4.9. StarIoExtManagerDelegate

プリンターや周辺機器のステータス情報を通知します。

4.9.1. didConnectPort

added in version 1.11.0

接続成功を通知します。

  • 宣言

    - (void)manager:(nonnull StarIoExtManager *)manager didConnectPort:(nonnull NSString *)portName;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

    portName

    プリンターポート名

    NSString *

  • 戻り値

    なし

  • 実装例

    - (void)manager:(StarIoExtManager *)manager didConnectPort:(NSString *)portName {
    if ((self.didAppear == NO) && (self.starIoExtManager.port != nil)) {
        [self.printButton sendActionsForControlEvents:UIControlEventTouchUpInside];
    } else {
        self.blind = NO;
    }
    
    self.didAppear = YES;
    }
    

    PrinterExtWithConnectAsyncViewController.m を参照ください。

4.9.2. didFailToConnectPort

added in version 1.11.0

接続失敗を通知します。

  • 宣言

    - (void)manager:(nonnull StarIoExtManager *)manager didFailToConnectPort:(nonnull NSString *)portName error:(nullable NSError *)error;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

    portName

    プリンターポート名

    NSString *

    error

    接続失敗のエラー情報
    codeプロパティにエラーコードがセットされています。

    NSError *

  • エラーコード

    説明

    SMResultCodeFailed

    何らかのエラーが発生した

    SMResultCodeInUse

    プリンターから接続拒否された(他ホストが接続中など)

    SMResultCodeInProcess

    既に接続処理を実行中

  • 戻り値

    なし

  • 実装例

    - (void)manager:(StarIoExtManager *)manager didFailToConnectPort:(NSString *)portName error:(NSError *)error {
    if (error != nil) {
        [self showSimpleAlertWithTitle:@"Communication Result"
                                message:[Communication getCommunicationResultMessage:[[CommunicationResult alloc] initWithResult:CommResultErrorOpenPort code:error.code]]
                            buttonTitle:@"OK"
                            buttonStyle:UIAlertActionStyleCancel
                            completion:^(UIAlertController *alertController) {
            self.commentLabel.text = [NSString stringWithFormat:@"%@\n"
                                    "\n"
                                    "Check the device. (Power and Bluetooth pairing)\n"
                                    "Then touch up the Refresh button.\n", error.localizedDescription];
    
            self.commentLabel.textColor = UIColor.redColor;
    
    
    
            self.blind = NO;
        }];
    }
    
    self.didAppear = YES;
    }
    

    PrinterExtWithConnectAsyncViewController.m を参照ください。

4.9.3. didPrinterImpossible

プリンター使用不能を通知します。

  • 宣言

    - (void)didPrinterImpossible;
    - (void)didPrinterImpossible:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didPrinterImpossible:(StarIoExtManager *)manager {
        _commentLabel.text = @"Printer Impossible.";
    
        _commentLabel.textColor = [UIColor redColor];
    }
    

    PrinterExtViewController.m / CashDrawerExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.4. didPrinterOnline

プリンターオンラインを通知します。

  • 宣言

    - (void)didPrinterOnline;
    - (void)didPrinterOnline:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didPrinterOnline:(StarIoExtManager *)manager {
        _commentLabel.text = @"Printer Online.";
    
        _commentLabel.textColor = [UIColor blueColor];
    }
    

    PrinterExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.5. didPrinterOffline

プリンターオフラインを通知します。

  • 宣言

    - (void)didPrinterOffline;
    - (void)didPrinterOffline:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didPrinterOffline:(StarIoExtManager *)manager {
        _commentLabel.text = @"Printer Offline.";
    
        _commentLabel.textColor = [UIColor redColor];
    }
    

    PrinterExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.6. didPrinterPaperReady

プリンター用紙レディを通知します。

  • 宣言

    - (void)didPrinterPaperReady;
    - (void)didPrinterPaperReady:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didPrinterPaperReady:(StarIoExtManager *)manager {
        _commentLabel.text = @"Printer Paper Ready.";
    
        _commentLabel.textColor = [UIColor blueColor];
    }
    

    PrinterExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.7. didPrinterPaperNearEmpty

プリンター用紙ニアエンプティを通知します。

  • 宣言

    - (void)didPrinterPaperNearEmpty;
    - (void)didPrinterPaperNearEmpty:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didPrinterPaperNearEmpty:(StarIoExtManager *)manager {
        _commentLabel.text = @"Printer Paper Near Empty.";
    
        _commentLabel.textColor = [UIColor orangeColor];
    }
    

    PrinterExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.8. didPrinterPaperEmpty

プリンター用紙エンプティを通知します。

  • 宣言

    - (void)didPrinterPaperEmpty;
    - (void)didPrinterPaperEmpty:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didPrinterPaperEmpty:(StarIoExtManager *)manager {
        _commentLabel.text = @"Printer Paper Empty.";
    
        _commentLabel.textColor = [UIColor redColor];
    }
    

    PrinterExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.9. didPrinterCoverOpen

プリンターカバーオープンを通知します。

  • 宣言

    - (void)didPrinterCoverOpen;
    - (void)didPrinterCoverOpen:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didPrinterCoverOpen:(StarIoExtManager *)manager {
        _commentLabel.text = @"Printer Cover Open.";
    
        _commentLabel.textColor = [UIColor redColor];
    }
    

    PrinterExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.10. didPrinterCoverClose

プリンターカバークローズを通知します。

  • 宣言

    - (void)didPrinterCoverClose;
    - (void)didPrinterCoverClose:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    func didPrinterCoverClose(_ manager: StarIoExtManager!) {
        self.commentLabel.text = "Printer Cover Close."
    
        self.commentLabel.textColor = UIColor.blue
    }
    

    PrinterExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.11. didCashDrawerOpen

