iCub-main
Loading...
Searching...
No Matches
CMTComm Class Reference

#include <MTComm.h>

Public Member Functions

 CMTComm ()
virtual ~CMTComm ()
clock_t clockms ()
short openPort (const int portNumber, const unsigned long baudrate=PBR_115K2, const unsigned long inqueueSize=4096, const unsigned long outqueueSize=1024)
short openPort (const char *portName, const unsigned long baudrate=PBR_115K2, const unsigned long inqueueSize=4096, const unsigned long outqueueSize=1024)
short openFile (const char *fileName, bool createAlways=false)
bool isPortOpen ()
bool isFileOpen ()
int readData (unsigned char *msgBuffer, const int nBytesToRead)
int writeData (const unsigned char *msgBuffer, const int nBytesToWrite)
void flush ()
void escape (unsigned long function)
void setPortQueueSize (const unsigned long inqueueSize=4096, const unsigned long outqueueSize=1024)
short setFilePos (long relPos, unsigned long moveMethod=FILEPOS_BEGIN)
short getFileSize (unsigned long &fileSize)
short close ()
short readMessage (unsigned char &mid, unsigned char data[], short &dataLen, unsigned char *bid=NULL)
short readDataMessage (unsigned char data[], short &dataLen)
short readMessageRaw (unsigned char *msgBuffer, short *msgBufferLength)
short writeMessage (const unsigned char mid, const unsigned long dataValue=0, const unsigned char dataValueLen=0, const unsigned char bid=BID_MASTER)
short writeMessage (const unsigned char mid, const unsigned char data[], const unsigned short &dataLen, const unsigned char bid=BID_MASTER)
short waitForMessage (const unsigned char mid, unsigned char data[]=NULL, short *dataLen=NULL, unsigned char *bid=NULL)
short reqSetting (const unsigned char mid, unsigned long &value, const unsigned char bid=BID_MASTER)
short reqSetting (const unsigned char mid, const unsigned char param, unsigned long &value, const unsigned char bid=BID_MASTER)
short reqSetting (const unsigned char mid, float &value, const unsigned char bid=BID_MASTER)
short reqSetting (const unsigned char mid, const unsigned char param, float &value, const unsigned char bid=BID_MASTER)
short reqSetting (const unsigned char mid, unsigned char data[], short &dataLen, const unsigned char bid=BID_MASTER)
short reqSetting (const unsigned char mid, unsigned char dataIn[], short dataInLen, unsigned char dataOut[], short &dataOutLen, const unsigned char bid=BID_MASTER)
short reqSetting (const unsigned char mid, const unsigned char param, unsigned char data[], short &dataLen, const unsigned char bid=BID_MASTER)
short setSetting (const unsigned char mid, const unsigned long value, const unsigned short valuelen, const unsigned char bid=BID_MASTER)
short setSetting (const unsigned char mid, const unsigned char param, const unsigned long value, const unsigned short valuelen, const unsigned char bid=BID_MASTER)
short setSetting (const unsigned char mid, const float value, const unsigned char bid=BID_MASTER)
short setSetting (const unsigned char mid, const unsigned char param, const float value, const unsigned char bid=BID_MASTER)
short setSetting (const unsigned char mid, const unsigned char param, const float value, const bool store, const unsigned char bid=BID_MASTER)
short getDeviceMode (unsigned short *numDevices=NULL)
short setDeviceMode (unsigned long OutputMode, unsigned long OutputSettings, const unsigned char bid=BID_MASTER)
short getMode (unsigned long &OutputMode, unsigned long &OutputSettings, unsigned short &dataLength, const unsigned char bid=BID_MASTER)
short setMode (unsigned long OutputMode, unsigned long OutputSettings, const unsigned char bid=BID_MASTER)
short getValue (const unsigned long valueSpec, unsigned short &value, const unsigned char data[], const unsigned char bid=BID_MT)
short getValue (const unsigned long valueSpec, unsigned short value[], const unsigned char data[], const unsigned char bid=BID_MT)
short getValue (const unsigned long valueSpec, float value[], const unsigned char data[], const unsigned char bid=BID_MT)
short getLastDeviceError ()
short getLastRetVal ()
short setTimeOut (short timeOutMs)
void calcChecksum (unsigned char *msgBuffer, const int msgBufferLength)
bool checkChecksum (const unsigned char *msgBuffer, const int msgBufferLength)

