rfsdfg

Dependencies:   Cayenne-LPP

Files at this revision

API Documentation at this revision

Comitter:
ennio
Date:
Wed Feb 03 12:24:26 2021 +0000
Parent:
59:23cc35ed9008
Commit message:
mmmmmm

Changed in this revision

Cayenne-LPP.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-lora-radio-drv.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
diff -r 23cc35ed9008 -r f84a58324d38 Cayenne-LPP.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Cayenne-LPP.lib	Wed Feb 03 12:24:26 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/myDevicesIoT/code/Cayenne-LPP/#5a9d65b33e85
diff -r 23cc35ed9008 -r f84a58324d38 main.cpp
--- a/main.cpp	Thu Nov 28 09:01:59 2019 +0000
+++ b/main.cpp	Wed Feb 03 12:24:26 2021 +0000
@@ -24,6 +24,7 @@
 #include "DummySensor.h"
 #include "trace_helper.h"
 #include "lora_radio_helper.h"
+#include "CayenneLPP.h"
 
 using namespace events;
 
@@ -36,7 +37,7 @@
 /*
  * Sets up an application dependent transmission timer in ms. Used only when Duty Cycling is off for testing
  */
-#define TX_TIMER                        10000
+#define TX_TIMER                        20000
 
 /**
  * Maximum number of events for the event queue.
@@ -59,7 +60,8 @@
  * Dummy sensor class object
  */
 DS1820  ds1820(PC_9);
-
+CayenneLPP cayenne(100);
+AnalogIn lm35(A0);
 /**
 * This event queue is the global event queue for both the
 * application and stack. To conserve memory, the stack is designed to run
@@ -152,23 +154,36 @@
 {
     uint16_t packet_len;
     int16_t retcode;
-    int32_t sensor_value;
+    float sensor_value;
+    float lm35temp;
 
     if (ds1820.begin()) {
         ds1820.startConversion();
         sensor_value = ds1820.read();
-        printf("\r\n Dummy Sensor Value = %d \r\n", sensor_value);
+        printf("\r\n Dummy Sensor Value = %f \r\n", sensor_value);
         ds1820.startConversion();
     } else {
         printf("\r\n No sensor found \r\n");
         return;
     }
+    lm35temp=lm35.read()*330.0;
 
-    packet_len = sprintf((char *) tx_buffer, "Dummy Sensor Value is %d",
-                         sensor_value);
+    cayenne.reset(); // vidage du payload cayenne
+    cayenne.addTemperature(2, lm35temp);
+    cayenne.addTemperature(1, sensor_value); // ajout de la valeur t°
+    cayenne.copy(tx_buffer); // copie dans le buffer LORA
+    packet_len=cayenne.getSize();
+    retcode = lorawan.send(MBED_CONF_LORA_APP_PORT, tx_buffer, packet_len,
+MSG_CONFIRMED_FLAG);
+
+    packet_len = sprintf((char *) tx_buffer, "Dummy Sensor Value is %f",sensor_value);
 
     retcode = lorawan.send(MBED_CONF_LORA_APP_PORT, tx_buffer, packet_len,
                            MSG_UNCONFIRMED_FLAG);
+    printf("\n lm35 : %.2f\n",lm35temp);
+    printf("\nMessage: ");
+    for(int i=0;i<packet_len;i++) printf("%02X ",tx_buffer[i]);
+    printf("\n");
 
     if (retcode < 0) {
         retcode == LORAWAN_STATUS_WOULD_BLOCK ? printf("send - WOULD BLOCK\r\n")
diff -r 23cc35ed9008 -r f84a58324d38 mbed-lora-radio-drv.lib
--- a/mbed-lora-radio-drv.lib	Thu Nov 28 09:01:59 2019 +0000
+++ b/mbed-lora-radio-drv.lib	Wed Feb 03 12:24:26 2021 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-semtech-lora-rf-drivers#6012fa43cf9f2cae46fa9d424fe4051d00e157a2
+https://github.com/ARMmbed/mbed-semtech-lora-rf-drivers/#6012fa43cf9f2cae46fa9d424fe4051d00e157a2
diff -r 23cc35ed9008 -r f84a58324d38 mbed_app.json
--- a/mbed_app.json	Thu Nov 28 09:01:59 2019 +0000
+++ b/mbed_app.json	Wed Feb 03 12:24:26 2021 +0000
@@ -33,9 +33,9 @@
             "lora.over-the-air-activation": true,
             "lora.duty-cycle-on": true,
             "lora.phy": "EU868",
-            "lora.device-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }",
-            "lora.application-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }",
-            "lora.application-key": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }"
+            "lora.device-eui": "{ 0x00, 0x7F, 0x4C, 0x6F, 0x98, 0x90, 0x04, 0x40 }",
+            "lora.application-eui": "{ 0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x03, 0x91, 0xC8 }",
+            "lora.application-key": "{ 0x75, 0xC3, 0x00, 0x7C, 0x57, 0x0B, 0xB0, 0x94, 0x92, 0x89, 0x7A, 0xCC, 0x0C, 0x84, 0xDA, 0xDE }"
         },
 
         "K64F": {