4.9. StarIoExtManager

Always connect to the printer. Provides a real-time status acquisition function.

Important

Please use SM-S and SM-T series in Auto Power Down function “NO USE” setting (Default setting).

4.9.1. StarIoExtManagerType

Manager type constants.

  • Declaration

    public enum StarIoExtManagerType {
        Standard,
        WithBarcodeReader,
        OnlyBarcodeReader
    }
    
  • Constants

    Name Contents
    Standard Management of the printer and the cash drawer.
    WithBarcodeReader Management of the printer, cash drawer and the barcode reader.
    OnlyBarcodeReader Management of the barcode reader.

4.9.2. StarIoExtManagerPrinterStatus

Printer status constants.

  • Declaration

    public enum StarIoExtManagerPrinterStatus {
        Invalid,
        Impossible,
        Online,
        Offline
    }
    
  • Constants

    Name Contents
    Invalid Invalid.
    Impossible Impossible to use printer.
    Online Detect Printer online.
    Offline Detect Printer offline.

4.9.3. StarIoExtManagerPrinterPaperStatus

Printer paper status constants.

  • Declaration

    public enum StarIoExtManagerPrinterPaperStatus {
        Invalid,
        Impossible,
        Ready,
        NearEmpty,
        Empty
    }
    
  • Constants

    Name Contents
    Invalid Invalid.
    Impossible Impossible to use printer.
    Ready Detect Printer paper ready.
    NearEmpty Detect Printer paper near end.
    Empty Detect Printer paper empty.

4.9.4. StarIoExtManagerPrinterCoverStatus

Printer cover status constants.

  • Declaration

    public enum StarIoExtManagerPrinterCoverStatus {
        Invalid,
        Impossible,
        Open,
        Close
    }
    
  • Constants

    Name Contents
    Invalid Invalid.
    Impossible Impossible to use printer.
    Open Detect Printer cover open.
    Close Detect Printer cover close.

4.9.5. StarIoExtManagerCashDrawerStatus

Cash drawer status constants.

  • Declaration

    public enum StarIoExtManagerCashDrawerStatus {
        Invalid,
        Impossible,
        Open,
        Close
    }
    
  • Constants

    Name Contents
    Invalid Invalid.
    Impossible Impossible to use Cash drawer.
    Open Detect Cash drawer open.
    Close Detect Cash drawer close.

4.9.6. StarIoExtManagerBarcodeReaderStatus

Barcode reader status constants.

  • Declaration

    public enum StarIoExtManagerBarcodeReaderStatus {
        Invalid,
        Impossible,
        Connect,
        Disconnect
    }
    
  • Constants

    Name Contents
    Invalid Invalid.
    Impossible Impossible to use Barcode reader.
    Connect Detect Barcode reader connection.
    Disconnect Detect Barcode reader disconnection.

4.9.7. Port

Port object.

  • Declaration

    public Port Port { get; }
    

4.9.8. PrinterOnlineStatus

Printer Online status.

  • Declaration

    public StarIoExtManagerPrinterStatus PrinterOnlineStatus { get; }
    

4.9.9. PrinterPaperStatus

Printer paper status.

  • Declaration

    public StarIoExtManagerPrinterPaperStatus PrinterPaperStatus { get; }
    

4.9.10. PrinterCoverStatus

Printer cover status.

  • Declaration

    public StarIoExtManagerPrinterCoverStatus PrinterCoverStatus { get; }
    

4.9.11. CashDrawerStatus

Gets the cash drawer status.

  • Declaration

    public StarIoExtManagerCashDrawerStatus CashDrawerStatus { get; }
    

4.9.12. BarcodeReaderStatus

Barcode reader status.

  • Declaration

    public StarIoExtManagerBarcodeReaderStatus BarcodeReaderStatus { get; }
    

4.9.13. CashDrawerOpenActiveHigh

Mode of cash drawer open sensor active.

  • Declaration

    public bool CashDrawerOpenActiveHigh { get; set; }
    

4.9.14. StarIoExtManager

