30.11.2013 - New PICollection namespace, Android support, my own PIVector implementation
This commit is contained in:
22
piprotocol.h
22
piprotocol.h
@@ -1,5 +1,5 @@
|
||||
/*! \file piprotocol.h
|
||||
* \brief Highly configurable from file device
|
||||
* \brief Highly configurable from file I/O channel
|
||||
*/
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
@@ -76,13 +76,25 @@ class PIP_EXPORT PIProtocol: public PIObject
|
||||
friend class PIMultiProtocol;
|
||||
enum Type {None, Serial, Ethernet};
|
||||
public:
|
||||
|
||||
//! Contructs an empty unconfigured protocol
|
||||
PIProtocol(): PIObject() {init();}
|
||||
|
||||
//! Contructs protocol configured from file "config", config file section "name"
|
||||
PIProtocol(const PIString & config, const PIString & name, void * recHeaderPtr = 0, int recHeaderSize = 0,
|
||||
void * recDataPtr = 0, int recDataSize = 0, void * sendDataPtr = 0, int sendDataSize = 0); // from config
|
||||
|
||||
virtual ~PIProtocol();
|
||||
|
||||
enum Quality {Unknown = 1, Failure = 2, Bad = 3, Average = 4, Good = 5};
|
||||
|
||||
|
||||
//! Connection quality
|
||||
enum Quality {
|
||||
Unknown /** Unknown, no one packet received yet */ = 1,
|
||||
Failure /** No connection, no one correct packet received for last period */ = 2,
|
||||
Bad /** Bad connection, correct packets received <= 20% */ = 3,
|
||||
Average /** Average connection, correct packets received > 20% and <= 80% */ = 4,
|
||||
Good /** Good connection, correct packets received > 80% */ = 5
|
||||
};
|
||||
|
||||
EVENT_HANDLER0(void, startReceive) {startReceive(-1.f);}
|
||||
EVENT_HANDLER1(void, startReceive, float, exp_frequency); // if "frequency = -1" used last passed value
|
||||
EVENT_HANDLER0(void, stopReceive);
|
||||
@@ -191,6 +203,8 @@ protected:
|
||||
virtual bool aboutSend() {return true;} // executed before send data, if return 'false' then data is not sending
|
||||
|
||||
void init();
|
||||
void init_sender(PIConfig::Entry & b, PIConfig::Entry & sb, const PIString & config);
|
||||
void init_receiver(PIConfig::Entry & b, PIConfig::Entry & rb, const PIString & config);
|
||||
void check_state();
|
||||
void calc_freq();
|
||||
void calc_diag();
|
||||
|
||||
Reference in New Issue
Block a user