Extension qnx.bluetooth

qnx.bluetooth

Manage Bluetooth operations

Search Events

bluetoothnewdevice

When new device found, event contains object representing found device

Event data

callback parameter {Object}

Example
{
     mac:{String},           //MAC address of the device
     ccod:{String},          //Class Of Device, describes device capabilities
     name:{String},          //device name
     paired:{Boolean},       //indicates if device paired, true if paired
     rssi:{String}           //Received signal strength indication, value indicates power present in a received radio signal for given device
}

bluetoothsearchcomplete

When Search is completed

bluetoothsearchcancelled

When Search is cancelled

Pairing events

bluetoothpairingcomplete

Indicates that pairing with device successful

Event data

callback parameter {String}

Example
mac:{String}		//MAC address of the device

bluetoothinitpairingfail

Indicate that pairing failed

Event data

callback parameter {String}

Example
mac:{String}		//MAC address of the device

bluetoothinitpairingsuccess

Indicate that the initialization of the pairing process successful

Event data

callback parameter {String}

Example
mac:{String}		//MAC address of the device

bluetoothpairingfailed

Indicate that the initialization of the pairing process failed

Event data

callback parameter {String}

Example
mac:{String}		//MAC address of the device

bluetoothpairingcancelled

Indicate that pairing is cancelled

Event data

callback parameter {String}

Example
mac:"{String}		//MAC address of the device

bluetoothauthrequest

Indicate an incoming authorization request

Event data

callback parameter {Object}

Example
{
     mac:{String},           //MAC address of the device
     type:{String},          //contains type of the authorization request, one of public constants LEGACY_PIN, AUTHORIZE, PASS_KEY, ACCEPT_PASS_KEY, DISPLAY_PASS_KEY
     passkey:{String}        //[Optional] if type = ACCEPT_PASS_KEY, DISPLAY_PASS_KEY contains passkey to display, otherwise undefined
}

bluetoothcommandfailed

Indicates that current command failed

bluetoothnewpaireddevice

When device paired

Event data

callback parameter {Object}

Example
{
     mac:{String},           //MAC address of the device
     ccod:{String},          //Class Of Device, describes device capabilities
     name:{String},          //device name
     paired:{Boolean},       //indicates if device paired, true if paired
     rssi:{String}           //Received signal strength indication, value indicates power present in a received radio signal for given device
}

Other events

commandfailed

Triggered when command failed

bluetoothcommandbusy

Triggered when Bluetooth stack busy

bluetoothserviceconnected

Triggered when service connected

Event data

callback parameter {Object}

Example
{
     mac:{String},           //MAC address of the device
     serviceid:{String}      //contains string representing Bluetooth service ID
} 

bluetoothserviceconnectfailed

Triggered when service connect failed

Event data

callback parameter {Object}

Example
{
     mac:{String},           //MAC address of the device
     serviceid:{String}      //contains string representing Bluetooth service ID
} 

bluetoothservicedisconnected

Triggered when service disconnected, event provides MAC address

Event data

callback parameter {Object}

Example
{
     mac:{String},           //MAC address of the device
     serviceid:{String}      //contains string representing Bluetooth service ID
} 

bluetoothpaireddevicedeleted

Triggered when paired device deleted successfully

Event data

callback parameter {String}

Example
      mac:{String}        //MAC address of the device

bluetoothpaireddevicedeletefailed

Triggered when paired device delete failed

Event data

callback parameter {String}

Example
      mac:{String}        //MAC address of the device

bluetoothaclconnected

Triggered when a low-level (ACL) connection has been established with a remote device.

Event data

callback parameter {String}

Example
      mac:{String}        //MAC address of the device

Members

ACCEPT_PASS_KEY

Request to display dialog to confirm displayed passkey

AUTHORIZE

To allow remote device connect.

DEVICE_CONNECTABLE_ONLY

Connectable but not discoverable.

DEVICE_DISCOVERABLE_ONLY

Discoverable but not connectable.

DEVICE_GENERAL_ACCESSIBLE

General discoverable and connectable.

DEVICE_LIMITED_ACCESSIBLE

Limited discoverable and connectable.

DEVICE_NOT_ACCESSIBLE

Not discoverable or connectable.

DISPLAY_PASS_KEY

