Ejemplo n.º 1
0
        private static OscBundle CreateTestBundle()
        {
            IPEndPoint sourceEndPoint = new IPEndPoint(IPAddress.Loopback, Port);
            OscBundle bundle = new OscBundle(sourceEndPoint);

            OscBundle nestedBundle = new OscBundle(sourceEndPoint);
            OscMessage nestedMessage = new OscMessage(sourceEndPoint, TestMethod);
            nestedMessage.AppendNil();
            nestedMessage.Append("Some String");
            nestedMessage.Append(10);
            nestedMessage.Append(100000L);
            nestedMessage.Append(1234.567f);
            nestedMessage.Append(10.0012345);
            nestedMessage.Append(new byte[] { 1, 2, 3, 4 });
            nestedMessage.Append(new OscTimeTag());
            nestedMessage.Append('c');
            nestedMessage.Append(Color.DarkGoldenrod);
            nestedMessage.Append(true);
            nestedMessage.Append(false);
            nestedMessage.Append(float.PositiveInfinity);
            nestedBundle.Append(nestedMessage);
            bundle.Append(nestedBundle);

            OscMessage message = new OscMessage(sourceEndPoint, AliveMethod);
            message.Append(9876.543f);
            bundle.Append(message);

            return bundle;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 回転角や位置情報をOSCにより送信
        /// </summary>
        /// <param name="rotHeadXYZ"></param>
        /// <param name="posHeadXYZ"></param>
        /// <param name="posHandRightXYZ"></param>
        /// <param name="posHandLeftXYZ"></param>
        private void SendOSCMessage(Vector3DF rotHeadXYZ, Vector3DF posHeadXYZ, Vector3DF posHandRightXYZ, Vector3DF posHandLeftXYZ)
        {
            // OSCメッセージ生成
            OscMessage rotHeadOsc      = new OscMessage(from, "/head_rot", null);
            OscMessage posHeadOsc      = new OscMessage(from, "/head_pos", null);
            OscMessage posHandRightOsc = new OscMessage(from, "/hand_r", null);
            OscMessage posHandLeftOsc  = new OscMessage(from, "/hand_l", null);

            // 情報の追加
            rotHeadOsc.Append <float>(rotHeadXYZ.x);
            rotHeadOsc.Append <float>(rotHeadXYZ.y);
            rotHeadOsc.Append <float>(rotHeadXYZ.z);
            posHeadOsc.Append <float>(posHeadXYZ.x);
            posHeadOsc.Append <float>(posHeadXYZ.y);
            posHeadOsc.Append <float>(posHeadXYZ.z);
            posHandRightOsc.Append <float>(posHandRightXYZ.x);
            posHandRightOsc.Append <float>(posHandRightXYZ.y);
            posHandRightOsc.Append <float>(posHandRightXYZ.z);
            posHandLeftOsc.Append <float>(posHandLeftXYZ.x);
            posHandLeftOsc.Append <float>(posHandLeftXYZ.y);
            posHandLeftOsc.Append <float>(posHandLeftXYZ.z);

            // 送信
            rotHeadOsc.Send(toExp);
            posHeadOsc.Send(toExp);
            posHandRightOsc.Send(toExp);
            posHandLeftOsc.Send(toExp);
        }
Ejemplo n.º 3
0
    void DoSendCommand(string command, params object[] args)
    {
        var endPoint = new IPEndPoint(IPAddress.Parse(address), port);

        var oscMessage = new OscMessage(endPoint, "/" + command);

        foreach (var arg in args)
        {
            if (arg is int)
            {
                oscMessage.Append <int> ((int)arg);
            }
            else if (arg is float)
            {
                oscMessage.Append <float> ((float)arg);
            }
            else
            {
                oscMessage.Append <string> (arg.ToString());
            }
        }

        // Spam a few of the same message, effectively solves UDP unreliability in a clunky way
        for (int i = 0; i < 5; i++)
        {
            oscMessage.Send(endPoint);
        }
    }
Ejemplo n.º 4
0
        //
        // message helpers
        //

        private OscMessage CreateSourceMessage(string type)
        {
            OscMessage msg = new OscMessage("/tuio/" + type);

            msg.Append("source");
            msg.Append("TUIO Simulator@" + localIPAddresses);
            return(msg);
        }
Ejemplo n.º 5
0
        private OscMessage CreateFSeqMessage(string type)
        {
            OscMessage msg = new OscMessage("/tuio/" + type);

            msg.Append("fseq");
            msg.Append(fseq);
            return(msg);
        }
Ejemplo n.º 6
0
    // Update is called once per frame
    public void SendPosition()
    {
        OscMessage m = new OscMessage(address);

        m.Append(transform.position.x);
        m.Append(transform.position.y);
        m.Append(transform.position.z);
        transmitter.Send(m);
    }
Ejemplo n.º 7
0
    private void SendAxesGesture(string gesture, Vector3 axes)
    {
        // Message with address "/id/axes_gesture"
        OscMessage msg = new OscMessage("/" + display.id + "/axes_gesture");

        // Set the gesture
        msg.Append(gesture);
        msg.Append(axes.x);
        msg.Append(axes.y);
        msg.Append(axes.z);

        // Send the transform data to master
        _transmitter.Send(msg);
    }
Ejemplo n.º 8
0
        private static OscBundle CreateTestBundle()
        {
            IPEndPoint sourceEndPoint = new IPEndPoint(IPAddress.Loopback, Port);
            OscBundle  bundle         = new OscBundle(sourceEndPoint);

            OscBundle  nestedBundle  = new OscBundle(sourceEndPoint);
            OscMessage nestedMessage = new OscMessage(sourceEndPoint, TestMethod);

            nestedMessage.AppendNil();
            nestedMessage.Append("Some String");
            nestedMessage.Append(10);
            nestedMessage.Append(100000L);
            nestedMessage.Append(1234.567f);
            nestedMessage.Append(10.0012345);
            nestedMessage.Append(new byte[] { 1, 2, 3, 4 });
            nestedMessage.Append(new OscTimeTag());
            nestedMessage.Append('c');
            nestedMessage.Append(Color.DarkGoldenrod);
            nestedMessage.Append(true);
            nestedMessage.Append(false);
            nestedMessage.Append(float.PositiveInfinity);
            nestedBundle.Append(nestedMessage);
            bundle.Append(nestedBundle);

            OscMessage message = new OscMessage(sourceEndPoint, AliveMethod);

            message.Append(9876.543f);
            bundle.Append(message);

            return(bundle);
        }
    public void sendPickupCount(int count)
    {
        controllerOscMessage = new OscMessage("/playerPositionX");
        controllerOscMessage.Append(1.0f);

        oscTransmitter.Send(controllerOscMessage);
    }
Ejemplo n.º 10
0
        private OscMessage CreateAliveMessage(string type)
        {
            OscMessage msg = new OscMessage("/tuio/" + type);

            msg.Append("alive");
            return(msg);
        }
Ejemplo n.º 11
0
 // Send QTM OSC Command to server
 private void SendCommand(string cmd)
 {
     qtmCommand.ClearData();
     qtmCommand.Append(cmd);
     LogMessage(qtmCommand);
     qtmCommand.Send(serverEndPoint);
 }
        /// <summary>
        ///     Delivers the value to method.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="stream">The stream.</param>
        /// <param name="method">The method.</param>
        /// <param name="value">The value.</param>
        private static void DeliverValueToMethod <T>(this IObserver <OscPacket> stream, string method, T value)
        {
            var msg = new OscMessage(method);

            msg.Append(value);
            stream.OnNext(msg);
        }
Ejemplo n.º 13
0
        private static OscPacket DeserialiseMessage(JsonReader reader, string address)
        {
            reader.Read(); // read property tags
            var tags = reader.ReadAsString();
            var msg  = new OscMessage(address);

            reader.Read(); // data property name
            reader.Read(); // array start
            for (var index = 0; index < tags.Length; index++)
            {
                var tag = tags[index];

                if (tag == JsonSerializerFactory.ArrayOpen)
                {
                    // skip the '[' character.
                    index++;

                    // deserialise array of object
                    var ret = new List <object>();
                    while (tags[index] != JsonSerializerFactory.ArrayClose &&
                           index < tags.Length)
                    {
                        var des = JsonSerializerFactory.GetSerializer(tags[index]);
                        ret.Add(des.Decode(reader));

                        index++;
                    }

                    msg.Append(ret.ToArray());
                }
                else if (tag != JsonSerializerFactory.DefaultTag)
                {
                    if (tag != JsonSerializerFactory.EventTag)
                    {
                        var des = JsonSerializerFactory.GetSerializer(tag);
                        msg.Append(des.Decode(reader));
                    }
                    else
                    {
                        msg.IsEvent = true;
                    }
                }
            }
            reader.Read(); // array end

            return(msg);
        }
Ejemplo n.º 14
0
        private OscMessage CreateOscMessage(SensorData sensorData)
        {
            OscMessage dataOscMessage = new OscMessage(_sourceEndPoint, "/taprapper/sensordata", sOscClient);

            dataOscMessage.Append(sensorData.AccDataObject.DataVector.X);
            dataOscMessage.Append(sensorData.AccDataObject.DataVector.Y);
            dataOscMessage.Append(sensorData.AccDataObject.DataVector.Z);
            dataOscMessage.Append(sensorData.GyroDataObject.Pitch);
            dataOscMessage.Append(sensorData.GyroDataObject.Roll);
            dataOscMessage.Append(sensorData.GyroDataObject.Yaw);
            dataOscMessage.Append(sensorData.QuaternionObject.X);
            dataOscMessage.Append(sensorData.QuaternionObject.Y);
            dataOscMessage.Append(sensorData.QuaternionObject.Z);
            dataOscMessage.Append(sensorData.QuaternionObject.W);

            return(dataOscMessage);
        }
Ejemplo n.º 15
0
 void OnCollisionEnter(Collision collision)
 {
     if (!clicked)
     {
         var s = stroke.GetComponent <Stroke>();
         if (s.NumberOfStrokes > 0)
         {
             var        sound = collision.gameObject.GetComponent <Sound>();
             OscMessage m     = new OscMessage(audiomesh_address);
             m.Append(sound.AudioIndex);
             m.Append(0.0);
             var percentage = ((float)sound.Index) / s.NumberOfStrokes;
             m.Append(percentage);
             transmitter.Send(m);
         }
     }
 }
Ejemplo n.º 16
0
    private void Controller_MenuUnclicked(object sender, ClickedEventArgs e)
    {
        OscMessage m = new OscMessage(reset_address);

        m.Append(0.0f);
        transmitter.Send(m);
        DestroyImmediate(strokes);
        strokes           = new GameObject();
        Sound.GlobalIndex = 1;
    }
Ejemplo n.º 17
0
        /// <summary>
        /// Sends an OSC message to the remote host.
        /// </summary>
        public void Send(string message, params float[] args)
        {
            var msg = new OscMessage(OSCSettings.SourceEndPoint, message);

            foreach (var f in args)
            {
                msg.Append(f);
            }
            msg.Send(Target);
        }
Ejemplo n.º 18
0
        public void TestArraySerialisation3()
        {
            var msg = new OscMessage("/test", new object[] { 1, 2f, "foo" });

            msg.Append(1); // the last argument is an integer.

            var expected = CreateExpectedDataArray3();

            msg.TypeTag.Should().Be(",[ifs]i");
            OscValidation.AssertSamePacket(expected, msg.ToByteArray());
        }
Ejemplo n.º 19
0
    private void AppendMessage(string address, List <object> values)
    {
        OscMessage messageToSend = new OscMessage(localEndPoint, address);

        //        messageToSend.ClearData(); // do i need this?
        foreach (object message in values)
        {
            messageToSend.Append(message);
        }
        messagesThisFrame.Add(messageToSend);
    }
Ejemplo n.º 20
0
        /// <summary>
        /// Send message to osc device.
        /// </summary>
        /// <param name="address">Address where to send the message.</param>
        /// <param name="value">List of Message(s) or value(s) to send.</param>
        /// <param name="ipAddress">IP address of the osc device.</param>
        /// <param name="port">Port of the osc device.</param>
        private void sendOscMessage(string address, IList <object> data, IPAddress ipAddress, int port)
        {
            IPEndPoint sourceEndPoint = new IPEndPoint(ipAddress, port);
            OscMessage oscMessage     = new OscMessage(sourceEndPoint, address);

            foreach (object value in data)
            {
                oscMessage.Append(value);
            }
            oscMessage.Send(sourceEndPoint);
        }
Ejemplo n.º 21
0
        private void BuildTrackMessage(int[][] score, OscMessage m, int trackCount)
        {
            if (IsShortTrack(score, trackCount))
            {
                positions[trackCount] = 0;
            }

            if (HasBeat(score, trackCount)) m.Append(trackCount + 1);

            ProgressTrackPosition(trackCount);
        }
Ejemplo n.º 22
0
        private static void SendMessage(string messageText)
        {
            var message = new OscMessage(endPoint, "/");

            foreach (var item in messageText.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
            {
                message.Append(item);
            }

            message.Send(endPoint);
        }
Ejemplo n.º 23
0
    private void SendButtonGesture(string gesture)
    {
        // Message with address "/id/button_gesture"
        OscMessage msg = new OscMessage("/" + display.id + "/button_gesture");

        // Set the gesture
        msg.Append(gesture);
        
        // Send the transform data to master
        _transmitter.Send(msg);
    }
Ejemplo n.º 24
0
        private void AppendToBundle <T>(OscBundle oscBundle, OscMessage sourceMsg, OscMessage aliveMsg, OscMessage fseqMsg, bool forceSet = false) where T : ITUIOEntity
        {
            // http://www.tuio.org/?specification - Message & Bundle Format
            //
            // /tuio/2Dcur source application@address
            // /tuio/2Dcur alive s_id0 ... s_idN
            // /tuio/2Dcur set s x y X Y m
            // /tuio/2Dcur fseq f_id
            //
            // nb. TUIOsharp does not enforce an order for alive/set messages so long as they're before fseq

            oscBundle.Append(sourceMsg);

            // entities: alive, set
            aliveMsg.ClearData();             // nb. also clears address
            aliveMsg.Append("alive");

            oscBundle.Append(aliveMsg);

            for (int i = 0; i < _entities.Count; i++)
            {
                ITUIOEntity e = _entities[i];
                if (e.GetType() != typeof(T))
                {
                    continue;
                }

                aliveMsg.Append(e.Id);
                if (forceSet || e.isSendRequired)
                {
                    oscBundle.Append(e.oscMessage);                     // set
                    e.isSendRequired = false;
                }
            }

            // frame sequence
            fseqMsg.UpdateDataAt(1, fseq);
            oscBundle.Append(fseqMsg);
        }
Ejemplo n.º 25
0
    private void HandleTriggerClicked(object sender, ClickedEventArgs e)
    {
        clicked = true;
        points.Clear();
        stroke = new GameObject(stroke_object, typeof(Stroke));
        stroke.transform.parent = strokes.transform;
        stroke_index            = -1;

        OscMessage m = new OscMessage(trigger_address);

        m.Append(transform.position.x);
        transmitter.Send(m);
    }
Ejemplo n.º 26
0
    private void Controller_TriggerUnclicked(object sender, ClickedEventArgs e)
    {
        clicked           = false;
        lastStroke.points = points.ToArray();
        stroke.GetComponent <Stroke>().NumberOfStrokes = points.Count;

        OscMessage m = new OscMessage(trigger_address);

        m.Append(0);
        transmitter.Send(m);

        soundMarker.AudioIndex = Sound.GlobalIndex++;
    }
    // --- game functions ---
    public void sendOSCPlayerPosition(float x, float z)
    {
        //controllerOscMessage = new OscMessage (spherePositionNamespace);
        controllerOscMessage = new OscMessage("/playerPositionX");
        //print("Test");
        controllerOscMessage.Append(x);
        //controllerOscMessage.Append (z);
        //controllerOscMessage.Append("/1/toggle1, f");

        //oscTransmitter.Send (controllerOscMessage);

        // /sphere/position 8.3 -3.1
    }
Ejemplo n.º 28
0
        public void TestArraySerialisation4()
        {
            var msg = new OscMessage("/test", new object[] { 1, 2f, "foo" });

            var blob = CreateTestBlob();

            msg.Append(blob); // the last argument is a blob.

            var expected = CreateExpectedDataArray4();

            msg.TypeTag.Should().Be(",[ifs]b");
            OscValidation.AssertSamePacket(expected, msg.ToByteArray());
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Sends an OSC message to all connected Ableton Live sessions.
        /// </summary>
        public void Send(string message, params float[] args)
        {
            var msg = new OscMessage(SourceEndPoint, message);

            foreach (var f in args)
            {
                msg.Append(f);
            }
            foreach (var target in Targets)
            {
                msg.Send(target);
            }
        }
Ejemplo n.º 30
0
        private void BuildTrackMessage(int[][] score, OscMessage m, int trackCount)
        {
            if (IsShortTrack(score, trackCount))
            {
                positions[trackCount] = 0;
            }

            if (HasBeat(score, trackCount))
            {
                m.Append(trackCount + 1);
            }

            ProgressTrackPosition(trackCount);
        }
Ejemplo n.º 31
0
        private void SendMessage(string address, int[] values = null)
        {
            OscMessage msg = new OscMessage(source, string.Format(MESSAGE_FORMAT, address));

            if (values != null)
            {
                foreach (object v in values)
                {
                    msg.Append(v);
                }
            }

            msg.Send(dest);
        }
Ejemplo n.º 32
0
        // Send data through OSC
        private void SendOSCX(string address, params object[] args)
        {
            // Message with address "/id/button_gesture"
            OscMessage msg = new OscMessage(address);

            // Set the gesture
            foreach (object arg in args)
            {
                msg.Append(arg);
            }

            // Send the transform data to master
            _transmitterX.Send(msg);
        }
Ejemplo n.º 33
0
        /**
         * Creates an OSC formatted message using the current key/value pairs within the
         * local Peer.stateVars dictionary. Each key is represented as a component of the
         * string address (separated by forward slashes). Each value is appended to the
         * OSC packet using the appropriate bit packing method. The index parameter is used
         * to help the remote ServerConnection object match the OSC message with its locally
         * stored list of Client instances.
         *
         * @param index the integer sent to the client upon registration
         * @return TRUE if stateTransmitter was properly initialized, FALSE otherwise
         */
        internal bool PropagateStateVars(int index)
        {
            bool propagated = false;

            if (this.stateVarsInvalidated && null != this.stateTransmitter && this.stateTransmitter.IsConnected() && this.stateVars.Count > 0)
            {
                string     address = "";
                OscMessage message = new OscMessage("");
                message.Append(index);
                foreach (KeyValuePair <string, object> pair in this.stateVars)
                {
                    address += pair.Key + "/";
                    message.Append(pair.Value);
                }
                message.Address = address;
                this.stateTransmitter.Send(message);
                //UnityMainThreadDispatcher.Instance ().Enqueue (ExsecuteOnMainThread_TimeCheck ());
                propagated = true;
            }

            this.stateVarsInvalidated = false;

            return(propagated);
        }
Ejemplo n.º 34
0
        private OscBundle CreateBundle()
        {
            var ipAddress      = _setting.UseLoopback ? IPAddress.Loopback : IPAddress.Parse(_setting.IpAddress);
            var sourceEndPoint = new IPEndPoint(ipAddress, _setting.Port);
            var bundle         = new OscBundle(sourceEndPoint);

            var nestedBundle = new OscBundle(sourceEndPoint);

            foreach (var bindValue in _setting.BindValues)
            {
                var message = new OscMessage(sourceEndPoint, bindValue.Address);
                message.Append(bindValue.Value);
                nestedBundle.Append(message);
            }
            bundle.Append(nestedBundle);
            return(bundle);
        }
Ejemplo n.º 35
0
 private void limboViewerCaptureFree(int _userCount , int _cellPhoneNumber)
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view/picture");
     msg.Append(_userCount.ToString() + "_0" + _cellPhoneNumber.ToString());
     msg.Send(limboViewerIP);
 }
        OscBundle skeleton2DdataCoordEventArgsToOSCBundle(Skeleton2DdataCoordEventArgs e)
        { 
            //Bundles are collections of messages
            OscBundle bundle = new OscBundle(transmitter_ipendpoint);
            //Messages are like packets, label with their type by method name
            OscMessage message = new OscMessage(transmitter_ipendpoint, DEMO_METHOD);
            //Both bundles and messages can be nested
            //Must have at least one bundle and on message

            //Send the whole skeleton
            //First send the index
            message.Append(e.index);
            //Then append each point in order, x then y
            int num_points = e._points.Count();
            for (int i = 0; i < num_points; i++)
            {
                Point normalized_point = normalize_skeleton_point(e._points[i]);
                message.Append((float)normalized_point.X);
                message.Append((float)normalized_point.Y);
            }
            bundle.Append(message);
            return bundle;
        }
Ejemplo n.º 37
0
        private OscMessage GetCursorMessage(TuioCursor cursor)
        {
            OscMessage msg = new OscMessage(_ipEndPoint, _cursorAddressPattern);

            msg.Append("set");
            msg.Append((Int32)cursor.Id);
            msg.Append(cursor.Location.X);
            msg.Append(cursor.Location.Y);
            msg.Append(cursor.Speed.X);
            msg.Append(cursor.Speed.Y);
            msg.Append(cursor.MotionAcceleration);

            return msg;
        }
Ejemplo n.º 38
0
 // Limbo Viewer Message Send
 private void limboViewerSetScene(int sceneNumber)
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view/scene");
     msg.Append(sceneNumber);
     msg.Send(limboViewerIP);
 }
Ejemplo n.º 39
0
        private void limboViewerSendSuccess(bool successStatus)
        {
            OscMessage msg = new OscMessage(limboViewerIP, "/view");
            if (successStatus)
            {
                msg.Append("success");
            }
            else
            {
                msg.Append("fail");
            }

            msg.Send(limboViewerIP);
        }
Ejemplo n.º 40
0
 private void limboViewerPlayCountDown()
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view");
     msg.Append("countdown");
     msg.Send(limboViewerIP);
 }
