Пример #1
0
def Print(arg):
    while True:
        try:

            NUM = DAN.pull('HKA_MSG_NUM')
            print(NUM)
            NUM = str(NUM)
            NUM = NUM.replace("[", "")
            NUM = NUM.replace("]", "")
            NUM = NUM.replace("'", "")

            String = DAN.pull('HKA_MSG_STRING')
            print(String)
            String = str(String)
            String = String.replace("[", "")
            String = String.replace("]", "")
            String = String.replace("'", "")

            for userId in user_id_set:
                if NUM != 'None' and String != 'None':
                    line_bot_api.push_message(
                        userId, TextSendMessage(text=NUM + ' 時間: ' +
                                                String))  # Push API example
            time.sleep(0.5)
        except Exception as e:
            print(e)
            if str(e).find('mac_addr not found:') != -1:
                print('Reg_addr is not found. Try to re-register...')
                DAN.device_registration_with_retry(ServerURL, Reg_addr)
            else:
                print('Connection failed due to unknow reasons.')
                time.sleep(1)
Пример #2
0
    def on_data(frame_id, img, bboxes, img_path):
        """
        When objects are detected, this function will be called.

        Args:
            frame_id:
                the frame number
            img:
                a numpy array which stored the frame
            bboxes:
                A list contains several `libs.darknet.yolo_device.ExtendedBoundingBox` object. The list contains
                all detected objects in a single frame.
            img_path:
                The path of the stored frame. If `output_dir` is None, this parameter will be None too.
        """
        global tmp
        for det in bboxes:
            now = datetime.datetime.now()
            # You can push these variables to IoTtalk sever
            class_name = det.get_class_name()
            confidence = det.get_confidence()
            center_x, center_y = det.get_center()
            
            if int(now.strftime("%Y%m%d%H%M%S"))>int((tmp+datetime.timedelta(seconds=10)).strftime("%Y%m%d%H%M%S")): # You can add different condition at here
                msg = "\nPeople detected, see: https://"+img_path.split('www')[1]+"\nToday's snapshots: https://"+(img_path.split('www')[1]).rsplit("/", 2)[0]+"/"
                tmp = now
                LineNotify.line_notify(msg)
                DAN.push('yPerson-I', str(det.get_obj_id()), center_x, center_y, img_path.split('www')[1])
                print(confidence, center_x, center_y)
                print(img_path)
                time.sleep(1)
Пример #3
0
def job_of_time_action_info(_action_list):
    global time_probe
    global last_time
    global now_time
    last_time = 0
    while (time_probe < len(action_list)):
        # get current action list
        target = action_list[time_probe]
        # get current time
        now_time = target[0]
        # iottalk delay
        #now_time -= 2
        # get current action
        target_action = target[1]
        target_time = now_time - last_time
        time.sleep(target_time)
        print("timer: ", end='')
        print(now_time)
        print("action: ", end='')
        print(target_action)
        #if (DAN.state == 'SET_DF_STATUS'):
        DAN.push('musicMonitorI', target_action)
        # update last_time
        last_time = now_time
        # move probe to next action
        time_probe += 1
    time.sleep(300)  # dummy delay XDD
Пример #4
0
def receive_frame_from_iottalk():

    #print('start receive frame from iottalk')
    try:
        data = DAN.pull('ODF_Frame')
        if data != None:
            frame_string = data[0]
            person_information = data[1]
            #print(person_information)

            tmp_array = literal_eval(frame_string)
            tmp_boxes = json.loads(person_information)
            #tmp_nparray = np.array(tmp_array)
            #tmp_buf = tmp_nparray.astype('uint8')
            #frame = cv2.imdecode(tmp_buf, 1)
            #cv2.imshow('Receive',frame)
            #cv2.waitKey(1)

            return (tmp_array, tmp_boxes)

    except Exception as e:
        print(e)
        if str(e).find('mac_addr not found:') != -1:
            print('Reg_addr is not found. Try to re-register...')
            DAN.device_registration_with_retry(ServerURL, Reg_addr)
        else:
            print('Connection failed due to unknow reasons.')
            #time.sleep(1)

    #time.sleep(0.2)
    return None
