change PIIODevice read* and write* methods size to "ssize_t"
This commit is contained in:
@@ -273,15 +273,15 @@ public:
|
||||
|
||||
//! \~english Read from device maximum "max_size" bytes to "read_to"
|
||||
//! \~russian Читает из устройства не более "max_size" байт в "read_to"
|
||||
int read(void * read_to, int max_size) {return readDevice(read_to, max_size);}
|
||||
ssize_t read(void * read_to, ssize_t max_size) {return readDevice(read_to, max_size);}
|
||||
|
||||
//! \~english Read from device to memory block "mb"
|
||||
//! \~russian Читает из устройства в блок памяти "mb"
|
||||
int read(PIMemoryBlock mb) {return readDevice(mb.data(), mb.size());}
|
||||
ssize_t read(PIMemoryBlock mb) {return readDevice(mb.data(), mb.size());}
|
||||
|
||||
//! \~english Read from device maximum "max_size" bytes and returns them as PIByteArray
|
||||
//! \~russian Читает из устройства не более "max_size" байт и возвращает данные как PIByteArray
|
||||
PIByteArray read(int max_size);
|
||||
PIByteArray read(ssize_t max_size);
|
||||
|
||||
//! \~english Returns the number of bytes that are available for reading.
|
||||
//! \~russian Возвращает количество байт доступных для чтения
|
||||
@@ -296,7 +296,7 @@ public:
|
||||
|
||||
//! \~english Write maximum "max_size" bytes of "data" to device
|
||||
//! \~russian Пишет в устройство не более "max_size" байт из "data"
|
||||
int write(const void * data, int max_size) {return writeDevice(data, max_size);}
|
||||
ssize_t write(const void * data, ssize_t max_size);
|
||||
|
||||
//! \~english Read from device for "timeout_ms" milliseconds and return readed data as PIByteArray.
|
||||
//! Timeout should to be greater than 0
|
||||
@@ -307,7 +307,7 @@ public:
|
||||
|
||||
//! \~english Add task to threaded write queue and return task ID
|
||||
//! \~russian Добавляет данные в очередь на потоковую запись и возвращает ID задания
|
||||
ullong writeThreaded(const void * data, int max_size) {return writeThreaded(PIByteArray(data, uint(max_size)));}
|
||||
ullong writeThreaded(const void * data, ssize_t max_size) {return writeThreaded(PIByteArray(data, uint(max_size)));}
|
||||
|
||||
//! \~english Add task to threaded write queue and return task ID
|
||||
//! \~russian Добавляет данные в очередь на потоковую запись и возвращает ID задания
|
||||
@@ -369,18 +369,18 @@ public:
|
||||
bool open(DeviceMode _mode);
|
||||
EVENT_HANDLER2(bool, open, const PIString &, _path, DeviceMode, _mode);
|
||||
EVENT_HANDLER(bool, close);
|
||||
EVENT_HANDLER1(int, write, PIByteArray, data);
|
||||
EVENT_HANDLER1(ssize_t, write, PIByteArray, data);
|
||||
|
||||
//! \~english Write memory block "mb" to device
|
||||
//! \~russian Пишет в устройство блок памяти "mb"
|
||||
int write(const PIMemoryBlock & mb) {return write(mb.data(), mb.size());}
|
||||
ssize_t write(const PIMemoryBlock & mb) {return write(mb.data(), mb.size());}
|
||||
|
||||
EVENT_VHANDLER(void, flush) {;}
|
||||
|
||||
EVENT(opened);
|
||||
EVENT(closed);
|
||||
EVENT2(threadedReadEvent, const uchar * , readed, int, size);
|
||||
EVENT2(threadedWriteEvent, ullong, id, int, written_size);
|
||||
EVENT2(threadedReadEvent, const uchar * , readed, ssize_t, size);
|
||||
EVENT2(threadedWriteEvent, ullong, id, ssize_t, written_size);
|
||||
|
||||
//! \handlers
|
||||
//! \{
|
||||
@@ -405,7 +405,7 @@ public:
|
||||
//! \~english Close device
|
||||
//! \~russian Закрывает устройство
|
||||
|
||||
//! \fn int write(PIByteArray data)
|
||||
//! \fn ssize_t write(PIByteArray data)
|
||||
//! \~english Write "data" to device
|
||||
//! \~russian Пишет "data" в устройство
|
||||
|
||||
@@ -429,11 +429,11 @@ public:
|
||||
//! \~english Raise if succesfull close
|
||||
//! \~russian Вызывается при успешном закрытии
|
||||
|
||||
//! \fn void threadedReadEvent(const uchar * readed, int size)
|
||||
//! \fn void threadedReadEvent(const uchar * readed, ssize_t size)
|
||||
//! \~english Raise if read thread succesfull read some data
|
||||
//! \~russian Вызывается при успешном потоковом чтении данных
|
||||
|
||||
//! \fn void threadedWriteEvent(ullong id, int written_size)
|
||||
//! \fn void threadedWriteEvent(ullong id, ssize_t written_size)
|
||||
//! \~english Raise if write thread successfull write some data of task with ID "id"
|
||||
//! \~russian Вызывается при успешной потоковой записи данных с ID задания "id"
|
||||
|
||||
@@ -477,15 +477,15 @@ protected:
|
||||
|
||||
//! \~english Reimplement this function to read from your device
|
||||
//! \~russian Переопределите для чтения данных из устройства
|
||||
virtual int readDevice(void * read_to, int max_size) {piCoutObj << "\"read\" is not implemented!"; return -2;}
|
||||
virtual ssize_t readDevice(void * read_to, ssize_t max_size) {piCoutObj << "\"read\" is not implemented!"; return -2;}
|
||||
|
||||
//! \~english Reimplement this function to write to your device
|
||||
//! \~russian Переопределите для записи данных в устройство
|
||||
virtual int writeDevice(const void * data, int max_size) {piCoutObj << "\"write\" is not implemented!"; return -2;}
|
||||
virtual ssize_t writeDevice(const void * data, ssize_t max_size) {piCoutObj << "\"write\" is not implemented!"; return -2;}
|
||||
|
||||
//! \~english Function executed when thread read some data, default implementation execute external callback "ret_func_"
|
||||
//! \~russian Метод вызывается после каждого успешного потокового чтения, по умолчанию вызывает callback "ret_func_"
|
||||
virtual bool threadedRead(const uchar * readed, int size);
|
||||
virtual bool threadedRead(const uchar * readed, ssize_t size);
|
||||
|
||||
//! \~english Reimplement to construct full unambiguous string, describes this device.
|
||||
//! Default implementation returns \a path()
|
||||
@@ -561,7 +561,7 @@ private:
|
||||
PIByteArray buffer_in, buffer_tr;
|
||||
PIQueue<PIPair<PIByteArray, ullong> > write_queue;
|
||||
ullong tri;
|
||||
int readed_;
|
||||
ssize_t readed_;
|
||||
uint threaded_read_buffer_size;
|
||||
bool init_, thread_started_, raise_threaded_read_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user