Ejemplo n.º 41
0
 // iPad Message Send
 //private void iPadSendPicture(int _userCount)
 //{
 //    OscMessage msg = new OscMessage(ipadIP, "/ipad/picture");
 //    msg.Append(_userCount);
 //    msg.Send(ipadIP);
 //}
 private void iPadNextUserReady()
 {
     OscMessage msg = new OscMessage(ipadIP, "/ipad");
     msg.Append("ready");
     msg.Send(ipadIP);
 }
Ejemplo n.º 42
0
 private void iPadIsAlive()
 {
     OscMessage msg = new OscMessage(ipadIP, "/ipad");
     msg.Append("test");
     msg.Send(ipadIP);
 }
Ejemplo n.º 43
0
 private void imageServerTakePhoto(int _userCount, int _cellPhoneNumber)
 {
     OscMessage msg = new OscMessage(imageServerIP, "/image/picture");
     msg.Append(_userCount.ToString()+"_0"+_cellPhoneNumber.ToString());
     msg.Send(imageServerIP);
 }
Ejemplo n.º 44
0
 // Image Server Message Send
 private void imageServerMergeImage()
 {
     OscMessage msg = new OscMessage(imageServerIP, "/image");
     msg.Append("merge");
     msg.Send(imageServerIP);
 }
