BLE GATT

Service URI - luna://com.webos.service.blegatt

All methods return responses containing errorCode (Number) and errorText (String) when returnValue contains false. All responses from methods that have been subscribed to (i.e., were passed subscribe:true) contain subscribed.

The service informs the client that it will not send any further subscription responses by setting it to false (including the case when it rejects the initial subscription request in the method call). When the client receives a false value for subscribed, it must always call LSCallCancel() or handle.cancel().

Methods

Method

Description

Supported in Emulator

isEnabled

Check if Bluetooth is currently enabled and ready for use.

No

startScan

Starts scanning only for ble devices.

No

stopScan

Stops ongoing ble scanning.

No

getState

Gets information about the scanning status and connected/paired devices.

No

pair

Pairs a specific remote Bluetooth device.

No

unpair

Disconnects the paired remote device. All pairing information about the device will be removed.

No

client/connect

Connects the specified remote device to the GATT profile.

No

client/disconnect

Disconnects an established connection.

No

client/discoverServices

Discovers services offered by a remote device as well as their characteristics and descriptors.

No

client/getServices

Returns a list of GATT services offered by the remote device.

No

client/setCharacteristicNotification

Enables or disables notifications/indications for a given characteristic.

No

client/readCharacteristic

Reads the requested characteristic from the associated remote device.

No

client/readDescriptor

Reads the value for a given descriptor from the associated remote device.

No

client/writeCharacteristic

Writes a given characteristic and its values to the associated remote device.

No

client/writeDescriptor

Writes the value of a given descriptor to the associated remote device.

No

isEnabled

Description

Checks if Bluetooth is currently enabled and ready for use.

If the TV device’s Bluetooth adapter is enabled, the isEnabled return is true; or else, it is false. If the isEnabled return is false, BLE operations cannot be done. You should call the isEnabled method first and check if the isEnabled return is returned as true before running any BLE operations.

Parameters

Name

Required

Type

Description

subscribe

Optional

Boolean

Whether to subscribe for notifications on changes. Possible values are:

 • true: Subscribe.

 • false: Do not subscribe. Call the method only once. (Default).

Call returns

Name

Required

Type

Description

subscribed

Optional

Boolean

Indicates if subscribed to get notifications.

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

isEnabled

Required

Boolean

true if the local adapter is currently enabled and ready for use.

Example

// One-time call
var request = webOS.service.request("luna://com.webos.service.blegatt", {
  method: "isEnabled",
  parameters: {},
  onSuccess: function (inResponse) {
    console.log("Result: " + JSON.stringify(inResponse));
    // To-Do something
  },
  onFailure: function (inError) {
    console.log("[" + inError.errorCode + "]: " + inError.errorText);
    // To-Do something
  },
});
// Subscription
var subscriptionHandle = webOS.service.request(
  "luna://com.webos.service.blegatt",
  {
    method: "isEnabled",
    parameters: {
      subscribe: true,
    },
    onSuccess: function (inResponse) {
      if (typeof inResponse.subscribed !== "undefined") {
        if (!inResponse.subscribed) {
          console.log("Failed to subscribe");
          return;
        }
      }
      console.log("Result: " + JSON.stringify(inResponse));
      // To-Do something
    },
    onFailure: function (inError) {
      console.log("[" + inError.errorCode + "]: " + inError.errorText);
      // To-Do something
    },
  }
);
 
// If you need to unsubscribe the data, use cancel() method as below
subscriptionHandle.cancel();

Return Example

Success return

{
  "subscribed": true,
  "returnValue": true,
  "isEnabled": false
}

{
  "returnValue": true,
  "isEnabled": true
}

Failure return

{
  "returnValue": false,
  "errorCode": 105,
  "errorText": "Failed to parse incoming message"
}

startScan

Description

Starts scanning only for BLE devices.

If you want to search for a certain device containing a specific service UUID, include the service UUID in the uuid parameter when calling this method.

To avoid getting information about too many devices, it also allows picking out devices that include name in their advertising information only. To do so, include “scanType”:”name”in the parameter when calling the startScan method.

The return data contains name, rssi, mac address, manufacturer data, scan record of each searched device in a array format, and every time there is a change to the data, the subscribed return is delivered.

If there is no explicit call of the stopScan method after the startScan method is called, the scanning operation works for 60 seconds and then stops. After that, to resume scanning, you need to call the startScan method again.

To check if the scanning operation is underway, see the value of the isScan return of the getState method.

If the startScan method is called again while scanning is already underway, the returnValue will be false with errorCode:1003 and errorText: Scan is already in progress.

Parameters

Name

Required

Type

Description

subscribe

Required

Boolean

Whether to subscribe for notifications on changes. Possible values are:

 • true: Subscribe.

 • false: Do not subscribe. Call the method only once. (Default).

uuid

Required

String

To search for a certain device with a specific service UUID, enter the service uuid of the device.

serviceData

Object: serviceData

Object containing information about a serviceData to be advertised.

Call returns

Name

Required

Type

Description

subscribed

Required

Boolean

Indicates if subscribed to get notifications.

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

adapterAddress

Optional

String

The address of the TV Bluetooth adapter.

devices

Required

Object array: deviceStatus

"devices" will contain status information for all the devices known to the system, not just the ones whose status has been changed.

The name, rssi, mac address, manufacturer data, scan record of each device are delivered in an array format.

Example

// Subscription
var subscriptionHandle = webOS.service.request(
  "luna://com.webos.service.blegatt",
  {
    method: "startScan",
    parameters: {
      subscribe: true,
    },
    onSuccess: function (inResponse) {
      if (typeof inResponse.subscribed !== "undefined") {
        if (!inResponse.subscribed) {
          console.log("Failed to subscribe");
          return;
        }
      }
      console.log("Result: " + JSON.stringify(inResponse));
      // To-Do something
    },
    onFailure: function (inError) {
      console.log("[" + inError.errorCode + "]: " + inError.errorText);
      // To-Do something
    },
  }
);
// If you need to unsubscribe the data, use cancel() method as below
subscriptionHandle.cancel();

Return Example

Suceess return

{
  "subscribed": true,
  "returnValue": true
}