Static Public Member Functions

static void swapEndian (const unsigned char input[], unsigned char output[], const short length)

Protected Attributes

int m_handle
bool m_portOpen
bool m_fileOpen
short m_deviceError
short m_retVal
short m_timeOut
clock_t m_clkEnd
unsigned long m_storedOutputMode [MAXDEVICES+1]
unsigned long m_storedOutputSettings [MAXDEVICES+1]
unsigned long m_storedDataLength [MAXDEVICES+1]
unsigned char m_tempBuffer [MAXMSGLEN]
int m_nTempBufferLen

Detailed Description

Definition at line 898 of file MTComm.h.

Constructor & Destructor Documentation

◆ CMTComm()

CMTComm::CMTComm ( )

Definition at line 96 of file MTComm.cpp.

◆ ~CMTComm()

CMTComm::~CMTComm ( )
virtual

Definition at line 112 of file MTComm.cpp.

Member Function Documentation

◆ calcChecksum()

void CMTComm::calcChecksum ( unsigned char * msgBuffer,
const int msgBufferLength )

Definition at line 2633 of file MTComm.cpp.

◆ checkChecksum()

bool CMTComm::checkChecksum ( const unsigned char * msgBuffer,
const int msgBufferLength )

Definition at line 2651 of file MTComm.cpp.

◆ clockms()

clock_t CMTComm::clockms ( )

Definition at line 128 of file MTComm.cpp.

◆ close()

short CMTComm::close ( )

Definition at line 702 of file MTComm.cpp.

◆ escape()

void CMTComm::escape ( unsigned long function)

Definition at line 610 of file MTComm.cpp.

◆ flush()

void CMTComm::flush ( )

Definition at line 588 of file MTComm.cpp.

◆ getDeviceMode()

short CMTComm::getDeviceMode ( unsigned short * numDevices = NULL)

Definition at line 2021 of file MTComm.cpp.

◆ getFileSize()

short CMTComm::getFileSize ( unsigned long & fileSize)

Definition at line 677 of file MTComm.cpp.

◆ getLastDeviceError()

short CMTComm::getLastDeviceError ( )

Definition at line 2556 of file MTComm.cpp.

◆ getLastRetVal()

short CMTComm::getLastRetVal ( )

Definition at line 2568 of file MTComm.cpp.

◆ getMode()

short CMTComm::getMode ( unsigned long & OutputMode,
unsigned long & OutputSettings,
unsigned short & dataLength,
const unsigned char bid = BID_MASTER )

Definition at line 2187 of file MTComm.cpp.

◆ getValue() [1/3]

short CMTComm::getValue ( const unsigned long valueSpec,
float value[],
const unsigned char data[],
const unsigned char bid = BID_MT )

Definition at line 2439 of file MTComm.cpp.

◆ getValue() [2/3]

short CMTComm::getValue ( const unsigned long valueSpec,
unsigned short & value,
const unsigned char data[],
const unsigned char bid = BID_MT )

Definition at line 2300 of file MTComm.cpp.

◆ getValue() [3/3]

short CMTComm::getValue ( const unsigned long valueSpec,
unsigned short value[],
const unsigned char data[],
const unsigned char bid = BID_MT )

Definition at line 2371 of file MTComm.cpp.

◆ isFileOpen()

bool CMTComm::isFileOpen ( )

Definition at line 481 of file MTComm.cpp.

◆ isPortOpen()

bool CMTComm::isPortOpen ( )

Definition at line 471 of file MTComm.cpp.

◆ openFile()

short CMTComm::openFile ( const char * fileName,
bool createAlways = false )

