Exemple #1
0
def reg_test():
	register_device(get_local_ip('eth0'), gen_id_val())
Exemple #2
0
	return id_val[:8]



if __name__ == '__main__':
	#run()
	#reg_test_ip_vals= ['192.168.1.101', '192.168.1.204', '192.168.1.202', '192.168.1.107', '192.168.103', '192.168.1.106']					
	#for ip in reg_test_ip_vals:
		#time.sleep(4)
		#register_device(ip,gen_id_val())
	
	fake_dev_map={}	
	counter = 0
	
	while True and counter < 150:
		time.sleep(1)
		fake_id = gen_fake_id_val()
		fake_dev_map[fake_id] = ' '
		fake_ip = gen_fake_ip(fake_dev_map)
		fake_dev_map[fake_id]=fake_ip
		#print '%s has the ip of %s'%(fake_id,fake_ip)				
		register_device(fake_ip,fake_id)
		
	#reg_test()






Exemple #3
0
def reg_test():
    register_device(get_local_ip('eth0'), gen_id_val())
Exemple #4
0
    return root_add


#generates a fake ID value
def gen_fake_id_val():
    id_val = hashlib.md5(str(random.random())).hexdigest()
    return id_val[:8]


if __name__ == '__main__':
    #run()
    #reg_test_ip_vals= ['192.168.1.101', '192.168.1.204', '192.168.1.202', '192.168.1.107', '192.168.103', '192.168.1.106']
    #for ip in reg_test_ip_vals:
    #time.sleep(4)
    #register_device(ip,gen_id_val())

    fake_dev_map = {}
    counter = 0

    while True and counter < 150:
        time.sleep(1)
        fake_id = gen_fake_id_val()
        fake_dev_map[fake_id] = ' '
        fake_ip = gen_fake_ip(fake_dev_map)
        fake_dev_map[fake_id] = fake_ip
        #print '%s has the ip of %s'%(fake_id,fake_ip)
        register_device(fake_ip, fake_id)

    #reg_test()
Exemple #5
0
            values_dict[n] = 'N/A'

    return values_dict


if __name__ == '__main__':
    #get the id_val of the device
    dev_id = gen_id_val()
    device = connect_phidget()
    #We can use a timer thread for this.. just wanted to keep it simple for
    #my own sake.
    while True:
        sleep(3)
        device.setOutputState(0, 0)
        #getting the IP here, don't really need to do this after some recent updates
        ip_addy = get_local_ip('eth0')
        log_info('IP is: %s' % ip_addy)
        register_device(ip_addy, dev_id)
        sensor_data = check_sensors(device)
        log_info(sensor_data)
        response = put_value_change(dev_id, sensor_data, True)
        if response == 0:
            device.setOutputState(0, 1)
    device.closePhidget()

#Only here to block until user keyboard input, which will end the program.
#character = str(raw_input())

#we have to close the phidget after we are done..
#device.closePhidget()
Exemple #6
0
			values_dict[n] = 'N/A'

	return values_dict

if __name__ == '__main__':
	#get the id_val of the device
	dev_id = gen_id_val()
	device = connect_phidget()
	#We can use a timer thread for this.. just wanted to keep it simple for
	#my own sake.
	while True:
		sleep(3)
		device.setOutputState(0,0)
		#getting the IP here, don't really need to do this after some recent updates
		ip_addy = get_local_ip('eth0')
		log_info('IP is: %s'%ip_addy)		
		register_device(ip_addy,dev_id)
		sensor_data = check_sensors(device)
		log_info(sensor_data)
		response = put_value_change(dev_id,sensor_data,True)
		if response == 0:
			device.setOutputState(0,1)
	device.closePhidget()


#Only here to block until user keyboard input, which will end the program.
#character = str(raw_input())

#we have to close the phidget after we are done..
#device.closePhidget()