Skip to content

Commit 12bc60f

Browse files
committed
A little helper: decode ASCII payload
1 parent 365f8e2 commit 12bc60f

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

doc/Handlers.md

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ To create a new handler you need to set:
2525
- **Application** name
2626
- **Uplink Fields** that will be forwarded to the backend Connector
2727
- **Payload** format for automatic decoding
28+
- **ASCII Text**
2829
- [**Cayenne LPP**](https://github.com/myDevicesIoT/cayenne-docs/blob/master/docs/LORA.md)
2930
- **Parse Uplink** function to extract additional data fields from the uplink frame
3031
- **Event Fields** that will be forwarded to the backend Connector
@@ -149,6 +150,10 @@ The server can auto-parse some well-known data formats.
149150
To parse a custom format leave the *Payload* field undefined and write own
150151
*Parse Uplink* function.
151152

153+
### ASCII Text
154+
155+
The payload will get stored into the `text` field as ASII characters.
156+
152157
### Cayenne Low Power Payload (LPP)
153158

154159
For each Data Channel *N* the server will create a `fieldN` with the parsed value.

priv/admin/admin.js

+1
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,7 @@ myApp.config(['NgAdminConfigurationProvider', function (nga) {
813813
]),
814814
nga.field('payload', 'choice')
815815
.choices([
816+
{ value: 'ascii', label: 'ASCII Text' },
816817
{ value: 'cayenne', label: 'Cayenne LPP' }
817818
]),
818819
nga.field('parse_uplink', 'text'),

src/lorawan_application_backend.erl

+2
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ filter_group_responses(_AppID, List) ->
278278
end,
279279
ok, List).
280280

281+
parse_payload(<<"ascii">>, Data) ->
282+
#{text => Data};
281283
parse_payload(<<"cayenne">>, Data) ->
282284
cayenne_decode(Data);
283285
parse_payload(None, _Data) when None == <<>>; None == undefined ->

0 commit comments

Comments
 (0)