Definition at line 434 of file MTComm.cpp.

◆ openPort() [1/2]

short CMTComm::openPort ( const char * portName,
const unsigned long baudrate = PBR_115K2,
const unsigned long inqueueSize = 4096,
const unsigned long outqueueSize = 1024 )

Definition at line 300 of file MTComm.cpp.

◆ openPort() [2/2]

short CMTComm::openPort ( const int portNumber,
const unsigned long baudrate = PBR_115K2,
const unsigned long inqueueSize = 4096,
const unsigned long outqueueSize = 1024 )

Definition at line 160 of file MTComm.cpp.

◆ readData()

int CMTComm::readData ( unsigned char * msgBuffer,
const int nBytesToRead )

Definition at line 498 of file MTComm.cpp.

◆ readDataMessage()

short CMTComm::readDataMessage ( unsigned char data[],
short & dataLen )

Definition at line 786 of file MTComm.cpp.

◆ readMessage()

short CMTComm::readMessage ( unsigned char & mid,
unsigned char data[],
short & dataLen,
unsigned char * bid = NULL )

Definition at line 745 of file MTComm.cpp.

◆ readMessageRaw()

short CMTComm::readMessageRaw ( unsigned char * msgBuffer,
short * msgBufferLength )

Definition at line 829 of file MTComm.cpp.

◆ reqSetting() [1/7]

short CMTComm::reqSetting ( const unsigned char mid,
const unsigned char param,
float & value,
const unsigned char bid = BID_MASTER )

Definition at line 1429 of file MTComm.cpp.

◆ reqSetting() [2/7]

short CMTComm::reqSetting ( const unsigned char mid,
const unsigned char param,
unsigned char data[],
short & dataLen,
const unsigned char bid = BID_MASTER )

Definition at line 1647 of file MTComm.cpp.

◆ reqSetting() [3/7]

short CMTComm::reqSetting ( const unsigned char mid,
const unsigned char param,
unsigned long & value,
const unsigned char bid = BID_MASTER )

Definition at line 1302 of file MTComm.cpp.

◆ reqSetting() [4/7]

short CMTComm::reqSetting ( const unsigned char mid,
float & value,
const unsigned char bid = BID_MASTER )

Definition at line 1371 of file MTComm.cpp.

◆ reqSetting() [5/7]

short CMTComm::reqSetting ( const unsigned char mid,
unsigned char data[],
short & dataLen,
const unsigned char bid = BID_MASTER )

Definition at line 1499 of file MTComm.cpp.

◆ reqSetting() [6/7]

short CMTComm::reqSetting ( const unsigned char mid,
unsigned char dataIn[],
short dataInLen,
unsigned char dataOut[],
short & dataOutLen,
const unsigned char bid = BID_MASTER )

Definition at line 1567 of file MTComm.cpp.

◆ reqSetting() [7/7]

short CMTComm::reqSetting ( const unsigned char mid,
unsigned long & value,
const unsigned char bid = BID_MASTER )

Definition at line 1243 of file MTComm.cpp.

◆ setDeviceMode()

short CMTComm::setDeviceMode ( unsigned long OutputMode,
unsigned long OutputSettings,
const unsigned char bid = BID_MASTER )

Definition at line 2130 of file MTComm.cpp.

◆ setFilePos()

short CMTComm::setFilePos ( long relPos,
unsigned long moveMethod = FILEPOS_BEGIN )

Definition at line 648 of file MTComm.cpp.

◆ setMode()

short CMTComm::setMode ( unsigned long OutputMode,
unsigned long OutputSettings,
const unsigned char bid = BID_MASTER )

Definition at line 2211 of file MTComm.cpp.

◆ setPortQueueSize()

void CMTComm::setPortQueueSize ( const unsigned long inqueueSize = 4096,
const unsigned long outqueueSize = 1024 )

Definition at line 623 of file MTComm.cpp.

◆ setSetting() [1/5]

short CMTComm::setSetting ( const unsigned char mid,
const float value,
const unsigned char bid = BID_MASTER )

