searcher.h
#ifndef _SEARCHER_H_
#define _SEARCHER_H_
#include "vn/bool.h"
#include "vn/int.h"
#include "vn/xplat/serialport.h"
#include "vn/xplat/thread.h"
/* These defines are used to enable a single function name while implementing */
/* different solutions given the OS. */
#if defined __linux__ || defined __CYGWIN__
#define VnSearcher_findPorts VnSearcher_findPorts_LINUX
#elif defined _WIN32
#define VnSearcher_findPorts VnSearcher_findPorts_WIN32
#else
#error ERROR: System not yet supported in VnSearcher
#endif
#ifdef _WIN32
#pragma warning(push)
#pragma warning(disable : 4820)
#endif
typedef struct
{
char* portName;
VnThread thread;
int32_t baud;
size_t dataSize;
VnSerialPort* port;
char data[255];
} VnPortInfo;
#ifdef _WIN32
#pragma warning(pop)
#endif
char* VnSearcher_getPortName(VnPortInfo* portInfo);
int32_t VnSearcher_getPortBaud(VnPortInfo* portInfo);
void VnSearcher_findPorts(char*** portNames, int32_t* numPortsFound);
void VnSearcher_findPortBaud(char* portName, int32_t* foundBaudrate);
void VnSearcher_findAllSensors(VnPortInfo*** sensorsFound, int32_t* numSensors);
void VnSearcher_searchInputPorts(char*** portsToCheck, int32_t numPortsToCheck, VnPortInfo*** sensorsFound);
#endif
VnPortInfo::baud
int32_t baud
Baud of the attached senosr, -1 for no sensor, -2 for error.
Definition: searcher.h:34
VnPortInfo
containing information about the port to be searched.
Definition: searcher.h:25
thread.h
VnSerialPort
Provides access to a serial port.
Definition: serialport.h:48
VnPortInfo::portName
char * portName
Contains the name of the port.
Definition: searcher.h:28
VnPortInfo::thread
VnThread thread
VnThread object for callback purposes.
Definition: searcher.h:31
VnThread
Structure for working with threads.
Definition: thread.h:40
VnPortInfo::port
VnSerialPort * port
VnSerialPort object to handle communication to the sensor.
Definition: searcher.h:40
VnPortInfo::dataSize
size_t dataSize
size of the data array
Definition: searcher.h:37