Esempio n. 1
0
def skill_inital(set_id,lan,music_choice,main_music,bmp_name,clisten_file):
    C4_Def_Gpio.Write_Iris_LED(2)
    C1_Def_File.clear_cyberon()
    C5_Def_Program.play_music(music_choice,lan,main_music) 
    C1_Def_File.bmp_file_set(bmp_name)
    C5_Def_Program.strat_cyberon(lan,1,clisten_file)
    C4_Def_Gpio.Write_Iris_LED(1) 
Esempio n. 2
0
def Center_need_to_answer(value):
    need_brocast ,stat_rand_time ,end_rand_time,value =  D2_Iris_talk.which_one_i_need_answer(value)
    talk = Center_need_to_rand_init(stat_rand_time,end_rand_time)
    Center_need_to_play_file('/tmp/file/answer.mp3')
    C1_Def_File.choice_file_set('//tmp/file/answer', '00000')
    
    if need_brocast == 1 :
        Center_need_to_unicast(value)
        
    return talk   
Esempio n. 3
0
def main_cspotter_check(lan):
    State_led_check = C4_Def_Gpio.Check_State_One_LED()
    f = C1_Def_File.cyberon_get()
    if f == "Go Iris" or f == "Iris":
        #C8_Def_Skill.Center_need_to_kill_cyberon_cspoter()
        C1_Def_File.clear_cyberon_cspotter()
        angle = C1_Def_File.angle_get()
        return 2 , angle
        
    elif State_led_check==1:
        C4_Def_Gpio.Write_State_One_LED(0)
        angle = 720
        return 2 , angle
    angle = 0
    return 0 , angle
Esempio n. 4
0
def call_group_iris_check(stream_state_busy):
    stream_state = C1_Def_File.Get_stream_state()
    if stream_state != '0':
    
        if stream_state == '1':
            #print '***********party mode on now***************'
            C5_Def_Program.party_mode_on()
            stream_state_busy = 1
        if stream_state == '2':
            #print '***********party mode off now***************'
            C5_Def_Program.party_mode_off()
            stream_state_busy = 0
        if stream_state == '3':
            #print '***********AnnouncementModeOn now***************'
            C5_Def_Program.Announcement_Mode_On()
            stream_state_busy = 2
        if stream_state == '4':
            #print '***********AnnouncementModeOff now***************'
            C5_Def_Program.Announcement_Mode_Off()
            stream_state_busy = 0
        if stream_state == '5':
            #print '***********ktv on now***************'
            C5_Def_Program.Ktv_on()
            stream_state_busy = 0
        if stream_state == '6':
            #print '***********ktv off now***************'
            C5_Def_Program.Ktv_off()
            stream_state_busy = 0
            
    return stream_state_busy  
Esempio n. 5
0
def strat_cyberon(lan, main, sub):
    #subprocess.Popen('/usr/bin/CSpotterDemo_x86 /usr/bin/Trigger.bin', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    file = C1_Def_File.cyberon_file(lan, main, sub)
    if main == 0:
        #subprocess.Popen('/usr/bin/CSpotterDemo_x86 /usr/bin/Trigger.bin', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
        subprocess.Popen(['/usr/bin/CSpotterDemo_x86', file])
    else:
        subprocess.Popen(['/usr/bin/CListenerDemo_x86', lan, file, '0'])
Esempio n. 6
0
def Center_need_to_find_iris(line,lan):
    tmp_line = line
    line = C1_Def_File.choice_file_length('/tmp/file/search_iris')
    if tmp_line != line:
        C5_Def_Program.party_mode_pause(1)
        C5_Def_Program.play_music(21,lan,2)
        C5_Def_Program.party_mode_pause_then_start(1)
    return line
Esempio n. 7
0
def radio_play(radio_now ,lan):    
    C5_Def_Program.kill_play_stream()
    command = "'" + mp3_site[radio_now] + "'"
    #print ("command=",command)
    r = C5_Def_Program.play_music_url(command)
    r = C5_Def_Program.selete_avoid_stop(r,10)#r=return command , %d=time_out
    #print r
    if r == 1:
        C5_Def_Program.play_music(31,lan,2)
        C5_Def_Program.kill_play_stream()
        play = 1
        return play
    else :
        C1_Def_File.bmp_file_set('playing')
        bmp_word = 'playing'
        play = 0
        return play
Esempio n. 8
0
def Announcement_Mode_Off():
    command = "killall -9 wget aplay"
    volume = C1_Def_File.get_iris_conf('volume_set')
    control_volume(volume)
    subprocess.Popen(command,
                     shell=True,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.STDOUT).wait()
    file_reset()
Esempio n. 9
0
def Announcement_Mode_On():
    time.sleep(1)
    stream_ip = C1_Def_File.Get_stream_ip()
    volume = 3
    control_volume(volume)
    command = "wget -q -O - http://" + stream_ip + ":8090/test1.wav | aplay&"
    subprocess.Popen(command,
                     shell=True,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.STDOUT).wait()
    file_reset()
Esempio n. 10
0
def party_mode_on():
    time.sleep(1)
    stream_ip = C1_Def_File.Get_stream_ip()

    command = "killall -9 snapclient_AIR"
    subprocess.Popen(command,
                     shell=True,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.STDOUT).wait()

    #####TMP##########
    command = 'amixer -c0 cset name="Channel Control" "1"'
    subprocess.Popen(command,
                     shell=True,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.STDOUT).wait()
    #####TMP##########

    command = "snapclient_AIR -d -h " + stream_ip
    subprocess.Popen(command,
                     shell=True,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.STDOUT).wait()
    file_reset()
