git-svn-id: svn://db.shs.com.ru/pip@565 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -282,6 +282,7 @@ protected:
|
|||||||
bool closeDevice();
|
bool closeDevice();
|
||||||
void propertyChanged(const PIString &);
|
void propertyChanged(const PIString &);
|
||||||
bool threadedRead(uchar *readed, int size);
|
bool threadedRead(uchar *readed, int size);
|
||||||
|
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct BinLogRecord {
|
struct BinLogRecord {
|
||||||
|
|||||||
@@ -790,6 +790,18 @@ int PIEthernet::writeDevice(const void * data, int max_size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PIIODevice::DeviceInfoFlags PIEthernet::deviceInfoFlags() const {
|
||||||
|
switch (type()) {
|
||||||
|
case UDP: return 0;
|
||||||
|
case TCP_Client:
|
||||||
|
case TCP_Server:
|
||||||
|
case TCP_SingleTCP: return Sequential | Reliable;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PIEthernet::clientDeleted() {
|
void PIEthernet::clientDeleted() {
|
||||||
clients_mutex.lock();
|
clients_mutex.lock();
|
||||||
clients_.removeOne((PIEthernet*)emitter());
|
clients_.removeOne((PIEthernet*)emitter());
|
||||||
|
|||||||
@@ -467,6 +467,7 @@ protected:
|
|||||||
bool configureDevice(const void * e_main, const void * e_parent = 0);
|
bool configureDevice(const void * e_main, const void * e_parent = 0);
|
||||||
int readDevice(void * read_to, int max_size);
|
int readDevice(void * read_to, int max_size);
|
||||||
int writeDevice(const void * data, int max_size);
|
int writeDevice(const void * data, int max_size);
|
||||||
|
DeviceInfoFlags deviceInfoFlags() const;
|
||||||
|
|
||||||
//! Executes when any read function was successful. Default implementation does nothing
|
//! Executes when any read function was successful. Default implementation does nothing
|
||||||
virtual void received(const void * data, int size) {;}
|
virtual void received(const void * data, int size) {;}
|
||||||
|
|||||||
@@ -293,6 +293,7 @@ protected:
|
|||||||
int writeDevice(const void * data, int max_size);
|
int writeDevice(const void * data, int max_size);
|
||||||
bool openDevice();
|
bool openDevice();
|
||||||
bool closeDevice();
|
bool closeDevice();
|
||||||
|
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Sequential | PIIODevice::Reliable;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PIString strType(const PIIODevice::DeviceMode type);
|
PIString strType(const PIIODevice::DeviceMode type);
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ protected:
|
|||||||
bool openDevice();
|
bool openDevice();
|
||||||
int readDevice(void * read_to, int size);
|
int readDevice(void * read_to, int size);
|
||||||
int writeDevice(const void * data_, int size);
|
int writeDevice(const void * data_, int size);
|
||||||
|
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Sequential | PIIODevice::Reliable;}
|
||||||
|
|
||||||
ssize_t pos;
|
ssize_t pos;
|
||||||
PIByteArray * data_;
|
PIByteArray * data_;
|
||||||
|
|||||||
@@ -69,7 +69,14 @@ public:
|
|||||||
BlockingWrite /*! \a write block until data is sent, default off */ = 0x02
|
BlockingWrite /*! \a write block until data is sent, default off */ = 0x02
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! \brief Characteristics of PIIODevice subclass
|
||||||
|
enum DeviceInfoFlag {
|
||||||
|
Sequential /*! Continuous channel */ = 0x01,
|
||||||
|
Reliable /*! Channel is safe */ = 0x02
|
||||||
|
};
|
||||||
|
|
||||||
typedef PIFlags<DeviceOption> DeviceOptions;
|
typedef PIFlags<DeviceOption> DeviceOptions;
|
||||||
|
typedef PIFlags<DeviceInfoFlag> DeviceInfoFlags;
|
||||||
|
|
||||||
explicit PIIODevice(const PIString & path, DeviceMode mode = ReadWrite);
|
explicit PIIODevice(const PIString & path, DeviceMode mode = ReadWrite);
|
||||||
virtual ~PIIODevice();
|
virtual ~PIIODevice();
|
||||||
@@ -92,6 +99,9 @@ public:
|
|||||||
//! Set device option "o" to "yes" and return previous state
|
//! Set device option "o" to "yes" and return previous state
|
||||||
bool setOption(DeviceOption o, bool yes = true);
|
bool setOption(DeviceOption o, bool yes = true);
|
||||||
|
|
||||||
|
//! Returns device characteristic flags
|
||||||
|
DeviceInfoFlags infoFlags() const {return deviceInfoFlags();}
|
||||||
|
|
||||||
//! Current path of device
|
//! Current path of device
|
||||||
PIString path() const {return property(PIStringAscii("path")).toString();}
|
PIString path() const {return property(PIStringAscii("path")).toString();}
|
||||||
|
|
||||||
@@ -336,6 +346,9 @@ protected:
|
|||||||
//! Reimplement to apply new device options
|
//! Reimplement to apply new device options
|
||||||
virtual void optionsChanged() {;}
|
virtual void optionsChanged() {;}
|
||||||
|
|
||||||
|
//! Reimplement to return correct \a DeviceInfoFlags. Default implementation returns 0
|
||||||
|
virtual DeviceInfoFlags deviceInfoFlags() const {return 0;}
|
||||||
|
|
||||||
//! Reimplement to apply new \a threadedReadBufferSize()
|
//! Reimplement to apply new \a threadedReadBufferSize()
|
||||||
virtual void threadedReadBufferSizeChanged() {;}
|
virtual void threadedReadBufferSizeChanged() {;}
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ protected:
|
|||||||
bool openDevice();
|
bool openDevice();
|
||||||
int readDevice(void * read_to, int max_size);
|
int readDevice(void * read_to, int max_size);
|
||||||
int writeDevice(const void * data, int max_size);
|
int writeDevice(const void * data, int max_size);
|
||||||
|
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Sequential | PIIODevice::Reliable;}
|
||||||
|
|
||||||
ssize_t pos;
|
ssize_t pos;
|
||||||
PIString * str;
|
PIString * str;
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ private:
|
|||||||
PIString fullPathPrefix() const {return PIStringAscii("pckext");}
|
PIString fullPathPrefix() const {return PIStringAscii("pckext");}
|
||||||
PIString constructFullPathDevice() const;
|
PIString constructFullPathDevice() const;
|
||||||
bool openDevice() {if (dev == 0) return false; return dev->open();}
|
bool openDevice() {if (dev == 0) return false; return dev->open();}
|
||||||
|
DeviceInfoFlags deviceInfoFlags() const {if (dev) return dev->infoFlags(); return 0;}
|
||||||
|
|
||||||
PIIODevice * dev;
|
PIIODevice * dev;
|
||||||
PIByteArray buffer, tmpbuf, src_header, src_footer, trbuf;
|
PIByteArray buffer, tmpbuf, src_header, src_footer, trbuf;
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ private:
|
|||||||
void configureFromFullPathDevice(const PIString &full_path);
|
void configureFromFullPathDevice(const PIString &full_path);
|
||||||
int readDevice(void * read_to, int max_size);
|
int readDevice(void * read_to, int max_size);
|
||||||
int writeDevice(const void * data, int size);
|
int writeDevice(const void * data, int size);
|
||||||
|
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;}
|
||||||
|
|
||||||
PeerInfo * quickestPeer(const PIString & to);
|
PeerInfo * quickestPeer(const PIString & to);
|
||||||
bool sendToNeighbour(PeerInfo * peer, const PIByteArray & ba);
|
bool sendToNeighbour(PeerInfo * peer, const PIByteArray & ba);
|
||||||
|
|||||||
@@ -208,6 +208,7 @@ protected:
|
|||||||
void threadedReadBufferSizeChanged();
|
void threadedReadBufferSizeChanged();
|
||||||
int readDevice(void * read_to, int max_size);
|
int readDevice(void * read_to, int max_size);
|
||||||
int writeDevice(const void * data, int max_size);
|
int writeDevice(const void * data, int max_size);
|
||||||
|
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Sequential;}
|
||||||
|
|
||||||
//! Executes when any read function was successful. Default implementation does nothing
|
//! Executes when any read function was successful. Default implementation does nothing
|
||||||
virtual void received(const void * data, int size) {;}
|
virtual void received(const void * data, int size) {;}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ protected:
|
|||||||
void configureFromFullPathDevice(const PIString & full_path);
|
void configureFromFullPathDevice(const PIString & full_path);
|
||||||
int readDevice(void * read_to, int max_size) {return read(read_to, max_size, 0);}
|
int readDevice(void * read_to, int max_size) {return read(read_to, max_size, 0);}
|
||||||
int writeDevice(const void * data, int max_size) {return write(data, max_size, 0);}
|
int writeDevice(const void * data, int max_size) {return write(data, max_size, 0);}
|
||||||
|
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initPrivate();
|
void initPrivate();
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ protected:
|
|||||||
int readDevice(void * read_to, int max_size);
|
int readDevice(void * read_to, int max_size);
|
||||||
int writeDevice(const void * data, int max_size);
|
int writeDevice(const void * data, int max_size);
|
||||||
PIString fullPathPrefix() const {return PIStringAscii("tr");}
|
PIString fullPathPrefix() const {return PIStringAscii("tr");}
|
||||||
|
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;}
|
||||||
|
|
||||||
PIMutex que_mutex;
|
PIMutex que_mutex;
|
||||||
PIQueue<PIByteArray> que;
|
PIQueue<PIByteArray> que;
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ protected:
|
|||||||
//bool init();
|
//bool init();
|
||||||
bool openDevice();
|
bool openDevice();
|
||||||
bool closeDevice();
|
bool closeDevice();
|
||||||
|
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;}
|
||||||
|
|
||||||
PIVector<PIUSB::Endpoint> eps;
|
PIVector<PIUSB::Endpoint> eps;
|
||||||
ushort vid_, pid_;
|
ushort vid_, pid_;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
#define PIVERSION_H
|
#define PIVERSION_H
|
||||||
|
|
||||||
#define PIP_VERSION_MAJOR 1
|
#define PIP_VERSION_MAJOR 1
|
||||||
#define PIP_VERSION_MINOR 3
|
#define PIP_VERSION_MINOR 4
|
||||||
#define PIP_VERSION_REVISION 0
|
#define PIP_VERSION_REVISION 0
|
||||||
#define PIP_VERSION_SUFFIX "_alpha"
|
#define PIP_VERSION_SUFFIX ""
|
||||||
|
|
||||||
#endif // PIVERSION_H
|
#endif // PIVERSION_H
|
||||||
|
|||||||
Reference in New Issue
Block a user