Exemple #1
0
def get_temp_units_handler(msg_type, data):
    temp = pb.IntegerValue()
    temp.ParseFromString(data)
    if temp.value == 0:
        print "Celcius"
    else:
        print "Farenheight"
Exemple #2
0
 def cmd_get_ble_params(self, msg_num):
     iv = pb.IntegerValue()
     iv.value = 0
     self.send(msg_type=msg_num,
               data=iv.SerializeToString(),
               handler=get_ble_params_handler)
Exemple #3
0
 def cmd_set_temp_units(self, msg_num, degree):
     iv = pb.IntegerValue()
     iv.value = degree
     self.send(msg_type=msg_num,
               data=iv.SerializeToString(),
               handler=set_temp_units_handler)
Exemple #4
0
 def cmd_get_cur_temp(self, msg_num):
     iv = pb.IntegerValue()
     iv.value = 0
     self.send(msg_type=msg_num,
               data=iv.SerializeToString(),
               handler=get_curr_temp_handler)
Exemple #5
0
 def cmd_setpoint(self, msg_num, value):
     iv = pb.IntegerValue()
     iv.value = value
     self.send(msg_type=msg_num,
               data=iv.SerializeToString(),
               handler=set_temp_setpoint_handler)
Exemple #6
0
def get_temp_setpoint_handler(msg_type, data):
    temp = pb.IntegerValue()
    temp.ParseFromString(data)
    print "Setpoint: %d" % temp.value