我有一个带有 LoRa bee 的 SODAQ Mbili 板。我还有一个 GPS 传感器。您可以在下面找到我如何添加蜜蜂和传感器。
在该板上,我使用 GPS 坐标创建一个 JSON 字符串,然后通过 LoRa 网络发送该数据。但我怎么能这么做呢。
在我下载的源代码中,他们使用下一个代码:
LoRaModemMicrochip modem(&MODEM_SERIAL, &debugSerial);
Device libTest(&modem, &debugSerial);
void readGPSData() {
GPSSensor gpsSens(4.3, 51.222, 15.5, 0);
dumpSendResult(gpsSens);
}
void dumpSendResult(Sensor& sns) {
bool sendResult = libTest.send(sns, true);
}
我将更改此代码,如下面的代码,以便我可以发送我的 JSON 数据
LoRaModemMicrochip modem(&MODEM_SERIAL, &debugSerial);
Device libTest(&modem, &debugSerial);
void readGPSData() {
String json = "My JSON code";
dumpJsonResult(json);
}
void dumpJsonResult(String& text) {
bool sendResult = libTest.send(text, true);
}
但是它给了我这个错误:
在函数中
:void dumpJsonResult(String&)
错误:没有匹配的函数可调用
Device::send(String&, bool)
bool sendResult = libTest.send(text, true); ^
您知道如何将 JSON 数据发送到 LoRaWAN 吗?
如果您有正确的 NWSessionKey 和 APPSessionKey 等,您可以尝试通过 Actility 的免费合作伙伴专区登录您的设备。 https://partners.thingpark.com/
完成此操作后,您需要:
您的设备还可以将 ack 发送到应用服务器,您可以将其插入 Actility 的解决方案(REST-POST/JSON)
让我们知道进展如何 最好的问候,
使用了哪些库?我没有在 sodaq 网站上找到 LoRaModemMicrochip 对象定义。
你看过http://support.sodaq.com/sodaq-one/lorabee/吗?
我强烈建议您不要在 LoRa 中使用 JSON,因为这非常冗长并且会占用大量的通话时间,而 LoRa 运行的频段有很强的占空比限制。