mip_dispatch.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "mip_types.h"
4 #include "mip_field.h"
5 #include "mip_packet.h"
7 
8 #include <stdbool.h>
9 
10 
11 #ifdef __cplusplus
12 namespace mip {
13 namespace C {
14 #endif
15 
16 
20 
21 
28 
29 
30 
38 typedef void (*mip_dispatch_packet_callback)(void* context, const mip_packet* packet, mip_timestamp timestamp);
39 
47 typedef void (*mip_dispatch_field_callback )(void* context, const mip_field* field, mip_timestamp timestamp);
48 
55 typedef bool (*mip_dispatch_extractor)(const mip_field* field, void* ptr);
56 
57 
58 enum {
64 
68 };
69 
84 
87 typedef struct mip_dispatch_handler
88 {
90  union
91  {
95  };
96  void* _user_data;
97  uint8_t _type;
98  uint8_t _descriptor_set;
100  uint8_t _enabled;
102 
103 
104 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);
105 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);
106 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);
107 
108 void mip_dispatch_handler_set_enabled(mip_dispatch_handler* handler, bool enable);
110 
111 
117 
118 
121 typedef struct mip_dispatcher
122 {
125 
126 
131 
132 void mip_dispatcher_dispatch_packet(mip_dispatcher* self, const mip_packet* packet, mip_timestamp timestamp);
133 
138 
139 
140 #ifdef __cplusplus
141 } // namespace C
142 } // namespace mip
143 #endif
mip_packet.h
mip_dispatch_handler::_extract_callback
mip_dispatch_extractor _extract_callback
User callback for data fields. Valid if _type is MIP_DISPATCH_TYPE_EXTRACT.
Definition: mip_dispatch.h:94
mip
Definition: ping.cpp:12
mip_dispatch_handler_init_packet_handler
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.
Definition: mip_dispatch.c:49
mip_dispatch_packet_callback
void(* mip_dispatch_packet_callback)(void *context, const mip_packet *packet, mip_timestamp timestamp)
Signature for packet-level callbacks.
Definition: mip_dispatch.h:38
mip_dispatch_handler::_user_data
void * _user_data
User-provided pointer which is passed directly to the callback.
Definition: mip_dispatch.h:96
mip_types.h
mip_dispatch_handler
struct mip_dispatch_handler mip_dispatch_handler
Handler information for MIP Packet or Field callbacks.
mip_dispatch_handler::_field_descriptor
uint8_t _field_descriptor
MIP field descriptor for this callback. If 0x00, the callback is a packet callback.
Definition: mip_dispatch.h:99
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 *context)
Initialize the dispatch handler with a field callback.
Definition: mip_dispatch.c:84
mip_dispatcher_dispatch_packet
void mip_dispatcher_dispatch_packet(mip_dispatcher *self, const mip_packet *packet, mip_timestamp timestamp)
Called to dispatch the callbacks for a given packet.
Definition: mip_dispatch.c:351
mip_dispatch_extractor
bool(* mip_dispatch_extractor)(const mip_field *field, void *ptr)
Signature for extraction callbacks.
Definition: mip_dispatch.h:55
MIP_DISPATCH_ANY_DATA_SET
@ MIP_DISPATCH_ANY_DATA_SET
Wildcard descriptor set which only includes data packets.
Definition: mip_dispatch.h:63
mip_dispatch_handler::_packet_callback
mip_dispatch_packet_callback _packet_callback
User function for packets. Valid if type is MIP_DISPATCH_TYPE_PACKET*.
Definition: mip_dispatch.h:92
MIP_DISPATCH_ANY_DESCRIPTOR
@ MIP_DISPATCH_ANY_DESCRIPTOR
Any descriptor set or field descriptor.
Definition: mip_dispatch.h:67
mip_dispatch_handler::_field_callback
mip_dispatch_field_callback _field_callback
User callback for data fields. Valid if _type is MIP_DISPATCH_TYPE_FIELD.
Definition: mip_dispatch.h:93
mip_dispatcher_add_handler
void mip_dispatcher_add_handler(mip_dispatcher *self, mip_dispatch_handler *handler)
Registers a handler in the dispatch system.
Definition: mip_dispatch.c:187
mip_dispatcher_remove_handler
void mip_dispatcher_remove_handler(mip_dispatcher *self, mip_dispatch_handler *handler)
Removes a handler from the dispatch system.
Definition: mip_dispatch.c:208
mip_dispatcher::_first_handler
mip_dispatch_handler * _first_handler
Pointer to the first dispatch handler. May be NULL.
Definition: mip_dispatch.h:123
mip_dispatch_handler::_descriptor_set
uint8_t _descriptor_set
MIP descriptor set for this callback.
Definition: mip_dispatch.h:98
mip_dispatch_handler_is_enabled
bool mip_dispatch_handler_is_enabled(mip_dispatch_handler *handler)
Determines if the handler is currently enabled.
Definition: mip_dispatch.c:164
mip_field
A structure representing a MIP field.
Definition: mip_field.h:52
mip_dispatcher
struct mip_dispatcher mip_dispatcher
Holds the state of the MIP dispatch system.
mip_timestamp
uint64_t mip_timestamp
Type used for packet timestamps and timeouts.
Definition: mip_types.h:32
mip_dispatch_handler::_next
struct mip_dispatch_handler * _next
Pointer to the next handler in the list.
Definition: mip_dispatch.h:89
mip_dispatch_handler_set_enabled
void mip_dispatch_handler_set_enabled(mip_dispatch_handler *handler, bool enable)
Enables or disables the handler.
Definition: mip_dispatch.c:154
mip_field.h
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.
Definition: mip_dispatch.c:129
mip_dispatch_handler
Handler information for MIP Packet or Field callbacks.
Definition: mip_dispatch.h:87
mip_dispatch_handler::_enabled
uint8_t _enabled
If false, the handler will be ignored. (Using u8 for better struct packing.)
Definition: mip_dispatch.h:100
descriptors.h
mip_dispatcher_remove_all_handlers
void mip_dispatcher_remove_all_handlers(mip_dispatcher *self)
Removes all handlers from the dispatcher.
Definition: mip_dispatch.c:237
mip_packet
Structure representing a MIP Packet.
Definition: mip_packet.h:41
mip_dispatch_field_callback
void(* mip_dispatch_field_callback)(void *context, const mip_field *field, mip_timestamp timestamp)
Signature for field-level callbacks.
Definition: mip_dispatch.h:47
mip_dispatcher_init
void mip_dispatcher_init(mip_dispatcher *self)
Initializes the mip_dispatcher object.
Definition: mip_dispatch.c:176
mip_dispatch_handler::_type
uint8_t _type
Type of the callback. (Using u8 for better struct packing.)
Definition: mip_dispatch.h:97
mip_dispatcher
Holds the state of the MIP dispatch system.
Definition: mip_dispatch.h:121


microstrain_inertial_driver
Author(s): Brian Bingham, Parker Hannifin Corp
autogenerated on Mon Jun 24 2024 02:51:40