Request to display dialog display passkey

LEGACY_PIN

To exchange legacy PIN (usually hardcoded)

PASS_KEY

Request to display dialog to enter authorization passkey

SERVICE_ALL

Defines all allowed Profile ID for current device

SERVICE_HFP

Defines Handsfree Profile ID

SERVICE_MAP

Defines Message Access Profile ID

SERVICE_PBAP

Defines Phonebook Access Profile ID

SERVICE_SPP

Defines Serial Port Profile ID

Methods

cancelPair

Cancel a pairing operation in progress
Parameters:
Name Type Description
mac String MAC address of the device

cancelSearch

Cancel a search in progress

connectService

Connect to specified service on device with specified MAC address
Parameters:
Name Type Description
service String Service identifier
mac String MAC address of the device

disconnectService

Disconnect from specified service on device with specified MAC address
Parameters:
Name Type Description
service String Service identifier
mac String MAC address of the device

getConnectedDevices

Get a list of connected devices for Bluetooth services
Parameters:
Name Type Description
service String [optional] The Bluetooth service (e.g. SERVICE_HFP)

getOptions

Return Bluetooth settings, reading from PPS
Parameters:
Name Type Description
settings Array [optional] A list of settings to get; if omitted, all are returned
Returns:
The requested settings
Type
  • Object
Example
{
    accessibility:{Number},             //defines if host Bluetooth device will be visible to others
    active_connections:{Boolean},       //indicated if there is any active connection established, true if connection established
    btaddr:{String},                    //provides MAC address of host Bluetooth adapter
    enabled:{Boolean},                  //defines if Bluetooth is enabled and operational, true if operational
    name:{String},                      //defines Bluetooth device name which will be visible to others
    running:{Boolean},                  //indicated if Bluetooth stack is up and running, true if running
    sapphire_device:{String},           //indicates MAC address of the device currently connected via Bridge
    sapphire_device_p:{String},         //indicates MAC address of the device currently connected via Bridge
    sapphire_enabled:{Boolean}          //indicates if BlackBerry Bridge connected via SPP profile, true if connected
}

getPaired

Return a list of paired devices
Returns:
The currently paired device, or null
Type
  • Object

getServices

Get a list of available Bluetooth services for a device
Parameters:
Name Type Description
mac String MAC address of the device

pair

Initiate pairing to a Bluetooth device
Parameters:
Name Type Description
mac String MAC address of the device

removeDevice

Remove a paired device and revoke its authorization to pair
Parameters:
Name Type Description
mac Object MAC address of the Bluetooth device in question

saveDevice

Send authorization information to the BT stack.
Parameters:
Name Type Description
mac String MAC address of the device
parameters Object Parameters of the authorization response
Example
{
    type: {String}      //indicates type of the authorizations
    response: {String}  //data passed for authorizations response
}
Initiate the search for Bluetooth devices.

setAccessibilityMode

Set the Bluetooth device accessibility mode
Parameters:
Name Type Description
mode Number The value of the accessibility mode DEVICE_NOT_ACCESSIBLE, DEVICE_GENERAL_ACCESSIBLE, DEVICE_LIMITED_ACCESSIBLE, DEVICE_CONNECTABLE_ONLY, DEVICE_DISCOVERABLE_ONLY

setName

Set the Bluetooth name of the device
Parameters:
Name Type Description
name String The name to set

setOptions

Save Bluetooth settings to PPS
Parameters:
Name Type Description
settings Object Bluetooth settings to set
Example
{
    accessibility:{Number},             //defines if host Bluetooth device will be visible to others
    active_connections:{Boolean},       //indicated if there is any active connection established, true if connection established
    btaddr:{String},                    //provides MAC address of host Bluetooth adapter
    enabled:{Boolean},                  //defines if Bluetooth is enabled and operational, true if operational
    name:{String},                      //defines Bluetooth device name which will be visible to others
    running:{Boolean},                  //indicated if Bluetooth stack is up and running, true if running
    sapphire_device:{String},           //indicates MAC address of the device currently connected via Bridge
    sapphire_device_p:{String},         //indicates MAC address of the device currently connected via Bridge
    sapphire_enabled:{Boolean}          //indicates if BlackBerry Bridge connected via SPP profile, true if connected
}