Ejemplo n.º 45
0
 private void imageServerIsAlive()
 {
     OscMessage msg = new OscMessage(imageServerIP, "/image");
     msg.Append("test");
     msg.Send(imageServerIP);
 }
Ejemplo n.º 46
0
        public void sendSkeletonData(Skeleton skeleton_data, int i )
        {
            IPEndPoint sourceEndPoint = new IPEndPoint(IPAddress.Loopback, Port);
            OscBundle sBundle = new OscBundle(sourceEndPoint);
            //OscMessage sMessage = new OscMessage(sourceEndPoint, "/skeleton", client);

            foreach (Joint joint in skeleton_data.Joints)
            {
                if (this.oscCheck.IsChecked.HasValue && this.oscCheck.IsChecked.Value)
                {
                    OscMessage oscMessage = new OscMessage(sourceEndPoint, "/skeleton", client);
                    oscMessage.Append(joint.JointType.ToString());
                    oscMessage.Append(i.ToString());
                    oscMessage.Append(joint.Position.X.ToString());
                    oscMessage.Append(joint.Position.Y.ToString());
                    oscMessage.Append(joint.Position.Z.ToString());
                    oscMessage.Send(Destination);
                }

            }
        }
        public static OscMessage CreateMessage(string Address)
        {
            Address = Address.Trim();
            string Value = null;
            if (Address.IndexOf(" ") > 0)
            {
                Value = Address.Substring(Address.IndexOf(" ") + 1);
                Address = Address.Substring(0, Address.IndexOf(" "));
            }

            OscMessage msg = new OscMessage(sourceEndPoint, Address);
            if (Value != null)
            {
                if (Address.EndsWith("updates") ||
                    Address.EndsWith("loadAt") ||
                    Address.EndsWith("preWait") ||
                    Address.EndsWith("duration") ||
                    Address.EndsWith("postWait") ||
                    Address.EndsWith("continueMode") ||
                    Address.EndsWith("flagged") ||
                    Address.EndsWith("armed") ||
                    Address.EndsWith("patch") ||
                    Address.EndsWith("startTime") ||
                    Address.EndsWith("endTime") ||
                    Address.EndsWith("playCount") ||
                    Address.EndsWith("infiniteLoop") ||
                    Address.EndsWith("rate") ||
                    Address.EndsWith("doFade") ||
                    Address.EndsWith("surfaceID") ||
                    Address.EndsWith("fullScreen") ||
                    Address.EndsWith("preserveAspectRatio") ||
                    Address.EndsWith("translationX") ||
                    Address.EndsWith("translationY") ||
                    Address.EndsWith("scaleX") ||
                    Address.EndsWith("scaleY") ||
                    Address.EndsWith("doEffect") ||
                    Address.EndsWith("effect"))
                {
                    msg.Append<float>((float)Convert.ToDouble(Value));
                }
                else if (Address.EndsWith("sliderLevel"))
                {
                    if (Value.Contains(" "))
                    {
                        msg.Append<float>((float)Convert.ToDouble(Value.Substring(0, Value.IndexOf(" "))));
                        Value = Value.Substring(Value.IndexOf(" ") + 1);
                    }
                    msg.Append<float>((float)Convert.ToDouble(Value));
                }
                else
                {
                    msg.Append<string>(Value);
                }
            }
            return msg;
        }
