6.5 Bluetooth Plug-in

The following table lists all the methods that the Bluetooth plug-in supports.

Method

Syntax

Description

Response

getdevices

https://127.0.0.1:8440/api/v1/bluetooth/getdevices

This GET method either returns a JSON array of all discovered Bluetooth devices or an error code if Bluetooth is turned off.

{
"devices":
[
{
"name":"MagicKeyboard","address":"9cd746e1234","type":"peripheral","hash":"9b67e2d07088a1f0bd64bde8c44ab7cdc279463bd6d93735ab778afda79d0bde"
},
{
"name":"MagicMouse","address":"1abcd22dafae","type":"peripheral","hash":"dbf75830268ab5516a0d658d28105761b6d6ec062a42317a84b3a82e8e4d643f"},
{
"name":"Lex'siPhone","address":"40cd0150cf58","type":"phone","hash":"ac904cc2e2626ca27eb7f4100166e0ae07957da89a5a3aa52f0a5d182b6ba42e"
}
]
}

where:

  • name indicates the Bluetooth device name.

  • address indicates address of the device

  • type indicates device type. The type can be one of the following:

    • computer

    • phone

    • lan_access

    • audio

    • peripheral

    • imaging

    • unclassified

detectdevice

https://127.0.0.1:8440/api/v1/bluetooth/detectdevice Request Body {"address":"[RSA encoded address]"}

where RSA encoded address is address of Bluetooth device encoded with an RSA public key (from certificate) in the hex-string format.

This POST method is used to test the presence of device with its address

If the device is in range, the service returns:

{"result":"CONNECTED","address":"40cd0150cf58"}

if the device is not within the range or the Bluetooth is turned OFF on the device, the service returns:

{"result":"DISCONNECTED"}

Following are the other possible result values for this method:

  • FAILED: Indicates general failure

  • DECRYPT_FAILED: Indicates failure while decoding

  • INVALID_ADDRESS: Indicates invalid address of the device

  • hash: Indicates SHA256 hash of the address

  • BLUETOOTH_DISABLED: Indicates Bluetooth is turned OFF.

getpublickey

https://127.0.0.1:8440/api/v1/bluetooth/getpublickey

This GET method returns the public certificate in the PEM format. The Bluetooth address is encoded with the public key in that certificate.

{"publicKey":"[PUBLIC_CERT]"}

where:

  • PUBLIC_CERT indicates the public certificate in the PEM format.

  • publickey displays public key of the device in the following format:

    "-----BEGIN RSA PUBLIC KEY-----\n" 
    
    "MIGHAoGBAKqGJxyB/ZgrTEsfqmMdE4GRwGH+XOioOa0EiQ8+HYcR8Pcg57j1Cc5k\n" 
    
    "D1TrGNKpayWUWW7YEsXvfSpc5a5x9qwsEe06Iak5eP/PcGNLUViLwy2CN9oy5mSM\n" 
     
    "Izpd607GNBUzEwWg0sIpm3FBEvtFFDxBb7PzE9W4hE//t0LQkGcTAgED\n"
    
    "-----END RSA PUBLIC KEY-----";