Esempio n. 11
0
def answer_check():
    return C1_Def_File.choice_file_get('/tmp/file/answer')
Esempio n. 12
0
def check_voip_state():
    return C1_Def_File.Get_voip_state()
Esempio n. 13
0
def Center_need_to_voip(lan ,voip_now): 
    subcount = 101 ;
    
    C5_Def_Program.kill_cyberon_clistener_loop()
    C5_Def_Program.strat_cyberon_loop(lan,1,6)
    C1_Def_File.clear_cyberon()
    while True:
        f = C1_Def_File.cyberon_get()    
        State_led_check = C4_Def_Gpio.Check_State_One_LED()
        voip_talk_check = open('/tmp/file/sound_busy_check', 'r').read().strip()
        set_id = C7_1_Def_Talk_list.iris_mapping(lan,'voip' ,'720')  
        '''
        if f == "Go Iris" or f == "Iris" :
        
            volume = 10
            C5_Def_Program.control_volume(volume)  
            
            C5_Def_Program.kill_cyberon_cspotter()
            C1_Def_File.bmp_file_set('listen')
            C1_Def_File.clear_cyberon_cspotter()
            C5_Def_Program.strat_cyberon_loop(lan,1,6)
            C4_Def_Gpio.Write_Iris_LED(1)
            subcount = 0
            
        elif subcount == 101:
            volume = C1_Def_File.get_iris_conf('volume_set')
            if int(volume)>0 and int(volume) < 10:
                C5_Def_Program.control_volume(volume)  
                
            #C5_Def_Program.kill_cyberon_clistener() 
            C5_Def_Program.kill_cyberon_clistener_loop()
            C1_Def_File.clear_cyberon()
            C1_Def_File.music_start() 
            C4_Def_Gpio.Write_Iris_LED(0)
            C1_Def_File.bmp_file_set('voip')
            C5_Def_Program.strat_cyberon(lan,0,0)
            subcount = 101
        '''
        if set_id == 1 and voip_now == 0 and voip_talk_check == '4':
            C5_Def_Program.kill_cyberon_clistener_loop()
            C5_Def_Program.start_program('killall -9 madplay aplay')
            C5_Def_Program.start_program('echo a | telnet localhost 5555')
            volume = C1_Def_File.get_iris_conf('volume_set')
            C5_Def_Program.control_volume(volume)  
            voip_now = 1
        
        elif State_led_check == 1 or voip_talk_check=='9' or set_id == 0:
            C5_Def_Program.kill_cyberon_clistener_loop()
            #C5_Def_Program.kill_cyberon_cspotter()
            C5_Def_Program.start_program('killall -9 madplay aplay')
            C5_Def_Program.start_program('echo b | telnet localhost 5555')
            volume = C1_Def_File.get_iris_conf('volume_set')
            C5_Def_Program.control_volume(volume)  
            C4_Def_Gpio.Write_Voip(0)
            time.sleep(1)            
            C5_Def_Program.play_music(10,lan,1) 
            C5_Def_Program.kill_cyberon_clistener() 
            break

        subcount = subcount + 1   
        time.sleep(0.1)   
        
    C1_Def_File.clear_cyberon()    
    C5_Def_Program.kill_cyberon_clistener_loop()
Esempio n. 14
0
def kill_cyberon_clistener_loop():
    subprocess.Popen('killall -9 CListenerDemo_loop',
                     shell=True,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.STDOUT).wait()
    C1_Def_File.clear_cyberon()
Esempio n. 15
0
def party_mode_pause_then_start(value):
    time.sleep(value)
    C1_Def_File.music_start()
Esempio n. 16
0
def kill_cyberon_cspotter():
    subprocess.Popen('killall -9 CSpotterDemo_x86',
                     shell=True,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.STDOUT).wait()
    C1_Def_File.clear_cyberon()
Esempio n. 17
0
def party_mode_pause(value):
    C1_Def_File.music_pause()
    time.sleep(value)
