# VectorNav C++ Library: include/vn/port.h Source File

port.h
#ifndef _VN_XPLAT_PORT_H_
#define _VN_XPLAT_PORT_H_
#include <cstddef>
#include "export.h"
namespace vn {
namespace xplat {
class vn_proglib_DLLEXPORT IPort
{
// Types //////////////////////////////////////////////////////////////////
public:
typedef void(*DataReceivedHandler)(void* userData);
// Public Methods /////////////////////////////////////////////////////////
public:
virtual ~IPort() = 0;
virtual void open() = 0;
virtual void close() = 0;
virtual bool isOpen() = 0;
virtual void write(const char data[], size_t length) = 0;
virtual void read(char dataBuffer[], size_t numOfBytesToRead, size_t &numOfBytesActuallyRead) = 0;
virtual void registerDataReceivedHandler(void* userData, DataReceivedHandler handler) = 0;
virtual void unregisterDataReceivedHandler() = 0;
#if PYTHON && !PL156_ORIGINAL && !PL156_FIX_ATTEMPT_1
virtual void stopThread(){}
virtual bool threadStopped(){ return false; }
virtual void resumeThread(){}
#endif
};
}
}
#endif
vn::xplat::IPort
Interface for a simple port.
Definition: port.h:12
xplat
Definition: mock.h:4
vn
Definition: attitude.h:8