{
  "returnValue": true,
  "devices": [
    {
      "manufactureData": {
        "companyId": [87, 0],
        "value": [79, 32, 1, 52, 0, 0, 65, 58]
      },
      "name": "JBL Flip 6",
      "address": "55:fd:b4:8f:52:86",
      "scanRecord": [
        11, 255, 87, 0, 79, 32, 1, 52, 0, 0, 65, 58, 3, 22, 223, 253, 11, 9, 74,
        66, 76, 32, 70, 108, 105, 112, 32, 54
      ],
      "rssi": -57
    },
    {
      "manufactureData": {
        "companyId": [196, 0],
        "value": [64, 192, 64, 215, 75]
      },
      "name": "LG_Speaker_S90QY",
      "address": "7e:e4:c4:64:2c:bc",
      "scanRecord": [
        2, 1, 0, 8, 255, 196, 0, 64, 192, 64, 215, 75, 17, 7, 27, 197, 213, 165,
        2, 0, 8, 186, 229, 17, 190, 19, 208, 119, 32, 176, 17, 9, 76, 71, 95,
        83, 112, 101, 97, 107, 101, 114, 95, 83, 57, 48, 81, 89
      ],
      "rssi": -55
    }
  ]
}

Failure return

{
  "returnValue": false,
  "errorCode": 200,
  "errorText": "Blegatt already scanning"
}

// Failure Subsequent Response
{
  "subscribed":false,
  "returnValue": true,
  "values": {    
      "errorCode": 111,
      "errorText": "Fail call function"  
  }
}

stopScan

Description

Stops ongoing ble scanning.

If the stopScan method is called while scanning is underway, the ongoing scanning operation stops and no more information about device searching is sent as return of the startScan method. The scanning operation also stops when 60 seconds elapse after the startScan method is called or if another app goes foreground. The state of the scanning operation can be checked in the isScan return of the getState method.

Parameters

Name

Required

Type

Description

uuid

Required

String

To stop scan for a certain device with a specific service UUID, enter the service uuid of the device.

Call returns

Name

Required

Type

Description

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

Example

var request = webOS.service.request("luna://com.webos.service.blegatt", {
  method: "stoptScan",
  parameters: {},
  onSuccess: function (inResponse) {
    console.log("Result: " + JSON.stringify(inResponse));
    // To-Do something
  },
  onFailure: function (inError) {
    console.log("[" + inError.errorCode + "]: " + inError.errorText);
    // To-Do something
  },
});

Return Example

Success return

{
  "returnValue": true
}

Failure return

{
  "returnValue": false,
  "errorCode": 101,
  "errorText": "Invalid JSON input"
}

getState

Description

Gets information about the scanning state, connected devices, and paired devices.

If the value of the subscribe parameter is true, every time there is a change to the return data, the updated information will be delivered.

The isScan return indicates whether the scanning operation is currently underway. If the value is true, the scanning operation is underway, or false, the operation has stopped.

The connectedDevice return delivers information about the currently-connected GATT server device. If this method is called with the subscribe parameter as true, the data will be updated every time there is a change to the connected device. The data includes the mac address and name, and if two or more devices are connected, the information of each device is delivered in an array format.

The pairedDevice return delivers information about the currently-paired device. If the method is called with the subscribe parameter as true, the data is updated every time there is a change to the paired device. The data includes the mac address and name, and if two or more devices are paired, the information of each device is delivered in an array format.

Parameters

Name

Required

Type

Description

subscribe

Optional

Boolean

Whether to subscribe for notifications on changes. Possible values are:

 • true: Subscribe.

 • false: Do not subscribe. Call the method only once. (Default).

Call returns

Name

Required

Type

Description

subscribed

Optional

Boolean

Indicates if subscribed to get notifications.

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

Version

Required

String

The version of the SDK

isScan

Required

Boolean

Current state of the scanning operation.

 • true: The scanning operation is underway.

 • false: The scanning operation has stopped.

connectedDevice

Optional

Object array: connectedDevice

Currently connected device information.

The data includes the mac address and name. If two or more devices are connected, the information of each device is delivered in an array format.

pairedDevice

Object array: pairedDevice

String

The reason for the failure of the operation.

Example

// One-time call
var request = webOS.service.request("luna://com.webos.service.blegatt", {
  method: "getState",
  parameters: {},
  onSuccess: function (inResponse) {
    console.log("Result: " + JSON.stringify(inResponse));
    // To-Do something
  },
  onFailure: function (inError) {
    console.log("[" + inError.errorCode + "]: " + inError.errorText);
    // To-Do something
  },
});
 
// Subscription
var subscriptionHandle = webOS.service.request(
  "luna://com.webos.service.blegatt",
  {
    method: "getState",
    parameters: {
      subscribe: true,
    },
    onSuccess: function (inResponse) {
      if (typeof inResponse.subscribed !== "undefined") {
        if (!inResponse.subscribed) {
          console.log("Failed to subscribe");
          return;
        }
      }
      console.log("Result: " + JSON.stringify(inResponse));
      // To-Do something
    },
    onFailure: function (inError) {
      console.log("[" + inError.errorCode + "]: " + inError.errorText);
      // To-Do something
    },
  }
);
 
// If you need to unsubscribe the data, use cancel() method as below
subscriptionHandle.cancel();

Return Example

Success return

{
  "subscribed": true,
  "returnValue": true,
  "version": "1.0",
  "isScan": false,
  "connectedDevice": [
    {
      "address": "45:8b:7f:e0:56:45",
      "name": "LG TV"
    },
    {
      "address": "aa:bb:cc:dd:ee:ff",
      "name": "soundbar"
    }
  ],
  "pairedDevice": [
    {
      "address": "45:8b:7f:e0:56:45",
      "name": "LG TV"
    },
    {
      "address": "aa:bb:cc:dd:ee:ff",
      "name": "soundbar"
    }
  ]
}

Failure return

{
  "returnValue": false,
  "errorCode": 105,
  "errorText": "Failed to parse incoming message"
}

pair

Description

Pairs a specific remote Bluetooth device with a specific Bluetooth adapter.

Only one pairing request can be active for an adapter at a given time. When the pair method is called, the mac address of a device to pair should be added. If no or wrong address, an error will be returned. If the subscribe parameter is true when this method is called, the result of pairing - success or failure- will be delivered in the subscribed return. The pairing state can be checked in the state return: if the value is “pairing”, it means pairing is underway; if “successPairing”, the pairing is successful; and if “failPairing”, the pairing failed. When pairing is successful, the information about the successfully-paired device is added and updated to the pairedDevice return of the getState method.

Parameters

Name

Required

Type

Description

subscribe

Optional

Boolean

Whether to subscribe for notifications on changes. Possible values are:

 • true: Subscribe.

 • false: Do not subscribe. Call the method only once. (Default).

address

Required

String

The address (bdaddr) of the remote device with which pairing is being attempted.

Call returns

Name

Required

Type

Description

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

state

Required

String

Pairing state. Possible values are:

 • pairing: Pairing is in progress.

 • successPairing: Pairing is successful.

 • failPairing: Pairing failed.

Example

