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()
.
Check out the BLE GATT sample app, developed with Enact, for how to call the BLE GATT API.
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:
|
Call returns
Name | Required | Type | Description |
---|---|---|---|
subscribed | Optional | Boolean | Indicates if subscribed to get notifications. |
returnValue | Required | Boolean | Indicates success/failure of the request.
|
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. |
Error reference
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 312, 313, 314, 315 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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:
|
uuid | Optional | String | To search for a certain device with a specific service UUID, enter the service uuid of the device. |
scanType | Optional | String | To search for devices containing certain information, enter the information. Currently, only “name” is supported. |
Call returns
Name | Required | Type | Description |
---|---|---|---|
subscribed | Optional | Boolean | Indicates if subscribed to get notifications. |
returnValue | Required | Boolean | Indicates success/failure of the request.
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
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. |
Error reference
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 200, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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"
}
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
N/A
Call returns
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates success/failure of the request.
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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:
|
Call returns
Name | Required | Type | Description |
---|---|---|---|
subscribed | Optional | Boolean | Indicates if subscribed to get notifications. |
returnValue | Required | Boolean | Indicates success/failure of the request.
|
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.
|
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. |
Error reference
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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:
|
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.
|
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:
|
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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"
}
Failure return
{
"returnValue": false,
"state": "failPairing"
}
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 |
---|---|---|---|
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.
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 318 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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
}
Failure return
{
"returnValue": false,
"errorCode": 318,
"errorText": "Failed to unpair"
}
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 connectedDevice
parameter 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:
|
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.
|
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
|
values | Optional | Object: values | Data corresponding to each event. |
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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"
}
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 connectedDevice
return 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 |
---|---|---|---|
address | Required | String | The address of the remote device. |
Call returns
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates success/failure of the request.
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103,104, 105, 106, 107, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413 | See Error Code Reference for more details. | See Error Code Reference for more details. |
Example
var request = webOS.service.request("luna://com.webos.service.blegatt", {
method: "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"
}
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.
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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.
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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.
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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.
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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.
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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 address
parameter, 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.
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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 address
parameter, 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:
|
Call returns
Name | Required | Type | Description |
---|---|---|---|
returnValue | Required | Boolean | Indicates success/failure of the request.
|
errorCode | Optional | Number | The error code for the failed operation. |
errorText | Optional | String | The reason for the failure of the operation. |
Error code | Error text | Error description |
---|---|---|
100, 101, 102, 103, 104, 105, 106, 107, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413 | See Error Code Reference for more details. | See Error Code Reference for more details. |
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"
}
Error code reference
Error Code | Error Text | Description |
---|---|---|
-1 | Unknown method or Service does not exist | Unknown method or service does not exist. |
0 | Unkonwn error | Unkonwn error. |
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 | BLEGATT version is not matched, please check the version | BLEGATT version is not matched, please check the version. |
200 | Blegatt already scanning | Blegatt already scanning |
300 | Device is already paired | The remote device with which we are trying to pair is already paired to the local device adapter. |
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 | Required 'characteristic' uuid parameter is not supplied | Required 'characteristic' uuid parameter is not supplied |
412 | Invalid value input for GATT characteristic | The supplied value for GATT characteristics is invalid. |
413 | GATT write characteristic failed | Failed to write characteristic the specified value. |
414 | Invalid value input for GATT characteristic | The supplied value for GATT characteristics is invalid. |
Objects
deviceStatus
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
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
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
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:
|
connected | Optional | Boolean | Indicates if the connection is open. Possible values are:
|
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:
|
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
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:
|
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
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
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
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:
- string
- number
- array of numbers
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
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
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. |