Você está na página 1de 91

StarIO SDK for Windows Store Apps

Users Manual(C#)

Summary

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

2016Star Micronics. All rights reserved.

History of document
Date
Feb. 26, 2016

Contents
First release

2 / 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 and
programming languages at our website in the Developers section. Check the Developers section of
our 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, but
assumes no liability for errors or omissions.

STAR

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

Reproduction

in whole or in part is prohibited.

3 / 90
2016 Star Micronics. All rights reserved.

Content
1

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

4 / 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

5 / 90
2016 Star Micronics. All rights reserved.

1 Introduction
Explain the usage of [StarIOPort runtime component] which makes development of Windows store
application with printers easier with the form of Hands-On.

1.1 List
Name

Description

Sample folder

The folder with reference project for Windows store application


Windows
The folder with runtime component
The folder with all Hands-On work result
StarIO SDK for Windows Store Apps users manual(C#))(English)
StarIO SDK for Windows Store Apps users manual(C#))(Japanese)
Readme file (English)
Readme file (Japanese)
Software end-user license agreements (English)
Software end-user license agreements (Japanese)

StarIO
StarIOPortHandsOn_CS folder
UsersManual _CS_En.docx
UsersManual _CS_Jp.docx
readme.txt
readme_Jp.txt
SoftwareLicenseAgreement.pdf
SoftwareLicenseAgreement_Jp.pdf

1.2 Operating System


OS

Description

Windows8.1
Windows10

x86/x64
x86/x64 (except Windows IO IoT Core)

1.3 Interface
Interface

Bluetooth
LAN

1.4 Printer, Emulation


Printer

POS Printer

Mobile Printer

TSP650II
TSP700II
TSP800II
FVP10
TSP100LAN
TSP100IIILAN
TSP100IIIWLAN
mPOP
SM-S210i
SM-S220i
SM-S230i
SM-T300i
SM-T400i
SM-L200

F/W Version

Emulation

V1.0 or later
V5.0 or later
V2.0 or later
V2.0 or later
V2.0 or later
V1.0 or later
V1.0 or later
V1.0 or later
V3.0 or later
V3.0 or later
V1.0 or later
V3.0 or later
V3.0 or later
V1.0 or later

StarLine Emulation

Star Graphic Emulation

StarPRNT Emulation

6 / 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 lamp
flashes 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 Mode
StarPRNT : 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 Interface
Assign an IP Address to the Star Printer and connect it to the network. Star Printers do not ship with an IP
Address 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 Print
which 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 and
how to set the Static IP Address.

TSP100IIIW
Connecting Tablet/PC
See the Online manual (Setup - Connect Tablet/PC).

7 / 90
2016 Star Micronics. All rights reserved.

2 Hands-On
2.1 Make work solution
Make work solution for Hands-On.

Step1. Start [Visual studio 2013]

8 / 90
2016 Star Micronics. All rights reserved.

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

9 / 90
2016 Star Micronics. All rights reserved.

2.2 Add StarIOPort / StarIO_Extension runtime component


The version management of StarIOPort/StarIO_Extension runtime component which is shared
by project in one solution is easily done by addition of created StarIOPort/StarIO_Extension
runtime component to work solution.
Besides, peculiar version management for certain solution separated from other solutions
StarIOPort/StarIO_Extension runtime component is possible.

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

10 / 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].

11 / 90
2016 Star Micronics. All rights reserved.

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


addition.

12 / 90
2016 Star Micronics. All rights reserved.

2.3 Make Hands-On application 1


Make 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]).

13 / 90
2016 Star Micronics. All rights reserved.

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

14 / 90
2016 Star Micronics. All rights reserved.

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

15 / 90
2016 Star Micronics. All rights reserved.

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

16 / 90
2016 Star Micronics. All rights reserved.

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

17 / 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].

<Capability Name="privateNetworkClientServer" />


<m2:DeviceCapability Name="bluetooth.rfcomm">
<m2:Device Id="any">
<m2:Function Type="name:serialPort" />
</m2:Device>
</m2:DeviceCapability>

18 / 90
2016 Star Micronics. All rights reserved.

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

19 / 90
2016 Star Micronics. All rights reserved.

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

20 / 90
2016 Star Micronics. All rights reserved.

Step9. Confirm printers name.

21 / 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
{
}

22 / 90
2016 Star Micronics. All rights reserved.

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

23 / 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.

24 / 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 by
StarIOPort runtime component.

Step1.

Go to "[Visual C#] -[Windows Store]-[New application(XAML)] from [Add a new project], then add
Hands-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.

25 / 90
2016 Star Micronics. All rights reserved.

Step3.

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