Пример #5
0
def resume():
    print('Sending information', end='', flush=True)
    i = 5
    while(i):
        i -= 1
        time.sleep(1)
        DAN.push('ReversiTalkAIOutput', -1, {'event': 'emitBoardUpdate', 'data': 'AI is fetching data.'})
        print('.', end='', flush=True)
    print('Information sent.')
Пример #6
0
def handle_message(event):
    Msg = event.message.text
    if Msg == 'Hello, world': return
    print('GotMsg:{}'.format(Msg))
    DAN.push('TextSenderIDF', Msg)
    #line_bot_api.reply_message(event.reply_token,TextSendMessage(text=value1[0]))   # Reply API example
    userId = event.source.user_id
    if not userId in user_id_set:
        user_id_set.add(userId)
        saveUserId(userId)
Пример #7
0
def auto_push_switch():
    global data
    while True:
        if data['Manual_mode'] == 0:
            if check_time() and check_control():
                Switch_control(1, 'control')
            else:
                Switch_control(0, 'control')
        DAN.push('Switch1', data['switch'])
        time.sleep(5)
Пример #8
0
def print_sound(indata=0, outdata=50, frames=1000, time=10, status=50):
    global gotInput, volume_norm
    volume_norm = np.linalg.norm(indata) * 10
    print(int(volume_norm))
    if (int(volume_norm) > 10):
        max_volume = int(volume_norm)
        #
        #print("max volume = ",max_volume,"\n")
        DAN.push('wea_date', max_volume, max_volume)

    gotInput = True
Пример #9
0
def server():
    while True:
        rawInput = DAN.pull('FP_LB3_msg_pull')
        if rawInput != None and bool(rawInput[0]):
            content = json.loads(str(rawInput[0]))
            if content['type'] == 'state_update':
                print("推播通知")
                for orderId in content['content']['orderID']:
                    query = (Users.select(Users, Orders).join(
                        Orders, on=(Users.userID == Orders.userID)).where(
                            Orders.orderID == orderId))
                    lineId = query[0].lineID
                    orderUid = query[0].orders_sent_by_user[0].orderUID
                    print(orderUid)
                    if content['content']['status'] == 1:
                        line_bot_api.push_message(
                            lineId,
                            TextSendMessage(
                                text='訂單編號{} 已開始出貨,欲知詳情請輸入「我的訂單狀態」。'.format(
                                    orderUid)))
                    elif content['content']['status'] == -1:
                        line_bot_api.push_message(
                            lineId,
                            TextSendMessage(text='訂單編號{} 已經送達,敬請前往取貨,謝謝您。'.
                                            format(orderUid)))
                    else:
                        print('push message status error')
            else:
                print('status not state_update')
Пример #10
0
def south():
    while True:
        Msg = DAN.pull('wash_south')
        if Msg is not None:
            if Msg[0] != "":
                reply = "南棟:\n"
                w1num = len(crawl.sort_data_with_geo('S1W',
                                                     crawl.get_status()))
                reply += "1F洗衣機 %d 台" % (w1num)
                if w1num == 0:
                    reply += " 最快%d分鐘後可使用" % (
                        crawl.get_earilest_avaliable('S1W'))

                d1num = len(crawl.sort_data_with_geo('S1D',
                                                     crawl.get_status()))
                reply += "\n1F烘衣機 %d 台" % (d1num)
                #if d1num == 0:
                #reply += " 最快%d分鐘後可使用"%(crawl.get_earilest_avaliable('S1D'))

                w10num = len(
                    crawl.sort_data_with_geo('S10W', crawl.get_status()))
                reply += "\n10F洗衣機 %d 台" % (w10num)
                if w10num == 0:
                    reply += " 最快%d分鐘後可使用" % (
                        crawl.get_earilest_avaliable('S10W'))

                d10num = len(
                    crawl.sort_data_with_geo('S10D', crawl.get_status()))
                reply += "\n10F烘衣機 %d 台" % (d10num)
                if d10num == 0:
                    reply += " 最快%d分鐘後可使用" % (
                        crawl.get_earilest_avaliable('S10D'))

                line_bot_api.push_message(Msg[0], TextSendMessage(text=reply))
                print(reply)
