예제 #1
0
        static void Main(string[] args)
        {
            CGazeFlowAPI gazeFlowAPI = new CGazeFlowAPI();


            //To get your AppKey register at http://gazeflow.epizy.com/GazeFlowAPI/register/

            string AppKey = "AppKeyDemo";

            if (gazeFlowAPI.Connect("127.0.0.1", 5555, AppKey))
            {
                while (true)
                {
                    CGazeData GazeData = gazeFlowAPI.ReciveGazeDataSyn();
                    if (GazeData == null)
                    {
                        Console.WriteLine("Disconected");
                        return;
                    }
                    else
                    {
                        Console.WriteLine("Gaze: {0} , {1}", GazeData.GazeX, GazeData.GazeY);
                        Console.WriteLine("Head: {0} , {1}, {2}", GazeData.HeadX, GazeData.HeadY, GazeData.HeadZ);
                        Console.WriteLine("Head rot : {0} , {1}, {2}", GazeData.HeadYaw, GazeData.HeadPitch, GazeData.HeadRoll);
                        Console.WriteLine("");
                    }
                }
            }
            else
            {
                Console.WriteLine("Connection fail");
            }



            Console.Read();
        }
예제 #2
0
        public void IsPressed(CGazeData GazeData, int width_letter, int height_letter, int Height, int Width, SpeechSynthesizer speaker)
        {
            //Taste A
            if (GazeData.GazeX <= width_letter && GazeData.GazeY <= height_letter)
            {
                if (lastchar != 'A')
                {
                    count = 0;
                }
                count++;
                lastchar = 'A';
                if (count == 40)
                {
                    char_list.Add('A');
                    //Console.Write("A");
                    myText.Text += "A";
                    myText.Refresh();
                }
            }
            //Taste B
            if (GazeData.GazeX > width_letter && GazeData.GazeX <= (2 * width_letter) && GazeData.GazeY <= height_letter)
            {
                if (lastchar != 'B')
                {
                    count = 0;
                }
                count++;
                lastchar = 'B';
                if (count == 40)
                {
                    char_list.Add('B');
                    //Console.Write("B");
                    myText.Text += "B";
                    myText.Refresh();
                }
            }

            //Taste F
            if (GazeData.GazeX > (5 * width_letter) && GazeData.GazeX <= Width && GazeData.GazeY <= height_letter)
            {
                if (lastchar != 'F')
                {
                    count = 0;
                }
                count++;
                lastchar = 'F';
                if (count == 40)
                {
                    char_list.Add('F');
                    //Console.Write("F");
                    myText.Text += "F";
                    myText.Refresh();
                }
            }

            //Taste H
            if (GazeData.GazeX > width_letter && GazeData.GazeX <= (2 * width_letter) && GazeData.GazeY > height_letter && GazeData.GazeY <= (2 * height_letter))
            {
                if (lastchar != 'H')
                {
                    count = 0;
                }
                count++;
                lastchar = 'H';
                if (count == 40)
                {
                    char_list.Add('H');
                    //Console.Write("H");
                    myText.Text += "H";
                    myText.Refresh();
                }
            }

            //ENTER-Taste
            if (GazeData.GazeX > (5 * width_letter) && GazeData.GazeX <= Width && GazeData.GazeY > (4 * height_letter) && GazeData.GazeY <= Height)
            {
                if (lastchar != '#')
                {
                    count = 0;
                }
                count++;
                lastchar = '#';
                if (count == 40)
                {
                    string str = new string(char_list.ToArray());
                    speaker.SpeakAsync(str);
                }
            }
        }
예제 #3
0
        static void Main()
        {
            /*Erstellung und Öffnen des GUIs Keyboard*/

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Keyboard keyboard = new Keyboard();

            int Width         = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
            int Height        = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
            int width_letter  = Width / 6;
            int height_letter = Height / 5;

            /*Bei 1366 x 768:
             * width_letter = 227,667
             * height_letter = 153,6
             *
             * Bereiche der einzelnen letters:
             * A    x: [0 - width_letter]                       y: [0 - height_letter]
             * B    x: [width_letter - (2*width_letter)         y: bleibt gleich
             * C    x: [(2*width_letter) - (3*width_letter)]    y: bleibt gleich
             * usw.
             */


            //Sprachausgabe
            SpeechSynthesizer speaker = new SpeechSynthesizer();

            //In dem Fall unnötig, aber falls zB vorher OutputToWav eingestellt war
            speaker.SetOutputToDefaultAudioDevice();
            //Geschwindigkeit (-10 - 10)
            speaker.Rate = 1;
            //Lautstärke (0-100)
            speaker.Volume = 100;
            // Stimme
            speaker.SelectVoiceByHints(VoiceGender.Male, VoiceAge.Adult);

            /*Liste besser als Arr -> dynamisch*/
            List <char> char_list = new List <char>();

            CGazeFlowAPI gazeFlowAPI = new CGazeFlowAPI();

            //Keypress keypress = new Keypress();

            string AppKey = "AppKeyDemo";

            if (gazeFlowAPI.Connect("127.0.0.1", 43333, AppKey))
            {
                while (true)
                {
                    keyboard.Show();
                    keyboard.Focus();
                    CGazeData GazeData = gazeFlowAPI.ReciveGazeDataSyn();
                    if (GazeData == null)
                    {
                        Console.WriteLine("Disconected");
                        return;
                    }
                    else
                    {
                        //Methode ausgelagert
                        keyboard.IsPressed(GazeData, width_letter, height_letter, Height, Width, speaker);
                    }
                }
            }
            else
            {
                Console.WriteLine("Connection fail");
            }

            Console.Read();
        }