// One-time call
var request = webOS.service.request("luna://com.webos.service.blegatt", {
  method: "pair",
  parameters: {
    address: "4f:6b:40:db:5b:b2"
  },
  onSuccess: function (inResponse) {
    console.log("Result: " + JSON.stringify(inResponse));
    // To-Do something
  },
  onFailure: function (inError) {
    console.log("[" + inError.errorCode + "]: " + inError.errorText);
    // To-Do something
  },
});
 
// Subscription
var subscriptionHandle = webOS.service.request(
  "luna://com.webos.service.blegatt",
  {
    method: "pair",
    parameters: {
      address: "4f:6b:40:db:5b:b2",
      subscribe: true,
    },
    onSuccess: function (inResponse) {
      if (typeof inResponse.subscribed !== "undefined") {
        if (!inResponse.subscribed) {
          console.log("Failed to subscribe");
          return;
        }
      }
      console.log("Result: " + JSON.stringify(inResponse));
      // To-Do something
    },
    onFailure: function (inError) {
      console.log("[" + inError.errorCode + "]: " + inError.errorText);
      // To-Do something
    },
  }
);
 
// If you need to unsubscribe the data, use cancel() method as below
subscriptionHandle.cancel();

Return Example

Success return

{
  "returnValue": true,
  "subscribe": true,
  "state": "pairing"
}

{
  "returnValue": true,
  "state": "successPairing"
}

// Success Subsequent Response
{
  "subscribed":false,
  "returnValue": true,
  "state": "successPairing"
}

Failure return

{
  "returnValue": false,
  "state": "failPairing"
}

// Failure Subsequent Response
{
  "subscribed":false,
  "returnValue": true,
  "state": "failPairing",
  "values": {    
      "errorCode": 111,
      "errorText": "Fail call function"  
  }
}

unpair

Description

Disconnects from the paired remote device.

All pairing information about the remote device will be removed and any open connections will be closed. However, the remote device is still discoverable. When this method is called, the mac address of a device to delete from the pairing history should be included. When the pairing history is deleted, the information about the device of which unpairing is requested is deleted and updated to the pairedDevice return of the getState method.

Parameters

Name

Required

Type

Description

subscribe

Optional

Boolean

Whether to subscribe for notifications on changes. Possible values are:

 • true: Subscribe.

 • false: Do not subscribe. Call the method only once. (Default).

address

Required

String

The address (bdaddr) of the remote device to unpair.

Call returns

Name

Required

Type

Description

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

Example

var request = webOS.service.request("luna://com.webos.service.blegatt", {
  method: "unpair",
  parameters: {
    address: "4f:6b:40:db:5b:b2",
  },
  onSuccess: function (inResponse) {
    console.log("Result: " + JSON.stringify(inResponse));
    // To-Do something
  },
  onFailure: function (inError) {
    console.log("[" + inError.errorCode + "]: " + inError.errorText);
    // To-Do something
  },
});

Return Example

Success return

{
  "returnValue": true
}

// Success Subsequent Response
{
  "subscribed":false,
  "returnValue": true,
  "state": "successUnpairing"
}

Failure return

{
  "returnValue": false,
  "errorCode": 318,
  "errorText": "Failed to unpair"
}

// Failure Subsequent Response
{
  "subscribed":false,
  "returnValue": true,
  "state": "failUnpairing",
  "values": {    
      "errorCode": 111,
      "errorText": "Fail call function"  
  }
}

client/connect

Description

Connects to the GATT profile on the specified remote device.

When this method is called, the mac address of a device to connect should be included. Also to receive all events while the connection is on, the value of the subscribe parameter should be true.

The event return delivers not only the connection state but also information about all GATT client operations. Information and values required for each event are delivered in the values object.

If the connection state changes, onConnectionStateChange is delivered as the event return, and the state information - connecting, connected, or disconnected - is delivered in the values object. While connection is being made, the values will be connecting: true and connected: false. When the connection is successfully made, they will be connecting: false and connected:true. When the the connection is closed, the values will be connecting:false and connected:false. If connection to the GATT server is successfully made, information about the connected device is added to the connectedDeviceparameter of the getState method and delivered.

If the discoverServices or getServices method is called and the service of the GATT server is successfully discovered, an onServicesDiscovered event is delivered with the information about the searched service, characteristic, and descriptor in thevalues object.

If the readCharacteristic method is called and the information about the requesting characteristic is read successfully, an onCharacteristicRead event is delivered and information about the characteristic that requests reading is delivered in the values object.

If the writeCharacteristic method is called and the information about the requesting characteristic is successfully written, an onCharacteristicWrite event is delivered. If the readDescriptor method is called and information about the requesting descriptor is successfully read, an onDescriptorRead event is delivered, and the information about the descriptor that requests read is delivered in the values object.

If the writeDescriptor method is called and information about the requesting descriptor is successfully written, an onDescriptorWrite event is delivered. If the setCharacteristicNotification method is called and notification of changes to certain characteristic’s information is requested, every time there is a change to the corresponding characteristic’s information, an onCharacteristicChanged event is delivered, and the changed information about the characteristic is delivered in the values object.

Parameters

Name

Required

Type

Description

subscribe

Required

Boolean

Whether to subscribe for notifications on changes. Possible values are:

 • true: Subscribe.

 • false: Do not subscribe. Call the method only once. (Default).

address

Required

String

The address of the remote device.

Call returns

Name

Required

Type

Description

subscribed

Optional

Boolean

Indicates if subscribed to get notifications.

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

event

Required

String

The value is used to deliver results to Caller, such as connection status as well as any further GATT client operations

 • onConnectionStateChange: Indicating the GATT client has connected/disconnected to/from a remote GATT server.

 • onServicesDiscovered: Indicating the list of remote services, characteristics, and descriptors for the remote device has been updated.

 • onCharacteristicChanged: Triggered as a result of a remote characteristic notification.

 • onCharacteristicRead: Reporting the result of a characteristic read operation.

 • onCharacteristicWrite: Indicating the result of a characteristic write operation.

 • onDescriptorRead: Reporting the result of a descriptor read operation.

 • onDescriptorWrite: Indicating the result of a descriptor write operation.

values

Optional

Object: values

Data corresponding to each event.

Example

// Subscription
var subscriptionHandle = webOS.service.request(
  "luna://com.webos.service.blegatt",
  {
    method: "client/connect",
    parameters: {
      subscribe: true,
      address: "4f:8f:d7:c4:e3:e1",
    },
    onSuccess: function (inResponse) {
      if (typeof inResponse.subscribed !== "undefined") {
        if (!inResponse.subscribed) {
          console.log("Failed to subscribe");
          return;
        }
      }
      console.log("Result: " + JSON.stringify(inResponse));
      // To-Do something
    },
    onFailure: function (inError) {
      console.log("[" + inError.errorCode + "]: " + inError.errorText);
      // To-Do something
    },
  }
);
 
