SatCat5
satcat5::log::FromCbor Class Reference

Detailed Description

Read CBOR-formatted network messages and copy to the local log.

SatCat5 CBOR log messages.

This class is not intended to be used directly. For a specific protocol, satcat5::eth::FromCbor or satcat5::udp::FromCbor.

Definition at line 41 of file log_cbor.h.

#include <log_cbor.h>

Inheritance diagram for satcat5::log::FromCbor:
[legend]
Collaboration diagram for satcat5::log::FromCbor:
[legend]

Public Member Functions

void set_min_priority (s8 priority)
 Set the minimum priority for message forwarding. More...
 

Protected Member Functions

 FromCbor (satcat5::net::Dispatch *src, satcat5::net::Type filter)
 Only children can safely access constructor/destructor.
 
void frame_rcvd (satcat5::io::LimitedRead &src) override
 Event handler for incoming messages. More...
 
virtual void log_event (s8 priority, unsigned nbytes, const char *msg)
 Event handler for validated messages. More...
 

Protected Attributes

satcat5::net::Dispatch *const m_src
 Pointer to the interface object.
 
satcat5::net::Type m_filter
 Incoming packet filter.
 

Private Attributes

s8 m_min_priority = satcat5::log::DEBUG
 
satcat5::net::Protocolm_next
 Linked list of Protocols.
 

Member Function Documentation

◆ frame_rcvd()

void FromCbor::frame_rcvd ( satcat5::io::LimitedRead src)
overrideprotectedvirtual

Event handler for incoming messages.

After parsing and validation, this method calls log_event.

Implements satcat5::net::Protocol.

Definition at line 46 of file log_cbor.cc.

◆ log_event()

void FromCbor::log_event ( s8  priority,
unsigned  nbytes,
const char *  msg 
)
protectedvirtual

Event handler for validated messages.

The built-in handler creates a log::Log message object, which notifies all local log::EventHandler instances. Users may override this method in a child class to add new behavior. Note: The string argument is NOT null-terminated.

Definition at line 85 of file log_cbor.cc.

◆ set_min_priority()

void satcat5::log::FromCbor::set_min_priority ( s8  priority)
inline

Set the minimum priority for message forwarding.

By default, all messages are forwarded for processing. After calling this method, messages below the specified cutoff are ignored.

Definition at line 68 of file log_cbor.h.


The documentation for this class was generated from the following files: