Connectasync Method - Citizen CT-D101 Series Programming Manual

Hide thumbs Also See for CT-D101 Series:
Table of Contents

Advertisement

2.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
connectType
addr
port
timeout
Description
This method is used to connect the printer. Please specify the type and address of the printer
connection.
Connection port number is valid only if you specify the connection type CMP_PORT_WiFi. If it is omitted,
you connected with number 9100.
Timeout is giving the maximum number of milliseconds to connect printer. If it is omitted, you
connected with 8000 milliseconds when using Bluetooth and connected with 4000 milliseconds in other
cases.
When connecting to the printer, this SDK also checks the status of the printer and the supporting
models.
When communication with the printer is not necessary, must execute the
disconnect the printer connection. When not disconnect, the next connection will be an error.
An application with this SDK connects to a Bluetooth printer for the first time, Windows shows the
consent dialog to accept to use the Bluetooth device (printer). The "timeout" parameter is invalid while
this dialog is shown. To show this dialog, write ConnectAsync method in the UI thread, or it will not
show and fails to connect.
There are declarations to use "Bluetooth" or "Internet (Client)", "Private Networks (Client & Server)" in
the "Capabilities" tab of the Package.appxmanifest which is created by the Visual Studio in the new
project files. Set them correctly, or Windows prevent to use these interfaces.
Return value
Return CMP_SUCCESS (0) in success. Please check the description of the error codes below in the case
of failure. Please refer to
Error codes
CMP_E_NOTCONNECT (1003)
CMP_E_CONNECT_NOTFOUND
(1004)
CMP_E_CONNECT_OFFLINE (1005)
[IN/OUT]
Meaning
[IN]
Connect type
[IN]
IP address or BD address to
connect.
[IN]
Connection port number
[IN]
Timeout (msec)
"2.3.1. Return
value" for the error code except it.
Description
Failed connection to the printer.
(1) The printer is under none-connection status.
(2) The printer is not turned ON.
(3) Cannot obtain handle of interface board.
Failed to check the support model after connecting to the printer.
(1) The model is not supported.
Failed to check the printer status after connecting to the printer.
The printer is connected but the following errors occurred.
CITIZEN UWP POS Print SDK - Programming Manual
Setting range
CMP_PORT_WiFi
CMP_PORT_Bluetooth
WiFi:
Bluetooth: 00:00:00:00:00:00~
30
0.0.0.0~255.255.255.255
FF:FF:FF:FF:FF:FF
DisconnectAsync method
to

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents