summaryrefslogtreecommitdiff
path: root/LoRaHandler/LoRaHandler.h
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2015-11-17 13:04:00 -0600
committerMike Fiore <mfiore@multitech.com>2015-11-17 13:04:00 -0600
commit11ac166f3476116b08eeaffc25d80b163573089b (patch)
tree0675e50c2377dbffc37ce3906967b17478f225c0 /LoRaHandler/LoRaHandler.h
parentb86c62d46385ff454a939f23277761b8ee6b8a0d (diff)
downloadmtdot-box-evb-factory-firmware-11ac166f3476116b08eeaffc25d80b163573089b.tar.gz
mtdot-box-evb-factory-firmware-11ac166f3476116b08eeaffc25d80b163573089b.tar.bz2
mtdot-box-evb-factory-firmware-11ac166f3476116b08eeaffc25d80b163573089b.zip
join works, but only once - added object for running LoRa operations in a thread, lots of misc updates
Diffstat (limited to 'LoRaHandler/LoRaHandler.h')
-rw-r--r--LoRaHandler/LoRaHandler.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/LoRaHandler/LoRaHandler.h b/LoRaHandler/LoRaHandler.h
new file mode 100644
index 0000000..20f9d6f
--- /dev/null
+++ b/LoRaHandler/LoRaHandler.h
@@ -0,0 +1,50 @@
+#ifndef __LORAHANDLER_H__
+#define __LORAHANDLER_H__
+
+#include "mDot.h"
+
+#define loraSignal (int32_t)0x02
+
+class LoRaHandler {
+ public:
+ typedef enum {
+ none = 0,
+ busy,
+ ping_success,
+ send_success,
+ join_success,
+ ping_failure,
+ send_failure,
+ join_failure
+ } LoRaStatus;
+
+ typedef struct {
+ bool status;
+ mDot::ping_response up;
+ mDot::ping_response down;
+ } LoRaPing;
+
+ LoRaHandler(osThreadId main);
+ ~LoRaHandler();
+
+ bool setDataRate(uint8_t rate);
+ bool setPower(uint32_t power);
+ bool ping();
+ bool send(std::vector<uint8_t> data);
+ bool join();
+ bool action(uint8_t cmd);
+ LoRaStatus getStatus();
+ LoRaPing getPingResults();
+ uint32_t getNextTx();
+
+
+ osThreadId _main;
+ Thread _thread;
+ LoRaStatus _status;
+ LoRaPing _ping;
+ mDot* _dot;
+ Mutex _mutex;
+};
+
+#endif
+