4.9. StarIoExtManagerDelegate

Provides status information about printers and peripherals

4.9.1. didConnectPort

added in version 1.11.0

Sends notice of connection success.

  • Declaration

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

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

    portName

    Printer port name

    NSString *

  • Return value

    None

  • Examples

    - (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;
    }
    

    Refer to PrinterExtWithConnectAsyncViewController.m.

4.9.2. didFailToConnectPort

added in version 1.11.0

Sends notice of connection failure.

  • Declaration

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

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

    portName

    Printer port name

    NSString *

    error

    Connection failure error information
    An error code is set in the code property.

    NSError *

  • Error code

    Value

    Contents

    SMResultCodeFailed

    Some kind of error occurred.

    SMResultCodeInUse

    Connection was refused by the printer (another host is connected or other reason).

    SMResultCodeInProcess

    Connection process is already in progress.

  • Return value

    None

  • Examples

    - (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;
    }
    

    Refer to PrinterExtWithConnectAsyncViewController.m.

4.9.3. didPrinterImpossible

Tells the printer impossible.

  • Declaration

    - (void)didPrinterImpossible;
    - (void)didPrinterImpossible:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to PrinterExtViewController.m, CashDrawerExtViewController.m and CombinationExtViewController.m.

4.9.4. didPrinterOnline

Tells the printer has come online.

  • Declaration

    - (void)didPrinterOnline;
    - (void)didPrinterOnline:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to PrinterExtViewController.m and CombinationExtViewController.m.

4.9.5. didPrinterOffline

Tells the printer has come offline.

  • Declaration

    - (void)didPrinterOffline;
    - (void)didPrinterOffline:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to PrinterExtViewController.m and CombinationExtViewController.m.

4.9.6. didPrinterPaperReady

Tells the printer has come paper ready.

  • Declaration

    - (void)didPrinterPaperReady;
    - (void)didPrinterPaperReady:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to PrinterExtViewController.m and CombinationExtViewController.m.

4.9.7. didPrinterPaperNearEmpty

Tells the printer has come paper near end.

  • Declaration

    - (void)didPrinterPaperNearEmpty;
    - (void)didPrinterPaperNearEmpty:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to PrinterExtViewController.m and CombinationExtViewController.m.

4.9.8. didPrinterPaperEmpty

Tells the printer has come paper empty.

  • Declaration

    - (void)didPrinterPaperEmpty;
    - (void)didPrinterPaperEmpty:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to PrinterExtViewController.m and CombinationExtViewController.m.

4.9.9. didPrinterCoverOpen

Tells the printer has come cover open.

  • Declaration

    - (void)didPrinterCoverOpen;
    - (void)didPrinterCoverOpen:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to PrinterExtViewController.m and CombinationExtViewController.m.

4.9.10. didPrinterCoverClose

Tells the printer has come cover close.

  • Declaration

    - (void)didPrinterCoverClose;
    - (void)didPrinterCoverClose:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to PrinterExtViewController.m and CombinationExtViewController.m.

4.9.11. didCashDrawerOpen

Tells the delegate the cash drawer has come open.

  • Declaration

    - (void)didCashDrawerOpen;
    - (void)didCashDrawerOpen:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to CashDrawerExtViewController.m and CombinationExtViewController.m.

4.9.12. didCashDrawerClose

Tells the delegate the cash drawer has come close.

  • Declaration

    - (void)didCashDrawerClose;
    - (void)didCashDrawerClose:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to CashDrawerExtViewController.m and CombinationExtViewController.m.

4.9.13. didBarcodeReaderImpossible

Tells the delegate the barcode reader impossible.

  • Declaration

    - (void)didBarcodeReaderImpossible;
    - (void)didBarcodeReaderImpossible:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to BarcodeReaderExtViewController.m and CombinationExtViewController.m.

4.9.14. didBarcodeReaderConnect

Tells the delegate the barcode reader connected.

  • Declaration

    - (void)didBarcodeReaderConnect;
    - (void)didBarcodeReaderConnect:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to BarcodeReaderExtViewController.m and CombinationExtViewController.m.

4.9.15. didBarcodeReaderDisconnect

Tells the delegate the barcode reader disconnected.

  • Declaration

    - (void)didBarcodeReaderDisconnect;
    - (void)didBarcodeReaderDisconnect:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to BarcodeReaderExtViewController.m and CombinationExtViewController.m.

4.9.16. didBarcodeDataReceive

Tells the delegate the barcode data received.

  • Declaration

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

    Name

    Contents

    Type

    data

    Received barcode data

    NSData *

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

    - (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:@""];
        }
        }
    }
    

    Refer to BarcodeReaderExtViewController.m and CombinationExtViewController.m.

4.9.17. didAccessoryConnectSuccess

Tells the listener the accessory connection succeeded from disconnection.

  • Declaration

    - (void)didAccessoryConnectSuccess;
    - (void)didAccessoryConnectSuccess:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to PrinterExtViewController.m, CashDrawerExtViewController.m, BarcodeReaderExtViewController.m and CombinationExtViewController.m.

4.9.18. didAccessoryConnectFailure

Tells the listener the accessory connection failed from disconnection.

  • Declaration

    - (void)didAccessoryConnectFailure;
    - (void)didAccessoryConnectFailure:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to PrinterExtViewController.m, CashDrawerExtViewController.m, BarcodeReaderExtViewController.m and CombinationExtViewController.m.

4.9.19. didAccessoryDisconnect

Tells the accessory disconnected.

  • Declaration

    - (void)didAccessoryDisconnect;
    - (void)didAccessoryDisconnect:(StarIoExtManager *)manager;
    
  • Parameter

    Name

    Contents

    Type

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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

    Refer to PrinterExtViewController.m, CashDrawerExtViewController.m, BarcodeReaderExtViewController.m and CombinationExtViewController.m.

4.9.20. didStatusUpdate

Tells the status updated.

  • Declaration

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

    Name

    Contents

    Type

    status

    Updated status
    Hexdecimal digit sequence of 3rd to 6th bytes in Automatic Status. (ex. “28000000”)
    Please refer to STAR Line Mode and StarPRNT command manual for details of Automatic Status.

    Status update timing
    * When the status changes
    * Even no status change, every 5 min

    NSString *

    manager

    A StarIoExtManager object informing the delegate

    StarIoExtManager

  • Return value

    None

  • Examples

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