Classes | Typedefs | Functions
mip_dispatch_handler

This represents a binding between a MIP descriptor pair and a callback function. More...

Collaboration diagram for mip_dispatch_handler:

Classes

struct  mip_dispatch_handler
 Handler information for MIP Packet or Field callbacks. More...
 

Typedefs

typedef struct mip_dispatch_handler mip_dispatch_handler
 Handler information for MIP Packet or Field callbacks. More...
 

Functions

void mip_dispatch_handler_init_extractor (mip_dispatch_handler *handler, uint8_t descriptor_set, uint8_t field_descriptor, mip_dispatch_extractor extractor, void *field_ptr)
 Initialize the dispatch handler with an extraction callback. More...
 
void mip_dispatch_handler_init_field_handler (mip_dispatch_handler *handler, uint8_t descriptor_set, uint8_t field_descriptor, mip_dispatch_field_callback callback, void *context)
 Initialize the dispatch handler with a field callback. More...
 
void mip_dispatch_handler_init_packet_handler (mip_dispatch_handler *handler, uint8_t descriptor_set, bool after_fields, mip_dispatch_packet_callback callback, void *context)
 Initialize the dispatch handler with a packet callback. More...
 
bool mip_dispatch_handler_is_enabled (mip_dispatch_handler *handler)
 Determines if the handler is currently enabled. More...
 
void mip_dispatch_handler_set_enabled (mip_dispatch_handler *handler, bool enable)
 Enables or disables the handler. More...
 

Detailed Description

This represents a binding between a MIP descriptor pair and a callback function.

This object must be valid for the duration of its registration in a mip_dispatcher. It cannot be reinitialized while registered.

Note
This should be considered an "opaque" structure; its members should be considered an internal implementation detail. Avoid accessing them directly as they are subject to change in future versions of this software.

Typedef Documentation

◆ mip_dispatch_handler

Handler information for MIP Packet or Field callbacks.

Function Documentation

◆ mip_dispatch_handler_init_extractor()

void mip_dispatch_handler_init_extractor ( mip_dispatch_handler handler,
uint8_t  descriptor_set,
uint8_t  field_descriptor,
mip_dispatch_extractor  extractor,
void *  field_ptr 
)

Initialize the dispatch handler with an extraction callback.

Use this function to automatically populate your data structures with data as it arrives. This avoids the need to implement a switch/case or lots of duplicated code to handle extraction of various data quantities.

Parameters
handler
descriptor_setThe callback will only be invoked for fields belonging to this descriptor set. It must match the descriptor set corresponding to the extract function and object pointed to by field_ptr. This may be MIP_DISPATCH_ANY_DATA_SET if the field descriptor is from the shared data region.
field_descriptorThe callback will only be invoked for fields of this field descriptor. It must match the field descriptor corresponding to the extract function and object pointed to by field_ptr.
extractorThe extraction callback function. This is one of the functions in the definitions/data_*.h files with the name extract_<field-type>_from_field.
field_ptrA pointer to the data structure corresponding to the field type handled by the callback function. Cannot be NULL.
Warning
The type of field_ptr must match what the callback function expects. Otherwise, the behavior is undefined and your program may experience memory corruption or process crash.

Definition at line 129 of file mip_dispatch.c.

◆ mip_dispatch_handler_init_field_handler()

void mip_dispatch_handler_init_field_handler ( mip_dispatch_handler handler,
uint8_t  descriptor_set,
uint8_t  field_descriptor,
mip_dispatch_field_callback  callback,
void *  user_data 
)

Initialize the dispatch handler with a field callback.

Fields which match both the descriptor set and field descriptor will cause the callback function to be executed.

Parameters
handler
descriptor_setThe callback will only be invoked for fields belonging to this descriptor set. Can be MIP_DISPATCH_ANY_DESCRIPTOR to match any packet, or MIP_DISPATCH_ANY_DATA_SET to match only data packets.
field_descriptorThe callback will only be invoked for fields of this field descriptor. It can be MIP_DISPATCH_ANY_DESCRIPTOR to select all field descriptors.
callbackThe callback function.
user_dataAny pointer the user wants to pass into the callback.

Definition at line 84 of file mip_dispatch.c.

◆ mip_dispatch_handler_init_packet_handler()

void mip_dispatch_handler_init_packet_handler ( mip_dispatch_handler handler,
uint8_t  descriptor_set,
bool  post_callback,
mip_dispatch_packet_callback  callback,
void *  user_data 
)

Initialize the dispatch handler with a packet callback.

Packets which match the descriptor set will cause the callback to be executed.

Parameters
handler
descriptor_setThe callback will only be invoked for fields belonging to this descriptor set. Can be MIP_DISPATCH_ANY_DESCRIPTOR to match any packet, or MIP_DISPATCH_ANY_DATA_SET to match only data packets.
post_callbackIf false, the callback is called before any field callbacks from the same packet. If true, the callback is called after field callbacks.
callbackThe callback function.
user_dataAny pointer the user wants to pass into the callback.

Definition at line 49 of file mip_dispatch.c.

◆ mip_dispatch_handler_is_enabled()

bool mip_dispatch_handler_is_enabled ( mip_dispatch_handler handler)

Determines if the handler is currently enabled.

Returns
true if the handler is enabled, false otherwise.

Definition at line 164 of file mip_dispatch.c.

◆ mip_dispatch_handler_set_enabled()

void mip_dispatch_handler_set_enabled ( mip_dispatch_handler handler,
bool  enable 
)

Enables or disables the handler.

Parameters
handler
enableIf true, the callback is enabled. If false, it will not be called.

Definition at line 154 of file mip_dispatch.c.



microstrain_inertial_driver
Author(s): Brian Bingham, Parker Hannifin Corp
autogenerated on Wed Mar 22 2023 02:35:07