public TuioServer(string host = "127.0.0.1", int port = 3333, int size = 65536)
        {
            if (size > MAX_UDP_SIZE) size = MAX_UDP_SIZE;
            if (size < MIN_UDP_SIZE) size = MIN_UDP_SIZE;

            try
            {
                this.socket = new OSCTransmitter(host, port);
                this.socket.Connect();

                this.connected = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            this.cursorList = new List<TuioCursor>();
            this.freeCursorList = new List<TuioCursor>();
            this.freeCursorBuffer = new List<TuioCursor>();

            this.currentFrameTime = TuioTime.SessionTime;
            this.currentFrame = -1;
            this.sessionID = -1;
            this.maxCursorID = -1;
            this.updateCursor = false;
            this.lastCursorUpdate = this.currentFrameTime.Seconds;

            Clear();
        }
 public void disconnect()
 {
     if (pUDPWriter != null)
         pUDPWriter.Close();
     pUDPWriter = null;
     if (OnDisconnect != null)
     {
         OnDisconnect();
     }
 }
 public void connect()
 {
     // Reconnect with the new API.
     pUDPWriter = new OSCTransmitter(WiiTUIO.Properties.Settings.Default.tuio_IP, WiiTUIO.Properties.Settings.Default.tuio_port);
     pUDPWriter.Connect();
     if (OnConnect != null)
     {
         OnConnect();
     }
 }
Example #4
0
 private void disconnect()
 {
     if (transmitter != null)
     {
         transmitter.Close();
     }
     if (receiver != null)
     {
         receiver.Close();
     }
     if (listenerThread != null)
     {
         listenerThread.Abort();
     }
     listenerThread = null;
     receiver       = null;
     transmitter    = null;
 }
        private void scaOscButton_Click(object sender, EventArgs e)
        {
            scaOscStopButton.Enabled = true;
            scaOscButton.Enabled = false;

            ensureOscilloscope();

            m_oscListenerThread = new Thread(new ThreadStart(oscListenerLoop));
            // see Entry.cs for how the current culture is set:
            m_oscListenerThread.CurrentCulture = Thread.CurrentThread.CurrentCulture; //new CultureInfo("en-US", false);
            m_oscListenerThread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture; //new CultureInfo("en-US", false);
            m_oscListenerThread.IsBackground = true;	// terminate with the main process
            m_oscListenerThread.Name = "AccelTestOSCListener";
            m_oscListenerThread.Start();

            Thread.Sleep(3000);		// let the oscilloscope start

            int oscPort = Convert.ToInt32(oscPortTextBox.Text);

            oscTransmitter = new OSCTransmitter("localhost", oscPort);

            oscTransmitter.Connect();

            Tracer.Trace("OSC connected and transmitting to port " + oscPort);
        }
Example #6
0
    //
    void connexion(string serverIp)
    {
        transmitter = new OSC.NET.OSCTransmitter(serverIp, 3333);

        //Application.LoadLevel(1);
    }
Example #7
0
 public void doneCapturePhoto()
 {
     OSC.NET.OSCMessage m = new OSC.NET.OSCMessage("camera_on");
         OSC.NET.OSCTransmitter t = new OSC.NET.OSCTransmitter("localhost", capturePort + 1);
         t.Connect();
         t.Send(m);
 }
Example #8
0
 //
 void connexion(string serverIp)
 {
     transmitter = new OSC.NET.OSCTransmitter(serverIp, 3333);
 }
 /// <summary>
 /// Disconnect the UDP Transmitter.
 /// </summary>
 /// <returns></returns>
 private void disconnectTransmitter()
 {
     // Close any open connections.
     if (pUDPWriter != null)
         pUDPWriter.Close();
     pUDPWriter = null;
 }
	        private void Window_Loaded(object sender, RoutedEventArgs e)
	        {
			osc = new OSCTransmitter(remoteIP, remotePort);		// Initializes the OSC transmitter
			this.InitializeHDFace();
	        }
Example #11
0
 private void buttonConnect_Click(object sender, System.EventArgs e)
 {
     //osc = new OSCUDPTalk(textBoxRemoteHost.Text, int.Parse(textBoxRemotePort.Text), int.Parse(textBoxLocalPort.Text), true);
     transmitter = new OSCTransmitter(textBoxRemoteHost.Text, int.Parse(textBoxRemotePort.Text));
     receiver = new OSCReceiver(int.Parse(textBoxLocalPort.Text));
     updateComponents(true);
     listenerThread = new Thread(new ThreadStart(this.receive));
     listenerThread.Start();
 }
Example #12
0
 private void disconnect()
 {
     if(transmitter != null) transmitter.Close();
     if(receiver != null) receiver.Close();
     if(listenerThread !=null) listenerThread.Abort();
     listenerThread = null;
     receiver = null;
     transmitter = null;
 }
Example #13
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _oscTransmitter = new OSCTransmitter("127.0.0.1", Port, TCP);
            _oscTransmitter.TCPClientConnected += _oscTransmitter_TCPClientConnected;
            _cursorSessionCounter = 0;

            _cursors = new Dictionary<string, Cursor>();

            this.WindowState = WindowState.Maximized;

            MultipointSdk.Instance.Register(this);
            App.MultiPointObject.CurrentWindow = this;

            foreach (DeviceInfo d in App.MultiPointObject.MouseDeviceList)
            {
                MultipointMouseDevice mpMouseDevice = d.DeviceVisual;
                Bitmap cursorBitmap = GetCursorImage(MultipointSdk.Instance.MouseDeviceList.Count);
                mpMouseDevice.CursorImage = ConvertBitmapToBitmapImage(cursorBitmap);
            }
            App.MultiPointObject.DeviceArrivalEvent += MultiPointObject_DeviceArrivalEvent;

            KeyDown += Window1_KeyDown;

            MTContainer.MultipointMouseDownEvent += MTContainer_MultiPointMouseDownEvent;
            MTContainer.MultipointMouseMoveEvent += MTContainer_MultiPointMouseMoveEvent;
            MTContainer.MultipointMouseUpEvent += MTContainer_MultiPointMouseUpEvent;
        }
        public void Close()
        {
            if (this.connected && this.socket != null)
            {
                Clear();

                this.socket.Close();
                this.socket = null;

                this.connected = false;
            }
        }
        private void scaOscStopButton_Click(object sender, EventArgs e)
        {
            oscStopNow = true;
            oscTransmitter.Close();
            oscTransmitter = null;

            Tracer.Trace("stopping OSC loop");
            if (m_oscListenerThread != null)
            {
                Thread.Sleep(1000);		// let the dialog close before we abort the thread
                m_oscListenerThread.Abort();
                m_oscListenerThread = null;
            }
            scaOscButton.Enabled = true;
            scaOscStopButton.Enabled = false;
        }
