Uniot Core
0.8.1
Loading...
Searching...
No Matches
uniot::RegisterManager Class Reference

#include <RegisterManager.h>

Public Member Functions

 RegisterManager ()
 Default constructor.
 
 RegisterManager (RegisterManager const &)=delete
 Copy constructor is deleted to prevent unexpected behavior.
 
void operator= (RegisterManager const &)=delete
 Assignment operator is deleted to prevent unexpected behavior.
 
template<typename... Args>
void setDigitalInput (uint8_t first, Args... args)
 Sets one or more pins as digital inputs.
 
template<typename... Args>
void setDigitalOutput (uint8_t first, Args... args)
 Sets one or more pins as digital outputs.
 
template<typename... Args>
void setAnalogInput (uint8_t first, Args... args)
 Sets one or more pins as analog inputs.
 
template<typename... Args>
void setAnalogOutput (uint8_t first, Args... args)
 Sets one or more pins as analog outputs.
 
bool link (const String &name, RecordPtr link, uint32_t id=FOURCC(____))
 Links an object to a named register.
 
bool getGpio (const String &name, size_t index, uint8_t &outValue) const
 Gets a GPIO value from a named register.
 
template<typename T>
T * getObject (const String &name, size_t index)
 Gets an object of the specified type from a named register.
 
size_t getRegisterLength (const String &name) const
 Gets the number of elements in the specified named register.
 
void serializeRegisters (CBORObject &obj)
 Serializes all registers (GPIO and Object) to a CBOR object.
 

Constructor & Destructor Documentation

◆ RegisterManager() [1/2]

uniot::RegisterManager::RegisterManager ( )
inline

Default constructor.

◆ RegisterManager() [2/2]

uniot::RegisterManager::RegisterManager ( RegisterManager const & )
delete

Copy constructor is deleted to prevent unexpected behavior.

Member Function Documentation

◆ getGpio()

bool uniot::RegisterManager::getGpio ( const String & name,
size_t index,
uint8_t & outValue ) const
inline

Gets a GPIO value from a named register.

Parameters
nameThe register name to read from
indexThe index within the register to read
outValueReference to store the read GPIO value
Return values
trueIf the value was successfully read
falseIf the value could not be read or parameters are invalid

◆ getObject()

template<typename T>
T * uniot::RegisterManager::getObject ( const String & name,
size_t index )
inline

Gets an object of the specified type from a named register.

Template Parameters
TThe type of object to retrieve
Parameters
nameThe register name to read from
indexThe index within the register to get the object from
Return values
T*Pointer to the requested object or nullptr if not found

◆ getRegisterLength()

size_t uniot::RegisterManager::getRegisterLength ( const String & name) const
inline

Gets the number of elements in the specified named register.

Checks both GPIO and Object registers for the specified name.

Parameters
nameThe register name to check
Return values
size_tThe number of elements in the register, or 0 if not found

◆ link()

bool uniot::RegisterManager::link ( const String & name,
RecordPtr link,
uint32_t id = FOURCC(____) )
inline

Links an object to a named register.

Parameters
nameThe register name to link the object to
linkPointer to the object to link
idOptional identifier for the object (default: FOURCC(____)
Return values
trueIf the link operation was successful
falseIf the link operation failed

◆ operator=()

void uniot::RegisterManager::operator= ( RegisterManager const & )
delete

Assignment operator is deleted to prevent unexpected behavior.

◆ serializeRegisters()

void uniot::RegisterManager::serializeRegisters ( CBORObject & obj)
inline

Serializes all registers (GPIO and Object) to a CBOR object.

GPIO registers are serialized as arrays of values. Object registers are serialized as arrays of their identifiers.

Parameters
objThe CBOR object to serialize the registers into

◆ setAnalogInput()

template<typename... Args>
void uniot::RegisterManager::setAnalogInput ( uint8_t first,
Args... args )
inline

Sets one or more pins as analog inputs.

Template Parameters
ArgsVariadic template for multiple pin numbers
Parameters
firstThe first pin to configure
argsAdditional pins to configure

◆ setAnalogOutput()

template<typename... Args>
void uniot::RegisterManager::setAnalogOutput ( uint8_t first,
Args... args )
inline

Sets one or more pins as analog outputs.

Template Parameters
ArgsVariadic template for multiple pin numbers
Parameters
firstThe first pin to configure
argsAdditional pins to configure

◆ setDigitalInput()

template<typename... Args>
void uniot::RegisterManager::setDigitalInput ( uint8_t first,
Args... args )
inline

Sets one or more pins as digital inputs.

Template Parameters
ArgsVariadic template for multiple pin numbers
Parameters
firstThe first pin to configure
argsAdditional pins to configure

◆ setDigitalOutput()

template<typename... Args>
void uniot::RegisterManager::setDigitalOutput ( uint8_t first,
Args... args )
inline

Sets one or more pins as digital outputs.

Template Parameters
ArgsVariadic template for multiple pin numbers
Parameters
firstThe first pin to configure
argsAdditional pins to configure

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