20.10.2013 - Modified PIObject - virtual debugName() for macro piCoutObj, improved timer measurements and timers on Windows

This commit is contained in:
peri4
2013-10-20 17:41:55 +04:00
parent 0f1b528ac6
commit ec5530053a
32 changed files with 2196 additions and 1331 deletions

View File

@@ -182,17 +182,7 @@ public:
void flush() {if (fd != -1) tcflush(fd, TCIOFLUSH);}
#endif
int read(void * read_to, int max_size) {
#ifdef WINDOWS
if (!canRead()) return -1;
WaitCommEvent(hCom, 0, 0);
ReadFile(hCom, read_to, max_size, &readed, 0);
return readed;
#else
if (!canRead()) return -1;
return ::read(fd, read_to, max_size);
#endif
}
int read(void * read_to, int max_size);
bool read(void * data, int size, double timeout_ms);
PIString read(int size = -1, double timeout_ms = 1000.);
PIByteArray readData(int size = -1, double timeout_ms = 1000.);
@@ -203,8 +193,8 @@ public:
bool send(const PIString & data, bool wait = false) {return (write(data.data(), data.lengthAscii(), wait) == data.size_s());}
bool send(const PIByteArray & data, bool wait = false) {return (write(data.data(), data.size_s(), wait) == data.size_s());}
protected:
bool configureDevice(const void * e_main, const void * e_parent = 0);
virtual void received(void * data, int size) {;}
int convertSpeed(PISerial::Speed speed);