sforkowany z mirror/meshtastic-firmware
commit
b45d633a34
|
@ -9,13 +9,13 @@
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
;default_envs = tbeam
|
default_envs = tbeam
|
||||||
;default_envs = tbeam0.7
|
;default_envs = tbeam0.7
|
||||||
;default_envs = heltec
|
;default_envs = heltec
|
||||||
;default_envs = tlora-v1
|
;default_envs = tlora-v1
|
||||||
;default_envs = tlora-v2
|
;default_envs = tlora-v2
|
||||||
;default_envs = lora-relay-v1 # nrf board
|
;default_envs = lora-relay-v1 # nrf board
|
||||||
default_envs = linux # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
|
;default_envs = linux # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
|
||||||
|
|
||||||
[common]
|
[common]
|
||||||
; common is not currently used
|
; common is not currently used
|
||||||
|
|
2
proto
2
proto
|
@ -1 +1 @@
|
||||||
Subproject commit 106f4bfdebe277ab0b86d2b8c950ab78a35b0654
|
Subproject commit a76ceb1509b2ec3d844af0378e998e7d4737492c
|
|
@ -201,7 +201,7 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state
|
||||||
|
|
||||||
// the max length of this buffer is much longer than we can possibly print
|
// the max length of this buffer is much longer than we can possibly print
|
||||||
static char tempBuf[96];
|
static char tempBuf[96];
|
||||||
assert(mp.decoded.which_payload == SubPacket_data_tag);
|
assert(mp.decoded.which_payloadVariant == SubPacket_data_tag);
|
||||||
snprintf(tempBuf, sizeof(tempBuf), " %s", mp.decoded.data.payload.bytes);
|
snprintf(tempBuf, sizeof(tempBuf), " %s", mp.decoded.data.payload.bytes);
|
||||||
|
|
||||||
display->drawStringMaxWidth(4 + x, 10 + y, SCREEN_WIDTH - (6 + x), tempBuf);
|
display->drawStringMaxWidth(4 + x, 10 + y, SCREEN_WIDTH - (6 + x), tempBuf);
|
||||||
|
|
|
@ -72,7 +72,7 @@ void DSRRouter::sniffReceived(const MeshPacket *p)
|
||||||
addRoute(p->from, p->from, 0); // We are adjacent with zero hops
|
addRoute(p->from, p->from, 0); // We are adjacent with zero hops
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (p->decoded.which_payload) {
|
switch (p->decoded.which_payloadVariant) {
|
||||||
case SubPacket_route_request_tag:
|
case SubPacket_route_request_tag:
|
||||||
// Handle route discovery packets (will be a broadcast message)
|
// Handle route discovery packets (will be a broadcast message)
|
||||||
// FIXME - always start request with the senders nodenum
|
// FIXME - always start request with the senders nodenum
|
||||||
|
@ -139,7 +139,7 @@ void DSRRouter::sniffReceived(const MeshPacket *p)
|
||||||
|
|
||||||
// handle naks - convert them to route error packets
|
// handle naks - convert them to route error packets
|
||||||
// All naks are generated locally, because we failed resending the packet too many times
|
// All naks are generated locally, because we failed resending the packet too many times
|
||||||
PacketId nakId = p->decoded.which_ack == SubPacket_fail_id_tag ? p->decoded.ack.fail_id : 0;
|
PacketId nakId = p->decoded.which_ackVariant == SubPacket_fail_id_tag ? p->decoded.ackVariant.fail_id : 0;
|
||||||
if (nakId) {
|
if (nakId) {
|
||||||
auto pending = findPendingPacket(p->to, nakId);
|
auto pending = findPendingPacket(p->to, nakId);
|
||||||
if (pending && pending->packet->decoded.source) { // if source not set, this was not a multihop packet, just ignore
|
if (pending && pending->packet->decoded.source) { // if source not set, this was not a multihop packet, just ignore
|
||||||
|
|
|
@ -176,7 +176,7 @@ void MeshService::sendToMesh(MeshPacket *p)
|
||||||
// Strip out any time information before sending packets to other nodes - to keep the wire size small (and because other
|
// Strip out any time information before sending packets to other nodes - to keep the wire size small (and because other
|
||||||
// nodes shouldn't trust it anyways) Note: we allow a device with a local GPS to include the time, so that gpsless
|
// nodes shouldn't trust it anyways) Note: we allow a device with a local GPS to include the time, so that gpsless
|
||||||
// devices can get time.
|
// devices can get time.
|
||||||
if (p->which_payload == MeshPacket_decoded_tag && p->decoded.which_payload == SubPacket_position_tag &&
|
if (p->which_payloadVariant == MeshPacket_decoded_tag && p->decoded.which_payloadVariant == SubPacket_position_tag &&
|
||||||
p->decoded.position.time) {
|
p->decoded.position.time) {
|
||||||
if (getRTCQuality() < RTCQualityGPS) {
|
if (getRTCQuality() < RTCQualityGPS) {
|
||||||
DEBUG_MSG("Stripping time %u from position send\n", p->decoded.position.time);
|
DEBUG_MSG("Stripping time %u from position send\n", p->decoded.position.time);
|
||||||
|
|
|
@ -265,16 +265,15 @@ void NodeDB::installDefaultDeviceState()
|
||||||
|
|
||||||
// Init our blank owner info to reasonable defaults
|
// Init our blank owner info to reasonable defaults
|
||||||
getMacAddr(ourMacAddr);
|
getMacAddr(ourMacAddr);
|
||||||
sprintf(owner.id, "!%02x%02x%02x%02x%02x%02x", ourMacAddr[0], ourMacAddr[1], ourMacAddr[2], ourMacAddr[3], ourMacAddr[4],
|
|
||||||
ourMacAddr[5]);
|
|
||||||
memcpy(owner.macaddr, ourMacAddr, sizeof(owner.macaddr));
|
|
||||||
|
|
||||||
// Set default owner name
|
// Set default owner name
|
||||||
pickNewNodeNum(); // Note: we will repick later, just in case the settings are corrupted, but we need a valid
|
pickNewNodeNum(); // based on macaddr now
|
||||||
// owner.short_name now
|
|
||||||
sprintf(owner.long_name, "Unknown %02x%02x", ourMacAddr[4], ourMacAddr[5]);
|
sprintf(owner.long_name, "Unknown %02x%02x", ourMacAddr[4], ourMacAddr[5]);
|
||||||
sprintf(owner.short_name, "?%02X", (unsigned)(myNodeInfo.my_node_num & 0xff));
|
sprintf(owner.short_name, "?%02X", (unsigned)(myNodeInfo.my_node_num & 0xff));
|
||||||
|
|
||||||
|
sprintf(owner.id, "!%08x", getNodeNum()); // Default node ID now based on nodenum
|
||||||
|
memcpy(owner.macaddr, ourMacAddr, sizeof(owner.macaddr));
|
||||||
|
|
||||||
// Restore region if possible
|
// Restore region if possible
|
||||||
if (oldRegionCode != RegionCode_Unset)
|
if (oldRegionCode != RegionCode_Unset)
|
||||||
radioConfig.preferences.region = oldRegionCode;
|
radioConfig.preferences.region = oldRegionCode;
|
||||||
|
@ -526,7 +525,7 @@ void NodeDB::updateUser(uint32_t nodeId, const User &p)
|
||||||
/// we updateGUI and updateGUIforNode if we think our this change is big enough for a redraw
|
/// we updateGUI and updateGUIforNode if we think our this change is big enough for a redraw
|
||||||
void NodeDB::updateFrom(const MeshPacket &mp)
|
void NodeDB::updateFrom(const MeshPacket &mp)
|
||||||
{
|
{
|
||||||
if (mp.which_payload == MeshPacket_decoded_tag) {
|
if (mp.which_payloadVariant == MeshPacket_decoded_tag) {
|
||||||
const SubPacket &p = mp.decoded;
|
const SubPacket &p = mp.decoded;
|
||||||
DEBUG_MSG("Update DB node 0x%x, rx_time=%u\n", mp.from, mp.rx_time);
|
DEBUG_MSG("Update DB node 0x%x, rx_time=%u\n", mp.from, mp.rx_time);
|
||||||
|
|
||||||
|
@ -539,7 +538,7 @@ void NodeDB::updateFrom(const MeshPacket &mp)
|
||||||
|
|
||||||
info->snr = mp.rx_snr; // keep the most recent SNR we received for this node.
|
info->snr = mp.rx_snr; // keep the most recent SNR we received for this node.
|
||||||
|
|
||||||
switch (p.which_payload) {
|
switch (p.which_payloadVariant) {
|
||||||
case SubPacket_position_tag: {
|
case SubPacket_position_tag: {
|
||||||
// handle a legacy position packet
|
// handle a legacy position packet
|
||||||
DEBUG_MSG("WARNING: Processing a (deprecated) position packet from %d\n", mp.from);
|
DEBUG_MSG("WARNING: Processing a (deprecated) position packet from %d\n", mp.from);
|
||||||
|
|
|
@ -59,15 +59,15 @@ void PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
||||||
// return (lastContactMsec != 0) &&
|
// return (lastContactMsec != 0) &&
|
||||||
|
|
||||||
if (pb_decode_from_bytes(buf, bufLength, ToRadio_fields, &toRadioScratch)) {
|
if (pb_decode_from_bytes(buf, bufLength, ToRadio_fields, &toRadioScratch)) {
|
||||||
switch (toRadioScratch.which_variant) {
|
switch (toRadioScratch.which_payloadVariant) {
|
||||||
case ToRadio_packet_tag: {
|
case ToRadio_packet_tag: {
|
||||||
MeshPacket &p = toRadioScratch.variant.packet;
|
MeshPacket &p = toRadioScratch.packet;
|
||||||
printPacket("PACKET FROM PHONE", &p);
|
printPacket("PACKET FROM PHONE", &p);
|
||||||
service.handleToRadio(p);
|
service.handleToRadio(p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ToRadio_want_config_id_tag:
|
case ToRadio_want_config_id_tag:
|
||||||
config_nonce = toRadioScratch.variant.want_config_id;
|
config_nonce = toRadioScratch.want_config_id;
|
||||||
DEBUG_MSG("Client wants config, nonce=%u\n", config_nonce);
|
DEBUG_MSG("Client wants config, nonce=%u\n", config_nonce);
|
||||||
state = STATE_SEND_MY_INFO;
|
state = STATE_SEND_MY_INFO;
|
||||||
|
|
||||||
|
@ -79,12 +79,12 @@ void PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
||||||
|
|
||||||
case ToRadio_set_owner_tag:
|
case ToRadio_set_owner_tag:
|
||||||
DEBUG_MSG("Client is setting owner\n");
|
DEBUG_MSG("Client is setting owner\n");
|
||||||
handleSetOwner(toRadioScratch.variant.set_owner);
|
handleSetOwner(toRadioScratch.set_owner);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ToRadio_set_radio_tag:
|
case ToRadio_set_radio_tag:
|
||||||
DEBUG_MSG("Client is setting radio\n");
|
DEBUG_MSG("Client is setting radio\n");
|
||||||
handleSetRadio(toRadioScratch.variant.set_radio);
|
handleSetRadio(toRadioScratch.set_radio);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -131,22 +131,22 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||||
myNodeInfo.has_gps = (radioConfig.preferences.location_share == LocationSharing_LocDisabled)
|
myNodeInfo.has_gps = (radioConfig.preferences.location_share == LocationSharing_LocDisabled)
|
||||||
? true
|
? true
|
||||||
: (gps && gps->isConnected()); // Update with latest GPS connect info
|
: (gps && gps->isConnected()); // Update with latest GPS connect info
|
||||||
fromRadioScratch.which_variant = FromRadio_my_info_tag;
|
fromRadioScratch.which_payloadVariant = FromRadio_my_info_tag;
|
||||||
fromRadioScratch.variant.my_info = myNodeInfo;
|
fromRadioScratch.my_info = myNodeInfo;
|
||||||
state = STATE_SEND_RADIO;
|
state = STATE_SEND_RADIO;
|
||||||
|
|
||||||
service.refreshMyNodeInfo(); // Update my NodeInfo because the client will be asking for it soon.
|
service.refreshMyNodeInfo(); // Update my NodeInfo because the client will be asking for it soon.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE_SEND_RADIO:
|
case STATE_SEND_RADIO:
|
||||||
fromRadioScratch.which_variant = FromRadio_radio_tag;
|
fromRadioScratch.which_payloadVariant = FromRadio_radio_tag;
|
||||||
|
|
||||||
fromRadioScratch.variant.radio = radioConfig;
|
fromRadioScratch.radio = radioConfig;
|
||||||
|
|
||||||
// NOTE: The phone app needs to know the ls_secs value so it can properly expect sleep behavior.
|
// NOTE: The phone app needs to know the ls_secs value so it can properly expect sleep behavior.
|
||||||
// So even if we internally use 0 to represent 'use default' we still need to send the value we are
|
// So even if we internally use 0 to represent 'use default' we still need to send the value we are
|
||||||
// using to the app (so that even old phone apps work with new device loads).
|
// using to the app (so that even old phone apps work with new device loads).
|
||||||
fromRadioScratch.variant.radio.preferences.ls_secs = getPref_ls_secs();
|
fromRadioScratch.radio.preferences.ls_secs = getPref_ls_secs();
|
||||||
|
|
||||||
state = STATE_SEND_NODEINFO;
|
state = STATE_SEND_NODEINFO;
|
||||||
break;
|
break;
|
||||||
|
@ -158,8 +158,8 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||||
if (info) {
|
if (info) {
|
||||||
DEBUG_MSG("Sending nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", info->num, info->position.time, info->user.id,
|
DEBUG_MSG("Sending nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", info->num, info->position.time, info->user.id,
|
||||||
info->user.long_name);
|
info->user.long_name);
|
||||||
fromRadioScratch.which_variant = FromRadio_node_info_tag;
|
fromRadioScratch.which_payloadVariant = FromRadio_node_info_tag;
|
||||||
fromRadioScratch.variant.node_info = *info;
|
fromRadioScratch.node_info = *info;
|
||||||
// Stay in current state until done sending nodeinfos
|
// Stay in current state until done sending nodeinfos
|
||||||
} else {
|
} else {
|
||||||
DEBUG_MSG("Done sending nodeinfos\n");
|
DEBUG_MSG("Done sending nodeinfos\n");
|
||||||
|
@ -171,8 +171,8 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
case STATE_SEND_COMPLETE_ID:
|
case STATE_SEND_COMPLETE_ID:
|
||||||
fromRadioScratch.which_variant = FromRadio_config_complete_id_tag;
|
fromRadioScratch.which_payloadVariant = FromRadio_config_complete_id_tag;
|
||||||
fromRadioScratch.variant.config_complete_id = config_nonce;
|
fromRadioScratch.config_complete_id = config_nonce;
|
||||||
config_nonce = 0;
|
config_nonce = 0;
|
||||||
state = STATE_SEND_PACKETS;
|
state = STATE_SEND_PACKETS;
|
||||||
break;
|
break;
|
||||||
|
@ -185,8 +185,8 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||||
printPacket("phone downloaded packet", packetForPhone);
|
printPacket("phone downloaded packet", packetForPhone);
|
||||||
|
|
||||||
// Encapsulate as a FromRadio packet
|
// Encapsulate as a FromRadio packet
|
||||||
fromRadioScratch.which_variant = FromRadio_packet_tag;
|
fromRadioScratch.which_payloadVariant = FromRadio_packet_tag;
|
||||||
fromRadioScratch.variant.packet = *packetForPhone;
|
fromRadioScratch.packet = *packetForPhone;
|
||||||
|
|
||||||
service.releaseToPool(packetForPhone); // we just copied the bytes, so don't need this buffer anymore
|
service.releaseToPool(packetForPhone); // we just copied the bytes, so don't need this buffer anymore
|
||||||
packetForPhone = NULL;
|
packetForPhone = NULL;
|
||||||
|
@ -198,9 +198,9 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we have a message from the mesh?
|
// Do we have a message from the mesh?
|
||||||
if (fromRadioScratch.which_variant != 0) {
|
if (fromRadioScratch.which_payloadVariant != 0) {
|
||||||
// Encapsulate as a FromRadio packet
|
// Encapsulate as a FromRadio packet
|
||||||
DEBUG_MSG("encoding toPhone packet to phone variant=%d", fromRadioScratch.which_variant);
|
DEBUG_MSG("encoding toPhone packet to phone variant=%d", fromRadioScratch.which_payloadVariant);
|
||||||
size_t numbytes = pb_encode_to_bytes(buf, FromRadio_size, FromRadio_fields, &fromRadioScratch);
|
size_t numbytes = pb_encode_to_bytes(buf, FromRadio_size, FromRadio_fields, &fromRadioScratch);
|
||||||
DEBUG_MSG(", %d bytes\n", numbytes);
|
DEBUG_MSG(", %d bytes\n", numbytes);
|
||||||
return numbytes;
|
return numbytes;
|
||||||
|
|
|
@ -83,7 +83,7 @@ uint32_t RadioInterface::getPacketTime(uint32_t pl)
|
||||||
|
|
||||||
uint32_t RadioInterface::getPacketTime(MeshPacket *p)
|
uint32_t RadioInterface::getPacketTime(MeshPacket *p)
|
||||||
{
|
{
|
||||||
assert(p->which_payload == MeshPacket_encrypted_tag); // It should have already been encoded by now
|
assert(p->which_payloadVariant == MeshPacket_encrypted_tag); // It should have already been encoded by now
|
||||||
uint32_t pl = p->encrypted.size + sizeof(PacketHeader);
|
uint32_t pl = p->encrypted.size + sizeof(PacketHeader);
|
||||||
|
|
||||||
return getPacketTime(pl);
|
return getPacketTime(pl);
|
||||||
|
@ -119,9 +119,9 @@ void printPacket(const char *prefix, const MeshPacket *p)
|
||||||
{
|
{
|
||||||
DEBUG_MSG("%s (id=0x%08x Fr0x%02x To0x%02x, WantAck%d, HopLim%d", prefix, p->id, p->from & 0xff, p->to & 0xff, p->want_ack,
|
DEBUG_MSG("%s (id=0x%08x Fr0x%02x To0x%02x, WantAck%d, HopLim%d", prefix, p->id, p->from & 0xff, p->to & 0xff, p->want_ack,
|
||||||
p->hop_limit);
|
p->hop_limit);
|
||||||
if (p->which_payload == MeshPacket_decoded_tag) {
|
if (p->which_payloadVariant == MeshPacket_decoded_tag) {
|
||||||
auto &s = p->decoded;
|
auto &s = p->decoded;
|
||||||
switch (s.which_payload) {
|
switch (s.which_payloadVariant) {
|
||||||
case SubPacket_data_tag:
|
case SubPacket_data_tag:
|
||||||
DEBUG_MSG(" Portnum=%d", s.data.portnum);
|
DEBUG_MSG(" Portnum=%d", s.data.portnum);
|
||||||
break;
|
break;
|
||||||
|
@ -135,7 +135,7 @@ void printPacket(const char *prefix, const MeshPacket *p)
|
||||||
DEBUG_MSG(" Payload:None");
|
DEBUG_MSG(" Payload:None");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DEBUG_MSG(" Payload:%d", s.which_payload);
|
DEBUG_MSG(" Payload:%d", s.which_payloadVariant);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (s.want_response)
|
if (s.want_response)
|
||||||
|
@ -147,10 +147,10 @@ void printPacket(const char *prefix, const MeshPacket *p)
|
||||||
if (s.dest != 0)
|
if (s.dest != 0)
|
||||||
DEBUG_MSG(" dest=%08x", s.dest);
|
DEBUG_MSG(" dest=%08x", s.dest);
|
||||||
|
|
||||||
if (s.which_ack == SubPacket_success_id_tag)
|
if (s.which_ackVariant == SubPacket_success_id_tag)
|
||||||
DEBUG_MSG(" successId=%08x", s.ack.success_id);
|
DEBUG_MSG(" successId=%08x", s.ackVariant.success_id);
|
||||||
else if (s.which_ack == SubPacket_fail_id_tag)
|
else if (s.which_ackVariant == SubPacket_fail_id_tag)
|
||||||
DEBUG_MSG(" failId=%08x", s.ack.fail_id);
|
DEBUG_MSG(" failId=%08x", s.ackVariant.fail_id);
|
||||||
} else {
|
} else {
|
||||||
DEBUG_MSG(" encrypted");
|
DEBUG_MSG(" encrypted");
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ size_t RadioInterface::beginSending(MeshPacket *p)
|
||||||
assert(!sendingPacket);
|
assert(!sendingPacket);
|
||||||
|
|
||||||
// DEBUG_MSG("sending queued packet on mesh (txGood=%d,rxGood=%d,rxBad=%d)\n", rf95.txGood(), rf95.rxGood(), rf95.rxBad());
|
// DEBUG_MSG("sending queued packet on mesh (txGood=%d,rxGood=%d,rxBad=%d)\n", rf95.txGood(), rf95.rxGood(), rf95.rxBad());
|
||||||
assert(p->which_payload == MeshPacket_encrypted_tag); // It should have already been encoded by now
|
assert(p->which_payloadVariant == MeshPacket_encrypted_tag); // It should have already been encoded by now
|
||||||
|
|
||||||
lastTxStart = millis();
|
lastTxStart = millis();
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ void RadioLibInterface::handleReceiveInterrupt()
|
||||||
|
|
||||||
addReceiveMetadata(mp);
|
addReceiveMetadata(mp);
|
||||||
|
|
||||||
mp->which_payload = MeshPacket_encrypted_tag; // Mark that the payload is still encrypted at this point
|
mp->which_payloadVariant = MeshPacket_encrypted_tag; // Mark that the payload is still encrypted at this point
|
||||||
assert(((uint32_t) payloadLen) <= sizeof(mp->encrypted.bytes));
|
assert(((uint32_t) payloadLen) <= sizeof(mp->encrypted.bytes));
|
||||||
memcpy(mp->encrypted.bytes, payload, payloadLen);
|
memcpy(mp->encrypted.bytes, payload, payloadLen);
|
||||||
mp->encrypted.size = payloadLen;
|
mp->encrypted.size = payloadLen;
|
||||||
|
|
|
@ -65,8 +65,8 @@ void ReliableRouter::sniffReceived(const MeshPacket *p)
|
||||||
|
|
||||||
// If the payload is valid, look for ack/nak
|
// If the payload is valid, look for ack/nak
|
||||||
|
|
||||||
PacketId ackId = p->decoded.which_ack == SubPacket_success_id_tag ? p->decoded.ack.success_id : 0;
|
PacketId ackId = p->decoded.which_ackVariant == SubPacket_success_id_tag ? p->decoded.ackVariant.success_id : 0;
|
||||||
PacketId nakId = p->decoded.which_ack == SubPacket_fail_id_tag ? p->decoded.ack.fail_id : 0;
|
PacketId nakId = p->decoded.which_ackVariant == SubPacket_fail_id_tag ? p->decoded.ackVariant.fail_id : 0;
|
||||||
|
|
||||||
// We intentionally don't check wasSeenRecently, because it is harmless to delete non existent retransmission records
|
// We intentionally don't check wasSeenRecently, because it is harmless to delete non existent retransmission records
|
||||||
if (ackId || nakId) {
|
if (ackId || nakId) {
|
||||||
|
|
|
@ -88,7 +88,7 @@ MeshPacket *Router::allocForSending()
|
||||||
{
|
{
|
||||||
MeshPacket *p = packetPool.allocZeroed();
|
MeshPacket *p = packetPool.allocZeroed();
|
||||||
|
|
||||||
p->which_payload = MeshPacket_decoded_tag; // Assume payload is decoded at start.
|
p->which_payloadVariant = MeshPacket_decoded_tag; // Assume payload is decoded at start.
|
||||||
p->from = nodeDB.getNodeNum();
|
p->from = nodeDB.getNodeNum();
|
||||||
p->to = NODENUM_BROADCAST;
|
p->to = NODENUM_BROADCAST;
|
||||||
p->hop_limit = HOP_RELIABLE;
|
p->hop_limit = HOP_RELIABLE;
|
||||||
|
@ -110,14 +110,14 @@ void Router::sendAckNak(ErrorReason err, NodeNum to, PacketId idFrom)
|
||||||
DEBUG_MSG("Sending an err=%d,to=0x%x,idFrom=0x%x,id=0x%x\n", err, to, idFrom, p->id);
|
DEBUG_MSG("Sending an err=%d,to=0x%x,idFrom=0x%x,id=0x%x\n", err, to, idFrom, p->id);
|
||||||
|
|
||||||
if (!err) {
|
if (!err) {
|
||||||
p->decoded.ack.success_id = idFrom;
|
p->decoded.ackVariant.success_id = idFrom;
|
||||||
p->decoded.which_ack = SubPacket_success_id_tag;
|
p->decoded.which_ackVariant = SubPacket_success_id_tag;
|
||||||
} else {
|
} else {
|
||||||
p->decoded.ack.fail_id = idFrom;
|
p->decoded.ackVariant.fail_id = idFrom;
|
||||||
p->decoded.which_ack = SubPacket_fail_id_tag;
|
p->decoded.which_ackVariant = SubPacket_fail_id_tag;
|
||||||
|
|
||||||
// Also send back the error reason
|
// Also send back the error reason
|
||||||
p->decoded.which_payload = SubPacket_error_reason_tag;
|
p->decoded.which_payloadVariant = SubPacket_error_reason_tag;
|
||||||
p->decoded.error_reason = err;
|
p->decoded.error_reason = err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ ErrorCode Router::send(MeshPacket *p)
|
||||||
{
|
{
|
||||||
assert(p->to != nodeDB.getNodeNum()); // should have already been handled by sendLocal
|
assert(p->to != nodeDB.getNodeNum()); // should have already been handled by sendLocal
|
||||||
|
|
||||||
PacketId nakId = p->decoded.which_ack == SubPacket_fail_id_tag ? p->decoded.ack.fail_id : 0;
|
PacketId nakId = p->decoded.which_ackVariant == SubPacket_fail_id_tag ? p->decoded.ackVariant.fail_id : 0;
|
||||||
assert(
|
assert(
|
||||||
!nakId); // I don't think we ever send 0hop naks over the wire (other than to the phone), test that assumption with assert
|
!nakId); // I don't think we ever send 0hop naks over the wire (other than to the phone), test that assumption with assert
|
||||||
|
|
||||||
|
@ -170,11 +170,11 @@ ErrorCode Router::send(MeshPacket *p)
|
||||||
|
|
||||||
// If the packet hasn't yet been encrypted, do so now (it might already be encrypted if we are just forwarding it)
|
// If the packet hasn't yet been encrypted, do so now (it might already be encrypted if we are just forwarding it)
|
||||||
|
|
||||||
assert(p->which_payload == MeshPacket_encrypted_tag ||
|
assert(p->which_payloadVariant == MeshPacket_encrypted_tag ||
|
||||||
p->which_payload == MeshPacket_decoded_tag); // I _think_ all packets should have a payload by now
|
p->which_payloadVariant == MeshPacket_decoded_tag); // I _think_ all packets should have a payload by now
|
||||||
|
|
||||||
// First convert from protobufs to raw bytes
|
// First convert from protobufs to raw bytes
|
||||||
if (p->which_payload == MeshPacket_decoded_tag) {
|
if (p->which_payloadVariant == MeshPacket_decoded_tag) {
|
||||||
static uint8_t bytes[MAX_RHPACKETLEN]; // we have to use a scratch buffer because a union
|
static uint8_t bytes[MAX_RHPACKETLEN]; // we have to use a scratch buffer because a union
|
||||||
|
|
||||||
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), SubPacket_fields, &p->decoded);
|
size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), SubPacket_fields, &p->decoded);
|
||||||
|
@ -185,7 +185,7 @@ ErrorCode Router::send(MeshPacket *p)
|
||||||
// Copy back into the packet and set the variant type
|
// Copy back into the packet and set the variant type
|
||||||
memcpy(p->encrypted.bytes, bytes, numbytes);
|
memcpy(p->encrypted.bytes, bytes, numbytes);
|
||||||
p->encrypted.size = numbytes;
|
p->encrypted.size = numbytes;
|
||||||
p->which_payload = MeshPacket_encrypted_tag;
|
p->which_payloadVariant = MeshPacket_encrypted_tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(iface); // This should have been detected already in sendLocal (or we just received a packet from outside)
|
assert(iface); // This should have been detected already in sendLocal (or we just received a packet from outside)
|
||||||
|
@ -211,10 +211,10 @@ void Router::sniffReceived(const MeshPacket *p)
|
||||||
|
|
||||||
bool Router::perhapsDecode(MeshPacket *p)
|
bool Router::perhapsDecode(MeshPacket *p)
|
||||||
{
|
{
|
||||||
if (p->which_payload == MeshPacket_decoded_tag)
|
if (p->which_payloadVariant == MeshPacket_decoded_tag)
|
||||||
return true; // If packet was already decoded just return
|
return true; // If packet was already decoded just return
|
||||||
|
|
||||||
assert(p->which_payload == MeshPacket_encrypted_tag);
|
assert(p->which_payloadVariant == MeshPacket_encrypted_tag);
|
||||||
|
|
||||||
// FIXME - someday don't send routing packets encrypted. That would allow us to route for other channels without
|
// FIXME - someday don't send routing packets encrypted. That would allow us to route for other channels without
|
||||||
// being able to decrypt their data.
|
// being able to decrypt their data.
|
||||||
|
@ -230,7 +230,7 @@ bool Router::perhapsDecode(MeshPacket *p)
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// parsing was successful
|
// parsing was successful
|
||||||
p->which_payload = MeshPacket_decoded_tag;
|
p->which_payloadVariant = MeshPacket_decoded_tag;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ class SinglePortPlugin : public MeshPlugin
|
||||||
{
|
{
|
||||||
// Update our local node info with our position (even if we don't decide to update anyone else)
|
// Update our local node info with our position (even if we don't decide to update anyone else)
|
||||||
MeshPacket *p = router->allocForSending();
|
MeshPacket *p = router->allocForSending();
|
||||||
p->decoded.which_payload = SubPacket_data_tag;
|
p->decoded.which_payloadVariant = SubPacket_data_tag;
|
||||||
p->decoded.data.portnum = ourPortNum;
|
p->decoded.data.portnum = ourPortNum;
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|
|
@ -84,8 +84,8 @@ void StreamAPI::emitRebooted()
|
||||||
{
|
{
|
||||||
// In case we send a FromRadio packet
|
// In case we send a FromRadio packet
|
||||||
memset(&fromRadioScratch, 0, sizeof(fromRadioScratch));
|
memset(&fromRadioScratch, 0, sizeof(fromRadioScratch));
|
||||||
fromRadioScratch.which_variant = FromRadio_rebooted_tag;
|
fromRadioScratch.which_payloadVariant = FromRadio_rebooted_tag;
|
||||||
fromRadioScratch.variant.rebooted = true;
|
fromRadioScratch.rebooted = true;
|
||||||
|
|
||||||
DEBUG_MSG("Emitting reboot packet for serial shell\n");
|
DEBUG_MSG("Emitting reboot packet for serial shell\n");
|
||||||
emitTxBuffer(pb_encode_to_bytes(txBuf + HEADER_LEN, FromRadio_size, FromRadio_fields, &fromRadioScratch));
|
emitTxBuffer(pb_encode_to_bytes(txBuf + HEADER_LEN, FromRadio_size, FromRadio_fields, &fromRadioScratch));
|
||||||
|
|
|
@ -80,7 +80,7 @@ extern const pb_msgdesc_t DeviceState_msg;
|
||||||
#define DeviceState_fields &DeviceState_msg
|
#define DeviceState_fields &DeviceState_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define DeviceState_size 6239
|
#define DeviceState_size 6262
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
@ -193,6 +193,11 @@ typedef struct _RadioConfig_UserPreferences {
|
||||||
bool ext_notification_plugin_active;
|
bool ext_notification_plugin_active;
|
||||||
bool ext_notification_plugin_alert_message;
|
bool ext_notification_plugin_alert_message;
|
||||||
bool ext_notification_plugin_alert_bell;
|
bool ext_notification_plugin_alert_bell;
|
||||||
|
bool range_test_plugin_enabled;
|
||||||
|
uint32_t range_test_plugin_sender;
|
||||||
|
bool range_test_plugin_save;
|
||||||
|
bool store_forward_plugin_enabled;
|
||||||
|
uint32_t store_forward_plugin_records;
|
||||||
} RadioConfig_UserPreferences;
|
} RadioConfig_UserPreferences;
|
||||||
|
|
||||||
typedef struct _RouteDiscovery {
|
typedef struct _RouteDiscovery {
|
||||||
|
@ -225,7 +230,7 @@ typedef struct _RadioConfig {
|
||||||
} RadioConfig;
|
} RadioConfig;
|
||||||
|
|
||||||
typedef struct _SubPacket {
|
typedef struct _SubPacket {
|
||||||
pb_size_t which_payload;
|
pb_size_t which_payloadVariant;
|
||||||
union {
|
union {
|
||||||
Position position;
|
Position position;
|
||||||
Data data;
|
Data data;
|
||||||
|
@ -237,11 +242,11 @@ typedef struct _SubPacket {
|
||||||
uint32_t original_id;
|
uint32_t original_id;
|
||||||
bool want_response;
|
bool want_response;
|
||||||
uint32_t dest;
|
uint32_t dest;
|
||||||
pb_size_t which_ack;
|
pb_size_t which_ackVariant;
|
||||||
union {
|
union {
|
||||||
uint32_t success_id;
|
uint32_t success_id;
|
||||||
uint32_t fail_id;
|
uint32_t fail_id;
|
||||||
} ack;
|
} ackVariant;
|
||||||
uint32_t source;
|
uint32_t source;
|
||||||
} SubPacket;
|
} SubPacket;
|
||||||
|
|
||||||
|
@ -249,7 +254,7 @@ typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t;
|
||||||
typedef struct _MeshPacket {
|
typedef struct _MeshPacket {
|
||||||
uint32_t from;
|
uint32_t from;
|
||||||
uint32_t to;
|
uint32_t to;
|
||||||
pb_size_t which_payload;
|
pb_size_t which_payloadVariant;
|
||||||
union {
|
union {
|
||||||
SubPacket decoded;
|
SubPacket decoded;
|
||||||
MeshPacket_encrypted_t encrypted;
|
MeshPacket_encrypted_t encrypted;
|
||||||
|
@ -264,7 +269,7 @@ typedef struct _MeshPacket {
|
||||||
|
|
||||||
typedef struct _FromRadio {
|
typedef struct _FromRadio {
|
||||||
uint32_t num;
|
uint32_t num;
|
||||||
pb_size_t which_variant;
|
pb_size_t which_payloadVariant;
|
||||||
union {
|
union {
|
||||||
MeshPacket packet;
|
MeshPacket packet;
|
||||||
MyNodeInfo my_info;
|
MyNodeInfo my_info;
|
||||||
|
@ -274,18 +279,18 @@ typedef struct _FromRadio {
|
||||||
uint32_t config_complete_id;
|
uint32_t config_complete_id;
|
||||||
bool rebooted;
|
bool rebooted;
|
||||||
ChannelSettings channel;
|
ChannelSettings channel;
|
||||||
} variant;
|
};
|
||||||
} FromRadio;
|
} FromRadio;
|
||||||
|
|
||||||
typedef struct _ToRadio {
|
typedef struct _ToRadio {
|
||||||
pb_size_t which_variant;
|
pb_size_t which_payloadVariant;
|
||||||
union {
|
union {
|
||||||
MeshPacket packet;
|
MeshPacket packet;
|
||||||
uint32_t want_config_id;
|
uint32_t want_config_id;
|
||||||
RadioConfig set_radio;
|
RadioConfig set_radio;
|
||||||
User set_owner;
|
User set_owner;
|
||||||
ChannelSettings set_channel;
|
ChannelSettings set_channel;
|
||||||
} variant;
|
};
|
||||||
} ToRadio;
|
} ToRadio;
|
||||||
|
|
||||||
|
|
||||||
|
@ -340,7 +345,7 @@ extern "C" {
|
||||||
#define MeshPacket_init_default {0, 0, 0, {SubPacket_init_default}, 0, 0, 0, 0, 0, 0}
|
#define MeshPacket_init_default {0, 0, 0, {SubPacket_init_default}, 0, 0, 0, 0, 0, 0}
|
||||||
#define ChannelSettings_init_default {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, "", 0, 0, 0, 0, 0, 0, 0}
|
#define ChannelSettings_init_default {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, "", 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default, false, ChannelSettings_init_default}
|
#define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default, false, ChannelSettings_init_default}
|
||||||
#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0}
|
#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0}
|
||||||
#define MyNodeInfo_init_default {0, 0, 0, "", "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0}
|
#define MyNodeInfo_init_default {0, 0, 0, "", "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN}
|
#define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN}
|
||||||
|
@ -354,7 +359,7 @@ extern "C" {
|
||||||
#define MeshPacket_init_zero {0, 0, 0, {SubPacket_init_zero}, 0, 0, 0, 0, 0, 0}
|
#define MeshPacket_init_zero {0, 0, 0, {SubPacket_init_zero}, 0, 0, 0, 0, 0, 0}
|
||||||
#define ChannelSettings_init_zero {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, "", 0, 0, 0, 0, 0, 0, 0}
|
#define ChannelSettings_init_zero {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, "", 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero, false, ChannelSettings_init_zero}
|
#define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero, false, ChannelSettings_init_zero}
|
||||||
#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0}
|
#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0}
|
||||||
#define MyNodeInfo_init_zero {0, 0, 0, "", "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0}
|
#define MyNodeInfo_init_zero {0, 0, 0, "", "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN}
|
#define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN}
|
||||||
|
@ -435,6 +440,11 @@ extern "C" {
|
||||||
#define RadioConfig_UserPreferences_ext_notification_plugin_active_tag 129
|
#define RadioConfig_UserPreferences_ext_notification_plugin_active_tag 129
|
||||||
#define RadioConfig_UserPreferences_ext_notification_plugin_alert_message_tag 130
|
#define RadioConfig_UserPreferences_ext_notification_plugin_alert_message_tag 130
|
||||||
#define RadioConfig_UserPreferences_ext_notification_plugin_alert_bell_tag 131
|
#define RadioConfig_UserPreferences_ext_notification_plugin_alert_bell_tag 131
|
||||||
|
#define RadioConfig_UserPreferences_range_test_plugin_enabled_tag 132
|
||||||
|
#define RadioConfig_UserPreferences_range_test_plugin_sender_tag 133
|
||||||
|
#define RadioConfig_UserPreferences_range_test_plugin_save_tag 134
|
||||||
|
#define RadioConfig_UserPreferences_store_forward_plugin_enabled_tag 136
|
||||||
|
#define RadioConfig_UserPreferences_store_forward_plugin_records_tag 137
|
||||||
#define RouteDiscovery_route_tag 2
|
#define RouteDiscovery_route_tag 2
|
||||||
#define User_id_tag 1
|
#define User_id_tag 1
|
||||||
#define User_long_name_tag 2
|
#define User_long_name_tag 2
|
||||||
|
@ -514,31 +524,31 @@ X(a, STATIC, REPEATED, INT32, route, 2)
|
||||||
#define RouteDiscovery_DEFAULT NULL
|
#define RouteDiscovery_DEFAULT NULL
|
||||||
|
|
||||||
#define SubPacket_FIELDLIST(X, a) \
|
#define SubPacket_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload,position,position), 1) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,position,position), 1) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload,data,data), 3) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,data,data), 3) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload,user,user), 4) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,user,user), 4) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload,route_request,route_request), 6) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,route_request,route_request), 6) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload,route_reply,route_reply), 7) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,route_reply,route_reply), 7) \
|
||||||
X(a, STATIC, ONEOF, UENUM, (payload,error_reason,error_reason), 13) \
|
X(a, STATIC, ONEOF, UENUM, (payloadVariant,error_reason,error_reason), 13) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, original_id, 2) \
|
X(a, STATIC, SINGULAR, UINT32, original_id, 2) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, want_response, 5) \
|
X(a, STATIC, SINGULAR, BOOL, want_response, 5) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, dest, 9) \
|
X(a, STATIC, SINGULAR, UINT32, dest, 9) \
|
||||||
X(a, STATIC, ONEOF, UINT32, (ack,success_id,ack.success_id), 10) \
|
X(a, STATIC, ONEOF, UINT32, (ackVariant,success_id,ackVariant.success_id), 10) \
|
||||||
X(a, STATIC, ONEOF, UINT32, (ack,fail_id,ack.fail_id), 11) \
|
X(a, STATIC, ONEOF, UINT32, (ackVariant,fail_id,ackVariant.fail_id), 11) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, source, 12)
|
X(a, STATIC, SINGULAR, UINT32, source, 12)
|
||||||
#define SubPacket_CALLBACK NULL
|
#define SubPacket_CALLBACK NULL
|
||||||
#define SubPacket_DEFAULT NULL
|
#define SubPacket_DEFAULT NULL
|
||||||
#define SubPacket_payload_position_MSGTYPE Position
|
#define SubPacket_payloadVariant_position_MSGTYPE Position
|
||||||
#define SubPacket_payload_data_MSGTYPE Data
|
#define SubPacket_payloadVariant_data_MSGTYPE Data
|
||||||
#define SubPacket_payload_user_MSGTYPE User
|
#define SubPacket_payloadVariant_user_MSGTYPE User
|
||||||
#define SubPacket_payload_route_request_MSGTYPE RouteDiscovery
|
#define SubPacket_payloadVariant_route_request_MSGTYPE RouteDiscovery
|
||||||
#define SubPacket_payload_route_reply_MSGTYPE RouteDiscovery
|
#define SubPacket_payloadVariant_route_reply_MSGTYPE RouteDiscovery
|
||||||
|
|
||||||
#define MeshPacket_FIELDLIST(X, a) \
|
#define MeshPacket_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, from, 1) \
|
X(a, STATIC, SINGULAR, UINT32, from, 1) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, to, 2) \
|
X(a, STATIC, SINGULAR, UINT32, to, 2) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload,decoded,decoded), 3) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,decoded,decoded), 3) \
|
||||||
X(a, STATIC, ONEOF, BYTES, (payload,encrypted,encrypted), 8) \
|
X(a, STATIC, ONEOF, BYTES, (payloadVariant,encrypted,encrypted), 8) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, channel_index, 4) \
|
X(a, STATIC, SINGULAR, UINT32, channel_index, 4) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, id, 6) \
|
X(a, STATIC, SINGULAR, UINT32, id, 6) \
|
||||||
X(a, STATIC, SINGULAR, FLOAT, rx_snr, 7) \
|
X(a, STATIC, SINGULAR, FLOAT, rx_snr, 7) \
|
||||||
|
@ -547,7 +557,7 @@ X(a, STATIC, SINGULAR, UINT32, hop_limit, 10) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, want_ack, 11)
|
X(a, STATIC, SINGULAR, BOOL, want_ack, 11)
|
||||||
#define MeshPacket_CALLBACK NULL
|
#define MeshPacket_CALLBACK NULL
|
||||||
#define MeshPacket_DEFAULT NULL
|
#define MeshPacket_DEFAULT NULL
|
||||||
#define MeshPacket_payload_decoded_MSGTYPE SubPacket
|
#define MeshPacket_payloadVariant_decoded_MSGTYPE SubPacket
|
||||||
|
|
||||||
#define ChannelSettings_FIELDLIST(X, a) \
|
#define ChannelSettings_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, INT32, tx_power, 1) \
|
X(a, STATIC, SINGULAR, INT32, tx_power, 1) \
|
||||||
|
@ -609,7 +619,12 @@ X(a, STATIC, SINGULAR, UINT32, ext_notification_plugin_output_ms, 127) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, ext_notification_plugin_output, 128) \
|
X(a, STATIC, SINGULAR, UINT32, ext_notification_plugin_output, 128) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, ext_notification_plugin_active, 129) \
|
X(a, STATIC, SINGULAR, BOOL, ext_notification_plugin_active, 129) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, ext_notification_plugin_alert_message, 130) \
|
X(a, STATIC, SINGULAR, BOOL, ext_notification_plugin_alert_message, 130) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, ext_notification_plugin_alert_bell, 131)
|
X(a, STATIC, SINGULAR, BOOL, ext_notification_plugin_alert_bell, 131) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, range_test_plugin_enabled, 132) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, range_test_plugin_sender, 133) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, range_test_plugin_save, 134) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, store_forward_plugin_enabled, 136) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, store_forward_plugin_records, 137)
|
||||||
#define RadioConfig_UserPreferences_CALLBACK NULL
|
#define RadioConfig_UserPreferences_CALLBACK NULL
|
||||||
#define RadioConfig_UserPreferences_DEFAULT NULL
|
#define RadioConfig_UserPreferences_DEFAULT NULL
|
||||||
|
|
||||||
|
@ -652,35 +667,35 @@ X(a, STATIC, SINGULAR, UENUM, level, 4)
|
||||||
|
|
||||||
#define FromRadio_FIELDLIST(X, a) \
|
#define FromRadio_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, num, 1) \
|
X(a, STATIC, SINGULAR, UINT32, num, 1) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,packet,variant.packet), 2) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 2) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,my_info,variant.my_info), 3) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,my_info,my_info), 3) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,node_info,variant.node_info), 4) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,node_info,node_info), 4) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,radio,variant.radio), 6) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,radio,radio), 6) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,log_record,variant.log_record), 7) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,log_record,log_record), 7) \
|
||||||
X(a, STATIC, ONEOF, UINT32, (variant,config_complete_id,variant.config_complete_id), 8) \
|
X(a, STATIC, ONEOF, UINT32, (payloadVariant,config_complete_id,config_complete_id), 8) \
|
||||||
X(a, STATIC, ONEOF, BOOL, (variant,rebooted,variant.rebooted), 9) \
|
X(a, STATIC, ONEOF, BOOL, (payloadVariant,rebooted,rebooted), 9) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,channel,variant.channel), 10)
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,channel,channel), 10)
|
||||||
#define FromRadio_CALLBACK NULL
|
#define FromRadio_CALLBACK NULL
|
||||||
#define FromRadio_DEFAULT NULL
|
#define FromRadio_DEFAULT NULL
|
||||||
#define FromRadio_variant_packet_MSGTYPE MeshPacket
|
#define FromRadio_payloadVariant_packet_MSGTYPE MeshPacket
|
||||||
#define FromRadio_variant_my_info_MSGTYPE MyNodeInfo
|
#define FromRadio_payloadVariant_my_info_MSGTYPE MyNodeInfo
|
||||||
#define FromRadio_variant_node_info_MSGTYPE NodeInfo
|
#define FromRadio_payloadVariant_node_info_MSGTYPE NodeInfo
|
||||||
#define FromRadio_variant_radio_MSGTYPE RadioConfig
|
#define FromRadio_payloadVariant_radio_MSGTYPE RadioConfig
|
||||||
#define FromRadio_variant_log_record_MSGTYPE LogRecord
|
#define FromRadio_payloadVariant_log_record_MSGTYPE LogRecord
|
||||||
#define FromRadio_variant_channel_MSGTYPE ChannelSettings
|
#define FromRadio_payloadVariant_channel_MSGTYPE ChannelSettings
|
||||||
|
|
||||||
#define ToRadio_FIELDLIST(X, a) \
|
#define ToRadio_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,packet,variant.packet), 1) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 1) \
|
||||||
X(a, STATIC, ONEOF, UINT32, (variant,want_config_id,variant.want_config_id), 100) \
|
X(a, STATIC, ONEOF, UINT32, (payloadVariant,want_config_id,want_config_id), 100) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,set_radio,variant.set_radio), 101) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,set_radio,set_radio), 101) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,set_owner,variant.set_owner), 102) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,set_owner,set_owner), 102) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,set_channel,variant.set_channel), 103)
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,set_channel,set_channel), 103)
|
||||||
#define ToRadio_CALLBACK NULL
|
#define ToRadio_CALLBACK NULL
|
||||||
#define ToRadio_DEFAULT NULL
|
#define ToRadio_DEFAULT NULL
|
||||||
#define ToRadio_variant_packet_MSGTYPE MeshPacket
|
#define ToRadio_payloadVariant_packet_MSGTYPE MeshPacket
|
||||||
#define ToRadio_variant_set_radio_MSGTYPE RadioConfig
|
#define ToRadio_payloadVariant_set_radio_MSGTYPE RadioConfig
|
||||||
#define ToRadio_variant_set_owner_MSGTYPE User
|
#define ToRadio_payloadVariant_set_owner_MSGTYPE User
|
||||||
#define ToRadio_variant_set_channel_MSGTYPE ChannelSettings
|
#define ToRadio_payloadVariant_set_channel_MSGTYPE ChannelSettings
|
||||||
|
|
||||||
extern const pb_msgdesc_t Position_msg;
|
extern const pb_msgdesc_t Position_msg;
|
||||||
extern const pb_msgdesc_t Data_msg;
|
extern const pb_msgdesc_t Data_msg;
|
||||||
|
@ -721,13 +736,13 @@ extern const pb_msgdesc_t ToRadio_msg;
|
||||||
#define SubPacket_size 275
|
#define SubPacket_size 275
|
||||||
#define MeshPacket_size 320
|
#define MeshPacket_size 320
|
||||||
#define ChannelSettings_size 95
|
#define ChannelSettings_size 95
|
||||||
#define RadioConfig_size 382
|
#define RadioConfig_size 405
|
||||||
#define RadioConfig_UserPreferences_size 282
|
#define RadioConfig_UserPreferences_size 305
|
||||||
#define NodeInfo_size 132
|
#define NodeInfo_size 132
|
||||||
#define MyNodeInfo_size 106
|
#define MyNodeInfo_size 106
|
||||||
#define LogRecord_size 81
|
#define LogRecord_size 81
|
||||||
#define FromRadio_size 391
|
#define FromRadio_size 414
|
||||||
#define ToRadio_size 386
|
#define ToRadio_size 409
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
@ -20,6 +20,7 @@ typedef enum _PortNum {
|
||||||
PortNum_IP_TUNNEL_APP = 33,
|
PortNum_IP_TUNNEL_APP = 33,
|
||||||
PortNum_SERIAL_APP = 64,
|
PortNum_SERIAL_APP = 64,
|
||||||
PortNum_STORE_FORWARD_APP = 65,
|
PortNum_STORE_FORWARD_APP = 65,
|
||||||
|
PortNum_RANGE_TEST_APP = 66,
|
||||||
PortNum_PRIVATE_APP = 256,
|
PortNum_PRIVATE_APP = 256,
|
||||||
PortNum_ATAK_FORWARDER = 257
|
PortNum_ATAK_FORWARDER = 257
|
||||||
} PortNum;
|
} PortNum;
|
||||||
|
|
Ładowanie…
Reference in New Issue