GamepadCodec Arduino Lib 1.0.1
Loading...
Searching...
No Matches
gamepad::codec::Decoder Class Reference

Decoder class responsible for parsing gamepad input frames from a byte stream and updating the state tracker. More...

#include <gamepad_codec_decoder.h>

Public Member Functions

 Decoder (Stream &stream) noexcept
 Constructor.
 
const gamepad::input::Tracker & Update () noexcept
 Update, need to be called in Loop.
 
const gamepad::input::Tracker & input_tracker () const noexcept
 Get the input tracker object.
 

Detailed Description

Decoder class responsible for parsing gamepad input frames from a byte stream and updating the state tracker.

Binds to a Stream (e.g., Serial) object. When Update() is called, it reads all available data, uses RobustFrame::Parser to synchronize frame boundaries, identifies the payload type (0x01), deserializes data into gamepad::input::State, and finally updates the internal Tracker.

Examples
decoder/ble_serial_module/basic_polling/basic_polling.ino.

Definition at line 31 of file gamepad_codec_decoder.h.

Constructor & Destructor Documentation

◆ Decoder()

gamepad::codec::Decoder::Decoder ( Stream & stream)
noexcept

Constructor.

Parameters
[in]streamReference to a Stream object for reading data byte stream.

Definition at line 12 of file gamepad_codec_decoder.cpp.

Member Function Documentation

◆ input_tracker()

const gamepad::input::Tracker & gamepad::codec::Decoder::input_tracker ( ) const
inlinenoexcept

Get the input tracker object.

This function returns a reference to the internal input tracker object.

Returns
Input tracker object

Definition at line 67 of file gamepad_codec_decoder.h.

◆ Update()

const gamepad::input::Tracker & gamepad::codec::Decoder::Update ( )
noexcept

Update, need to be called in Loop.

Definition at line 14 of file gamepad_codec_decoder.cpp.


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