예제 #1
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
        public frmCar()
        {
            InitializeComponent();

            InputPool = null;

            //r = phone.FindContact();
        }
예제 #2
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
        private void Fusion()
        {
            clsInput temp = new clsInput();
            temp = InputPool;

            DeleteExpiredData();

            if (!dialogue) StartDialogue();

            while (temp != null)
            {
                if ((temp.GetPartOfSpeech() == "action") && frame == null)
                {
                    SelectFrame(temp.GetInfo());

                    state = 1; //  tries to fill that frame

                    //start task's timer
                    //tmrTimeFrame.Enabled = true;
                    counter = 0; //cancel after 3 attempts
                    RemoveInput(temp);
                }
                else
                {
                    /*if (frame != null)

                        if (frame.name == "call" && state == 31)
                            response = "Yes";
                    if (temp.GetPartOfSpeech() == "digit")
                        nbdigit++;
                    if (frame != null && !frame.isFilled())
                    {
                        if ((frame.name == "call" || frame.name == "message" )&& nbdigit>=10)
                            GetNumber();

                    }*/
                }
                if (frame != null && frame.name == "addressbook")
                {
                    if (temp.GetInfo().ToLower() == "next")
                    {
                        iContact++;
                        state = 4;
                    }
                    if (temp.GetInfo().ToLower() == "previous" || temp.GetInfo().ToLower() == "back")
                    {
                        iContact--;
                        state = 4;
                    }

                }
                temp = temp.next;
            }
            temp = null;

            //Dialogue();
        }
예제 #3
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
        private void FillingSlots()
        {
            clsInput temp = new clsInput();
            temp = InputPool;

            //reverse the parsing
            while (temp != null && frame != null)
            {
                clsSlot sl = new clsSlot();
                sl = frame.slots;
                while (sl != null && frame != null)
                {
                    if ((sl.name == temp.GetPartOfSpeech()))
                    {
                        sl.value = temp.GetInfo();
                        //tmrTimeFrame.Enabled = false;
                    }
                    sl = sl.next;
                }
                if (frame.name == "call" && temp.GetInfo() == "number")
                    state = 26;
                temp = temp.next;
            }
            temp = null;

            if (frame != null && frame.isFilled())
                state = 3; // check for number state 21

            //
        }
예제 #4
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
 private void button3_Click(object sender, EventArgs e)
 {
     phone.Play("Media\\nokiasms.mp3");
     clsInput inp = new clsInput("incoming_sms", "action", "Event", DateTime.Now, 1);
     AddInput(inp);
     Record("<Event> Incoming text message");
     Fusion();
 }
예제 #5
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
 void ClearingDigits()
 {
     clsInput temp = new clsInput();
     temp = InputPool;
     if (temp.next == null) temp = null;
     else
         while (temp.next != null)
         {
             string info = temp.GetPartOfSpeech();
             //DateTime time = temp.GetTime();
             if (info == "digit")
             {
                 temp = temp.next.next;
                 break;
             }
             else
                 temp = temp.next;
         }
 }
예제 #6
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
        private void btnSend_Click(object sender, EventArgs e)
        {
            if (state == 31)
                response = "Yes";
            if (frame != null && !frame.isFilled())
            {
                // try to get a number in the input pool
                if (frame.name == "call" || frame.name == "message")
                    GetNumber();

            }
            else
            {
                clsInput inp = new clsInput("message", "action", "Click", DateTime.Now, 1);
                //InputPool
                AddInput(inp);
                Record("<Button> Send Message");
                Fusion();
            }
        }
예제 #7
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
 private void button2_Click(object sender, EventArgs e)
 {
     Ringing();
     clsInput inp = new clsInput("incoming_call", "action", "Event", DateTime.Now, 1);
     AddInput(inp);
     Record("<Event> Incoming call");
     Fusion();
 }
예제 #8
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
        private void btnCall_Click(object sender, EventArgs e)
        {
            if (state == 31)
                response = "Yes";

            if (nb != "" && frame != null && frame.name == "call" && frame.isFilled())
            {
                //check teh number
                frame.slots.value = nb;
                state = 3;
            }

            if (frame != null && !frame.isFilled())
            {
                // try to get a number in the input pool
                //if (frame.name == "call" || frame.name == "message")
                //GetNumber();
            }
            else
            {
                clsInput inp = new clsInput("call", "action", "Click", DateTime.Now, 1);
                Record("<Button> Call");
                AddInput(inp);
                Fusion();
            }

            //when incoming call accept it
        }
예제 #9
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
 private void btnRead_Click(object sender, EventArgs e)
 {
     clsInput inp = new clsInput("read", "action", "Click", DateTime.Now, 1);
     //InputPool
     AddInput(inp);
     Record("<Button> Read message");
     Fusion();
 }
예제 #10
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
        private void AddInput(clsInput cur)
        {
            if (InputPool == null)
            {
                InputPool = cur;
            }
            else
            {
                clsInput temp = new clsInput();
                temp = InputPool;
                while (temp.next != null)
                {
                    temp = temp.next;
                }
                cur.next = null;
                temp.next = cur;
                temp = cur = null; //frees memory
            }

            ShowInput();
        }
예제 #11
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
        private void bntPairing_Click(object sender, EventArgs e)
        {
            clsInput inp = new clsInput("pairing", "action", "Click", DateTime.Now, 1);

            AddInput(inp);
            Record("<Button> Pairing");
            Fusion();
        }
예제 #12
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
        private void tmrSilence_Tick(object sender, EventArgs e)
        {
            //when a silence is detected try to see if the input pool has a number
            clsInput temp = new clsInput();
            temp = InputPool;
            //check if the last number is a digit

            if (frame != null && !frame.isFilled())
            {
                if (frame.name == "call" || frame.name == "add" || frame.name == "message")
                {

                    //parse input pool from the end and

                    nb = "";

                    while (temp != null)
                    {
                        clsSlot sl = new clsSlot();
                        sl = frame.slots;
                        if ("digit" == temp.GetPartOfSpeech())
                        {
                            nb += phone.GetDigit(temp.GetInfo());
                        }

                        temp = temp.next;
                    }
                    temp = null;

                    // check the number a perform the call
                    state = 11;

                    //this.Enabled = false;
                }

                if (frame.name == "add")
                {
                    if (!frame.isFilled())
                    {
                        if (frame.slots.next.value == "")
                        {
                            Tts("Please enter the phone number of your new contact");
                            //ASRGrammar("digits");
                            state = 13;
                            //check number
                        }
                        else
                        {
                            if (frame.slots.value == "")
                            {
                                Tts("Please enter the name of your new contact");

                            }
                        }
                    }
                    else
                    {
                        state = 3;
                    }
                }
            }
        }
예제 #13
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
 private void StopDialogue()
 {
     dialogue = false; // the dialogue is not completed yet
     InputPool = null; // clear it properly
     frame = null;
     lblFrame.Text = "";
     state = 0; // return to the idle state
 }
예제 #14
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
        private void SpeechRecognised(object sender, SpeechRecognizedEventArgs e)
        {
            if (acceptSpeech)
            {
                // can be done with XML grammar sgxml
                string[] words;

                Beep();

                //call number sms number ?

                // look for homophones, Result.Semantics

                //if (e.Result.Semantics != null)
                //{
                    if (e.Result.Text.Contains("double") || e.Result.Text.Contains("triple") || e.Result.Text.Contains("re dial"))
                    {
                        words = new string[] { "" };
                        words[0] = e.Result.Text;
                    }
                    else
                    {
                        words = e.Result.Text.Split(' ');
                    }

                    if (e.Result.Text.ToLower() == "repeat")
                        Tts(savedText);
                    //tmrSilence.Enabled = false;

                    if (e.Result.Text.ToLower() == "call" ||
                        e.Result.Text.ToLower() == "phone" ||
                        e.Result.Text.ToLower() == "dial")// nb.Length==10) //check also 10-digits
                    {
                        btnCall_Click(sender, e);
                    }

                    if (e.Result.Text.ToLower() == "send") //check also 10-digits
                    {
                        // btnSend_Click(sender, e);
                    }

                    Record(e.Result.Text);

                    if (e.Result.Semantics.ContainsKey("answer") && state == 31)
                    {
                        response = e.Result.Semantics["answer"].Value.ToString();
                    }

                    if (e.Result.Semantics.ContainsKey("Number"))
                    {
                        nb += e.Result.Semantics["Number"].Value.ToString();
                    }

                    if (e.Result.Semantics.ContainsKey("option") && state == 25)
                    {
                        selection = e.Result.Semantics["option"].Value.ToString();
                    }

                    if (e.Result.Semantics.ContainsKey("cmd") && e.Result.Semantics.ContainsKey("name"))
                    {
                        if (e.Result.Semantics["name"].Value.ToString() == "number")
                        {
                            //ask for the number in grounding()

                        }
                        semantic = "name";
                    }

                    if (e.Result.Semantics.ContainsKey("cmd"))
                    {
                        semantic = "action";
                    }/**/

                    foreach (string word in words)
                    {
                        clsInput inp = new clsInput(word, "", "Speech", DateTime.Now, e.Result.Confidence);

                        AddInput(inp);
                    }

                    if (e.Result.Semantics.ContainsKey("cancel"))
                    {
                        StopDialogue();
                        Tts("Cancelling...");
                        LoadGrammar("calltext.grxml");
                    }

                    else
                        Fusion();
                //}//Semantics

                // }  //call numbers
                // handling digits with adjectives

            //}
            //else
            //{
                //lvwDialogue.Items.Add("Not used...");
            }
        }
예제 #15
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
        /*
         * Any time a digit is detected, treat it apart (method)
         * enable the timer,
         * concatenate with the number till it react 10 digit/ make a beep
         * Cancel/Restart => reinitialise the number
         */
        public void GetNumber()
        {
            //parse input pool from the end and
            clsInput temp = new clsInput();
            temp = InputPool;

            nb = "";

            while (temp != null)
            {
                clsSlot sl = new clsSlot();
                sl = frame.slots;
                if ("digit" == temp.GetPartOfSpeech())
                {
                    nb += phone.GetDigit(temp.GetInfo());
                }

                temp = temp.next;
            }
            temp = null;

            ClearingDigits(); //remove all digit to avoid issues

            // check the number a perform the call
            state = 11;
        }
예제 #16
0
파일: frmCar.cs 프로젝트: ptchankue/mimi
        void RemoveInput(clsInput val)
        {
            clsInput temp = new clsInput();
            temp = InputPool;
            if (temp.next == null) temp = null;
            else

                while (temp.next != null)
                {
                    string info = temp.GetInfo(); DateTime time = temp.GetTime();
                    if ((info == val.GetInfo()) && (time == val.GetTime()))
                    {
                        temp = temp.next.next;
                        break;
                    }
                    else
                        temp = temp.next;
                }
        }