Esempio n. 1
0
void TUIServerApp::handleSystemCmdMsg(HostEvent * msg) {
    HostAddress address = msg->getAddress();
    SystemCmdMsg * msg2 = static_cast<SystemCmdMsg *>(msg->getPayload());
    const SystemCmd & systemCmd = msg2->getPayload();
    address.setPortNr(systemCmd.getPortNr());
    if (systemCmd.getCmd() == SystemCmd::requestConnection) {
        TFDEBUG("SystemCmdMsg::RequestConnection: " << address);
        this->outHostMsgDispatcher.addDstAddress(address);
        if (this->usingMulticast) {
            MulticastGroupInvitationMsg * event = new MulticastGroupInvitationMsg();
            event->setPayload(this->multicastGroup);
            this->outEventQueue.push(event);
        } 

        {
            {
                GUIDEventTypeIDVectorMsg * event = new GUIDEventTypeIDVectorMsg();
                event->setPayload(this->guidEventTypeIDVector);
                this->outEventQueue.push(event);
            }
            {
                AttachedObjectsMsg * event = new AttachedObjectsMsg();
                event->setPayload(this->attachedObjects);
                this->outEventQueue.push(event);
            }

        }
    } else if (systemCmd.getCmd() == SystemCmd::removeConnection) {
        TFDEBUG("SystemCmdMsg::RemoveConnection: " << address);
        this->outHostMsgDispatcher.removeDstAddress(address);
    }
}
DigitalToAnalogMSP::DigitalToAnalogMSP(const MSPConfig & config) :
    config(config),
    out(0) {

    this->eventDelegate.setReceiver(this, &DigitalToAnalogMSP::handleEvent);
    
    try {
        this->value0 = config.getParameterGroup().getDouble("Convert|Value_0");
        this->value1 = config.getParameterGroup().getDouble("Convert|Value_1");
        TFDEBUG("Value_0 = " << this->value0);
        TFDEBUG("Value_1 = " << this->value1);
    }
    catch(Exception & e) {
        TFERROR(e.getFormattedString());
    }
}
Esempio n. 3
0
void TUIClientApp::handleMulticastGroupInvitationMsg(MulticastGroupInvitationMsg * event) {
    TFDEBUG("TUIClientApp::handleMulticastGroupInvitationMsg " << event);
    const HostAddress & address = event->getPayload();
    this->multicastListener.setMCGroupIPAddress(address.getIPAddress());
    this->multicastListener.setPort(address.getPortNr());
    this->multicastListener.create();
    this->multicastListenerActivated = true;
    SystemCmdMsg * msg = new SystemCmdMsg();
    msg->setPayload(SystemCmd(SystemCmd::removeConnection, static_cast<unsigned short>(this->myReceivePortNr)));
    this->outEventQueue.push(msg);
}
Esempio n. 4
0
void TUIClientApp::handleAttachedObjectsMsg(AttachedObjectsMsg * event) {
    TFDEBUG("TUIClientApp::handleAttachedObjectsMsg " << event);
    if ( ! this->connectedWithServer) {
        this->stubContainer.createStubs(event->getPayload().getTUIObjectInstanceVector(), event->getPayload().getTUIObjectTypeVector());
        this->attachedObjects = event->getPayload();
        this->connectedWithServer = true;
        if (this->systemNotificationSink) {
            this->systemNotificationSink->push(new SystemMsg(CONNECTION_ESTABLISHED));
        }
    }
}
AnalogToDigitalMSP::AnalogToDigitalMSP(const MSPConfig & config) :
    config(config),
    out(0) {

    this->eventDelegate.setReceiver(this, &AnalogToDigitalMSP::handleEvent);

    try {
        this->threshold = static_cast<float>(config.getParameterGroup().getDouble("Convert|Threshold"));
        TFDEBUG("Threshold = " << this->threshold);
    }
    catch(Exception & e) {
        TFERROR(e.getFormattedString());
    }
}