Skeleton Code for BOX-ID shared configuration, encoder and decoder of devices.
This is a example how a message decoder for the BOX-ID System should look like.
src
: Typescript source filessrc/index.ts
: Just a export helpersrc/decode.ts
: Basic decoding file with a exported function to start a decodingsrc/decode/
: Folder to place the additional decoder filessrc/encode.ts
: Basic encoding file with a exported function to do the encoding of the current settingssrc/encode
: Folder to place the additional encoder filessrc/config.ts
: Basic configuration file with generic config functionssrc/config/
: Folder to place the additional device configuration filessrc/utils.ts
: Processing utilssrc/test/
: Folder with the unit test files
compile
: simple code compile from TS to JSdev
: test and watch: compile the code and wait for changes to recompile and run the unit testcheck
: run all checks: dependencies checker, code linter, unit test and compileclear
: clear all compile code
The decoded message should result a JS object (JSON compatible). The contents is fully optional and can contain any kind of key value pairs.
But there are some keys with special meanings in the processing after the raw data was decoded.
time
(Number
): Optional timestamp of this message. If not time is defined in the body or the header, the service will use it's own time. Example:1600867532
type
(String
): A message type describing the reason for the data input. This is usually shown in the raw data list as column for A quick view over the reason why this message was send or how the payload will look like. Example:"GPS_POS"
geo
(Array
): The geo position including an optional accuracy to set for the given tag. Formats:< -[latitude, longitude]
Only geo position< -[latitude, longitude, accuracy]
With an optional accuracy radius im meter Example:[52.0116, 11.8523, 1342]
geo_source
(Number
): A description to inform the system the position source.0
UNKNOWN: Unknown position source ( GUI-Color: gray )1
SCELL: computedLocation.source = 2 - Sigfox simple cell position ( GUI-Color: gray )2
SML: computedLocation.source = 3 - Sigfox machine learning POI ( GUI-Color: gray )3
SHD: computedLocation.source = 4 - Sigfox HD cell position ( GUI-Color: gray )4
SPDB: computedLocation.source = 5 - Sigfox private DB ( GUI-Color: blue )5
SWIFI: computedLocation.source = 6 - Sigfox private wifi via here ( GUI-Color: blue )6
GWIFI: Wifi position via BOX-ID google location ( GUI-Color: blue )7
HWIFI: Wifi position via BOX-ID here location ( GUI-Color: blue )8
GPS: GPS position direct from device ( GUI-Color: red )9
ZID: Geo position via zone ident if defined in db ( GUI-Color: blue ) Example:8
zone_ident
(String
): An zone ident token to force the zone resolver which zone should be used as result. Example:skdfjbgvsliubk
mounted
(Boolean
): A flag that describes if this device is currently mounted to the assetin_transit
(Boolean
): A flag that describes if this device is in transit, so e.g. is traveling with a truck,msg_event_shock
(Number
|Boolean
): If amsg_event = "shock"
is defined it's possible to add a corresponding value like the mG that caused this event Example:573
If no value like can be defined with the event just a booleantrue
should be sendmsg_event_temp
(Number
|Boolean
): If amsg_event = "temp"
is defined it's possible to add a corresponding temperature that caused this event Example:13
If no value like can be defined with the event just a booleantrue
should be sendmsg_event_humi
(Number
|Boolean
): If amsg_event = "humi"
is defined it's possible to add a corresponding humidity that caused this event Example:23
If no value like can be defined with the event just a booleantrue
should be sendmsg_event_press
(Number
|Boolean
): If amsg_event = "press"
is defined it's possible to add a corresponding air pressure that caused this event Example:6874
If no value like can be defined with the event just a booleantrue
should be sendmacs
(Array<String | Object>
): A list of recorded mac addresses used to locate ths position via Here or Google Positioning Services. This can also be used to locate the device via our Zone-Ident Feature If the element is a string: A single mac address. As byte divider it's allowed to use:
,-
or nothing. Example:[{ "mac": "12:23:34:AB:BC:CD", "rssi": -23 },{ "mac": "98:23:56:AB:BC:CD", "rssi": -42 }]
If the element is a object: Object-Params:mac
(String
): The mac address. As byte divider it's allowed to use:
,-
or nothing. Example:"12:23:34:AB:BC:CD"
rssi
(Number
): The rssi for this recorded mac address in dBm Example:-42
beacons
(Array<String | Object>
): A list of BLE, or similar, beacons used to locate the device. This can also be used to locate the device via our Zone-Ident Feature If the element is a string: A single beacon address. As byte divider it's allowed to use:
,-
or nothing. Example:[{ "beacon": "98:87:34:FC:DC:CD", "rssi": -23 }]
If the element is a object: Object-Params:beacon
(String
): The beacon address. As byte divider it's allowed to use:
,-
or nothing. Example:"98:87:34:FC:DC:CD"
rssi
(Number
): The rssi for this recorded beacon address in dBm Example:-23
stations
(Array
): A list of cellular stations, or similar, to locate the device. This can also be used to locate the device via our Zone-Ident Feature Example:[{ "station": "cell-de-0815", "rssi": -13 }]
If the element is a string: A single station identifier Example:"cell-de-0815"
If the element is a object: Object-Params:station
(String
): A single station identifier Example:"cell-de-0815"
rssi
(Number
): The rssi for this station in dBm Example:-13
temp
(Number
): A temperature recorded by this device. Unit°C
. If the device type is configured to have e.g. temperatures as condition values we will also show these values in tracking and Feed and keep track of the min., max. and average values. Example:13.9
humi
(Number
): A humidity recorded by this device. Unit%
. If the device type is configured to have e.g. humidity as condition values we will also show these values in tracking and Feed and keep track of the min., max. and average values. Example:42
press
(Number
): A air pressure recorded by this device. UnithPa
. If the device type is configured to have e.g. air pressure as condition values we will also show these values in tracking and Feed and keep track of the min., max. and average values. Example:487
acc
(Array<Number>
): The current acceleration of this device as list of x, y and z. The acceleration in a specific direction inmG
Example:[154, 456, 542]