示例#1
0
Config::Config(QDialog *parent) :
    QDialog(parent),
    ui(new Ui::Config)
{
    ui->setupUi(this);

    Clientcont = ClientControl::getInstance();
    Clientcam = ClientCamera::getInstance();
    QObject::connect(this, SIGNAL(getIPCam()),Clientcam, SLOT(getIP()), Qt::QueuedConnection);
    QObject::connect(this, SIGNAL(getPortCam()),Clientcam, SLOT(getPort()), Qt::QueuedConnection);
    QObject::connect(this, SIGNAL(getIPRobot()),Clientcont, SLOT(getIP()), Qt::QueuedConnection);
    QObject::connect(this, SIGNAL(getPortRobot()),Clientcont, SLOT(getPort()), Qt::QueuedConnection);
    QObject::connect(Clientcam, SIGNAL(sendIP(QString)),this, SLOT(receiveIPCam(QString)), Qt::QueuedConnection);
    QObject::connect(Clientcam, SIGNAL(sendPort(int)),this, SLOT(receivePortCam(int)), Qt::QueuedConnection);
    QObject::connect(Clientcont, SIGNAL(sendIP(QString)),this, SLOT(receiveIPRobot(QString)), Qt::QueuedConnection);
    QObject::connect(Clientcont, SIGNAL(sendPort(int)),this, SLOT(receivePortRobot(int)), Qt::QueuedConnection);
    QObject::connect(this, SIGNAL(setIPCam(QString)),Clientcam, SLOT(setIP(QString)), Qt::QueuedConnection);
    QObject::connect(this, SIGNAL(setPortCam(int)),Clientcam, SLOT(setPort(int)), Qt::QueuedConnection);
    QObject::connect(this, SIGNAL(setIPRobot(QString)),Clientcont, SLOT(setIP(QString)), Qt::QueuedConnection);
    QObject::connect(this, SIGNAL(setPortRobot(int)),Clientcont, SLOT(setPort(int)), Qt::QueuedConnection);

    emit getIPCam();
    emit getPortCam();
    emit getIPRobot();
    emit getPortRobot();
    this->setAttribute(Qt::WA_DeleteOnClose );
}
示例#2
0
 void ProcessPerMessage::sendTransportLayer(Message * outboundMessage,int protoId, int hlp){
     int infoLength = 4;
     size_t headerLength = sizeof(int) + infoLength + sizeof(size_t);
     // printf("UDP/TCP header length: %lu\n", headerLength);
     char* header = new char[headerLength];
     *((int*)header) = hlp;
     memset(header + sizeof(int), 0, infoLength);
     *((size_t*)(header + sizeof(int) + infoLength)) = outboundMessage->msgLen();
     outboundMessage->msgAddHdr(header, headerLength);
     sendIP(outboundMessage, protoId);
 }