virtual void sendEvent(const osgGA::Event &event)
{
    if (event.getName() == "/zeroconf/advertise")
    {
        std::string  type;
        unsigned int port = 0;
        event.getUserValue("type", type);
        event.getUserValue("port", port);
        if (type.empty() || (port == 0))
        {
            OSG_WARN << "ZeroConfRegisterDevice :: could not advertise service, missing type/port " << std::endl;
        }
        else
        {
            advertise(type, port);
        }
    }
}
Пример #2
0
bool OscSendingDevice::sendEventImpl(const osgGA::Event &ea, MsgIdType msg_id)
{
    bool do_send(false);
    if (ea.getUserDataContainer())
    {
        std::string key = ea.getUserDataContainer()->getName();
        if (key.empty()) key = ea.getName();
        if (key.empty()) key = "user_data";
        
        sendUserDataContainer(transliterateKey(key), ea.getUserDataContainer(), true, msg_id);
        
        do_send = true;
    }
    
    if (do_send)
    {
        OSG_INFO << "OscDevice :: sending event per OSC " << std::endl;
        
        _transmitSocket.Send( _oscStream.Data(), _oscStream.Size() );
        _oscStream.Clear();
    }
    
    return do_send;
}