// If you need to unsubscribe the data, use cancel() method as below
subscriptionHandle.cancel();

Return Example

Success return

{
  "subscribed": true,
  "returnValue": true
}

- Connecting status

{
  "event": "onConnectionStateChange",
  "returnValue": true,
  "values": {
    "connected": false,
    "address": "4f:8f:d7:c4:e3:e1",
    "connecting": true
  }
}

- Device connected

{
  "event": "onConnectionStateChange",
  "returnValue": true,
  "values": {
    "connected": true,
    "address": "4f:8f:d7:c4:e3:e1",
    "connecting": false
  }
}

- Discover service

{
  "event": "onServicesDiscovered",
  "returnValue": true,
  "values": {
    "returnValue": true,
    "address": "4f:8f:d7:c4:e3:e1"
  }
}

- Get service

{
  "event": "onServicesDiscovered",
  "returnValue": true,
  "values": {
    "address": "4f:8f:d7:c4:e3:e1",
    "services": [
      {
        "includes": [],
        "characteristics": [
          {
            "properties": {
              "authenticatedSignedWrites": false,
              "extendedProperties": false,
              "write": false,
              "read": false,
              "notify": false,
              "broadcast": false,
              "writeWithoutResponse": false,
              "indicate": true
            },
            "characteristic": "00002a05-0000-1000-8000-00805f9b34fb",
            "instanceId": "003",
            "permissions": {},
            "value": {
              "bytes": []
            },
            "descriptors": []
          },
          {
            "properties": {
              "authenticatedSignedWrites": false,
              "extendedProperties": false,
              "write": false,
              "read": true,
              "notify": false,
              "broadcast": false,
              "writeWithoutResponse": false,
              "indicate": false
            },
            "characteristic": "00002b3a-0000-1000-8000-00805f9b34fb",
            "instanceId": "005",
            "permissions": {},
            "value": {
              "bytes": []
            },
            "descriptors": []
          },
          {
            "properties": {
              "authenticatedSignedWrites": false,
              "extendedProperties": false,
              "write": true,
              "read": true,
              "notify": false,
              "broadcast": false,
              "writeWithoutResponse": false,
              "indicate": false
            },
            "characteristic": "00002b29-0000-1000-8000-00805f9b34fb",
            "instanceId": "007",
            "permissions": {},
            "value": {
              "bytes": []
            },
            "descriptors": []
          },
          {
            "properties": {
              "authenticatedSignedWrites": false,
              "extendedProperties": false,
              "write": false,
              "read": true,
              "notify": false,
              "broadcast": false,
              "writeWithoutResponse": false,
              "indicate": false
            },
            "characteristic": "00002b2a-0000-1000-8000-00805f9b34fb",
            "instanceId": "009",
            "permissions": {},
            "value": {
              "bytes": []
            },
            "descriptors": []
          }
        ],
        "service": "00001801-0000-1000-8000-00805f9b34fb",
        "type": "primary"
      }
    ]
  }
}

- Receive notification

{
  "event": "onCharacteristicChanged",
  "returnValue": true,
  "values": {
    "address": "4f:8f:d7:c4:e3:e1",
    "changed": {
      "characteristic": "0000fff4-0000-1000-8000-00805f9b34fb",
      "instanceId": "055",
      "value": {
        "bytes": [
          125, 71, 69, 95, 121, 99, 36, 86, 42, 110, 87, 70, 70, 83, 117, 19,
          92, 91, 93
        ]
      }
    }
  }
}

- Read characteristic

{
  "event": "onCharacteristicRead",
  "returnValue": true,
  "values": {
    "service": "0000fff0-0000-1000-8000-00805f9b34fb",
    "address": "4f:8f:d7:c4:e3:e1",
    "values": [
      {
        "properties": {
          "authenticatedSignedWrites": false,
          "extendedProperties": false,
          "write": false,
          "read": true,
          "notify": false,
          "broadcast": false,
          "writeWithoutResponse": false,
          "indicate": false
        },
        "characteristic": "0000fff1-0000-1000-8000-00805f9b34fb",
        "instanceId": "042",
        "permissions": {},
        "value": {
          "bytes": []
        },
        "descriptors": [
          {
            "instanceId": "044",
            "descriptor": "00002901-0000-1000-8000-00805f9b34fb",
            "permissions": {},
            "value": {
              "bytes": []
            }
          },
          {
            "instanceId": "043",
            "descriptor": "00002904-0000-1000-8000-00805f9b34fb",
            "permissions": {},
            "value": {
              "bytes": []
            }
          }
        ]
      }
    ]
  }
}

- Read descriptor

{
  "event": "onDescriptorRead",
  "returnValue": true,
  "values": {
    "characteristic": "0000fff4-0000-1000-8000-00805f9b34fb",
    "service": "0000fff0-0000-1000-8000-00805f9b34fb",
    "address": "4f:8f:d7:c4:e3:e1",
    "values": [
      {
        "instanceId": "058",
        "descriptor": "00002901-0000-1000-8000-00805f9b34fb",
        "permissions": {},
        "value": {
          "bytes": []
        }
      },
      {
        "instanceId": "057",
        "descriptor": "00002902-0000-1000-8000-00805f9b34fb",
        "permissions": {},
        "value": {
          "bytes": [1, 0]
        }
      },
      {
        "instanceId": "056",
        "descriptor": "00002904-0000-1000-8000-00805f9b34fb",
        "permissions": {},
        "value": {
          "bytes": []
        }
      }
    ]
  }
}

- Write characteristic

{
  "event": "onCharacteristicWrite",
  "returnValue": true,
  "values": {
    "adapterAddress": "ac:f1:08:d4:6f:eb",
    "returnValue": true,
    "address": "4f:8f:d7:c4:e3:e1"
  }
}

- Device disconnected

{
  "event": "onConnectionStateChange",
  "returnValue": true,
  "values": {
    "connected": false,
    "address": "4f:8f:d7:c4:e3:e1",
    "connecting": false
  }
}

Failure return

{
  "returnValue": false,
  "errorCode": 400,
  "errorText": "Device is already connected"
}

- Connecting status

// Failure Subsequent Response
{
  "subscribed":false,
  "returnValue": true,
  "event": "onConnectionStateChange",
  "values": {
      "connecting": false,
      "connected": false,           
      "errorCode": 111,
      "errorText": "Fail call function"  
  }
}

- Discover service