Initializes the StarIoExtManager .

  • Declaration

    public StarIoExtManager(StarIoExtManagerType type, string portName, string portSettings, Int32 timeout)
    
  • Parameter

    Name Contents Type
    type Manager type StarIoExtManagerType
    portName It is the same as the portName of the ConnectAsync method. string
    portSettings It is the same as the portSetting of the ConnectAsync method. string
    ioTimeoutMillis Acquires and specifies the timeout time for internal control and API (unit: millisecond) uint
  • Return value

    Contents Type
    StarIoExtManager object StarIoExtManager
  • Examples

    StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    

    Refer to PrinterExtSamplePage.xaml.cs/ CashDrawerExtSamplePage.xaml.cs/ BarcodeReaderSamplePage.xaml.cs/ CombinationExtSamplePage.xaml.cs.

4.9.15. ConnectAsync

Management start.

  • Declaration

    public IAsyncOperation<bool> ConnectAsync()
    
  • Parameter

    None

  • Return value

    Contents Type
    Result
    true … Success
    false … Failure
    bool
  • Error code

    Value Contents Library version
    StarResultCode.ErrorFailed Some kind of error occurred 1.7.0+
    StarResultCode.ErrorInUse Connection was refused by the printer (another host is connected or other reason) 1.7.0+
    StarResultCode.ErrorInProcess Connection process is already in progress. 1.7.0+
  • Examples

    StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
    await starIoExtManager.ConnectAsync();
    

    Refer to PrinterExtSamplePage.xaml.cs/ CashDrawerExtSamplePage.xaml.cs/ BarcodeReaderSamplePage.xaml.cs/ CombinationExtSamplePage.xaml.cs.

4.9.16. DisconnectAsync

Management stop.

  • Declaration

    public IAsyncOperation<bool> DisconnectAsync()
    
  • Parameter

    None

  • Return value

    Contents Type
    Result
    true … Success
    false … Failure
    bool
  • Examples

    StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
    await starIoExtManager.ConnectAsync();
    
    if (starIoExtManager != null)
    {
        await starIoExtManager.DisconnectAsync();
        starIoExtManager = null;
    }
    

    Refer to PrinterExtSamplePage.xaml.cs/ CashDrawerExtSamplePage.xaml.cs/ BarcodeReaderSamplePage.xaml.cs/ CombinationExtSamplePage.xaml.cs.

4.9.17. LockAsync

Obtains exclusive access to communication on the Port property.

  • Declaration

    public IAsyncOperation<IDisposable> LockAsync()
    
  • Parameter

    None

  • Return value

    Contents Type
    IDisposable object IDisposable

4.9.18. PrinterImpossibleEvent

Tells the printer impossible.

  • Declaration

    public event EventHandler<Object> PrinterImpossibleEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.PrinterImpossibleEvent += starIoExtManager_PrinterImpossibleEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_PrinterImpossibleEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.19. PrinterOnlineEvent

Tells the printer has come online.

  • Declaration

    public event EventHandler<Object> PrinterOnlineEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.PrinterOnlineEvent += starIoExtManager_PrinterOnlineEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_PrinterOnlineEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.20. PrinterOfflineEvent

Tells the printer has come offline.

  • Declaration

    public event EventHandler<Object> PrinterOfflineEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.PrinterOfflineEvent += starIoExtManager_PrinterOfflineEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_PrinterOfflineEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.21. PrinterPaperReadyEvent

Tells the printer has come paper ready.

  • Declaration

    public event EventHandler<Object> PrinterPaperReadyEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.PrinterPaperReadyEvent += starIoExtManager_PrinterPaperReadyEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_PrinterPaperReadyEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.22. PrinterPaperNearEmptyEvent

Tells the printer has come paper near end.

  • Declaration

    public event EventHandler<Object> PrinterPaperNearEmptyEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.PrinterPaperNearEmptyEvent += starIoExtManager_PrinterPaperNearEmptyEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_PrinterPaperNearEmptyEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.23. PrinterPaperEmptyEvent

Tells the printer has come paper empty.

  • Declaration

    public event EventHandler<Object> PrinterPaperEmptyEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.PrinterPaperNearEmptyEvent += starIoExtManager_PrinterPaperNearEmptyEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_PrinterPaperNearEmptyEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.24. PrinterCoverOpenEvent

