diff --git a/bin/regen-protos.bat b/bin/regen-protos.bat index 8edebcf7c..aa2a2684f 100644 --- a/bin/regen-protos.bat +++ b/bin/regen-protos.bat @@ -1,5 +1,5 @@ cd protobufs && ..\nanopb-0.4.7\generator-bin\protoc.exe --nanopb_out=-v:..\src\mesh\generated -I=..\protobufs ..\protobufs\meshtastic\*.proto -cd ../src/mesh/generated/meshtastic -sed -i 's/#include "meshtastic/#include "./g' * -sed -i 's/meshtastic_//g' * +@REM cd ../src/mesh/generated/meshtastic +@REM sed -i 's/#include "meshtastic/#include "./g' * +@REM sed -i 's/meshtastic_//g' * diff --git a/bin/regen-protos.sh b/bin/regen-protos.sh index bba445b5a..5fa3ab049 100755 --- a/bin/regen-protos.sh +++ b/bin/regen-protos.sh @@ -10,10 +10,10 @@ echo "prebuilt binaries for your computer into nanopb-0.4.7" cd protobufs ../nanopb-0.4.7/generator-bin/protoc --nanopb_out=-v:../src/mesh/generated/ -I=../protobufs meshtastic/*.proto -cd ../src/mesh/generated/meshtastic -sed -i 's/#include "meshtastic/#include "./g' -- * +# cd ../src/mesh/generated/meshtastic +# sed -i 's/#include "meshtastic/#include "./g' -- * -sed -i 's/meshtastic_//g' -- * +# sed -i 's/meshtastic_//g' -- * #echo "Regenerating protobuf documentation - if you see an error message" #echo "you can ignore it unless doing a new protobuf release to github." diff --git a/platformio.ini b/platformio.ini index d5c5b13df..edcc8618c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -39,7 +39,7 @@ extra_scripts = bin/platformio-custom.py ; The Radiolib stuff will speed up building considerably. Exclud all the stuff we dont need. build_flags = -Wno-missing-field-initializers -Wno-format - -Isrc -Isrc/mesh -Isrc/gps -Isrc/buzz -Wl,-Map,.pio/build/output.map + -Isrc -Isrc/mesh -Isrc/mesh/generated -Isrc/gps -Isrc/buzz -Wl,-Map,.pio/build/output.map -DUSE_THREAD_NAMES -DTINYGPS_OPTION_NO_CUSTOM_FIELDS -DPB_ENABLE_MALLOC=1 diff --git a/src/GPSStatus.h b/src/GPSStatus.h index bf8903f80..bdfce36ff 100644 --- a/src/GPSStatus.h +++ b/src/GPSStatus.h @@ -22,13 +22,13 @@ class GPSStatus : public Status bool isPowerSaving = false; // Are we in power saving state - Position p = Position_init_default; + meshtastic_Position p = meshtastic_Position_init_default; public: GPSStatus() { statusType = STATUS_TYPE_GPS; } // preferred method - GPSStatus(bool hasLock, bool isConnected, bool isPowerSaving, const Position &pos) : Status() + GPSStatus(bool hasLock, bool isConnected, bool isPowerSaving, const meshtastic_Position &pos) : Status() { this->hasLock = hasLock; this->isConnected = isConnected; @@ -55,7 +55,7 @@ class GPSStatus : public Status #ifdef GPS_EXTRAVERBOSE LOG_WARN("Using fixed latitude\n"); #endif - NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); + meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); return node->position.latitude_i; } else { return p.latitude_i; @@ -68,7 +68,7 @@ class GPSStatus : public Status #ifdef GPS_EXTRAVERBOSE LOG_WARN("Using fixed longitude\n"); #endif - NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); + meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); return node->position.longitude_i; } else { return p.longitude_i; @@ -81,7 +81,7 @@ class GPSStatus : public Status #ifdef GPS_EXTRAVERBOSE LOG_WARN("Using fixed altitude\n"); #endif - NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); + meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); return node->position.altitude; } else { return p.altitude; diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index 632e18083..c36c65efc 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -16,7 +16,7 @@ static bool isPowered() return true; #endif - bool isRouter = (config.device.role == Config_DeviceConfig_Role_ROUTER ? 1 : 0); + bool isRouter = (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ? 1 : 0); // If we are not a router and we already have AC power go to POWER state after init, otherwise go to ON // We assume routers might be powered all the time, but from a low current (solar) source @@ -238,7 +238,7 @@ Fsm powerFSM(&stateBOOT); void PowerFSM_setup() { - bool isRouter = (config.device.role == Config_DeviceConfig_Role_ROUTER ? 1 : 0); + bool isRouter = (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER ? 1 : 0); bool hasPower = isPowered(); LOG_INFO("PowerFSM init, USB power=%d\n", hasPower ? 1 : 0); diff --git a/src/detect/i2cScan.h b/src/detect/i2cScan.h index 0189677bd..87ca55957 100644 --- a/src/detect/i2cScan.h +++ b/src/detect/i2cScan.h @@ -168,13 +168,13 @@ void scanI2Cdevice() registerValue = getRegisterValue(addr, 0xD0, 1); // GET_ID if (registerValue == 0x61) { LOG_INFO("BME-680 sensor found at address 0x%x\n", (uint8_t)addr); - nodeTelemetrySensorsMap[TelemetrySensorType_BME680] = addr; + nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_BME680] = addr; } else if (registerValue == 0x60) { LOG_INFO("BME-280 sensor found at address 0x%x\n", (uint8_t)addr); - nodeTelemetrySensorsMap[TelemetrySensorType_BME280] = addr; + nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_BME280] = addr; } else { LOG_INFO("BMP-280 sensor found at address 0x%x\n", (uint8_t)addr); - nodeTelemetrySensorsMap[TelemetrySensorType_BMP280] = addr; + nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_BMP280] = addr; } } if (addr == INA_ADDR || addr == INA_ADDR_ALTERNATE) { @@ -182,41 +182,41 @@ void scanI2Cdevice() LOG_DEBUG("Register MFG_UID: 0x%x\n", registerValue); if (registerValue == 0x5449) { LOG_INFO("INA260 sensor found at address 0x%x\n", (uint8_t)addr); - nodeTelemetrySensorsMap[TelemetrySensorType_INA260] = addr; + nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA260] = addr; } else { // Assume INA219 if INA260 ID is not found LOG_INFO("INA219 sensor found at address 0x%x\n", (uint8_t)addr); - nodeTelemetrySensorsMap[TelemetrySensorType_INA219] = addr; + nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219] = addr; } } if (addr == MCP9808_ADDR) { - nodeTelemetrySensorsMap[TelemetrySensorType_MCP9808] = addr; + nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_MCP9808] = addr; LOG_INFO("MCP9808 sensor found\n"); } if (addr == SHT31_ADDR) { LOG_INFO("SHT31 sensor found\n"); - nodeTelemetrySensorsMap[TelemetrySensorType_SHT31] = addr; + nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_SHT31] = addr; } if (addr == SHTC3_ADDR) { LOG_INFO("SHTC3 sensor found\n"); - nodeTelemetrySensorsMap[TelemetrySensorType_SHTC3] = addr; + nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_SHTC3] = addr; } if (addr == LPS22HB_ADDR || addr == LPS22HB_ADDR_ALT) { LOG_INFO("LPS22HB sensor found\n"); - nodeTelemetrySensorsMap[TelemetrySensorType_LPS22] = addr; + nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_LPS22] = addr; } // High rate sensors, will be processed internally if (addr == QMC6310_ADDR) { LOG_INFO("QMC6310 Highrate 3-Axis magnetic sensor found\n"); - nodeTelemetrySensorsMap[TelemetrySensorType_QMC6310] = addr; + nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_QMC6310] = addr; } if (addr == QMI8658_ADDR) { LOG_INFO("QMI8658 Highrate 6-Axis inertial measurement sensor found\n"); - nodeTelemetrySensorsMap[TelemetrySensorType_QMI8658] = addr; + nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_QMI8658] = addr; } if (addr == QMC5883L_ADDR) { LOG_INFO("QMC5883L Highrate 3-Axis magnetic sensor found\n"); - nodeTelemetrySensorsMap[TelemetrySensorType_QMC5883L] = addr; + nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_QMC5883L] = addr; } } else if (err == 4) { LOG_ERROR("Unknow error at address 0x%x\n", addr); diff --git a/src/error.h b/src/error.h index 087215b1d..fc0707cd6 100644 --- a/src/error.h +++ b/src/error.h @@ -8,5 +8,5 @@ #define RECORD_CRITICALERROR(code) recordCriticalError(code, __LINE__, __FILE__) /// Record an error that should be reported via analytics -void recordCriticalError(CriticalErrorCode code = CriticalErrorCode_UNSPECIFIED, uint32_t address = 0, +void recordCriticalError(meshtastic_CriticalErrorCode code = meshtastic_CriticalErrorCode_UNSPECIFIED, uint32_t address = 0, const char *filename = NULL); diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index c3a7bd6cf..898725923 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -486,7 +486,7 @@ int32_t GPS::runOnce() if (hasValidLocation) { LOG_DEBUG("hasValidLocation FALLING EDGE (last read: %d)\n", gotLoc); } - p = Position_init_default; + p = meshtastic_Position_init_default; hasValidLocation = false; } diff --git a/src/gps/GPS.h b/src/gps/GPS.h index a3703187c..ab4bc5b38 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -54,7 +54,7 @@ class GPS : private concurrency::OSThread /** If !NULL we will use this serial port to construct our GPS */ static HardwareSerial *_serial_gps; - Position p = Position_init_default; + meshtastic_Position p = meshtastic_Position_init_default; GPS() : concurrency::OSThread("GPS") {} diff --git a/src/gps/NMEAGPS.cpp b/src/gps/NMEAGPS.cpp index b7da07934..0632164e9 100644 --- a/src/gps/NMEAGPS.cpp +++ b/src/gps/NMEAGPS.cpp @@ -159,7 +159,7 @@ bool NMEAGPS::lookForLocation() return false; } - p.location_source = Position_LocSource_LOC_INTERNAL; + p.location_source = meshtastic_Position_LocSource_LOC_INTERNAL; // Dilution of precision (an accuracy metric) is reported in 10^2 units, so we need to scale down when we use it #ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS diff --git a/src/gps/NMEAWPL.cpp b/src/gps/NMEAWPL.cpp index 232218b34..6ab2c85bf 100644 --- a/src/gps/NMEAWPL.cpp +++ b/src/gps/NMEAWPL.cpp @@ -16,7 +16,7 @@ * ------------------------------------------- */ -uint32_t printWPL(char *buf, size_t bufsz, const Position &pos, const char *name) +uint32_t printWPL(char *buf, size_t bufsz, const meshtastic_Position &pos, const char *name) { GeoCoord geoCoord(pos.latitude_i, pos.longitude_i, pos.altitude); uint32_t len = snprintf(buf, bufsz, "$GNWPL,%02d%07.4f,%c,%03d%07.4f,%c,%s", geoCoord.getDMSLatDeg(), @@ -53,7 +53,7 @@ uint32_t printWPL(char *buf, size_t bufsz, const Position &pos, const char *name * ------------------------------------------- */ -uint32_t printGGA(char *buf, size_t bufsz, const Position &pos) +uint32_t printGGA(char *buf, size_t bufsz, const meshtastic_Position &pos) { GeoCoord geoCoord(pos.latitude_i, pos.longitude_i, pos.altitude); uint32_t len = diff --git a/src/gps/NMEAWPL.h b/src/gps/NMEAWPL.h index 9017c8797..a9f00cb14 100644 --- a/src/gps/NMEAWPL.h +++ b/src/gps/NMEAWPL.h @@ -3,5 +3,5 @@ #include "main.h" #include -uint32_t printWPL(char *buf, size_t bufsz, const Position &pos, const char *name); -uint32_t printGGA(char *buf, size_t bufsz, const Position &pos); +uint32_t printWPL(char *buf, size_t bufsz, const meshtastic_Position &pos, const char *name); +uint32_t printGGA(char *buf, size_t bufsz, const meshtastic_Position &pos); diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 8ab3076ee..94db8b6f5 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -352,7 +352,7 @@ static void drawCriticalFaultFrame(OLEDDisplay *display, OLEDDisplayUiState *sta } // Ignore messages orginating from phone (from the current node 0x0) unless range test or store and forward module are enabled -static bool shouldDrawMessage(const MeshPacket *packet) +static bool shouldDrawMessage(const meshtastic_MeshPacket *packet) { return packet->from != 0 && !moduleConfig.range_test.enabled && !moduleConfig.store_forward.enabled; } @@ -365,8 +365,8 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state // the max length of this buffer is much longer than we can possibly print static char tempBuf[237]; - MeshPacket &mp = devicestate.rx_text_message; - NodeInfo *node = nodeDB.getNode(getFrom(&mp)); + meshtastic_MeshPacket &mp = devicestate.rx_text_message; + meshtastic_NodeInfo *node = nodeDB.getNode(getFrom(&mp)); // LOG_DEBUG("drawing text message from 0x%x: %s\n", mp.from, // mp.decoded.variant.data.decoded.bytes); @@ -375,7 +375,7 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state // be wrapped. Currently only spaces and "-" are allowed for wrapping display->setTextAlignment(TEXT_ALIGN_LEFT); display->setFont(FONT_SMALL); - if (config.display.displaymode == Config_DisplayConfig_DisplayMode_INVERTED) { + if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) { display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL); display->setColor(BLACK); } @@ -556,7 +556,7 @@ static void drawGPSAltitude(OLEDDisplay *display, int16_t x, int16_t y, const GP } else { geoCoord.updateCoords(int32_t(gps->getLatitude()), int32_t(gps->getLongitude()), int32_t(gps->getAltitude())); displayLine = "Altitude: " + String(geoCoord.getAltitude()) + "m"; - if (config.display.units == Config_DisplayConfig_DisplayUnits_IMPERIAL) + if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) displayLine = "Altitude: " + String(geoCoord.getAltitude() * METERS_TO_FEET) + "ft"; display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); } @@ -578,21 +578,21 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const geoCoord.updateCoords(int32_t(gps->getLatitude()), int32_t(gps->getLongitude()), int32_t(gps->getAltitude())); - if (gpsFormat != Config_DisplayConfig_GpsCoordinateFormat_DMS) { + if (gpsFormat != meshtastic_Config_DisplayConfig_GpsCoordinateFormat_DMS) { char coordinateLine[22]; - if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_DEC) { // Decimal Degrees + if (gpsFormat == meshtastic_Config_DisplayConfig_GpsCoordinateFormat_DEC) { // Decimal Degrees snprintf(coordinateLine, sizeof(coordinateLine), "%f %f", geoCoord.getLatitude() * 1e-7, geoCoord.getLongitude() * 1e-7); - } else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_UTM) { // Universal Transverse Mercator + } else if (gpsFormat == meshtastic_Config_DisplayConfig_GpsCoordinateFormat_UTM) { // Universal Transverse Mercator snprintf(coordinateLine, sizeof(coordinateLine), "%2i%1c %06u %07u", geoCoord.getUTMZone(), geoCoord.getUTMBand(), geoCoord.getUTMEasting(), geoCoord.getUTMNorthing()); - } else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_MGRS) { // Military Grid Reference System + } else if (gpsFormat == meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MGRS) { // Military Grid Reference System snprintf(coordinateLine, sizeof(coordinateLine), "%2i%1c %1c%1c %05u %05u", geoCoord.getMGRSZone(), geoCoord.getMGRSBand(), geoCoord.getMGRSEast100k(), geoCoord.getMGRSNorth100k(), geoCoord.getMGRSEasting(), geoCoord.getMGRSNorthing()); - } else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_OLC) { // Open Location Code + } else if (gpsFormat == meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OLC) { // Open Location Code geoCoord.getOLCCode(coordinateLine); - } else if (gpsFormat == Config_DisplayConfig_GpsCoordinateFormat_OSGR) { // Ordnance Survey Grid Reference + } else if (gpsFormat == meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OSGR) { // Ordnance Survey Grid Reference if (geoCoord.getOSGRE100k() == 'I' || geoCoord.getOSGRN100k() == 'I') // OSGR is only valid around the UK region snprintf(coordinateLine, sizeof(coordinateLine), "%s", "Out of Boundary"); else @@ -699,7 +699,7 @@ static float estimatedHeading(double lat, double lon) /// Sometimes we will have Position objects that only have a time, so check for /// valid lat/lon -static bool hasPosition(NodeInfo *n) +static bool hasPosition(meshtastic_NodeInfo *n) { return n->has_position && (n->position.latitude_i != 0 || n->position.longitude_i != 0); } @@ -709,7 +709,7 @@ static uint16_t getCompassDiam(OLEDDisplay *display) uint16_t diam = 0; uint16_t offset = 0; - if (config.display.displaymode != Config_DisplayConfig_DisplayMode_DEFAULT) + if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT) offset = FONT_HEIGHT_SMALL; // get the smaller of the 2 dimensions and subtract 20 @@ -786,7 +786,7 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ prevFrame = state->currentFrame; nodeIndex = (nodeIndex + 1) % nodeDB.getNumNodes(); - NodeInfo *n = nodeDB.getNodeByIndex(nodeIndex); + meshtastic_NodeInfo *n = nodeDB.getNodeByIndex(nodeIndex); if (n->num == nodeDB.getNodeNum()) { // Don't show our node, just skip to next nodeIndex = (nodeIndex + 1) % nodeDB.getNumNodes(); @@ -795,14 +795,14 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ displayedNodeNum = n->num; } - NodeInfo *node = nodeDB.getNodeByIndex(nodeIndex); + meshtastic_NodeInfo *node = nodeDB.getNodeByIndex(nodeIndex); display->setFont(FONT_SMALL); // The coordinates define the left starting point of the text display->setTextAlignment(TEXT_ALIGN_LEFT); - if (config.display.displaymode == Config_DisplayConfig_DisplayMode_INVERTED) { + if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) { display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL); } @@ -832,12 +832,12 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ static char distStr[20]; strncpy(distStr, "? km", sizeof(distStr)); // might not have location data - NodeInfo *ourNode = nodeDB.getNode(nodeDB.getNodeNum()); + meshtastic_NodeInfo *ourNode = nodeDB.getNode(nodeDB.getNodeNum()); const char *fields[] = {username, distStr, signalStr, lastStr, NULL}; int16_t compassX = 0, compassY = 0; // coordinates for the center of the compass/circle - if (config.display.displaymode == Config_DisplayConfig_DisplayMode_DEFAULT) { + if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT) { compassX = x + SCREEN_WIDTH - getCompassDiam(display) / 2 - 5; compassY = y + SCREEN_HEIGHT / 2; } else { @@ -847,18 +847,18 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ bool hasNodeHeading = false; if (ourNode && hasPosition(ourNode)) { - Position &op = ourNode->position; + meshtastic_Position &op = ourNode->position; float myHeading = estimatedHeading(DegD(op.latitude_i), DegD(op.longitude_i)); drawCompassNorth(display, compassX, compassY, myHeading); if (hasPosition(node)) { // display direction toward node hasNodeHeading = true; - Position &p = node->position; + meshtastic_Position &p = node->position; float d = GeoCoord::latLongToMeter(DegD(p.latitude_i), DegD(p.longitude_i), DegD(op.latitude_i), DegD(op.longitude_i)); - if (config.display.units == Config_DisplayConfig_DisplayUnits_IMPERIAL) { + if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) { if (d < (2 * MILES_TO_FEET)) snprintf(distStr, sizeof(distStr), "%.0f ft", d * METERS_TO_FEET); else @@ -887,7 +887,7 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ } display->drawCircle(compassX, compassY, getCompassDiam(display) / 2); - if (config.display.displaymode == Config_DisplayConfig_DisplayMode_INVERTED) { + if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) { display->setColor(BLACK); } // Must be after distStr is populated @@ -910,7 +910,7 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_ // #else Screen::Screen(uint8_t address, int sda, int scl) : OSThread("Screen"), cmdQueue(32), - dispdev(address, sda, scl, screen_model == Config_DisplayConfig_OledType_OLED_SH1107 ? GEOMETRY_128_128 : GEOMETRY_128_64), + dispdev(address, sda, scl, screen_model == meshtastic_Config_DisplayConfig_OledType_OLED_SH1107 ? GEOMETRY_128_128 : GEOMETRY_128_64), ui(&dispdev) { address_found = address; @@ -961,8 +961,8 @@ void Screen::setup() useDisplay = true; #ifdef AutoOLEDWire_h - if (screen_model == Config_DisplayConfig_OledType_OLED_SH1107) - screen_model = Config_DisplayConfig_OledType_OLED_SH1106; + if (screen_model == meshtastic_Config_DisplayConfig_OledType_OLED_SH1107) + screen_model = meshtastic_Config_DisplayConfig_OledType_OLED_SH1106; dispdev.setDetected(screen_model); #endif @@ -1084,7 +1084,7 @@ int32_t Screen::runOnce() } #ifndef DISABLE_WELCOME_UNSET - if (showingNormalScreen && config.lora.region == Config_LoRaConfig_RegionCode_UNSET) { + if (showingNormalScreen && config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) { setWelcomeFrames(); } #endif @@ -1404,7 +1404,7 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 // The coordinates define the left starting point of the text display->setTextAlignment(TEXT_ALIGN_LEFT); - if (config.display.displaymode == Config_DisplayConfig_DisplayMode_INVERTED) { + if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) { display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL); display->setColor(BLACK); } @@ -1418,20 +1418,20 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 // Display power status if (powerStatus->getHasBattery()) { - if (config.display.displaymode == Config_DisplayConfig_DisplayMode_DEFAULT) { + if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT) { drawBattery(display, x, y + 2, imgBattery, powerStatus); } else { drawBattery(display, x + 1, y + 3, imgBattery, powerStatus); } } else if (powerStatus->knowsUSB()) { - if (config.display.displaymode == Config_DisplayConfig_DisplayMode_DEFAULT) { + if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT) { display->drawFastImage(x, y + 2, 16, 8, powerStatus->getHasUSB() ? imgUSB : imgPower); } else { display->drawFastImage(x + 1, y + 3, 16, 8, powerStatus->getHasUSB() ? imgUSB : imgPower); } } // Display nodes status - if (config.display.displaymode == Config_DisplayConfig_DisplayMode_DEFAULT) { + if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT) { drawNodes(display, x + (SCREEN_WIDTH * 0.25), y + 2, nodeStatus); } else { drawNodes(display, x + (SCREEN_WIDTH * 0.25), y + 3, nodeStatus); @@ -1444,7 +1444,7 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 #endif drawGPSpowerstat(display, x, yPos, gpsStatus); } else { - if (config.display.displaymode == Config_DisplayConfig_DisplayMode_DEFAULT) { + if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT) { drawGPS(display, x + (SCREEN_WIDTH * 0.63), y + 2, gpsStatus); } else { drawGPS(display, x + (SCREEN_WIDTH * 0.63), y + 3, gpsStatus); @@ -1517,7 +1517,7 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i // The coordinates define the left starting point of the text display->setTextAlignment(TEXT_ALIGN_LEFT); - if (config.display.displaymode == Config_DisplayConfig_DisplayMode_INVERTED) { + if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) { display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL); display->setColor(BLACK); } @@ -1649,7 +1649,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat // The coordinates define the left starting point of the text display->setTextAlignment(TEXT_ALIGN_LEFT); - if (config.display.displaymode == Config_DisplayConfig_DisplayMode_INVERTED) { + if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) { display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL); display->setColor(BLACK); } @@ -1676,25 +1676,25 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat auto mode = ""; switch (config.lora.modem_preset) { - case Config_LoRaConfig_ModemPreset_SHORT_SLOW: + case meshtastic_Config_LoRaConfig_ModemPreset_SHORT_SLOW: mode = "ShortS"; break; - case Config_LoRaConfig_ModemPreset_SHORT_FAST: + case meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST: mode = "ShortF"; break; - case Config_LoRaConfig_ModemPreset_MEDIUM_SLOW: + case meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_SLOW: mode = "MedS"; break; - case Config_LoRaConfig_ModemPreset_MEDIUM_FAST: + case meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_FAST: mode = "MedF"; break; - case Config_LoRaConfig_ModemPreset_LONG_SLOW: + case meshtastic_Config_LoRaConfig_ModemPreset_LONG_SLOW: mode = "LongS"; break; - case Config_LoRaConfig_ModemPreset_LONG_FAST: + case meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST: mode = "LongF"; break; - case Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW: + case meshtastic_Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW: mode = "VeryL"; break; default: @@ -1756,7 +1756,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat display->drawString(x + SCREEN_WIDTH - display->getStringWidth(chUtil), y + FONT_HEIGHT_SMALL * 1, chUtil); if (config.position.gps_enabled) { // Line 3 - if (config.display.gps_format != Config_DisplayConfig_GpsCoordinateFormat_DMS) // if DMS then don't draw altitude + if (config.display.gps_format != meshtastic_Config_DisplayConfig_GpsCoordinateFormat_DMS) // if DMS then don't draw altitude drawGPSAltitude(display, x, y + FONT_HEIGHT_SMALL * 2, gpsStatus); // Line 4 @@ -1804,7 +1804,7 @@ int Screen::handleStatusUpdate(const meshtastic::Status *arg) return 0; } -int Screen::handleTextMessage(const MeshPacket *packet) +int Screen::handleTextMessage(const meshtastic_MeshPacket *packet) { if (showingNormalScreen) { setFrames(); // Regen the list of screens (will show new text message) diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index 1a11df70e..db851e8bb 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -110,8 +110,8 @@ class Screen : public concurrency::OSThread CallbackObserver(this, &Screen::handleStatusUpdate); CallbackObserver nodeStatusObserver = CallbackObserver(this, &Screen::handleStatusUpdate); - CallbackObserver textMessageObserver = - CallbackObserver(this, &Screen::handleTextMessage); + CallbackObserver textMessageObserver = + CallbackObserver(this, &Screen::handleTextMessage); CallbackObserver uiFrameEventObserver = CallbackObserver(this, &Screen::handleUIFrameEvent); @@ -273,7 +273,7 @@ class Screen : public concurrency::OSThread DebugInfo *debug_info() { return &debugInfo; } int handleStatusUpdate(const meshtastic::Status *arg); - int handleTextMessage(const MeshPacket *arg); + int handleTextMessage(const meshtastic_MeshPacket *arg); int handleUIFrameEvent(const UIFrameEvent *arg); /// Used to force (super slow) eink displays to draw critical frames diff --git a/src/input/RotaryEncoderInterruptBase.cpp b/src/input/RotaryEncoderInterruptBase.cpp index ad55bd1a4..19b507f6c 100644 --- a/src/input/RotaryEncoderInterruptBase.cpp +++ b/src/input/RotaryEncoderInterruptBase.cpp @@ -34,7 +34,7 @@ void RotaryEncoderInterruptBase::init( int32_t RotaryEncoderInterruptBase::runOnce() { InputEvent e; - e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_NONE; + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; e.source = this->_originName; if (this->action == ROTARY_ACTION_PRESSED) { @@ -48,7 +48,7 @@ int32_t RotaryEncoderInterruptBase::runOnce() e.inputEvent = this->_eventCcw; } - if (e.inputEvent != ModuleConfig_CannedMessageConfig_InputEventChar_NONE) { + if (e.inputEvent != meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE) { this->notifyObservers(&e); } diff --git a/src/input/RotaryEncoderInterruptBase.h b/src/input/RotaryEncoderInterruptBase.h index 88d619178..06f7a2354 100644 --- a/src/input/RotaryEncoderInterruptBase.h +++ b/src/input/RotaryEncoderInterruptBase.h @@ -33,8 +33,8 @@ class RotaryEncoderInterruptBase : public Observable, public private: uint8_t _pinA = 0; uint8_t _pinB = 0; - char _eventCw = ModuleConfig_CannedMessageConfig_InputEventChar_NONE; - char _eventCcw = ModuleConfig_CannedMessageConfig_InputEventChar_NONE; - char _eventPressed = ModuleConfig_CannedMessageConfig_InputEventChar_NONE; + char _eventCw = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; + char _eventCcw = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; + char _eventPressed = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; const char *_originName; }; diff --git a/src/input/UpDownInterruptBase.h b/src/input/UpDownInterruptBase.h index 1ee4e4a03..ed7eee332 100644 --- a/src/input/UpDownInterruptBase.h +++ b/src/input/UpDownInterruptBase.h @@ -16,8 +16,8 @@ class UpDownInterruptBase : public Observable private: uint8_t _pinDown = 0; uint8_t _pinUp = 0; - char _eventDown = ModuleConfig_CannedMessageConfig_InputEventChar_NONE; - char _eventUp = ModuleConfig_CannedMessageConfig_InputEventChar_NONE; - char _eventPressed = ModuleConfig_CannedMessageConfig_InputEventChar_NONE; + char _eventDown = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; + char _eventUp = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; + char _eventPressed = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; const char *_originName; }; diff --git a/src/input/UpDownInterruptImpl1.cpp b/src/input/UpDownInterruptImpl1.cpp index c49409660..c22152f82 100644 --- a/src/input/UpDownInterruptImpl1.cpp +++ b/src/input/UpDownInterruptImpl1.cpp @@ -17,9 +17,9 @@ void UpDownInterruptImpl1::init() uint8_t pinDown = moduleConfig.canned_message.inputbroker_pin_b; uint8_t pinPress = moduleConfig.canned_message.inputbroker_pin_press; - char eventDown = static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_DOWN); - char eventUp = static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_UP); - char eventPressed = static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_SELECT); + char eventDown = static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN); + char eventUp = static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP); + char eventPressed = static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT); UpDownInterruptBase::init(pinDown, pinUp, pinPress, eventDown, eventUp, eventPressed, UpDownInterruptImpl1::handleIntDown, UpDownInterruptImpl1::handleIntUp, UpDownInterruptImpl1::handleIntPressed); diff --git a/src/input/kbI2cBase.cpp b/src/input/kbI2cBase.cpp index ca0ce2361..9212b6d4c 100644 --- a/src/input/kbI2cBase.cpp +++ b/src/input/kbI2cBase.cpp @@ -70,35 +70,35 @@ int32_t KbI2cBase::runOnce() while (Wire.available()) { char c = Wire.read(); InputEvent e; - e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_NONE; + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; e.source = this->_originName; switch (c) { case 0x1b: // ESC - e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL; + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL; break; case 0x08: // Back - e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_BACK; + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK; e.kbchar = c; break; case 0xb5: // Up - e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_UP; + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP; break; case 0xb6: // Down - e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_DOWN; + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN; break; case 0xb4: // Left - e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_LEFT; + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT; e.kbchar = c; break; case 0xb7: // Right - e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT; + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT; e.kbchar = c; break; case 0x0d: // Enter - e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_SELECT; + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT; break; case 0x00: // nopress - e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_NONE; + e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE; break; default: // all other keys e.inputEvent = ANYKEY; @@ -106,7 +106,7 @@ int32_t KbI2cBase::runOnce() break; } - if (e.inputEvent != ModuleConfig_CannedMessageConfig_InputEventChar_NONE) { + if (e.inputEvent != meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE) { this->notifyObservers(&e); } } diff --git a/src/main.cpp b/src/main.cpp index f554c3785..26658e6a7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -98,7 +98,7 @@ uint32_t serialSinceMsec; bool pmu_found; // Array map of sensor types (as array index) and i2c address as value we'll find in the i2c scan -uint8_t nodeTelemetrySensorsMap[_TelemetrySensorType_MAX + 1] = { +uint8_t nodeTelemetrySensorsMap[_meshtastic_TelemetrySensorType_MAX + 1] = { 0}; // one is enough, missing elements will be initialized to 0 anyway. Router *router = NULL; // Users of router don't care what sort of subclass implements that API @@ -302,7 +302,7 @@ void setup() playStartMelody(); // fixed screen override? - if (config.display.oled != Config_DisplayConfig_OledType_OLED_AUTO) + if (config.display.oled != meshtastic_Config_DisplayConfig_OledType_OLED_AUTO) screen_model = config.display.oled; #if defined(USE_SH1107) @@ -341,7 +341,7 @@ void setup() // Do this after service.init (because that clears error_code) #ifdef HAS_PMU if (!pmu_found) - RECORD_CRITICALERROR(CriticalErrorCode_NO_AXP192); // Record a hardware fault for missing hardware + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_NO_AXP192); // Record a hardware fault for missing hardware #endif // Don't call screen setup until after nodedb is setup (because we need @@ -454,9 +454,9 @@ void setup() // check if the radio chip matches the selected region - if ((config.lora.region == Config_LoRaConfig_RegionCode_LORA_24) && (!rIf->wideLora())) { + if ((config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_LORA_24) && (!rIf->wideLora())) { LOG_WARN("Radio chip does not support 2.4GHz LoRa. Reverting to unset.\n"); - config.lora.region = Config_LoRaConfig_RegionCode_UNSET; + config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_UNSET; nodeDB.saveToDisk(SEGMENT_CONFIG); if (!rIf->reconfigure()) { LOG_WARN("Reconfigure failed, rebooting\n"); @@ -490,13 +490,13 @@ void setup() airTime = new AirTime(); if (!rIf) - RECORD_CRITICALERROR(CriticalErrorCode_NO_RADIO); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_NO_RADIO); else { router->addInterface(rIf); // Calculate and save the bit rate to myNodeInfo // TODO: This needs to be added what ever method changes the channel from the phone. - myNodeInfo.bitrate = (float(Constants_DATA_PAYLOAD_LEN) / (float(rIf->getPacketTime(Constants_DATA_PAYLOAD_LEN)))) * 1000; + myNodeInfo.bitrate = (float(meshtastic_Constants_DATA_PAYLOAD_LEN) / (float(rIf->getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN)))) * 1000; LOG_DEBUG("myNodeInfo.bitrate = %f bytes / sec\n", myNodeInfo.bitrate); } diff --git a/src/main.h b/src/main.h index 27aa06d6c..9d965b0fc 100644 --- a/src/main.h +++ b/src/main.h @@ -26,7 +26,7 @@ extern bool isUSBPowered; extern ATECCX08A atecc; #endif -extern uint8_t nodeTelemetrySensorsMap[_TelemetrySensorType_MAX + 1]; +extern uint8_t nodeTelemetrySensorsMap[_meshtastic_TelemetrySensorType_MAX + 1]; extern int TCPPort; // set by Portduino diff --git a/src/mesh/Channels.cpp b/src/mesh/Channels.cpp index fc7d62bbb..1b090a28f 100644 --- a/src/mesh/Channels.cpp +++ b/src/mesh/Channels.cpp @@ -45,23 +45,23 @@ int16_t Channels::generateHash(ChannelIndex channelNum) /** * Validate a channel, fixing any errors as needed */ -Channel &Channels::fixupChannel(ChannelIndex chIndex) +meshtastic_Channel &Channels::fixupChannel(ChannelIndex chIndex) { - Channel &ch = getByIndex(chIndex); + meshtastic_Channel &ch = getByIndex(chIndex); ch.index = chIndex; // Preinit the index so it be ready to share with the phone (we'll never change it later) if (!ch.has_settings) { // No settings! Must disable and skip - ch.role = Channel_Role_DISABLED; + ch.role = meshtastic_Channel_Role_DISABLED; memset(&ch.settings, 0, sizeof(ch.settings)); ch.has_settings = true; } else { - ChannelSettings &channelSettings = ch.settings; + meshtastic_ChannelSettings &meshtastic_channelSettings = ch.settings; // Convert the old string "Default" to our new short representation - if (strcmp(channelSettings.name, "Default") == 0) - *channelSettings.name = '\0'; + if (strcmp(meshtastic_channelSettings.name, "Default") == 0) + *meshtastic_channelSettings.name = '\0'; } hashes[chIndex] = generateHash(chIndex); @@ -74,11 +74,11 @@ Channel &Channels::fixupChannel(ChannelIndex chIndex) */ void Channels::initDefaultChannel(ChannelIndex chIndex) { - Channel &ch = getByIndex(chIndex); - ChannelSettings &channelSettings = ch.settings; - Config_LoRaConfig &loraConfig = config.lora; + meshtastic_Channel &ch = getByIndex(chIndex); + meshtastic_ChannelSettings &channelSettings = ch.settings; + meshtastic_Config_LoRaConfig &loraConfig = config.lora; - loraConfig.modem_preset = Config_LoRaConfig_ModemPreset_LONG_FAST; // Default to Long Range & Fast + loraConfig.modem_preset = meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST; // Default to Long Range & Fast loraConfig.use_preset = true; loraConfig.tx_power = 0; // default uint8_t defaultpskIndex = 1; @@ -87,25 +87,25 @@ void Channels::initDefaultChannel(ChannelIndex chIndex) strncpy(channelSettings.name, "", sizeof(channelSettings.name)); ch.has_settings = true; - ch.role = Channel_Role_PRIMARY; + ch.role = meshtastic_Channel_Role_PRIMARY; } CryptoKey Channels::getKey(ChannelIndex chIndex) { - Channel &ch = getByIndex(chIndex); - const ChannelSettings &channelSettings = ch.settings; + meshtastic_Channel &ch = getByIndex(chIndex); + const meshtastic_ChannelSettings &channelSettings = ch.settings; assert(ch.has_settings); CryptoKey k; memset(k.bytes, 0, sizeof(k.bytes)); // In case the user provided a short key, we want to pad the rest with zeros - if (ch.role == Channel_Role_DISABLED) { + if (ch.role == meshtastic_Channel_Role_DISABLED) { k.length = -1; // invalid } else { memcpy(k.bytes, channelSettings.psk.bytes, channelSettings.psk.size); k.length = channelSettings.psk.size; if (k.length == 0) { - if (ch.role == Channel_Role_SECONDARY) { + if (ch.role == meshtastic_Channel_Role_SECONDARY) { LOG_DEBUG("Unset PSK for secondary channel %s. using primary key\n", ch.settings.name); k = getKey(primaryIndex); } else @@ -182,24 +182,24 @@ void Channels::onConfigChanged() { // Make sure the phone hasn't mucked anything up for (int i = 0; i < channelFile.channels_count; i++) { - Channel &ch = fixupChannel(i); + meshtastic_Channel &ch = fixupChannel(i); - if (ch.role == Channel_Role_PRIMARY) + if (ch.role == meshtastic_Channel_Role_PRIMARY) primaryIndex = i; } } -Channel &Channels::getByIndex(ChannelIndex chIndex) +meshtastic_Channel &Channels::getByIndex(ChannelIndex chIndex) { // remove this assert cause malformed packets can make our firmware reboot here. if (chIndex < channelFile.channels_count) { // This should be equal to MAX_NUM_CHANNELS - Channel *ch = channelFile.channels + chIndex; + meshtastic_Channel *ch = channelFile.channels + chIndex; return *ch; } else { LOG_ERROR("Invalid channel index %d > %d, malformed packet received?\n", chIndex, channelFile.channels_count); - static Channel *ch = (Channel *)malloc(sizeof(Channel)); - memset(ch, 0, sizeof(Channel)); + static meshtastic_Channel *ch = (meshtastic_Channel *)malloc(sizeof(meshtastic_Channel)); + memset(ch, 0, sizeof(meshtastic_Channel)); // ch.index -1 means we don't know the channel locally and need to look it up by settings.name // not sure this is handled right everywhere ch->index = -1; @@ -207,7 +207,7 @@ Channel &Channels::getByIndex(ChannelIndex chIndex) } } -Channel &Channels::getByName(const char *chName) +meshtastic_Channel &Channels::getByName(const char *chName) { for (ChannelIndex i = 0; i < getNumChannels(); i++) { if (strcasecmp(getGlobalId(i), chName) == 0) { @@ -218,15 +218,15 @@ Channel &Channels::getByName(const char *chName) return getByIndex(getPrimaryIndex()); } -void Channels::setChannel(const Channel &c) +void Channels::setChannel(const meshtastic_Channel &c) { - Channel &old = getByIndex(c.index); + meshtastic_Channel &old = getByIndex(c.index); // if this is the new primary, demote any existing roles - if (c.role == Channel_Role_PRIMARY) + if (c.role == meshtastic_Channel_Role_PRIMARY) for (int i = 0; i < getNumChannels(); i++) - if (channelFile.channels[i].role == Channel_Role_PRIMARY) - channelFile.channels[i].role = Channel_Role_SECONDARY; + if (channelFile.channels[i].role == meshtastic_Channel_Role_PRIMARY) + channelFile.channels[i].role = meshtastic_Channel_Role_SECONDARY; old = c; // slam in the new settings/role } @@ -234,7 +234,7 @@ void Channels::setChannel(const Channel &c) const char *Channels::getName(size_t chIndex) { // Convert the short "" representation for Default into a usable string - const ChannelSettings &channelSettings = getByIndex(chIndex).settings; + const meshtastic_ChannelSettings &channelSettings = getByIndex(chIndex).settings; const char *channelName = channelSettings.name; if (!*channelName) { // emptystring // Per mesh.proto spec, if bandwidth is specified we must ignore modemPreset enum, we assume that in that case @@ -242,25 +242,25 @@ const char *Channels::getName(size_t chIndex) if (config.lora.use_preset) { switch (config.lora.modem_preset) { - case Config_LoRaConfig_ModemPreset_SHORT_SLOW: + case meshtastic_Config_LoRaConfig_ModemPreset_SHORT_SLOW: channelName = "ShortSlow"; break; - case Config_LoRaConfig_ModemPreset_SHORT_FAST: + case meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST: channelName = "ShortFast"; break; - case Config_LoRaConfig_ModemPreset_MEDIUM_SLOW: + case meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_SLOW: channelName = "MediumSlow"; break; - case Config_LoRaConfig_ModemPreset_MEDIUM_FAST: + case meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_FAST: channelName = "MediumFast"; break; - case Config_LoRaConfig_ModemPreset_LONG_SLOW: + case meshtastic_Config_LoRaConfig_ModemPreset_LONG_SLOW: channelName = "LongSlow"; break; - case Config_LoRaConfig_ModemPreset_LONG_FAST: + case meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST: channelName = "LongFast"; break; - case Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW: + case meshtastic_Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW: channelName = "VLongSlow"; break; default: diff --git a/src/mesh/Channels.h b/src/mesh/Channels.h index ebf836cb7..f3d696f90 100644 --- a/src/mesh/Channels.h +++ b/src/mesh/Channels.h @@ -34,18 +34,18 @@ class Channels /// Well known channel names static const char *adminChannel, *gpioChannel, *serialChannel; - const ChannelSettings &getPrimary() { return getByIndex(getPrimaryIndex()).settings; } + const meshtastic_ChannelSettings &getPrimary() { return getByIndex(getPrimaryIndex()).settings; } /** Return the Channel for a specified index */ - Channel &getByIndex(ChannelIndex chIndex); + meshtastic_Channel &getByIndex(ChannelIndex chIndex); /** Return the Channel for a specified name, return primary if not found. */ - Channel &getByName(const char *chName); + meshtastic_Channel &getByName(const char *chName); /** Using the index inside the channel, update the specified channel's settings and role. If this channel is being promoted * to be primary, force all other channels to be secondary. */ - void setChannel(const Channel &c); + void setChannel(const meshtastic_Channel &c); /** Return a human friendly name for this channel (and expand any short strings as needed) */ @@ -124,7 +124,7 @@ class Channels /** * Validate a channel, fixing any errors as needed */ - Channel &fixupChannel(ChannelIndex chIndex); + meshtastic_Channel &fixupChannel(ChannelIndex chIndex); /** * Write a default channel to the specified channel index diff --git a/src/mesh/FloodingRouter.cpp b/src/mesh/FloodingRouter.cpp index dfbc20202..40404306a 100644 --- a/src/mesh/FloodingRouter.cpp +++ b/src/mesh/FloodingRouter.cpp @@ -9,7 +9,7 @@ FloodingRouter::FloodingRouter() {} * later free() the packet to pool. This routine is not allowed to stall. * If the txmit queue is full it might return an error */ -ErrorCode FloodingRouter::send(MeshPacket *p) +ErrorCode FloodingRouter::send(meshtastic_MeshPacket *p) { // Add any messages _we_ send to the seen message list (so we will ignore all retransmissions we see) wasSeenRecently(p); // FIXME, move this to a sniffSent method @@ -17,7 +17,7 @@ ErrorCode FloodingRouter::send(MeshPacket *p) return Router::send(p); } -bool FloodingRouter::shouldFilterReceived(const MeshPacket *p) +bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p) { if (wasSeenRecently(p)) { // Note: this will also add a recent packet record printPacket("Ignoring incoming msg, because we've already seen it", p); @@ -27,9 +27,9 @@ bool FloodingRouter::shouldFilterReceived(const MeshPacket *p) return Router::shouldFilterReceived(p); } -void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c) +void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c) { - bool isAck = ((c && c->error_reason == Routing_Error_NONE)); // consider only ROUTING_APP message without error as ACK + bool isAck = ((c && c->error_reason == meshtastic_Routing_Error_NONE)); // consider only ROUTING_APP message without error as ACK if (isAck && p->to != getNodeNum()) { // do not flood direct message that is ACKed LOG_DEBUG("Receiving an ACK not for me, but don't need to rebroadcast this direct message anymore.\n"); @@ -37,13 +37,13 @@ void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c) } if ((p->to != getNodeNum()) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum())) { if (p->id != 0) { - if (config.device.role != Config_DeviceConfig_Role_CLIENT_MUTE) { - MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it + if (config.device.role != meshtastic_Config_DeviceConfig_Role_CLIENT_MUTE) { + meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it tosend->hop_limit--; // bump down the hop count // If it is a traceRoute request, update the route that it went via me - if (p->which_payload_variant == MeshPacket_decoded_tag && traceRouteModule->wantPacket(p)) { + if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag && traceRouteModule->wantPacket(p)) { traceRouteModule->updateRoute(tosend); } diff --git a/src/mesh/FloodingRouter.h b/src/mesh/FloodingRouter.h index 01b51c9a2..73dbd1f3f 100644 --- a/src/mesh/FloodingRouter.h +++ b/src/mesh/FloodingRouter.h @@ -42,7 +42,7 @@ class FloodingRouter : public Router, protected PacketHistory * later free() the packet to pool. This routine is not allowed to stall. * If the txmit queue is full it might return an error */ - virtual ErrorCode send(MeshPacket *p) override; + virtual ErrorCode send(meshtastic_MeshPacket *p) override; protected: /** @@ -51,10 +51,10 @@ class FloodingRouter : public Router, protected PacketHistory * Called immedately on receiption, before any further processing. * @return true to abandon the packet */ - virtual bool shouldFilterReceived(const MeshPacket *p) override; + virtual bool shouldFilterReceived(const meshtastic_MeshPacket *p) override; /** * Look for broadcasts we need to rebroadcast */ - virtual void sniffReceived(const MeshPacket *p, const Routing *c) override; + virtual void sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c) override; }; diff --git a/src/mesh/MeshModule.cpp b/src/mesh/MeshModule.cpp index 79b206547..c370d3677 100644 --- a/src/mesh/MeshModule.cpp +++ b/src/mesh/MeshModule.cpp @@ -8,13 +8,13 @@ std::vector *MeshModule::modules; -const MeshPacket *MeshModule::currentRequest; +const meshtastic_MeshPacket *MeshModule::currentRequest; /** * If any of the current chain of modules has already sent a reply, it will be here. This is useful to allow * the RoutingPlugin to avoid sending redundant acks */ -MeshPacket *MeshModule::currentReply; +meshtastic_MeshPacket *MeshModule::currentReply; MeshModule::MeshModule(const char *_name) : name(_name) { @@ -32,21 +32,21 @@ MeshModule::~MeshModule() assert(0); // FIXME - remove from list of modules once someone needs this feature } -MeshPacket *MeshModule::allocAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex) +meshtastic_MeshPacket *MeshModule::allocAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex) { - Routing c = Routing_init_default; + meshtastic_Routing c = meshtastic_Routing_init_default; c.error_reason = err; - c.which_variant = Routing_error_reason_tag; + c.which_variant = meshtastic_Routing_error_reason_tag; // Now that we have moded sendAckNak up one level into the class heirarchy we can no longer assume we are a RoutingPlugin // So we manually call pb_encode_to_bytes and specify routing port number // auto p = allocDataProtobuf(c); - MeshPacket *p = router->allocForSending(); - p->decoded.portnum = PortNum_ROUTING_APP; - p->decoded.payload.size = pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &Routing_msg, &c); + meshtastic_MeshPacket *p = router->allocForSending(); + p->decoded.portnum = meshtastic_PortNum_ROUTING_APP; + p->decoded.payload.size = pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_Routing_msg, &c); - p->priority = MeshPacket_Priority_ACK; + p->priority = meshtastic_MeshPacket_Priority_ACK; p->hop_limit = config.lora.hop_limit; // Flood ACK back to original sender p->to = to; @@ -57,7 +57,7 @@ MeshPacket *MeshModule::allocAckNak(Routing_Error err, NodeNum to, PacketId idFr return p; } -MeshPacket *MeshModule::allocErrorResponse(Routing_Error err, const MeshPacket *p) +meshtastic_MeshPacket *MeshModule::allocErrorResponse(meshtastic_Routing_Error err, const meshtastic_MeshPacket *p) { auto r = allocAckNak(err, getFrom(p), p->id, p->channel); @@ -66,13 +66,13 @@ MeshPacket *MeshModule::allocErrorResponse(Routing_Error err, const MeshPacket * return r; } -void MeshModule::callPlugins(const MeshPacket &mp, RxSource src) +void MeshModule::callPlugins(const meshtastic_MeshPacket &mp, RxSource src) { // LOG_DEBUG("In call modules\n"); bool moduleFound = false; // We now allow **encrypted** packets to pass through the modules - bool isDecoded = mp.which_payload_variant == MeshPacket_decoded_tag; + bool isDecoded = mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag; currentReply = NULL; // No reply yet @@ -101,7 +101,7 @@ void MeshModule::callPlugins(const MeshPacket &mp, RxSource src) moduleFound = true; /// received channel (or NULL if not decoded) - Channel *ch = isDecoded ? &channels.getByIndex(mp.channel) : NULL; + meshtastic_Channel *ch = isDecoded ? &channels.getByIndex(mp.channel) : NULL; /// Is the channel this packet arrived on acceptable? (security check) /// Note: we can't know channel names for encrypted packets, so those are NEVER sent to boundChannel modules @@ -117,7 +117,7 @@ void MeshModule::callPlugins(const MeshPacket &mp, RxSource src) if (mp.decoded.want_response) { printPacket("packet on wrong channel, returning error", &mp); - currentReply = pi.allocErrorResponse(Routing_Error_NOT_AUTHORIZED, &mp); + currentReply = pi.allocErrorResponse(meshtastic_Routing_Error_NOT_AUTHORIZED, &mp); } else printPacket("packet on wrong channel, but can't respond", &mp); } else { @@ -170,7 +170,7 @@ void MeshModule::callPlugins(const MeshPacket &mp, RxSource src) // SECURITY NOTE! I considered sending back a different error code if we didn't find the psk (i.e. !isDecoded) // but opted NOT TO. Because it is not a good idea to let remote nodes 'probe' to find out which PSKs were "good" vs // bad. - routingModule->sendAckNak(Routing_Error_NO_RESPONSE, getFrom(&mp), mp.id, mp.channel); + routingModule->sendAckNak(meshtastic_Routing_Error_NO_RESPONSE, getFrom(&mp), mp.id, mp.channel); } } @@ -179,7 +179,7 @@ void MeshModule::callPlugins(const MeshPacket &mp, RxSource src) (src == RX_SRC_LOCAL) ? "LOCAL" : "REMOTE"); } -MeshPacket *MeshModule::allocReply() +meshtastic_MeshPacket *MeshModule::allocReply() { auto r = myReply; myReply = NULL; // Only use each reply once @@ -190,7 +190,7 @@ MeshPacket *MeshModule::allocReply() * so that subclasses can (optionally) send a response back to the original sender. Implementing this method * is optional */ -void MeshModule::sendResponse(const MeshPacket &req) +void MeshModule::sendResponse(const meshtastic_MeshPacket &req) { auto r = allocReply(); if (r) { @@ -205,16 +205,16 @@ void MeshModule::sendResponse(const MeshPacket &req) /** set the destination and packet parameters of packet p intended as a reply to a particular "to" packet * This ensures that if the request packet was sent reliably, the reply is sent that way as well. */ -void setReplyTo(MeshPacket *p, const MeshPacket &to) +void setReplyTo(meshtastic_MeshPacket *p, const meshtastic_MeshPacket &to) { - assert(p->which_payload_variant == MeshPacket_decoded_tag); // Should already be set by now + assert(p->which_payload_variant == meshtastic_MeshPacket_decoded_tag); // Should already be set by now p->to = getFrom(&to); // Make sure that if we are sending to the local node, we use our local node addr, not 0 p->channel = to.channel; // Use the same channel that the request came in on // No need for an ack if we are just delivering locally (it just generates an ignored ack) p->want_ack = (to.from != 0) ? to.want_ack : false; - if (p->priority == MeshPacket_Priority_UNSET) - p->priority = MeshPacket_Priority_RELIABLE; + if (p->priority == meshtastic_MeshPacket_Priority_UNSET) + p->priority = meshtastic_MeshPacket_Priority_RELIABLE; p->decoded.request_id = to.id; } @@ -248,8 +248,8 @@ void MeshModule::observeUIEvents(Observer *observer) } } -AdminMessageHandleResult MeshModule::handleAdminMessageForAllPlugins(const MeshPacket &mp, AdminMessage *request, - AdminMessage *response) +AdminMessageHandleResult MeshModule::handleAdminMessageForAllPlugins(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *request, + meshtastic_AdminMessage *response) { AdminMessageHandleResult handled = AdminMessageHandleResult::NOT_HANDLED; if (modules) { diff --git a/src/mesh/MeshModule.h b/src/mesh/MeshModule.h index fcde7a305..8f7108613 100644 --- a/src/mesh/MeshModule.h +++ b/src/mesh/MeshModule.h @@ -64,12 +64,12 @@ class MeshModule /** For use only by MeshService */ - static void callPlugins(const MeshPacket &mp, RxSource src = RX_SRC_RADIO); + static void callPlugins(const meshtastic_MeshPacket &mp, RxSource src = RX_SRC_RADIO); static std::vector GetMeshModulesWithUIFrames(); static void observeUIEvents(Observer *observer); - static AdminMessageHandleResult handleAdminMessageForAllPlugins(const MeshPacket &mp, AdminMessage *request, - AdminMessage *response); + static AdminMessageHandleResult handleAdminMessageForAllPlugins(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *request, + meshtastic_AdminMessage *response); #if HAS_SCREEN virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { @@ -108,12 +108,12 @@ class MeshModule * Note: this can be static because we are guaranteed to be processing only one * plumodulegin at a time. */ - static const MeshPacket *currentRequest; + static const meshtastic_MeshPacket *currentRequest; /** * If your handler wants to send a response, simply set currentReply and it will be sent at the end of response handling. */ - MeshPacket *myReply = NULL; + meshtastic_MeshPacket *myReply = NULL; /** * Initialize your module. This setup function is called once after all hardware and mesh protocol layers have @@ -124,14 +124,14 @@ class MeshModule /** * @return true if you want to receive the specified portnum */ - virtual bool wantPacket(const MeshPacket *p) = 0; + virtual bool wantPacket(const meshtastic_MeshPacket *p) = 0; /** Called to handle a particular incoming message @return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it */ - virtual ProcessMessage handleReceived(const MeshPacket &mp) + virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) { return ProcessMessage::CONTINUE; } @@ -142,7 +142,7 @@ class MeshModule * Note: most implementers don't need to override this, instead: If while handling a request you have a reply, just set * the protected reply field in this instance. * */ - virtual MeshPacket *allocReply(); + virtual meshtastic_MeshPacket *allocReply(); /*** * @return true if you want to be alloced a UI screen frame @@ -156,10 +156,10 @@ class MeshModule return NULL; } - MeshPacket *allocAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex); + meshtastic_MeshPacket *allocAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex); /// Send an error response for the specified packet. - MeshPacket *allocErrorResponse(Routing_Error err, const MeshPacket *p); + meshtastic_MeshPacket *allocErrorResponse(meshtastic_Routing_Error err, const meshtastic_MeshPacket *p); /** * @brief An admin message arrived to AdminModule. Module was asked whether it want to handle the request. @@ -171,8 +171,8 @@ class MeshModule * HANDLED if message was handled * HANDLED_WITH_RESPONSE if a response is also prepared and to be sent. */ - virtual AdminMessageHandleResult handleAdminMessageForModule(const MeshPacket &mp, AdminMessage *request, - AdminMessage *response) + virtual AdminMessageHandleResult handleAdminMessageForModule(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *request, + meshtastic_AdminMessage *response) { return AdminMessageHandleResult::NOT_HANDLED; }; @@ -182,7 +182,7 @@ class MeshModule * If any of the current chain of modules has already sent a reply, it will be here. This is useful to allow * the RoutingModule to avoid sending redundant acks */ - static MeshPacket *currentReply; + static meshtastic_MeshPacket *currentReply; friend class ReliableRouter; @@ -190,10 +190,10 @@ class MeshModule * so that subclasses can (optionally) send a response back to the original sender. This method calls allocReply() * to generate the reply message, and if !NULL that message will be delivered to whoever sent req */ - void sendResponse(const MeshPacket &req); + void sendResponse(const meshtastic_MeshPacket &req); }; /** set the destination and packet parameters of packet p intended as a reply to a particular "to" packet * This ensures that if the request packet was sent reliably, the reply is sent that way as well. */ -void setReplyTo(MeshPacket *p, const MeshPacket &to); +void setReplyTo(meshtastic_MeshPacket *p, const meshtastic_MeshPacket &to); diff --git a/src/mesh/MeshPacketQueue.cpp b/src/mesh/MeshPacketQueue.cpp index f14ca58ae..24756fd2a 100644 --- a/src/mesh/MeshPacketQueue.cpp +++ b/src/mesh/MeshPacketQueue.cpp @@ -5,14 +5,14 @@ #include /// @return the priority of the specified packet -inline uint32_t getPriority(const MeshPacket *p) +inline uint32_t getPriority(const meshtastic_MeshPacket *p) { auto pri = p->priority; return pri; } /// @return "true" if "p1" is ordered before "p2" -bool CompareMeshPacketFunc(const MeshPacket *p1, const MeshPacket *p2) +bool CompareMeshPacketFunc(const meshtastic_MeshPacket *p1, const meshtastic_MeshPacket *p2) { assert(p1 && p2); auto p1p = getPriority(p1), p2p = getPriority(p2); @@ -34,21 +34,21 @@ bool MeshPacketQueue::empty() /** * Some clients might not properly set priority, therefore we fix it here. */ -void fixPriority(MeshPacket *p) +void fixPriority(meshtastic_MeshPacket *p) { // We might receive acks from other nodes (and since generated remotely, they won't have priority assigned. Check for that // and fix it - if (p->priority == MeshPacket_Priority_UNSET) { + if (p->priority == meshtastic_MeshPacket_Priority_UNSET) { // if acks give high priority // if a reliable message give a bit higher default priority - p->priority = (p->decoded.portnum == PortNum_ROUTING_APP) - ? MeshPacket_Priority_ACK - : (p->want_ack ? MeshPacket_Priority_RELIABLE : MeshPacket_Priority_DEFAULT); + p->priority = (p->decoded.portnum == meshtastic_PortNum_ROUTING_APP) + ? meshtastic_MeshPacket_Priority_ACK + : (p->want_ack ? meshtastic_MeshPacket_Priority_RELIABLE : meshtastic_MeshPacket_Priority_DEFAULT); } } /** enqueue a packet, return false if full */ -bool MeshPacketQueue::enqueue(MeshPacket *p) +bool MeshPacketQueue::enqueue(meshtastic_MeshPacket *p) { fixPriority(p); @@ -62,7 +62,7 @@ bool MeshPacketQueue::enqueue(MeshPacket *p) return true; } -MeshPacket *MeshPacketQueue::dequeue() +meshtastic_MeshPacket *MeshPacketQueue::dequeue() { if (empty()) { return NULL; @@ -75,7 +75,7 @@ MeshPacket *MeshPacketQueue::dequeue() return p; } -MeshPacket *MeshPacketQueue::getFront() +meshtastic_MeshPacket *MeshPacketQueue::getFront() { if (empty()) { return NULL; @@ -86,7 +86,7 @@ MeshPacket *MeshPacketQueue::getFront() } /** Attempt to find and remove a packet from this queue. Returns a pointer to the removed packet, or NULL if not found */ -MeshPacket *MeshPacketQueue::remove(NodeNum from, PacketId id) +meshtastic_MeshPacket *MeshPacketQueue::remove(NodeNum from, PacketId id) { for (auto it = queue.begin(); it != queue.end(); it++) { auto p = (*it); @@ -101,7 +101,7 @@ MeshPacket *MeshPacketQueue::remove(NodeNum from, PacketId id) } /** Attempt to find and remove a packet from this queue. Returns the packet which was removed from the queue */ -bool MeshPacketQueue::replaceLowerPriorityPacket(MeshPacket *p) +bool MeshPacketQueue::replaceLowerPriorityPacket(meshtastic_MeshPacket *p) { std::sort_heap(queue.begin(), queue.end(), &CompareMeshPacketFunc); // sort ascending based on priority (0 -> 127) diff --git a/src/mesh/MeshPacketQueue.h b/src/mesh/MeshPacketQueue.h index dd348bec6..3c28fc5ce 100644 --- a/src/mesh/MeshPacketQueue.h +++ b/src/mesh/MeshPacketQueue.h @@ -10,17 +10,17 @@ class MeshPacketQueue { size_t maxLen; - std::vector queue; + std::vector queue; /** Replace a lower priority package in the queue with 'mp' (provided there are lower pri packages). Return true if replaced. */ - bool replaceLowerPriorityPacket(MeshPacket *mp); + bool replaceLowerPriorityPacket(meshtastic_MeshPacket *mp); public: explicit MeshPacketQueue(size_t _maxLen); /** enqueue a packet, return false if full */ - bool enqueue(MeshPacket *p); + bool enqueue(meshtastic_MeshPacket *p); /** return true if the queue is empty */ bool empty(); @@ -31,10 +31,10 @@ class MeshPacketQueue /** return total size of the Queue */ size_t getMaxLen() { return maxLen; } - MeshPacket *dequeue(); + meshtastic_MeshPacket *dequeue(); - MeshPacket *getFront(); + meshtastic_MeshPacket *getFront(); /** Attempt to find and remove a packet from this queue. Returns the packet which was removed from the queue */ - MeshPacket *remove(NodeNum from, PacketId id); + meshtastic_MeshPacket *remove(NodeNum from, PacketId id); }; diff --git a/src/mesh/MeshRadio.h b/src/mesh/MeshRadio.h index 2cb7f4e6d..f2514eea1 100644 --- a/src/mesh/MeshRadio.h +++ b/src/mesh/MeshRadio.h @@ -7,7 +7,7 @@ // Map from old region names to new region enums struct RegionInfo { - Config_LoRaConfig_RegionCode code; + meshtastic_Config_LoRaConfig_RegionCode code; float freqStart; float freqEnd; float dutyCycle; diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index 55a1f66c3..55a8721b5 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -51,9 +51,9 @@ FIXME in the initial proof of concept we just skip the entire want/deny flow and MeshService service; -static MemoryDynamic staticQueueStatusPool; +static MemoryDynamic staticQueueStatusPool; -Allocator &queueStatusPool = staticQueueStatusPool; +Allocator &queueStatusPool = staticQueueStatusPool; #include "Router.h" @@ -71,14 +71,14 @@ void MeshService::init() gpsObserver.observe(&gps->newStatus); } -int MeshService::handleFromRadio(const MeshPacket *mp) +int MeshService::handleFromRadio(const meshtastic_MeshPacket *mp) { powerFSM.trigger(EVENT_PACKET_FOR_PHONE); // Possibly keep the node from sleeping printPacket("Forwarding to phone", mp); nodeDB.updateFrom(*mp); // update our DB state based off sniffing every RX packet from the radio - sendToPhone((MeshPacket *)mp); + sendToPhone((meshtastic_MeshPacket *)mp); return 0; } @@ -87,7 +87,7 @@ int MeshService::handleFromRadio(const MeshPacket *mp) void MeshService::loop() { if (lastQueueStatus.free == 0) { // check if there is now free space in TX queue - QueueStatus qs = router->getQueueStatus(); + meshtastic_QueueStatus qs = router->getQueueStatus(); if (qs.free != lastQueueStatus.free) (void)sendQueueStatusToPhone(qs, 0, 0); } @@ -130,7 +130,7 @@ void MeshService::reloadOwner(bool shouldSave) * Called by PhoneAPI.handleToRadio. Note: p is a scratch buffer, this function is allowed to write to it but it can not keep a * reference */ -void MeshService::handleToRadio(MeshPacket &p) +void MeshService::handleToRadio(meshtastic_MeshPacket &p) { #ifdef ARCH_PORTDUINO // Simulates device is receiving a packet via the LoRa chip @@ -188,16 +188,16 @@ bool MeshService::cancelSending(PacketId id) return router->cancelSending(nodeDB.getNodeNum(), id); } -ErrorCode MeshService::sendQueueStatusToPhone(const QueueStatus &qs, ErrorCode res, uint32_t mesh_packet_id) +ErrorCode MeshService::sendQueueStatusToPhone(const meshtastic_QueueStatus &qs, ErrorCode res, uint32_t mesh_packet_id) { - QueueStatus *copied = queueStatusPool.allocCopy(qs); + meshtastic_QueueStatus *copied = queueStatusPool.allocCopy(qs); copied->res = res; copied->mesh_packet_id = mesh_packet_id; if (toPhoneQueueStatusQueue.numFree() == 0) { LOG_DEBUG("NOTE: tophone queue status queue is full, discarding oldest\n"); - QueueStatus *d = toPhoneQueueStatusQueue.dequeuePtr(0); + meshtastic_QueueStatus *d = toPhoneQueueStatusQueue.dequeuePtr(0); if (d) releaseQueueStatusToPool(d); } @@ -210,7 +210,7 @@ ErrorCode MeshService::sendQueueStatusToPhone(const QueueStatus &qs, ErrorCode r return res ? ERRNO_OK : ERRNO_UNKNOWN; } -void MeshService::sendToMesh(MeshPacket *p, RxSource src, bool ccToPhone) +void MeshService::sendToMesh(meshtastic_MeshPacket *p, RxSource src, bool ccToPhone) { uint32_t mesh_packet_id = p->id; nodeDB.updateFrom(*p); // update our local DB for this packet (because phone might have sent position packets etc...) @@ -220,7 +220,7 @@ void MeshService::sendToMesh(MeshPacket *p, RxSource src, bool ccToPhone) /* NOTE(pboldin): Prepare and send QueueStatus message to the phone as a * high-priority message. */ - QueueStatus qs = router->getQueueStatus(); + meshtastic_QueueStatus qs = router->getQueueStatus(); ErrorCode r = sendQueueStatusToPhone(qs, res, mesh_packet_id); if (r != ERRNO_OK) { LOG_DEBUG("Can't send status to phone"); @@ -233,7 +233,7 @@ void MeshService::sendToMesh(MeshPacket *p, RxSource src, bool ccToPhone) void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies) { - NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); + meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); assert(node); if (node->has_position && (node->position.latitude_i != 0 || node->position.longitude_i != 0)) { @@ -249,24 +249,24 @@ void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies) } } -void MeshService::sendToPhone(MeshPacket *p) +void MeshService::sendToPhone(meshtastic_MeshPacket *p) { if (toPhoneQueue.numFree() == 0) { LOG_WARN("ToPhone queue is full, discarding oldest\n"); - MeshPacket *d = toPhoneQueue.dequeuePtr(0); + meshtastic_MeshPacket *d = toPhoneQueue.dequeuePtr(0); if (d) releaseToPool(d); } - MeshPacket *copied = packetPool.allocCopy(*p); + meshtastic_MeshPacket *copied = packetPool.allocCopy(*p); perhapsDecode(copied); assert(toPhoneQueue.enqueue(copied, 0)); fromNum++; } -NodeInfo *MeshService::refreshMyNodeInfo() +meshtastic_NodeInfo *MeshService::refreshMyNodeInfo() { - NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); + meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); assert(node); // We might not have a position yet for our local node, in that case, at least try to send the time @@ -275,7 +275,7 @@ NodeInfo *MeshService::refreshMyNodeInfo() node->has_position = true; } - Position &position = node->position; + meshtastic_Position &position = node->position; // Update our local node info with our time (even if we don't decide to update anyone else) node->last_heard = @@ -291,8 +291,8 @@ NodeInfo *MeshService::refreshMyNodeInfo() int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus) { // Update our local node info with our position (even if we don't decide to update anyone else) - NodeInfo *node = refreshMyNodeInfo(); - Position pos = Position_init_default; + meshtastic_NodeInfo *node = refreshMyNodeInfo(); + meshtastic_Position pos = meshtastic_Position_init_default; if (newStatus->getHasLock()) { // load data from GPS object, will add timestamp + battery further down diff --git a/src/mesh/MeshService.h b/src/mesh/MeshService.h index fceafbab4..b8abac80d 100644 --- a/src/mesh/MeshService.h +++ b/src/mesh/MeshService.h @@ -14,7 +14,7 @@ #include "../platform/portduino/SimRadio.h" #endif -extern Allocator &queueStatusPool; +extern Allocator &queueStatusPool; /** * Top level app for this service. keeps the mesh, the radio config and the queue of received packets. @@ -29,13 +29,13 @@ class MeshService /// FIXME, change to a DropOldestQueue and keep a count of the number of dropped packets to ensure /// we never hang because android hasn't been there in a while /// FIXME - save this to flash on deep sleep - PointerQueue toPhoneQueue; + PointerQueue toPhoneQueue; // keep list of QueueStatus packets to be send to the phone - PointerQueue toPhoneQueueStatusQueue; + PointerQueue toPhoneQueueStatusQueue; // This holds the last QueueStatus send - QueueStatus lastQueueStatus; + meshtastic_QueueStatus lastQueueStatus; /// The current nonce for the newest packet which has been queued for the phone uint32_t fromNum = 0; @@ -59,23 +59,23 @@ class MeshService /// Return the next packet destined to the phone. FIXME, somehow use fromNum to allow the phone to retry the /// last few packets if needs to. - MeshPacket *getForPhone() { return toPhoneQueue.dequeuePtr(0); } + meshtastic_MeshPacket *getForPhone() { return toPhoneQueue.dequeuePtr(0); } /// Allows the bluetooth handler to free packets after they have been sent - void releaseToPool(MeshPacket *p) { packetPool.release(p); } + void releaseToPool(meshtastic_MeshPacket *p) { packetPool.release(p); } /// Return the next QueueStatus packet destined to the phone. - QueueStatus *getQueueStatusForPhone() { return toPhoneQueueStatusQueue.dequeuePtr(0); } + meshtastic_QueueStatus *getQueueStatusForPhone() { return toPhoneQueueStatusQueue.dequeuePtr(0); } // Release QueueStatus packet to pool - void releaseQueueStatusToPool(QueueStatus *p) { queueStatusPool.release(p); } + void releaseQueueStatusToPool(meshtastic_QueueStatus *p) { queueStatusPool.release(p); } /** * Given a ToRadio buffer parse it and properly handle it (setup radio, owner or send packet into the mesh) * Called by PhoneAPI.handleToRadio. Note: p is a scratch buffer, this function is allowed to write to it but it can not keep * a reference */ - void handleToRadio(MeshPacket &p); + void handleToRadio(meshtastic_MeshPacket &p); /** The radioConfig object just changed, call this to force the hw to change to the new settings * @return true if client devices should be sent a new set of radio configs @@ -92,16 +92,16 @@ class MeshService /// Send a packet into the mesh - note p must have been allocated from packetPool. We will return it to that pool after /// sending. This is the ONLY function you should use for sending messages into the mesh, because it also updates the nodedb /// cache - void sendToMesh(MeshPacket *p, RxSource src = RX_SRC_LOCAL, bool ccToPhone = false); + void sendToMesh(meshtastic_MeshPacket *p, RxSource src = RX_SRC_LOCAL, bool ccToPhone = false); /** Attempt to cancel a previously sent packet from this _local_ node. Returns true if a packet was found we could cancel */ bool cancelSending(PacketId id); /// Pull the latest power and time info into my nodeinfo - NodeInfo *refreshMyNodeInfo(); + meshtastic_NodeInfo *refreshMyNodeInfo(); /// Send a packet to the phone - void sendToPhone(MeshPacket *p); + void sendToPhone(meshtastic_MeshPacket *p); bool isToPhoneQueueEmpty(); @@ -112,10 +112,10 @@ class MeshService /// Handle a packet that just arrived from the radio. This method does _ReliableRouternot_ free the provided packet. If it /// needs to keep the packet around it makes a copy - int handleFromRadio(const MeshPacket *p); + int handleFromRadio(const meshtastic_MeshPacket *p); friend class RoutingModule; - ErrorCode sendQueueStatusToPhone(const QueueStatus &qs, ErrorCode res, uint32_t mesh_packet_id); + ErrorCode sendQueueStatusToPhone(const meshtastic_QueueStatus &qs, ErrorCode res, uint32_t mesh_packet_id); }; extern MeshService service; diff --git a/src/mesh/MeshTypes.h b/src/mesh/MeshTypes.h index ad21bf1bc..ee23b9158 100644 --- a/src/mesh/MeshTypes.h +++ b/src/mesh/MeshTypes.h @@ -39,10 +39,10 @@ enum RxSource { typedef int ErrorCode; /// Alloc and free packets to our global, ISR safe pool -extern Allocator &packetPool; +extern Allocator &packetPool; /** * Most (but not always) of the time we want to treat packets 'from' the local phone (where from == 0), as if they originated on * the local node. If from is zero this function returns our node number instead */ -NodeNum getFrom(const MeshPacket *p); \ No newline at end of file +NodeNum getFrom(const meshtastic_MeshPacket *p); \ No newline at end of file diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 7a2f0483e..b278d4567 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -32,12 +32,12 @@ NodeDB nodeDB; // we have plenty of ram so statically alloc this tempbuf (for now) -EXT_RAM_ATTR DeviceState devicestate; -MyNodeInfo &myNodeInfo = devicestate.my_node; -LocalConfig config; -LocalModuleConfig moduleConfig; -ChannelFile channelFile; -OEMStore oemStore; +EXT_RAM_ATTR meshtastic_DeviceState devicestate; +meshtastic_MyNodeInfo &myNodeInfo = devicestate.my_node; +meshtastic_LocalConfig config; +meshtastic_LocalModuleConfig moduleConfig; +meshtastic_ChannelFile channelFile; +meshtastic_OEMStore oemStore; /** The current change # for radio settings. Starts at 0 on boot and any time the radio settings * might have changed is incremented. Allows others to detect they might now be on a new channel. @@ -53,7 +53,7 @@ extern void getMacAddr(uint8_t *dmac); * But there are some special ids used when we haven't yet been configured by a user. In that case * we use !macaddr (no colons). */ -User &owner = devicestate.owner; +meshtastic_User &owner = devicestate.owner; static uint8_t ourMacAddr[6]; @@ -69,7 +69,7 @@ NodeDB::NodeDB() : nodes(devicestate.node_db), numNodes(&devicestate.node_db_cou * Most (but not always) of the time we want to treat packets 'from' the local phone (where from == 0), as if they originated on * the local node. If from is zero this function returns our node number instead */ -NodeNum getFrom(const MeshPacket *p) +NodeNum getFrom(const meshtastic_MeshPacket *p) { return (p->from == 0) ? nodeDB.getNodeNum() : p->from; } @@ -102,7 +102,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset) config.power.wait_bluetooth_secs = 10; config.position.position_broadcast_secs = 6 * 60; config.power.ls_secs = 60; - config.lora.region = Config_LoRaConfig_RegionCode_TW; + config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_TW; // Enter super deep sleep soon and stay there not very long // radioConfig.preferences.mesh_sds_timeout_secs = 10; @@ -151,7 +151,7 @@ bool NodeDB::factoryReset() void NodeDB::installDefaultConfig() { LOG_INFO("Installing default LocalConfig\n"); - memset(&config, 0, sizeof(LocalConfig)); + memset(&config, 0, sizeof(meshtastic_LocalConfig)); config.version = DEVICESTATE_CUR_VER; config.has_device = true; config.has_display = true; @@ -163,8 +163,8 @@ void NodeDB::installDefaultConfig() config.lora.tx_enabled = true; // FIXME: maybe false in the future, and setting region to enable it. (unset region forces it off) config.lora.override_duty_cycle = false; - config.lora.region = Config_LoRaConfig_RegionCode_UNSET; - config.lora.modem_preset = Config_LoRaConfig_ModemPreset_LONG_FAST; + config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_UNSET; + config.lora.modem_preset = meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST; config.lora.hop_limit = HOP_RELIABLE; config.position.gps_enabled = true; config.position.position_broadcast_smart_enabled = true; @@ -180,10 +180,10 @@ void NodeDB::installDefaultConfig() bool hasScreen = screen_found; #endif config.bluetooth.mode = - hasScreen ? Config_BluetoothConfig_PairingMode_RANDOM_PIN : Config_BluetoothConfig_PairingMode_FIXED_PIN; + hasScreen ? meshtastic_Config_BluetoothConfig_PairingMode_RANDOM_PIN : meshtastic_Config_BluetoothConfig_PairingMode_FIXED_PIN; // for backward compat, default position flags are ALT+MSL config.position.position_flags = - (Config_PositionConfig_PositionFlags_ALTITUDE | Config_PositionConfig_PositionFlags_ALTITUDE_MSL); + (meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE | meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE_MSL); initConfigIntervals(); } @@ -206,7 +206,7 @@ void NodeDB::initConfigIntervals() void NodeDB::installDefaultModuleConfig() { LOG_INFO("Installing default ModuleConfig\n"); - memset(&moduleConfig, 0, sizeof(ModuleConfig)); + memset(&moduleConfig, 0, sizeof(meshtastic_ModuleConfig)); moduleConfig.version = DEVICESTATE_CUR_VER; moduleConfig.has_mqtt = true; @@ -233,7 +233,7 @@ void NodeDB::initModuleConfigIntervals() void NodeDB::installDefaultChannels() { LOG_INFO("Installing default ChannelFile\n"); - memset(&channelFile, 0, sizeof(ChannelFile)); + memset(&channelFile, 0, sizeof(meshtastic_ChannelFile)); channelFile.version = DEVICESTATE_CUR_VER; } @@ -247,7 +247,7 @@ void NodeDB::resetNodes() void NodeDB::installDefaultDeviceState() { LOG_INFO("Installing default DeviceState\n"); - memset(&devicestate, 0, sizeof(DeviceState)); + memset(&devicestate, 0, sizeof(meshtastic_DeviceState)); *numNodes = 0; @@ -289,7 +289,7 @@ void NodeDB::init() myNodeInfo.max_channels = MAX_NUM_CHANNELS; // tell others the max # of channels we can understand myNodeInfo.error_code = - CriticalErrorCode_NONE; // For the error code, only show values from this boot (discard value from flash) + meshtastic_CriticalErrorCode_NONE; // For the error code, only show values from this boot (discard value from flash) myNodeInfo.error_address = 0; // likewise - we always want the app requirements to come from the running appload @@ -303,7 +303,7 @@ void NodeDB::init() owner.hw_model = HW_VENDOR; // Include our owner in the node db under our nodenum - NodeInfo *info = getOrCreateNode(getNodeNum()); + meshtastic_NodeInfo *info = getOrCreateNode(getNodeNum()); info->user = owner; info->has_user = true; @@ -352,7 +352,7 @@ void NodeDB::pickNewNodeNum() if (r == NODENUM_BROADCAST || r < NUM_RESERVED) r = NUM_RESERVED; // don't pick a reserved node number - NodeInfo *found; + meshtastic_NodeInfo *found; while ((found = getNode(r)) && memcmp(found->user.macaddr, owner.macaddr, sizeof(owner.macaddr))) { NodeNum n = random(NUM_RESERVED, NODENUM_BROADCAST); // try a new random choice LOG_DEBUG("NOTE! Our desired nodenum 0x%x is in use, so trying for 0x%x\n", r, n); @@ -403,7 +403,7 @@ bool NodeDB::loadProto(const char *filename, size_t protoSize, size_t objSize, c void NodeDB::loadFromDisk() { // static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM - if (!loadProto(prefFileName, DeviceState_size, sizeof(DeviceState), &DeviceState_msg, &devicestate)) { + if (!loadProto(prefFileName, meshtastic_DeviceState_size, sizeof(meshtastic_DeviceState), &meshtastic_DeviceState_msg, &devicestate)) { installDefaultDeviceState(); // Our in RAM copy might now be corrupt } else { if (devicestate.version < DEVICESTATE_MIN_VER) { @@ -414,7 +414,7 @@ void NodeDB::loadFromDisk() } } - if (!loadProto(configFileName, LocalConfig_size, sizeof(LocalConfig), &LocalConfig_msg, &config)) { + if (!loadProto(configFileName, meshtastic_LocalConfig_size, sizeof(meshtastic_LocalConfig), &meshtastic_LocalConfig_msg, &config)) { installDefaultConfig(); // Our in RAM copy might now be corrupt } else { if (config.version < DEVICESTATE_MIN_VER) { @@ -425,7 +425,7 @@ void NodeDB::loadFromDisk() } } - if (!loadProto(moduleConfigFileName, LocalModuleConfig_size, sizeof(LocalModuleConfig), &LocalModuleConfig_msg, + if (!loadProto(moduleConfigFileName, meshtastic_LocalModuleConfig_size, sizeof(meshtastic_LocalModuleConfig), &meshtastic_LocalModuleConfig_msg, &moduleConfig)) { installDefaultModuleConfig(); // Our in RAM copy might now be corrupt } else { @@ -437,7 +437,7 @@ void NodeDB::loadFromDisk() } } - if (!loadProto(channelFileName, ChannelFile_size, sizeof(ChannelFile), &ChannelFile_msg, &channelFile)) { + if (!loadProto(channelFileName, meshtastic_ChannelFile_size, sizeof(meshtastic_ChannelFile), &meshtastic_ChannelFile_msg, &channelFile)) { installDefaultChannels(); // Our in RAM copy might now be corrupt } else { if (channelFile.version < DEVICESTATE_MIN_VER) { @@ -448,7 +448,7 @@ void NodeDB::loadFromDisk() } } - if (loadProto(oemConfigFile, OEMStore_size, sizeof(OEMStore), &OEMStore_msg, &oemStore)) + if (loadProto(oemConfigFile, meshtastic_OEMStore_size, sizeof(meshtastic_OEMStore), &meshtastic_OEMStore_msg, &oemStore)) LOG_INFO("Loaded OEMStore\n"); } @@ -501,7 +501,7 @@ void NodeDB::saveChannelsToDisk() #ifdef FSCom FSCom.mkdir("/prefs"); #endif - saveProto(channelFileName, ChannelFile_size, &ChannelFile_msg, &channelFile); + saveProto(channelFileName, meshtastic_ChannelFile_size, &meshtastic_ChannelFile_msg, &channelFile); } } @@ -511,7 +511,7 @@ void NodeDB::saveDeviceStateToDisk() #ifdef FSCom FSCom.mkdir("/prefs"); #endif - saveProto(prefFileName, DeviceState_size, &DeviceState_msg, &devicestate); + saveProto(prefFileName, meshtastic_DeviceState_size, &meshtastic_DeviceState_msg, &devicestate); } } @@ -533,7 +533,7 @@ void NodeDB::saveToDisk(int saveWhat) config.has_power = true; config.has_network = true; config.has_bluetooth = true; - saveProto(configFileName, LocalConfig_size, &LocalConfig_msg, &config); + saveProto(configFileName, meshtastic_LocalConfig_size, &meshtastic_LocalConfig_msg, &config); } if (saveWhat & SEGMENT_MODULECONFIG) { @@ -544,7 +544,7 @@ void NodeDB::saveToDisk(int saveWhat) moduleConfig.has_serial = true; moduleConfig.has_store_forward = true; moduleConfig.has_telemetry = true; - saveProto(moduleConfigFileName, LocalModuleConfig_size, &LocalModuleConfig_msg, &moduleConfig); + saveProto(moduleConfigFileName, meshtastic_LocalModuleConfig_size, &meshtastic_LocalModuleConfig_msg, &moduleConfig); } if (saveWhat & SEGMENT_CHANNELS) { @@ -555,7 +555,7 @@ void NodeDB::saveToDisk(int saveWhat) } } -const NodeInfo *NodeDB::readNextInfo() +const meshtastic_NodeInfo *NodeDB::readNextInfo() { if (readPointer < *numNodes) return &nodes[readPointer++]; @@ -564,7 +564,7 @@ const NodeInfo *NodeDB::readNextInfo() } /// Given a node, return how many seconds in the past (vs now) that we last heard from it -uint32_t sinceLastSeen(const NodeInfo *n) +uint32_t sinceLastSeen(const meshtastic_NodeInfo *n) { uint32_t now = getTime(); @@ -593,9 +593,9 @@ size_t NodeDB::getNumOnlineNodes() /** Update position info for this node based on received position data */ -void NodeDB::updatePosition(uint32_t nodeId, const Position &p, RxSource src) +void NodeDB::updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSource src) { - NodeInfo *info = getOrCreateNode(nodeId); + meshtastic_NodeInfo *info = getOrCreateNode(nodeId); if (!info) { return; } @@ -638,11 +638,11 @@ void NodeDB::updatePosition(uint32_t nodeId, const Position &p, RxSource src) /** Update telemetry info for this node based on received metrics * We only care about device telemetry here */ -void NodeDB::updateTelemetry(uint32_t nodeId, const Telemetry &t, RxSource src) +void NodeDB::updateTelemetry(uint32_t nodeId, const meshtastic_Telemetry &t, RxSource src) { - NodeInfo *info = getOrCreateNode(nodeId); + meshtastic_NodeInfo *info = getOrCreateNode(nodeId); // Environment metrics should never go to NodeDb but we'll safegaurd anyway - if (!info || t.which_variant != Telemetry_device_metrics_tag) { + if (!info || t.which_variant != meshtastic_Telemetry_device_metrics_tag) { return; } @@ -660,9 +660,9 @@ void NodeDB::updateTelemetry(uint32_t nodeId, const Telemetry &t, RxSource src) /** Update user info for this node based on received user data */ -void NodeDB::updateUser(uint32_t nodeId, const User &p) +void NodeDB::updateUser(uint32_t nodeId, const meshtastic_User &p) { - NodeInfo *info = getOrCreateNode(nodeId); + meshtastic_NodeInfo *info = getOrCreateNode(nodeId); if (!info) { return; } @@ -689,12 +689,12 @@ void NodeDB::updateUser(uint32_t nodeId, const User &p) /// given a subpacket sniffed from the network, update our DB state /// 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 meshtastic_MeshPacket &mp) { - if (mp.which_payload_variant == MeshPacket_decoded_tag && mp.from) { + if (mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag && mp.from) { LOG_DEBUG("Update DB node 0x%x, rx_time=%u\n", mp.from, mp.rx_time); - NodeInfo *info = getOrCreateNode(getFrom(&mp)); + meshtastic_NodeInfo *info = getOrCreateNode(getFrom(&mp)); if (!info) { return; } @@ -709,7 +709,7 @@ void NodeDB::updateFrom(const MeshPacket &mp) /// Find a node in our DB, return null for missing /// NOTE: This function might be called from an ISR -NodeInfo *NodeDB::getNode(NodeNum n) +meshtastic_NodeInfo *NodeDB::getNode(NodeNum n) { for (int i = 0; i < *numNodes; i++) if (nodes[i].num == n) @@ -719,9 +719,9 @@ NodeInfo *NodeDB::getNode(NodeNum n) } /// Find a node in our DB, create an empty NodeInfo if missing -NodeInfo *NodeDB::getOrCreateNode(NodeNum n) +meshtastic_NodeInfo *NodeDB::getOrCreateNode(NodeNum n) { - NodeInfo *info = getNode(n); + meshtastic_NodeInfo *info = getNode(n); if (!info) { if (*numNodes >= MAX_NUM_NODES) { @@ -753,7 +753,7 @@ NodeInfo *NodeDB::getOrCreateNode(NodeNum n) } /// Record an error that should be reported via analytics -void recordCriticalError(CriticalErrorCode code, uint32_t address, const char *filename) +void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, const char *filename) { // Print error to screen and serial port String lcd = String("Critical error ") + code + "!\n"; diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index 651dd2207..8ca1d5d7b 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -21,16 +21,16 @@ DeviceState versions used to be defined in the .proto file but really only this #define DEVICESTATE_CUR_VER 20 #define DEVICESTATE_MIN_VER DEVICESTATE_CUR_VER -extern DeviceState devicestate; -extern ChannelFile channelFile; -extern MyNodeInfo &myNodeInfo; -extern LocalConfig config; -extern LocalModuleConfig moduleConfig; -extern OEMStore oemStore; -extern User &owner; +extern meshtastic_DeviceState devicestate; +extern meshtastic_ChannelFile channelFile; +extern meshtastic_MyNodeInfo &myNodeInfo; +extern meshtastic_LocalConfig config; +extern meshtastic_LocalModuleConfig moduleConfig; +extern meshtastic_OEMStore oemStore; +extern meshtastic_User &owner; /// Given a node, return how many seconds in the past (vs now) that we last heard from it -uint32_t sinceLastSeen(const NodeInfo *n); +uint32_t sinceLastSeen(const meshtastic_NodeInfo *n); class NodeDB { @@ -40,14 +40,14 @@ class NodeDB // Eventually use a smarter datastructure // HashMap nodes; // Note: these two references just point into our static array we serialize to/from disk - NodeInfo *nodes; + meshtastic_NodeInfo *nodes; pb_size_t *numNodes; uint32_t readPointer = 0; public: bool updateGUI = false; // we think the gui should definitely be redrawn, screen will clear this once handled - NodeInfo *updateGUIforNode = NULL; // if currently showing this node, we think you should update the GUI + meshtastic_NodeInfo *updateGUIforNode = NULL; // if currently showing this node, we think you should update the GUI Observable newStatus; /// don't do mesh based algoritm for node id assignment (initially) @@ -71,19 +71,19 @@ class NodeDB /// given a subpacket sniffed from the network, update our DB state /// we updateGUI and updateGUIforNode if we think our this change is big enough for a redraw - void updateFrom(const MeshPacket &p); + void updateFrom(const meshtastic_MeshPacket &p); /** Update position info for this node based on received position data */ - void updatePosition(uint32_t nodeId, const Position &p, RxSource src = RX_SRC_RADIO); + void updatePosition(uint32_t nodeId, const meshtastic_Position &p, RxSource src = RX_SRC_RADIO); /** Update telemetry info for this node based on received metrics */ - void updateTelemetry(uint32_t nodeId, const Telemetry &t, RxSource src = RX_SRC_RADIO); + void updateTelemetry(uint32_t nodeId, const meshtastic_Telemetry &t, RxSource src = RX_SRC_RADIO); /** Update user info for this node based on received user data */ - void updateUser(uint32_t nodeId, const User &p); + void updateUser(uint32_t nodeId, const meshtastic_User &p); /// @return our node number NodeNum getNodeNum() { return myNodeInfo.my_node_num; } @@ -105,15 +105,15 @@ class NodeDB void resetReadPointer() { readPointer = 0; } /// Allow the bluetooth layer to read our next nodeinfo record, or NULL if done reading - const NodeInfo *readNextInfo(); + const meshtastic_NodeInfo *readNextInfo(); /// pick a provisional nodenum we hope no one is using void pickNewNodeNum(); /// Find a node in our DB, return null for missing - NodeInfo *getNode(NodeNum n); + meshtastic_NodeInfo *getNode(NodeNum n); - NodeInfo *getNodeByIndex(size_t x) + meshtastic_NodeInfo *getNodeByIndex(size_t x) { assert(x < *numNodes); return &nodes[x]; @@ -131,7 +131,7 @@ class NodeDB private: /// Find a node in our DB, create an empty NodeInfo if missing - NodeInfo *getOrCreateNode(NodeNum n); + meshtastic_NodeInfo *getOrCreateNode(NodeNum n); /// Notify observers of changes to the DB void notifyObservers(bool forceUpdate = false) @@ -182,7 +182,7 @@ extern NodeDB nodeDB; // Our delay functions check for this for times that should never expire #define NODE_DELAY_FOREVER 0xffffffff -#define IF_ROUTER(routerVal, normalVal) ((config.device.role == Config_DeviceConfig_Role_ROUTER) ? (routerVal) : (normalVal)) +#define IF_ROUTER(routerVal, normalVal) ((config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER) ? (routerVal) : (normalVal)) #define ONE_DAY 24 * 60 * 60 diff --git a/src/mesh/PacketHistory.cpp b/src/mesh/PacketHistory.cpp index 4784ecf3b..9ecad47cd 100644 --- a/src/mesh/PacketHistory.cpp +++ b/src/mesh/PacketHistory.cpp @@ -11,7 +11,7 @@ PacketHistory::PacketHistory() /** * Update recentBroadcasts and return true if we have already seen this packet */ -bool PacketHistory::wasSeenRecently(const MeshPacket *p, bool withUpdate) +bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpdate) { if (p->id == 0) { LOG_DEBUG("Ignoring message with zero id\n"); diff --git a/src/mesh/PacketHistory.h b/src/mesh/PacketHistory.h index d44a3d369..e59acca8f 100644 --- a/src/mesh/PacketHistory.h +++ b/src/mesh/PacketHistory.h @@ -41,5 +41,5 @@ class PacketHistory * * @param withUpdate if true and not found we add an entry to recentPackets */ - bool wasSeenRecently(const MeshPacket *p, bool withUpdate = true); + bool wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpdate = true); }; diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 7c5781879..cd59ad080 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -80,20 +80,20 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength) // return (lastContactMsec != 0) && memset(&toRadioScratch, 0, sizeof(toRadioScratch)); - if (pb_decode_from_bytes(buf, bufLength, &ToRadio_msg, &toRadioScratch)) { + if (pb_decode_from_bytes(buf, bufLength, &meshtastic_ToRadio_msg, &toRadioScratch)) { switch (toRadioScratch.which_payload_variant) { - case ToRadio_packet_tag: + case meshtastic_ToRadio_packet_tag: return handleToRadioPacket(toRadioScratch.packet); - case ToRadio_want_config_id_tag: + case meshtastic_ToRadio_want_config_id_tag: config_nonce = toRadioScratch.want_config_id; LOG_INFO("Client wants config, nonce=%u\n", config_nonce); handleStartConfig(); break; - case ToRadio_disconnect_tag: + case meshtastic_ToRadio_disconnect_tag: LOG_INFO("Disconnecting from phone\n"); close(); break; - case ToRadio_xmodemPacket_tag: + case meshtastic_ToRadio_xmodemPacket_tag: LOG_INFO("Got xmodem packet\n"); xModem.handlePacket(toRadioScratch.xmodemPacket); break; @@ -143,7 +143,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) // If the user has specified they don't want our node to share its location, make sure to tell the phone // app not to send locations on our behalf. myNodeInfo.has_gps = gps && gps->isConnected(); // Update with latest GPS connect info - fromRadioScratch.which_payload_variant = FromRadio_my_info_tag; + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_my_info_tag; fromRadioScratch.my_info = myNodeInfo; state = STATE_SEND_NODEINFO; @@ -152,13 +152,13 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) case STATE_SEND_NODEINFO: { LOG_INFO("getFromRadio=STATE_SEND_NODEINFO\n"); - const NodeInfo *info = nodeInfoForPhone; + const meshtastic_NodeInfo *info = nodeInfoForPhone; nodeInfoForPhone = NULL; // We just consumed a nodeinfo, will need a new one next time if (info) { LOG_INFO("Sending nodeinfo: num=0x%x, lastseen=%u, id=%s, name=%s\n", info->num, info->last_heard, info->user.id, info->user.long_name); - fromRadioScratch.which_payload_variant = FromRadio_node_info_tag; + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_node_info_tag; fromRadioScratch.node_info = *info; // Stay in current state until done sending nodeinfos } else { @@ -172,47 +172,47 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) case STATE_SEND_CHANNELS: LOG_INFO("getFromRadio=STATE_SEND_CHANNELS\n"); - fromRadioScratch.which_payload_variant = FromRadio_channel_tag; + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_channel_tag; fromRadioScratch.channel = channels.getByIndex(config_state); config_state++; // Advance when we have sent all of our Channels if (config_state >= MAX_NUM_CHANNELS) { state = STATE_SEND_CONFIG; - config_state = _AdminMessage_ConfigType_MIN + 1; + config_state = _meshtastic_AdminMessage_ConfigType_MIN + 1; } break; case STATE_SEND_CONFIG: LOG_INFO("getFromRadio=STATE_SEND_CONFIG\n"); - fromRadioScratch.which_payload_variant = FromRadio_config_tag; + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_tag; switch (config_state) { - case Config_device_tag: - fromRadioScratch.config.which_payload_variant = Config_device_tag; + case meshtastic_Config_device_tag: + fromRadioScratch.config.which_payload_variant = meshtastic_Config_device_tag; fromRadioScratch.config.payload_variant.device = config.device; break; - case Config_position_tag: - fromRadioScratch.config.which_payload_variant = Config_position_tag; + case meshtastic_Config_position_tag: + fromRadioScratch.config.which_payload_variant = meshtastic_Config_position_tag; fromRadioScratch.config.payload_variant.position = config.position; break; - case Config_power_tag: - fromRadioScratch.config.which_payload_variant = Config_power_tag; + case meshtastic_Config_power_tag: + fromRadioScratch.config.which_payload_variant = meshtastic_Config_power_tag; fromRadioScratch.config.payload_variant.power = config.power; fromRadioScratch.config.payload_variant.power.ls_secs = default_ls_secs; break; - case Config_network_tag: - fromRadioScratch.config.which_payload_variant = Config_network_tag; + case meshtastic_Config_network_tag: + fromRadioScratch.config.which_payload_variant = meshtastic_Config_network_tag; fromRadioScratch.config.payload_variant.network = config.network; break; - case Config_display_tag: - fromRadioScratch.config.which_payload_variant = Config_display_tag; + case meshtastic_Config_display_tag: + fromRadioScratch.config.which_payload_variant = meshtastic_Config_display_tag; fromRadioScratch.config.payload_variant.display = config.display; break; - case Config_lora_tag: - fromRadioScratch.config.which_payload_variant = Config_lora_tag; + case meshtastic_Config_lora_tag: + fromRadioScratch.config.which_payload_variant = meshtastic_Config_lora_tag; fromRadioScratch.config.payload_variant.lora = config.lora; break; - case Config_bluetooth_tag: - fromRadioScratch.config.which_payload_variant = Config_bluetooth_tag; + case meshtastic_Config_bluetooth_tag: + fromRadioScratch.config.which_payload_variant = meshtastic_Config_bluetooth_tag; fromRadioScratch.config.payload_variant.bluetooth = config.bluetooth; break; default: @@ -224,50 +224,50 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) config_state++; // Advance when we have sent all of our config objects - if (config_state > (_AdminMessage_ConfigType_MAX + 1)) { + if (config_state > (_meshtastic_AdminMessage_ConfigType_MAX + 1)) { state = STATE_SEND_MODULECONFIG; - config_state = _AdminMessage_ModuleConfigType_MIN + 1; + config_state = _meshtastic_AdminMessage_ModuleConfigType_MIN + 1; } break; case STATE_SEND_MODULECONFIG: LOG_INFO("getFromRadio=STATE_SEND_MODULECONFIG\n"); - fromRadioScratch.which_payload_variant = FromRadio_moduleConfig_tag; + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_moduleConfig_tag; switch (config_state) { - case ModuleConfig_mqtt_tag: - fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_mqtt_tag; + case meshtastic_ModuleConfig_mqtt_tag: + fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_mqtt_tag; fromRadioScratch.moduleConfig.payload_variant.mqtt = moduleConfig.mqtt; break; - case ModuleConfig_serial_tag: - fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_serial_tag; + case meshtastic_ModuleConfig_serial_tag: + fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_serial_tag; fromRadioScratch.moduleConfig.payload_variant.serial = moduleConfig.serial; break; - case ModuleConfig_external_notification_tag: - fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_external_notification_tag; + case meshtastic_ModuleConfig_external_notification_tag: + fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_external_notification_tag; fromRadioScratch.moduleConfig.payload_variant.external_notification = moduleConfig.external_notification; break; - case ModuleConfig_store_forward_tag: - fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_store_forward_tag; + case meshtastic_ModuleConfig_store_forward_tag: + fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_store_forward_tag; fromRadioScratch.moduleConfig.payload_variant.store_forward = moduleConfig.store_forward; break; - case ModuleConfig_range_test_tag: - fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_range_test_tag; + case meshtastic_ModuleConfig_range_test_tag: + fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_range_test_tag; fromRadioScratch.moduleConfig.payload_variant.range_test = moduleConfig.range_test; break; - case ModuleConfig_telemetry_tag: - fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_telemetry_tag; + case meshtastic_ModuleConfig_telemetry_tag: + fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_telemetry_tag; fromRadioScratch.moduleConfig.payload_variant.telemetry = moduleConfig.telemetry; break; - case ModuleConfig_canned_message_tag: - fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_canned_message_tag; + case meshtastic_ModuleConfig_canned_message_tag: + fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_canned_message_tag; fromRadioScratch.moduleConfig.payload_variant.canned_message = moduleConfig.canned_message; break; - case ModuleConfig_audio_tag: - fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_audio_tag; + case meshtastic_ModuleConfig_audio_tag: + fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_audio_tag; fromRadioScratch.moduleConfig.payload_variant.audio = moduleConfig.audio; break; - case ModuleConfig_remote_hardware_tag: - fromRadioScratch.moduleConfig.which_payload_variant = ModuleConfig_remote_hardware_tag; + case meshtastic_ModuleConfig_remote_hardware_tag: + fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_remote_hardware_tag; fromRadioScratch.moduleConfig.payload_variant.remote_hardware = moduleConfig.remote_hardware; break; default: @@ -276,7 +276,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) config_state++; // Advance when we have sent all of our ModuleConfig objects - if (config_state > (_AdminMessage_ModuleConfigType_MAX + 1)) { + if (config_state > (_meshtastic_AdminMessage_ModuleConfigType_MAX + 1)) { state = STATE_SEND_COMPLETE_ID; config_state = 0; } @@ -284,7 +284,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) case STATE_SEND_COMPLETE_ID: LOG_INFO("getFromRadio=STATE_SEND_COMPLETE_ID\n"); - fromRadioScratch.which_payload_variant = FromRadio_config_complete_id_tag; + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_config_complete_id_tag; fromRadioScratch.config_complete_id = config_nonce; config_nonce = 0; state = STATE_SEND_PACKETS; @@ -294,11 +294,11 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) // Do we have a message from the mesh? LOG_INFO("getFromRadio=STATE_SEND_PACKETS\n"); if (queueStatusPacketForPhone) { - fromRadioScratch.which_payload_variant = FromRadio_queueStatus_tag; + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_queueStatus_tag; fromRadioScratch.queueStatus = *queueStatusPacketForPhone; releaseQueueStatusPhonePacket(); } else if (xmodemPacketForPhone) { - fromRadioScratch.which_payload_variant = FromRadio_xmodemPacket_tag; + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_xmodemPacket_tag; fromRadioScratch.xmodemPacket = *xmodemPacketForPhone; free(xmodemPacketForPhone); xmodemPacketForPhone = NULL; @@ -306,7 +306,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) printPacket("phone downloaded packet", packetForPhone); // Encapsulate as a FromRadio packet - fromRadioScratch.which_payload_variant = FromRadio_packet_tag; + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_packet_tag; fromRadioScratch.packet = *packetForPhone; releasePhonePacket(); } @@ -319,7 +319,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) // Do we have a message from the mesh? if (fromRadioScratch.which_payload_variant != 0) { // Encapsulate as a FromRadio packet - size_t numbytes = pb_encode_to_bytes(buf, FromRadio_size, &FromRadio_msg, &fromRadioScratch); + size_t numbytes = pb_encode_to_bytes(buf, meshtastic_FromRadio_size, &meshtastic_FromRadio_msg, &fromRadioScratch); LOG_DEBUG("encoding toPhone packet to phone variant=%d, %d bytes\n", fromRadioScratch.which_payload_variant, numbytes); return numbytes; @@ -399,7 +399,7 @@ bool PhoneAPI::available() /** * Handle a packet that the phone wants us to send. It is our responsibility to free the packet to the pool */ -bool PhoneAPI::handleToRadioPacket(MeshPacket &p) +bool PhoneAPI::handleToRadioPacket(meshtastic_MeshPacket &p) { printPacket("PACKET FROM PHONE", &p); service.handleToRadio(p); diff --git a/src/mesh/PhoneAPI.h b/src/mesh/PhoneAPI.h index bed917af2..4c78a6dcb 100644 --- a/src/mesh/PhoneAPI.h +++ b/src/mesh/PhoneAPI.h @@ -41,18 +41,18 @@ class PhoneAPI /// We temporarily keep the packet here between the call to available and getFromRadio. We will free it after the phone /// downloads it - MeshPacket *packetForPhone = NULL; + meshtastic_MeshPacket *packetForPhone = NULL; // file transfer packets destined for phone. Push it to the queue then free it. - XModem *xmodemPacketForPhone = NULL; + meshtastic_XModem *xmodemPacketForPhone = NULL; // Keep QueueStatus packet just as packetForPhone - QueueStatus *queueStatusPacketForPhone = NULL; + meshtastic_QueueStatus *queueStatusPacketForPhone = NULL; /// We temporarily keep the nodeInfo here between the call to available and getFromRadio - const NodeInfo *nodeInfoForPhone = NULL; + const meshtastic_NodeInfo *nodeInfoForPhone = NULL; - ToRadio toRadioScratch = {0}; // this is a static scratch object, any data must be copied elsewhere before returning + meshtastic_ToRadio toRadioScratch = {0}; // this is a static scratch object, any data must be copied elsewhere before returning /// Use to ensure that clients don't get confused about old messages from the radio uint32_t config_nonce = 0; @@ -92,7 +92,7 @@ class PhoneAPI protected: /// Our fromradio packet while it is being assembled - FromRadio fromRadioScratch = {}; + meshtastic_FromRadio fromRadioScratch = {}; /** the last msec we heard from the client on the other side of this link */ uint32_t lastContactMsec = 0; @@ -128,7 +128,7 @@ class PhoneAPI * Handle a packet that the phone wants us to send. We can write to it but can not keep a reference to it * @return true true if a packet was queued for sending */ - bool handleToRadioPacket(MeshPacket &p); + bool handleToRadioPacket(meshtastic_MeshPacket &p); /// If the mesh service tells us fromNum has changed, tell the phone virtual int onNotify(uint32_t newValue) override; diff --git a/src/mesh/ProtobufModule.h b/src/mesh/ProtobufModule.h index f1b0bd3d1..bdfdea9ad 100644 --- a/src/mesh/ProtobufModule.h +++ b/src/mesh/ProtobufModule.h @@ -16,7 +16,7 @@ template class ProtobufModule : protected SinglePortModule /** Constructor * name is for debugging output */ - ProtobufModule(const char *_name, PortNum _ourPortNum, const pb_msgdesc_t *_fields) + ProtobufModule(const char *_name, meshtastic_PortNum _ourPortNum, const pb_msgdesc_t *_fields) : SinglePortModule(_name, _ourPortNum), fields(_fields) { } @@ -28,17 +28,17 @@ template class ProtobufModule : protected SinglePortModule * In general decoded will always be !NULL. But in some special applications (where you have handling packets * for multiple port numbers, decoding will ONLY be attempted for packets where the portnum matches our expected ourPortNum. */ - virtual bool handleReceivedProtobuf(const MeshPacket &mp, T *decoded) = 0; + virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, T *decoded) = 0; /** * Return a mesh packet which has been preinited with a particular protobuf data payload and port number. * You can then send this packet (after customizing any of the payload fields you might need) with * service.sendToMesh() */ - MeshPacket *allocDataProtobuf(const T &payload) + meshtastic_MeshPacket *allocDataProtobuf(const T &payload) { // Update our local node info with our position (even if we don't decide to update anyone else) - MeshPacket *p = allocDataPacket(); + meshtastic_MeshPacket *p = allocDataPacket(); p->decoded.payload.size = pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), fields, &payload); @@ -50,7 +50,7 @@ template class ProtobufModule : protected SinglePortModule * Gets the short name from the sender of the mesh packet * Returns "???" if unknown sender */ - const char *getSenderShortName(const MeshPacket &mp) + const char *getSenderShortName(const meshtastic_MeshPacket &mp) { auto node = nodeDB.getNode(getFrom(&mp)); const char *sender = (node) ? node->user.short_name : "???"; @@ -63,7 +63,7 @@ template class ProtobufModule : protected SinglePortModule @return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it */ - virtual ProcessMessage handleReceived(const MeshPacket &mp) override + virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override { // FIXME - we currently update position data in the DB only if the message was a broadcast or destined to us // it would be better to update even if the message was destined to others. @@ -73,7 +73,7 @@ template class ProtobufModule : protected SinglePortModule T scratch; T *decoded = NULL; - if (mp.which_payload_variant == MeshPacket_decoded_tag && mp.decoded.portnum == ourPortNum) { + if (mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag && mp.decoded.portnum == ourPortNum) { memset(&scratch, 0, sizeof(scratch)); if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, fields, &scratch)) { decoded = &scratch; diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp index 523c37746..f4344941d 100644 --- a/src/mesh/RF95Interface.cpp +++ b/src/mesh/RF95Interface.cpp @@ -104,15 +104,15 @@ bool RF95Interface::reconfigure() // configure publicly accessible settings int err = lora->setSpreadingFactor(sf); if (err != RADIOLIB_ERR_NONE) - RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); err = lora->setBandwidth(bw); if (err != RADIOLIB_ERR_NONE) - RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); err = lora->setCodingRate(cr); if (err != RADIOLIB_ERR_NONE) - RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); err = lora->setSyncWord(syncWord); assert(err == RADIOLIB_ERR_NONE); @@ -125,14 +125,14 @@ bool RF95Interface::reconfigure() err = lora->setFrequency(getFreq()); if (err != RADIOLIB_ERR_NONE) - RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); if (power > MAX_POWER) // This chip has lower power limits than some power = MAX_POWER; err = lora->setOutputPower(power); if (err != RADIOLIB_ERR_NONE) - RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); startReceive(); // restart receiving @@ -142,7 +142,7 @@ bool RF95Interface::reconfigure() /** * Add SNR data to received messages */ -void RF95Interface::addReceiveMetadata(MeshPacket *mp) +void RF95Interface::addReceiveMetadata(meshtastic_MeshPacket *mp) { mp->rx_snr = lora->getSNR(); mp->rx_rssi = lround(lora->getRSSI()); diff --git a/src/mesh/RF95Interface.h b/src/mesh/RF95Interface.h index 641f3fc2d..9851020d9 100644 --- a/src/mesh/RF95Interface.h +++ b/src/mesh/RF95Interface.h @@ -55,7 +55,7 @@ class RF95Interface : public RadioLibInterface /** * Add SNR data to received messages */ - virtual void addReceiveMetadata(MeshPacket *mp) override; + virtual void addReceiveMetadata(meshtastic_MeshPacket *mp) override; virtual void setStandby() override; diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 76532fb69..0f319661d 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -13,7 +13,7 @@ #define RDEF(name, freq_start, freq_end, duty_cycle, spacing, power_limit, audio_permitted, frequency_switching, wide_lora) \ { \ - Config_LoRaConfig_RegionCode_##name, freq_start, freq_end, duty_cycle, spacing, power_limit, audio_permitted, \ + meshtastic_Config_LoRaConfig_RegionCode_##name, freq_start, freq_end, duty_cycle, spacing, power_limit, audio_permitted, \ frequency_switching, wide_lora, #name \ } @@ -127,7 +127,7 @@ static uint8_t bytes[MAX_RHPACKETLEN]; void initRegion() { const RegionInfo *r = regions; - for (; r->code != Config_LoRaConfig_RegionCode_UNSET && r->code != config.lora.region; r++) + for (; r->code != meshtastic_Config_LoRaConfig_RegionCode_UNSET && r->code != config.lora.region; r++) ; myRegion = r; LOG_INFO("Wanted region %d, using %s\n", config.lora.region, r->name); @@ -175,22 +175,22 @@ uint32_t RadioInterface::getPacketTime(uint32_t pl) return msecs; } -uint32_t RadioInterface::getPacketTime(MeshPacket *p) +uint32_t RadioInterface::getPacketTime(meshtastic_MeshPacket *p) { uint32_t pl = 0; - if (p->which_payload_variant == MeshPacket_encrypted_tag) { + if (p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag) { pl = p->encrypted.size + sizeof(PacketHeader); } else { - size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &Data_msg, &p->decoded); + size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_Data_msg, &p->decoded); pl = numbytes + sizeof(PacketHeader); } return getPacketTime(pl); } /** The delay to use for retransmitting dropped packets */ -uint32_t RadioInterface::getRetransmissionMsec(const MeshPacket *p) +uint32_t RadioInterface::getRetransmissionMsec(const meshtastic_MeshPacket *p) { - size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &Data_msg, &p->decoded); + size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_Data_msg, &p->decoded); uint32_t packetAirtime = getPacketTime(numbytes + sizeof(PacketHeader)); // Make sure enough time has elapsed for this packet to be sent and an ACK is received. // LOG_DEBUG("Waiting for flooding message with airtime %d and slotTime is %d\n", packetAirtime, slotTimeMsec); @@ -226,7 +226,7 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(float snr) uint32_t delay = 0; uint8_t CWsize = map(snr, SNR_MIN, SNR_MAX, CWmin, CWmax); // LOG_DEBUG("rx_snr of %f so setting CWsize to:%d\n", snr, CWsize); - if (config.device.role == Config_DeviceConfig_Role_ROUTER || config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT) { + if (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER || config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT) { delay = random(0, 2 * CWsize) * slotTimeMsec; LOG_DEBUG("rx_snr found in packet. As a router, setting tx delay:%d\n", delay); } else { @@ -237,11 +237,11 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(float snr) return delay; } -void printPacket(const char *prefix, const MeshPacket *p) +void printPacket(const char *prefix, const meshtastic_MeshPacket *p) { LOG_DEBUG("%s (id=0x%08x fr=0x%02x to=0x%02x, WantAck=%d, HopLim=%d Ch=0x%x", prefix, p->id, p->from & 0xff, p->to & 0xff, p->want_ack, p->hop_limit, p->channel); - if (p->which_payload_variant == MeshPacket_decoded_tag) { + if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { auto &s = p->decoded; LOG_DEBUG(" Portnum=%d", s.portnum); @@ -371,26 +371,26 @@ void RadioInterface::applyModemConfig() { // Set up default configuration // No Sync Words in LORA mode - Config_LoRaConfig &loraConfig = config.lora; + meshtastic_Config_LoRaConfig &loraConfig = config.lora; if (loraConfig.use_preset) { switch (loraConfig.modem_preset) { - case Config_LoRaConfig_ModemPreset_SHORT_FAST: + case meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST: bw = (myRegion->wideLora) ? 812.5 : 250; cr = 8; sf = 7; break; - case Config_LoRaConfig_ModemPreset_SHORT_SLOW: + case meshtastic_Config_LoRaConfig_ModemPreset_SHORT_SLOW: bw = (myRegion->wideLora) ? 812.5 : 250; cr = 8; sf = 8; break; - case Config_LoRaConfig_ModemPreset_MEDIUM_FAST: + case meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_FAST: bw = (myRegion->wideLora) ? 812.5 : 250; cr = 8; sf = 9; break; - case Config_LoRaConfig_ModemPreset_MEDIUM_SLOW: + case meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_SLOW: bw = (myRegion->wideLora) ? 812.5 : 250; cr = 8; sf = 10; @@ -400,12 +400,12 @@ void RadioInterface::applyModemConfig() cr = 8; sf = 11; break; - case Config_LoRaConfig_ModemPreset_LONG_SLOW: + case meshtastic_Config_LoRaConfig_ModemPreset_LONG_SLOW: bw = (myRegion->wideLora) ? 406.25 : 125; cr = 8; sf = 12; break; - case Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW: + case meshtastic_Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW: bw = (myRegion->wideLora) ? 203.125 : 31.25; cr = 8; sf = 12; @@ -487,7 +487,7 @@ void RadioInterface::limitPower() LOG_INFO("Set radio: final power level=%d\n", power); } -void RadioInterface::deliverToReceiver(MeshPacket *p) +void RadioInterface::deliverToReceiver(meshtastic_MeshPacket *p) { if (router) router->enqueueReceivedMessage(p); @@ -496,12 +496,12 @@ void RadioInterface::deliverToReceiver(MeshPacket *p) /*** * given a packet set sendingPacket and decode the protobufs into radiobuf. Returns # of payload bytes to send */ -size_t RadioInterface::beginSending(MeshPacket *p) +size_t RadioInterface::beginSending(meshtastic_MeshPacket *p) { assert(!sendingPacket); // LOG_DEBUG("sending queued packet on mesh (txGood=%d,rxGood=%d,rxBad=%d)\n", rf95.txGood(), rf95.rxGood(), rf95.rxBad()); - assert(p->which_payload_variant == MeshPacket_encrypted_tag); // It should have already been encoded by now + assert(p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag); // It should have already been encoded by now lastTxStart = millis(); diff --git a/src/mesh/RadioInterface.h b/src/mesh/RadioInterface.h index 852ad5f38..1a84c87f9 100644 --- a/src/mesh/RadioInterface.h +++ b/src/mesh/RadioInterface.h @@ -69,7 +69,7 @@ class RadioInterface const uint8_t CWmin = 2; // minimum CWsize const uint8_t CWmax = 8; // maximum CWsize - MeshPacket *sendingPacket = NULL; // The packet we are currently sending + meshtastic_MeshPacket *sendingPacket = NULL; // The packet we are currently sending uint32_t lastTxStart = 0L; /** @@ -80,7 +80,7 @@ class RadioInterface /** * Enqueue a received packet for the registered receiver */ - void deliverToReceiver(MeshPacket *p); + void deliverToReceiver(meshtastic_MeshPacket *p); public: /** pool is the pool we will alloc our rx packets from @@ -113,12 +113,12 @@ class RadioInterface * later free() the packet to pool. This routine is not allowed to stall. * If the txmit queue is full it might return an error */ - virtual ErrorCode send(MeshPacket *p) = 0; + virtual ErrorCode send(meshtastic_MeshPacket *p) = 0; /** Return TX queue status */ - virtual QueueStatus getQueueStatus() + virtual meshtastic_QueueStatus getQueueStatus() { - QueueStatus qs; + meshtastic_QueueStatus qs; qs.res = qs.mesh_packet_id = qs.free = qs.maxlen = 0; return qs; } @@ -139,7 +139,7 @@ class RadioInterface virtual bool reconfigure(); /** The delay to use for retransmitting dropped packets */ - uint32_t getRetransmissionMsec(const MeshPacket *p); + uint32_t getRetransmissionMsec(const meshtastic_MeshPacket *p); /** The delay to use when we want to send something */ uint32_t getTxDelayMsec(); @@ -154,7 +154,7 @@ class RadioInterface * * @return num msecs for the packet */ - uint32_t getPacketTime(MeshPacket *p); + uint32_t getPacketTime(meshtastic_MeshPacket *p); uint32_t getPacketTime(uint32_t totalPacketLen); /** @@ -182,7 +182,7 @@ class RadioInterface * * Used as the first step of */ - size_t beginSending(MeshPacket *p); + size_t beginSending(meshtastic_MeshPacket *p); /** * Some regulatory regions limit xmit power. @@ -221,4 +221,4 @@ class RadioInterface }; /// Debug printing for packets -void printPacket(const char *prefix, const MeshPacket *p); +void printPacket(const char *prefix, const meshtastic_MeshPacket *p); diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index dff195be1..71de44af3 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -87,7 +87,7 @@ bool RadioLibInterface::canSendImmediately() // TX IRQ from the radio, the radio is probably broken. if (busyTx && (millis() - lastTxStart > 60000)) { LOG_ERROR("Hardware Failure! busyTx for more than 60s\n"); - RECORD_CRITICALERROR(CriticalErrorCode_TRANSMIT_FAILED); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_TRANSMIT_FAILED); // reboot in 5 seconds when this condition occurs. rebootAtMsec = lastTxStart + 65000; } @@ -101,15 +101,15 @@ bool RadioLibInterface::canSendImmediately() /// Send a packet (possibly by enquing in a private fifo). This routine will /// later free() the packet to pool. This routine is not allowed to stall because it is called from /// bluetooth comms code. If the txmit queue is empty it might return an error -ErrorCode RadioLibInterface::send(MeshPacket *p) +ErrorCode RadioLibInterface::send(meshtastic_MeshPacket *p) { #ifndef DISABLE_WELCOME_UNSET - if (config.lora.region != Config_LoRaConfig_RegionCode_UNSET) { + if (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_UNSET) { if (disabled || !config.lora.tx_enabled) { - if (config.lora.region != Config_LoRaConfig_RegionCode_UNSET) { + if (config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_UNSET) { if (disabled || !config.lora.tx_enabled) { LOG_WARN("send - !config.lora.tx_enabled\n"); packetPool.release(p); @@ -158,9 +158,9 @@ ErrorCode RadioLibInterface::send(MeshPacket *p) #endif } -QueueStatus RadioLibInterface::getQueueStatus() +meshtastic_QueueStatus RadioLibInterface::getQueueStatus() { - QueueStatus qs; + meshtastic_QueueStatus qs; qs.res = qs.mesh_packet_id = 0; qs.free = txQueue.getFree(); @@ -227,7 +227,7 @@ void RadioLibInterface::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); @@ -247,7 +247,7 @@ void RadioLibInterface::onNotify(uint32_t notification) void RadioLibInterface::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. @@ -358,7 +358,7 @@ void RadioLibInterface::handleReceiveInterrupt() // Note: we deliver _all_ packets to our router (i.e. our interface is intentionally promiscuous). // This allows the router and other apps on our node to sniff packets (usually routing) between other // nodes. - MeshPacket *mp = packetPool.allocZeroed(); + meshtastic_MeshPacket *mp = packetPool.allocZeroed(); mp->from = h->from; mp->to = h->to; @@ -370,7 +370,7 @@ void RadioLibInterface::handleReceiveInterrupt() addReceiveMetadata(mp); - mp->which_payload_variant = MeshPacket_encrypted_tag; // Mark that the payload is still encrypted at this point + mp->which_payload_variant = meshtastic_MeshPacket_encrypted_tag; // Mark that the payload is still encrypted at this point assert(((uint32_t)payloadLen) <= sizeof(mp->encrypted.bytes)); memcpy(mp->encrypted.bytes, payload, payloadLen); mp->encrypted.size = payloadLen; @@ -385,7 +385,7 @@ void RadioLibInterface::handleReceiveInterrupt() } /** start an immediate transmit */ -void RadioLibInterface::startSend(MeshPacket *txp) +void RadioLibInterface::startSend(meshtastic_MeshPacket *txp) { printPacket("Starting low level send", txp); if (disabled || !config.lora.tx_enabled) { @@ -401,7 +401,7 @@ void RadioLibInterface::startSend(MeshPacket *txp) int res = iface->startTransmit(radiobuf, numbytes); if (res != RADIOLIB_ERR_NONE) { LOG_ERROR("startTransmit failed, error=%d\n", res); - RECORD_CRITICALERROR(CriticalErrorCode_RADIO_SPI_BUG); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_RADIO_SPI_BUG); // This send failed, but make sure to 'complete' it properly completeSending(); diff --git a/src/mesh/RadioLibInterface.h b/src/mesh/RadioLibInterface.h index 031a330ff..c5cc85df7 100644 --- a/src/mesh/RadioLibInterface.h +++ b/src/mesh/RadioLibInterface.h @@ -102,7 +102,7 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified RadioLibInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi, PhysicalLayer *iface = NULL); - virtual ErrorCode send(MeshPacket *p) override; + virtual ErrorCode send(meshtastic_MeshPacket *p) override; /** * Return true if we think the board can go to sleep (i.e. our tx queue is empty, we are not sending or receiving) @@ -150,9 +150,9 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified /** start an immediate transmit * This method is virtual so subclasses can hook as needed, subclasses should not call directly */ - virtual void startSend(MeshPacket *txp); + virtual void startSend(meshtastic_MeshPacket *txp); - QueueStatus getQueueStatus(); + meshtastic_QueueStatus getQueueStatus(); protected: /** Do any hardware setup needed on entry into send configuration for the radio. Subclasses can customize */ @@ -173,7 +173,7 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified /** * Add SNR data to received messages */ - virtual void addReceiveMetadata(MeshPacket *mp) = 0; + virtual void addReceiveMetadata(meshtastic_MeshPacket *mp) = 0; virtual void setStandby() = 0; }; diff --git a/src/mesh/ReliableRouter.cpp b/src/mesh/ReliableRouter.cpp index 95b46f9c4..8000926f3 100644 --- a/src/mesh/ReliableRouter.cpp +++ b/src/mesh/ReliableRouter.cpp @@ -10,7 +10,7 @@ * If the message is want_ack, then add it to a list of packets to retransmit. * If we run out of retransmissions, send a nak packet towards the original client to indicate failure. */ -ErrorCode ReliableRouter::send(MeshPacket *p) +ErrorCode ReliableRouter::send(meshtastic_MeshPacket *p) { if (p->want_ack) { // If someone asks for acks on broadcast, we need the hop limit to be at least one, so that first node that receives our @@ -27,7 +27,7 @@ ErrorCode ReliableRouter::send(MeshPacket *p) return FloodingRouter::send(p); } -bool ReliableRouter::shouldFilterReceived(const MeshPacket *p) +bool ReliableRouter::shouldFilterReceived(const meshtastic_MeshPacket *p) { // Note: do not use getFrom() here, because we want to ignore messages sent from phone if (p->from == getNodeNum()) { @@ -45,7 +45,7 @@ bool ReliableRouter::shouldFilterReceived(const MeshPacket *p) LOG_DEBUG("generating implicit ack\n"); // NOTE: we do NOT check p->wantAck here because p is the INCOMING rebroadcast and that packet is not expected to be // marked as wantAck - sendAckNak(Routing_Error_NONE, getFrom(p), p->id, old->packet->channel); + sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, old->packet->channel); stopRetransmission(key); } else { @@ -60,7 +60,7 @@ bool ReliableRouter::shouldFilterReceived(const MeshPacket *p) if (wasSeenRecently(p, false) && p->hop_limit == HOP_RELIABLE && !MeshModule::currentReply && p->to != nodeDB.getNodeNum()) { // retransmission on broadcast has hop_limit still equal to HOP_RELIABLE LOG_DEBUG("Resending implicit ack for a repeated floodmsg\n"); - MeshPacket *tosend = packetPool.allocCopy(*p); + meshtastic_MeshPacket *tosend = packetPool.allocCopy(*p); tosend->hop_limit--; // bump down the hop count Router::send(tosend); } @@ -80,7 +80,7 @@ bool ReliableRouter::shouldFilterReceived(const MeshPacket *p) * * Otherwise, let superclass handle it. */ -void ReliableRouter::sniffReceived(const MeshPacket *p, const Routing *c) +void ReliableRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c) { NodeNum ourNode = getNodeNum(); @@ -88,18 +88,18 @@ void ReliableRouter::sniffReceived(const MeshPacket *p, const Routing *c) if (p->want_ack) { if (MeshModule::currentReply) LOG_DEBUG("Some other module has replied to this message, no need for a 2nd ack\n"); - else if (p->which_payload_variant == MeshPacket_decoded_tag) - sendAckNak(Routing_Error_NONE, getFrom(p), p->id, p->channel); + else if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) + sendAckNak(meshtastic_Routing_Error_NONE, getFrom(p), p->id, p->channel); else // Send a 'NO_CHANNEL' error on the primary channel if want_ack packet destined for us cannot be decoded - sendAckNak(Routing_Error_NO_CHANNEL, getFrom(p), p->id, channels.getPrimaryIndex()); + sendAckNak(meshtastic_Routing_Error_NO_CHANNEL, getFrom(p), p->id, channels.getPrimaryIndex()); } // We consider an ack to be either a !routing packet with a request ID or a routing packet with !error - PacketId ackId = ((c && c->error_reason == Routing_Error_NONE) || !c) ? p->decoded.request_id : 0; + PacketId ackId = ((c && c->error_reason == meshtastic_Routing_Error_NONE) || !c) ? p->decoded.request_id : 0; // A nak is a routing packt that has an error code - PacketId nakId = (c && c->error_reason != Routing_Error_NONE) ? p->decoded.request_id : 0; + PacketId nakId = (c && c->error_reason != meshtastic_Routing_Error_NONE) ? p->decoded.request_id : 0; // We intentionally don't check wasSeenRecently, because it is harmless to delete non existent retransmission records if (ackId || nakId) { @@ -119,7 +119,7 @@ void ReliableRouter::sniffReceived(const MeshPacket *p, const Routing *c) #define NUM_RETRANSMISSIONS 3 -PendingPacket::PendingPacket(MeshPacket *p) +PendingPacket::PendingPacket(meshtastic_MeshPacket *p) { packet = p; numRetransmissions = NUM_RETRANSMISSIONS - 1; // We subtract one, because we assume the user just did the first send @@ -157,7 +157,7 @@ bool ReliableRouter::stopRetransmission(GlobalPacketId key) /** * Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting. */ -PendingPacket *ReliableRouter::startRetransmission(MeshPacket *p) +PendingPacket *ReliableRouter::startRetransmission(meshtastic_MeshPacket *p) { auto id = GlobalPacketId(p); auto rec = PendingPacket(p); @@ -191,7 +191,7 @@ int32_t ReliableRouter::doRetransmissions() if (p.numRetransmissions == 0) { LOG_DEBUG("Reliable send failed, returning a nak for fr=0x%x,to=0x%x,id=0x%x\n", p.packet->from, p.packet->to, p.packet->id); - sendAckNak(Routing_Error_MAX_RETRANSMIT, getFrom(p.packet), p.packet->id, p.packet->channel); + sendAckNak(meshtastic_Routing_Error_MAX_RETRANSMIT, getFrom(p.packet), p.packet->id, p.packet->channel); // Note: we don't stop retransmission here, instead the Nak packet gets processed in sniffReceived stopRetransmission(it->first); stillValid = false; // just deleted it diff --git a/src/mesh/ReliableRouter.h b/src/mesh/ReliableRouter.h index 65f486e5b..259da7249 100644 --- a/src/mesh/ReliableRouter.h +++ b/src/mesh/ReliableRouter.h @@ -13,7 +13,7 @@ struct GlobalPacketId { bool operator==(const GlobalPacketId &p) const { return node == p.node && id == p.id; } - explicit GlobalPacketId(const MeshPacket *p) + explicit GlobalPacketId(const meshtastic_MeshPacket *p) { node = getFrom(p); id = p->id; @@ -30,7 +30,7 @@ struct GlobalPacketId { * A packet queued for retransmission */ struct PendingPacket { - MeshPacket *packet; + meshtastic_MeshPacket *packet; /** The next time we should try to retransmit this packet */ uint32_t nextTxMsec = 0; @@ -39,7 +39,7 @@ struct PendingPacket { uint8_t numRetransmissions = 0; PendingPacket() {} - explicit PendingPacket(MeshPacket *p); + explicit PendingPacket(meshtastic_MeshPacket *p); }; class GlobalPacketIdHashFunction @@ -68,7 +68,7 @@ class ReliableRouter : public FloodingRouter * later free() the packet to pool. This routine is not allowed to stall. * If the txmit queue is full it might return an error */ - virtual ErrorCode send(MeshPacket *p) override; + virtual ErrorCode send(meshtastic_MeshPacket *p) override; /** Do our retransmission handling */ virtual int32_t runOnce() override @@ -85,7 +85,7 @@ class ReliableRouter : public FloodingRouter /** * Look for acks/naks or someone retransmitting us */ - virtual void sniffReceived(const MeshPacket *p, const Routing *c) override; + virtual void sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c) override; /** * Try to find the pending packet record for this ID (or NULL if not found) @@ -96,12 +96,12 @@ class ReliableRouter : public FloodingRouter /** * We hook this method so we can see packets before FloodingRouter says they should be discarded */ - virtual bool shouldFilterReceived(const MeshPacket *p) override; + virtual bool shouldFilterReceived(const meshtastic_MeshPacket *p) override; /** * Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting. */ - PendingPacket *startRetransmission(MeshPacket *p); + PendingPacket *startRetransmission(meshtastic_MeshPacket *p); private: /** diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index e1643e206..82fcb5619 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -35,9 +35,9 @@ extern "C" { 2) // max number of packets which can be in flight (either queued from reception or queued for sending) // static MemoryPool staticPool(MAX_PACKETS); -static MemoryDynamic staticPool; +static MemoryDynamic staticPool; -Allocator &packetPool = staticPool; +Allocator &packetPool = staticPool; static uint8_t bytes[MAX_RHPACKETLEN]; @@ -63,7 +63,7 @@ Router::Router() : concurrency::OSThread("Router"), fromRadioQueue(MAX_RX_FROMRA */ int32_t Router::runOnce() { - MeshPacket *mp; + meshtastic_MeshPacket *mp; while ((mp = fromRadioQueue.dequeuePtr(0)) != NULL) { // printPacket("handle fromRadioQ", mp); perhapsHandleReceived(mp); @@ -77,7 +77,7 @@ int32_t Router::runOnce() * RadioInterface calls this to queue up packets that have been received from the radio. The router is now responsible for * freeing the packet */ -void Router::enqueueReceivedMessage(MeshPacket *p) +void Router::enqueueReceivedMessage(meshtastic_MeshPacket *p) { if (fromRadioQueue.enqueue(p, 0)) { // NOWAIT - fixme, if queue is full, delete older messages @@ -112,11 +112,11 @@ PacketId generatePacketId() return id; } -MeshPacket *Router::allocForSending() +meshtastic_MeshPacket *Router::allocForSending() { - MeshPacket *p = packetPool.allocZeroed(); + meshtastic_MeshPacket *p = packetPool.allocZeroed(); - p->which_payload_variant = MeshPacket_decoded_tag; // Assume payload is decoded at start. + p->which_payload_variant = meshtastic_MeshPacket_decoded_tag; // Assume payload is decoded at start. p->from = nodeDB.getNodeNum(); p->to = NODENUM_BROADCAST; p->hop_limit = (config.lora.hop_limit >= HOP_MAX) ? HOP_MAX : config.lora.hop_limit; @@ -130,12 +130,12 @@ MeshPacket *Router::allocForSending() /** * Send an ack or a nak packet back towards whoever sent idFrom */ -void Router::sendAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex) +void Router::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex) { routingModule->sendAckNak(err, to, idFrom, chIndex); } -void Router::abortSendAndNak(Routing_Error err, MeshPacket *p) +void Router::abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p) { LOG_ERROR("Error=%d, returning NAK and dropping packet.\n", err); sendAckNak(err, getFrom(p), p->id, p->channel); @@ -149,12 +149,12 @@ void Router::setReceivedMessage() runASAP = true; } -QueueStatus Router::getQueueStatus() +meshtastic_QueueStatus Router::getQueueStatus() { return iface->getQueueStatus(); } -ErrorCode Router::sendLocal(MeshPacket *p, RxSource src) +ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src) { // No need to deliver externally if the destination is the local node if (p->to == nodeDB.getNodeNum()) { @@ -163,7 +163,7 @@ ErrorCode Router::sendLocal(MeshPacket *p, RxSource src) return ERRNO_OK; } else if (!iface) { // We must be sending to remote nodes also, fail if no interface found - abortSendAndNak(Routing_Error_NO_INTERFACE, p); + abortSendAndNak(meshtastic_Routing_Error_NO_INTERFACE, p); return ERRNO_NO_INTERFACES; } else { @@ -190,12 +190,12 @@ void printBytes(const char *label, const uint8_t *p, size_t numbytes) * later free() the packet to pool. This routine is not allowed to stall. * If the txmit queue is full it might return an error. */ -ErrorCode Router::send(MeshPacket *p) +ErrorCode Router::send(meshtastic_MeshPacket *p) { if (p->to == nodeDB.getNodeNum()) { LOG_ERROR("BUG! send() called with packet destined for local node!\n"); packetPool.release(p); - return Routing_Error_BAD_REQUEST; + return meshtastic_Routing_Error_BAD_REQUEST; } // should have already been handled by sendLocal // Abort sending if we are violating the duty cycle @@ -204,7 +204,7 @@ ErrorCode Router::send(MeshPacket *p) if (hourlyTxPercent > myRegion->dutyCycle) { uint8_t silentMinutes = airTime->getSilentMinutes(hourlyTxPercent, myRegion->dutyCycle); LOG_WARN("Duty cycle limit exceeded. Aborting send for now, you can send again in %d minutes.\n", silentMinutes); - Routing_Error err = Routing_Error_DUTY_CYCLE_LIMIT; + meshtastic_Routing_Error err = meshtastic_Routing_Error_DUTY_CYCLE_LIMIT; if (getFrom(p) == nodeDB.getNodeNum()) { // only send NAK to API, not to the mesh abortSendAndNak(err, p); } else { @@ -228,11 +228,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) - assert(p->which_payload_variant == MeshPacket_encrypted_tag || - p->which_payload_variant == MeshPacket_decoded_tag); // I _think_ all packets should have a payload by now + assert(p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag || + p->which_payload_variant == meshtastic_MeshPacket_decoded_tag); // I _think_ all packets should have a payload by now // If the packet is not yet encrypted, do so now - if (p->which_payload_variant == MeshPacket_decoded_tag) { + if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { ChannelIndex chIndex = p->channel; // keep as a local because we are about to change it bool shouldActuallyEncrypt = true; @@ -264,7 +264,7 @@ ErrorCode Router::send(MeshPacket *p) #endif auto encodeResult = perhapsEncode(p); - if (encodeResult != Routing_Error_NONE) { + if (encodeResult != meshtastic_Routing_Error_NONE) { abortSendAndNak(encodeResult, p); return encodeResult; // FIXME - this isn't a valid ErrorCode } @@ -293,17 +293,17 @@ bool Router::cancelSending(NodeNum from, PacketId id) * Every (non duplicate) packet this node receives will be passed through this method. This allows subclasses to * update routing tables etc... based on what we overhear (even for messages not destined to our node) */ -void Router::sniffReceived(const MeshPacket *p, const Routing *c) +void Router::sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c) { // FIXME, update nodedb here for any packet that passes through us } -bool perhapsDecode(MeshPacket *p) +bool perhapsDecode(meshtastic_MeshPacket *p) { // LOG_DEBUG("\n\n** perhapsDecode payloadVariant - %d\n\n", p->which_payloadVariant); - if (p->which_payload_variant == MeshPacket_decoded_tag) + if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) return true; // If packet was already decoded just return // assert(p->which_payloadVariant == MeshPacket_encrypted_tag); @@ -323,20 +323,20 @@ bool perhapsDecode(MeshPacket *p) // Take those raw bytes and convert them back into a well structured protobuf we can understand memset(&p->decoded, 0, sizeof(p->decoded)); - if (!pb_decode_from_bytes(bytes, rawSize, &Data_msg, &p->decoded)) { + if (!pb_decode_from_bytes(bytes, rawSize, &meshtastic_Data_msg, &p->decoded)) { LOG_ERROR("Invalid protobufs in received mesh packet (bad psk?)!\n"); - } else if (p->decoded.portnum == PortNum_UNKNOWN_APP) { + } else if (p->decoded.portnum == meshtastic_PortNum_UNKNOWN_APP) { LOG_ERROR("Invalid portnum (bad psk?)!\n"); } else { // parsing was successful - p->which_payload_variant = MeshPacket_decoded_tag; // change type to decoded + p->which_payload_variant = meshtastic_MeshPacket_decoded_tag; // change type to decoded p->channel = chIndex; // change to store the index instead of the hash // Decompress if needed. jm - if (p->decoded.portnum == PortNum_TEXT_MESSAGE_COMPRESSED_APP) { + if (p->decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_COMPRESSED_APP) { // Decompress the payload - char compressed_in[Constants_DATA_PAYLOAD_LEN] = {}; - char decompressed_out[Constants_DATA_PAYLOAD_LEN] = {}; + char compressed_in[meshtastic_Constants_DATA_PAYLOAD_LEN] = {}; + char decompressed_out[meshtastic_Constants_DATA_PAYLOAD_LEN] = {}; int decompressed_len; memcpy(compressed_in, p->decoded.payload.bytes, p->decoded.payload.size); @@ -348,7 +348,7 @@ bool perhapsDecode(MeshPacket *p) memcpy(p->decoded.payload.bytes, decompressed_out, decompressed_len); // Switch the port from PortNum_TEXT_MESSAGE_COMPRESSED_APP to PortNum_TEXT_MESSAGE_APP - p->decoded.portnum = PortNum_TEXT_MESSAGE_APP; + p->decoded.portnum = meshtastic_PortNum_TEXT_MESSAGE_APP; } printPacket("decoded message", p); @@ -363,21 +363,21 @@ bool perhapsDecode(MeshPacket *p) /** Return 0 for success or a Routing_Errror code for failure */ -Routing_Error perhapsEncode(MeshPacket *p) +meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p) { // If the packet is not yet encrypted, do so now - if (p->which_payload_variant == MeshPacket_decoded_tag) { + if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { - size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &Data_msg, &p->decoded); + size_t numbytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_Data_msg, &p->decoded); // Only allow encryption on the text message app. // TODO: Allow modules to opt into compression. - if (p->decoded.portnum == PortNum_TEXT_MESSAGE_APP) { + if (p->decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP) { - char original_payload[Constants_DATA_PAYLOAD_LEN]; + char original_payload[meshtastic_Constants_DATA_PAYLOAD_LEN]; memcpy(original_payload, p->decoded.payload.bytes, p->decoded.payload.size); - char compressed_out[Constants_DATA_PAYLOAD_LEN] = {0}; + char compressed_out[meshtastic_Constants_DATA_PAYLOAD_LEN] = {0}; int compressed_len; compressed_len = unishox2_compress_simple(original_payload, p->decoded.payload.size, compressed_out); @@ -401,12 +401,12 @@ Routing_Error perhapsEncode(MeshPacket *p) p->decoded.payload.size = compressed_len; memcpy(p->decoded.payload.bytes, compressed_out, compressed_len); - p->decoded.portnum = PortNum_TEXT_MESSAGE_COMPRESSED_APP; + p->decoded.portnum = meshtastic_PortNum_TEXT_MESSAGE_COMPRESSED_APP; } } if (numbytes > MAX_RHPACKETLEN) - return Routing_Error_TOO_LARGE; + return meshtastic_Routing_Error_TOO_LARGE; // printBytes("plaintext", bytes, numbytes); @@ -414,7 +414,7 @@ Routing_Error perhapsEncode(MeshPacket *p) auto hash = channels.setActiveByIndex(chIndex); if (hash < 0) // No suitable channel could be found for sending - return Routing_Error_NO_CHANNEL; + return meshtastic_Routing_Error_NO_CHANNEL; // Now that we are encrypting the packet channel should be the hash (no longer the index) p->channel = hash; @@ -423,10 +423,10 @@ Routing_Error perhapsEncode(MeshPacket *p) // Copy back into the packet and set the variant type memcpy(p->encrypted.bytes, bytes, numbytes); p->encrypted.size = numbytes; - p->which_payload_variant = MeshPacket_encrypted_tag; + p->which_payload_variant = meshtastic_MeshPacket_encrypted_tag; } - return Routing_Error_NONE; + return meshtastic_Routing_Error_NONE; } NodeNum Router::getNodeNum() @@ -438,7 +438,7 @@ NodeNum Router::getNodeNum() * Handle any packet that is received by an interface on this node. * Note: some packets may merely being passed through this node and will be forwarded elsewhere. */ -void Router::handleReceived(MeshPacket *p, RxSource src) +void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src) { // Also, we should set the time from the ISR and it should have msec level resolution p->rx_time = getValidTime(RTCQualityFromNet); // store the arrival timestamp for the phone @@ -461,7 +461,7 @@ void Router::handleReceived(MeshPacket *p, RxSource src) MeshModule::callPlugins(*p, src); } -void Router::perhapsHandleReceived(MeshPacket *p) +void Router::perhapsHandleReceived(meshtastic_MeshPacket *p) { // assert(radioConfig.has_preferences); bool ignore = is_in_repeated(config.lora.ignore_incoming, p->from); diff --git a/src/mesh/Router.h b/src/mesh/Router.h index 5a9cc0702..8e116dca0 100644 --- a/src/mesh/Router.h +++ b/src/mesh/Router.h @@ -16,7 +16,7 @@ class Router : protected concurrency::OSThread private: /// Packets which have just arrived from the radio, ready to be processed by this service and possibly /// forwarded to the phone. - PointerQueue fromRadioQueue; + PointerQueue fromRadioQueue; protected: RadioInterface *iface = NULL; @@ -45,7 +45,7 @@ class Router : protected concurrency::OSThread * * NOTE: This method will free the provided packet (even if we return an error code) */ - ErrorCode sendLocal(MeshPacket *p, RxSource src = RX_SRC_RADIO); + ErrorCode sendLocal(meshtastic_MeshPacket *p, RxSource src = RX_SRC_RADIO); /** Attempt to cancel a previously sent packet. Returns true if a packet was found we could cancel */ bool cancelSending(NodeNum from, PacketId id); @@ -53,10 +53,10 @@ class Router : protected concurrency::OSThread /** Allocate and return a meshpacket which defaults as send to broadcast from the current node. * The returned packet is guaranteed to have a unique packet ID already assigned */ - MeshPacket *allocForSending(); + meshtastic_MeshPacket *allocForSending(); /** Return Underlying interface's TX queue status */ - QueueStatus getQueueStatus(); + meshtastic_QueueStatus getQueueStatus(); /** * @return our local nodenum */ @@ -71,7 +71,7 @@ class Router : protected concurrency::OSThread * RadioInterface calls this to queue up packets that have been received from the radio. The router is now responsible for * freeing the packet */ - void enqueueReceivedMessage(MeshPacket *p); + void enqueueReceivedMessage(meshtastic_MeshPacket *p); protected: friend class RoutingModule; @@ -83,7 +83,7 @@ class Router : protected concurrency::OSThread * * NOTE: This method will free the provided packet (even if we return an error code) */ - virtual ErrorCode send(MeshPacket *p); + virtual ErrorCode send(meshtastic_MeshPacket *p); /** * Should this incoming filter be dropped? @@ -93,18 +93,18 @@ class Router : protected concurrency::OSThread * Called immedately on receiption, before any further processing. * @return true to abandon the packet */ - virtual bool shouldFilterReceived(const MeshPacket *p) { return false; } + virtual bool shouldFilterReceived(const meshtastic_MeshPacket *p) { return false; } /** * Every (non duplicate) packet this node receives will be passed through this method. This allows subclasses to * update routing tables etc... based on what we overhear (even for messages not destined to our node) */ - virtual void sniffReceived(const MeshPacket *p, const Routing *c); + virtual void sniffReceived(const meshtastic_MeshPacket *p, const meshtastic_Routing *c); /** * Send an ack or a nak packet back towards whoever sent idFrom */ - void sendAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex); + void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex); private: /** @@ -115,7 +115,7 @@ class Router : protected concurrency::OSThread * Note: this packet will never be called for messages sent/generated by this node. * Note: this method will free the provided packet. */ - void perhapsHandleReceived(MeshPacket *p); + void perhapsHandleReceived(meshtastic_MeshPacket *p); /** * Called from perhapsHandleReceived() - allows subclass message delivery behavior. @@ -125,10 +125,10 @@ class Router : protected concurrency::OSThread * Note: this packet will never be called for messages sent/generated by this node. * Note: this method will free the provided packet. */ - void handleReceived(MeshPacket *p, RxSource src = RX_SRC_RADIO); + void handleReceived(meshtastic_MeshPacket *p, RxSource src = RX_SRC_RADIO); /** Frees the provided packet, and generates a NAK indicating the speicifed error while sending */ - void abortSendAndNak(Routing_Error err, MeshPacket *p); + void abortSendAndNak(meshtastic_Routing_Error err, meshtastic_MeshPacket *p); }; /** FIXME - move this into a mesh packet class @@ -136,11 +136,11 @@ class Router : protected concurrency::OSThread * * @return true for success, false for corrupt packet. */ -bool perhapsDecode(MeshPacket *p); +bool perhapsDecode(meshtastic_MeshPacket *p); /** Return 0 for success or a Routing_Errror code for failure */ -Routing_Error perhapsEncode(MeshPacket *p); +meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p); extern Router *router; diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index 2fc4084f7..7fadb7997 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -115,15 +115,15 @@ template bool SX126xInterface::reconfigure() // configure publicly accessible settings int err = lora.setSpreadingFactor(sf); if (err != RADIOLIB_ERR_NONE) - RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); err = lora.setBandwidth(bw); if (err != RADIOLIB_ERR_NONE) - RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); err = lora.setCodingRate(cr); if (err != RADIOLIB_ERR_NONE) - RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); // Hmm - seems to lower SNR when the signal levels are high. Leaving off for now... // TODO: Confirm gain registers are okay now @@ -141,7 +141,7 @@ template bool SX126xInterface::reconfigure() err = lora.setFrequency(getFreq()); if (err != RADIOLIB_ERR_NONE) - RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); if (power > SX126X_MAX_POWER) // This chip has lower power limits than some power = SX126X_MAX_POWER; @@ -185,7 +185,7 @@ template void SX126xInterface::setStandby() /** * Add SNR data to received messages */ -template void SX126xInterface::addReceiveMetadata(MeshPacket *mp) +template void SX126xInterface::addReceiveMetadata(meshtastic_MeshPacket *mp) { // LOG_DEBUG("PacketStatus %x\n", lora.getPacketStatus()); mp->rx_snr = lora.getSNR(); diff --git a/src/mesh/SX126xInterface.h b/src/mesh/SX126xInterface.h index 9a77ab70f..a773fd71f 100644 --- a/src/mesh/SX126xInterface.h +++ b/src/mesh/SX126xInterface.h @@ -63,7 +63,7 @@ template class SX126xInterface : public RadioLibInterface /** * Add SNR data to received messages */ - virtual void addReceiveMetadata(MeshPacket *mp) override; + virtual void addReceiveMetadata(meshtastic_MeshPacket *mp) override; virtual void setStandby() override; diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index a8a1b7240..c984d9f05 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -55,9 +55,9 @@ template bool SX128xInterface::init() // \todo Display actual typename of the adapter, not just `SX128x` LOG_INFO("SX128x init result %d\n", res); - if ((config.lora.region != Config_LoRaConfig_RegionCode_LORA_24) && (res == RADIOLIB_ERR_INVALID_FREQUENCY)) { + if ((config.lora.region != meshtastic_Config_LoRaConfig_RegionCode_LORA_24) && (res == RADIOLIB_ERR_INVALID_FREQUENCY)) { LOG_WARN("Radio chip only supports 2.4GHz LoRa. Adjusting Region and rebooting.\n"); - config.lora.region = Config_LoRaConfig_RegionCode_LORA_24; + config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_LORA_24; nodeDB.saveToDisk(SEGMENT_CONFIG); delay(2000); #if defined(ARCH_ESP32) @@ -92,15 +92,15 @@ template bool SX128xInterface::reconfigure() // configure publicly accessible settings int err = lora.setSpreadingFactor(sf); if (err != RADIOLIB_ERR_NONE) - RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); err = lora.setBandwidth(bw); if (err != RADIOLIB_ERR_NONE) - RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); err = lora.setCodingRate(cr); if (err != RADIOLIB_ERR_NONE) - RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); // Hmm - seems to lower SNR when the signal levels are high. Leaving off for now... // TODO: Confirm gain registers are okay now @@ -115,7 +115,7 @@ template bool SX128xInterface::reconfigure() err = lora.setFrequency(getFreq()); if (err != RADIOLIB_ERR_NONE) - RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING); if (power > SX128X_MAX_POWER) // This chip has lower power limits than some power = SX128X_MAX_POWER; @@ -164,7 +164,7 @@ template void SX128xInterface::setStandby() /** * Add SNR data to received messages */ -template void SX128xInterface::addReceiveMetadata(MeshPacket *mp) +template void SX128xInterface::addReceiveMetadata(meshtastic_MeshPacket *mp) { // LOG_DEBUG("PacketStatus %x\n", lora.getPacketStatus()); mp->rx_snr = lora.getSNR(); diff --git a/src/mesh/SX128xInterface.h b/src/mesh/SX128xInterface.h index 6028ed992..235d39ee0 100644 --- a/src/mesh/SX128xInterface.h +++ b/src/mesh/SX128xInterface.h @@ -63,7 +63,7 @@ template class SX128xInterface : public RadioLibInterface /** * Add SNR data to received messages */ - virtual void addReceiveMetadata(MeshPacket *mp) override; + virtual void addReceiveMetadata(meshtastic_MeshPacket *mp) override; virtual void setStandby() override; diff --git a/src/mesh/SinglePortModule.h b/src/mesh/SinglePortModule.h index 2e587cb89..6fa69d964 100644 --- a/src/mesh/SinglePortModule.h +++ b/src/mesh/SinglePortModule.h @@ -9,29 +9,29 @@ class SinglePortModule : public MeshModule { protected: - PortNum ourPortNum; + meshtastic_PortNum ourPortNum; public: /** Constructor * name is for debugging output */ - SinglePortModule(const char *_name, PortNum _ourPortNum) : MeshModule(_name), ourPortNum(_ourPortNum) {} + SinglePortModule(const char *_name, meshtastic_PortNum _ourPortNum) : MeshModule(_name), ourPortNum(_ourPortNum) {} protected: /** * @return true if you want to receive the specified portnum */ - virtual bool wantPacket(const MeshPacket *p) override { return p->decoded.portnum == ourPortNum; } + virtual bool wantPacket(const meshtastic_MeshPacket *p) override { return p->decoded.portnum == ourPortNum; } /** * Return a mesh packet which has been preinited as a data packet with a particular port number. * You can then send this packet (after customizing any of the payload fields you might need) with * service.sendToMesh() */ - MeshPacket *allocDataPacket() + meshtastic_MeshPacket *allocDataPacket() { // Update our local node info with our position (even if we don't decide to update anyone else) - MeshPacket *p = router->allocForSending(); + meshtastic_MeshPacket *p = router->allocForSending(); p->decoded.portnum = ourPortNum; return p; diff --git a/src/mesh/StreamAPI.cpp b/src/mesh/StreamAPI.cpp index b3ffa1682..4d04dffe4 100644 --- a/src/mesh/StreamAPI.cpp +++ b/src/mesh/StreamAPI.cpp @@ -112,11 +112,11 @@ void StreamAPI::emitRebooted() { // In case we send a FromRadio packet memset(&fromRadioScratch, 0, sizeof(fromRadioScratch)); - fromRadioScratch.which_payload_variant = FromRadio_rebooted_tag; + fromRadioScratch.which_payload_variant = meshtastic_FromRadio_rebooted_tag; fromRadioScratch.rebooted = true; // LOG_DEBUG("Emitting reboot packet for serial shell\n"); - emitTxBuffer(pb_encode_to_bytes(txBuf + HEADER_LEN, FromRadio_size, &FromRadio_msg, &fromRadioScratch)); + emitTxBuffer(pb_encode_to_bytes(txBuf + HEADER_LEN, meshtastic_FromRadio_size, &meshtastic_FromRadio_msg, &fromRadioScratch)); } /// Hookable to find out when connection changes diff --git a/src/mesh/eth/ethClient.cpp b/src/mesh/eth/ethClient.cpp index 6a7235af6..80208825c 100644 --- a/src/mesh/eth/ethClient.cpp +++ b/src/mesh/eth/ethClient.cpp @@ -96,10 +96,10 @@ bool initEthernet() getMacAddr(mac); // FIXME use the BLE MAC for now... mac[0] &= 0xfe; // Make sure this is not a multicast MAC - if (config.network.address_mode == Config_NetworkConfig_AddressMode_DHCP) { + if (config.network.address_mode == meshtastic_Config_NetworkConfig_AddressMode_DHCP) { LOG_INFO("starting Ethernet DHCP\n"); status = Ethernet.begin(mac); - } else if (config.network.address_mode == Config_NetworkConfig_AddressMode_STATIC) { + } else if (config.network.address_mode == meshtastic_Config_NetworkConfig_AddressMode_STATIC) { LOG_INFO("starting Ethernet Static\n"); Ethernet.begin(mac, config.network.ipv4_config.ip, config.network.ipv4_config.dns, config.network.ipv4_config.subnet); } else { diff --git a/src/mesh/generated/meshtastic/admin.pb.c b/src/mesh/generated/meshtastic/admin.pb.c index 8677e0feb..1f668dabc 100644 --- a/src/mesh/generated/meshtastic/admin.pb.c +++ b/src/mesh/generated/meshtastic/admin.pb.c @@ -1,12 +1,12 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./admin.pb.h" +#include "meshtastic/admin.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(AdminMessage, AdminMessage, 2) +PB_BIND(meshtastic_AdminMessage, meshtastic_AdminMessage, 2) diff --git a/src/mesh/generated/meshtastic/admin.pb.h b/src/mesh/generated/meshtastic/admin.pb.h index 83aa7bbff..5caa22bb7 100644 --- a/src/mesh/generated/meshtastic/admin.pb.h +++ b/src/mesh/generated/meshtastic/admin.pb.h @@ -4,11 +4,11 @@ #ifndef PB_MESHTASTIC_MESHTASTIC_ADMIN_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_ADMIN_PB_H_INCLUDED #include -#include "./channel.pb.h" -#include "./config.pb.h" -#include "./device_metadata.pb.h" -#include "./mesh.pb.h" -#include "./module_config.pb.h" +#include "meshtastic/channel.pb.h" +#include "meshtastic/config.pb.h" +#include "meshtastic/device_metadata.pb.h" +#include "meshtastic/mesh.pb.h" +#include "meshtastic/module_config.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. @@ -16,69 +16,69 @@ /* Enum definitions */ /* TODO: REPLACE */ -typedef enum _AdminMessage_ConfigType { +typedef enum _meshtastic_AdminMessage_ConfigType { /* TODO: REPLACE */ - AdminMessage_ConfigType_DEVICE_CONFIG = 0, + meshtastic_AdminMessage_ConfigType_DEVICE_CONFIG = 0, /* TODO: REPLACE */ - AdminMessage_ConfigType_POSITION_CONFIG = 1, + meshtastic_AdminMessage_ConfigType_POSITION_CONFIG = 1, /* TODO: REPLACE */ - AdminMessage_ConfigType_POWER_CONFIG = 2, + meshtastic_AdminMessage_ConfigType_POWER_CONFIG = 2, /* TODO: REPLACE */ - AdminMessage_ConfigType_NETWORK_CONFIG = 3, + meshtastic_AdminMessage_ConfigType_NETWORK_CONFIG = 3, /* TODO: REPLACE */ - AdminMessage_ConfigType_DISPLAY_CONFIG = 4, + meshtastic_AdminMessage_ConfigType_DISPLAY_CONFIG = 4, /* TODO: REPLACE */ - AdminMessage_ConfigType_LORA_CONFIG = 5, + meshtastic_AdminMessage_ConfigType_LORA_CONFIG = 5, /* TODO: REPLACE */ - AdminMessage_ConfigType_BLUETOOTH_CONFIG = 6 -} AdminMessage_ConfigType; + meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG = 6 +} meshtastic_AdminMessage_ConfigType; /* TODO: REPLACE */ -typedef enum _AdminMessage_ModuleConfigType { +typedef enum _meshtastic_AdminMessage_ModuleConfigType { /* TODO: REPLACE */ - AdminMessage_ModuleConfigType_MQTT_CONFIG = 0, + meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG = 0, /* TODO: REPLACE */ - AdminMessage_ModuleConfigType_SERIAL_CONFIG = 1, + meshtastic_AdminMessage_ModuleConfigType_SERIAL_CONFIG = 1, /* TODO: REPLACE */ - AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG = 2, + meshtastic_AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG = 2, /* TODO: REPLACE */ - AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG = 3, + meshtastic_AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG = 3, /* TODO: REPLACE */ - AdminMessage_ModuleConfigType_RANGETEST_CONFIG = 4, + meshtastic_AdminMessage_ModuleConfigType_RANGETEST_CONFIG = 4, /* TODO: REPLACE */ - AdminMessage_ModuleConfigType_TELEMETRY_CONFIG = 5, + meshtastic_AdminMessage_ModuleConfigType_TELEMETRY_CONFIG = 5, /* TODO: REPLACE */ - AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG = 6, + meshtastic_AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG = 6, /* TODO: REPLACE */ - AdminMessage_ModuleConfigType_AUDIO_CONFIG = 7, + meshtastic_AdminMessage_ModuleConfigType_AUDIO_CONFIG = 7, /* TODO: REPLACE */ - AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG = 8 -} AdminMessage_ModuleConfigType; + meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG = 8 +} meshtastic_AdminMessage_ModuleConfigType; /* Struct definitions */ /* This message is handled by the Admin module and is responsible for all settings/channel read/write operations. This message is used to do settings operations to both remote AND local nodes. (Prior to 1.2 these operations were done via special ToRadio operations) */ -typedef struct _AdminMessage { +typedef struct _meshtastic_AdminMessage { pb_size_t which_payload_variant; union { /* Send the specified channel in the response to this message NOTE: This field is sent with the channel index + 1 (to ensure we never try to send 'zero' - which protobufs treats as not present) */ uint32_t get_channel_request; /* TODO: REPLACE */ - Channel get_channel_response; + meshtastic_Channel get_channel_response; /* Send the current owner data in the response to this message. */ bool get_owner_request; /* TODO: REPLACE */ - User get_owner_response; + meshtastic_User get_owner_response; /* Ask for the following config data to be sent */ - AdminMessage_ConfigType get_config_request; + meshtastic_AdminMessage_ConfigType get_config_request; /* Send the current Config in the response to this message. */ - Config get_config_response; + meshtastic_Config get_config_response; /* Ask for the following config data to be sent */ - AdminMessage_ModuleConfigType get_module_config_request; + meshtastic_AdminMessage_ModuleConfigType get_module_config_request; /* Send the current Config in the response to this message. */ - ModuleConfig get_module_config_response; + meshtastic_ModuleConfig get_module_config_response; /* Get the Canned Message Module messages in the response to this message. */ bool get_canned_message_module_messages_request; /* Get the Canned Message Module messages in the response to this message. */ @@ -86,23 +86,23 @@ typedef struct _AdminMessage { /* Request the node to send device metadata (firmware, protobuf version, etc) */ bool get_device_metadata_request; /* Device metadata response */ - DeviceMetadata get_device_metadata_response; + meshtastic_DeviceMetadata get_device_metadata_response; /* Get the Ringtone in the response to this message. */ bool get_ringtone_request; /* Get the Ringtone in the response to this message. */ char get_ringtone_response[231]; /* Set the owner for this node */ - User set_owner; + meshtastic_User set_owner; /* Set channels (using the new API). A special channel is the "primary channel". The other records are secondary channels. Note: only one channel can be marked as primary. If the client sets a particular channel to be primary, the previous channel will be set to SECONDARY automatically. */ - Channel set_channel; + meshtastic_Channel set_channel; /* Set the current Config */ - Config set_config; + meshtastic_Config set_config; /* Set the current Config */ - ModuleConfig set_module_config; + meshtastic_ModuleConfig set_module_config; /* Set the Canned Message Module messages text. */ char set_canned_message_module_messages[201]; /* Set the ringtone for ExternalNotification. */ @@ -134,7 +134,7 @@ typedef struct _AdminMessage { /* Tell the node to reset the nodedb. */ int32_t nodedb_reset; }; -} AdminMessage; +} meshtastic_AdminMessage; #ifdef __cplusplus @@ -142,56 +142,56 @@ extern "C" { #endif /* Helper constants for enums */ -#define _AdminMessage_ConfigType_MIN AdminMessage_ConfigType_DEVICE_CONFIG -#define _AdminMessage_ConfigType_MAX AdminMessage_ConfigType_BLUETOOTH_CONFIG -#define _AdminMessage_ConfigType_ARRAYSIZE ((AdminMessage_ConfigType)(AdminMessage_ConfigType_BLUETOOTH_CONFIG+1)) +#define _meshtastic_AdminMessage_ConfigType_MIN meshtastic_AdminMessage_ConfigType_DEVICE_CONFIG +#define _meshtastic_AdminMessage_ConfigType_MAX meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG +#define _meshtastic_AdminMessage_ConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ConfigType)(meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG+1)) -#define _AdminMessage_ModuleConfigType_MIN AdminMessage_ModuleConfigType_MQTT_CONFIG -#define _AdminMessage_ModuleConfigType_MAX AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG -#define _AdminMessage_ModuleConfigType_ARRAYSIZE ((AdminMessage_ModuleConfigType)(AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG+1)) +#define _meshtastic_AdminMessage_ModuleConfigType_MIN meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG +#define _meshtastic_AdminMessage_ModuleConfigType_MAX meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG +#define _meshtastic_AdminMessage_ModuleConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ModuleConfigType)(meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG+1)) -#define AdminMessage_payload_variant_get_config_request_ENUMTYPE AdminMessage_ConfigType -#define AdminMessage_payload_variant_get_module_config_request_ENUMTYPE AdminMessage_ModuleConfigType +#define meshtastic_AdminMessage_payload_variant_get_config_request_ENUMTYPE meshtastic_AdminMessage_ConfigType +#define meshtastic_AdminMessage_payload_variant_get_module_config_request_ENUMTYPE meshtastic_AdminMessage_ModuleConfigType /* Initializer values for message structs */ -#define AdminMessage_init_default {0, {0}} -#define AdminMessage_init_zero {0, {0}} +#define meshtastic_AdminMessage_init_default {0, {0}} +#define meshtastic_AdminMessage_init_zero {0, {0}} /* Field tags (for use in manual encoding/decoding) */ -#define AdminMessage_get_channel_request_tag 1 -#define AdminMessage_get_channel_response_tag 2 -#define AdminMessage_get_owner_request_tag 3 -#define AdminMessage_get_owner_response_tag 4 -#define AdminMessage_get_config_request_tag 5 -#define AdminMessage_get_config_response_tag 6 -#define AdminMessage_get_module_config_request_tag 7 -#define AdminMessage_get_module_config_response_tag 8 -#define AdminMessage_get_canned_message_module_messages_request_tag 10 -#define AdminMessage_get_canned_message_module_messages_response_tag 11 -#define AdminMessage_get_device_metadata_request_tag 12 -#define AdminMessage_get_device_metadata_response_tag 13 -#define AdminMessage_get_ringtone_request_tag 14 -#define AdminMessage_get_ringtone_response_tag 15 -#define AdminMessage_set_owner_tag 32 -#define AdminMessage_set_channel_tag 33 -#define AdminMessage_set_config_tag 34 -#define AdminMessage_set_module_config_tag 35 -#define AdminMessage_set_canned_message_module_messages_tag 36 -#define AdminMessage_set_ringtone_message_tag 37 -#define AdminMessage_begin_edit_settings_tag 64 -#define AdminMessage_commit_edit_settings_tag 65 -#define AdminMessage_confirm_set_channel_tag 66 -#define AdminMessage_confirm_set_radio_tag 67 -#define AdminMessage_reboot_ota_seconds_tag 95 -#define AdminMessage_exit_simulator_tag 96 -#define AdminMessage_reboot_seconds_tag 97 -#define AdminMessage_shutdown_seconds_tag 98 -#define AdminMessage_factory_reset_tag 99 -#define AdminMessage_nodedb_reset_tag 100 +#define meshtastic_AdminMessage_get_channel_request_tag 1 +#define meshtastic_AdminMessage_get_channel_response_tag 2 +#define meshtastic_AdminMessage_get_owner_request_tag 3 +#define meshtastic_AdminMessage_get_owner_response_tag 4 +#define meshtastic_AdminMessage_get_config_request_tag 5 +#define meshtastic_AdminMessage_get_config_response_tag 6 +#define meshtastic_AdminMessage_get_module_config_request_tag 7 +#define meshtastic_AdminMessage_get_module_config_response_tag 8 +#define meshtastic_AdminMessage_get_canned_message_module_messages_request_tag 10 +#define meshtastic_AdminMessage_get_canned_message_module_messages_response_tag 11 +#define meshtastic_AdminMessage_get_device_metadata_request_tag 12 +#define meshtastic_AdminMessage_get_device_metadata_response_tag 13 +#define meshtastic_AdminMessage_get_ringtone_request_tag 14 +#define meshtastic_AdminMessage_get_ringtone_response_tag 15 +#define meshtastic_AdminMessage_set_owner_tag 32 +#define meshtastic_AdminMessage_set_channel_tag 33 +#define meshtastic_AdminMessage_set_config_tag 34 +#define meshtastic_AdminMessage_set_module_config_tag 35 +#define meshtastic_AdminMessage_set_canned_message_module_messages_tag 36 +#define meshtastic_AdminMessage_set_ringtone_message_tag 37 +#define meshtastic_AdminMessage_begin_edit_settings_tag 64 +#define meshtastic_AdminMessage_commit_edit_settings_tag 65 +#define meshtastic_AdminMessage_confirm_set_channel_tag 66 +#define meshtastic_AdminMessage_confirm_set_radio_tag 67 +#define meshtastic_AdminMessage_reboot_ota_seconds_tag 95 +#define meshtastic_AdminMessage_exit_simulator_tag 96 +#define meshtastic_AdminMessage_reboot_seconds_tag 97 +#define meshtastic_AdminMessage_shutdown_seconds_tag 98 +#define meshtastic_AdminMessage_factory_reset_tag 99 +#define meshtastic_AdminMessage_nodedb_reset_tag 100 /* Struct field encoding specification for nanopb */ -#define AdminMessage_FIELDLIST(X, a) \ +#define meshtastic_AdminMessage_FIELDLIST(X, a) \ X(a, STATIC, ONEOF, UINT32, (payload_variant,get_channel_request,get_channel_request), 1) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_channel_response,get_channel_response), 2) \ X(a, STATIC, ONEOF, BOOL, (payload_variant,get_owner_request,get_owner_request), 3) \ @@ -222,25 +222,25 @@ X(a, STATIC, ONEOF, INT32, (payload_variant,reboot_seconds,reboot_second X(a, STATIC, ONEOF, INT32, (payload_variant,shutdown_seconds,shutdown_seconds), 98) \ X(a, STATIC, ONEOF, INT32, (payload_variant,factory_reset,factory_reset), 99) \ X(a, STATIC, ONEOF, INT32, (payload_variant,nodedb_reset,nodedb_reset), 100) -#define AdminMessage_CALLBACK NULL -#define AdminMessage_DEFAULT NULL -#define AdminMessage_payload_variant_get_channel_response_MSGTYPE Channel -#define AdminMessage_payload_variant_get_owner_response_MSGTYPE User -#define AdminMessage_payload_variant_get_config_response_MSGTYPE Config -#define AdminMessage_payload_variant_get_module_config_response_MSGTYPE ModuleConfig -#define AdminMessage_payload_variant_get_device_metadata_response_MSGTYPE DeviceMetadata -#define AdminMessage_payload_variant_set_owner_MSGTYPE User -#define AdminMessage_payload_variant_set_channel_MSGTYPE Channel -#define AdminMessage_payload_variant_set_config_MSGTYPE Config -#define AdminMessage_payload_variant_set_module_config_MSGTYPE ModuleConfig +#define meshtastic_AdminMessage_CALLBACK NULL +#define meshtastic_AdminMessage_DEFAULT NULL +#define meshtastic_AdminMessage_payload_variant_get_channel_response_MSGTYPE meshtastic_Channel +#define meshtastic_AdminMessage_payload_variant_get_owner_response_MSGTYPE meshtastic_User +#define meshtastic_AdminMessage_payload_variant_get_config_response_MSGTYPE meshtastic_Config +#define meshtastic_AdminMessage_payload_variant_get_module_config_response_MSGTYPE meshtastic_ModuleConfig +#define meshtastic_AdminMessage_payload_variant_get_device_metadata_response_MSGTYPE meshtastic_DeviceMetadata +#define meshtastic_AdminMessage_payload_variant_set_owner_MSGTYPE meshtastic_User +#define meshtastic_AdminMessage_payload_variant_set_channel_MSGTYPE meshtastic_Channel +#define meshtastic_AdminMessage_payload_variant_set_config_MSGTYPE meshtastic_Config +#define meshtastic_AdminMessage_payload_variant_set_module_config_MSGTYPE meshtastic_ModuleConfig -extern const pb_msgdesc_t AdminMessage_msg; +extern const pb_msgdesc_t meshtastic_AdminMessage_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define AdminMessage_fields &AdminMessage_msg +#define meshtastic_AdminMessage_fields &meshtastic_AdminMessage_msg /* Maximum encoded size of messages (where known) */ -#define AdminMessage_size 234 +#define meshtastic_AdminMessage_size 234 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/apponly.pb.c b/src/mesh/generated/meshtastic/apponly.pb.c index 8360eaa34..8c3801ed7 100644 --- a/src/mesh/generated/meshtastic/apponly.pb.c +++ b/src/mesh/generated/meshtastic/apponly.pb.c @@ -1,12 +1,12 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./apponly.pb.h" +#include "meshtastic/apponly.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(ChannelSet, ChannelSet, 2) +PB_BIND(meshtastic_ChannelSet, meshtastic_ChannelSet, 2) diff --git a/src/mesh/generated/meshtastic/apponly.pb.h b/src/mesh/generated/meshtastic/apponly.pb.h index a37ba8ab5..187df98d4 100644 --- a/src/mesh/generated/meshtastic/apponly.pb.h +++ b/src/mesh/generated/meshtastic/apponly.pb.h @@ -4,8 +4,8 @@ #ifndef PB_MESHTASTIC_MESHTASTIC_APPONLY_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_APPONLY_PB_H_INCLUDED #include -#include "./channel.pb.h" -#include "./config.pb.h" +#include "meshtastic/channel.pb.h" +#include "meshtastic/config.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. @@ -17,14 +17,14 @@ any SECONDARY channels. No DISABLED channels are included. This abstraction is used only on the the 'app side' of the world (ie python, javascript and android etc) to show a group of Channels as a (long) URL */ -typedef struct _ChannelSet { +typedef struct _meshtastic_ChannelSet { /* Channel list with settings */ pb_size_t settings_count; - ChannelSettings settings[8]; + meshtastic_ChannelSettings settings[8]; /* LoRa config */ bool has_lora_config; - Config_LoRaConfig lora_config; -} ChannelSet; + meshtastic_Config_LoRaConfig lora_config; +} meshtastic_ChannelSet; #ifdef __cplusplus @@ -32,29 +32,29 @@ extern "C" { #endif /* Initializer values for message structs */ -#define ChannelSet_init_default {0, {ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default, ChannelSettings_init_default}, false, Config_LoRaConfig_init_default} -#define ChannelSet_init_zero {0, {ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero, ChannelSettings_init_zero}, false, Config_LoRaConfig_init_zero} +#define meshtastic_ChannelSet_init_default {0, {meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default, meshtastic_ChannelSettings_init_default}, false, meshtastic_Config_LoRaConfig_init_default} +#define meshtastic_ChannelSet_init_zero {0, {meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero, meshtastic_ChannelSettings_init_zero}, false, meshtastic_Config_LoRaConfig_init_zero} /* Field tags (for use in manual encoding/decoding) */ -#define ChannelSet_settings_tag 1 -#define ChannelSet_lora_config_tag 2 +#define meshtastic_ChannelSet_settings_tag 1 +#define meshtastic_ChannelSet_lora_config_tag 2 /* Struct field encoding specification for nanopb */ -#define ChannelSet_FIELDLIST(X, a) \ +#define meshtastic_ChannelSet_FIELDLIST(X, a) \ X(a, STATIC, REPEATED, MESSAGE, settings, 1) \ X(a, STATIC, OPTIONAL, MESSAGE, lora_config, 2) -#define ChannelSet_CALLBACK NULL -#define ChannelSet_DEFAULT NULL -#define ChannelSet_settings_MSGTYPE ChannelSettings -#define ChannelSet_lora_config_MSGTYPE Config_LoRaConfig +#define meshtastic_ChannelSet_CALLBACK NULL +#define meshtastic_ChannelSet_DEFAULT NULL +#define meshtastic_ChannelSet_settings_MSGTYPE meshtastic_ChannelSettings +#define meshtastic_ChannelSet_lora_config_MSGTYPE meshtastic_Config_LoRaConfig -extern const pb_msgdesc_t ChannelSet_msg; +extern const pb_msgdesc_t meshtastic_ChannelSet_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define ChannelSet_fields &ChannelSet_msg +#define meshtastic_ChannelSet_fields &meshtastic_ChannelSet_msg /* Maximum encoded size of messages (where known) */ -#define ChannelSet_size 584 +#define meshtastic_ChannelSet_size 584 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/cannedmessages.pb.c b/src/mesh/generated/meshtastic/cannedmessages.pb.c index 5fb8adfd0..fffa3fdf9 100644 --- a/src/mesh/generated/meshtastic/cannedmessages.pb.c +++ b/src/mesh/generated/meshtastic/cannedmessages.pb.c @@ -1,12 +1,12 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./cannedmessages.pb.h" +#include "meshtastic/cannedmessages.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(CannedMessageModuleConfig, CannedMessageModuleConfig, AUTO) +PB_BIND(meshtastic_CannedMessageModuleConfig, meshtastic_CannedMessageModuleConfig, AUTO) diff --git a/src/mesh/generated/meshtastic/cannedmessages.pb.h b/src/mesh/generated/meshtastic/cannedmessages.pb.h index e2f0426f2..b81f65d0d 100644 --- a/src/mesh/generated/meshtastic/cannedmessages.pb.h +++ b/src/mesh/generated/meshtastic/cannedmessages.pb.h @@ -11,10 +11,10 @@ /* Struct definitions */ /* Canned message module configuration. */ -typedef struct _CannedMessageModuleConfig { +typedef struct _meshtastic_CannedMessageModuleConfig { /* Predefined messages for canned message module separated by '|' characters. */ char messages[201]; -} CannedMessageModuleConfig; +} meshtastic_CannedMessageModuleConfig; #ifdef __cplusplus @@ -22,25 +22,25 @@ extern "C" { #endif /* Initializer values for message structs */ -#define CannedMessageModuleConfig_init_default {""} -#define CannedMessageModuleConfig_init_zero {""} +#define meshtastic_CannedMessageModuleConfig_init_default {""} +#define meshtastic_CannedMessageModuleConfig_init_zero {""} /* Field tags (for use in manual encoding/decoding) */ -#define CannedMessageModuleConfig_messages_tag 1 +#define meshtastic_CannedMessageModuleConfig_messages_tag 1 /* Struct field encoding specification for nanopb */ -#define CannedMessageModuleConfig_FIELDLIST(X, a) \ +#define meshtastic_CannedMessageModuleConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, STRING, messages, 1) -#define CannedMessageModuleConfig_CALLBACK NULL -#define CannedMessageModuleConfig_DEFAULT NULL +#define meshtastic_CannedMessageModuleConfig_CALLBACK NULL +#define meshtastic_CannedMessageModuleConfig_DEFAULT NULL -extern const pb_msgdesc_t CannedMessageModuleConfig_msg; +extern const pb_msgdesc_t meshtastic_CannedMessageModuleConfig_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define CannedMessageModuleConfig_fields &CannedMessageModuleConfig_msg +#define meshtastic_CannedMessageModuleConfig_fields &meshtastic_CannedMessageModuleConfig_msg /* Maximum encoded size of messages (where known) */ -#define CannedMessageModuleConfig_size 203 +#define meshtastic_CannedMessageModuleConfig_size 203 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/channel.pb.c b/src/mesh/generated/meshtastic/channel.pb.c index b22ec0b36..62585fd17 100644 --- a/src/mesh/generated/meshtastic/channel.pb.c +++ b/src/mesh/generated/meshtastic/channel.pb.c @@ -1,15 +1,15 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./channel.pb.h" +#include "meshtastic/channel.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(ChannelSettings, ChannelSettings, AUTO) +PB_BIND(meshtastic_ChannelSettings, meshtastic_ChannelSettings, AUTO) -PB_BIND(Channel, Channel, AUTO) +PB_BIND(meshtastic_Channel, meshtastic_Channel, AUTO) diff --git a/src/mesh/generated/meshtastic/channel.pb.h b/src/mesh/generated/meshtastic/channel.pb.h index 8c287eca8..83ef7b5fc 100644 --- a/src/mesh/generated/meshtastic/channel.pb.h +++ b/src/mesh/generated/meshtastic/channel.pb.h @@ -19,18 +19,18 @@ cross band routing as needed. If a device has only a single radio (the common case) only one channel can be PRIMARY at a time (but any number of SECONDARY channels can't be sent received on that common frequency) */ -typedef enum _Channel_Role { +typedef enum _meshtastic_Channel_Role { /* This channel is not in use right now */ - Channel_Role_DISABLED = 0, + meshtastic_Channel_Role_DISABLED = 0, /* This channel is used to set the frequency for the radio - all other enabled channels must be SECONDARY */ - Channel_Role_PRIMARY = 1, + meshtastic_Channel_Role_PRIMARY = 1, /* Secondary channels are only used for encryption/decryption/authentication purposes. Their radio settings (freq etc) are ignored, only psk is used. */ - Channel_Role_SECONDARY = 2 -} Channel_Role; + meshtastic_Channel_Role_SECONDARY = 2 +} meshtastic_Channel_Role; /* Struct definitions */ -typedef PB_BYTES_ARRAY_T(32) ChannelSettings_psk_t; +typedef PB_BYTES_ARRAY_T(32) meshtastic_ChannelSettings_psk_t; /* Full settings (center freq, spread factor, pre-shared secret key etc...) needed to configure a radio for speaking on a particular channel This information can be encoded as a QRcode/url so that other users can configure @@ -50,7 +50,7 @@ typedef PB_BYTES_ARRAY_T(32) ChannelSettings_psk_t; FIXME: Add description of multi-channel support and how primary vs secondary channels are used. FIXME: explain how apps use channels for security. explain how remote settings and remote gpio are managed as an example */ -typedef struct _ChannelSettings { +typedef struct _meshtastic_ChannelSettings { /* Deprecated in favor of LoraConfig.channel_num */ uint32_t channel_num; /* A simple pre-shared key for now for crypto. @@ -63,7 +63,7 @@ typedef struct _ChannelSettings { `1` = The special "default" channel key: {0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0x59, 0xf0, 0xbc, 0xff, 0xab, 0xcf, 0x4e, 0x69, 0xbf} `2` through 10 = The default channel key, except with 1 through 9 added to the last byte. Shown to user as simple1 through 10 */ - ChannelSettings_psk_t psk; + meshtastic_ChannelSettings_psk_t psk; /* A SHORT name that will be packed into the URL. Less than 12 bytes. Something for end users to call the channel @@ -89,20 +89,20 @@ typedef struct _ChannelSettings { bool uplink_enabled; /* If true, messages seen on the internet will be forwarded to the local mesh. */ bool downlink_enabled; -} ChannelSettings; +} meshtastic_ChannelSettings; /* A pair of a channel number, mode and the (sharable) settings for that channel */ -typedef struct _Channel { +typedef struct _meshtastic_Channel { /* The index of this channel in the channel table (from 0 to MAX_NUM_CHANNELS-1) (Someday - not currently implemented) An index of -1 could be used to mean "set by name", in which case the target node will find and set the channel by settings.name. */ int8_t index; /* The new settings, or NULL to disable that channel */ bool has_settings; - ChannelSettings settings; + meshtastic_ChannelSettings settings; /* TODO: REPLACE */ - Channel_Role role; -} Channel; + meshtastic_Channel_Role role; +} meshtastic_Channel; #ifdef __cplusplus @@ -110,60 +110,60 @@ extern "C" { #endif /* Helper constants for enums */ -#define _Channel_Role_MIN Channel_Role_DISABLED -#define _Channel_Role_MAX Channel_Role_SECONDARY -#define _Channel_Role_ARRAYSIZE ((Channel_Role)(Channel_Role_SECONDARY+1)) +#define _meshtastic_Channel_Role_MIN meshtastic_Channel_Role_DISABLED +#define _meshtastic_Channel_Role_MAX meshtastic_Channel_Role_SECONDARY +#define _meshtastic_Channel_Role_ARRAYSIZE ((meshtastic_Channel_Role)(meshtastic_Channel_Role_SECONDARY+1)) -#define Channel_role_ENUMTYPE Channel_Role +#define meshtastic_Channel_role_ENUMTYPE meshtastic_Channel_Role /* Initializer values for message structs */ -#define ChannelSettings_init_default {0, {0, {0}}, "", 0, 0, 0} -#define Channel_init_default {0, false, ChannelSettings_init_default, _Channel_Role_MIN} -#define ChannelSettings_init_zero {0, {0, {0}}, "", 0, 0, 0} -#define Channel_init_zero {0, false, ChannelSettings_init_zero, _Channel_Role_MIN} +#define meshtastic_ChannelSettings_init_default {0, {0, {0}}, "", 0, 0, 0} +#define meshtastic_Channel_init_default {0, false, meshtastic_ChannelSettings_init_default, _meshtastic_Channel_Role_MIN} +#define meshtastic_ChannelSettings_init_zero {0, {0, {0}}, "", 0, 0, 0} +#define meshtastic_Channel_init_zero {0, false, meshtastic_ChannelSettings_init_zero, _meshtastic_Channel_Role_MIN} /* Field tags (for use in manual encoding/decoding) */ -#define ChannelSettings_channel_num_tag 1 -#define ChannelSettings_psk_tag 2 -#define ChannelSettings_name_tag 3 -#define ChannelSettings_id_tag 4 -#define ChannelSettings_uplink_enabled_tag 5 -#define ChannelSettings_downlink_enabled_tag 6 -#define Channel_index_tag 1 -#define Channel_settings_tag 2 -#define Channel_role_tag 3 +#define meshtastic_ChannelSettings_channel_num_tag 1 +#define meshtastic_ChannelSettings_psk_tag 2 +#define meshtastic_ChannelSettings_name_tag 3 +#define meshtastic_ChannelSettings_id_tag 4 +#define meshtastic_ChannelSettings_uplink_enabled_tag 5 +#define meshtastic_ChannelSettings_downlink_enabled_tag 6 +#define meshtastic_Channel_index_tag 1 +#define meshtastic_Channel_settings_tag 2 +#define meshtastic_Channel_role_tag 3 /* Struct field encoding specification for nanopb */ -#define ChannelSettings_FIELDLIST(X, a) \ +#define meshtastic_ChannelSettings_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, channel_num, 1) \ X(a, STATIC, SINGULAR, BYTES, psk, 2) \ X(a, STATIC, SINGULAR, STRING, name, 3) \ X(a, STATIC, SINGULAR, FIXED32, id, 4) \ X(a, STATIC, SINGULAR, BOOL, uplink_enabled, 5) \ X(a, STATIC, SINGULAR, BOOL, downlink_enabled, 6) -#define ChannelSettings_CALLBACK NULL -#define ChannelSettings_DEFAULT NULL +#define meshtastic_ChannelSettings_CALLBACK NULL +#define meshtastic_ChannelSettings_DEFAULT NULL -#define Channel_FIELDLIST(X, a) \ +#define meshtastic_Channel_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, INT32, index, 1) \ X(a, STATIC, OPTIONAL, MESSAGE, settings, 2) \ X(a, STATIC, SINGULAR, UENUM, role, 3) -#define Channel_CALLBACK NULL -#define Channel_DEFAULT NULL -#define Channel_settings_MSGTYPE ChannelSettings +#define meshtastic_Channel_CALLBACK NULL +#define meshtastic_Channel_DEFAULT NULL +#define meshtastic_Channel_settings_MSGTYPE meshtastic_ChannelSettings -extern const pb_msgdesc_t ChannelSettings_msg; -extern const pb_msgdesc_t Channel_msg; +extern const pb_msgdesc_t meshtastic_ChannelSettings_msg; +extern const pb_msgdesc_t meshtastic_Channel_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define ChannelSettings_fields &ChannelSettings_msg -#define Channel_fields &Channel_msg +#define meshtastic_ChannelSettings_fields &meshtastic_ChannelSettings_msg +#define meshtastic_Channel_fields &meshtastic_Channel_msg /* Maximum encoded size of messages (where known) */ -#define ChannelSettings_size 62 -#define Channel_size 77 +#define meshtastic_ChannelSettings_size 62 +#define meshtastic_Channel_size 77 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/config.pb.c b/src/mesh/generated/meshtastic/config.pb.c index bd65fee30..7cbee2bb8 100644 --- a/src/mesh/generated/meshtastic/config.pb.c +++ b/src/mesh/generated/meshtastic/config.pb.c @@ -1,36 +1,36 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./config.pb.h" +#include "meshtastic/config.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(Config, Config, AUTO) +PB_BIND(meshtastic_Config, meshtastic_Config, AUTO) -PB_BIND(Config_DeviceConfig, Config_DeviceConfig, AUTO) +PB_BIND(meshtastic_Config_DeviceConfig, meshtastic_Config_DeviceConfig, AUTO) -PB_BIND(Config_PositionConfig, Config_PositionConfig, AUTO) +PB_BIND(meshtastic_Config_PositionConfig, meshtastic_Config_PositionConfig, AUTO) -PB_BIND(Config_PowerConfig, Config_PowerConfig, AUTO) +PB_BIND(meshtastic_Config_PowerConfig, meshtastic_Config_PowerConfig, AUTO) -PB_BIND(Config_NetworkConfig, Config_NetworkConfig, AUTO) +PB_BIND(meshtastic_Config_NetworkConfig, meshtastic_Config_NetworkConfig, AUTO) -PB_BIND(Config_NetworkConfig_IpV4Config, Config_NetworkConfig_IpV4Config, AUTO) +PB_BIND(meshtastic_Config_NetworkConfig_IpV4Config, meshtastic_Config_NetworkConfig_IpV4Config, AUTO) -PB_BIND(Config_DisplayConfig, Config_DisplayConfig, AUTO) +PB_BIND(meshtastic_Config_DisplayConfig, meshtastic_Config_DisplayConfig, AUTO) -PB_BIND(Config_LoRaConfig, Config_LoRaConfig, 2) +PB_BIND(meshtastic_Config_LoRaConfig, meshtastic_Config_LoRaConfig, 2) -PB_BIND(Config_BluetoothConfig, Config_BluetoothConfig, AUTO) +PB_BIND(meshtastic_Config_BluetoothConfig, meshtastic_Config_BluetoothConfig, AUTO) diff --git a/src/mesh/generated/meshtastic/config.pb.h b/src/mesh/generated/meshtastic/config.pb.h index 54edfe65d..73cfa7e17 100644 --- a/src/mesh/generated/meshtastic/config.pb.h +++ b/src/mesh/generated/meshtastic/config.pb.h @@ -11,184 +11,184 @@ /* Enum definitions */ /* Defines the device's role on the Mesh network */ -typedef enum _Config_DeviceConfig_Role { +typedef enum _meshtastic_Config_DeviceConfig_Role { /* Client device role */ - Config_DeviceConfig_Role_CLIENT = 0, + meshtastic_Config_DeviceConfig_Role_CLIENT = 0, /* Client Mute device role Same as a client except packets will not hop over this node, does not contribute to routing packets for mesh. */ - Config_DeviceConfig_Role_CLIENT_MUTE = 1, + meshtastic_Config_DeviceConfig_Role_CLIENT_MUTE = 1, /* Router device role. Mesh packets will prefer to be routed over this node. This node will not be used by client apps. The wifi/ble radios and the oled screen will be put to sleep. */ - Config_DeviceConfig_Role_ROUTER = 2, + meshtastic_Config_DeviceConfig_Role_ROUTER = 2, /* Router Client device role Mesh packets will prefer to be routed over this node. The Router Client can be used as both a Router and an app connected Client. */ - Config_DeviceConfig_Role_ROUTER_CLIENT = 3 -} Config_DeviceConfig_Role; + meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT = 3 +} meshtastic_Config_DeviceConfig_Role; /* Bit field of boolean configuration options, indicating which optional fields to include when assembling POSITION messages Longitude and latitude are always included (also time if GPS-synced) NOTE: the more fields are included, the larger the message will be - leading to longer airtime and a higher risk of packet loss */ -typedef enum _Config_PositionConfig_PositionFlags { +typedef enum _meshtastic_Config_PositionConfig_PositionFlags { /* Required for compilation */ - Config_PositionConfig_PositionFlags_UNSET = 0, + meshtastic_Config_PositionConfig_PositionFlags_UNSET = 0, /* Include an altitude value (if available) */ - Config_PositionConfig_PositionFlags_ALTITUDE = 1, + meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE = 1, /* Altitude value is MSL */ - Config_PositionConfig_PositionFlags_ALTITUDE_MSL = 2, + meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE_MSL = 2, /* Include geoidal separation */ - Config_PositionConfig_PositionFlags_GEOIDAL_SEPARATION = 4, + meshtastic_Config_PositionConfig_PositionFlags_GEOIDAL_SEPARATION = 4, /* Include the DOP value ; PDOP used by default, see below */ - Config_PositionConfig_PositionFlags_DOP = 8, + meshtastic_Config_PositionConfig_PositionFlags_DOP = 8, /* If POS_DOP set, send separate HDOP / VDOP values instead of PDOP */ - Config_PositionConfig_PositionFlags_HVDOP = 16, + meshtastic_Config_PositionConfig_PositionFlags_HVDOP = 16, /* Include number of "satellites in view" */ - Config_PositionConfig_PositionFlags_SATINVIEW = 32, + meshtastic_Config_PositionConfig_PositionFlags_SATINVIEW = 32, /* Include a sequence number incremented per packet */ - Config_PositionConfig_PositionFlags_SEQ_NO = 64, + meshtastic_Config_PositionConfig_PositionFlags_SEQ_NO = 64, /* Include positional timestamp (from GPS solution) */ - Config_PositionConfig_PositionFlags_TIMESTAMP = 128, + meshtastic_Config_PositionConfig_PositionFlags_TIMESTAMP = 128, /* Include positional heading Intended for use with vehicle not walking speeds walking speeds are likely to be error prone like the compass */ - Config_PositionConfig_PositionFlags_HEADING = 256, + meshtastic_Config_PositionConfig_PositionFlags_HEADING = 256, /* Include positional speed Intended for use with vehicle not walking speeds walking speeds are likely to be error prone like the compass */ - Config_PositionConfig_PositionFlags_SPEED = 512 -} Config_PositionConfig_PositionFlags; + meshtastic_Config_PositionConfig_PositionFlags_SPEED = 512 +} meshtastic_Config_PositionConfig_PositionFlags; -typedef enum _Config_NetworkConfig_AddressMode { +typedef enum _meshtastic_Config_NetworkConfig_AddressMode { /* obtain ip address via DHCP */ - Config_NetworkConfig_AddressMode_DHCP = 0, + meshtastic_Config_NetworkConfig_AddressMode_DHCP = 0, /* use static ip address */ - Config_NetworkConfig_AddressMode_STATIC = 1 -} Config_NetworkConfig_AddressMode; + meshtastic_Config_NetworkConfig_AddressMode_STATIC = 1 +} meshtastic_Config_NetworkConfig_AddressMode; /* How the GPS coordinates are displayed on the OLED screen. */ -typedef enum _Config_DisplayConfig_GpsCoordinateFormat { +typedef enum _meshtastic_Config_DisplayConfig_GpsCoordinateFormat { /* GPS coordinates are displayed in the normal decimal degrees format: DD.DDDDDD DDD.DDDDDD */ - Config_DisplayConfig_GpsCoordinateFormat_DEC = 0, + meshtastic_Config_DisplayConfig_GpsCoordinateFormat_DEC = 0, /* GPS coordinates are displayed in the degrees minutes seconds format: DD°MM'SS"C DDD°MM'SS"C, where C is the compass point representing the locations quadrant */ - Config_DisplayConfig_GpsCoordinateFormat_DMS = 1, + meshtastic_Config_DisplayConfig_GpsCoordinateFormat_DMS = 1, /* Universal Transverse Mercator format: ZZB EEEEEE NNNNNNN, where Z is zone, B is band, E is easting, N is northing */ - Config_DisplayConfig_GpsCoordinateFormat_UTM = 2, + meshtastic_Config_DisplayConfig_GpsCoordinateFormat_UTM = 2, /* Military Grid Reference System format: ZZB CD EEEEE NNNNN, where Z is zone, B is band, C is the east 100k square, D is the north 100k square, E is easting, N is northing */ - Config_DisplayConfig_GpsCoordinateFormat_MGRS = 3, + meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MGRS = 3, /* Open Location Code (aka Plus Codes). */ - Config_DisplayConfig_GpsCoordinateFormat_OLC = 4, + meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OLC = 4, /* Ordnance Survey Grid Reference (the National Grid System of the UK). Format: AB EEEEE NNNNN, where A is the east 100k square, B is the north 100k square, E is the easting, N is the northing */ - Config_DisplayConfig_GpsCoordinateFormat_OSGR = 5 -} Config_DisplayConfig_GpsCoordinateFormat; + meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OSGR = 5 +} meshtastic_Config_DisplayConfig_GpsCoordinateFormat; /* Unit display preference */ -typedef enum _Config_DisplayConfig_DisplayUnits { +typedef enum _meshtastic_Config_DisplayConfig_DisplayUnits { /* Metric (Default) */ - Config_DisplayConfig_DisplayUnits_METRIC = 0, + meshtastic_Config_DisplayConfig_DisplayUnits_METRIC = 0, /* Imperial */ - Config_DisplayConfig_DisplayUnits_IMPERIAL = 1 -} Config_DisplayConfig_DisplayUnits; + meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL = 1 +} meshtastic_Config_DisplayConfig_DisplayUnits; /* Override OLED outo detect with this if it fails. */ -typedef enum _Config_DisplayConfig_OledType { +typedef enum _meshtastic_Config_DisplayConfig_OledType { /* Default / Auto */ - Config_DisplayConfig_OledType_OLED_AUTO = 0, + meshtastic_Config_DisplayConfig_OledType_OLED_AUTO = 0, /* Default / Auto */ - Config_DisplayConfig_OledType_OLED_SSD1306 = 1, + meshtastic_Config_DisplayConfig_OledType_OLED_SSD1306 = 1, /* Default / Auto */ - Config_DisplayConfig_OledType_OLED_SH1106 = 2, + meshtastic_Config_DisplayConfig_OledType_OLED_SH1106 = 2, /* Can not be auto detected but set by proto. Used for 128x128 screens */ - Config_DisplayConfig_OledType_OLED_SH1107 = 3 -} Config_DisplayConfig_OledType; + meshtastic_Config_DisplayConfig_OledType_OLED_SH1107 = 3 +} meshtastic_Config_DisplayConfig_OledType; -typedef enum _Config_DisplayConfig_DisplayMode { +typedef enum _meshtastic_Config_DisplayConfig_DisplayMode { /* Default. The old style for the 128x64 OLED screen */ - Config_DisplayConfig_DisplayMode_DEFAULT = 0, + meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT = 0, /* Rearrange display elements to cater for bicolor OLED displays */ - Config_DisplayConfig_DisplayMode_TWOCOLOR = 1, + meshtastic_Config_DisplayConfig_DisplayMode_TWOCOLOR = 1, /* Same as TwoColor, but with inverted top bar. Not so good for Epaper displays */ - Config_DisplayConfig_DisplayMode_INVERTED = 2, + meshtastic_Config_DisplayConfig_DisplayMode_INVERTED = 2, /* TFT Full Color Displays (not implemented yet) */ - Config_DisplayConfig_DisplayMode_COLOR = 3 -} Config_DisplayConfig_DisplayMode; + meshtastic_Config_DisplayConfig_DisplayMode_COLOR = 3 +} meshtastic_Config_DisplayConfig_DisplayMode; -typedef enum _Config_LoRaConfig_RegionCode { +typedef enum _meshtastic_Config_LoRaConfig_RegionCode { /* Region is not set */ - Config_LoRaConfig_RegionCode_UNSET = 0, + meshtastic_Config_LoRaConfig_RegionCode_UNSET = 0, /* United States */ - Config_LoRaConfig_RegionCode_US = 1, + meshtastic_Config_LoRaConfig_RegionCode_US = 1, /* European Union 433mhz */ - Config_LoRaConfig_RegionCode_EU_433 = 2, + meshtastic_Config_LoRaConfig_RegionCode_EU_433 = 2, /* European Union 433mhz */ - Config_LoRaConfig_RegionCode_EU_868 = 3, + meshtastic_Config_LoRaConfig_RegionCode_EU_868 = 3, /* China */ - Config_LoRaConfig_RegionCode_CN = 4, + meshtastic_Config_LoRaConfig_RegionCode_CN = 4, /* Japan */ - Config_LoRaConfig_RegionCode_JP = 5, + meshtastic_Config_LoRaConfig_RegionCode_JP = 5, /* Australia / New Zealand */ - Config_LoRaConfig_RegionCode_ANZ = 6, + meshtastic_Config_LoRaConfig_RegionCode_ANZ = 6, /* Korea */ - Config_LoRaConfig_RegionCode_KR = 7, + meshtastic_Config_LoRaConfig_RegionCode_KR = 7, /* Taiwan */ - Config_LoRaConfig_RegionCode_TW = 8, + meshtastic_Config_LoRaConfig_RegionCode_TW = 8, /* Russia */ - Config_LoRaConfig_RegionCode_RU = 9, + meshtastic_Config_LoRaConfig_RegionCode_RU = 9, /* India */ - Config_LoRaConfig_RegionCode_IN = 10, + meshtastic_Config_LoRaConfig_RegionCode_IN = 10, /* New Zealand 865mhz */ - Config_LoRaConfig_RegionCode_NZ_865 = 11, + meshtastic_Config_LoRaConfig_RegionCode_NZ_865 = 11, /* Thailand */ - Config_LoRaConfig_RegionCode_TH = 12, + meshtastic_Config_LoRaConfig_RegionCode_TH = 12, /* WLAN Band */ - Config_LoRaConfig_RegionCode_LORA_24 = 13, + meshtastic_Config_LoRaConfig_RegionCode_LORA_24 = 13, /* Ukraine 433mhz */ - Config_LoRaConfig_RegionCode_UA_433 = 14, + meshtastic_Config_LoRaConfig_RegionCode_UA_433 = 14, /* Ukraine 868mhz */ - Config_LoRaConfig_RegionCode_UA_868 = 15 -} Config_LoRaConfig_RegionCode; + meshtastic_Config_LoRaConfig_RegionCode_UA_868 = 15 +} meshtastic_Config_LoRaConfig_RegionCode; /* Standard predefined channel settings Note: these mappings must match ModemPreset Choice in the device code. */ -typedef enum _Config_LoRaConfig_ModemPreset { +typedef enum _meshtastic_Config_LoRaConfig_ModemPreset { /* Long Range - Fast */ - Config_LoRaConfig_ModemPreset_LONG_FAST = 0, + meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST = 0, /* Long Range - Slow */ - Config_LoRaConfig_ModemPreset_LONG_SLOW = 1, + meshtastic_Config_LoRaConfig_ModemPreset_LONG_SLOW = 1, /* Very Long Range - Slow */ - Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW = 2, + meshtastic_Config_LoRaConfig_ModemPreset_VERY_LONG_SLOW = 2, /* Medium Range - Slow */ - Config_LoRaConfig_ModemPreset_MEDIUM_SLOW = 3, + meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_SLOW = 3, /* Medium Range - Fast */ - Config_LoRaConfig_ModemPreset_MEDIUM_FAST = 4, + meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_FAST = 4, /* Short Range - Slow */ - Config_LoRaConfig_ModemPreset_SHORT_SLOW = 5, + meshtastic_Config_LoRaConfig_ModemPreset_SHORT_SLOW = 5, /* Short Range - Fast */ - Config_LoRaConfig_ModemPreset_SHORT_FAST = 6 -} Config_LoRaConfig_ModemPreset; + meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST = 6 +} meshtastic_Config_LoRaConfig_ModemPreset; -typedef enum _Config_BluetoothConfig_PairingMode { +typedef enum _meshtastic_Config_BluetoothConfig_PairingMode { /* Device generates a random pin that will be shown on the screen of the device for pairing */ - Config_BluetoothConfig_PairingMode_RANDOM_PIN = 0, + meshtastic_Config_BluetoothConfig_PairingMode_RANDOM_PIN = 0, /* Device requires a specified fixed pin for pairing */ - Config_BluetoothConfig_PairingMode_FIXED_PIN = 1, + meshtastic_Config_BluetoothConfig_PairingMode_FIXED_PIN = 1, /* Device requires no pin for pairing */ - Config_BluetoothConfig_PairingMode_NO_PIN = 2 -} Config_BluetoothConfig_PairingMode; + meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN = 2 +} meshtastic_Config_BluetoothConfig_PairingMode; /* Struct definitions */ /* Configuration */ -typedef struct _Config_DeviceConfig { +typedef struct _meshtastic_Config_DeviceConfig { /* Sets the role of node */ - Config_DeviceConfig_Role role; + meshtastic_Config_DeviceConfig_Role role; /* Disabling this will disable the SerialConsole by not initilizing the StreamAPI */ bool serial_enabled; /* By default we turn off logging as soon as an API client connects (to keep shared serial link quiet). @@ -200,10 +200,10 @@ typedef struct _Config_DeviceConfig { /* For boards without a PWM buzzer, this is the pin number that will be used Defaults to PIN_BUZZER if defined. */ uint32_t buzzer_gpio; -} Config_DeviceConfig; +} meshtastic_Config_DeviceConfig; /* Position Config */ -typedef struct _Config_PositionConfig { +typedef struct _meshtastic_Config_PositionConfig { /* We should send our position this often (but only if it has changed significantly) Defaults to 15 minutes */ uint32_t position_broadcast_secs; @@ -231,11 +231,11 @@ typedef struct _Config_PositionConfig { uint32_t rx_gpio; /* (Re)define GPS_TX_PIN for your board. */ uint32_t tx_gpio; -} Config_PositionConfig; +} meshtastic_Config_PositionConfig; /* Power Config\ See [Power Config](/docs/settings/config/power) for additional power config details. */ -typedef struct _Config_PowerConfig { +typedef struct _meshtastic_Config_PowerConfig { /* If set, we are powered from a low-current source (i.e. solar), so even if it looks like we have power flowing in we should try to minimize power consumption as much as possible. YOU DO NOT NEED TO SET THIS IF YOU'VE set is_router (it is implied in that case). @@ -271,9 +271,9 @@ typedef struct _Config_PowerConfig { While in light sleep when we receive packets on the LoRa radio we will wake and handle them and stay awake in no BLE mode for this value 0 for default of 10 seconds */ uint32_t min_wake_secs; -} Config_PowerConfig; +} meshtastic_Config_PowerConfig; -typedef struct _Config_NetworkConfig_IpV4Config { +typedef struct _meshtastic_Config_NetworkConfig_IpV4Config { /* Static IP address */ uint32_t ip; /* Static gateway address */ @@ -282,10 +282,10 @@ typedef struct _Config_NetworkConfig_IpV4Config { uint32_t subnet; /* Static DNS server address */ uint32_t dns; -} Config_NetworkConfig_IpV4Config; +} meshtastic_Config_NetworkConfig_IpV4Config; /* Network Config */ -typedef struct _Config_NetworkConfig { +typedef struct _meshtastic_Config_NetworkConfig { /* Enable WiFi (disables Bluetooth) */ bool wifi_enabled; /* If set, this node will try to join the specified wifi network and @@ -298,21 +298,21 @@ typedef struct _Config_NetworkConfig { /* Enable Ethernet */ bool eth_enabled; /* acquire an address via DHCP or assign static */ - Config_NetworkConfig_AddressMode address_mode; + meshtastic_Config_NetworkConfig_AddressMode address_mode; /* struct to keep static address */ bool has_ipv4_config; - Config_NetworkConfig_IpV4Config ipv4_config; + meshtastic_Config_NetworkConfig_IpV4Config ipv4_config; /* rsyslog Server and Port */ char rsyslog_server[33]; -} Config_NetworkConfig; +} meshtastic_Config_NetworkConfig; /* Display Config */ -typedef struct _Config_DisplayConfig { +typedef struct _meshtastic_Config_DisplayConfig { /* Number of seconds the screen stays on after pressing the user button or receiving a message 0 for default of one minute MAXUINT for always on */ uint32_t screen_on_secs; /* How the GPS coordinates are formatted on the OLED screen. */ - Config_DisplayConfig_GpsCoordinateFormat gps_format; + meshtastic_Config_DisplayConfig_GpsCoordinateFormat gps_format; /* Automatically toggles to the next page on the screen like a carousel, based the specified interval in seconds. Potentially useful for devices without user buttons. */ uint32_t auto_screen_carousel_secs; @@ -322,17 +322,17 @@ typedef struct _Config_DisplayConfig { /* Flip screen vertically, for cases that mount the screen upside down */ bool flip_screen; /* Perferred display units */ - Config_DisplayConfig_DisplayUnits units; + meshtastic_Config_DisplayConfig_DisplayUnits units; /* Override auto-detect in screen */ - Config_DisplayConfig_OledType oled; + meshtastic_Config_DisplayConfig_OledType oled; /* Display Mode */ - Config_DisplayConfig_DisplayMode displaymode; + meshtastic_Config_DisplayConfig_DisplayMode displaymode; /* Print first line in pseudo-bold? FALSE is original style, TRUE is bold */ bool heading_bold; -} Config_DisplayConfig; +} meshtastic_Config_DisplayConfig; /* Lora Config */ -typedef struct _Config_LoRaConfig { +typedef struct _meshtastic_Config_LoRaConfig { /* When enabled, the `modem_preset` fields will be adheared to, else the `bandwidth`/`spread_factor`/`coding_rate` will be taked from their respective manually defined fields */ bool use_preset; @@ -341,7 +341,7 @@ typedef struct _Config_LoRaConfig { Because protobufs take ZERO space when the value is zero this works out nicely. This value is replaced by bandwidth/spread_factor/coding_rate. If you'd like to experiment with other options add them to MeshRadio.cpp in the device code. */ - Config_LoRaConfig_ModemPreset modem_preset; + meshtastic_Config_LoRaConfig_ModemPreset modem_preset; /* Bandwidth in MHz Certain bandwidth numbers are 'special' and will be converted to the appropriate floating point value: 31 -> 31.25MHz */ @@ -357,7 +357,7 @@ typedef struct _Config_LoRaConfig { Used to correct for crystal calibration errors. */ float frequency_offset; /* The region code for the radio (US, CN, EU433, etc...) */ - Config_LoRaConfig_RegionCode region; + meshtastic_Config_LoRaConfig_RegionCode region; /* Maximum number of hops. This can't be greater than 7. Default of 3 */ uint32_t hop_limit; @@ -386,29 +386,29 @@ typedef struct _Config_LoRaConfig { in ignore_incoming will have packets they send droped on receive (by router.cpp) */ pb_size_t ignore_incoming_count; uint32_t ignore_incoming[3]; -} Config_LoRaConfig; +} meshtastic_Config_LoRaConfig; -typedef struct _Config_BluetoothConfig { +typedef struct _meshtastic_Config_BluetoothConfig { /* Enable Bluetooth on the device */ bool enabled; /* Determines the pairing strategy for the device */ - Config_BluetoothConfig_PairingMode mode; + meshtastic_Config_BluetoothConfig_PairingMode mode; /* Specified pin for PairingMode.FixedPin */ uint32_t fixed_pin; -} Config_BluetoothConfig; +} meshtastic_Config_BluetoothConfig; -typedef struct _Config { +typedef struct _meshtastic_Config { pb_size_t which_payload_variant; union { - Config_DeviceConfig device; - Config_PositionConfig position; - Config_PowerConfig power; - Config_NetworkConfig network; - Config_DisplayConfig display; - Config_LoRaConfig lora; - Config_BluetoothConfig bluetooth; + meshtastic_Config_DeviceConfig device; + meshtastic_Config_PositionConfig position; + meshtastic_Config_PowerConfig power; + meshtastic_Config_NetworkConfig network; + meshtastic_Config_DisplayConfig display; + meshtastic_Config_LoRaConfig lora; + meshtastic_Config_BluetoothConfig bluetooth; } payload_variant; -} Config; +} meshtastic_Config; #ifdef __cplusplus @@ -416,155 +416,155 @@ extern "C" { #endif /* Helper constants for enums */ -#define _Config_DeviceConfig_Role_MIN Config_DeviceConfig_Role_CLIENT -#define _Config_DeviceConfig_Role_MAX Config_DeviceConfig_Role_ROUTER_CLIENT -#define _Config_DeviceConfig_Role_ARRAYSIZE ((Config_DeviceConfig_Role)(Config_DeviceConfig_Role_ROUTER_CLIENT+1)) +#define _meshtastic_Config_DeviceConfig_Role_MIN meshtastic_Config_DeviceConfig_Role_CLIENT +#define _meshtastic_Config_DeviceConfig_Role_MAX meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT +#define _meshtastic_Config_DeviceConfig_Role_ARRAYSIZE ((meshtastic_Config_DeviceConfig_Role)(meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT+1)) -#define _Config_PositionConfig_PositionFlags_MIN Config_PositionConfig_PositionFlags_UNSET -#define _Config_PositionConfig_PositionFlags_MAX Config_PositionConfig_PositionFlags_SPEED -#define _Config_PositionConfig_PositionFlags_ARRAYSIZE ((Config_PositionConfig_PositionFlags)(Config_PositionConfig_PositionFlags_SPEED+1)) +#define _meshtastic_Config_PositionConfig_PositionFlags_MIN meshtastic_Config_PositionConfig_PositionFlags_UNSET +#define _meshtastic_Config_PositionConfig_PositionFlags_MAX meshtastic_Config_PositionConfig_PositionFlags_SPEED +#define _meshtastic_Config_PositionConfig_PositionFlags_ARRAYSIZE ((meshtastic_Config_PositionConfig_PositionFlags)(meshtastic_Config_PositionConfig_PositionFlags_SPEED+1)) -#define _Config_NetworkConfig_AddressMode_MIN Config_NetworkConfig_AddressMode_DHCP -#define _Config_NetworkConfig_AddressMode_MAX Config_NetworkConfig_AddressMode_STATIC -#define _Config_NetworkConfig_AddressMode_ARRAYSIZE ((Config_NetworkConfig_AddressMode)(Config_NetworkConfig_AddressMode_STATIC+1)) +#define _meshtastic_Config_NetworkConfig_AddressMode_MIN meshtastic_Config_NetworkConfig_AddressMode_DHCP +#define _meshtastic_Config_NetworkConfig_AddressMode_MAX meshtastic_Config_NetworkConfig_AddressMode_STATIC +#define _meshtastic_Config_NetworkConfig_AddressMode_ARRAYSIZE ((meshtastic_Config_NetworkConfig_AddressMode)(meshtastic_Config_NetworkConfig_AddressMode_STATIC+1)) -#define _Config_DisplayConfig_GpsCoordinateFormat_MIN Config_DisplayConfig_GpsCoordinateFormat_DEC -#define _Config_DisplayConfig_GpsCoordinateFormat_MAX Config_DisplayConfig_GpsCoordinateFormat_OSGR -#define _Config_DisplayConfig_GpsCoordinateFormat_ARRAYSIZE ((Config_DisplayConfig_GpsCoordinateFormat)(Config_DisplayConfig_GpsCoordinateFormat_OSGR+1)) +#define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN meshtastic_Config_DisplayConfig_GpsCoordinateFormat_DEC +#define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MAX meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OSGR +#define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_ARRAYSIZE ((meshtastic_Config_DisplayConfig_GpsCoordinateFormat)(meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OSGR+1)) -#define _Config_DisplayConfig_DisplayUnits_MIN Config_DisplayConfig_DisplayUnits_METRIC -#define _Config_DisplayConfig_DisplayUnits_MAX Config_DisplayConfig_DisplayUnits_IMPERIAL -#define _Config_DisplayConfig_DisplayUnits_ARRAYSIZE ((Config_DisplayConfig_DisplayUnits)(Config_DisplayConfig_DisplayUnits_IMPERIAL+1)) +#define _meshtastic_Config_DisplayConfig_DisplayUnits_MIN meshtastic_Config_DisplayConfig_DisplayUnits_METRIC +#define _meshtastic_Config_DisplayConfig_DisplayUnits_MAX meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL +#define _meshtastic_Config_DisplayConfig_DisplayUnits_ARRAYSIZE ((meshtastic_Config_DisplayConfig_DisplayUnits)(meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL+1)) -#define _Config_DisplayConfig_OledType_MIN Config_DisplayConfig_OledType_OLED_AUTO -#define _Config_DisplayConfig_OledType_MAX Config_DisplayConfig_OledType_OLED_SH1107 -#define _Config_DisplayConfig_OledType_ARRAYSIZE ((Config_DisplayConfig_OledType)(Config_DisplayConfig_OledType_OLED_SH1107+1)) +#define _meshtastic_Config_DisplayConfig_OledType_MIN meshtastic_Config_DisplayConfig_OledType_OLED_AUTO +#define _meshtastic_Config_DisplayConfig_OledType_MAX meshtastic_Config_DisplayConfig_OledType_OLED_SH1107 +#define _meshtastic_Config_DisplayConfig_OledType_ARRAYSIZE ((meshtastic_Config_DisplayConfig_OledType)(meshtastic_Config_DisplayConfig_OledType_OLED_SH1107+1)) -#define _Config_DisplayConfig_DisplayMode_MIN Config_DisplayConfig_DisplayMode_DEFAULT -#define _Config_DisplayConfig_DisplayMode_MAX Config_DisplayConfig_DisplayMode_COLOR -#define _Config_DisplayConfig_DisplayMode_ARRAYSIZE ((Config_DisplayConfig_DisplayMode)(Config_DisplayConfig_DisplayMode_COLOR+1)) +#define _meshtastic_Config_DisplayConfig_DisplayMode_MIN meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT +#define _meshtastic_Config_DisplayConfig_DisplayMode_MAX meshtastic_Config_DisplayConfig_DisplayMode_COLOR +#define _meshtastic_Config_DisplayConfig_DisplayMode_ARRAYSIZE ((meshtastic_Config_DisplayConfig_DisplayMode)(meshtastic_Config_DisplayConfig_DisplayMode_COLOR+1)) -#define _Config_LoRaConfig_RegionCode_MIN Config_LoRaConfig_RegionCode_UNSET -#define _Config_LoRaConfig_RegionCode_MAX Config_LoRaConfig_RegionCode_UA_868 -#define _Config_LoRaConfig_RegionCode_ARRAYSIZE ((Config_LoRaConfig_RegionCode)(Config_LoRaConfig_RegionCode_UA_868+1)) +#define _meshtastic_Config_LoRaConfig_RegionCode_MIN meshtastic_Config_LoRaConfig_RegionCode_UNSET +#define _meshtastic_Config_LoRaConfig_RegionCode_MAX meshtastic_Config_LoRaConfig_RegionCode_UA_868 +#define _meshtastic_Config_LoRaConfig_RegionCode_ARRAYSIZE ((meshtastic_Config_LoRaConfig_RegionCode)(meshtastic_Config_LoRaConfig_RegionCode_UA_868+1)) -#define _Config_LoRaConfig_ModemPreset_MIN Config_LoRaConfig_ModemPreset_LONG_FAST -#define _Config_LoRaConfig_ModemPreset_MAX Config_LoRaConfig_ModemPreset_SHORT_FAST -#define _Config_LoRaConfig_ModemPreset_ARRAYSIZE ((Config_LoRaConfig_ModemPreset)(Config_LoRaConfig_ModemPreset_SHORT_FAST+1)) +#define _meshtastic_Config_LoRaConfig_ModemPreset_MIN meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST +#define _meshtastic_Config_LoRaConfig_ModemPreset_MAX meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST +#define _meshtastic_Config_LoRaConfig_ModemPreset_ARRAYSIZE ((meshtastic_Config_LoRaConfig_ModemPreset)(meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST+1)) -#define _Config_BluetoothConfig_PairingMode_MIN Config_BluetoothConfig_PairingMode_RANDOM_PIN -#define _Config_BluetoothConfig_PairingMode_MAX Config_BluetoothConfig_PairingMode_NO_PIN -#define _Config_BluetoothConfig_PairingMode_ARRAYSIZE ((Config_BluetoothConfig_PairingMode)(Config_BluetoothConfig_PairingMode_NO_PIN+1)) +#define _meshtastic_Config_BluetoothConfig_PairingMode_MIN meshtastic_Config_BluetoothConfig_PairingMode_RANDOM_PIN +#define _meshtastic_Config_BluetoothConfig_PairingMode_MAX meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN +#define _meshtastic_Config_BluetoothConfig_PairingMode_ARRAYSIZE ((meshtastic_Config_BluetoothConfig_PairingMode)(meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN+1)) -#define Config_DeviceConfig_role_ENUMTYPE Config_DeviceConfig_Role +#define meshtastic_Config_DeviceConfig_role_ENUMTYPE meshtastic_Config_DeviceConfig_Role -#define Config_NetworkConfig_address_mode_ENUMTYPE Config_NetworkConfig_AddressMode +#define meshtastic_Config_NetworkConfig_address_mode_ENUMTYPE meshtastic_Config_NetworkConfig_AddressMode -#define Config_DisplayConfig_gps_format_ENUMTYPE Config_DisplayConfig_GpsCoordinateFormat -#define Config_DisplayConfig_units_ENUMTYPE Config_DisplayConfig_DisplayUnits -#define Config_DisplayConfig_oled_ENUMTYPE Config_DisplayConfig_OledType -#define Config_DisplayConfig_displaymode_ENUMTYPE Config_DisplayConfig_DisplayMode +#define meshtastic_Config_DisplayConfig_gps_format_ENUMTYPE meshtastic_Config_DisplayConfig_GpsCoordinateFormat +#define meshtastic_Config_DisplayConfig_units_ENUMTYPE meshtastic_Config_DisplayConfig_DisplayUnits +#define meshtastic_Config_DisplayConfig_oled_ENUMTYPE meshtastic_Config_DisplayConfig_OledType +#define meshtastic_Config_DisplayConfig_displaymode_ENUMTYPE meshtastic_Config_DisplayConfig_DisplayMode -#define Config_LoRaConfig_modem_preset_ENUMTYPE Config_LoRaConfig_ModemPreset -#define Config_LoRaConfig_region_ENUMTYPE Config_LoRaConfig_RegionCode +#define meshtastic_Config_LoRaConfig_modem_preset_ENUMTYPE meshtastic_Config_LoRaConfig_ModemPreset +#define meshtastic_Config_LoRaConfig_region_ENUMTYPE meshtastic_Config_LoRaConfig_RegionCode -#define Config_BluetoothConfig_mode_ENUMTYPE Config_BluetoothConfig_PairingMode +#define meshtastic_Config_BluetoothConfig_mode_ENUMTYPE meshtastic_Config_BluetoothConfig_PairingMode /* Initializer values for message structs */ -#define Config_init_default {0, {Config_DeviceConfig_init_default}} -#define Config_DeviceConfig_init_default {_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0} -#define Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} -#define Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0} -#define Config_NetworkConfig_init_default {0, "", "", "", 0, _Config_NetworkConfig_AddressMode_MIN, false, Config_NetworkConfig_IpV4Config_init_default, ""} -#define Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0} -#define Config_DisplayConfig_init_default {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN, _Config_DisplayConfig_OledType_MIN, _Config_DisplayConfig_DisplayMode_MIN, 0} -#define Config_LoRaConfig_init_default {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, {0, 0, 0}} -#define Config_BluetoothConfig_init_default {0, _Config_BluetoothConfig_PairingMode_MIN, 0} -#define Config_init_zero {0, {Config_DeviceConfig_init_zero}} -#define Config_DeviceConfig_init_zero {_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0} -#define Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} -#define Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0} -#define Config_NetworkConfig_init_zero {0, "", "", "", 0, _Config_NetworkConfig_AddressMode_MIN, false, Config_NetworkConfig_IpV4Config_init_zero, ""} -#define Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0} -#define Config_DisplayConfig_init_zero {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN, _Config_DisplayConfig_OledType_MIN, _Config_DisplayConfig_DisplayMode_MIN, 0} -#define Config_LoRaConfig_init_zero {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, {0, 0, 0}} -#define Config_BluetoothConfig_init_zero {0, _Config_BluetoothConfig_PairingMode_MIN, 0} +#define meshtastic_Config_init_default {0, {meshtastic_Config_DeviceConfig_init_default}} +#define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0} +#define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, ""} +#define meshtastic_Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0} +#define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0} +#define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, {0, 0, 0}} +#define meshtastic_Config_BluetoothConfig_init_default {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0} +#define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}} +#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, 0} +#define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, ""} +#define meshtastic_Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0} +#define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0} +#define meshtastic_Config_LoRaConfig_init_zero {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, {0, 0, 0}} +#define meshtastic_Config_BluetoothConfig_init_zero {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0} /* Field tags (for use in manual encoding/decoding) */ -#define Config_DeviceConfig_role_tag 1 -#define Config_DeviceConfig_serial_enabled_tag 2 -#define Config_DeviceConfig_debug_log_enabled_tag 3 -#define Config_DeviceConfig_button_gpio_tag 4 -#define Config_DeviceConfig_buzzer_gpio_tag 5 -#define Config_PositionConfig_position_broadcast_secs_tag 1 -#define Config_PositionConfig_position_broadcast_smart_enabled_tag 2 -#define Config_PositionConfig_fixed_position_tag 3 -#define Config_PositionConfig_gps_enabled_tag 4 -#define Config_PositionConfig_gps_update_interval_tag 5 -#define Config_PositionConfig_gps_attempt_time_tag 6 -#define Config_PositionConfig_position_flags_tag 7 -#define Config_PositionConfig_rx_gpio_tag 8 -#define Config_PositionConfig_tx_gpio_tag 9 -#define Config_PowerConfig_is_power_saving_tag 1 -#define Config_PowerConfig_on_battery_shutdown_after_secs_tag 2 -#define Config_PowerConfig_adc_multiplier_override_tag 3 -#define Config_PowerConfig_wait_bluetooth_secs_tag 4 -#define Config_PowerConfig_mesh_sds_timeout_secs_tag 5 -#define Config_PowerConfig_sds_secs_tag 6 -#define Config_PowerConfig_ls_secs_tag 7 -#define Config_PowerConfig_min_wake_secs_tag 8 -#define Config_NetworkConfig_IpV4Config_ip_tag 1 -#define Config_NetworkConfig_IpV4Config_gateway_tag 2 -#define Config_NetworkConfig_IpV4Config_subnet_tag 3 -#define Config_NetworkConfig_IpV4Config_dns_tag 4 -#define Config_NetworkConfig_wifi_enabled_tag 1 -#define Config_NetworkConfig_wifi_ssid_tag 3 -#define Config_NetworkConfig_wifi_psk_tag 4 -#define Config_NetworkConfig_ntp_server_tag 5 -#define Config_NetworkConfig_eth_enabled_tag 6 -#define Config_NetworkConfig_address_mode_tag 7 -#define Config_NetworkConfig_ipv4_config_tag 8 -#define Config_NetworkConfig_rsyslog_server_tag 9 -#define Config_DisplayConfig_screen_on_secs_tag 1 -#define Config_DisplayConfig_gps_format_tag 2 -#define Config_DisplayConfig_auto_screen_carousel_secs_tag 3 -#define Config_DisplayConfig_compass_north_top_tag 4 -#define Config_DisplayConfig_flip_screen_tag 5 -#define Config_DisplayConfig_units_tag 6 -#define Config_DisplayConfig_oled_tag 7 -#define Config_DisplayConfig_displaymode_tag 8 -#define Config_DisplayConfig_heading_bold_tag 9 -#define Config_LoRaConfig_use_preset_tag 1 -#define Config_LoRaConfig_modem_preset_tag 2 -#define Config_LoRaConfig_bandwidth_tag 3 -#define Config_LoRaConfig_spread_factor_tag 4 -#define Config_LoRaConfig_coding_rate_tag 5 -#define Config_LoRaConfig_frequency_offset_tag 6 -#define Config_LoRaConfig_region_tag 7 -#define Config_LoRaConfig_hop_limit_tag 8 -#define Config_LoRaConfig_tx_enabled_tag 9 -#define Config_LoRaConfig_tx_power_tag 10 -#define Config_LoRaConfig_channel_num_tag 11 -#define Config_LoRaConfig_override_duty_cycle_tag 12 -#define Config_LoRaConfig_ignore_incoming_tag 103 -#define Config_BluetoothConfig_enabled_tag 1 -#define Config_BluetoothConfig_mode_tag 2 -#define Config_BluetoothConfig_fixed_pin_tag 3 -#define Config_device_tag 1 -#define Config_position_tag 2 -#define Config_power_tag 3 -#define Config_network_tag 4 -#define Config_display_tag 5 -#define Config_lora_tag 6 -#define Config_bluetooth_tag 7 +#define meshtastic_Config_DeviceConfig_role_tag 1 +#define meshtastic_Config_DeviceConfig_serial_enabled_tag 2 +#define meshtastic_Config_DeviceConfig_debug_log_enabled_tag 3 +#define meshtastic_Config_DeviceConfig_button_gpio_tag 4 +#define meshtastic_Config_DeviceConfig_buzzer_gpio_tag 5 +#define meshtastic_Config_PositionConfig_position_broadcast_secs_tag 1 +#define meshtastic_Config_PositionConfig_position_broadcast_smart_enabled_tag 2 +#define meshtastic_Config_PositionConfig_fixed_position_tag 3 +#define meshtastic_Config_PositionConfig_gps_enabled_tag 4 +#define meshtastic_Config_PositionConfig_gps_update_interval_tag 5 +#define meshtastic_Config_PositionConfig_gps_attempt_time_tag 6 +#define meshtastic_Config_PositionConfig_position_flags_tag 7 +#define meshtastic_Config_PositionConfig_rx_gpio_tag 8 +#define meshtastic_Config_PositionConfig_tx_gpio_tag 9 +#define meshtastic_Config_PowerConfig_is_power_saving_tag 1 +#define meshtastic_Config_PowerConfig_on_battery_shutdown_after_secs_tag 2 +#define meshtastic_Config_PowerConfig_adc_multiplier_override_tag 3 +#define meshtastic_Config_PowerConfig_wait_bluetooth_secs_tag 4 +#define meshtastic_Config_PowerConfig_mesh_sds_timeout_secs_tag 5 +#define meshtastic_Config_PowerConfig_sds_secs_tag 6 +#define meshtastic_Config_PowerConfig_ls_secs_tag 7 +#define meshtastic_Config_PowerConfig_min_wake_secs_tag 8 +#define meshtastic_Config_NetworkConfig_IpV4Config_ip_tag 1 +#define meshtastic_Config_NetworkConfig_IpV4Config_gateway_tag 2 +#define meshtastic_Config_NetworkConfig_IpV4Config_subnet_tag 3 +#define meshtastic_Config_NetworkConfig_IpV4Config_dns_tag 4 +#define meshtastic_Config_NetworkConfig_wifi_enabled_tag 1 +#define meshtastic_Config_NetworkConfig_wifi_ssid_tag 3 +#define meshtastic_Config_NetworkConfig_wifi_psk_tag 4 +#define meshtastic_Config_NetworkConfig_ntp_server_tag 5 +#define meshtastic_Config_NetworkConfig_eth_enabled_tag 6 +#define meshtastic_Config_NetworkConfig_address_mode_tag 7 +#define meshtastic_Config_NetworkConfig_ipv4_config_tag 8 +#define meshtastic_Config_NetworkConfig_rsyslog_server_tag 9 +#define meshtastic_Config_DisplayConfig_screen_on_secs_tag 1 +#define meshtastic_Config_DisplayConfig_gps_format_tag 2 +#define meshtastic_Config_DisplayConfig_auto_screen_carousel_secs_tag 3 +#define meshtastic_Config_DisplayConfig_compass_north_top_tag 4 +#define meshtastic_Config_DisplayConfig_flip_screen_tag 5 +#define meshtastic_Config_DisplayConfig_units_tag 6 +#define meshtastic_Config_DisplayConfig_oled_tag 7 +#define meshtastic_Config_DisplayConfig_displaymode_tag 8 +#define meshtastic_Config_DisplayConfig_heading_bold_tag 9 +#define meshtastic_Config_LoRaConfig_use_preset_tag 1 +#define meshtastic_Config_LoRaConfig_modem_preset_tag 2 +#define meshtastic_Config_LoRaConfig_bandwidth_tag 3 +#define meshtastic_Config_LoRaConfig_spread_factor_tag 4 +#define meshtastic_Config_LoRaConfig_coding_rate_tag 5 +#define meshtastic_Config_LoRaConfig_frequency_offset_tag 6 +#define meshtastic_Config_LoRaConfig_region_tag 7 +#define meshtastic_Config_LoRaConfig_hop_limit_tag 8 +#define meshtastic_Config_LoRaConfig_tx_enabled_tag 9 +#define meshtastic_Config_LoRaConfig_tx_power_tag 10 +#define meshtastic_Config_LoRaConfig_channel_num_tag 11 +#define meshtastic_Config_LoRaConfig_override_duty_cycle_tag 12 +#define meshtastic_Config_LoRaConfig_ignore_incoming_tag 103 +#define meshtastic_Config_BluetoothConfig_enabled_tag 1 +#define meshtastic_Config_BluetoothConfig_mode_tag 2 +#define meshtastic_Config_BluetoothConfig_fixed_pin_tag 3 +#define meshtastic_Config_device_tag 1 +#define meshtastic_Config_position_tag 2 +#define meshtastic_Config_power_tag 3 +#define meshtastic_Config_network_tag 4 +#define meshtastic_Config_display_tag 5 +#define meshtastic_Config_lora_tag 6 +#define meshtastic_Config_bluetooth_tag 7 /* Struct field encoding specification for nanopb */ -#define Config_FIELDLIST(X, a) \ +#define meshtastic_Config_FIELDLIST(X, a) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,device,payload_variant.device), 1) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,position,payload_variant.position), 2) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,power,payload_variant.power), 3) \ @@ -572,26 +572,26 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,network,payload_variant.netw X(a, STATIC, ONEOF, MESSAGE, (payload_variant,display,payload_variant.display), 5) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,lora,payload_variant.lora), 6) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,bluetooth,payload_variant.bluetooth), 7) -#define Config_CALLBACK NULL -#define Config_DEFAULT NULL -#define Config_payload_variant_device_MSGTYPE Config_DeviceConfig -#define Config_payload_variant_position_MSGTYPE Config_PositionConfig -#define Config_payload_variant_power_MSGTYPE Config_PowerConfig -#define Config_payload_variant_network_MSGTYPE Config_NetworkConfig -#define Config_payload_variant_display_MSGTYPE Config_DisplayConfig -#define Config_payload_variant_lora_MSGTYPE Config_LoRaConfig -#define Config_payload_variant_bluetooth_MSGTYPE Config_BluetoothConfig +#define meshtastic_Config_CALLBACK NULL +#define meshtastic_Config_DEFAULT NULL +#define meshtastic_Config_payload_variant_device_MSGTYPE meshtastic_Config_DeviceConfig +#define meshtastic_Config_payload_variant_position_MSGTYPE meshtastic_Config_PositionConfig +#define meshtastic_Config_payload_variant_power_MSGTYPE meshtastic_Config_PowerConfig +#define meshtastic_Config_payload_variant_network_MSGTYPE meshtastic_Config_NetworkConfig +#define meshtastic_Config_payload_variant_display_MSGTYPE meshtastic_Config_DisplayConfig +#define meshtastic_Config_payload_variant_lora_MSGTYPE meshtastic_Config_LoRaConfig +#define meshtastic_Config_payload_variant_bluetooth_MSGTYPE meshtastic_Config_BluetoothConfig -#define Config_DeviceConfig_FIELDLIST(X, a) \ +#define meshtastic_Config_DeviceConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UENUM, role, 1) \ X(a, STATIC, SINGULAR, BOOL, serial_enabled, 2) \ X(a, STATIC, SINGULAR, BOOL, debug_log_enabled, 3) \ X(a, STATIC, SINGULAR, UINT32, button_gpio, 4) \ X(a, STATIC, SINGULAR, UINT32, buzzer_gpio, 5) -#define Config_DeviceConfig_CALLBACK NULL -#define Config_DeviceConfig_DEFAULT NULL +#define meshtastic_Config_DeviceConfig_CALLBACK NULL +#define meshtastic_Config_DeviceConfig_DEFAULT NULL -#define Config_PositionConfig_FIELDLIST(X, a) \ +#define meshtastic_Config_PositionConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, position_broadcast_secs, 1) \ X(a, STATIC, SINGULAR, BOOL, position_broadcast_smart_enabled, 2) \ X(a, STATIC, SINGULAR, BOOL, fixed_position, 3) \ @@ -601,10 +601,10 @@ X(a, STATIC, SINGULAR, UINT32, gps_attempt_time, 6) \ X(a, STATIC, SINGULAR, UINT32, position_flags, 7) \ X(a, STATIC, SINGULAR, UINT32, rx_gpio, 8) \ X(a, STATIC, SINGULAR, UINT32, tx_gpio, 9) -#define Config_PositionConfig_CALLBACK NULL -#define Config_PositionConfig_DEFAULT NULL +#define meshtastic_Config_PositionConfig_CALLBACK NULL +#define meshtastic_Config_PositionConfig_DEFAULT NULL -#define Config_PowerConfig_FIELDLIST(X, a) \ +#define meshtastic_Config_PowerConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, is_power_saving, 1) \ X(a, STATIC, SINGULAR, UINT32, on_battery_shutdown_after_secs, 2) \ X(a, STATIC, SINGULAR, FLOAT, adc_multiplier_override, 3) \ @@ -613,10 +613,10 @@ X(a, STATIC, SINGULAR, UINT32, mesh_sds_timeout_secs, 5) \ X(a, STATIC, SINGULAR, UINT32, sds_secs, 6) \ X(a, STATIC, SINGULAR, UINT32, ls_secs, 7) \ X(a, STATIC, SINGULAR, UINT32, min_wake_secs, 8) -#define Config_PowerConfig_CALLBACK NULL -#define Config_PowerConfig_DEFAULT NULL +#define meshtastic_Config_PowerConfig_CALLBACK NULL +#define meshtastic_Config_PowerConfig_DEFAULT NULL -#define Config_NetworkConfig_FIELDLIST(X, a) \ +#define meshtastic_Config_NetworkConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, wifi_enabled, 1) \ X(a, STATIC, SINGULAR, STRING, wifi_ssid, 3) \ X(a, STATIC, SINGULAR, STRING, wifi_psk, 4) \ @@ -625,19 +625,19 @@ X(a, STATIC, SINGULAR, BOOL, eth_enabled, 6) \ X(a, STATIC, SINGULAR, UENUM, address_mode, 7) \ X(a, STATIC, OPTIONAL, MESSAGE, ipv4_config, 8) \ X(a, STATIC, SINGULAR, STRING, rsyslog_server, 9) -#define Config_NetworkConfig_CALLBACK NULL -#define Config_NetworkConfig_DEFAULT NULL -#define Config_NetworkConfig_ipv4_config_MSGTYPE Config_NetworkConfig_IpV4Config +#define meshtastic_Config_NetworkConfig_CALLBACK NULL +#define meshtastic_Config_NetworkConfig_DEFAULT NULL +#define meshtastic_Config_NetworkConfig_ipv4_config_MSGTYPE meshtastic_Config_NetworkConfig_IpV4Config -#define Config_NetworkConfig_IpV4Config_FIELDLIST(X, a) \ +#define meshtastic_Config_NetworkConfig_IpV4Config_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, FIXED32, ip, 1) \ X(a, STATIC, SINGULAR, FIXED32, gateway, 2) \ X(a, STATIC, SINGULAR, FIXED32, subnet, 3) \ X(a, STATIC, SINGULAR, FIXED32, dns, 4) -#define Config_NetworkConfig_IpV4Config_CALLBACK NULL -#define Config_NetworkConfig_IpV4Config_DEFAULT NULL +#define meshtastic_Config_NetworkConfig_IpV4Config_CALLBACK NULL +#define meshtastic_Config_NetworkConfig_IpV4Config_DEFAULT NULL -#define Config_DisplayConfig_FIELDLIST(X, a) \ +#define meshtastic_Config_DisplayConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, screen_on_secs, 1) \ X(a, STATIC, SINGULAR, UENUM, gps_format, 2) \ X(a, STATIC, SINGULAR, UINT32, auto_screen_carousel_secs, 3) \ @@ -647,10 +647,10 @@ X(a, STATIC, SINGULAR, UENUM, units, 6) \ X(a, STATIC, SINGULAR, UENUM, oled, 7) \ X(a, STATIC, SINGULAR, UENUM, displaymode, 8) \ X(a, STATIC, SINGULAR, BOOL, heading_bold, 9) -#define Config_DisplayConfig_CALLBACK NULL -#define Config_DisplayConfig_DEFAULT NULL +#define meshtastic_Config_DisplayConfig_CALLBACK NULL +#define meshtastic_Config_DisplayConfig_DEFAULT NULL -#define Config_LoRaConfig_FIELDLIST(X, a) \ +#define meshtastic_Config_LoRaConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, use_preset, 1) \ X(a, STATIC, SINGULAR, UENUM, modem_preset, 2) \ X(a, STATIC, SINGULAR, UINT32, bandwidth, 3) \ @@ -664,47 +664,47 @@ X(a, STATIC, SINGULAR, INT32, tx_power, 10) \ X(a, STATIC, SINGULAR, UINT32, channel_num, 11) \ X(a, STATIC, SINGULAR, BOOL, override_duty_cycle, 12) \ X(a, STATIC, REPEATED, UINT32, ignore_incoming, 103) -#define Config_LoRaConfig_CALLBACK NULL -#define Config_LoRaConfig_DEFAULT NULL +#define meshtastic_Config_LoRaConfig_CALLBACK NULL +#define meshtastic_Config_LoRaConfig_DEFAULT NULL -#define Config_BluetoothConfig_FIELDLIST(X, a) \ +#define meshtastic_Config_BluetoothConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, enabled, 1) \ X(a, STATIC, SINGULAR, UENUM, mode, 2) \ X(a, STATIC, SINGULAR, UINT32, fixed_pin, 3) -#define Config_BluetoothConfig_CALLBACK NULL -#define Config_BluetoothConfig_DEFAULT NULL +#define meshtastic_Config_BluetoothConfig_CALLBACK NULL +#define meshtastic_Config_BluetoothConfig_DEFAULT NULL -extern const pb_msgdesc_t Config_msg; -extern const pb_msgdesc_t Config_DeviceConfig_msg; -extern const pb_msgdesc_t Config_PositionConfig_msg; -extern const pb_msgdesc_t Config_PowerConfig_msg; -extern const pb_msgdesc_t Config_NetworkConfig_msg; -extern const pb_msgdesc_t Config_NetworkConfig_IpV4Config_msg; -extern const pb_msgdesc_t Config_DisplayConfig_msg; -extern const pb_msgdesc_t Config_LoRaConfig_msg; -extern const pb_msgdesc_t Config_BluetoothConfig_msg; +extern const pb_msgdesc_t meshtastic_Config_msg; +extern const pb_msgdesc_t meshtastic_Config_DeviceConfig_msg; +extern const pb_msgdesc_t meshtastic_Config_PositionConfig_msg; +extern const pb_msgdesc_t meshtastic_Config_PowerConfig_msg; +extern const pb_msgdesc_t meshtastic_Config_NetworkConfig_msg; +extern const pb_msgdesc_t meshtastic_Config_NetworkConfig_IpV4Config_msg; +extern const pb_msgdesc_t meshtastic_Config_DisplayConfig_msg; +extern const pb_msgdesc_t meshtastic_Config_LoRaConfig_msg; +extern const pb_msgdesc_t meshtastic_Config_BluetoothConfig_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define Config_fields &Config_msg -#define Config_DeviceConfig_fields &Config_DeviceConfig_msg -#define Config_PositionConfig_fields &Config_PositionConfig_msg -#define Config_PowerConfig_fields &Config_PowerConfig_msg -#define Config_NetworkConfig_fields &Config_NetworkConfig_msg -#define Config_NetworkConfig_IpV4Config_fields &Config_NetworkConfig_IpV4Config_msg -#define Config_DisplayConfig_fields &Config_DisplayConfig_msg -#define Config_LoRaConfig_fields &Config_LoRaConfig_msg -#define Config_BluetoothConfig_fields &Config_BluetoothConfig_msg +#define meshtastic_Config_fields &meshtastic_Config_msg +#define meshtastic_Config_DeviceConfig_fields &meshtastic_Config_DeviceConfig_msg +#define meshtastic_Config_PositionConfig_fields &meshtastic_Config_PositionConfig_msg +#define meshtastic_Config_PowerConfig_fields &meshtastic_Config_PowerConfig_msg +#define meshtastic_Config_NetworkConfig_fields &meshtastic_Config_NetworkConfig_msg +#define meshtastic_Config_NetworkConfig_IpV4Config_fields &meshtastic_Config_NetworkConfig_IpV4Config_msg +#define meshtastic_Config_DisplayConfig_fields &meshtastic_Config_DisplayConfig_msg +#define meshtastic_Config_LoRaConfig_fields &meshtastic_Config_LoRaConfig_msg +#define meshtastic_Config_BluetoothConfig_fields &meshtastic_Config_BluetoothConfig_msg /* Maximum encoded size of messages (where known) */ -#define Config_BluetoothConfig_size 10 -#define Config_DeviceConfig_size 18 -#define Config_DisplayConfig_size 26 -#define Config_LoRaConfig_size 70 -#define Config_NetworkConfig_IpV4Config_size 20 -#define Config_NetworkConfig_size 195 -#define Config_PositionConfig_size 42 -#define Config_PowerConfig_size 43 -#define Config_size 198 +#define meshtastic_Config_BluetoothConfig_size 10 +#define meshtastic_Config_DeviceConfig_size 18 +#define meshtastic_Config_DisplayConfig_size 26 +#define meshtastic_Config_LoRaConfig_size 70 +#define meshtastic_Config_NetworkConfig_IpV4Config_size 20 +#define meshtastic_Config_NetworkConfig_size 195 +#define meshtastic_Config_PositionConfig_size 42 +#define meshtastic_Config_PowerConfig_size 43 +#define meshtastic_Config_size 198 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/device_metadata.pb.c b/src/mesh/generated/meshtastic/device_metadata.pb.c index 725ac4c9f..627ce3244 100644 --- a/src/mesh/generated/meshtastic/device_metadata.pb.c +++ b/src/mesh/generated/meshtastic/device_metadata.pb.c @@ -1,12 +1,12 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./device_metadata.pb.h" +#include "meshtastic/device_metadata.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(DeviceMetadata, DeviceMetadata, AUTO) +PB_BIND(meshtastic_DeviceMetadata, meshtastic_DeviceMetadata, AUTO) diff --git a/src/mesh/generated/meshtastic/device_metadata.pb.h b/src/mesh/generated/meshtastic/device_metadata.pb.h index cf6314e19..384863601 100644 --- a/src/mesh/generated/meshtastic/device_metadata.pb.h +++ b/src/mesh/generated/meshtastic/device_metadata.pb.h @@ -4,7 +4,7 @@ #ifndef PB_MESHTASTIC_MESHTASTIC_DEVICE_METADATA_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_DEVICE_METADATA_PB_H_INCLUDED #include -#include "./config.pb.h" +#include "meshtastic/config.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. @@ -12,7 +12,7 @@ /* Struct definitions */ /* Device metadata response */ -typedef struct _DeviceMetadata { +typedef struct _meshtastic_DeviceMetadata { /* Device firmware version string */ char firmware_version[18]; /* Device state version */ @@ -26,10 +26,10 @@ typedef struct _DeviceMetadata { /* Indicates that the device has an ethernet peripheral */ bool hasEthernet; /* Indicates that the device's role in the mesh */ - Config_DeviceConfig_Role role; + meshtastic_Config_DeviceConfig_Role role; /* Indicates the device's current enabled position flags */ uint32_t position_flags; -} DeviceMetadata; +} meshtastic_DeviceMetadata; #ifdef __cplusplus @@ -37,21 +37,21 @@ extern "C" { #endif /* Initializer values for message structs */ -#define DeviceMetadata_init_default {"", 0, 0, 0, 0, 0, _Config_DeviceConfig_Role_MIN, 0} -#define DeviceMetadata_init_zero {"", 0, 0, 0, 0, 0, _Config_DeviceConfig_Role_MIN, 0} +#define meshtastic_DeviceMetadata_init_default {"", 0, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_Role_MIN, 0} +#define meshtastic_DeviceMetadata_init_zero {"", 0, 0, 0, 0, 0, _meshtastic_Config_DeviceConfig_Role_MIN, 0} /* Field tags (for use in manual encoding/decoding) */ -#define DeviceMetadata_firmware_version_tag 1 -#define DeviceMetadata_device_state_version_tag 2 -#define DeviceMetadata_canShutdown_tag 3 -#define DeviceMetadata_hasWifi_tag 4 -#define DeviceMetadata_hasBluetooth_tag 5 -#define DeviceMetadata_hasEthernet_tag 6 -#define DeviceMetadata_role_tag 7 -#define DeviceMetadata_position_flags_tag 8 +#define meshtastic_DeviceMetadata_firmware_version_tag 1 +#define meshtastic_DeviceMetadata_device_state_version_tag 2 +#define meshtastic_DeviceMetadata_canShutdown_tag 3 +#define meshtastic_DeviceMetadata_hasWifi_tag 4 +#define meshtastic_DeviceMetadata_hasBluetooth_tag 5 +#define meshtastic_DeviceMetadata_hasEthernet_tag 6 +#define meshtastic_DeviceMetadata_role_tag 7 +#define meshtastic_DeviceMetadata_position_flags_tag 8 /* Struct field encoding specification for nanopb */ -#define DeviceMetadata_FIELDLIST(X, a) \ +#define meshtastic_DeviceMetadata_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, STRING, firmware_version, 1) \ X(a, STATIC, SINGULAR, UINT32, device_state_version, 2) \ X(a, STATIC, SINGULAR, BOOL, canShutdown, 3) \ @@ -60,16 +60,16 @@ X(a, STATIC, SINGULAR, BOOL, hasBluetooth, 5) \ X(a, STATIC, SINGULAR, BOOL, hasEthernet, 6) \ X(a, STATIC, SINGULAR, UENUM, role, 7) \ X(a, STATIC, SINGULAR, UINT32, position_flags, 8) -#define DeviceMetadata_CALLBACK NULL -#define DeviceMetadata_DEFAULT NULL +#define meshtastic_DeviceMetadata_CALLBACK NULL +#define meshtastic_DeviceMetadata_DEFAULT NULL -extern const pb_msgdesc_t DeviceMetadata_msg; +extern const pb_msgdesc_t meshtastic_DeviceMetadata_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define DeviceMetadata_fields &DeviceMetadata_msg +#define meshtastic_DeviceMetadata_fields &meshtastic_DeviceMetadata_msg /* Maximum encoded size of messages (where known) */ -#define DeviceMetadata_size 41 +#define meshtastic_DeviceMetadata_size 41 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.c b/src/mesh/generated/meshtastic/deviceonly.pb.c index 0b26e68d1..f3d27d086 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.c +++ b/src/mesh/generated/meshtastic/deviceonly.pb.c @@ -1,18 +1,18 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./deviceonly.pb.h" +#include "meshtastic/deviceonly.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(DeviceState, DeviceState, 4) +PB_BIND(meshtastic_DeviceState, meshtastic_DeviceState, 4) -PB_BIND(ChannelFile, ChannelFile, 2) +PB_BIND(meshtastic_ChannelFile, meshtastic_ChannelFile, 2) -PB_BIND(OEMStore, OEMStore, 2) +PB_BIND(meshtastic_OEMStore, meshtastic_OEMStore, 2) diff --git a/src/mesh/generated/meshtastic/deviceonly.pb.h b/src/mesh/generated/meshtastic/deviceonly.pb.h index 234b65d00..842431b28 100644 --- a/src/mesh/generated/meshtastic/deviceonly.pb.h +++ b/src/mesh/generated/meshtastic/deviceonly.pb.h @@ -4,8 +4,8 @@ #ifndef PB_MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_INCLUDED #include -#include "./channel.pb.h" -#include "./mesh.pb.h" +#include "meshtastic/channel.pb.h" +#include "meshtastic/mesh.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. @@ -13,14 +13,14 @@ /* Enum definitions */ /* TODO: REPLACE */ -typedef enum _ScreenFonts { +typedef enum _meshtastic_ScreenFonts { /* TODO: REPLACE */ - ScreenFonts_FONT_SMALL = 0, + meshtastic_ScreenFonts_FONT_SMALL = 0, /* TODO: REPLACE */ - ScreenFonts_FONT_MEDIUM = 1, + meshtastic_ScreenFonts_FONT_MEDIUM = 1, /* TODO: REPLACE */ - ScreenFonts_FONT_LARGE = 2 -} ScreenFonts; + meshtastic_ScreenFonts_FONT_LARGE = 2 +} meshtastic_ScreenFonts; /* Struct definitions */ /* This message is never sent over the wire, but it is used for serializing DB @@ -28,24 +28,24 @@ typedef enum _ScreenFonts { FIXME, since we write this each time we enter deep sleep (and have infinite flash) it would be better to use some sort of append only data structure for the receive queue and use the preferences store for the other stuff */ -typedef struct _DeviceState { +typedef struct _meshtastic_DeviceState { /* Read only settings/info about this node */ bool has_my_node; - MyNodeInfo my_node; + meshtastic_MyNodeInfo my_node; /* My owner info */ bool has_owner; - User owner; + meshtastic_User owner; /* TODO: REPLACE */ pb_size_t node_db_count; - NodeInfo node_db[80]; + meshtastic_NodeInfo node_db[80]; /* Received packets saved for delivery to the phone */ pb_size_t receive_queue_count; - MeshPacket receive_queue[1]; + meshtastic_MeshPacket receive_queue[1]; /* We keep the last received text message (only) stored in the device flash, so we can show it on the screen. Might be null */ bool has_rx_text_message; - MeshPacket rx_text_message; + meshtastic_MeshPacket rx_text_message; /* A version integer used to invalidate old save files when we make incompatible changes This integer is set at build time and is private to NodeDB.cpp in the device code. */ @@ -55,37 +55,37 @@ typedef struct _DeviceState { bool no_save; /* Some GPSes seem to have bogus settings from the factory, so we always do one factory reset. */ bool did_gps_reset; -} DeviceState; +} meshtastic_DeviceState; /* The on-disk saved channels */ -typedef struct _ChannelFile { +typedef struct _meshtastic_ChannelFile { /* The channels our node knows about */ pb_size_t channels_count; - Channel channels[8]; + meshtastic_Channel channels[8]; /* A version integer used to invalidate old save files when we make incompatible changes This integer is set at build time and is private to NodeDB.cpp in the device code. */ uint32_t version; -} ChannelFile; +} meshtastic_ChannelFile; -typedef PB_BYTES_ARRAY_T(2048) OEMStore_oem_icon_bits_t; -typedef PB_BYTES_ARRAY_T(32) OEMStore_oem_aes_key_t; +typedef PB_BYTES_ARRAY_T(2048) meshtastic_OEMStore_oem_icon_bits_t; +typedef PB_BYTES_ARRAY_T(32) meshtastic_OEMStore_oem_aes_key_t; /* This can be used for customizing the firmware distribution. If populated, show a secondary bootup screen with cuatom logo and text for 2.5 seconds. */ -typedef struct _OEMStore { +typedef struct _meshtastic_OEMStore { /* The Logo width in Px */ uint32_t oem_icon_width; /* The Logo height in Px */ uint32_t oem_icon_height; /* The Logo in xbm bytechar format */ - OEMStore_oem_icon_bits_t oem_icon_bits; + meshtastic_OEMStore_oem_icon_bits_t oem_icon_bits; /* Use this font for the OEM text. */ - ScreenFonts oem_font; + meshtastic_ScreenFonts oem_font; /* Use this font for the OEM text. */ char oem_text[40]; /* The default device encryption key, 16 or 32 byte */ - OEMStore_oem_aes_key_t oem_aes_key; -} OEMStore; + meshtastic_OEMStore_oem_aes_key_t oem_aes_key; +} meshtastic_OEMStore; #ifdef __cplusplus @@ -93,43 +93,43 @@ extern "C" { #endif /* Helper constants for enums */ -#define _ScreenFonts_MIN ScreenFonts_FONT_SMALL -#define _ScreenFonts_MAX ScreenFonts_FONT_LARGE -#define _ScreenFonts_ARRAYSIZE ((ScreenFonts)(ScreenFonts_FONT_LARGE+1)) +#define _meshtastic_ScreenFonts_MIN meshtastic_ScreenFonts_FONT_SMALL +#define _meshtastic_ScreenFonts_MAX meshtastic_ScreenFonts_FONT_LARGE +#define _meshtastic_ScreenFonts_ARRAYSIZE ((meshtastic_ScreenFonts)(meshtastic_ScreenFonts_FONT_LARGE+1)) -#define OEMStore_oem_font_ENUMTYPE ScreenFonts +#define meshtastic_OEMStore_oem_font_ENUMTYPE meshtastic_ScreenFonts /* Initializer values for message structs */ -#define DeviceState_init_default {false, MyNodeInfo_init_default, false, User_init_default, 0, {NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default}, 0, {MeshPacket_init_default}, false, MeshPacket_init_default, 0, 0, 0} -#define ChannelFile_init_default {0, {Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default, Channel_init_default}, 0} -#define OEMStore_init_default {0, 0, {0, {0}}, _ScreenFonts_MIN, "", {0, {0}}} -#define DeviceState_init_zero {false, MyNodeInfo_init_zero, false, User_init_zero, 0, {NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero}, 0, {MeshPacket_init_zero}, false, MeshPacket_init_zero, 0, 0, 0} -#define ChannelFile_init_zero {0, {Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero, Channel_init_zero}, 0} -#define OEMStore_init_zero {0, 0, {0, {0}}, _ScreenFonts_MIN, "", {0, {0}}} +#define meshtastic_DeviceState_init_default {false, meshtastic_MyNodeInfo_init_default, false, meshtastic_User_init_default, 0, {meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default, meshtastic_NodeInfo_init_default}, 0, {meshtastic_MeshPacket_init_default}, false, meshtastic_MeshPacket_init_default, 0, 0, 0} +#define meshtastic_ChannelFile_init_default {0, {meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default}, 0} +#define meshtastic_OEMStore_init_default {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}} +#define meshtastic_DeviceState_init_zero {false, meshtastic_MyNodeInfo_init_zero, false, meshtastic_User_init_zero, 0, {meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero, meshtastic_NodeInfo_init_zero}, 0, {meshtastic_MeshPacket_init_zero}, false, meshtastic_MeshPacket_init_zero, 0, 0, 0} +#define meshtastic_ChannelFile_init_zero {0, {meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero}, 0} +#define meshtastic_OEMStore_init_zero {0, 0, {0, {0}}, _meshtastic_ScreenFonts_MIN, "", {0, {0}}} /* Field tags (for use in manual encoding/decoding) */ -#define DeviceState_my_node_tag 2 -#define DeviceState_owner_tag 3 -#define DeviceState_node_db_tag 4 -#define DeviceState_receive_queue_tag 5 -#define DeviceState_rx_text_message_tag 7 -#define DeviceState_version_tag 8 -#define DeviceState_no_save_tag 9 -#define DeviceState_did_gps_reset_tag 11 -#define ChannelFile_channels_tag 1 -#define ChannelFile_version_tag 2 -#define OEMStore_oem_icon_width_tag 1 -#define OEMStore_oem_icon_height_tag 2 -#define OEMStore_oem_icon_bits_tag 3 -#define OEMStore_oem_font_tag 4 -#define OEMStore_oem_text_tag 5 -#define OEMStore_oem_aes_key_tag 6 +#define meshtastic_DeviceState_my_node_tag 2 +#define meshtastic_DeviceState_owner_tag 3 +#define meshtastic_DeviceState_node_db_tag 4 +#define meshtastic_DeviceState_receive_queue_tag 5 +#define meshtastic_DeviceState_rx_text_message_tag 7 +#define meshtastic_DeviceState_version_tag 8 +#define meshtastic_DeviceState_no_save_tag 9 +#define meshtastic_DeviceState_did_gps_reset_tag 11 +#define meshtastic_ChannelFile_channels_tag 1 +#define meshtastic_ChannelFile_version_tag 2 +#define meshtastic_OEMStore_oem_icon_width_tag 1 +#define meshtastic_OEMStore_oem_icon_height_tag 2 +#define meshtastic_OEMStore_oem_icon_bits_tag 3 +#define meshtastic_OEMStore_oem_font_tag 4 +#define meshtastic_OEMStore_oem_text_tag 5 +#define meshtastic_OEMStore_oem_aes_key_tag 6 /* Struct field encoding specification for nanopb */ -#define DeviceState_FIELDLIST(X, a) \ +#define meshtastic_DeviceState_FIELDLIST(X, a) \ X(a, STATIC, OPTIONAL, MESSAGE, my_node, 2) \ X(a, STATIC, OPTIONAL, MESSAGE, owner, 3) \ X(a, STATIC, REPEATED, MESSAGE, node_db, 4) \ @@ -138,44 +138,44 @@ X(a, STATIC, OPTIONAL, MESSAGE, rx_text_message, 7) \ X(a, STATIC, SINGULAR, UINT32, version, 8) \ X(a, STATIC, SINGULAR, BOOL, no_save, 9) \ X(a, STATIC, SINGULAR, BOOL, did_gps_reset, 11) -#define DeviceState_CALLBACK NULL -#define DeviceState_DEFAULT NULL -#define DeviceState_my_node_MSGTYPE MyNodeInfo -#define DeviceState_owner_MSGTYPE User -#define DeviceState_node_db_MSGTYPE NodeInfo -#define DeviceState_receive_queue_MSGTYPE MeshPacket -#define DeviceState_rx_text_message_MSGTYPE MeshPacket +#define meshtastic_DeviceState_CALLBACK NULL +#define meshtastic_DeviceState_DEFAULT NULL +#define meshtastic_DeviceState_my_node_MSGTYPE meshtastic_MyNodeInfo +#define meshtastic_DeviceState_owner_MSGTYPE meshtastic_User +#define meshtastic_DeviceState_node_db_MSGTYPE meshtastic_NodeInfo +#define meshtastic_DeviceState_receive_queue_MSGTYPE meshtastic_MeshPacket +#define meshtastic_DeviceState_rx_text_message_MSGTYPE meshtastic_MeshPacket -#define ChannelFile_FIELDLIST(X, a) \ +#define meshtastic_ChannelFile_FIELDLIST(X, a) \ X(a, STATIC, REPEATED, MESSAGE, channels, 1) \ X(a, STATIC, SINGULAR, UINT32, version, 2) -#define ChannelFile_CALLBACK NULL -#define ChannelFile_DEFAULT NULL -#define ChannelFile_channels_MSGTYPE Channel +#define meshtastic_ChannelFile_CALLBACK NULL +#define meshtastic_ChannelFile_DEFAULT NULL +#define meshtastic_ChannelFile_channels_MSGTYPE meshtastic_Channel -#define OEMStore_FIELDLIST(X, a) \ +#define meshtastic_OEMStore_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, oem_icon_width, 1) \ X(a, STATIC, SINGULAR, UINT32, oem_icon_height, 2) \ X(a, STATIC, SINGULAR, BYTES, oem_icon_bits, 3) \ X(a, STATIC, SINGULAR, UENUM, oem_font, 4) \ X(a, STATIC, SINGULAR, STRING, oem_text, 5) \ X(a, STATIC, SINGULAR, BYTES, oem_aes_key, 6) -#define OEMStore_CALLBACK NULL -#define OEMStore_DEFAULT NULL +#define meshtastic_OEMStore_CALLBACK NULL +#define meshtastic_OEMStore_DEFAULT NULL -extern const pb_msgdesc_t DeviceState_msg; -extern const pb_msgdesc_t ChannelFile_msg; -extern const pb_msgdesc_t OEMStore_msg; +extern const pb_msgdesc_t meshtastic_DeviceState_msg; +extern const pb_msgdesc_t meshtastic_ChannelFile_msg; +extern const pb_msgdesc_t meshtastic_OEMStore_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define DeviceState_fields &DeviceState_msg -#define ChannelFile_fields &ChannelFile_msg -#define OEMStore_fields &OEMStore_msg +#define meshtastic_DeviceState_fields &meshtastic_DeviceState_msg +#define meshtastic_ChannelFile_fields &meshtastic_ChannelFile_msg +#define meshtastic_OEMStore_fields &meshtastic_OEMStore_msg /* Maximum encoded size of messages (where known) */ -#define ChannelFile_size 638 -#define DeviceState_size 21800 -#define OEMStore_size 2140 +#define meshtastic_ChannelFile_size 638 +#define meshtastic_DeviceState_size 21800 +#define meshtastic_OEMStore_size 2140 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/localonly.pb.c b/src/mesh/generated/meshtastic/localonly.pb.c index b6be65c46..8fc3f1139 100644 --- a/src/mesh/generated/meshtastic/localonly.pb.c +++ b/src/mesh/generated/meshtastic/localonly.pb.c @@ -1,15 +1,15 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./localonly.pb.h" +#include "meshtastic/localonly.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(LocalConfig, LocalConfig, 2) +PB_BIND(meshtastic_LocalConfig, meshtastic_LocalConfig, 2) -PB_BIND(LocalModuleConfig, LocalModuleConfig, 2) +PB_BIND(meshtastic_LocalModuleConfig, meshtastic_LocalModuleConfig, 2) diff --git a/src/mesh/generated/meshtastic/localonly.pb.h b/src/mesh/generated/meshtastic/localonly.pb.h index fbaa06666..bc0966d85 100644 --- a/src/mesh/generated/meshtastic/localonly.pb.h +++ b/src/mesh/generated/meshtastic/localonly.pb.h @@ -4,75 +4,75 @@ #ifndef PB_MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_INCLUDED #include -#include "./config.pb.h" -#include "./module_config.pb.h" +#include "meshtastic/config.pb.h" +#include "meshtastic/module_config.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif /* Struct definitions */ -typedef struct _LocalConfig { +typedef struct _meshtastic_LocalConfig { /* The part of the config that is specific to the Device */ bool has_device; - Config_DeviceConfig device; + meshtastic_Config_DeviceConfig device; /* The part of the config that is specific to the GPS Position */ bool has_position; - Config_PositionConfig position; + meshtastic_Config_PositionConfig position; /* The part of the config that is specific to the Power settings */ bool has_power; - Config_PowerConfig power; + meshtastic_Config_PowerConfig power; /* The part of the config that is specific to the Wifi Settings */ bool has_network; - Config_NetworkConfig network; + meshtastic_Config_NetworkConfig network; /* The part of the config that is specific to the Display */ bool has_display; - Config_DisplayConfig display; + meshtastic_Config_DisplayConfig display; /* The part of the config that is specific to the Lora Radio */ bool has_lora; - Config_LoRaConfig lora; + meshtastic_Config_LoRaConfig lora; /* The part of the config that is specific to the Bluetooth settings */ bool has_bluetooth; - Config_BluetoothConfig bluetooth; + meshtastic_Config_BluetoothConfig bluetooth; /* A version integer used to invalidate old save files when we make incompatible changes This integer is set at build time and is private to NodeDB.cpp in the device code. */ uint32_t version; -} LocalConfig; +} meshtastic_LocalConfig; -typedef struct _LocalModuleConfig { +typedef struct _meshtastic_LocalModuleConfig { /* The part of the config that is specific to the MQTT module */ bool has_mqtt; - ModuleConfig_MQTTConfig mqtt; + meshtastic_ModuleConfig_MQTTConfig mqtt; /* The part of the config that is specific to the Serial module */ bool has_serial; - ModuleConfig_SerialConfig serial; + meshtastic_ModuleConfig_SerialConfig serial; /* The part of the config that is specific to the ExternalNotification module */ bool has_external_notification; - ModuleConfig_ExternalNotificationConfig external_notification; + meshtastic_ModuleConfig_ExternalNotificationConfig external_notification; /* The part of the config that is specific to the Store & Forward module */ bool has_store_forward; - ModuleConfig_StoreForwardConfig store_forward; + meshtastic_ModuleConfig_StoreForwardConfig store_forward; /* The part of the config that is specific to the RangeTest module */ bool has_range_test; - ModuleConfig_RangeTestConfig range_test; + meshtastic_ModuleConfig_RangeTestConfig range_test; /* The part of the config that is specific to the Telemetry module */ bool has_telemetry; - ModuleConfig_TelemetryConfig telemetry; + meshtastic_ModuleConfig_TelemetryConfig telemetry; /* The part of the config that is specific to the Canned Message module */ bool has_canned_message; - ModuleConfig_CannedMessageConfig canned_message; + meshtastic_ModuleConfig_CannedMessageConfig canned_message; /* A version integer used to invalidate old save files when we make incompatible changes This integer is set at build time and is private to NodeDB.cpp in the device code. */ uint32_t version; /* The part of the config that is specific to the Audio module */ bool has_audio; - ModuleConfig_AudioConfig audio; + meshtastic_ModuleConfig_AudioConfig audio; /* The part of the config that is specific to the Remote Hardware module */ bool has_remote_hardware; - ModuleConfig_RemoteHardwareConfig remote_hardware; -} LocalModuleConfig; + meshtastic_ModuleConfig_RemoteHardwareConfig remote_hardware; +} meshtastic_LocalModuleConfig; #ifdef __cplusplus @@ -80,33 +80,33 @@ extern "C" { #endif /* Initializer values for message structs */ -#define LocalConfig_init_default {false, Config_DeviceConfig_init_default, false, Config_PositionConfig_init_default, false, Config_PowerConfig_init_default, false, Config_NetworkConfig_init_default, false, Config_DisplayConfig_init_default, false, Config_LoRaConfig_init_default, false, Config_BluetoothConfig_init_default, 0} -#define LocalModuleConfig_init_default {false, ModuleConfig_MQTTConfig_init_default, false, ModuleConfig_SerialConfig_init_default, false, ModuleConfig_ExternalNotificationConfig_init_default, false, ModuleConfig_StoreForwardConfig_init_default, false, ModuleConfig_RangeTestConfig_init_default, false, ModuleConfig_TelemetryConfig_init_default, false, ModuleConfig_CannedMessageConfig_init_default, 0, false, ModuleConfig_AudioConfig_init_default, false, ModuleConfig_RemoteHardwareConfig_init_default} -#define LocalConfig_init_zero {false, Config_DeviceConfig_init_zero, false, Config_PositionConfig_init_zero, false, Config_PowerConfig_init_zero, false, Config_NetworkConfig_init_zero, false, Config_DisplayConfig_init_zero, false, Config_LoRaConfig_init_zero, false, Config_BluetoothConfig_init_zero, 0} -#define LocalModuleConfig_init_zero {false, ModuleConfig_MQTTConfig_init_zero, false, ModuleConfig_SerialConfig_init_zero, false, ModuleConfig_ExternalNotificationConfig_init_zero, false, ModuleConfig_StoreForwardConfig_init_zero, false, ModuleConfig_RangeTestConfig_init_zero, false, ModuleConfig_TelemetryConfig_init_zero, false, ModuleConfig_CannedMessageConfig_init_zero, 0, false, ModuleConfig_AudioConfig_init_zero, false, ModuleConfig_RemoteHardwareConfig_init_zero} +#define meshtastic_LocalConfig_init_default {false, meshtastic_Config_DeviceConfig_init_default, false, meshtastic_Config_PositionConfig_init_default, false, meshtastic_Config_PowerConfig_init_default, false, meshtastic_Config_NetworkConfig_init_default, false, meshtastic_Config_DisplayConfig_init_default, false, meshtastic_Config_LoRaConfig_init_default, false, meshtastic_Config_BluetoothConfig_init_default, 0} +#define meshtastic_LocalModuleConfig_init_default {false, meshtastic_ModuleConfig_MQTTConfig_init_default, false, meshtastic_ModuleConfig_SerialConfig_init_default, false, meshtastic_ModuleConfig_ExternalNotificationConfig_init_default, false, meshtastic_ModuleConfig_StoreForwardConfig_init_default, false, meshtastic_ModuleConfig_RangeTestConfig_init_default, false, meshtastic_ModuleConfig_TelemetryConfig_init_default, false, meshtastic_ModuleConfig_CannedMessageConfig_init_default, 0, false, meshtastic_ModuleConfig_AudioConfig_init_default, false, meshtastic_ModuleConfig_RemoteHardwareConfig_init_default} +#define meshtastic_LocalConfig_init_zero {false, meshtastic_Config_DeviceConfig_init_zero, false, meshtastic_Config_PositionConfig_init_zero, false, meshtastic_Config_PowerConfig_init_zero, false, meshtastic_Config_NetworkConfig_init_zero, false, meshtastic_Config_DisplayConfig_init_zero, false, meshtastic_Config_LoRaConfig_init_zero, false, meshtastic_Config_BluetoothConfig_init_zero, 0} +#define meshtastic_LocalModuleConfig_init_zero {false, meshtastic_ModuleConfig_MQTTConfig_init_zero, false, meshtastic_ModuleConfig_SerialConfig_init_zero, false, meshtastic_ModuleConfig_ExternalNotificationConfig_init_zero, false, meshtastic_ModuleConfig_StoreForwardConfig_init_zero, false, meshtastic_ModuleConfig_RangeTestConfig_init_zero, false, meshtastic_ModuleConfig_TelemetryConfig_init_zero, false, meshtastic_ModuleConfig_CannedMessageConfig_init_zero, 0, false, meshtastic_ModuleConfig_AudioConfig_init_zero, false, meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero} /* Field tags (for use in manual encoding/decoding) */ -#define LocalConfig_device_tag 1 -#define LocalConfig_position_tag 2 -#define LocalConfig_power_tag 3 -#define LocalConfig_network_tag 4 -#define LocalConfig_display_tag 5 -#define LocalConfig_lora_tag 6 -#define LocalConfig_bluetooth_tag 7 -#define LocalConfig_version_tag 8 -#define LocalModuleConfig_mqtt_tag 1 -#define LocalModuleConfig_serial_tag 2 -#define LocalModuleConfig_external_notification_tag 3 -#define LocalModuleConfig_store_forward_tag 4 -#define LocalModuleConfig_range_test_tag 5 -#define LocalModuleConfig_telemetry_tag 6 -#define LocalModuleConfig_canned_message_tag 7 -#define LocalModuleConfig_version_tag 8 -#define LocalModuleConfig_audio_tag 9 -#define LocalModuleConfig_remote_hardware_tag 10 +#define meshtastic_LocalConfig_device_tag 1 +#define meshtastic_LocalConfig_position_tag 2 +#define meshtastic_LocalConfig_power_tag 3 +#define meshtastic_LocalConfig_network_tag 4 +#define meshtastic_LocalConfig_display_tag 5 +#define meshtastic_LocalConfig_lora_tag 6 +#define meshtastic_LocalConfig_bluetooth_tag 7 +#define meshtastic_LocalConfig_version_tag 8 +#define meshtastic_LocalModuleConfig_mqtt_tag 1 +#define meshtastic_LocalModuleConfig_serial_tag 2 +#define meshtastic_LocalModuleConfig_external_notification_tag 3 +#define meshtastic_LocalModuleConfig_store_forward_tag 4 +#define meshtastic_LocalModuleConfig_range_test_tag 5 +#define meshtastic_LocalModuleConfig_telemetry_tag 6 +#define meshtastic_LocalModuleConfig_canned_message_tag 7 +#define meshtastic_LocalModuleConfig_version_tag 8 +#define meshtastic_LocalModuleConfig_audio_tag 9 +#define meshtastic_LocalModuleConfig_remote_hardware_tag 10 /* Struct field encoding specification for nanopb */ -#define LocalConfig_FIELDLIST(X, a) \ +#define meshtastic_LocalConfig_FIELDLIST(X, a) \ X(a, STATIC, OPTIONAL, MESSAGE, device, 1) \ X(a, STATIC, OPTIONAL, MESSAGE, position, 2) \ X(a, STATIC, OPTIONAL, MESSAGE, power, 3) \ @@ -115,17 +115,17 @@ X(a, STATIC, OPTIONAL, MESSAGE, display, 5) \ X(a, STATIC, OPTIONAL, MESSAGE, lora, 6) \ X(a, STATIC, OPTIONAL, MESSAGE, bluetooth, 7) \ X(a, STATIC, SINGULAR, UINT32, version, 8) -#define LocalConfig_CALLBACK NULL -#define LocalConfig_DEFAULT NULL -#define LocalConfig_device_MSGTYPE Config_DeviceConfig -#define LocalConfig_position_MSGTYPE Config_PositionConfig -#define LocalConfig_power_MSGTYPE Config_PowerConfig -#define LocalConfig_network_MSGTYPE Config_NetworkConfig -#define LocalConfig_display_MSGTYPE Config_DisplayConfig -#define LocalConfig_lora_MSGTYPE Config_LoRaConfig -#define LocalConfig_bluetooth_MSGTYPE Config_BluetoothConfig +#define meshtastic_LocalConfig_CALLBACK NULL +#define meshtastic_LocalConfig_DEFAULT NULL +#define meshtastic_LocalConfig_device_MSGTYPE meshtastic_Config_DeviceConfig +#define meshtastic_LocalConfig_position_MSGTYPE meshtastic_Config_PositionConfig +#define meshtastic_LocalConfig_power_MSGTYPE meshtastic_Config_PowerConfig +#define meshtastic_LocalConfig_network_MSGTYPE meshtastic_Config_NetworkConfig +#define meshtastic_LocalConfig_display_MSGTYPE meshtastic_Config_DisplayConfig +#define meshtastic_LocalConfig_lora_MSGTYPE meshtastic_Config_LoRaConfig +#define meshtastic_LocalConfig_bluetooth_MSGTYPE meshtastic_Config_BluetoothConfig -#define LocalModuleConfig_FIELDLIST(X, a) \ +#define meshtastic_LocalModuleConfig_FIELDLIST(X, a) \ X(a, STATIC, OPTIONAL, MESSAGE, mqtt, 1) \ X(a, STATIC, OPTIONAL, MESSAGE, serial, 2) \ X(a, STATIC, OPTIONAL, MESSAGE, external_notification, 3) \ @@ -136,28 +136,28 @@ X(a, STATIC, OPTIONAL, MESSAGE, canned_message, 7) \ X(a, STATIC, SINGULAR, UINT32, version, 8) \ X(a, STATIC, OPTIONAL, MESSAGE, audio, 9) \ X(a, STATIC, OPTIONAL, MESSAGE, remote_hardware, 10) -#define LocalModuleConfig_CALLBACK NULL -#define LocalModuleConfig_DEFAULT NULL -#define LocalModuleConfig_mqtt_MSGTYPE ModuleConfig_MQTTConfig -#define LocalModuleConfig_serial_MSGTYPE ModuleConfig_SerialConfig -#define LocalModuleConfig_external_notification_MSGTYPE ModuleConfig_ExternalNotificationConfig -#define LocalModuleConfig_store_forward_MSGTYPE ModuleConfig_StoreForwardConfig -#define LocalModuleConfig_range_test_MSGTYPE ModuleConfig_RangeTestConfig -#define LocalModuleConfig_telemetry_MSGTYPE ModuleConfig_TelemetryConfig -#define LocalModuleConfig_canned_message_MSGTYPE ModuleConfig_CannedMessageConfig -#define LocalModuleConfig_audio_MSGTYPE ModuleConfig_AudioConfig -#define LocalModuleConfig_remote_hardware_MSGTYPE ModuleConfig_RemoteHardwareConfig +#define meshtastic_LocalModuleConfig_CALLBACK NULL +#define meshtastic_LocalModuleConfig_DEFAULT NULL +#define meshtastic_LocalModuleConfig_mqtt_MSGTYPE meshtastic_ModuleConfig_MQTTConfig +#define meshtastic_LocalModuleConfig_serial_MSGTYPE meshtastic_ModuleConfig_SerialConfig +#define meshtastic_LocalModuleConfig_external_notification_MSGTYPE meshtastic_ModuleConfig_ExternalNotificationConfig +#define meshtastic_LocalModuleConfig_store_forward_MSGTYPE meshtastic_ModuleConfig_StoreForwardConfig +#define meshtastic_LocalModuleConfig_range_test_MSGTYPE meshtastic_ModuleConfig_RangeTestConfig +#define meshtastic_LocalModuleConfig_telemetry_MSGTYPE meshtastic_ModuleConfig_TelemetryConfig +#define meshtastic_LocalModuleConfig_canned_message_MSGTYPE meshtastic_ModuleConfig_CannedMessageConfig +#define meshtastic_LocalModuleConfig_audio_MSGTYPE meshtastic_ModuleConfig_AudioConfig +#define meshtastic_LocalModuleConfig_remote_hardware_MSGTYPE meshtastic_ModuleConfig_RemoteHardwareConfig -extern const pb_msgdesc_t LocalConfig_msg; -extern const pb_msgdesc_t LocalModuleConfig_msg; +extern const pb_msgdesc_t meshtastic_LocalConfig_msg; +extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define LocalConfig_fields &LocalConfig_msg -#define LocalModuleConfig_fields &LocalModuleConfig_msg +#define meshtastic_LocalConfig_fields &meshtastic_LocalConfig_msg +#define meshtastic_LocalModuleConfig_fields &meshtastic_LocalModuleConfig_msg /* Maximum encoded size of messages (where known) */ -#define LocalConfig_size 425 -#define LocalModuleConfig_size 412 +#define meshtastic_LocalConfig_size 425 +#define meshtastic_LocalModuleConfig_size 412 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/mesh.pb.c b/src/mesh/generated/meshtastic/mesh.pb.c index bc9af848f..977e3916f 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.c +++ b/src/mesh/generated/meshtastic/mesh.pb.c @@ -1,51 +1,51 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./mesh.pb.h" +#include "meshtastic/mesh.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(Position, Position, AUTO) +PB_BIND(meshtastic_Position, meshtastic_Position, AUTO) -PB_BIND(User, User, AUTO) +PB_BIND(meshtastic_User, meshtastic_User, AUTO) -PB_BIND(RouteDiscovery, RouteDiscovery, AUTO) +PB_BIND(meshtastic_RouteDiscovery, meshtastic_RouteDiscovery, AUTO) -PB_BIND(Routing, Routing, AUTO) +PB_BIND(meshtastic_Routing, meshtastic_Routing, AUTO) -PB_BIND(Data, Data, 2) +PB_BIND(meshtastic_Data, meshtastic_Data, 2) -PB_BIND(Waypoint, Waypoint, AUTO) +PB_BIND(meshtastic_Waypoint, meshtastic_Waypoint, AUTO) -PB_BIND(MeshPacket, MeshPacket, 2) +PB_BIND(meshtastic_MeshPacket, meshtastic_MeshPacket, 2) -PB_BIND(NodeInfo, NodeInfo, AUTO) +PB_BIND(meshtastic_NodeInfo, meshtastic_NodeInfo, AUTO) -PB_BIND(MyNodeInfo, MyNodeInfo, AUTO) +PB_BIND(meshtastic_MyNodeInfo, meshtastic_MyNodeInfo, AUTO) -PB_BIND(LogRecord, LogRecord, AUTO) +PB_BIND(meshtastic_LogRecord, meshtastic_LogRecord, AUTO) -PB_BIND(QueueStatus, QueueStatus, AUTO) +PB_BIND(meshtastic_QueueStatus, meshtastic_QueueStatus, AUTO) -PB_BIND(FromRadio, FromRadio, 2) +PB_BIND(meshtastic_FromRadio, meshtastic_FromRadio, 2) -PB_BIND(ToRadio, ToRadio, 2) +PB_BIND(meshtastic_ToRadio, meshtastic_ToRadio, 2) -PB_BIND(Compressed, Compressed, AUTO) +PB_BIND(meshtastic_Compressed, meshtastic_Compressed, AUTO) diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 98cf8238b..0a8cf5cfe 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -4,12 +4,12 @@ #ifndef PB_MESHTASTIC_MESHTASTIC_MESH_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_MESH_PB_H_INCLUDED #include -#include "./channel.pb.h" -#include "./config.pb.h" -#include "./module_config.pb.h" -#include "./portnums.pb.h" -#include "./telemetry.pb.h" -#include "./xmodem.pb.h" +#include "meshtastic/channel.pb.h" +#include "meshtastic/config.pb.h" +#include "meshtastic/module_config.pb.h" +#include "meshtastic/portnums.pb.h" +#include "meshtastic/telemetry.pb.h" +#include "meshtastic/xmodem.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. @@ -20,179 +20,179 @@ bin/build-all.sh script. Because they will be used to find firmware filenames in the android app for OTA updates. To match the old style filenames, _ is converted to -, p is converted to . */ -typedef enum _HardwareModel { +typedef enum _meshtastic_HardwareModel { /* TODO: REPLACE */ - HardwareModel_UNSET = 0, + meshtastic_HardwareModel_UNSET = 0, /* TODO: REPLACE */ - HardwareModel_TLORA_V2 = 1, + meshtastic_HardwareModel_TLORA_V2 = 1, /* TODO: REPLACE */ - HardwareModel_TLORA_V1 = 2, + meshtastic_HardwareModel_TLORA_V1 = 2, /* TODO: REPLACE */ - HardwareModel_TLORA_V2_1_1P6 = 3, + meshtastic_HardwareModel_TLORA_V2_1_1P6 = 3, /* TODO: REPLACE */ - HardwareModel_TBEAM = 4, + meshtastic_HardwareModel_TBEAM = 4, /* The original heltec WiFi_Lora_32_V2, which had battery voltage sensing hooked to GPIO 13 (see HELTEC_V2 for the new version). */ - HardwareModel_HELTEC_V2_0 = 5, + meshtastic_HardwareModel_HELTEC_V2_0 = 5, /* TODO: REPLACE */ - HardwareModel_TBEAM_V0P7 = 6, + meshtastic_HardwareModel_TBEAM_V0P7 = 6, /* TODO: REPLACE */ - HardwareModel_T_ECHO = 7, + meshtastic_HardwareModel_T_ECHO = 7, /* TODO: REPLACE */ - HardwareModel_TLORA_V1_1P3 = 8, + meshtastic_HardwareModel_TLORA_V1_1P3 = 8, /* TODO: REPLACE */ - HardwareModel_RAK4631 = 9, + meshtastic_HardwareModel_RAK4631 = 9, /* The new version of the heltec WiFi_Lora_32_V2 board that has battery sensing hooked to GPIO 37. Sadly they did not update anything on the silkscreen to identify this board */ - HardwareModel_HELTEC_V2_1 = 10, + meshtastic_HardwareModel_HELTEC_V2_1 = 10, /* Ancient heltec WiFi_Lora_32 board */ - HardwareModel_HELTEC_V1 = 11, + meshtastic_HardwareModel_HELTEC_V1 = 11, /* New T-BEAM with ESP32-S3 CPU */ - HardwareModel_LILYGO_TBEAM_S3_CORE = 12, + meshtastic_HardwareModel_LILYGO_TBEAM_S3_CORE = 12, /* RAK WisBlock ESP32 core: https://docs.rakwireless.com/Product-Categories/WisBlock/RAK11200/Overview/ */ - HardwareModel_RAK11200 = 13, + meshtastic_HardwareModel_RAK11200 = 13, /* B&Q Consulting Nano Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:nano */ - HardwareModel_NANO_G1 = 14, + meshtastic_HardwareModel_NANO_G1 = 14, /* TODO: REPLACE */ - HardwareModel_TLORA_V2_1_1P8 = 15, + meshtastic_HardwareModel_TLORA_V2_1_1P8 = 15, /* TODO: REPLACE */ - HardwareModel_TLORA_T3_S3 = 16, + meshtastic_HardwareModel_TLORA_T3_S3 = 16, /* B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station */ - HardwareModel_STATION_G1 = 25, + meshtastic_HardwareModel_STATION_G1 = 25, /* Less common/prototype boards listed here (needs one more byte over the air) */ - HardwareModel_LORA_RELAY_V1 = 32, + meshtastic_HardwareModel_LORA_RELAY_V1 = 32, /* TODO: REPLACE */ - HardwareModel_NRF52840DK = 33, + meshtastic_HardwareModel_NRF52840DK = 33, /* TODO: REPLACE */ - HardwareModel_PPR = 34, + meshtastic_HardwareModel_PPR = 34, /* TODO: REPLACE */ - HardwareModel_GENIEBLOCKS = 35, + meshtastic_HardwareModel_GENIEBLOCKS = 35, /* TODO: REPLACE */ - HardwareModel_NRF52_UNKNOWN = 36, + meshtastic_HardwareModel_NRF52_UNKNOWN = 36, /* TODO: REPLACE */ - HardwareModel_PORTDUINO = 37, + meshtastic_HardwareModel_PORTDUINO = 37, /* The simulator built into the android app */ - HardwareModel_ANDROID_SIM = 38, + meshtastic_HardwareModel_ANDROID_SIM = 38, /* Custom DIY device based on @NanoVHF schematics: https://github.com/NanoVHF/Meshtastic-DIY/tree/main/Schematics */ - HardwareModel_DIY_V1 = 39, + meshtastic_HardwareModel_DIY_V1 = 39, /* nRF52840 Dongle : https://www.nordicsemi.com/Products/Development-hardware/nrf52840-dongle/ */ - HardwareModel_NRF52840_PCA10059 = 40, + meshtastic_HardwareModel_NRF52840_PCA10059 = 40, /* Custom Disaster Radio esp32 v3 device https://github.com/sudomesh/disaster-radio/tree/master/hardware/board_esp32_v3 */ - HardwareModel_DR_DEV = 41, + meshtastic_HardwareModel_DR_DEV = 41, /* M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/ */ - HardwareModel_M5STACK = 42, + meshtastic_HardwareModel_M5STACK = 42, /* New Heltec LoRA32 with ESP32-S3 CPU */ - HardwareModel_HELTEC_V3 = 43, + meshtastic_HardwareModel_HELTEC_V3 = 43, /* New Heltec Wireless Stick Lite with ESP32-S3 CPU */ - HardwareModel_HELTEC_WSL_V3 = 44, + meshtastic_HardwareModel_HELTEC_WSL_V3 = 44, /* New BETAFPV ELRS Micro TX Module 2.4G with ESP32 CPU */ - HardwareModel_BETAFPV_2400_TX = 45, + meshtastic_HardwareModel_BETAFPV_2400_TX = 45, /* Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. */ - HardwareModel_PRIVATE_HW = 255 -} HardwareModel; + meshtastic_HardwareModel_PRIVATE_HW = 255 +} meshtastic_HardwareModel; /* Shared constants between device and phone */ -typedef enum _Constants { +typedef enum _meshtastic_Constants { /* First enum must be zero, and we are just using this enum to pass int constants between two very different environments */ - Constants_ZERO = 0, + meshtastic_Constants_ZERO = 0, /* From mesh.options note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is outside of this envelope */ - Constants_DATA_PAYLOAD_LEN = 237 -} Constants; + meshtastic_Constants_DATA_PAYLOAD_LEN = 237 +} meshtastic_Constants; /* Error codes for critical errors The device might report these fault codes on the screen. If you encounter a fault code, please post on the meshtastic.discourse.group and we'll try to help. */ -typedef enum _CriticalErrorCode { +typedef enum _meshtastic_CriticalErrorCode { /* TODO: REPLACE */ - CriticalErrorCode_NONE = 0, + meshtastic_CriticalErrorCode_NONE = 0, /* A software bug was detected while trying to send lora */ - CriticalErrorCode_TX_WATCHDOG = 1, + meshtastic_CriticalErrorCode_TX_WATCHDOG = 1, /* A software bug was detected on entry to sleep */ - CriticalErrorCode_SLEEP_ENTER_WAIT = 2, + meshtastic_CriticalErrorCode_SLEEP_ENTER_WAIT = 2, /* No Lora radio hardware could be found */ - CriticalErrorCode_NO_RADIO = 3, + meshtastic_CriticalErrorCode_NO_RADIO = 3, /* Not normally used */ - CriticalErrorCode_UNSPECIFIED = 4, + meshtastic_CriticalErrorCode_UNSPECIFIED = 4, /* We failed while configuring a UBlox GPS */ - CriticalErrorCode_UBLOX_UNIT_FAILED = 5, + meshtastic_CriticalErrorCode_UBLOX_UNIT_FAILED = 5, /* This board was expected to have a power management chip and it is missing or broken */ - CriticalErrorCode_NO_AXP192 = 6, + meshtastic_CriticalErrorCode_NO_AXP192 = 6, /* The channel tried to set a radio setting which is not supported by this chipset, radio comms settings are now undefined. */ - CriticalErrorCode_INVALID_RADIO_SETTING = 7, + meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING = 7, /* Radio transmit hardware failure. We sent data to the radio chip, but it didn't reply with an interrupt. */ - CriticalErrorCode_TRANSMIT_FAILED = 8, + meshtastic_CriticalErrorCode_TRANSMIT_FAILED = 8, /* We detected that the main CPU voltage dropped below the minumum acceptable value */ - CriticalErrorCode_BROWNOUT = 9, + meshtastic_CriticalErrorCode_BROWNOUT = 9, /* Selftest of SX1262 radio chip failed */ - CriticalErrorCode_SX1262_FAILURE = 10, + meshtastic_CriticalErrorCode_SX1262_FAILURE = 10, /* A (likely software but possibly hardware) failure was detected while trying to send packets. If this occurs on your board, please post in the forum so that we can ask you to collect some information to allow fixing this bug */ - CriticalErrorCode_RADIO_SPI_BUG = 11 -} CriticalErrorCode; + meshtastic_CriticalErrorCode_RADIO_SPI_BUG = 11 +} meshtastic_CriticalErrorCode; /* How the location was acquired: manual, onboard GPS, external (EUD) GPS */ -typedef enum _Position_LocSource { +typedef enum _meshtastic_Position_LocSource { /* TODO: REPLACE */ - Position_LocSource_LOC_UNSET = 0, + meshtastic_Position_LocSource_LOC_UNSET = 0, /* TODO: REPLACE */ - Position_LocSource_LOC_MANUAL = 1, + meshtastic_Position_LocSource_LOC_MANUAL = 1, /* TODO: REPLACE */ - Position_LocSource_LOC_INTERNAL = 2, + meshtastic_Position_LocSource_LOC_INTERNAL = 2, /* TODO: REPLACE */ - Position_LocSource_LOC_EXTERNAL = 3 -} Position_LocSource; + meshtastic_Position_LocSource_LOC_EXTERNAL = 3 +} meshtastic_Position_LocSource; /* How the altitude was acquired: manual, GPS int/ext, etc Default: same as location_source if present */ -typedef enum _Position_AltSource { +typedef enum _meshtastic_Position_AltSource { /* TODO: REPLACE */ - Position_AltSource_ALT_UNSET = 0, + meshtastic_Position_AltSource_ALT_UNSET = 0, /* TODO: REPLACE */ - Position_AltSource_ALT_MANUAL = 1, + meshtastic_Position_AltSource_ALT_MANUAL = 1, /* TODO: REPLACE */ - Position_AltSource_ALT_INTERNAL = 2, + meshtastic_Position_AltSource_ALT_INTERNAL = 2, /* TODO: REPLACE */ - Position_AltSource_ALT_EXTERNAL = 3, + meshtastic_Position_AltSource_ALT_EXTERNAL = 3, /* TODO: REPLACE */ - Position_AltSource_ALT_BAROMETRIC = 4 -} Position_AltSource; + meshtastic_Position_AltSource_ALT_BAROMETRIC = 4 +} meshtastic_Position_AltSource; /* A failure in delivering a message (usually used for routing control messages, but might be provided in addition to ack.fail_id to provide details on the type of failure). */ -typedef enum _Routing_Error { +typedef enum _meshtastic_Routing_Error { /* This message is not a failure */ - Routing_Error_NONE = 0, + meshtastic_Routing_Error_NONE = 0, /* Our node doesn't have a route to the requested destination anymore. */ - Routing_Error_NO_ROUTE = 1, + meshtastic_Routing_Error_NO_ROUTE = 1, /* We received a nak while trying to forward on your behalf */ - Routing_Error_GOT_NAK = 2, + meshtastic_Routing_Error_GOT_NAK = 2, /* TODO: REPLACE */ - Routing_Error_TIMEOUT = 3, + meshtastic_Routing_Error_TIMEOUT = 3, /* No suitable interface could be found for delivering this packet */ - Routing_Error_NO_INTERFACE = 4, + meshtastic_Routing_Error_NO_INTERFACE = 4, /* We reached the max retransmission count (typically for naive flood routing) */ - Routing_Error_MAX_RETRANSMIT = 5, + meshtastic_Routing_Error_MAX_RETRANSMIT = 5, /* No suitable channel was found for sending this packet (i.e. was requested channel index disabled?) */ - Routing_Error_NO_CHANNEL = 6, + meshtastic_Routing_Error_NO_CHANNEL = 6, /* The packet was too big for sending (exceeds interface MTU after encoding) */ - Routing_Error_TOO_LARGE = 7, + meshtastic_Routing_Error_TOO_LARGE = 7, /* The request had want_response set, the request reached the destination node, but no service on that node wants to send a response (possibly due to bad channel permissions) */ - Routing_Error_NO_RESPONSE = 8, + meshtastic_Routing_Error_NO_RESPONSE = 8, /* Cannot send currently because duty cycle regulations will be violated. */ - Routing_Error_DUTY_CYCLE_LIMIT = 9, + meshtastic_Routing_Error_DUTY_CYCLE_LIMIT = 9, /* The application layer service on the remote node received your request, but considered your request somehow invalid */ - Routing_Error_BAD_REQUEST = 32, + meshtastic_Routing_Error_BAD_REQUEST = 32, /* The application layer service on the remote node received your request, but considered your request not authorized (i.e you did not send the request on the required bound channel) */ - Routing_Error_NOT_AUTHORIZED = 33 -} Routing_Error; + meshtastic_Routing_Error_NOT_AUTHORIZED = 33 +} meshtastic_Routing_Error; /* The priority of this message for sending. Higher priorities are sent first (when managing the transmit queue). @@ -212,57 +212,57 @@ typedef enum _Routing_Error { So I bit the bullet and implemented a new (internal - not sent over the air) field in MeshPacket called ‘priority’. And the transmission queue in the router object is now a priority queue. */ -typedef enum _MeshPacket_Priority { +typedef enum _meshtastic_MeshPacket_Priority { /* Treated as Priority.DEFAULT */ - MeshPacket_Priority_UNSET = 0, + meshtastic_MeshPacket_Priority_UNSET = 0, /* TODO: REPLACE */ - MeshPacket_Priority_MIN = 1, + meshtastic_MeshPacket_Priority_MIN = 1, /* Background position updates are sent with very low priority - if the link is super congested they might not go out at all */ - MeshPacket_Priority_BACKGROUND = 10, + meshtastic_MeshPacket_Priority_BACKGROUND = 10, /* This priority is used for most messages that don't have a priority set */ - MeshPacket_Priority_DEFAULT = 64, + meshtastic_MeshPacket_Priority_DEFAULT = 64, /* If priority is unset but the message is marked as want_ack, assume it is important and use a slightly higher priority */ - MeshPacket_Priority_RELIABLE = 70, + meshtastic_MeshPacket_Priority_RELIABLE = 70, /* Ack/naks are sent with very high priority to ensure that retransmission stops as soon as possible */ - MeshPacket_Priority_ACK = 120, + meshtastic_MeshPacket_Priority_ACK = 120, /* TODO: REPLACE */ - MeshPacket_Priority_MAX = 127 -} MeshPacket_Priority; + meshtastic_MeshPacket_Priority_MAX = 127 +} meshtastic_MeshPacket_Priority; /* Identify if this is a delayed packet */ -typedef enum _MeshPacket_Delayed { +typedef enum _meshtastic_MeshPacket_Delayed { /* If unset, the message is being sent in real time. */ - MeshPacket_Delayed_NO_DELAY = 0, + meshtastic_MeshPacket_Delayed_NO_DELAY = 0, /* The message is delayed and was originally a broadcast */ - MeshPacket_Delayed_DELAYED_BROADCAST = 1, + meshtastic_MeshPacket_Delayed_DELAYED_BROADCAST = 1, /* The message is delayed and was originally a direct message */ - MeshPacket_Delayed_DELAYED_DIRECT = 2 -} MeshPacket_Delayed; + meshtastic_MeshPacket_Delayed_DELAYED_DIRECT = 2 +} meshtastic_MeshPacket_Delayed; /* Log levels, chosen to match python logging conventions. */ -typedef enum _LogRecord_Level { +typedef enum _meshtastic_LogRecord_Level { /* Log levels, chosen to match python logging conventions. */ - LogRecord_Level_UNSET = 0, + meshtastic_LogRecord_Level_UNSET = 0, /* Log levels, chosen to match python logging conventions. */ - LogRecord_Level_CRITICAL = 50, + meshtastic_LogRecord_Level_CRITICAL = 50, /* Log levels, chosen to match python logging conventions. */ - LogRecord_Level_ERROR = 40, + meshtastic_LogRecord_Level_ERROR = 40, /* Log levels, chosen to match python logging conventions. */ - LogRecord_Level_WARNING = 30, + meshtastic_LogRecord_Level_WARNING = 30, /* Log levels, chosen to match python logging conventions. */ - LogRecord_Level_INFO = 20, + meshtastic_LogRecord_Level_INFO = 20, /* Log levels, chosen to match python logging conventions. */ - LogRecord_Level_DEBUG = 10, + meshtastic_LogRecord_Level_DEBUG = 10, /* Log levels, chosen to match python logging conventions. */ - LogRecord_Level_TRACE = 5 -} LogRecord_Level; + meshtastic_LogRecord_Level_TRACE = 5 +} meshtastic_LogRecord_Level; /* Struct definitions */ /* a gps position */ -typedef struct _Position { +typedef struct _meshtastic_Position { /* The new preferred location encoding, multiply by 1e-7 to get degrees in floating point */ int32_t latitude_i; @@ -277,9 +277,9 @@ typedef struct _Position { seconds since 1970 */ uint32_t time; /* TODO: REPLACE */ - Position_LocSource location_source; + meshtastic_Position_LocSource location_source; /* TODO: REPLACE */ - Position_AltSource altitude_source; + meshtastic_Position_AltSource altitude_source; /* Positional timestamp (actual timestamp of GPS solution) in integer epoch seconds */ uint32_t timestamp; /* Pos. timestamp milliseconds adjustment (rarely available or required) */ @@ -327,7 +327,7 @@ typedef struct _Position { /* A sequence number, incremented with each Position message to help detect lost updates if needed */ uint32_t seq_number; -} Position; +} meshtastic_Position; /* Broadcast when a newly powered mesh node wants to find a node num it can use Sent from the phone over bluetooth to set the user id for the owner of this node. @@ -349,7 +349,7 @@ typedef struct _Position { A few nodenums are reserved and will never be requested: 0xff - broadcast 0 through 3 - for future use */ -typedef struct _User { +typedef struct _meshtastic_User { /* A globally unique ID string for this user. In the case of Signal that would mean +16504442323, for the default macaddr derived id it would be !<8 hexidecimal bytes>. Note: app developers are encouraged to also use the following standard @@ -367,43 +367,43 @@ typedef struct _User { Starting in 1.2.11 moved to hw_model enum in the NodeInfo object. Apps will still need the string here for older builds (so OTA update can find the right image), but if the enum is available it will be used instead. */ - HardwareModel hw_model; + meshtastic_HardwareModel hw_model; /* In some regions Ham radio operators have different bandwidth limitations than others. If this user is a licensed operator, set this flag. Also, "long_name" should be their licence number. */ bool is_licensed; -} User; +} meshtastic_User; /* A message used in our Dynamic Source Routing protocol (RFC 4728 based) */ -typedef struct _RouteDiscovery { +typedef struct _meshtastic_RouteDiscovery { /* The list of nodenums this packet has visited so far */ pb_size_t route_count; uint32_t route[8]; -} RouteDiscovery; +} meshtastic_RouteDiscovery; /* A Routing control Data packet handled by the routing module */ -typedef struct _Routing { +typedef struct _meshtastic_Routing { pb_size_t which_variant; union { /* A route request going from the requester */ - RouteDiscovery route_request; + meshtastic_RouteDiscovery route_request; /* A route reply */ - RouteDiscovery route_reply; + meshtastic_RouteDiscovery route_reply; /* A failure in delivering a message (usually used for routing control messages, but might be provided in addition to ack.fail_id to provide details on the type of failure). */ - Routing_Error error_reason; + meshtastic_Routing_Error error_reason; }; -} Routing; +} meshtastic_Routing; -typedef PB_BYTES_ARRAY_T(237) Data_payload_t; +typedef PB_BYTES_ARRAY_T(237) meshtastic_Data_payload_t; /* (Formerly called SubPacket) The payload portion fo a packet, this is the actual bytes that are sent inside a radio packet (because from/to are broken out by the comms library) */ -typedef struct _Data { +typedef struct _meshtastic_Data { /* Formerly named typ and of type Type */ - PortNum portnum; + meshtastic_PortNum portnum; /* TODO: REPLACE */ - Data_payload_t payload; + meshtastic_Data_payload_t payload; /* Not normally used, but for testing a sender can request that recipient responds in kind (i.e. if it received a position, it should unicast back it's position). Note: that if you set this on a broadcast you will receive many replies. */ @@ -426,10 +426,10 @@ typedef struct _Data { /* Defaults to false. If true, then what is in the payload should be treated as an emoji like giving a message a heart or poop emoji. */ uint32_t emoji; -} Data; +} meshtastic_Data; /* Waypoint message, used to share arbitrary locations across the mesh */ -typedef struct _Waypoint { +typedef struct _meshtastic_Waypoint { /* Id of the waypoint */ uint32_t id; /* latitude_i */ @@ -447,13 +447,13 @@ typedef struct _Waypoint { char description[100]; /* Designator icon for the waypoint in the form of a unicode emoji */ uint32_t icon; -} Waypoint; +} meshtastic_Waypoint; -typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t; +typedef PB_BYTES_ARRAY_T(256) meshtastic_MeshPacket_encrypted_t; /* A packet envelope sent/received over the mesh only payload_variant is sent in the payload portion of the LORA packet. The other fields are either not sent at all, or sent in the special 16 byte LORA header. */ -typedef struct _MeshPacket { +typedef struct _meshtastic_MeshPacket { /* The sending node number. Note: Our crypto implementation uses this field as well. See [crypto](/docs/overview/encryption) for details. @@ -473,9 +473,9 @@ typedef struct _MeshPacket { pb_size_t which_payload_variant; union { /* TODO: REPLACE */ - Data decoded; + meshtastic_Data decoded; /* TODO: REPLACE */ - MeshPacket_encrypted_t encrypted; + meshtastic_MeshPacket_encrypted_t encrypted; }; /* A unique ID for this packet. Always 0 for no-ack packets or non broadcast packets (and therefore take zero bytes of space). @@ -514,12 +514,12 @@ typedef struct _MeshPacket { bool want_ack; /* The priority of this message for sending. See MeshPacket.Priority description for more details. */ - MeshPacket_Priority priority; + meshtastic_MeshPacket_Priority priority; /* rssi of received packet. Only sent to phone for dispay purposes. */ int32_t rx_rssi; /* Describe if this message is delayed */ - MeshPacket_Delayed delayed; -} MeshPacket; + meshtastic_MeshPacket_Delayed delayed; +} meshtastic_MeshPacket; /* The bluetooth to device link: Old BTLE protocol docs from TODO, merge in above and make real docs... @@ -537,16 +537,16 @@ typedef struct _MeshPacket { level etc) SET_CONFIG (switches device to a new set of radio params and preshared key, drops all existing nodes, force our node to rejoin this new group) Full information about a node on the mesh */ -typedef struct _NodeInfo { +typedef struct _meshtastic_NodeInfo { /* The node number */ uint32_t num; /* The user info for this node */ bool has_user; - User user; + meshtastic_User user; /* This position data. Note: before 1.2.14 we would also store the last time we've heard from this node in position.time, that is no longer true. Position.time now indicates the last time we received a POSITION from that node. */ bool has_position; - Position position; + meshtastic_Position position; /* Returns the Signal-to-noise ratio (SNR) of the last received message, as measured by the receiver. Return SNR of the last received message in dB */ float snr; @@ -554,13 +554,13 @@ typedef struct _NodeInfo { uint32_t last_heard; /* The latest device metrics for the node. */ bool has_device_metrics; - DeviceMetrics device_metrics; -} NodeInfo; + meshtastic_DeviceMetrics device_metrics; +} meshtastic_NodeInfo; /* Unique local debugging info for this node Note: we don't include position or the user info, because that will come in the Sent to the phone in response to WantNodes. */ -typedef struct _MyNodeInfo { +typedef struct _meshtastic_MyNodeInfo { /* Tells the phone what our node number is, default starting value is lowbyte of macaddr, but it will be fixed if that is already in use */ uint32_t my_node_num; @@ -577,7 +577,7 @@ typedef struct _MyNodeInfo { This field will be cleared after the phone reads MyNodeInfo (i.e. it will only be reported once) a numeric error code to go with error message, zero means no error */ - CriticalErrorCode error_code; + meshtastic_CriticalErrorCode error_code; /* A numeric error address (nonzero if available) */ uint32_t error_address; /* The total number of errors this node has ever encountered @@ -608,14 +608,14 @@ typedef struct _MyNodeInfo { float channel_utilization; /* Percent of airtime for transmission used within the last hour. */ float air_util_tx; -} MyNodeInfo; +} meshtastic_MyNodeInfo; /* Debug output from the device. To minimize the size of records inside the device code, if a time/source/level is not set on the message it is assumed to be a continuation of the previously sent message. This allows the device code to use fixed maxlen 64 byte strings for messages, and then extend as needed by emitting multiple records. */ -typedef struct _LogRecord { +typedef struct _meshtastic_LogRecord { /* Log levels, chosen to match python logging conventions. */ char message[64]; /* Seconds since 1970 - or 0 for unknown/unset */ @@ -623,10 +623,10 @@ typedef struct _LogRecord { /* Usually based on thread name - if known */ char source[8]; /* Not yet set */ - LogRecord_Level level; -} LogRecord; + meshtastic_LogRecord_Level level; +} meshtastic_LogRecord; -typedef struct _QueueStatus { +typedef struct _meshtastic_QueueStatus { /* Last attempt to queue status, ErrorCode */ int8_t res; /* Free entries in the outgoing queue */ @@ -635,30 +635,30 @@ typedef struct _QueueStatus { uint8_t maxlen; /* What was mesh packet id that generated this response? */ uint32_t mesh_packet_id; -} QueueStatus; +} meshtastic_QueueStatus; /* Packets from the radio to the phone will appear on the fromRadio characteristic. It will support READ and NOTIFY. When a new packet arrives the device will BLE notify? It will sit in that descriptor until consumed by the phone, at which point the next item in the FIFO will be populated. */ -typedef struct _FromRadio { +typedef struct _meshtastic_FromRadio { /* The packet id, used to allow the phone to request missing read packets from the FIFO, see our bluetooth docs */ uint32_t id; pb_size_t which_payload_variant; union { /* Log levels, chosen to match python logging conventions. */ - MeshPacket packet; + meshtastic_MeshPacket packet; /* Tells the phone what our node number is, can be -1 if we've not yet joined a mesh. NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. */ - MyNodeInfo my_info; + meshtastic_MyNodeInfo my_info; /* One packet is sent for each node in the on radio DB starts over with the first node in our DB */ - NodeInfo node_info; + meshtastic_NodeInfo node_info; /* Include a part of the config (was: RadioConfig radio) */ - Config config; + meshtastic_Config config; /* Set to send debug console output over our protobuf stream */ - LogRecord log_record; + meshtastic_LogRecord log_record; /* Sent as true once the device has finished sending all of the responses to want_config recipient should check if this ID matches our original request nonce, if not, it means your config responses haven't started yet. @@ -670,23 +670,23 @@ typedef struct _FromRadio { NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. */ bool rebooted; /* Include module config */ - ModuleConfig moduleConfig; + meshtastic_ModuleConfig moduleConfig; /* One packet is sent for each channel */ - Channel channel; + meshtastic_Channel channel; /* Queue status info */ - QueueStatus queueStatus; + meshtastic_QueueStatus queueStatus; /* File Transfer Chunk */ - XModem xmodemPacket; + meshtastic_XModem xmodemPacket; }; -} FromRadio; +} meshtastic_FromRadio; /* Packets/commands to the radio will be written (reliably) to the toRadio characteristic. Once the write completes the phone can assume it is handled. */ -typedef struct _ToRadio { +typedef struct _meshtastic_ToRadio { pb_size_t which_payload_variant; union { /* Send this packet on the mesh */ - MeshPacket packet; + meshtastic_MeshPacket packet; /* Phone wants radio to send full node db to the phone, This is typically the first packet sent to the radio when the phone gets a bluetooth connection. The radio will respond by sending back a @@ -700,18 +700,18 @@ typedef struct _ToRadio { This is useful for serial links where there is no hardware/protocol based notification that the client has dropped the link. (Sending this message is optional for clients) */ bool disconnect; - XModem xmodemPacket; + meshtastic_XModem xmodemPacket; }; -} ToRadio; +} meshtastic_ToRadio; -typedef PB_BYTES_ARRAY_T(237) Compressed_data_t; +typedef PB_BYTES_ARRAY_T(237) meshtastic_Compressed_data_t; /* Compressed message payload */ -typedef struct _Compressed { +typedef struct _meshtastic_Compressed { /* PortNum to determine the how to handle the compressed payload. */ - PortNum portnum; + meshtastic_PortNum portnum; /* Compressed data. */ - Compressed_data_t data; -} Compressed; + meshtastic_Compressed_data_t data; +} meshtastic_Compressed; #ifdef __cplusplus @@ -719,210 +719,210 @@ extern "C" { #endif /* Helper constants for enums */ -#define _HardwareModel_MIN HardwareModel_UNSET -#define _HardwareModel_MAX HardwareModel_PRIVATE_HW -#define _HardwareModel_ARRAYSIZE ((HardwareModel)(HardwareModel_PRIVATE_HW+1)) +#define _meshtastic_HardwareModel_MIN meshtastic_HardwareModel_UNSET +#define _meshtastic_HardwareModel_MAX meshtastic_HardwareModel_PRIVATE_HW +#define _meshtastic_HardwareModel_ARRAYSIZE ((meshtastic_HardwareModel)(meshtastic_HardwareModel_PRIVATE_HW+1)) -#define _Constants_MIN Constants_ZERO -#define _Constants_MAX Constants_DATA_PAYLOAD_LEN -#define _Constants_ARRAYSIZE ((Constants)(Constants_DATA_PAYLOAD_LEN+1)) +#define _meshtastic_Constants_MIN meshtastic_Constants_ZERO +#define _meshtastic_Constants_MAX meshtastic_Constants_DATA_PAYLOAD_LEN +#define _meshtastic_Constants_ARRAYSIZE ((meshtastic_Constants)(meshtastic_Constants_DATA_PAYLOAD_LEN+1)) -#define _CriticalErrorCode_MIN CriticalErrorCode_NONE -#define _CriticalErrorCode_MAX CriticalErrorCode_RADIO_SPI_BUG -#define _CriticalErrorCode_ARRAYSIZE ((CriticalErrorCode)(CriticalErrorCode_RADIO_SPI_BUG+1)) +#define _meshtastic_CriticalErrorCode_MIN meshtastic_CriticalErrorCode_NONE +#define _meshtastic_CriticalErrorCode_MAX meshtastic_CriticalErrorCode_RADIO_SPI_BUG +#define _meshtastic_CriticalErrorCode_ARRAYSIZE ((meshtastic_CriticalErrorCode)(meshtastic_CriticalErrorCode_RADIO_SPI_BUG+1)) -#define _Position_LocSource_MIN Position_LocSource_LOC_UNSET -#define _Position_LocSource_MAX Position_LocSource_LOC_EXTERNAL -#define _Position_LocSource_ARRAYSIZE ((Position_LocSource)(Position_LocSource_LOC_EXTERNAL+1)) +#define _meshtastic_Position_LocSource_MIN meshtastic_Position_LocSource_LOC_UNSET +#define _meshtastic_Position_LocSource_MAX meshtastic_Position_LocSource_LOC_EXTERNAL +#define _meshtastic_Position_LocSource_ARRAYSIZE ((meshtastic_Position_LocSource)(meshtastic_Position_LocSource_LOC_EXTERNAL+1)) -#define _Position_AltSource_MIN Position_AltSource_ALT_UNSET -#define _Position_AltSource_MAX Position_AltSource_ALT_BAROMETRIC -#define _Position_AltSource_ARRAYSIZE ((Position_AltSource)(Position_AltSource_ALT_BAROMETRIC+1)) +#define _meshtastic_Position_AltSource_MIN meshtastic_Position_AltSource_ALT_UNSET +#define _meshtastic_Position_AltSource_MAX meshtastic_Position_AltSource_ALT_BAROMETRIC +#define _meshtastic_Position_AltSource_ARRAYSIZE ((meshtastic_Position_AltSource)(meshtastic_Position_AltSource_ALT_BAROMETRIC+1)) -#define _Routing_Error_MIN Routing_Error_NONE -#define _Routing_Error_MAX Routing_Error_NOT_AUTHORIZED -#define _Routing_Error_ARRAYSIZE ((Routing_Error)(Routing_Error_NOT_AUTHORIZED+1)) +#define _meshtastic_Routing_Error_MIN meshtastic_Routing_Error_NONE +#define _meshtastic_Routing_Error_MAX meshtastic_Routing_Error_NOT_AUTHORIZED +#define _meshtastic_Routing_Error_ARRAYSIZE ((meshtastic_Routing_Error)(meshtastic_Routing_Error_NOT_AUTHORIZED+1)) -#define _MeshPacket_Priority_MIN MeshPacket_Priority_UNSET -#define _MeshPacket_Priority_MAX MeshPacket_Priority_MAX -#define _MeshPacket_Priority_ARRAYSIZE ((MeshPacket_Priority)(MeshPacket_Priority_MAX+1)) +#define _meshtastic_MeshPacket_Priority_MIN meshtastic_MeshPacket_Priority_UNSET +#define _meshtastic_MeshPacket_Priority_MAX meshtastic_MeshPacket_Priority_MAX +#define _meshtastic_MeshPacket_Priority_ARRAYSIZE ((meshtastic_MeshPacket_Priority)(meshtastic_MeshPacket_Priority_MAX+1)) -#define _MeshPacket_Delayed_MIN MeshPacket_Delayed_NO_DELAY -#define _MeshPacket_Delayed_MAX MeshPacket_Delayed_DELAYED_DIRECT -#define _MeshPacket_Delayed_ARRAYSIZE ((MeshPacket_Delayed)(MeshPacket_Delayed_DELAYED_DIRECT+1)) +#define _meshtastic_MeshPacket_Delayed_MIN meshtastic_MeshPacket_Delayed_NO_DELAY +#define _meshtastic_MeshPacket_Delayed_MAX meshtastic_MeshPacket_Delayed_DELAYED_DIRECT +#define _meshtastic_MeshPacket_Delayed_ARRAYSIZE ((meshtastic_MeshPacket_Delayed)(meshtastic_MeshPacket_Delayed_DELAYED_DIRECT+1)) -#define _LogRecord_Level_MIN LogRecord_Level_UNSET -#define _LogRecord_Level_MAX LogRecord_Level_CRITICAL -#define _LogRecord_Level_ARRAYSIZE ((LogRecord_Level)(LogRecord_Level_CRITICAL+1)) +#define _meshtastic_LogRecord_Level_MIN meshtastic_LogRecord_Level_UNSET +#define _meshtastic_LogRecord_Level_MAX meshtastic_LogRecord_Level_CRITICAL +#define _meshtastic_LogRecord_Level_ARRAYSIZE ((meshtastic_LogRecord_Level)(meshtastic_LogRecord_Level_CRITICAL+1)) -#define Position_location_source_ENUMTYPE Position_LocSource -#define Position_altitude_source_ENUMTYPE Position_AltSource +#define meshtastic_Position_location_source_ENUMTYPE meshtastic_Position_LocSource +#define meshtastic_Position_altitude_source_ENUMTYPE meshtastic_Position_AltSource -#define User_hw_model_ENUMTYPE HardwareModel +#define meshtastic_User_hw_model_ENUMTYPE meshtastic_HardwareModel -#define Routing_variant_error_reason_ENUMTYPE Routing_Error +#define meshtastic_Routing_variant_error_reason_ENUMTYPE meshtastic_Routing_Error -#define Data_portnum_ENUMTYPE PortNum +#define meshtastic_Data_portnum_ENUMTYPE meshtastic_PortNum -#define MeshPacket_priority_ENUMTYPE MeshPacket_Priority -#define MeshPacket_delayed_ENUMTYPE MeshPacket_Delayed +#define meshtastic_MeshPacket_priority_ENUMTYPE meshtastic_MeshPacket_Priority +#define meshtastic_MeshPacket_delayed_ENUMTYPE meshtastic_MeshPacket_Delayed -#define MyNodeInfo_error_code_ENUMTYPE CriticalErrorCode +#define meshtastic_MyNodeInfo_error_code_ENUMTYPE meshtastic_CriticalErrorCode -#define LogRecord_level_ENUMTYPE LogRecord_Level +#define meshtastic_LogRecord_level_ENUMTYPE meshtastic_LogRecord_Level -#define Compressed_portnum_ENUMTYPE PortNum +#define meshtastic_Compressed_portnum_ENUMTYPE meshtastic_PortNum /* Initializer values for message structs */ -#define Position_init_default {0, 0, 0, 0, _Position_LocSource_MIN, _Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -#define User_init_default {"", "", "", {0}, _HardwareModel_MIN, 0} -#define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}} -#define Routing_init_default {0, {RouteDiscovery_init_default}} -#define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0} -#define Waypoint_init_default {0, 0, 0, 0, 0, "", "", 0} -#define MeshPacket_init_default {0, 0, 0, 0, {Data_init_default}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN} -#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0, false, DeviceMetrics_init_default} -#define MyNodeInfo_init_default {0, 0, 0, "", _CriticalErrorCode_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} -#define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN} -#define QueueStatus_init_default {0, 0, 0, 0} -#define FromRadio_init_default {0, 0, {MeshPacket_init_default}} -#define ToRadio_init_default {0, {MeshPacket_init_default}} -#define Compressed_init_default {_PortNum_MIN, {0, {0}}} -#define Position_init_zero {0, 0, 0, 0, _Position_LocSource_MIN, _Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -#define User_init_zero {"", "", "", {0}, _HardwareModel_MIN, 0} -#define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}} -#define Routing_init_zero {0, {RouteDiscovery_init_zero}} -#define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0} -#define Waypoint_init_zero {0, 0, 0, 0, 0, "", "", 0} -#define MeshPacket_init_zero {0, 0, 0, 0, {Data_init_zero}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN} -#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0, false, DeviceMetrics_init_zero} -#define MyNodeInfo_init_zero {0, 0, 0, "", _CriticalErrorCode_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} -#define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN} -#define QueueStatus_init_zero {0, 0, 0, 0} -#define FromRadio_init_zero {0, 0, {MeshPacket_init_zero}} -#define ToRadio_init_zero {0, {MeshPacket_init_zero}} -#define Compressed_init_zero {_PortNum_MIN, {0, {0}}} +#define meshtastic_Position_init_default {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN, _meshtastic_Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_User_init_default {"", "", "", {0}, _meshtastic_HardwareModel_MIN, 0} +#define meshtastic_RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}} +#define meshtastic_Routing_init_default {0, {meshtastic_RouteDiscovery_init_default}} +#define meshtastic_Data_init_default {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0} +#define meshtastic_Waypoint_init_default {0, 0, 0, 0, 0, "", "", 0} +#define meshtastic_MeshPacket_init_default {0, 0, 0, 0, {meshtastic_Data_init_default}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN} +#define meshtastic_NodeInfo_init_default {0, false, meshtastic_User_init_default, false, meshtastic_Position_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default} +#define meshtastic_MyNodeInfo_init_default {0, 0, 0, "", _meshtastic_CriticalErrorCode_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} +#define meshtastic_LogRecord_init_default {"", 0, "", _meshtastic_LogRecord_Level_MIN} +#define meshtastic_QueueStatus_init_default {0, 0, 0, 0} +#define meshtastic_FromRadio_init_default {0, 0, {meshtastic_MeshPacket_init_default}} +#define meshtastic_ToRadio_init_default {0, {meshtastic_MeshPacket_init_default}} +#define meshtastic_Compressed_init_default {_meshtastic_PortNum_MIN, {0, {0}}} +#define meshtastic_Position_init_zero {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN, _meshtastic_Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_User_init_zero {"", "", "", {0}, _meshtastic_HardwareModel_MIN, 0} +#define meshtastic_RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}} +#define meshtastic_Routing_init_zero {0, {meshtastic_RouteDiscovery_init_zero}} +#define meshtastic_Data_init_zero {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0} +#define meshtastic_Waypoint_init_zero {0, 0, 0, 0, 0, "", "", 0} +#define meshtastic_MeshPacket_init_zero {0, 0, 0, 0, {meshtastic_Data_init_zero}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN} +#define meshtastic_NodeInfo_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_Position_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero} +#define meshtastic_MyNodeInfo_init_zero {0, 0, 0, "", _meshtastic_CriticalErrorCode_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} +#define meshtastic_LogRecord_init_zero {"", 0, "", _meshtastic_LogRecord_Level_MIN} +#define meshtastic_QueueStatus_init_zero {0, 0, 0, 0} +#define meshtastic_FromRadio_init_zero {0, 0, {meshtastic_MeshPacket_init_zero}} +#define meshtastic_ToRadio_init_zero {0, {meshtastic_MeshPacket_init_zero}} +#define meshtastic_Compressed_init_zero {_meshtastic_PortNum_MIN, {0, {0}}} /* Field tags (for use in manual encoding/decoding) */ -#define Position_latitude_i_tag 1 -#define Position_longitude_i_tag 2 -#define Position_altitude_tag 3 -#define Position_time_tag 4 -#define Position_location_source_tag 5 -#define Position_altitude_source_tag 6 -#define Position_timestamp_tag 7 -#define Position_timestamp_millis_adjust_tag 8 -#define Position_altitude_hae_tag 9 -#define Position_altitude_geoidal_separation_tag 10 -#define Position_PDOP_tag 11 -#define Position_HDOP_tag 12 -#define Position_VDOP_tag 13 -#define Position_gps_accuracy_tag 14 -#define Position_ground_speed_tag 15 -#define Position_ground_track_tag 16 -#define Position_fix_quality_tag 17 -#define Position_fix_type_tag 18 -#define Position_sats_in_view_tag 19 -#define Position_sensor_id_tag 20 -#define Position_next_update_tag 21 -#define Position_seq_number_tag 22 -#define User_id_tag 1 -#define User_long_name_tag 2 -#define User_short_name_tag 3 -#define User_macaddr_tag 4 -#define User_hw_model_tag 5 -#define User_is_licensed_tag 6 -#define RouteDiscovery_route_tag 1 -#define Routing_route_request_tag 1 -#define Routing_route_reply_tag 2 -#define Routing_error_reason_tag 3 -#define Data_portnum_tag 1 -#define Data_payload_tag 2 -#define Data_want_response_tag 3 -#define Data_dest_tag 4 -#define Data_source_tag 5 -#define Data_request_id_tag 6 -#define Data_reply_id_tag 7 -#define Data_emoji_tag 8 -#define Waypoint_id_tag 1 -#define Waypoint_latitude_i_tag 2 -#define Waypoint_longitude_i_tag 3 -#define Waypoint_expire_tag 4 -#define Waypoint_locked_to_tag 5 -#define Waypoint_name_tag 6 -#define Waypoint_description_tag 7 -#define Waypoint_icon_tag 8 -#define MeshPacket_from_tag 1 -#define MeshPacket_to_tag 2 -#define MeshPacket_channel_tag 3 -#define MeshPacket_decoded_tag 4 -#define MeshPacket_encrypted_tag 5 -#define MeshPacket_id_tag 6 -#define MeshPacket_rx_time_tag 7 -#define MeshPacket_rx_snr_tag 8 -#define MeshPacket_hop_limit_tag 9 -#define MeshPacket_want_ack_tag 10 -#define MeshPacket_priority_tag 11 -#define MeshPacket_rx_rssi_tag 12 -#define MeshPacket_delayed_tag 13 -#define NodeInfo_num_tag 1 -#define NodeInfo_user_tag 2 -#define NodeInfo_position_tag 3 -#define NodeInfo_snr_tag 4 -#define NodeInfo_last_heard_tag 5 -#define NodeInfo_device_metrics_tag 6 -#define MyNodeInfo_my_node_num_tag 1 -#define MyNodeInfo_has_gps_tag 2 -#define MyNodeInfo_max_channels_tag 3 -#define MyNodeInfo_firmware_version_tag 4 -#define MyNodeInfo_error_code_tag 5 -#define MyNodeInfo_error_address_tag 6 -#define MyNodeInfo_error_count_tag 7 -#define MyNodeInfo_reboot_count_tag 8 -#define MyNodeInfo_bitrate_tag 9 -#define MyNodeInfo_message_timeout_msec_tag 10 -#define MyNodeInfo_min_app_version_tag 11 -#define MyNodeInfo_air_period_tx_tag 12 -#define MyNodeInfo_air_period_rx_tag 13 -#define MyNodeInfo_has_wifi_tag 14 -#define MyNodeInfo_channel_utilization_tag 15 -#define MyNodeInfo_air_util_tx_tag 16 -#define LogRecord_message_tag 1 -#define LogRecord_time_tag 2 -#define LogRecord_source_tag 3 -#define LogRecord_level_tag 4 -#define QueueStatus_res_tag 1 -#define QueueStatus_free_tag 2 -#define QueueStatus_maxlen_tag 3 -#define QueueStatus_mesh_packet_id_tag 4 -#define FromRadio_id_tag 1 -#define FromRadio_packet_tag 2 -#define FromRadio_my_info_tag 3 -#define FromRadio_node_info_tag 4 -#define FromRadio_config_tag 5 -#define FromRadio_log_record_tag 6 -#define FromRadio_config_complete_id_tag 7 -#define FromRadio_rebooted_tag 8 -#define FromRadio_moduleConfig_tag 9 -#define FromRadio_channel_tag 10 -#define FromRadio_queueStatus_tag 11 -#define FromRadio_xmodemPacket_tag 12 -#define ToRadio_packet_tag 1 -#define ToRadio_want_config_id_tag 3 -#define ToRadio_disconnect_tag 4 -#define ToRadio_xmodemPacket_tag 5 -#define Compressed_portnum_tag 1 -#define Compressed_data_tag 2 +#define meshtastic_Position_latitude_i_tag 1 +#define meshtastic_Position_longitude_i_tag 2 +#define meshtastic_Position_altitude_tag 3 +#define meshtastic_Position_time_tag 4 +#define meshtastic_Position_location_source_tag 5 +#define meshtastic_Position_altitude_source_tag 6 +#define meshtastic_Position_timestamp_tag 7 +#define meshtastic_Position_timestamp_millis_adjust_tag 8 +#define meshtastic_Position_altitude_hae_tag 9 +#define meshtastic_Position_altitude_geoidal_separation_tag 10 +#define meshtastic_Position_PDOP_tag 11 +#define meshtastic_Position_HDOP_tag 12 +#define meshtastic_Position_VDOP_tag 13 +#define meshtastic_Position_gps_accuracy_tag 14 +#define meshtastic_Position_ground_speed_tag 15 +#define meshtastic_Position_ground_track_tag 16 +#define meshtastic_Position_fix_quality_tag 17 +#define meshtastic_Position_fix_type_tag 18 +#define meshtastic_Position_sats_in_view_tag 19 +#define meshtastic_Position_sensor_id_tag 20 +#define meshtastic_Position_next_update_tag 21 +#define meshtastic_Position_seq_number_tag 22 +#define meshtastic_User_id_tag 1 +#define meshtastic_User_long_name_tag 2 +#define meshtastic_User_short_name_tag 3 +#define meshtastic_User_macaddr_tag 4 +#define meshtastic_User_hw_model_tag 5 +#define meshtastic_User_is_licensed_tag 6 +#define meshtastic_RouteDiscovery_route_tag 1 +#define meshtastic_Routing_route_request_tag 1 +#define meshtastic_Routing_route_reply_tag 2 +#define meshtastic_Routing_error_reason_tag 3 +#define meshtastic_Data_portnum_tag 1 +#define meshtastic_Data_payload_tag 2 +#define meshtastic_Data_want_response_tag 3 +#define meshtastic_Data_dest_tag 4 +#define meshtastic_Data_source_tag 5 +#define meshtastic_Data_request_id_tag 6 +#define meshtastic_Data_reply_id_tag 7 +#define meshtastic_Data_emoji_tag 8 +#define meshtastic_Waypoint_id_tag 1 +#define meshtastic_Waypoint_latitude_i_tag 2 +#define meshtastic_Waypoint_longitude_i_tag 3 +#define meshtastic_Waypoint_expire_tag 4 +#define meshtastic_Waypoint_locked_to_tag 5 +#define meshtastic_Waypoint_name_tag 6 +#define meshtastic_Waypoint_description_tag 7 +#define meshtastic_Waypoint_icon_tag 8 +#define meshtastic_MeshPacket_from_tag 1 +#define meshtastic_MeshPacket_to_tag 2 +#define meshtastic_MeshPacket_channel_tag 3 +#define meshtastic_MeshPacket_decoded_tag 4 +#define meshtastic_MeshPacket_encrypted_tag 5 +#define meshtastic_MeshPacket_id_tag 6 +#define meshtastic_MeshPacket_rx_time_tag 7 +#define meshtastic_MeshPacket_rx_snr_tag 8 +#define meshtastic_MeshPacket_hop_limit_tag 9 +#define meshtastic_MeshPacket_want_ack_tag 10 +#define meshtastic_MeshPacket_priority_tag 11 +#define meshtastic_MeshPacket_rx_rssi_tag 12 +#define meshtastic_MeshPacket_delayed_tag 13 +#define meshtastic_NodeInfo_num_tag 1 +#define meshtastic_NodeInfo_user_tag 2 +#define meshtastic_NodeInfo_position_tag 3 +#define meshtastic_NodeInfo_snr_tag 4 +#define meshtastic_NodeInfo_last_heard_tag 5 +#define meshtastic_NodeInfo_device_metrics_tag 6 +#define meshtastic_MyNodeInfo_my_node_num_tag 1 +#define meshtastic_MyNodeInfo_has_gps_tag 2 +#define meshtastic_MyNodeInfo_max_channels_tag 3 +#define meshtastic_MyNodeInfo_firmware_version_tag 4 +#define meshtastic_MyNodeInfo_error_code_tag 5 +#define meshtastic_MyNodeInfo_error_address_tag 6 +#define meshtastic_MyNodeInfo_error_count_tag 7 +#define meshtastic_MyNodeInfo_reboot_count_tag 8 +#define meshtastic_MyNodeInfo_bitrate_tag 9 +#define meshtastic_MyNodeInfo_message_timeout_msec_tag 10 +#define meshtastic_MyNodeInfo_min_app_version_tag 11 +#define meshtastic_MyNodeInfo_air_period_tx_tag 12 +#define meshtastic_MyNodeInfo_air_period_rx_tag 13 +#define meshtastic_MyNodeInfo_has_wifi_tag 14 +#define meshtastic_MyNodeInfo_channel_utilization_tag 15 +#define meshtastic_MyNodeInfo_air_util_tx_tag 16 +#define meshtastic_LogRecord_message_tag 1 +#define meshtastic_LogRecord_time_tag 2 +#define meshtastic_LogRecord_source_tag 3 +#define meshtastic_LogRecord_level_tag 4 +#define meshtastic_QueueStatus_res_tag 1 +#define meshtastic_QueueStatus_free_tag 2 +#define meshtastic_QueueStatus_maxlen_tag 3 +#define meshtastic_QueueStatus_mesh_packet_id_tag 4 +#define meshtastic_FromRadio_id_tag 1 +#define meshtastic_FromRadio_packet_tag 2 +#define meshtastic_FromRadio_my_info_tag 3 +#define meshtastic_FromRadio_node_info_tag 4 +#define meshtastic_FromRadio_config_tag 5 +#define meshtastic_FromRadio_log_record_tag 6 +#define meshtastic_FromRadio_config_complete_id_tag 7 +#define meshtastic_FromRadio_rebooted_tag 8 +#define meshtastic_FromRadio_moduleConfig_tag 9 +#define meshtastic_FromRadio_channel_tag 10 +#define meshtastic_FromRadio_queueStatus_tag 11 +#define meshtastic_FromRadio_xmodemPacket_tag 12 +#define meshtastic_ToRadio_packet_tag 1 +#define meshtastic_ToRadio_want_config_id_tag 3 +#define meshtastic_ToRadio_disconnect_tag 4 +#define meshtastic_ToRadio_xmodemPacket_tag 5 +#define meshtastic_Compressed_portnum_tag 1 +#define meshtastic_Compressed_data_tag 2 /* Struct field encoding specification for nanopb */ -#define Position_FIELDLIST(X, a) \ +#define meshtastic_Position_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 1) \ X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 2) \ X(a, STATIC, SINGULAR, INT32, altitude, 3) \ @@ -945,34 +945,34 @@ X(a, STATIC, SINGULAR, UINT32, sats_in_view, 19) \ X(a, STATIC, SINGULAR, UINT32, sensor_id, 20) \ X(a, STATIC, SINGULAR, UINT32, next_update, 21) \ X(a, STATIC, SINGULAR, UINT32, seq_number, 22) -#define Position_CALLBACK NULL -#define Position_DEFAULT NULL +#define meshtastic_Position_CALLBACK NULL +#define meshtastic_Position_DEFAULT NULL -#define User_FIELDLIST(X, a) \ +#define meshtastic_User_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, STRING, id, 1) \ X(a, STATIC, SINGULAR, STRING, long_name, 2) \ X(a, STATIC, SINGULAR, STRING, short_name, 3) \ X(a, STATIC, SINGULAR, FIXED_LENGTH_BYTES, macaddr, 4) \ X(a, STATIC, SINGULAR, UENUM, hw_model, 5) \ X(a, STATIC, SINGULAR, BOOL, is_licensed, 6) -#define User_CALLBACK NULL -#define User_DEFAULT NULL +#define meshtastic_User_CALLBACK NULL +#define meshtastic_User_DEFAULT NULL -#define RouteDiscovery_FIELDLIST(X, a) \ +#define meshtastic_RouteDiscovery_FIELDLIST(X, a) \ X(a, STATIC, REPEATED, FIXED32, route, 1) -#define RouteDiscovery_CALLBACK NULL -#define RouteDiscovery_DEFAULT NULL +#define meshtastic_RouteDiscovery_CALLBACK NULL +#define meshtastic_RouteDiscovery_DEFAULT NULL -#define Routing_FIELDLIST(X, a) \ +#define meshtastic_Routing_FIELDLIST(X, a) \ X(a, STATIC, ONEOF, MESSAGE, (variant,route_request,route_request), 1) \ X(a, STATIC, ONEOF, MESSAGE, (variant,route_reply,route_reply), 2) \ X(a, STATIC, ONEOF, UENUM, (variant,error_reason,error_reason), 3) -#define Routing_CALLBACK NULL -#define Routing_DEFAULT NULL -#define Routing_variant_route_request_MSGTYPE RouteDiscovery -#define Routing_variant_route_reply_MSGTYPE RouteDiscovery +#define meshtastic_Routing_CALLBACK NULL +#define meshtastic_Routing_DEFAULT NULL +#define meshtastic_Routing_variant_route_request_MSGTYPE meshtastic_RouteDiscovery +#define meshtastic_Routing_variant_route_reply_MSGTYPE meshtastic_RouteDiscovery -#define Data_FIELDLIST(X, a) \ +#define meshtastic_Data_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UENUM, portnum, 1) \ X(a, STATIC, SINGULAR, BYTES, payload, 2) \ X(a, STATIC, SINGULAR, BOOL, want_response, 3) \ @@ -981,10 +981,10 @@ X(a, STATIC, SINGULAR, FIXED32, source, 5) \ X(a, STATIC, SINGULAR, FIXED32, request_id, 6) \ X(a, STATIC, SINGULAR, FIXED32, reply_id, 7) \ X(a, STATIC, SINGULAR, FIXED32, emoji, 8) -#define Data_CALLBACK NULL -#define Data_DEFAULT NULL +#define meshtastic_Data_CALLBACK NULL +#define meshtastic_Data_DEFAULT NULL -#define Waypoint_FIELDLIST(X, a) \ +#define meshtastic_Waypoint_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, id, 1) \ X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 2) \ X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 3) \ @@ -993,10 +993,10 @@ X(a, STATIC, SINGULAR, UINT32, locked_to, 5) \ X(a, STATIC, SINGULAR, STRING, name, 6) \ X(a, STATIC, SINGULAR, STRING, description, 7) \ X(a, STATIC, SINGULAR, FIXED32, icon, 8) -#define Waypoint_CALLBACK NULL -#define Waypoint_DEFAULT NULL +#define meshtastic_Waypoint_CALLBACK NULL +#define meshtastic_Waypoint_DEFAULT NULL -#define MeshPacket_FIELDLIST(X, a) \ +#define meshtastic_MeshPacket_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, FIXED32, from, 1) \ X(a, STATIC, SINGULAR, FIXED32, to, 2) \ X(a, STATIC, SINGULAR, UINT32, channel, 3) \ @@ -1010,24 +1010,24 @@ X(a, STATIC, SINGULAR, BOOL, want_ack, 10) \ X(a, STATIC, SINGULAR, UENUM, priority, 11) \ X(a, STATIC, SINGULAR, INT32, rx_rssi, 12) \ X(a, STATIC, SINGULAR, UENUM, delayed, 13) -#define MeshPacket_CALLBACK NULL -#define MeshPacket_DEFAULT NULL -#define MeshPacket_payload_variant_decoded_MSGTYPE Data +#define meshtastic_MeshPacket_CALLBACK NULL +#define meshtastic_MeshPacket_DEFAULT NULL +#define meshtastic_MeshPacket_payload_variant_decoded_MSGTYPE meshtastic_Data -#define NodeInfo_FIELDLIST(X, a) \ +#define meshtastic_NodeInfo_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, num, 1) \ X(a, STATIC, OPTIONAL, MESSAGE, user, 2) \ X(a, STATIC, OPTIONAL, MESSAGE, position, 3) \ X(a, STATIC, SINGULAR, FLOAT, snr, 4) \ X(a, STATIC, SINGULAR, FIXED32, last_heard, 5) \ X(a, STATIC, OPTIONAL, MESSAGE, device_metrics, 6) -#define NodeInfo_CALLBACK NULL -#define NodeInfo_DEFAULT NULL -#define NodeInfo_user_MSGTYPE User -#define NodeInfo_position_MSGTYPE Position -#define NodeInfo_device_metrics_MSGTYPE DeviceMetrics +#define meshtastic_NodeInfo_CALLBACK NULL +#define meshtastic_NodeInfo_DEFAULT NULL +#define meshtastic_NodeInfo_user_MSGTYPE meshtastic_User +#define meshtastic_NodeInfo_position_MSGTYPE meshtastic_Position +#define meshtastic_NodeInfo_device_metrics_MSGTYPE meshtastic_DeviceMetrics -#define MyNodeInfo_FIELDLIST(X, a) \ +#define meshtastic_MyNodeInfo_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, my_node_num, 1) \ X(a, STATIC, SINGULAR, BOOL, has_gps, 2) \ X(a, STATIC, SINGULAR, UINT32, max_channels, 3) \ @@ -1044,26 +1044,26 @@ X(a, STATIC, REPEATED, UINT32, air_period_rx, 13) \ X(a, STATIC, SINGULAR, BOOL, has_wifi, 14) \ X(a, STATIC, SINGULAR, FLOAT, channel_utilization, 15) \ X(a, STATIC, SINGULAR, FLOAT, air_util_tx, 16) -#define MyNodeInfo_CALLBACK NULL -#define MyNodeInfo_DEFAULT NULL +#define meshtastic_MyNodeInfo_CALLBACK NULL +#define meshtastic_MyNodeInfo_DEFAULT NULL -#define LogRecord_FIELDLIST(X, a) \ +#define meshtastic_LogRecord_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, STRING, message, 1) \ X(a, STATIC, SINGULAR, FIXED32, time, 2) \ X(a, STATIC, SINGULAR, STRING, source, 3) \ X(a, STATIC, SINGULAR, UENUM, level, 4) -#define LogRecord_CALLBACK NULL -#define LogRecord_DEFAULT NULL +#define meshtastic_LogRecord_CALLBACK NULL +#define meshtastic_LogRecord_DEFAULT NULL -#define QueueStatus_FIELDLIST(X, a) \ +#define meshtastic_QueueStatus_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, INT32, res, 1) \ X(a, STATIC, SINGULAR, UINT32, free, 2) \ X(a, STATIC, SINGULAR, UINT32, maxlen, 3) \ X(a, STATIC, SINGULAR, UINT32, mesh_packet_id, 4) -#define QueueStatus_CALLBACK NULL -#define QueueStatus_DEFAULT NULL +#define meshtastic_QueueStatus_CALLBACK NULL +#define meshtastic_QueueStatus_DEFAULT NULL -#define FromRadio_FIELDLIST(X, a) \ +#define meshtastic_FromRadio_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, id, 1) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,packet,packet), 2) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,my_info,my_info), 3) \ @@ -1076,80 +1076,80 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,moduleConfig,moduleConfig), X(a, STATIC, ONEOF, MESSAGE, (payload_variant,channel,channel), 10) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,queueStatus,queueStatus), 11) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,xmodemPacket,xmodemPacket), 12) -#define FromRadio_CALLBACK NULL -#define FromRadio_DEFAULT NULL -#define FromRadio_payload_variant_packet_MSGTYPE MeshPacket -#define FromRadio_payload_variant_my_info_MSGTYPE MyNodeInfo -#define FromRadio_payload_variant_node_info_MSGTYPE NodeInfo -#define FromRadio_payload_variant_config_MSGTYPE Config -#define FromRadio_payload_variant_log_record_MSGTYPE LogRecord -#define FromRadio_payload_variant_moduleConfig_MSGTYPE ModuleConfig -#define FromRadio_payload_variant_channel_MSGTYPE Channel -#define FromRadio_payload_variant_queueStatus_MSGTYPE QueueStatus -#define FromRadio_payload_variant_xmodemPacket_MSGTYPE XModem +#define meshtastic_FromRadio_CALLBACK NULL +#define meshtastic_FromRadio_DEFAULT NULL +#define meshtastic_FromRadio_payload_variant_packet_MSGTYPE meshtastic_MeshPacket +#define meshtastic_FromRadio_payload_variant_my_info_MSGTYPE meshtastic_MyNodeInfo +#define meshtastic_FromRadio_payload_variant_node_info_MSGTYPE meshtastic_NodeInfo +#define meshtastic_FromRadio_payload_variant_config_MSGTYPE meshtastic_Config +#define meshtastic_FromRadio_payload_variant_log_record_MSGTYPE meshtastic_LogRecord +#define meshtastic_FromRadio_payload_variant_moduleConfig_MSGTYPE meshtastic_ModuleConfig +#define meshtastic_FromRadio_payload_variant_channel_MSGTYPE meshtastic_Channel +#define meshtastic_FromRadio_payload_variant_queueStatus_MSGTYPE meshtastic_QueueStatus +#define meshtastic_FromRadio_payload_variant_xmodemPacket_MSGTYPE meshtastic_XModem -#define ToRadio_FIELDLIST(X, a) \ +#define meshtastic_ToRadio_FIELDLIST(X, a) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,packet,packet), 1) \ X(a, STATIC, ONEOF, UINT32, (payload_variant,want_config_id,want_config_id), 3) \ X(a, STATIC, ONEOF, BOOL, (payload_variant,disconnect,disconnect), 4) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,xmodemPacket,xmodemPacket), 5) -#define ToRadio_CALLBACK NULL -#define ToRadio_DEFAULT NULL -#define ToRadio_payload_variant_packet_MSGTYPE MeshPacket -#define ToRadio_payload_variant_xmodemPacket_MSGTYPE XModem +#define meshtastic_ToRadio_CALLBACK NULL +#define meshtastic_ToRadio_DEFAULT NULL +#define meshtastic_ToRadio_payload_variant_packet_MSGTYPE meshtastic_MeshPacket +#define meshtastic_ToRadio_payload_variant_xmodemPacket_MSGTYPE meshtastic_XModem -#define Compressed_FIELDLIST(X, a) \ +#define meshtastic_Compressed_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UENUM, portnum, 1) \ X(a, STATIC, SINGULAR, BYTES, data, 2) -#define Compressed_CALLBACK NULL -#define Compressed_DEFAULT NULL +#define meshtastic_Compressed_CALLBACK NULL +#define meshtastic_Compressed_DEFAULT NULL -extern const pb_msgdesc_t Position_msg; -extern const pb_msgdesc_t User_msg; -extern const pb_msgdesc_t RouteDiscovery_msg; -extern const pb_msgdesc_t Routing_msg; -extern const pb_msgdesc_t Data_msg; -extern const pb_msgdesc_t Waypoint_msg; -extern const pb_msgdesc_t MeshPacket_msg; -extern const pb_msgdesc_t NodeInfo_msg; -extern const pb_msgdesc_t MyNodeInfo_msg; -extern const pb_msgdesc_t LogRecord_msg; -extern const pb_msgdesc_t QueueStatus_msg; -extern const pb_msgdesc_t FromRadio_msg; -extern const pb_msgdesc_t ToRadio_msg; -extern const pb_msgdesc_t Compressed_msg; +extern const pb_msgdesc_t meshtastic_Position_msg; +extern const pb_msgdesc_t meshtastic_User_msg; +extern const pb_msgdesc_t meshtastic_RouteDiscovery_msg; +extern const pb_msgdesc_t meshtastic_Routing_msg; +extern const pb_msgdesc_t meshtastic_Data_msg; +extern const pb_msgdesc_t meshtastic_Waypoint_msg; +extern const pb_msgdesc_t meshtastic_MeshPacket_msg; +extern const pb_msgdesc_t meshtastic_NodeInfo_msg; +extern const pb_msgdesc_t meshtastic_MyNodeInfo_msg; +extern const pb_msgdesc_t meshtastic_LogRecord_msg; +extern const pb_msgdesc_t meshtastic_QueueStatus_msg; +extern const pb_msgdesc_t meshtastic_FromRadio_msg; +extern const pb_msgdesc_t meshtastic_ToRadio_msg; +extern const pb_msgdesc_t meshtastic_Compressed_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define Position_fields &Position_msg -#define User_fields &User_msg -#define RouteDiscovery_fields &RouteDiscovery_msg -#define Routing_fields &Routing_msg -#define Data_fields &Data_msg -#define Waypoint_fields &Waypoint_msg -#define MeshPacket_fields &MeshPacket_msg -#define NodeInfo_fields &NodeInfo_msg -#define MyNodeInfo_fields &MyNodeInfo_msg -#define LogRecord_fields &LogRecord_msg -#define QueueStatus_fields &QueueStatus_msg -#define FromRadio_fields &FromRadio_msg -#define ToRadio_fields &ToRadio_msg -#define Compressed_fields &Compressed_msg +#define meshtastic_Position_fields &meshtastic_Position_msg +#define meshtastic_User_fields &meshtastic_User_msg +#define meshtastic_RouteDiscovery_fields &meshtastic_RouteDiscovery_msg +#define meshtastic_Routing_fields &meshtastic_Routing_msg +#define meshtastic_Data_fields &meshtastic_Data_msg +#define meshtastic_Waypoint_fields &meshtastic_Waypoint_msg +#define meshtastic_MeshPacket_fields &meshtastic_MeshPacket_msg +#define meshtastic_NodeInfo_fields &meshtastic_NodeInfo_msg +#define meshtastic_MyNodeInfo_fields &meshtastic_MyNodeInfo_msg +#define meshtastic_LogRecord_fields &meshtastic_LogRecord_msg +#define meshtastic_QueueStatus_fields &meshtastic_QueueStatus_msg +#define meshtastic_FromRadio_fields &meshtastic_FromRadio_msg +#define meshtastic_ToRadio_fields &meshtastic_ToRadio_msg +#define meshtastic_Compressed_fields &meshtastic_Compressed_msg /* Maximum encoded size of messages (where known) */ -#define Compressed_size 243 -#define Data_size 270 -#define FromRadio_size 330 -#define LogRecord_size 81 -#define MeshPacket_size 321 -#define MyNodeInfo_size 179 -#define NodeInfo_size 258 -#define Position_size 137 -#define QueueStatus_size 23 -#define RouteDiscovery_size 40 -#define Routing_size 42 -#define ToRadio_size 324 -#define User_size 77 -#define Waypoint_size 165 +#define meshtastic_Compressed_size 243 +#define meshtastic_Data_size 270 +#define meshtastic_FromRadio_size 330 +#define meshtastic_LogRecord_size 81 +#define meshtastic_MeshPacket_size 321 +#define meshtastic_MyNodeInfo_size 179 +#define meshtastic_NodeInfo_size 258 +#define meshtastic_Position_size 137 +#define meshtastic_QueueStatus_size 23 +#define meshtastic_RouteDiscovery_size 40 +#define meshtastic_Routing_size 42 +#define meshtastic_ToRadio_size 324 +#define meshtastic_User_size 77 +#define meshtastic_Waypoint_size 165 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/module_config.pb.c b/src/mesh/generated/meshtastic/module_config.pb.c index a67bcfcc9..0878be909 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.c +++ b/src/mesh/generated/meshtastic/module_config.pb.c @@ -1,39 +1,39 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./module_config.pb.h" +#include "meshtastic/module_config.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(ModuleConfig, ModuleConfig, AUTO) +PB_BIND(meshtastic_ModuleConfig, meshtastic_ModuleConfig, AUTO) -PB_BIND(ModuleConfig_MQTTConfig, ModuleConfig_MQTTConfig, AUTO) +PB_BIND(meshtastic_ModuleConfig_MQTTConfig, meshtastic_ModuleConfig_MQTTConfig, AUTO) -PB_BIND(ModuleConfig_RemoteHardwareConfig, ModuleConfig_RemoteHardwareConfig, AUTO) +PB_BIND(meshtastic_ModuleConfig_RemoteHardwareConfig, meshtastic_ModuleConfig_RemoteHardwareConfig, AUTO) -PB_BIND(ModuleConfig_AudioConfig, ModuleConfig_AudioConfig, AUTO) +PB_BIND(meshtastic_ModuleConfig_AudioConfig, meshtastic_ModuleConfig_AudioConfig, AUTO) -PB_BIND(ModuleConfig_SerialConfig, ModuleConfig_SerialConfig, AUTO) +PB_BIND(meshtastic_ModuleConfig_SerialConfig, meshtastic_ModuleConfig_SerialConfig, AUTO) -PB_BIND(ModuleConfig_ExternalNotificationConfig, ModuleConfig_ExternalNotificationConfig, AUTO) +PB_BIND(meshtastic_ModuleConfig_ExternalNotificationConfig, meshtastic_ModuleConfig_ExternalNotificationConfig, AUTO) -PB_BIND(ModuleConfig_StoreForwardConfig, ModuleConfig_StoreForwardConfig, AUTO) +PB_BIND(meshtastic_ModuleConfig_StoreForwardConfig, meshtastic_ModuleConfig_StoreForwardConfig, AUTO) -PB_BIND(ModuleConfig_RangeTestConfig, ModuleConfig_RangeTestConfig, AUTO) +PB_BIND(meshtastic_ModuleConfig_RangeTestConfig, meshtastic_ModuleConfig_RangeTestConfig, AUTO) -PB_BIND(ModuleConfig_TelemetryConfig, ModuleConfig_TelemetryConfig, AUTO) +PB_BIND(meshtastic_ModuleConfig_TelemetryConfig, meshtastic_ModuleConfig_TelemetryConfig, AUTO) -PB_BIND(ModuleConfig_CannedMessageConfig, ModuleConfig_CannedMessageConfig, AUTO) +PB_BIND(meshtastic_ModuleConfig_CannedMessageConfig, meshtastic_ModuleConfig_CannedMessageConfig, AUTO) diff --git a/src/mesh/generated/meshtastic/module_config.pb.h b/src/mesh/generated/meshtastic/module_config.pb.h index 84914285f..50fed5197 100644 --- a/src/mesh/generated/meshtastic/module_config.pb.h +++ b/src/mesh/generated/meshtastic/module_config.pb.h @@ -11,70 +11,70 @@ /* Enum definitions */ /* Baudrate for codec2 voice */ -typedef enum _ModuleConfig_AudioConfig_Audio_Baud { - ModuleConfig_AudioConfig_Audio_Baud_CODEC2_DEFAULT = 0, - ModuleConfig_AudioConfig_Audio_Baud_CODEC2_3200 = 1, - ModuleConfig_AudioConfig_Audio_Baud_CODEC2_2400 = 2, - ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1600 = 3, - ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1400 = 4, - ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1300 = 5, - ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1200 = 6, - ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700 = 7, - ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B = 8 -} ModuleConfig_AudioConfig_Audio_Baud; +typedef enum _meshtastic_ModuleConfig_AudioConfig_Audio_Baud { + meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_DEFAULT = 0, + meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_3200 = 1, + meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_2400 = 2, + meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1600 = 3, + meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1400 = 4, + meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1300 = 5, + meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_1200 = 6, + meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700 = 7, + meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B = 8 +} meshtastic_ModuleConfig_AudioConfig_Audio_Baud; /* TODO: REPLACE */ -typedef enum _ModuleConfig_SerialConfig_Serial_Baud { - ModuleConfig_SerialConfig_Serial_Baud_BAUD_DEFAULT = 0, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_110 = 1, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_300 = 2, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_600 = 3, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_1200 = 4, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_2400 = 5, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_4800 = 6, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_9600 = 7, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_19200 = 8, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_38400 = 9, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_57600 = 10, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_115200 = 11, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_230400 = 12, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_460800 = 13, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_576000 = 14, - ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600 = 15 -} ModuleConfig_SerialConfig_Serial_Baud; +typedef enum _meshtastic_ModuleConfig_SerialConfig_Serial_Baud { + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_DEFAULT = 0, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_110 = 1, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_300 = 2, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_600 = 3, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_1200 = 4, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_2400 = 5, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_4800 = 6, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_9600 = 7, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_19200 = 8, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_38400 = 9, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_57600 = 10, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_115200 = 11, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_230400 = 12, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_460800 = 13, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_576000 = 14, + meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600 = 15 +} meshtastic_ModuleConfig_SerialConfig_Serial_Baud; /* TODO: REPLACE */ -typedef enum _ModuleConfig_SerialConfig_Serial_Mode { - ModuleConfig_SerialConfig_Serial_Mode_DEFAULT = 0, - ModuleConfig_SerialConfig_Serial_Mode_SIMPLE = 1, - ModuleConfig_SerialConfig_Serial_Mode_PROTO = 2, - ModuleConfig_SerialConfig_Serial_Mode_TEXTMSG = 3, - ModuleConfig_SerialConfig_Serial_Mode_NMEA = 4 -} ModuleConfig_SerialConfig_Serial_Mode; +typedef enum _meshtastic_ModuleConfig_SerialConfig_Serial_Mode { + meshtastic_ModuleConfig_SerialConfig_Serial_Mode_DEFAULT = 0, + meshtastic_ModuleConfig_SerialConfig_Serial_Mode_SIMPLE = 1, + meshtastic_ModuleConfig_SerialConfig_Serial_Mode_PROTO = 2, + meshtastic_ModuleConfig_SerialConfig_Serial_Mode_TEXTMSG = 3, + meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA = 4 +} meshtastic_ModuleConfig_SerialConfig_Serial_Mode; /* TODO: REPLACE */ -typedef enum _ModuleConfig_CannedMessageConfig_InputEventChar { +typedef enum _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar { /* TODO: REPLACE */ - ModuleConfig_CannedMessageConfig_InputEventChar_NONE = 0, + meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE = 0, /* TODO: REPLACE */ - ModuleConfig_CannedMessageConfig_InputEventChar_UP = 17, + meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP = 17, /* TODO: REPLACE */ - ModuleConfig_CannedMessageConfig_InputEventChar_DOWN = 18, + meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN = 18, /* TODO: REPLACE */ - ModuleConfig_CannedMessageConfig_InputEventChar_LEFT = 19, + meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT = 19, /* TODO: REPLACE */ - ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT = 20, + meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT = 20, /* '\n' */ - ModuleConfig_CannedMessageConfig_InputEventChar_SELECT = 10, + meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT = 10, /* TODO: REPLACE */ - ModuleConfig_CannedMessageConfig_InputEventChar_BACK = 27, + meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK = 27, /* TODO: REPLACE */ - ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL = 24 -} ModuleConfig_CannedMessageConfig_InputEventChar; + meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL = 24 +} meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar; /* Struct definitions */ /* MQTT Client Config */ -typedef struct _ModuleConfig_MQTTConfig { +typedef struct _meshtastic_ModuleConfig_MQTTConfig { /* If a meshtastic node is able to reach the internet it will normally attempt to gateway any channels that are marked as is_uplink_enabled or is_downlink_enabled. */ bool enabled; @@ -96,22 +96,22 @@ typedef struct _ModuleConfig_MQTTConfig { bool encryption_enabled; /* Whether to send / consume json packets on MQTT */ bool json_enabled; -} ModuleConfig_MQTTConfig; +} meshtastic_ModuleConfig_MQTTConfig; /* RemoteHardwareModule Config */ -typedef struct _ModuleConfig_RemoteHardwareConfig { +typedef struct _meshtastic_ModuleConfig_RemoteHardwareConfig { /* Whether the Module is enabled */ bool enabled; -} ModuleConfig_RemoteHardwareConfig; +} meshtastic_ModuleConfig_RemoteHardwareConfig; /* Audio Config for codec2 voice */ -typedef struct _ModuleConfig_AudioConfig { +typedef struct _meshtastic_ModuleConfig_AudioConfig { /* Whether Audio is enabled */ bool codec2_enabled; /* PTT Pin */ uint8_t ptt_pin; /* The audio sample rate to use for codec2 */ - ModuleConfig_AudioConfig_Audio_Baud bitrate; + meshtastic_ModuleConfig_AudioConfig_Audio_Baud bitrate; /* I2S Word Select */ uint8_t i2s_ws; /* I2S Data IN */ @@ -120,10 +120,10 @@ typedef struct _ModuleConfig_AudioConfig { uint8_t i2s_din; /* I2S Clock */ uint8_t i2s_sck; -} ModuleConfig_AudioConfig; +} meshtastic_ModuleConfig_AudioConfig; /* Serial Config */ -typedef struct _ModuleConfig_SerialConfig { +typedef struct _meshtastic_ModuleConfig_SerialConfig { /* Preferences for the SerialModule FIXME - Move this out of UserPreferences and into a section for module configuration. */ bool enabled; @@ -134,15 +134,15 @@ typedef struct _ModuleConfig_SerialConfig { /* TODO: REPLACE */ uint32_t txd; /* TODO: REPLACE */ - ModuleConfig_SerialConfig_Serial_Baud baud; + meshtastic_ModuleConfig_SerialConfig_Serial_Baud baud; /* TODO: REPLACE */ uint32_t timeout; /* TODO: REPLACE */ - ModuleConfig_SerialConfig_Serial_Mode mode; -} ModuleConfig_SerialConfig; + meshtastic_ModuleConfig_SerialConfig_Serial_Mode mode; +} meshtastic_ModuleConfig_SerialConfig; /* External Notifications Config */ -typedef struct _ModuleConfig_ExternalNotificationConfig { +typedef struct _meshtastic_ModuleConfig_ExternalNotificationConfig { /* Enable the ExternalNotificationModule */ bool enabled; /* When using in On/Off mode, keep the output on for this many @@ -181,10 +181,10 @@ typedef struct _ModuleConfig_ExternalNotificationConfig { Default is 0 which means don't repeat at all. 60 would mean blink and/or beep for 60 seconds */ uint16_t nag_timeout; -} ModuleConfig_ExternalNotificationConfig; +} meshtastic_ModuleConfig_ExternalNotificationConfig; /* Store and Forward Module Config */ -typedef struct _ModuleConfig_StoreForwardConfig { +typedef struct _meshtastic_ModuleConfig_StoreForwardConfig { /* Enable the Store and Forward Module */ bool enabled; /* TODO: REPLACE */ @@ -195,10 +195,10 @@ typedef struct _ModuleConfig_StoreForwardConfig { uint32_t history_return_max; /* TODO: REPLACE */ uint32_t history_return_window; -} ModuleConfig_StoreForwardConfig; +} meshtastic_ModuleConfig_StoreForwardConfig; /* Preferences for the RangeTestModule */ -typedef struct _ModuleConfig_RangeTestConfig { +typedef struct _meshtastic_ModuleConfig_RangeTestConfig { /* Enable the Range Test Module */ bool enabled; /* Send out range test messages from this node */ @@ -206,10 +206,10 @@ typedef struct _ModuleConfig_RangeTestConfig { /* Bool value indicating that this node should save a RangeTest.csv file. ESP32 Only */ bool save; -} ModuleConfig_RangeTestConfig; +} meshtastic_ModuleConfig_RangeTestConfig; /* Configuration for both device and environment metrics */ -typedef struct _ModuleConfig_TelemetryConfig { +typedef struct _meshtastic_ModuleConfig_TelemetryConfig { /* Interval in seconds of how often we should try to send our device metrics to the mesh */ uint32_t device_update_interval; @@ -222,10 +222,10 @@ typedef struct _ModuleConfig_TelemetryConfig { /* We'll always read the sensor in Celsius, but sometimes we might want to display the results in Fahrenheit as a "user preference". */ bool environment_display_fahrenheit; -} ModuleConfig_TelemetryConfig; +} meshtastic_ModuleConfig_TelemetryConfig; /* TODO: REPLACE */ -typedef struct _ModuleConfig_CannedMessageConfig { +typedef struct _meshtastic_ModuleConfig_CannedMessageConfig { /* Enable the rotary encoder #1. This is a 'dumb' encoder sending pulses on both A and B pins while rotating. */ bool rotary1_enabled; /* GPIO pin for rotary encoder A port. */ @@ -235,11 +235,11 @@ typedef struct _ModuleConfig_CannedMessageConfig { /* GPIO pin for rotary encoder Press port. */ uint32_t inputbroker_pin_press; /* Generate input event on CW of this kind. */ - ModuleConfig_CannedMessageConfig_InputEventChar inputbroker_event_cw; + meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar inputbroker_event_cw; /* Generate input event on CCW of this kind. */ - ModuleConfig_CannedMessageConfig_InputEventChar inputbroker_event_ccw; + meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar inputbroker_event_ccw; /* Generate input event on Press of this kind. */ - ModuleConfig_CannedMessageConfig_InputEventChar inputbroker_event_press; + meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar inputbroker_event_press; /* Enable the Up/Down/Select input device. Can be RAK rotary encoder or 3 buttons. Uses the a/b/press definitions from inputbroker. */ bool updown1_enabled; /* Enable/disable CannedMessageModule. */ @@ -250,32 +250,32 @@ typedef struct _ModuleConfig_CannedMessageConfig { /* CannedMessageModule also sends a bell character with the messages. ExternalNotificationModule can benefit from this feature. */ bool send_bell; -} ModuleConfig_CannedMessageConfig; +} meshtastic_ModuleConfig_CannedMessageConfig; /* Module Config */ -typedef struct _ModuleConfig { +typedef struct _meshtastic_ModuleConfig { pb_size_t which_payload_variant; union { /* TODO: REPLACE */ - ModuleConfig_MQTTConfig mqtt; + meshtastic_ModuleConfig_MQTTConfig mqtt; /* TODO: REPLACE */ - ModuleConfig_SerialConfig serial; + meshtastic_ModuleConfig_SerialConfig serial; /* TODO: REPLACE */ - ModuleConfig_ExternalNotificationConfig external_notification; + meshtastic_ModuleConfig_ExternalNotificationConfig external_notification; /* TODO: REPLACE */ - ModuleConfig_StoreForwardConfig store_forward; + meshtastic_ModuleConfig_StoreForwardConfig store_forward; /* TODO: REPLACE */ - ModuleConfig_RangeTestConfig range_test; + meshtastic_ModuleConfig_RangeTestConfig range_test; /* TODO: REPLACE */ - ModuleConfig_TelemetryConfig telemetry; + meshtastic_ModuleConfig_TelemetryConfig telemetry; /* TODO: REPLACE */ - ModuleConfig_CannedMessageConfig canned_message; + meshtastic_ModuleConfig_CannedMessageConfig canned_message; /* TODO: REPLACE */ - ModuleConfig_AudioConfig audio; + meshtastic_ModuleConfig_AudioConfig audio; /* TODO: REPLACE */ - ModuleConfig_RemoteHardwareConfig remote_hardware; + meshtastic_ModuleConfig_RemoteHardwareConfig remote_hardware; } payload_variant; -} ModuleConfig; +} meshtastic_ModuleConfig; #ifdef __cplusplus @@ -283,133 +283,133 @@ extern "C" { #endif /* Helper constants for enums */ -#define _ModuleConfig_AudioConfig_Audio_Baud_MIN ModuleConfig_AudioConfig_Audio_Baud_CODEC2_DEFAULT -#define _ModuleConfig_AudioConfig_Audio_Baud_MAX ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B -#define _ModuleConfig_AudioConfig_Audio_Baud_ARRAYSIZE ((ModuleConfig_AudioConfig_Audio_Baud)(ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B+1)) +#define _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_DEFAULT +#define _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MAX meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B +#define _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_ARRAYSIZE ((meshtastic_ModuleConfig_AudioConfig_Audio_Baud)(meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700B+1)) -#define _ModuleConfig_SerialConfig_Serial_Baud_MIN ModuleConfig_SerialConfig_Serial_Baud_BAUD_DEFAULT -#define _ModuleConfig_SerialConfig_Serial_Baud_MAX ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600 -#define _ModuleConfig_SerialConfig_Serial_Baud_ARRAYSIZE ((ModuleConfig_SerialConfig_Serial_Baud)(ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600+1)) +#define _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MIN meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_DEFAULT +#define _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MAX meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600 +#define _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Baud)(meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600+1)) -#define _ModuleConfig_SerialConfig_Serial_Mode_MIN ModuleConfig_SerialConfig_Serial_Mode_DEFAULT -#define _ModuleConfig_SerialConfig_Serial_Mode_MAX ModuleConfig_SerialConfig_Serial_Mode_NMEA -#define _ModuleConfig_SerialConfig_Serial_Mode_ARRAYSIZE ((ModuleConfig_SerialConfig_Serial_Mode)(ModuleConfig_SerialConfig_Serial_Mode_NMEA+1)) +#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN meshtastic_ModuleConfig_SerialConfig_Serial_Mode_DEFAULT +#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MAX meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA +#define _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_ARRAYSIZE ((meshtastic_ModuleConfig_SerialConfig_Serial_Mode)(meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA+1)) -#define _ModuleConfig_CannedMessageConfig_InputEventChar_MIN ModuleConfig_CannedMessageConfig_InputEventChar_NONE -#define _ModuleConfig_CannedMessageConfig_InputEventChar_MAX ModuleConfig_CannedMessageConfig_InputEventChar_BACK -#define _ModuleConfig_CannedMessageConfig_InputEventChar_ARRAYSIZE ((ModuleConfig_CannedMessageConfig_InputEventChar)(ModuleConfig_CannedMessageConfig_InputEventChar_BACK+1)) +#define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE +#define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MAX meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK +#define _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_ARRAYSIZE ((meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar)(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK+1)) -#define ModuleConfig_AudioConfig_bitrate_ENUMTYPE ModuleConfig_AudioConfig_Audio_Baud +#define meshtastic_ModuleConfig_AudioConfig_bitrate_ENUMTYPE meshtastic_ModuleConfig_AudioConfig_Audio_Baud -#define ModuleConfig_SerialConfig_baud_ENUMTYPE ModuleConfig_SerialConfig_Serial_Baud -#define ModuleConfig_SerialConfig_mode_ENUMTYPE ModuleConfig_SerialConfig_Serial_Mode +#define meshtastic_ModuleConfig_SerialConfig_baud_ENUMTYPE meshtastic_ModuleConfig_SerialConfig_Serial_Baud +#define meshtastic_ModuleConfig_SerialConfig_mode_ENUMTYPE meshtastic_ModuleConfig_SerialConfig_Serial_Mode -#define ModuleConfig_CannedMessageConfig_inputbroker_event_cw_ENUMTYPE ModuleConfig_CannedMessageConfig_InputEventChar -#define ModuleConfig_CannedMessageConfig_inputbroker_event_ccw_ENUMTYPE ModuleConfig_CannedMessageConfig_InputEventChar -#define ModuleConfig_CannedMessageConfig_inputbroker_event_press_ENUMTYPE ModuleConfig_CannedMessageConfig_InputEventChar +#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_cw_ENUMTYPE meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar +#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_ccw_ENUMTYPE meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar +#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_press_ENUMTYPE meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar /* Initializer values for message structs */ -#define ModuleConfig_init_default {0, {ModuleConfig_MQTTConfig_init_default}} -#define ModuleConfig_MQTTConfig_init_default {0, "", "", "", 0, 0} -#define ModuleConfig_RemoteHardwareConfig_init_default {0} -#define ModuleConfig_AudioConfig_init_default {0, 0, _ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0} -#define ModuleConfig_SerialConfig_init_default {0, 0, 0, 0, _ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _ModuleConfig_SerialConfig_Serial_Mode_MIN} -#define ModuleConfig_ExternalNotificationConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -#define ModuleConfig_StoreForwardConfig_init_default {0, 0, 0, 0, 0} -#define ModuleConfig_RangeTestConfig_init_default {0, 0, 0} -#define ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0} -#define ModuleConfig_CannedMessageConfig_init_default {0, 0, 0, 0, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0} -#define ModuleConfig_init_zero {0, {ModuleConfig_MQTTConfig_init_zero}} -#define ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0} -#define ModuleConfig_RemoteHardwareConfig_init_zero {0} -#define ModuleConfig_AudioConfig_init_zero {0, 0, _ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0} -#define ModuleConfig_SerialConfig_init_zero {0, 0, 0, 0, _ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _ModuleConfig_SerialConfig_Serial_Mode_MIN} -#define ModuleConfig_ExternalNotificationConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -#define ModuleConfig_StoreForwardConfig_init_zero {0, 0, 0, 0, 0} -#define ModuleConfig_RangeTestConfig_init_zero {0, 0, 0} -#define ModuleConfig_TelemetryConfig_init_zero {0, 0, 0, 0, 0} -#define ModuleConfig_CannedMessageConfig_init_zero {0, 0, 0, 0, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0} +#define meshtastic_ModuleConfig_init_default {0, {meshtastic_ModuleConfig_MQTTConfig_init_default}} +#define meshtastic_ModuleConfig_MQTTConfig_init_default {0, "", "", "", 0, 0} +#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_default {0} +#define meshtastic_ModuleConfig_AudioConfig_init_default {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0} +#define meshtastic_ModuleConfig_SerialConfig_init_default {0, 0, 0, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN} +#define meshtastic_ModuleConfig_ExternalNotificationConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_ModuleConfig_StoreForwardConfig_init_default {0, 0, 0, 0, 0} +#define meshtastic_ModuleConfig_RangeTestConfig_init_default {0, 0, 0} +#define meshtastic_ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0} +#define meshtastic_ModuleConfig_CannedMessageConfig_init_default {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0} +#define meshtastic_ModuleConfig_init_zero {0, {meshtastic_ModuleConfig_MQTTConfig_init_zero}} +#define meshtastic_ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0, 0} +#define meshtastic_ModuleConfig_RemoteHardwareConfig_init_zero {0} +#define meshtastic_ModuleConfig_AudioConfig_init_zero {0, 0, _meshtastic_ModuleConfig_AudioConfig_Audio_Baud_MIN, 0, 0, 0, 0} +#define meshtastic_ModuleConfig_SerialConfig_init_zero {0, 0, 0, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Baud_MIN, 0, _meshtastic_ModuleConfig_SerialConfig_Serial_Mode_MIN} +#define meshtastic_ModuleConfig_ExternalNotificationConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_ModuleConfig_StoreForwardConfig_init_zero {0, 0, 0, 0, 0} +#define meshtastic_ModuleConfig_RangeTestConfig_init_zero {0, 0, 0} +#define meshtastic_ModuleConfig_TelemetryConfig_init_zero {0, 0, 0, 0, 0} +#define meshtastic_ModuleConfig_CannedMessageConfig_init_zero {0, 0, 0, 0, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0} /* Field tags (for use in manual encoding/decoding) */ -#define ModuleConfig_MQTTConfig_enabled_tag 1 -#define ModuleConfig_MQTTConfig_address_tag 2 -#define ModuleConfig_MQTTConfig_username_tag 3 -#define ModuleConfig_MQTTConfig_password_tag 4 -#define ModuleConfig_MQTTConfig_encryption_enabled_tag 5 -#define ModuleConfig_MQTTConfig_json_enabled_tag 6 -#define ModuleConfig_RemoteHardwareConfig_enabled_tag 1 -#define ModuleConfig_AudioConfig_codec2_enabled_tag 1 -#define ModuleConfig_AudioConfig_ptt_pin_tag 2 -#define ModuleConfig_AudioConfig_bitrate_tag 3 -#define ModuleConfig_AudioConfig_i2s_ws_tag 4 -#define ModuleConfig_AudioConfig_i2s_sd_tag 5 -#define ModuleConfig_AudioConfig_i2s_din_tag 6 -#define ModuleConfig_AudioConfig_i2s_sck_tag 7 -#define ModuleConfig_SerialConfig_enabled_tag 1 -#define ModuleConfig_SerialConfig_echo_tag 2 -#define ModuleConfig_SerialConfig_rxd_tag 3 -#define ModuleConfig_SerialConfig_txd_tag 4 -#define ModuleConfig_SerialConfig_baud_tag 5 -#define ModuleConfig_SerialConfig_timeout_tag 6 -#define ModuleConfig_SerialConfig_mode_tag 7 -#define ModuleConfig_ExternalNotificationConfig_enabled_tag 1 -#define ModuleConfig_ExternalNotificationConfig_output_ms_tag 2 -#define ModuleConfig_ExternalNotificationConfig_output_tag 3 -#define ModuleConfig_ExternalNotificationConfig_active_tag 4 -#define ModuleConfig_ExternalNotificationConfig_alert_message_tag 5 -#define ModuleConfig_ExternalNotificationConfig_alert_bell_tag 6 -#define ModuleConfig_ExternalNotificationConfig_use_pwm_tag 7 -#define ModuleConfig_ExternalNotificationConfig_output_vibra_tag 8 -#define ModuleConfig_ExternalNotificationConfig_output_buzzer_tag 9 -#define ModuleConfig_ExternalNotificationConfig_alert_message_vibra_tag 10 -#define ModuleConfig_ExternalNotificationConfig_alert_message_buzzer_tag 11 -#define ModuleConfig_ExternalNotificationConfig_alert_bell_vibra_tag 12 -#define ModuleConfig_ExternalNotificationConfig_alert_bell_buzzer_tag 13 -#define ModuleConfig_ExternalNotificationConfig_nag_timeout_tag 14 -#define ModuleConfig_StoreForwardConfig_enabled_tag 1 -#define ModuleConfig_StoreForwardConfig_heartbeat_tag 2 -#define ModuleConfig_StoreForwardConfig_records_tag 3 -#define ModuleConfig_StoreForwardConfig_history_return_max_tag 4 -#define ModuleConfig_StoreForwardConfig_history_return_window_tag 5 -#define ModuleConfig_RangeTestConfig_enabled_tag 1 -#define ModuleConfig_RangeTestConfig_sender_tag 2 -#define ModuleConfig_RangeTestConfig_save_tag 3 -#define ModuleConfig_TelemetryConfig_device_update_interval_tag 1 -#define ModuleConfig_TelemetryConfig_environment_update_interval_tag 2 -#define ModuleConfig_TelemetryConfig_environment_measurement_enabled_tag 3 -#define ModuleConfig_TelemetryConfig_environment_screen_enabled_tag 4 -#define ModuleConfig_TelemetryConfig_environment_display_fahrenheit_tag 5 -#define ModuleConfig_CannedMessageConfig_rotary1_enabled_tag 1 -#define ModuleConfig_CannedMessageConfig_inputbroker_pin_a_tag 2 -#define ModuleConfig_CannedMessageConfig_inputbroker_pin_b_tag 3 -#define ModuleConfig_CannedMessageConfig_inputbroker_pin_press_tag 4 -#define ModuleConfig_CannedMessageConfig_inputbroker_event_cw_tag 5 -#define ModuleConfig_CannedMessageConfig_inputbroker_event_ccw_tag 6 -#define ModuleConfig_CannedMessageConfig_inputbroker_event_press_tag 7 -#define ModuleConfig_CannedMessageConfig_updown1_enabled_tag 8 -#define ModuleConfig_CannedMessageConfig_enabled_tag 9 -#define ModuleConfig_CannedMessageConfig_allow_input_source_tag 10 -#define ModuleConfig_CannedMessageConfig_send_bell_tag 11 -#define ModuleConfig_mqtt_tag 1 -#define ModuleConfig_serial_tag 2 -#define ModuleConfig_external_notification_tag 3 -#define ModuleConfig_store_forward_tag 4 -#define ModuleConfig_range_test_tag 5 -#define ModuleConfig_telemetry_tag 6 -#define ModuleConfig_canned_message_tag 7 -#define ModuleConfig_audio_tag 8 -#define ModuleConfig_remote_hardware_tag 9 +#define meshtastic_ModuleConfig_MQTTConfig_enabled_tag 1 +#define meshtastic_ModuleConfig_MQTTConfig_address_tag 2 +#define meshtastic_ModuleConfig_MQTTConfig_username_tag 3 +#define meshtastic_ModuleConfig_MQTTConfig_password_tag 4 +#define meshtastic_ModuleConfig_MQTTConfig_encryption_enabled_tag 5 +#define meshtastic_ModuleConfig_MQTTConfig_json_enabled_tag 6 +#define meshtastic_ModuleConfig_RemoteHardwareConfig_enabled_tag 1 +#define meshtastic_ModuleConfig_AudioConfig_codec2_enabled_tag 1 +#define meshtastic_ModuleConfig_AudioConfig_ptt_pin_tag 2 +#define meshtastic_ModuleConfig_AudioConfig_bitrate_tag 3 +#define meshtastic_ModuleConfig_AudioConfig_i2s_ws_tag 4 +#define meshtastic_ModuleConfig_AudioConfig_i2s_sd_tag 5 +#define meshtastic_ModuleConfig_AudioConfig_i2s_din_tag 6 +#define meshtastic_ModuleConfig_AudioConfig_i2s_sck_tag 7 +#define meshtastic_ModuleConfig_SerialConfig_enabled_tag 1 +#define meshtastic_ModuleConfig_SerialConfig_echo_tag 2 +#define meshtastic_ModuleConfig_SerialConfig_rxd_tag 3 +#define meshtastic_ModuleConfig_SerialConfig_txd_tag 4 +#define meshtastic_ModuleConfig_SerialConfig_baud_tag 5 +#define meshtastic_ModuleConfig_SerialConfig_timeout_tag 6 +#define meshtastic_ModuleConfig_SerialConfig_mode_tag 7 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_enabled_tag 1 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_output_ms_tag 2 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_output_tag 3 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_active_tag 4 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_alert_message_tag 5 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_alert_bell_tag 6 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_use_pwm_tag 7 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_output_vibra_tag 8 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_output_buzzer_tag 9 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_alert_message_vibra_tag 10 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_alert_message_buzzer_tag 11 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_alert_bell_vibra_tag 12 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_alert_bell_buzzer_tag 13 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_nag_timeout_tag 14 +#define meshtastic_ModuleConfig_StoreForwardConfig_enabled_tag 1 +#define meshtastic_ModuleConfig_StoreForwardConfig_heartbeat_tag 2 +#define meshtastic_ModuleConfig_StoreForwardConfig_records_tag 3 +#define meshtastic_ModuleConfig_StoreForwardConfig_history_return_max_tag 4 +#define meshtastic_ModuleConfig_StoreForwardConfig_history_return_window_tag 5 +#define meshtastic_ModuleConfig_RangeTestConfig_enabled_tag 1 +#define meshtastic_ModuleConfig_RangeTestConfig_sender_tag 2 +#define meshtastic_ModuleConfig_RangeTestConfig_save_tag 3 +#define meshtastic_ModuleConfig_TelemetryConfig_device_update_interval_tag 1 +#define meshtastic_ModuleConfig_TelemetryConfig_environment_update_interval_tag 2 +#define meshtastic_ModuleConfig_TelemetryConfig_environment_measurement_enabled_tag 3 +#define meshtastic_ModuleConfig_TelemetryConfig_environment_screen_enabled_tag 4 +#define meshtastic_ModuleConfig_TelemetryConfig_environment_display_fahrenheit_tag 5 +#define meshtastic_ModuleConfig_CannedMessageConfig_rotary1_enabled_tag 1 +#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_pin_a_tag 2 +#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_pin_b_tag 3 +#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_pin_press_tag 4 +#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_cw_tag 5 +#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_ccw_tag 6 +#define meshtastic_ModuleConfig_CannedMessageConfig_inputbroker_event_press_tag 7 +#define meshtastic_ModuleConfig_CannedMessageConfig_updown1_enabled_tag 8 +#define meshtastic_ModuleConfig_CannedMessageConfig_enabled_tag 9 +#define meshtastic_ModuleConfig_CannedMessageConfig_allow_input_source_tag 10 +#define meshtastic_ModuleConfig_CannedMessageConfig_send_bell_tag 11 +#define meshtastic_ModuleConfig_mqtt_tag 1 +#define meshtastic_ModuleConfig_serial_tag 2 +#define meshtastic_ModuleConfig_external_notification_tag 3 +#define meshtastic_ModuleConfig_store_forward_tag 4 +#define meshtastic_ModuleConfig_range_test_tag 5 +#define meshtastic_ModuleConfig_telemetry_tag 6 +#define meshtastic_ModuleConfig_canned_message_tag 7 +#define meshtastic_ModuleConfig_audio_tag 8 +#define meshtastic_ModuleConfig_remote_hardware_tag 9 /* Struct field encoding specification for nanopb */ -#define ModuleConfig_FIELDLIST(X, a) \ +#define meshtastic_ModuleConfig_FIELDLIST(X, a) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,mqtt,payload_variant.mqtt), 1) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,serial,payload_variant.serial), 2) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,external_notification,payload_variant.external_notification), 3) \ @@ -419,34 +419,34 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,telemetry,payload_variant.te X(a, STATIC, ONEOF, MESSAGE, (payload_variant,canned_message,payload_variant.canned_message), 7) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,audio,payload_variant.audio), 8) \ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,remote_hardware,payload_variant.remote_hardware), 9) -#define ModuleConfig_CALLBACK NULL -#define ModuleConfig_DEFAULT NULL -#define ModuleConfig_payload_variant_mqtt_MSGTYPE ModuleConfig_MQTTConfig -#define ModuleConfig_payload_variant_serial_MSGTYPE ModuleConfig_SerialConfig -#define ModuleConfig_payload_variant_external_notification_MSGTYPE ModuleConfig_ExternalNotificationConfig -#define ModuleConfig_payload_variant_store_forward_MSGTYPE ModuleConfig_StoreForwardConfig -#define ModuleConfig_payload_variant_range_test_MSGTYPE ModuleConfig_RangeTestConfig -#define ModuleConfig_payload_variant_telemetry_MSGTYPE ModuleConfig_TelemetryConfig -#define ModuleConfig_payload_variant_canned_message_MSGTYPE ModuleConfig_CannedMessageConfig -#define ModuleConfig_payload_variant_audio_MSGTYPE ModuleConfig_AudioConfig -#define ModuleConfig_payload_variant_remote_hardware_MSGTYPE ModuleConfig_RemoteHardwareConfig +#define meshtastic_ModuleConfig_CALLBACK NULL +#define meshtastic_ModuleConfig_DEFAULT NULL +#define meshtastic_ModuleConfig_payload_variant_mqtt_MSGTYPE meshtastic_ModuleConfig_MQTTConfig +#define meshtastic_ModuleConfig_payload_variant_serial_MSGTYPE meshtastic_ModuleConfig_SerialConfig +#define meshtastic_ModuleConfig_payload_variant_external_notification_MSGTYPE meshtastic_ModuleConfig_ExternalNotificationConfig +#define meshtastic_ModuleConfig_payload_variant_store_forward_MSGTYPE meshtastic_ModuleConfig_StoreForwardConfig +#define meshtastic_ModuleConfig_payload_variant_range_test_MSGTYPE meshtastic_ModuleConfig_RangeTestConfig +#define meshtastic_ModuleConfig_payload_variant_telemetry_MSGTYPE meshtastic_ModuleConfig_TelemetryConfig +#define meshtastic_ModuleConfig_payload_variant_canned_message_MSGTYPE meshtastic_ModuleConfig_CannedMessageConfig +#define meshtastic_ModuleConfig_payload_variant_audio_MSGTYPE meshtastic_ModuleConfig_AudioConfig +#define meshtastic_ModuleConfig_payload_variant_remote_hardware_MSGTYPE meshtastic_ModuleConfig_RemoteHardwareConfig -#define ModuleConfig_MQTTConfig_FIELDLIST(X, a) \ +#define meshtastic_ModuleConfig_MQTTConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, enabled, 1) \ X(a, STATIC, SINGULAR, STRING, address, 2) \ X(a, STATIC, SINGULAR, STRING, username, 3) \ X(a, STATIC, SINGULAR, STRING, password, 4) \ X(a, STATIC, SINGULAR, BOOL, encryption_enabled, 5) \ X(a, STATIC, SINGULAR, BOOL, json_enabled, 6) -#define ModuleConfig_MQTTConfig_CALLBACK NULL -#define ModuleConfig_MQTTConfig_DEFAULT NULL +#define meshtastic_ModuleConfig_MQTTConfig_CALLBACK NULL +#define meshtastic_ModuleConfig_MQTTConfig_DEFAULT NULL -#define ModuleConfig_RemoteHardwareConfig_FIELDLIST(X, a) \ +#define meshtastic_ModuleConfig_RemoteHardwareConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, enabled, 1) -#define ModuleConfig_RemoteHardwareConfig_CALLBACK NULL -#define ModuleConfig_RemoteHardwareConfig_DEFAULT NULL +#define meshtastic_ModuleConfig_RemoteHardwareConfig_CALLBACK NULL +#define meshtastic_ModuleConfig_RemoteHardwareConfig_DEFAULT NULL -#define ModuleConfig_AudioConfig_FIELDLIST(X, a) \ +#define meshtastic_ModuleConfig_AudioConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, codec2_enabled, 1) \ X(a, STATIC, SINGULAR, UINT32, ptt_pin, 2) \ X(a, STATIC, SINGULAR, UENUM, bitrate, 3) \ @@ -454,10 +454,10 @@ X(a, STATIC, SINGULAR, UINT32, i2s_ws, 4) \ X(a, STATIC, SINGULAR, UINT32, i2s_sd, 5) \ X(a, STATIC, SINGULAR, UINT32, i2s_din, 6) \ X(a, STATIC, SINGULAR, UINT32, i2s_sck, 7) -#define ModuleConfig_AudioConfig_CALLBACK NULL -#define ModuleConfig_AudioConfig_DEFAULT NULL +#define meshtastic_ModuleConfig_AudioConfig_CALLBACK NULL +#define meshtastic_ModuleConfig_AudioConfig_DEFAULT NULL -#define ModuleConfig_SerialConfig_FIELDLIST(X, a) \ +#define meshtastic_ModuleConfig_SerialConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, enabled, 1) \ X(a, STATIC, SINGULAR, BOOL, echo, 2) \ X(a, STATIC, SINGULAR, UINT32, rxd, 3) \ @@ -465,10 +465,10 @@ X(a, STATIC, SINGULAR, UINT32, txd, 4) \ X(a, STATIC, SINGULAR, UENUM, baud, 5) \ X(a, STATIC, SINGULAR, UINT32, timeout, 6) \ X(a, STATIC, SINGULAR, UENUM, mode, 7) -#define ModuleConfig_SerialConfig_CALLBACK NULL -#define ModuleConfig_SerialConfig_DEFAULT NULL +#define meshtastic_ModuleConfig_SerialConfig_CALLBACK NULL +#define meshtastic_ModuleConfig_SerialConfig_DEFAULT NULL -#define ModuleConfig_ExternalNotificationConfig_FIELDLIST(X, a) \ +#define meshtastic_ModuleConfig_ExternalNotificationConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, enabled, 1) \ X(a, STATIC, SINGULAR, UINT32, output_ms, 2) \ X(a, STATIC, SINGULAR, UINT32, output, 3) \ @@ -483,35 +483,35 @@ X(a, STATIC, SINGULAR, BOOL, alert_message_buzzer, 11) \ X(a, STATIC, SINGULAR, BOOL, alert_bell_vibra, 12) \ X(a, STATIC, SINGULAR, BOOL, alert_bell_buzzer, 13) \ X(a, STATIC, SINGULAR, UINT32, nag_timeout, 14) -#define ModuleConfig_ExternalNotificationConfig_CALLBACK NULL -#define ModuleConfig_ExternalNotificationConfig_DEFAULT NULL +#define meshtastic_ModuleConfig_ExternalNotificationConfig_CALLBACK NULL +#define meshtastic_ModuleConfig_ExternalNotificationConfig_DEFAULT NULL -#define ModuleConfig_StoreForwardConfig_FIELDLIST(X, a) \ +#define meshtastic_ModuleConfig_StoreForwardConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, enabled, 1) \ X(a, STATIC, SINGULAR, BOOL, heartbeat, 2) \ X(a, STATIC, SINGULAR, UINT32, records, 3) \ X(a, STATIC, SINGULAR, UINT32, history_return_max, 4) \ X(a, STATIC, SINGULAR, UINT32, history_return_window, 5) -#define ModuleConfig_StoreForwardConfig_CALLBACK NULL -#define ModuleConfig_StoreForwardConfig_DEFAULT NULL +#define meshtastic_ModuleConfig_StoreForwardConfig_CALLBACK NULL +#define meshtastic_ModuleConfig_StoreForwardConfig_DEFAULT NULL -#define ModuleConfig_RangeTestConfig_FIELDLIST(X, a) \ +#define meshtastic_ModuleConfig_RangeTestConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, enabled, 1) \ X(a, STATIC, SINGULAR, UINT32, sender, 2) \ X(a, STATIC, SINGULAR, BOOL, save, 3) -#define ModuleConfig_RangeTestConfig_CALLBACK NULL -#define ModuleConfig_RangeTestConfig_DEFAULT NULL +#define meshtastic_ModuleConfig_RangeTestConfig_CALLBACK NULL +#define meshtastic_ModuleConfig_RangeTestConfig_DEFAULT NULL -#define ModuleConfig_TelemetryConfig_FIELDLIST(X, a) \ +#define meshtastic_ModuleConfig_TelemetryConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, device_update_interval, 1) \ X(a, STATIC, SINGULAR, UINT32, environment_update_interval, 2) \ X(a, STATIC, SINGULAR, BOOL, environment_measurement_enabled, 3) \ X(a, STATIC, SINGULAR, BOOL, environment_screen_enabled, 4) \ X(a, STATIC, SINGULAR, BOOL, environment_display_fahrenheit, 5) -#define ModuleConfig_TelemetryConfig_CALLBACK NULL -#define ModuleConfig_TelemetryConfig_DEFAULT NULL +#define meshtastic_ModuleConfig_TelemetryConfig_CALLBACK NULL +#define meshtastic_ModuleConfig_TelemetryConfig_DEFAULT NULL -#define ModuleConfig_CannedMessageConfig_FIELDLIST(X, a) \ +#define meshtastic_ModuleConfig_CannedMessageConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, BOOL, rotary1_enabled, 1) \ X(a, STATIC, SINGULAR, UINT32, inputbroker_pin_a, 2) \ X(a, STATIC, SINGULAR, UINT32, inputbroker_pin_b, 3) \ @@ -523,43 +523,43 @@ X(a, STATIC, SINGULAR, BOOL, updown1_enabled, 8) \ X(a, STATIC, SINGULAR, BOOL, enabled, 9) \ X(a, STATIC, SINGULAR, STRING, allow_input_source, 10) \ X(a, STATIC, SINGULAR, BOOL, send_bell, 11) -#define ModuleConfig_CannedMessageConfig_CALLBACK NULL -#define ModuleConfig_CannedMessageConfig_DEFAULT NULL +#define meshtastic_ModuleConfig_CannedMessageConfig_CALLBACK NULL +#define meshtastic_ModuleConfig_CannedMessageConfig_DEFAULT NULL -extern const pb_msgdesc_t ModuleConfig_msg; -extern const pb_msgdesc_t ModuleConfig_MQTTConfig_msg; -extern const pb_msgdesc_t ModuleConfig_RemoteHardwareConfig_msg; -extern const pb_msgdesc_t ModuleConfig_AudioConfig_msg; -extern const pb_msgdesc_t ModuleConfig_SerialConfig_msg; -extern const pb_msgdesc_t ModuleConfig_ExternalNotificationConfig_msg; -extern const pb_msgdesc_t ModuleConfig_StoreForwardConfig_msg; -extern const pb_msgdesc_t ModuleConfig_RangeTestConfig_msg; -extern const pb_msgdesc_t ModuleConfig_TelemetryConfig_msg; -extern const pb_msgdesc_t ModuleConfig_CannedMessageConfig_msg; +extern const pb_msgdesc_t meshtastic_ModuleConfig_msg; +extern const pb_msgdesc_t meshtastic_ModuleConfig_MQTTConfig_msg; +extern const pb_msgdesc_t meshtastic_ModuleConfig_RemoteHardwareConfig_msg; +extern const pb_msgdesc_t meshtastic_ModuleConfig_AudioConfig_msg; +extern const pb_msgdesc_t meshtastic_ModuleConfig_SerialConfig_msg; +extern const pb_msgdesc_t meshtastic_ModuleConfig_ExternalNotificationConfig_msg; +extern const pb_msgdesc_t meshtastic_ModuleConfig_StoreForwardConfig_msg; +extern const pb_msgdesc_t meshtastic_ModuleConfig_RangeTestConfig_msg; +extern const pb_msgdesc_t meshtastic_ModuleConfig_TelemetryConfig_msg; +extern const pb_msgdesc_t meshtastic_ModuleConfig_CannedMessageConfig_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define ModuleConfig_fields &ModuleConfig_msg -#define ModuleConfig_MQTTConfig_fields &ModuleConfig_MQTTConfig_msg -#define ModuleConfig_RemoteHardwareConfig_fields &ModuleConfig_RemoteHardwareConfig_msg -#define ModuleConfig_AudioConfig_fields &ModuleConfig_AudioConfig_msg -#define ModuleConfig_SerialConfig_fields &ModuleConfig_SerialConfig_msg -#define ModuleConfig_ExternalNotificationConfig_fields &ModuleConfig_ExternalNotificationConfig_msg -#define ModuleConfig_StoreForwardConfig_fields &ModuleConfig_StoreForwardConfig_msg -#define ModuleConfig_RangeTestConfig_fields &ModuleConfig_RangeTestConfig_msg -#define ModuleConfig_TelemetryConfig_fields &ModuleConfig_TelemetryConfig_msg -#define ModuleConfig_CannedMessageConfig_fields &ModuleConfig_CannedMessageConfig_msg +#define meshtastic_ModuleConfig_fields &meshtastic_ModuleConfig_msg +#define meshtastic_ModuleConfig_MQTTConfig_fields &meshtastic_ModuleConfig_MQTTConfig_msg +#define meshtastic_ModuleConfig_RemoteHardwareConfig_fields &meshtastic_ModuleConfig_RemoteHardwareConfig_msg +#define meshtastic_ModuleConfig_AudioConfig_fields &meshtastic_ModuleConfig_AudioConfig_msg +#define meshtastic_ModuleConfig_SerialConfig_fields &meshtastic_ModuleConfig_SerialConfig_msg +#define meshtastic_ModuleConfig_ExternalNotificationConfig_fields &meshtastic_ModuleConfig_ExternalNotificationConfig_msg +#define meshtastic_ModuleConfig_StoreForwardConfig_fields &meshtastic_ModuleConfig_StoreForwardConfig_msg +#define meshtastic_ModuleConfig_RangeTestConfig_fields &meshtastic_ModuleConfig_RangeTestConfig_msg +#define meshtastic_ModuleConfig_TelemetryConfig_fields &meshtastic_ModuleConfig_TelemetryConfig_msg +#define meshtastic_ModuleConfig_CannedMessageConfig_fields &meshtastic_ModuleConfig_CannedMessageConfig_msg /* Maximum encoded size of messages (where known) */ -#define ModuleConfig_AudioConfig_size 19 -#define ModuleConfig_CannedMessageConfig_size 49 -#define ModuleConfig_ExternalNotificationConfig_size 40 -#define ModuleConfig_MQTTConfig_size 201 -#define ModuleConfig_RangeTestConfig_size 10 -#define ModuleConfig_RemoteHardwareConfig_size 2 -#define ModuleConfig_SerialConfig_size 26 -#define ModuleConfig_StoreForwardConfig_size 22 -#define ModuleConfig_TelemetryConfig_size 18 -#define ModuleConfig_size 204 +#define meshtastic_ModuleConfig_AudioConfig_size 19 +#define meshtastic_ModuleConfig_CannedMessageConfig_size 49 +#define meshtastic_ModuleConfig_ExternalNotificationConfig_size 40 +#define meshtastic_ModuleConfig_MQTTConfig_size 201 +#define meshtastic_ModuleConfig_RangeTestConfig_size 10 +#define meshtastic_ModuleConfig_RemoteHardwareConfig_size 2 +#define meshtastic_ModuleConfig_SerialConfig_size 26 +#define meshtastic_ModuleConfig_StoreForwardConfig_size 22 +#define meshtastic_ModuleConfig_TelemetryConfig_size 18 +#define meshtastic_ModuleConfig_size 204 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/mqtt.pb.c b/src/mesh/generated/meshtastic/mqtt.pb.c index 86a1e0075..3046e6109 100644 --- a/src/mesh/generated/meshtastic/mqtt.pb.c +++ b/src/mesh/generated/meshtastic/mqtt.pb.c @@ -1,12 +1,12 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./mqtt.pb.h" +#include "meshtastic/mqtt.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(ServiceEnvelope, ServiceEnvelope, AUTO) +PB_BIND(meshtastic_ServiceEnvelope, meshtastic_ServiceEnvelope, AUTO) diff --git a/src/mesh/generated/meshtastic/mqtt.pb.h b/src/mesh/generated/meshtastic/mqtt.pb.h index 644a771bb..12e83c724 100644 --- a/src/mesh/generated/meshtastic/mqtt.pb.h +++ b/src/mesh/generated/meshtastic/mqtt.pb.h @@ -4,7 +4,7 @@ #ifndef PB_MESHTASTIC_MESHTASTIC_MQTT_PB_H_INCLUDED #define PB_MESHTASTIC_MESHTASTIC_MQTT_PB_H_INCLUDED #include -#include "./mesh.pb.h" +#include "meshtastic/mesh.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. @@ -12,16 +12,16 @@ /* Struct definitions */ /* This message wraps a MeshPacket with extra metadata about the sender and how it arrived. */ -typedef struct _ServiceEnvelope { +typedef struct _meshtastic_ServiceEnvelope { /* The (probably encrypted) packet */ - struct _MeshPacket *packet; + struct _meshtastic_MeshPacket *packet; /* The global channel ID it was sent on */ char *channel_id; /* The sending gateway node ID. Can we use this to authenticate/prevent fake nodeid impersonation for senders? - i.e. use gateway/mesh id (which is authenticated) + local node id as the globally trusted nodenum */ char *gateway_id; -} ServiceEnvelope; +} meshtastic_ServiceEnvelope; #ifdef __cplusplus @@ -29,30 +29,30 @@ extern "C" { #endif /* Initializer values for message structs */ -#define ServiceEnvelope_init_default {NULL, NULL, NULL} -#define ServiceEnvelope_init_zero {NULL, NULL, NULL} +#define meshtastic_ServiceEnvelope_init_default {NULL, NULL, NULL} +#define meshtastic_ServiceEnvelope_init_zero {NULL, NULL, NULL} /* Field tags (for use in manual encoding/decoding) */ -#define ServiceEnvelope_packet_tag 1 -#define ServiceEnvelope_channel_id_tag 2 -#define ServiceEnvelope_gateway_id_tag 3 +#define meshtastic_ServiceEnvelope_packet_tag 1 +#define meshtastic_ServiceEnvelope_channel_id_tag 2 +#define meshtastic_ServiceEnvelope_gateway_id_tag 3 /* Struct field encoding specification for nanopb */ -#define ServiceEnvelope_FIELDLIST(X, a) \ +#define meshtastic_ServiceEnvelope_FIELDLIST(X, a) \ X(a, POINTER, OPTIONAL, MESSAGE, packet, 1) \ X(a, POINTER, SINGULAR, STRING, channel_id, 2) \ X(a, POINTER, SINGULAR, STRING, gateway_id, 3) -#define ServiceEnvelope_CALLBACK NULL -#define ServiceEnvelope_DEFAULT NULL -#define ServiceEnvelope_packet_MSGTYPE MeshPacket +#define meshtastic_ServiceEnvelope_CALLBACK NULL +#define meshtastic_ServiceEnvelope_DEFAULT NULL +#define meshtastic_ServiceEnvelope_packet_MSGTYPE meshtastic_MeshPacket -extern const pb_msgdesc_t ServiceEnvelope_msg; +extern const pb_msgdesc_t meshtastic_ServiceEnvelope_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define ServiceEnvelope_fields &ServiceEnvelope_msg +#define meshtastic_ServiceEnvelope_fields &meshtastic_ServiceEnvelope_msg /* Maximum encoded size of messages (where known) */ -/* ServiceEnvelope_size depends on runtime parameters */ +/* meshtastic_ServiceEnvelope_size depends on runtime parameters */ #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/portnums.pb.c b/src/mesh/generated/meshtastic/portnums.pb.c index 663247bf8..dd0d00e20 100644 --- a/src/mesh/generated/meshtastic/portnums.pb.c +++ b/src/mesh/generated/meshtastic/portnums.pb.c @@ -1,7 +1,7 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./portnums.pb.h" +#include "meshtastic/portnums.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif diff --git a/src/mesh/generated/meshtastic/portnums.pb.h b/src/mesh/generated/meshtastic/portnums.pb.h index 27d2ab498..59cf0ebe5 100644 --- a/src/mesh/generated/meshtastic/portnums.pb.h +++ b/src/mesh/generated/meshtastic/portnums.pb.h @@ -22,87 +22,87 @@ Note: This was formerly a Type enum named 'typ' with the same id # We have change to this 'portnum' based scheme for specifying app handlers for particular payloads. This change is backwards compatible by treating the legacy OPAQUE/CLEAR_TEXT values identically. */ -typedef enum _PortNum { +typedef enum _meshtastic_PortNum { /* Deprecated: do not use in new code (formerly called OPAQUE) A message sent from a device outside of the mesh, in a form the mesh does not understand NOTE: This must be 0, because it is documented in IMeshService.aidl to be so */ - PortNum_UNKNOWN_APP = 0, + meshtastic_PortNum_UNKNOWN_APP = 0, /* A simple UTF-8 text message, which even the little micros in the mesh can understand and show on their screen eventually in some circumstances even signal might send messages in this form (see below) */ - PortNum_TEXT_MESSAGE_APP = 1, + meshtastic_PortNum_TEXT_MESSAGE_APP = 1, /* Reserved for built-in GPIO/example app. See remote_hardware.proto/HardwareMessage for details on the message sent/received to this port number */ - PortNum_REMOTE_HARDWARE_APP = 2, + meshtastic_PortNum_REMOTE_HARDWARE_APP = 2, /* The built-in position messaging app. Payload is a [Position](/docs/developers/protobufs/api#position) message */ - PortNum_POSITION_APP = 3, + meshtastic_PortNum_POSITION_APP = 3, /* The built-in user info app. Payload is a [User](/docs/developers/protobufs/api#user) message */ - PortNum_NODEINFO_APP = 4, + meshtastic_PortNum_NODEINFO_APP = 4, /* Protocol control packets for mesh protocol use. Payload is a [Routing](/docs/developers/protobufs/api#routing) message */ - PortNum_ROUTING_APP = 5, + meshtastic_PortNum_ROUTING_APP = 5, /* Admin control packets. Payload is a [AdminMessage](/docs/developers/protobufs/api#adminmessage) message */ - PortNum_ADMIN_APP = 6, + meshtastic_PortNum_ADMIN_APP = 6, /* Compressed TEXT_MESSAGE payloads. */ - PortNum_TEXT_MESSAGE_COMPRESSED_APP = 7, + meshtastic_PortNum_TEXT_MESSAGE_COMPRESSED_APP = 7, /* Waypoint payloads. Payload is a [Waypoint](/docs/developers/protobufs/api#waypoint) message */ - PortNum_WAYPOINT_APP = 8, + meshtastic_PortNum_WAYPOINT_APP = 8, /* Audio Payloads. Encapsulated codec2 packets. On 2.4 GHZ Bandwidths only for now */ - PortNum_AUDIO_APP = 9, + meshtastic_PortNum_AUDIO_APP = 9, /* Provides a 'ping' service that replies to any packet it receives. Also serves as a small example module. */ - PortNum_REPLY_APP = 32, + meshtastic_PortNum_REPLY_APP = 32, /* Used for the python IP tunnel feature */ - PortNum_IP_TUNNEL_APP = 33, + meshtastic_PortNum_IP_TUNNEL_APP = 33, /* Provides a hardware serial interface to send and receive from the Meshtastic network. Connect to the RX/TX pins of a device with 38400 8N1. Packets received from the Meshtastic network is forwarded to the RX pin while sending a packet to TX will go out to the Mesh network. Maximum packet size of 240 bytes. Module is disabled by default can be turned on by setting SERIAL_MODULE_ENABLED = 1 in SerialPlugh.cpp. */ - PortNum_SERIAL_APP = 64, + meshtastic_PortNum_SERIAL_APP = 64, /* STORE_FORWARD_APP (Work in Progress) Maintained by Jm Casler (MC Hamster) : jm@casler.org */ - PortNum_STORE_FORWARD_APP = 65, + meshtastic_PortNum_STORE_FORWARD_APP = 65, /* Optional port for messages for the range test module. */ - PortNum_RANGE_TEST_APP = 66, + meshtastic_PortNum_RANGE_TEST_APP = 66, /* Provides a format to send and receive telemetry data from the Meshtastic network. Maintained by Charles Crossan (crossan007) : crossan007@gmail.com */ - PortNum_TELEMETRY_APP = 67, + meshtastic_PortNum_TELEMETRY_APP = 67, /* Experimental tools for estimating node position without a GPS Maintained by Github user a-f-G-U-C (a Meshtastic contributor) Project files at https://github.com/a-f-G-U-C/Meshtastic-ZPS */ - PortNum_ZPS_APP = 68, + meshtastic_PortNum_ZPS_APP = 68, /* Used to let multiple instances of Linux native applications communicate as if they did using their LoRa chip. Maintained by GitHub user GUVWAF. Project files at https://github.com/GUVWAF/Meshtasticator */ - PortNum_SIMULATOR_APP = 69, + meshtastic_PortNum_SIMULATOR_APP = 69, /* Provides a traceroute functionality to show the route a packet towards a certain destination would take on the mesh. */ - PortNum_TRACEROUTE_APP = 70, + meshtastic_PortNum_TRACEROUTE_APP = 70, /* Private applications should use portnums >= 256. To simplify initial development and testing you can use "PRIVATE_APP" in your code without needing to rebuild protobuf files (via [regen-protos.sh](https://github.com/meshtastic/firmware/blob/master/bin/regen-protos.sh)) */ - PortNum_PRIVATE_APP = 256, + meshtastic_PortNum_PRIVATE_APP = 256, /* ATAK Forwarder Module https://github.com/paulmandal/atak-forwarder */ - PortNum_ATAK_FORWARDER = 257, + meshtastic_PortNum_ATAK_FORWARDER = 257, /* Currently we limit port nums to no higher than this value */ - PortNum_MAX = 511 -} PortNum; + meshtastic_PortNum_MAX = 511 +} meshtastic_PortNum; #ifdef __cplusplus extern "C" { #endif /* Helper constants for enums */ -#define _PortNum_MIN PortNum_UNKNOWN_APP -#define _PortNum_MAX PortNum_MAX -#define _PortNum_ARRAYSIZE ((PortNum)(PortNum_MAX+1)) +#define _meshtastic_PortNum_MIN meshtastic_PortNum_UNKNOWN_APP +#define _meshtastic_PortNum_MAX meshtastic_PortNum_MAX +#define _meshtastic_PortNum_ARRAYSIZE ((meshtastic_PortNum)(meshtastic_PortNum_MAX+1)) #ifdef __cplusplus diff --git a/src/mesh/generated/meshtastic/remote_hardware.pb.c b/src/mesh/generated/meshtastic/remote_hardware.pb.c index e33884659..f368ec1ef 100644 --- a/src/mesh/generated/meshtastic/remote_hardware.pb.c +++ b/src/mesh/generated/meshtastic/remote_hardware.pb.c @@ -1,12 +1,12 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./remote_hardware.pb.h" +#include "meshtastic/remote_hardware.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(HardwareMessage, HardwareMessage, AUTO) +PB_BIND(meshtastic_HardwareMessage, meshtastic_HardwareMessage, AUTO) diff --git a/src/mesh/generated/meshtastic/remote_hardware.pb.h b/src/mesh/generated/meshtastic/remote_hardware.pb.h index b76dbe0bc..26df97616 100644 --- a/src/mesh/generated/meshtastic/remote_hardware.pb.h +++ b/src/mesh/generated/meshtastic/remote_hardware.pb.h @@ -11,22 +11,22 @@ /* Enum definitions */ /* TODO: REPLACE */ -typedef enum _HardwareMessage_Type { +typedef enum _meshtastic_HardwareMessage_Type { /* Unset/unused */ - HardwareMessage_Type_UNSET = 0, + meshtastic_HardwareMessage_Type_UNSET = 0, /* Set gpio gpios based on gpio_mask/gpio_value */ - HardwareMessage_Type_WRITE_GPIOS = 1, + meshtastic_HardwareMessage_Type_WRITE_GPIOS = 1, /* We are now interested in watching the gpio_mask gpios. If the selected gpios change, please broadcast GPIOS_CHANGED. Will implicitly change the gpios requested to be INPUT gpios. */ - HardwareMessage_Type_WATCH_GPIOS = 2, + meshtastic_HardwareMessage_Type_WATCH_GPIOS = 2, /* The gpios listed in gpio_mask have changed, the new values are listed in gpio_value */ - HardwareMessage_Type_GPIOS_CHANGED = 3, + meshtastic_HardwareMessage_Type_GPIOS_CHANGED = 3, /* Read the gpios specified in gpio_mask, send back a READ_GPIOS_REPLY reply with gpio_value populated */ - HardwareMessage_Type_READ_GPIOS = 4, + meshtastic_HardwareMessage_Type_READ_GPIOS = 4, /* A reply to READ_GPIOS. gpio_mask and gpio_value will be populated */ - HardwareMessage_Type_READ_GPIOS_REPLY = 5 -} HardwareMessage_Type; + meshtastic_HardwareMessage_Type_READ_GPIOS_REPLY = 5 +} meshtastic_HardwareMessage_Type; /* Struct definitions */ /* An example app to show off the module system. This message is used for @@ -38,15 +38,15 @@ typedef enum _HardwareMessage_Type { because no security yet (beyond the channel mechanism). It should be off by default and then protected based on some TBD mechanism (a special channel once multichannel support is included?) */ -typedef struct _HardwareMessage { +typedef struct _meshtastic_HardwareMessage { /* What type of HardwareMessage is this? */ - HardwareMessage_Type type; + meshtastic_HardwareMessage_Type type; /* What gpios are we changing. Not used for all MessageTypes, see MessageType for details */ uint64_t gpio_mask; /* For gpios that were listed in gpio_mask as valid, what are the signal levels for those gpios. Not used for all MessageTypes, see MessageType for details */ uint64_t gpio_value; -} HardwareMessage; +} meshtastic_HardwareMessage; #ifdef __cplusplus @@ -54,37 +54,37 @@ extern "C" { #endif /* Helper constants for enums */ -#define _HardwareMessage_Type_MIN HardwareMessage_Type_UNSET -#define _HardwareMessage_Type_MAX HardwareMessage_Type_READ_GPIOS_REPLY -#define _HardwareMessage_Type_ARRAYSIZE ((HardwareMessage_Type)(HardwareMessage_Type_READ_GPIOS_REPLY+1)) +#define _meshtastic_HardwareMessage_Type_MIN meshtastic_HardwareMessage_Type_UNSET +#define _meshtastic_HardwareMessage_Type_MAX meshtastic_HardwareMessage_Type_READ_GPIOS_REPLY +#define _meshtastic_HardwareMessage_Type_ARRAYSIZE ((meshtastic_HardwareMessage_Type)(meshtastic_HardwareMessage_Type_READ_GPIOS_REPLY+1)) -#define HardwareMessage_type_ENUMTYPE HardwareMessage_Type +#define meshtastic_HardwareMessage_type_ENUMTYPE meshtastic_HardwareMessage_Type /* Initializer values for message structs */ -#define HardwareMessage_init_default {_HardwareMessage_Type_MIN, 0, 0} -#define HardwareMessage_init_zero {_HardwareMessage_Type_MIN, 0, 0} +#define meshtastic_HardwareMessage_init_default {_meshtastic_HardwareMessage_Type_MIN, 0, 0} +#define meshtastic_HardwareMessage_init_zero {_meshtastic_HardwareMessage_Type_MIN, 0, 0} /* Field tags (for use in manual encoding/decoding) */ -#define HardwareMessage_type_tag 1 -#define HardwareMessage_gpio_mask_tag 2 -#define HardwareMessage_gpio_value_tag 3 +#define meshtastic_HardwareMessage_type_tag 1 +#define meshtastic_HardwareMessage_gpio_mask_tag 2 +#define meshtastic_HardwareMessage_gpio_value_tag 3 /* Struct field encoding specification for nanopb */ -#define HardwareMessage_FIELDLIST(X, a) \ +#define meshtastic_HardwareMessage_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UENUM, type, 1) \ X(a, STATIC, SINGULAR, UINT64, gpio_mask, 2) \ X(a, STATIC, SINGULAR, UINT64, gpio_value, 3) -#define HardwareMessage_CALLBACK NULL -#define HardwareMessage_DEFAULT NULL +#define meshtastic_HardwareMessage_CALLBACK NULL +#define meshtastic_HardwareMessage_DEFAULT NULL -extern const pb_msgdesc_t HardwareMessage_msg; +extern const pb_msgdesc_t meshtastic_HardwareMessage_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define HardwareMessage_fields &HardwareMessage_msg +#define meshtastic_HardwareMessage_fields &meshtastic_HardwareMessage_msg /* Maximum encoded size of messages (where known) */ -#define HardwareMessage_size 24 +#define meshtastic_HardwareMessage_size 24 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/rtttl.pb.c b/src/mesh/generated/meshtastic/rtttl.pb.c index 5980cacf2..685bbde45 100644 --- a/src/mesh/generated/meshtastic/rtttl.pb.c +++ b/src/mesh/generated/meshtastic/rtttl.pb.c @@ -1,12 +1,12 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./rtttl.pb.h" +#include "meshtastic/rtttl.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(RTTTLConfig, RTTTLConfig, AUTO) +PB_BIND(meshtastic_RTTTLConfig, meshtastic_RTTTLConfig, AUTO) diff --git a/src/mesh/generated/meshtastic/rtttl.pb.h b/src/mesh/generated/meshtastic/rtttl.pb.h index 8cca21f59..aa55d0b7d 100644 --- a/src/mesh/generated/meshtastic/rtttl.pb.h +++ b/src/mesh/generated/meshtastic/rtttl.pb.h @@ -11,10 +11,10 @@ /* Struct definitions */ /* Canned message module configuration. */ -typedef struct _RTTTLConfig { +typedef struct _meshtastic_RTTTLConfig { /* Ringtone for PWM Buzzer in RTTTL Format. */ char ringtone[230]; -} RTTTLConfig; +} meshtastic_RTTTLConfig; #ifdef __cplusplus @@ -22,25 +22,25 @@ extern "C" { #endif /* Initializer values for message structs */ -#define RTTTLConfig_init_default {""} -#define RTTTLConfig_init_zero {""} +#define meshtastic_RTTTLConfig_init_default {""} +#define meshtastic_RTTTLConfig_init_zero {""} /* Field tags (for use in manual encoding/decoding) */ -#define RTTTLConfig_ringtone_tag 1 +#define meshtastic_RTTTLConfig_ringtone_tag 1 /* Struct field encoding specification for nanopb */ -#define RTTTLConfig_FIELDLIST(X, a) \ +#define meshtastic_RTTTLConfig_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, STRING, ringtone, 1) -#define RTTTLConfig_CALLBACK NULL -#define RTTTLConfig_DEFAULT NULL +#define meshtastic_RTTTLConfig_CALLBACK NULL +#define meshtastic_RTTTLConfig_DEFAULT NULL -extern const pb_msgdesc_t RTTTLConfig_msg; +extern const pb_msgdesc_t meshtastic_RTTTLConfig_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define RTTTLConfig_fields &RTTTLConfig_msg +#define meshtastic_RTTTLConfig_fields &meshtastic_RTTTLConfig_msg /* Maximum encoded size of messages (where known) */ -#define RTTTLConfig_size 232 +#define meshtastic_RTTTLConfig_size 232 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/storeforward.pb.c b/src/mesh/generated/meshtastic/storeforward.pb.c index 154e01db5..44a1c70c1 100644 --- a/src/mesh/generated/meshtastic/storeforward.pb.c +++ b/src/mesh/generated/meshtastic/storeforward.pb.c @@ -1,21 +1,21 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./storeforward.pb.h" +#include "meshtastic/storeforward.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(StoreAndForward, StoreAndForward, AUTO) +PB_BIND(meshtastic_StoreAndForward, meshtastic_StoreAndForward, AUTO) -PB_BIND(StoreAndForward_Statistics, StoreAndForward_Statistics, AUTO) +PB_BIND(meshtastic_StoreAndForward_Statistics, meshtastic_StoreAndForward_Statistics, AUTO) -PB_BIND(StoreAndForward_History, StoreAndForward_History, AUTO) +PB_BIND(meshtastic_StoreAndForward_History, meshtastic_StoreAndForward_History, AUTO) -PB_BIND(StoreAndForward_Heartbeat, StoreAndForward_Heartbeat, AUTO) +PB_BIND(meshtastic_StoreAndForward_Heartbeat, meshtastic_StoreAndForward_Heartbeat, AUTO) diff --git a/src/mesh/generated/meshtastic/storeforward.pb.h b/src/mesh/generated/meshtastic/storeforward.pb.h index 75b06fc4a..e6cb51f61 100644 --- a/src/mesh/generated/meshtastic/storeforward.pb.h +++ b/src/mesh/generated/meshtastic/storeforward.pb.h @@ -12,42 +12,42 @@ /* Enum definitions */ /* 001 - 063 = From Router 064 - 127 = From Client */ -typedef enum _StoreAndForward_RequestResponse { +typedef enum _meshtastic_StoreAndForward_RequestResponse { /* Unset/unused */ - StoreAndForward_RequestResponse_UNSET = 0, + meshtastic_StoreAndForward_RequestResponse_UNSET = 0, /* Router is an in error state. */ - StoreAndForward_RequestResponse_ROUTER_ERROR = 1, + meshtastic_StoreAndForward_RequestResponse_ROUTER_ERROR = 1, /* Router heartbeat */ - StoreAndForward_RequestResponse_ROUTER_HEARTBEAT = 2, + meshtastic_StoreAndForward_RequestResponse_ROUTER_HEARTBEAT = 2, /* Router has requested the client respond. This can work as a "are you there" message. */ - StoreAndForward_RequestResponse_ROUTER_PING = 3, + meshtastic_StoreAndForward_RequestResponse_ROUTER_PING = 3, /* The response to a "Ping" */ - StoreAndForward_RequestResponse_ROUTER_PONG = 4, + meshtastic_StoreAndForward_RequestResponse_ROUTER_PONG = 4, /* Router is currently busy. Please try again later. */ - StoreAndForward_RequestResponse_ROUTER_BUSY = 5, + meshtastic_StoreAndForward_RequestResponse_ROUTER_BUSY = 5, /* Router is responding to a request for history. */ - StoreAndForward_RequestResponse_ROUTER_HISTORY = 6, + meshtastic_StoreAndForward_RequestResponse_ROUTER_HISTORY = 6, /* Router is responding to a request for stats. */ - StoreAndForward_RequestResponse_ROUTER_STATS = 7, + meshtastic_StoreAndForward_RequestResponse_ROUTER_STATS = 7, /* Client is an in error state. */ - StoreAndForward_RequestResponse_CLIENT_ERROR = 64, + meshtastic_StoreAndForward_RequestResponse_CLIENT_ERROR = 64, /* Client has requested a replay from the router. */ - StoreAndForward_RequestResponse_CLIENT_HISTORY = 65, + meshtastic_StoreAndForward_RequestResponse_CLIENT_HISTORY = 65, /* Client has requested stats from the router. */ - StoreAndForward_RequestResponse_CLIENT_STATS = 66, + meshtastic_StoreAndForward_RequestResponse_CLIENT_STATS = 66, /* Client has requested the router respond. This can work as a "are you there" message. */ - StoreAndForward_RequestResponse_CLIENT_PING = 67, + meshtastic_StoreAndForward_RequestResponse_CLIENT_PING = 67, /* The response to a "Ping" */ - StoreAndForward_RequestResponse_CLIENT_PONG = 68, + meshtastic_StoreAndForward_RequestResponse_CLIENT_PONG = 68, /* Client has requested that the router abort processing the client's request */ - StoreAndForward_RequestResponse_CLIENT_ABORT = 106 -} StoreAndForward_RequestResponse; + meshtastic_StoreAndForward_RequestResponse_CLIENT_ABORT = 106 +} meshtastic_StoreAndForward_RequestResponse; /* Struct definitions */ /* TODO: REPLACE */ -typedef struct _StoreAndForward_Statistics { +typedef struct _meshtastic_StoreAndForward_Statistics { /* Number of messages we have ever seen */ uint32_t messages_total; /* Number of messages we have currently saved our history. */ @@ -66,42 +66,42 @@ typedef struct _StoreAndForward_Statistics { uint32_t return_max; /* Is the heartbeat enabled on the server? */ uint32_t return_window; -} StoreAndForward_Statistics; +} meshtastic_StoreAndForward_Statistics; /* TODO: REPLACE */ -typedef struct _StoreAndForward_History { +typedef struct _meshtastic_StoreAndForward_History { /* Number of that will be sent to the client */ uint32_t history_messages; /* The window of messages that was used to filter the history client requested */ uint32_t window; /* The window of messages that was used to filter the history client requested */ uint32_t last_request; -} StoreAndForward_History; +} meshtastic_StoreAndForward_History; /* TODO: REPLACE */ -typedef struct _StoreAndForward_Heartbeat { +typedef struct _meshtastic_StoreAndForward_Heartbeat { /* Number of that will be sent to the client */ uint32_t period; /* If set, this is not the primary Store & Forward router on the mesh */ uint32_t secondary; -} StoreAndForward_Heartbeat; +} meshtastic_StoreAndForward_Heartbeat; /* TODO: REPLACE */ -typedef struct _StoreAndForward { +typedef struct _meshtastic_StoreAndForward { /* TODO: REPLACE */ - StoreAndForward_RequestResponse rr; + meshtastic_StoreAndForward_RequestResponse rr; pb_size_t which_variant; union { /* TODO: REPLACE */ - StoreAndForward_Statistics stats; + meshtastic_StoreAndForward_Statistics stats; /* TODO: REPLACE */ - StoreAndForward_History history; + meshtastic_StoreAndForward_History history; /* TODO: REPLACE */ - StoreAndForward_Heartbeat heartbeat; + meshtastic_StoreAndForward_Heartbeat heartbeat; /* Empty Payload */ bool empty; } variant; -} StoreAndForward; +} meshtastic_StoreAndForward; #ifdef __cplusplus @@ -109,61 +109,61 @@ extern "C" { #endif /* Helper constants for enums */ -#define _StoreAndForward_RequestResponse_MIN StoreAndForward_RequestResponse_UNSET -#define _StoreAndForward_RequestResponse_MAX StoreAndForward_RequestResponse_CLIENT_ABORT -#define _StoreAndForward_RequestResponse_ARRAYSIZE ((StoreAndForward_RequestResponse)(StoreAndForward_RequestResponse_CLIENT_ABORT+1)) +#define _meshtastic_StoreAndForward_RequestResponse_MIN meshtastic_StoreAndForward_RequestResponse_UNSET +#define _meshtastic_StoreAndForward_RequestResponse_MAX meshtastic_StoreAndForward_RequestResponse_CLIENT_ABORT +#define _meshtastic_StoreAndForward_RequestResponse_ARRAYSIZE ((meshtastic_StoreAndForward_RequestResponse)(meshtastic_StoreAndForward_RequestResponse_CLIENT_ABORT+1)) -#define StoreAndForward_rr_ENUMTYPE StoreAndForward_RequestResponse +#define meshtastic_StoreAndForward_rr_ENUMTYPE meshtastic_StoreAndForward_RequestResponse /* Initializer values for message structs */ -#define StoreAndForward_init_default {_StoreAndForward_RequestResponse_MIN, 0, {StoreAndForward_Statistics_init_default}} -#define StoreAndForward_Statistics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} -#define StoreAndForward_History_init_default {0, 0, 0} -#define StoreAndForward_Heartbeat_init_default {0, 0} -#define StoreAndForward_init_zero {_StoreAndForward_RequestResponse_MIN, 0, {StoreAndForward_Statistics_init_zero}} -#define StoreAndForward_Statistics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} -#define StoreAndForward_History_init_zero {0, 0, 0} -#define StoreAndForward_Heartbeat_init_zero {0, 0} +#define meshtastic_StoreAndForward_init_default {_meshtastic_StoreAndForward_RequestResponse_MIN, 0, {meshtastic_StoreAndForward_Statistics_init_default}} +#define meshtastic_StoreAndForward_Statistics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_StoreAndForward_History_init_default {0, 0, 0} +#define meshtastic_StoreAndForward_Heartbeat_init_default {0, 0} +#define meshtastic_StoreAndForward_init_zero {_meshtastic_StoreAndForward_RequestResponse_MIN, 0, {meshtastic_StoreAndForward_Statistics_init_zero}} +#define meshtastic_StoreAndForward_Statistics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} +#define meshtastic_StoreAndForward_History_init_zero {0, 0, 0} +#define meshtastic_StoreAndForward_Heartbeat_init_zero {0, 0} /* Field tags (for use in manual encoding/decoding) */ -#define StoreAndForward_Statistics_messages_total_tag 1 -#define StoreAndForward_Statistics_messages_saved_tag 2 -#define StoreAndForward_Statistics_messages_max_tag 3 -#define StoreAndForward_Statistics_up_time_tag 4 -#define StoreAndForward_Statistics_requests_tag 5 -#define StoreAndForward_Statistics_requests_history_tag 6 -#define StoreAndForward_Statistics_heartbeat_tag 7 -#define StoreAndForward_Statistics_return_max_tag 8 -#define StoreAndForward_Statistics_return_window_tag 9 -#define StoreAndForward_History_history_messages_tag 1 -#define StoreAndForward_History_window_tag 2 -#define StoreAndForward_History_last_request_tag 3 -#define StoreAndForward_Heartbeat_period_tag 1 -#define StoreAndForward_Heartbeat_secondary_tag 2 -#define StoreAndForward_rr_tag 1 -#define StoreAndForward_stats_tag 2 -#define StoreAndForward_history_tag 3 -#define StoreAndForward_heartbeat_tag 4 -#define StoreAndForward_empty_tag 5 +#define meshtastic_StoreAndForward_Statistics_messages_total_tag 1 +#define meshtastic_StoreAndForward_Statistics_messages_saved_tag 2 +#define meshtastic_StoreAndForward_Statistics_messages_max_tag 3 +#define meshtastic_StoreAndForward_Statistics_up_time_tag 4 +#define meshtastic_StoreAndForward_Statistics_requests_tag 5 +#define meshtastic_StoreAndForward_Statistics_requests_history_tag 6 +#define meshtastic_StoreAndForward_Statistics_heartbeat_tag 7 +#define meshtastic_StoreAndForward_Statistics_return_max_tag 8 +#define meshtastic_StoreAndForward_Statistics_return_window_tag 9 +#define meshtastic_StoreAndForward_History_history_messages_tag 1 +#define meshtastic_StoreAndForward_History_window_tag 2 +#define meshtastic_StoreAndForward_History_last_request_tag 3 +#define meshtastic_StoreAndForward_Heartbeat_period_tag 1 +#define meshtastic_StoreAndForward_Heartbeat_secondary_tag 2 +#define meshtastic_StoreAndForward_rr_tag 1 +#define meshtastic_StoreAndForward_stats_tag 2 +#define meshtastic_StoreAndForward_history_tag 3 +#define meshtastic_StoreAndForward_heartbeat_tag 4 +#define meshtastic_StoreAndForward_empty_tag 5 /* Struct field encoding specification for nanopb */ -#define StoreAndForward_FIELDLIST(X, a) \ +#define meshtastic_StoreAndForward_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UENUM, rr, 1) \ X(a, STATIC, ONEOF, MESSAGE, (variant,stats,variant.stats), 2) \ X(a, STATIC, ONEOF, MESSAGE, (variant,history,variant.history), 3) \ X(a, STATIC, ONEOF, MESSAGE, (variant,heartbeat,variant.heartbeat), 4) \ X(a, STATIC, ONEOF, BOOL, (variant,empty,variant.empty), 5) -#define StoreAndForward_CALLBACK NULL -#define StoreAndForward_DEFAULT NULL -#define StoreAndForward_variant_stats_MSGTYPE StoreAndForward_Statistics -#define StoreAndForward_variant_history_MSGTYPE StoreAndForward_History -#define StoreAndForward_variant_heartbeat_MSGTYPE StoreAndForward_Heartbeat +#define meshtastic_StoreAndForward_CALLBACK NULL +#define meshtastic_StoreAndForward_DEFAULT NULL +#define meshtastic_StoreAndForward_variant_stats_MSGTYPE meshtastic_StoreAndForward_Statistics +#define meshtastic_StoreAndForward_variant_history_MSGTYPE meshtastic_StoreAndForward_History +#define meshtastic_StoreAndForward_variant_heartbeat_MSGTYPE meshtastic_StoreAndForward_Heartbeat -#define StoreAndForward_Statistics_FIELDLIST(X, a) \ +#define meshtastic_StoreAndForward_Statistics_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, messages_total, 1) \ X(a, STATIC, SINGULAR, UINT32, messages_saved, 2) \ X(a, STATIC, SINGULAR, UINT32, messages_max, 3) \ @@ -173,38 +173,38 @@ X(a, STATIC, SINGULAR, UINT32, requests_history, 6) \ X(a, STATIC, SINGULAR, BOOL, heartbeat, 7) \ X(a, STATIC, SINGULAR, UINT32, return_max, 8) \ X(a, STATIC, SINGULAR, UINT32, return_window, 9) -#define StoreAndForward_Statistics_CALLBACK NULL -#define StoreAndForward_Statistics_DEFAULT NULL +#define meshtastic_StoreAndForward_Statistics_CALLBACK NULL +#define meshtastic_StoreAndForward_Statistics_DEFAULT NULL -#define StoreAndForward_History_FIELDLIST(X, a) \ +#define meshtastic_StoreAndForward_History_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, history_messages, 1) \ X(a, STATIC, SINGULAR, UINT32, window, 2) \ X(a, STATIC, SINGULAR, UINT32, last_request, 3) -#define StoreAndForward_History_CALLBACK NULL -#define StoreAndForward_History_DEFAULT NULL +#define meshtastic_StoreAndForward_History_CALLBACK NULL +#define meshtastic_StoreAndForward_History_DEFAULT NULL -#define StoreAndForward_Heartbeat_FIELDLIST(X, a) \ +#define meshtastic_StoreAndForward_Heartbeat_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, period, 1) \ X(a, STATIC, SINGULAR, UINT32, secondary, 2) -#define StoreAndForward_Heartbeat_CALLBACK NULL -#define StoreAndForward_Heartbeat_DEFAULT NULL +#define meshtastic_StoreAndForward_Heartbeat_CALLBACK NULL +#define meshtastic_StoreAndForward_Heartbeat_DEFAULT NULL -extern const pb_msgdesc_t StoreAndForward_msg; -extern const pb_msgdesc_t StoreAndForward_Statistics_msg; -extern const pb_msgdesc_t StoreAndForward_History_msg; -extern const pb_msgdesc_t StoreAndForward_Heartbeat_msg; +extern const pb_msgdesc_t meshtastic_StoreAndForward_msg; +extern const pb_msgdesc_t meshtastic_StoreAndForward_Statistics_msg; +extern const pb_msgdesc_t meshtastic_StoreAndForward_History_msg; +extern const pb_msgdesc_t meshtastic_StoreAndForward_Heartbeat_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define StoreAndForward_fields &StoreAndForward_msg -#define StoreAndForward_Statistics_fields &StoreAndForward_Statistics_msg -#define StoreAndForward_History_fields &StoreAndForward_History_msg -#define StoreAndForward_Heartbeat_fields &StoreAndForward_Heartbeat_msg +#define meshtastic_StoreAndForward_fields &meshtastic_StoreAndForward_msg +#define meshtastic_StoreAndForward_Statistics_fields &meshtastic_StoreAndForward_Statistics_msg +#define meshtastic_StoreAndForward_History_fields &meshtastic_StoreAndForward_History_msg +#define meshtastic_StoreAndForward_Heartbeat_fields &meshtastic_StoreAndForward_Heartbeat_msg /* Maximum encoded size of messages (where known) */ -#define StoreAndForward_Heartbeat_size 12 -#define StoreAndForward_History_size 18 -#define StoreAndForward_Statistics_size 50 -#define StoreAndForward_size 54 +#define meshtastic_StoreAndForward_Heartbeat_size 12 +#define meshtastic_StoreAndForward_History_size 18 +#define meshtastic_StoreAndForward_Statistics_size 50 +#define meshtastic_StoreAndForward_size 54 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/telemetry.pb.c b/src/mesh/generated/meshtastic/telemetry.pb.c index 1446be188..cdc01710a 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.c +++ b/src/mesh/generated/meshtastic/telemetry.pb.c @@ -1,18 +1,18 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./telemetry.pb.h" +#include "meshtastic/telemetry.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(DeviceMetrics, DeviceMetrics, AUTO) +PB_BIND(meshtastic_DeviceMetrics, meshtastic_DeviceMetrics, AUTO) -PB_BIND(EnvironmentMetrics, EnvironmentMetrics, AUTO) +PB_BIND(meshtastic_EnvironmentMetrics, meshtastic_EnvironmentMetrics, AUTO) -PB_BIND(Telemetry, Telemetry, AUTO) +PB_BIND(meshtastic_Telemetry, meshtastic_Telemetry, AUTO) diff --git a/src/mesh/generated/meshtastic/telemetry.pb.h b/src/mesh/generated/meshtastic/telemetry.pb.h index 7d4bb02eb..188b27d77 100644 --- a/src/mesh/generated/meshtastic/telemetry.pb.h +++ b/src/mesh/generated/meshtastic/telemetry.pb.h @@ -11,38 +11,38 @@ /* Enum definitions */ /* TODO: REPLACE */ -typedef enum _TelemetrySensorType { +typedef enum _meshtastic_TelemetrySensorType { /* No external telemetry sensor explicitly set */ - TelemetrySensorType_SENSOR_UNSET = 0, + meshtastic_TelemetrySensorType_SENSOR_UNSET = 0, /* High accuracy temperature, pressure, humidity */ - TelemetrySensorType_BME280 = 1, + meshtastic_TelemetrySensorType_BME280 = 1, /* High accuracy temperature, pressure, humidity, and air resistance */ - TelemetrySensorType_BME680 = 2, + meshtastic_TelemetrySensorType_BME680 = 2, /* Very high accuracy temperature */ - TelemetrySensorType_MCP9808 = 3, + meshtastic_TelemetrySensorType_MCP9808 = 3, /* Moderate accuracy current and voltage */ - TelemetrySensorType_INA260 = 4, + meshtastic_TelemetrySensorType_INA260 = 4, /* Moderate accuracy current and voltage */ - TelemetrySensorType_INA219 = 5, + meshtastic_TelemetrySensorType_INA219 = 5, /* High accuracy temperature and pressure */ - TelemetrySensorType_BMP280 = 6, + meshtastic_TelemetrySensorType_BMP280 = 6, /* High accuracy temperature and humidity */ - TelemetrySensorType_SHTC3 = 7, + meshtastic_TelemetrySensorType_SHTC3 = 7, /* High accuracy pressure */ - TelemetrySensorType_LPS22 = 8, + meshtastic_TelemetrySensorType_LPS22 = 8, /* 3-Axis magnetic sensor */ - TelemetrySensorType_QMC6310 = 9, + meshtastic_TelemetrySensorType_QMC6310 = 9, /* 6-Axis inertial measurement sensor */ - TelemetrySensorType_QMI8658 = 10, + meshtastic_TelemetrySensorType_QMI8658 = 10, /* 3-Axis magnetic sensor */ - TelemetrySensorType_QMC5883L = 11, + meshtastic_TelemetrySensorType_QMC5883L = 11, /* High accuracy temperature and humidity */ - TelemetrySensorType_SHT31 = 12 -} TelemetrySensorType; + meshtastic_TelemetrySensorType_SHT31 = 12 +} meshtastic_TelemetrySensorType; /* Struct definitions */ /* Key native device metrics such as battery level */ -typedef struct _DeviceMetrics { +typedef struct _meshtastic_DeviceMetrics { /* 1-100 (0 means powered) */ uint32_t battery_level; /* Voltage measured */ @@ -51,10 +51,10 @@ typedef struct _DeviceMetrics { float channel_utilization; /* Percent of airtime for transmission used within the last hour. */ float air_util_tx; -} DeviceMetrics; +} meshtastic_DeviceMetrics; /* Weather station or other environmental metrics */ -typedef struct _EnvironmentMetrics { +typedef struct _meshtastic_EnvironmentMetrics { /* Temperature measured */ float temperature; /* Relative humidity percent measured */ @@ -67,24 +67,24 @@ typedef struct _EnvironmentMetrics { float voltage; /* Current measured */ float current; -} EnvironmentMetrics; +} meshtastic_EnvironmentMetrics; /* Types of Measurements the telemetry module is equipped to handle */ -typedef struct _Telemetry { - /* This is usually not sent over the mesh (to save space), but it is sent - from the phone so that the local device can set its RTC If it is sent over - the mesh (because there are devices on the mesh without GPS), it will only - be sent by devices which has a hardware GPS clock (IE Mobile Phone). +typedef struct _meshtastic_Telemetry { + /* This is usually not sent over the mesh (to save space), but it is sent + from the phone so that the local device can set its RTC If it is sent over + the mesh (because there are devices on the mesh without GPS), it will only + be sent by devices which has a hardware GPS clock (IE Mobile Phone). seconds since 1970 */ uint32_t time; pb_size_t which_variant; union { /* Key native device metrics such as battery level */ - DeviceMetrics device_metrics; + meshtastic_DeviceMetrics device_metrics; /* Weather station or other environmental metrics */ - EnvironmentMetrics environment_metrics; + meshtastic_EnvironmentMetrics environment_metrics; } variant; -} Telemetry; +} meshtastic_Telemetry; #ifdef __cplusplus @@ -92,78 +92,78 @@ extern "C" { #endif /* Helper constants for enums */ -#define _TelemetrySensorType_MIN TelemetrySensorType_SENSOR_UNSET -#define _TelemetrySensorType_MAX TelemetrySensorType_SHT31 -#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_SHT31+1)) +#define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET +#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_SHT31 +#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_SHT31+1)) /* Initializer values for message structs */ -#define DeviceMetrics_init_default {0, 0, 0, 0} -#define EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0} -#define Telemetry_init_default {0, 0, {DeviceMetrics_init_default}} -#define DeviceMetrics_init_zero {0, 0, 0, 0} -#define EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0} -#define Telemetry_init_zero {0, 0, {DeviceMetrics_init_zero}} +#define meshtastic_DeviceMetrics_init_default {0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_default {0, 0, 0, 0, 0, 0} +#define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}} +#define meshtastic_DeviceMetrics_init_zero {0, 0, 0, 0} +#define meshtastic_EnvironmentMetrics_init_zero {0, 0, 0, 0, 0, 0} +#define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}} /* Field tags (for use in manual encoding/decoding) */ -#define DeviceMetrics_battery_level_tag 1 -#define DeviceMetrics_voltage_tag 2 -#define DeviceMetrics_channel_utilization_tag 3 -#define DeviceMetrics_air_util_tx_tag 4 -#define EnvironmentMetrics_temperature_tag 1 -#define EnvironmentMetrics_relative_humidity_tag 2 -#define EnvironmentMetrics_barometric_pressure_tag 3 -#define EnvironmentMetrics_gas_resistance_tag 4 -#define EnvironmentMetrics_voltage_tag 5 -#define EnvironmentMetrics_current_tag 6 -#define Telemetry_time_tag 1 -#define Telemetry_device_metrics_tag 2 -#define Telemetry_environment_metrics_tag 3 +#define meshtastic_DeviceMetrics_battery_level_tag 1 +#define meshtastic_DeviceMetrics_voltage_tag 2 +#define meshtastic_DeviceMetrics_channel_utilization_tag 3 +#define meshtastic_DeviceMetrics_air_util_tx_tag 4 +#define meshtastic_EnvironmentMetrics_temperature_tag 1 +#define meshtastic_EnvironmentMetrics_relative_humidity_tag 2 +#define meshtastic_EnvironmentMetrics_barometric_pressure_tag 3 +#define meshtastic_EnvironmentMetrics_gas_resistance_tag 4 +#define meshtastic_EnvironmentMetrics_voltage_tag 5 +#define meshtastic_EnvironmentMetrics_current_tag 6 +#define meshtastic_Telemetry_time_tag 1 +#define meshtastic_Telemetry_device_metrics_tag 2 +#define meshtastic_Telemetry_environment_metrics_tag 3 /* Struct field encoding specification for nanopb */ -#define DeviceMetrics_FIELDLIST(X, a) \ +#define meshtastic_DeviceMetrics_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, battery_level, 1) \ X(a, STATIC, SINGULAR, FLOAT, voltage, 2) \ X(a, STATIC, SINGULAR, FLOAT, channel_utilization, 3) \ X(a, STATIC, SINGULAR, FLOAT, air_util_tx, 4) -#define DeviceMetrics_CALLBACK NULL -#define DeviceMetrics_DEFAULT NULL +#define meshtastic_DeviceMetrics_CALLBACK NULL +#define meshtastic_DeviceMetrics_DEFAULT NULL -#define EnvironmentMetrics_FIELDLIST(X, a) \ +#define meshtastic_EnvironmentMetrics_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, FLOAT, temperature, 1) \ X(a, STATIC, SINGULAR, FLOAT, relative_humidity, 2) \ X(a, STATIC, SINGULAR, FLOAT, barometric_pressure, 3) \ X(a, STATIC, SINGULAR, FLOAT, gas_resistance, 4) \ X(a, STATIC, SINGULAR, FLOAT, voltage, 5) \ X(a, STATIC, SINGULAR, FLOAT, current, 6) -#define EnvironmentMetrics_CALLBACK NULL -#define EnvironmentMetrics_DEFAULT NULL +#define meshtastic_EnvironmentMetrics_CALLBACK NULL +#define meshtastic_EnvironmentMetrics_DEFAULT NULL -#define Telemetry_FIELDLIST(X, a) \ +#define meshtastic_Telemetry_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, FIXED32, time, 1) \ X(a, STATIC, ONEOF, MESSAGE, (variant,device_metrics,variant.device_metrics), 2) \ X(a, STATIC, ONEOF, MESSAGE, (variant,environment_metrics,variant.environment_metrics), 3) -#define Telemetry_CALLBACK NULL -#define Telemetry_DEFAULT NULL -#define Telemetry_variant_device_metrics_MSGTYPE DeviceMetrics -#define Telemetry_variant_environment_metrics_MSGTYPE EnvironmentMetrics +#define meshtastic_Telemetry_CALLBACK NULL +#define meshtastic_Telemetry_DEFAULT NULL +#define meshtastic_Telemetry_variant_device_metrics_MSGTYPE meshtastic_DeviceMetrics +#define meshtastic_Telemetry_variant_environment_metrics_MSGTYPE meshtastic_EnvironmentMetrics -extern const pb_msgdesc_t DeviceMetrics_msg; -extern const pb_msgdesc_t EnvironmentMetrics_msg; -extern const pb_msgdesc_t Telemetry_msg; +extern const pb_msgdesc_t meshtastic_DeviceMetrics_msg; +extern const pb_msgdesc_t meshtastic_EnvironmentMetrics_msg; +extern const pb_msgdesc_t meshtastic_Telemetry_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define DeviceMetrics_fields &DeviceMetrics_msg -#define EnvironmentMetrics_fields &EnvironmentMetrics_msg -#define Telemetry_fields &Telemetry_msg +#define meshtastic_DeviceMetrics_fields &meshtastic_DeviceMetrics_msg +#define meshtastic_EnvironmentMetrics_fields &meshtastic_EnvironmentMetrics_msg +#define meshtastic_Telemetry_fields &meshtastic_Telemetry_msg /* Maximum encoded size of messages (where known) */ -#define DeviceMetrics_size 21 -#define EnvironmentMetrics_size 30 -#define Telemetry_size 37 +#define meshtastic_DeviceMetrics_size 21 +#define meshtastic_EnvironmentMetrics_size 30 +#define meshtastic_Telemetry_size 37 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/meshtastic/xmodem.pb.c b/src/mesh/generated/meshtastic/xmodem.pb.c index f2b00401d..9692a5eb4 100644 --- a/src/mesh/generated/meshtastic/xmodem.pb.c +++ b/src/mesh/generated/meshtastic/xmodem.pb.c @@ -1,12 +1,12 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.4.7 */ -#include "./xmodem.pb.h" +#include "meshtastic/xmodem.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(XModem, XModem, AUTO) +PB_BIND(meshtastic_XModem, meshtastic_XModem, AUTO) diff --git a/src/mesh/generated/meshtastic/xmodem.pb.h b/src/mesh/generated/meshtastic/xmodem.pb.h index 4994fa97b..48d5aa5cd 100644 --- a/src/mesh/generated/meshtastic/xmodem.pb.h +++ b/src/mesh/generated/meshtastic/xmodem.pb.h @@ -10,25 +10,25 @@ #endif /* Enum definitions */ -typedef enum _XModem_Control { - XModem_Control_NUL = 0, - XModem_Control_SOH = 1, - XModem_Control_STX = 2, - XModem_Control_EOT = 4, - XModem_Control_ACK = 6, - XModem_Control_NAK = 21, - XModem_Control_CAN = 24, - XModem_Control_CTRLZ = 26 -} XModem_Control; +typedef enum _meshtastic_XModem_Control { + meshtastic_XModem_Control_NUL = 0, + meshtastic_XModem_Control_SOH = 1, + meshtastic_XModem_Control_STX = 2, + meshtastic_XModem_Control_EOT = 4, + meshtastic_XModem_Control_ACK = 6, + meshtastic_XModem_Control_NAK = 21, + meshtastic_XModem_Control_CAN = 24, + meshtastic_XModem_Control_CTRLZ = 26 +} meshtastic_XModem_Control; /* Struct definitions */ -typedef PB_BYTES_ARRAY_T(128) XModem_buffer_t; -typedef struct _XModem { - XModem_Control control; +typedef PB_BYTES_ARRAY_T(128) meshtastic_XModem_buffer_t; +typedef struct _meshtastic_XModem { + meshtastic_XModem_Control control; uint16_t seq; uint16_t crc16; - XModem_buffer_t buffer; -} XModem; + meshtastic_XModem_buffer_t buffer; +} meshtastic_XModem; #ifdef __cplusplus @@ -36,39 +36,39 @@ extern "C" { #endif /* Helper constants for enums */ -#define _XModem_Control_MIN XModem_Control_NUL -#define _XModem_Control_MAX XModem_Control_CTRLZ -#define _XModem_Control_ARRAYSIZE ((XModem_Control)(XModem_Control_CTRLZ+1)) +#define _meshtastic_XModem_Control_MIN meshtastic_XModem_Control_NUL +#define _meshtastic_XModem_Control_MAX meshtastic_XModem_Control_CTRLZ +#define _meshtastic_XModem_Control_ARRAYSIZE ((meshtastic_XModem_Control)(meshtastic_XModem_Control_CTRLZ+1)) -#define XModem_control_ENUMTYPE XModem_Control +#define meshtastic_XModem_control_ENUMTYPE meshtastic_XModem_Control /* Initializer values for message structs */ -#define XModem_init_default {_XModem_Control_MIN, 0, 0, {0, {0}}} -#define XModem_init_zero {_XModem_Control_MIN, 0, 0, {0, {0}}} +#define meshtastic_XModem_init_default {_meshtastic_XModem_Control_MIN, 0, 0, {0, {0}}} +#define meshtastic_XModem_init_zero {_meshtastic_XModem_Control_MIN, 0, 0, {0, {0}}} /* Field tags (for use in manual encoding/decoding) */ -#define XModem_control_tag 1 -#define XModem_seq_tag 2 -#define XModem_crc16_tag 3 -#define XModem_buffer_tag 4 +#define meshtastic_XModem_control_tag 1 +#define meshtastic_XModem_seq_tag 2 +#define meshtastic_XModem_crc16_tag 3 +#define meshtastic_XModem_buffer_tag 4 /* Struct field encoding specification for nanopb */ -#define XModem_FIELDLIST(X, a) \ +#define meshtastic_XModem_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UENUM, control, 1) \ X(a, STATIC, SINGULAR, UINT32, seq, 2) \ X(a, STATIC, SINGULAR, UINT32, crc16, 3) \ X(a, STATIC, SINGULAR, BYTES, buffer, 4) -#define XModem_CALLBACK NULL -#define XModem_DEFAULT NULL +#define meshtastic_XModem_CALLBACK NULL +#define meshtastic_XModem_DEFAULT NULL -extern const pb_msgdesc_t XModem_msg; +extern const pb_msgdesc_t meshtastic_XModem_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define XModem_fields &XModem_msg +#define meshtastic_XModem_fields &meshtastic_XModem_msg /* Maximum encoded size of messages (where known) */ -#define XModem_size 141 +#define meshtastic_XModem_size 141 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/http/WiFiAPClient.cpp b/src/mesh/http/WiFiAPClient.cpp index e8bacc12a..c3dcb5a0e 100644 --- a/src/mesh/http/WiFiAPClient.cpp +++ b/src/mesh/http/WiFiAPClient.cpp @@ -171,7 +171,7 @@ bool initWifi() WiFi.onEvent(WiFiEvent); WiFi.setAutoReconnect(true); WiFi.setSleep(false); - if (config.network.address_mode == Config_NetworkConfig_AddressMode_STATIC && config.network.ipv4_config.ip != 0) { + if (config.network.address_mode == meshtastic_Config_NetworkConfig_AddressMode_STATIC && config.network.ipv4_config.ip != 0) { WiFi.config(config.network.ipv4_config.ip, config.network.ipv4_config.gateway, config.network.ipv4_config.subnet, config.network.ipv4_config.dns, config.network.ipv4_config.dns); // Wifi wants two DNS servers... set both to the same value diff --git a/src/mesh/mesh-pb-constants.h b/src/mesh/mesh-pb-constants.h index aadfe1f54..8e22aa82b 100644 --- a/src/mesh/mesh-pb-constants.h +++ b/src/mesh/mesh-pb-constants.h @@ -16,10 +16,10 @@ #define MAX_RX_TOPHONE 32 /// max number of nodes allowed in the mesh -#define MAX_NUM_NODES (member_size(DeviceState, node_db) / member_size(DeviceState, node_db[0])) +#define MAX_NUM_NODES (member_size(meshtastic_DeviceState, node_db) / member_size(meshtastic_DeviceState, node_db[0])) /// Max number of channels allowed -#define MAX_NUM_CHANNELS (member_size(ChannelFile, channels) / member_size(ChannelFile, channels[0])) +#define MAX_NUM_CHANNELS (member_size(meshtastic_ChannelFile, channels) / member_size(meshtastic_ChannelFile, channels[0])) /// helper function for encoding a record as a protobuf, any failures to encode are fatal and we will panic /// returns the encoded packet size diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index ac13f273a..2a7b64ab7 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -38,7 +38,7 @@ static void writeSecret(char *buf, size_t bufsz, const char *currentVal) * @param r Decoded AdminMessage * @return bool */ -bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r) +bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *r) { // if handled == false, then let others look at this message also if they want bool handled = false; @@ -49,26 +49,26 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r) /** * Getters */ - case AdminMessage_get_owner_request_tag: + case meshtastic_AdminMessage_get_owner_request_tag: LOG_INFO("Client is getting owner\n"); handleGetOwner(mp); break; - case AdminMessage_get_config_request_tag: + case meshtastic_AdminMessage_get_config_request_tag: LOG_INFO("Client is getting config\n"); handleGetConfig(mp, r->get_config_request); break; - case AdminMessage_get_module_config_request_tag: + case meshtastic_AdminMessage_get_module_config_request_tag: LOG_INFO("Client is getting module config\n"); handleGetModuleConfig(mp, r->get_module_config_request); break; - case AdminMessage_get_channel_request_tag: { + case meshtastic_AdminMessage_get_channel_request_tag: { uint32_t i = r->get_channel_request - 1; LOG_INFO("Client is getting channel %u\n", i); if (i >= MAX_NUM_CHANNELS) - myReply = allocErrorResponse(Routing_Error_BAD_REQUEST, &mp); + myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp); else handleGetChannel(mp, i); break; @@ -77,25 +77,25 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r) /** * Setters */ - case AdminMessage_set_owner_tag: + case meshtastic_AdminMessage_set_owner_tag: LOG_INFO("Client is setting owner\n"); handleSetOwner(r->set_owner); break; - case AdminMessage_set_config_tag: + case meshtastic_AdminMessage_set_config_tag: LOG_INFO("Client is setting the config\n"); handleSetConfig(r->set_config); break; - case AdminMessage_set_module_config_tag: + case meshtastic_AdminMessage_set_module_config_tag: LOG_INFO("Client is setting the module config\n"); handleSetModuleConfig(r->set_module_config); break; - case AdminMessage_set_channel_tag: + case meshtastic_AdminMessage_set_channel_tag: LOG_INFO("Client is setting channel %d\n", r->set_channel.index); if (r->set_channel.index < 0 || r->set_channel.index >= (int)MAX_NUM_CHANNELS) - myReply = allocErrorResponse(Routing_Error_BAD_REQUEST, &mp); + myReply = allocErrorResponse(meshtastic_Routing_Error_BAD_REQUEST, &mp); else handleSetChannel(r->set_channel); break; @@ -103,11 +103,11 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r) /** * Other */ - case AdminMessage_reboot_seconds_tag: { + case meshtastic_AdminMessage_reboot_seconds_tag: { reboot(r->reboot_seconds); break; } - case AdminMessage_reboot_ota_seconds_tag: { + case meshtastic_AdminMessage_reboot_ota_seconds_tag: { int32_t s = r->reboot_ota_seconds; #ifdef ARCH_ESP32 if (BleOta::getOtaAppVersion().isEmpty()) { @@ -125,35 +125,35 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r) rebootAtMsec = (s < 0) ? 0 : (millis() + s * 1000); break; } - case AdminMessage_shutdown_seconds_tag: { + case meshtastic_AdminMessage_shutdown_seconds_tag: { int32_t s = r->shutdown_seconds; LOG_INFO("Shutdown in %d seconds\n", s); shutdownAtMsec = (s < 0) ? 0 : (millis() + s * 1000); break; } - case AdminMessage_get_device_metadata_request_tag: { + case meshtastic_AdminMessage_get_device_metadata_request_tag: { LOG_INFO("Client is getting device metadata\n"); handleGetDeviceMetadata(mp); break; } - case AdminMessage_factory_reset_tag: { + case meshtastic_AdminMessage_factory_reset_tag: { LOG_INFO("Initiating factory reset\n"); nodeDB.factoryReset(); reboot(DEFAULT_REBOOT_SECONDS); break; } - case AdminMessage_nodedb_reset_tag: { + case meshtastic_AdminMessage_nodedb_reset_tag: { LOG_INFO("Initiating node-db reset\n"); nodeDB.resetNodes(); reboot(DEFAULT_REBOOT_SECONDS); break; } - case AdminMessage_begin_edit_settings_tag: { + case meshtastic_AdminMessage_begin_edit_settings_tag: { LOG_INFO("Beginning transaction for editing settings\n"); hasOpenEditTransaction = true; break; } - case AdminMessage_commit_edit_settings_tag: { + case meshtastic_AdminMessage_commit_edit_settings_tag: { LOG_INFO("Committing transaction for edited settings\n"); hasOpenEditTransaction = false; saveChanges(SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS); @@ -167,7 +167,7 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r) #endif default: - AdminMessage res = AdminMessage_init_default; + meshtastic_AdminMessage res = meshtastic_AdminMessage_init_default; AdminMessageHandleResult handleResult = MeshModule::handleAdminMessageForAllPlugins(mp, r, &res); if (handleResult == AdminMessageHandleResult::HANDLED_WITH_RESPONSE) { @@ -183,7 +183,7 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r) // If asked for a response and it is not yet set, generate an 'ACK' response if (mp.decoded.want_response && !myReply) { - myReply = allocErrorResponse(Routing_Error_NONE, &mp); + myReply = allocErrorResponse(meshtastic_Routing_Error_NONE, &mp); } return handled; @@ -193,7 +193,7 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r) * Setter methods */ -void AdminModule::handleSetOwner(const User &o) +void AdminModule::handleSetOwner(const meshtastic_User &o) { int changed = 0; bool licensed_changed = false; @@ -223,53 +223,53 @@ void AdminModule::handleSetOwner(const User &o) } } -void AdminModule::handleSetConfig(const Config &c) +void AdminModule::handleSetConfig(const meshtastic_Config &c) { - bool isRouter = (config.device.role == Config_DeviceConfig_Role_ROUTER); - bool isRegionUnset = (config.lora.region == Config_LoRaConfig_RegionCode_UNSET); + bool isRouter = (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER); + bool isRegionUnset = (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET); switch (c.which_payload_variant) { - case Config_device_tag: + case meshtastic_Config_device_tag: LOG_INFO("Setting config: Device\n"); config.has_device = true; config.device = c.payload_variant.device; // If we're setting router role for the first time, install its intervals - if (!isRouter && c.payload_variant.device.role == Config_DeviceConfig_Role_ROUTER) { + if (!isRouter && c.payload_variant.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER) { nodeDB.initConfigIntervals(); nodeDB.initModuleConfigIntervals(); } break; - case Config_position_tag: + case meshtastic_Config_position_tag: LOG_INFO("Setting config: Position\n"); config.has_position = true; config.position = c.payload_variant.position; // Save nodedb as well in case we got a fixed position packet saveChanges(SEGMENT_DEVICESTATE, false); break; - case Config_power_tag: + case meshtastic_Config_power_tag: LOG_INFO("Setting config: Power\n"); config.has_power = true; config.power = c.payload_variant.power; break; - case Config_network_tag: + case meshtastic_Config_network_tag: LOG_INFO("Setting config: WiFi\n"); config.has_network = true; config.network = c.payload_variant.network; break; - case Config_display_tag: + case meshtastic_Config_display_tag: LOG_INFO("Setting config: Display\n"); config.has_display = true; config.display = c.payload_variant.display; break; - case Config_lora_tag: + case meshtastic_Config_lora_tag: LOG_INFO("Setting config: LoRa\n"); config.has_lora = true; config.lora = c.payload_variant.lora; - if (isRegionUnset && config.lora.region > Config_LoRaConfig_RegionCode_UNSET) { + if (isRegionUnset && config.lora.region > meshtastic_Config_LoRaConfig_RegionCode_UNSET) { config.lora.tx_enabled = true; } break; - case Config_bluetooth_tag: + case meshtastic_Config_bluetooth_tag: LOG_INFO("Setting config: Bluetooth\n"); config.has_bluetooth = true; config.bluetooth = c.payload_variant.bluetooth; @@ -279,50 +279,50 @@ void AdminModule::handleSetConfig(const Config &c) saveChanges(SEGMENT_CONFIG); } -void AdminModule::handleSetModuleConfig(const ModuleConfig &c) +void AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c) { switch (c.which_payload_variant) { - case ModuleConfig_mqtt_tag: + case meshtastic_ModuleConfig_mqtt_tag: LOG_INFO("Setting module config: MQTT\n"); moduleConfig.has_mqtt = true; moduleConfig.mqtt = c.payload_variant.mqtt; break; - case ModuleConfig_serial_tag: + case meshtastic_ModuleConfig_serial_tag: LOG_INFO("Setting module config: Serial\n"); moduleConfig.has_serial = true; moduleConfig.serial = c.payload_variant.serial; break; - case ModuleConfig_external_notification_tag: + case meshtastic_ModuleConfig_external_notification_tag: LOG_INFO("Setting module config: External Notification\n"); moduleConfig.has_external_notification = true; moduleConfig.external_notification = c.payload_variant.external_notification; break; - case ModuleConfig_store_forward_tag: + case meshtastic_ModuleConfig_store_forward_tag: LOG_INFO("Setting module config: Store & Forward\n"); moduleConfig.has_store_forward = true; moduleConfig.store_forward = c.payload_variant.store_forward; break; - case ModuleConfig_range_test_tag: + case meshtastic_ModuleConfig_range_test_tag: LOG_INFO("Setting module config: Range Test\n"); moduleConfig.has_range_test = true; moduleConfig.range_test = c.payload_variant.range_test; break; - case ModuleConfig_telemetry_tag: + case meshtastic_ModuleConfig_telemetry_tag: LOG_INFO("Setting module config: Telemetry\n"); moduleConfig.has_telemetry = true; moduleConfig.telemetry = c.payload_variant.telemetry; break; - case ModuleConfig_canned_message_tag: + case meshtastic_ModuleConfig_canned_message_tag: LOG_INFO("Setting module config: Canned Message\n"); moduleConfig.has_canned_message = true; moduleConfig.canned_message = c.payload_variant.canned_message; break; - case ModuleConfig_audio_tag: + case meshtastic_ModuleConfig_audio_tag: LOG_INFO("Setting module config: Audio\n"); moduleConfig.has_audio = true; moduleConfig.audio = c.payload_variant.audio; break; - case ModuleConfig_remote_hardware_tag: + case meshtastic_ModuleConfig_remote_hardware_tag: LOG_INFO("Setting module config: Remote Hardware\n"); moduleConfig.has_remote_hardware = true; moduleConfig.remote_hardware = c.payload_variant.remote_hardware; @@ -332,7 +332,7 @@ void AdminModule::handleSetModuleConfig(const ModuleConfig &c) saveChanges(SEGMENT_MODULECONFIG); } -void AdminModule::handleSetChannel(const Channel &cc) +void AdminModule::handleSetChannel(const meshtastic_Channel &cc) { channels.setChannel(cc); channels.onConfigChanged(); // tell the radios about this change @@ -343,59 +343,59 @@ void AdminModule::handleSetChannel(const Channel &cc) * Getters */ -void AdminModule::handleGetOwner(const MeshPacket &req) +void AdminModule::handleGetOwner(const meshtastic_MeshPacket &req) { if (req.decoded.want_response) { // We create the reply here - AdminMessage res = AdminMessage_init_default; + meshtastic_AdminMessage res = meshtastic_AdminMessage_init_default; res.get_owner_response = owner; - res.which_payload_variant = AdminMessage_get_owner_response_tag; + res.which_payload_variant = meshtastic_AdminMessage_get_owner_response_tag; myReply = allocDataProtobuf(res); } } -void AdminModule::handleGetConfig(const MeshPacket &req, const uint32_t configType) +void AdminModule::handleGetConfig(const meshtastic_MeshPacket &req, const uint32_t configType) { - AdminMessage res = AdminMessage_init_default; + meshtastic_AdminMessage res = meshtastic_AdminMessage_init_default; if (req.decoded.want_response) { switch (configType) { - case AdminMessage_ConfigType_DEVICE_CONFIG: + case meshtastic_AdminMessage_ConfigType_DEVICE_CONFIG: LOG_INFO("Getting config: Device\n"); - res.get_config_response.which_payload_variant = Config_device_tag; + res.get_config_response.which_payload_variant = meshtastic_Config_device_tag; res.get_config_response.payload_variant.device = config.device; break; - case AdminMessage_ConfigType_POSITION_CONFIG: + case meshtastic_AdminMessage_ConfigType_POSITION_CONFIG: LOG_INFO("Getting config: Position\n"); - res.get_config_response.which_payload_variant = Config_position_tag; + res.get_config_response.which_payload_variant = meshtastic_Config_position_tag; res.get_config_response.payload_variant.position = config.position; break; - case AdminMessage_ConfigType_POWER_CONFIG: + case meshtastic_AdminMessage_ConfigType_POWER_CONFIG: LOG_INFO("Getting config: Power\n"); - res.get_config_response.which_payload_variant = Config_power_tag; + res.get_config_response.which_payload_variant = meshtastic_Config_power_tag; res.get_config_response.payload_variant.power = config.power; break; - case AdminMessage_ConfigType_NETWORK_CONFIG: + case meshtastic_AdminMessage_ConfigType_NETWORK_CONFIG: LOG_INFO("Getting config: Network\n"); - res.get_config_response.which_payload_variant = Config_network_tag; + res.get_config_response.which_payload_variant = meshtastic_Config_network_tag; res.get_config_response.payload_variant.network = config.network; writeSecret(res.get_config_response.payload_variant.network.wifi_psk, sizeof(res.get_config_response.payload_variant.network.wifi_psk), config.network.wifi_psk); break; - case AdminMessage_ConfigType_DISPLAY_CONFIG: + case meshtastic_AdminMessage_ConfigType_DISPLAY_CONFIG: LOG_INFO("Getting config: Display\n"); - res.get_config_response.which_payload_variant = Config_display_tag; + res.get_config_response.which_payload_variant = meshtastic_Config_display_tag; res.get_config_response.payload_variant.display = config.display; break; - case AdminMessage_ConfigType_LORA_CONFIG: + case meshtastic_AdminMessage_ConfigType_LORA_CONFIG: LOG_INFO("Getting config: LoRa\n"); - res.get_config_response.which_payload_variant = Config_lora_tag; + res.get_config_response.which_payload_variant = meshtastic_Config_lora_tag; res.get_config_response.payload_variant.lora = config.lora; break; - case AdminMessage_ConfigType_BLUETOOTH_CONFIG: + case meshtastic_AdminMessage_ConfigType_BLUETOOTH_CONFIG: LOG_INFO("Getting config: Bluetooth\n"); - res.get_config_response.which_payload_variant = Config_bluetooth_tag; + res.get_config_response.which_payload_variant = meshtastic_Config_bluetooth_tag; res.get_config_response.payload_variant.bluetooth = config.bluetooth; break; } @@ -406,60 +406,60 @@ void AdminModule::handleGetConfig(const MeshPacket &req, const uint32_t configTy // hideSecret(r.get_radio_response.preferences.wifi_ssid); // hmm - leave public for now, because only minimally private // and useful for users to know current provisioning) hideSecret(r.get_radio_response.preferences.wifi_password); // r.get_config_response.which_payloadVariant = Config_ModuleConfig_telemetry_tag; - res.which_payload_variant = AdminMessage_get_config_response_tag; + res.which_payload_variant = meshtastic_AdminMessage_get_config_response_tag; myReply = allocDataProtobuf(res); } } -void AdminModule::handleGetModuleConfig(const MeshPacket &req, const uint32_t configType) +void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const uint32_t configType) { - AdminMessage res = AdminMessage_init_default; + meshtastic_AdminMessage res = meshtastic_AdminMessage_init_default; if (req.decoded.want_response) { switch (configType) { - case AdminMessage_ModuleConfigType_MQTT_CONFIG: + case meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG: LOG_INFO("Getting module config: MQTT\n"); - res.get_module_config_response.which_payload_variant = ModuleConfig_mqtt_tag; + res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_mqtt_tag; res.get_module_config_response.payload_variant.mqtt = moduleConfig.mqtt; break; - case AdminMessage_ModuleConfigType_SERIAL_CONFIG: + case meshtastic_AdminMessage_ModuleConfigType_SERIAL_CONFIG: LOG_INFO("Getting module config: Serial\n"); - res.get_module_config_response.which_payload_variant = ModuleConfig_serial_tag; + res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_serial_tag; res.get_module_config_response.payload_variant.serial = moduleConfig.serial; break; - case AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG: + case meshtastic_AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG: LOG_INFO("Getting module config: External Notification\n"); - res.get_module_config_response.which_payload_variant = ModuleConfig_external_notification_tag; + res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_external_notification_tag; res.get_module_config_response.payload_variant.external_notification = moduleConfig.external_notification; break; - case AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG: + case meshtastic_AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG: LOG_INFO("Getting module config: Store & Forward\n"); - res.get_module_config_response.which_payload_variant = ModuleConfig_store_forward_tag; + res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_store_forward_tag; res.get_module_config_response.payload_variant.store_forward = moduleConfig.store_forward; break; - case AdminMessage_ModuleConfigType_RANGETEST_CONFIG: + case meshtastic_AdminMessage_ModuleConfigType_RANGETEST_CONFIG: LOG_INFO("Getting module config: Range Test\n"); - res.get_module_config_response.which_payload_variant = ModuleConfig_range_test_tag; + res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_range_test_tag; res.get_module_config_response.payload_variant.range_test = moduleConfig.range_test; break; - case AdminMessage_ModuleConfigType_TELEMETRY_CONFIG: + case meshtastic_AdminMessage_ModuleConfigType_TELEMETRY_CONFIG: LOG_INFO("Getting module config: Telemetry\n"); - res.get_module_config_response.which_payload_variant = ModuleConfig_telemetry_tag; + res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_telemetry_tag; res.get_module_config_response.payload_variant.telemetry = moduleConfig.telemetry; break; - case AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG: + case meshtastic_AdminMessage_ModuleConfigType_CANNEDMSG_CONFIG: LOG_INFO("Getting module config: Canned Message\n"); - res.get_module_config_response.which_payload_variant = ModuleConfig_canned_message_tag; + res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_canned_message_tag; res.get_module_config_response.payload_variant.canned_message = moduleConfig.canned_message; break; - case AdminMessage_ModuleConfigType_AUDIO_CONFIG: + case meshtastic_AdminMessage_ModuleConfigType_AUDIO_CONFIG: LOG_INFO("Getting module config: Audio\n"); - res.get_module_config_response.which_payload_variant = ModuleConfig_audio_tag; + res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_audio_tag; res.get_module_config_response.payload_variant.audio = moduleConfig.audio; break; - case AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG: + case meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG: LOG_INFO("Getting module config: Remote Hardware\n"); - res.get_module_config_response.which_payload_variant = ModuleConfig_remote_hardware_tag; + res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_remote_hardware_tag; res.get_module_config_response.payload_variant.remote_hardware = moduleConfig.remote_hardware; break; } @@ -471,16 +471,16 @@ void AdminModule::handleGetModuleConfig(const MeshPacket &req, const uint32_t co // hideSecret(r.get_radio_response.preferences.wifi_ssid); // hmm - leave public for now, because only minimally private // and useful for users to know current provisioning) hideSecret(r.get_radio_response.preferences.wifi_password); // r.get_config_response.which_payloadVariant = Config_ModuleConfig_telemetry_tag; - res.which_payload_variant = AdminMessage_get_module_config_response_tag; + res.which_payload_variant = meshtastic_AdminMessage_get_module_config_response_tag; myReply = allocDataProtobuf(res); } } -void AdminModule::handleGetDeviceMetadata(const MeshPacket &req) +void AdminModule::handleGetDeviceMetadata(const meshtastic_MeshPacket &req) { - AdminMessage r = AdminMessage_init_default; + meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default; - DeviceMetadata deviceMetadata; + meshtastic_DeviceMetadata deviceMetadata; strncpy(deviceMetadata.firmware_version, myNodeInfo.firmware_version, 18); deviceMetadata.device_state_version = DEVICESTATE_CUR_VER; deviceMetadata.canShutdown = pmu_found || HAS_CPU_SHUTDOWN; @@ -491,17 +491,17 @@ void AdminModule::handleGetDeviceMetadata(const MeshPacket &req) deviceMetadata.position_flags = config.position.position_flags; r.get_device_metadata_response = deviceMetadata; - r.which_payload_variant = AdminMessage_get_device_metadata_response_tag; + r.which_payload_variant = meshtastic_AdminMessage_get_device_metadata_response_tag; myReply = allocDataProtobuf(r); } -void AdminModule::handleGetChannel(const MeshPacket &req, uint32_t channelIndex) +void AdminModule::handleGetChannel(const meshtastic_MeshPacket &req, uint32_t channelIndex) { if (req.decoded.want_response) { // We create the reply here - AdminMessage r = AdminMessage_init_default; + meshtastic_AdminMessage r = meshtastic_AdminMessage_init_default; r.get_channel_response = channels.getByIndex(channelIndex); - r.which_payload_variant = AdminMessage_get_channel_response_tag; + r.which_payload_variant = meshtastic_AdminMessage_get_channel_response_tag; myReply = allocDataProtobuf(r); } } @@ -526,7 +526,7 @@ void AdminModule::saveChanges(int saveWhat, bool shouldReboot) } } -AdminModule::AdminModule() : ProtobufModule("Admin", PortNum_ADMIN_APP, &AdminMessage_msg) +AdminModule::AdminModule() : ProtobufModule("Admin", meshtastic_PortNum_ADMIN_APP, &meshtastic_AdminMessage_msg) { // restrict to the admin channel for rx boundChannel = Channels::adminChannel; diff --git a/src/modules/AdminModule.h b/src/modules/AdminModule.h index 369bcc60b..a0602b140 100644 --- a/src/modules/AdminModule.h +++ b/src/modules/AdminModule.h @@ -4,7 +4,7 @@ /** * Admin module for admin messages */ -class AdminModule : public ProtobufModule +class AdminModule : public ProtobufModule { public: /** Constructor @@ -17,7 +17,7 @@ class AdminModule : public ProtobufModule @return true if you've guaranteed you've handled this message and no other handlers should be considered for it */ - virtual bool handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *p) override; + virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *p) override; private: bool hasOpenEditTransaction = false; @@ -26,19 +26,19 @@ class AdminModule : public ProtobufModule /** * Getters */ - void handleGetOwner(const MeshPacket &req); - void handleGetConfig(const MeshPacket &req, uint32_t configType); - void handleGetModuleConfig(const MeshPacket &req, uint32_t configType); - void handleGetChannel(const MeshPacket &req, uint32_t channelIndex); - void handleGetDeviceMetadata(const MeshPacket &req); + void handleGetOwner(const meshtastic_MeshPacket &req); + void handleGetConfig(const meshtastic_MeshPacket &req, uint32_t configType); + void handleGetModuleConfig(const meshtastic_MeshPacket &req, uint32_t configType); + void handleGetChannel(const meshtastic_MeshPacket &req, uint32_t channelIndex); + void handleGetDeviceMetadata(const meshtastic_MeshPacket &req); /** * Setters */ - void handleSetOwner(const User &o); - void handleSetChannel(const Channel &cc); - void handleSetConfig(const Config &c); - void handleSetModuleConfig(const ModuleConfig &c); + void handleSetOwner(const meshtastic_User &o); + void handleSetChannel(const meshtastic_Channel &cc); + void handleSetConfig(const meshtastic_Config &c); + void handleSetModuleConfig(const meshtastic_ModuleConfig &c); void handleSetChannel(); void reboot(int32_t seconds); }; diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 5e1550893..c6bc13388 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -39,12 +39,12 @@ extern uint8_t cardkb_found; static const char *cannedMessagesConfigFile = "/prefs/cannedConf.proto"; -CannedMessageModuleConfig cannedMessageModuleConfig; +meshtastic_CannedMessageModuleConfig cannedMessageModuleConfig; CannedMessageModule *cannedMessageModule; CannedMessageModule::CannedMessageModule() - : SinglePortModule("canned", PortNum_TEXT_MESSAGE_APP), concurrency::OSThread("CannedMessageModule") + : SinglePortModule("canned", meshtastic_PortNum_TEXT_MESSAGE_APP), concurrency::OSThread("CannedMessageModule") { if (moduleConfig.canned_message.enabled) { this->loadProtoForModule(); @@ -122,17 +122,17 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event) } bool validEvent = false; - if (event->inputEvent == static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_UP)) { + if (event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP)) { LOG_DEBUG("Canned message event UP\n"); this->runState = CANNED_MESSAGE_RUN_STATE_ACTION_UP; validEvent = true; } - if (event->inputEvent == static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_DOWN)) { + if (event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN)) { LOG_DEBUG("Canned message event DOWN\n"); this->runState = CANNED_MESSAGE_RUN_STATE_ACTION_DOWN; validEvent = true; } - if (event->inputEvent == static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_SELECT)) { + if (event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT)) { LOG_DEBUG("Canned message event Select\n"); // when inactive, call the onebutton shortpress instead. Activate Module only on up/down if ((this->runState == CANNED_MESSAGE_RUN_STATE_INACTIVE) || (this->runState == CANNED_MESSAGE_RUN_STATE_DISABLED)) { @@ -143,15 +143,15 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event) validEvent = true; } } - if (event->inputEvent == static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL)) { + if (event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL)) { LOG_DEBUG("Canned message event Cancel\n"); // emulate a timeout. Same result this->lastTouchMillis = 0; validEvent = true; } - if ((event->inputEvent == static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_BACK)) || - (event->inputEvent == static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_LEFT)) || - (event->inputEvent == static_cast(ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT))) { + if ((event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK)) || + (event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT)) || + (event->inputEvent == static_cast(meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT))) { LOG_DEBUG("Canned message event (%x)\n", event->kbchar); if (this->runState == CANNED_MESSAGE_RUN_STATE_FREETEXT) { // pass the pressed key @@ -192,7 +192,7 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event) void CannedMessageModule::sendText(NodeNum dest, const char *message, bool wantReplies) { - MeshPacket *p = allocDataPacket(); + meshtastic_MeshPacket *p = allocDataPacket(); p->to = dest; p->want_ack = true; p->decoded.payload.size = strlen(message); @@ -360,9 +360,9 @@ int32_t CannedMessageModule::runOnce() this->freetext.substring(0, this->cursor) + this->payload + this->freetext.substring(this->cursor); } this->cursor += 1; - if (this->freetext.length() > Constants_DATA_PAYLOAD_LEN) { - this->cursor = Constants_DATA_PAYLOAD_LEN; - this->freetext = this->freetext.substring(0, Constants_DATA_PAYLOAD_LEN); + if (this->freetext.length() > meshtastic_Constants_DATA_PAYLOAD_LEN) { + this->cursor = meshtastic_Constants_DATA_PAYLOAD_LEN; + this->freetext = this->freetext.substring(0, meshtastic_Constants_DATA_PAYLOAD_LEN); } break; } @@ -398,7 +398,7 @@ const char *CannedMessageModule::getNodeName(NodeNum node) if (node == NODENUM_BROADCAST) { return "Broadcast"; } else { - NodeInfo *info = nodeDB.getNode(node); + meshtastic_NodeInfo *info = nodeDB.getNode(node); if (info != NULL) { return info->user.long_name; } else { @@ -457,7 +457,7 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st } display->drawStringf(0 + x, 0 + y, buffer, "To: %s", cannedMessageModule->getNodeName(this->dest)); // used chars right aligned - snprintf(buffer, sizeof(buffer), "%d left", Constants_DATA_PAYLOAD_LEN - this->freetext.length()); + snprintf(buffer, sizeof(buffer), "%d left", meshtastic_Constants_DATA_PAYLOAD_LEN - this->freetext.length()); display->drawString(x + display->getWidth() - display->getStringWidth(buffer), y + 0, buffer); if (this->destSelect) { display->drawString(x + display->getWidth() - display->getStringWidth(buffer) - 1, y + 0, buffer); @@ -483,8 +483,8 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st void CannedMessageModule::loadProtoForModule() { - if (!nodeDB.loadProto(cannedMessagesConfigFile, CannedMessageModuleConfig_size, sizeof(CannedMessageModuleConfig), - &CannedMessageModuleConfig_msg, &cannedMessageModuleConfig)) { + if (!nodeDB.loadProto(cannedMessagesConfigFile, meshtastic_CannedMessageModuleConfig_size, sizeof(meshtastic_CannedMessageModuleConfig), + &meshtastic_CannedMessageModuleConfig_msg, &cannedMessageModuleConfig)) { installDefaultCannedMessageModuleConfig(); } } @@ -503,7 +503,7 @@ bool CannedMessageModule::saveProtoForModule() FS.mkdir("/prefs"); #endif - okay &= nodeDB.saveProto(cannedMessagesConfigFile, CannedMessageModuleConfig_size, &CannedMessageModuleConfig_msg, + okay &= nodeDB.saveProto(cannedMessagesConfigFile, meshtastic_CannedMessageModuleConfig_size, &meshtastic_CannedMessageModuleConfig_msg, &cannedMessageModuleConfig); return okay; @@ -526,19 +526,19 @@ void CannedMessageModule::installDefaultCannedMessageModuleConfig() * @return AdminMessageHandleResult HANDLED if message was handled * HANDLED_WITH_RESULT if a result is also prepared. */ -AdminMessageHandleResult CannedMessageModule::handleAdminMessageForModule(const MeshPacket &mp, AdminMessage *request, - AdminMessage *response) +AdminMessageHandleResult CannedMessageModule::handleAdminMessageForModule(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *request, + meshtastic_AdminMessage *response) { AdminMessageHandleResult result; switch (request->which_payload_variant) { - case AdminMessage_get_canned_message_module_messages_request_tag: + case meshtastic_AdminMessage_get_canned_message_module_messages_request_tag: LOG_DEBUG("Client is getting radio canned messages\n"); this->handleGetCannedMessageModuleMessages(mp, response); result = AdminMessageHandleResult::HANDLED_WITH_RESPONSE; break; - case AdminMessage_set_canned_message_module_messages_tag: + case meshtastic_AdminMessage_set_canned_message_module_messages_tag: LOG_DEBUG("Client is setting radio canned messages\n"); this->handleSetCannedMessageModuleMessages(request->set_canned_message_module_messages); result = AdminMessageHandleResult::HANDLED; @@ -551,11 +551,11 @@ AdminMessageHandleResult CannedMessageModule::handleAdminMessageForModule(const return result; } -void CannedMessageModule::handleGetCannedMessageModuleMessages(const MeshPacket &req, AdminMessage *response) +void CannedMessageModule::handleGetCannedMessageModuleMessages(const meshtastic_MeshPacket &req, meshtastic_AdminMessage *response) { LOG_DEBUG("*** handleGetCannedMessageModuleMessages\n"); if (req.decoded.want_response) { - response->which_payload_variant = AdminMessage_get_canned_message_module_messages_response_tag; + response->which_payload_variant = meshtastic_AdminMessage_get_canned_message_module_messages_response_tag; strncpy(response->get_canned_message_module_messages_response, cannedMessageModuleConfig.messages, sizeof(response->get_canned_message_module_messages_response)); } // Don't send anything if not instructed to. Better than asserting. diff --git a/src/modules/CannedMessageModule.h b/src/modules/CannedMessageModule.h index 744ec6f47..8e1b3a85d 100644 --- a/src/modules/CannedMessageModule.h +++ b/src/modules/CannedMessageModule.h @@ -36,7 +36,7 @@ class CannedMessageModule : public SinglePortModule, public ObservableshouldDraw(); } virtual Observable *getUIFrameObservable() override { return this; } virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override; - virtual AdminMessageHandleResult handleAdminMessageForModule(const MeshPacket &mp, AdminMessage *request, - AdminMessage *response) override; + virtual AdminMessageHandleResult handleAdminMessageForModule(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *request, + meshtastic_AdminMessage *response) override; void loadProtoForModule(); bool saveProtoForModule(); diff --git a/src/modules/ExternalNotificationModule.cpp b/src/modules/ExternalNotificationModule.cpp index 1e379b65c..3390cdd79 100644 --- a/src/modules/ExternalNotificationModule.cpp +++ b/src/modules/ExternalNotificationModule.cpp @@ -27,7 +27,7 @@ #define ASCII_BELL 0x07 -RTTTLConfig rtttlConfig; +meshtastic_RTTTLConfig rtttlConfig; ExternalNotificationModule *externalNotificationModule; @@ -142,7 +142,7 @@ void ExternalNotificationModule::stopNow() } ExternalNotificationModule::ExternalNotificationModule() - : SinglePortModule("ExternalNotificationModule", PortNum_TEXT_MESSAGE_APP), concurrency::OSThread( + : SinglePortModule("ExternalNotificationModule", meshtastic_PortNum_TEXT_MESSAGE_APP), concurrency::OSThread( "ExternalNotificationModule") { /* @@ -164,7 +164,7 @@ ExternalNotificationModule::ExternalNotificationModule() // moduleConfig.external_notification.nag_timeout = 300; if (moduleConfig.external_notification.enabled) { - if (!nodeDB.loadProto(rtttlConfigFile, RTTTLConfig_size, sizeof(RTTTLConfig), &RTTTLConfig_msg, &rtttlConfig)) { + if (!nodeDB.loadProto(rtttlConfigFile, meshtastic_RTTTLConfig_size, sizeof(meshtastic_RTTTLConfig), &meshtastic_RTTTLConfig_msg, &rtttlConfig)) { memset(rtttlConfig.ringtone, 0, sizeof(rtttlConfig.ringtone)); strncpy(rtttlConfig.ringtone, "a:d=8,o=5,b=125:4d#6,a#,2d#6,16p,g#,4a#,4d#.,p,16g,16a#,d#6,a#,f6,2d#6,16p,c#.6,16c6,16a#,g#.,2a#", @@ -205,7 +205,7 @@ ExternalNotificationModule::ExternalNotificationModule() } } -ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp) +ProcessMessage ExternalNotificationModule::handleReceived(const meshtastic_MeshPacket &mp) { if (moduleConfig.external_notification.enabled) { @@ -319,19 +319,19 @@ ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp) * @return AdminMessageHandleResult HANDLED if message was handled * HANDLED_WITH_RESULT if a result is also prepared. */ -AdminMessageHandleResult ExternalNotificationModule::handleAdminMessageForModule(const MeshPacket &mp, AdminMessage *request, - AdminMessage *response) +AdminMessageHandleResult ExternalNotificationModule::handleAdminMessageForModule(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *request, + meshtastic_AdminMessage *response) { AdminMessageHandleResult result; switch (request->which_payload_variant) { - case AdminMessage_get_ringtone_request_tag: + case meshtastic_AdminMessage_get_ringtone_request_tag: LOG_INFO("Client is getting ringtone\n"); this->handleGetRingtone(mp, response); result = AdminMessageHandleResult::HANDLED_WITH_RESPONSE; break; - case AdminMessage_set_ringtone_message_tag: + case meshtastic_AdminMessage_set_ringtone_message_tag: LOG_INFO("Client is setting ringtone\n"); this->handleSetRingtone(request->set_canned_message_module_messages); result = AdminMessageHandleResult::HANDLED; @@ -344,11 +344,11 @@ AdminMessageHandleResult ExternalNotificationModule::handleAdminMessageForModule return result; } -void ExternalNotificationModule::handleGetRingtone(const MeshPacket &req, AdminMessage *response) +void ExternalNotificationModule::handleGetRingtone(const meshtastic_MeshPacket &req, meshtastic_AdminMessage *response) { LOG_INFO("*** handleGetRingtone\n"); if (req.decoded.want_response) { - response->which_payload_variant = AdminMessage_get_ringtone_response_tag; + response->which_payload_variant = meshtastic_AdminMessage_get_ringtone_response_tag; strncpy(response->get_ringtone_response, rtttlConfig.ringtone, sizeof(response->get_ringtone_response)); } // Don't send anything if not instructed to. Better than asserting. } @@ -364,6 +364,6 @@ void ExternalNotificationModule::handleSetRingtone(const char *from_msg) } if (changed) { - nodeDB.saveProto(rtttlConfigFile, RTTTLConfig_size, &RTTTLConfig_msg, &rtttlConfig); + nodeDB.saveProto(rtttlConfigFile, meshtastic_RTTTLConfig_size, &meshtastic_RTTTLConfig_msg, &rtttlConfig); } } \ No newline at end of file diff --git a/src/modules/ExternalNotificationModule.h b/src/modules/ExternalNotificationModule.h index 2adc3ad1a..fa196c8bc 100644 --- a/src/modules/ExternalNotificationModule.h +++ b/src/modules/ExternalNotificationModule.h @@ -40,7 +40,7 @@ class ExternalNotificationModule : public SinglePortModule, private concurrency: void stopNow(); - void handleGetRingtone(const MeshPacket &req, AdminMessage *response); + void handleGetRingtone(const meshtastic_MeshPacket &req, meshtastic_AdminMessage *response); void handleSetRingtone(const char *from_msg); protected: @@ -48,14 +48,14 @@ class ExternalNotificationModule : public SinglePortModule, private concurrency: @return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it */ - virtual ProcessMessage handleReceived(const MeshPacket &mp) override; + virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override; virtual int32_t runOnce() override; bool isNagging = false; - virtual AdminMessageHandleResult handleAdminMessageForModule(const MeshPacket &mp, AdminMessage *request, - AdminMessage *response) override; + virtual AdminMessageHandleResult handleAdminMessageForModule(const meshtastic_MeshPacket &mp, meshtastic_AdminMessage *request, + meshtastic_AdminMessage *response) override; }; extern ExternalNotificationModule *externalNotificationModule; diff --git a/src/modules/NodeInfoModule.cpp b/src/modules/NodeInfoModule.cpp index 5fe2ef299..e7ac3133f 100644 --- a/src/modules/NodeInfoModule.cpp +++ b/src/modules/NodeInfoModule.cpp @@ -8,7 +8,7 @@ NodeInfoModule *nodeInfoModule; -bool NodeInfoModule::handleReceivedProtobuf(const MeshPacket &mp, User *pptr) +bool NodeInfoModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_User *pptr) { auto p = *pptr; @@ -33,25 +33,25 @@ void NodeInfoModule::sendOurNodeInfo(NodeNum dest, bool wantReplies) if (prevPacketId) // if we wrap around to zero, we'll simply fail to cancel in that rare case (no big deal) service.cancelSending(prevPacketId); - MeshPacket *p = allocReply(); + meshtastic_MeshPacket *p = allocReply(); p->to = dest; p->decoded.want_response = wantReplies; - p->priority = MeshPacket_Priority_BACKGROUND; + p->priority = meshtastic_MeshPacket_Priority_BACKGROUND; prevPacketId = p->id; service.sendToMesh(p); } -MeshPacket *NodeInfoModule::allocReply() +meshtastic_MeshPacket *NodeInfoModule::allocReply() { - User &u = owner; + meshtastic_User &u = owner; LOG_INFO("sending owner %s/%s/%s\n", u.id, u.long_name, u.short_name); return allocDataProtobuf(u); } NodeInfoModule::NodeInfoModule() - : ProtobufModule("nodeinfo", PortNum_NODEINFO_APP, &User_msg), concurrency::OSThread("NodeInfoModule") + : ProtobufModule("nodeinfo", meshtastic_PortNum_NODEINFO_APP, &meshtastic_User_msg), concurrency::OSThread("NodeInfoModule") { isPromiscuous = true; // We always want to update our nodedb, even if we are sniffing on others setIntervalFromNow(30 * diff --git a/src/modules/NodeInfoModule.h b/src/modules/NodeInfoModule.h index d805f362b..4645b06b4 100644 --- a/src/modules/NodeInfoModule.h +++ b/src/modules/NodeInfoModule.h @@ -4,7 +4,7 @@ /** * NodeInfo module for sending/receiving NodeInfos into the mesh */ -class NodeInfoModule : public ProtobufModule, private concurrency::OSThread +class NodeInfoModule : public ProtobufModule, private concurrency::OSThread { /// The id of the last packet we sent, to allow us to cancel it if we make something fresher PacketId prevPacketId = 0; @@ -27,11 +27,11 @@ class NodeInfoModule : public ProtobufModule, private concurrency::OSThrea @return true if you've guaranteed you've handled this message and no other handlers should be considered for it */ - virtual bool handleReceivedProtobuf(const MeshPacket &mp, User *p) override; + virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_User *p) override; /** Messages can be received that have the want_response bit set. If set, this callback will be invoked * so that subclasses can (optionally) send a response back to the original sender. */ - virtual MeshPacket *allocReply() override; + virtual meshtastic_MeshPacket *allocReply() override; /** Does our periodic broadcast */ virtual int32_t runOnce() override; diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index b3565d919..29cd638ca 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -10,13 +10,13 @@ PositionModule *positionModule; PositionModule::PositionModule() - : ProtobufModule("position", PortNum_POSITION_APP, &Position_msg), concurrency::OSThread("PositionModule") + : ProtobufModule("position", meshtastic_PortNum_POSITION_APP, &meshtastic_Position_msg), concurrency::OSThread("PositionModule") { isPromiscuous = true; // We always want to update our nodedb, even if we are sniffing on others setIntervalFromNow(60 * 1000); // Send our initial position 60 seconds after we start (to give GPS time to setup) } -bool PositionModule::handleReceivedProtobuf(const MeshPacket &mp, Position *pptr) +bool PositionModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Position *pptr) { auto p = *pptr; @@ -53,9 +53,9 @@ bool PositionModule::handleReceivedProtobuf(const MeshPacket &mp, Position *pptr return false; // Let others look at this message also if they want } -MeshPacket *PositionModule::allocReply() +meshtastic_MeshPacket *PositionModule::allocReply() { - NodeInfo *node = service.refreshMyNodeInfo(); // should guarantee there is now a position + meshtastic_NodeInfo *node = service.refreshMyNodeInfo(); // should guarantee there is now a position assert(node->has_position); node->position.seq_number++; @@ -65,44 +65,44 @@ MeshPacket *PositionModule::allocReply() uint32_t pos_flags = config.position.position_flags; // Populate a Position struct with ONLY the requested fields - Position p = Position_init_default; // Start with an empty structure + meshtastic_Position p = meshtastic_Position_init_default; // Start with an empty structure // lat/lon are unconditionally included - IF AVAILABLE! p.latitude_i = node->position.latitude_i; p.longitude_i = node->position.longitude_i; p.time = node->position.time; - if (pos_flags & Config_PositionConfig_PositionFlags_ALTITUDE) { - if (pos_flags & Config_PositionConfig_PositionFlags_ALTITUDE_MSL) + if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE) { + if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE_MSL) p.altitude = node->position.altitude; else p.altitude_hae = node->position.altitude_hae; - if (pos_flags & Config_PositionConfig_PositionFlags_GEOIDAL_SEPARATION) + if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_GEOIDAL_SEPARATION) p.altitude_geoidal_separation = node->position.altitude_geoidal_separation; } - if (pos_flags & Config_PositionConfig_PositionFlags_DOP) { - if (pos_flags & Config_PositionConfig_PositionFlags_HVDOP) { + if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_DOP) { + if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_HVDOP) { p.HDOP = node->position.HDOP; p.VDOP = node->position.VDOP; } else p.PDOP = node->position.PDOP; } - if (pos_flags & Config_PositionConfig_PositionFlags_SATINVIEW) + if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_SATINVIEW) p.sats_in_view = node->position.sats_in_view; - if (pos_flags & Config_PositionConfig_PositionFlags_TIMESTAMP) + if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_TIMESTAMP) p.timestamp = node->position.timestamp; - if (pos_flags & Config_PositionConfig_PositionFlags_SEQ_NO) + if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_SEQ_NO) p.seq_number = node->position.seq_number; - if (pos_flags & Config_PositionConfig_PositionFlags_HEADING) + if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_HEADING) p.ground_track = node->position.ground_track; - if (pos_flags & Config_PositionConfig_PositionFlags_SPEED) + if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_SPEED) p.ground_speed = node->position.ground_speed; // Strip out any time information before sending packets to other nodes - to keep the wire size small (and because other @@ -125,10 +125,10 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies) if (prevPacketId) // if we wrap around to zero, we'll simply fail to cancel in that rare case (no big deal) service.cancelSending(prevPacketId); - MeshPacket *p = allocReply(); + meshtastic_MeshPacket *p = allocReply(); p->to = dest; p->decoded.want_response = wantReplies; - p->priority = MeshPacket_Priority_BACKGROUND; + p->priority = meshtastic_MeshPacket_Priority_BACKGROUND; prevPacketId = p->id; service.sendToMesh(p, RX_SRC_LOCAL, true); @@ -136,7 +136,7 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies) int32_t PositionModule::runOnce() { - NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); + meshtastic_NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); // We limit our GPS broadcasts to a max rate uint32_t now = millis(); @@ -166,7 +166,7 @@ int32_t PositionModule::runOnce() // Only send packets if the channel is less than 25% utilized. if (airTime->isTxAllowedChannelUtil(true)) { - NodeInfo *node2 = service.refreshMyNodeInfo(); // should guarantee there is now a position + meshtastic_NodeInfo *node2 = service.refreshMyNodeInfo(); // should guarantee there is now a position if (node2->has_position && (node2->position.latitude_i != 0 || node2->position.longitude_i != 0)) { // The minimum distance to travel before we are able to send a new position packet. diff --git a/src/modules/PositionModule.h b/src/modules/PositionModule.h index d5a33a95a..8e9c37087 100644 --- a/src/modules/PositionModule.h +++ b/src/modules/PositionModule.h @@ -5,7 +5,7 @@ /** * Position module for sending/receiving positions into the mesh */ -class PositionModule : public ProtobufModule, private concurrency::OSThread +class PositionModule : public ProtobufModule, private concurrency::OSThread { /// The id of the last packet we sent, to allow us to cancel it if we make something fresher PacketId prevPacketId = 0; @@ -36,11 +36,11 @@ class PositionModule : public ProtobufModule, private concurrency::OST @return true if you've guaranteed you've handled this message and no other handlers should be considered for it */ - virtual bool handleReceivedProtobuf(const MeshPacket &mp, Position *p) override; + virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Position *p) override; /** Messages can be received that have the want_response bit set. If set, this callback will be invoked * so that subclasses can (optionally) send a response back to the original sender. */ - virtual MeshPacket *allocReply() override; + virtual meshtastic_MeshPacket *allocReply() override; /** Does our periodic broadcast */ virtual int32_t runOnce() override; diff --git a/src/modules/RemoteHardwareModule.cpp b/src/modules/RemoteHardwareModule.cpp index 4336d6229..b7dfd00a5 100644 --- a/src/modules/RemoteHardwareModule.cpp +++ b/src/modules/RemoteHardwareModule.cpp @@ -47,19 +47,19 @@ static uint64_t digitalReads(uint64_t mask) } RemoteHardwareModule::RemoteHardwareModule() - : ProtobufModule("remotehardware", PortNum_REMOTE_HARDWARE_APP, &HardwareMessage_msg), concurrency::OSThread( + : ProtobufModule("remotehardware", meshtastic_PortNum_REMOTE_HARDWARE_APP, &meshtastic_HardwareMessage_msg), concurrency::OSThread( "RemoteHardwareModule") { } -bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, HardwareMessage *pptr) +bool RemoteHardwareModule::handleReceivedProtobuf(const meshtastic_MeshPacket &req, meshtastic_HardwareMessage *pptr) { if (moduleConfig.remote_hardware.enabled) { auto p = *pptr; LOG_INFO("Received RemoteHardware typ=%d\n", p.type); switch (p.type) { - case HardwareMessage_Type_WRITE_GPIOS: + case meshtastic_HardwareMessage_Type_WRITE_GPIOS: // Print notification to LCD screen screen->print("Write GPIOs\n"); @@ -73,7 +73,7 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, Hardwar break; - case HardwareMessage_Type_READ_GPIOS: { + case meshtastic_HardwareMessage_Type_READ_GPIOS: { // Print notification to LCD screen if (screen) screen->print("Read GPIOs\n"); @@ -81,17 +81,17 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, Hardwar uint64_t res = digitalReads(p.gpio_mask); // Send the reply - HardwareMessage r = HardwareMessage_init_default; - r.type = HardwareMessage_Type_READ_GPIOS_REPLY; + meshtastic_HardwareMessage r = meshtastic_HardwareMessage_init_default; + r.type = meshtastic_HardwareMessage_Type_READ_GPIOS_REPLY; r.gpio_value = res; r.gpio_mask = p.gpio_mask; - MeshPacket *p2 = allocDataProtobuf(r); + meshtastic_MeshPacket *p2 = allocDataProtobuf(r); setReplyTo(p2, req); myReply = p2; break; } - case HardwareMessage_Type_WATCH_GPIOS: { + case meshtastic_HardwareMessage_Type_WATCH_GPIOS: { watchGpios = p.gpio_mask; lastWatchMsec = 0; // Force a new publish soon previousWatch = @@ -101,8 +101,8 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const MeshPacket &req, Hardwar break; } - case HardwareMessage_Type_READ_GPIOS_REPLY: - case HardwareMessage_Type_GPIOS_CHANGED: + case meshtastic_HardwareMessage_Type_READ_GPIOS_REPLY: + case meshtastic_HardwareMessage_Type_GPIOS_CHANGED: break; // Ignore - we might see our own replies default: @@ -127,10 +127,10 @@ int32_t RemoteHardwareModule::runOnce() LOG_INFO("Broadcasting GPIOS 0x%llx changed!\n", curVal); // Something changed! Tell the world with a broadcast message - HardwareMessage r = HardwareMessage_init_default; - r.type = HardwareMessage_Type_GPIOS_CHANGED; + meshtastic_HardwareMessage r = meshtastic_HardwareMessage_init_default; + r.type = meshtastic_HardwareMessage_Type_GPIOS_CHANGED; r.gpio_value = curVal; - MeshPacket *p = allocDataProtobuf(r); + meshtastic_MeshPacket *p = allocDataProtobuf(r); service.sendToMesh(p); } } diff --git a/src/modules/RemoteHardwareModule.h b/src/modules/RemoteHardwareModule.h index 69733a87d..dd39f5b69 100644 --- a/src/modules/RemoteHardwareModule.h +++ b/src/modules/RemoteHardwareModule.h @@ -6,7 +6,7 @@ /** * A module that provides easy low-level remote access to device hardware. */ -class RemoteHardwareModule : public ProtobufModule, private concurrency::OSThread +class RemoteHardwareModule : public ProtobufModule, private concurrency::OSThread { /// The current set of GPIOs we've been asked to watch for changes uint64_t watchGpios = 0; @@ -28,7 +28,7 @@ class RemoteHardwareModule : public ProtobufModule, private con @return true if you've guaranteed you've handled this message and no other handlers should be considered for it */ - virtual bool handleReceivedProtobuf(const MeshPacket &mp, HardwareMessage *p) override; + virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_HardwareMessage *p) override; /** * Periodically read the gpios we have been asked to WATCH, if they have changed, diff --git a/src/modules/ReplyModule.cpp b/src/modules/ReplyModule.cpp index 7b3b1e714..3bfad28ad 100644 --- a/src/modules/ReplyModule.cpp +++ b/src/modules/ReplyModule.cpp @@ -5,7 +5,7 @@ #include -MeshPacket *ReplyModule::allocReply() +meshtastic_MeshPacket *ReplyModule::allocReply() { assert(currentRequest); // should always be !NULL auto req = *currentRequest; diff --git a/src/modules/ReplyModule.h b/src/modules/ReplyModule.h index 1ca5b7389..86d4172ed 100644 --- a/src/modules/ReplyModule.h +++ b/src/modules/ReplyModule.h @@ -10,11 +10,11 @@ class ReplyModule : public SinglePortModule /** Constructor * name is for debugging output */ - ReplyModule() : SinglePortModule("reply", PortNum_REPLY_APP) {} + ReplyModule() : SinglePortModule("reply", meshtastic_PortNum_REPLY_APP) {} protected: /** For reply module we do all of our processing in the (normally optional) * want_replies handling */ - virtual MeshPacket *allocReply() override; + virtual meshtastic_MeshPacket *allocReply() override; }; diff --git a/src/modules/RoutingModule.cpp b/src/modules/RoutingModule.cpp index e4c6f71b2..bf3739f2c 100644 --- a/src/modules/RoutingModule.cpp +++ b/src/modules/RoutingModule.cpp @@ -7,7 +7,7 @@ RoutingModule *routingModule; -bool RoutingModule::handleReceivedProtobuf(const MeshPacket &mp, Routing *r) +bool RoutingModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Routing *r) { printPacket("Routing sniffing", &mp); router->sniffReceived(&mp, r); @@ -22,26 +22,26 @@ bool RoutingModule::handleReceivedProtobuf(const MeshPacket &mp, Routing *r) return false; // Let others look at this message also if they want } -MeshPacket *RoutingModule::allocReply() +meshtastic_MeshPacket *RoutingModule::allocReply() { assert(currentRequest); // We only consider making replies if the request was a legit routing packet (not just something we were sniffing) - if (currentRequest->decoded.portnum == PortNum_ROUTING_APP) { + if (currentRequest->decoded.portnum == meshtastic_PortNum_ROUTING_APP) { assert(0); // 1.2 refactoring fixme, Not sure if anything needs this yet? // return allocDataProtobuf(u); } return NULL; } -void RoutingModule::sendAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex) +void RoutingModule::sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex) { auto p = allocAckNak(err, to, idFrom, chIndex); router->sendLocal(p); // we sometimes send directly to the local node } -RoutingModule::RoutingModule() : ProtobufModule("routing", PortNum_ROUTING_APP, &Routing_msg) +RoutingModule::RoutingModule() : ProtobufModule("routing", meshtastic_PortNum_ROUTING_APP, &meshtastic_Routing_msg) { isPromiscuous = true; encryptedOk = true; diff --git a/src/modules/RoutingModule.h b/src/modules/RoutingModule.h index 76cb6e2bb..06e76cfb4 100644 --- a/src/modules/RoutingModule.h +++ b/src/modules/RoutingModule.h @@ -5,7 +5,7 @@ /** * Routing module for router control messages */ -class RoutingModule : public ProtobufModule +class RoutingModule : public ProtobufModule { public: /** Constructor @@ -13,7 +13,7 @@ class RoutingModule : public ProtobufModule */ RoutingModule(); - void sendAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex); + void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex); protected: friend class Router; @@ -22,14 +22,14 @@ class RoutingModule : public ProtobufModule @return true if you've guaranteed you've handled this message and no other handlers should be considered for it */ - virtual bool handleReceivedProtobuf(const MeshPacket &mp, Routing *p) override; + virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Routing *p) override; /** Messages can be received that have the want_response bit set. If set, this callback will be invoked * so that subclasses can (optionally) send a response back to the original sender. */ - virtual MeshPacket *allocReply() override; + virtual meshtastic_MeshPacket *allocReply() override; /// Override wantPacket to say we want to see all packets, not just those for our port number - virtual bool wantPacket(const MeshPacket *p) override { return true; } + virtual bool wantPacket(const meshtastic_MeshPacket *p) override { return true; } }; extern RoutingModule *routingModule; diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index a5da9c224..d740ba607 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -61,21 +61,21 @@ SerialModuleRadio *serialModuleRadio; SerialModule::SerialModule() : StreamAPI(&Serial2), concurrency::OSThread("SerialModule") {} -char serialBytes[Constants_DATA_PAYLOAD_LEN]; +char serialBytes[meshtastic_Constants_DATA_PAYLOAD_LEN]; size_t serialPayloadSize; SerialModuleRadio::SerialModuleRadio() : MeshModule("SerialModuleRadio") { switch (moduleConfig.serial.mode) { - case ModuleConfig_SerialConfig_Serial_Mode_TEXTMSG: - ourPortNum = PortNum_TEXT_MESSAGE_APP; + case meshtastic_ModuleConfig_SerialConfig_Serial_Mode_TEXTMSG: + ourPortNum = meshtastic_PortNum_TEXT_MESSAGE_APP; break; - case ModuleConfig_SerialConfig_Serial_Mode_NMEA: - ourPortNum = PortNum_POSITION_APP; + case meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA: + ourPortNum = meshtastic_PortNum_POSITION_APP; break; default: - ourPortNum = PortNum_SERIAL_APP; + ourPortNum = meshtastic_PortNum_SERIAL_APP; // restrict to the serial channel for rx boundChannel = Channels::serialChannel; break; @@ -111,52 +111,52 @@ int32_t SerialModule::runOnce() uint32_t baud = 0; - if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_DEFAULT) { + if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_DEFAULT) { baud = 38400; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_110) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_110) { baud = 110; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_300) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_300) { baud = 300; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_600) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_600) { baud = 600; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_1200) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_1200) { baud = 1200; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_2400) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_2400) { baud = 2400; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_4800) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_4800) { baud = 4800; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_9600) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_9600) { baud = 9600; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_19200) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_19200) { baud = 19200; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_38400) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_38400) { baud = 38400; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_57600) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_57600) { baud = 57600; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_115200) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_115200) { baud = 115200; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_230400) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_230400) { baud = 230400; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_460800) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_460800) { baud = 460800; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_576000) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_576000) { baud = 576000; - } else if (moduleConfig.serial.baud == ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600) { + } else if (moduleConfig.serial.baud == meshtastic_ModuleConfig_SerialConfig_Serial_Baud_BAUD_921600) { baud = 921600; } @@ -187,15 +187,15 @@ int32_t SerialModule::runOnce() firstTime = 0; // in API mode send rebooted sequence - if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_PROTO) { + if (moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_PROTO) { emitRebooted(); } } else { - if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_PROTO) { + if (moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_PROTO) { return runOncePart(); - } else if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_NMEA) { + } else if (moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA) { // in NMEA mode send out GGA every 2 seconds, Don't read from Port if (millis() - lastNmeaTime > 2000) { lastNmeaTime = millis(); @@ -204,7 +204,7 @@ int32_t SerialModule::runOnce() } } else { while (Serial2.available()) { - serialPayloadSize = Serial2.readBytes(serialBytes, Constants_DATA_PAYLOAD_LEN); + serialPayloadSize = Serial2.readBytes(serialBytes, meshtastic_Constants_DATA_PAYLOAD_LEN); serialModuleRadio->sendPayload(); } } @@ -216,7 +216,7 @@ int32_t SerialModule::runOnce() } } -MeshPacket *SerialModuleRadio::allocReply() +meshtastic_MeshPacket *SerialModuleRadio::allocReply() { auto reply = allocDataPacket(); // Allocate a packet for sending @@ -225,8 +225,8 @@ MeshPacket *SerialModuleRadio::allocReply() void SerialModuleRadio::sendPayload(NodeNum dest, bool wantReplies) { - Channel *ch = (boundChannel != NULL) ? &channels.getByName(boundChannel) : NULL; - MeshPacket *p = allocReply(); + meshtastic_Channel *ch = (boundChannel != NULL) ? &channels.getByName(boundChannel) : NULL; + meshtastic_MeshPacket *p = allocReply(); p->to = dest; if (ch != NULL) { p->channel = ch->index; @@ -241,10 +241,10 @@ void SerialModuleRadio::sendPayload(NodeNum dest, bool wantReplies) service.sendToMesh(p); } -ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp) +ProcessMessage SerialModuleRadio::handleReceived(const meshtastic_MeshPacket &mp) { if (moduleConfig.serial.enabled) { - if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_PROTO) { + if (moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_PROTO) { // in API mode we don't care about stuff from radio. return ProcessMessage::CONTINUE; } @@ -273,22 +273,22 @@ ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp) } else { - if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_DEFAULT || - moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_SIMPLE) { + if (moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_DEFAULT || + moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_SIMPLE) { Serial2.printf("%s", p.payload.bytes); - } else if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_TEXTMSG) { - NodeInfo *node = nodeDB.getNode(getFrom(&mp)); + } else if (moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_TEXTMSG) { + meshtastic_NodeInfo *node = nodeDB.getNode(getFrom(&mp)); String sender = (node && node->has_user) ? node->user.short_name : "???"; Serial2.println(); Serial2.printf("%s: %s", sender, p.payload.bytes); Serial2.println(); - } else if (moduleConfig.serial.mode == ModuleConfig_SerialConfig_Serial_Mode_NMEA) { + } else if (moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_NMEA) { // Decode the Payload some more - Position scratch; - Position *decoded = NULL; - if (mp.which_payload_variant == MeshPacket_decoded_tag && mp.decoded.portnum == ourPortNum) { + meshtastic_Position scratch; + meshtastic_Position *decoded = NULL; + if (mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag && mp.decoded.portnum == ourPortNum) { memset(&scratch, 0, sizeof(scratch)); - if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &Position_msg, &scratch)) { + if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Position_msg, &scratch)) { decoded = &scratch; } // send position packet as WPL to the serial port diff --git a/src/modules/SerialModule.h b/src/modules/SerialModule.h index 83bfa5952..8c53d2064 100644 --- a/src/modules/SerialModule.h +++ b/src/modules/SerialModule.h @@ -46,23 +46,23 @@ class SerialModuleRadio : public MeshModule void sendPayload(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false); protected: - virtual MeshPacket *allocReply() override; + virtual meshtastic_MeshPacket *allocReply() override; /** Called to handle a particular incoming message @return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it */ - virtual ProcessMessage handleReceived(const MeshPacket &mp) override; + virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override; - PortNum ourPortNum; + meshtastic_PortNum ourPortNum; - virtual bool wantPacket(const MeshPacket *p) override { return p->decoded.portnum == ourPortNum; } + virtual bool wantPacket(const meshtastic_MeshPacket *p) override { return p->decoded.portnum == ourPortNum; } - MeshPacket *allocDataPacket() + meshtastic_MeshPacket *allocDataPacket() { // Update our local node info with our position (even if we don't decide to update anyone else) - MeshPacket *p = router->allocForSending(); + meshtastic_MeshPacket *p = router->allocForSending(); p->decoded.portnum = ourPortNum; return p; diff --git a/src/modules/Telemetry/DeviceTelemetry.cpp b/src/modules/Telemetry/DeviceTelemetry.cpp index 3821ea445..630de2933 100644 --- a/src/modules/Telemetry/DeviceTelemetry.cpp +++ b/src/modules/Telemetry/DeviceTelemetry.cpp @@ -26,9 +26,9 @@ int32_t DeviceTelemetryModule::runOnce() return sendToPhoneIntervalMs; } -bool DeviceTelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Telemetry *t) +bool DeviceTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t) { - if (t->which_variant == Telemetry_device_metrics_tag) { + if (t->which_variant == meshtastic_Telemetry_device_metrics_tag) { const char *sender = getSenderShortName(mp); LOG_INFO("(Received from %s): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f\n", sender, @@ -44,10 +44,10 @@ bool DeviceTelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Telemet bool DeviceTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly) { - Telemetry t; + meshtastic_Telemetry t; t.time = getTime(); - t.which_variant = Telemetry_device_metrics_tag; + t.which_variant = meshtastic_Telemetry_device_metrics_tag; t.variant.device_metrics.air_util_tx = myNodeInfo.air_util_tx; t.variant.device_metrics.battery_level = powerStatus->getBatteryChargePercent(); @@ -58,10 +58,10 @@ bool DeviceTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly) t.variant.device_metrics.air_util_tx, t.variant.device_metrics.channel_utilization, t.variant.device_metrics.battery_level, t.variant.device_metrics.voltage); - MeshPacket *p = allocDataProtobuf(t); + meshtastic_MeshPacket *p = allocDataProtobuf(t); p->to = dest; p->decoded.want_response = false; - p->priority = MeshPacket_Priority_MIN; + p->priority = meshtastic_MeshPacket_Priority_MIN; lastMeasurementPacket = packetPool.allocCopy(*p); nodeDB.updateTelemetry(nodeDB.getNodeNum(), t, RX_SRC_LOCAL); diff --git a/src/modules/Telemetry/DeviceTelemetry.h b/src/modules/Telemetry/DeviceTelemetry.h index 11506c71f..5128d3a84 100644 --- a/src/modules/Telemetry/DeviceTelemetry.h +++ b/src/modules/Telemetry/DeviceTelemetry.h @@ -5,11 +5,11 @@ #include #include -class DeviceTelemetryModule : private concurrency::OSThread, public ProtobufModule +class DeviceTelemetryModule : private concurrency::OSThread, public ProtobufModule { public: DeviceTelemetryModule() - : concurrency::OSThread("DeviceTelemetryModule"), ProtobufModule("DeviceTelemetry", PortNum_TELEMETRY_APP, &Telemetry_msg) + : concurrency::OSThread("DeviceTelemetryModule"), ProtobufModule("DeviceTelemetry", meshtastic_PortNum_TELEMETRY_APP, &meshtastic_Telemetry_msg) { lastMeasurementPacket = nullptr; setIntervalFromNow(10 * 1000); @@ -20,7 +20,7 @@ class DeviceTelemetryModule : private concurrency::OSThread, public ProtobufModu /** Called to handle a particular incoming message @return true if you've guaranteed you've handled this message and no other handlers should be considered for it */ - virtual bool handleReceivedProtobuf(const MeshPacket &mp, Telemetry *p) override; + virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *p) override; virtual int32_t runOnce() override; /** * Send our Telemetry into the mesh @@ -30,5 +30,5 @@ class DeviceTelemetryModule : private concurrency::OSThread, public ProtobufModu private: uint32_t sendToPhoneIntervalMs = SECONDS_IN_MINUTE * 1000; // Send to phone every minute uint32_t lastSentToMesh = 0; - const MeshPacket *lastMeasurementPacket; + const meshtastic_MeshPacket *lastMeasurementPacket; }; diff --git a/src/modules/Telemetry/EnvironmentTelemetry.cpp b/src/modules/Telemetry/EnvironmentTelemetry.cpp index dce243b83..ae4f9e648 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.cpp +++ b/src/modules/Telemetry/EnvironmentTelemetry.cpp @@ -118,7 +118,7 @@ int32_t EnvironmentTelemetryModule::runOnce() #endif } -uint32_t GetTimeSinceMeshPacket(const MeshPacket *mp) +uint32_t GetTimeSinceMeshPacket(const meshtastic_MeshPacket *mp) { uint32_t now = getTime(); @@ -151,13 +151,13 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt return; } - Telemetry lastMeasurement; + meshtastic_Telemetry lastMeasurement; uint32_t agoSecs = GetTimeSinceMeshPacket(lastMeasurementPacket); const char *lastSender = getSenderShortName(*lastMeasurementPacket); auto &p = lastMeasurementPacket->decoded; - if (!pb_decode_from_bytes(p.payload.bytes, p.payload.size, &Telemetry_msg, &lastMeasurement)) { + if (!pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_Telemetry_msg, &lastMeasurement)) { display->setFont(FONT_SMALL); display->drawString(x, y += fontHeight(FONT_MEDIUM), "Measurement Error"); LOG_ERROR("Unable to decode last packet"); @@ -182,9 +182,9 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt String(lastMeasurement.variant.environment_metrics.current, 0) + "mA"); } -bool EnvironmentTelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Telemetry *t) +bool EnvironmentTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t) { - if (t->which_variant == Telemetry_environment_metrics_tag) { + if (t->which_variant == meshtastic_Telemetry_environment_metrics_tag) { const char *sender = getSenderShortName(mp); LOG_INFO("(Received from %s): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, " @@ -201,9 +201,9 @@ bool EnvironmentTelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Te bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly) { - Telemetry m; + meshtastic_Telemetry m; m.time = getTime(); - m.which_variant = Telemetry_environment_metrics_tag; + m.which_variant = meshtastic_Telemetry_environment_metrics_tag; m.variant.environment_metrics.barometric_pressure = 0; m.variant.environment_metrics.current = 0; @@ -239,10 +239,10 @@ bool EnvironmentTelemetryModule::sendTelemetry(NodeNum dest, bool phoneOnly) sensor_read_error_count = 0; - MeshPacket *p = allocDataProtobuf(m); + meshtastic_MeshPacket *p = allocDataProtobuf(m); p->to = dest; p->decoded.want_response = false; - p->priority = MeshPacket_Priority_MIN; + p->priority = meshtastic_MeshPacket_Priority_MIN; lastMeasurementPacket = packetPool.allocCopy(*p); if (phoneOnly) { diff --git a/src/modules/Telemetry/EnvironmentTelemetry.h b/src/modules/Telemetry/EnvironmentTelemetry.h index 5dce19c57..69ef29edb 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.h +++ b/src/modules/Telemetry/EnvironmentTelemetry.h @@ -5,12 +5,12 @@ #include #include -class EnvironmentTelemetryModule : private concurrency::OSThread, public ProtobufModule +class EnvironmentTelemetryModule : private concurrency::OSThread, public ProtobufModule { public: EnvironmentTelemetryModule() : concurrency::OSThread("EnvironmentTelemetryModule"), - ProtobufModule("EnvironmentTelemetry", PortNum_TELEMETRY_APP, &Telemetry_msg) + ProtobufModule("EnvironmentTelemetry", meshtastic_PortNum_TELEMETRY_APP, &meshtastic_Telemetry_msg) { lastMeasurementPacket = nullptr; setIntervalFromNow(10 * 1000); @@ -26,7 +26,7 @@ class EnvironmentTelemetryModule : private concurrency::OSThread, public Protobu /** Called to handle a particular incoming message @return true if you've guaranteed you've handled this message and no other handlers should be considered for it */ - virtual bool handleReceivedProtobuf(const MeshPacket &mp, Telemetry *p) override; + virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *p) override; virtual int32_t runOnce() override; /** * Send our Telemetry into the mesh @@ -36,7 +36,7 @@ class EnvironmentTelemetryModule : private concurrency::OSThread, public Protobu private: float CelsiusToFahrenheit(float c); bool firstTime = 1; - const MeshPacket *lastMeasurementPacket; + const meshtastic_MeshPacket *lastMeasurementPacket; uint32_t sendToPhoneIntervalMs = SECONDS_IN_MINUTE * 1000; // Send to phone every minute uint32_t lastSentToMesh = 0; uint32_t sensor_read_error_count = 0; diff --git a/src/modules/Telemetry/Sensor/BME280Sensor.cpp b/src/modules/Telemetry/Sensor/BME280Sensor.cpp index 6c173eaec..7bc65a418 100644 --- a/src/modules/Telemetry/Sensor/BME280Sensor.cpp +++ b/src/modules/Telemetry/Sensor/BME280Sensor.cpp @@ -5,7 +5,7 @@ #include #include -BME280Sensor::BME280Sensor() : TelemetrySensor(TelemetrySensorType_BME280, "BME280") {} +BME280Sensor::BME280Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_BME280, "BME280") {} int32_t BME280Sensor::runOnce() { @@ -26,7 +26,7 @@ int32_t BME280Sensor::runOnce() void BME280Sensor::setup() {} -bool BME280Sensor::getMetrics(Telemetry *measurement) +bool BME280Sensor::getMetrics(meshtastic_Telemetry *measurement) { LOG_DEBUG("BME280Sensor::getMetrics\n"); bme280.takeForcedMeasurement(); diff --git a/src/modules/Telemetry/Sensor/BME280Sensor.h b/src/modules/Telemetry/Sensor/BME280Sensor.h index c75b9ef59..780dcdb61 100644 --- a/src/modules/Telemetry/Sensor/BME280Sensor.h +++ b/src/modules/Telemetry/Sensor/BME280Sensor.h @@ -13,5 +13,5 @@ class BME280Sensor : virtual public TelemetrySensor public: BME280Sensor(); virtual int32_t runOnce() override; - virtual bool getMetrics(Telemetry *measurement) override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; }; \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/BME680Sensor.cpp b/src/modules/Telemetry/Sensor/BME680Sensor.cpp index e3266450a..f05246d52 100644 --- a/src/modules/Telemetry/Sensor/BME680Sensor.cpp +++ b/src/modules/Telemetry/Sensor/BME680Sensor.cpp @@ -4,7 +4,7 @@ #include "configuration.h" #include -BME680Sensor::BME680Sensor() : TelemetrySensor(TelemetrySensorType_BME680, "BME680") {} +BME680Sensor::BME680Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_BME680, "BME680") {} int32_t BME680Sensor::runOnce() { @@ -19,7 +19,7 @@ int32_t BME680Sensor::runOnce() void BME680Sensor::setup() {} -bool BME680Sensor::getMetrics(Telemetry *measurement) +bool BME680Sensor::getMetrics(meshtastic_Telemetry *measurement) { bme680.performReading(); measurement->variant.environment_metrics.temperature = bme680.temperature; diff --git a/src/modules/Telemetry/Sensor/BME680Sensor.h b/src/modules/Telemetry/Sensor/BME680Sensor.h index e66eba75c..d59374803 100644 --- a/src/modules/Telemetry/Sensor/BME680Sensor.h +++ b/src/modules/Telemetry/Sensor/BME680Sensor.h @@ -13,5 +13,5 @@ class BME680Sensor : virtual public TelemetrySensor public: BME680Sensor(); virtual int32_t runOnce() override; - virtual bool getMetrics(Telemetry *measurement) override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; }; \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/BMP280Sensor.cpp b/src/modules/Telemetry/Sensor/BMP280Sensor.cpp index 267656c4c..c0b5625de 100644 --- a/src/modules/Telemetry/Sensor/BMP280Sensor.cpp +++ b/src/modules/Telemetry/Sensor/BMP280Sensor.cpp @@ -5,7 +5,7 @@ #include #include -BMP280Sensor::BMP280Sensor() : TelemetrySensor(TelemetrySensorType_BMP280, "BMP280") {} +BMP280Sensor::BMP280Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_BMP280, "BMP280") {} int32_t BMP280Sensor::runOnce() { @@ -25,7 +25,7 @@ int32_t BMP280Sensor::runOnce() void BMP280Sensor::setup() {} -bool BMP280Sensor::getMetrics(Telemetry *measurement) +bool BMP280Sensor::getMetrics(meshtastic_Telemetry *measurement) { LOG_DEBUG("BMP280Sensor::getMetrics\n"); bmp280.takeForcedMeasurement(); diff --git a/src/modules/Telemetry/Sensor/BMP280Sensor.h b/src/modules/Telemetry/Sensor/BMP280Sensor.h index 769f4e4ba..cc8c0b9da 100644 --- a/src/modules/Telemetry/Sensor/BMP280Sensor.h +++ b/src/modules/Telemetry/Sensor/BMP280Sensor.h @@ -13,5 +13,5 @@ class BMP280Sensor : virtual public TelemetrySensor public: BMP280Sensor(); virtual int32_t runOnce() override; - virtual bool getMetrics(Telemetry *measurement) override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; }; \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/INA219Sensor.cpp b/src/modules/Telemetry/Sensor/INA219Sensor.cpp index 69a67ad4b..bffa1e367 100644 --- a/src/modules/Telemetry/Sensor/INA219Sensor.cpp +++ b/src/modules/Telemetry/Sensor/INA219Sensor.cpp @@ -4,7 +4,7 @@ #include "configuration.h" #include -INA219Sensor::INA219Sensor() : TelemetrySensor(TelemetrySensorType_INA219, "INA219") {} +INA219Sensor::INA219Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_INA219, "INA219") {} int32_t INA219Sensor::runOnce() { @@ -19,7 +19,7 @@ int32_t INA219Sensor::runOnce() void INA219Sensor::setup() {} -bool INA219Sensor::getMetrics(Telemetry *measurement) +bool INA219Sensor::getMetrics(meshtastic_Telemetry *measurement) { measurement->variant.environment_metrics.voltage = ina219.getBusVoltage_V(); measurement->variant.environment_metrics.current = ina219.getCurrent_mA(); diff --git a/src/modules/Telemetry/Sensor/INA219Sensor.h b/src/modules/Telemetry/Sensor/INA219Sensor.h index 7288dac8a..dc6c0a5af 100644 --- a/src/modules/Telemetry/Sensor/INA219Sensor.h +++ b/src/modules/Telemetry/Sensor/INA219Sensor.h @@ -13,5 +13,5 @@ class INA219Sensor : virtual public TelemetrySensor public: INA219Sensor(); virtual int32_t runOnce() override; - virtual bool getMetrics(Telemetry *measurement) override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; }; \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/INA260Sensor.cpp b/src/modules/Telemetry/Sensor/INA260Sensor.cpp index d69d25a75..ee0256e62 100644 --- a/src/modules/Telemetry/Sensor/INA260Sensor.cpp +++ b/src/modules/Telemetry/Sensor/INA260Sensor.cpp @@ -4,7 +4,7 @@ #include "configuration.h" #include -INA260Sensor::INA260Sensor() : TelemetrySensor(TelemetrySensorType_INA260, "INA260") {} +INA260Sensor::INA260Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_INA260, "INA260") {} int32_t INA260Sensor::runOnce() { @@ -18,7 +18,7 @@ int32_t INA260Sensor::runOnce() void INA260Sensor::setup() {} -bool INA260Sensor::getMetrics(Telemetry *measurement) +bool INA260Sensor::getMetrics(meshtastic_Telemetry *measurement) { // mV conversion to V measurement->variant.environment_metrics.voltage = ina260.readBusVoltage() / 1000; diff --git a/src/modules/Telemetry/Sensor/INA260Sensor.h b/src/modules/Telemetry/Sensor/INA260Sensor.h index de1fe0ad7..1dcb596e6 100644 --- a/src/modules/Telemetry/Sensor/INA260Sensor.h +++ b/src/modules/Telemetry/Sensor/INA260Sensor.h @@ -13,5 +13,5 @@ class INA260Sensor : virtual public TelemetrySensor public: INA260Sensor(); virtual int32_t runOnce() override; - virtual bool getMetrics(Telemetry *measurement) override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; }; \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/LPS22HBSensor.cpp b/src/modules/Telemetry/Sensor/LPS22HBSensor.cpp index ac77bdb40..05f940656 100644 --- a/src/modules/Telemetry/Sensor/LPS22HBSensor.cpp +++ b/src/modules/Telemetry/Sensor/LPS22HBSensor.cpp @@ -5,7 +5,7 @@ #include #include -LPS22HBSensor::LPS22HBSensor() : TelemetrySensor(TelemetrySensorType_LPS22, "LPS22HB") {} +LPS22HBSensor::LPS22HBSensor() : TelemetrySensor(meshtastic_TelemetrySensorType_LPS22, "LPS22HB") {} int32_t LPS22HBSensor::runOnce() { @@ -22,7 +22,7 @@ void LPS22HBSensor::setup() lps22hb.setDataRate(LPS22_RATE_10_HZ); } -bool LPS22HBSensor::getMetrics(Telemetry *measurement) +bool LPS22HBSensor::getMetrics(meshtastic_Telemetry *measurement) { sensors_event_t temp; sensors_event_t pressure; diff --git a/src/modules/Telemetry/Sensor/LPS22HBSensor.h b/src/modules/Telemetry/Sensor/LPS22HBSensor.h index 7472950b8..556d161c4 100644 --- a/src/modules/Telemetry/Sensor/LPS22HBSensor.h +++ b/src/modules/Telemetry/Sensor/LPS22HBSensor.h @@ -14,5 +14,5 @@ class LPS22HBSensor : virtual public TelemetrySensor public: LPS22HBSensor(); virtual int32_t runOnce() override; - virtual bool getMetrics(Telemetry *measurement) override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; }; \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/MCP9808Sensor.cpp b/src/modules/Telemetry/Sensor/MCP9808Sensor.cpp index 7bac18d9a..28db3d8a9 100644 --- a/src/modules/Telemetry/Sensor/MCP9808Sensor.cpp +++ b/src/modules/Telemetry/Sensor/MCP9808Sensor.cpp @@ -4,7 +4,7 @@ #include "configuration.h" #include -MCP9808Sensor::MCP9808Sensor() : TelemetrySensor(TelemetrySensorType_MCP9808, "MCP9808") {} +MCP9808Sensor::MCP9808Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_MCP9808, "MCP9808") {} int32_t MCP9808Sensor::runOnce() { @@ -21,7 +21,7 @@ void MCP9808Sensor::setup() mcp9808.setResolution(2); } -bool MCP9808Sensor::getMetrics(Telemetry *measurement) +bool MCP9808Sensor::getMetrics(meshtastic_Telemetry *measurement) { LOG_DEBUG("MCP9808Sensor::getMetrics\n"); measurement->variant.environment_metrics.temperature = mcp9808.readTempC(); diff --git a/src/modules/Telemetry/Sensor/MCP9808Sensor.h b/src/modules/Telemetry/Sensor/MCP9808Sensor.h index 150b76237..b70707477 100644 --- a/src/modules/Telemetry/Sensor/MCP9808Sensor.h +++ b/src/modules/Telemetry/Sensor/MCP9808Sensor.h @@ -13,5 +13,5 @@ class MCP9808Sensor : virtual public TelemetrySensor public: MCP9808Sensor(); virtual int32_t runOnce() override; - virtual bool getMetrics(Telemetry *measurement) override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; }; \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/SHT31Sensor.cpp b/src/modules/Telemetry/Sensor/SHT31Sensor.cpp index 940a94d46..7ffb68254 100644 --- a/src/modules/Telemetry/Sensor/SHT31Sensor.cpp +++ b/src/modules/Telemetry/Sensor/SHT31Sensor.cpp @@ -4,7 +4,7 @@ #include "configuration.h" #include -SHT31Sensor::SHT31Sensor() : TelemetrySensor(TelemetrySensorType_SHT31, "SHT31") {} +SHT31Sensor::SHT31Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_SHT31, "SHT31") {} int32_t SHT31Sensor::runOnce() { @@ -21,7 +21,7 @@ void SHT31Sensor::setup() // Set up oversampling and filter initialization } -bool SHT31Sensor::getMetrics(Telemetry *measurement) +bool SHT31Sensor::getMetrics(meshtastic_Telemetry *measurement) { measurement->variant.environment_metrics.temperature = sht31.readTemperature(); measurement->variant.environment_metrics.relative_humidity = sht31.readHumidity(); diff --git a/src/modules/Telemetry/Sensor/SHT31Sensor.h b/src/modules/Telemetry/Sensor/SHT31Sensor.h index ca574a5cd..60354aaea 100644 --- a/src/modules/Telemetry/Sensor/SHT31Sensor.h +++ b/src/modules/Telemetry/Sensor/SHT31Sensor.h @@ -13,5 +13,5 @@ class SHT31Sensor : virtual public TelemetrySensor public: SHT31Sensor(); virtual int32_t runOnce() override; - virtual bool getMetrics(Telemetry *measurement) override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; }; diff --git a/src/modules/Telemetry/Sensor/SHTC3Sensor.cpp b/src/modules/Telemetry/Sensor/SHTC3Sensor.cpp index 1ed16cc11..b0b5d37dc 100644 --- a/src/modules/Telemetry/Sensor/SHTC3Sensor.cpp +++ b/src/modules/Telemetry/Sensor/SHTC3Sensor.cpp @@ -4,7 +4,7 @@ #include "configuration.h" #include -SHTC3Sensor::SHTC3Sensor() : TelemetrySensor(TelemetrySensorType_SHTC3, "SHTC3") {} +SHTC3Sensor::SHTC3Sensor() : TelemetrySensor(meshtastic_TelemetrySensorType_SHTC3, "SHTC3") {} int32_t SHTC3Sensor::runOnce() { @@ -21,7 +21,7 @@ void SHTC3Sensor::setup() // Set up oversampling and filter initialization } -bool SHTC3Sensor::getMetrics(Telemetry *measurement) +bool SHTC3Sensor::getMetrics(meshtastic_Telemetry *measurement) { sensors_event_t humidity, temp; shtc3.getEvent(&humidity, &temp); diff --git a/src/modules/Telemetry/Sensor/SHTC3Sensor.h b/src/modules/Telemetry/Sensor/SHTC3Sensor.h index f391580a6..c67047396 100644 --- a/src/modules/Telemetry/Sensor/SHTC3Sensor.h +++ b/src/modules/Telemetry/Sensor/SHTC3Sensor.h @@ -13,5 +13,5 @@ class SHTC3Sensor : virtual public TelemetrySensor public: SHTC3Sensor(); virtual int32_t runOnce() override; - virtual bool getMetrics(Telemetry *measurement) override; + virtual bool getMetrics(meshtastic_Telemetry *measurement) override; }; \ No newline at end of file diff --git a/src/modules/Telemetry/Sensor/TelemetrySensor.h b/src/modules/Telemetry/Sensor/TelemetrySensor.h index 79dfbf312..7a579ef5c 100644 --- a/src/modules/Telemetry/Sensor/TelemetrySensor.h +++ b/src/modules/Telemetry/Sensor/TelemetrySensor.h @@ -8,7 +8,7 @@ class TelemetrySensor { protected: - TelemetrySensor(TelemetrySensorType sensorType, const char *sensorName) + TelemetrySensor(meshtastic_TelemetrySensorType sensorType, const char *sensorName) { this->sensorName = sensorName; this->sensorType = sensorType; @@ -16,7 +16,7 @@ class TelemetrySensor } const char *sensorName; - TelemetrySensorType sensorType; + meshtastic_TelemetrySensorType sensorType; unsigned status; int32_t initI2CSensor() @@ -36,5 +36,5 @@ class TelemetrySensor bool hasSensor() { return sensorType < sizeof(nodeTelemetrySensorsMap) && nodeTelemetrySensorsMap[sensorType] > 0; } virtual int32_t runOnce() = 0; - virtual bool getMetrics(Telemetry *measurement) = 0; + virtual bool getMetrics(meshtastic_Telemetry *measurement) = 0; }; diff --git a/src/modules/TextMessageModule.cpp b/src/modules/TextMessageModule.cpp index 7ed25d1dc..bab5decda 100644 --- a/src/modules/TextMessageModule.cpp +++ b/src/modules/TextMessageModule.cpp @@ -5,7 +5,7 @@ TextMessageModule *textMessageModule; -ProcessMessage TextMessageModule::handleReceived(const MeshPacket &mp) +ProcessMessage TextMessageModule::handleReceived(const meshtastic_MeshPacket &mp) { auto &p = mp.decoded; LOG_INFO("Received text msg from=0x%0x, id=0x%x, msg=%.*s\n", mp.from, mp.id, p.payload.size, p.payload.bytes); diff --git a/src/modules/TextMessageModule.h b/src/modules/TextMessageModule.h index 11598c8c4..93b1bfaa2 100644 --- a/src/modules/TextMessageModule.h +++ b/src/modules/TextMessageModule.h @@ -5,13 +5,13 @@ /** * Text message handling for meshtastic - draws on the OLED display the most recent received message */ -class TextMessageModule : public SinglePortModule, public Observable +class TextMessageModule : public SinglePortModule, public Observable { public: /** Constructor * name is for debugging output */ - TextMessageModule() : SinglePortModule("text", PortNum_TEXT_MESSAGE_APP) {} + TextMessageModule() : SinglePortModule("text", meshtastic_PortNum_TEXT_MESSAGE_APP) {} protected: /** Called to handle a particular incoming message @@ -19,7 +19,7 @@ class TextMessageModule : public SinglePortModule, public Observabledecoded; // Only append an ID for the request (one way) if (!incoming.request_id) { - RouteDiscovery scratch; - RouteDiscovery *updated = NULL; + meshtastic_RouteDiscovery scratch; + meshtastic_RouteDiscovery *updated = NULL; memset(&scratch, 0, sizeof(scratch)); - pb_decode_from_bytes(incoming.payload.bytes, incoming.payload.size, &RouteDiscovery_msg, &scratch); + pb_decode_from_bytes(incoming.payload.bytes, incoming.payload.size, &meshtastic_RouteDiscovery_msg, &scratch); updated = &scratch; appendMyID(updated); @@ -30,11 +30,11 @@ void TraceRouteModule::updateRoute(MeshPacket *p) // Set updated route to the payload of the to be flooded packet p->decoded.payload.size = - pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &RouteDiscovery_msg, updated); + pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_RouteDiscovery_msg, updated); } } -void TraceRouteModule::appendMyID(RouteDiscovery *updated) +void TraceRouteModule::appendMyID(meshtastic_RouteDiscovery *updated) { // Length of route array can normally not be exceeded due to the max. hop_limit of 7 if (updated->route_count < sizeof(updated->route) / sizeof(updated->route[0])) { @@ -45,7 +45,7 @@ void TraceRouteModule::appendMyID(RouteDiscovery *updated) } } -void TraceRouteModule::printRoute(RouteDiscovery *r, uint32_t origin, uint32_t dest) +void TraceRouteModule::printRoute(meshtastic_RouteDiscovery *r, uint32_t origin, uint32_t dest) { LOG_INFO("Route traced:\n"); LOG_INFO("0x%x --> ", origin); @@ -58,28 +58,28 @@ void TraceRouteModule::printRoute(RouteDiscovery *r, uint32_t origin, uint32_t d LOG_INFO("...\n"); } -MeshPacket *TraceRouteModule::allocReply() +meshtastic_MeshPacket *TraceRouteModule::allocReply() { assert(currentRequest); // Copy the payload of the current request auto req = *currentRequest; auto &p = req.decoded; - RouteDiscovery scratch; - RouteDiscovery *updated = NULL; + meshtastic_RouteDiscovery scratch; + meshtastic_RouteDiscovery *updated = NULL; memset(&scratch, 0, sizeof(scratch)); - pb_decode_from_bytes(p.payload.bytes, p.payload.size, &RouteDiscovery_msg, &scratch); + pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_RouteDiscovery_msg, &scratch); updated = &scratch; printRoute(updated, req.from, req.to); // Create a MeshPacket with this payload and set it as the reply - MeshPacket *reply = allocDataProtobuf(*updated); + meshtastic_MeshPacket *reply = allocDataProtobuf(*updated); return reply; } -TraceRouteModule::TraceRouteModule() : ProtobufModule("traceroute", PortNum_TRACEROUTE_APP, &RouteDiscovery_msg) +TraceRouteModule::TraceRouteModule() : ProtobufModule("traceroute", meshtastic_PortNum_TRACEROUTE_APP, &meshtastic_RouteDiscovery_msg) { - ourPortNum = PortNum_TRACEROUTE_APP; + ourPortNum = meshtastic_PortNum_TRACEROUTE_APP; } diff --git a/src/modules/TraceRouteModule.h b/src/modules/TraceRouteModule.h index 7601d672d..674846ef1 100644 --- a/src/modules/TraceRouteModule.h +++ b/src/modules/TraceRouteModule.h @@ -4,7 +4,7 @@ /** * A module that traces the route to a certain destination node */ -class TraceRouteModule : public ProtobufModule +class TraceRouteModule : public ProtobufModule { public: TraceRouteModule(); @@ -13,22 +13,22 @@ class TraceRouteModule : public ProtobufModule friend class FloodingRouter; protected: - bool handleReceivedProtobuf(const MeshPacket &mp, RouteDiscovery *r) override; + bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_RouteDiscovery *r) override; - virtual MeshPacket *allocReply() override; + virtual meshtastic_MeshPacket *allocReply() override; /* Call before rebroadcasting a RouteDiscovery payload in order to update the route array containing the IDs of nodes this packet went through */ - void updateRoute(MeshPacket *p); + void updateRoute(meshtastic_MeshPacket *p); private: // Call to add your ID to the route array of a RouteDiscovery message - void appendMyID(RouteDiscovery *r); + void appendMyID(meshtastic_RouteDiscovery *r); /* Call to print the route array of a RouteDiscovery message. Set origin to where the request came from. Set dest to the ID of its destination, or NODENUM_BROADCAST if it has not yet arrived there. */ - void printRoute(RouteDiscovery *r, uint32_t origin, uint32_t dest); + void printRoute(meshtastic_RouteDiscovery *r, uint32_t origin, uint32_t dest); }; extern TraceRouteModule *traceRouteModule; \ No newline at end of file diff --git a/src/modules/WaypointModule.cpp b/src/modules/WaypointModule.cpp index 61af5db7b..079be604e 100644 --- a/src/modules/WaypointModule.cpp +++ b/src/modules/WaypointModule.cpp @@ -5,7 +5,7 @@ WaypointModule *waypointModule; -ProcessMessage WaypointModule::handleReceived(const MeshPacket &mp) +ProcessMessage WaypointModule::handleReceived(const meshtastic_MeshPacket &mp) { auto &p = mp.decoded; LOG_INFO("Received waypoint msg from=0x%0x, id=0x%x, msg=%.*s\n", mp.from, mp.id, p.payload.size, p.payload.bytes); diff --git a/src/modules/WaypointModule.h b/src/modules/WaypointModule.h index 789e0915b..ddbabf4de 100644 --- a/src/modules/WaypointModule.h +++ b/src/modules/WaypointModule.h @@ -5,13 +5,13 @@ /** * Waypoint message handling for meshtastic */ -class WaypointModule : public SinglePortModule, public Observable +class WaypointModule : public SinglePortModule, public Observable { public: /** Constructor * name is for debugging output */ - WaypointModule() : SinglePortModule("waypoint", PortNum_WAYPOINT_APP) {} + WaypointModule() : SinglePortModule("waypoint", meshtastic_PortNum_WAYPOINT_APP) {} protected: /** Called to handle a particular incoming message @@ -19,7 +19,7 @@ class WaypointModule : public SinglePortModule, public Observableto = dest; p->decoded.want_response = wantReplies; p->want_ack = false; // Audio is shoot&forget. No need to wait for ACKs. - p->priority = MeshPacket_Priority_MAX; // Audio is important, because realtime + p->priority = meshtastic_MeshPacket_Priority_MAX; // Audio is important, because realtime p->decoded.payload.size = tx_encode_frame_index; memcpy(p->decoded.payload.bytes, tx_encode_frame, p->decoded.payload.size); @@ -292,7 +292,7 @@ void AudioModule::sendPayload(NodeNum dest, bool wantReplies) service.sendToMesh(p); } -ProcessMessage AudioModule::handleReceived(const MeshPacket &mp) +ProcessMessage AudioModule::handleReceived(const meshtastic_MeshPacket &mp) { if ((moduleConfig.audio.codec2_enabled) && (myRegion->audioPermitted)) { auto &p = mp.decoded; diff --git a/src/modules/esp32/AudioModule.h b/src/modules/esp32/AudioModule.h index fbf843d4f..8bf8c3f55 100644 --- a/src/modules/esp32/AudioModule.h +++ b/src/modules/esp32/AudioModule.h @@ -28,13 +28,13 @@ struct c2_header { #define I2S_PORT I2S_NUM_0 #define AUDIO_MODULE_RX_BUFFER 128 -#define AUDIO_MODULE_MODE ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700 +#define AUDIO_MODULE_MODE meshtastic_ModuleConfig_AudioConfig_Audio_Baud_CODEC2_700 class AudioModule : public SinglePortModule, public Observable, private concurrency::OSThread { public: - unsigned char rx_encode_frame[Constants_DATA_PAYLOAD_LEN] = {}; - unsigned char tx_encode_frame[Constants_DATA_PAYLOAD_LEN] = {}; + unsigned char rx_encode_frame[meshtastic_Constants_DATA_PAYLOAD_LEN] = {}; + unsigned char tx_encode_frame[meshtastic_Constants_DATA_PAYLOAD_LEN] = {}; c2_header tx_header = {}; int16_t speech[ADC_BUFFER_SIZE_MAX] = {}; int16_t output_buffer[ADC_BUFFER_SIZE_MAX] = {}; @@ -65,7 +65,7 @@ class AudioModule : public SinglePortModule, public ObservableshouldDraw(); } virtual Observable *getUIFrameObservable() override { return this; } @@ -79,7 +79,7 @@ class AudioModule : public SinglePortModule, public Observableto = dest; p->decoded.want_response = wantReplies; @@ -121,7 +121,7 @@ void RangeTestModuleRadio::sendPayload(NodeNum dest, bool wantReplies) powerFSM.trigger(EVENT_CONTACT_FROM_PHONE); } -ProcessMessage RangeTestModuleRadio::handleReceived(const MeshPacket &mp) +ProcessMessage RangeTestModuleRadio::handleReceived(const meshtastic_MeshPacket &mp) { #ifdef ARCH_ESP32 @@ -176,11 +176,11 @@ ProcessMessage RangeTestModuleRadio::handleReceived(const MeshPacket &mp) return ProcessMessage::CONTINUE; // Let others look at this message also if they want } -bool RangeTestModuleRadio::appendFile(const MeshPacket &mp) +bool RangeTestModuleRadio::appendFile(const meshtastic_MeshPacket &mp) { auto &p = mp.decoded; - NodeInfo *n = nodeDB.getNode(getFrom(&mp)); + meshtastic_NodeInfo *n = nodeDB.getNode(getFrom(&mp)); /* LOG_DEBUG("-----------------------------------------\n"); LOG_DEBUG("p.payload.bytes \"%s\"\n", p.payload.bytes); diff --git a/src/modules/esp32/RangeTestModule.h b/src/modules/esp32/RangeTestModule.h index db49a586e..e404bd8b6 100644 --- a/src/modules/esp32/RangeTestModule.h +++ b/src/modules/esp32/RangeTestModule.h @@ -28,7 +28,7 @@ class RangeTestModuleRadio : public SinglePortModule uint32_t lastRxID = 0; public: - RangeTestModuleRadio() : SinglePortModule("RangeTestModuleRadio", PortNum_TEXT_MESSAGE_APP) + RangeTestModuleRadio() : SinglePortModule("RangeTestModuleRadio", meshtastic_PortNum_TEXT_MESSAGE_APP) { loopbackOk = true; // Allow locally generated messages to loop back to the client } @@ -41,7 +41,7 @@ class RangeTestModuleRadio : public SinglePortModule /** * Append range test data to the file on the Filesystem */ - bool appendFile(const MeshPacket &mp); + bool appendFile(const meshtastic_MeshPacket &mp); /** * Kevin's magical calculation of two points to meters. @@ -49,14 +49,14 @@ class RangeTestModuleRadio : public SinglePortModule float latLongToMeter(double lat_a, double lng_a, double lat_b, double lng_b); protected: - virtual MeshPacket *allocReply() override; + virtual meshtastic_MeshPacket *allocReply() override; /** Called to handle a particular incoming message @return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it */ - virtual ProcessMessage handleReceived(const MeshPacket &mp) override; + virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override; }; extern RangeTestModuleRadio *rangeTestModuleRadio; diff --git a/src/modules/esp32/StoreForwardModule.cpp b/src/modules/esp32/StoreForwardModule.cpp index 36d023162..d09509449 100644 --- a/src/modules/esp32/StoreForwardModule.cpp +++ b/src/modules/esp32/StoreForwardModule.cpp @@ -25,8 +25,8 @@ int32_t StoreForwardModule::runOnce() storeForwardModule->sendPayload(this->busyTo, this->packetHistoryTXQueue_index); if (this->packetHistoryTXQueue_index == packetHistoryTXQueue_size) { // Tell the client we're done sending - StoreAndForward sf = StoreAndForward_init_zero; - sf.rr = StoreAndForward_RequestResponse_ROUTER_PING; + meshtastic_StoreAndForward sf = meshtastic_StoreAndForward_init_zero; + sf.rr = meshtastic_StoreAndForward_RequestResponse_ROUTER_PING; storeForwardModule->sendMessage(this->busyTo, sf); LOG_INFO("*** S&F - Done. (ROUTER_PING)\n"); this->packetHistoryTXQueue_index = 0; @@ -40,9 +40,9 @@ int32_t StoreForwardModule::runOnce() } else if ((millis() - lastHeartbeat > (heartbeatInterval * 1000)) && airTime->isTxAllowedChannelUtil(true)) { lastHeartbeat = millis(); LOG_INFO("*** Sending heartbeat\n"); - StoreAndForward sf = StoreAndForward_init_zero; - sf.rr = StoreAndForward_RequestResponse_ROUTER_HEARTBEAT; - sf.which_variant = StoreAndForward_heartbeat_tag; + meshtastic_StoreAndForward sf = meshtastic_StoreAndForward_init_zero; + sf.rr = meshtastic_StoreAndForward_RequestResponse_ROUTER_HEARTBEAT; + sf.which_variant = meshtastic_StoreAndForward_heartbeat_tag; sf.variant.heartbeat.period = 300; sf.variant.heartbeat.secondary = 0; // TODO we always have one primary router for now storeForwardModule->sendMessage(NODENUM_BROADCAST, sf); @@ -93,9 +93,9 @@ void StoreForwardModule::historySend(uint32_t msAgo, uint32_t to) } else { LOG_INFO("*** S&F - No history to send\n"); } - StoreAndForward sf = StoreAndForward_init_zero; - sf.rr = StoreAndForward_RequestResponse_ROUTER_HISTORY; - sf.which_variant = StoreAndForward_history_tag; + meshtastic_StoreAndForward sf = meshtastic_StoreAndForward_init_zero; + sf.rr = meshtastic_StoreAndForward_RequestResponse_ROUTER_HISTORY; + sf.which_variant = meshtastic_StoreAndForward_history_tag; sf.variant.history.history_messages = queueSize; sf.variant.history.window = msAgo; storeForwardModule->sendMessage(to, sf); @@ -130,7 +130,7 @@ uint32_t StoreForwardModule::historyQueueCreate(uint32_t msAgo, uint32_t to) this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].channel = this->packetHistory[i].channel; this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].payload_size = this->packetHistory[i].payload_size; memcpy(this->packetHistoryTXQueue[this->packetHistoryTXQueue_size].payload, this->packetHistory[i].payload, - Constants_DATA_PAYLOAD_LEN); + meshtastic_Constants_DATA_PAYLOAD_LEN); this->packetHistoryTXQueue_size++; LOG_DEBUG("*** PacketHistoryStruct time=%d\n", this->packetHistory[i].time); @@ -141,7 +141,7 @@ uint32_t StoreForwardModule::historyQueueCreate(uint32_t msAgo, uint32_t to) return this->packetHistoryTXQueue_size; } -void StoreForwardModule::historyAdd(const MeshPacket &mp) +void StoreForwardModule::historyAdd(const meshtastic_MeshPacket &mp) { const auto &p = mp.decoded; @@ -150,13 +150,13 @@ void StoreForwardModule::historyAdd(const MeshPacket &mp) this->packetHistory[this->packetHistoryCurrent].channel = mp.channel; this->packetHistory[this->packetHistoryCurrent].from = mp.from; this->packetHistory[this->packetHistoryCurrent].payload_size = p.payload.size; - memcpy(this->packetHistory[this->packetHistoryCurrent].payload, p.payload.bytes, Constants_DATA_PAYLOAD_LEN); + memcpy(this->packetHistory[this->packetHistoryCurrent].payload, p.payload.bytes, meshtastic_Constants_DATA_PAYLOAD_LEN); this->packetHistoryCurrent++; this->packetHistoryMax++; } -MeshPacket *StoreForwardModule::allocReply() +meshtastic_MeshPacket *StoreForwardModule::allocReply() { auto reply = allocDataPacket(); // Allocate a packet for sending return reply; @@ -165,7 +165,7 @@ MeshPacket *StoreForwardModule::allocReply() void StoreForwardModule::sendPayload(NodeNum dest, uint32_t packetHistory_index) { LOG_INFO("*** Sending S&F Payload\n"); - MeshPacket *p = allocReply(); + meshtastic_MeshPacket *p = allocReply(); p->to = dest; p->from = this->packetHistoryTXQueue[packetHistory_index].from; @@ -183,17 +183,17 @@ void StoreForwardModule::sendPayload(NodeNum dest, uint32_t packetHistory_index) service.sendToMesh(p); } -void StoreForwardModule::sendMessage(NodeNum dest, StoreAndForward &payload) +void StoreForwardModule::sendMessage(NodeNum dest, meshtastic_StoreAndForward &payload) { - MeshPacket *p = allocDataProtobuf(payload); + meshtastic_MeshPacket *p = allocDataProtobuf(payload); p->to = dest; - p->priority = MeshPacket_Priority_MIN; + p->priority = meshtastic_MeshPacket_Priority_MIN; // FIXME - Determine if the delayed packet is broadcast or delayed. For now, assume // everything is broadcast. - p->delayed = MeshPacket_Delayed_DELAYED_BROADCAST; + p->delayed = meshtastic_MeshPacket_Delayed_DELAYED_BROADCAST; // Let's assume that if the router received the S&F request that the client is in range. // TODO: Make this configurable. @@ -203,20 +203,20 @@ void StoreForwardModule::sendMessage(NodeNum dest, StoreAndForward &payload) service.sendToMesh(p); } -void StoreForwardModule::sendMessage(NodeNum dest, StoreAndForward_RequestResponse rr) +void StoreForwardModule::sendMessage(NodeNum dest, meshtastic_StoreAndForward_RequestResponse rr) { // Craft an empty response, save some bytes in flash - StoreAndForward sf = StoreAndForward_init_zero; + meshtastic_StoreAndForward sf = meshtastic_StoreAndForward_init_zero; sf.rr = rr; storeForwardModule->sendMessage(dest, sf); } void StoreForwardModule::statsSend(uint32_t to) { - StoreAndForward sf = StoreAndForward_init_zero; + meshtastic_StoreAndForward sf = meshtastic_StoreAndForward_init_zero; - sf.rr = StoreAndForward_RequestResponse_ROUTER_STATS; - sf.which_variant = StoreAndForward_stats_tag; + sf.rr = meshtastic_StoreAndForward_RequestResponse_ROUTER_STATS; + sf.which_variant = meshtastic_StoreAndForward_stats_tag; sf.variant.stats.messages_total = this->packetHistoryMax; sf.variant.stats.messages_saved = this->packetHistoryCurrent; sf.variant.stats.messages_max = this->records; @@ -231,29 +231,29 @@ void StoreForwardModule::statsSend(uint32_t to) storeForwardModule->sendMessage(to, sf); } -ProcessMessage StoreForwardModule::handleReceived(const MeshPacket &mp) +ProcessMessage StoreForwardModule::handleReceived(const meshtastic_MeshPacket &mp) { #ifdef ARCH_ESP32 if (moduleConfig.store_forward.enabled) { // The router node should not be sending messages as a client. Unless he is a ROUTER_CLIENT - if ((getFrom(&mp) != nodeDB.getNodeNum()) || (config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) { + if ((getFrom(&mp) != nodeDB.getNodeNum()) || (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT)) { - if ((mp.decoded.portnum == PortNum_TEXT_MESSAGE_APP) && is_server) { + if ((mp.decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP) && is_server) { auto &p = mp.decoded; if ((p.payload.bytes[0] == 'S') && (p.payload.bytes[1] == 'F') && (p.payload.bytes[2] == 0x00)) { LOG_DEBUG("*** Legacy Request to send\n"); // Send the last 60 minutes of messages. if (this->busy) { - storeForwardModule->sendMessage(getFrom(&mp), StoreAndForward_RequestResponse_ROUTER_BUSY); + storeForwardModule->sendMessage(getFrom(&mp), meshtastic_StoreAndForward_RequestResponse_ROUTER_BUSY); LOG_INFO("*** S&F - Busy. Try again shortly.\n"); - MeshPacket *pr = allocReply(); + meshtastic_MeshPacket *pr = allocReply(); pr->to = getFrom(&mp); - pr->priority = MeshPacket_Priority_MIN; + pr->priority = meshtastic_MeshPacket_Priority_MIN; pr->want_ack = false; pr->decoded.want_response = false; - pr->decoded.portnum = PortNum_TEXT_MESSAGE_APP; + pr->decoded.portnum = meshtastic_PortNum_TEXT_MESSAGE_APP; memcpy(pr->decoded.payload.bytes, "** S&F - Busy. Try again shortly.", 34); pr->decoded.payload.size = 34; service.sendToMesh(pr); @@ -265,12 +265,12 @@ ProcessMessage StoreForwardModule::handleReceived(const MeshPacket &mp) LOG_INFO("*** S&F stored. Message history contains %u records now.\n", this->packetHistoryCurrent); } - } else if (mp.decoded.portnum == PortNum_STORE_FORWARD_APP) { + } else if (mp.decoded.portnum == meshtastic_PortNum_STORE_FORWARD_APP) { auto &p = mp.decoded; - StoreAndForward scratch; - StoreAndForward *decoded = NULL; - if (mp.which_payload_variant == MeshPacket_decoded_tag) { - if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &StoreAndForward_msg, &scratch)) { + meshtastic_StoreAndForward scratch; + meshtastic_StoreAndForward *decoded = NULL; + if (mp.which_payload_variant == meshtastic_MeshPacket_decoded_tag) { + if (pb_decode_from_bytes(p.payload.bytes, p.payload.size, &meshtastic_StoreAndForward_msg, &scratch)) { decoded = &scratch; } else { LOG_ERROR("Error decoding protobuf module!\n"); @@ -288,7 +288,7 @@ ProcessMessage StoreForwardModule::handleReceived(const MeshPacket &mp) return ProcessMessage::CONTINUE; // Let others look at this message also if they want } -bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndForward *p) +bool StoreForwardModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_StoreAndForward *p) { if (!moduleConfig.store_forward.enabled) { // If this module is not enabled in any capacity, don't handle the packet, and allow other modules to consume @@ -298,8 +298,8 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo requests++; switch (p->rr) { - case StoreAndForward_RequestResponse_CLIENT_ERROR: - case StoreAndForward_RequestResponse_CLIENT_ABORT: + case meshtastic_StoreAndForward_RequestResponse_CLIENT_ERROR: + case meshtastic_StoreAndForward_RequestResponse_CLIENT_ABORT: if (is_server) { // stop sending stuff, the client wants to abort or has another error if ((this->busy) && (this->busyTo == getFrom(&mp))) { @@ -310,16 +310,16 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo } break; - case StoreAndForward_RequestResponse_CLIENT_HISTORY: + case meshtastic_StoreAndForward_RequestResponse_CLIENT_HISTORY: if (is_server) { requests_history++; LOG_INFO("*** Client Request to send HISTORY\n"); // Send the last 60 minutes of messages. if (this->busy) { - storeForwardModule->sendMessage(getFrom(&mp), StoreAndForward_RequestResponse_ROUTER_BUSY); + storeForwardModule->sendMessage(getFrom(&mp), meshtastic_StoreAndForward_RequestResponse_ROUTER_BUSY); LOG_INFO("*** S&F - Busy. Try again shortly.\n"); } else { - if ((p->which_variant == StoreAndForward_history_tag) && (p->variant.history.window > 0)) { + if ((p->which_variant == meshtastic_StoreAndForward_history_tag) && (p->variant.history.window > 0)) { storeForwardModule->historySend(p->variant.history.window * 60000, getFrom(&mp)); // window is in minutes } else { storeForwardModule->historySend(historyReturnWindow * 60000, getFrom(&mp)); // defaults to 4 hours @@ -328,15 +328,15 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo } break; - case StoreAndForward_RequestResponse_CLIENT_PING: + case meshtastic_StoreAndForward_RequestResponse_CLIENT_PING: if (is_server) { LOG_INFO("*** StoreAndForward_RequestResponse_CLIENT_PING\n"); // respond with a ROUTER PONG - storeForwardModule->sendMessage(getFrom(&mp), StoreAndForward_RequestResponse_ROUTER_PONG); + storeForwardModule->sendMessage(getFrom(&mp), meshtastic_StoreAndForward_RequestResponse_ROUTER_PONG); } break; - case StoreAndForward_RequestResponse_CLIENT_PONG: + case meshtastic_StoreAndForward_RequestResponse_CLIENT_PONG: if (is_server) { LOG_INFO("*** StoreAndForward_RequestResponse_CLIENT_PONG\n"); // The Client is alive, update NodeDB @@ -344,11 +344,11 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo } break; - case StoreAndForward_RequestResponse_CLIENT_STATS: + case meshtastic_StoreAndForward_RequestResponse_CLIENT_STATS: if (is_server) { LOG_INFO("*** Client Request to send STATS\n"); if (this->busy) { - storeForwardModule->sendMessage(getFrom(&mp), StoreAndForward_RequestResponse_ROUTER_BUSY); + storeForwardModule->sendMessage(getFrom(&mp), meshtastic_StoreAndForward_RequestResponse_ROUTER_BUSY); LOG_INFO("*** S&F - Busy. Try again shortly.\n"); } else { storeForwardModule->statsSend(getFrom(&mp)); @@ -356,22 +356,22 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo } break; - case StoreAndForward_RequestResponse_ROUTER_ERROR: - case StoreAndForward_RequestResponse_ROUTER_BUSY: + case meshtastic_StoreAndForward_RequestResponse_ROUTER_ERROR: + case meshtastic_StoreAndForward_RequestResponse_ROUTER_BUSY: if (is_client) { LOG_DEBUG("*** StoreAndForward_RequestResponse_ROUTER_BUSY\n"); // retry in messages_saved * packetTimeMax ms retry_delay = - millis() + packetHistoryCurrent * packetTimeMax * (StoreAndForward_RequestResponse_ROUTER_ERROR ? 2 : 1); + millis() + packetHistoryCurrent * packetTimeMax * (meshtastic_StoreAndForward_RequestResponse_ROUTER_ERROR ? 2 : 1); } break; - case StoreAndForward_RequestResponse_ROUTER_PONG: + case meshtastic_StoreAndForward_RequestResponse_ROUTER_PONG: // A router responded, this is equal to receiving a heartbeat - case StoreAndForward_RequestResponse_ROUTER_HEARTBEAT: + case meshtastic_StoreAndForward_RequestResponse_ROUTER_HEARTBEAT: if (is_client) { // register heartbeat and interval - if (p->which_variant == StoreAndForward_heartbeat_tag) { + if (p->which_variant == meshtastic_StoreAndForward_heartbeat_tag) { heartbeatInterval = p->variant.heartbeat.period; } lastHeartbeat = millis(); @@ -379,19 +379,19 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo } break; - case StoreAndForward_RequestResponse_ROUTER_PING: + case meshtastic_StoreAndForward_RequestResponse_ROUTER_PING: if (is_client) { LOG_DEBUG("*** StoreAndForward_RequestResponse_ROUTER_PING\n"); // respond with a CLIENT PONG - storeForwardModule->sendMessage(getFrom(&mp), StoreAndForward_RequestResponse_CLIENT_PONG); + storeForwardModule->sendMessage(getFrom(&mp), meshtastic_StoreAndForward_RequestResponse_CLIENT_PONG); } break; - case StoreAndForward_RequestResponse_ROUTER_STATS: + case meshtastic_StoreAndForward_RequestResponse_ROUTER_STATS: if (is_client) { LOG_DEBUG("*** Router Response STATS\n"); // These fields only have informational purpose on a client. Fill them to consume later. - if (p->which_variant == StoreAndForward_stats_tag) { + if (p->which_variant == meshtastic_StoreAndForward_stats_tag) { this->packetHistoryMax = p->variant.stats.messages_total; this->packetHistoryCurrent = p->variant.stats.messages_saved; this->records = p->variant.stats.messages_max; @@ -404,10 +404,10 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo } break; - case StoreAndForward_RequestResponse_ROUTER_HISTORY: + case meshtastic_StoreAndForward_RequestResponse_ROUTER_HISTORY: if (is_client) { // These fields only have informational purpose on a client. Fill them to consume later. - if (p->which_variant == StoreAndForward_history_tag) { + if (p->which_variant == meshtastic_StoreAndForward_history_tag) { this->historyReturnWindow = p->variant.history.window / 60000; LOG_INFO("*** Router Response HISTORY - Sending %d messages from last %d minutes\n", p->variant.history.history_messages, this->historyReturnWindow); @@ -422,7 +422,7 @@ bool StoreForwardModule::handleReceivedProtobuf(const MeshPacket &mp, StoreAndFo } StoreForwardModule::StoreForwardModule() - : concurrency::OSThread("StoreForwardModule"), ProtobufModule("StoreForward", PortNum_STORE_FORWARD_APP, &StoreAndForward_msg) + : concurrency::OSThread("StoreForwardModule"), ProtobufModule("StoreForward", meshtastic_PortNum_STORE_FORWARD_APP, &meshtastic_StoreAndForward_msg) { #ifdef ARCH_ESP32 @@ -441,8 +441,8 @@ StoreForwardModule::StoreForwardModule() if (moduleConfig.store_forward.enabled) { // Router - if ((config.device.role == Config_DeviceConfig_Role_ROUTER) || - (config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) { + if ((config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER) || + (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT)) { LOG_INFO("*** Initializing Store & Forward Module in Router mode\n"); if (ESP.getPsramSize() > 0) { if (ESP.getFreePsram() >= 1024 * 1024) { @@ -479,8 +479,8 @@ StoreForwardModule::StoreForwardModule() // Client } - if ((config.device.role == Config_DeviceConfig_Role_CLIENT) || - (config.device.role == Config_DeviceConfig_Role_ROUTER_CLIENT)) { + if ((config.device.role == meshtastic_Config_DeviceConfig_Role_CLIENT) || + (config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER_CLIENT)) { is_client = true; LOG_INFO("*** Initializing Store & Forward Module in Client mode\n"); } diff --git a/src/modules/esp32/StoreForwardModule.h b/src/modules/esp32/StoreForwardModule.h index b1c4084f3..23f42e4ae 100644 --- a/src/modules/esp32/StoreForwardModule.h +++ b/src/modules/esp32/StoreForwardModule.h @@ -14,15 +14,15 @@ struct PacketHistoryStruct { uint32_t from; uint8_t channel; bool ack; - uint8_t payload[Constants_DATA_PAYLOAD_LEN]; + uint8_t payload[meshtastic_Constants_DATA_PAYLOAD_LEN]; pb_size_t payload_size; }; -class StoreForwardModule : private concurrency::OSThread, public ProtobufModule +class StoreForwardModule : private concurrency::OSThread, public ProtobufModule { bool busy = 0; uint32_t busyTo = 0; - char routerMessage[Constants_DATA_PAYLOAD_LEN] = {0}; + char routerMessage[meshtastic_Constants_DATA_PAYLOAD_LEN] = {0}; PacketHistoryStruct *packetHistory = 0; uint32_t packetHistoryCurrent = 0; @@ -47,7 +47,7 @@ class StoreForwardModule : private concurrency::OSThread, public ProtobufModule< Update our local reference of when we last saw that node. @return 0 if we have never seen that node before otherwise return the last time we saw the node. */ - void historyAdd(const MeshPacket &mp); + void historyAdd(const meshtastic_MeshPacket &mp); void statsSend(uint32_t to); void historySend(uint32_t msAgo, uint32_t to); @@ -57,18 +57,18 @@ class StoreForwardModule : private concurrency::OSThread, public ProtobufModule< * Send our payload into the mesh */ void sendPayload(NodeNum dest = NODENUM_BROADCAST, uint32_t packetHistory_index = 0); - void sendMessage(NodeNum dest, StoreAndForward &payload); - void sendMessage(NodeNum dest, StoreAndForward_RequestResponse rr); + void sendMessage(NodeNum dest, meshtastic_StoreAndForward &payload); + void sendMessage(NodeNum dest, meshtastic_StoreAndForward_RequestResponse rr); - virtual MeshPacket *allocReply() override; + virtual meshtastic_MeshPacket *allocReply() override; /* -Override the wantPacket method. */ - virtual bool wantPacket(const MeshPacket *p) override + virtual bool wantPacket(const meshtastic_MeshPacket *p) override { switch (p->decoded.portnum) { - case PortNum_TEXT_MESSAGE_APP: - case PortNum_STORE_FORWARD_APP: + case meshtastic_PortNum_TEXT_MESSAGE_APP: + case meshtastic_PortNum_STORE_FORWARD_APP: return true; default: return false; @@ -98,8 +98,8 @@ class StoreForwardModule : private concurrency::OSThread, public ProtobufModule< @return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it */ - virtual ProcessMessage handleReceived(const MeshPacket &mp) override; - virtual bool handleReceivedProtobuf(const MeshPacket &mp, StoreAndForward *p); + virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override; + virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_StoreAndForward *p); }; extern StoreForwardModule *storeForwardModule; diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index a6073af3b..64a53edff 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -21,9 +21,9 @@ String statusTopic = "msh/2/stat/"; String cryptTopic = "msh/2/c/"; // msh/2/c/CHANNELID/NODEID String jsonTopic = "msh/2/json/"; // msh/2/json/CHANNELID/NODEID -static MemoryDynamic staticMqttPool; +static MemoryDynamic staticMqttPool; -Allocator &mqttPool = staticMqttPool; +Allocator &mqttPool = staticMqttPool; void MQTT::mqttCallback(char *topic, byte *payload, unsigned int length) { @@ -33,7 +33,7 @@ void MQTT::mqttCallback(char *topic, byte *payload, unsigned int length) void MQTT::onPublish(char *topic, byte *payload, unsigned int length) { // parsing ServiceEnvelope - ServiceEnvelope e = ServiceEnvelope_init_default; + meshtastic_ServiceEnvelope e = meshtastic_ServiceEnvelope_init_default; if (moduleConfig.mqtt.json_enabled && (strncmp(topic, jsonTopic.c_str(), jsonTopic.length()) == 0)) { // check if this is a json payload message by comparing the topic start @@ -54,7 +54,7 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length) ptr = strtok(NULL, "/"); } LOG_DEBUG("Looking for Channel name: %s\n", ptr); - Channel sendChannel = channels.getByName(ptr); + meshtastic_Channel sendChannel = channels.getByName(ptr); LOG_DEBUG("Found Channel name: %s (Index %d)\n", channels.getGlobalId(sendChannel.settings.channel_num), sendChannel.settings.channel_num); @@ -68,14 +68,14 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length) LOG_INFO("JSON payload %s, length %u\n", jsonPayloadStr.c_str(), jsonPayloadStr.length()); // construct protobuf data packet using TEXT_MESSAGE, send it to the mesh - MeshPacket *p = router->allocForSending(); - p->decoded.portnum = PortNum_TEXT_MESSAGE_APP; + meshtastic_MeshPacket *p = router->allocForSending(); + p->decoded.portnum = meshtastic_PortNum_TEXT_MESSAGE_APP; p->channel = sendChannel.settings.channel_num; if (sendChannel.settings.downlink_enabled) { if (jsonPayloadStr.length() <= sizeof(p->decoded.payload.bytes)) { memcpy(p->decoded.payload.bytes, jsonPayloadStr.c_str(), jsonPayloadStr.length()); p->decoded.payload.size = jsonPayloadStr.length(); - MeshPacket *packet = packetPool.allocCopy(*p); + meshtastic_MeshPacket *packet = packetPool.allocCopy(*p); service.sendToMesh(packet, RX_SRC_LOCAL); } else { LOG_WARN("Received MQTT json payload too long, dropping\n"); @@ -95,19 +95,19 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length) (json["sender"]->AsString().compare(owner.id) != 0)) { JSONObject posit; posit = json["payload"]->AsObject(); // get nested JSON Position - Position pos = Position_init_default; + meshtastic_Position pos = meshtastic_Position_init_default; pos.latitude_i = posit["latitude_i"]->AsNumber(); pos.longitude_i = posit["longitude_i"]->AsNumber(); pos.altitude = posit["altitude"]->AsNumber(); pos.time = posit["time"]->AsNumber(); // construct protobuf data packet using POSITION, send it to the mesh - MeshPacket *p = router->allocForSending(); - p->decoded.portnum = PortNum_POSITION_APP; + meshtastic_MeshPacket *p = router->allocForSending(); + p->decoded.portnum = meshtastic_PortNum_POSITION_APP; p->channel = sendChannel.settings.channel_num; if (sendChannel.settings.downlink_enabled) { p->decoded.payload.size = pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), - &Position_msg, &pos); // make the Data protobuf from position + &meshtastic_Position_msg, &pos); // make the Data protobuf from position service.sendToMesh(p, RX_SRC_LOCAL); } else { LOG_WARN("Received MQTT json payload on channel %s, but downlink is disabled, dropping\n", @@ -125,7 +125,7 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length) } delete json_value; } else { - if (!pb_decode_from_bytes(payload, length, &ServiceEnvelope_msg, &e)) { + if (!pb_decode_from_bytes(payload, length, &meshtastic_ServiceEnvelope_msg, &e)) { LOG_ERROR("Invalid MQTT service envelope, topic %s, len %u!\n", topic, length); return; } else { @@ -134,7 +134,7 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length) else { if (e.packet) { LOG_INFO("Received MQTT topic %s, len=%u\n", topic, length); - MeshPacket *p = packetPool.allocCopy(*e.packet); + meshtastic_MeshPacket *p = packetPool.allocCopy(*e.packet); // ignore messages sent by us or if we don't have the channel key if (router && p->from != nodeDB.getNodeNum() && perhapsDecode(p)) @@ -293,9 +293,9 @@ int32_t MQTT::runOnce() if (pubSub.connected()) { if (!mqttQueue.isEmpty()) { // FIXME - this size calculation is super sloppy, but it will go away once we dynamically alloc meshpackets - ServiceEnvelope *env = mqttQueue.dequeuePtr(0); - static uint8_t bytes[MeshPacket_size + 64]; - size_t numBytes = pb_encode_to_bytes(bytes, sizeof(bytes), &ServiceEnvelope_msg, env); + meshtastic_ServiceEnvelope *env = mqttQueue.dequeuePtr(0); + static uint8_t bytes[meshtastic_MeshPacket_size + 64]; + size_t numBytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_ServiceEnvelope_msg, env); String topic = cryptTopic + env->channel_id + "/" + owner.id; LOG_INFO("publish %s, %u bytes from queue\n", topic.c_str(), numBytes); @@ -332,24 +332,24 @@ int32_t MQTT::runOnce() } } -void MQTT::onSend(const MeshPacket &mp, ChannelIndex chIndex) +void MQTT::onSend(const meshtastic_MeshPacket &mp, ChannelIndex chIndex) { auto &ch = channels.getByIndex(chIndex); if (ch.settings.uplink_enabled) { const char *channelId = channels.getGlobalId(chIndex); // FIXME, for now we just use the human name for the channel - ServiceEnvelope *env = mqttPool.allocZeroed(); + meshtastic_ServiceEnvelope *env = mqttPool.allocZeroed(); env->channel_id = (char *)channelId; env->gateway_id = owner.id; - env->packet = (MeshPacket *)∓ + env->packet = (meshtastic_MeshPacket *)∓ // don't bother sending if not connected... if (pubSub.connected()) { // FIXME - this size calculation is super sloppy, but it will go away once we dynamically alloc meshpackets - static uint8_t bytes[MeshPacket_size + 64]; - size_t numBytes = pb_encode_to_bytes(bytes, sizeof(bytes), &ServiceEnvelope_msg, env); + static uint8_t bytes[meshtastic_MeshPacket_size + 64]; + size_t numBytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_ServiceEnvelope_msg, env); String topic = cryptTopic + channelId + "/" + owner.id; LOG_DEBUG("publish %s, %u bytes\n", topic.c_str(), numBytes); @@ -358,7 +358,7 @@ void MQTT::onSend(const MeshPacket &mp, ChannelIndex chIndex) if (moduleConfig.mqtt.json_enabled) { // handle json topic - auto jsonString = this->downstreamPacketToJson((MeshPacket *)&mp); + auto jsonString = this->downstreamPacketToJson((meshtastic_MeshPacket *)&mp); if (jsonString.length() != 0) { String topicJson = jsonTopic + channelId + "/" + owner.id; LOG_INFO("JSON publish message to %s, %u bytes: %s\n", topicJson.c_str(), jsonString.length(), @@ -370,12 +370,12 @@ void MQTT::onSend(const MeshPacket &mp, ChannelIndex chIndex) LOG_INFO("MQTT not connected, queueing packet\n"); if (mqttQueue.numFree() == 0) { LOG_WARN("NOTE: MQTT queue is full, discarding oldest\n"); - ServiceEnvelope *d = mqttQueue.dequeuePtr(0); + meshtastic_ServiceEnvelope *d = mqttQueue.dequeuePtr(0); if (d) mqttPool.release(d); } // make a copy of serviceEnvelope and queue it - ServiceEnvelope *copied = mqttPool.allocCopy(*env); + meshtastic_ServiceEnvelope *copied = mqttPool.allocCopy(*env); assert(mqttQueue.enqueue(copied, 0)); } mqttPool.release(env); @@ -383,7 +383,7 @@ void MQTT::onSend(const MeshPacket &mp, ChannelIndex chIndex) } // converts a downstream packet into a json message -std::string MQTT::downstreamPacketToJson(MeshPacket *mp) +std::string MQTT::downstreamPacketToJson(meshtastic_MeshPacket *mp) { // the created jsonObj is immutable after creation, so // we need to do the heavy lifting before assembling it. @@ -392,7 +392,7 @@ std::string MQTT::downstreamPacketToJson(MeshPacket *mp) JSONObject jsonObj; switch (mp->decoded.portnum) { - case PortNum_TEXT_MESSAGE_APP: { + case meshtastic_PortNum_TEXT_MESSAGE_APP: { msgType = "text"; // convert bytes to string LOG_DEBUG("got text message of size %u\n", mp->decoded.payload.size); @@ -414,20 +414,20 @@ std::string MQTT::downstreamPacketToJson(MeshPacket *mp) } break; } - case PortNum_TELEMETRY_APP: { + case meshtastic_PortNum_TELEMETRY_APP: { msgType = "telemetry"; - Telemetry scratch; - Telemetry *decoded = NULL; - if (mp->which_payload_variant == MeshPacket_decoded_tag) { + meshtastic_Telemetry scratch; + meshtastic_Telemetry *decoded = NULL; + if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { memset(&scratch, 0, sizeof(scratch)); - if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &Telemetry_msg, &scratch)) { + if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &meshtastic_Telemetry_msg, &scratch)) { decoded = &scratch; - if (decoded->which_variant == Telemetry_device_metrics_tag) { + if (decoded->which_variant == meshtastic_Telemetry_device_metrics_tag) { msgPayload["battery_level"] = new JSONValue((int)decoded->variant.device_metrics.battery_level); msgPayload["voltage"] = new JSONValue(decoded->variant.device_metrics.voltage); msgPayload["channel_utilization"] = new JSONValue(decoded->variant.device_metrics.channel_utilization); msgPayload["air_util_tx"] = new JSONValue(decoded->variant.device_metrics.air_util_tx); - } else if (decoded->which_variant == Telemetry_environment_metrics_tag) { + } else if (decoded->which_variant == meshtastic_Telemetry_environment_metrics_tag) { msgPayload["temperature"] = new JSONValue(decoded->variant.environment_metrics.temperature); msgPayload["relative_humidity"] = new JSONValue(decoded->variant.environment_metrics.relative_humidity); msgPayload["barometric_pressure"] = new JSONValue(decoded->variant.environment_metrics.barometric_pressure); @@ -441,13 +441,13 @@ std::string MQTT::downstreamPacketToJson(MeshPacket *mp) }; break; } - case PortNum_NODEINFO_APP: { + case meshtastic_PortNum_NODEINFO_APP: { msgType = "nodeinfo"; - User scratch; - User *decoded = NULL; - if (mp->which_payload_variant == MeshPacket_decoded_tag) { + meshtastic_User scratch; + meshtastic_User *decoded = NULL; + if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { memset(&scratch, 0, sizeof(scratch)); - if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &User_msg, &scratch)) { + if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &meshtastic_User_msg, &scratch)) { decoded = &scratch; msgPayload["id"] = new JSONValue(decoded->id); msgPayload["longname"] = new JSONValue(decoded->long_name); @@ -459,13 +459,13 @@ std::string MQTT::downstreamPacketToJson(MeshPacket *mp) }; break; } - case PortNum_POSITION_APP: { + case meshtastic_PortNum_POSITION_APP: { msgType = "position"; - Position scratch; - Position *decoded = NULL; - if (mp->which_payload_variant == MeshPacket_decoded_tag) { + meshtastic_Position scratch; + meshtastic_Position *decoded = NULL; + if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { memset(&scratch, 0, sizeof(scratch)); - if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &Position_msg, &scratch)) { + if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &meshtastic_Position_msg, &scratch)) { decoded = &scratch; if ((int)decoded->time) { msgPayload["time"] = new JSONValue((int)decoded->time); @@ -486,13 +486,13 @@ std::string MQTT::downstreamPacketToJson(MeshPacket *mp) break; } - case PortNum_WAYPOINT_APP: { + case meshtastic_PortNum_WAYPOINT_APP: { msgType = "position"; - Waypoint scratch; - Waypoint *decoded = NULL; - if (mp->which_payload_variant == MeshPacket_decoded_tag) { + meshtastic_Waypoint scratch; + meshtastic_Waypoint *decoded = NULL; + if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag) { memset(&scratch, 0, sizeof(scratch)); - if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &Waypoint_msg, &scratch)) { + if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &meshtastic_Waypoint_msg, &scratch)) { decoded = &scratch; msgPayload["id"] = new JSONValue((int)decoded->id); msgPayload["name"] = new JSONValue(decoded->name); diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index 3f2cf2de6..8b12e2f88 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -46,7 +46,7 @@ class MQTT : private concurrency::OSThread * Note: for messages we are forwarding on the mesh that we can't find the channel for (because we don't have the keys), we * can not forward those messages to the cloud - becuase no way to find a global channel ID. */ - void onSend(const MeshPacket &mp, ChannelIndex chIndex); + void onSend(const meshtastic_MeshPacket &mp, ChannelIndex chIndex); /** Attempt to connect to server if necessary */ @@ -55,7 +55,7 @@ class MQTT : private concurrency::OSThread bool connected(); protected: - PointerQueue mqttQueue; + PointerQueue mqttQueue; int reconnectCount = 0; @@ -77,7 +77,7 @@ class MQTT : private concurrency::OSThread void onPublish(char *topic, byte *payload, unsigned int length); /// Called when a new publish arrives from the MQTT server - std::string downstreamPacketToJson(MeshPacket *mp); + std::string downstreamPacketToJson(meshtastic_MeshPacket *mp); /// Return 0 if sleep is okay, veto sleep if we are connected to pubsub server // int preflightSleepCb(void *unused = NULL) { return pubSub.connected() ? 1 : 0; } diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp index 2e346f760..79be9a35b 100644 --- a/src/nimble/NimbleBluetooth.cpp +++ b/src/nimble/NimbleBluetooth.cpp @@ -56,7 +56,7 @@ class NimbleBluetoothFromRadioCallback : public NimBLECharacteristicCallbacks virtual void onRead(NimBLECharacteristic *pCharacteristic) { LOG_INFO("From Radio onread\n"); - uint8_t fromRadioBytes[FromRadio_size]; + uint8_t fromRadioBytes[meshtastic_FromRadio_size]; size_t numBytes = bluetoothPhoneAPI->getFromRadio(fromRadioBytes); std::string fromRadioByteString(fromRadioBytes, fromRadioBytes + numBytes); @@ -71,7 +71,7 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks { uint32_t passkey = config.bluetooth.fixed_pin; - if (config.bluetooth.mode == Config_BluetoothConfig_PairingMode_RANDOM_PIN) { + if (config.bluetooth.mode == meshtastic_Config_BluetoothConfig_PairingMode_RANDOM_PIN) { LOG_INFO("Using random passkey\n"); // This is the passkey to be entered on peer - we pick a number >100,000 to ensure 6 digits passkey = random(100000, 999999); @@ -127,7 +127,7 @@ void NimbleBluetooth::setup() NimBLEDevice::init(getDeviceName()); NimBLEDevice::setPower(ESP_PWR_LVL_P9); - if (config.bluetooth.mode != Config_BluetoothConfig_PairingMode_NO_PIN) { + if (config.bluetooth.mode != meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN) { NimBLEDevice::setSecurityAuth(true, true, true); NimBLEDevice::setSecurityIOCap(BLE_HS_IO_DISPLAY_ONLY); } @@ -146,7 +146,7 @@ void NimbleBluetooth::setupService() NimBLECharacteristic *ToRadioCharacteristic; NimBLECharacteristic *FromRadioCharacteristic; // Define the characteristics that the app is looking for - if (config.bluetooth.mode == Config_BluetoothConfig_PairingMode_NO_PIN) { + if (config.bluetooth.mode == meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN) { ToRadioCharacteristic = bleService->createCharacteristic(TORADIO_UUID, NIMBLE_PROPERTY::WRITE); FromRadioCharacteristic = bleService->createCharacteristic(FROMRADIO_UUID, NIMBLE_PROPERTY::READ); fromNumCharacteristic = bleService->createCharacteristic(FROMNUM_UUID, NIMBLE_PROPERTY::NOTIFY | NIMBLE_PROPERTY::READ); diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index 785847825..7936e7f75 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -44,52 +44,52 @@ // This string must exactly match the case used in release file names or the android updater won't work #if defined(TBEAM_V10) -#define HW_VENDOR HardwareModel_TBEAM +#define HW_VENDOR meshtastic_HardwareModel_TBEAM #elif defined(TBEAM_V07) -#define HW_VENDOR HardwareModel_TBEAM_V0P7 +#define HW_VENDOR meshtastic_HardwareModel_TBEAM_V0P7 #elif defined(LILYGO_TBEAM_S3_CORE) -#define HW_VENDOR HardwareModel_LILYGO_TBEAM_S3_CORE +#define HW_VENDOR meshtastic_HardwareModel_LILYGO_TBEAM_S3_CORE #elif defined(DIY_V1) -#define HW_VENDOR HardwareModel_DIY_V1 +#define HW_VENDOR meshtastic_HardwareModel_DIY_V1 #elif defined(RAK_11200) -#define HW_VENDOR HardwareModel_RAK11200 +#define HW_VENDOR meshtastic_HardwareModel_RAK11200 #elif defined(ARDUINO_HELTEC_WIFI_LORA_32_V2) #ifdef HELTEC_V2_0 -#define HW_VENDOR HardwareModel_HELTEC_V2_0 +#define HW_VENDOR meshtastic_HardwareModel_HELTEC_V2_0 #endif #ifdef HELTEC_V2_1 -#define HW_VENDOR HardwareModel_HELTEC_V2_1 +#define HW_VENDOR meshtastic_HardwareModel_HELTEC_V2_1 #endif #elif defined(ARDUINO_HELTEC_WIFI_LORA_32) -#define HW_VENDOR HardwareModel_HELTEC_V1 +#define HW_VENDOR meshtastic_HardwareModel_HELTEC_V1 #elif defined(TLORA_V1) -#define HW_VENDOR HardwareModel_TLORA_V1 +#define HW_VENDOR meshtastic_HardwareModel_TLORA_V1 #elif defined(TLORA_V2) -#define HW_VENDOR HardwareModel_TLORA_V2 +#define HW_VENDOR meshtastic_HardwareModel_TLORA_V2 #elif defined(TLORA_V1_3) -#define HW_VENDOR HardwareModel_TLORA_V1_1P3 +#define HW_VENDOR meshtastic_HardwareModel_TLORA_V1_1P3 #elif defined(TLORA_V2_1_16) -#define HW_VENDOR HardwareModel_TLORA_V2_1_1P6 +#define HW_VENDOR meshtastic_HardwareModel_TLORA_V2_1_1P6 #elif defined(TLORA_V2_1_18) -#define HW_VENDOR HardwareModel_TLORA_V2_1_1P8 +#define HW_VENDOR meshtastic_HardwareModel_TLORA_V2_1_1P8 #elif defined(GENIEBLOCKS) -#define HW_VENDOR HardwareModel_GENIEBLOCKS +#define HW_VENDOR meshtastic_HardwareModel_GENIEBLOCKS #elif defined(PRIVATE_HW) -#define HW_VENDOR HardwareModel_PRIVATE_HW +#define HW_VENDOR meshtastic_HardwareModel_PRIVATE_HW #elif defined(NANO_G1) -#define HW_VENDOR HardwareModel_NANO_G1 +#define HW_VENDOR meshtastic_HardwareModel_NANO_G1 #elif defined(M5STACK) -#define HW_VENDOR HardwareModel_M5STACK +#define HW_VENDOR meshtastic_HardwareModel_M5STACK #elif defined(STATION_G1) -#define HW_VENDOR HardwareModel_STATION_G1 +#define HW_VENDOR meshtastic_HardwareModel_STATION_G1 #elif defined(DR_DEV) -#define HW_VENDOR HardwareModel_DR_DEV +#define HW_VENDOR meshtastic_HardwareModel_DR_DEV #elif defined(HELTEC_V3) -#define HW_VENDOR HardwareModel_HELTEC_V3 +#define HW_VENDOR meshtastic_HardwareModel_HELTEC_V3 #elif defined(HELTEC_WSL_V3) -#define HW_VENDOR HardwareModel_HELTEC_WSL_V3 +#define HW_VENDOR meshtastic_HardwareModel_HELTEC_WSL_V3 #elif defined(TLORA_T3S3_V1) -#define HW_VENDOR HardwareModel_TLORA_T3_S3 +#define HW_VENDOR meshtastic_HardwareModel_TLORA_T3_S3 #endif // diff --git a/src/platform/nrf52/NRF52Bluetooth.cpp b/src/platform/nrf52/NRF52Bluetooth.cpp index 7bdd1a982..54df5528f 100644 --- a/src/platform/nrf52/NRF52Bluetooth.cpp +++ b/src/platform/nrf52/NRF52Bluetooth.cpp @@ -19,8 +19,8 @@ static BLEDfu bledfu; // DFU software update helper service // This scratch buffer is used for various bluetooth reads/writes - but it is safe because only one bt operation can be in // proccess at once // static uint8_t trBytes[_max(_max(_max(_max(ToRadio_size, RadioConfig_size), User_size), MyNodeInfo_size), FromRadio_size)]; -static uint8_t fromRadioBytes[FromRadio_size]; -static uint8_t toRadioBytes[ToRadio_size]; +static uint8_t fromRadioBytes[meshtastic_FromRadio_size]; +static uint8_t toRadioBytes[meshtastic_ToRadio_size]; static uint16_t connectionHandle; @@ -168,7 +168,7 @@ 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 == 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!!! @@ -225,8 +225,8 @@ void NRF52Bluetooth::setup() Bluefruit.Advertising.clearData(); Bluefruit.ScanResponse.clearData(); - if (config.bluetooth.mode != Config_BluetoothConfig_PairingMode_NO_PIN) { - configuredPasskey = config.bluetooth.mode == Config_BluetoothConfig_PairingMode_FIXED_PIN ? config.bluetooth.fixed_pin + 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); auto pinString = std::to_string(configuredPasskey); LOG_INFO("Bluetooth pin set to '%i'\n", configuredPasskey); diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index 9493796a0..383a0da4e 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -36,19 +36,19 @@ // This string must exactly match the case used in release file names or the android updater won't work #ifdef ARDUINO_NRF52840_PCA10056 -#define HW_VENDOR HardwareModel_NRF52840DK +#define HW_VENDOR meshtastic_HardwareModel_NRF52840DK #elif defined(ARDUINO_NRF52840_PPR) -#define HW_VENDOR HardwareModel_PPR +#define HW_VENDOR meshtastic_HardwareModel_PPR #elif defined(RAK4630) -#define HW_VENDOR HardwareModel_RAK4631 +#define HW_VENDOR meshtastic_HardwareModel_RAK4631 #elif defined(TTGO_T_ECHO) -#define HW_VENDOR HardwareModel_T_ECHO +#define HW_VENDOR meshtastic_HardwareModel_T_ECHO #elif defined(NORDIC_PCA10059) -#define HW_VENDOR HardwareModel_NRF52840_PCA10059 +#define HW_VENDOR meshtastic_HardwareModel_NRF52840_PCA10059 #elif defined(PRIVATE_HW) || defined(FEATHER_DIY) -#define HW_VENDOR HardwareModel_PRIVATE_HW +#define HW_VENDOR meshtastic_HardwareModel_PRIVATE_HW #else -#define HW_VENDOR HardwareModel_NRF52_UNKNOWN +#define HW_VENDOR meshtastic_HardwareModel_NRF52_UNKNOWN #endif // diff --git a/src/platform/nrf52/main-nrf52.cpp b/src/platform/nrf52/main-nrf52.cpp index f08033d27..0384073a4 100644 --- a/src/platform/nrf52/main-nrf52.cpp +++ b/src/platform/nrf52/main-nrf52.cpp @@ -109,7 +109,7 @@ void checkSDEvents() while (NRF_SUCCESS == sd_evt_get(&evt)) { switch (evt) { case NRF_EVT_POWER_FAILURE_WARNING: - RECORD_CRITICALERROR(CriticalErrorCode_BROWNOUT); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_BROWNOUT); break; default: @@ -119,7 +119,7 @@ void checkSDEvents() } } else { if (NRF_POWER->EVENTS_POFWARN) - RECORD_CRITICALERROR(CriticalErrorCode_BROWNOUT); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_BROWNOUT); } } diff --git a/src/platform/rp2040/architecture.h b/src/platform/rp2040/architecture.h index d80d88914..c5a2ecdec 100644 --- a/src/platform/rp2040/architecture.h +++ b/src/platform/rp2040/architecture.h @@ -3,5 +3,5 @@ #define ARCH_RP2040 #if defined(PRIVATE_HW) -#define HW_VENDOR HardwareModel_PRIVATE_HW +#define HW_VENDOR meshtastic_HardwareModel_PRIVATE_HW #endif \ No newline at end of file diff --git a/src/sleep.cpp b/src/sleep.cpp index 921e687bf..54502a5bd 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -157,7 +157,7 @@ static void waitEnterSleep() delay(100); // Kinda yucky - wait until radio says say we can shutdown (finished in process sends/receives) if (millis() - now > 30 * 1000) { // If we wait too long just report an error and go to sleep - RECORD_CRITICALERROR(CriticalErrorCode_SLEEP_ENTER_WAIT); + RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_SLEEP_ENTER_WAIT); assert(0); // FIXME - for now we just restart, need to fix bug #167 break; } diff --git a/src/xmodem.cpp b/src/xmodem.cpp index aed551795..dbc7bf4a7 100644 --- a/src/xmodem.cpp +++ b/src/xmodem.cpp @@ -36,7 +36,7 @@ XModemAdapter xModem; XModemAdapter::XModemAdapter() { - xmodemStore = (XModem *)malloc(XModem_size); + xmodemStore = (meshtastic_XModem *)malloc(meshtastic_XModem_size); } unsigned short XModemAdapter::crc16_ccitt(const pb_byte_t *buffer, int length) @@ -64,15 +64,15 @@ int XModemAdapter::check(const pb_byte_t *buf, int sz, unsigned short tcrc) return 0; } -void XModemAdapter::sendControl(XModem_Control c) +void XModemAdapter::sendControl(meshtastic_XModem_Control c) { - memset(xmodemStore, 0, XModem_size); + memset(xmodemStore, 0, meshtastic_XModem_size); xmodemStore->control = c; LOG_DEBUG("XModem: Notify Sending control %d.\n", c); packetReady.notifyObservers(packetno); } -XModem *XModemAdapter::getForPhone() +meshtastic_XModem *XModemAdapter::getForPhone() { if (xmodemStore) { return xmodemStore; @@ -81,23 +81,23 @@ XModem *XModemAdapter::getForPhone() } } -void XModemAdapter::handlePacket(XModem xmodemPacket) +void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket) { switch (xmodemPacket.control) { - case XModem_Control_SOH: - case XModem_Control_STX: + case meshtastic_XModem_Control_SOH: + case meshtastic_XModem_Control_STX: if ((xmodemPacket.seq == 0) && !isReceiving && !isTransmitting) { // NULL packet has the destination filename memcpy(filename, &xmodemPacket.buffer.bytes, xmodemPacket.buffer.size); - if (xmodemPacket.control == XModem_Control_SOH) { // Receive this file and put to Flash + if (xmodemPacket.control == meshtastic_XModem_Control_SOH) { // Receive this file and put to Flash file = FSCom.open(filename, FILE_O_WRITE); if (file) { - sendControl(XModem_Control_ACK); + sendControl(meshtastic_XModem_Control_ACK); isReceiving = true; packetno = 1; break; } - sendControl(XModem_Control_NAK); + sendControl(meshtastic_XModem_Control_NAK); isReceiving = false; break; } else { // Transmit this file from Flash @@ -106,20 +106,20 @@ void XModemAdapter::handlePacket(XModem xmodemPacket) if (file) { packetno = 1; isTransmitting = true; - memset(xmodemStore, 0, XModem_size); - xmodemStore->control = XModem_Control_SOH; + memset(xmodemStore, 0, meshtastic_XModem_size); + xmodemStore->control = meshtastic_XModem_Control_SOH; xmodemStore->seq = packetno; - xmodemStore->buffer.size = file.read(xmodemStore->buffer.bytes, sizeof(XModem_buffer_t::bytes)); + xmodemStore->buffer.size = file.read(xmodemStore->buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes)); xmodemStore->crc16 = crc16_ccitt(xmodemStore->buffer.bytes, xmodemStore->buffer.size); LOG_DEBUG("XModem: STX Notify Sending packet %d, %d Bytes.\n", packetno, xmodemStore->buffer.size); - if (xmodemStore->buffer.size < sizeof(XModem_buffer_t::bytes)) { + if (xmodemStore->buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) { isEOT = true; // send EOT on next Ack } packetReady.notifyObservers(packetno); break; } - sendControl(XModem_Control_NAK); + sendControl(meshtastic_XModem_Control_NAK); isTransmitting = false; break; } @@ -130,39 +130,39 @@ void XModemAdapter::handlePacket(XModem xmodemPacket) check(xmodemPacket.buffer.bytes, xmodemPacket.buffer.size, xmodemPacket.crc16)) { // valid packet file.write(xmodemPacket.buffer.bytes, xmodemPacket.buffer.size); - sendControl(XModem_Control_ACK); + sendControl(meshtastic_XModem_Control_ACK); packetno++; break; } // invalid packet - sendControl(XModem_Control_NAK); + sendControl(meshtastic_XModem_Control_NAK); break; } else if (isTransmitting) { // just received something weird. - sendControl(XModem_Control_CAN); + sendControl(meshtastic_XModem_Control_CAN); isTransmitting = false; break; } } break; - case XModem_Control_EOT: + case meshtastic_XModem_Control_EOT: // End of transmission - sendControl(XModem_Control_ACK); + sendControl(meshtastic_XModem_Control_ACK); file.close(); isReceiving = false; break; - case XModem_Control_CAN: + case meshtastic_XModem_Control_CAN: // Cancel transmission and remove file - sendControl(XModem_Control_ACK); + sendControl(meshtastic_XModem_Control_ACK); file.close(); FSCom.remove(filename); isReceiving = false; break; - case XModem_Control_ACK: + case meshtastic_XModem_Control_ACK: // Acknowledge Send the next packet if (isTransmitting) { if (isEOT) { - sendControl(XModem_Control_EOT); + sendControl(meshtastic_XModem_Control_EOT); file.close(); LOG_INFO("XModem: Finished sending file %s\n", filename); isTransmitting = false; @@ -171,47 +171,47 @@ void XModemAdapter::handlePacket(XModem xmodemPacket) } retrans = MAXRETRANS; // reset retransmit counter packetno++; - memset(xmodemStore, 0, XModem_size); - xmodemStore->control = XModem_Control_SOH; + memset(xmodemStore, 0, meshtastic_XModem_size); + xmodemStore->control = meshtastic_XModem_Control_SOH; xmodemStore->seq = packetno; - xmodemStore->buffer.size = file.read(xmodemStore->buffer.bytes, sizeof(XModem_buffer_t::bytes)); + xmodemStore->buffer.size = file.read(xmodemStore->buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes)); xmodemStore->crc16 = crc16_ccitt(xmodemStore->buffer.bytes, xmodemStore->buffer.size); LOG_DEBUG("XModem: ACK Notify Sending packet %d, %d Bytes.\n", packetno, xmodemStore->buffer.size); - if (xmodemStore->buffer.size < sizeof(XModem_buffer_t::bytes)) { + if (xmodemStore->buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) { isEOT = true; // send EOT on next Ack } packetReady.notifyObservers(packetno); } else { // just received something weird. - sendControl(XModem_Control_CAN); + sendControl(meshtastic_XModem_Control_CAN); } break; - case XModem_Control_NAK: + case meshtastic_XModem_Control_NAK: // Negative acknowledge. Send the same buffer again if (isTransmitting) { if (--retrans <= 0) { - sendControl(XModem_Control_CAN); + sendControl(meshtastic_XModem_Control_CAN); file.close(); LOG_INFO("XModem: Retransmit timeout, cancelling file %s\n", filename); isTransmitting = false; break; } - memset(xmodemStore, 0, XModem_size); - xmodemStore->control = XModem_Control_SOH; + memset(xmodemStore, 0, meshtastic_XModem_size); + xmodemStore->control = meshtastic_XModem_Control_SOH; xmodemStore->seq = packetno; - file.seek((packetno - 1) * sizeof(XModem_buffer_t::bytes)); - xmodemStore->buffer.size = file.read(xmodemStore->buffer.bytes, sizeof(XModem_buffer_t::bytes)); + file.seek((packetno - 1) * sizeof(meshtastic_XModem_buffer_t::bytes)); + xmodemStore->buffer.size = file.read(xmodemStore->buffer.bytes, sizeof(meshtastic_XModem_buffer_t::bytes)); xmodemStore->crc16 = crc16_ccitt(xmodemStore->buffer.bytes, xmodemStore->buffer.size); LOG_DEBUG("XModem: NAK Notify Sending packet %d, %d Bytes.\n", packetno, xmodemStore->buffer.size); - if (xmodemStore->buffer.size < sizeof(XModem_buffer_t::bytes)) { + if (xmodemStore->buffer.size < sizeof(meshtastic_XModem_buffer_t::bytes)) { isEOT = true; // send EOT on next Ack } packetReady.notifyObservers(packetno); } else { // just received something weird. - sendControl(XModem_Control_CAN); + sendControl(meshtastic_XModem_Control_CAN); } break; default: diff --git a/src/xmodem.h b/src/xmodem.h index 8a9c08db6..776f800bb 100644 --- a/src/xmodem.h +++ b/src/xmodem.h @@ -46,8 +46,8 @@ class XModemAdapter XModemAdapter(); - void handlePacket(XModem xmodemPacket); - XModem *getForPhone(); + void handlePacket(meshtastic_XModem xmodemPacket); + meshtastic_XModem *getForPhone(); private: bool isReceiving = false; @@ -64,13 +64,13 @@ class XModemAdapter File file; #endif - char filename[sizeof(XModem_buffer_t::bytes)] = {0}; + char filename[sizeof(meshtastic_XModem_buffer_t::bytes)] = {0}; protected: - XModem *xmodemStore = NULL; + meshtastic_XModem *xmodemStore = NULL; unsigned short crc16_ccitt(const pb_byte_t *buffer, int length); int check(const pb_byte_t *buf, int sz, unsigned short tcrc); - void sendControl(XModem_Control c); + void sendControl(meshtastic_XModem_Control c); }; extern XModemAdapter xModem;