// Failure Subsequent Response
{
  "subscribed":true,
  "returnValue": true,
  "event": "onServicesDiscovered",
  "values": {
      "errorCode": 111,
      "errorText": "Fail call function"  
  }
}

- Get service

// Failure Subsequent Response
{
  "subscribed":true,
  "returnValue": true,
  "event": "onServicesDiscovered",
  "values": {
      "errorCode": 111,
      "errorText": "Fail call function"  
  }
}

- Receive notification

// Failure Subsequent Response
{
  "subscribed":true,
  "returnValue": true,
  "event": "onCharacteristicChanged",
  "values": {
      "errorCode": 111,
      "errorText": "Fail call function"  
  }
}

- Read characteristic

// Failure Subsequent Response
{
  "subscribed":true,
  "returnValue": true,
  "event": "onCharacteristicRead",
  "values": {
      "errorCode": 111,
      "errorText": "Fail call function"  
  }
}

- Write characteristic

// Failure Subsequent Response
{
  "subscribed":true,
  "returnValue": true,
  "event": "onCharacteristicWrite",
  "values": {
      "errorCode": 111,
      "errorText": "Fail call function"  
  }
}

client/disconnect

Description

Disconnects GATT connection.

When calling this method, you should include the mac address to disconnect in the address parameter. When the connection is closed, an onConnectionStateChange event is delivered as an event return of the client/connect method. The values of connecting and connected of thevalues object will be false. Also, when the connection is closed, the disconnected device is removed from the connectedDevicereturn of the getState method. If an app with connected device(s) goes background without disconnecting the device(s), all the connected device(s) will be disconnected.

Parameters

Name

Required

Type

Description

subscribe

Optional

Boolean

Whether to subscribe for notifications on changes. Possible values are:

 • true: Subscribe.

 • false: Do not subscribe. Call the method only once. (Default).

address

Required

String

The address of the remote device.

Call returns

Name

Required

Type

Description

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

Example

var request = webOS.service.request("luna://com.webos.service.blegatt", {
  method: "client/disconnect",
  parameters: {
    address: "4f:6b:40:db:5b:b2",
  },
  onSuccess: function (inResponse) {
    console.log("Result: " + JSON.stringify(inResponse));
    // To-Do something
  },
  onFailure: function (inError) {
    console.log("[" + inError.errorCode + "]: " + inError.errorText);
    // To-Do something
  },
});

Return Example

Success return

{
  "returnValue": true
}

Failure return

{
  "returnValue": false,
  "errorCode": 401,
  "errorText": "Device is not connected"
}

// Failure Subsequent Response
{
  "subscribed":false,
  "returnValue": true,
  "state": "failDisconnecting",
  "values": {    
      "errorCode": 111,
      "errorText": "Fail call function"  
  }
}

client/discoverServices

Description

Discovers available services for the given remote device.

When calling this method, you should include the mac address of the connected device in the address parameter. When searching of the supported service of the connected device is complete, an onServicesDiscovered event is delivered as an event return of the client/connect method. To check the information about the searched service, call the client/getServices method.

Parameters

Name

Required

Type

Description

address

Required

String

The address of the remote device.

Call returns

Name

Required

Type

Description

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

Example

var request = webOS.service.request("luna://com.webos.service.blegatt", {
  method: "discoverServices",
  parameters: {
    address: "4f:6b:40:db:5b:b2",
  },
  onSuccess: function (inResponse) {
    console.log("Result: " + JSON.stringify(inResponse));
    // To-Do something
  },
  onFailure: function (inError) {
    console.log("[" + inError.errorCode + "]: " + inError.errorText);
    // To-Do something
  },
});

Return Example

Success return

{
  "returnValue": true
}

Failure return

{
  "returnValue": false,
  "errorCode": 404,
  "errorText": "Failed to start service discovery"
}

client/getServices

Description

Gets available services for remote device.

When calling this method, you should include the mac address of the connected device in the address parameter. The service information of the connected device is delivered in an onServicesDiscovered event as an event return of the client/connect method, and information about the service, characteristic, and descriptor is delivered in the values object.

Parameters

Name

Required

Type

Description

address

Required

String

The address of the remote device.

Call returns

Name

Required

Type

Description

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

Example

var request = webOS.service.request("luna://com.webos.service.blegatt", {
  method: "getServices",
  parameters: {
    address: "4f:6b:40:db:5b:b2",
  },
  onSuccess: function (inResponse) {
    console.log("Result: " + JSON.stringify(inResponse));
    // To-Do something
  },
  onFailure: function (inError) {
    console.log("[" + inError.errorCode + "]: " + inError.errorText);
    // To-Do something
  },
});

Return Example

Success return

{
  "returnValue": true
}

Failure return

{
  "returnValue": false,
  "errorCode": 405,
  "errorText": "Adapter Address is not valid"
}

client/setCharacteristicNotification

Description

Enables or disables notifications/indications for a given characteristic.

When calling this method, you should include the mac address of the connected device in the address parameter and include the service UUID where the characteristic for notification belongs in the service parameter. Also, you should include the characteristic UUID for notification in the characteristic parameter and set whether to enable notification in the enable parameter. When there is a change to the characteristic’s information for which notification is on, an onCharacteristicChanged event is delivered as an event return of theclient/connect method, and the changed values are delivered in the values object.

Parameters

Name

Required

Type

Description

address

Required

String

The address of the remote device.

service

Required

String

UUID of the service the characteristic belongs to.

characteristic

Required

String

UUID of the characteristic to be monitored.

enable

Required

Boolean

Enable or disable notifications.

Call returns

Name

Required

Type

Description

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

Example

var request = webOS.service.request("luna://com.webos.service.blegatt", {
  method: "setCharacteristicNotification",
  parameters: {
    address: "4f:6b:40:db:5b:b2",
    characteristic: "0000fff4-0000-1000-8000-00805f9b34fb",
    service: "0000fff0-0000-1000-8000-00805f9b34fb",
    enable: true,
  },
  onSuccess: function (inResponse) {
    console.log("Result: " + JSON.stringify(inResponse));
    // To-Do something
  },
  onFailure: function (inError) {
    console.log("[" + inError.errorCode + "]: " + inError.errorText);
    // To-Do something
  },
});

Return Example

Success return

{
  "returnValue": true
}

Failure return

{
  "returnValue": false,
  "errorCode": 408,
  "errorText": "GATT monitor characteristic failed for characteristic"
}

client/readCharacteristic

Description

Reads the value of a specific characteristic.

When calling this method, you should include the mac address of the connected device in the address parameter, include the service UUID where the characteristic for reading belongs in the service parameter, and include the characteristic UUID for read in the characteristic parameter. Information about the read characteristic is delivered in an onCharacteristicRead event as an event return of the client/connect method, and information about the characteristic is delivered in the values object.