26 / 90
2016 Star Micronics. All rights reserved.

Step4.

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

<Page.Resources>
<CollectionViewSource x:Name="ProductListSource"/>
</Page.Resources>

27 / 90
2016 Star Micronics. All rights reserved.

Step5.

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

28 / 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}}"

29 / 90
2016 Star Micronics. All rights reserved.

Step7.

Do the same work as 2.5.6 for following description.


<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</ListBox.ItemTemplate>

30 / 90
2016 Star Micronics. All rights reserved.

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

31 / 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;

32 / 90
2016 Star Micronics. All rights reserved.

Step10.

Type [override] to class [MainPage] in [MainPage.xaml], and select [OnNavigatedTo] method on


the popped up list. Then can be created the [OnNavigatedTo].

33 / 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
{
}

34 / 90
2016 Star Micronics. All rights reserved.

Step12.

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

35 / 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
{
}

36 / 90
2016 Star Micronics. All rights reserved.

Step14.

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

37 / 90
2016 Star Micronics. All rights reserved.

Step15.

Step16.

Execute Hands-On application 2

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

38 / 90
2016 Star Micronics. All rights reserved.

2.5 Verify Printer Status and Monitor the Completion of Printing


There are no description either to verify Printer Status or to monitor the completion of
printing 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 to
enable the [ProductListBox] at the end of the [ProductListBox_Tapped] method as shown
below.
By adding these descriptions, you can prevent multiple tap and confirm the printing
completion.

ProductListBox.IsEnabled = false;
ProductListBox.IsEnabled = true;

39 / 90
2016 Star Micronics. All rights reserved.

Step2.

Replace the description in the [using] part of the [ProductListBox_Tapped] method with the
following.
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);
}

40 / 90
2016 Star Micronics. All rights reserved.

Step3. Replace the description of the [catch] part in [ProductListBox_Tapped] method with the
following.
catch (Exception exc)
{
Windows.UI.Popups.MessageDialog dialog = new Windows.UI.Popups.MessageDialog(exc.Message);
dialog.ShowAsync();
}

41 / 90
2016 Star Micronics. All rights reserved.

Step4.

Execute Hands On application 2 and verify that the [ProductListBox] is disable after it is
tapped 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.

42 / 90
2016 Star Micronics. All rights reserved.

3 API reference
3.1 Port class
Syntax

public sealed class Port : IDisposable


Constructor

Description

Port

Creates Port object

Method

Description

ConnectAsync
WriteAsync
ReadAsync
GetParsedStatusAsync
BeginCheckedBlockAsync
EndCheckedBlockAsync
GetOnlineStatusAsync
Close

Starts an asynchronous operation


Writes data
Reads data
Gets status
Starts to check completion of printing
Terminates to check completion of printing
Verify printer online status
Releases unmanaged resources

Property

Non
Namespace

StarIOPort

3.1.1 Port constructor


Lists up ProductInformation object
Syntax

public Port()
public Port(Int32 timeout)
Argument

Description

Type

timeout

Sets Default timeout value.


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

Int32

Return Value

Description

Port

Port object

43 / 90
2016 Star Micronics. All rights reserved.

3.1.2 ConnectAsync method


Starts an asynchronous operation
Syntax

public IAsyncAction ConnectAsync(string portName, string portSettings)


public IAsyncAction ConnectAsync(ProductInformation info, string portSettings)
Argument

Description

Type

portName

Starts an asynchronous operation with the printer whose printer


name or MAC address is specified.
Ethernet Interface:
TCP:IP address
BluetoothInterface:
BT:
BT:Device Name
BT:MAC address
Starts an asynchronous operation with the printer which is specified
by using ProductInformation object.
Specifies connection setting information.
Please refer to the below table (*1) for the actual value of the port
settings.

string

info
portSettings

Return Value

Description

IAsyncAction

Control asynchronous action object

ProductInformation
string

Return value by asynchronous action

*1
Interface
Ethernet

Bluetooth

Emulation(*2)
StarLine
StarPRNT
StarGraphic
StarLine

StarPRNT

StarGraphic

portSettings
the empty string
portable;
the empty string
the empty string
;l
;d[value]
portable;
portable;l
portable;d[value]
the empty string
;l

Retry OFF
Retry ON
Data timeout function(*3) ON
Retry OFF
Retry ON
Data timeout function(*3) ON
Retry OFF
Retry ON

*2: Please refer to 1.4 Printer, Emulationfor 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 3
seconds. 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 Bluetooth
connection is disconnected during data transmission.
The data timeout function is supported by TSP650II with F/W version 2.0 or later.

44 / 90
2016 Star Micronics. All rights reserved.

