# VectorNav C++ Library: vn::sensors::EzAsyncData Class Reference

vn::sensors::EzAsyncData Class Reference

Provides easy and reliable access to asynchronous data from a VectorNav sensor at the cost of a slight performance hit. More...

`#include <ezasyncdata.h>`

Inheritance diagram for vn::sensors::EzAsyncData:

## Public Member Functions

| ~EzAsyncData ()
| DTOR.
VnSensor * | sensor ()
| Returns the underlying sensor object. More...
void | disconnect ()
| Disconnects from the VectorNav sensor.
CompositeData | currentData ()
| Gets the latest collection of current data received from asychronous messages from the sensor. More...
CompositeData | getNextData ()
| Gets the next data packet available and blocks until a data packet is received if there is currently not data available. More...
CompositeData | getNextData (int timeoutMs)
| This method will get the next data packet available and block until a data packet is received if there is currently not data available. More...

## Static Public Member Functions

static EzAsyncData * | connect (std::string portName, uint32_t baudrate)
| Connects to a sensor with the specified connection parameters. More...

## Detailed Description

Provides easy and reliable access to asynchronous data from a VectorNav sensor at the cost of a slight performance hit.

Examples:
  ez_async_data/main.cpp.

## Member Function Documentation

static EzAsyncData* vn::sensors::EzAsyncData::connect | ( | std::string | portName,
|  | uint32_t | baudrate
| ) |  |

static

Connects to a sensor with the specified connection parameters.

Parameters

  [in] | portName | The COM port name.
  [in] | baudrate | Baudrate to connect to the sensor at.

Returns
  New EzAsyncData object wrapping the connected sensor and providing easy access to asynchronous data.

CompositeData vn::sensors::EzAsyncData::currentData | ( |  | ) |

Gets the latest collection of current data received from asychronous messages from the sensor.

Returns
  The latest current data.

Examples:
  ez_async_data/main.cpp.

CompositeData vn::sensors::EzAsyncData::getNextData | ( |  | ) |

Gets the next data packet available and blocks until a data packet is received if there is currently not data available.

Returns
  The received data packet.

Examples:
  ez_async_data/main.cpp.

CompositeData vn::sensors::EzAsyncData::getNextData | ( | int | timeoutMs | ) |

This method will get the next data packet available and block until a data packet is received if there is currently not data available.

Parameters

  [in] | timeoutMs | The number of milliseconds to wait for the next available data.

Returns
  The next received packet of data.

Exceptions

  timeout | Did not receive new data by the timeout.

VnSensor* vn::sensors::EzAsyncData::sensor | ( |  | ) |

Returns the underlying sensor object.

Returns
  The sensor object.

Examples:
  ez_async_data/main.cpp.

The documentation for this class was generated from the following file:

- include/vn/ezasyncdata.h