MCPcopy Create free account
hub / github.com/attermann/microReticulum / ExampleAnnounceHandler

Class ExampleAnnounceHandler

examples/lora_announce/src/main.cpp:46–62  ·  view source on GitHub ↗

Test AnnounceHandler

Source from the content-addressed store, hash-verified

44
45// Test AnnounceHandler
46class ExampleAnnounceHandler : public RNS::AnnounceHandler {
47public:
48 ExampleAnnounceHandler(const char* aspect_filter = nullptr) : AnnounceHandler(aspect_filter) {}
49 virtual ~ExampleAnnounceHandler() {}
50 virtual void received_announce(const RNS::Bytes& destination_hash, const RNS::Identity& announced_identity, const RNS::Bytes& app_data) {
51 INFO("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
52 INFOF("ExampleAnnounceHandler: destination hash: %s", destination_hash.toHex().c_str());
53 if (announced_identity) {
54 INFOF("ExampleAnnounceHandler: announced identity hash: %s", announced_identity.hash().toHex().c_str());
55 INFOF("ExampleAnnounceHandler: announced identity app data: %s", announced_identity.app_data().toHex().c_str());
56 }
57 if (app_data) {
58 INFOF("ExampleAnnounceHandler: app data text: \"%s\"", app_data.toString().c_str());
59 }
60 INFO("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
61 }
62};
63
64// Test packet receive callback
65void onPacket(const RNS::Bytes& data, const RNS::Packet& packet) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected