3.10.2013 - PIPeer release, PIConsole now can work as server and remote client. Remote console test program in directory "remote_console"

This commit is contained in:
peri4
2013-10-03 16:04:02 +04:00
parent 9111640ca8
commit 4b90f2818e
56 changed files with 6422 additions and 673 deletions

View File

@@ -24,7 +24,7 @@
* \brief Base class for input/output classes
*
* \section PIIODevice_sec0 Synopsis
* This class provide open/close logic, threaded read and virtual input/output
* This class provide open/close logic, threaded read/write and virtual input/output
* functions \a read() and \a write(). You should implement pure virtual
* function \a openDevice() in your subclass.
*
@@ -41,13 +41,20 @@
* bool func_name(void * Threaded_read_data, uchar * readed_data, int readed_size)\n
* Threaded read starts with function \a startThreadedRead().
*
* \section PIIODevice_sec3 Internal buffer
* \section PIIODevice_sec3 Threaded write
* PIIODevice aggregate another PIThread to perform a threaded write by function
* \a writeThreaded(). This function add task to internal queue and return
* queue entry ID. You should start write thread by function \a startThreadedWrite.
* On successful write event \a threadedWriteEvent is raised with two arguments -
* task ID and written bytes count.
*
* \section PIIODevice_sec4 Internal buffer
* PIIODevice have internal buffer for threaded read, and \a threadedRead() function
* receive pointer to this buffer in first argument. You can adjust size of this buffer
* by function \a setThreadedReadBufferSize() \n
* Default size of this buffer is 4096 bytes
*
* \section PIIODevice_sec4 Reopen
* \section PIIODevice_sec5 Reopen
* When threaded read is begin its call \a open() if device is closed. While threaded
* read running PIIODevice check if device opened every read and if not call \a open()
* every reopen timeout if reopen enabled. Reopen timeout is set by \a setReopenTimeout(),
@@ -58,11 +65,10 @@
*/
//! Constructs a empty PIIODevice
PIIODevice::PIIODevice(): PIThread() {
mode_ = ReadOnly;
opened_ = init_ = thread_started_ = false;
reopen_enabled_ = true;
reopen_enabled_ = raise_threaded_read_ = true;
reopen_timeout_ = 1000;
ret_func_ = 0;
ret_data_ = 0;
@@ -82,7 +88,7 @@ PIIODevice::PIIODevice(const PIString & path, PIIODevice::DeviceMode type, bool
path_ = path;
mode_ = type;
opened_ = init_ = thread_started_ = false;
reopen_enabled_ = true;
reopen_enabled_ = raise_threaded_read_ = true;
reopen_timeout_ = 1000;
ret_func_ = 0;
ret_data_ = 0;
@@ -150,7 +156,7 @@ void PIIODevice::begin() {
void PIIODevice::run() {
if (!isReadable()) {
//cout << "not readable\n";
stop();
PIThread::stop();
return;
}
if (!thread_started_) {
@@ -165,7 +171,7 @@ void PIIODevice::run() {
return;
}
threadedRead(buffer_tr.data(), readed_);
threadedReadEvent(buffer_tr.data(), readed_);
if (raise_threaded_read_) threadedReadEvent(buffer_tr.data(), readed_);
}