Go to the source code of this file.
Classes | |
struct | broadcast_msg_t |
struct | com_manager_init_t |
struct | com_manager_port_t |
struct | com_manager_status_t |
struct | com_manager_t |
struct | ensured_pkt_t |
struct | registered_data_t |
Macros | |
#define | COM_MANAGER_BUF_SIZE_BCAST_MSG(max_num_bcast_msgs) ((max_num_bcast_msgs)*sizeof(broadcast_msg_t)) |
#define | COM_MANAGER_BUF_SIZE_ENSURED_PKTS(max_num_ensured_pkts) ((max_num_ensured_pkts)*sizeof(ensured_pkt_t)) |
#define | ENABLE_PACKET_CONTINUATION 0 |
#define | MAX_NUM_BCAST_MSGS 4 |
Typedefs | |
typedef void * | CMHANDLE |
typedef int(* | pfnComManagerAsapMsg) (CMHANDLE cmHandle, int pHandle, p_data_get_t *req) |
typedef void(* | pfnComManagerDisableBroadcasts) (CMHANDLE cmHandle, int pHandle) |
typedef int(* | pfnComManagerGenMsgHandler) (CMHANDLE cmHandle, int pHandle, const unsigned char *msg, int msgSize) |
typedef void(* | pfnComManagerPostAck) (CMHANDLE cmHandle, int pHandle, p_ack_t *ack, unsigned char packetIdentifier) |
typedef void(* | pfnComManagerPostRead) (CMHANDLE cmHandle, int pHandle, p_data_t *dataRead) |
typedef int(* | pfnComManagerPreSend) (CMHANDLE cmHandle, int pHandle) |
typedef int(* | pfnComManagerRead) (CMHANDLE cmHandle, int pHandle, uint8_t *buffer, int numberOfBytes) |
typedef int(* | pfnComManagerSend) (CMHANDLE cmHandle, int pHandle, unsigned char *buffer, int numberOfBytes) |
typedef int(* | pfnComManagerSendBufferAvailableBytes) (CMHANDLE cmHandle, int pHandle) |
Functions | |
void | comManagerAssignUserPointer (CMHANDLE cmInstance, void *userPointer) |
void | comManagerDisableBroadcasts (int pHandle) |
void | comManagerDisableBroadcastsInstance (CMHANDLE cmInstance, int pHandle) |
int | comManagerDisableData (int pHandle, uint32_t dataId) |
int | comManagerDisableDataInstance (CMHANDLE cmInstance, int pHandle, uint32_t dataId) |
void | comManagerGetData (int pHandle, uint32_t dataId, int offset, int size, int periodMultiple) |
Request data This function requests the specified data w/ offset and length for partial reads. More... | |
void | comManagerGetDataInstance (CMHANDLE cmInstance, int pHandle, uint32_t dataId, int offset, int size, int periodMultiple) |
int | comManagerGetDataRequest (int pHandle, p_data_get_t *req) |
int | comManagerGetDataRequestInstance (CMHANDLE cmInstance, int pHandle, p_data_get_t *req) |
void | comManagerGetDataRmc (int pHandle, uint64_t rmcBits, uint32_t rmcOptions) |
void | comManagerGetDataRmcInstance (CMHANDLE cmInstance, int pHandle, uint64_t rmcBits, uint32_t rmcOptions) |
CMHANDLE | comManagerGetGlobal (void) |
bufTxRxPtr_t * | comManagerGetRegisteredDataInfo (uint32_t dataId) |
bufTxRxPtr_t * | comManagerGetRegisteredDataInfoInstance (CMHANDLE cmInstance, uint32_t dataId) |
com_manager_status_t * | comManagerGetStatus (int pHandle) |
com_manager_status_t * | comManagerGetStatusInstance (CMHANDLE cmInstance, int pHandle) |
void * | comManagerGetUserPointer (CMHANDLE cmInstance) |
int | comManagerInit (int numHandles, int maxEnsuredPackets, int stepPeriodMilliseconds, int retryCount, pfnComManagerRead readFnc, pfnComManagerSend sendFnc, pfnComManagerSendBufferAvailableBytes txFreeFnc, pfnComManagerPostRead pstRxFnc, pfnComManagerPostAck pstAckFnc, pfnComManagerDisableBroadcasts disableBcastFnc, com_manager_init_t *buffers, com_manager_port_t *cmPorts) |
int | comManagerInitInstance (CMHANDLE cmHandle, int numHandles, int maxEnsuredPackets, int stepPeriodMilliseconds, int retryCount, pfnComManagerRead readFnc, pfnComManagerSend sendFnc, pfnComManagerSendBufferAvailableBytes txFreeFnc, pfnComManagerPostRead pstRxFnc, pfnComManagerPostAck pstAckFnc, pfnComManagerDisableBroadcasts disableBcastFnc, com_manager_init_t *buffers, com_manager_port_t *cmPorts) |
void | comManagerRegister (uint32_t dataId, pfnComManagerPreSend txFnc, pfnComManagerPostRead pstRxFnc, const void *txDataPtr, void *rxDataPtr, int dataSize, uint8_t pktFlags) |
void | comManagerRegisterInstance (CMHANDLE cmInstance, uint32_t dataId, pfnComManagerPreSend txFnc, pfnComManagerPostRead pstRxFnc, const void *txDataPtr, void *rxDataPtr, int dataSize, uint8_t pktFlags) |
int | comManagerSend (int pHandle, uint8_t pktInfo, bufPtr_t *bodyHdr, bufPtr_t *txData, uint8_t pktFlags) |
int | comManagerSendData (int pHandle, uint32_t dataId, void *dataPtr, int dataSize, int dataOffset) |
int | comManagerSendDataInstance (CMHANDLE cmInstance, int pHandle, uint32_t dataId, void *dataPtr, int dataSize, int dataOffset) |
int | comManagerSendDataNoAck (int pHandle, uint32_t dataId, void *dataPtr, int dataSize, int dataOffset) |
int | comManagerSendDataNoAckInstance (CMHANDLE cmInstance, int pHandle, uint32_t dataId, void *dataPtr, int dataSize, int dataOffset) |
int | comManagerSendEnsured (int pHandle, uint8_t pktInfo, unsigned char *data, unsigned int dataSize) |
int | comManagerSendEnsuredInstance (CMHANDLE cmInstance, int pHandle, uint8_t pktInfo, unsigned char *data, unsigned int dataSize) |
int | comManagerSendInstance (CMHANDLE cmInstance, int pHandle, uint8_t pktInfo, bufPtr_t *bodyHdr, bufPtr_t *txData, uint8_t pktFlags) |
int | comManagerSendRawData (int pHandle, uint32_t dataId, void *dataPtr, int dataSize, int dataOffset) |
int | comManagerSendRawDataInstance (CMHANDLE cmInstance, int pHandle, uint32_t dataId, void *dataPtr, int dataSize, int dataOffset) |
void | comManagerSetCallbacks (pfnComManagerAsapMsg rmcHandler, pfnComManagerGenMsgHandler asciiHandler, pfnComManagerGenMsgHandler ubloxHandler, pfnComManagerGenMsgHandler rtcm3Handler) |
void | comManagerSetCallbacksInstance (CMHANDLE cmInstance, pfnComManagerAsapMsg rmcHandler, pfnComManagerGenMsgHandler asciiHandler, pfnComManagerGenMsgHandler ubloxHandler, pfnComManagerGenMsgHandler rtcm3Handler) |
void | comManagerStep (void) |
void | comManagerStepInstance (CMHANDLE cmInstance_) |
void | comManagerStepRxInstance (CMHANDLE cmInstance) |
void | comManagerStepTxInstance (CMHANDLE cmInstance) |
int | comManagerValidateBaudRate (unsigned int baudRate) |
#define COM_MANAGER_BUF_SIZE_BCAST_MSG | ( | max_num_bcast_msgs | ) | ((max_num_bcast_msgs)*sizeof(broadcast_msg_t)) |
Definition at line 115 of file com_manager.h.
#define COM_MANAGER_BUF_SIZE_ENSURED_PKTS | ( | max_num_ensured_pkts | ) | ((max_num_ensured_pkts)*sizeof(ensured_pkt_t)) |
Definition at line 116 of file com_manager.h.
#define ENABLE_PACKET_CONTINUATION 0 |
Definition at line 25 of file com_manager.h.
#define MAX_NUM_BCAST_MSGS 4 |
Maximum number of messages that may be broadcast simultaneously, per port. Since most messages use the RMC (real-time message controller) now, this can be fairly low
Definition at line 112 of file com_manager.h.
typedef void* CMHANDLE |
Definition at line 119 of file com_manager.h.
typedef int(* pfnComManagerAsapMsg) (CMHANDLE cmHandle, int pHandle, p_data_get_t *req) |
Definition at line 153 of file com_manager.h.
typedef void(* pfnComManagerDisableBroadcasts) (CMHANDLE cmHandle, int pHandle) |
Definition at line 138 of file com_manager.h.
typedef int(* pfnComManagerGenMsgHandler) (CMHANDLE cmHandle, int pHandle, const unsigned char *msg, int msgSize) |
Definition at line 147 of file com_manager.h.
typedef void(* pfnComManagerPostAck) (CMHANDLE cmHandle, int pHandle, p_ack_t *ack, unsigned char packetIdentifier) |
Definition at line 135 of file com_manager.h.
Definition at line 132 of file com_manager.h.
typedef int(* pfnComManagerPreSend) (CMHANDLE cmHandle, int pHandle) |
Definition at line 141 of file com_manager.h.
typedef int(* pfnComManagerRead) (CMHANDLE cmHandle, int pHandle, uint8_t *buffer, int numberOfBytes) |
Definition at line 123 of file com_manager.h.
typedef int(* pfnComManagerSend) (CMHANDLE cmHandle, int pHandle, unsigned char *buffer, int numberOfBytes) |
Definition at line 126 of file com_manager.h.
typedef int(* pfnComManagerSendBufferAvailableBytes) (CMHANDLE cmHandle, int pHandle) |
Definition at line 129 of file com_manager.h.
void comManagerAssignUserPointer | ( | CMHANDLE | cmInstance, |
void * | userPointer | ||
) |
Attach user defined data to a com manager instance
Definition at line 477 of file com_manager.c.
void comManagerDisableBroadcasts | ( | int | pHandle | ) |
Disables broadcasts of all messages on specified port, or all ports if phandle == -1.
pHandle | the pHandle to disable broadcasts on, -1 for all |
Definition at line 1057 of file com_manager.c.
void comManagerDisableBroadcastsInstance | ( | CMHANDLE | cmInstance, |
int | pHandle | ||
) |
Definition at line 1062 of file com_manager.c.
int comManagerDisableData | ( | int | pHandle, |
uint32_t | dataId | ||
) |
Disable a broadcast for a specified port handle and data identifier
pHandle | the port handle to disable a broadcast for |
dataId | the data id to disable boradcast for |
Example:
Definition at line 625 of file com_manager.c.
int comManagerDisableDataInstance | ( | CMHANDLE | cmInstance, |
int | pHandle, | ||
uint32_t | dataId | ||
) |
Definition at line 630 of file com_manager.c.
void comManagerGetData | ( | int | pHandle, |
uint32_t | dataId, | ||
int | offset, | ||
int | size, | ||
int | periodMultiple | ||
) |
Request data This function requests the specified data w/ offset and length for partial reads.
Make a request to a port handle to broadcast a piece of data at a set interval.
pHandle | the port handle to request broadcast data from |
dataId | the data id to broadcast |
offset | offset into the structure for the data id to broadcast - pass offset and size of 0 to receive the entire data set |
size | number of bytes in the data structure from offset to broadcast - pass offset and size of 0 to receive the entire data set |
periodMultiple | the data broadcast period in multiples of the base update period |
Example that makes a request to receive the device info just once:
Example that broadcasts INS data every 50 milliseconds:
[in] | dataId | Data structure ID |
[in] | offset | Byte offset into data structure. 0 = data start. |
[in] | length | Byte length of data. 0 = entire structure. |
[in] | periodMultiple | Broadcast period of requested data. 0 = single request. |
Definition at line 516 of file com_manager.c.
void comManagerGetDataInstance | ( | CMHANDLE | cmInstance, |
int | pHandle, | ||
uint32_t | dataId, | ||
int | offset, | ||
int | size, | ||
int | periodMultiple | ||
) |
Definition at line 521 of file com_manager.c.
int comManagerGetDataRequest | ( | int | pHandle, |
p_data_get_t * | req | ||
) |
Internal use mostly, process a get data request for a message that needs to be broadcasted
Definition at line 895 of file com_manager.c.
int comManagerGetDataRequestInstance | ( | CMHANDLE | cmInstance, |
int | pHandle, | ||
p_data_get_t * | req | ||
) |
Definition at line 900 of file com_manager.c.
void comManagerGetDataRmc | ( | int | pHandle, |
uint64_t | rmcBits, | ||
uint32_t | rmcOptions | ||
) |
Make a request to a port handle to broadcast a piece of data at a set interval.
pHandle | the port handle to request broadcast data from |
RMC | bits specifying data messages to stream. See presets: RMC_PRESET_PPD_BITS = post processing data, RMC_PRESET_INS_BITS = INS2 and GPS data at full rate |
RMC | options to enable data streaming on ports other than the current port. |
offset | offset into the structure for the data id to broadcast - pass offset and size of 0 to receive the entire data set |
size | number of bytes in the data structure from offset to broadcast - pass offset and size of 0 to receive the entire data set |
periodMultiple | the data broadcast period in multiples of the base update period |
Example that enables streaming of all data messages necessary for post processing:
Example that broadcasts INS and GPS data at full rate:
Definition at line 539 of file com_manager.c.
void comManagerGetDataRmcInstance | ( | CMHANDLE | cmInstance, |
int | pHandle, | ||
uint64_t | rmcBits, | ||
uint32_t | rmcOptions | ||
) |
Definition at line 544 of file com_manager.c.
CMHANDLE comManagerGetGlobal | ( | void | ) |
Definition at line 76 of file com_manager.c.
bufTxRxPtr_t* comManagerGetRegisteredDataInfo | ( | uint32_t | dataId | ) |
Internal use mostly, get data info for a the specified pre-registered dataId
Definition at line 878 of file com_manager.c.
bufTxRxPtr_t* comManagerGetRegisteredDataInfoInstance | ( | CMHANDLE | cmInstance, |
uint32_t | dataId | ||
) |
Definition at line 883 of file com_manager.c.
com_manager_status_t* comManagerGetStatus | ( | int | pHandle | ) |
Get the most recent status of the com manager
Definition at line 487 of file com_manager.c.
com_manager_status_t* comManagerGetStatusInstance | ( | CMHANDLE | cmInstance, |
int | pHandle | ||
) |
Definition at line 492 of file com_manager.c.
void* comManagerGetUserPointer | ( | CMHANDLE | cmInstance | ) |
Get user defined data to from a com manager instance
Definition at line 482 of file com_manager.c.
int comManagerInit | ( | int | numHandles, |
int | maxEnsuredPackets, | ||
int | stepPeriodMilliseconds, | ||
int | retryCount, | ||
pfnComManagerRead | readFnc, | ||
pfnComManagerSend | sendFnc, | ||
pfnComManagerSendBufferAvailableBytes | txFreeFnc, | ||
pfnComManagerPostRead | pstRxFnc, | ||
pfnComManagerPostAck | pstAckFnc, | ||
pfnComManagerDisableBroadcasts | disableBcastFnc, | ||
com_manager_init_t * | buffers, | ||
com_manager_port_t * | cmPorts | ||
) |
Initializes the default global com manager. This is generally only called once on program start. The global com manager is used by the functions that do not have the Instance suffix and first parameter of void* cmInstance. The instance functions can be ignored, unless you have a reason to have two com managers in the same process.
numHandles | the max number of serial ports possible |
maxEnsuredPackets | the max number of ensured packets |
stepPeriodMilliseconds | how many milliseconds you are waiting in between calls to comManagerStep |
retryCount | the number of times to retry failed packets |
readFnc | read data from the serial port represented by pHandle |
sendFnc | send data to the serial port represented by pHandle |
txFreeFnc | optional, return the number of free bytes in the send buffer for the serial port represented by pHandle |
pstRxFnc | optional, called after new data is available (successfully parsed and checksum passed) from the serial port represented by pHandle |
pstAckFnc | optional, called after an ACK is received by the serial port represented by pHandle |
disableBcastFnc | mostly for internal use, this can be left as 0 or NULL |
Example:
Definition at line 79 of file com_manager.c.
int comManagerInitInstance | ( | CMHANDLE | cmHandle, |
int | numHandles, | ||
int | maxEnsuredPackets, | ||
int | stepPeriodMilliseconds, | ||
int | retryCount, | ||
pfnComManagerRead | readFnc, | ||
pfnComManagerSend | sendFnc, | ||
pfnComManagerSendBufferAvailableBytes | txFreeFnc, | ||
pfnComManagerPostRead | pstRxFnc, | ||
pfnComManagerPostAck | pstAckFnc, | ||
pfnComManagerDisableBroadcasts | disableBcastFnc, | ||
com_manager_init_t * | buffers, | ||
com_manager_port_t * | cmPorts | ||
) |
Definition at line 111 of file com_manager.c.
void comManagerRegister | ( | uint32_t | dataId, |
pfnComManagerPreSend | txFnc, | ||
pfnComManagerPostRead | pstRxFnc, | ||
const void * | txDataPtr, | ||
void * | rxDataPtr, | ||
int | dataSize, | ||
uint8_t | pktFlags | ||
) |
Register message handling function for a received data id (binary). This is mostly an internal use function, but can be used if you are implementing your own receiver on a device.
dataId | the data id to register the handler for |
txFnc | called right before the data is sent |
pstRxFnc | called after data is received for the data id |
txDataPtr | a pointer to the structure in memory of the data to send |
rxDataPtr | a pointer to the structure in memory to copy received data to |
dataSize | size of the data structure in txDataPtr and rxDataPtr |
pktFlags | packet flags, usually 0 |
Example:
Definition at line 247 of file com_manager.c.
void comManagerRegisterInstance | ( | CMHANDLE | cmInstance, |
uint32_t | dataId, | ||
pfnComManagerPreSend | txFnc, | ||
pfnComManagerPostRead | pstRxFnc, | ||
const void * | txDataPtr, | ||
void * | rxDataPtr, | ||
int | dataSize, | ||
uint8_t | pktFlags | ||
) |
Definition at line 252 of file com_manager.c.
int comManagerSend | ( | int | pHandle, |
uint8_t | pktInfo, | ||
bufPtr_t * | bodyHdr, | ||
bufPtr_t * | txData, | ||
uint8_t | pktFlags | ||
) |
Send a packet to a port handle
pHandle | the port handle to send the packet to |
pktInfo | the type of packet (PID) |
bodyHdr | optional, can contain information about the actual data of the body (txData), usually the data id, offset and size |
txData | optional, the actual body of the packet |
Example:
Definition at line 639 of file com_manager.c.
int comManagerSendData | ( | int | pHandle, |
uint32_t | dataId, | ||
void * | dataPtr, | ||
int | dataSize, | ||
int | dataOffset | ||
) |
Convenience function that wraps comManagerSend for sending data structures. Must be multiple of 4 bytes in size.
pHandle | the port handle to send data to |
dataId | the data id of the data to send |
dataPtr | pointer to the data structure to send |
dataSize | number of bytes to send |
dataOffset | offset into dataPtr to send at |
Example:
Definition at line 553 of file com_manager.c.
int comManagerSendDataInstance | ( | CMHANDLE | cmInstance, |
int | pHandle, | ||
uint32_t | dataId, | ||
void * | dataPtr, | ||
int | dataSize, | ||
int | dataOffset | ||
) |
Definition at line 558 of file com_manager.c.
int comManagerSendDataNoAck | ( | int | pHandle, |
uint32_t | dataId, | ||
void * | dataPtr, | ||
int | dataSize, | ||
int | dataOffset | ||
) |
Same as comManagerSend, except that no retry is attempted
pHandle | the port handle to send the packet to |
dataId | Data structure ID number. |
dataPtr | Pointer to actual data. |
dataSize | Size of data to send in number of bytes. |
dataOffset | Offset into data structure where copied data starts. |
pFlags | Additional packet flags if needed. |
Definition at line 577 of file com_manager.c.
int comManagerSendDataNoAckInstance | ( | CMHANDLE | cmInstance, |
int | pHandle, | ||
uint32_t | dataId, | ||
void * | dataPtr, | ||
int | dataSize, | ||
int | dataOffset | ||
) |
Definition at line 582 of file com_manager.c.
int comManagerSendEnsured | ( | int | pHandle, |
uint8_t | pktInfo, | ||
unsigned char * | data, | ||
unsigned int | dataSize | ||
) |
Same as comManagerSend, except that the com manager may retry the send if an ACK is not received
pHandle | the port handle to send the packet to |
pktInfo | the type of packet (PID) |
bodyHdr | optional, can contain information about the actual data of the body (txData), usually the data id, offset and size |
txData | optional, the actual body of the packet |
Definition at line 665 of file com_manager.c.
int comManagerSendEnsuredInstance | ( | CMHANDLE | cmInstance, |
int | pHandle, | ||
uint8_t | pktInfo, | ||
unsigned char * | data, | ||
unsigned int | dataSize | ||
) |
Definition at line 670 of file com_manager.c.
int comManagerSendInstance | ( | CMHANDLE | cmInstance, |
int | pHandle, | ||
uint8_t | pktInfo, | ||
bufPtr_t * | bodyHdr, | ||
bufPtr_t * | txData, | ||
uint8_t | pktFlags | ||
) |
Definition at line 644 of file com_manager.c.
int comManagerSendRawData | ( | int | pHandle, |
uint32_t | dataId, | ||
void * | dataPtr, | ||
int | dataSize, | ||
int | dataOffset | ||
) |
Convenience function that wraps comManagerSend for sending data structures. Allows arbitrary bytes size, 4 byte multiple not required. No byte swapping occurs.
pHandle | the port handle to send data to |
dataId | the data id of the data to send |
dataPtr | pointer to the data structure to send |
dataSize | number of bytes to send |
dataOffset | offset into dataPtr to send at |
Example:
Definition at line 601 of file com_manager.c.
int comManagerSendRawDataInstance | ( | CMHANDLE | cmInstance, |
int | pHandle, | ||
uint32_t | dataId, | ||
void * | dataPtr, | ||
int | dataSize, | ||
int | dataOffset | ||
) |
Definition at line 606 of file com_manager.c.
void comManagerSetCallbacks | ( | pfnComManagerAsapMsg | rmcHandler, |
pfnComManagerGenMsgHandler | asciiHandler, | ||
pfnComManagerGenMsgHandler | ubloxHandler, | ||
pfnComManagerGenMsgHandler | rtcm3Handler | ||
) |
Register message handler callback functions. Pass in NULL to disable any of these callbacks.
msgFunc | handler for Realtime Message Controller (RMC) called whenever we get a message broadcast request or message disable command. |
msgFunc | handler for ASCII messages. |
msgFunc | handler for ublox messages. |
msgFunc | handler for RTCM3 messages. |
Definition at line 453 of file com_manager.c.
void comManagerSetCallbacksInstance | ( | CMHANDLE | cmInstance, |
pfnComManagerAsapMsg | rmcHandler, | ||
pfnComManagerGenMsgHandler | asciiHandler, | ||
pfnComManagerGenMsgHandler | ubloxHandler, | ||
pfnComManagerGenMsgHandler | rtcm3Handler | ||
) |
Definition at line 462 of file com_manager.c.
void comManagerStep | ( | void | ) |
Performs one round of sending and receiving message. This should be called as often as you want to send and receive data.
Definition at line 281 of file com_manager.c.
void comManagerStepInstance | ( | CMHANDLE | cmInstance_ | ) |
Definition at line 287 of file com_manager.c.
void comManagerStepRxInstance | ( | CMHANDLE | cmInstance | ) |
Definition at line 300 of file com_manager.c.
void comManagerStepTxInstance | ( | CMHANDLE | cmInstance | ) |
Definition at line 397 of file com_manager.c.
int comManagerValidateBaudRate | ( | unsigned int | baudRate | ) |
Ensure baudrate is valid for InertialSense hardware
baudRate | the baud rate to check |
Definition at line 1587 of file com_manager.c.