Definition at line 1839 of file MTComm.cpp.

◆ setSetting() [2/5]

short CMTComm::setSetting ( const unsigned char mid,
const unsigned char param,
const float value,
const bool store,
const unsigned char bid = BID_MASTER )

Definition at line 1956 of file MTComm.cpp.

◆ setSetting() [3/5]

short CMTComm::setSetting ( const unsigned char mid,
const unsigned char param,
const float value,
const unsigned char bid = BID_MASTER )

Definition at line 1893 of file MTComm.cpp.

◆ setSetting() [4/5]

short CMTComm::setSetting ( const unsigned char mid,
const unsigned char param,
const unsigned long value,
const unsigned short valuelen,
const unsigned char bid = BID_MASTER )

Definition at line 1778 of file MTComm.cpp.

◆ setSetting() [5/5]

short CMTComm::setSetting ( const unsigned char mid,
const unsigned long value,
const unsigned short valuelen,
const unsigned char bid = BID_MASTER )

Definition at line 1720 of file MTComm.cpp.

◆ setTimeOut()

short CMTComm::setTimeOut ( short timeOutMs)

Definition at line 2581 of file MTComm.cpp.

◆ swapEndian()

void CMTComm::swapEndian ( const unsigned char input[],
unsigned char output[],
const short length )
static

Definition at line 2603 of file MTComm.cpp.

◆ waitForMessage()

short CMTComm::waitForMessage ( const unsigned char mid,
unsigned char data[] = NULL,
short * dataLen = NULL,
unsigned char * bid = NULL )

Definition at line 1177 of file MTComm.cpp.

◆ writeData()

int CMTComm::writeData ( const unsigned char * msgBuffer,
const int nBytesToWrite )

Definition at line 565 of file MTComm.cpp.

◆ writeMessage() [1/2]

short CMTComm::writeMessage ( const unsigned char mid,
const unsigned char data[],
const unsigned short & dataLen,
const unsigned char bid = BID_MASTER )

Definition at line 1089 of file MTComm.cpp.

◆ writeMessage() [2/2]

short CMTComm::writeMessage ( const unsigned char mid,
const unsigned long dataValue = 0,
const unsigned char dataValueLen = 0,
const unsigned char bid = BID_MASTER )

Definition at line 1012 of file MTComm.cpp.

Member Data Documentation

◆ m_clkEnd

clock_t CMTComm::m_clkEnd
protected

Definition at line 990 of file MTComm.h.

◆ m_deviceError

short CMTComm::m_deviceError
protected

Definition at line 987 of file MTComm.h.

◆ m_fileOpen

bool CMTComm::m_fileOpen
protected

Definition at line 986 of file MTComm.h.

◆ m_handle

int CMTComm::m_handle
protected

Definition at line 983 of file MTComm.h.

◆ m_nTempBufferLen

int CMTComm::m_nTempBufferLen
protected

Definition at line 999 of file MTComm.h.

◆ m_portOpen

bool CMTComm::m_portOpen
protected

Definition at line 985 of file MTComm.h.

◆ m_retVal

short CMTComm::m_retVal
protected

Definition at line 988 of file MTComm.h.

◆ m_storedDataLength

unsigned long CMTComm::m_storedDataLength[MAXDEVICES+1]
protected

Definition at line 995 of file MTComm.h.

◆ m_storedOutputMode

unsigned long CMTComm::m_storedOutputMode[MAXDEVICES+1]
protected

Definition at line 993 of file MTComm.h.

◆ m_storedOutputSettings

unsigned long CMTComm::m_storedOutputSettings[MAXDEVICES+1]
protected

Definition at line 994 of file MTComm.h.

◆ m_tempBuffer

unsigned char CMTComm::m_tempBuffer[MAXMSGLEN]
protected

Definition at line 998 of file MTComm.h.

◆ m_timeOut

short CMTComm::m_timeOut
protected

Definition at line 989 of file MTComm.h.


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