mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-02 10:16:11 +00:00
* new CMD_SEND_RAW_PACKET
This commit is contained in:
@@ -61,6 +61,7 @@
|
|||||||
#define CMD_SEND_CHANNEL_DATA 62
|
#define CMD_SEND_CHANNEL_DATA 62
|
||||||
#define CMD_SET_DEFAULT_FLOOD_SCOPE 63
|
#define CMD_SET_DEFAULT_FLOOD_SCOPE 63
|
||||||
#define CMD_GET_DEFAULT_FLOOD_SCOPE 64
|
#define CMD_GET_DEFAULT_FLOOD_SCOPE 64
|
||||||
|
#define CMD_SEND_RAW_PACKET 65
|
||||||
|
|
||||||
// Stats sub-types for CMD_GET_STATS
|
// Stats sub-types for CMD_GET_STATS
|
||||||
#define STATS_TYPE_CORE 0
|
#define STATS_TYPE_CORE 0
|
||||||
@@ -1963,6 +1964,19 @@ void MyMesh::handleCmdFrame(size_t len) {
|
|||||||
memcpy(&out_frame[i], &r->upper_freq, 4); i += 4;
|
memcpy(&out_frame[i], &r->upper_freq, 4); i += 4;
|
||||||
}
|
}
|
||||||
_serial->writeFrame(out_frame, i);
|
_serial->writeFrame(out_frame, i);
|
||||||
|
} else if (cmd_frame[0] == CMD_SEND_RAW_PACKET && len >= 4) {
|
||||||
|
auto pkt = obtainNewPacket();
|
||||||
|
if (pkt) {
|
||||||
|
uint8_t priority = cmd_frame[1];
|
||||||
|
if (tryParsePacket(pkt, &cmd_frame[2], len - 2)) {
|
||||||
|
sendPacket(pkt, priority, 0);
|
||||||
|
writeOKFrame();
|
||||||
|
} else {
|
||||||
|
writeErrFrame(ERR_CODE_ILLEGAL_ARG);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
writeErrFrame(ERR_CODE_TABLE_FULL);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
writeErrFrame(ERR_CODE_UNSUPPORTED_CMD);
|
writeErrFrame(ERR_CODE_UNSUPPORTED_CMD);
|
||||||
MESH_DEBUG_PRINTLN("ERROR: unknown command: %02X", cmd_frame[0]);
|
MESH_DEBUG_PRINTLN("ERROR: unknown command: %02X", cmd_frame[0]);
|
||||||
|
|||||||
+2
-1
@@ -193,8 +193,9 @@ public:
|
|||||||
bool millisHasNowPassed(unsigned long timestamp) const;
|
bool millisHasNowPassed(unsigned long timestamp) const;
|
||||||
unsigned long futureMillis(int millis_from_now) const;
|
unsigned long futureMillis(int millis_from_now) const;
|
||||||
|
|
||||||
private:
|
|
||||||
bool tryParsePacket(Packet* pkt, const uint8_t* raw, int len);
|
bool tryParsePacket(Packet* pkt, const uint8_t* raw, int len);
|
||||||
|
|
||||||
|
private:
|
||||||
void checkRecv();
|
void checkRecv();
|
||||||
void checkSend();
|
void checkSend();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user