diff --git a/doc/Handlers.md b/doc/Handlers.md index 5c77f0e0..e114d4d0 100644 --- a/doc/Handlers.md +++ b/doc/Handlers.md @@ -25,6 +25,7 @@ To create a new handler you need to set: - **Application** name - **Uplink Fields** that will be forwarded to the backend Connector - **Payload** format for automatic decoding + - **ASCII Text** - [**Cayenne LPP**](https://github.com/myDevicesIoT/cayenne-docs/blob/master/docs/LORA.md) - **Parse Uplink** function to extract additional data fields from the uplink frame - **Event Fields** that will be forwarded to the backend Connector @@ -149,6 +150,10 @@ The server can auto-parse some well-known data formats. To parse a custom format leave the *Payload* field undefined and write own *Parse Uplink* function. +### ASCII Text + +The payload will get stored into the `text` field as ASII characters. + ### Cayenne Low Power Payload (LPP) For each Data Channel *N* the server will create a `fieldN` with the parsed value. diff --git a/priv/admin/admin.js b/priv/admin/admin.js index a27c3f74..1470fa5f 100644 --- a/priv/admin/admin.js +++ b/priv/admin/admin.js @@ -813,6 +813,7 @@ myApp.config(['NgAdminConfigurationProvider', function (nga) { ]), nga.field('payload', 'choice') .choices([ + { value: 'ascii', label: 'ASCII Text' }, { value: 'cayenne', label: 'Cayenne LPP' } ]), nga.field('parse_uplink', 'text'), diff --git a/src/lorawan_application_backend.erl b/src/lorawan_application_backend.erl index 13fb4273..13539c3a 100644 --- a/src/lorawan_application_backend.erl +++ b/src/lorawan_application_backend.erl @@ -278,6 +278,8 @@ filter_group_responses(_AppID, List) -> end, ok, List). +parse_payload(<<"ascii">>, Data) -> + #{text => Data}; parse_payload(<<"cayenne">>, Data) -> cayenne_decode(Data); parse_payload(None, _Data) when None == <<>>; None == undefined ->