3.1.3 WriteAsync method


Writes data
Syntax

public IAsyncOperation<uint> WriteAsync(IBuffer buffer)


public IAsyncOperation<uint> WriteAsync(IBuffer buffer, Int32 timeout)
Argument

Description

Type

buffer
timeout

Buffer in which data is stored


Timeout value for writing data
Default timeout value is set by Port constructor, if the argument is
omitted.

IBuffer
Int32

Return Value

Description

IAsyncOperation<uint>

Control asynchronous action object

Return value by
asynchronous action

Description

uint

The length of IBuffer object written to the transmission stream

3.1.4 ReadAsync method


Reads data
Syntax

public IAsyncOperation<IBuffer> ReadAsync()


public IAsyncOperation<IBuffer> ReadAsync(Int32 timeout)
Argument

Description

Type

timeout

Default timuout value which is set by Port constructor


Timeout value of data read

Int32

Return Value

Description

IAsyncOperation<IBuffer>

Object for control asynchronous operation

Return value by
asynchronous action

Description

IBuffer

IBuffer object read from the receiving stream

45 / 90
2016 Star Micronics. All rights reserved.

3.1.5 GetParsedStatusAsync method


Gets status
Syntax

public IAsyncOperation<Status> GetParsedStatusAsync()


public IAsyncOperation<Status> GetParsedStatusAsync(Int32 timeout)
Argument

Description

Type

timeout

Default timuout value which is set by Port constructor


Timeout value for getting status

Int32

Return Value
IAsyncOperation<Status>

Description
Object to control asynchronous operation

Return value by
asynchronous action

Description

Status

Status object

3.1.6 BeginCheckedBlockAsync method


Starts to check completion of printing
Syntax

public IAsyncOperation<Status> BeginCheckedBlockAsync()


public IAsyncOperation<Status> BeginCheckedBlockAsync(Int32 timeout)
Argument

Description

Type

timeout

Default timeout value which is set by Port constructor


Timeout value for starting to check completion of printing

Int32

Return Value

Description

IAsyncOperation<Status>

Object to control asynchronous operation

Return value by
asynchronous action

Description

Status

Status object before starting to check completion of printing

46 / 90
2016 Star Micronics. All rights reserved.

3.1.7 EndCheckedBlockAsync method


Terminates a check of completion of printing
Syntax

public IAsyncOperation<Status> EndCheckedBlockAsync()


public IAsyncOperation<Status> EndCheckedBlockAsync(Int32 timeout)
Argument

Description

Type

Timeout

Default timeout value which is set by Port constructor


Timeout Value for terminating a check of completion of printing

Int32

Return Value

Description

IAsyncOperation<IBuffer>

Object to control asynchronous operation

Return value by
asynchronous action

Description

Status

Status object after terminating a check of completion of printing

3.1.8 GetOnlineStatusAsync method


Verifies printer online status
Syntax

public IAsyncOperation<bool> GetOnlineStatusAsync()


public IAsyncOperation<bool> GetOnlineStatusAsync(Int32 timeout)
Argument

Description

Type

Timeout

Default timeout value which is set by Port constructor


Timeout value for verification of printer online status

Int32

Return Value

Description

IAsyncOperation<bool>

Object to control asynchronous operation

Return value by
asynchronous action

Description

bool

Online status of the printer

47 / 90
2016 Star Micronics. All rights reserved.

3.1.9 Close method


Releases unmanaged resources
Syntax

public void Close()


Argument

Return Value

48 / 90
2016 Star Micronics. All rights reserved.

3.2 ProductId Enumeration


Syntax

public enum ProductId


Constructor

Method

Member

Description

Type

BluetoothPOSPrinter
BluetoothMobilePrinter
LANPOSPrinter

Identifier of Bluetooth POS printer


Identifier of Bluetooth Portable printer
Identifier of LAN POS printer

ProductId
ProductId
ProductId

Namespace

StarIOPort

49 / 90
2016 Star Micronics. All rights reserved.

3.3 ProductInformation class


Syntax

public sealed class ProductInformation


Constructor

Method

Description

FindAllAsync

List up ProductInformation object

Property

Description

Type

Name
MacAddress
ProductId

Name
MAC address
Identifier to specify the product type

string
string
ProductId

Namespace

StarIOPort

3.3.1 FindAllAsync method


List up ProductInformation object
Syntax

public static IAsyncOperation<ProductInformationCollection> FindAllAsync()


public static IAsyncOperation<ProductInformationCollection> FindAllAsync(printerInterfaceType)
Argument

Desciption

Type

printerInterfaceType

Specify the Printer Interface Type