Esempio n. 18
0
def radio_choice(radio_tmp, len_mp3 , lan , play ,subcount , bmp_word ,set_id):
    try: 
        radio_now=int(C1_Def_File.get_iris_conf('radio3')) 
    except Exception as exc:
        radio_now=1
    if radio_tmp== 999:
        radio_tmp = radio_now
        radio_play(radio_now-1 ,lan)
        
    if set_id < 999: 
        C4_Def_Gpio.Write_Iris_LED(2)
        subcount = 100
        #play
        if set_id == 6 and play ==1:
            radio_tmp = radio_now
            radio_play(radio_now-1 ,lan)
            play=0 
            
        #pause
        elif set_id == 7 and play==0:
            C1_Def_File.bmp_file_set('pause')
            bmp_word = 'pause'
            C5_Def_Program.kill_play_stream() 
            play=1
            
        #volume up down
        elif set_id == 9:
            volume = C1_Def_File.get_iris_conf('volume_set')
            if int(volume)>0 and int(volume) <= 10 :
                volume = int(volume) - 1
                C1_Def_File.bmp_file_set('volume%i'%(volume))
                C1_Def_File.set_iris_conf('volume_set',volume)
                C5_Def_Program.control_volume(volume) 
                bmp_word = C1_Def_File.bmp_file_get()
                
        elif set_id == 10:
            #C5_Def_Program.play_music(27,lan,2)     
            volume = C1_Def_File.get_iris_conf('volume_set')
            if int(volume)>=0 and int(volume) < 10 :
                volume = int(volume) + 1
                C1_Def_File.bmp_file_set('volume%i'%(volume))
                C1_Def_File.set_iris_conf('volume_set',volume)
                C5_Def_Program.control_volume(volume) 
                bmp_word = C1_Def_File.bmp_file_get()
                C1_Def_File.bmp_file_set(bmp_word)                
                
        #volume lowest      
        elif set_id == 17:
            #C5_Def_Program.play_music(27,lan,2)     
            volume = C1_Def_File.get_iris_conf('volume_set')
            if int(volume)>=0 and int(volume) < 10 :
                volume = 10
                C1_Def_File.bmp_file_set('volume%i'%(volume))
                C1_Def_File.set_iris_conf('volume_set',volume)
                C5_Def_Program.control_volume(volume)  
                time.sleep(1)
                bmp_word = C1_Def_File.bmp_file_get()
                C1_Def_File.bmp_file_set(bmp_word)
                
        #next        
        elif set_id == 11 and radio_now < len_mp3 :
            C1_Def_File.bmp_file_set('processing')
            bmp_word = 'processing'             
            radio_now += 1
        #back    
        elif set_id == 8 and radio_now > 1:
            C1_Def_File.bmp_file_set('processing')
            bmp_word = 'processing'   
            radio_now -= 1
            
        elif set_id == 13 and radio_now < len_mp3 :
            C5_Def_Program.kill_play_stream() 
            C1_Def_File.set_iris_conf('radio1','212.')
            C1_Def_File.set_iris_conf('radio2','218.')
            play=3
            
        elif set_id == 14 and radio_now < len_mp3 :
            C5_Def_Program.kill_play_stream()    
            C1_Def_File.set_iris_conf('radio1','220.')
            C1_Def_File.set_iris_conf('radio2','230.')
            play=3
           
        elif set_id == 15 and radio_now < len_mp3 :
            C5_Def_Program.kill_play_stream()     
            C1_Def_File.set_iris_conf('radio1','163.')
            C1_Def_File.set_iris_conf('radio2','170.')
            play=3
            
        if radio_now != radio_tmp:
            radio_tmp = radio_now
            play=radio_play(radio_now-1 ,lan)
            C1_Def_File.set_iris_conf('radio3',radio_now)
                
        C1_Def_File.clear_cyberon()
        
    subcount += 1
    return radio_tmp , play  , subcount , bmp_word 
Esempio n. 19
0
def call_music_start():
    C1_Def_File.music_start()  
Esempio n. 20
0
def check_language(lan):
    language = C1_Def_File.get_iris_conf(lan)
    #C8_Def_Skill.Center_need_to_start_cyberon(language,1,0) #inital cyberon because first start it is too slow
    return language
Esempio n. 21
0
def strat_cyberon_loop(lan, main, sub):
    file = C1_Def_File.cyberon_file(lan, main, sub)
    subprocess.Popen(['/usr/bin/CListenerDemo_loop', lan, file, '0'])
