Skip to content

Instantly share code, notes, and snippets.

@janjongboom
Created September 4, 2015 09:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janjongboom/fc083cae614c77877a02 to your computer and use it in GitHub Desktop.
Save janjongboom/fc083cae614c77877a02 to your computer and use it in GitHub Desktop.
Add appEui to AS->CS messages
diff --git a/ApplicationServer/MoteAS.cpp b/ApplicationServer/MoteAS.cpp
--- a/ApplicationServer/MoteAS.cpp
+++ b/ApplicationServer/MoteAS.cpp
@@ -131,7 +131,7 @@ void Mote::ForwardApplicationData(bool up, ValidValueUint32 const& sequenceNumbe
{
JSON::String jsonString;
jsonString.Open();
- jsonString.AddAppObject(up, Id(), sequenceNumber, token, payload, transmitRecord, gatewayList, false);
+ jsonString.AddAppObject(up, Id(), appEui, sequenceNumber, token, payload, transmitRecord, gatewayList, false);
jsonString.Close(); //top
Service::Mask mask = up ? Service::userDataServer : Service::downstreamServer;
diff --git a/Common/JsonString.cpp b/Common/JsonString.cpp
--- a/Common/JsonString.cpp
+++ b/Common/JsonString.cpp
@@ -65,10 +65,12 @@ void JSON::String::AddPosition(Position const& position, bool addCommaBefore)
}
-void JSON::String::AddAppObject(bool up, EuiType eui, ValidValueUint32 const& sequenceNumber, ValidValueUint16 const& token, LoRa::FrameApplicationData const& payload, MoteTransmitRecord const& transmitRecord, GatewayReceiveList const& gatewayList, bool addCommaBefore)
+void JSON::String::AddAppObject(bool up, EuiType eui, EuiType appEui, ValidValueUint32 const& sequenceNumber, ValidValueUint16 const& token, LoRa::FrameApplicationData const& payload, MoteTransmitRecord const& transmitRecord, GatewayReceiveList const& gatewayList, bool addCommaBefore)
{
OpenStructuredObject("app", addCommaBefore);
AddEui("moteeui", eui, false);
+ if (up)
+ AddEui("appeui", appEui, true);
AddDirection(up);
diff --git a/Common/JsonString.hpp b/Common/JsonString.hpp
--- a/Common/JsonString.hpp
+++ b/Common/JsonString.hpp
@@ -148,7 +148,7 @@ namespace JSON
void AddPosition(Position const& position, bool addCommaBefore = true);
//FRAME methods
- void AddAppObject(bool up, EuiType eui, ValidValueUint32 const& sequenceNumber, ValidValueUint16 const& token,
+ void AddAppObject(bool up, EuiType eui, EuiType appEui, ValidValueUint32 const& sequenceNumber, ValidValueUint16 const& token,
LoRa::FrameApplicationData const& payload,
MoteTransmitRecord const& transmitRecord,
GatewayReceiveList const& gatewayList,
diff --git a/CustomerServer/MoteCS.cpp b/CustomerServer/MoteCS.cpp
--- a/CustomerServer/MoteCS.cpp
+++ b/CustomerServer/MoteCS.cpp
@@ -7,7 +7,6 @@ The copyright of this file is owned by Semtech Corporation (Semtech). This is an
#include "GlobalDataCS.hpp"
#include "ValueWithValidity.hpp"
-
void MoteList::CreateMote(EuiType myEui, EuiType myApp)
{
DeleteById(myEui);
@@ -144,7 +143,7 @@ void Mote::DownlinkController::SendToMote(LoRa::FrameApplicationData const& data
JSON::String jsonString;
jsonString.Open();
- jsonString.AddAppObject(false, mote.Id(), invalidValueUint32, ++txToken, data, invalidTransmitRecord, invalidGatewayList, false);
+ jsonString.AddAppObject(false, mote.Id(), invalidValueUint32, invalidValueUint32, ++txToken, data, invalidTransmitRecord, invalidGatewayList, false);
jsonString.Close();
Global::applicationList.Send(mote.ApplicationEui(), Service::downstreamServerMask, jsonString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment