23.06.2014 - PICodeParser, PICodeInfo, PIConnection, new binary "pip_cmg"

This commit is contained in:
peri4
2014-06-23 21:08:27 +04:00
parent 2e5e75c4c4
commit 15a20d40ac
56 changed files with 10315 additions and 760 deletions

View File

@@ -86,11 +86,11 @@ PIEthernet::PIEthernet(int sock_, PIString ip_port): PIIODevice("", ReadWrite) {
sock_s = -1;
init_ = opened_ = connected_ = true;
connecting_ = false;
server_thread_.setData(this);
server_thread_.setData(this);
setParameters(PIEthernet::ReuseAddress);
setThreadedReadBufferSize(65536);
setPriority(piHigh);
setType(TCP_Client);
setType(TCP_Client, false);
setPath(ip_port);
}
@@ -165,7 +165,7 @@ bool PIEthernet::openDevice() {
init();
if (sock == -1 || path().isEmpty()) return false;
parseAddress(path(), &ip_, &port_);
if (type() != UDP)
if (type() != UDP && mode() == PIIODevice::WriteOnly)
return true;
//piCout << "bind to" << (params[PIEthernet::Broadcast] ? "bc" : ip_) << ":" << port_ << " ...";
memset(&addr_, 0, sizeof(addr_));
@@ -563,6 +563,17 @@ bool PIEthernet::configureDevice(const void * e_main, const void * e_parent) {
}
PIString PIEthernet::constructFullPath() const {
PIString ret(fullPathPrefix() + "://");
ret << (type() == PIEthernet::UDP ? "UDP" : "TCP") << ":" << readIP() << ":" << readPort();
if (type() == PIEthernet::UDP) {
piForeachC (PIString & m, multicastGroups())
ret << ":mcast:" << m;
}
return ret;
}
void PIEthernet::configureFromFullPath(const PIString & full_path) {
PIStringList pl = full_path.split(":");
bool mcast = false;
@@ -574,8 +585,8 @@ void PIEthernet::configureFromFullPath(const PIString & full_path) {
if (p == "udp") setType(UDP);
if (p == "tcp") setType(TCP_Client);
break;
case 1: setReadIP(p); break;
case 2: setReadPort(p.toInt()); break;
case 1: setReadIP(p); setSendIP(p); break;
case 2: setReadPort(p.toInt()); setSendPort(p.toInt()); break;
}
if (i <= 2) continue;
if (i % 2 == 1) {if (p.toLowerCase() == "mcast") mcast = true;}