41 #ifndef YOCTO_SERIALPORT_H 42 #define YOCTO_SERIALPORT_H 55 #ifndef _Y_VOLTAGELEVEL_ENUM 56 #define _Y_VOLTAGELEVEL_ENUM 68 #define Y_RXCOUNT_INVALID (YAPI_INVALID_UINT) 69 #define Y_TXCOUNT_INVALID (YAPI_INVALID_UINT) 70 #define Y_ERRCOUNT_INVALID (YAPI_INVALID_UINT) 71 #define Y_RXMSGCOUNT_INVALID (YAPI_INVALID_UINT) 72 #define Y_TXMSGCOUNT_INVALID (YAPI_INVALID_UINT) 73 #define Y_LASTMSG_INVALID (YAPI_INVALID_STRING) 74 #define Y_CURRENTJOB_INVALID (YAPI_INVALID_STRING) 75 #define Y_STARTUPJOB_INVALID (YAPI_INVALID_STRING) 76 #define Y_COMMAND_INVALID (YAPI_INVALID_STRING) 77 #define Y_PROTOCOL_INVALID (YAPI_INVALID_STRING) 78 #define Y_SERIALMODE_INVALID (YAPI_INVALID_STRING) 93 #pragma option push -w-8022 113 virtual int get_time(
void);
115 virtual int get_direction(
void);
117 virtual string get_message(
void);
141 #pragma option push -w-8022 205 int get_rxCount(
void);
208 {
return this->get_rxCount(); }
217 int get_txCount(
void);
220 {
return this->get_txCount(); }
229 int get_errCount(
void);
232 {
return this->get_errCount(); }
241 int get_rxMsgCount(
void);
244 {
return this->get_rxMsgCount(); }
253 int get_txMsgCount(
void);
256 {
return this->get_txMsgCount(); }
265 string get_lastMsg(
void);
268 {
return this->get_lastMsg(); }
277 string get_currentJob(
void);
280 {
return this->get_currentJob(); }
293 int set_currentJob(
const string& newval);
295 {
return this->set_currentJob(newval); }
304 string get_startupJob(
void);
307 {
return this->get_startupJob(); }
320 int set_startupJob(
const string& newval);
322 {
return this->set_startupJob(newval); }
324 string get_command(
void);
327 {
return this->get_command(); }
329 int set_command(
const string& newval);
331 {
return this->set_command(newval); }
345 {
return this->get_voltageLevel(); }
364 {
return this->set_voltageLevel(newval); }
381 string get_protocol(
void);
384 {
return this->get_protocol(); }
405 int set_protocol(
const string& newval);
407 {
return this->set_protocol(newval); }
422 string get_serialMode(
void);
425 {
return this->get_serialMode(); }
442 int set_serialMode(
const string& newval);
444 {
return this->set_serialMode(newval); }
491 virtual int sendCommand(
string text);
500 virtual int reset(
void);
511 virtual int writeByte(
int code);
522 virtual int writeStr(
string text);
533 virtual int writeBin(
string buff);
544 virtual int writeArray(vector<int> byteList);
555 virtual int writeHex(
string hexString);
566 virtual int writeLine(
string text);
577 virtual int readByte(
void);
590 virtual string readStr(
int nChars);
603 virtual string readBin(
int nChars);
616 virtual vector<int> readArray(
int nChars);
629 virtual string readHex(
int nBytes);
644 virtual string readLine(
void);
667 virtual vector<string> readMessages(
string pattern,
int maxWait);
678 virtual int read_seek(
int absPos);
685 virtual int read_tell(
void);
693 virtual int read_avail(
void);
707 virtual string queryLine(
string query,
int maxWait);
720 virtual int uploadJob(
string jobfile,
string jsonDef);
733 virtual int selectJob(
string jobfile);
745 virtual int set_RTS(
int val);
755 virtual int get_CTS(
void);
773 virtual vector<YSnoopingRecord> snoopMessages(
int maxWait);
786 virtual int writeMODBUS(
string hexString);
800 virtual vector<int> queryMODBUS(
int slaveNo,vector<int> pduBytes);
814 virtual vector<int> modbusReadBits(
int slaveNo,
int pduAddr,
int nBits);
828 virtual vector<int> modbusReadInputBits(
int slaveNo,
int pduAddr,
int nBits);
842 virtual vector<int> modbusReadRegisters(
int slaveNo,
int pduAddr,
int nWords);
856 virtual vector<int> modbusReadInputRegisters(
int slaveNo,
int pduAddr,
int nWords);
870 virtual int modbusWriteBit(
int slaveNo,
int pduAddr,
int value);
884 virtual int modbusWriteBits(
int slaveNo,
int pduAddr,vector<int> bits);
898 virtual int modbusWriteRegister(
int slaveNo,
int pduAddr,
int value);
912 virtual int modbusWriteRegisters(
int slaveNo,
int pduAddr,vector<int> values);
929 virtual vector<int> modbusWriteAndReadRegisters(
int slaveNo,
int pduWriteAddr,vector<int> values,
int pduReadAddr,
int nReadWords);
944 {
return this->nextSerialPort();}
static YSerialPort * FirstSerialPort(void)
void(* YSerialPortValueCallback)(YSerialPort *func, const string &functionValue)
static const string CURRENTJOB_INVALID
YSerialPort * yFirstSerialPort(void)
static const string PROTOCOL_INVALID
int setCommand(const string &newval)
static const string LASTMSG_INVALID
int setSerialMode(const string &newval)
#define YAPI_INVALID_UINT
int setCurrentJob(const string &newval)
virtual int _parseAttr(YJSONObject *json_val)
int setProtocol(const string &newval)
static const string STARTUPJOB_INVALID
YSerialPort * yFindSerialPort(const string &func)
static const string COMMAND_INVALID
YSerialPortValueCallback _valueCallbackSerialPort
virtual int registerValueCallback(YFunctionValueCallback callback)
int setStartupJob(const string &newval)
#define YOCTO_CLASS_EXPORT
Y_VOLTAGELEVEL_enum voltageLevel(void)
static const string SERIALMODE_INVALID
Y_VOLTAGELEVEL_enum _voltageLevel
static YSerialPort * FindSerialPort(string func)
static YSerialPort * First(void)
int setVoltageLevel(Y_VOLTAGELEVEL_enum newval)
static YSerialPort * Find(string func)
virtual int _invokeValueCallback(string value)