FD1 Client Protocol

FD1 Client Protocol Examples

Create a text file "fd1start.txt" containing the commands to send

{"a":"fd1.session.login","v":{"purpose":"debugscope"}}
{"a":"fd1.firehose.open_firehose","rq":1,"v":{"event":"device.event"},"q":{"dbm(>=)":-70,"battery(>=)":0}}
{"a":"fd1.firehose.open_firehose","rq":2,"v":{"event":"device.event"},"q":{"dbm(>=)":-80}}
Open a command prompt and run websocat
websocat -n ws://127.0.0.1:3490/ws/open_websocket < fd1start.txt
Responsese will start streaming to stdout (reformatted to aid reading)
{"rp":"2","sc":"device.bluetooth.announcement","v":{
    "addr":"C0288D347D2C",
    "dbm":-83,
    "advtype":0,
    "uuid":"{0000FE61-0000-1000-8000-00805F9B34FB}",
    "coid":3,
    "manudata":"00 60 41 00 00 0A 38 E1 3D 38 E6 FE 32",
    "coidstr":"IBM",
    "sections":[{"datatype":"Flags"},{"datatype":"Shortened Local Name"},{"datatype":"Service UUIDs"},{"datatype":"Manufacturer Data"}]}}
{"rp":"2","sc":"device.bluetooth.announcement","v":{
    "addr":"6C4EBB754703",
    "dbm":-68,
    "advtype":0,
    "uuid":"{0000FEA0-0000-1000-8000-00805F9B34FB}",
    "sections":[{"datatype":"Flags"},{"datatype":"Service Data"},{"datatype":"Incomplete Service UUIDs"}]}}
{"rp":"2","sc":"device.bluetooth.announcement","v":{
    "addr":"6C4EBB754703",
    "dbm":-72,
    "advtype":0,
    "uuid":"{0000FEA0-0000-1000-8000-00805F9B34FB}",
    "sections":[{"datatype":"Flags"},{"datatype":"Service Data"},{"datatype":"Incomplete Service UUIDs"}]}}
{"rp":"1","sc":"device.bluetooth.announcement","v":{,
    "addr":"BC5729024562",
    "dbm":-66,
    "advtype":0,
    "uuid":"{0000FEAA-0000-1000-8000-00805F9B34FB}",
    "sections":[{"datatype":"Flags"},{"datatype":"Service UUIDs"},{"datatype":"Service Data"}],
    "battery":3.505,
    "temp":22.5,
    "humid":61.02}}
{"rp":"2","sc":"device.bluetooth.announcement","v":{
    "addr":"BC5729024562",
    "dbm":-66,
    "advtype":0,
    "uuid":"{0000FEAA-0000-1000-8000-00805F9B34FB}",
    "sections":[{"datatype":"Flags"},{"datatype":"Service UUIDs"},{"datatype":"Service Data"}],
    "battery":3.505,
    "temp":22.5,
    "humid":61.02}}
{"rp":"2","sc":"device.bluetooth.announcement","v":{
    "addr":"6C4EBB754703",
    "dbm":-72,
    "advtype":0,
    "uuid":"{0000FEA0-0000-1000-8000-00805F9B34FB}",
    "sections":[{"datatype":"Flags"},{"datatype":"Service Data"},{"datatype":"Incomplete Service UUIDs"}]}}

The two messages highlighted in blue are showing that you received the same message twice, for each of the two firehose subscriptions in the original request