キャッシュドロアーオープンを通知します。

  • 宣言

    - (void)didCashDrawerOpen;
    - (void)didCashDrawerOpen:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didCashDrawerOpen:(StarIoExtManager *)manager {
        _commentLabel.text = @"Cash Drawer Open.";
    
        _commentLabel.textColor = [UIColor magentaColor];
    }
    

    CashDrawerExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.12. didCashDrawerClose

キャッシュドロアークローズを通知します。

  • 宣言

    - (void)didCashDrawerClose;
    - (void)didCashDrawerClose:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didCashDrawerClose:(StarIoExtManager *)manager {
        _commentLabel.text = @"Cash Drawer Close.";
    
        _commentLabel.textColor = [UIColor blueColor];
    }
    

    CashDrawerExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.13. didBarcodeReaderImpossible

バーコードリーダー使用不能を通知します。

  • 宣言

    - (void)didBarcodeReaderImpossible;
    - (void)didBarcodeReaderImpossible:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didBarcodeReaderImpossible:(StarIoExtManager *)manager {
        _commentLabel.text = @"Barcode Reader Impossible.";
    
        _commentLabel.textColor = [UIColor redColor];
    }
    

    BarcodeReaderExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.14. didBarcodeReaderConnect

バーコードリーダー接続を通知します。

  • 宣言

    - (void)didBarcodeReaderConnect;
    - (void)didBarcodeReaderConnect:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didBarcodeReaderConnect:(StarIoExtManager *)manager {
        _commentLabel.text = @"Barcode Reader Connect.";
    
        _commentLabel.textColor = [UIColor blueColor];
    }
    

    BarcodeReaderExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.15. didBarcodeReaderDisconnect

バーコードリーダー切断を通知します。

  • 宣言

    - (void)didBarcodeReaderDisconnect;
    - (void)didBarcodeReaderDisconnect:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didBarcodeReaderDisconnect:(StarIoExtManager *)manager {
        _commentLabel.text = @"Barcode Reader Disconnect.";
    
        _commentLabel.textColor = [UIColor redColor];
    }
    

    BarcodeReaderExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.16. didBarcodeDataReceive

バーコードデータ受信を通知します。

  • 宣言

    - (void)didBarcodeDataReceive:(NSData *)data;
    - (void)didBarcodeDataReceive:(StarIoExtManager *)manager data:(NSData *)data;
    
  • 引数

    名称

    説明

    data

    受信したバーコードデータ

    NSData *

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didBarcodeDataReceive:(StarIoExtManager *)manager data:(NSData *)data {
        NSMutableString *text = [NSMutableString stringWithString:@""];
    
        const uint8_t *p = [data bytes];
    
        for (int i = 0; i < data.length; i++) {
        uint8_t ch = *(p + i);
    
        if(ch >= 0x20 && ch <= 0x7f) {
            [text appendFormat:@"%c", (char) ch];
        }
        else if (ch == 0x0d) {
            ...
    
            text = [NSMutableString stringWithString:@""];
        }
        }
    }
    

    BarcodeReaderExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.17. didAccessoryConnectSuccess

アクセサリー切断状態でのアクセサリー再接続成功を通知します。

  • 宣言

    - (void)didAccessoryConnectSuccess;
    - (void)didAccessoryConnectSuccess:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didAccessoryConnectSuccess:(StarIoExtManager *)manager {
        _commentLabel.text = @"Accessory Connect Success.";
    
        _commentLabel.textColor = [UIColor blueColor];
    }
    

    PrinterExtViewController.m / CashDrawerExtViewController.m / BarcodeReaderExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.18. didAccessoryConnectFailure

アクセサリー切断状態でのアクセサリー再接続失敗を通知します。

  • 宣言

    - (void)didAccessoryConnectFailure;
    - (void)didAccessoryConnectFailure:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didAccessoryConnectFailure:(StarIoExtManager *)manager {
        _commentLabel.text = @"Accessory Connect Failure.";
    
        _commentLabel.textColor = [UIColor redColor];
    }
    

    PrinterExtViewController.m / CashDrawerExtViewController.m / BarcodeReaderExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.19. didAccessoryDisconnect

アクセサリー切断を通知します。

  • 宣言

    - (void)didAccessoryDisconnect;
    - (void)didAccessoryDisconnect:(StarIoExtManager *)manager;
    
  • 引数

    名称

    説明

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didAccessoryDisconnect:(StarIoExtManager *)manager {
        _commentLabel.text = @"Accessory Disconnect.";
    
        _commentLabel.textColor = [UIColor redColor];
    }
    

    PrinterExtViewController.m / CashDrawerExtViewController.m / BarcodeReaderExtViewController.m / CombinationExtViewController.m を参照ください。

4.9.20. didStatusUpdate

ステータスアップデートを通知します。

  • 宣言

    - (void)didStatusUpdate:(NSString *)status;
    - (void)didStatusUpdate:(StarIoExtManager *)manager status:(NSString *)status;
    
  • 引数

    名称

    説明

    status

    アップデートステータス
    自動ステータスの3バイト目から6バイト目までを16進数で表した文字列です(例:"28000000")。
    自動ステータスにつきましては、StarLineコマンド仕様書、もしくはStarPRNTコマンド仕様書を参照ください。

    ステータス通知タイミング
    * ステータス変化時
    * ステータス未変化状態では5分ごと

    NSString *

    manager

    呼び出し元の StarIoExtManager オブジェクト

    StarIoExtManager

  • 戻り値

    なし

  • 実装例

    - (void)didStatusUpdate:(StarIoExtManager *)manager status:(NSString *)status {
        _commentLabel.text = status;
    
        _commentLabel.textColor = [UIColor greenColor];
    }