Starmicronics C# API

download Starmicronics C# API

of 91

Transcript of Starmicronics C# API

  • 8/18/2019 Starmicronics C# API

    1/91

    © 2016Star Micronics. All rights reserved.

    StarIO SDK for Windows Store Apps

    User’s Manual(C#)

    Summary

    This manual is for StarIO SDK for Windows Store Apps and the guideline to construct printingapplication is included for Windows store application developers.

  • 8/18/2019 Starmicronics C# API

    2/91

    2 / 90 © 2016 Star Micronics. All rights reserved.

    History of documentDate ContentsFeb. 26, 2016 First release

  • 8/18/2019 Starmicronics C# API

    3/91

    3 / 90 © 2016 Star Micronics. All rights reserved.

    About this Manual

    This paper provides information about the StarIO SDK for Windows Store Apps.

    It is important to understand the basics of the Visual C# language.

    Although this SDK is for Android, there are SDKs available for many different operating systems andprogramming languages at our website in the Developers section. Check the Developers section ofour site for the newest SDKs, technical documentation, FAQs, and many more additional resources.

    CAUTION

    The information in this manual is subject to change without notice.

    STAR MICRONICS CO., LTD. has taken every measure to provide accurate information, butassumes no liability for errors or omissions.

    STAR MICRONICS CO., LTD. is not liable for any damages resulting from the use of informationcontained in this manual.

    Reproduction in whole or in part is prohibited.

    http://www.starmicronics.com/support/http://www.starmicronics.com/support/http://www.starmicronics.com/support/http://www.starmicronics.com/support/

  • 8/18/2019 Starmicronics C# API

    4/91

    4 / 90 © 2016 Star Micronics. All rights reserved.

    Content1 Introduction .......................................................................................................................................... 6

    1.1 List.................................................................................................................................................. 6 1.2 Operating System .......................................................................................................................... 6

    1.3 Interface ........................................................................................................................................ 6 1.4 Printer, Emulation ......................................................................................................................... 6 2 Hands-On .............................................................................................................................................. 8

    2.1 Make work solution ....................................................................................................................... 8 2.2 Add StarIOPort / StarIO_Extension runtime component ............................................................10 2.3 Make Hands-On application 1 .....................................................................................................13 2.4 Make Hands-On application 2 .....................................................................................................25 2.5 Verify Printer Status and Monitor the Completion of Printing ...................................................39

    3 API reference ......................................................................................................................................43 3.1 Port class ......................................................................................................................................43

    3.1.1 Port constructor ..................................................................................................................43

    3.1.2

    ConnectAsync method ........................................................................................................44

    3.1.3 WriteAsync method .............................................................................................................45 3.1.4 ReadAsync method ..............................................................................................................45 3.1.5 GetParsedStatusAsync method ..........................................................................................46 3.1.6 BeginCheckedBlockAsync method......................................................................................46 3.1.7 EndCheckedBlockAsync method ........................................................................................47 3.1.8 GetOnlineStatusAsync method ..........................................................................................47 3.1.9 Close method .......................................................................................................................48

    3.2 ProductId Enumeration ...............................................................................................................49 3.3 ProductInformation class ............................................................................................................50

    3.3.1 FindAllAsync method ...........................................................................................................50 3.4 ProductInformationCollection class ............................................................................................51 3.5 Status class ..................................................................................................................................52 3.6 Util class .......................................................................................................................................55

    3.6.1 GetStarIOVersion method ...................................................................................................55 3.7 PrinterInterfaceType enumeration .............................................................................................56 3.8 StarIoExtManager class ...............................................................................................................57

    3.8.1 StarIoExtManager constructor ............................................................................................58 3.8.2 connectAsync method .........................................................................................................59 3.8.3 disconnectAsync method ....................................................................................................60 3.8.4 LockAsync method ...............................................................................................................61 3.8.5 Port property .......................................................................................................................61 3.8.6 printerOnlineStatus property ..............................................................................................62 3.8.7 printerPaperReadyStatus property .....................................................................................62 3.8.8 printerCoverOpenStatus property ......................................................................................62 3.8.9 cashDrawerOpenStatus property ........................................................................................63 3.8.10 barcodeReaderConnectStatus property ..............................................................................63 3.8.11 cashDrawerOpenActiveHigh property.................................................................................63 3.8.12 PrinterImpossibleEvent event .............................................................................................64 3.8.13 PrinterOnlineEvent event ....................................................................................................65 3.8.14 PrinterOfflineEvent event ....................................................................................................66 3.8.15 PrinterPaperReadyEvent event ...........................................................................................67 3.8.16 PrinterPaperNearEmptyEvent event ...................................................................................68 3.8.17 PrinterPaperEmptyEvent event ...........................................................................................69 3.8.18 PrinterCoverOpenEvent event ............................................................................................70 3.8.19 PrinterCoverClosedEvent event ..........................................................................................71

  • 8/18/2019 Starmicronics C# API

    5/91

    5 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.20 CashDrawerOpenEvent event .............................................................................................72 3.8.21 CashDrawerCloseEvent event .............................................................................................73 3.8.22 BarcodeReaderImpossibleEvent event................................................................................74 3.8.23 BarcodeReaderConnectEvent event....................................................................................75 3.8.24 BarcodeReaderDisconnectEvent event ...............................................................................76 3.8.25 BarcodeDataReceivedEvent event ......................................................................................77 3.8.26 AccessoryConnectSuccessEvent event ................................................................................78 3.8.27 AccessoryConnectFailureEvent event .................................................................................79 3.8.28 AccessoryDisconnectEvent event ........................................................................................80

    3.9 StarIoExtManagerType enumeration ..........................................................................................81 3.10 StarIoExtManagerStatus enumeration ........................................................................................82 3.11 SCBFactory class ..........................................................................................................................83

    3.11.1 createBuilder method..........................................................................................................83 3.12 ISCBBulider interface ...................................................................................................................84

    3.12.1 beginDocument method .....................................................................................................84 3.12.2 endDocument method ........................................................................................................85

    3.12.3 appendCutPaper method ....................................................................................................86 3.12.4 appendPeripheral method ..................................................................................................87 3.12.5 appendBitmapAsync method ..............................................................................................88 3.12.6 getBuffer method ................................................................................................................89

    3.13 Emulation enumeration...............................................................................................................90 3.14 SCBBitmapConverterRotation enumeration ...............................................................................90 3.15 SCBCutPaperAction enumeration ...............................................................................................90 3.16 SCBPeripheralChannel enumeration ...........................................................................................90

  • 8/18/2019 Starmicronics C# API

    6/91

    6 / 90 © 2016 Star Micronics. All rights reserved.

    1 IntroductionExplain the usage of [StarIOPort runtime component] which makes development of Windows storeapplication with printers easier with the form of Hands-On.

    1.1 ListName Description Sample folder The folder with reference project for Windows store application

    WindowsStarIO The folder with runtime componentStarIOPortHandsOn_CS folder The folder with all Hands-On work resultUsersManual _CS_En.docx StarIO SDK for Windows Store Apps user’s manual(C#))(English)UsersManual _CS_Jp.docx StarIO SDK for Windows Store Apps user’s manual(C#))(Japanese)readme.txt Readme file (English)readme_Jp.txt Readme file (Japanese)SoftwareLicenseAgreement.pdf Software end-user license agreements (English)SoftwareLicenseAgreement_Jp.pdf Software end-user license agreements (Japanese)

    1.2 Operating SystemOS Description Windows8.1 x86/x64Windows10 x86/x64 (except Windows IO IoT Core)

    1.3 InterfaceInterfaceBluetoothLAN

    1.4 Printer, EmulationPrinter F/W Version EmulationPOS Printer TSP650II V1.0 or later StarLine Emulation

    TSP700II V5.0 or later

    TSP800II V2.0 or laterFVP10 V2.0 or laterTSP100LAN V2.0 or later Star Graphic EmulationTSP100IIILAN V1.0 or laterTSP100IIIWLAN V1.0 or latermPOP V1.0 or later StarPRNT Emulation

    Mobile Printer SM-S210i V3.0 or laterSM-S220i V3.0 or laterSM-S230i V1.0 or laterSM-T300i V3.0 or laterSM-T400i V3.0 or laterSM-L200 V1.0 or later

  • 8/18/2019 Starmicronics C# API

    7/91

    7 / 90 © 2016 Star Micronics. All rights reserved.

    Portable Printer

    When using StarPRNT emulation:

    To use the StarPRNT emulation, set the emulation setting of the printer to “StarPRNT Mode”. To

    change the emulation, proceed as follows. (For SM-L200, it does not need to switch the emulation.)

    ◆ Switching over between StarPRNT and ESC/POS emulation

    1. Turn the printer power and open the printer cover.

    2. Press and hold the POWER button and the FEED button simultaneously. As soon as the ERROR lampflashes five times, release the buttons. The emulation switchover takes place automatically.

    3. After setting a paper, close the printer cover. The set emulation is printed out.ESC/POS : EMU = ESC/POS ModeStarPRNT : EMU = StarPRNT Mode

    If the emulation is not switched correctly, repeat the above steps 1 to 3.At that time, in step 2, make sure not to release the buttons until the lamp completes the 5th flash.

    4. Please reboot the printer after switching the emulation. *It will be valid after rebooting the printer.

    Network InterfaceAssign an IP Address to the Star Printer and connect it to the network. Star Printers do not ship with an IPAddress pre-assigned; this can set by a DHCP network.

    Use Star POS Printers with the #9100 Multi Session disabled. The setting can be confirmed by Test Printwhich can be executed by holding down the printer's feed button while turning the printer on.

    Refer to "guidelines-ethernet_en.pdf” for how to confirm and change the #9100 Multi Session setting andhow to set the Static IP Address.

    TSP100IIIWConnecting Tablet/PCSee the Online manual (Setup - Connect Tablet/PC) .

    http://www.star-m.jp/prjump/000059.htmlhttp://www.star-m.jp/prjump/000059.htmlhttp://www.star-m.jp/prjump/000059.htmlhttp://www.star-m.jp/prjump/000059.html

  • 8/18/2019 Starmicronics C# API

    8/91

    8 / 90 © 2016 Star Micronics. All rights reserved.

    2 Hands-On

    2.1 Make work solutionMake work solution for Hands-On.

    Step1. Start [Visual studio 2013]

  • 8/18/2019 Starmicronics C# API

    9/91

    9 / 90 © 2016 Star Micronics. All rights reserved.

    Step2. Go to [Templates]-[Other Project Types]-[Visual Studio Solutions]-[Blank Solution] from [Make newproject] and make work solution with any name. (example: [StarIOPortHandsOn])

  • 8/18/2019 Starmicronics C# API

    10/91

    10 / 90 © 2016 Star Micronics. All rights reserved.

    2.2 Add StarIOPort / StarIO_Extension runtime componentThe version management of StarIOPort/StarIO_Extension runtime component which is sharedby project in one solution is easily done by addition of created StarIOPort/StarIO_Extensionruntime component to work solution.

    Besides, peculiar version management for certain solution separated from other solution’sStarIOPort/StarIO_Extension runtime component is possible.

    Step1. Open the [Empty Solution] folder with reference of Explorer, and copy StarIOPort folder to it.

  • 8/18/2019 Starmicronics C# API

    11/91

    11 / 90 © 2016 Star Micronics. All rights reserved.

    Step2. Add StarIOPort runtime component [StarIOPort.winmd] and StarIO_Extension runtime component[StarIO_Extension.winmd] to solution by [Current Solution Item Addition].

  • 8/18/2019 Starmicronics C# API

    12/91

    12 / 90 © 2016 Star Micronics. All rights reserved.

    Step3. The following construction will be built by StarIOPort/StarIO_Extension runtime componentaddition.

  • 8/18/2019 Starmicronics C# API

    13/91

    13 / 90 © 2016 Star Micronics. All rights reserved.

    2.3 Make Hands-On application 1Make application with StarIOPort runtime component.

    Step1. Go to [Visual C#]-[Store Apps]-[Windows Apps]-[Blank App(Windows)] from [New Project Addition],and add Hands-On application with any name(example : [App1]).

  • 8/18/2019 Starmicronics C# API

    14/91

    14 / 90 © 2016 Star Micronics. All rights reserved.

    Step2. The following construction will be built by Hands-On application addition.

  • 8/18/2019 Starmicronics C# API

    15/91

    15 / 90 © 2016 Star Micronics. All rights reserved.

    Step3. Add StarIOPort/StarIO_Extension runtime component in solution to project reference setting from[Reference Addition]

  • 8/18/2019 Starmicronics C# API

    16/91

    16 / 90 © 2016 Star Micronics. All rights reserved.

    Step4. The following solution construction will be built by addition of StarIOPort/StarIO_Extension runtimecomponent to reference setting.

  • 8/18/2019 Starmicronics C# API

    17/91

    17 / 90 © 2016 Star Micronics. All rights reserved.

    Step5. Open [Package.appxmanifest] in project with the form of code.

  • 8/18/2019 Starmicronics C# API

    18/91

    18 / 90 © 2016 Star Micronics. All rights reserved.

    Step6. Allow to use printer with Hands-On application 1 by addition of the following description to[Package.appxmanifest].

  • 8/18/2019 Starmicronics C# API

    19/91

    19 / 90 © 2016 Star Micronics. All rights reserved.

    Step7. Open [MainPage.xaml] and arrange [Button] from Tool Box with any location and any size.

  • 8/18/2019 Starmicronics C# API

    20/91

    20 / 90 © 2016 Star Micronics. All rights reserved.

    Step8. Double-click arrange [Button] and [Button_click] method will be created in [MainPage.xaml.cs].

  • 8/18/2019 Starmicronics C# API

    21/91

    21 / 90 © 2016 Star Micronics. All rights reserved.

    Step9. Confirm printer’s name.

  • 8/18/2019 Starmicronics C# API

    22/91

    22 / 90 © 2016 Star Micronics. All rights reserved.

    Step10. Add the following description to created [Button_click] method.

    try{

    Windows.Storage.Streams.IBuffer buffer =System.Text.Encoding.GetEncoding("Shift_JIS").GetBytes("Hello Windows8.1\n").AsBuffer();

    using (StarIOPort.Port port = new StarIOPort.Port()){

    await port.ConnectAsync(" BT:Star Micronics"," ");

    await port.WriteAsync(buffer);}

    }catch{}

  • 8/18/2019 Starmicronics C# API

    23/91

    23 / 90 © 2016 Star Micronics. All rights reserved.

    Step11. Define [Button_click] method as a asynchronous method (keyword : async).

  • 8/18/2019 Starmicronics C# API

    24/91

    24 / 90 © 2016 Star Micronics. All rights reserved.

    Step12. Execute Hands-On application 1.

    Step13. The following will be come up when [Button] is tapped only first time. If “Allow” button is selected,

    [Hello Windows 8,1] will be printed.

  • 8/18/2019 Starmicronics C# API

    25/91

    25 / 90 © 2016 Star Micronics. All rights reserved.

    2.4 Make Hands-On application 2 Make an application which can be printed with selecting the printer from a list enumerated byStarIOPort runtime component.

    Step1. Go to "[Visual C#] -[Windows Store]-[New application(XAML)] from [Add a new project], then addHands-On application2 with any name.

    Step2.

    Do the same work as step3 - step6 of making 2.3 Hands-On application 1.

    - Add the StarIOPort runtime component to project reference setting.

    - Allow to use the printer with Hands-On application 2.

  • 8/18/2019 Starmicronics C# API

    26/91

    26 / 90 © 2016 Star Micronics. All rights reserved.

    Step3. Open [MainPage.xaml], and arrange [ListBox] with any location and any size.

  • 8/18/2019 Starmicronics C# API

    27/91

    27 / 90 © 2016 Star Micronics. All rights reserved.

    Step4. Add the following description to source code of [MainPage.xaml].

  • 8/18/2019 Starmicronics C# API

    28/91

    28 / 90 © 2016 Star Micronics. All rights reserved.

    Step5. Name [ProductListBox] from name of arranged [ListBox].

  • 8/18/2019 Starmicronics C# API

    29/91

    29 / 90 © 2016 Star Micronics. All rights reserved.

    Step6. Add the following description regarding ItemSource to [ListBox] code in [MainPage.xaml].

    ItemsSource="{Binding Source={StaticResource ProductListSource}}"

  • 8/18/2019 Starmicronics C# API

    30/91

    30 / 90 © 2016 Star Micronics. All rights reserved.

    Step7. Do the same work as 2.5.6 for following description.

  • 8/18/2019 Starmicronics C# API

    31/91

    31 / 90 © 2016 Star Micronics. All rights reserved.

    Step8. Double-click [Tapped] on the property page of [List Box] and [ProductListBox_Tapped] will becreated. .

  • 8/18/2019 Starmicronics C# API

    32/91

    32 / 90 © 2016 Star Micronics. All rights reserved.

    Step9. Add the following description regarding PrivateProperty to class [MainPage] in source code of[MainPage.xaml].

    private StarIOPort.ProductInformationCollection productCollection = null;

  • 8/18/2019 Starmicronics C# API

    33/91

    33 / 90 © 2016 Star Micronics. All rights reserved.

    Step10. Type [override] to class [MainPage] in [MainPage.xaml], and select [OnNavigatedTo] method onthe popped up list. Then can be created the [OnNavigatedTo].

  • 8/18/2019 Starmicronics C# API

    34/91

    34 / 90 © 2016 Star Micronics. All rights reserved.

    Step11. Add the following description to created [OnNavigatedTo] method.

    try{

    productCollection = await StarIOPort.ProductInformation.FindAllAsync();

    ProductListSource.Source = productCollection;

    ProductListBox.SelectedIndex = 0;}catch{}

  • 8/18/2019 Starmicronics C# API

    35/91

    35 / 90 © 2016 Star Micronics. All rights reserved.

    Step12. Define [OnNavigatedTo] a method as asynchronous method(keyword: async).

  • 8/18/2019 Starmicronics C# API

    36/91

    36 / 90 © 2016 Star Micronics. All rights reserved.

    Step13. Add the following description to created [ProductListBox_Tapped] method at the step8.

    StarIOPort.ProductInformation info = (StarIOPort.ProductInformation) ((ListBox) sender).SelectedItem;

    try

    { Windows.Storage.Streams.IBuffer buffer =System.Text.Encoding.GetEncoding("Shift_JIS").GetBytes("Hello Windows8.1\n").AsBuffer();

    using (StarIOPort.Port port = new StarIOPort.Port()){

    await port.ConnectAsync(info);

    await port.WriteAsync(buffer);}

    }catch{

    }

  • 8/18/2019 Starmicronics C# API

    37/91

    37 / 90 © 2016 Star Micronics. All rights reserved.

    Step14. Define [ProductListBox_Tapped] method as a asynchronous method(keyword: async).

  • 8/18/2019 Starmicronics C# API

    38/91

    38 / 90 © 2016 Star Micronics. All rights reserved.

    Step15. Execute Hands-On application 2

    Step16. The following will be come up when [ListBox] is tapped only first time. If “Allow” button isselected, [Hello Windows 8,1] will be printed.

  • 8/18/2019 Starmicronics C# API

    39/91

    39 / 90 © 2016 Star Micronics. All rights reserved.

    2.5 Verify Printer Status and Monitor the Completion of PrintingThere are no description either to verify Printer Status or to monitor the completion ofprinting in Hands On applications 1 and 2.

    However, users normally need to get those information.

    In this section, you can add those descriptions into Hands On application 2.

    Step1. Add the description to disable the [ProductListBox] at the beginning and the description toenable the [ProductListBox] at the end of the [ProductListBox_Tapped] method as shownbelow.

    By adding these descriptions, you can prevent multiple tap and confirm the printingcompletion.

    ProductListBox.IsEnabled = false;

    ProductListBox.IsEnabled = true;

  • 8/18/2019 Starmicronics C# API

    40/91

    40 / 90 © 2016 Star Micronics. All rights reserved.

    Step2. Replace the description in the [using] part of the [ProductListBox_Tapped] method with thefollowing.

    StarIOPort.Status status;

    await port.ConnectAsync(info,"");

    status = await port.BeginCheckedBlockAsync();

    if (status.Offline == true){

    throw new Exception("Printer is offline.");}

    if (await port.WriteAsync(buffer) != buffer.Length){

    throw new Exception("WriteAsync failed.");}

    status = await port.EndCheckedBlockAsync();if (status.Offline == true){

    String message = "Printer is offline.";if (status.ReceiptPaperEmpty == true){

    message += "\nPaper is enmpty.";}if (status.CoverOpen == true){

    message += "\nCover is open.";}

    throw new Exception(message);}

  • 8/18/2019 Starmicronics C# API

    41/91

    41 / 90 © 2016 Star Micronics. All rights reserved.

    Step3. Replace the description of the [catch] part in [ProductListBox_Tapped] method with thefollowing.

    catch (Exception exc){

    Windows.UI.Popups.MessageDialog dialog = new Windows.UI.Popups.MessageDialog(exc.Message);

    dialog.ShowAsync();}

  • 8/18/2019 Starmicronics C# API

    42/91

    42 / 90 © 2016 Star Micronics. All rights reserved.

    Step4. Execute Hands On application 2 and verify that the [ProductListBox] is disable after it istapped until the completion of printing.

    Step5. Verify the exception I generated and “Printer is offline” [MessageDialog] appearsuntil the[ProductListBox] is tapped with the cover opened.

  • 8/18/2019 Starmicronics C# API

    43/91

    43 / 90 © 2016 Star Micronics. All rights reserved.

    3 API reference

    3.1 Port classSyntax

    public sealed class Port : IDisposableConstructor DescriptionPort Creates Port object

    Method DescriptionConnectAsync Starts an asynchronous operationWriteAsync Writes dataReadAsync Reads dataGetParsedStatusAsync Gets statusBeginCheckedBlockAsync Starts to check completion of printingEndCheckedBlockAsync Terminates to check completion of printingGetOnlineStatusAsync Verify printer online statusClose Releases unmanaged resources

    PropertyNon

    NamespaceStarIOPort

    3.1.1 Port constructor

    Lists up ProductInformation objectSyntaxpublic Port()public Port(Int32 timeout)

    Arg ument Descript ion Typetimeout Sets Default timeout value.

    Default timeout value is 10000mS if the argument is omitted.Int32

    Return Value Descripti onPort Port object

  • 8/18/2019 Starmicronics C# API

    44/91

    44 / 90 © 2016 Star Micronics. All rights reserved.

    3.1.2 ConnectAsync methodStarts an asynchronous operation

    Syntaxpublic IAsyncAction ConnectAsync(string portName, string portSettings)

    public IAsyncAction ConnectAsync(ProductInformation info, string portSettings)

    Arg ument Descr ip ti on TypeportName Starts an asynchronous operation with the printer whose printer

    name or MAC address is specified.Ethernet Interface:

    TCP:IP addressBluetoothInterface:

    BT:BT:Device NameBT:MAC address

    string

    info Starts an asynchronous operation with the printer which is specifiedby using ProductInformation object.

    ProductInformation

    portSettings Specifies connection setting information.Please refer to the below table (*1) for the actual value of the portsettings.

    string

    Return Value Descripti onIAsyncAction Control asynchronous action object

    Return value by asynchronou s action-

    *1Interface Emulation(*2) portSettings

    Ethernet StarLine the empty stringStarPRNT portable;StarGraphic the empty string

    Bluetooth StarLine the empty string Retry OFF;l Retry ON;d[value] Data timeout function(*3) ON

    StarPRNT portable; Retry OFFportable;l Retry ONportable;d[value] Data timeout function(*3) ON

    StarGraphic the empty string Retry OFF;l Retry ON

    *2: Please refer to 1.4 Printer, Emulation for confirmation method.

    *3: Data timeout function (Bluetooth Interface only)In case an error occurs while printing or no data is sent to the printer during a predetermined time,the data canceling function will be executed.

    To set the time value, specify from 0 to 255 (unit: second) in [value]. The default value is 3seconds. If a value outside of the range is specified, it will be ignored.

    This function prevents next print data from being printed incorrectly when the Bluetoothconnection is disconnected during data transmission.

    The data timeout func tion is support ed by TSP650II with F/W version 2.0 or later.

  • 8/18/2019 Starmicronics C# API

    45/91

    45 / 90 © 2016 Star Micronics. All rights reserved.

    3.1.3 WriteAsync methodWrites data

    Syntaxpublic IAsyncOperation WriteAsync(IBuffer buffer)

    public IAsyncOperation WriteAsync(IBuffer buffer, Int32 timeout)

    Arg ument Descript ion Typebuffer Buffer in which data is stored IBuffertimeout Timeout value for writing data

    Default timeout value is set by Port constructor, if the argument isomitted.

    Int32

    Return Value Descripti onIAsyncOperation Control asynchronous action object

    Return value byasynchronous action

    Description

    uint The length of IBuffer object written to the transmission stream

    3.1.4 ReadAsync methodReads data

    Syntaxpublic IAsyncOperation ReadAsync()public IAsyncOperation ReadAsync(Int32 timeout)

    Arg ument Descript ion Type- Default timuout value which is set by Port constructor -timeout Timeout value of data read Int32

    Return Value Descripti onIAsyncOperation Object for control asynchronous operation

    Return value byasynchronous action

    Description

    IBuffer IBuffer object read from the receiving stream

  • 8/18/2019 Starmicronics C# API

    46/91

    46 / 90 © 2016 Star Micronics. All rights reserved.

    3.1.5 GetParsedStatusAsync methodGets status

    Syntaxpublic IAsyncOperation GetParsedStatusAsync()

    public IAsyncOperation GetParsedStatusAsync(Int32 timeout)

    Arg ument Descript ion Type- Default timuout value which is set by Port constructor -timeout Timeout value for getting status Int32

    Return Value DescriptionIAsyncOperation Object to control asynchronous operation

    Return value byasynchronous action

    Description

    Status Status object

    3.1.6 BeginCheckedBlockAsync methodStarts to check completion of printing

    Syntaxpublic IAsyncOperation BeginCheckedBlockAsync()public IAsyncOperation BeginCheckedBlockAsync(Int32 timeout)

    Arg ument Descript ion Type- Default timeout value which is set by Port constructor -timeout Timeout value for starting to check completion of printing Int32

    Return Value Descripti onIAsyncOperation Object to control asynchronous operation

    Return value byasynchronous action

    Description

    Status Status object before starting to check completion of printing

  • 8/18/2019 Starmicronics C# API

    47/91

    47 / 90 © 2016 Star Micronics. All rights reserved.

    3.1.7 EndCheckedBlockAsync methodTerminates a check of completion of printingSyntaxpublic IAsyncOperation EndCheckedBlockAsync()public IAsyncOperation EndCheckedBlockAsync(Int32 timeout)

    Arg ument Descript ion Type- Default timeout value which is set by Port constructor -Timeout Timeout Value for terminating a check of completion of printing Int32

    Return Value Descripti onIAsyncOperation Object to control asynchronous operation

    Return value byasynchronous action

    Description

    Status Status object after terminating a check of completion of printing

    3.1.8 GetOnlineStatusAsync methodVerifies printer online status

    Syntaxpublic IAsyncOperation GetOnlineStatusAsync()public IAsyncOperation GetOnlineStatusAsync(Int32 timeout)

    Arg ument Descript ion Type

    - Default timeout value which is set by Port constructor -Timeout Timeout value for verification of printer online status Int32

    Return Value Descripti onIAsyncOperation Object to control asynchronous operation

    Return value byasynchronous action

    Description

    bool Online status of the printer

  • 8/18/2019 Starmicronics C# API

    48/91

    48 / 90 © 2016 Star Micronics. All rights reserved.

    3.1.9 Close methodReleases unmanaged resources

    Syntaxpublic void Close()

    Arg ument-

    Return Value-

  • 8/18/2019 Starmicronics C# API

    49/91

    49 / 90 © 2016 Star Micronics. All rights reserved.

    3.2 ProductId EnumerationSyntaxpublic enum ProductId

    Constructor

    -

    Method-

    Member Descripti on TypeBluetoothPOSPrinter Identifier of Bluetooth POS printer ProductIdBluetoothMobilePrinter Identifier of Bluetooth Portable printer ProductIdLANPOSPrinter Identifier of LAN POS printer ProductId

    NamespaceStarIOPort

  • 8/18/2019 Starmicronics C# API

    50/91

    50 / 90 © 2016 Star Micronics. All rights reserved.

    3.3 ProductInformation classSyntaxpublic sealed class ProductInformation

    Constructor

    -

    Method DescriptionFindAllAsync List up ProductInformation object

    Property Descripti on TypeName Name stringMacAddress MAC address stringProductId Identifier to specify the product type ProductId

    NamespaceStarIOPort

    3.3.1 FindAllAsync methodList up ProductInformation object

    Syntaxpublic static IAsyncOperation FindAllAsync()public static IAsyncOperation FindAllAsync(printerInterfaceType)

    Arg ument

    Desciption

    Type

    printerInterfaceType Specify the Printer Interface Type StarIOPort.PrinterInterfaceBluetooth: Bluetooth PrinterLAN: Wired LAN Printer Wireless LAN Printer

    Return Value Descipti onIAsyncOperation Object to control asynchronous operation

    Return value by asynchronous action DesctiptionProductInformationCollection ProductInformationCollection object lists

    FindAllAsync method do not guarantee the discovery of devices.

  • 8/18/2019 Starmicronics C# API

    51/91

    51 / 90 © 2016 Star Micronics. All rights reserved.

    3.4 ProductInformationCollection classSyntaxpublic sealed class ProductInformationCollection : IReadOnlyList

    Constructor

    -

    Method-

    Property Descripti on TypeCount Gets the number of elements are stored in a collection intItem Gets the element in the registered index ProductInformation

    NamespaceStarIOPort

  • 8/18/2019 Starmicronics C# API

    52/91

    52 / 90 © 2016 Star Micronics. All rights reserved.

    3.5 Status classSyntaxpublic sealed class Status

    Constructor

    -

    Method-

    Property Descriptio n TypeCoverOpen Cover open boolOffline Off line boolCompulsionSwitch Compulsion switch boolOverTemp Stop printing by head thermistor boolUnrecoverableError Unrecoverable error boolCutterError Cutter error boolMechanicalError Mechanical error boolHeadThermistorError Head thermistor error boolVoltageError Voltage error boolReceiptPaperEmpty Paper end boolReceiptPaperNearEmptyInner Paper near end (inner) boolReceiptPaperNearEmptyOuter Paper near end (outer) boolETBAvailable Availability of ETB boolETBCounter ETB counter byteRawStatus Number of Status byte byte[]

    Namespace

    StarIOPort

  • 8/18/2019 Starmicronics C# API

    53/91

    53 / 90 © 2016 Star Micronics. All rights reserved.

    Support model

    Member nameTSP

    100IIILAN

    TSP100III

    W

    TSP100LAN

    FVP10TSP650

    II

    TSP700

    II

    TSP800

    II

    BlackMarkError ✔

    CompulsionSwitch ✔ ✔ ✔ ✔ ✔ ✔ ✔

    CoverOpen ✔ ✔ ✔ ✔ ✔ ✔ ✔

    CutterError ✔ ✔ ✔ ✔ ✔ ✔ ✔

    ETBAvailable ✔ ✔ ✔ ✔ ✔ ✔ ✔

    ETBCounter ✔ ✔ ✔ ✔ ✔ ✔ ✔

    HeadThermistorError

    Offline ✔ ✔ ✔ ✔ ✔ ✔ ✔

    OverTemp ✔ ✔ ✔ ✔ ✔ ✔ ✔

    PresenterPaperJamError

    PresenterState

    RawStatus ✔ ✔ ✔ ✔ ✔ ✔ ✔

    ReceiptPaperEmpty ✔ ✔ ✔ ✔ ✔ ✔ ✔

    ReceiptPaperNearEmptyInner ✔ ✔ ✔ ✔

    ReceiveBufferOverflow ✔ ✔ ✔ ✔

    UnrecoverableError ✔ ✔ ✔ ✔ ✔ ✔ ✔

    VoltageError

  • 8/18/2019 Starmicronics C# API

    54/91

    54 / 90 © 2016 Star Micronics. All rights reserved.

    Support model

    Member name SM-L200

    SM-S210i

    *

    SM-S220i

    **

    SM-S230i

    **

    SM-T300i

    SM-T400i mPOP

    BlackMarkError ✔

    CompulsionSwitch ✔

    CoverOpen ✔ ✔ ✔ ✔ ✔ ✔ ✔

    CutterError ✔

    ETBAvailable ✔ ✔ ✔ ✔ ✔ ✔ ✔

    ETBCounter ✔ ✔ ✔ ✔ ✔ ✔ ✔

    HeadThermistorError ✔

    Offline ✔ ✔ ✔ ✔ ✔ ✔ ✔

    OverTemp ✔ ✔ ✔ ✔ ✔ ✔ ✔

    PresenterPaperJamError

    PresenterState

    RawStatus ✔ ✔ ✔ ✔ ✔ ✔ ✔

    ReceiptPaperEmpty ✔ ✔ ✔ ✔ ✔ ✔ ✔

    ReceiptPaperNearEmptyInner

    ReceiveBufferOverflow

    UnrecoverableError ✔

    VoltageError ✔

    * JP Model only ** Models for US and Europe only

  • 8/18/2019 Starmicronics C# API

    55/91

    55 / 90 © 2016 Star Micronics. All rights reserved.

    3.6 Util classSyntaxpublic sealed class Util

    Constructor

    -

    Method DescriptionGetStarIOVersion Gets StarIO Version

    PropertyNon

    NamespaceStarIOPort

    3.6.1 GetStarIOVersion methodGets StarIO Version

    Syntaxpublic static string GetStarIOVersion()

    Arg ument-

    Return Value Descripti onstring StarIO Version

    Return value by asynchronou s action-

  • 8/18/2019 Starmicronics C# API

    56/91

    56 / 90 © 2016 Star Micronics. All rights reserved.

    3.7 PrinterInterfaceType enumerationInterface-type constants

    Syntaxpublic enum PrinterInterfaceType

    Constructor-

    Method-

    Member Descripti on TypeBluetooth Identifier for Bluetooth printer PrinterInterfaceTypeLAN Identifier for wired LAN/wireless LAN printers PrinterInterfaceType

    Namespace

    StarIOPort

  • 8/18/2019 Starmicronics C# API

    57/91

    57 / 90 © 2016 Star Micronics. All rights reserved.

    3.8 StarIoExtManager classSyntaxpublic sealed class StarIOExtManager

    Constructor Description

    StarIOExtManager Initializes the StarIOExtManager object.

    Method DescriptionconnectAsync Starts management.disconnectAsync Stops management.LockAsync Obtains exclusive access to communication on the port property.

    Property Descriptionport Gets the StarIOPort object.printerOnlineStatus Gets the printer's online status.printerPaperReadyStatus Gets the printer's paper ready status.printerCoverOpenStatus Gets the printer's cover open status.cashDrawerOpenStatus Gets the cash drawer open status.barcodeReaderConnectStatus Gets the barcode reader's connection status.cashDrawerOpenActiveHigh Gets or sets the mode of the cash drawer's open sensor.

    Event DescriptionPrinterImpossibleEvent Occurs when the printer is not functioning.PrinterOnlineEvent Occurs when the printer is online.PrinterOfflineEvent Occurs when the printer is offline.PrinterPaperReadyEvent Occurs when the printer's paper is ready.PrinterPaperNearEmptyEvent Occurs when the printer is almost out of paper.PrinterPaperEmptyEvent Occurs when the printer is out of paper.PrinterCoverOpenEvent Occurs when the printer's cover is open.

    PrinterCoverCloseEvent Occurs when the printer's cover is closed.CashDrawerOpenEvent Occurs when the cash drawer is open.CashDrawerCloseEvent Occurs when the cash drawer is closed.BarcodeReaderImpossibleEvent Occurs when the barcode reader cannot be used.BarcodeReaderConnectEvent Occurs when the barcode reader is connected.BarcodeReaderDisconnectEvent Occurs when the barcode reader is disconnected.BarcodeDataReceivedEvent Occurs when data has been received from the barcode reader.

    AccessoryConnectSuccessEvent Occurs when an accessory connection succeeded. AccessoryConnectFailureEvent Occurs when an accessory connection failed. AccessoryDisconnectEvent Occurs when an accessory is disconnected.

  • 8/18/2019 Starmicronics C# API

    58/91

    58 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.1 StarIoExtManager constructorInitializes the StarIoExtManager object.

    Syntaxpublic StarIoExtManager(StarIoExtManagerType type, string portName, string portSettings, Int32 timeout)

    Arg ument Descr ip tion Typetype Manager type StarIO_Extension.Star

    IoExtManagerTypeStandard:

    WithBarcodeReader:

    OnlyBarcodeReader:

    Management of the printer and thecash drawerManagement of the printer, thecash drawer, and the barcodereaderManagement of the barcode reader

    Arg ument Descr ip tion TypeportName Port name string

    Arg ument Descr ip tion TypeportSettings Port settings string

    Arg ument Descr ip tion TypeTimeout Timeout value for internal control and API Int32

    Return value Descripti onStarIoExtManager StarIoExtManager object

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader,

    portName.ToString(),

    portSettings.ToString(),

    10000);

  • 8/18/2019 Starmicronics C# API

    59/91

    59 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.2 connectAsync methodStarts management.

    Syntaxpublic IAsyncOperation connect()

    Return value DescriptionIAsyncOperation Object for managing asynchronous operation

    Return value byasynchronous action

    Description

    bool Results of starting managementtrue:false:

    SuccessFailure

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader,

    portName.ToString(),

    portSettings.ToString(),

    10000);

    await starIoExtManager.connectAsync();

  • 8/18/2019 Starmicronics C# API

    60/91

    60 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.3 disconnectAsync methodStops management.

    Syntaxpublic IAsyncOperation disconnect()

    Return value DescriptionIAsyncOperation Object for managing asynchronous operation

    Return value byasynchronous action

    Description

    bool Results of stopping managementtrue: Successfalse: Failure

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader,

    portName.ToString(),

    portSettings.ToString(),

    10000);

    await starIoExtManager.connectAsync();

    if (starIoExtManager != null)

    {

    await starIoExtManager.disconnectAsync();

    starIoExtManager = null;

    }

  • 8/18/2019 Starmicronics C# API

    61/91

    61 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.4 LockAsync methodExclusive access to communication on the port property.

    Syntaxpublic IAsyncOperation LockAsync()

    Return value Descripti onIAsyncOperation Object for managing asynchronous operation

    Return value by asynchronousaction

    Description

    IDisposable IDisposable object

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    3.8.5 Port propertyStarIOPort object

    Syntax

    public StarIOPort.Port port { get;}

    Property value Descripti on TypeStarIOPort object StarIOPort.Port

    using StarIO_Extension;

    StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader,

    portName.ToString(),

    portSettings.ToString(),

    10000);

    await starIoExtManager.connectAsync();

    using (await starIoExtManager.LockAsync())

    {

    //Implementation

    }

  • 8/18/2019 Starmicronics C# API

    62/91

    62 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.6 printerOnlineStatus propertyPrinter's online status

    Syntaxpublic StarIO_Extention.StarIoExtManagerStatus printerOnlineStatus { get; }

    Propertyvalue

    Description Type

    Printer's online status StarIO_Extension.StarIoExtManagerStatusInvalid: Invalid

    Impossible: Equipment not functioningPrinterOnline: Printer detected as onlinePrinterOffline: Printer detected as offline

    3.8.7 printerPaperReadyStatus property

    Printer paper's ready statusSyntaxpublic StarIO_Extention.StarIoExtManagerStatus printerPaperReadyStatus { get; }

    Propertyvalue

    Description Type

    Printer paper's ready status StarIO_Extension.StarIoExtManagerStatusInvalid: Invalid

    Impossible: Equipment not functioningPrinterPaperReady: Printer's paper detected as readyPrinterPaperNearEmpty: Printer's paper detected as almost

    empty

    PrinterPaperEmpty: Printer's paper detected as empty

    3.8.8 printerCoverOpenStatus propertyPrinter cover's open status

    Syntaxpublic StarIO_Extention.StarIoExtManagerStatus printerCoverOpenStatus { get; }

    Propertyvalue

    Description Type

    Printer cover's open status StarIO_Extension.StarIoExtManagerStatusInvalid: InvalidImpossible: Equipment not functioningPrinterCoverOpen: Printer's cover detected as openPrinterCoverClose: Printer's cover detected as closed

  • 8/18/2019 Starmicronics C# API

    63/91

    63 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.9 cashDrawerOpenStatus propertyCash drawer's open status

    Syntaxpublic StarIO_Extention.StarIoExtManagerStatus cashDrawerOpenStatus { get; }

    Propertyvalue

    Description Type

    Cash drawer's open status StarIO_Extension.StarIoExtManagerStatusInvalid: Invalid

    Impossible: Equipment not functioningCashDrawerOpen: Cash drawer detected as openCashDrawerClose: Cash drawer detected as closed

    3.8.10 barcodeReaderConnectStatus propertyBarcode reader's connection status

    Syntaxpublic StarIO_Extention.StarIoExtManagerStatus barcodeReaderConnectStatus { get; }

    Propertyvalue

    Description Type

    Barcode reader's connection status StarIO_Extension.StarIoExtManagerStatusInvalid: Invalid

    Impossible: Equipment not functioningBarcodeReaderConnect: Barcode reader detected as

    connected

    BarcodeReaderDisconnect: Barcode reader detected asdisconnected

    3.8.11 cashDrawerOpenActiveHigh propertyMode of the cash drawer's open sensor

    Syntaxpublic StarIO_Extention.StarIoExtManagerStatus barcodeReaderConnectStatus { get; set;}

    Propertyvalue

    Description Type

    Mode of the cash drawer's open sensor booltrue: Active highfalse: Active low

    * Must be the default value (true) for the mPOP mechanism.

  • 8/18/2019 Starmicronics C# API

    64/91

    64 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.12 PrinterImpossibleEvent eventOccurs when the printer is not functioning.

    Syntaxpublic event EventHandler PrinterImpossibleEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    65/91

    65 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.13 PrinterOnlineEvent eventOccurs when the printer is online.

    Syntaxpublic event EventHandler PrinterOnlineEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    66/91

    66 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.14 PrinterOfflineEvent eventOccurs when the printer is offline.

    Syntaxpublic event EventHandler PrinterOfflineEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    67/91

    67 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.15 PrinterPaperReadyEvent eventOccurs when the printer's paper is ready.

    Syntaxpublic event EventHandler PrinterOfflineEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    68/91

    68 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.16 PrinterPaperNearEmptyEvent eventOccurs when the printer is almost out of paper.

    Syntaxpublic event EventHandler PrinterPaperNearEmptyEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    69/91

    69 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.17 PrinterPaperEmptyEvent eventOccurs when the printer is out of paper.

    Syntaxpublic event EventHandler PrinterPaperEmptyEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    70/91

    70 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.18 PrinterCoverOpenEvent eventOccurs when the printer's cover is open.

    Syntaxpublic event EventHandler PrinterCoverOpenEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    71/91

    71 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.19 PrinterCoverClosedEvent eventOccurs when the printer's cover is closed.

    Syntaxpublic event EventHandler PrinterCoverCloseEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    72/91

    72 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.20 CashDrawerOpenEvent eventOccurs when the cash drawer is open.

    Syntaxpublic event EventHandler CashDrawerOpenEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    73/91

    73 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.21 CashDrawerCloseEvent eventOccurs when the cash drawer is closed.

    Syntaxpublic event EventHandler CashDrawerCloseEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    74/91

  • 8/18/2019 Starmicronics C# API

    75/91

    75 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.23 BarcodeReaderConnectEvent eventOccurs when the barcode reader is connected.

    Syntaxpublic event EventHandler BarcodeReaderConnectEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    76/91

    76 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.24 BarcodeReaderDisconnectEvent eventOccurs when the barcode reader is disconnected.

    Syntaxpublic event EventHandler BarcodeReaderDisconnectEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    77/91

    77 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.25 BarcodeDataReceivedEvent eventOccurs when data has been received from the barcode reader.

    Syntaxpublic event EventHandler BarcodeDataReceivedEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    78/91

  • 8/18/2019 Starmicronics C# API

    79/91

    79 / 90 © 2016 Star Micronics. All rights reserved.

    3.8.27 AccessoryConnectFailureEvent eventOccurs when an accessory connection failed.

    Syntaxpublic event EventHandler AccessoryConnectFailureEvent;

    Example

    Refer to BarcodeReaderwithPrintPage.xaml.cs.

    using StarIO_Extension;

    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

    });

    }

  • 8/18/2019 Starmicronics C# API

    80/91

  • 8/18/2019 Starmicronics C# API

    81/91

    81 / 90 © 2016 Star Micronics. All rights reserved.

    3.9 StarIoExtManagerType enumerationManager type constants

    Syntaxpublic enum StarIoExtManagerType

    Member DescriptionStandard Management of the printer and the cash drawerWithBarcodeReader Management of the printer, the cash drawer, and the barcode readerOnlyBarcodeReader Management of the barcode reader

    NamespaceStarIO_Extension

  • 8/18/2019 Starmicronics C# API

    82/91

    82 / 90 © 2016 Star Micronics. All rights reserved.

    3.10 StarIoExtManagerStatus enumerationStatus constants

    A StarIoExtManagerStatus enumeration is returned by the printerOnlineStatus property, theprinterPaperReadyStatus property, the printerCoverOpenStatus property, the cashDrawerOpenStatus

    property, and the barcodeReaderConnectStatus property in the StarIOExtManager class.Syntaxpublic enum StarIoExtManagerStatus

    Member DescriptionInvalid InvalidImpossible Equipment not functioningPrinterOnline Printer detected as onlinePrinterOffline Printer detected as offlinePrinterPaperReady Printer paper detected as readyPrinterPaperNearEmpty Printer paper detected as almost emptyPrinterPaperEmpty Printer paper detected as emptyPrinterCoverOpen Printer cover detected as openPrinterCoverClose Printer cover detected as closedCashDrawerOpen Cash drawer detected as openCashDrawerClose Cash drawer detected as closedBarcodeReaderConnect Barcode reader connection detectedBarcodeReaderDisconnect Barcode reader disconnection detected

    NamespaceStarIO_Extension

  • 8/18/2019 Starmicronics C# API

    83/91

    83 / 90 © 2016 Star Micronics. All rights reserved.

    3.11 SCBFactory class

    Syntaxpublic sealed class SCBFactory

    Constructor-

    Method DescriptioncreateBuilder Creates an ISCBBuilder object.

    Property-

    NamespaceStarIO_Extension

    3.11.1 createBuilder methodCreates an ISCBBuilder object.

    Syntaxpublic static ISCBBuilder createBuilder(StarIO_Extension.Emulation emulation)

    Arg ument Descript ion Typeemulation Emulation type StarIO_Extension.Emulation

    Return value Descripti on TypeISCBBuilder ISCBBuilder object ISCBBuilder

    Example

    Refer to CouponPrintPage.xaml.cs, CouponRotation90PrintPage.xaml.cs, OpenDrawerPage.xaml.cs, andRasterReceiptPrintPage.xaml.cs.

    using StarIO_Extension;

    ISCBBuilder builder = SCBFactory.createBuilder(Emulation.StarLine);

  • 8/18/2019 Starmicronics C# API

    84/91

    84 / 90 © 2016 Star Micronics. All rights reserved.

    3.12 ISCBBulider interface

    Method DescriptionbeginDocument Generates a print start command.endDocument Generates a print end command.appendCutPaper Generates a cut command.appendPeripheral Generates a drawer command.appendBitmapAsync Generates a bitmap print command.getBuffer Gets the generated command.

    3.12.1 beginDocument methodGenerates a print start command.

    Syntax

    void beginDocument()

    Arg ument-

    Return value-

    Return value by asynchronou s action-

    Example

    Refer to CouponPrintPage.xaml.cs, CouponRotation90PrintPage.xaml.cs, OpenDrawerPage.xaml.cs, andRasterReceiptPrintPage.xaml.cs.

    using StarIO_Extension;

    //In starLine emulation case

    ISCBBuilder builder = SCBFactory.createBuilder(Emulation.StarLine);

    builder.beginDocument();

  • 8/18/2019 Starmicronics C# API

    85/91

    85 / 90 © 2016 Star Micronics. All rights reserved.

    3.12.2 endDocument methodGenerates a print end command.

    Syntaxvoid endDocument()

    Arg ument-

    Return value-

    Return value by asynchronou s action-

    Example

    Refer to CouponPrintPage.xaml.cs, CouponRotation90PrintPage.xaml.cs, OpenDrawerPage.xaml.cs, andRasterReceiptPrintPage.xaml.cs.

    using StarIO_Extension;

    //In starLine emulation case

    ISCBBuilder builder = SCBFactory.createBuilder(Emulation.StarLine);

    builder.beginDocument();

    await builder.appendBitmapAsync(logoData, false, 576, true, SCBBitmapConverterRotation.Normal);

    builder.appendCutPaper(SCBCutPaperAction.PartialCutWithFeed);

    builder.appendPeripheral(SCBPeripheralChannel.ChannelNo1, 200);

    builder.endDocument();

  • 8/18/2019 Starmicronics C# API

    86/91

    86 / 90 © 2016 Star Micronics. All rights reserved.

    3.12.3 appendCutPaper methodGenerates a cut command.

    Syntaxvoid appendCutPaper(StarIO_Extension.SCBCutPaperAction action)

    Arg ument Descript ion Typeaction Cut action type StarIO_Extension.SCBCutPaperAction

    Return value-

    Return value by asynchronou s action-

    Example

    Refer to CouponPrintPage.xaml.cs, CouponRotation90PrintPage.xaml.cs, OpenDrawerPage.xaml.cs, andRasterReceiptPrintPage.xaml.cs.

    using StarIO_Extension;

    //In starLine emulation case

    ISCBBuilder builder = SCBFactory.createBuilder(Emulation.StarLine);

    builder.beginDocument();

    await builder.appendBitmapAsync(logoData, false, 576, true, SCBBitmapConverterRotation.Normal);

    builder.appendCutPaper(SCBCutPaperAction.PartialCutWithFeed);

  • 8/18/2019 Starmicronics C# API

    87/91

    87 / 90 © 2016 Star Micronics. All rights reserved.

    3.12.4 appendPeripheral methodGenerates a drawer command.

    SyntaxappendPeripheral(StarIO_Extension.SCBPeripheralChannel channel, int time)

    Arg ument Descr ip tion Typechannel Specifies either external device 1 or external device 2 StarIO_Extension.SCBPer

    ipheralChannel* For external device 2, the energizing time is fixed at 200 ms, andthe delay time is fixed at 200 ms.* External devices 1 and 2 cannot be used simultaneously.

    Arg ument Descr ip tion Typetime Specifies the energizing time (ms) and the delay time (ms) for

    activating the external deviceStarIO_Extension.SCBPer ipheralChannel

    time [milliseconds]: (10–1270)

    Return value-

    Return value by asynchronou s action-

    Example

    Refer to CouponPrintPage.xaml.cs, CouponRotation90PrintPage.xaml.cs, OpenDrawerPage.xaml.cs, andRasterReceiptPrintPage.xaml.cs.

    using StarIO_Extension;

    //In starLine emulation case

    ISCBBuilder builder = SCBFactory.createBuilder(Emulation.StarLine);

    builder.beginDocument();

    await builder.appendBitmapAsync(logoData, false, 576, true, SCBBitmapConverterRotation.Normal);

    builder.appendCutPaper(SCBCutPaperAction.PartialCutWithFeed);

    builder.appendPeripheral(SCBPeripheralChannel.ChannelNo1, 200);

  • 8/18/2019 Starmicronics C# API

    88/91

  • 8/18/2019 Starmicronics C# API

    89/91

    89 / 90 © 2016 Star Micronics. All rights reserved.

    3.12.6 getBuffer methodGets the generated command.

    SyntaxIBuffer getBuffer()

    Arg ument-

    Return value-

    Example

    Refer to CouponPrintPage.xaml.cs, CouponRotation90PrintPage.xaml.cs, OpenDrawerPage.xaml.cs, andRasterReceiptPrintPage.xaml.cs.

    using StarIO_Extension;

    //In starLine emulation case

    ISCBBuilder builder = SCBFactory.createBuilder(Emulation.StarLine);

    builder.beginDocument();await builder.appendBitmapAsync(logoData, false, 576, true, SCBBitmapConverterRotation.Normal);

    builder.appendCutPaper(SCBCutPaperAction.PartialCutWithFeed);

    builder.appendPeripheral(SCBPeripheralChannel.ChannelNo1, 200);

    builder.endDocument();

    IBuffer buffer = builder.getBuffer();

  • 8/18/2019 Starmicronics C# API

    90/91

    90 / 90 © 2016 Star Micronics. All rights reserved.

    3.13 Emulation enumerationEmulation constantsMember DescriptionStarLine StarLine emulationStarPRNT StarPRNT emulationStarGraphic StarGraphic emulation

    NamespaceStarIO_Extension

    3.14 SCBBitmapConverterRotation enumerationRotation constantsMember DescriptionNormal Do not rotateRight90 Rotate 90 degrees to the rightLeft90 Rotate 90 degrees to the leftRotate180 Rotate 180 degrees

    NamespaceStarIO_Extension

    3.15 SCBCutPaperAction enumeration

    Paper cutting action constantsMember DescriptionFullCut Full cutoff at the current positionPartialCut Partial cutoff at the current positionFullCutWithFeed Feed the paper to the cutting position and then full cutoffPartialCutWithFeed Feed the paper to the cutting position and then partial cutoff

    NamespaceStarIO_Extension

    3.16 SCBPeripheralChannel enumerationExternal driving device constantsMember DescriptionChannelNo1 External driving device 1ChannelNo2 External driving device 2

    NamespaceStarIO_Extension

  • 8/18/2019 Starmicronics C# API

    91/91