Bluetooth: Bluetooth Printer
LAN:
Wired LAN PrinterWireless LAN Printer

StarIOPort.PrinterInterface

Return Value

Desciption

IAsyncOperation<ProductInformationCollection>

Object to control asynchronous operation

Return value by asynchronous action

Desctiption

ProductInformationCollection

ProductInformationCollection object lists

FindAllAsync method do not guarantee the discovery of devices.

50 / 90
2016 Star Micronics. All rights reserved.

3.4 ProductInformationCollection class


Syntax

public sealed class ProductInformationCollection : IReadOnlyList<ProductInformation>


Constructor

Method

Property

Description

Type

Count
Item

Gets the number of elements are stored in a collection


Gets the element in the registered index

int
ProductInformation

Namespace

StarIOPort

51 / 90
2016 Star Micronics. All rights reserved.

3.5 Status class


Syntax

public sealed class Status


Constructor

Method

Property

Description

Type

CoverOpen
Offline
CompulsionSwitch
OverTemp
UnrecoverableError
CutterError
MechanicalError
HeadThermistorError
VoltageError
ReceiptPaperEmpty
ReceiptPaperNearEmptyInner
ReceiptPaperNearEmptyOuter
ETBAvailable
ETBCounter
RawStatus

Cover open
Off line
Compulsion switch
Stop printing by head thermistor
Unrecoverable error
Cutter error
Mechanical error
Head thermistor error
Voltage error
Paper end
Paper near end (inner)
Paper near end (outer)
Availability of ETB
ETB counter
Number of Status byte

bool
bool
bool
bool
bool
bool
bool
bool
bool
bool
bool
bool
bool
byte
byte[]

Namespace

StarIOPort

52 / 90
2016 Star Micronics. All rights reserved.

Support model
Member name

TSP
100III
LAN

TSP
100III
W

TSP
100
LAN

FVP10

TSP
650
II

BlackMarkError

TSP
700
II

TSP
800
II

CompulsionSwitch

CoverOpen

CutterError

ETBAvailable

ETBCounter

Offline

OverTemp

RawStatus

ReceiptPaperEmpty

ReceiptPaperNearEmptyInner

ReceiveBufferOverflow

HeadThermistorError

PresenterPaperJamError
PresenterState

UnrecoverableError

VoltageError

53 / 90
2016 Star Micronics. All rights reserved.

Support model
Member name

BlackMarkError

SML200

SMS210i

SMS220i

SMS230i

**

**

SMT300i

SMT400i

CompulsionSwitch
CoverOpen

mPOP

CutterError
ETBAvailable

ETBCounter

HeadThermistorError
Offline

OverTemp

RawStatus

ReceiptPaperEmpty

PresenterPaperJamError
PresenterState

ReceiptPaperNearEmptyInner
ReceiveBufferOverflow
UnrecoverableError

VoltageError

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

54 / 90
2016 Star Micronics. All rights reserved.

3.6 Util class


Syntax

public sealed class Util


Constructor

Method

Description

GetStarIOVersion

Gets StarIO Version

Property

Non
Namespace

StarIOPort

3.6.1 GetStarIOVersion method


Gets StarIO Version
Syntax

public static string GetStarIOVersion()


Argument

Return Value

Description

string

StarIO Version

Return value by asynchronous action

55 / 90
2016 Star Micronics. All rights reserved.

3.7 PrinterInterfaceType enumeration


Interface-type constants
Syntax

public enum PrinterInterfaceType


Constructor

Method

Member

Description

Type

Bluetooth
LAN

Identifier for Bluetooth printer


Identifier for wired LAN/wireless LAN printers

PrinterInterfaceType
PrinterInterfaceType

Namespace

StarIOPort

56 / 90
2016 Star Micronics. All rights reserved.

3.8 StarIoExtManager class


Syntax

public sealed class StarIOExtManager


Constructor

Description

StarIOExtManager

Initializes the StarIOExtManager object.

Method

Description

connectAsync
disconnectAsync
LockAsync

Starts management.
Stops management.
Obtains exclusive access to communication on the port property.

Property

Description

port
printerOnlineStatus
printerPaperReadyStatus
printerCoverOpenStatus
cashDrawerOpenStatus
barcodeReaderConnectStatus
cashDrawerOpenActiveHigh

Gets the StarIOPort object.


Gets the printer's online status.
Gets the printer's paper ready status.
Gets the printer's cover open status.
Gets the cash drawer open status.
Gets the barcode reader's connection status.
Gets or sets the mode of the cash drawer's open sensor.

Event

Description