Esempio n. 22
0
def Choice_skill(set_id,lan,party_mode_now,angle):

    if set_id == 0 : 
        skill_inital(set_id,lan,58,2,'device',5)
        subcount = 0
        while True:
            set_id , State_led_check ,subcount ,angle= main_trigger(lan , subcount , 'device' , 5 , 'device' , angle)
            if set_id == 100 or State_led_check == 1:
                break 
            elif set_id < 999: 
                C4_Def_Gpio.Write_Iris_LED(2)
                subcount = 100
                try:
                    #r=requests.get("http://192.168.1.150/volume/user_file/1600.txt",timeout=2)
                    url = "http://192.168.1.150/volume/user_file/1600.txt"
                    r = C3_Def_link.requests_command(url,3) 
                    pos=r.text.index('results') 
                    integer=r.text[(pos+7):len(r.text)].strip('":} \r\n')
                    if set_id < 10 :
                        C5_Def_Program.play_music(set_id,lan,1)   
                        C1_Def_File.device_save(set_id)      
                        url = C9_Power_command.power_command(1,set_id)
                        r = C3_Def_link.requests_command(url,3)   
                    elif set_id == 10 :
                        if integer[0] == '1':
                            C5_Def_Program.play_music(32,lan,2)
                        else :
                            C5_Def_Program.play_music(33,lan,2)
                    elif set_id == 11 :
                        if integer[1] == '1':
                            C5_Def_Program.play_music(34,lan,2)
                        else :
                            C5_Def_Program.play_music(35,lan,2)
                    elif set_id == 12 :
                        if integer[2] == '1':
                            C5_Def_Program.play_music(36,lan,2)
                        else :
                            C5_Def_Program.play_music(37,lan,2)
                    elif set_id == 13 :
                        if integer[3] == '1':
                            C5_Def_Program.play_music(38,lan,2)
                        else :
                            C5_Def_Program.play_music(39,lan,2)
                            
                except Exception as exc:
                    C5_Def_Program.play_music(31,lan,2)
                    
                C1_Def_File.clear_cyberon()

            time.sleep(0.1)
            subcount = subcount + 1   
    
        C4_Def_Gpio.Write_Iris_LED(2)       
        C5_Def_Program.play_music(5,lan,2)
        
    if set_id == 10:
        skill_inital(set_id,lan,59,2,'phone',6)
        subcount = 0
        while True:
            set_id , State_led_check ,subcount ,angle = main_trigger(lan , subcount , 'phone' , 6 , 'phone' , angle)
            if set_id == 100 or State_led_check == 1:
                C4_Def_Gpio.Write_Iris_LED(2)       
                C5_Def_Program.play_music(5,lan,2)
                break 
            elif set_id < 999: 
                subcount = 100 
                if set_id == 1:
                    C5_Def_Program.play_music(11,lan,1)
                elif set_id == 2:
                    C5_Def_Program.play_music(12,lan,1)
                if set_id == 1 or set_id == 2:
                    recall = 0
                    C4_Def_Gpio.Write_Iris_LED(2)
                    C1_Def_File.bmp_file_set('calling')
                    command = 'echo b | telnet localhost 5555'
                    while True:
                        voip_talk_check = open('/tmp/file/sound_busy_check', 'r').read().strip()
                        State_led_check = C4_Def_Gpio.Check_State_One_LED()
                        if voip_talk_check == '9':
                            if set_id == 1:
                                command = 'echo d 2011 | telnet localhost 5555'
                                C5_Def_Program.start_program(command)
                            elif set_id == 2:
                                command = 'echo d 2011 | telnet localhost 5555'
                                C5_Def_Program.start_program(command)
                            time.sleep(1)
                        if voip_talk_check == '1':
                            C5_Def_Program.kill_cyberon_clistener_loop()
                            Center_need_to_voip(lan ,1)
                            break
  
                        elif recall >= 5:
                            command = 'echo b | telnet localhost 5555'
                            C5_Def_Program.start_program(command)
                            C5_Def_Program.play_music(31,lan,2)
                            break
                            
                        elif State_led_check == 1:
                            command = 'echo b | telnet localhost 5555'
                            break
                            
                        recall += 1          
                    break
        
            time.sleep(0.1)
            subcount = subcount + 1   
    


    if set_id == 20:
        C4_Def_Gpio.Write_Iris_LED(2)
        volume = C1_Def_File.get_iris_conf('volume_set')
        if int(volume)>0 and int(volume) <= 10:
            volume = int(volume) - 1
            C1_Def_File.bmp_file_set('volume%i'%(volume))
            C1_Def_File.set_iris_conf('volume_set',volume)
            C5_Def_Program.control_volume(volume)  
            C5_Def_Program.play_music(20,lan,1)
            C1_Def_File.bmp_file_set('iris_now')
        
        #print '*************volume up************' 
    if set_id == 21:
        C4_Def_Gpio.Write_Iris_LED(2)
        volume = C1_Def_File.get_iris_conf('volume_set')
        if int(volume)>=0 and int(volume)<10:
            volume = int(volume) + 1
            C1_Def_File.bmp_file_set('volume%i'%(volume))
            C1_Def_File.set_iris_conf('volume_set',volume)
            C5_Def_Program.control_volume(volume)  
            C5_Def_Program.play_music(21,lan,1)
            C1_Def_File.bmp_file_set('iris_now')
        
        #print '*************volume down************' 
    if set_id == 220:
        volume = 2
        C1_Def_File.set_iris_conf('volume_set',volume)
        C5_Def_Program.control_volume(volume)  
        C5_Def_Program.play_music(22,lan,1)
        
        #print '*************Max volume************'     
    if set_id == 230:
        volume = 10
        C1_Def_File.set_iris_conf('volume_set',volume)
        C5_Def_Program.control_volume(volume) 
        C5_Def_Program.play_music(22,lan,1)
                
        #print '*************min volume************'            
    if set_id == 240:
        volume = 11
        C1_Def_File.volume_set(volume)
        C5_Def_Program.control_volume(volume)  
        C5_Def_Program.play_music(22,lan,1)
        
        #print '*************Mute************'              
    
    
    #search iris
    if set_id == 270:
        C4_Def_Gpio.Write_Iris_LED(2) 
        #print '*************search iris************' 
        C5_Def_Program.play_music(set_id,lan,1) 
        Net_state = C3_Def_link.call_to_search_ip()
        if Net_state == 1 :
            C5_Def_Program.play_music_keep(9,lan,2) 
            C3_Def_link.search_iris_quan()
            C5_Def_Program.kill_play()
            C5_Def_Program.play_music(28,lan,1)  
        C4_Def_Gpio.Write_Iris_LED(4) 
        
    #wifi down               
    if set_id == 290:
        C4_Def_Gpio.Write_Iris_LED(2) 
        C5_Def_Program.play_music(set_id,lan,1) 
        #print '*************wifi down************' 
        C3_Def_link.quantenna_wifi_down()    
        C4_Def_Gpio.Write_Iris_LED(4)

    #wifi up   
    if set_id == 300:
        C4_Def_Gpio.Write_Iris_LED(2) 
        C5_Def_Program.play_music(set_id,lan,1) 
        #print '*************wifi up************' 
        C3_Def_link.quantenna_wifi_up()               
        C4_Def_Gpio.Write_Iris_LED(4) 
        
    #push wps                   
    if set_id == 320:  
        C4_Def_Gpio.Write_Iris_LED(2) 
        C5_Def_Program.play_music(set_id,lan,1)
        Wps_state = C3_Def_link.check_quan_wps()
        #print '*************push wps************' 
        if Wps_state == 1:
            C5_Def_Program.play_music_keep(6,lan,2)         
            Wps_state = C3_Def_link.call_to_push_wps() 
            C5_Def_Program.kill_play()
            if Wps_state == '2':
                C5_Def_Program.play_music(7,lan,2)   
            if Wps_state == '4':
                C5_Def_Program.play_music(8,lan,2)          
        C4_Def_Gpio.Write_Iris_LED(4)
        
    #connect_the_iris
    if set_id == 330:
        C4_Def_Gpio.Write_Iris_LED(2) 
        C5_Def_Program.play_music(set_id,lan,1)
        #print '*************connect_the_iris************' 
        Net_state = C3_Def_link.quantenna_connect_iris()
        if Net_state == 1 :
            C5_Def_Program.play_music(10,lan,2)
        if Net_state == 0 :
            C5_Def_Program.play_music(11,lan,2)
        C4_Def_Gpio.Write_Iris_LED(4)   
        
    #ir controller
    if set_id == 35:
        skill_inital(set_id,lan,set_id,1,'controller',1)
        subcount = 0
        while True:
            set_id , State_led_check ,subcount ,angle = main_trigger(lan , subcount , 'controller' , 1 , 'controller' , angle)
            if set_id == 100 or State_led_check == 1:
                break 
            elif set_id < 999: 
                C4_Def_Gpio.Write_Iris_LED(2)
                subcount = 100
                if set_id == 0:
                    C1_Def_File.ir_file_set('power')
                    C5_Def_Program.play_music(49,lan,2)    
                elif set_id == 26:
                    C1_Def_File.ir_file_set('power')
                    C5_Def_Program.play_music(57,lan,2)    
                elif set_id == 1:
                    C1_Def_File.ir_file_set('up')
                elif set_id == 2:
                    C1_Def_File.ir_file_set('left')
                elif set_id == 3:
                    C1_Def_File.ir_file_set('ok')
                elif set_id == 4:
                    C1_Def_File.ir_file_set('right')
                elif set_id == 5:
                    C1_Def_File.ir_file_set('down')
                elif set_id == 6:
                    C1_Def_File.ir_file_set('play')
                elif set_id == 7:
                    C1_Def_File.ir_file_set('back')
                elif set_id == 8:
                    C1_Def_File.ir_file_set('volumeadd')
                elif set_id == 9:
                    C1_Def_File.ir_file_set('volumedown')
                elif set_id == 10:
                    C1_Def_File.ir_file_set('programadd')
                elif set_id == 11:
                    C1_Def_File.ir_file_set('programdown')
                elif set_id == 12:
                    C1_Def_File.ir_file_set('0')
                elif set_id == 13:
                    C1_Def_File.ir_file_set('1')
                elif set_id == 14:
                    C1_Def_File.ir_file_set('2')
                elif set_id == 15:
                    C1_Def_File.ir_file_set('3')
                elif set_id == 16:
                    C1_Def_File.ir_file_set('4')
                elif set_id == 17:
                    C1_Def_File.ir_file_set('5')
                elif set_id == 18:
                    C1_Def_File.ir_file_set('6')
                elif set_id == 19:
                    C1_Def_File.ir_file_set('7')
                elif set_id == 20:
                    C1_Def_File.ir_file_set('8')
                elif set_id == 21:
                    C1_Def_File.ir_file_set('9')
                elif set_id == 22:
                    C1_Def_File.ir_file_set('3')
                    C5_Def_Program.play_music(50,lan,2)  
                elif set_id == 23:
                    C1_Def_File.ir_file_set('49')
                    C5_Def_Program.play_music(51,lan,2)  
                elif set_id == 24:
                    C1_Def_File.ir_file_set('50')
                    C5_Def_Program.play_music(52,lan,2)  
                elif set_id == 25:
                    C1_Def_File.ir_file_set('volumemute')
                    C5_Def_Program.play_music(53,lan,2)  
                            
                C1_Def_File.clear_cyberon()

            time.sleep(0.1)
            subcount = subcount + 1   
    
        C4_Def_Gpio.Write_Iris_LED(2)       
        C5_Def_Program.play_music(5,lan,2)
        
    # radio 
    if set_id == 36 or set_id == 42:
        # radio wait time
        if set_id == 42:
            skill_inital(set_id,lan,40,1,'processing',2)
            C4_Def_Gpio.Write_Iris_LED(2) 
            time_count = 0 ; subcount = 0;
            while True:
                set_id , subcount  , angle = main_trigger(lan , subcount , 'radio' , 1 , 'radio' , angle)
                if time_count == 60 :
                    set_id = 36
                    break 
                time_count += 1 
                time.sleep(1)  
                
        if set_id == 36:                
            skill_inital(set_id,lan,set_id,1,'processing',2)
            while True:
                C1_Def_File.bmp_file_set('processing')
                global decodejson;global mp3_site;global user_choice_id
                decodejson=[[]]*3;mp3_site=[];user_choice_id=['1','','']  
                try:
                    r = C3_Def_link.requests_command("http://Andromeda.tti.tv",0.5)
                except Exception as exc:
                    C5_Def_Program.play_music(31,lan,2)
                    break
                '''
                if r.status_code!=200:
                    print 'requests.get \"Andromeda.tti.tv\" failed'
                '''
                return_bool_value=radio_url_get(0,3)
                if return_bool_value==False:
                    print 'return_bool_value error'
                i=0;j=0
                
                radio_tmp = 999 ; play=0 ;call_iris =0 ; subcount = 101 ; bmp_word = 'processing' ;
                '''
                for i in range(len(decodejson[2])):
                    print 'request.get:'+decodejson[2][i]['StreamUrl']
                    try:
                        r = C3_Def_link.requests_command_stream(decodejson[2][i]['StreamUrl'], 0.5)#200,503,403,only connected message
                    except:
                        print 'requests.get \"'+decodejson[2][i]['StreamUrl']+'\" failed'
                        continue
                    print r.status_code
                    aac=2
                    if r.status_code==200:
                        print r.headers['content-type']
                        if 'aac' in r.headers['content-type']:
                            aac=1
                        else:
                            aac=0
                    if aac==0:
                        #print 'aac=0'
                        mp3_site.append(decodejson[2][i]['StreamUrl'])
                        print len(mp3_site)
                        radio_tmp , play , subcount  = radio_choice(radio_tmp,len(mp3_site),lan ,play,subcount )
                        if play == 2 or play == 3:
                            C1_Def_File.set_iris_conf('radio3',1)
                            break 
                print ('mp3 site count=',len(mp3_site))
                '''
                # tmp
                for i in range(len(decodejson[2])):
                    mp3_site.append(decodejson[2][i]['StreamUrl'])    
                #print ('mp3 site count=',len(mp3_site))    
                    
                if len(mp3_site)>0:
                    while True:            
                        set_id , State_led_check ,subcount , angle= main_trigger(lan , subcount , 'radio' , 2 , 'radio' , angle)    
                        if set_id == 100 or State_led_check == 1 or play == 3:
                            C1_Def_File.set_iris_conf('radio3',1)
                            break
                        radio_tmp , play , subcount , bmp_word  = radio_choice(radio_tmp,len(mp3_site),lan , play , subcount , bmp_word ,set_id)
                        time.sleep(0.1)
                if set_id == 100 or State_led_check == 1:
                    C5_Def_Program.kill_play_stream() 
                    break
            #tmp
            C1_Def_File.set_iris_conf('radio3',1)
            
        C4_Def_Gpio.Write_Iris_LED(2)       
        C5_Def_Program.play_music(5,lan,2)
            


    if set_id == 37:
        skill_inital(set_id,lan,set_id,1,'Andromeda',3)
        subcount = 0; app = '0' ; ip = 'http://192.168.1.150:7070/'
        Andromeda_ID  = C1_Def_File.get_iris_conf('Andromeda_ID')
        #ip = 'http://211.75.14.235:7070/'
        while True:
            set_id , State_led_check ,subcount ,angle= main_trigger(lan , subcount , 'Andromeda' , 3 , 'Andromeda' ,angle)
            if set_id == 100 or State_led_check == 1:
                break 
            elif set_id < 999: 
                try:
                    C4_Def_Gpio.Write_Iris_LED(2)
                    subcount = 100
                    
                    if set_id == 0:
                        C5_Def_Program.play_music(45,lan,2)
                        payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'LiveTV', 'message':'open', 'uri':''}
                        r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                        app = 'LiveTV'
                        
                    elif set_id == 1:
                        C5_Def_Program.play_music(46,lan,2)
                        payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'MediaStore', 'message':'open', 'uri':''}
                        r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                        app = 'MediaStore'  
                        
                    #elif set_id == 2:
                    #    C1_Def_File.ir_file_set('back')
                        
                    elif app == 'LiveTV':  
                        if set_id == 16:
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'LiveTV', 'message':'close', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                            app = '0'
                        elif set_id == 2:
                            C1_Def_File.ir_file_set('back')
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'LiveTV', 'message':'close', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                            app = '0'
                        elif set_id == 10:
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'LiveTV', 'message':'change to channel 3', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                        elif set_id == 11:
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'LiveTV', 'message':'change to channel 49', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                        elif set_id == 12:
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'LiveTV', 'message':'change to channel 50', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)  
                            
                    elif app == 'MediaStore' :   
                        if set_id == 2:
                            C1_Def_File.ir_file_set('back')
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'MediaStore', 'message':'back', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                            app = '0'
                        elif set_id == 3:
                            C5_Def_Program.play_music(47,lan,2)
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'MediaStore', 'message':'video', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                        elif set_id == 4:
                            C5_Def_Program.play_music(48,lan,2)
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'MediaStore', 'message':'audio', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                        elif set_id == 5:
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'MediaStore', 'message':'stop', 'uri':''}
                            r=r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                        elif set_id == 6:
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'MediaStore', 'message':'play', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                        elif set_id == 7:
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'MediaStore', 'message':'pause', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                        elif set_id == 13:
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'MediaStore', 'message':'play wonderland', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                        elif set_id == 14:
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'MediaStore', 'message':'play snowboard', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                        elif set_id == 15:
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'MediaStore', 'message':'play redbull', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                        elif set_id == 16:
                            payload = {'broadcast': 'N', 'username': Andromeda_ID  , 'title':'MediaStore', 'message':'close', 'uri':''}
                            r=C3_Def_link.requests_command_payload(ip + "notification.do?action=send",payload,5)
                            app = '0'
                                
                except Exception as exc:
                    C5_Def_Program.play_music(31,lan,2)
                    
                C1_Def_File.clear_cyberon()
            
            time.sleep(0.1)
            subcount = subcount + 1 
            
        C4_Def_Gpio.Write_Iris_LED(2)       
        C5_Def_Program.play_music(5,lan,2)
