VectorNav C Library
searcher.h
1 #ifndef _SEARCHER_H_
2 #define _SEARCHER_H_
3 
4 #include "vn/bool.h"
5 #include "vn/int.h"
6 #include "vn/xplat/serialport.h"
7 #include "vn/xplat/thread.h"
8 
9 /* These defines are used to enable a single function name while implementing */
10 /* different solutions given the OS. */
11 #if defined __linux__ || defined __CYGWIN__
12  #define VnSearcher_findPorts VnSearcher_findPorts_LINUX
13 #elif defined _WIN32
14  #define VnSearcher_findPorts VnSearcher_findPorts_WIN32
15 #else
16  #error ERROR: System not yet supported in VnSearcher
17 #endif
18 
19 #ifdef _WIN32
20 #pragma warning(push)
21 #pragma warning(disable : 4820)
22 #endif
23 
25 typedef struct
26 {
28  char* portName;
29 
32 
34  int32_t baud;
35 
37  size_t dataSize;
38 
41 
43  char data[255];
44 } VnPortInfo;
45 
46 #ifdef _WIN32
47 #pragma warning(pop)
48 #endif
49 
54 char* VnSearcher_getPortName(VnPortInfo* portInfo);
55 
62 int32_t VnSearcher_getPortBaud(VnPortInfo* portInfo);
63 
68 void VnSearcher_findPorts(char*** portNames, int32_t* numPortsFound);
69 
75 void VnSearcher_findPortBaud(char* portName, int32_t* foundBaudrate);
76 
82 void VnSearcher_findAllSensors(VnPortInfo*** sensorsFound, int32_t* numSensors);
83 
92 void VnSearcher_searchInputPorts(char*** portsToCheck, int32_t numPortsToCheck, VnPortInfo*** sensorsFound);
93 
94 #endif
int32_t baud
Baud of the attached senosr, -1 for no sensor, -2 for error.
Definition: searcher.h:34
containing information about the port to be searched.
Definition: searcher.h:25
Provides access to a serial port.
Definition: serialport.h:48
char * portName
Contains the name of the port.
Definition: searcher.h:28
VnThread thread
VnThread object for callback purposes.
Definition: searcher.h:31
Structure for working with threads.
Definition: thread.h:40
VnSerialPort * port
VnSerialPort object to handle communication to the sensor.
Definition: searcher.h:40
size_t dataSize
size of the data array
Definition: searcher.h:37