Methods
(static) this.connect(address, pin, successFunction, errorFunction)
Attempts to connect to remote device
Parameters:
| Name | Type | Description |
|---|---|---|
address |
string | Bluetooth address |
pin |
string | PIN code if needed, or null to try unencrypted connection |
successFunction |
function | Success function |
errorFunction |
function | Error function |
- Source:
(static) this.disconnect(address, successFunction, errorFunction)
Disconnects from remote device
Parameters:
| Name | Type | Description |
|---|---|---|
address |
string | Bluetooth address returned from discoverDevices/discoverPrinters |
successFunction |
function | Success function |
errorFunction |
function | Error function |
- Source:
(static) this.discoverDevices(maxDevices, maxTimeout, codTypes, errorFunction)
Performs background discovery of the nearby bluetooth devices. The discovery status and devices found will be sent via delegate notifications.
Parameters:
| Name | Type | Description |
|---|---|---|
maxDevices |
number | Maximum results to return |
maxTimeout |
number | Max time to discover, in seconds. Actual time may vary. |
codTypes |
number | Bluetooth Class Of Device to look for or 0 to search for all bluetooth devices |
errorFunction |
function | Error function |
- Source:
(static) this.discoverPrinters(maxDevices, maxTimeout, errorFunction)
Performs background discovery of supported printers. The discovery status and devices found will be sent via delegate notifications.
Parameters:
| Name | Type | Description |
|---|---|---|
maxDevices |
number | Maximum results to return |
maxTimeout |
number | Max time to discover, in seconds. Actual time may vary. |
errorFunction |
function | Error function |
- Source:
(static) this.getEnabled(statusFunction, errorFunction)
Check if bluetooth is enabled
Parameters:
| Name | Type | Description |
|---|---|---|
statusFunction |
function | The callback that will get bluetooth status passing back |
errorFunction |
function | The callback that will receive error |
- Source:
(static) this.monitorDeviceDiscovered(deviceDiscovered)
Sets the callback function for device discovery
Parameters:
| Name | Type | Description |
|---|---|---|
deviceDiscovered |
function | Callback function called when device is discovered |
- Source:
(static) this.monitorDiscoveryComplete(discoveryComplete)
Sets the callback function for monitor discovery
Parameters:
| Name | Type | Description |
|---|---|---|
discoveryComplete |
function | Callback function called when bluetooth discovery is complete |
- Source:
(static) this.monitorStatus(bluetoothStatus)
Monitor the status of bluetooth. The callback function will get called anytime there is a change to bluetooth status.
Parameters:
| Name | Type | Description |
|---|---|---|
bluetoothStatus |
function | The callback that will receive bluetooth status updates. Format: bluetoothStatus(function) - 1 = Connected - 2 = Data Ready to Read - 8 = Error - 16 = Disconnected |
- Source:
(static) this.printerConnect(address, pin, successFunction, errorFunction)
Attempts to connect to remote printer
Parameters:
| Name | Type | Description |
|---|---|---|
address |
string | Bluetooth address |
pin |
string | PIN code if needed, or null to try unencrypted connection |
successFunction |
function | Success function |
errorFunction |
function | Error function |
- Source:
(static) this.read(maxLength, maxTimeout, receiveFunction, errorFunction)
Tries to read data from the connected remote device for specified timeout
Parameters:
| Name | Type | Description |
|---|---|---|
maxLength |
number | Maximum amount of bytes to wait for |
maxTimeout |
number | Maximum timeout in seconds to wait for data |
receiveFunction |
function | Function that receives read data |
errorFunction |
function | Error function |
- Source:
(static) this.setEnabled(enabled, statusFunction, errorFunction)
Enables or disables scanner's bluetooth
Parameters:
| Name | Type | Description |
|---|---|---|
enabled |
boolean | Enable or disable bluetooth |
statusFunction |
function | The callback that will get bluetooth status passing back |
errorFunction |
function | The callback that will receive error |
- Source:
(static) this.write(data, errorFunction)
Sends data to the connected remote device
Parameters:
| Name | Type | Description |
|---|---|---|
data |
string | Data to write |
errorFunction |
function | Error function |
- Source:
(static) this.writeStream(data, errorFunction)
Writes the contents of a provided data buffer to the receiver
Parameters:
| Name | Type | Description |
|---|---|---|
data |
string | Data to write |
errorFunction |
function | Error function |
- Source:
(static) this.writeStreamData(data, errorFunction)
Writes the contents of a provided data buffer to the receiver
Parameters:
| Name | Type | Description |
|---|---|---|
data |
string | Data to write |
errorFunction |
function | Error function |
- Source: