public bool OnSpeechRecognised(string ID, RecognitionSuccess result) { string matched = ""; string cmd = ""; if (result.getSemanticValuesAsString("command")!=null) cmd = result.getSemanticValuesAsString("command"); if (cmd == "turn off alarm") { if (lastAlarm == null) return false; lock (timers) { if (timers.ContainsKey(lastAlarm)) { timers[lastAlarm].Item1.Dispose(); timers.Remove(lastAlarm); matched = lastAlarm; lastAlarm = null; } } } if (matched != "") { OnControllableEvent(this, new IControllableEventArgs(matched, "removed")); return true; } return false; }
public bool OnSpeechRecognised(string ID, RecognitionSuccess result) { string room = ""; if (result.getSemanticValuesAsString("room") != null) room = result.getSemanticValuesAsString("room"); string item = ""; if (result.getSemanticValuesAsString("item") != null) item = result.getSemanticValuesAsString("item"); string action = ""; if (result.getSemanticValuesAsString("action") != null) action = result.getSemanticValuesAsString("action"); Command c = new Command(room, item, action, this); Form1.server.protos.Execute(c); return true; }
public bool OnSpeechRecognised(string ID, RecognitionSuccess result) { //ID: source of the audio. Normally IPaddress:port string cmd = ""; if (result.getSemanticValuesAsString("command") != null) cmd = result.getSemanticValuesAsString("command"); if (cmd == "play show" || cmd == "resume show") { int tvshowid = result.getSemanticValueAsInt("tvshowid"); int episode = result.getSemanticValueAsInt("episodeval"); int season = result.getSemanticValueAsInt("seasonval"); if (tvshowid != -1 && episode != -1 && season != -1) { OnControllableEvent(this, new XBMCEventArgs(ID, cmd, tvshowid, season, episode)); return true; } } else if (cmd == "play movie" || cmd == "resume movie") { int movieid = result.getSemanticValueAsInt("movieid"); if (movieid != -1) { OnControllableEvent(this, new XBMCEventArgs(ID, cmd, movieid, 0, 0)); return true; } } else if (cmd == "stop media" || cmd == "pause media" || cmd == "resume media") { OnControllableEvent(this, new XBMCEventArgs(ID, cmd, 0, 0, 0)); return true; } else if (cmd == "play me some") { //genre music int genreid = result.getSemanticValueAsInt("genreid"); if (genreid != -1) { OnControllableEvent(this, new XBMCEventArgs(ID, cmd, genreid, 0, 0)); return true; } } return false; }