Esempio n. 23
0
def call_music_pause():
    C1_Def_File.music_pause()
Esempio n. 24
0
def clistener(lan , party_mode_now , angle): 
    #C8_Def_Skill.Center_need_to_kill_cyberon_cspoter()
    C1_Def_File.clear_cyberon()
    C8_Def_Skill.Center_need_to_play_music_no_wait(60,lan,2)
    C8_Def_Skill.Center_need_to_start_cyberon(lan,1,0)
    #C8_Def_Skill.Center_need_to_start_cyberon_loop(lan,1,0)
    C1_Def_File.bmp_file_set('iris_now')
    C4_Def_Gpio.Write_Iris_LED(1)
    #print '*************clistener up************'
    Count = 1;iris_state = 0;
    
    if party_mode_now == 1:
        volume = 10
        C8_Def_Skill.Center_need_to_control_volume(volume)     
    
    while True:   
        State_led_check = C4_Def_Gpio.Check_State_One_LED()
        voip_talk_check = open('/tmp/file/sound_busy_check', 'r').read().strip()
        
        if voip_talk_check != '9' or Count == 10:
            break
            
        if voip_talk_check == '9':
            
            if angle !=720:
                set_id = C7_Def_Talk_list.iris_mapping(lan , angle)   
            else:
                set_id = C7_Def_Talk_list.iris_mapping_no_angle(lan)  
            #button to down
            if State_led_check == 1 or set_id == 1000:
                #C1_Def_File.music_pause()
                break
                  
              
            #print set_id
            if set_id < 999 and State_led_check == 0:
                C8_Def_Skill.Center_need_to_kill_cyberon_clistener_loop()
                C1_Def_File.clear_cyberon() 
                if set_id == 100:
                    C4_Def_Gpio.Write_Iris_LED(2)     
                
                    if party_mode_now == 1:  
                        C8_Def_Skill.Center_need_to_party_mode_off()
                        
                    C8_Def_Skill.Center_need_to_kill_cyberon_clistener() 
                    C8_Def_Skill.Center_need_to_play(5,lan,2) 
                    C4_Def_Gpio.Write_Iris_LED(0)           
                
                elif set_id == 14 or set_id == 15: 
                    C4_Def_Gpio.Write_Iris_LED(2) 
                    C1_Def_File.bmp_file_set('annocement')                  
                    C8_Def_Skill.Center_need_to_play(14,lan,1)                     
                    C8_Def_Skill.Center_need_to_Announcement_Mode_On()
                    C1_Def_File.clear_cyberon()
                    C8_Def_Skill.Center_need_to_start_cyberon_loop(lan,1,0)
                    C4_Def_Gpio.Write_Iris_LED(1) 
                    Announcement_count=0
                    while True:
                        time.sleep(1)
                        set_id = C7_Def_Talk_list.iris_mapping_no_angle(lan)
                        State_led_check = C4_Def_Gpio.Check_State_One_LED()
                        if State_led_check == 1 or Announcement_count == 40 or set_id == 14 or set_id == 15: 
                            C8_Def_Skill.Center_need_to_Announcement_Mode_Off()
                            break
                            
                        Announcement_count=Announcement_count+1

                    C8_Def_Skill.Center_need_to_kill_cyberon_clistener_loop()
                    C4_Def_Gpio.Write_Iris_LED(2)                            
                    C8_Def_Skill.Center_need_to_play(15,lan,1) 
            
                elif set_id == 16 or  set_id == 17: 
                    C4_Def_Gpio.Write_Iris_LED(2) 
                    if party_mode_now == 0:
                        C1_Def_File.bmp_file_set('partymodenow')
                        C8_Def_Skill.Center_need_to_play(16,lan,1)
                        C8_Def_Skill.Center_need_to_party_mode()   
                        party_mode_now=1
                    elif party_mode_now == 1: 
                        C8_Def_Skill.Center_need_to_party_mode_off()
                        C8_Def_Skill.Center_need_to_play(17,lan,1)  
                        party_mode_now=0
                        
                elif set_id == 18 :
                    C1_Def_File.bmp_file_set('alexa_now')
                    C4_Def_Gpio.Write_Alexa_LED(1)
                    f = C1_Def_File.alexa_control_get()
                    if f == '0' :
                        #print '*************alexa up************'
                        C8_Def_Skill.Center_need_to_kill_cyberon_clistener_loop()
                        C1_Def_File.alexa_control_set()
                        while True:
                            State_led_check = C4_Def_Gpio.Check_State_One_LED()
                            alexa_control = C1_Def_File.alexa_control_get()
                            if alexa_control == '0' :
                                break
                            if State_led_check==1 :
                                C1_Def_File.button_alexa_to_reset()
                                break
                                
                            time.sleep(1)

                        #C8_Def_Skill.Center_need_to_start_cyberon(lan,0,0)
                        
                    elif f != '0' :  
                        #print '*************alexa error************'
                        C8_Def_Skill.Center_need_to_play(1,lan,2)
                        
                    C4_Def_Gpio.Write_Alexa_LED(0)
                    C1_Def_File.clear_cyberon()
                    
                else:           
                    C8_Def_Skill.Choice_skill(set_id , lan,party_mode_now , angle)   
                    

                            
                    break
                
            Count += 1
            time.sleep(1)
            
    C8_Def_Skill.Center_need_to_kill_cyberon_clistener()
    #C8_Def_Skill.Center_need_to_kill_cyberon_clistener_loop()
    C1_Def_File.clear_cyberon() 
    C4_Def_Gpio.Write_Iris_LED(0)
    C4_Def_Gpio.Write_State_One_LED(0)
    if party_mode_now == 0:
        C1_Def_File.bmp_file_set('hello')
    else :
        C1_Def_File.bmp_file_set('partymodenow')
        
    if party_mode_now == 1:
        volume = C1_Def_File.get_iris_conf('volume_set')
        C8_Def_Skill.Center_need_to_control_volume(volume)   

    C1_Def_File.music_start() 
    return party_mode_now
