MOOS 0.2375
Classes | Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes
CMOOSSerialPort Class Reference

Cross Platform Serial Port Base Class. More...

#include <MOOSSerialPort.h>

Inheritance diagram for CMOOSSerialPort:
Inheritance graph
[legend]
Collaboration diagram for CMOOSSerialPort:
Collaboration graph
[legend]

List of all members.

Classes

class  CMOOSSerialTelegram

Public Types

typedef std::list
< CMOOSSerialTelegram
TELEGRAM_LIST

Public Member Functions

std::string GetPortName ()
virtual bool Close ()
char GetTermCharacter ()
void SetTermCharacter (char cTermChar)
int GetBaudRate ()
virtual int Flush ()
bool IsStreaming ()
bool IsVerbose ()
bool GetLatest (std::string &sWhat, double &dfWhen)
bool GetEarliest (std::string &sWhat, double &dfWhen)
bool CommsLoop ()
 CMOOSSerialPort ()
virtual ~CMOOSSerialPort ()
virtual bool Configure (STRING_LIST sParams)
virtual bool Create (const char *pPortNum=DEFAULT_PORT, int nBaudRate=DEFAULT_BAUDRATE)=0
virtual int ReadNWithTimeOut (char *pBuff, int nBufferLen, double Timeout=0.5, double *pTime=NULL)
virtual int Write (const char *Str, int nLen, double *pTime=NULL)=0
bool GetTelegram (std::string &sTelegram, double dfTimeOut, double *pTime=NULL)
bool GetTelegramOrAccumulate (std::string &sTelegram, double dfTimeOut, double *pTime=NULL)
virtual int ReadNWithTimeOut2 (char *pBuff, int nBufferLen, double Timeout=0.5, double *pTime=NULL)
void SetIsCompleteReplyCallBack (bool(*pfn)(char *pData, int nLen, int nRead))
virtual void Break ()

Public Attributes

TELEGRAM_LIST m_InBox
TELEGRAM_LIST m_OutBox
CMOOSLock m_InBoxLock
CMOOSLock m_OutBoxLock
CMOOSLock m_PortLock

Protected Types

typedef pthread_t THREAD_ID

Protected Member Functions

bool StartThreads ()
virtual int GrabN (char *pBuffer, int nRequired)=0
bool IsCompleteReply (char *pData, int nLen, int nRead)

Protected Attributes

char m_cTermCharacter
THREAD_ID m_nCommsThreadID
bool m_bStreaming
bool m_bVerbose
bool(* m_pfnUserIsCompleteReplyCallBack )(char *pData, int nLen, int nRead)
bool m_bHandShaking
 handware handshaking active flag
std::string m_sPort
 port name
int m_nBaudRate
 baudrate
bool m_bQuit
bool m_bUseCsmExt
 ARH 14/05/2005 For 500kBaud PCMCIA card.

Detailed Description

Cross Platform Serial Port Base Class.

Provides cross platform functionality which is implemented in detail by the platform dependent derivatives

Definition at line 65 of file MOOSSerialPort.h.


Member Typedef Documentation

Definition at line 92 of file MOOSSerialPort.h.

typedef pthread_t CMOOSSerialPort::THREAD_ID [protected]

Win32 handle to IO thread

Definition at line 142 of file MOOSSerialPort.h.


Constructor & Destructor Documentation

CMOOSSerialPort::CMOOSSerialPort ( )

Definition at line 122 of file MOOSSerialPort.cpp.

CMOOSSerialPort::~CMOOSSerialPort ( ) [virtual]

Definition at line 137 of file MOOSSerialPort.cpp.


Member Function Documentation

void CMOOSSerialPort::Break ( ) [virtual]

Reimplemented in CMOOSLinuxSerialPort, and CMOOSNTSerialPort.

Definition at line 245 of file MOOSSerialPort.cpp.

bool CMOOSSerialPort::Close ( void  ) [virtual]

Reimplemented in CMOOSLinuxSerialPort, and CMOOSNTSerialPort.

Definition at line 679 of file MOOSSerialPort.cpp.

bool CMOOSSerialPort::CommsLoop ( )

Definition at line 274 of file MOOSSerialPort.cpp.

bool CMOOSSerialPort::Configure ( STRING_LIST  sParams) [virtual]

Definition at line 142 of file MOOSSerialPort.cpp.

virtual bool CMOOSSerialPort::Create ( const char *  pPortNum = DEFAULT_PORT,
int  nBaudRate = DEFAULT_BAUDRATE 
) [pure virtual]
virtual int CMOOSSerialPort::Flush ( void  ) [inline, virtual]

