Skip to content

Commit

Permalink
Add event field
Browse files Browse the repository at this point in the history
  • Loading branch information
gotthardp committed Feb 19, 2018
1 parent 43ee9f2 commit 784ab1a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ The server:
* Invokes internal modules with application logic. It provides examples for:
* [Semtech/IMST LoRaMote](http://webshop.imst.de/loramote-lora-evaluation-tool.html)
* [Microchip LoRa(TM) Technology Mote](http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=dm164138)
* Automatically parses well-known payload formats. It currently supports:
* [Cayenne Low Power Payload](https://github.com/myDevicesIoT/cayenne-docs/blob/master/docs/LORA.md#cayenne-low-power-payload)
* Invokes external applications. It currently supports connections via:
* WebSocket protocol [RFC6455](https://tools.ietf.org/rfc/rfc6455.txt)
* HTTP/1.1 and HTTP/2 protocol (REST API)
Expand Down
1 change: 1 addition & 0 deletions doc/Handlers.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ applications the following fields:
fcnt | Integer | U | Received frame sequence number.
port | Integer | U | LoRaWAN port number.
data | Hex String | U | Raw application payload, encoded as a hexadecimal string.
event | String | J DL | Event name (joined, delivered, lost).
datetime | ISO 8601 | U J DL | Timestamp using the server clock.
freq | Number | U | RX central frequency in MHz (unsigned float, Hz precision).
datr | String | U | LoRa datarate identifier (eg. "SF12BW500").
Expand Down
1 change: 1 addition & 0 deletions priv/admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ myApp.config(['NgAdminConfigurationProvider', function (nga) {
{ value: 'fcnt', label: 'fcnt' },
{ value: 'port', label: 'port' },
{ value: 'data', label: 'data' },
{ value: 'event', label: 'event' },
{ value: 'datetime', label: 'datetime' },

{ value: 'freq', label: 'freq' },
Expand Down
3 changes: 2 additions & 1 deletion src/lorawan_application_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ handle_delivery({_Network, #profile{app=AppID}, Node}, Result, Receipt) ->
send_event(Event, Vars0, #handler{app=AppID, parse_event=Parse, fields=Fields}, DeviceOrNode) ->
Vars =
vars_add(app, AppID, Fields,
vars_add(event, Event, Fields,
vars_add(datetime, calendar:universal_time(), Fields,
case DeviceOrNode of
{#device{deveui=DevEUI, appargs=AppArgs}, DevAddr} ->
Expand All @@ -161,7 +162,7 @@ send_event(Event, Vars0, #handler{app=AppID, parse_event=Parse, fields=Fields},
vars_add(deveui, get_deveui(DevAddr), Fields,
vars_add(appargs, AppArgs, Fields,
Vars0)))
end)),
end))),
lorawan_backend_factory:event(AppID, DeviceOrNode,
data_to_fields(AppID, Parse, Vars, Event)).

Expand Down

0 comments on commit 784ab1a

Please sign in to comment.