80 lines
2.4 KiB
C
80 lines
2.4 KiB
C
#ifndef LIBDI_INCLUDE_DI_CAN_ZKL_H_
|
|
#define LIBDI_INCLUDE_DI_CAN_ZKL_H_
|
|
|
|
#include <stdbool.h>
|
|
#include <di/types.h>
|
|
#include <di/can/zkl/structures.h>
|
|
#include <di/constants/rpc/zklrc.h>
|
|
|
|
struct di_can_ctx;
|
|
struct di_can_msg;
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* Set the ZKL switch section state
|
|
* @param ctx CAN context
|
|
* @param nodeid CAN nodeid of the drive MCU
|
|
* @param section The section id
|
|
* @param state The section state
|
|
* @retval DNOK when section state is requested
|
|
*/
|
|
di_errno_t di_can_zkl_switch_set_section_state(struct di_can_ctx *ctx,
|
|
const enum di_can_zkl_section section, const bool state);
|
|
|
|
/**
|
|
* Get the ZKL switch sections state
|
|
* @param ctx CAN context
|
|
* @param nodeid CAN nodeid of the measurement MCU
|
|
* @param state Switch state
|
|
* @retval DNOK when section state is replied
|
|
*/
|
|
di_errno_t di_can_zkl_switch_get_section_state(struct di_can_ctx *ctx, struct di_can_zkl_switch_section_state *state);
|
|
|
|
/**
|
|
* Get the ZKL switch section batteries state
|
|
* @param ctx CAN context
|
|
* @param nodeid CAN nodeid of the measurement MCU
|
|
* @param state Switch state
|
|
* @retval DNOK when section state is replied
|
|
*/
|
|
di_errno_t di_can_zkl_switch_get_battery_section_state(struct di_can_ctx *ctx,
|
|
struct di_can_zkl_switch_section_state *state);
|
|
|
|
/**
|
|
* Serialize ZKL_SET_SECTION_STATE
|
|
*/
|
|
di_errno_t di_can_zkl_serialize_set_section_state(struct di_can_msg *msg,
|
|
const enum di_can_zkl_section section, const bool state);
|
|
|
|
/**
|
|
* Serialize ZKL_GET_SECTION_STATE, ZKL_GET_BATTERY_STATE data payload
|
|
*/
|
|
di_errno_t di_can_zkl_serialize_section_state(struct di_can_msg *msg,
|
|
const struct di_can_zkl_switch_section_state *section);
|
|
|
|
/**
|
|
* Deserialize ZKL_SET_SECTION_STATE message for Drive MCU
|
|
*/
|
|
di_errno_t di_can_zkl_deserialize_set_section_state(const struct di_can_msg *msg,
|
|
enum di_can_zkl_section *section, bool *state);
|
|
|
|
di_errno_t di_can_zkl_deserialize_keyswitch_state(const struct di_can_msg *msg,
|
|
enum di_rpc_zklrc_keyswitch_state *state);
|
|
|
|
di_errno_t di_can_zkl_deserialize_section_state(const struct di_can_msg *msg,
|
|
struct di_can_zkl_switch_section_state *state);
|
|
|
|
/**
|
|
* Deserialize ZKL_GET_TEMPERATURE message for Control MCU
|
|
*/
|
|
di_errno_t di_can_zkl_deserialize_temperature(const struct di_can_msg *msg, float *temperature);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* LIBDI_INCLUDE_DI_CAN_ZKL_H_ */
|