/** * @file di_fw/can/config.h * @brief CAN rpc message config class helpers * @copyright 2015 Dual Inventive Technology Centre B.V. */ #ifndef INCLUDE_DI_FW_CAN_CONFIG_H_ #define INCLUDE_DI_FW_CAN_CONFIG_H_ #include #include struct di_can_ctx; struct di_can_msg; struct di_rpc_data; /** * Validate if the mutation of 'config:set' for 'token' is allowed. It autmaticly sends the correct reply. * * Value (token) must be a uint32 (DNE_PROTO reply) * * When di_device_get_state == DI_DEVICE_STATE_ARMED * * token != current_token (DNE_OPDENIED reply) * * token == current_token (OK reply with empty result). It returns DNE_OPDENIED to the caller to indicate * no further processed is required (e.g selftest, storing persistent config option). * * When a device error is raised (DNE_OPDENIED) * @param ctx CAN context used for reply sending * @param d Deserialized 'config:set' params data * @param req Request which initiated the call (needed for sending an empty result) * @retval DNOK when mutation is valid, !DNOK when invalid (a CAN RPC reply is already send) */ di_errno_t di_fw_can_config_set_token_validate(struct di_can_ctx *ctx, const struct di_rpc_data *d, const struct di_can_msg *req); /** * Validate if the mutation of 'config:set' for 'activation' is allowed. It autmaticly sends the correct reply * when the mutation is no allowed. * * Value (activation) must be a boolean (DNE_PROTO reply) * * When di_device_get_state == DI_DEVICE_STATE_ACTIVE (OK reply with empty result). It returns DNE_OPDENIED to * the caller to indicate no further processed is required (e.g selftest, storing persistent config option). * * Disallow transition to "active" -> "armed" (DNE_OPDENIED reply). To deactivate a "config:reset" message is used. * * When one or more device errors are raised (DNE_OPDENIED reply) * @param activate[out] The activation state * @param ctx CAN context used for reply sending * @param d Deserialized 'config:set' params data * @retval DNOK when mutation is valid, !DNOK when invalid (a CAN RPC reply is already send) */ di_errno_t di_fw_can_config_set_activation_validate(struct di_can_ctx *ctx, const struct di_rpc_data *d, const struct di_can_msg *req); #endif /* INCLUDE_DI_FW_CAN_CONFIG_H_ */