Reimplemented in CMOOSLinuxSerialPort, and CNTSerial.

Definition at line 74 of file MOOSSerialPort.h.

int CMOOSSerialPort::GetBaudRate ( ) [inline]

Definition at line 72 of file MOOSSerialPort.h.

bool CMOOSSerialPort::GetEarliest ( std::string &  sWhat,
double &  dfWhen 
)

Definition at line 404 of file MOOSSerialPort.cpp.

bool CMOOSSerialPort::GetLatest ( std::string &  sWhat,
double &  dfWhen 
)

Definition at line 384 of file MOOSSerialPort.cpp.

std::string CMOOSSerialPort::GetPortName ( )

Definition at line 698 of file MOOSSerialPort.cpp.

bool CMOOSSerialPort::GetTelegram ( std::string &  sTelegram,
double  dfTimeOut,
double *  pTime = NULL 
)

Definition at line 558 of file MOOSSerialPort.cpp.

bool CMOOSSerialPort::GetTelegramOrAccumulate ( std::string &  sTelegram,
double  dfTimeOut,
double *  pTime = NULL 
)

Similar to the GetTelegram method, but uses an internal data buffer to store incomplete telegrams. addition to API submitted by submitted by Arjan Vermeij

Definition at line 618 of file MOOSSerialPort.cpp.

char CMOOSSerialPort::GetTermCharacter ( )

Definition at line 445 of file MOOSSerialPort.cpp.

virtual int CMOOSSerialPort::GrabN ( char *  pBuffer,
int  nRequired 
) [protected, pure virtual]
bool CMOOSSerialPort::IsCompleteReply ( char *  pData,
int  nLen,
int  nRead 
) [protected]

Definition at line 251 of file MOOSSerialPort.cpp.

bool CMOOSSerialPort::IsStreaming ( )

Definition at line 426 of file MOOSSerialPort.cpp.

bool CMOOSSerialPort::IsVerbose ( ) [inline]

Definition at line 77 of file MOOSSerialPort.h.

int CMOOSSerialPort::ReadNWithTimeOut ( char *  pBuff,
int  nBufferLen,
double  Timeout = 0.5,
double *  pTime = NULL 
) [virtual]

Definition at line 453 of file MOOSSerialPort.cpp.

int CMOOSSerialPort::ReadNWithTimeOut2 ( char *  pBuff,
int  nBufferLen,
double  Timeout = 0.5,
double *  pTime = NULL 
) [virtual]

Definition at line 504 of file MOOSSerialPort.cpp.

void CMOOSSerialPort::SetIsCompleteReplyCallBack ( bool(*)(char *pData, int nLen, int nRead)  pfn)

Definition at line 267 of file MOOSSerialPort.cpp.

void CMOOSSerialPort::SetTermCharacter ( char  cTermChar)

Sets the termination character for the serial port to watch out for when it constructs Telegrams for Streaming Devices.

Definition at line 437 of file MOOSSerialPort.cpp.

bool CMOOSSerialPort::StartThreads ( ) [protected]

Definition at line 93 of file MOOSSerialPort.cpp.

virtual int CMOOSSerialPort::Write ( const char *  Str,
int  nLen,
double *  pTime = NULL 
) [pure virtual]

Member Data Documentation

handware handshaking active flag

Definition at line 163 of file MOOSSerialPort.h.

Definition at line 171 of file MOOSSerialPort.h.

Definition at line 152 of file MOOSSerialPort.h.

ARH 14/05/2005 For 500kBaud PCMCIA card.

Definition at line 174 of file MOOSSerialPort.h.

Definition at line 154 of file MOOSSerialPort.h.

Definition at line 131 of file MOOSSerialPort.h.

Definition at line 94 of file MOOSSerialPort.h.

Definition at line 96 of file MOOSSerialPort.h.

baudrate

Definition at line 169 of file MOOSSerialPort.h.

ID of IO thread

Definition at line 147 of file MOOSSerialPort.h.

Definition at line 95 of file MOOSSerialPort.h.

Definition at line 97 of file MOOSSerialPort.h.

bool(* CMOOSSerialPort::m_pfnUserIsCompleteReplyCallBack)(char *pData, int nLen, int nRead) [protected]

Definition at line 158 of file MOOSSerialPort.h.

Definition at line 98 of file MOOSSerialPort.h.

std::string CMOOSSerialPort::m_sPort [protected]

port name

Definition at line 166 of file MOOSSerialPort.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines