sonar_tritech
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
sea_net::SeaNet Class Reference

#include <SeaNet.hpp>

Inheritance diagram for sea_net::SeaNet:
sea_net::Micron sea_net::Profiling

Public Member Functions

 SeaNet (const DeviceType type)
 
 ~SeaNet ()
 
void openSerial (std::string const &port, int baudrate=115200)
 
void openURI (std::string const &uri)
 
void clear ()
 
void reboot (int timeout)
 
PacketType readPacket (int timeout)
 
void waitForPacket (PacketType type, int timeout)
 
void getVersion (VersionData &version, int timeout)
 
bool isFullDuplex (int timeout)
 
bool isFullDublex (int timeout)
 
void setWriteTimeout (uint32_t timeout)
 
SeaNetPacket const & getSeaNetPacket () const
 
void requestData ()
 
bool hasPendingData () const
 
void receiveData (int timeout)
 

Protected Member Functions

void writeHeadCommand (HeadCommand &hc, int timeout)
 
virtual int extractPacket (uint8_t const *buffer, size_t buffer_size) const
 

Protected Attributes

SeaNetPacket sea_net_packet
 
DeviceType device_type
 
bool has_pending_data
 

Constructor & Destructor Documentation

sea_net::SeaNet::SeaNet ( const DeviceType  type)

Base class for RS232 SeaNet devices The class has to be initialized with the right device type which is used as communictaion check

sea_net::SeaNet::~SeaNet ( )

Member Function Documentation

void sea_net::SeaNet::clear ( )

Overloaded from iodrivers_base::Driver

int sea_net::SeaNet::extractPacket ( uint8_t const *  buffer,
size_t  buffer_size 
) const
protectedvirtual
SeaNetPacket const & sea_net::SeaNet::getSeaNetPacket ( ) const

Returns the structure holding the last received packet

void sea_net::SeaNet::getVersion ( VersionData version,
int  timeout 
)

extracts the software version of the device from a mtVersionData package

call this function if readPacket returns mtVersionData

bool sea_net::SeaNet::hasPendingData ( ) const

Checks whether data has been requested but not received yet

Some operations (e.g. configure()) cannot be called if it is the case. For these operations, if you don't know whether data has been requested, you must check whether hasPendingData() returns true and call receiveData() first.

bool sea_net::SeaNet::isFullDublex ( int  timeout)
Deprecated:
use isFullDuplex instead
bool sea_net::SeaNet::isFullDuplex ( int  timeout)

Returns if the remote device is configured as full duplex or half duplex

void sea_net::SeaNet::openSerial ( std::string const &  port,
int  baudrate = 115200 
)

Opens a serial port and sets it up to a sane configuration.

Throws UnixError on error

void sea_net::SeaNet::openURI ( std::string const &  uri)

Overloaded from iodrivers_base::Driver

sea_net::PacketType sea_net::SeaNet::readPacket ( int  timeout)

Reads one packat from I/O and returns the packet type

The packet's content can be retrieved by the SeaNetPacket API on the value returned by getSeaNetPacket

Parameters
timeoutthe timeout in milliseconds
Returns
the packet type
void sea_net::SeaNet::reboot ( int  timeout)

Reboots the Device and waits for a mtAlive package be careful this takes a while and even if you receive mtAlives the device my be in a state where it does not accept mtHeadCommands

void sea_net::SeaNet::receiveData ( int  timeout)

Wait for the beam data requested by requestData to be received

Parameters
timeoutthe timeout in milliseconds
void sea_net::SeaNet::requestData ( )

Request the sonar to acquire one beam

Calling this method will fail until the corresponding data packet has been received.

The timeout is the default write timeout

void sea_net::SeaNet::setWriteTimeout ( uint32_t  timeout)
void sea_net::SeaNet::waitForPacket ( PacketType  type,
int  timeout 
)
void sea_net::SeaNet::writeHeadCommand ( HeadCommand hc,
int  timeout 
)
protected

Member Data Documentation

DeviceType sea_net::SeaNet::device_type
protected
bool sea_net::SeaNet::has_pending_data
protected
SeaNetPacket sea_net::SeaNet::sea_net_packet
protected

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