PIIODevice::bytesAvailible()

fix pistringlist pibinarystream write
pibinarystream::binaryStreamSize()
PIByteArray pibinarystream read with more size fix
pistring pibinarystream read optimization
fix bug in PIIOBinaryStream read and write if failed
workaround in PIIOString::readDevice
PISPI readDevice bug Fixed
This commit is contained in:
Бычков Андрей
2022-07-27 15:43:04 +03:00
parent d13e68c206
commit 3873f0b03b
50 changed files with 323 additions and 253 deletions

View File

@@ -136,7 +136,7 @@ private:
EVENT_HANDLER2(void, mcastRead, const uchar * , data, int, size);
void destroyAll();
void initAll(PIVector<PIEthernet::Address> al);
void run();
void run() override;
Channels _channels;
PIEthernet::Address mcast_address;

View File

@@ -308,7 +308,7 @@ public:
PIVector<PIConnection * > listeners;
};
void run();
void run() override;
void deviceReaded(DeviceData * dd, const PIByteArray & data);
@@ -372,7 +372,7 @@ private:
PIVector<PIIODevice * > devices;
PIByteArray sdata;
float int_;
void tick(void * , int);
void tick(void * , int) override;
};
PIMap<PIString, Extractor * > extractors;

View File

@@ -138,9 +138,9 @@ private:
friend bool operator !=(const PIDiagnostics::Entry & f, const PIDiagnostics::Entry & s);
friend bool operator <(const PIDiagnostics::Entry & f, const PIDiagnostics::Entry & s);
void tick(void *, int);
void tick(void *, int) override;
Entry calcHistory(PIQueue<Entry> & hist, int & cnt);
void propertyChanged(const char *);
void propertyChanged(const char *) override;
void changeDisconnectTimeout(float disct);
PIQueue<Entry> history_rec, history_send;

View File

@@ -137,6 +137,12 @@ void PIPacketExtractor::setDevice(PIIODevice * device_) {
}
ssize_t PIPacketExtractor::bytesAvailible() const {
if (dev) return dev->bytesAvailible();
else return 0;
}
void PIPacketExtractor::setBufferSize(int new_size) {
buffer_size = new_size;
buffer.resize(buffer_size);

View File

@@ -62,6 +62,7 @@ public:
//! Set child %device to "device_"
void setDevice(PIIODevice * device_);
ssize_t bytesAvailible() const override;
//! Returns buffer size
int bufferSize() const {return buffer_size;}
@@ -164,14 +165,14 @@ protected:
private:
void construct();
void propertyChanged(const char *);
virtual int readDevice(void * read_to, int max_size) override;
virtual int writeDevice(const void * data, int max_size) override;
virtual bool threadedRead(const uchar * readed, int size) override;
virtual PIString constructFullPathDevice() const override;
virtual bool openDevice() override;
virtual bool closeDevice() override;
virtual DeviceInfoFlags deviceInfoFlags() const override;
void propertyChanged(const char *) override;
int readDevice(void * read_to, int max_size) override;
int writeDevice(const void * data, int max_size) override;
bool threadedRead(const uchar * readed, int size) override;
PIString constructFullPathDevice() const override;
bool openDevice() override;
bool closeDevice() override;
DeviceInfoFlags deviceInfoFlags() const override;
PIIODevice * dev;
PIByteArray buffer, tmpbuf, src_header, src_footer, trbuf;