mirror of
https://github.com/markqvist/reticulum-cpp.git
synced 2024-12-28 00:49:21 -05:00
WIP update
This commit is contained in:
parent
2c8006f3a9
commit
8026638a06
@ -480,7 +480,7 @@ Bytes Packet::get_hashable_part() {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
std::string Packet::toString() {
|
std::string Packet::debugString() {
|
||||||
if (_object->_packed) {
|
if (_object->_packed) {
|
||||||
//unpack();
|
//unpack();
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,9 @@ namespace RNS {
|
|||||||
inline const Bytes &raw() const { assert(_object); return _object->_raw; }
|
inline const Bytes &raw() const { assert(_object); return _object->_raw; }
|
||||||
inline Bytes packet_hash() const { assert(_object); return _object->_packet_hash; }
|
inline Bytes packet_hash() const { assert(_object); return _object->_packet_hash; }
|
||||||
|
|
||||||
std::string toString();
|
inline std::string toString() const { assert(_object); return "{Packet:" + _object->_packet_hash.toHex() + "}"; }
|
||||||
|
|
||||||
|
std::string debugString();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Object {
|
class Object {
|
||||||
|
@ -29,6 +29,10 @@ const char* APP_NAME = "example_utilities";
|
|||||||
const char* fruits[] = {"Peach", "Quince", "Date", "Tangerine", "Pomelo", "Carambola", "Grape"};
|
const char* fruits[] = {"Peach", "Quince", "Date", "Tangerine", "Pomelo", "Carambola", "Grape"};
|
||||||
const char* noble_gases[] = {"Helium", "Neon", "Argon", "Krypton", "Xenon", "Radon", "Oganesson"};
|
const char* noble_gases[] = {"Helium", "Neon", "Argon", "Krypton", "Xenon", "Radon", "Oganesson"};
|
||||||
|
|
||||||
|
void onPacket(const RNS::Bytes &data, const RNS::Packet &packet) {
|
||||||
|
RNS::extreme("onPacket: data: " + data.toHex());
|
||||||
|
RNS::extreme("onPacket: data string: \"" + data.toString() + "\"");
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
@ -81,12 +85,13 @@ void setup() {
|
|||||||
// test data send packet
|
// test data send packet
|
||||||
RNS::Packet send_packet(destination, "The quick brown fox jumps over the lazy dog");
|
RNS::Packet send_packet(destination, "The quick brown fox jumps over the lazy dog");
|
||||||
send_packet.pack();
|
send_packet.pack();
|
||||||
RNS::extreme("Test send_packet packet: " + send_packet.toString());
|
RNS::extreme("Test send_packet packet: " + send_packet.debugString());
|
||||||
|
|
||||||
// test data receive packet
|
// test data receive packet
|
||||||
|
destination.set_packet_callback(onPacket);
|
||||||
RNS::Packet recv_packet(RNS::Destination::NONE, send_packet.raw());
|
RNS::Packet recv_packet(RNS::Destination::NONE, send_packet.raw());
|
||||||
recv_packet.unpack();
|
recv_packet.unpack();
|
||||||
RNS::extreme("Test recv_packet packet: " + recv_packet.toString());
|
RNS::extreme("Test recv_packet packet: " + recv_packet.debugString());
|
||||||
destination.receive(recv_packet);
|
destination.receive(recv_packet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user