PrinterImpossibleEvent
PrinterOnlineEvent
PrinterOfflineEvent
PrinterPaperReadyEvent
PrinterPaperNearEmptyEvent
PrinterPaperEmptyEvent
PrinterCoverOpenEvent
PrinterCoverCloseEvent
CashDrawerOpenEvent
CashDrawerCloseEvent
BarcodeReaderImpossibleEvent
BarcodeReaderConnectEvent
BarcodeReaderDisconnectEvent
BarcodeDataReceivedEvent
AccessoryConnectSuccessEvent
AccessoryConnectFailureEvent
AccessoryDisconnectEvent

Occurs when the printer is not functioning.


Occurs when the printer is online.
Occurs when the printer is offline.
Occurs when the printer's paper is ready.
Occurs when the printer is almost out of paper.
Occurs when the printer is out of paper.
Occurs when the printer's cover is open.
Occurs when the printer's cover is closed.
Occurs when the cash drawer is open.
Occurs when the cash drawer is closed.
Occurs when the barcode reader cannot be used.
Occurs when the barcode reader is connected.
Occurs when the barcode reader is disconnected.
Occurs when data has been received from the barcode reader.
Occurs when an accessory connection succeeded.
Occurs when an accessory connection failed.
Occurs when an accessory is disconnected.

57 / 90
2016 Star Micronics. All rights reserved.

3.8.1 StarIoExtManager constructor


Initializes the StarIoExtManager object.
Syntax
public StarIoExtManager(StarIoExtManagerType type, string portName, string portSettings, Int32 timeout)
Argument

Description

type

Manager type
Standard:

Type

WithBarcodeReader:

OnlyBarcodeReader:

Management of the printer and the


cash drawer
Management of the printer, the
cash drawer, and the barcode
reader
Management of the barcode reader

StarIO_Extension.Star
IoExtManagerType

Argument

Description

Type

portName

Port name

string

Argument

Description

Type

portSettings

Port settings

string

Argument

Description

Type

Timeout

Timeout value for internal control and API

Int32

Return value

Description

StarIoExtManager

StarIoExtManager object

Example
using StarIO_Extension;

StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader,


portName.ToString(),
portSettings.ToString(),
10000);

Refer to BarcodeReaderwithPrintPage.xaml.cs.

58 / 90
2016 Star Micronics. All rights reserved.

3.8.2 connectAsync method


Starts management.
Syntax

public IAsyncOperation<bool> connect()


Return value

Description

IAsyncOperation<bool>

Object for managing asynchronous operation

Return value by
asynchronous action

Description

bool

Results of starting management


true:
Success
false:
Failure

Example
using StarIO_Extension;

StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader,


portName.ToString(),
portSettings.ToString(),
10000);
await starIoExtManager.connectAsync();

Refer to BarcodeReaderwithPrintPage.xaml.cs.

59 / 90
2016 Star Micronics. All rights reserved.

3.8.3 disconnectAsync method


Stops management.
Syntax

public IAsyncOperation<bool> disconnect()


Return value

Description

IAsyncOperation<bool>

Object for managing asynchronous operation

Return value by
asynchronous action

Description

bool

Results of stopping management


true:
Success
false:
Failure

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

Refer to BarcodeReaderwithPrintPage.xaml.cs.

60 / 90
2016 Star Micronics. All rights reserved.

3.8.4 LockAsync method


Exclusive access to communication on the port property.
Syntax

public IAsyncOperation<IDisposable> LockAsync()


Return value

Description

IAsyncOperation<IDisposable>

Object for managing asynchronous operation

Return value by asynchronous


action

Description

IDisposable

IDisposable object

Example
using StarIO_Extension;

