Beispiel #1
0
    private void sendVibrateState(int state, int freq, int time)
    {
        //Here we update the data with the new value
        if (_OSCeArg.Packet is OscMessage)
        {
            //Message
            OscMessage msg = ((OscMessage)_OSCeArg.Packet);
            msg.UpdateDataAt(0, state);
            msg.UpdateDataAt(1, changeFreqToWavelength(freq));
            msg.UpdateDataAt(2, time);
        }
        else if (_OSCeArg.Packet is OscBundle)
        {
            //Bundle
            foreach (OscMessage msg2 in ((OscBundle)_OSCeArg.Packet).Messages)
            {
                msg2.UpdateDataAt(0, state);
                msg2.UpdateDataAt(1, changeFreqToWavelength(freq));
                msg2.UpdateDataAt(2, time);
            }
        }

        //Here we trigger the sending method
        _SendOSCMessage(_OSCeArg);
    }
Beispiel #2
0
    private void sendMouseState(int state, Vector2 pos)
    {
        //Here we update the data with the new value
        if (_OSCeArg.Packet is OscMessage)
        {
            //Message
            OscMessage msg = ((OscMessage)_OSCeArg.Packet);
            msg.UpdateDataAt(0, state);
            msg.UpdateDataAt(1, pos.x);
            msg.UpdateDataAt(2, pos.y);
        }
        else if (_OSCeArg.Packet is OscBundle)
        {
            //Bundle
            foreach (OscMessage msg2 in ((OscBundle)_OSCeArg.Packet).Messages)
            {
                msg2.UpdateDataAt(0, state);
                msg2.UpdateDataAt(1, pos.x);
                msg2.UpdateDataAt(2, pos.y);
            }
        }

        //Here we trigger the sending method
        _SendOSCMessage(_OSCeArg);
    }
Beispiel #3
0
 public void SendResetWeight()
 {
     /* Send the reset weight signal to adafruit*/
     if (_OSCeArg.Packet is OscMessage)
     {
         OscMessage msg = ((OscMessage)_OSCeArg.Packet);
         msg.UpdateDataAt(0, resetWeightSenser ? 1 : 0);
         msg.UpdateDataAt(1, calibrationFactor);
     }
     _SendOSCMessage(_OSCeArg);
     resetWeightSenser       = false;
     changeCalivrationFactor = false;
     Debug.LogFormat("[OSC] Send the reset weight signal");
 }
 private void _updateOscMessageData(OscMessage msg)
 {
     msg.UpdateDataAt(0, isDragging);
     msg.UpdateDataAt(1, controllerXPosition);
     msg.UpdateDataAt(2, controllerYPosition);
     msg.UpdateDataAt(3, isPinching);
     msg.UpdateDataAt(4, controllerScale);
     msg.UpdateDataAt(5, isTwisting);
     msg.UpdateDataAt(6, controllerZRotation);
     msg.UpdateDataAt(7, isDoubleTapped);
 }
Beispiel #5
0
    private void sendLedState(int state2)
    {
        //Here we update the data with the new value
        if (_OSCeArg.Packet is OscMessage)
        {
            //Message
            OscMessage msg3 = ((OscMessage)_OSCeArg.Packet);
            msg3.UpdateDataAt(3, state2);
        }
        else if (_OSCeArg.Packet is OscBundle)
        {
            //Bundle
            foreach (OscMessage msg4 in ((OscBundle)_OSCeArg.Packet).Messages)
            {
                msg4.UpdateDataAt(3, state2);
            }
        }

        //Here we trigger the sending method
        _SendOSCMessage(_OSCeArg);
    }
Beispiel #6
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);
        }
Beispiel #7
0
 /// <summary>
 /// Just a dummy method that shows how you update the data of the OSC Message
 /// </summary>
 private void _updateOscMessageData(OscMessage msg)
 {
     msg.UpdateDataAt(0, dynamicIntValue);
     msg.UpdateDataAt(1, dynamicFloatValue);
     msg.UpdateDataAt(2, dynamicStringValue);
 }