Esempio n. 25
0
def main_trigger(lan , subcount , bmp_name , clisten_file , clisten_check ,angle):
    f = C1_Def_File.cyberon_get()
    set_id = C7_1_Def_Talk_list.iris_mapping(lan,clisten_check,angle)     
    State_led_check = C4_Def_Gpio.Check_State_One_LED()
    #if subcount == 101 or set_id == 1000:
    if subcount == 101:
        volume = C1_Def_File.get_iris_conf('volume_set')
        if int(volume)>0 and int(volume) < 10:
            C5_Def_Program.control_volume(volume)  
        
        C5_Def_Program.kill_cyberon_clistener() 
        #C5_Def_Program.kill_cyberon_clistener_loop()
        C1_Def_File.clear_cyberon()
        C1_Def_File.music_start() 
        C4_Def_Gpio.Write_Iris_LED(0)
        C1_Def_File.bmp_file_set(bmp_name)
        #C5_Def_Program.strat_cyberon(lan,0,0)
        subcount = 101
    elif f == "Go Iris" or f == "Iris" :
        angle = C1_Def_File.angle_get()
        volume = C1_Def_File.get_iris_conf('volume_set')
        if int(volume)>0 and int(volume) < 10:
            C5_Def_Program.control_volume(10)  
        
        #C5_Def_Program.kill_cyberon_cspotter()
        if clisten_check != 'radio':
            C5_Def_Program.play_music_no_wait(60,lan,2)
        C1_Def_File.clear_cyberon_cspotter()
        C5_Def_Program.strat_cyberon(lan,1,clisten_file)
        #C5_Def_Program.strat_cyberon_loop(lan,1,clisten_file)
        C1_Def_File.bmp_file_set('listen')
        C4_Def_Gpio.Write_Iris_LED(1)
        subcount = 0
            
    return set_id , State_led_check ,subcount ,angle
