git-svn-id: svn://db.shs.com.ru/pip@258 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-09-07 10:49:17 +00:00
parent 5bc69bcf59
commit c089ad19ea
4 changed files with 11 additions and 7 deletions

View File

@@ -265,10 +265,10 @@ WORD PIScreen::SystemConsole::attributes(const PIScreenTypes::Cell & c) {
case White: attr = attr | BACKGROUND_MASK; break; case White: attr = attr | BACKGROUND_MASK; break;
} }
if ((c.format.flags & Inverse) == Inverse) { if ((c.format.flags & Inverse) == Inverse) {
uchar f = c.format.flags & 0xFF; uchar f = attr & 0xFF;
c.format.flags &= 0xFFFFFF00; attr &= 0xFFFFFF00;
f = (f << 4) | (f >> 4); f = (f << 4) | (f >> 4);
c.format.flags |= f; attr |= f;
} }
return attr; return attr;
} }

View File

@@ -937,7 +937,7 @@ PIIODevice * PIConnection::DevicePool::addDevice(PIConnection * parent, const PI
dd->rthread = 0; dd->rthread = 0;
dd->started = false; dd->started = false;
} }
dd->rthread = new PIThread(dd, threadReadDP); dd->rthread = new PIThread(dd, __DevicePool_threadReadDP);
dd->rthread->setName("__S__connection_" + fp + "_read_thread"); dd->rthread->setName("__S__connection_" + fp + "_read_thread");
need_start = true; need_start = true;
pmode |= PIIODevice::ReadOnly; pmode |= PIIODevice::ReadOnly;
@@ -1066,12 +1066,13 @@ void PIConnection::DevicePool::run() {
} }
void PIConnection::DevicePool::threadReadDP(void * ddp) { void __DevicePool_threadReadDP(void * ddp) {
DeviceData * dd((DeviceData * )ddp); PIConnection::DevicePool::DeviceData * dd((PIConnection::DevicePool::DeviceData * )ddp);
if (dd->dev == 0) {piMSleep(100); return;} if (dd->dev == 0) {piMSleep(100); return;}
PIByteArray ba; PIByteArray ba;
ba = dd->dev->read(dd->dev->threadedReadBufferSize()); ba = dd->dev->read(dd->dev->threadedReadBufferSize());
if (ba.isEmpty()) {piMSleep(10); return;} if (ba.isEmpty()) {piMSleep(10); return;}
dd->dev->threadedRead(ba.data(), ba.size_s());
//piCout << "Readed from" << dd->dev->path() << Hex << ba; //piCout << "Readed from" << dd->dev->path() << Hex << ba;
__device_pool__->deviceReaded(dd, ba); __device_pool__->deviceReaded(dd, ba);
} }

View File

@@ -284,6 +284,7 @@ public:
class DevicePool: public PIThread { class DevicePool: public PIThread {
PIOBJECT_SUBCLASS(DevicePool, PIThread) PIOBJECT_SUBCLASS(DevicePool, PIThread)
friend void __DevicePool_threadReadDP(void * ddp);
friend class PIConnection; friend class PIConnection;
public: public:
DevicePool(); DevicePool();
@@ -309,7 +310,6 @@ public:
void run(); void run();
static void threadReadDP(void * ddp);
void deviceReaded(DeviceData * dd, const PIByteArray & data); void deviceReaded(DeviceData * dd, const PIByteArray & data);
typedef PIMap<PIString, DeviceData * >::value_type DDPair; typedef PIMap<PIString, DeviceData * >::value_type DDPair;
@@ -407,6 +407,8 @@ private:
}; };
void __DevicePool_threadReadDP(void * ddp);
extern PIConnection::DevicePool * __device_pool__; extern PIConnection::DevicePool * __device_pool__;

View File

@@ -49,6 +49,7 @@ typedef bool (*ReadRetFunc)(void * , uchar * , int );
class PIP_EXPORT PIIODevice: public PIThread class PIP_EXPORT PIIODevice: public PIThread
{ {
PIOBJECT_SUBCLASS(PIIODevice, PIThread) PIOBJECT_SUBCLASS(PIIODevice, PIThread)
friend void __DevicePool_threadReadDP(void * ddp);
public: public:
//! Constructs a empty PIIODevice //! Constructs a empty PIIODevice