void * _user_pointer
Optional user-specified data pointer.
void mip_interface_set_max_packets_per_update(mip_interface *device, unsigned int max_packets)
Sets a limit on the number of packets which can be processed in one call to the mip_interface_receive...
bool mip_interface_start_command_packet(mip_interface *device, const mip_packet *packet, mip_pending_cmd *cmd)
Queues the command and sends the packet.
bool(* mip_update_callback)(struct mip_interface *device, timeout_type timeout)
Callback function typedef for custom update behavior.
void mip_interface_register_extractor(mip_interface *device, mip_dispatch_handler *handler, uint8_t descriptor_set, uint8_t field_descriptor, mip_dispatch_extractor callback, void *field_ptr)
Registers a callback for packets of the specified descriptor set.
void mip_interface_register_field_callback(mip_interface *device, mip_dispatch_handler *handler, uint8_t descriptor_set, uint8_t field_descriptor, mip_dispatch_field_callback callback, void *user_data)
Registers a callback for packets of the specified descriptor set.
bool mip_interface_recv_from_device(mip_interface *device, uint8_t *buffer, size_t max_length, timeout_type timeout, size_t *length_out, timestamp_type *now)
Checks for data at the port and reads it into buffer.
mip_recv_callback mip_interface_recv_function(const mip_interface *device)
Gets the receive function pointer.
Holds the state of the MIP dispatch system.
bool(* mip_recv_callback)(struct mip_interface *device, uint8_t *buffer, size_t max_length, timeout_type wait_time, size_t *out_length, timestamp_type *timestamp_out)
Receives new data from the device.
enum mip_cmd_result mip_interface_wait_for_reply(mip_interface *device, mip_pending_cmd *cmd)
Blocks until the pending command completes or times out.
Holds a list of pending commands.
mip_update_callback mip_interface_update_function(const mip_interface *device)
Gets the update function pointer.
bool(* mip_dispatch_extractor)(const mip_field *field, void *ptr)
Signature for extraction callbacks.
void mip_interface_init(mip_interface *device, uint8_t *parse_buffer, size_t parse_buffer_size, timeout_type parse_timeout, timeout_type base_reply_timeout, mip_send_callback send, mip_recv_callback recv, mip_update_callback update, void *user_pointer)
Initialize the mip_interface components.
bool mip_interface_parse_callback(void *device, const mip_packet *packet, timestamp_type timestamp)
Wrapper around mip_interface_receive_packet for use with mip_parser.
void mip_interface_receive_packet(mip_interface *device, const mip_packet *packet, timestamp_type timestamp)
Processes a pre-parsed packet for command replies and data.
void * mip_interface_user_pointer(const mip_interface *device)
Retrieves the pointer set by mip_interface_set_user_pointer().
unsigned int _max_update_pkts
Max number of MIP packets to parse at once.
void mip_interface_process_unparsed_packets(mip_interface *device)
Process more packets from the internal buffer.
void mip_interface_set_send_function(mip_interface *device, mip_send_callback function)
Sets the send callback function.
bool mip_interface_update(mip_interface *device, timeout_type wait_time)
Call to process data from the device.
mip_parser _parser
MIP Parser for incoming MIP packets.
void mip_interface_set_recv_function(mip_interface *device, mip_recv_callback function)
Sets the receive callback function.
mip_send_callback _send_callback
Optional function which is called to send raw bytes to the device.
remaining_count mip_interface_receive_bytes(mip_interface *device, const uint8_t *data, size_t length, timestamp_type timestamp)
Passes data from the device into the parser.
mip_cmd_queue _queue
Queue for checking command replies.
void(* mip_dispatch_packet_callback)(void *context, const mip_packet *packet, timestamp_type timestamp)
Signature for packet-level callbacks.
void mip_interface_set_update_function(mip_interface *device, mip_update_callback function)
Sets the update function.
timestamp_type timeout_type
mip_parser * mip_interface_parser(mip_interface *device)
Returns the MIP parser for the device.
bool mip_interface_default_update(mip_interface *device, timeout_type wait_time)
Polls the port for new data or command replies.
TF2SIMD_FORCE_INLINE tf2Scalar length(const Quaternion &q)
mip_cmd_result
Represents the status of a MIP command.
unsigned int mip_interface_max_packets_per_update(const mip_interface *device)
Returns the maximum number of packets to parser per update call.
Structure representing a MIP Packet.
mip_cmd_queue * mip_interface_cmd_queue(mip_interface *device)
Returns the commmand queue for the device.
mip_recv_callback _recv_callback
Optional function which is called to receive raw bytes from the device.
Represents a command awaiting a reply from the device.
Handler information for MIP Packet or Field callbacks.
bool mip_interface_send_to_device(mip_interface *device, const uint8_t *data, size_t length)
Sends data to the port (i.e.
uint8_t parse_buffer[1024]
State of the interface for communicating with a MIP device.
enum mip_cmd_result mip_interface_run_command_packet(mip_interface *device, const mip_packet *packet, mip_pending_cmd *cmd)
Similar to mip_interface_start_command_packet but waits for the command to complete.
mip_send_callback mip_interface_send_function(const mip_interface *device)
Gets the send function pointer.
int_least16_t remaining_count
void(* mip_dispatch_field_callback)(void *context, const mip_field *field, timestamp_type timestamp)
Signature for field-level callbacks.
bool(* mip_send_callback)(struct mip_interface *device, const uint8_t *data, size_t length)
Sends data to the port (i.e.
enum mip_cmd_result mip_interface_run_command_with_response(mip_interface *device, uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t *payload, uint8_t payload_length, uint8_t response_descriptor, uint8_t *response_data, uint8_t *response_length_inout)
Runs a command using a pre-serialized payload.
uint64_t timestamp_type
Type used for packet timestamps and timeouts.
struct mip_interface mip_interface
State of the interface for communicating with a MIP device.
void mip_interface_set_user_pointer(mip_interface *device, void *pointer)
Sets an optional user data pointer which can be retrieved later.
mip_dispatcher _dispatcher
Dispatcher for data callbacks.
mip_update_callback _update_callback
Optional function to call during updates.
enum mip_cmd_result mip_interface_run_command(mip_interface *device, uint8_t descriptor_set, uint8_t field_descriptor, const uint8_t *payload, uint8_t payload_length)
Runs a command using a pre-serialized payload.
void mip_interface_register_packet_callback(mip_interface *device, mip_dispatch_handler *handler, uint8_t descriptor_set, bool after_fields, mip_dispatch_packet_callback callback, void *user_data)
Registers a callback for packets of the specified descriptor set.