Tells the printer has come cover open.

  • Declaration

    public event EventHandler<Object> PrinterCoverOpenEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.PrinterCoverOpenEvent += starIoExtManager_PrinterCoverOpenEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_PrinterCoverOpenEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.25. PrinterCoverCloseEvent

Tells the printer has come cover close.

  • Declaration

    public event EventHandler<Object> PrinterCoverCloseEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.PrinterCoverCloseEvent += starIoExtManager_PrinterCoverCloseEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_PrinterCoverCloseEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.26. CashDrawerOpenEvent

Tells the delegate the cash drawer has come open.

  • Declaration

    public event EventHandler<Object> CashDrawerOpenEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.CashDrawerOpenEvent += starIoExtManager_CashDrawerOpenEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_CashDrawerOpenEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.27. CashDrawerCloseEvent

Tells the delegate the cash drawer has come close.

  • Declaration

    public event EventHandler<Object> CashDrawerCloseEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.CashDrawerCloseEvent += starIoExtManager_CashDrawerCloseEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_CashDrawerCloseEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.28. BarcodeReaderImpossibleEvent

Tells the delegate the barcode reader impossible.

  • Declaration

    public event EventHandler<Object> BarcodeReaderImpossibleEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.BarcodeReaderImpossibleEvent += starIoExtManager_BarcodeReaderImpossibleEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_BarcodeReaderImpossibleEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.29. BarcodeReaderConnectEvent

Tells the delegate the barcode reader connected.

  • Declaration

    public event EventHandler<Object> BarcodeReaderConnectEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.BarcodeReaderConnectEvent += starIoExtManager_BarcodeReaderConnectEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_BarcodeReaderConnectEvent(object sender, object e) {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.30. BarcodeReaderDisconnectEvent

Tells the delegate the barcode reader disconnected.

  • Declaration

    public event EventHandler<Object> BarcodeReaderDisconnectEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.BarcodeReaderDisconnectEvent += starIoExtManager_BarcodeReaderDisconnectEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_BarcodeReaderDisconnectEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.31. BarcodeDataReceivedEvent

Tells the delegate the barcode data received.

  • Declaration

    public event EventHandler<Object> BarcodeDataReceivedEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
        starIoExtManager.BarcodeDataReceivedEvent += starIoExtManager_BarcodeDataReceivedEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_BarcodeDataReceivedEvent(object sender, object e)
    {
        // barcode data, byte [] type is stored in parameter e.
        // type cast as byte[] type and get barcode data.
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.32. AccessoryConnectSuccessEvent

Tells the listener the accessory connection succeeded from disconnection.

  • Declaration

    public event EventHandler<Object> AccessoryConnectSuccessEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.AccessoryConnectSuccessEvent += starIoExtManager_AccessoryConnectSuccessEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_AccessoryConnectSuccessEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.33. AccessoryConnectFailureEvent

Tells the listener the accessory connection failed from disconnection.

  • Declaration

    public event EventHandler<Object> AccessoryConnectFailureEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.AccessoryConnectFailureEvent += starIoExtManager_AccessoryConnectFailureEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_AccessoryConnectFailureEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.34. AccessoryDisconnectEvent

Tells the accessory disconnected.

  • Declaration

    public event EventHandler<Object> AccessoryDisconnectEvent;
    
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.AccessoryDisconnectEvent += starIoExtManager_AccessoryDisconnectEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_AccessoryDisconnectEvent(object sender, object e)
    {
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }
    

4.9.35. StatusUpdatedEvent

Tells the status updated.

  • Declaration

    public event EventHandler<Object> StatusUpdatedEvent;
    
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 or even no status change, every 5 min.
  • Examples

    async private void Button_Click(object sender, RoutedEventArgs e)
    {
        StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader, portName.ToString(), portSettings.ToString(), 10000);
    
        starIoExtManager.StatusUpdatedEvent += starIoExtManager_StatusUpdatedEvent;
        await starIoExtManager.ConnectAsync();
    }
    
    async void starIoExtManager_StatusUpdatedEvent(object sender, object e)
    {
        // Hexadecimal digit sequence of 3rd to 6th bytes in Automatic Status of string type (*) is stored in parameter e. (ex. "28000000")
        // Type cast as string type and get Automatic Status.
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            // UI thread Implementation
        });
    }