Update README.md
This commit is contained in:
parent
fa6bbb9c7d
commit
3f08425a08
32
README.md
32
README.md
@ -110,28 +110,28 @@ FPort2:
|
|||||||
|
|
||||||
see remote command set
|
see remote command set
|
||||||
|
|
||||||
If you're using [TheThingsNetwork](https://www.thethingsnetwork.org/) you may want to use a payload converter in console. For this purpose go to Application - Payload Formats and copy the code below to the tabs Decoder and Converter. Take care that your application matches the fields pax, ble and wifi.
|
If you're using [TheThingsNetwork](https://www.thethingsnetwork.org/) you may want to use a payload converter. For this purpose go to TTN Console - Application - Payload Formats and copy the code example below to the tabs Decoder and Converter. Make sure that your parsing application matches the fields `pax`, `ble` and `wifi`.
|
||||||
|
|
||||||
*Decoder*
|
*Decoder*
|
||||||
|
|
||||||
function Decoder(bytes, port) {
|
function Decoder(bytes, port) {
|
||||||
var decoded = {};
|
var decoded = {};
|
||||||
if (port === 1) {
|
if (port === 1) {
|
||||||
decoded.wifi = (bytes[0] << 8) | bytes[1];
|
decoded.wifi = (bytes[0] << 8) | bytes[1];
|
||||||
decoded.ble = (bytes[2] << 8) | bytes[3];
|
decoded.ble = (bytes[2] << 8) | bytes[3];
|
||||||
}
|
}
|
||||||
return decoded;
|
return decoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
*Converter*
|
*Converter*
|
||||||
|
|
||||||
function Converter(decoded, port) {
|
function Converter(decoded, port) {
|
||||||
var converted = decoded;
|
var converted = decoded;
|
||||||
if (port === 1) {
|
if (port === 1) {
|
||||||
converted.pax = converted.ble + converted.wifi;
|
converted.pax = converted.ble + converted.wifi;
|
||||||
}
|
}
|
||||||
return converted;
|
return converted;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remote command set
|
# Remote command set
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user