187 lines
5.7 KiB
C
Executable File
187 lines
5.7 KiB
C
Executable File
/**
|
|
* @file include/di_fw/can/callbacks.h
|
|
* @brief callback header file
|
|
* @date August 26, 2015
|
|
* @author A.A.W.M. Ruijs
|
|
* @copyright 2015 Dual Inventive Technology Centre B.V.
|
|
*/
|
|
#ifndef INCLUDE_DI_FW_CAN_CALLBACKS_H_
|
|
#define INCLUDE_DI_FW_CAN_CALLBACKS_H_
|
|
|
|
#include <di/can.h>
|
|
|
|
#define DI_FW_CAN_CALLBACK_RAW_CONNECTION_ITEM { \
|
|
DI_CAN_CALLBACK_CANID(DI_CAN_MSGTYPE_RAW,\
|
|
DI_CAN_TRANSFERTYPE_PUBLISH,\
|
|
DI_CAN_RAW_DTYPE_CONNECTION_STATE),\
|
|
di_fw_can_cb_raw_connection\
|
|
}
|
|
#define DI_FW_CAN_CALLBACK_RAW_DEVICE_UID_ITEM { \
|
|
DI_CAN_CALLBACK_CANID(DI_CAN_MSGTYPE_RAW,\
|
|
DI_CAN_TRANSFERTYPE_REQUEST,\
|
|
DI_CAN_RAW_DTYPE_DEVICE_UID),\
|
|
di_fw_can_cb_raw_device_uid \
|
|
}
|
|
#define DI_FW_CAN_CALLBACK_RAW_CLOUDLIGHT_STATE_ITEM { \
|
|
DI_CAN_CALLBACK_CANID(DI_CAN_MSGTYPE_RAW,\
|
|
DI_CAN_TRANSFERTYPE_REQUEST,\
|
|
DI_CAN_RAW_DTYPE_CLOUDLIGHT_STATE),\
|
|
di_fw_can_cb_raw_cloudlight\
|
|
}
|
|
#define DI_FW_CAN_CALLBACK_RAW_PROJECT_ID_ITEM { \
|
|
DI_CAN_CALLBACK_CANID(DI_CAN_MSGTYPE_RAW,\
|
|
DI_CAN_TRANSFERTYPE_REQUEST,\
|
|
DI_CAN_RAW_DTYPE_PROJECT_ID),\
|
|
di_fw_can_cb_raw_project_id \
|
|
}
|
|
#define DI_FW_CAN_CALLBACK_DEVICE_PING_ITEM { \
|
|
DI_CAN_CALLBACK_CANID(DI_CAN_MSGTYPE_RPC,\
|
|
DI_CAN_TRANSFERTYPE_REQUEST,\
|
|
DI_RPC_TYPE_DEVICE_PING),\
|
|
di_fw_can_cb_device_ping\
|
|
}
|
|
#define DI_FW_CAN_CALLBACK_DEVICE_INFO_ITEM(callback) { \
|
|
DI_CAN_CALLBACK_CANID(DI_CAN_MSGTYPE_RPC, \
|
|
DI_CAN_TRANSFERTYPE_REQUEST,\
|
|
DI_RPC_TYPE_DEVICE_INFO),\
|
|
callback\
|
|
}
|
|
#define DI_FW_CAN_CALLBACK_DEVICE_DATA_ITEM { \
|
|
DI_CAN_CALLBACK_CANID(DI_CAN_MSGTYPE_RPC,\
|
|
DI_CAN_TRANSFERTYPE_REQUEST,\
|
|
DI_RPC_TYPE_DEVICE_DATA),\
|
|
di_fw_can_cb_device_data\
|
|
}
|
|
#define DI_FW_CAN_CALLBACK_CONFIG_INFO_ITEM { \
|
|
DI_CAN_CALLBACK_CANID(DI_CAN_MSGTYPE_RPC,\
|
|
DI_CAN_TRANSFERTYPE_REQUEST,\
|
|
DI_RPC_TYPE_CONFIG_INFO),\
|
|
di_fw_can_cb_config_info\
|
|
}
|
|
#define DI_FW_CAN_CALLBACK_CONFIG_GET_ITEM { \
|
|
DI_CAN_CALLBACK_CANID(DI_CAN_MSGTYPE_RPC,\
|
|
DI_CAN_TRANSFERTYPE_REQUEST,\
|
|
DI_RPC_TYPE_CONFIG_GET),\
|
|
di_fw_can_cb_config_get\
|
|
}
|
|
#define DI_FW_CAN_CALLBACK_CONFIG_SET_ITEM { \
|
|
DI_CAN_CALLBACK_CANID(DI_CAN_MSGTYPE_RPC,\
|
|
DI_CAN_TRANSFERTYPE_REQUEST,\
|
|
DI_RPC_TYPE_CONFIG_SET),\
|
|
di_fw_can_cb_config_set\
|
|
}
|
|
#define DI_FW_CAN_CALLBACK_CONFIG_RESET_ITEM { \
|
|
DI_CAN_CALLBACK_CANID(DI_CAN_MSGTYPE_RPC,\
|
|
DI_CAN_TRANSFERTYPE_REQUEST,\
|
|
DI_RPC_TYPE_CONFIG_RESET),\
|
|
di_fw_can_cb_config_reset\
|
|
}
|
|
#define DI_FW_CAN_CALLBACK_CONNECTION_INFO_ITEM { \
|
|
DI_CAN_CALLBACK_CANID(DI_CAN_MSGTYPE_RPC, \
|
|
DI_CAN_TRANSFERTYPE_REQUEST, \
|
|
DI_RPC_TYPE_CONNECTION_INFO), \
|
|
di_fw_can_cb_connection_info \
|
|
}
|
|
|
|
/**
|
|
* worker routine for di_fw_can_cb_device_data()
|
|
* @param msg pointer to the message
|
|
* @param ctx pointer to the can context
|
|
*/
|
|
di_errno_t di_fw_can_device_data(const struct di_can_msg *msg, struct di_can_ctx *ctx, const bool rt);
|
|
|
|
/**
|
|
* Sent an RPC reply on the device:ping request
|
|
* @param msg pointer to the message
|
|
* @param ctx pointer to the can context
|
|
*/
|
|
void di_fw_can_cb_device_ping(const struct di_can_msg *msg, struct di_can_ctx *ctx);
|
|
|
|
/**
|
|
* Sent an RPC reply on the device:info request
|
|
* @param msg pointer to the message
|
|
* @param ctx pointer to the can context
|
|
*/
|
|
void di_fw_can_cb_device_info(const struct di_can_msg *msg, struct di_can_ctx *ctx);
|
|
|
|
/**
|
|
* Sent an device:data reply or publish message
|
|
* @param msg Request message. When NULL a publish is send.
|
|
* @param ctx CAN context
|
|
*/
|
|
void di_fw_can_cb_device_data(const struct di_can_msg *msg, struct di_can_ctx *ctx);
|
|
|
|
/**
|
|
* Sent an RAW reply on the connection request
|
|
* @param msg pointer to the message
|
|
* @param ctx pointer to the can context
|
|
*/
|
|
void di_fw_can_cb_raw_connection(const struct di_can_msg *msg, struct di_can_ctx *ctx);
|
|
|
|
/**
|
|
* Sent an RAW reply on the device:uid request
|
|
* @param msg pointer to the message
|
|
* @param ctx pointer to the can context
|
|
*/
|
|
void di_fw_can_cb_raw_device_uid(const struct di_can_msg *msg, struct di_can_ctx *ctx);
|
|
|
|
/**
|
|
* CAN RAW project:id request message handler based on libdi device token
|
|
* @param msg CAN request message
|
|
* @param ctx CAN context
|
|
*/
|
|
void di_fw_can_cb_raw_project_id(const struct di_can_msg *msg, struct di_can_ctx *ctx);
|
|
|
|
/**
|
|
* Sent an RAW reply on the cloudlight request
|
|
* @param msg pointer to the message
|
|
* @param ctx pointer to the can context
|
|
*/
|
|
void di_fw_can_cb_raw_cloudlight(const struct di_can_msg *msg, struct di_can_ctx *ctx);
|
|
|
|
/**
|
|
* Sent a RPC reply on the config:info request
|
|
* @param ctx pointer to the can context
|
|
* @param msg pointer to the message
|
|
*/
|
|
void di_fw_can_cb_config_info(const struct di_can_msg *msg, struct di_can_ctx *ctx);
|
|
|
|
/**
|
|
* Sent an empty RPC reply on the config:set request if successful
|
|
* Sent an error RPC reply on failure
|
|
* @param msg pointer to the message
|
|
* @param ctx pointer to the can context
|
|
*/
|
|
void di_fw_can_cb_config_set(const struct di_can_msg *msg, struct di_can_ctx *ctx);
|
|
|
|
/**
|
|
* Sent an RPC reply on known config:get request
|
|
* Sent an error RPC reply on unknown config:get request
|
|
* @param msg pointer to the message
|
|
* @param ctx pointer to the can context
|
|
*/
|
|
void di_fw_can_cb_config_get(const struct di_can_msg *msg, struct di_can_ctx *ctx);
|
|
|
|
/**
|
|
* Sent an empty RPC reply on the config:reset request if successful
|
|
* Sent an error RPC reply on failure
|
|
* @param msg pointer to the message
|
|
* @param ctx pointer to the can context
|
|
*/
|
|
void di_fw_can_cb_config_reset(const struct di_can_msg *msg, struct di_can_ctx *ctx);
|
|
|
|
/**
|
|
* Send CAN RPC device:info reply
|
|
*/
|
|
void di_fw_can_cb_device_info_send_reply(struct di_can_ctx *ctx, const struct di_can_msg *req,
|
|
const struct di_rpc_device_info *info);
|
|
|
|
/**
|
|
* RPC request handler for connection:info
|
|
* @param msg Request message
|
|
* @param ctx CAN-context
|
|
*/
|
|
void di_fw_can_cb_connection_info(const struct di_can_msg *msg, struct di_can_ctx *ctx);
|
|
|
|
#endif /* INCLUDE_DI_FW_CAN_CALLBACKS_H_ */
|