Пример #11
0
def turn_off_job(toggle_id):
    #print(datetime.now())
    DAN.push('5Toggle-I{}'.format(toggle_id), 0)
    print('5Toggle-I{} push 0'.format(toggle_id))
    job_dict['toggle{}'.format(toggle_id)]['trigger_status'] = 0
    get_turn_off_data = {
        'id':
        toggle_id,
        'turn_off_time':
        job_dict['toggle{}'.format(toggle_id)]['turn_off_time'].strftime(
            '%H:%M'),
        'toggle_value':
        job_dict['toggle{}'.format(toggle_id)]['toggle_value'],
        'trigger_status':
        job_dict['toggle{}'.format(toggle_id)]['trigger_status']
    }
    print(get_turn_off_data)
Пример #12
0
def trace():
	global device_location_bind
	while True:
		rawInput = DAN.pull('FP_LB3_trace_pull')
		if rawInput != None:
			content = json.loads(str(rawInput[0]))
			device_location_bind.update({content['driverId']: [content['lat'], content['long']]})
			print(content['driverId'], 'move to', content['lat'], content['long'])
Пример #13
0
def doRead():
    global gotInput, theInput
    while True:
        if gotInput:
            time.sleep(0.5)
            continue  # go back to while
        try:
            theInput = ""
        except Exception:  # KeyboardInterrupt:
            allDead = True
            print("\n\nDeregister " +
                  DAN.profile['d_name'] + " !!!\n",  flush=True)
            DAN.deregister()
            sys.stdout = sys.__stdout__
            print(" Thread say Bye bye ---------------", flush=True)
            sys.exit()  # break  # raise   #  ?
        gotInput = True
Пример #14
0
def doRead( ):
    global gotInput, theInput, allDead
    while True:
        if gotInput:
           time.sleep(0.1)
           continue  # go back to while
        try:
           theInput = input("Give me data: ")
        except Exception:    ##  KeyboardInterrupt:
           allDead = True
           print("\n\nDeregister " + DAN.profile['d_name'] + " !!!\n",  flush=True)
           DAN.deregister()
           sys.stdout = sys.__stdout__
           print(" Thread say Bye bye ---------------", flush=True)
           sys.exit( )   ## break  # raise   #  ?
        gotInput=True
        if theInput !='quit' and theInput != "exit":
           print("Will send " + theInput, end="   , ")
Пример #15
0
def whilepull():
    global Label_List
    while live_flag:
        for i in range(len(odf_List)):
            value = DAN.pull(odf_List[i])
            #print('Pull: {0} = {1}'.format(odf_List[i], value))
            if value != None:
                print('Pull: {0} = {1}'.format(odf_List[i], value[0]))
                Label_List[i].config(text=str(value[0]))
        time.sleep(1)
Пример #16
0
def job():
    while 1:
        value1 = DAN.pull('msgO')
        if value1 != None:
            try:
                for userId in user_id_set:
                    line_bot_api.push_message(
                        userId,
                        TextSendMessage(text=value1[0]))  # Push API example
            except Exception as e:
                print(e)
Пример #17
0
def handle_message(event):

    Msg = event.message.text
    if Msg == 'Hello, world': return
    print('GotMsg:{}'.format(Msg))
    DAN.push('MSG-I', Msg)

    #Line_Temp=DAN.pull('MSG-O')
    #Line_Temp=str(Line_Temp)
    #Line_Temp=Line_Temp.replace("[","")
    #Line_Temp=Line_Temp.replace("]","")
    #Line_Temp=Line_Temp.replace("'","")

    line_bot_api.reply_message(
        event.reply_token, TextSendMessage(text='hello'))  # Reply API example

    userId = event.source.user_id
    if not userId in user_id_set:
        user_id_set.add(userId)
        saveUserId(userId)