Ejemplo n.º 48
0
 private void limboViewerGetImageFromServer(int _userCount, int _cellPhoneNumber)
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view/merge");
     msg.Append(_userCount.ToString() + "_0" + _cellPhoneNumber.ToString());
     msg.Send(limboViewerIP);
 }
Ejemplo n.º 49
0
 private void limboViewerIsAlive()
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view");
     msg.Append("test");
     msg.Send(limboViewerIP);
 }
Ejemplo n.º 50
0
        private void iPadSendSuccess(bool successStatus)
        {
            // keep trying until 'photoReady = true'
            OscMessage msg;
            if (successStatus)
            {
                msg = new OscMessage(limboViewerIP, "/ipad/success");
                msg.Append(userCount.ToString() + "_0"+ cellPhoneNumber.ToString());
            }
            else
            {
                msg = new OscMessage(limboViewerIP, "/ipad/fail");
                msg.Append(userCount.ToString() + "_0" + cellPhoneNumber.ToString());
            }

            userCount++;
            MySettings.Default.userCountSetting = userCount;
            this.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                userCountDisplay.Text = userCount.ToString();
            }));

            msg.Send(ipadIP);
        }
Ejemplo n.º 51
0
 private void limboViewerPlaySlideView()
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view");
     msg.Append("slideview");
     msg.Send(limboViewerIP);
 }
