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

ezasyncdata.h
#ifndef _VNSENSORS_EZASYNCDATA_H_
#define _VNSENSORS_EZASYNCDATA_H_
#include <string>
#include "vn/int.h"
#include "vn/nocopy.h"
#include "vn/sensors.h"
#include "vn/compositedata.h"
#include "vn/criticalsection.h"
#include "vn/event.h"
#include "vn/export.h"
namespace vn {
namespace sensors {
class vn_proglib_DLLEXPORT EzAsyncData : private util::NoCopy
{
private:
explicit EzAsyncData(VnSensor* sensor);
public:
~EzAsyncData();
VnSensor* sensor();
static EzAsyncData* connect(std::string portName, uint32_t baudrate);
void disconnect();
CompositeData currentData();
CompositeData getNextData();
CompositeData getNextData(int timeoutMs);
private:
static void asyncPacketReceivedHandler(void* userData, protocol::uart::Packet& p, size_t index);
private:
VnSensor* _sensor;
xplat::CriticalSection _mainCS, _copyCS;
CompositeData _persistentData, _nextData;
xplat::Event _newDataEvent;
};
}
}
#endif
vn::xplat::CriticalSection
Represents a cross-platform critical section.
Definition: criticalsection.h:16
vn::xplat::Event
Represents a cross-platform event.
Definition: event.h:12
int.h
nocopy.h
vn::sensors::CompositeData
Composite structure of all data types available from VectorNav sensors.
Definition: compositedata.h:15
vn::sensors::EzAsyncData
Provides easy and reliable access to asynchronous data from a VectorNav sensor at the cost of a sligh...
Definition: ezasyncdata.h:19
criticalsection.h
vn::sensors::VnSensor
Helpful class for working with VectorNav sensors.
Definition: sensors.h:58
vn::util::NoCopy
Identifies a derived class as being unable to be copied and prevents copy attempts.
Definition: nocopy.h:21
vn
Definition: attitude.h:8
vn::protocol::uart::Packet
Structure representing a UART packet received from the VectorNav sensor.
Definition: packet.h:16