mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-23 19:20:41 +00:00
whatever makes trunk happy.
This commit is contained in:
@@ -168,7 +168,8 @@ void setupMeshService(void)
|
||||
// any characteristic(s) within that service definition.. Calling .begin() on
|
||||
// a BLECharacteristic will cause it to be added to the last BLEService that
|
||||
// was 'begin()'ed!
|
||||
auto secMode = config.bluetooth.mode == meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN ? SECMODE_OPEN : SECMODE_ENC_NO_MITM;
|
||||
auto secMode =
|
||||
config.bluetooth.mode == meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN ? SECMODE_OPEN : SECMODE_ENC_NO_MITM;
|
||||
|
||||
fromNum.setProperties(CHR_PROPS_NOTIFY | CHR_PROPS_READ);
|
||||
fromNum.setPermission(secMode, SECMODE_NO_ACCESS); // FIXME, secure this!!!
|
||||
@@ -226,8 +227,9 @@ void NRF52Bluetooth::setup()
|
||||
Bluefruit.ScanResponse.clearData();
|
||||
|
||||
if (config.bluetooth.mode != meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN) {
|
||||
configuredPasskey = config.bluetooth.mode == meshtastic_Config_BluetoothConfig_PairingMode_FIXED_PIN ? config.bluetooth.fixed_pin
|
||||
: random(100000, 999999);
|
||||
configuredPasskey = config.bluetooth.mode == meshtastic_Config_BluetoothConfig_PairingMode_FIXED_PIN
|
||||
? config.bluetooth.fixed_pin
|
||||
: random(100000, 999999);
|
||||
auto pinString = std::to_string(configuredPasskey);
|
||||
LOG_INFO("Bluetooth pin set to '%i'\n", configuredPasskey);
|
||||
Bluefruit.Security.setPIN(pinString.c_str());
|
||||
|
||||
@@ -9,7 +9,7 @@ SimRadio::SimRadio()
|
||||
|
||||
SimRadio *SimRadio::instance;
|
||||
|
||||
ErrorCode SimRadio::send(MeshPacket *p)
|
||||
ErrorCode SimRadio::send(meshtastic_MeshPacket *p)
|
||||
{
|
||||
printPacket("enqueuing for send", p);
|
||||
|
||||
@@ -29,7 +29,7 @@ ErrorCode SimRadio::send(MeshPacket *p)
|
||||
|
||||
void SimRadio::setTransmitDelay()
|
||||
{
|
||||
MeshPacket *p = txQueue.getFront();
|
||||
meshtastic_MeshPacket *p = txQueue.getFront();
|
||||
// We want all sending/receiving to be done by our daemon thread.
|
||||
// We use a delay here because this packet might have been sent in response to a packet we just received.
|
||||
// So we want to make sure the other side has had a chance to reconfigure its radio.
|
||||
@@ -163,7 +163,7 @@ void SimRadio::onNotify(uint32_t notification)
|
||||
setTransmitDelay(); // reset random delay
|
||||
} else {
|
||||
// Send any outgoing packets we have ready
|
||||
MeshPacket *txp = txQueue.dequeue();
|
||||
meshtastic_MeshPacket *txp = txQueue.dequeue();
|
||||
assert(txp);
|
||||
startSend(txp);
|
||||
// Packet has been sent, count it toward our TX airtime utilization.
|
||||
@@ -188,9 +188,9 @@ void SimRadio::startSend(MeshPacket *txp)
|
||||
{
|
||||
printPacket("Starting low level send", txp);
|
||||
size_t numbytes = beginSending(txp);
|
||||
MeshPacket *p = packetPool.allocCopy(*txp);
|
||||
meshtastic_MeshPacket *p = packetPool.allocCopy(*txp);
|
||||
perhapsDecode(p);
|
||||
Compressed c = Compressed_init_default;
|
||||
meshtastic_Compressed c = meshtastic_Compressed_init_default;
|
||||
c.portnum = p->decoded.portnum;
|
||||
// LOG_DEBUG("Sending back to simulator with portNum %d\n", p->decoded.portnum);
|
||||
if (p->decoded.payload.size <= sizeof(c.data.bytes)) {
|
||||
@@ -199,8 +199,9 @@ void SimRadio::startSend(MeshPacket *txp)
|
||||
} else {
|
||||
LOG_WARN("Payload size is larger than compressed message allows! Sending empty payload.\n");
|
||||
}
|
||||
p->decoded.payload.size = pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &Compressed_msg, &c);
|
||||
p->decoded.portnum = PortNum_SIMULATOR_APP;
|
||||
p->decoded.payload.size =
|
||||
pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_Compressed_msg, &c);
|
||||
p->decoded.portnum = meshtastic_PortNum_SIMULATOR_APP;
|
||||
service.sendToPhone(p); // Sending back to simulator
|
||||
}
|
||||
|
||||
@@ -213,9 +214,9 @@ void SimRadio::startReceive(MeshPacket *p)
|
||||
handleReceiveInterrupt(p);
|
||||
}
|
||||
|
||||
QueueStatus SimRadio::getQueueStatus()
|
||||
meshtastic_QueueStatus SimRadio::getQueueStatus()
|
||||
{
|
||||
QueueStatus qs;
|
||||
meshtastic_QueueStatus qs;
|
||||
|
||||
qs.res = qs.mesh_packet_id = 0;
|
||||
qs.free = txQueue.getFree();
|
||||
@@ -224,7 +225,7 @@ QueueStatus SimRadio::getQueueStatus()
|
||||
return qs;
|
||||
}
|
||||
|
||||
void SimRadio::handleReceiveInterrupt(MeshPacket *p)
|
||||
void SimRadio::handleReceiveInterrupt(meshtastic_MeshPacket *p)
|
||||
{
|
||||
LOG_DEBUG("HANDLE RECEIVE INTERRUPT\n");
|
||||
uint32_t xmitMsec;
|
||||
@@ -241,8 +242,8 @@ void SimRadio::handleReceiveInterrupt(MeshPacket *p)
|
||||
xmitMsec = getPacketTime(length);
|
||||
// LOG_DEBUG("Payload size %d vs length (includes header) %d\n", p->decoded.payload.size, length);
|
||||
|
||||
MeshPacket *mp = packetPool.allocCopy(*p); // keep a copy in packtPool
|
||||
mp->which_payload_variant = MeshPacket_decoded_tag; // Mark that the payload is already decoded
|
||||
meshtastic_MeshPacket *mp = packetPool.allocCopy(*p); // keep a copy in packtPool
|
||||
mp->which_payload_variant = meshtastic_MeshPacket_decoded_tag; // Mark that the payload is already decoded
|
||||
|
||||
printPacket("Lora RX", mp);
|
||||
|
||||
@@ -251,7 +252,7 @@ void SimRadio::handleReceiveInterrupt(MeshPacket *p)
|
||||
deliverToReceiver(mp);
|
||||
}
|
||||
|
||||
size_t SimRadio::getPacketLength(MeshPacket *mp)
|
||||
size_t SimRadio::getPacketLength(meshtastic_MeshPacket *mp)
|
||||
{
|
||||
auto &p = mp->decoded;
|
||||
return (size_t)p.payload.size + sizeof(PacketHeader);
|
||||
|
||||
@@ -24,7 +24,7 @@ class SimRadio : public RadioInterface
|
||||
*/
|
||||
static SimRadio *instance;
|
||||
|
||||
virtual ErrorCode send(MeshPacket *p) override;
|
||||
virtual ErrorCode send(meshtastic_MeshPacket *p) override;
|
||||
|
||||
/** can we detect a LoRa preamble on the current channel? */
|
||||
virtual bool isChannelActive();
|
||||
@@ -42,9 +42,9 @@ class SimRadio : public RadioInterface
|
||||
*
|
||||
* External functions can call this method to wake the device from sleep.
|
||||
*/
|
||||
virtual void startReceive(MeshPacket *p);
|
||||
virtual void startReceive(meshtastic_MeshPacket *p);
|
||||
|
||||
QueueStatus getQueueStatus() override;
|
||||
meshtastic_QueueStatus getQueueStatus() override;
|
||||
|
||||
protected:
|
||||
/// are _trying_ to receive a packet currently (note - we might just be waiting for one)
|
||||
@@ -60,15 +60,15 @@ class SimRadio : public RadioInterface
|
||||
void startTransmitTimerSNR(float snr);
|
||||
|
||||
void handleTransmitInterrupt();
|
||||
void handleReceiveInterrupt(MeshPacket *p);
|
||||
void handleReceiveInterrupt(meshtastic_MeshPacket *p);
|
||||
|
||||
void onNotify(uint32_t notification);
|
||||
|
||||
// start an immediate transmit
|
||||
virtual void startSend(MeshPacket *txp);
|
||||
virtual void startSend(meshtastic_MeshPacket *txp);
|
||||
|
||||
// derive packet length
|
||||
size_t getPacketLength(MeshPacket *p);
|
||||
size_t getPacketLength(meshtastic_MeshPacket *p);
|
||||
|
||||
int16_t readData(uint8_t *str, size_t len);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
// set HW_VENDOR
|
||||
//
|
||||
|
||||
#define HW_VENDOR HardwareModel_PORTDUINO
|
||||
#define HW_VENDOR meshtastic_HardwareModel_PORTDUINO
|
||||
|
||||
#define HAS_RTC 1
|
||||
#define HAS_WIFI 1
|
||||
|
||||
Reference in New Issue
Block a user