Beispiel #1
0
    def getskills(self, intent, text, tok):

        if intent == 'clock':
            clock.start(tok)
        elif intent == 'camera':
            camera.start(tok)
        elif intent == 'smarthome':
            smarthome.start(tok)
        elif intent == 'weather':
            weather.start(tok)
        elif intent == 'music':
            music.start(tok)
        elif intent == 'mail':
            mail.start(tok)
        elif intent == 'joke':
            joke.start(tok)
        elif intent == 'news':
            news.start(tok)
        elif intent == 'tuling':
            tuling.start(text, tok)
        elif intent == 'snowboytrain':
            snowboytrain.start(tok)
        elif intent == 'raspberrypi-gpio':
            raspberrypigpio.start(tok)
        elif intent == 'respeaker':
            speaker.speak()
        elif intent == 'no':
            sconvenstation()
        elif intent == 'reintent':
            intent = nlp.do_intent(text, tok)
            s.getskills(intent, text, tok)
Beispiel #2
0
    def getskills(self, intent, text, tok):

        s = skills()
        m = xlMusic()
        if intent == 'clock':
            clock.start(tok)
        elif intent == 'camera':
            camera.start(tok)
        elif intent == 'smarthome':
            smarthome.start(tok)
        elif intent == 'weather':
            weather.start(tok)
        elif intent == 'music':
            m.start(tok)
        elif intent == 'translate':
            ts.start(tok)
        elif intent == 'email':
            mail.start(tok)
        elif intent == 'joke':
            joke.start(tok)
        elif intent == 'news':
            news.start(tok)
        elif intent == 'express':
            express.start(tok)
        elif intent == 'reintent':
            nlu.do_intent(text, tok)
        elif intent == 'no':
            speaker.speacilrecorder()
        else:
            nlu.do_intent(text, tok)
Beispiel #3
0
 def __init__(self):
     # ----------------------
     # Simulation Start Time
     # ----------------------
     clock.start(self)
     
     #--------------------------------------
     # Read the Control File for Simulation
     #--------------------------------------
     self.Control_file     = sys.argv[1]
     
     ########################################################################
     # Execute the script
     ########################################################################
     self.run_atm()
Beispiel #4
0
 def __init__(self):
     # ----------------------
     # Simulation Start Time
     # ----------------------
     clock.start(self)
     
     #--------------------------------------
     # Read the Control File for Simulation
     #--------------------------------------
     self.Control_file     = sys.argv[1]
     
     ########################################################################
     # Execute the script
     ########################################################################
     self.run_attm()
Beispiel #5
0
def start(pwm_no):
    '''Starts a PWM peripheral.
    Also starts the clock that drives the PWM.
    @param pwm_no: the identifier of the PWM (0 or 1)
    '''
    
    if pwm_no == 0:
        regs.PWMCTL |= 0x01

    elif pwm_no == 1:
        regs.PWMCTL |= 0x100

    else:
        raise Exception('Invalid PWM number')

    # make sure the clock is started as well    
    clock.start('pwm')
Beispiel #6
0
    def __init__(self):

        self.skillsdef = {
                'weather': ['weather', weather.start()],
                'clock': ['clock', clock.start()],
                'joke': ['joke', joke.start()],
                'smarthome': ['smarthome', self.sm.main()],
                'news': ['news', news.start()]
Beispiel #7
0
class skills(Xiaolan):

    def __init__(self):

        self.skillsdef = {
                'weather': weather.start(),
                'clock': clock.start(),
                'joke': joke.start(),
                'smarthome': self.sm.main(),
                'news': news.start()
        }
Beispiel #8
0
 def clock(self, tok):
     clock.start(tok)
Beispiel #9
0
def do_intent(text, tok):

    sm = hass()
    m = xlMusic()
    services = {
        'musicurl_get': 'method=baidu.ting.song.play&songid=',
        'search': 'method=baidu.ting.search.catalogSug&query=',
        'hot':
        'method=baidu.ting.song.getRecommandSongList&song_id=877578&num=12'
    }

    if text != None:
        if '闹钟' in text:
            clock.start(tok)
        elif '打开' in text:
            sm.cortol('turn_on', text[6:-1], tok)
        elif '关闭' in text:
            sm.cortol('turn_off', text[6:-1], tok)
        elif '获取' in text:
            if '传感器' in text or '温度' in text:
                sm.sensor('sensor', text[6:-1], tok)
            elif '湿度' in text:
                sm.sensor('sensor', text[6:-1], tok)
            else:
                sm.sensor('switch', text[6:-1], tok)
        elif '天气' in text:
            weather.main(tok)
        elif '重新说' in text or '重复' in text:
            speaker.speak()
        elif '翻译' in text:
            ts.main(tok)
        elif '搜索' in text:
            tuling.main(text, tok)
        elif '闲聊' in text:
            tuling.main(text, tok)
        elif '怎么走' in text:
            maps.start(tok)
        elif '酒店' in text:
            tuling.main(text, tok)
        elif '旅游' in text:
            tuling.main(text, tok)
        elif '新闻' in text:
            news.start(tok)
        elif '拍照' in text:
            camera.start(tok)
        elif '邮件' in text or '邮件助手' in text:
            mail.start(tok)
        elif '快递' in text:
            express.start(tok)
        elif '笑话' in text:
            joke.main(tok)
        elif '训练' in text:
            snowboytrain.start(tok)
        elif '播放' in text:
            if '音乐' in text:
                m.sui_ji(services, tok)
            else:
                songname = text[2:-1]
                m.sou_suo(services, songname, tok)
        elif '我想听' in text:
            if '音乐' in text:
                m.sui_ji(services, tok)
            else:
                songname = text[3:-1]
                m.sou_suo(services, songname, tok)
        else:
            tuling.start(text, tok)
    else:
        speaker.speacilrecorder()