private void Start()
        {
            if (_tuioClient != null)
            {
                Stop();
            }

            TouchInjection.Initialize(MAX_CONTACTS, this.IsContactVisible ? TouchFeedback.INDIRECT : TouchFeedback.NONE);

            _tuioClient = new TuioClient(this.Port);
            _tuioClient.addTuioListener(this);
            try
            {
                _tuioClient.connect();
            }
            catch (Exception e)
            {
                this.IsEnabled = false;
                if (e is SocketException)
                {
                    SocketException se = (SocketException)e;
                    MessageBox.Show(string.Format("{0}\r\n\r\nError Code: {1} ({2})", se.Message, se.ErrorCode, se.SocketErrorCode), "Error: SocketException", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Exemple #2
0
    public TuioDemo(int port)
    {
        verbose    = false;
        fullscreen = false;
        width      = window_width;
        height     = window_height;

        this.ClientSize = new System.Drawing.Size(width, height);
        this.Name       = "TuioDemo";
        this.Text       = "TuioDemo";

        this.Closing += new CancelEventHandler(Form_Closing);
        this.KeyDown += new KeyEventHandler(Form_KeyDown);

        this.SetStyle(ControlStyles.AllPaintingInWmPaint |
                      ControlStyles.UserPaint |
                      ControlStyles.DoubleBuffer, true);

        objectList = new Dictionary <long, TuioObject>(128);
        cursorList = new Dictionary <long, TuioCursor>(128);
        blobList   = new Dictionary <long, TuioBlob>(128);

        client = new TuioClient(port);
        client.addTuioListener(this);

        client.connect();
    }
    public BBInputController()
    {
        client = new TuioClient(3333);
        client.addTuioListener(this);
//		Debug.Log ("before calling client.connect (TuioClient client)");
        client.connect();
    }
Exemple #4
0
 public ibheTuioConnector()
 {
     client = new TuioClient(3333);
     client.addTuioListener(this);
     client.connect();
     Debug.Log("Commencing TUIO connection");
 }
Exemple #5
0
    public static void Main(String[] argv)
    {
        TuioDump   demo   = new TuioDump();
        TuioClient client = null;

        switch (argv.Length)
        {
        case 1:
            int port = 0;
            port = int.Parse(argv[0], null);
            if (port > 0)
            {
                client = new TuioClient(port);
            }
            break;

        case 0:
            client = new TuioClient();
            break;
        }

        if (client != null)
        {
            client.addTuioListener(demo);
            client.connect();
            Console.WriteLine("listening to TUIO messages at port " + client.getPort());
        }
        else
        {
            Console.WriteLine("usage: mono TuioDump [port]");
        }
    }
        private void InitTracking()
        {
            if (_client != null && _client.isConnected())
            {
                Debug.LogWarning("Client is already connected. Abort opening another connection.");
                return;
            }

            _eventQueue = new Queue <TuioEvent>();

            // Create a new TUIO client and listen for data on the specified port
            _client = new TuioClient(_udpPort);
            _client.addTuioListener(this);
            _client.connect();

            if (!_client.isConnected())
            {
                Debug.LogError("Couldn't listen at port " + _udpPort + " for TUIO data. Check if port isn't already in use. (netstat -ano | find \"" + _udpPort + "\")\n(also be sure to kill adb.exe if its still running)");
                _client.removeTuioListener(this);
                _client = null;
            }
            else
            {
                Debug.Log("Connection establised: listening at port " + _udpPort + " for TUIO data.");
            }
        }
Exemple #7
0
 public BBInputController()
 {
     client = new TuioClient(3333);
     client.addTuioListener(this);
     client.connect();
     cursorDidChange = false;
 }
Exemple #8
0
        private void bttConnect_Click(object sender, RoutedEventArgs e)
        {
            if (client == null)
            {
                try
                {
                    client = new TuioClient(int.Parse(txtPort.Text));
                    client.addTuioListener(this);
                    client.connect();
                    bttConnect.Content = "Disconnect";
                    lblContent.Content = "Simulator has working !";
                    DrawLogSystem("Simulator has working!");
                }
                catch (Exception e2)
                {
                    lblContent.Content = "Can't connect to TUIO host!\nPlease change another port !";
                    client             = null;

                    DrawLogSystem("Simulator can't connect to TUIO host!");
                }
            }
            else
            {
                client.disconnect();
                client             = null;
                lblContent.Content = "Simulator has stop working !";
                bttConnect.Content = "Connect...";
                DrawLogSystem("Simulator has stop working!");
            }
        }
 public void Start()
 {
     client   = new TuioClient();
     listener = new Listener(this);
     client.addTuioListener(listener);
     client.connect();
     IsRunning = true;
 }
Exemple #10
0
 public mtConnector(mtManager mang)
 {
     client = new TuioClient(3333);
     client.addTuioListener(this);
     client.connect();
     cursorDidChange = false;
     activeCursors   = client.getTuioCursors();
     Debug.Log("Commencing TUIO connection");
     mtM = mang;
 }
        private void Stop()
        {
            _pointerTouchInfos.Clear();
            InjectPointerTouchInfos();

            if (_tuioClient != null)
            {
                _tuioClient.disconnect();
                _tuioClient.removeTuioListener(this);
                _tuioClient = null;
            }
        }
Exemple #12
0
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("Script start");
        objectList = new Dictionary <long, TuioObject>(128);
        cursorList = new Dictionary <long, TuioCursor>(128);

        client = new TuioClient(3333);
        client.addTuioListener(this);

        client.connect();


        gameObjectList = new Dictionary <long, GameObject>(128);
        Debug.Log("tuio client connected");
    }
        /// <summary>
        /// Shuts down the reception of tracking data by disconnecting the TUIO client.
        /// </summary>
        public void Shutdown()
        {
            if (_client != null)
            {
                _client.removeTuioListener(this);

                if (_client.isConnected())
                {
                    _client.disconnect();
                }

                _client = null;
                Debug.Log("Disconnected TUIO client: port is now free.");
            }
        }
        public TuioManager()
        {
            if (m_Instance != null)
            {
                Debug.LogError("Trying to create two instances of singleton.");
                return;
            }

            m_Instance = this;

            m_Client = new TuioClient();
            m_Client.addTuioListener(this);

            //init members
            this.m_TUIOObjects = new List <TuioObject>();
        }
Exemple #15
0
    void Start()
    {
        m_tokenPosition = TokenPosition.Instance;
        m_settings      = Settings.Instance;

        markersOnGrid = new List <int>();

        redMarkers   = new List <GameObject>();
        greenMarkers = new List <GameObject>();
        blueMarkers  = new List <GameObject>();

        red   = m_settings.red;
        blue  = m_settings.blue;
        green = m_settings.green;
        grey  = m_settings.grey;

        addedTuioObjects   = new List <TuioObject>();
        removedTuioObjects = new List <TuioObject>();
        updatedTuioObjects = new List <TuioObject>();

        addedTuioObjectsI   = new List <TuioObject>();
        removedTuioObjectsI = new List <TuioObject>();
        updatedTuioObjectsI = new List <TuioObject>();

        activeMarkersOnGrid      = new GameObject[m_settings.beats];
        activeREDMarkersOnGrid   = new GameObject[m_settings.beats];
        activeGREENMarkersOnGrid = new GameObject[m_settings.beats];
        activeBLUEMarkersOnGrid  = new GameObject[m_settings.beats];

        //add this class to the callback list of the client
        m_tuiomanager = TuioManager.Instance;
        TuioClient m_tuioClient = m_tuiomanager.GetTuioClient();

        m_tuioClient.addTuioListener(this);

        //get all markers in the game
        GameObject[] markersArray = GameObject.FindGameObjectsWithTag(m_settings.markerTag);
        //fills dictionary with markers for later easier access (MarkerID as key)
        markers      = new Dictionary <int, GameObject>();
        currentTunes = new Dictionary <int, int>();
        foreach (GameObject marker in markersArray)
        {
            int id = marker.GetComponent <FiducialController>().MarkerID;
            markers.Add(id, marker);
            currentTunes.Add(id, 0);
        }
    }
        /// <summary>
        /// Shuts down the reception of tracking data by disconnecting the TUIO client.
        /// </summary>
        public void Shutdown()
        {
            if (m_client != null)
            {
                m_client.removeTuioListener(this);
                if (m_client.isConnected())
                {
                    m_client.disconnect();
                }
                m_client = null;
                Debug.Log("--- Disconnected TUIO client: port is now free ---");
            }
            else
            {
//				Debug.LogWarning("--- Disconnect failed: No TuioClient object available ---");
            }
        }
Exemple #17
0
 public bool Connect(int port = 3333)
 {
     CursorList = new Dictionary <long, TuioCursorContainer>();
     try
     {
         client = new TuioClient(port);
         client.addTuioListener(helper);
         client.connect();
         IsRunning = true;
         return(true);
     }
     catch
     {
         IsRunning = false;
         return(false);
     }
 }
        public static void RegisterEvents(Window root)
        {
            _root = root;
            try
            {
                isSwapXY = Convert.ToBoolean(ConfigurationManager.AppSettings["TUIO_isSwapXY"]);
                isFlipX  = Convert.ToBoolean(ConfigurationManager.AppSettings["TUIO_isFlipX"]);
                isFlipY  = Convert.ToBoolean(ConfigurationManager.AppSettings["TUIO_isFlipY"]);
            }
            catch
            {
            }

            client = new TuioClient(3333);
            client.addTuioListener(tm);
            client.connect();
            root.Closing += new System.ComponentModel.CancelEventHandler(root_Closing);
            CompositionTarget.Rendering += CompositionTarget_Rendering;
        }
        public void addtuioclient()
        {
            client = null;
            client = new TuioClient(Convert.ToInt32(tuio_port.Text));

            if (client != null)
            {
                client.addTuioListener(Listener);
                client.connect();
                Console.WriteLine("listening to TUIO messages at port " + client.getPort());
                timer1          = new Timer();
                timer1.Interval = 100;
                timer1.Enabled  = true;
                timer1.Tick    += new System.EventHandler(OnTimerEvent);
            }
            else
            {
                Console.WriteLine("usage: java TuioDump [port]");
            }
        }
        private void InitTracking()
        {
            while (m_client != null && m_client.isConnected())
            {
                Debug.LogWarning("Client still connecting. Waiting...");
            }

            m_eventQueue = new Queue <TuioEvent>();
            // Create a new TUIO client and listen for data on the specified port
            m_client = new TuioClient(m_udpPort);
            m_client.addTuioListener(this);
            m_client.connect();
            if (!m_client.isConnected())
            {
                Debug.LogError("Couldn't listen at port " + m_udpPort + " for TUIO data. Check if port isn't already in use. (netstat -ano | find \"" + m_udpPort + "\")\n(also be sure to kill adb.exe if its still running)");
                m_client.removeTuioListener(this);
                m_client = null;
            }
            else
            {
                //Debug.Log ("--- Connection establised: listening at port " + m_udpPort + " for TUIO data. ---");
            }
        }
 public TuioListener(int port = 3333)
 {
     client = new TuioClient(port);
     client.addTuioListener(this);
     client.connect();
 }
Exemple #22
0
 public BBInputController()
 {
     client = new TuioClient(3333);
     client.addTuioListener(this);
     client.connect();
 }
Exemple #23
0
 public TuioUnityListener()
 {
     client = new TuioClient();
     client.addTuioListener(this);
     client.connect();
 }
 private TUIOController()
 {
     m_refClt = new TuioClient();
 }
 public void UpdatePort(int iPort_)
 {
     m_refClt = new TuioClient(iPort_);
 }
Exemple #26
0
 public TUIODecoder()
 {
     FTuioClient = new TuioClient();
     instance    = this;
 }