/* Generated ActuatorFD wire codecs. Spec SHA-256: c8b7736cbd0e5225e8ed78790c3b3191ae08096323ec087c59f0ffc017c6db46 */
#ifndef ACTUATOR_FD_H
#define ACTUATOR_FD_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#define AFD_MAJOR 1u
#define AFD_MINOR 0u
typedef struct { uint8_t priority, service, source, destination, major; } afd_identifier_t;
bool afd_encode_identifier(uint32_t priority, uint32_t service, uint32_t source, uint32_t destination, uint32_t *out);
bool afd_decode_identifier(uint32_t value, afd_identifier_t *out);
#define AFD_EMERGENCY_DISABLE_SERVICE 0u
#define AFD_EMERGENCY_DISABLE_PRIORITY 0u
#define AFD_EMERGENCY_DISABLE_PAYLOAD_SIZE 4u
#define AFD_EMERGENCY_DISABLE_WIRE_SIZE 4u
typedef struct {
    uint32_t reason;
} afd_emergency_disable_t;
bool afd_encode_emergency_disable(const afd_emergency_disable_t *value, uint8_t *out, size_t length);
bool afd_decode_emergency_disable(const uint8_t *data, size_t length, afd_emergency_disable_t *out);
#define AFD_FAULT_SERVICE 1u
#define AFD_FAULT_PRIORITY 1u
#define AFD_FAULT_PAYLOAD_SIZE 20u
#define AFD_FAULT_WIRE_SIZE 20u
typedef struct {
    uint32_t session;
    uint32_t sequence;
    uint32_t fault_bits;
    uint32_t latched_bits;
    uint32_t time_us;
} afd_fault_t;
bool afd_encode_fault(const afd_fault_t *value, uint8_t *out, size_t length);
bool afd_decode_fault(const uint8_t *data, size_t length, afd_fault_t *out);
#define AFD_SYNC_SERVICE 2u
#define AFD_SYNC_PRIORITY 2u
#define AFD_SYNC_PAYLOAD_SIZE 12u
#define AFD_SYNC_WIRE_SIZE 12u
typedef struct {
    uint32_t session;
    uint32_t time_us;
    uint32_t cycle;
} afd_sync_t;
bool afd_encode_sync(const afd_sync_t *value, uint8_t *out, size_t length);
bool afd_decode_sync(const uint8_t *data, size_t length, afd_sync_t *out);
#define AFD_COMMAND_SERVICE 3u
#define AFD_COMMAND_PRIORITY 3u
#define AFD_COMMAND_PAYLOAD_SIZE 38u
#define AFD_COMMAND_WIRE_SIZE 48u
typedef struct {
    uint32_t session;
    uint32_t sequence;
    uint32_t execute_us;
    uint32_t valid_until_us;
    float position_rad;
    float velocity_rad_s;
    float feedforward_nm;
    float kp_nm_rad;
    float kd_nm_s_rad;
    uint8_t mode;
    uint8_t flags;
} afd_command_t;
bool afd_encode_command(const afd_command_t *value, uint8_t *out, size_t length);
bool afd_decode_command(const uint8_t *data, size_t length, afd_command_t *out);
#define AFD_STATE_SERVICE 4u
#define AFD_STATE_PRIORITY 4u
#define AFD_STATE_PAYLOAD_SIZE 40u
#define AFD_STATE_WIRE_SIZE 48u
typedef struct {
    uint32_t session;
    uint32_t sequence;
    uint32_t time_us;
    float output_position_rad;
    float motor_position_rad;
    float velocity_rad_s;
    float iq_a;
    float estimated_torque_nm;
    float temperature_c;
    uint32_t fault_bits;
} afd_state_t;
bool afd_encode_state(const afd_state_t *value, uint8_t *out, size_t length);
bool afd_decode_state(const uint8_t *data, size_t length, afd_state_t *out);
#define AFD_HEALTH_SERVICE 5u
#define AFD_HEALTH_PRIORITY 5u
#define AFD_HEALTH_PAYLOAD_SIZE 33u
#define AFD_HEALTH_WIRE_SIZE 48u
typedef struct {
    uint32_t session;
    uint32_t sequence;
    float bus_voltage_v;
    float winding_temperature_c;
    float inverter_temperature_c;
    uint32_t uptime_ms;
    uint32_t rx_errors;
    uint32_t tx_errors;
    uint8_t mode;
} afd_health_t;
bool afd_encode_health(const afd_health_t *value, uint8_t *out, size_t length);
bool afd_decode_health(const uint8_t *data, size_t length, afd_health_t *out);
#define AFD_DISCOVER_SERVICE 16u
#define AFD_DISCOVER_PRIORITY 6u
#define AFD_DISCOVER_PAYLOAD_SIZE 10u
#define AFD_DISCOVER_WIRE_SIZE 12u
typedef struct {
    uint32_t nonce;
    uint16_t slot_count;
    uint32_t slot_duration_us;
} afd_discover_t;
bool afd_encode_discover(const afd_discover_t *value, uint8_t *out, size_t length);
bool afd_decode_discover(const uint8_t *data, size_t length, afd_discover_t *out);
#define AFD_IDENTITY_SERVICE 17u
#define AFD_IDENTITY_PRIORITY 6u
#define AFD_IDENTITY_PAYLOAD_SIZE 27u
#define AFD_IDENTITY_WIRE_SIZE 32u
typedef struct {
    uint32_t nonce;
    uint8_t unique_id[16];
    uint16_t hardware_revision;
    uint32_t firmware_version;
    uint8_t node_id;
} afd_identity_t;
bool afd_encode_identity(const afd_identity_t *value, uint8_t *out, size_t length);
bool afd_decode_identity(const uint8_t *data, size_t length, afd_identity_t *out);
#define AFD_ASSIGN_ADDRESS_SERVICE 18u
#define AFD_ASSIGN_ADDRESS_PRIORITY 6u
#define AFD_ASSIGN_ADDRESS_PAYLOAD_SIZE 21u
#define AFD_ASSIGN_ADDRESS_WIRE_SIZE 24u
typedef struct {
    uint32_t nonce;
    uint8_t unique_id[16];
    uint8_t node_id;
} afd_assign_address_t;
bool afd_encode_assign_address(const afd_assign_address_t *value, uint8_t *out, size_t length);
bool afd_decode_assign_address(const uint8_t *data, size_t length, afd_assign_address_t *out);
#define AFD_CAPABILITIES_SERVICE 19u
#define AFD_CAPABILITIES_PRIORITY 6u
#define AFD_CAPABILITIES_PAYLOAD_SIZE 26u
#define AFD_CAPABILITIES_WIRE_SIZE 32u
typedef struct {
    uint16_t protocol_minor;
    uint32_t capability_bits;
    float continuous_torque_nm;
    float peak_torque_nm;
    float maximum_velocity_rad_s;
    uint32_t watchdog_us;
    uint32_t encoder_status;
} afd_capabilities_t;
bool afd_encode_capabilities(const afd_capabilities_t *value, uint8_t *out, size_t length);
bool afd_decode_capabilities(const uint8_t *data, size_t length, afd_capabilities_t *out);
#define AFD_SESSION_START_SERVICE 20u
#define AFD_SESSION_START_PRIORITY 6u
#define AFD_SESSION_START_PAYLOAD_SIZE 24u
#define AFD_SESSION_START_WIRE_SIZE 24u
typedef struct {
    uint32_t session;
    uint8_t unique_id[16];
    uint32_t watchdog_us;
} afd_session_start_t;
bool afd_encode_session_start(const afd_session_start_t *value, uint8_t *out, size_t length);
bool afd_decode_session_start(const uint8_t *data, size_t length, afd_session_start_t *out);
#define AFD_ACK_SERVICE 21u
#define AFD_ACK_PRIORITY 6u
#define AFD_ACK_PAYLOAD_SIZE 15u
#define AFD_ACK_WIRE_SIZE 16u
typedef struct {
    uint32_t session;
    uint32_t sequence;
    uint8_t request_service;
    uint16_t result;
    uint32_t detail;
} afd_ack_t;
bool afd_encode_ack(const afd_ack_t *value, uint8_t *out, size_t length);
bool afd_decode_ack(const uint8_t *data, size_t length, afd_ack_t *out);
#define AFD_CONFIGURE_SERVICE 32u
#define AFD_CONFIGURE_PRIORITY 7u
#define AFD_CONFIGURE_PAYLOAD_SIZE 43u
#define AFD_CONFIGURE_WIRE_SIZE 48u
typedef struct {
    uint32_t session;
    uint32_t sequence;
    uint16_t key;
    uint8_t operation;
    uint8_t value[32];
} afd_configure_t;
bool afd_encode_configure(const afd_configure_t *value, uint8_t *out, size_t length);
bool afd_decode_configure(const uint8_t *data, size_t length, afd_configure_t *out);
#define AFD_CALIBRATE_SERVICE 33u
#define AFD_CALIBRATE_PRIORITY 7u
#define AFD_CALIBRATE_PAYLOAD_SIZE 11u
#define AFD_CALIBRATE_WIRE_SIZE 12u
typedef struct {
    uint32_t session;
    uint32_t sequence;
    uint16_t routine;
    uint8_t operation;
} afd_calibrate_t;
bool afd_encode_calibrate(const afd_calibrate_t *value, uint8_t *out, size_t length);
bool afd_decode_calibrate(const uint8_t *data, size_t length, afd_calibrate_t *out);
#define AFD_CLEAR_FAULTS_SERVICE 34u
#define AFD_CLEAR_FAULTS_PRIORITY 7u
#define AFD_CLEAR_FAULTS_PAYLOAD_SIZE 12u
#define AFD_CLEAR_FAULTS_WIRE_SIZE 12u
typedef struct {
    uint32_t session;
    uint32_t sequence;
    uint32_t mask;
} afd_clear_faults_t;
bool afd_encode_clear_faults(const afd_clear_faults_t *value, uint8_t *out, size_t length);
bool afd_decode_clear_faults(const uint8_t *data, size_t length, afd_clear_faults_t *out);
#define AFD_FIRMWARE_BEGIN_SERVICE 48u
#define AFD_FIRMWARE_BEGIN_PRIORITY 7u
#define AFD_FIRMWARE_BEGIN_PAYLOAD_SIZE 45u
#define AFD_FIRMWARE_BEGIN_WIRE_SIZE 48u
typedef struct {
    uint32_t session;
    uint32_t sequence;
    uint32_t image_bytes;
    uint8_t image_sha256[32];
    uint8_t target_slot;
} afd_firmware_begin_t;
bool afd_encode_firmware_begin(const afd_firmware_begin_t *value, uint8_t *out, size_t length);
bool afd_decode_firmware_begin(const uint8_t *data, size_t length, afd_firmware_begin_t *out);
#define AFD_FIRMWARE_CHUNK_SERVICE 49u
#define AFD_FIRMWARE_CHUNK_PRIORITY 7u
#define AFD_FIRMWARE_CHUNK_PAYLOAD_SIZE 45u
#define AFD_FIRMWARE_CHUNK_WIRE_SIZE 48u
typedef struct {
    uint32_t session;
    uint32_t sequence;
    uint32_t offset;
    uint8_t valid_bytes;
    uint8_t data[32];
} afd_firmware_chunk_t;
bool afd_encode_firmware_chunk(const afd_firmware_chunk_t *value, uint8_t *out, size_t length);
bool afd_decode_firmware_chunk(const uint8_t *data, size_t length, afd_firmware_chunk_t *out);
#define AFD_FIRMWARE_COMMIT_SERVICE 50u
#define AFD_FIRMWARE_COMMIT_PRIORITY 7u
#define AFD_FIRMWARE_COMMIT_PAYLOAD_SIZE 40u
#define AFD_FIRMWARE_COMMIT_WIRE_SIZE 48u
typedef struct {
    uint32_t session;
    uint32_t sequence;
    uint8_t image_sha256[32];
} afd_firmware_commit_t;
bool afd_encode_firmware_commit(const afd_firmware_commit_t *value, uint8_t *out, size_t length);
bool afd_decode_firmware_commit(const uint8_t *data, size_t length, afd_firmware_commit_t *out);
#define AFD_ENABLE_SERVICE 35u
#define AFD_ENABLE_PRIORITY 3u
#define AFD_ENABLE_PAYLOAD_SIZE 9u
#define AFD_ENABLE_WIRE_SIZE 12u
typedef struct {
    uint32_t session;
    uint32_t sequence;
    uint8_t enabled;
} afd_enable_t;
bool afd_encode_enable(const afd_enable_t *value, uint8_t *out, size_t length);
bool afd_decode_enable(const uint8_t *data, size_t length, afd_enable_t *out);
#endif
