void aecp_controller_state_machine::state_timeout(uint32_t inflight_cmd_index)
    {
        struct jdksavdecc_frame frame = inflight_cmds.at(inflight_cmd_index).frame();
        bool is_retried = inflight_cmds.at(inflight_cmd_index).retried();
        uint32_t notification_flag = inflight_cmds.at(inflight_cmd_index).notification_flag();

        if(is_retried)
        {
            jdksavdecc_eui64 id = jdksavdecc_common_control_header_get_stream_id(frame.payload, ETHER_HDR_SIZE);
            uint16_t cmd_type = jdksavdecc_aecpdu_aem_get_command_type(frame.payload, ETHER_HDR_SIZE );
            cmd_type &= 0x7FFF;
            uint16_t desc_type = jdksavdecc_aem_command_read_descriptor_get_descriptor_type(frame.payload, ETHER_HDR_SIZE);
            uint16_t desc_index = jdksavdecc_aem_command_read_descriptor_get_descriptor_index(frame.payload, ETHER_HDR_SIZE);
            
            notification_imp_ref->post_notification_msg(COMMAND_TIMEOUT,
                                                        jdksavdecc_uint64_get(&id, 0),
                                                        cmd_type,
                                                        desc_type,
                                                        desc_index,
                                                        UINT_MAX,
                                                        inflight_cmds.at(inflight_cmd_index).cmd_notification_id);

            log_imp_ref->post_log_msg(LOGGING_LEVEL_ERROR,
                                      "Command Timeout, 0x%llx, %s, %s, %d, %d",
                                      jdksavdecc_uint64_get(&id, 0),
                                      utility::aem_cmd_value_to_name(cmd_type),
                                      utility::aem_desc_value_to_name(desc_type),
                                      desc_index,
                                      inflight_cmds.at(inflight_cmd_index).cmd_seq_id);

            inflight_cmds.erase(inflight_cmds.begin() + inflight_cmd_index);
        }
        else
        {
            log_imp_ref->post_log_msg(LOGGING_LEVEL_DEBUG,
                                      "Resend the command with sequence id = %d",
                                      inflight_cmds.at(inflight_cmd_index).cmd_seq_id);

            tx_cmd(inflight_cmds.at(inflight_cmd_index).cmd_notification_id,
                   notification_flag,
                   &frame,
                   true);
        }
    }
    void acmp_controller_state_machine::state_timeout(uint32_t inflight_cmd_index)
    {
        struct jdksavdecc_frame frame = inflight_cmds.at(inflight_cmd_index).frame();
        bool is_retried = inflight_cmds.at(inflight_cmd_index).retried();

        if(is_retried)
        {
            struct jdksavdecc_eui64 _end_station_entity_id = jdksavdecc_acmpdu_get_listener_entity_id(frame.payload, ETHER_HDR_SIZE);
            uint64_t end_station_entity_id = jdksavdecc_uint64_get(&_end_station_entity_id, 0);
            uint32_t msg_type = jdksavdecc_common_control_header_get_control_data(frame.payload, ETHER_HDR_SIZE);

            notification_imp_ref->post_notification_msg(RESPONSE_RECEIVED,
                                                        end_station_entity_id,
                                                        (uint16_t)msg_type + CMD_LOOKUP,
                                                        0,
                                                        0,
                                                        UINT_MAX,
                                                        inflight_cmds.at(inflight_cmd_index).cmd_notification_id);

            log_imp_ref->post_log_msg(LOGGING_LEVEL_ERROR,
                                      "Command Timeout, 0x%llx, %s, %s, %s, %d",
                                      end_station_entity_id,
                                      utility->acmp_cmd_value_to_name(msg_type),
                                      "NULL",
                                      "NULL",
                                      inflight_cmds.at(inflight_cmd_index).cmd_seq_id);

            inflight_cmds.erase(inflight_cmds.begin() + inflight_cmd_index);
        }
        else
        {
            log_imp_ref->post_log_msg(LOGGING_LEVEL_DEBUG,
                                      "Resend the command with sequence id = %d",
                                      inflight_cmds.at(inflight_cmd_index).cmd_seq_id);
           
            tx_cmd(inflight_cmds.at(inflight_cmd_index).cmd_notification_id,
                   inflight_cmds.at(inflight_cmd_index).notification_flag(),
                   &frame,
                   true);
        }
    }
 int aecp_controller_state_machine::state_send_cmd(void *notification_id, uint32_t notification_flag, struct jdksavdecc_frame *cmd_frame)
 {
    return tx_cmd(notification_id, notification_flag, cmd_frame, false);
 }