Difference between revisions of "BLEGattCentral"
From AMTech WikiDocs
(2 intermediate revisions by the same user not shown) | |||
Line 32: | Line 32: | ||
*Commands (see /amtech/linkeddata/types/composite/observation) | *Commands (see /amtech/linkeddata/types/composite/observation) | ||
**/amtech/linkeddata/types/composite/observation/bleGattCharacteristic | **/amtech/linkeddata/types/composite/observation/bleGattCharacteristic | ||
+ | === Observation example for Battery Service === | ||
+ | *Configuration | ||
+ | <syntaxhighlight lang="json"> | ||
+ | { | ||
+ | "_uuid": "0x180F", | ||
+ | "_name": "Battery Service", | ||
+ | "characteristics": [ | ||
+ | { | ||
+ | "_cuuid": "0x2A19", | ||
+ | "_name": "Battery Level", | ||
+ | "_read": true, | ||
+ | "_write": false, | ||
+ | "metadata": { | ||
+ | "params": [ | ||
+ | { | ||
+ | "param": "level", | ||
+ | "type": "uint8", | ||
+ | "bufLen": 1, | ||
+ | "onValueChanged": { | ||
+ | "_name": "lessThan", | ||
+ | "_criteria": 50 | ||
+ | } | ||
+ | } | ||
+ | ], | ||
+ | "extra": [] | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | *Observation | ||
+ | <syntaxhighlight lang="jsonld"> | ||
+ | { | ||
+ | "bleGattCharacID": "0x2a19", | ||
+ | "proximityarea": "", | ||
+ | "smoothingResult": "new", | ||
+ | "blePeripheralUuid": "5d2036dac8d2", | ||
+ | "@type": "/amtech/linkeddata/types/composite/observation/bleGattCharacteristic", | ||
+ | "detectiontime": "Wed Sep 20 20:20:48 UTC 2017", | ||
+ | "occurrencetime": "Wed Sep 20 20:20:47 UTC 2017", | ||
+ | "bleGattServiceName": "Battery Service", | ||
+ | "bleGattServiceID": "0x180f", | ||
+ | "_tenant": "followerbridgetest", | ||
+ | "bleGattCharacValue": "{\"level\":50}", | ||
+ | "bleDeviceName": "SAMSUNG-SM-N910A", | ||
+ | "guesttenants": [], | ||
+ | "topic": "/m2mBridgeTest/bleCentral/characteristic", | ||
+ | "producer": "BLEGattCentral", | ||
+ | "location": "{\"wkt\":\"POINT(-117.72036439999998 33.705365)\",\"sContext\":\"geo\",\"hash\":\"9mur9pyeuxqjv7rf31th6mpb\"}", | ||
+ | "_user": "smartsensor@amtech.mx", | ||
+ | "@id": "/amtech/things/observations/obs_6423b318e02c470ab2986747d5e5c8d3", | ||
+ | "targetthings": "[{\"thingType\":\"/amtech/linkeddata/types/composite/entity/BLEGattCentral\",\"thingsId\":[\"bleCentral:a0:88:69:31:30:b7:testBLECentral\"]}]", | ||
+ | "bleGattCharacName": "Battery Level", | ||
+ | "guestusers": [] | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | Edge Intelligence | ||
+ | **[[Smoothing_observations|Smoothing observations]] |
Latest revision as of 13:10, 2 February 2018
BLEGattCentral
Bridge BLE GATT services and characteristics read and write to IoT DAP protocol.
- leverages BLE GATT (Generic Attribute Profile) standard
- services and characteristics can be configured setting gattProfileConfig property
- Advertised device name List of devices name to be discovered (names the manufacture uses to advertise the device)
- Frequency to read characteristics value(s) an ISO 8601 string duration; representing how frequently characterictics values will be collected; defaults to 1 minute iso 8601 PT1M
- The amount of read cycles, the smoothing logic will consider for calculating lost observations
- Service UUID and name
- Characteristics UUID and name(can be selected for a list of supported characteristics specified at GATT services
- Metadata information used to parse characteristic buffer
- parmas
- extra
- Metadata information used to parse characteristic buffer
- Smoothing criteria each values decoded from the characteristic value can be configured to be smoothed based on the following filters
- never
- always
- percentage changed
- value changed
- less than
- greater than
- range
- Smoothing criteria each values decoded from the characteristic value can be configured to be smoothed based on the following filters
- Placeholders (See Placeholders)
- #{bleGattCharacID} Characteristic UUID
- #{bleGattCharacName} Characteristic name
- #{bleGattServiceID} Service UUID
- #{bleGattServiceName} Service name
- Produced observations (see /amtech/linkeddata/types/composite/observation)
- /amtech/linkeddata/types/composite/observation/bleGattCharacteristic
- Commands (see /amtech/linkeddata/types/composite/observation)
- /amtech/linkeddata/types/composite/observation/bleGattCharacteristic
Observation example for Battery Service
- Configuration
{
"_uuid": "0x180F",
"_name": "Battery Service",
"characteristics": [
{
"_cuuid": "0x2A19",
"_name": "Battery Level",
"_read": true,
"_write": false,
"metadata": {
"params": [
{
"param": "level",
"type": "uint8",
"bufLen": 1,
"onValueChanged": {
"_name": "lessThan",
"_criteria": 50
}
}
],
"extra": []
}
}
]
}
- Observation
{
"bleGattCharacID": "0x2a19",
"proximityarea": "",
"smoothingResult": "new",
"blePeripheralUuid": "5d2036dac8d2",
"@type": "/amtech/linkeddata/types/composite/observation/bleGattCharacteristic",
"detectiontime": "Wed Sep 20 20:20:48 UTC 2017",
"occurrencetime": "Wed Sep 20 20:20:47 UTC 2017",
"bleGattServiceName": "Battery Service",
"bleGattServiceID": "0x180f",
"_tenant": "followerbridgetest",
"bleGattCharacValue": "{\"level\":50}",
"bleDeviceName": "SAMSUNG-SM-N910A",
"guesttenants": [],
"topic": "/m2mBridgeTest/bleCentral/characteristic",
"producer": "BLEGattCentral",
"location": "{\"wkt\":\"POINT(-117.72036439999998 33.705365)\",\"sContext\":\"geo\",\"hash\":\"9mur9pyeuxqjv7rf31th6mpb\"}",
"_user": "smartsensor@amtech.mx",
"@id": "/amtech/things/observations/obs_6423b318e02c470ab2986747d5e5c8d3",
"targetthings": "[{\"thingType\":\"/amtech/linkeddata/types/composite/entity/BLEGattCentral\",\"thingsId\":[\"bleCentral:a0:88:69:31:30:b7:testBLECentral\"]}]",
"bleGattCharacName": "Battery Level",
"guestusers": []
}
Edge Intelligence