105
CITIZEN UWP POS Print SDK - Programming Manual
4.3.3. ConnectAsync method
Syntax
1)
Task<int> ConnectAsync (int connectType, String addr)
2)
Task<int> ConnectAsync (int connectType, String addr, int port)
3)
Task<int> ConnectAsync (int connectType, String addr, int port, int timeout)
Parameter
The meaning and the setting range of the parameters are as follows.
Value
[IN/OUT]
Meaning
Setting range
connectType
[IN]
Connection type of the
printer
CSC_PORT_WiFi
CSC_PORT_Bluetooth
addr
[IN]
IP address or BD address to
connect
WiFi:
0.0.0.0
~
255.255.255.255
Bluetooth: 00:00:00:00:00:00~
FF:FF:FF:FF:FF:FF
port
[IN]
Connection port number
timeout
[IN]
Timeout (msec)
Description
This method is used to connect the barcode scanner. Please specify the type and address of the printer
to which the barcode scanner is connected.
Connection port number is valid only if you specify the connection type CSC_PORT_WiFi. If it is omitted,
you connected with number 9210.
Timeout is gives the maximum number of milliseconds to connect scanner. If it is omitted, you
connected with 4000 milliseconds when using WiFi.
When communication with the scanner is not necessary, must execute the
disconnect the scanner connection. When not disconnect, the next connection will be an error.
Return value
Return CSC_SUCCESS (0) in success. Please check the description of the error codes below in the case
of failure. Please refer to "
" for the error code except it.
Error codes
Description
CSC_E_NOTCONNECT (1003)
Failed connection to the scanner.
(1) The scanner is under none-connection status.
(2) The printer is not turned ON.
(3) Cannot obtain handle of interface board.
Example
await scanner.ConnectAsync(ScannerConst.CSC_PORT_WiFi, "192.168.0.10");