Members
(static) EventName :string
Bluetooth event names that can be subscribed to for using window.addEventListener to receive bluetooth events.
Type:
- string
Properties:
Name | Type | Description |
---|---|---|
ON_PAIR_SUCCESS |
string | |
ON_PAIR_FAIL |
string | |
ON_PAIR_START |
string | |
ON_READ_SUCCESS |
string | |
ON_READ_FAIL |
string | |
ON_READY_TO_READ |
string | |
ON_READ_CANCEL |
string | |
ON_PASSIVE_DID_READ |
string | |
ON_PASSIVE_DID_FAIL |
string | |
ON_PASSIVE_DID_CANCEL |
string | |
ON_PASSIVE_READY_TO_READ |
string |
- Source:
Methods
(static) cancel()
Cancels a bluetooth reading or pairing. Listeners should receive an onReadCancel event after cancelling
reading or pairing.
- Source:
(static) getPassiveReadPeripheralIDs(success)
Parameters:
Name | Type | Description |
---|---|---|
success |
getPassiveReadPeripheralIDsCallback | Response containing array of currently subscribed sample types. |
- Source:
(static) getPeripheral(id, success, error)
Gets information about a peripheral with a given id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of peripheral to retrieve information about. |
success |
PeripheralCallback | Callback function including peripheral information. |
error |
FailCallback | Callback function indicating an error trying to receive info about peripheral or if id is not an integer. |
- Source:
(static) getPeripheralsOfType(type, success, error)
Gets an array of supported peripherals matching a peripheral type.
Parameters:
Name | Type | Description |
---|---|---|
type |
number | Type of peripheral to return list for. See ValidicMobile.PeripheralType. |
success |
PeripheralsOfTypeCallback | Callback function containing an array of all peripherals matching given type. |
error |
FailCallback | callback function indicating invalid type. |
- Source:
(static) getSupportedPeripherals(success)
Gets an array of supported peripherals for use with bluetooth.
Parameters:
Name | Type | Description |
---|---|---|
success |
PeripheralsCallback | Callback function containing an array of peripheral devices. |
- Source:
(static) isInProgress(success)
Indicates a reading is being taken from a paired peripheral.
Parameters:
Name | Type | Description |
---|---|---|
success |
InProgressCallback | Callback containing a boolean value containing true when a reading is being taken, otherwise false. |
- Source:
(static) pair(id, success, fail)
Pairs a bluetooth device.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | id of the device to pair with. |
success |
EventCallback | All bluetooth pair success methods flow through this callback. |
fail |
EventCallback | All bluetooth pair failure/cancel methods flow through this callback. |
- Source:
(static) read(id, success, fail)
Reads from a paired bluetooth device.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Peripheral Id to read from. |
success |
EventCallback | All bluetooth read success callbacks flow through this callback. |
fail |
EventCallback | All bluetooth read fail and cancel callbacks flow through this callback. |
- Source:
(static) setBluetoothPassiveListener(success, fail)
Registers listener for passive bluetooth read events. It is recommended to use event listeners instead.
Parameters:
Name | Type | Description |
---|---|---|
success |
PassiveBluetoothCallback | Function invoked when passive bluetooth records have been processed and submitted or when peripheral becomes ready to read. |
fail |
PassiveBluetoothCallback | Function invoked when passive bluetooth read is attempted but fails. |
- Source:
(static) setPassiveReadPeripheralIDs(params, success, error)
Set list of Bluetooth peripheral IDs which should be passively read. Once set, the library will listen for and read from
these devices when the app is in foreground or background.
To stop passive Bluetooth read, pass an empty array of IDs or null.
Parameters:
Name | Type | Description |
---|---|---|
params |
PassiveBluetoothOptions | Options for passive Bluetooth Scanning. For |
success |
Object | - |
error |
FailCallback | Invalid parameters were given. |
- Source: