public override void ProcessCommand(OSAEMethod method) { try { //basically just need to send parameter two to the contact in parameter one with sendMessage(); //Process incomming command string to = ""; if (gDebug) { Log.Debug("Process command: " + method.MethodName); } if (gDebug) { Log.Debug("Message: " + method.Parameter2); } OSAEObjectProperty prop = OSAEObjectPropertyManager.GetObjectPropertyValue(method.Parameter1, "JabberID"); if (prop != null) { to = prop.Value; } else { to = method.Parameter1; } if (to == "") { to = method.Parameter1; } if (gDebug) { Log.Debug("To: " + to); } switch (method.MethodName) { case "SEND MESSAGE": sendMessage(Common.PatternParse(method.Parameter2), to); break; case "SEND QUESTION": Ask_Question(to); break; case "SEND FROM LIST": string speechList = method.Parameter2.Substring(0, method.Parameter2.IndexOf(",")); string listItem = method.Parameter2.Substring(method.Parameter2.IndexOf(",") + 1, method.Parameter2.Length - (method.Parameter2.IndexOf(",") + 1)); if (gDebug) { Log.Debug("List = " + speechList + " Item=" + listItem); } sendMessage(Common.PatternParse(OSAEObjectPropertyManager.ObjectPropertyArrayGetRandom(speechList, listItem)), to); break; } } catch (Exception ex) { Log.Error("Error in ProcessCommand!", ex); } }
public override void ProcessCommand(OSAEMethod method) { try { //basically just need to send parameter two to the contact in parameter one with sendMessage(); //Process incomming command string to = ""; if (gDebug) { Log.Debug("Process command: " + method.MethodName); } if (gDebug) { Log.Debug("Message: " + method.Parameter2); } OSAEObjectProperty prop = OSAEObjectPropertyManager.GetObjectPropertyValue(method.Parameter1, "JabberID"); if (prop != null) { to = prop.Value; } else { to = method.Parameter1; } if (to == "") { to = method.Parameter1; } if (gDebug) { Log.Debug("To: " + to); } switch (method.MethodName) { case "SEND MESSAGE": sendMessage(Common.PatternParse(method.Parameter2), to); break; case "SEND FROM LIST": //Speech List here should not be hard coded, but I understand we only have 2 parameters to work with... sendMessage(Common.PatternParse(OSAEObjectPropertyManager.ObjectPropertyArrayGetRandom("Speech List", method.Parameter2)), to); break; } } catch (Exception ex) { Log.Error("Error processing command ", ex); } }
public override void ProcessCommand(OSAEMethod method) { try { //basically just need to send parameter two to the contact in parameter one with sendMessage(); //Process incomming command string to = ""; logging.AddToLog("Process command: " + method.MethodName, false); logging.AddToLog("Message: " + method.Parameter2, false); logging.AddToLog("To: " + method.Parameter1, false); OSAEObjectProperty prop = OSAEObjectPropertyManager.GetObjectPropertyValue(method.Parameter1, "JabberID"); if (prop != null) { to = prop.Value; } if (to == "") { to = method.Parameter1; } else { to = method.Parameter1; } if (to == "") { to = method.Parameter1; } switch (method.MethodName) { case "SEND MESSAGE": sendMessage(Common.PatternParse(method.Parameter2), to); break; case "SEND FROM LIST": sendMessage(Common.PatternParse(OSAEObjectPropertyManager.ObjectPropertyArrayGetRandom("Speech List", method.Parameter2)), to); break; } } catch (Exception ex) { logging.AddToLog("Error processing command: " + ex.Message, true); } }
public override void ProcessCommand(OSAEMethod method) { string sMethod = method.MethodName; string sParam1 = method.Parameter1; string sParam2 = method.Parameter2; logging.AddToLog("Received Command to: " + sMethod + " (" + sParam1 + ", " + sParam2 + ")", true); if (sMethod == "SPEAK") { string sText = Common.PatternParse(sParam1); oSpeech.Speak(sText); logging.AddToLog("Said " + sText, true); } else if (sMethod == "SPEAKFROM") { logging.AddToLog("--Speak From Object: " + sParam1 + " and pick From list: " + sParam2, true); string sText = OSAEObjectPropertyManager.ObjectPropertyArrayGetRandom(sParam1, sParam2).ToString(); sText = Common.PatternParse(sText); oSpeech.Speak(sText); logging.AddToLog("Said " + sText, true); } else if (sMethod == "PLAY") { wmPlayer.URL = sParam1; wmPlayer.controls.play(); logging.AddToLog("Played " + sParam1, true); } else if (sMethod == "PLAYFROM") { string sFile = OSAEObjectPropertyManager.ObjectPropertyArrayGetRandom(sParam1, sParam2).ToString(); wmPlayer.URL = sFile; wmPlayer.controls.play(); logging.AddToLog("Played " + sFile, true); } else if (sMethod == "STOP") { wmPlayer.controls.stop(); logging.AddToLog("Stopped", true); } else if (sMethod == "PAUSE") { wmPlayer.controls.pause(); logging.AddToLog("Paused", true); } else if (sMethod == "SETVOICE") { gSelectedVoice = sParam1; oSpeech.SelectVoice(gSelectedVoice); logging.AddToLog("Voice Set to " + gSelectedVoice, true); } else if (sMethod == "SETTTSVOLUME") { if (Convert.ToInt16(sParam1) > 0 && Convert.ToInt16(sParam1) <= 100) { oSpeech.Volume = Convert.ToInt16(sParam1); OSAEObjectPropertyManager.ObjectPropertySet(gAppName, "TTS Volume", sParam1, "SPEECH"); logging.AddToLog("TTS Volume Set to " + Convert.ToInt16(sParam1), true); } } else if (sMethod == "SETTTSRATE") { if (Convert.ToInt16(sParam1) > -11 && Convert.ToInt16(sParam1) < 11) { oSpeech.Rate = Convert.ToInt16(sParam1); OSAEObjectPropertyManager.ObjectPropertySet(gAppName, "TTS Rate", sParam1, "SPEECH"); logging.AddToLog("TTS Rate Set to " + Convert.ToInt16(sParam1), true); } } }
public override void ProcessCommand(OSAEMethod method) { string sMethod = method.MethodName; string sParam1 = method.Parameter1; string sParam2 = method.Parameter2; this.Log.Info("Received Command to: " + sMethod + " (" + sParam1 + ", " + sParam2 + ")"); if (sMethod == "SPEAK") { string sText = Common.PatternParse(sParam1); OSAEObjectPropertyManager.ObjectPropertySet(gAppName, "Speaking", "TRUE", gAppName); oSpeech.Speak(sText); this.Log.Info("Said " + sText); OSAEObjectPropertyManager.ObjectPropertySet(gAppName, "Speaking", "FALSE", gAppName); } else if (sMethod == "SPEAKFROM") { this.Log.Info("--Speak From Object: " + sParam1 + " and pick From list: " + sParam2); string sText = OSAEObjectPropertyManager.ObjectPropertyArrayGetRandom(sParam1, sParam2).ToString(); sText = Common.PatternParse(sText); OSAEObjectPropertyManager.ObjectPropertySet(gAppName, "Speaking", "TRUE", gAppName); oSpeech.Speak(sText); OSAEObjectPropertyManager.ObjectPropertySet(gAppName, "Speaking", "FALSE", gAppName); this.Log.Info("Said " + sText); } else if (sMethod == "PLAY") { wmPlayer.URL = sParam1; wmPlayer.controls.play(); this.Log.Info("Played " + sParam1); } else if (sMethod == "PLAYFROM") { string sFile = OSAEObjectPropertyManager.ObjectPropertyArrayGetRandom(sParam1, sParam2).ToString(); wmPlayer.URL = sFile; wmPlayer.controls.play(); this.Log.Info("Played " + sFile); } else if (sMethod == "STOP") { wmPlayer.controls.stop(); this.Log.Info("Stopped"); } else if (sMethod == "PAUSE") { wmPlayer.controls.pause(); this.Log.Info("Paused"); } else if (sMethod == "SETVOICE") { gSelectedVoice = sParam1; oSpeech.SelectVoice(gSelectedVoice); this.Log.Info("Voice Set to " + gSelectedVoice); } else if (sMethod == "SETTTSVOLUME") { if (Convert.ToInt16(sParam1) > 0 && Convert.ToInt16(sParam1) <= 100) { oSpeech.Volume = Convert.ToInt16(sParam1); OSAEObjectPropertyManager.ObjectPropertySet(gAppName, "TTS Volume", sParam1, "SPEECH"); this.Log.Info("TTS Volume Set to " + Convert.ToInt16(sParam1)); } } else if (sMethod == "SETTTSRATE") { // Load the speech rate, which must be -10 to 10, and set it to 0 if it is not valid. Int16 iTTSRate = Convert.ToInt16(sParam1); if (iTTSRate < -10 || iTTSRate > 10) { iTTSRate = 0; this.Log.Info("TTS Rate was invalid! I changed it to " + iTTSRate.ToString()); } OSAEObjectPropertyManager.ObjectPropertySet(gAppName, "TTS Rate", iTTSRate.ToString(), gAppName); this.Log.Info("TTS Rate Set to " + iTTSRate.ToString()); oSpeech.Rate = iTTSRate; } }
public override void ProcessCommand(OSAEMethod method) { //Process incomming command this.Log.Debug("Process command: " + method.MethodName); this.Log.Debug("Process parameter1: " + method.Parameter1); this.Log.Debug("Process parameter2: " + method.Parameter2); this.Log.Debug("Address: " + method.Address); switch (method.MethodName) { case "PLAY": if (method.Parameter1.Trim() == string.Empty) { sbs.Play(method.Address); } else { sbs.PlaylistPlay(method.Address, method.Parameter1); } OSAEObjectStateManager.ObjectStateSet(OSAEObjectManager.GetObjectByAddress(method.Address).Name, "PLAYING", pName); break; case "STOP": sbs.StopPlayer(method.Address); OSAEObjectStateManager.ObjectStateSet(OSAEObjectManager.GetObjectByAddress(method.Address).Name, "STOPPED", pName); break; case "NEXT": sbs.Next(method.Address); break; case "PREV": sbs.Previous(method.Address); break; case "SHOW": sbs.ShowMessage(method.Address, method.Parameter1, Int32.Parse(method.Parameter2)); break; case "PAUSE": sbs.PausePlayer(method.Address); OSAEObjectStateManager.ObjectStateSet(OSAEObjectManager.GetObjectByAddress(method.Address).Name, "PAUSED", pName); break; case "TTS": TextToSpeech(method.Parameter1); sbs.PlaylistPlay(method.Address, ttsPlay); break; case "TTSLIST": DataSet list = OSAEObjectPropertyManager.ObjectPropertyArrayGetAll(method.Parameter1, method.Parameter2); string tts = ""; int count = 1; foreach (DataRow item in list.Tables[0].Rows) { tts += " RSS item number " + count.ToString() + ". " + item["item_name"].ToString(); count++; } TextToSpeech(tts); sbs.PlaylistPlay(method.Address, ttsPlay); break; case "TTSLISTRAND": string listItem = OSAEObjectPropertyManager.ObjectPropertyArrayGetRandom(method.Parameter1, method.Parameter2); TextToSpeech(listItem); sbs.PlaylistPlay(method.Address, ttsPlay); break; } }