Class that implements the Bluetooth Classic specific communication and extends the AComm class. More...
Public Member Functions | |
| BTClassicConnection (String descriptor) | |
| Initialize new class instance based on descriptor string. More... | |
| BTClassicConnection (long bt_address) | |
| Initialize new class instance based on macAddress. Bluetooth pairing with the printer is required before connecting. More... | |
| int | BytesAvailable () |
| String | Descriptor () |
| boolean | Connected () |
| void | Close () |
| void | Open () |
| byte[] | Read () |
| void | Write (byte[] dataOut) |
Public Member Functions inherited from com.UniPRT.Sdk.Comm.AComm | |
| void | Read (OutputStream binDataIn) throws IOException |
| void | WaitForData (int msTimeOut) |
| Waits until data available BytesAvailable in current thread. Current thread sleeps until data received or timeout reached. Blocking call. More... | |
| void | Write (InputStream binReader) throws IOException |
| Write from input stream to output stream. More... | |
| void | WriteAndWaitForResponse (OutputStream binDataIn, InputStream binDataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException |
| Write binDataOut stream data to output stream and return data received in binDataIn stream. Data returned is any data received or up to completion token if received. Wait for response timeout before returning. More... | |
| byte[] | WriteAndWaitForResponse (byte[] dataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException |
| Write byte data to output stream and return data received. Data returned is any data received or up to completion token if received. Wait for response timeout before returning. More... | |
Static Public Member Functions | |
| static long | DescriptorValidate (String descriptorHint) |
| Validate descriptor string from descriptorHint that may or may not have a v_id and p_id. Returns long. More... | |
Private Attributes | |
| BluetoothAdapter | mBluetoothAdapter = null |
| BluetoothSocket | btSocket = null |
| OutputStream | OutStream = null |
| InputStream | InStream = null |
| long | _bt_address |
Static Private Attributes | |
| static final UUID | MY_UUID_SECURE = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB") |
| static final int | BLOCK_SIZE = 1024 |
Class that implements the Bluetooth Classic specific communication and extends the AComm class.
| com.UniPRT.Sdk.Comm.BTClassicConnection.BTClassicConnection | ( | String | descriptor | ) |
Initialize new class instance based on descriptor string.
| descriptor | Acceptable Formats:
|
References com.UniPRT.Sdk.Comm.BTClassicConnection._bt_address, and com.UniPRT.Sdk.Comm.BTClassicConnection.DescriptorValidate().
| com.UniPRT.Sdk.Comm.BTClassicConnection.BTClassicConnection | ( | long | bt_address | ) |
Initialize new class instance based on macAddress. Bluetooth pairing with the printer is required before connecting.
| [in] | macAddress | Specify the printer to be connected via the Bluetooth MAC address of the printer. e.g. 0x0080A3123456L |
| int com.UniPRT.Sdk.Comm.BTClassicConnection.BytesAvailable | ( | ) |
Get the number of bytes available to read.
Implements com.UniPRT.Sdk.Comm.IComm.
References com.UniPRT.Sdk.Comm.BTClassicConnection.InStream.
Referenced by com.UniPRT.Sdk.Comm.BTClassicConnection.Read().
| void com.UniPRT.Sdk.Comm.BTClassicConnection.Close | ( | ) |
Close the connection.
Implements com.UniPRT.Sdk.Comm.IComm.
References com.UniPRT.Sdk.Comm.BTClassicConnection.btSocket, com.UniPRT.Sdk.Comm.BTClassicConnection.InStream, and com.UniPRT.Sdk.Comm.BTClassicConnection.OutStream.
Referenced by com.UniPRT.Sdk.Comm.BTClassicConnection.Open().
| boolean com.UniPRT.Sdk.Comm.BTClassicConnection.Connected | ( | ) |
Check if connection is established.
Implements com.UniPRT.Sdk.Comm.IComm.
References com.UniPRT.Sdk.Comm.BTClassicConnection.btSocket.
| String com.UniPRT.Sdk.Comm.BTClassicConnection.Descriptor | ( | ) |
Get the string descriptor of the connection.
Implements com.UniPRT.Sdk.Comm.IComm.
References com.UniPRT.Sdk.Comm.BTClassicConnection._bt_address.
|
static |
Validate descriptor string from descriptorHint that may or may not have a v_id and p_id. Returns long.
descriptorHint accepted values:
Referenced by com.UniPRT.Sdk.Comm.BTClassicConnection.BTClassicConnection().
| void com.UniPRT.Sdk.Comm.BTClassicConnection.Open | ( | ) |
Open the connection.
Implements com.UniPRT.Sdk.Comm.IComm.
References com.UniPRT.Sdk.Comm.BTClassicConnection._bt_address, com.UniPRT.Sdk.Comm.BTClassicConnection.btSocket, com.UniPRT.Sdk.Comm.BTClassicConnection.Close(), com.UniPRT.Sdk.Comm.BTClassicConnection.InStream, com.UniPRT.Sdk.Comm.BTClassicConnection.mBluetoothAdapter, com.UniPRT.Sdk.Comm.BTClassicConnection.MY_UUID_SECURE, and com.UniPRT.Sdk.Comm.BTClassicConnection.OutStream.
| byte [] com.UniPRT.Sdk.Comm.BTClassicConnection.Read | ( | ) |
Read all available bytes.
Implements com.UniPRT.Sdk.Comm.IComm.
References com.UniPRT.Sdk.Comm.BTClassicConnection.BytesAvailable(), and com.UniPRT.Sdk.Comm.BTClassicConnection.InStream.
| void com.UniPRT.Sdk.Comm.BTClassicConnection.Write | ( | byte[] | dataOut | ) |
Write all bytes from the array passed in.
| dataOut | Byte array to write. |
Implements com.UniPRT.Sdk.Comm.IComm.
References com.UniPRT.Sdk.Comm.BTClassicConnection.BLOCK_SIZE, and com.UniPRT.Sdk.Comm.BTClassicConnection.OutStream.
|
private |
|
staticprivate |
Referenced by com.UniPRT.Sdk.Comm.BTClassicConnection.Write().
|
private |
|
private |
|
private |
Referenced by com.UniPRT.Sdk.Comm.BTClassicConnection.Open().
|
staticprivate |
Referenced by com.UniPRT.Sdk.Comm.BTClassicConnection.Open().
|
private |