Ejemplo n.º 52
0
 private void iPadTestButton_Click(object sender, RoutedEventArgs e)
 {
     msg = new OscMessage(ipadIP, iPadMsgAddr);
     msg.Append(iPadMsgArg);
     msg.Send(ipadIP);
 }
Ejemplo n.º 53
0
 private void limboViewerSendUserTracked()
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view/user");
     msg.Append("tracked");
     msg.Send(limboViewerIP);
 }
Ejemplo n.º 54
0
        // Kinect Message Send
        private void kinectOn(int kinect)
        {
            string addr = "/kinect/" + kinect.ToString();

            if(kinect == 1)
            {
                OscMessage msg = new OscMessage(kinectFrontIP, addr); ;
                msg.Append("on");
                msg.Send(kinectFrontIP);
            }
            else if (kinect == 2)
            {
                OscMessage msg = new OscMessage(kinectBackIP, addr); ;
                msg.Append("on");
                msg.Send(kinectBackIP);
            }
            else
            {
                return;
            }
        }
Ejemplo n.º 55
0
 private void limboStandIsAlive()
 {
     OscMessage msg = new OscMessage(limboStandIP, "/stand");
     msg.Append("test");
     msg.Send(limboStandIP);
 }
Ejemplo n.º 56
0
 private void limboStandReset()
 {
     OscMessage msg = new OscMessage(limboStandIP, "/stand");
     msg.Append("reset");
     msg.Send(limboStandIP);
 }
