Changes to the gear intents
Signed-off-by: merspieler <merspieler@users.noreply.github.com>
This commit is contained in:
parent
8a2ca44ef0
commit
87f7a80b74
1 changed files with 49 additions and 9 deletions
58
__init__.py
58
__init__.py
|
@ -72,8 +72,7 @@ class FlightGearCopilotSkill(MycroftSkill):
|
|||
|
||||
profile = None
|
||||
|
||||
# TODO read acid to know which profile to use
|
||||
|
||||
# read acid to know which profile to use
|
||||
for i_profiles in self.settings['profiles']:
|
||||
for i_acid in i_profiles['acid']:
|
||||
if i_acid == acid:
|
||||
|
@ -137,16 +136,57 @@ class FlightGearCopilotSkill(MycroftSkill):
|
|||
# #
|
||||
#########################
|
||||
|
||||
@intent_handler(IntentBuilder('GearIntent').require('gear'))
|
||||
def handle_gear_intent(self, message):
|
||||
gear_request = message.data['utterance']
|
||||
if gear_request == "gear":
|
||||
self.speak_dialog("no.gear.action")
|
||||
@intent_handler(IntentBuilder('GearUpIntent').require('gearup'))
|
||||
def handle_gear_up_intent(self, message):
|
||||
|
||||
# TODO add connection to fg
|
||||
# TODO read acid from fg
|
||||
|
||||
# read acid to know which profile to use
|
||||
for i_profiles in self.settings['profiles']:
|
||||
for i_acid in i_profiles['acid']:
|
||||
if i_acid == acid:
|
||||
profile = i_profiles
|
||||
break
|
||||
if profile != None:
|
||||
break
|
||||
|
||||
if profile == None:
|
||||
# TODO when creation of profiles via voice is possible, add dialog how to
|
||||
self.speak("Profile not found")
|
||||
sys.exit(0)
|
||||
|
||||
match = re.match(r'.*gear.* (up|down|) +.*|.*(retract|extend) .*gear.*', gear_request, re.i)
|
||||
if profile['gear-retractable'] == true:
|
||||
# TODO set gear up in fg
|
||||
self.speak("Gear up")
|
||||
else:
|
||||
self.speak_dialog("gear.not.retractable")
|
||||
|
||||
self.speak("Gear " + str(gear_request))
|
||||
@intent_handler(IntentBuilder('GearDownIntent').require('geardown'))
|
||||
def handle_gear_down_intent(self, message):
|
||||
|
||||
# TODO add connection to fg
|
||||
# TODO read acid from fg
|
||||
|
||||
# read acid to know which profile to use
|
||||
for i_profiles in self.settings['profiles']:
|
||||
for i_acid in i_profiles['acid']:
|
||||
if i_acid == acid:
|
||||
profile = i_profiles
|
||||
break
|
||||
if profile != None:
|
||||
break
|
||||
|
||||
if profile == None:
|
||||
# TODO when creation of profiles via voice is possible, add dialog how to
|
||||
self.speak("Profile not found")
|
||||
sys.exit(0)
|
||||
|
||||
if profile['gear-retractable'] == true:
|
||||
# TODO set gear down in fg
|
||||
self.speak("Gear down")
|
||||
else:
|
||||
self.speak_dialog("gear.not.retractable")
|
||||
|
||||
def stop(self):
|
||||
pass
|
||||
|
|
Loading…
Add table
Reference in a new issue