message from LoRa to BLE phone ready
This commit is contained in:
parent
a4a4e7f9fb
commit
ad87514b29
|
|
@ -1,9 +1,8 @@
|
|||
#include "ble_utils.h"
|
||||
#include <NimBLEDevice.h>
|
||||
//#include "lora_utils.h"
|
||||
#include "ble_utils.h"
|
||||
#include "msg_utils.h"
|
||||
#include "logger.h"
|
||||
#include "display.h"
|
||||
#include "logger.h"
|
||||
|
||||
#define SERVICE_UUID "0000180A-0000-1000-8000-00805F9B34FB"
|
||||
#define CHARACTERISTIC_UUID "00002A29-0000-1000-8000-00805F9B34FB"
|
||||
|
|
@ -58,6 +57,13 @@ class MyCallbacks : public NimBLECharacteristicCallbacks {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*void onRead(NimBLECharacteristic* pCharacteristic) {
|
||||
Serial.println("Read request received");
|
||||
// Handle read operation, for example, set the value to be read
|
||||
pCharacteristic->setValue("Hello, ESP32!");
|
||||
}*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -83,7 +89,7 @@ namespace BLE_Utils {
|
|||
if (!sendBleToLoRa) {
|
||||
return;
|
||||
}
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "BT TX", "%s", bleLoRaPacket.c_str());
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "BLE Tx", "%s", bleLoRaPacket.c_str());
|
||||
show_display("BLE Tx >>", "", bleLoRaPacket, 1000);
|
||||
|
||||
MSG_Utils::sendMessage(bleMsgAddresse,bleMsgTxt);
|
||||
|
|
@ -93,4 +99,16 @@ namespace BLE_Utils {
|
|||
sendBleToLoRa = false;
|
||||
}
|
||||
|
||||
void sendToPhone(const String& packet) {
|
||||
if (!packet.isEmpty()) {
|
||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "BLE Rx", "%s", packet.c_str());
|
||||
String receivedPacketString = "";
|
||||
for (int i=0; i<packet.length()-1;i++) {
|
||||
receivedPacketString += packet[i];
|
||||
}
|
||||
pCharacteristic->setValue(receivedPacketString);
|
||||
pCharacteristic->notify();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ namespace BLE_Utils {
|
|||
|
||||
void setup();
|
||||
void sendToLoRa();
|
||||
void sendToPhone(const String& packet);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "logger.h"
|
||||
|
||||
#include "APRSPacketLib.h"
|
||||
#include "ble_utils.h"
|
||||
|
||||
extern Beacon *currentBeacon;
|
||||
extern logging::Logger logger;
|
||||
|
|
@ -173,7 +174,8 @@ namespace MSG_Utils {
|
|||
//Serial.println(packetReceived); // only for debug
|
||||
aprsPacket = APRSPacketLib::processReceivedPacket(packetReceived.substring(3));
|
||||
if (aprsPacket.sender!=currentBeacon->callsign) {
|
||||
BLUETOOTH_Utils::sendPacket(packetReceived.substring(3));
|
||||
//BLUETOOTH_Utils::sendPacket(packetReceived.substring(3));
|
||||
BLE_Utils::sendToPhone(packetReceived.substring(3));
|
||||
|
||||
if (digirepeaterActive) {
|
||||
String digiRepeatedPacket = APRSPacketLib::generateDigiRepeatedPacket(aprsPacket, currentBeacon->callsign);
|
||||
|
|
|
|||
Loading…
Reference in New Issue