Exemple #1
0
 public void InitConnection()
 {
     if (OSCMaster.Clients.ContainsKey("AugmentaSimulatorOutput"))
     {
         OSCMaster.RemoveClient("AugmentaSimulatorOutput");
     }
     OSCMaster.CreateClient("AugmentaSimulatorOutput", IPAddress.Parse(OutputIP), OutputPort);
 }
Exemple #2
0
 /// <summary>
 /// Create client to send Augmenta message
 /// </summary>
 void CreateAugmentaClient()
 {
     //Create output client
     if (OSCMaster.Clients.ContainsKey("AugmentaSimulatorOutput"))
     {
         OSCMaster.RemoveClient("AugmentaSimulatorOutput");
     }
     OSCMaster.CreateClient("AugmentaSimulatorOutput", IPAddress.Parse(outputIP), outputPort);
 }
Exemple #3
0
    void HandleConnectV2(OSCMessage message)
    {
        //Answer connect
        string outputIP     = message.Data[0].ToString();
        int    outputPort   = (int)message.Data[1];
        string protocolType = message.Data[2].ToString();
        int    version      = (int)message.Data[3];

        if (protocolType != "osc" && protocolType != "OSC")
        {
            if (debug)
            {
                Debug.Log("Can only create osc protocol type.");
            }

            return;
        }

        string outputID = GetIDFromIPAndPort(outputIP, outputPort);

        //Create output client
        if (!OSCMaster.Clients.ContainsKey(outputID))
        {
            OSCMaster.CreateClient(outputID, outputIP, outputPort);
        }

        if (!_augmentaOutputs.ContainsKey(outputID))
        {
            _augmentaOutputs.Add(outputID, 0);
        }

        if (debug)
        {
            Debug.Log("Created output " + outputID);
        }
    }
Exemple #4
0
    void HandleConnectV1(OSCMessage message)
    {
        //Answer connect
        string outputIP   = message.Data[1].ToString();
        int    outputPort = (int)message.Data[2];

        string outputID = GetIDFromIPAndPort(outputIP, outputPort);

        //Create output client
        if (!OSCMaster.Clients.ContainsKey(outputID))
        {
            OSCMaster.CreateClient(outputID, outputIP, outputPort);
        }

        if (!_augmentaOutputs.ContainsKey(outputID))
        {
            _augmentaOutputs.Add(outputID, 0);
        }

        if (debug)
        {
            Debug.Log("Created output " + outputID);
        }
    }
    public void Connect()
    {
        if (OSCMaster.Clients.ContainsKey(OSCClientName))
        {
            OSCMaster.RemoveClient(OSCClientName);
        }
        OSCMaster.CreateClient(OSCClientName, IPAddress.Parse(TargetIp), TargetPort);
        Debug.Log("Connected on " + TargetIp + ":" + TargetPort);

        try
        {
            var message = new OSCMessage("/device/screen");
            message.Append(Screen.width);
            message.Append(Screen.height);

            OSCMaster.SendMessageUsingClient(OSCClientName, message);

            Debug.Log("Screen : " + Screen.width + "*" + Screen.height);
        }
        catch (Exception e)
        {
            Debug.Log(e.Message);
        }
    }