示例#1
0
    public void send(string s)
    {
        message = new OSCMessage(testaddress,s);

        //_clients[clientId].log.Add(String.Concat(DateTime.UtcNow.ToString(),".",FormatMilliseconds(DateTime.Now.Millisecond), " : ",
        //                                         testaddress," ", DataToString(message.Data)));
        _clients[clientId].messages.Add(message);

        _clients[clientId].client.Send(message);
    }
 /// <summary>
 ///
 /// </summary>
 /// <param name="message"></param>
 private void MessageReceived(OSCMessage message)
 {
     // config message handlers
 }
 protected override bool ProcessMessage(OSCMessage message, out bool value) => message.ToBool(out value);
示例#4
0
        protected override bool FillMessage(OSCMessage message)
        {
            message.AddValue(OSCValue.Impulse());

            return(true);
        }
 protected override bool ProcessMessage(OSCMessage message, out string value) => message.ToString(out value);
 protected override void FillMessage(OSCMessage message, Vector2 value)
 {
     message.AddValue(OSCValue.Float(value.x));
     message.AddValue(OSCValue.Float(value.y));
 }
 protected override void FillMessage(OSCMessage message, Color value)
 {
     message.AddValue(OSCValue.Color(value));
 }
示例#8
0
 private void SendLeapData()
 {
     try
     {
         if (transmitter != null)
         {
             //SEND OSC DATA
             decimal leapXRange = numLeapXMax.Value - numLeapXMin.Value;
             decimal leapYRange = numLeapYMax.Value - numLeapYMin.Value;
             if (chkLeapOscHand1XSend.Checked && !String.IsNullOrEmpty(txtLeapHand1XPos.Text))
             {
                 try
                 {
                     decimal leapPos  = decimal.Parse(txtLeapHand1XPos.Text);
                     decimal OscRange = numLeapOscHand1XMax.Value - numLeapOscHand1XMin.Value;
                     leapPos -= numLeapXMin.Value;
                     decimal perc = (100 / leapXRange) * leapPos;
                     decimal val  = (OscRange / 100) * perc;
                     if (val < numLeapOscHand1XMin.Value)
                     {
                         val = numLeapOscHand1XMin.Value;
                     }
                     if (val > numLeapOscHand1XMax.Value)
                     {
                         val = numLeapOscHand1XMax.Value;
                     }
                     numLeapOscHand1XSending.Value = val;
                     OSCMessage msg = new OSCMessage(txtLeapOscHand1XPath.Text, (float)val);
                     transmitter.Send(msg);
                 }
                 catch (Exception ex)
                 {
                     string blah = ex.Message;
                 }
             }
             if (chkLeapOscHand1YSend.Checked && !String.IsNullOrEmpty(txtLeapHand1YPos.Text))
             {
                 try
                 {
                     decimal leapPos  = decimal.Parse(txtLeapHand1YPos.Text);
                     decimal OscRange = numLeapOscHand1YMax.Value - numLeapOscHand1YMin.Value;
                     leapPos -= numLeapYMin.Value;
                     decimal perc = (100 / leapYRange) * leapPos;
                     decimal val  = (OscRange / 100) * perc;
                     if (val < numLeapOscHand1YMin.Value)
                     {
                         val = numLeapOscHand1YMin.Value;
                     }
                     if (val > numLeapOscHand1YMax.Value)
                     {
                         val = numLeapOscHand1YMax.Value;
                     }
                     numLeapOscHand1YSending.Value = val;
                     OSCMessage msg = new OSCMessage(txtLeapOscHand1YPath.Text, (float)val);
                     transmitter.Send(msg);
                 }
                 catch (Exception ex)
                 {
                     string blah = ex.Message;
                 }
             }
             if (chkLeapOscHand2XSend.Checked && !String.IsNullOrEmpty(txtLeapHand2XPos.Text))
             {
                 try
                 {
                     decimal leapPos  = decimal.Parse(txtLeapHand2XPos.Text);
                     decimal OscRange = numLeapOscHand2XMax.Value - numLeapOscHand2XMin.Value;
                     leapPos -= numLeapXMin.Value;
                     decimal perc = (100 / leapXRange) * leapPos;
                     decimal val  = (OscRange / 100) * perc;
                     if (val < numLeapOscHand2XMin.Value)
                     {
                         val = numLeapOscHand2XMin.Value;
                     }
                     if (val > numLeapOscHand2XMax.Value)
                     {
                         val = numLeapOscHand2XMax.Value;
                     }
                     numLeapOscHand2XSending.Value = val;
                     OSCMessage msg = new OSCMessage(txtLeapOscHand2XPath.Text, (float)val);
                     transmitter.Send(msg);
                 }
                 catch (Exception ex)
                 {
                     string blah = ex.Message;
                 }
             }
             if (chkLeapOscHand2YSend.Checked && !String.IsNullOrEmpty(txtLeapHand2YPos.Text))
             {
                 try
                 {
                     decimal leapPos  = decimal.Parse(txtLeapHand2YPos.Text);
                     decimal OscRange = numLeapOscHand2YMax.Value - numLeapOscHand2YMin.Value;
                     leapPos -= numLeapYMin.Value;
                     decimal perc = (100 / leapYRange) * leapPos;
                     decimal val  = (OscRange / 100) * perc;
                     if (val < numLeapOscHand2YMin.Value)
                     {
                         val = numLeapOscHand2YMin.Value;
                     }
                     if (val > numLeapOscHand2YMax.Value)
                     {
                         val = numLeapOscHand2YMax.Value;
                     }
                     numLeapOscHand2YSending.Value = val;
                     OSCMessage msg = new OSCMessage(txtLeapOscHand2YPath.Text, (float)val);
                     transmitter.Send(msg);
                 }
                 catch (Exception ex)
                 {
                     string blah = ex.Message;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 protected override bool ProcessMessage(OSCMessage message, out int value) => message.ToInt(out value);
示例#10
0
        private void SendWebCamData()
        {
            //check web cam available
            try
            {
                if (cap == null || classifier == null)
                {
                    return;
                }
                using (Image <Bgr, byte> nextFrame = cap.QueryFrame().ToImage <Bgr, byte>().Flip(FlipType.Horizontal))
                {
                    if (nextFrame != null)
                    {
                        //set the web cam width and height
                        WebcamWidth          = nextFrame.Width;
                        WebcamHeight         = nextFrame.Height;
                        txtWebcamWidth.Text  = WebcamWidth.ToString();
                        txtWebcamHeight.Text = WebcamHeight.ToString();
                        //draw the selected screen
                        double percent      = (double)numSensitivity.Value / 100;
                        double screenWidth  = WebcamWidth * percent;
                        double screenHeight = ((double)SelectedScreen.Bounds.Height / (double)SelectedScreen.Bounds.Width) * screenWidth;
                        double screenX      = ((WebcamWidth - screenWidth) / 2);
                        double screenY      = ((WebcamHeight - screenHeight) / 2);
                        txtScreenWidth.Text  = screenWidth.ToString();
                        txtScreenHeight.Text = screenHeight.ToString();
                        txtScreenX.Text      = screenX.ToString();
                        txtScreenY.Text      = screenY.ToString();
                        Rectangle screenRect = new Rectangle((int)screenX, (int)screenY, (int)screenWidth, (int)screenHeight);
                        nextFrame.Draw(screenRect, new Bgr(Color.Blue), 4);

                        //must greyscale image
                        Image <Gray, byte> grayframe   = nextFrame.Convert <Gray, byte>();
                        double             scaleFactor = double.Parse(txtScaleFactor.Text);
                        int minNeightbours             = (int)numMinNeighbours.Value;
                        int minSize = (int)numMinSize.Value;
                        int maxSize = (int)numMaxSize.Value;
                        //do detection and get rectangles
                        Rectangle[] rectangles = classifier.DetectMultiScale(grayframe, scaleFactor, minNeightbours, new Size(minSize, minSize), new Size(maxSize, maxSize));
                        //draw detected rectangles
                        if (rectangles.Count() > 0)
                        {
                            float averageX = (float)rectangles.Select(r => (r.X + (r.Width / 2))).Average();
                            float averageY = (float)rectangles.Select(r => (r.Y + (r.Height / 2))).Average();
                            if (!chkAverageDetection.Checked)
                            {
                                averageX = rectangles[0].X + (rectangles[0].Width / 2);
                                averageY = rectangles[0].Y + (rectangles[0].Height / 2);
                            }
                            detectedXPos = averageX;
                            detectedYPos = averageY;
                            //txtOscXOutput.Text = averageX.ToString();
                            //txtOscYOutput.Text = averageY.ToString();
                            //draw cross for central possition
                            nextFrame.Draw(new Cross2DF(new PointF(averageX, averageY), 20, 20), new Bgr(0, double.MaxValue, 0), 2);

                            if (transmitter != null)
                            {
                                //SEND OSC DATA
                                //from 0 - 127
                                //double val = (127 / (double)(nextFrame.Width)) * averageX;
                                double xposPercentage = (100 / (double)(nextFrame.Width)) * averageX;
                                double yposPercentage = (100 / (double)(nextFrame.Height)) * averageY;
                                if (chkOscXSend.Checked)
                                {
                                    try
                                    {
                                        decimal val = ((OscXMax - OscXMin) / 100) * (decimal)xposPercentage;
                                        txtOscXOutput.Text = val.ToString();
                                        OSCMessage OscXMessage = new OSCMessage(OscXPath, (float)val);
                                        transmitter.Send(OscXMessage);
                                    }
                                    catch (Exception ex)
                                    {
                                        string blah = ex.Message;
                                    }
                                }
                                if (chkOscYSend.Checked)
                                {
                                    try
                                    {
                                        decimal val = ((OscYMax - OscYMin) / 100) * (decimal)yposPercentage;
                                        txtOscYOutput.Text = val.ToString();
                                        OSCMessage OscYMessage = new OSCMessage(OscYPath, (float)val);
                                        transmitter.Send(OscYMessage);
                                    }
                                    catch (Exception ex)
                                    {
                                        string blah = ex.Message;
                                    }
                                }


                                //try
                                //{
                                //    decimal xval = ((OscXMax - OscXMin) / 100) * (decimal)xposPercentage;
                                //    OSCMessage OscXMessage = new OSCMessage(OscXPath, (float)xval);
                                //    transmitter.Send(OscXMessage);

                                //    //OSCMessage message = new OSCMessage("/xpospercentage", val.ToString());
                                //    OSCMessage message = new OSCMessage("/1/fader1", (float)val);
                                //    OSCMessage message2 = new OSCMessage("/1/fader2", (float)xposPercentage);
                                //    OSCMessage message3 = new OSCMessage("/1/fader3", (float)yposPercentage);
                                //    transmitter.Send(message);
                                //    transmitter.Send(message2);
                                //    transmitter.Send(message3);

                                //    //if(osc != null)
                                //    //{
                                //    //    osc.Send(new OscMessage("/xpospercentage", val.ToString()));
                                //    //    //osc.Send(new OscMessage("/ypospercentage", yposPercentage));
                                //    //    //osc.Send(new OscMessage("/playbackspeed", val));
                                //    //}
                                //}
                                //catch (Exception ex)
                                //{
                                //    string blah = ex.Message;
                                //}

                                //using (OscSender osc = new OscSender(address, port))
                                //{
                                //    try
                                //    {
                                //        osc.Connect();
                                //        osc.Send(new OscMessage("/xpospercentage", val.ToString()));
                                //        //osc.Send(new OscMessage("/ypospercentage", yposPercentage));
                                //        //osc.Send(new OscMessage("/playbackspeed", val));
                                //    }
                                //    catch (Exception ex)
                                //    {
                                //        string blah = ex.Message;
                                //    }
                                //    textBox3.Text = val.ToString();
                                //}
                                //SEND OSC DATA
                            }
                        }

                        //work out relative x and y to the screen rect
                        relativeX = detectedXPos - screenX;
                        relativeY = detectedYPos - screenY;
                        //keep the relative within bounds
                        relativeX         = (relativeX < 0) ? 0 : (relativeX > screenWidth) ? screenWidth : relativeX;
                        relativeY         = (relativeY < 0) ? 0 : (relativeY > screenHeight) ? screenHeight : relativeY;
                        txtRelativeX.Text = relativeX.ToString();
                        txtRelativeY.Text = relativeY.ToString();

                        if (chkDetectionBoxes.Checked)
                        {
                            if (!chkAverageDetection.Checked)
                            {
                                nextFrame.Draw(rectangles[0], new Bgr(0, double.MaxValue, 0), 1);
                            }
                            else
                            {
                                //add a rectangle for each
                                foreach (var face in rectangles)
                                {
                                    nextFrame.Draw(face, new Bgr(0, double.MaxValue, 0), 1);
                                }
                            }
                        }

                        //set aspect ration
                        var boundWidth  = SelectedScreen.Bounds.Width;
                        var boundHeight = SelectedScreen.Bounds.Height;
                        var gdc         = Gdc(boundWidth, boundHeight);
                        lblRatio.Text = boundWidth.ToString() + "x" + boundHeight.ToString() + " (" + (boundWidth / gdc).ToString() + ":" + (boundHeight / gdc).ToString() + ")";

                        //show mouse position
                        txtMouseX.Text = VirtualMouse.MousePositionX().ToString();
                        txtMouseY.Text = VirtualMouse.MousePositionY().ToString();

                        //create virtual mouse position
                        virtualMouseX         = (int)((SelectedScreen.Bounds.Width / screenWidth) * relativeX);
                        virtualMouseY         = (int)((SelectedScreen.Bounds.Height / screenHeight) * relativeY);
                        txtVirtualMouseX.Text = virtualMouseX.ToString();
                        txtVirtualMouseY.Text = virtualMouseY.ToString();

                        float min = 0;
                        float max = 65535;

                        txtVirtualMouseX.Text = VirtualMouse.Remap(virtualMouseX, 0.0f, (float)screenWidth, min, max).ToString();
                        txtVirtualMouseY.Text = VirtualMouse.Remap(virtualMouseY, 0.0f, (float)screenHeight, min, max).ToString();

                        //move the mouse if checked
                        if (chkMouse.Checked)
                        {
                            this.Cursor     = new Cursor(Cursor.Current.Handle);
                            Cursor.Position = new Point(virtualMouseX, virtualMouseY);
                            Cursor.Current  = Cursors.Arrow;


                            //VirtualMouse.MoveTo(virtualMouseX, virtualMouseY, (float)screenWidth, (float)screenHeight);
                        }

                        //do some color detection
                        //convert the image to hsv
                        Image <Hsv, Byte> hsvimg = nextFrame.Convert <Hsv, Byte>();

                        //extract the hue and value channels
                        Image <Gray, Byte>[] channels = hsvimg.Split();  //split into components
                        Image <Gray, Byte>   imghue   = channels[0];     //hsv, so channels[0] is hue.
                        Image <Gray, Byte>   imgval   = channels[2];     //hsv, so channels[2] is value.

                        //filter out all but "the color you want"...seems to be 0 to 128 ?
                        Image <Gray, byte> huefilter = imghue.InRange(new Gray(23), new Gray(27));

                        //use the value channel to filter out all but brighter colors
                        Image <Gray, byte> valfilter = imgval.InRange(new Gray(150), new Gray(255));

                        //now and the two to get the parts of the imaged that are colored and above some brightness.
                        Image <Gray, byte> colordetimg = huefilter.And(valfilter);
                        pictureBox2.Image = colordetimg.ToBitmap();

                        //show the image on the screen
                        Bitmap bmp = nextFrame.ToBitmap();
                        pictureBox1.Image = bmp;

                        Bgr       c = new Bgr();
                        MCvScalar s = new MCvScalar();
                        nextFrame.AvgSdv(out c, out s);
                        txtHistogram.Text     = "R: " + c.Red.ToString();
                        txtHistogram.Text    += "G: " + c.Green.ToString();
                        txtHistogram.Text    += "B: " + c.Blue.ToString();
                        pictureBox3.BackColor = Color.FromArgb((int)c.Red, (int)c.Green, (int)c.Blue);

                        if (histogramCounter == 0)
                        {
                            //do a color histogram on the image
                            //HistoGram(bmp);
                            histogramCounter = 100;
                        }
                        histogramCounter -= 1;

                        txtHistogramCounter.Text = histogramCounter.ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    // Update is called once per frame
    void Update()
    {
        /********************
        *  send
        ********************/
        // if (Input.GetMouseButtonDown(0))

        /*
         * if (Input.GetKeyDown(this.debugKey))
         * {
         *      Debug.Log("SendMessage");
         *
         *      var sampleVals = new List<int>(){1, 2, 3}; // 2つ以上のparameterを送信(型は同じである必要あり)
         *      OSCHandler.Instance.SendMessageToClient(this.clientId, debugMessage, sampleVals);
         * }
         */

        /*
         * // var sampleVals = new List<float>(){Input.mousePosition.x, Input.mousePosition.y}; // 2つ以上のparameterを送信(型は同じである必要あり)
         * var sampleVals = new List<float>(){(int)(Input.mousePosition.x), (int)(Input.mousePosition.y)}; // 2つ以上のparameterを送信(型は同じである必要あり)
         * OSCHandler.Instance.SendMessageToClient(this.clientId, debugMessage, sampleVals);
         */

        /********************
        *  receive
        ********************/
        while (0 < queue.Count)
        {
            OSCPacket packet = queue.Dequeue() as OSCPacket;
            if (packet.IsBundle())
            {
                // OSCBundleの場合
                OSCBundle bundle = packet as OSCBundle;
                foreach (OSCMessage msg in bundle.Data)
                {
                    // メッセージの中身にあわせた処理
                }
            }
            else
            {
                // OSCMessageの場合はそのまま変換
                OSCMessage msg = packet as OSCMessage;

                if (msg.Address == "/HumanPose")
                {
#if !WIN55_TO_MAC56
                    if (setPose.HumanPose.muscles.Length == System.Convert.ToInt16(msg.Data[7]))
                    {
#endif
                    setPose.HumanPose.bodyPosition.x = (float)(System.Convert.ToDouble(msg.Data[0]));
                    setPose.HumanPose.bodyPosition.y = (float)(System.Convert.ToDouble(msg.Data[1]));
                    setPose.HumanPose.bodyPosition.z = (float)(System.Convert.ToDouble(msg.Data[2]));
                    setPose.HumanPose.bodyRotation.x = (float)(System.Convert.ToDouble(msg.Data[3]));
                    setPose.HumanPose.bodyRotation.y = (float)(System.Convert.ToDouble(msg.Data[4]));
                    setPose.HumanPose.bodyRotation.z = (float)(System.Convert.ToDouble(msg.Data[5]));
                    setPose.HumanPose.bodyRotation.w = (float)(System.Convert.ToDouble(msg.Data[6]));

                    for (int i = 0; i < setPose.HumanPose.muscles.Length; i++)
                    {
#if WIN55_TO_MAC56
                        if (i < 6)                                 // 0 - 5:同じ
                        {
                            setPose.HumanPose.muscles[i] = (float)(System.Convert.ToDouble(msg.Data[8 + i]));
                        }
                        else if (i < 9)                                  // 6 - 8:additionnal param
                        /* skip(not zero) */
                        {
                        }
                        else                                   // 以降 : 間はさんで後は同じ.
                        {
                            setPose.HumanPose.muscles[i] = (float)(System.Convert.ToDouble(msg.Data[8 + i - 3]));
                        }
#else
                        setPose.HumanPose.muscles[i] = (float)(System.Convert.ToDouble(msg.Data[8 + i]));
#endif
                    }
#if !WIN55_TO_MAC56
                }
#endif

                    /* */
                    label = "(" + setPose.HumanPose.muscles.Length + ", " + msg.Data[7] + ", " + HumanTrait.MuscleCount + ")";
                }
            }
        }
    }
示例#12
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {

            updateClient();
            this.viewModel.StatusMessage = "Running ...";

            try
            {
                // Get the list of Microsoft Bands paired to the phone.
                IBandInfo[] pairedBands = await BandClientManager.Instance.GetBandsAsync();
                if (pairedBands.Length < 1)
                {
                    this.viewModel.StatusMessage = "This sample app requires a Microsoft Band paired to your device. Also make sure that you have the latest firmware installed on your Band, as provided by the latest Microsoft Health app.";
                    return;
                }

               
                // Connect to Microsoft Band.
                using (IBandClient bandClient = await BandClientManager.Instance.ConnectAsync(pairedBands[0]))
                {

                    bool heartRateConsentGranted;

                    // Check whether the user has granted access to the HeartRate sensor.
                    if (bandClient.SensorManager.HeartRate.GetCurrentUserConsent() == UserConsent.Granted)
                    {
                        heartRateConsentGranted = true;
                    }
                    else
                    {
                        heartRateConsentGranted = await bandClient.SensorManager.HeartRate.RequestUserConsentAsync();
                    }

                    if (!heartRateConsentGranted)
                    {
                        this.viewModel.StatusMessage = "Access to the heart rate sensor is denied.";
                    }
                    else
                    {
                        int samplesReceived = 0; // the number of Accelerometer samples received

                        // Subscribe to Accelerometer data.
                        bandClient.SensorManager.HeartRate.ReadingChanged += (s, args) =>
                        {
                            
                            heartRate = args.SensorReading.HeartRate;
                            samplesReceived++;

                        };


                        bool gsrOK = false;
                        if (bandClient.SensorManager.Gsr.IsSupported)
                        {

                            bandClient.SensorManager.Gsr.ReadingChanged += (s, args) =>
                            {
                                gsr = args.SensorReading.Resistance;

                            };
                            gsrOK = true;
                        }
                        else
                        {
                            this.viewModel.StatusMessage = "Gsr sensor is not supported with your Band version. Microsoft Band 2 is required.";
                        }
                       

                        while (true)
                        {
                            await bandClient.SensorManager.HeartRate.StartReadingsAsync();
                            if(gsrOK) await bandClient.SensorManager.Gsr.StartReadingsAsync();

                            await Task.Delay(TimeSpan.FromSeconds(1));

                            await bandClient.SensorManager.HeartRate.StopReadingsAsync();
                            if(gsrOK) await bandClient.SensorManager.Gsr.StopReadingsAsync();

                            this.viewModel.StatusMessage = string.Format("Sending to {0}:{1}\nHeart Rate = {2}\nGSR = {3}",client.ClientIPAddress,client.Port, heartRate,gsr);

                            OSCMessage msg = new OSCMessage("/emotion/heart");
                            msg.Append<int>(heartRate);
                            client.Send(msg);

                            if (gsrOK)
                            {
                                OSCMessage msg2 = new OSCMessage("/emotion/gsr");
                                msg2.Append<int>(gsr);
                                client.Send(msg2);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                this.viewModel.StatusMessage = ex.StackTrace.ToString();
            }
        }
示例#13
0
	public void SendToNode (string address, object val)
	{
		OSCMessage message = new OSCMessage (address, val);
		client.Send (message);
	}
 private void MessageReceive(OSCMessage message)
 {
     Debug.LogFormat("Received message: {0}", message);
 }
示例#15
0
 protected override void FillMessage(OSCMessage message, byte[] value)
 {
     message.AddValue(OSCValue.Blob(value));
 }
示例#16
0
 protected void MessageReceived(OSCMessage message)
 {
     Debug.Log(message);
 }
        private void Send(string address, OSCValue value)
        {
            var message = new OSCMessage(address, value);

            Transmitter.Send(message);
        }
示例#18
0
        /**
         * The OSC callback method where all TUIO messages are received and decoded
         * and where the TUIO event callbacks are dispatched
         *
         * @param message	the received OSC message
         */
        private void processMessage(OSCMessage message)
        {
            string    address = message.Address;
            ArrayList args    = message.Values;
            string    command = (string)args[0];

            if (address == "/tuio/2Dobj")
            {
                if (command == "set")
                {
                    long  s_id   = (int)args[1];
                    int   f_id   = (int)args[2];
                    float xpos   = (float)args[3];
                    float ypos   = (float)args[4];
                    float angle  = (float)args[5];
                    float xspeed = (float)args[6];
                    float yspeed = (float)args[7];
                    float rspeed = (float)args[8];
                    float maccel = (float)args[9];
                    float raccel = (float)args[10];

                    lock (objectSync) {
                        if (!objectList.ContainsKey(s_id))
                        {
                            TuioObject addObject = new TuioObject(s_id, f_id, xpos, ypos, angle);
                            frameObjects.Add(addObject);
                        }
                        else
                        {
                            TuioObject tobj = objectList[s_id];
                            if (tobj == null)
                            {
                                return;
                            }
                            if ((tobj.getX() != xpos) || (tobj.getY() != ypos) || (tobj.getAngle() != angle) || (tobj.getXSpeed() != xspeed) || (tobj.getYSpeed() != yspeed) || (tobj.getRotationSpeed() != rspeed) || (tobj.getMotionAccel() != maccel) || (tobj.getRotationAccel() != raccel))
                            {
                                TuioObject updateObject = new TuioObject(s_id, f_id, xpos, ypos, angle);
                                updateObject.update(xpos, ypos, angle, xspeed, yspeed, rspeed, maccel, raccel);
                                frameObjects.Add(updateObject);
                            }
                        }
                    }
                }
                else if (command == "alive")
                {
                    newObjectList.Clear();
                    for (int i = 1; i < args.Count; i++)
                    {
                        // get the message content
                        long s_id = (int)args[i];
                        newObjectList.Add(s_id);
                        // reduce the object list to the lost objects
                        if (aliveObjectList.Contains(s_id))
                        {
                            aliveObjectList.Remove(s_id);
                        }
                    }

                    // remove the remaining objects
                    lock (objectSync) {
                        for (int i = 0; i < aliveObjectList.Count; i++)
                        {
                            long       s_id         = aliveObjectList[i];
                            TuioObject removeObject = objectList[s_id];
                            removeObject.remove(currentTime);
                            frameObjects.Add(removeObject);
                        }
                    }
                }
                else if (command == "fseq")
                {
                    int  fseq      = (int)args[1];
                    bool lateFrame = false;

                    if (fseq > 0)
                    {
                        if (fseq > currentFrame)
                        {
                            currentTime = TuioTime.getSessionTime();
                        }
                        if ((fseq >= currentFrame) || ((currentFrame - fseq) > 100))
                        {
                            currentFrame = fseq;
                        }
                        else
                        {
                            lateFrame = true;
                        }
                    }
                    else if ((TuioTime.getSessionTime().getTotalMilliseconds() - currentTime.getTotalMilliseconds()) > 100)
                    {
                        currentTime = TuioTime.getSessionTime();
                    }

                    if (!lateFrame)
                    {
                        IEnumerator <TuioObject> frameEnum = frameObjects.GetEnumerator();
                        while (frameEnum.MoveNext())
                        {
                            TuioObject tobj = frameEnum.Current;

                            switch (tobj.getTuioState())
                            {
                            case TuioObject.TUIO_REMOVED:
                                TuioObject removeObject = tobj;
                                removeObject.remove(currentTime);

                                for (int i = 0; i < listenerList.Count; i++)
                                {
                                    TuioListener listener = (TuioListener)listenerList[i];
                                    if (listener != null)
                                    {
                                        listener.removeTuioObject(removeObject);
                                    }
                                }
                                lock (objectSync) {
                                    objectList.Remove(removeObject.getSessionID());
                                }
                                break;

                            case TuioObject.TUIO_ADDED:
                                TuioObject addObject = new TuioObject(currentTime, tobj.getSessionID(), tobj.getSymbolID(), tobj.getX(), tobj.getY(), tobj.getAngle());
                                lock (objectSync) {
                                    objectList.Add(addObject.getSessionID(), addObject);
                                }
                                for (int i = 0; i < listenerList.Count; i++)
                                {
                                    TuioListener listener = (TuioListener)listenerList[i];
                                    if (listener != null)
                                    {
                                        listener.addTuioObject(addObject);
                                    }
                                }
                                break;

                            default:
                                TuioObject updateObject = getTuioObject(tobj.getSessionID());
                                if ((tobj.getX() != updateObject.getX() && tobj.getXSpeed() == 0) || (tobj.getY() != updateObject.getY() && tobj.getYSpeed() == 0))
                                {
                                    updateObject.update(currentTime, tobj.getX(), tobj.getY(), tobj.getAngle());
                                }
                                else
                                {
                                    updateObject.update(currentTime, tobj.getX(), tobj.getY(), tobj.getAngle(), tobj.getXSpeed(), tobj.getYSpeed(), tobj.getRotationSpeed(), tobj.getMotionAccel(), tobj.getRotationAccel());
                                }

                                for (int i = 0; i < listenerList.Count; i++)
                                {
                                    TuioListener listener = (TuioListener)listenerList[i];
                                    if (listener != null)
                                    {
                                        listener.updateTuioObject(updateObject);
                                    }
                                }
                                break;
                            }
                        }

                        for (int i = 0; i < listenerList.Count; i++)
                        {
                            TuioListener listener = (TuioListener)listenerList[i];
                            if (listener != null)
                            {
                                listener.refresh(new TuioTime(currentTime));
                            }
                        }

                        List <long> buffer = aliveObjectList;
                        aliveObjectList = newObjectList;
                        // recycling the List
                        newObjectList = buffer;
                    }
                    frameObjects.Clear();
                }
            }
            else if (address == "/tuio/2Dcur")
            {
                if (command == "set")
                {
                    long  s_id   = (int)args[1];
                    float xpos   = (float)args[2];
                    float ypos   = (float)args[3];
                    float xspeed = (float)args[4];
                    float yspeed = (float)args[5];
                    float maccel = (float)args[6];

                    lock (cursorList) {
                        if (!cursorList.ContainsKey(s_id))
                        {
                            TuioCursor addCursor = new TuioCursor(s_id, -1, xpos, ypos);
                            frameCursors.Add(addCursor);
                        }
                        else
                        {
                            TuioCursor tcur = (TuioCursor)cursorList[s_id];
                            if (tcur == null)
                            {
                                return;
                            }
                            if ((tcur.getX() != xpos) || (tcur.getY() != ypos) || (tcur.getXSpeed() != xspeed) || (tcur.getYSpeed() != yspeed) || (tcur.getMotionAccel() != maccel))
                            {
                                TuioCursor updateCursor = new TuioCursor(s_id, tcur.getCursorID(), xpos, ypos);
                                updateCursor.update(xpos, ypos, xspeed, yspeed, maccel);
                                frameCursors.Add(updateCursor);
                            }
                        }
                    }
                }
                else if (command == "alive")
                {
                    newCursorList.Clear();
                    for (int i = 1; i < args.Count; i++)
                    {
                        // get the message content
                        long s_id = (int)args[i];
                        newCursorList.Add(s_id);
                        // reduce the cursor list to the lost cursors
                        if (aliveCursorList.Contains(s_id))
                        {
                            aliveCursorList.Remove(s_id);
                        }
                    }

                    // remove the remaining cursors
                    lock (cursorSync) {
                        for (int i = 0; i < aliveCursorList.Count; i++)
                        {
                            long s_id = aliveCursorList[i];
                            if (!cursorList.ContainsKey(s_id))
                            {
                                continue;
                            }
                            TuioCursor removeCursor = cursorList[s_id];
                            removeCursor.remove(currentTime);
                            frameCursors.Add(removeCursor);
                        }
                    }
                }
                else if (command == "fseq")
                {
                    int  fseq      = (int)args[1];
                    bool lateFrame = false;

                    if (fseq > 0)
                    {
                        if (fseq > currentFrame)
                        {
                            currentTime = TuioTime.getSessionTime();
                        }
                        if ((fseq >= currentFrame) || ((currentFrame - fseq) > 100))
                        {
                            currentFrame = fseq;
                        }
                        else
                        {
                            lateFrame = true;
                        }
                    }
                    else if ((TuioTime.getSessionTime().getTotalMilliseconds() - currentTime.getTotalMilliseconds()) > 100)
                    {
                        currentTime = TuioTime.getSessionTime();
                    }

                    if (!lateFrame)
                    {
                        IEnumerator <TuioCursor> frameEnum = frameCursors.GetEnumerator();
                        while (frameEnum.MoveNext())
                        {
                            TuioCursor tcur = frameEnum.Current;
                            switch (tcur.getTuioState())
                            {
                            case TuioCursor.TUIO_REMOVED:
                                TuioCursor removeCursor = tcur;
                                removeCursor.remove(currentTime);

                                for (int i = 0; i < listenerList.Count; i++)
                                {
                                    TuioListener listener = (TuioListener)listenerList[i];
                                    if (listener != null)
                                    {
                                        listener.removeTuioCursor(removeCursor);
                                    }
                                }
                                lock (cursorSync) {
                                    cursorList.Remove(removeCursor.getSessionID());

                                    if (removeCursor.getCursorID() == maxCursorID)
                                    {
                                        maxCursorID = -1;

                                        if (cursorList.Count > 0)
                                        {
                                            IEnumerator <KeyValuePair <long, TuioCursor> > clist = cursorList.GetEnumerator();
                                            while (clist.MoveNext())
                                            {
                                                int f_id = clist.Current.Value.getCursorID();
                                                if (f_id > maxCursorID)
                                                {
                                                    maxCursorID = f_id;
                                                }
                                            }

                                            List <TuioCursor>        freeCursorBuffer = new List <TuioCursor>();
                                            IEnumerator <TuioCursor> flist            = freeCursorList.GetEnumerator();
                                            while (flist.MoveNext())
                                            {
                                                TuioCursor testCursor = flist.Current;
                                                if (testCursor.getCursorID() < maxCursorID)
                                                {
                                                    freeCursorBuffer.Add(testCursor);
                                                }
                                            }
                                            freeCursorList = freeCursorBuffer;
                                        }
                                        else
                                        {
                                            freeCursorList.Clear();
                                        }
                                    }
                                    else if (removeCursor.getCursorID() < maxCursorID)
                                    {
                                        freeCursorList.Add(removeCursor);
                                    }
                                }
                                break;

                            case TuioCursor.TUIO_ADDED:
                                TuioCursor addCursor;
                                lock (cursorSync) {
                                    int c_id = cursorList.Count;
                                    if ((cursorList.Count <= maxCursorID) && (freeCursorList.Count > 0))
                                    {
                                        TuioCursor closestCursor          = freeCursorList[0];
                                        IEnumerator <TuioCursor> testList = freeCursorList.GetEnumerator();
                                        while (testList.MoveNext())
                                        {
                                            TuioCursor testCursor = testList.Current;
                                            if (testCursor.getDistance(tcur) < closestCursor.getDistance(tcur))
                                            {
                                                closestCursor = testCursor;
                                            }
                                        }
                                        c_id = closestCursor.getCursorID();
                                        freeCursorList.Remove(closestCursor);
                                    }
                                    else
                                    {
                                        maxCursorID = c_id;
                                    }

                                    addCursor = new TuioCursor(currentTime, tcur.getSessionID(), c_id, tcur.getX(), tcur.getY());
                                    cursorList.Add(addCursor.getSessionID(), addCursor);
                                }

                                for (int i = 0; i < listenerList.Count; i++)
                                {
                                    TuioListener listener = (TuioListener)listenerList[i];
                                    if (listener != null)
                                    {
                                        listener.addTuioCursor(addCursor);
                                    }
                                }
                                break;

                            default:
                                TuioCursor updateCursor = getTuioCursor(tcur.getSessionID());
                                if ((tcur.getX() != updateCursor.getX() && tcur.getXSpeed() == 0) || (tcur.getY() != updateCursor.getY() && tcur.getYSpeed() == 0))
                                {
                                    updateCursor.update(currentTime, tcur.getX(), tcur.getY());
                                }
                                else
                                {
                                    updateCursor.update(currentTime, tcur.getX(), tcur.getY(), tcur.getXSpeed(), tcur.getYSpeed(), tcur.getMotionAccel());
                                }

                                for (int i = 0; i < listenerList.Count; i++)
                                {
                                    TuioListener listener = (TuioListener)listenerList[i];
                                    if (listener != null)
                                    {
                                        listener.updateTuioCursor(updateCursor);
                                    }
                                }
                                break;
                            }
                        }

                        for (int i = 0; i < listenerList.Count; i++)
                        {
                            TuioListener listener = (TuioListener)listenerList[i];
                            if (listener != null)
                            {
                                listener.refresh(new TuioTime(currentTime));
                            }
                        }

                        List <long> buffer = aliveCursorList;
                        aliveCursorList = newCursorList;
                        // recycling the List
                        newCursorList = buffer;
                    }
                    frameCursors.Clear();
                }
            }
        }
示例#19
0
    /* on reçoit un message par point de laser */
    private string processMessage(OSCMessage message)
    {
        string    address = message.Address;
        ArrayList args    = message.Values;

        lastMessage = message;

        if (address == "/newFrame" || address == "/noLasers")
        {
            clearLasers();
            //lock(laserScreenFrames){ laserScreenFrames[currentFrame].Clear(); }
        }

        if (args.Count > 0)
        {
            msgReceived++;
            //Debug.Log("\t\treceived message ("+msgReceived+"):"+address+" args ? "+args.Count);

            if (address == "/laser")
            {
                /*Debug.Log("Pos:"+(int)args[1]+","+(int)args[2]);
                 *                      Debug.Log("Size:"+(int)args[3]+", Ratio:"+(int)args[3]/TRACKER_FULL_AREA);
                 *                      Debug.Log("width:"+(int)args[4]+", height"+(int)args[5]);
                 *                      Debug.Log("Bounding rect center:"+(int)args[6]+","+(int)args[7]);*/


                //raw coords
                screenPosX = (int)TRACKER_WIDTH + (int)args[1] * -1;
                screenPosY = (int)args[2];

                //transform into screen coord
                screenPosX = (int)(((float)screenPosX / TRACKER_WIDTH) * APP_WIDTH);
                screenPosY = (int)((TRACKER_HEIGHT - (float)screenPosY) / TRACKER_HEIGHT * APP_HEIGHT);

                //Debug.Log("Screen:"+APP_WIDTH+","+APP_HEIGHT);
                outOfBounds = false;

                lock (laserPoints){
                    lastIndex = 0;

                    //search for next available point in array

                    //le x de laserPoints[] est exprimé en screenspace transformé, donc -1000f <> -45f
                    //while(laserPoints[lastIndex].x <= UNUSED_POSITION.x && lastIndex < laserPoints.Length)

                    //UNUSED_POSITION.x à -1000f <> -45f in screen space
                    while (laserPoints[lastIndex].x >= -40f && lastIndex < laserPoints.Length)
                    {
                        //Debug.Log("" + laserPoints[lastIndex]);
                        lastIndex++;
                    }

                    if (lastIndex < laserPoints.Length)
                    {
                        laserPoints[lastIndex].x = screenPosX;
                        laserPoints[lastIndex].y = screenPosY;

                        //Debug.Log("updated "+i);
                    }
                    else
                    {
                        outOfBounds = true;
                        //Debug.LogWarning("<LaserTracker> trying to add a point at index "+lastIndex+" for a array of "+laserPoints.Length+" possible lasers");
                    }
                }
            }
        }
        else
        {
            msgReceivedNoArgs++;
        }

        return(message.Address);
    }
 protected override bool ProcessMessage(OSCMessage message, out Quaternion value) => message.ToQuaternion(out value);
示例#21
0
 protected override void FillMessage(OSCMessage message, string value) => message.AddValue(OSCValue.String(value));
 protected override void FillMessage(OSCMessage message, DateTime value) => message.AddValue(OSCValue.TimeTag(value));
示例#23
0
 protected override bool ProcessMessage(OSCMessage message, out Vector2 value) => message.ToVector2(out value);
示例#24
0
        //////////////////////////////
        ///       OSC related       //
        //////////////////////////////

        public void ReceivedOscTableTitles(OSCMessage message)
        {
            LogCurrentTimecode("Show End Titles");

            StartCoroutine(ShowEndTitlesSequence());
        }
示例#25
0
 public void OscReceivedHandler(OSCMessage message)
 {
     text.text = "Done";
 }
 protected override bool ProcessMessage(OSCMessage message, out char value) => message.ToChar(out value);
 protected override void FillMessage(OSCMessage message, bool value)
 {
     message.AddValue(OSCValue.Bool(value));
 }
示例#28
0
 public static string GenerateMessage(OSCMessage message)
 {
     return(GenerateMessage(message, "message", true));
 }
        protected override void ApplyTransformUpdate(Vector3 position, Quaternion rotation)
        {
            //our gear
            if (name == handShakedName)
            {
                if (verticalWalking)
                {
                    if (rBody == null)
                    {
                        rBody = t.GetComponent <Rigidbody>();
                        if (rBody == null)
                        {
                            rBody            = t.gameObject.AddComponent <Rigidbody>();
                            rBody.useGravity = false;
                        }
                    }

                    //snap to near-ground
                    float yOffset = OptiTrackOSCClient.GetPosition().y;
                    physicalY = position.y - yOffset;

                    Vector3 objectPosition = t.position;

                    //move object to correct X/Z position
                    objectPosition.x = position.x;
                    objectPosition.z = position.z;

                    //raycast down from object
                    RaycastHit hitInfo;
                    //TODO: figure out if we need to raycast from closer to the floor (so we don't teleport on top of stuff too much)
                    if (Physics.Raycast(objectPosition, -Vector3.up, out hitInfo, 2f, 1 << 8))
                    {
                        objectPosition.y += (physicalY - hitInfo.distance);
                        t.position        = objectPosition;
                        rBody.velocity    = Vector3.zero;
                    }
                    else
                    {
                        t.position = objectPosition;
                        if (canFall)
                        {
                            if (withAccelleration)
                            {
                                rBody.AddForce(-Vector3.up * 9.81f, ForceMode.Acceleration);
                            }
                            else
                            {
                                rBody.velocity = -3 * Vector3.up;
                            }
                        }
                    }

                    //send OSC Message for position
                    OSCMessage m = new OSCMessage("/gear-virtualpos");
                    m.Append(name);
                    m.Append(objectPosition.x);
                    m.Append(objectPosition.y);
                    m.Append(objectPosition.z);
                    handshakeClient.Send(m);
                    handshakeClient.Flush();

                    //when previewing in editor, apply rotation (Gear's handle this themselves)
                                        #if UNITY_EDITOR
                    t.rotation = rotation;
                                        #endif
                }
                else
                {
                    //TODO: test
                    t.position = position;
                                        #if UNITY_EDITOR
                    t.rotation = rotation;
                                        #endif
                }
            }
            //other player's gear
            else
            {
                if (verticalWalking)
                {
                    //TODO: test
                    //ignore y, but store it for reference
                    float yOffset = OptiTrackOSCClient.GetPosition().y;
                    physicalY = position.y - yOffset;

                    Vector3 alternateP = t.position;
                    alternateP.x = position.x;
                    alternateP.z = position.z;
                    t.position   = alternateP;
                }
                else
                {
                    //TODO: test
                    //business as usual
                    t.position = position;
                    t.rotation = rotation;
                }
            }
        }
 protected override void FillMessage(OSCMessage message, OSCMidi value)
 {
     message.AddValue(OSCValue.Midi(value));
 }
示例#31
0
    /// <summary>
    /// Answer yo protocol
    /// </summary>
    void OnYoMessageReceived(OSCMessage message)
    {
        string[] addressSplit = message.Address.Split('/');

        switch (addressSplit[1])
        {
        case "yo":

            //Answer yo
            string yoIP   = message.Data[0].ToString();
            int    yoPort = (int)message.Data[1];

            OSCMessage wassupMessage = new OSCMessage("/wassup");

            wassupMessage.Append(NetworkManager.GetIpv4());
            wassupMessage.Append(NetworkManager.GetMacAddress());
            wassupMessage.Append(_nodeManager ? _nodeManager.nodeName : "Simulator");
            wassupMessage.Append(_nodeManager ? string.Join(",", _nodeManager.tagsList) : "");

            if (debug)
            {
                Debug.Log("Answering yo from " + yoIP + ":" + yoPort + " with " + NetworkManager.GetIpv4() + " and " + NetworkManager.GetMacAddress());
            }

            try
            {
                OSCMaster.SendMessage(wassupMessage, yoIP, yoPort);
            }catch (System.Exception e)
            {
                Debug.LogWarning("Error sending OSC to " + yoIP + ":" + yoPort + " (" + e.Message + ")");
            }

            break;

        case "connect":

            switch (yoVersion)
            {
            case 1:
                HandleConnectV1(message);
                break;

            case 2:
                HandleConnectV2(message);
                break;
            }

            break;

        case "disconnect":

            switch (yoVersion)
            {
            case 1:
                HandleDisconnectV1(message);
                break;

            case 2:
                HandleDisconnectV2(message);
                break;
            }

            break;

        case "ping":

            //Answer ping
            string pongIP   = message.Data[0].ToString();
            int    pongPort = (int)message.Data[1];

            OSCMessage pongMessage = new OSCMessage("/pong");

            if (debug)
            {
                Debug.Log("Answering ping from " + pongIP + ":" + pongPort);
            }

            OSCMaster.SendMessage(pongMessage, pongIP, pongPort);

            break;

        case "info":

            //Answer info
            string infoIP   = message.Data[0].ToString();
            int    infoPort = (int)message.Data[1];

            if (debug)
            {
                Debug.Log("Answering info from " + infoIP + ":" + infoPort + " with " + NetworkManager.GetIpv4() + " Augmenta Simulator " + NetworkManager.GetMacAddress() + " " + Application.version + " " + _controllable.currentPreset + " Simulator Simulated");
            }
            ;

            SendInfoMessages(infoIP, infoPort);
            break;

        case "heartbeat":

            switch (yoVersion)
            {
            case 1:
                HandleHeartbeatV1(message);
                break;

            case 2:
                HandleHeartbeatV2(message);
                break;
            }

            break;
        }
    }
 protected override void FillMessage(OSCMessage message, int value) => message.AddValue(OSCValue.Float(value));
示例#33
0
    void SendInfoMessagesV2(string infoIP, int infoPort)
    {
        //Fusion
        OSCMessage infoMessage = new OSCMessage("/info/name");

        if (_nodeManager)
        {
            infoMessage.Append(_nodeManager.nodeName);
        }
        else
        {
            infoMessage.Append("Augmenta Simulator");
        }
        OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

        infoMessage = new OSCMessage("/info/type");
        if (_nodeManager)
        {
            infoMessage.Append("Node");
        }
        else
        {
            infoMessage.Append("Simulator");
        }
        OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

        infoMessage = new OSCMessage("/info/mac");
        infoMessage.Append(NetworkManager.GetMacAddress());
        OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

        infoMessage = new OSCMessage("/info/ip");
        infoMessage.Append(NetworkManager.GetIpv4());
        OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

        infoMessage = new OSCMessage("/info/version");
        infoMessage.Append(Application.version);
        OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

        infoMessage = new OSCMessage("/info/currentFile");
        infoMessage.Append(_controllable.currentPreset != "" ? _controllable.currentPreset : "None");
        OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

        infoMessage = new OSCMessage("/info/protocolAvailable");
        infoMessage.Append("OSC");
        infoMessage.Append("1");
        infoMessage.Append("2");
        OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

        if (_nodeManager)
        {
            //Node
            infoMessage = new OSCMessage("/info/sensor/type");
            infoMessage.Append(_nodeManager.sensorType);
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

            infoMessage = new OSCMessage("/info/sensor/brand");
            infoMessage.Append(_nodeManager.sensorBrand);
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

            infoMessage = new OSCMessage("/info/sensor/name");
            infoMessage.Append(_nodeManager.sensorName);
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

            infoMessage = new OSCMessage("/info/sensor/hFov");
            infoMessage.Append(_nodeManager.sensorHFOV);
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

            infoMessage = new OSCMessage("/info/sensor/vFov");
            infoMessage.Append(_nodeManager.sensorVFOV);
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

            infoMessage = new OSCMessage("/info/floorMode");
            infoMessage.Append(_nodeManager.floorMode);
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

            infoMessage = new OSCMessage("/info/floorState");
            infoMessage.Append(_nodeManager.floorState);
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

            infoMessage = new OSCMessage("/info/backgroundMode");
            infoMessage.Append(_nodeManager.backgroundMode);
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

            infoMessage = new OSCMessage("/info/debug/pipeName");
            infoMessage.Append(_nodeManager.debugPipeName);
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

            infoMessage = new OSCMessage("/info/debug/sensor");
            infoMessage.Append(_nodeManager.debugSensor);
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

            infoMessage = new OSCMessage("/info/debug/videoPipe");
            infoMessage.Append(_nodeManager.debugVideoPipe);
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

            infoMessage = new OSCMessage("/info/debug/trackingPipe");
            infoMessage.Append(_nodeManager.debugTrackingPipe);
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

            infoMessage = new OSCMessage("/info/debug/pid");
            infoMessage.Append(_nodeManager.debugPID);
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);

            infoMessage = new OSCMessage("/info/tags");
            foreach (string tag in _nodeManager.tagsList)
            {
                infoMessage.Append(tag);
            }
            OSCMaster.SendMessage(infoMessage, infoIP, infoPort);
        }
    }
示例#34
0
	public void SendToNode (string address, object val)
	{
		try {
			OSCMessage message = new OSCMessage (address, val);
			client.Send (message);
		} catch (Exception e) {
		}

	}
示例#35
0
 public static void sendFloat(string address, float value)
 {
     OSCMessage msg = new OSCMessage(address);
     msg.Append<float>(value);
     client.Send(msg);
 }