Esempio n. 26
0
def get_user_choice(i):
    str=C1_Def_File.get_iris_conf('radio%1d'%(i))
    return str[0:len(str)-1]
Esempio n. 27
0
def All_file_program_reset(lan):
    C4_Def_Gpio.Write_Power_LED(0)
    C8_Def_Skill.Center_need_to_inital_iris()
    C8_Def_Skill.Center_need_to_play(3,lan,2)
    C1_Def_File.bmp_file_set('hello')
Esempio n. 28
0
def inital_device():
    #print '*************inital_device************'

    #volume = C1_Def_File.get_iris_conf('volume_set')
    #subprocess.Popen("amixer cset numid=2,iface=MIXER,name='MaxxVolume Control' "+volume, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    C1_Def_File.choice_file_set('/tmp/file/cspotter', '0')
    C1_Def_File.choice_file_set('/tmp/file/clisten', '0')
    C1_Def_File.choice_file_set('/tmp/file/stream_check', '0')
    #C1_Def_File.choice_file_set('/tmp/file/sound_busy_check', '0')
    C1_Def_File.choice_file_set('/tmp/file/device', '00000')
    C1_Def_File.choice_file_set('//tmp/file/answer', '00000')
    master_quantenna_mac = C1_Def_File.get_iris_conf('master_quantenna_mac')
    C1_Def_File.choice_file_set('/tmp/file/master_quantenna_mac',
                                master_quantenna_mac)
    command = "echo '192.168.1.246' > /tmp/file/search_iris"
    subprocess.Popen(command,
                     shell=True,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.STDOUT).wait()
    command = "echo '192.168.1.247' > /tmp/file/search_quantenna"
    subprocess.Popen(command,
                     shell=True,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.STDOUT).wait()
    default_quantenna_ip = C1_Def_File.get_iris_conf('default_quantenna_ip')
    C1_Def_File.choice_file_set('/tmp/file/default_quantenna_ip',
                                default_quantenna_ip)
    C1_Def_File.set_iris_conf('radio3', 1)
    command = ("ffserver /etc/ffserver.conf&")
    subprocess.Popen(command,
                     shell=True,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.STDOUT).wait()