Parameters

Name

Required

Type

Description

address

Required

String

The address of the remote device.

service

Required

String

UUID of the service the characteristic belongs to.

characteristic

Required

String

UUID of the characteristic to read.

Call returns

Name

Required

Type

Description

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

Example

var request = webOS.service.request("luna://com.webos.service.blegatt", {
  method: "readCharacteristic",
  parameters: {
    address: "4f:6b:40:db:5b:b2",
    characteristic: "0000fff4-0000-1000-8000-00805f9b34fb",
    service: "0000fff0-0000-1000-8000-00805f9b34fb",
  },
  onSuccess: function (inResponse) {
    console.log("Result: " + JSON.stringify(inResponse));
    // To-Do something
  },
  onFailure: function (inError) {
    console.log("[" + inError.errorCode + "]: " + inError.errorText);
    // To-Do something
  },
});

Return Example

Success return

{
  "returnValue": true
}

Failure return

{
  "returnValue": false,
  "errorCode": 410,
  "errorText": "GATT read characteristics failed"
}

client/readDescriptor

Description

Reads the value of descriptor of a service characteristic.

When calling this method, you should include the mac address of the connected device in the address parameter, include the descriptor UUID for reading in the descriptor parameter, and include the characteristic UUID where the descriptor belongs in the characteristic parameter, and include the service UUID where the characteristic belongs in the service parameter. Information about the read descriptor is delivered in an onDescriptorRead event as an event return of the client/connect method, and the descriptor information is delivered in the values object.

Parameters

Name

Required

Type

Description

address

Required

String

The address of the remote device.

service

Required

String

UUID of the service the characteristic belongs to.

characteristic

Required

String

UUID of the characteristic the descriptor belongs to.

descriptor

Required

String

UUID of the descriptor.

Call returns

Name

Required

Type

Description

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

Example

var request = webOS.service.request("luna://com.webos.service.blegatt", {
  method: "readDescriptor",
  parameters: {
    address: "4f:6b:40:db:5b:b2",
    descriptor: "00002902-0000-1000-8000-00805f9b34fb",
    characteristic: "0000fff4-0000-1000-8000-00805f9b34fb",
    service: "0000fff0-0000-1000-8000-00805f9b34fb",
  },
  onSuccess: function (inResponse) {
    console.log("Result: " + JSON.stringify(inResponse));
    // To-Do something
  },
  onFailure: function (inError) {
    console.log("[" + inError.errorCode + "]: " + inError.errorText);
    // To-Do something
  },
});

Return Example

Success return

{
  "returnValue": true
}

Failure return

{
  "returnValue": false,
  "errorCode": 411,
  "errorText": "Required 'characteristic' uuid parameter is not supplied"
}

client/writeCharacteristic

Description

Writes the value for a remote characteristic.

When calling this method, you should include the mac address of the connected device in the addressparameter, include the service UUID where the characteristic to write belongs in the service parameter, and include the characteristic UUID in the characteristic parameter. Also, you should include the value to write in the value object, and the value should be of a single type, among string, number and bytes. If two or more types are included, the call of the method will fail. If writing to a certain characteristic is successful, an onCharacteristicWrite event is delivered as an event return of the client/connect method.

Parameters

Name

Required

Type

Description

address

Required

String

The address of the remote device.

service

Required

String

UUID of the service the characteristic belongs to.

characteristic

Required

String

UUID of the characteristic.

value

Required

Object: gattValueInfo

Value of the characteristic.

A value can only have one type, and depending on this type, one of the fields "string", "number" or "bytes" should be passed. If multiple fields are passed, the method will fail.

Call returns

Name

Required

Type

Description

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

Example

var request = webOS.service.request("luna://com.webos.service.blegatt", {
  method: "writeCharacteristic",
  parameters: {
    address: "4f:6b:40:db:5b:b2",
    characteristic: "0000fff4-0000-1000-8000-00805f9b34fb",
    service: "0000fff0-0000-1000-8000-00805f9b34fb",
    value: { bytes: [0] },
  },
  onSuccess: function (inResponse) {
    console.log("Result: " + JSON.stringify(inResponse));
    // To-Do something
  },
  onFailure: function (inError) {
    console.log("[" + inError.errorCode + "]: " + inError.errorText);
    // To-Do something
  },
});

Return Example

Success return

{
  "returnValue": true
}

Failure return

{
  "returnValue": false,
  "errorCode": 413,
  "errorText": "GATT write characteristic failed"
}

client/writeDescriptor

Description

Writes the value of a specific descriptor of a service characteristic in the remote device.

When calling this method, you should include the mac address of the connected device in the addressparameter, include the descriptor UUID for write in the descriptor parameter, include the characteristic UUID where the descriptor belongs in the characteristic parameter, and include the service UUID where the characteristic belongs in the service parameter. Also, you should include the value to write in the value object, and the value should be of a single type, among string, number and bytes. If two or more types are included, the call of the method will fail. If writing to a certain descriptor is successful, an onDescriptorWrite event is delivered as an event return of the client/connect method.

Parameters

Name

Required

Type

Description

address

Required

String

The address of the remote device.

service

Required

String

UUID of the service the characteristic belongs to.

characteristic

Required

String

UUID of the characteristic the descriptor belongs to.

descriptor

Required

String

UUID of the descriptor.

value

Optional

Object: gattValueInfo

Value of the characteristic.

A value can only have one type, and depending on this type, one of the fields "string", "number" or "bytes" should be passed. If multiple fields are passed, the method will fail.

notification

Optional

String

If you want to receive or reject notification, set the corresponding value in Client Characteristic Configuration Descriptor(CCCD). Available values are:

 • ENABLE_NOTIFICATION_VALUE: Receive notification.

 • DISABLE_NOTIFICATION_VALUE: Do not receive notification.

Call returns

Name

Required

Type

Description

returnValue

Required

Boolean

Indicates success/failure of the request.

 • true: Operation is successful.

 • false: Operation failed.

errorCode

Optional

Number

The error code for the failed operation.

errorText

Optional

String

The reason for the failure of the operation.

Example

var request = webOS.service.request("luna://com.webos.service.blegatt", {
  method: "writeDescriptor",
  parameters: {
    address: "4f:6b:40:db:5b:b2",
    descriptor: "00002902-0000-1000-8000-00805f9b34fb",
    characteristic: "0000fff4-0000-1000-8000-00805f9b34fb",
    service: "0000fff0-0000-1000-8000-00805f9b34fb",
    value: { bytes: [0] },
  },
  onSuccess: function (inResponse) {
    console.log("Result: " + JSON.stringify(inResponse));
    // To-Do something
  },
  onFailure: function (inError) {
    console.log("[" + inError.errorCode + "]: " + inError.errorText);
    // To-Do something
  },
});

