PIObject Property const char *

This commit is contained in:
Andrey
2022-04-29 18:17:03 +03:00
parent 97dd19f0c7
commit 8c8553a6af
7 changed files with 44 additions and 46 deletions

View File

@@ -201,44 +201,44 @@ public:
//! Set parameters to "parameters_". You should to reopen %PIEthernet to apply them
void setParameters(PIFlags<PIEthernet::Parameters> parameters_) {setProperty(PIStringAscii("parameters"), (int)parameters_);}
void setParameters(PIFlags<PIEthernet::Parameters> parameters_) {setProperty("parameters", (int)parameters_);}
//! Set parameter "parameter" to state "on". You should to reopen %PIEthernet to apply this
void setParameter(PIEthernet::Parameters parameter, bool on = true);
//! Returns if parameter "parameter" is set
bool isParameterSet(PIEthernet::Parameters parameter) const {return ((PIFlags<PIEthernet::Parameters>)(property(PIStringAscii("parameters")).toInt()))[parameter];}
bool isParameterSet(PIEthernet::Parameters parameter) const {return ((PIFlags<PIEthernet::Parameters>)(property("parameters").toInt()))[parameter];}
//! Returns parameters
PIFlags<PIEthernet::Parameters> parameters() const {return (PIFlags<PIEthernet::Parameters>)(property(PIStringAscii("parameters")).toInt());}
PIFlags<PIEthernet::Parameters> parameters() const {return (PIFlags<PIEthernet::Parameters>)(property("parameters").toInt());}
//! Returns %PIEthernet type
Type type() const {return (Type)(property(PIStringAscii("type")).toInt());}
Type type() const {return (Type)(property("type").toInt());}
//! Returns read timeout
double readTimeout() const {return property(PIStringAscii("readTimeout")).toDouble();}
double readTimeout() const {return property("readTimeout").toDouble();}
//! Returns write timeout
double writeTimeout() const {return property(PIStringAscii("writeTimeout")).toDouble();}
double writeTimeout() const {return property("writeTimeout").toDouble();}
//! Set timeout for read
void setReadTimeout(double ms) {setProperty(PIStringAscii("readTimeout"), ms);}
void setReadTimeout(double ms) {setProperty("readTimeout", ms);}
//! Set timeout for write
void setWriteTimeout(double ms) {setProperty(PIStringAscii("writeTimeout"), ms);}
void setWriteTimeout(double ms) {setProperty("writeTimeout", ms);}
//! Returns TTL (Time To Live)
int TTL() const {return property(PIStringAscii("TTL")).toInt();}
int TTL() const {return property("TTL").toInt();}
//! Returns multicast TTL (Time To Live)
int multicastTTL() const {return property(PIStringAscii("MulticastTTL")).toInt();}
int multicastTTL() const {return property("MulticastTTL").toInt();}
//! Set TTL (Time To Live), default is 64
void setTTL(int ttl) {setProperty(PIStringAscii("TTL"), ttl);}
void setTTL(int ttl) {setProperty("TTL", ttl);}
//! Set multicast TTL (Time To Live), default is 1
void setMulticastTTL(int ttl) {setProperty(PIStringAscii("MulticastTTL"), ttl);}
void setMulticastTTL(int ttl) {setProperty("MulticastTTL", ttl);}
//! Join to multicast group with address "group". Use only for UDP
@@ -499,7 +499,7 @@ protected:
private:
EVENT_HANDLER1(void, clientDeleted, PIObject *, o);
static void server_func(void * eth);
void setType(Type t, bool reopen = true) {setProperty(PIStringAscii("type"), (int)t); if (reopen && isOpened()) {closeDevice(); init(); openDevice();}}
void setType(Type t, bool reopen = true) {setProperty("type", (int)t); if (reopen && isOpened()) {closeDevice(); init(); openDevice();}}
static int ethErrorCore();
static PIString ethErrorString();

View File

@@ -109,10 +109,10 @@ public:
DeviceInfoFlags infoFlags() const {return deviceInfoFlags();}
//! Current path of device
PIString path() const {return property(PIStringAscii("path")).toString();}
PIString path() const {return property("path").toString();}
//! Set path of device
void setPath(const PIString & path) {setProperty(PIStringAscii("path"), path);}
void setPath(const PIString & path) {setProperty("path", path);}
//! Return \b true if mode is ReadOnly or ReadWrite
bool isReadable() const {return (mode_ & ReadOnly);}
@@ -134,17 +134,17 @@ public:
//! Set execution of \a open enabled while threaded read on closed device
void setReopenEnabled(bool yes = true) {setProperty(PIStringAscii("reopenEnabled"), yes);}
void setReopenEnabled(bool yes = true) {setProperty("reopenEnabled", yes);}
//! Set timeout in milliseconds between \a open tryings if reopen is enabled
void setReopenTimeout(int msecs) {setProperty(PIStringAscii("reopenTimeout"), msecs);}
void setReopenTimeout(int msecs) {setProperty("reopenTimeout", msecs);}
//! Return reopen enable
bool isReopenEnabled() const {return property(PIStringAscii("reopenEnabled")).toBool();}
bool isReopenEnabled() const {return property("reopenEnabled").toBool();}
//! Return reopen timeout
int reopenTimeout() {return property(PIStringAscii("reopenTimeout")).toInt();}
int reopenTimeout() {return property("reopenTimeout").toInt();}
/** \brief Set "threaded read slot"