VectorNav C Library
util.h
1 #ifndef VNUTIL_H_INCLUDED
2 #define VNUTIL_H_INCLUDED
3 
4 #include <stddef.h>
5 
6 #include "vn/int.h"
7 #include "vn/bool.h"
8 #include "vn/error.h"
9 #include "vn/math/matrix.h"
10 #include "vn/math/vector.h"
11 #include "vn/util/export.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
18 #define VNAPI_MAJOR 1
19 #define VNAPI_MINOR 1
20 #define VNAPI_PATCH 0
21 #define VNAPI_REVISION 126
22 
26 int VnApi_major(void);
27 
31 int VnApi_minor(void);
32 
36 int VnApi_patch(void);
37 
41 int VnApi_revision(void);
42 
48 VnError VnApi_getVersion(char *out, size_t outLength);
49 
55 uint8_t VnUtil_toUint8FromHexChar(char c);
56 
63 uint8_t VnUtil_toUint8FromHexStr(char const *str);
64 
71 uint16_t VnUtil_toUint16FromHexStr(char const *str);
72 
79 void VnUtil_toHexStrFromUint8(uint8_t toConvert, char *output);
80 
87 void VnUtil_toHexStrFromUint16(uint16_t toConvert, char *output);
88 
95 size_t VnUtil_toStrFromUint16(uint16_t toConvert, char *output);
96 
102 uint8_t DllExport VnUtil_countSetBitsUint8(uint8_t data);
103 
109 void strFromBool(char *out, bool val);
110 
121 uint16_t stoh16(uint16_t sensorOrdered);
122 
127 uint32_t stoh32(uint32_t sensorOrdered);
128 
133 uint64_t stoh64(uint64_t sensorOrdered);
134 
139 uint16_t htos16(uint16_t hostOrdered);
140 
145 uint32_t htos32(uint32_t hostOrdered);
146 
151 uint64_t htos64(uint64_t hostOrdered);
152 
157 float htosf4(float hostOrdered);
158 
163 double htosf8(double hostOrdered);
164 
180 uint16_t VnUtil_extractUint16(const char* pos);
181 
188 uint32_t VnUtil_extractUint32(const char* pos);
189 
196 float VnUtil_extractFloat(const char* pos);
197 
204 double VnUtil_extractDouble(const char* pos);
205 
206 /*#if THIS_SHOULD_BE_MOVED_TO_MATH_C_PACK*/
207 
214 vec3f VnUtil_extractVec3f(const char* pos);
215 
222 vec4f VnUtil_extractVec4f(const char* pos);
223 
230 vec3d VnUtil_extractVec3d(const char* pos);
231 
238 mat3f VnUtil_extractMat3f(const char* pos);
239 
240 /*#endif*/
241 
242 /* \} */
243 
244 #ifdef __cplusplus
245 }
246 #endif
247 
248 #endif
uint16_t htos16(uint16_t hostOrdered)
Converts a 16-bit integer in host order to sensor order.
uint32_t htos32(uint32_t hostOrdered)
Converts a 32-bit integer in host order to sensor order.
double htosf8(double hostOrdered)
Converts an 8-byte float in host order to sensor order.
uint16_t stoh16(uint16_t sensorOrdered)
Converts a 16-bit integer in sensor order to host order.
uint16_t VnUtil_extractUint16(const char *pos)
Extracts a uint16_t with appropriate byte reordering from the binary array received from a VectorNav ...
vec3d VnUtil_extractVec3d(const char *pos)
Extracts a vec3d with appropriate byte reordering from the binary array received from a VectorNav sen...
vec4f VnUtil_extractVec4f(const char *pos)
Extracts a vec4f with appropriate byte reordering from the binary array received from a VectorNav sen...
uint32_t stoh32(uint32_t sensorOrdered)
Converts a 32-bit integer in sensor order to host order.
double VnUtil_extractDouble(const char *pos)
Extracts a double with appropriate byte reordering from the binary array received from a VectorNav se...
uint64_t stoh64(uint64_t sensorOrdered)
Converts a 64-bit integer in sensor order to host order.
Represents a 4 component vector with an underlying data type of float.
Definition: vector.h:68
Represents a 3 component vector with an underlying data type of double.
Definition: vector.h:41
float VnUtil_extractFloat(const char *pos)
Extracts a float with appropriate byte reordering from the binary array received from a VectorNav sen...
float htosf4(float hostOrdered)
Converts a 4-byte float in host order to sensor order.
uint32_t VnUtil_extractUint32(const char *pos)
Extracts a uint32_t with appropriate byte reordering from the binary array received from a VectorNav ...
Represents a 3x3 matrix with an underlying data type of float.
Definition: matrix.h:11
vec3f VnUtil_extractVec3f(const char *pos)
Extracts a vec3f with appropriate byte reordering from the binary array received from a VectorNav sen...
mat3f VnUtil_extractMat3f(const char *pos)
Extracts a mat3f with appropriate byte reordering from the binary array received from a VectorNav sen...
uint64_t htos64(uint64_t hostOrdered)
Converts a 64-bit integer in host order to sensor order.
Various vector types and operations.
Definition: vector.h:14