CMD_Publisher#

Typedefs#

typedef void *

Handle to the Cmd Publisher "object".

typedef void(*
zaf_cp_subscriberFunction_t)(void *pSubscriberContext, void *pRxPackage)

Callback function triggered by ZAF_CP_CommandPublish, when corresponding subscriber gets notified.

Functions#

ZAF_CP_Init(void *pStorage, uint8_t numSubscribers)

Initializes Command publisher module.

bool
ZAF_CP_SubscribeToAll(CP_Handle_t handle, void *pSubscriberContext, zaf_cp_subscriberFunction_t pFunction)

Subscribe a function with pHandle to all command classes.

bool
ZAF_CP_SubscribeToCC(CP_Handle_t handle, void *pSubscriberContext, zaf_cp_subscriberFunction_t pFunction, uint16_t CmdClass)

Subscribe a function with pHandle to an entire command class.

bool
ZAF_CP_SubscribeToCmd(CP_Handle_t handle, void *pSubscriberContext, zaf_cp_subscriberFunction_t pFunction, uint16_t CmdClass, uint8_t Cmd)

Subscribe a function with pHandle to a specific command of the given command class.

bool
ZAF_CP_UnsubscribeToAll(CP_Handle_t handle, void *pSubscriberContext, zaf_cp_subscriberFunction_t pFunction)

Unsubscribe from previously subscribed handle.

bool
ZAF_CP_UnsubscribeToCC(CP_Handle_t handle, void *pSubscriberContext, zaf_cp_subscriberFunction_t pFunction, uint16_t CmdClass)

Unsubscribe from previously subscribed command class.

bool
ZAF_CP_UnsubscribeToCmd(CP_Handle_t handle, void *pSubscriberContext, zaf_cp_subscriberFunction_t pFunction, uint16_t CmdClass, uint8_t Cmd)

Unsubscribe from previously subscribed command.

void
ZAF_CP_CommandPublish(CP_Handle_t handle, void *pRxPackage)

Informs all relevant subscribers about incoming frame.

Macros#

#define
ZAF_CP_HEADER_SIZE 4
#define
ZAF_CP_ELEMENT_SIZE 16
#define
ZAF_CP_STORAGE_SIZE (num_elements)
#define
ZAF_CP_STORAGE (name, num_elements)

Typedef Documentation#

CP_Handle_t#

typedef void* CP_Handle_t

Handle to the Cmd Publisher "object".


zaf_cp_subscriberFunction_t#

typedef void(* zaf_cp_subscriberFunction_t) (void *pSubscriberContext, void *pRxPackage) )(void *pSubscriberContext, void *pRxPackage)

Callback function triggered by ZAF_CP_CommandPublish, when corresponding subscriber gets notified.

Parameters
TypeDirectionArgument NameDescription
N/ApSubscriberContext

Subscribers context to be passed to subscriber

N/ApRxPackage

Received Frame


Function Documentation#

ZAF_CP_Init#

CP_Handle_t ZAF_CP_Init (void * pStorage, uint8_t numSubscribers)

Initializes Command publisher module.

Parameters
TypeDirectionArgument NameDescription
void *N/ApStorage

Stores the subscribers list. Should be allocated with ZAF_CP_STORAGE

uint8_tN/AnumSubscribers

Number of subscribers

Note

  • ZAF_CP_STORAGE must be called before this

Returns

  • handle to the initialized content


ZAF_CP_SubscribeToAll#

bool ZAF_CP_SubscribeToAll (CP_Handle_t handle, void * pSubscriberContext, zaf_cp_subscriberFunction_t pFunction)

Subscribe a function with pHandle to all command classes.

Parameters
TypeDirectionArgument NameDescription
CP_Handle_tN/Ahandle

Handle to Cmd Publisher module

void *N/ApSubscriberContext

Context of the subscriber

zaf_cp_subscriberFunction_tN/ApFunction

Subscribers callback function

Returns

  • true if new subscription went OK, false if not


ZAF_CP_SubscribeToCC#

bool ZAF_CP_SubscribeToCC (CP_Handle_t handle, void * pSubscriberContext, zaf_cp_subscriberFunction_t pFunction, uint16_t CmdClass)

Subscribe a function with pHandle to an entire command class.

Parameters
TypeDirectionArgument NameDescription
CP_Handle_tN/Ahandle

Handle to Cmd Publisher module

void *N/ApSubscriberContext

Context of the subscriber

zaf_cp_subscriberFunction_tN/ApFunction

Subscribers callback function

uint16_tN/ACmdClass

Command Class to subscribe to

Returns

  • true if new subscription went OK, false if not


ZAF_CP_SubscribeToCmd#

bool ZAF_CP_SubscribeToCmd (CP_Handle_t handle, void * pSubscriberContext, zaf_cp_subscriberFunction_t pFunction, uint16_t CmdClass, uint8_t Cmd)

Subscribe a function with pHandle to a specific command of the given command class.

Parameters
TypeDirectionArgument NameDescription
CP_Handle_tN/Ahandle

Handle to Cmd Publisher module

void *N/ApSubscriberContext

Context of the subscriber

zaf_cp_subscriberFunction_tN/ApFunction

Subscribers callback function

uint16_tN/ACmdClass

Command Class to subscribe to

uint8_tN/ACmd

Specific command to subscribe to

Returns

  • true if new subscription went OK, false if not


ZAF_CP_UnsubscribeToAll#

bool ZAF_CP_UnsubscribeToAll (CP_Handle_t handle, void * pSubscriberContext, zaf_cp_subscriberFunction_t pFunction)

Unsubscribe from previously subscribed handle.

Parameters
TypeDirectionArgument NameDescription
CP_Handle_tN/Ahandle

Handle to Cmd Publisher module

void *N/ApSubscriberContext

Context of the subscriber

zaf_cp_subscriberFunction_tN/ApFunction

Subscribers callback function

Returns

  • true if unsubscribing went OK, false if not


ZAF_CP_UnsubscribeToCC#

bool ZAF_CP_UnsubscribeToCC (CP_Handle_t handle, void * pSubscriberContext, zaf_cp_subscriberFunction_t pFunction, uint16_t CmdClass)

Unsubscribe from previously subscribed command class.

Parameters
TypeDirectionArgument NameDescription
CP_Handle_tN/Ahandle

Handle to Cmd Publisher module

void *N/ApSubscriberContext

Context of the subscriber

zaf_cp_subscriberFunction_tN/ApFunction

Subscribers callback function

uint16_tN/ACmdClass

Command Class to unsubscribe from

Returns

  • true if unsubscribing went OK, false if not


ZAF_CP_UnsubscribeToCmd#

bool ZAF_CP_UnsubscribeToCmd (CP_Handle_t handle, void * pSubscriberContext, zaf_cp_subscriberFunction_t pFunction, uint16_t CmdClass, uint8_t Cmd)

Unsubscribe from previously subscribed command.

Parameters
TypeDirectionArgument NameDescription
CP_Handle_tN/Ahandle

Handle to Cmd Publisher module

void *N/ApSubscriberContext

Context of the subscriber

zaf_cp_subscriberFunction_tN/ApFunction

Subscribers callback function

uint16_tN/ACmdClass

Command Class to unsubscribe from

uint8_tN/ACmd

Specific command to unsubscribe from

Returns

  • true if unsubscribing went OK, false if not


ZAF_CP_CommandPublish#

void ZAF_CP_CommandPublish (CP_Handle_t handle, void * pRxPackage)

Informs all relevant subscribers about incoming frame.

Parameters
TypeDirectionArgument NameDescription
CP_Handle_tN/Ahandle

Handle to Cmd Publisher module

void *N/ApRxPackage

Received frame. It will be passed to subscribers

Based on incoming frame, it will decide which type of subscribers should be notified It should be called when the receive queue is emptied