Exemplo n.º 1
0
        public override void RunInterface(string pluginName)
        {
            gAppName = pluginName;
            Log      = new General.OSAELog(gAppName);

            try
            {
                gDebug = Convert.ToBoolean(OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "Debug").Value);
            }
            catch
            { Log.Info("The JABBER Object Type seems to be missing the Debug Property!"); }
            Log.Info("Debug Mode Set to " + gDebug);

            OwnTypes();

            OSAE.OSAEObject tempAlias = OSAE.OSAEObjectManager.GetObjectByName(gSystemName);
            if (tempAlias.Alias.Length > 0)
            {
                gSystemName = tempAlias.Alias;
            }

            try
            {
                oRecognizer.SpeechRecognized += new EventHandler <SpeechRecognizedEventArgs>(oRecognizer_SpeechRecognized);
                //oRecognizer.AudioStateChanged += new EventHandler<AudioStateChangedEventArgs>(oRecognizer_StateChanged);
            }
            catch (Exception ex)
            { Log.Error("Unable to configure oRecognizer", ex); }

            oRecognizer = OSAEGrammar.Load_Direct_Grammar(oRecognizer);
            Log.Info("Load_Direct_Grammar completed");
            oRecognizer = OSAEGrammar.Load_Voice_Grammars(oRecognizer);
            Log.Info("Load_Voice_Grammars completed");
            oRecognizer = OSAEGrammar.Load_Text_Only_Grammars(oRecognizer);
            Log.Info("Load_Text_Only_Grammars completed");
            // Subscribe to Events
            xmppCon.OnLogin       += new ObjectHandler(xmppCon_OnLogin);
            xmppCon.OnRosterStart += new ObjectHandler(xmppCon_OnRosterStart);
            xmppCon.OnRosterEnd   += new ObjectHandler(xmppCon_OnRosterEnd);
            xmppCon.OnRosterItem  += new XmppClientConnection.RosterHandler(xmppCon_OnRosterItem);
            xmppCon.OnPresence    += new agsXMPP.protocol.client.PresenceHandler(xmppCon_OnPresence);
            xmppCon.OnAuthError   += new XmppElementHandler(xmppCon_OnAuthError);
            xmppCon.OnError       += new ErrorHandler(xmppCon_OnError);
            xmppCon.OnClose       += new ObjectHandler(xmppCon_OnClose);
            xmppCon.OnMessage     += new agsXMPP.protocol.client.MessageHandler(xmppCon_OnMessage);

            connect();
        }
Exemplo n.º 2
0
        public void Question_Answered(string answer)
        {
            oRecognizer.UnloadAllGrammars();
            oRecognizer = OSAEGrammar.Load_Direct_Grammar(oRecognizer);
            Log.Info("Load_Direct_Grammar completed");
            oRecognizer = OSAEGrammar.Load_Voice_Grammars(oRecognizer);
            Log.Info("Load_Voice_Grammars completed");
            oRecognizer = OSAEGrammar.Load_Text_Only_Grammars(oRecognizer);
            Log.Info("Load_Text_Only_Grammars completed");

            sendMessage(gCurrentUser, Common.PatternParse("Setting " + gAnswerObject + "'s " + gAnswerProperty + " to " + answer), gCurrentAddress);

            Log.Info(Common.PatternParse("Setting " + gAnswerObject + "'s " + gAnswerProperty + " to " + answer));
            OSAEObjectPropertyManager.ObjectPropertySet(gAnswerObject, gAnswerProperty, answer, gCurrentUser);
            //Trust is enforced in the storedProc, but maybe it can be checked here for better replies.
            gAnswerObject   = "";
            gAnswerProperty = "";
        }