Exemple #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Starting");

            GestureRecognition    _gestureRecog;
            AmbrSpeechRecognition _speechRecog;

            KodiClient k = new KodiClient();

            //The gesture and speech services don't actually care if there's a sensor attached. it will just return nothing
            _gestureRecog = new GestureRecognition();
            _speechRecog  = new AmbrSpeechRecognition();

            //Subscribe to the events
            _gestureRecog.KinectActionRecognized += KinectActionEventHandler;
            _speechRecog.KinectActionRecognized  += KinectActionEventHandler;

            _gestureRecog.KinectActionRecognized += k.KinectActionEventHandler;
            _speechRecog.KinectActionRecognized  += k.KinectActionEventHandler;

            //Register the gestures
            _gestureRecog.Init().Wait();

            Console.WriteLine("Ready");

            //Wait until the user hits "escape"
            while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape))
            {
                // do something
            }
        }
Exemple #2
0
        private void startKodiClientProcess()
        {
            int port            = KodiClient.FreeTcpPort();
            ProcessStartInfo ps = new ProcessStartInfo("python", "AmbrKodi\\kodi_interface.py " + port.ToString());

            kodiPython.StartInfo = ps;
            kodiPython.Start();

            while (true)
            {
                try
                {
                    kodiTcpClient = new TcpClient("127.0.0.1", port);
                    break;
                }
                catch { }
            }
            kodiStreamReader           = new StreamReader(kodiTcpClient.GetStream());
            kodiStreamWriter           = new StreamWriter(kodiTcpClient.GetStream());
            kodiStreamWriter.AutoFlush = true;
        }