PDChannelLogger

class PDChannelLogger

Public Functions

PDChannelLogger(Acroname::BrainStem::Module *module, const uint8_t index, const uint16_t bufferLength = 1024)

Manages BrainStem Power Delivery logging packets.

Parameters:
  • module – Reference to an existing BrainStem Module

  • index – Index/channel logging should be enabled for.

  • bufferLength – Number of packets the class should queue before dropping.

aErr setEnabled(bool enable)

Enables Power Delivery logging.

Parameters:

enable – True enables logging; False disables logging

Returns:

aErrNone on sucess

aErr getPacket(BS_PD_Packet_t &packet)

Attempts to takes a packet from the internal buffer.

Parameters:

packet – Reference to a packet to be filled by the function.

Returns:

aErrNone if the function successfully acquired any number of packets.

aErrNotReady if no packets were available.

aErrInitialization if this module is not in a valid state to execute.

aErr getPackets(std::vector<BS_PD_Packet_t> &packets, const unsigned int maxPackets = 200)

Attempts to take a multiple packets (up to a maximum) from the internal buffer.

Parameters:
  • packets – reference to a vector to be filled by the function

  • maxPackets – The maximum number of packets to acquire.

Returns:

aErrNone if the function successfully acquired any number of packets.

aErrNotReady if no packets were available.

aErrInitialization if this module is not in a valid state to execute.

inline uint8_t getIndex(void) const

Provides the index for which this object was created for.

Returns:

The index of the object.