/** * @file di/can/net/callbacks.h * @brief DI-Net CAN network subsystem message callbacks * @copyright 2016 Dual Inventive Technology Centre B.V. * * CAN network discovery */ #ifndef LIBDI_INCLUDE_DI_CAN_NET_CALLBACKS_H_ #define LIBDI_INCLUDE_DI_CAN_NET_CALLBACKS_H_ struct di_can_msg; struct di_can_ctx; #include #ifdef __cplusplus extern "C" { #endif /** Callback item for net heartbeat publish message */ #define DI_CAN_NET_CALLBACK_HEARTBEAT_PUBLISH_ITEM { \ DI_CAN_CALLBACK_CANID( \ DI_CAN_MSGTYPE_NET, \ DI_CAN_TRANSFERTYPE_PUBLISH, \ DI_CAN_NET_DTYPE_HEARTBEAT \ ), \ di_can_net_cb_heartbeat_publish \ } /** Callback item for net node error publish message */ #define DI_CAN_NET_CALLBACK_NODE_ERROR_PUBLISH_ITEM { \ DI_CAN_CALLBACK_CANID( \ DI_CAN_MSGTYPE_NET, \ DI_CAN_TRANSFERTYPE_PUBLISH, \ DI_CAN_NET_DTYPE_NODE_ERROR \ ), \ di_can_net_cb_node_error_publish \ } /** Callback item for net node uid reply message */ #define DI_CAN_NET_CALLBACK_NODE_UID_REQUEST_ITEM { \ DI_CAN_CALLBACK_CANID( \ DI_CAN_MSGTYPE_NET, \ DI_CAN_TRANSFERTYPE_REQUEST, \ DI_CAN_NET_DTYPE_NODE_UID \ ), \ di_can_net_cb_node_uid_request \ } /** Callback item for Request raw hardware version */ #define DI_CAN_NET_CALLBACK_HW_REQUEST_ITEM { \ DI_CAN_CALLBACK_CANID( \ DI_CAN_MSGTYPE_RAW, \ DI_CAN_TRANSFERTYPE_REQUEST, \ DI_CAN_RAW_DTYPE_HW_VERSION \ ), \ di_can_net_cb_raw_request_hw_version \ } /** Callback item for Request raw firmware version */ #define DI_CAN_NET_CALLBACK_FW_REQUEST_ITEM { \ DI_CAN_CALLBACK_CANID( \ DI_CAN_MSGTYPE_RAW, \ DI_CAN_TRANSFERTYPE_REQUEST, \ DI_CAN_RAW_DTYPE_FW_VERSION \ ), \ di_can_net_cb_raw_request_fw_version \ } void di_can_net_cb_heartbeat_publish(const struct di_can_msg *msg, struct di_can_ctx *ctx); void di_can_net_cb_node_error_publish(const struct di_can_msg *msg, struct di_can_ctx *ctx); void di_can_net_cb_raw_request_hw_version(const struct di_can_msg *msg, struct di_can_ctx *ctx); void di_can_net_cb_raw_request_fw_version(const struct di_can_msg *msg, struct di_can_ctx *ctx); /** * Node device:uid request handler replies the cached di_device_uid. * When the request message had dst_id set to DI_CAN_NODEID_BROADCAST the * request is silently dropped as it is not allowed. A unicast request is * mandatory. * @param msg Request message * @param ctxt CAN context */ void di_can_net_cb_node_uid_request(const struct di_can_msg *msg, struct di_can_ctx *ctx); #ifdef __cplusplus } #endif #endif /* LIBDI_INCLUDE_DI_CAN_NET_CALLBACKS_H_ */