Example #16
0
        /// <summary>
        /// Allows the app to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            SetWindowOnSurface();
            InitializeSurfaceInput();

            // Set the application's orientation based on the current launcher orientation
            currentOrientation = ApplicationServices.InitialOrientation;

            // Subscribe to surface application activation events
            ApplicationServices.WindowInteractive += OnApplicationActivated;
            //ApplicationLauncher.ApplicationActivated += OnApplicationActivated;

            ApplicationServices.WindowNoninteractive += OnApplicationPreviewed;
            //ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed;

            ApplicationServices.WindowUnavailable += OnApplicationPreviewed;
            //ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated;

            // Setup the UI to transform if the UI is rotated.
            //if (currentOrientation == UserOrientation.Top)
            //{
                // Create a rotation matrix to orient the screen so it is viewed correctly when the user orientation is 180 degress different.
                //Matrix rotation = Matrix.CreateRotationZ(MathHelper.ToRadians(180));
                //Matrix translation = Matrix.CreateTranslation(graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height, 0);

                //screenTransform = rotation * translation;
            //}

            base.Initialize();
            //int port = 0;
            //bool parseSucc = int.TryParse(ConfigurationSettings.AppSettings["RemotePort"], out port);
            _OSCSender = new OSCTransmitter(Properties.Settings.Default.RemoteHost, Properties.Settings.Default.RemotePort);
            //_OSCSender = new OSCTransmitter("127.0.0.1", 3333);
            _Frame = 0;
        }
Example #17
0
        /// <summary>
        /// Connect the UDP transmitter using the port and IP specified above.
        /// </summary>
        /// <returns></returns>
        private bool connectTransmitter(String Host, String Port)
        {
            try
            {
                // Close any open connections.
                disconnectTransmitter();

                // Reconnect with the new API.
                pUDPWriter = new OSCTransmitter(Host, Int32.Parse(Port));
                pUDPWriter.Connect();
                return true;
            }
            catch (Exception pError)
            {
                // Tear down.
                try
                {
                    this.disconnectTransmitter();
                }
                catch { }

                // Report the error.
                System.Console.Error.WriteLine("TUIO Connection Error: " + pError.Message);
                return false;
            }
        }