Пример #18
0
def main():
    print(type(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S %p')))
    DAN.profile['dm_name'] = 'SwitchAIO'
    DAN.profile['d_name'] = 'TEST_SwitchAIO'
    DAN.profile['df_list'] = idf_list + odf_list

    open_config(config_name)
    #DAN.profile['d_name']= 'Assign a Device Name'

    DAN.device_registration_with_retry(IOT_ServerURL, Reg_addr)

    t_auto_pull = threading.Thread(target=Auto_pull)
    t_auto_pull.start()

    t_time_control = threading.Thread(target=auto_push_switch)
    t_time_control.start()

    atexit.register(on_exit)

    app.run(host=WEB_HOST, port=WEB_PORT, threaded=True, debug=False)
Пример #19
0
def doRead():
    global gotInput, theInput, allDead
    while True:
        while gotInput:  # 老闆還沒把資料拿走
            time.sleep(0.1)  # 小睡 下把 CPU 暫時讓給別人
            continue  # go back to while
        try:  # 準備讀取資料, 注意程式會卡在這等 User 輸入, 所以要用 Thread
            theInput = int(input("Give me data: "))
            print('send your input: {}'.format(theInput))
        except Exception:  ##  KeyboardInterrupt:
            allDead = True
            print("\n\nDeregister " + DAN.profile['d_name'] + " !!!\n",
                  flush=True)
            DAN.deregister()
            sys.stdout = sys.__stdout__
            print(" Thread say Bye bye ---------------", flush=True)
            sys.exit()
            ## break  # raise   #  ?
        gotInput = True  # notify my master that we have data
        if allDead:
            break
Пример #20
0
def Iottalk_message():
    while True:
        try:
            value1 = DAN.pull('position')
            if value1 != None:
                nearby = GameInfo.updatePos(value1[0], float(value1[1]),
                                            float(value1[2]))
                if nearby:
                    line_bot_api.push_message(
                        nearby, TextSendMessage(
                            text='Treasure is nearby!!'))  # Push API example

        except Exception as e:
            print(e)
            if str(e).find('mac_addr not found:') != -1:
                print('Reg_addr is not found. Try to re-register...')
                DAN.device_registration_with_retry(ServerURL, Reg_addr)
            else:
                print('Connection failed due to unknow reasons.')
                time.sleep(1)
        time.sleep(0.2)
Пример #21
0
def Auto_pull():
    global odf_list, odf_data, data
    while True:
        time.sleep(5)
        if DAN.state == 'RESUME':
            for odf in odf_list:
                d = DAN.pull(odf)
                if d != None:
                    #print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S %p')-data[odf+'_time'])
                    data[odf + '_time'] = datetime.datetime.now().strftime(
                        '%H:%M:%S %p')
                    odf_data[odf] = round(d[0], 2)
Пример #22
0
def doRead( ):
    global gotInput, theInput, allDead
    while True:   
        while gotInput:   # 老闆還沒把資料拿走
           time.sleep(0.1)    # 小睡 下把 CPU 暫時讓給別人
           continue  # go back to while   
        try:     # 準備讀取資料, 注意程式會卡在這等 User 輸入, 所以要用 Thread
           theInput = input("Give me data: ")
        except Exception:    ##  KeyboardInterrupt:
           allDead = True
           print("\n\nDeregister " + DAN.profile['d_name'] + " !!!\n",  flush=True)
           DAN.deregister()
           sys.stdout = sys.__stdout__
           print(" Thread say Bye bye ---------------", flush=True)
           sys.exit( );   ## break  # raise   #  ?
        if theInput =='quit' or theInput == "exit":    # these are NOT data
           allDead = True
        else:
           print("Will send " + theInput, end="   , ")
           gotInput=True   # notify my master that we have data 
        if allDead: break;   # 離開 while True 這 Loop  
Пример #23
0
def pushlinemsg(user_id_set):
    while True:
        msg = DAN.pull('MSG-O')
        msg = str(msg)
        #print('msg:',msg)
        if msg:
            print('PushMsg:{}'.format(msg))
            for usrId in user_id_set:
                if msg != 'None':
                    line_bot_api.push_message(userId,
                                              TextSendMessage(text=msg))
                    time.sleep(5)
Пример #24
0
def job_of_music_feature(music_file):
    """ fetch message from music file and get music features """
    midi_file = MidiFile(music_file)
    note_color = ColorMapping()
    for msg in midi_file:
        # print(dir(msg))
        # exit()
        time.sleep(msg.time)
        if not msg.is_meta:
            # print(msg)
            str_msg = str(msg)
            mid = MidiMessage(str_msg)
            if mid.channel() == 0:
                # print(str_msg)
                # print('note:', mid.note())
                # print('velocity: ', mid.velocity())
                if mid.velocity() > 0:
                    color = note_color.get_note_color(mid.note())
                    print('color:', color)
                    # print(color[0])
                    # exit()
                    DAN.push('Note', color[0], color[1], color[2])
Пример #25
0
def doRead():
    global gotInput, theInput
    while True:
        if gotInput:
            time.sleep(0.5)
            continue  # go back to while
        try:
            r = req.get(_url)
            if r.ok:
                soup = Soup(r.text, 'html.parser')
                wind = soup.find('span', {'data-testid': 'Wind'})
                wind_deg = 180
                try:
                    wind_deg = (int(
                        re.search(r'transform:rotate\(([0-9]+)deg\)',
                                  wind.find('svg')['style']).group(1)) +
                                180) % 360
                except:
                    pass
                wind_speed = float(
                    re.search(r'([0-9]+\.?[0-9]*)', wind.text).group(1))
                visibility = float(
                    re.search(
                        r'([0-9]+\.?[0-9]*)',
                        soup.find('span', {
                            'data-testid': 'VisibilityValue'
                        }).text).group(1))
                theInput = [wind_deg, wind_speed, visibility]
            else:
                theInput = []
        except Exception as e:  # KeyboardInterrupt:
            print(e)
            allDead = True
            print("\n\nDeregister " + DAN.profile['d_name'] + " !!!\n",
                  flush=True)
            DAN.deregister()
            sys.stdout = sys.__stdout__
            sys.exit()  # break  # raise   #  ?
        gotInput = True
Пример #26
0
def doRead( ):
    global gotInput, theInput, allDead
    while True:
        if gotInput:
           time.sleep(0.1)
           continue  # go back to while
        try:
           theInput = input("Give me data: ")
        except Exception:    ##  KeyboardInterrupt:
           allDead = True
           print("\n\nDeregister " + DAN.profile['d_name'] + " !!!\n",  flush=True)
           DAN.deregister()
           sys.stdout = sys.__stdout__
           print(" Thread say Bye bye ---------------", flush=True)
           sys.exit( );   ## break  # raise   #  ?
        gotInput=True
        ans = re.split(" ,|, |,| ", theInput)
      ## please try to input: color  55, 168, 33  44  55
        print("Original ans=", ans)

        ans = [ x for x in ans if x]  # remove empty string
        print("new ans=", ans)
        parse(ans);
        if cmd[0] == "Q" or cmd[0] == "E": break;
        if cmd[0] == "S":
           showData( );
           continue;
        if cmd[0] == "L":
           print("cmd=", cmd, "; Luminance=", Luminance)
        elif cmd[0] == "C":
           print("cmd=", cmd, ",R=", r, ",G=", g, ",B=", b, ",LUM=", Luminance)
        else:
           print("Illegal command. Only C / L two commands allowed.")
           print("Please Re-Enter your ", end="");


        if theInput !='quit' and theInput != "exit":
           print("Will send " + theInput, end="   , ")
Пример #27
0
def Print(arg):
    while True:
        try:
            Line_Temp = DAN.pull('MSG-O')
            print(Line_Temp)
            Line_Temp = str(Line_Temp)
            Line_Temp = Line_Temp.replace("[", "")
            Line_Temp = Line_Temp.replace("]", "")
            Line_Temp = Line_Temp.replace("'", "")
            for userId in user_id_set:
                if Line_Temp != 'None':
                    line_bot_api.push_message(
                        userId,
                        TextSendMessage(text=Line_Temp))  # Push API example
            time.sleep(10)
        except Exception as e:
            print(e)
            if str(e).find('mac_addr not found:') != -1:
                print('Reg_addr is not found. Try to re-register...')
                DAN.device_registration_with_retry(ServerURL, Reg_addr)
            else:
                print('Connection failed due to unknow reasons.')
                time.sleep(1)
def send_frame_to_iottalk(buf, boxes):

    #print(type(buf))
    #array = buf.tolist()
    #print(len(buf))
    frame_string = str(buf)
    person_information = json.dumps(boxes)
    #print(person_information)
    #print(data)
    #print(len(data))

    try:
        # @0: string
        # @1: json
        DAN.push('IDF_Frame', frame_string, person_information)
        print('push')
    except Exception as e:
        print(e)
        if str(e).find('mac_addr not found:') != -1:
            print('Reg_addr is not found. Try to re-register...')
            DAN.device_registration_with_retry(ServerURL, Reg_addr)
        else:
            print('Connection failed due to unknow reasons.')
Пример #29
0
def doRead():

    r1 = random.randint(10000, 20000)
    r2 = random.randint(30000, 50000)
    answer = r1 + r2

    global gotInput, theInput, allDead
    while True:
        if gotInput:
            time.sleep(0.1)
            continue  # go back to while
        try:
            print("answer the question: ", r1, " + ", r2, "= ?\n")
            theInput = input("Give me the answer: ")
        except Exception:  ##  KeyboardInterrupt:
            allDead = True
            print("\n\nDeregister " + DAN.profile['d_name'] + " !!!\n",
                  flush=True)
            DAN.deregister()
            sys.stdout = sys.__stdout__
            print(" Thread say Bye bye ---------------", flush=True)
            sys.exit()  ## break  # raise   #  ?
        gotInput = True

        if theInput != 'quit' and theInput != "exit" and int(
                theInput) == answer:
            print("Congraduate!!!!  Will send " + theInput, end="   , ")
            theInput = 0

        elif (int(theInput) < answer):
            print("the answer is bigger\n")
            theInput = 100
            continue
        elif (int(theInput) > answer):
            print("the answer is smaller\n")
            theInput = 100
Пример #30
0
def job_of_send_info():
    global sequence, action_list, send_signal, change, now, last, freq_list
    while (sequence < len(action_list)):

        #Pull data from a device feature called "Dummy_Control"
        #value1=DAN.pull('Dummy_Control')
        #if value1 != None:
        #   send_signal = 1
        #print (value1[0])

        #Push data to a device feature called "Dummy_Sensor"
        # job_of_play_music()

        #change = action_list[sequence]
        #change = int(change[0])
        change = int(freq_list[now]) / 100
        change = int(change)
        # change = change+1
        # change = change % 8
        push_data = [0, 0, 0, 0, 0, 0, 0]
        if (change == 0):
            push_data = [0, 0, 0, 0, 0, 0, 1]
        elif (change == 1):
            push_data = [0, 0, 0, 0, 0, 1, 1]
        elif (change == 2):
            push_data = [0, 0, 0, 0, 1, 1, 1]
        elif (change == 3):
            push_data = [0, 0, 0, 1, 1, 1, 1]
        elif (change == 4):
            push_data = [0, 0, 1, 1, 1, 1, 1]
        elif (change == 5):
            push_data = [0, 1, 1, 1, 1, 1, 1]
        elif (change >= 6):
            push_data = [1, 1, 1, 1, 1, 1, 1]
        else:
            push_data = [0, 0, 0, 0, 0, 0, 0]
        # sequence += 1
        print(change, freq_list[now])
        #color_list = []
        if (beat_strength[sequence] > 6):
            print(beat_strength[sequence])
            if (sequence == len(action_list)):
                DAN.push('music_ctl_i', 0, 0, 0, 0, 0, 0, 0)
            else:
                DAN.push('music_ctl_i', push_data[0], push_data[1],
                         push_data[2], push_data[3], push_data[4],
                         push_data[5], push_data[6])
        last = now
        now = now + 1
        sequence += 1
        time.sleep(float(action_list[now]) - float(action_list[last]))

    # end
    DAN.push('music_ctl_i', 0, 0, 0, 0, 0, 0, 0)
Пример #31
0
        DAN.profile['df_list'].append(t[0])

print('Detected features:')
for f_name in DAN.profile['df_list']:
    print('    {}'.format(f_name))


def LED_flash(LED_state):
    if LED_state:
        client.put('Reg_done', '1')
        os.system(r'echo "timer" > /sys/class/leds/arduino:white:usb/trigger')      #For ArduinoYun Only. LED Blink.
    else:
        client.put('Reg_done', '0')
        os.system(r'echo "none" > /sys/class/leds/arduino:white:usb/trigger')

DAN.device_registration_with_retry(custom.ServerIP)
LED_flash(1)

incomming = {}
for f_name in [t[0] for t in odf_list]:
    incomming[f_name] = 0

reConnecting = 0
while True:
    try:
        cache = {}
	check_list=[t[0] for t in odf_list]
	for f_name, index, pin_name in odf_list:

            if f_name not in cache.keys():
                os.system(r'echo "default-on" > /sys/class/leds/arduino:blue:wlan/trigger')
Пример #32
0
def profile_init():
    DAN.profile['dm_name']='CameraPT'
    DAN.profile['d_name']=DAN.profile['dm_name']+'.'+DAN.get_mac_addr()[-4:]