threadedRead now const uchar *

pipacketextractor Header mode now more flexible
fix splitTime mode
more refactoring
add virtual override to functions
remove piforeach
replace 0 to nullptr
iterate over pimap via iterators
replace CONNECTU to CONNECT# with compile time check
This commit is contained in:
Бычков Андрей
2022-07-26 17:18:08 +03:00
parent a4882dc054
commit d13e68c206
36 changed files with 615 additions and 623 deletions

View File

@@ -170,7 +170,7 @@ bool PIBinaryLog::closeDevice() {
}
bool PIBinaryLog::threadedRead(uchar *readed, int size) {
bool PIBinaryLog::threadedRead(const uchar *readed, int size) {
// piCout << "binlog threaded read";
if (!canRead() || isEnd()) return PIIODevice::threadedRead(readed, size);
is_thread_ok = false;
@@ -429,6 +429,11 @@ int PIBinaryLog::readDevice(void *read_to, int max_size) {
}
int PIBinaryLog::writeDevice(const void * data, int size) {
return writeBinLog(default_id, data, size);
}
void PIBinaryLog::restart() {
bool th = isRunning();
if (th) stopThreadedRead();

View File

@@ -301,18 +301,18 @@ public:
static bool joinBinLogsSerial(const PIStringList & src, const PIString & dst);
protected:
PIString constructFullPathDevice() const;
void configureFromFullPathDevice(const PIString & full_path);
PIPropertyStorage constructVariantDevice() const;
void configureFromVariantDevice(const PIPropertyStorage & d);
int readDevice(void *read_to, int max_size);
int writeDevice(const void * data, int size) {return writeBinLog(default_id, data, size);}
bool openDevice();
bool closeDevice();
void propertyChanged(const char * s);
bool threadedRead(uchar *readed, int size);
void threadedReadTerminated() {pausemutex.unlock();}
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;}
virtual PIString constructFullPathDevice() const override;
virtual void configureFromFullPathDevice(const PIString & full_path) override;
virtual PIPropertyStorage constructVariantDevice() const override;
virtual void configureFromVariantDevice(const PIPropertyStorage & d) override;
virtual int readDevice(void *read_to, int max_size) override;
virtual int writeDevice(const void * data, int size) override;
virtual bool openDevice() override;
virtual bool closeDevice() override;
virtual void propertyChanged(const char * s) override;
virtual bool threadedRead(const uchar *readed, int size) override;
virtual void threadedReadTerminated() override {pausemutex.unlock();}
virtual DeviceInfoFlags deviceInfoFlags() const override {return PIIODevice::Reliable;}
private:
struct PIP_EXPORT BinLogRecord {

View File

@@ -41,15 +41,15 @@ public:
int readedCANID() const;
protected:
bool openDevice();
bool closeDevice();
int readDevice(void * read_to, int max_size);
int writeDevice(const void * data, int max_size);
PIString constructFullPathDevice() const;
void configureFromFullPathDevice(const PIString & full_path);
PIPropertyStorage constructVariantDevice() const;
void configureFromVariantDevice(const PIPropertyStorage & d);
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;}
virtual bool openDevice() override;
virtual bool closeDevice() override;
virtual int readDevice(void * read_to, int max_size) override;
virtual int writeDevice(const void * data, int max_size) override;
virtual PIString constructFullPathDevice() const override;
virtual void configureFromFullPathDevice(const PIString & full_path) override;
virtual PIPropertyStorage constructVariantDevice() const override;
virtual void configureFromVariantDevice(const PIPropertyStorage & d) override;
virtual DeviceInfoFlags deviceInfoFlags() const override {return PIIODevice::Reliable;}
private:
int sock;

View File

@@ -901,7 +901,7 @@ void PIEthernet::server_func(void * eth) {
ip += ":" + PIString::fromNumber(htons(client_addr.sin_port));
PIEthernet * e = new PIEthernet(s, ip);
ce->clients_mutex.lock();
CONNECTU(e, deleted, ce, clientDeleted)
CONNECT1(void, PIObject *, e, deleted, ce, clientDeleted)
ce->clients_ << e;
ce->clients_mutex.unlock();
ce->newConnection(e);

View File

@@ -462,24 +462,24 @@ public:
protected:
explicit PIEthernet(int sock, PIString ip_port);
void propertyChanged(const char * name);
virtual void propertyChanged(const char * name) override;
PIString constructFullPathDevice() const;
void configureFromFullPathDevice(const PIString & full_path);
PIPropertyStorage constructVariantDevice() const;
void configureFromVariantDevice(const PIPropertyStorage & d);
bool configureDevice(const void * e_main, const void * e_parent = 0);
int readDevice(void * read_to, int max_size);
int writeDevice(const void * data, int max_size);
DeviceInfoFlags deviceInfoFlags() const;
virtual PIString constructFullPathDevice() const override;
virtual void configureFromFullPathDevice(const PIString & full_path) override;
virtual PIPropertyStorage constructVariantDevice() const override;
virtual void configureFromVariantDevice(const PIPropertyStorage & d) override;
virtual bool configureDevice(const void * e_main, const void * e_parent = 0) override;
virtual int readDevice(void * read_to, int max_size) override;
virtual int writeDevice(const void * data, int max_size) override;
virtual DeviceInfoFlags deviceInfoFlags() const override;
//! Executes when any read function was successful. Default implementation does nothing
virtual void received(const void * data, int size) {;}
void construct();
bool init();
bool openDevice();
bool closeDevice();
virtual bool init() override;
virtual bool openDevice() override;
virtual bool closeDevice() override;
void closeSocket(int & sd);
void applyTimeouts();
void applyTimeout(int fd, int opt, double ms);

View File

@@ -180,7 +180,7 @@ public:
//! \~english Immediate write all buffered data to disk
//! \~russian Немедленно записывает все буферизированные данные на диск
void flush();
virtual void flush() override;
//! \~english Move read/write position to "position"
//! \~russian Перемещает позицию чтения/записи на "position"
@@ -324,15 +324,15 @@ public:
//! \}
protected:
PIString constructFullPathDevice() const;
void configureFromFullPathDevice(const PIString & full_path);
PIPropertyStorage constructVariantDevice() const;
void configureFromVariantDevice(const PIPropertyStorage & d);
int readDevice(void * read_to, int max_size);
int writeDevice(const void * data, int max_size);
bool openDevice();
bool closeDevice();
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Sequential | PIIODevice::Reliable;}
virtual PIString constructFullPathDevice() const override;
virtual void configureFromFullPathDevice(const PIString & full_path) override;
virtual PIPropertyStorage constructVariantDevice() const override;
virtual void configureFromVariantDevice(const PIPropertyStorage & d) override;
virtual int readDevice(void * read_to, int max_size) override;
virtual int writeDevice(const void * data, int max_size) override;
virtual bool openDevice() override;
virtual bool closeDevice() override;
virtual DeviceInfoFlags deviceInfoFlags() const override {return PIIODevice::Sequential | PIIODevice::Reliable;}
private:
PIString strType(const PIIODevice::DeviceMode type);

View File

@@ -85,10 +85,10 @@ public:
int writeByteArray(const PIByteArray & ba);
protected:
bool openDevice();
int readDevice(void * read_to, int size);
int writeDevice(const void * data_, int size);
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Sequential | PIIODevice::Reliable;}
virtual bool openDevice() override;
virtual int readDevice(void * read_to, int size) override;
virtual int writeDevice(const void * data_, int size) override;
virtual DeviceInfoFlags deviceInfoFlags() const override {return PIIODevice::Sequential | PIIODevice::Reliable;}
ssize_t pos;
PIByteArray * data_;

View File

@@ -159,7 +159,7 @@ bool PIIODevice::setOption(PIIODevice::DeviceOption o, bool yes) {
//! после каждого успешного потокового чтения. Метод должен быть
//! в формате "bool func(void * data, uchar * readed, int size)"
void PIIODevice::setThreadedReadSlot(ReadRetFunc func) {
ret_func_ = func;
func_read = func;
}
@@ -239,8 +239,8 @@ PIByteArray PIIODevice::read(int max_size) {
void PIIODevice::_init() {
opened_ = init_ = thread_started_ = false;
raise_threaded_read_ = true;
ret_func_ = 0;
ret_data_ = 0;
func_read = nullptr;
ret_data_ = nullptr;
tri = 0;
setOptions(0);
setReopenEnabled(true);
@@ -596,9 +596,9 @@ PIMap<PIConstChars, PIIODevice::FabricInfo> & PIIODevice::fabrics() {
}
bool PIIODevice::threadedRead(uchar *readed, int size) {
bool PIIODevice::threadedRead(const uchar *readed, int size) {
// piCout << "iodevice threaded read";
if (ret_func_ != 0) return ret_func_(ret_data_, readed, size);
if (func_read != 0) return func_read(readed, size, ret_data_);
return true;
}

View File

@@ -30,9 +30,9 @@
#include "pitimer.h"
#include "piqueue.h"
// function executed from threaded read, pass ThreadedReadData, readedData, sizeOfData
typedef bool (*ReadRetFunc)(void * , uchar * , int );
/// TODO: написать документацию, тут ничего не понятно
// function executed from threaded read, pass readedData, sizeOfData, ThreadedReadData
typedef bool (*ReadRetFunc)(const uchar *, int, void *);
#ifdef DOXYGEN
@@ -64,9 +64,9 @@ typedef bool (*ReadRetFunc)(void * , uchar * , int );
# define PIIODEVICE(name, prefix) \
PIOBJECT_SUBCLASS(name, PIIODevice) \
PIIODevice * copy() const {return new name();} \
PIIODevice * copy() const override {return new name();} \
public: \
virtual PIConstChars fullPathPrefix() const {return prefix;} \
virtual PIConstChars fullPathPrefix() const override {return prefix;} \
static PIConstChars fullPathPrefixS() {return prefix;} \
private:
@@ -239,7 +239,7 @@ public:
//! \~english Start threaded read and assign threaded read callback to "func"
//! \~russian Запускает потоковое чтение и устанавливает callback потокового чтения в "func"
void startThreadedRead(ReadRetFunc func) {ret_func_ = func; startThreadedRead();}
void startThreadedRead(ReadRetFunc func) {func_read = func; startThreadedRead();}
//! \~english Stop threaded read. Hard stop terminate thread, otherwise wait fo 10 seconds
//! \~russian Останавливает потоковое чтение. Жесткая остановка убивает поток, иначе ожидает 10 секунд
@@ -369,7 +369,7 @@ public:
EVENT(opened);
EVENT(closed);
EVENT2(threadedReadEvent, uchar * , readed, int, size);
EVENT2(threadedReadEvent, const uchar * , readed, int, size);
EVENT2(threadedWriteEvent, ullong, id, int, written_size);
//! \handlers
@@ -419,7 +419,7 @@ public:
//! \~english Raise if succesfull close
//! \~russian Вызывается при успешном закрытии
//! \fn void threadedReadEvent(uchar * readed, int size)
//! \fn void threadedReadEvent(const uchar * readed, int size)
//! \~english Raise if read thread succesfull read some data
//! \~russian Вызывается при успешном потоковом чтении данных
@@ -475,7 +475,7 @@ protected:
//! \~english Function executed when thread read some data, default implementation execute external callback "ret_func_"
//! \~russian Метод вызывается после каждого успешного потокового чтения, по умолчанию вызывает callback "ret_func_"
virtual bool threadedRead(uchar * readed, int size);
virtual bool threadedRead(const uchar * readed, int size);
//! \~english Reimplement to construct full unambiguous string, describes this device.
//! Default implementation returns \a path()
@@ -528,7 +528,7 @@ protected:
DeviceMode mode_;
DeviceOptions options_;
ReadRetFunc ret_func_;
ReadRetFunc func_read;
bool opened_;
void * ret_data_;
@@ -539,9 +539,9 @@ private:
virtual PIIODevice * copy() const {return 0;}
PIString fullPathOptions() const;
void _init();
void begin();
void run();
void end() {terminate();}
void begin() override;
void run() override;
void end() override {terminate();}
static void cacheFullPath(const PIString & full_path, const PIIODevice * d);
static PIMap<PIConstChars, FabricInfo> & fabrics();

View File

@@ -89,10 +89,10 @@ public:
int writeString(const PIString & string);
protected:
bool openDevice();
int readDevice(void * read_to, int max_size);
int writeDevice(const void * data, int max_size);
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Sequential | PIIODevice::Reliable;}
virtual bool openDevice() override;
virtual int readDevice(void * read_to, int max_size) override;
virtual int writeDevice(const void * data, int max_size) override;
virtual DeviceInfoFlags deviceInfoFlags() const override {return PIIODevice::Sequential | PIIODevice::Reliable;}
ssize_t pos;
PIString * str;

View File

@@ -61,11 +61,11 @@ PIPeer::PeerData::PeerData(const PIString & n): PIObject(n) {
dt_out.setPacketSize(_PIPEER_MSG_SIZE);
dt_in.setCRCEnabled(false);
dt_out.setCRCEnabled(false);
CONNECTU(&dt_in, sendRequest, this, dtSendRequestIn);
CONNECTU(&dt_out, sendRequest, this, dtSendRequestOut);
CONNECTU(&dt_in, receiveFinished, this, dtReceiveFinishedIn);
CONNECTU(&dt_out, receiveFinished, this, dtReceiveFinishedOut);
CONNECTU(&t, started, this, dtThread);
CONNECT1(void, PIByteArray &, &dt_in, sendRequest, this, dtSendRequestIn);
CONNECT1(void, PIByteArray &, &dt_out, sendRequest, this, dtSendRequestOut);
CONNECT1(void, bool, &dt_in, receiveFinished, this, dtReceiveFinishedIn);
CONNECT1(void, bool, &dt_out, receiveFinished, this, dtReceiveFinishedOut);
CONNECT0(void, &t, started, this, dtThread);
}
@@ -172,7 +172,7 @@ PIPeer::PIPeer(const PIString & n): PIIODevice(), inited__(false), eth_tcp_srv(P
self_info.dist = 0;
self_info.time = PISystemTime::current();
randomize();
CONNECTU(&sync_timer, tickEvent, this, timerEvent);
CONNECT2(void, void *, int, &sync_timer, tickEvent, this, timerEvent);
prev_ifaces = PIEthernet::interfaces();
no_timer = false;
sync_timer.addDelimiter(5);
@@ -247,7 +247,7 @@ void PIPeer::initEths(PIStringList al) {
eths_traffic << ce;
cint = prev_ifaces.getByAddress(a);
self_info.addresses << PeerInfo::PeerAddress(ce->path(), cint == 0 ? "255.255.255.0" : cint->netmask);
CONNECTU(ce, threadedReadEvent, this, dataRead);
CONNECT2(void, const uchar *, int, ce, threadedReadEvent, this, dataRead);
ce->startThreadedRead();
// piCoutObj << "dc binded to" << ce->path();
// piCoutObj << "add eth" << a;
@@ -282,7 +282,7 @@ void PIPeer::initMBcasts(PIStringList al) {
ce->joinMulticastGroup(_PIPEER_MULTICAST_IP);
if (ce->open()) {
eths_mcast << ce;
CONNECTU(ce, threadedReadEvent, this, mbcastRead);
CONNECT2(void, const uchar *, int, ce, threadedReadEvent, this, mbcastRead);
ce->startThreadedRead();
// piCout << "mcast bind to" << a << ce->sendIP();
} else {
@@ -302,7 +302,7 @@ void PIPeer::initMBcasts(PIStringList al) {
ce->setReadAddress(a, _PIPEER_BROADCAST_PORT);
if (ce->open()) {
eths_bcast << ce;
CONNECTU(ce, threadedReadEvent, this, mbcastRead);
CONNECT2(void, const uchar *, int, ce, threadedReadEvent, this, mbcastRead);
ce->startThreadedRead();
// piCout << "mc BC try" << a << nm << ce->sendIP();
// piCout << "bcast bind to" << a << nm;
@@ -319,7 +319,7 @@ void PIPeer::initMBcasts(PIStringList al) {
eth_lo.setReadAddress("127.0.0.1", p);
if (eth_lo.open()) {
eth_lo.setSendIP("127.0.0.1");
CONNECTU(&eth_lo, threadedReadEvent, this, mbcastRead);
CONNECT2(void, const uchar *, int, &eth_lo, threadedReadEvent, this, mbcastRead);
eth_lo.startThreadedRead();
// piCout << "lo binded to" << eth_lo.readAddress() << eth_lo.sendAddress();
//piCout << "add eth" << ta;
@@ -330,13 +330,13 @@ void PIPeer::initMBcasts(PIStringList al) {
eth_tcp_srv.init();
eth_tcp_srv.listen("0.0.0.0", _PIPEER_TCP_PORT, true);
eth_tcp_srv.setDebug(false);
CONNECTU(&eth_tcp_srv, newConnection, this, newTcpClient);
CONNECT1(void, PIEthernet *, &eth_tcp_srv, newConnection, this, newTcpClient);
eth_tcp_srv.startThreadedRead();
eth_tcp_cli.setName("__S__PIPeer_eth_TCP_Client");
eth_tcp_cli.init();
eth_tcp_cli.setDebug(false);
tcpClientReconnect();
CONNECTU(&eth_tcp_cli, threadedReadEvent, this, mbcastRead);
CONNECT2(void, const uchar *, int, &eth_tcp_cli, threadedReadEvent, this, mbcastRead);
CONNECTU(&eth_tcp_cli, disconnected, this, tcpClientReconnect);
eth_tcp_cli.startThreadedRead();
if (eths_mcast.isEmpty() && eths_bcast.isEmpty() && !eth_lo.isOpened()) piCoutObj << "Warning! Can`t find suitable network interface for multicast receive, check for exists at least one interface with multicasting enabled!";
@@ -444,7 +444,7 @@ void PIPeer::dtReceived(const PIString & from, const PIByteArray & data) {
}
bool PIPeer::dataRead(uchar * readed, int size) {
bool PIPeer::dataRead(const uchar * readed, int size) {
if (destroyed) {
//piCout << "[PIPeer] SegFault";
return true;
@@ -561,7 +561,7 @@ bool PIPeer::dataRead(uchar * readed, int size) {
}
bool PIPeer::mbcastRead(uchar * data, int size) {
bool PIPeer::mbcastRead(const uchar * data, int size) {
if (destroyed) {
//piCout << "[PIPeer] SegFault";
return true;
@@ -765,8 +765,8 @@ void PIPeer::addPeer(const PIPeer::PeerInfo & pd) {
peers << pd;
PeerInfo & p(peers.back());
p.init();
CONNECTU(p._data, sendRequest, this, sendInternal)
CONNECTU(p._data, received, this, dtReceived)
CONNECT2(void, const PIString &, const PIByteArray &, p._data, sendRequest, this, sendInternal)
CONNECT2(void, const PIString &, const PIByteArray &, p._data, received, this, dtReceived)
}
@@ -961,7 +961,7 @@ int PIPeer::writeDevice(const void *data, int size) {
void PIPeer::newTcpClient(PIEthernet *client) {
client->setName("__S__PIPeer_eth_TCP_ServerClient" + client->path());
piCoutObj << "client" << client->path();
CONNECTU(client, threadedReadEvent, this, mbcastRead);
CONNECT2(void, const uchar *, int, client, threadedReadEvent, this, mbcastRead);
client->startThreadedRead();
}
@@ -1009,8 +1009,9 @@ void PIPeer::initNetwork() {
self_info.addresses.clear();
PIVector<PIEthernet::Address> al = PIEthernet::allAddresses();
PIStringList sl;
piForeachC (PIEthernet::Address & a, al)
for (const PIEthernet::Address & a : al) {
sl << a.ipString();
}
initEths(sl);
// piCoutObj << sl << self_info.addresses.size();
sl.removeAll("127.0.0.1");

View File

@@ -132,8 +132,8 @@ protected:
virtual void peerConnected(const PIString & name) {;}
virtual void peerDisconnected(const PIString & name) {;}
EVENT_HANDLER2(bool, dataRead, uchar *, readed, int, size);
EVENT_HANDLER2(bool, mbcastRead, uchar *, readed, int, size);
EVENT_HANDLER2(bool, dataRead, const uchar *, readed, int, size);
EVENT_HANDLER2(bool, mbcastRead, const uchar *, readed, int, size);
private:
EVENT_HANDLER2(void, timerEvent, void * , data, int, delim);
@@ -164,15 +164,15 @@ private:
void addToRemoved(const PeerInfo & pi) {removed[pi.name] = PIPair<int, PISystemTime>(pi.cnt, pi.time);}
bool isRemoved(const PeerInfo & pi) const {return (removed.value(pi.name) == PIPair<int, PISystemTime>(pi.cnt, pi.time));}
bool openDevice();
bool closeDevice();
PIString constructFullPathDevice() const;
void configureFromFullPathDevice(const PIString &full_path);
PIPropertyStorage constructVariantDevice() const;
void configureFromVariantDevice(const PIPropertyStorage & d);
int readDevice(void * read_to, int max_size);
int writeDevice(const void * data, int size);
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;}
virtual bool openDevice() override;
virtual bool closeDevice() override;
virtual PIString constructFullPathDevice() const override;
virtual void configureFromFullPathDevice(const PIString &full_path) override;
virtual PIPropertyStorage constructVariantDevice() const override;
virtual void configureFromVariantDevice(const PIPropertyStorage & d) override;
virtual int readDevice(void * read_to, int max_size) override;
virtual int writeDevice(const void * data, int size) override;
virtual DeviceInfoFlags deviceInfoFlags() const override {return PIIODevice::Reliable;}
PeerInfo * quickestPeer(const PIString & to);
bool sendToNeighbour(PeerInfo * peer, const PIByteArray & ba);

View File

@@ -216,7 +216,7 @@ public:
//! \~english Discard all buffered input and output data
//! \~russian Откидывает все буферизированные данные для передачи и приема
void flush();
virtual void flush() override;
int read(void * read_to, int max_size) {return readDevice(read_to, max_size);}
@@ -282,19 +282,19 @@ public:
//! \}
protected:
PIString constructFullPathDevice() const;
void configureFromFullPathDevice(const PIString & full_path);
PIPropertyStorage constructVariantDevice() const;
void configureFromVariantDevice(const PIPropertyStorage & d);
bool configureDevice(const void * e_main, const void * e_parent = 0);
void optionsChanged();
void threadedReadBufferSizeChanged();
virtual PIString constructFullPathDevice() const override;
virtual void configureFromFullPathDevice(const PIString & full_path) override;
virtual PIPropertyStorage constructVariantDevice() const override;
virtual void configureFromVariantDevice(const PIPropertyStorage & d) override;
virtual bool configureDevice(const void * e_main, const void * e_parent = 0) override;
virtual void optionsChanged() override;
virtual void threadedReadBufferSizeChanged() override;
//! \~english Basic read function
//! \~russian Базовое чтение
int readDevice(void * read_to, int max_size);
int writeDevice(const void * data, int max_size);
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Sequential;}
virtual int readDevice(void * read_to, int max_size) override;
virtual int writeDevice(const void * data, int max_size) override;
virtual DeviceInfoFlags deviceInfoFlags() const override {return PIIODevice::Sequential;}
//! Executes when any read function was successful. Default implementation does nothing
virtual void received(const void * data, int size) {;}
@@ -306,8 +306,8 @@ protected:
bool setBit(int bit, bool on, const PIString & bname);
bool isBit(int bit, const PIString & bname) const;
bool openDevice();
bool closeDevice();
virtual bool openDevice() override;
virtual bool closeDevice() override;
PRIVATE_DECLARATION(PIP_EXPORT)
int fd, vtime;

View File

@@ -91,15 +91,15 @@ public:
protected:
bool openDevice();
bool closeDevice();
PIString constructFullPathDevice() const;
void configureFromFullPathDevice(const PIString & full_path);
PIPropertyStorage constructVariantDevice() const;
void configureFromVariantDevice(const PIPropertyStorage & d);
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);}
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;}
virtual bool openDevice() override;
virtual bool closeDevice() override;
virtual PIString constructFullPathDevice() const override;
virtual void configureFromFullPathDevice(const PIString & full_path) override;
virtual PIPropertyStorage constructVariantDevice() const override;
virtual void configureFromVariantDevice(const PIPropertyStorage & d) override;
virtual int readDevice(void * read_to, int max_size) override {return read(read_to, max_size, 0);}
virtual int writeDevice(const void * data, int max_size) override {return write(data, max_size, 0);}
virtual DeviceInfoFlags deviceInfoFlags() const override {return PIIODevice::Reliable;}
private:
void initPrivate();

View File

@@ -62,16 +62,16 @@ public:
protected:
bool openDevice();
bool closeDevice();
int readDevice(void * read_to, int max_size);
int writeDevice(const void * data, int max_size);
virtual bool openDevice() override;
virtual bool closeDevice() override;
virtual int readDevice(void * read_to, int max_size) override;
virtual int writeDevice(const void * data, int max_size) override;
PIString constructFullPathDevice() const;
void configureFromFullPathDevice(const PIString & full_path);
PIPropertyStorage constructVariantDevice() const;
void configureFromVariantDevice(const PIPropertyStorage & d);
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Sequential;}
virtual PIString constructFullPathDevice() const override;
virtual void configureFromFullPathDevice(const PIString & full_path) override;
virtual PIPropertyStorage constructVariantDevice() const override;
virtual void configureFromVariantDevice(const PIPropertyStorage & d) override;
virtual DeviceInfoFlags deviceInfoFlags() const override {return PIIODevice::Sequential;}
private:
uint spi_speed;

View File

@@ -45,11 +45,11 @@ public:
virtual ~PITransparentDevice();
protected:
bool openDevice();
bool closeDevice();
int readDevice(void * read_to, int max_size);
int writeDevice(const void * data, int max_size);
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;}
virtual bool openDevice() override;
virtual bool closeDevice() override;
virtual int readDevice(void * read_to, int max_size) override;
virtual int writeDevice(const void * data, int max_size) override;
virtual DeviceInfoFlags deviceInfoFlags() const override {return PIIODevice::Reliable;}
PIMutex que_mutex;
PIQueue<PIByteArray> que;

View File

@@ -157,17 +157,17 @@ public:
int controlWrite(const void * data, int max_size);
void flush();
virtual void flush() override;
protected:
bool configureDevice(const void * e_main, const void * e_parent = 0);
PIString constructFullPathDevice() const;
void configureFromFullPathDevice(const PIString & full_path);
int readDevice(void * read_to, int max_size);
int writeDevice(const void * data, int max_size);
bool openDevice();
bool closeDevice();
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;}
virtual bool configureDevice(const void * e_main, const void * e_parent = 0) override;
virtual PIString constructFullPathDevice() const override;
virtual void configureFromFullPathDevice(const PIString & full_path) override;
virtual int readDevice(void * read_to, int max_size) override;
virtual int writeDevice(const void * data, int max_size) override;
virtual bool openDevice() override;
virtual bool closeDevice() override;
virtual DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;}
PIVector<PIUSB::Endpoint> eps;
ushort vid_, pid_;