本文整理汇总了C++中UdpSocket::host方法的典型用法代码示例。如果您正苦于以下问题:C++ UdpSocket::host方法的具体用法?C++ UdpSocket::host怎么用?C++ UdpSocket::host使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UdpSocket
的用法示例。
在下文中一共展示了UdpSocket::host方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
ConnectionPointer<Connection> ConnectionManager2::getConnWithConfig(quint8 type, const QHash<QString, QVariant> &cfg)
{
this->refresh();
#ifdef HAVE_LIBYB
// We want to receive first USB enumeration events,
// so that connections created here can be opened
QApplication::processEvents();
#endif
Connection *enumCon = NULL;
for(int i = 0; i < m_conns.size(); ++i)
{
if(m_conns[i]->getType() != type)
continue;
switch(type)
{
case CONNECTION_SERIAL_PORT:
{
SerialPort *sp = (SerialPort*)m_conns[i];
if(sp->deviceName() == cfg["device_name"])
{
if(!sp->removable())
enumCon = sp;
else if(sp->baudRate() == cfg["baud_rate"])
return ConnectionPointer<Connection>::fromPtr(sp);
}
break;
}
case CONNECTION_TCP_SOCKET:
{
TcpSocket *socket = (TcpSocket*)m_conns[i];
if(socket->host() == cfg["host"] && socket->port() == cfg["port"])
return ConnectionPointer<Connection>::fromPtr(socket);
break;
}
case CONNECTION_UDP_SOCKET:
{
UdpSocket *socket = (UdpSocket*)m_conns[i];
if (socket->name() == cfg["name"] &&
socket->host() == cfg["host"] && socket->port() == cfg["port"])
return ConnectionPointer<Connection>::fromPtr(socket);
break;
}
case CONNECTION_PROXY_TUNNEL:
{
ProxyTunnel *tunnel = (ProxyTunnel*)m_conns[i];
if(tunnel->name() == cfg["name"])
return ConnectionPointer<Connection>::fromPtr(tunnel);
break;
}
case CONNECTION_SHUPITO_TUNNEL:
{
QHash<QString, QVariant> c = cfg.value("companions").toHash();
QHash<QString, QVariant>::iterator itr = c.find(ShupitoTunnel::getCompanionName());
if(itr == c.end())
return ConnectionPointer<Connection>();
qint64 id = itr.value().toLongLong();
if(id != 0 && id == m_conns[i]->getCompanionId(ShupitoTunnel::getCompanionName()))
return ConnectionPointer<Connection>::fromPtr((ShupitoTunnel*)m_conns[i]);
break;
}
case CONNECTION_SHUPITO_SPI_TUNNEL:
{
QHash<QString, QVariant> c = cfg.value("companions").toHash();
QHash<QString, QVariant>::iterator itr = c.find(ShupitoSpiTunnelConn::getCompanionName());
if(itr == c.end())
return ConnectionPointer<Connection>();
qint64 id = itr.value().toLongLong();
if(id != 0 && id == m_conns[i]->getCompanionId(ShupitoSpiTunnelConn::getCompanionName()))
return ConnectionPointer<Connection>::fromPtr((ShupitoSpiTunnelConn*)m_conns[i]);
break;
}
#ifdef HAVE_LIBYB
case CONNECTION_USB_ACM2:
{
UsbAcmConnection2 *usb = (UsbAcmConnection2*)m_conns[i];
if (usb->vid() == cfg.value("vid", 0).toInt() &&
usb->pid() == cfg.value("pid", 0).toInt() &&
usb->serialNumber() == cfg.value("serial_number").toString() &&
usb->intfName() == cfg.value("intf_name").toString() &&
usb->baudRate() == cfg.value("baud_rate", 115200).toInt() &&
usb->stopBits() == cfg.value("stop_bits", 0).toInt() &&
usb->parity() == (UsbAcmConnection2::parity_t)cfg.value("parity", 0).toInt() &&
usb->dataBits() == cfg.value("data_bits", 8).toInt())
{
usb->applyConfig(cfg);
return ConnectionPointer<Connection>::fromPtr(usb);
}
break;
}
case CONNECTION_SHUPITO23:
{
UsbShupito23Connection *usb = (UsbShupito23Connection*)m_conns[i];
if (usb->vid() == cfg.value("vid", 0).toInt() &&
usb->pid() == cfg.value("pid", 0).toInt() &&
usb->serialNumber() == cfg.value("serial_number").toString() &&
//.........这里部分代码省略.........