PIStringAsciixes
git-svn-id: svn://db.shs.com.ru/pip@101 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -61,16 +61,16 @@ public:
|
||||
|
||||
|
||||
//! Set read address
|
||||
void setReadAddress(const PIString & ip, int port) {setPath(ip + ":" + PIString::fromNumber(port));}
|
||||
void setReadAddress(const PIString & ip, int port) {setPath(ip + PIStringAscii(":") + PIString::fromNumber(port));}
|
||||
|
||||
//! Set read address in format "i.i.i.i:p"
|
||||
void setReadAddress(const PIString & ip_port) {setPath(ip_port);}
|
||||
|
||||
//! Set read IP
|
||||
void setReadIP(const PIString & ip) {parseAddress(path(), &ip_, &port_); setPath(ip + ":" + PIString::fromNumber(port_));}
|
||||
void setReadIP(const PIString & ip) {parseAddress(path(), &ip_, &port_); setPath(ip + PIStringAscii(":") + PIString::fromNumber(port_));}
|
||||
|
||||
//! Set read port
|
||||
void setReadPort(int port) {parseAddress(path(), &ip_, &port_); setPath(ip_ + ":" + PIString::fromNumber(port));}
|
||||
void setReadPort(int port) {parseAddress(path(), &ip_, &port_); setPath(ip_ + PIStringAscii(":") + PIString::fromNumber(port));}
|
||||
|
||||
|
||||
//! Set send address
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
|
||||
|
||||
//! Returns send address in format "i.i.i.i:p"
|
||||
PIString sendAddress() const {return ip_s + ":" + PIString::fromNumber(port_s);}
|
||||
PIString sendAddress() const {return ip_s + PIStringAscii(":") + PIString::fromNumber(port_s);}
|
||||
|
||||
//! Returns send IP
|
||||
PIString sendIP() const {return ip_s;}
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
|
||||
|
||||
//! Returns address of last received UDP packet in format "i.i.i.i:p"
|
||||
PIString lastReadAddress() const {return ip_r + ":" + PIString::fromNumber(port_r);}
|
||||
PIString lastReadAddress() const {return ip_r + PIStringAscii(":") + PIString::fromNumber(port_r);}
|
||||
|
||||
//! Returns IP of last received UDP packet
|
||||
PIString lastReadIP() const {return ip_r;}
|
||||
@@ -117,46 +117,46 @@ public:
|
||||
|
||||
|
||||
//! Set parameters to "parameters_". You should to reopen %PIEthernet to apply them
|
||||
void setParameters(PIFlags<PIEthernet::Parameters> parameters_) {setProperty("parameters", (int)parameters_);}
|
||||
void setParameters(PIFlags<PIEthernet::Parameters> parameters_) {setProperty(PIStringAscii("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("parameters").toInt()))[parameter];}
|
||||
bool isParameterSet(PIEthernet::Parameters parameter) const {return ((PIFlags<PIEthernet::Parameters>)(property(PIStringAscii("parameters")).toInt()))[parameter];}
|
||||
|
||||
//! Returns parameters
|
||||
PIFlags<PIEthernet::Parameters> parameters() const {return (PIFlags<PIEthernet::Parameters>)(property("parameters").toInt());}
|
||||
PIFlags<PIEthernet::Parameters> parameters() const {return (PIFlags<PIEthernet::Parameters>)(property(PIStringAscii("parameters")).toInt());}
|
||||
|
||||
//PIByteArray macAddress() {if (!init_) init(); struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); memcpy(ifr.ifr_name, "eth0", 5); ioctl(sock, SIOCSIFHWADDR, &ifr); return PIByteArray(&ifr.ifr_hwaddr.sa_data, 6);}
|
||||
|
||||
//! Returns %PIEthernet type
|
||||
Type type() const {return (Type)(property("type").toInt());}
|
||||
Type type() const {return (Type)(property(PIStringAscii("type")).toInt());}
|
||||
|
||||
//! Returns read timeout
|
||||
double readTimeout() const {return property("readTimeout").toDouble();}
|
||||
double readTimeout() const {return property(PIStringAscii("readTimeout")).toDouble();}
|
||||
|
||||
//! Returns write timeout
|
||||
double writeTimeout() const {return property("writeTimeout").toDouble();}
|
||||
double writeTimeout() const {return property(PIStringAscii("writeTimeout")).toDouble();}
|
||||
|
||||
//! Set timeout for read
|
||||
void setReadTimeout(double ms) {setProperty("readTimeout", ms);}
|
||||
void setReadTimeout(double ms) {setProperty(PIStringAscii("readTimeout"), ms);}
|
||||
|
||||
//! Set timeout for write
|
||||
void setWriteTimeout(double ms) {setProperty("writeTimeout", ms);}
|
||||
void setWriteTimeout(double ms) {setProperty(PIStringAscii("writeTimeout"), ms);}
|
||||
|
||||
|
||||
//! Returns TTL (Time To Live)
|
||||
int TTL() const {return property("TTL").toInt();}
|
||||
int TTL() const {return property(PIStringAscii("TTL")).toInt();}
|
||||
|
||||
//! Returns multicast TTL (Time To Live)
|
||||
int multicastTTL() const {return property("MulticastTTL").toInt();}
|
||||
int multicastTTL() const {return property(PIStringAscii("MulticastTTL")).toInt();}
|
||||
|
||||
//! Set TTL (Time To Live), default is 64
|
||||
void setTTL(int ttl) {setProperty("TTL", ttl);}
|
||||
void setTTL(int ttl) {setProperty(PIStringAscii("TTL"), ttl);}
|
||||
|
||||
//! Set multicast TTL (Time To Live), default is 1
|
||||
void setMulticastTTL(int ttl) {setProperty("MulticastTTL", ttl);}
|
||||
void setMulticastTTL(int ttl) {setProperty(PIStringAscii("MulticastTTL"), ttl);}
|
||||
|
||||
|
||||
//! Join to multicast group with address "group". Use only for UDP
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
bool connect();
|
||||
|
||||
//! Connect to TCP server with address "ip":"port". Use only for TCP_Client
|
||||
bool connect(const PIString & ip, int port) {setPath(ip + ":" + PIString::fromNumber(port)); return connect();}
|
||||
bool connect(const PIString & ip, int port) {setPath(ip + PIStringAscii(":") + PIString::fromNumber(port)); return connect();}
|
||||
|
||||
//! Connect to TCP server with address "ip_port". Use only for TCP_Client
|
||||
bool connect(const PIString & ip_port) {setPath(ip_port); return connect();}
|
||||
@@ -377,7 +377,7 @@ protected:
|
||||
|
||||
void propertyChanged(const PIString & name);
|
||||
|
||||
PIString fullPathPrefix() const {return "eth";}
|
||||
PIString fullPathPrefix() const {return PIStringAscii("eth");}
|
||||
void configureFromFullPath(const PIString & full_path);
|
||||
bool configureDevice(const void * e_main, const void * e_parent = 0);
|
||||
|
||||
@@ -407,7 +407,7 @@ protected:
|
||||
private:
|
||||
EVENT_HANDLER(void, clientDeleted);
|
||||
static void server_func(void * eth);
|
||||
void setType(Type t, bool reopen = true) {setProperty("type", (int)t); if (reopen && isOpened()) {closeDevice(); init(); openDevice();}}
|
||||
void setType(Type t, bool reopen = true) {setProperty(PIStringAscii("type"), (int)t); if (reopen && isOpened()) {closeDevice(); init(); openDevice();}}
|
||||
|
||||
inline static int ethErrorCore();
|
||||
inline static PIString ethErrorString();
|
||||
|
||||
Reference in New Issue
Block a user