StarIoExtManager starIoExtManager = new StarIoExtManager(StarIoExtManagerType.WithBarcodeReader,


portName.ToString(),
portSettings.ToString(),
10000);
await starIoExtManager.connectAsync();
using (await starIoExtManager.LockAsync())
{
//Implementation
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

3.8.5 Port property


StarIOPort object
Syntax

public StarIOPort.Port port

{ get;}

Property value

Description

Type

StarIOPort object

StarIOPort.Port

61 / 90
2016 Star Micronics. All rights reserved.

3.8.6 printerOnlineStatus property


Printer's online status
Syntax

public StarIO_Extention.StarIoExtManagerStatus printerOnlineStatus


Property
value

{ get; }

Description

Type

Printer's online status


Invalid:
Impossible:
PrinterOnline:
PrinterOffline:

Invalid
Equipment not functioning
Printer detected as online
Printer detected as offline

StarIO_Extension.StarIo
ExtManagerStatus

3.8.7 printerPaperReadyStatus property


Printer paper's ready status
Syntax

public StarIO_Extention.StarIoExtManagerStatus printerPaperReadyStatus { get; }


Property
value

Description

Type

Printer paper's ready status


Invalid:
Impossible:
PrinterPaperReady:
PrinterPaperNearEmpty:
PrinterPaperEmpty:

Invalid
Equipment not functioning
Printer's paper detected as ready
Printer's paper detected as almost
empty
Printer's paper detected as empty

StarIO_Extension.StarIo
ExtManagerStatus

3.8.8 printerCoverOpenStatus property


Printer cover's open status
Syntax

public StarIO_Extention.StarIoExtManagerStatus printerCoverOpenStatus { get; }


Property
value

Description

Type

Printer cover's open status


Invalid:
Impossible:
PrinterCoverOpen:
PrinterCoverClose:

Invalid
Equipment not functioning
Printer's cover detected as open
Printer's cover detected as closed

StarIO_Extension.StarIo
ExtManagerStatus

62 / 90
2016 Star Micronics. All rights reserved.

3.8.9 cashDrawerOpenStatus property


Cash drawer's open status
Syntax

public StarIO_Extention.StarIoExtManagerStatus cashDrawerOpenStatus { get; }


Property
value

Description

Type

Cash drawer's open status


Invalid:
Impossible:
CashDrawerOpen:
CashDrawerClose:

Invalid
Equipment not functioning
Cash drawer detected as open
Cash drawer detected as closed

StarIO_Extension.StarIo
ExtManagerStatus

3.8.10 barcodeReaderConnectStatus property


Barcode reader's connection status
Syntax

public StarIO_Extention.StarIoExtManagerStatus barcodeReaderConnectStatus { get; }


Property
value

Description

Type

Barcode reader's connection status


Invalid:
Invalid
Impossible:
Equipment not functioning
BarcodeReaderConnect:
Barcode reader detected as
connected
BarcodeReaderDisconnect Barcode reader detected as
:
disconnected

StarIO_Extension.StarIo
ExtManagerStatus

3.8.11 cashDrawerOpenActiveHigh property


Mode of the cash drawer's open sensor
Syntax

public StarIO_Extention.StarIoExtManagerStatus barcodeReaderConnectStatus { get; set;}


Property
value

Description

Type

Mode of the cash drawer's open sensor


true:
Active high
false:
Active low
* Must be the default value (true) for the mPOP mechanism.

bool

63 / 90
2016 Star Micronics. All rights reserved.

3.8.12 PrinterImpossibleEvent event


Occurs when the printer is not functioning.
Syntax

public event EventHandler<Object> PrinterImpossibleEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

64 / 90
2016 Star Micronics. All rights reserved.

3.8.13 PrinterOnlineEvent event


Occurs when the printer is online.
Syntax

public event EventHandler<Object> PrinterOnlineEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

65 / 90
2016 Star Micronics. All rights reserved.

3.8.14 PrinterOfflineEvent event


Occurs when the printer is offline.
Syntax

public event EventHandler<Object> PrinterOfflineEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

66 / 90
2016 Star Micronics. All rights reserved.

3.8.15 PrinterPaperReadyEvent event


Occurs when the printer's paper is ready.
Syntax

public event EventHandler<Object> PrinterOfflineEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

67 / 90
2016 Star Micronics. All rights reserved.

3.8.16 PrinterPaperNearEmptyEvent event


Occurs when the printer is almost out of paper.
Syntax

public event EventHandler<Object> PrinterPaperNearEmptyEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

68 / 90
2016 Star Micronics. All rights reserved.

3.8.17 PrinterPaperEmptyEvent event


Occurs when the printer is out of paper.
Syntax

public event EventHandler<Object> PrinterPaperEmptyEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

69 / 90
2016 Star Micronics. All rights reserved.

3.8.18 PrinterCoverOpenEvent event


Occurs when the printer's cover is open.
Syntax

public event EventHandler<Object> PrinterCoverOpenEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

70 / 90
2016 Star Micronics. All rights reserved.

3.8.19 PrinterCoverClosedEvent event


Occurs when the printer's cover is closed.
Syntax

public event EventHandler<Object> PrinterCoverCloseEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

71 / 90
2016 Star Micronics. All rights reserved.

3.8.20 CashDrawerOpenEvent event


Occurs when the cash drawer is open.
Syntax

public event EventHandler<Object> CashDrawerOpenEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

72 / 90
2016 Star Micronics. All rights reserved.

3.8.21 CashDrawerCloseEvent event


Occurs when the cash drawer is closed.
Syntax

public event EventHandler<Object> CashDrawerCloseEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

73 / 90
2016 Star Micronics. All rights reserved.

3.8.22 BarcodeReaderImpossibleEvent event


Occurs when the barcode reader is not functioning.
Syntax

public event EventHandler<Object> BarcodeReaderImpossibleEvent;


Example
using StarIO_Extension;
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

74 / 90
2016 Star Micronics. All rights reserved.

3.8.23 BarcodeReaderConnectEvent event


Occurs when the barcode reader is connected.
Syntax

public event EventHandler<Object> BarcodeReaderConnectEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

75 / 90
2016 Star Micronics. All rights reserved.

3.8.24 BarcodeReaderDisconnectEvent event


Occurs when the barcode reader is disconnected.
Syntax

public event EventHandler<Object> BarcodeReaderDisconnectEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

76 / 90
2016 Star Micronics. All rights reserved.

3.8.25 BarcodeDataReceivedEvent event


Occurs when data has been received from the barcode reader.
Syntax

public event EventHandler<Object> BarcodeDataReceivedEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

77 / 90
2016 Star Micronics. All rights reserved.

3.8.26 AccessoryConnectSuccessEvent event


Occurs when an accessory connection succeeded.
Syntax

public event EventHandler<Object> AccessoryConnectSuccessEvent;


Example
using StarIO_Extension;
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

78 / 90
2016 Star Micronics. All rights reserved.

3.8.27 AccessoryConnectFailureEvent event


Occurs when an accessory connection failed.
Syntax

public event EventHandler<Object> AccessoryConnectFailureEvent;


Example
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

79 / 90
2016 Star Micronics. All rights reserved.

3.8.28 AccessoryDisconnectEvent event


Occurs when an accessory is disconnected.
Syntax

public event EventHandler<Object> AccessoryDisconnectEvent;


Example
using StarIO_Extension;
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
});
}

