MIP_SDK
v3.0.0
MicroStrain Communications Library for embedded systems
|
This represents a binding between a MIP descriptor pair and a callback function. More...
Classes | |
struct | mip::C::mip_dispatch_handler |
Handler information for MIP Packet or Field callbacks. More... | |
Typedefs | |
typedef struct mip::C::mip_dispatch_handler | mip::C::mip_dispatch_handler |
Handler information for MIP Packet or Field callbacks. More... | |
Functions | |
void | mip::C::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. More... | |
void | mip::C::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. More... | |
void | mip::C::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::C::mip_dispatch_handler_set_enabled (mip_dispatch_handler *handler, bool enable) |
Enables or disables the handler. More... | |
bool | mip::C::mip_dispatch_handler_is_enabled (mip_dispatch_handler *handler) |
Determines if the handler is currently enabled. More... | |
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.
typedef struct mip::C::mip_dispatch_handler mip::C::mip_dispatch_handler |
Handler information for MIP Packet or Field callbacks.
void mip::C::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.
handler | |
descriptor_set | The 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_descriptor | The 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. |
extractor | The extraction callback function. This is one of the functions in the definitions/data_*.h files with the name extract_<field-type>_from_field . |
field_ptr | A pointer to the data structure corresponding to the field type handled by the callback function. Cannot be NULL. |
void mip::C::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.
handler | |
descriptor_set | The 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_descriptor | The callback will only be invoked for fields of this field descriptor. It can be MIP_DISPATCH_ANY_DESCRIPTOR to select all field descriptors. |
callback | The callback function. |
user_data | Any pointer the user wants to pass into the callback. |
void mip::C::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.
handler | |
descriptor_set | The 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_callback | If false, the callback is called before any field callbacks from the same packet. If true, the callback is called after field callbacks. |
callback | The callback function. |
user_data | Any pointer the user wants to pass into the callback. |
bool mip::C::mip_dispatch_handler_is_enabled | ( | mip_dispatch_handler * | handler | ) |
Determines if the handler is currently enabled.
void mip::C::mip_dispatch_handler_set_enabled | ( | mip_dispatch_handler * | handler, |
bool | enable | ||
) |
Enables or disables the handler.
handler | |
enable | If true, the callback is enabled. If false, it will not be called. |