Ejemplo n.º 57
0
        private OscMessage GetAliveMessage()
        {
            OscMessage msg = new OscMessage(_ipEndPoint, _cursorAddressPattern);

            msg.Append("alive");
            lock (_cursors)
                foreach (TuioCursor cursor in _cursors.Values)
                    msg.Append((Int32)cursor.Id);

            return msg;
        }
Ejemplo n.º 58
0
 // Limbo Stand Message Send
 private void limboStandSetStandHeight(int _standHeight)
 {
     OscMessage msg = new OscMessage(limboStandIP, "/stand");
     msg.Append(_standHeight);
     msg.Send(limboStandIP);
 }
Ejemplo n.º 59
0
        private OscMessage GetSequenceMessage()
        {
            OscMessage msg = new OscMessage(_ipEndPoint, _cursorAddressPattern);

            msg.Append("fseq");
            msg.Append((Int32)_currentFrame);

            return msg;
        }
        //Return an OSC bundle for skeleton index provided
        /*
        OscBundle skeletonToOSCBundle(Skeleton s, int index)
        {
            Skeleton2DdataCoordEventArgs e = Skeleton2DDataExtract.skeletonToSkeleton2DdataCoordEventArgs(s, index);
            return skeleton2DdataCoordEventArgsToOSCBundle(e);
        }
         */

        OscBundle skeleton2DdataCoordEventArgsToOSCBundle(Skeleton2DdataCoordEventArgs e)
        { 
            //Bundles are collections of messages
            OscBundle bundle = new OscBundle(transmitter_ipendpoint);
            //Messages are like packets, label with their type by method name
            OscMessage message = new OscMessage(transmitter_ipendpoint, SKELETON_METHOD);
            //Both bundles and messages can be nested
            //Must have at least one bundle and on message

            //Send the whole skeleton
            //Send packet number
            message.Append(sent_bundles);
            //Debug.WriteLine("Sent bundle: " + sent_bundles);
            //Send the index
            message.Append(e.index);
            //Then append each point in order, x then y
            int num_points = e._points.Count();
            for (int i = 0; i < num_points; i++)
            {
                Point normalized_point = normalize_skeleton_point(e._points[i]);
                message.Append((float)normalized_point.X);
                message.Append((float)normalized_point.Y);
            }
            message.Append(kinect_id); //#19
            //There are 19 things appended to this message. If you add more,
            //you must change the numSkeletonOSCArgs in the c++ code

            bundle.Append(message);
            return bundle;
        }