Refer to BarcodeReaderwithPrintPage.xaml.cs.

80 / 90
2016 Star Micronics. All rights reserved.

3.9 StarIoExtManagerType enumeration


Manager type constants
Syntax

public enum StarIoExtManagerType


Member

Description

Standard
WithBarcodeReader
OnlyBarcodeReader

Management of the printer and the cash drawer


Management of the printer, the cash drawer, and the barcode reader
Management of the barcode reader

Namespace

StarIO_Extension

81 / 90
2016 Star Micronics. All rights reserved.

3.10 StarIoExtManagerStatus enumeration


Status constants
A StarIoExtManagerStatus enumeration is returned by the printerOnlineStatus property, the
printerPaperReadyStatus property, the printerCoverOpenStatus property, the cashDrawerOpenStatus
property, and the barcodeReaderConnectStatus property in the StarIOExtManager class.
Syntax

public enum StarIoExtManagerStatus


Member

Description

Invalid
Impossible
PrinterOnline
PrinterOffline
PrinterPaperReady
PrinterPaperNearEmpty
PrinterPaperEmpty
PrinterCoverOpen
PrinterCoverClose
CashDrawerOpen
CashDrawerClose
BarcodeReaderConnect
BarcodeReaderDisconnect

Invalid
Equipment not functioning
Printer detected as online
Printer detected as offline
Printer paper detected as ready
Printer paper detected as almost empty
Printer paper detected as empty
Printer cover detected as open
Printer cover detected as closed
Cash drawer detected as open
Cash drawer detected as closed
Barcode reader connection detected
Barcode reader disconnection detected

Namespace

StarIO_Extension

82 / 90
2016 Star Micronics. All rights reserved.

3.11 SCBFactory class


Syntax

public sealed class SCBFactory


Constructor

Method

Description

createBuilder

Creates an ISCBBuilder object.

Property

Namespace

StarIO_Extension

3.11.1 createBuilder method


Creates an ISCBBuilder object.
Syntax

public static ISCBBuilder createBuilder(StarIO_Extension.Emulation emulation)


Argument

Description

Type

emulation

Emulation type

StarIO_Extension.Emulation

Return value

Description

Type

ISCBBuilder

ISCBBuilder object

ISCBBuilder

Example
using StarIO_Extension;
ISCBBuilder builder = SCBFactory.createBuilder(Emulation.StarLine);

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


RasterReceiptPrintPage.xaml.cs.

83 / 90
2016 Star Micronics. All rights reserved.

3.12 ISCBBulider interface


Method

Description

beginDocument
endDocument
appendCutPaper
appendPeripheral
appendBitmapAsync
getBuffer

Generates a print start command.


Generates a print end command.
Generates a cut command.
Generates a drawer command.
Generates a bitmap print command.
Gets the generated command.

3.12.1 beginDocument method


Generates a print start command.
Syntax

void beginDocument()
Argument

Return value

