Spaces:
Build error
Build error
Commit
·
9871430
1
Parent(s):
c8d39fa
Create utils/lora_integration.py
Browse files- utils/lora_integration.py +19 -0
utils/lora_integration.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# utils/lora_integration.py
|
| 2 |
+
import json
|
| 3 |
+
import lora_library # Assuming there's a lora_library module
|
| 4 |
+
|
| 5 |
+
class LoRaIntegration:
|
| 6 |
+
@staticmethod
|
| 7 |
+
def send_data(data):
|
| 8 |
+
lora = lora_library.LoRa()
|
| 9 |
+
data_json = json.dumps(data)
|
| 10 |
+
lora.send(data_json)
|
| 11 |
+
|
| 12 |
+
@staticmethod
|
| 13 |
+
def receive_data():
|
| 14 |
+
lora = lora_library.LoRa()
|
| 15 |
+
received_data = lora.receive()
|
| 16 |
+
if received_data:
|
| 17 |
+
return json.loads(received_data)
|
| 18 |
+
else:
|
| 19 |
+
return None
|