DynamicClientCfg
The module DynamicClientCfg
contains the structure dynamicClient
which provides a flexible mechanism
for managing dynamic I/O channels and their associated clients at runtime.
It allows for dynamic addition, removal, and querying of clients and channels, providing a
convenient interface for handling dynamic I/O configurations in embedded systems.
Enumeration
enum
{
bitWidthDynamicClientCount = Size,
bitWidthDynamicClientsChannelCount = ((sizeof(T) * 8) - bitWidthDynamicClientCount),
maxDynamicClientCount = (0x01U << bitWidthDynamicClientCount),
channelInvalid = (0x01U << bitWidthDynamicClientsChannelCount) - 1U,
dynamicClientInvalid = (0x01U << bitWidthDynamicClientCount) - 1U,
dynamicChannels = dynamicChannelsCount
};
Methods
/**
* Clean all Clients
*/
static void cleanDynamicClients();
/**
* Check Valid Channel
* @param : number of channel
* @ret : true is valid ,false - not valid
*/
static bool getClientValid(T channel);
/**
* setDynamicClient
* @param : channel number ,
* @param : numberInsideClient , channel number inside the Client
* @param : IDynamicClient* client
* @ret : true , false
*/
bool setDynamicClient(T channel, T numberInsideClient, IDynamicClient* client);
/**
* clearDynamicClient
* @param : channel number ,
* @ret : true , false
*/
bool clearDynamicClient(T channel);
/**
* getClientInstance, channel has to be first checked using `getClientValid()` method
* @param : number of channel
* @ret : IDynamicClient*
*/
static inline IDynamicClient* getClientInstance(T channel)
{
return (fpDynamicClient[fDynamicChannelCfg[channel].instanceNumber]);
}
static inline T getChannelInsideClient(T channel)
{
return (fDynamicChannelCfg[channel].numberInsideClient);
}
static tDynamicClientCfg fDynamicChannelCfg[dynamicChannels];
static IDynamicClient* fpDynamicClient[dynamicClientCountCfg];