Return value by asynchronous action

Example
using StarIO_Extension;
//In starLine emulation case
ISCBBuilder builder = SCBFactory.createBuilder(Emulation.StarLine);
builder.beginDocument();

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


RasterReceiptPrintPage.xaml.cs.

84 / 90
2016 Star Micronics. All rights reserved.

3.12.2 endDocument method


Generates a print end command.
Syntax

void endDocument()
Argument

Return value

Return value by asynchronous action

Example
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();

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


RasterReceiptPrintPage.xaml.cs.

85 / 90
2016 Star Micronics. All rights reserved.

3.12.3 appendCutPaper method


Generates a cut command.
Syntax

void appendCutPaper(StarIO_Extension.SCBCutPaperAction action)


Argument

Description

Type

action

Cut action type

StarIO_Extension.SCBCutPaperAction

Return value

Return value by asynchronous action

Example
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);

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


RasterReceiptPrintPage.xaml.cs.

86 / 90
2016 Star Micronics. All rights reserved.

3.12.4 appendPeripheral method


Generates a drawer command.
Syntax

appendPeripheral(StarIO_Extension.SCBPeripheralChannel channel, int time)


Argument

Description

Type

channel

Specifies either external device 1 or external device 2


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

StarIO_Extension.SCBPer
ipheralChannel

Argument

Description

Type

time

Specifies the energizing time (ms) and the delay time (ms) for
activating the external device
time [milliseconds]: (101270)

StarIO_Extension.SCBPer
ipheralChannel

Return value

Return value by asynchronous action

Example
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);

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


RasterReceiptPrintPage.xaml.cs.

87 / 90
2016 Star Micronics. All rights reserved.

3.12.5 appendBitmapAsync method


Generates a bitmap print command.
Syntax

IAsyncAction appendBitmapAsync(Windows.Graphics.Imaging.BitmapDecoder bitmapDecoder, bool


diffusion, uint width, bool bothScale, StarIO_Extension.SCBBitmapConverterRotation rotation)
Argument

Description

Type

bitmapDecoder

Source BitmapDecoder object

Windows.Graphics.Imagin
g.BitmapDecoder

Argument

Description

Type

diffusion

Random dither
true:
Use random dithering
false:
Do not use random dithering

bool

Argument

Description

Type

width

Bitmap width after conversion (unit: dots)

unit

Argument

Description

Type

bothScale

Specifies whether to scale the height according to the scaling


percentage of the width
true:
Scale the height
false:
Do not scale the height

bool

Argument

Description

Type

rotation

Rotation
Normal:
Right90:
Left90:
Rotate180

Do not rotate
Rotate 90 degrees to the right
Rotate 90 degrees to the left
Rotate 180 degrees

Return value

Description

IAsyncAction

Object for managing asynchronous operation

StarIO_Extension.SCBBit
mapConverterRotation

Return value by asynchronous action

Example
using StarIO_Extension;
//In starLine emulation case
ISCBBuilder builder = SCBFactory.createBuilder(Emulation.StarLine);
builder.beginDocument();
await builder.appendBitmapAsync(logoData, false, 576, true, SCBBitmapConverterRotation.Normal);

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


RasterReceiptPrintPage.xaml.cs.

88 / 90
2016 Star Micronics. All rights reserved.

3.12.6 getBuffer method


Gets the generated command.
Syntax

IBuffer getBuffer()
Argument

Return value

Example
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();

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


RasterReceiptPrintPage.xaml.cs.

89 / 90
2016 Star Micronics. All rights reserved.

3.13 Emulation enumeration


Emulation constants
Member

Description

StarLine
StarPRNT
StarGraphic

StarLine emulation
StarPRNT emulation
StarGraphic emulation

Namespace

StarIO_Extension

3.14 SCBBitmapConverterRotation enumeration


Rotation constants
Member

Description

Normal
Right90
Left90
Rotate180

Do not rotate
Rotate 90 degrees to the right
Rotate 90 degrees to the left
Rotate 180 degrees

Namespace

StarIO_Extension

3.15 SCBCutPaperAction enumeration


Paper cutting action constants
Member

Description

FullCut
PartialCut
FullCutWithFeed
PartialCutWithFeed

Full cutoff at the current position


Partial cutoff at the current position
Feed the paper to the cutting position and then full cutoff
Feed the paper to the cutting position and then partial cutoff

Namespace

StarIO_Extension

3.16 SCBPeripheralChannel enumeration


External driving device constants
Member

Description

ChannelNo1
ChannelNo2

External driving device 1


External driving device 2

Namespace

StarIO_Extension

90 / 90
2016 Star Micronics. All rights reserved.

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