MOOS 0.2375
|
Cross Platform Serial Port Base Class. More...
#include <MOOSSerialPort.h>
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. |
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.
typedef std::list<CMOOSSerialTelegram> CMOOSSerialPort::TELEGRAM_LIST |
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.
CMOOSSerialPort::CMOOSSerialPort | ( | ) |
Definition at line 122 of file MOOSSerialPort.cpp.
CMOOSSerialPort::~CMOOSSerialPort | ( | ) | [virtual] |
Definition at line 137 of file MOOSSerialPort.cpp.
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] |
Implemented in CMOOSLinuxSerialPort, and CMOOSNTSerialPort.
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] |
Implemented in CMOOSLinuxSerialPort, and CMOOSNTSerialPort.
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] |
Implemented in CMOOSLinuxSerialPort, and CMOOSNTSerialPort.
bool CMOOSSerialPort::m_bHandShaking [protected] |
handware handshaking active flag
Definition at line 163 of file MOOSSerialPort.h.
bool CMOOSSerialPort::m_bQuit [protected] |
Definition at line 171 of file MOOSSerialPort.h.
bool CMOOSSerialPort::m_bStreaming [protected] |
Definition at line 152 of file MOOSSerialPort.h.
bool CMOOSSerialPort::m_bUseCsmExt [protected] |
ARH 14/05/2005 For 500kBaud PCMCIA card.
Definition at line 174 of file MOOSSerialPort.h.
bool CMOOSSerialPort::m_bVerbose [protected] |
Definition at line 154 of file MOOSSerialPort.h.
char CMOOSSerialPort::m_cTermCharacter [protected] |
Definition at line 131 of file MOOSSerialPort.h.
Definition at line 94 of file MOOSSerialPort.h.
Definition at line 96 of file MOOSSerialPort.h.
int CMOOSSerialPort::m_nBaudRate [protected] |
baudrate
Definition at line 169 of file MOOSSerialPort.h.
THREAD_ID CMOOSSerialPort::m_nCommsThreadID [protected] |
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.