Return Example

Success return

{
  "returnValue": true
}

Failure return

{
  "returnValue": false,
  "errorCode": 414,
  "errorText": "Invalid value input for GATT characteristic"
}

Object

deviceStatus object

Description

Object containing information about the state of the device identified by address.

This object is returned upon calling of the startScan method and contains information about the searched device. It includes the mac address, name, rssi, manufacturer, and service data of the searched device.

Properties

Name

Required

Type

Description

address

Required

String

The address of the device.

name

Required

String

The name of the device.

rssi

Required

Number

Signal strength level of the device.

scanRecord

Required

Number array

Service data of the remote device.

manufactureData

Required

Number array

Manufacturer-specific company ID and data (if advertised from the remote device, else it will be blank).

connectedDevice object

Description

Object containing information about the connected device.

This object is returned upon calling of the getState method and contains information about the connected remote device. It includes the mac address and name of the connected device.

Properties

Name

Required

Type

Description

address

Required

String

The address of the connected device.

name

Optional

String

The name of the connected device.

pairedDevice object

Description

Object containing information about paired device.

This object is returned upon calling of the getState method and contains information about the paired (bonded) remote device. It includes the mac address and name of the paired (bonded) device.

Properties

Name

Required

Type

Description

address

Required

String

The address of the paired device.

name

Optional

String

The name of the paired device.

values object

Description

Values about connection status as well as any further GATT client operations.

This object is returned upon calling of the client/connect method and contains information to be delivered during operations of the GATT client. It includes the connection state information, characteristic information, and the changed value of the characteristic for notification.

Properties

Name

Required

Type

Description

connecting

Optional

Boolean

Indicates whether the connection request is currently being processed. Possible values are:

 • true: Request is being processed.

 • false: Not being processed.

connected

Optional

Boolean

Indicates if the connection is open. Possible values are:

 • true: Connection is open.

 • false: Connection is not open.

serviceClasses

Optional

Object

Array of Service Classes supported by this device.

connectRequest

Optional

Boolean

Indicates whether the request is a connection request. Possible values are:

 • true: Request is a connection request.

 • false: Request is a disconnection request.

service

Optional

String

UUID of the service the characteristic belongs to.

characteristic

Optional

String

UUID of the characteristic the descriptor belongs to.

services

Optional

Object array: serviceInfo

List of the available services.

changed

Optional

Object array: characteristicInfo

Object containing information about the characteristic uuid and values.

serviceInfo object

Description

Object containing the GATT service configuration.

Supported services of the remote device are provided in an array format. Each array includes service UUID, service type, and characteristics included in the service.

Properties

Name

Required

Type

Description

service

Required

String

UUID of the service.

type

Required

String

UUID which describes the type of the service. The following types are defined:

 • primary (UUID 0x2800)

 • secondary (UUID 0x2801)

includes

Optional

String array

List of service UUIDs this services includes in its definition.

characteristics

Optional

Object array: characteristicInfo

List of characteristics which are part of the service.

characteristicInfo object

Description

Object containing information about a GATT characteristic.

Information about characteristics included in a certain service is provided in an array format. Each array includes characteristic UUID, value, property, permission, and descriptors included in the characteristic.

Properties

Name

Required

Type

Description

characteristic

Required

String

UUID of the characteristic.

value

Required

Object array: gattValueInfo

Value of the characteristic.

properties

Required

Object array: propertiesInfo

Configured properties for the characteristic.

permissions

Required

Object array: permissionsInfo

Configured permissions for the characteristic.

descriptors

Required

Object array: descriptorInfo

List of descriptors for the characteristic.

descriptorInfo object

Description

Object containing information about a GATT descriptor.

Information about descriptors included in a certain characteristic is provided in an array format. Each array includes descriptor UUID and value.

Properties

Name

Required

Type

Description

descriptor

Required

String

UUID of the descriptor.

value

Required

Object array: gattValueInfo

value of the descriptor.

gattValueInfo object

Description

Object containing information about a GATT value.

As a GATT characteristic can be extended with a descriptor which describes the type of the stored value, we have three different representations of a value currently:stringnumberarray of numbersThe last one is used only when a non-value type descriptor is present.

Properties

Name

Required

Type

Description

string

Optional

String

Present when the value is from type string. Not present otherwise.

number

Optional

Number

Present when the value is from type number. Not present otherwise.

bytes

Optional

Number array

If the type of the value is not specified then the value is returned as a sequence of bytes.

propertiesInfo object

Description

Object containing information about the set properties of a characteristic.

All properties are defined in Bluetooth Core Specification 4.1 vol. 4 Part G chapter 3.3.1.1.

Properties

Name

Required

Type

Description

broadcast

Optional

Boolean

If set, permits broadcasts of the Characteristic Value using Server Characteristic Configuration Descriptor.

If set, the Server Characteristic Configuration Descriptor shall exist.

read

Optional

Boolean

If set, permits reads of the Characteristic Value.

writeWithoutResponse

Optional

Boolean

If set, permit writes of the Characteristic Value without response.

write

Optional

Boolean

If set, permits writes of the Characteristic Value with response.

notify

Optional

Boolean

If set, permits notifications of a Characteristic Value without acknowledgement.

If set, the Client Characteristic Configuration Descriptor shall exist.

indicate

Optional

Boolean

If set, permits indications of a Characteristic Value with acknowledgement.

authenticatedSignedWrites

Optional

Boolean

If set, permits signed writes to the Characteristic Value.

extendedProperties

Optional

Boolean

If set, additional characteristic properties are defined in the Characteristic Extended Properties Descriptor.

If set, the Characteristic Extended Properties Descriptor shall exist.

permissionsInfo object

Description

Object containing information about the permissions allowed for a client to use a particular characteristic value.

All properties are defined in Bluetooth Core Specification 4.1 vol. 4 Part G chapter 3.3.1.1.

Properties

Name

Required

Type

Description

read

Optional

Boolean

If set, clients are allowed to read the characteristic value.

readEncrypted

Optional

Boolean

If set, allows encrypted read operations.

readEncryptedMitm

Optional

Boolean

If set, permits writes of the Characteristic Value with response.

notify

Optional

Boolean

If set, allows reading with man-in-the-middle protection.

write

Optional

Boolean

If set, clients are allowed to write the characteristic value.

writeEncrypted

Optional

Boolean

If set, allows encrypted writes.

writeEncryptedMitm

Optional

Boolean

If set, allows encrypted writes with man-in-the-middle protection.

writeSigned

Optional

Boolean

If set, allows signed write operations.

writeSignedMitm

Optional

Boolean

If set, allows signed write operations with man-in-the-middle protection.

serviceData object

Description

Object containing information about a service data to be advertised.

Properties

Name

Required

Type

Description

uuid

Required

String

Indicates the data uuid.

Note that uuid is an immutable representation of a 128-bit universally unique identifier.

data

Required

Number array

Contains the array of data pertaining to a service.

mask

Required

Number array

Indicates the bit mask for the service uuid. Possible values are:

 • 1: Set any bit in the mask to 1 to indicate a match is needed for the bit in the service uuid.

 • 0: Set any bit in the mask to 0 to ignore that bit.

Error code reference

Error Code

Error Text

Description

0

OK

Operation completed successfully. No error occurred.

1

This is unknown error

An unspecified or unknown error occurred.

2

CallerInfo is null

The internal caller information object is null.

3

SubscriptionInfo is null

The subscription information object is null. Subscription context is missing.

4

SubscriptionInfo is already existed

A subscription for this resource already exists. Duplicate subscription attempt.

100

Bluetooth adapter is not available.

The underlying Bluetooth daemon is not running or isn't attached to the hardware.

101

Invalid JSON input

The JSON input has an invalid format and cannot be parsed.

102

The JSON input does not match the expected schema

One or more of the parameters do not have the correct parameter type. See the 'Parameters' table to know the expected data type for each input parameter.

103

This app is not have permission.

The requested app does not have permission to control nearby devices.

104

Unknown device address

The remote Bluetooth device's address for performing the requested operation is not available in the list of found remote devices or is invalid.

105

Failed to parse incoming message

The JSON payload passed to the method cannot be parsed and the input parameters' values cannot be determined.

106

Required 'address' parameter is not supplied

The address parameter is mandatory, but was not supplied by the caller of the method.

107

Device with supplied address is not available

The remote Bluetooth device with the supplied address is not available (in the discovered devices list) to continue the operation of this method.

108

BLE open api version is not matched

The BLE API version used by the client does not match the server's supported version.

109

Other process is already in progress

Another operation is already in progress; concurrent operations are not allowed.

110

Fail register service category

Failed to register the service category with the Luna Service framework.

111

Fail call function

A function call failed internally.

200

Blegatt already scanning

Blegatt already scanning

201

Blegatt already scanning by other service

A BLE scan is already in progress by another service.

301

Device is not paired

Device is not paired

302

The operation failed for an unspecified or generic reason

The requested Bluetooth operation failed for an unspecified or generic reason in the Bluetooth stack.

303

The device is not ready to perform the requested operation

The Bluetooth adapter (local device) is not ready to perform the requested operation.

304

The SIL failed to allocate memory

The Bluetooth SIL (Stack Interface Layer) which interacts with the underlying stack has failed to allocate the required amount of memory to perform the requested operation.

305

The operation can not be performed at this time

The requested operation can not be performed by the adapter at this time since the adapter or SIL (Stack Interface Layer) is busy with a different operation.

306

The requested operation is not supported by the stack or device

The requested operation is not supported by the Bluetooth stack or adapter.

307

An invalid value was passed for one of the parameters

An invalid value was passed for one of the parameters while calling the SIL (Stack Interface Layer) from the Bluetooth service.

308

An unhandled error was encountered

An unhandled error was encountered at the SIL (Stack Interface Layer) while performing the requested operation.

309

Authentication with a remote device was canceled

Authentication with a remote Bluetooth device was canceled by the remote Bluetooth device.

310

Authentication with a remote device failed

Authentication with a remote Bluetooth device has failed either at the underlying stack.

311

Authentication with a remote was rejected

Authentication with a remote Bluetooth device was rejected by the remote Bluetooth device.

312

Authentication with a remote device timed out

Authentication with a remote Bluetooth device has timed out before getting a valid response from the remote device.

313

Failed to parse incoming message

The JSON payload passed to the method cannot be parsed and the input parameters' values cannot be determined.

314

Method needs to be subscribed

The API method needs to be called with an input parameter subscribe set to true, in order to get multiple responses for the LS call to this method. If subscribe is not set to true, this error is thrown.

315

Only one subscription allowed

Only one client is allowed to subscribe to this method

316

Pairing canceled by user

The ongoing pairing with a remote Bluetooth device has been canceled. The cancel is initiated by the client at the local device.

317

Pairing already in progress

Only one remote device can be pairing with the bluetooth adapter at any given time. This error indicates that the adapter is already pairing with a remote Bluetooth device, either with incoming or outgoing. Hence another pair cannot be initiated.

318

Failed to unpair

Failed to unpair the Bluetooth adapter with the paired remote Bluetooth device.

400

Device is already connected

The remote Bluetooth device is already connected

401

Device is not connected

The remote Bluetooth device is not connected to our Bluetooth adapter via the profile.

402

Profile backend is not available

The SIL (Stack Interface Layer) module used doesn't provide any implementation for the profile.

403

Bandwidth is not enough, please remove connected devices and try again

Bandwidth is not enough, please remove connected devices and try again

404

Failed to start service discovery.

GATT service discovery cannot be started, one of adapterAddress or address should be supplied

405

Adapter Address is not valid

The adapter address given is not valid.

406

Required 'service' uuid parameter is not supplied

The mandatory Service name parameter required by this method call is not supplied.

407

Invalid GATT characteristic for the given service

The characteristic ID supplied does not belong to the service.

408

GATT monitor characteristic failed for characteristic

Failed to monitor GATT characteristic.

409

Invalid GATT Service

The supplied GATT service is not available or is not configured.

410

GATT read characteristics failed

Failed to read the requested characteristics.

411

GATT Encryption is not ready

Encryption is not ready for the GATT operation.

412

Required 'characteristic' uuid parameter is not supplied

The 'characteristic' UUID parameter is missing from the request.

413

Invalid value input for GATT characteristic (The supplied value for GATT characteristics is invalid.)

The value provided for the GATT characteristic is invalid.

414

GATT write characteristic failed

Failed to write to the specified GATT characteristic.

415

Invalid value input for GATT characteristic (Characteristic value is not valid.)

The value provided for the GATT characteristic is not valid.

416

Failed to write GATT descriptor

Failed to write to the specified GATT descriptor.

417

Invalid value input for FTMS characteristic

The value provided for the FTMS characteristic is invalid.

418

ClientId is empty

The client ID is missing or empty.

419

Characteristic is already existed

The specified characteristic already exists.

420

Failed to connect with remote device

Failed to establish a connection with the remote device.

No Headings