def login_response(pack): login_boolean = parseBoolean(pack.data["login"]) connection.timestamp = time.time() if login_boolean: rpc.send("main", "access", bol=login_boolean) if not login_boolean: rpc.send("main", "access", bol=login_boolean)
def dbcheck_press_callback(self, widget, data=None): session = get_session() create_tables() session.bind session.query(User).all() user = unicode(userText.get_text()) pw = unicode(passText.get_text()) login = str(packet.Packet("login", username=user, password=pw)) print rpc.send("qos", "add_packet", packet=login)
def main(): rpc.set_name("rpcsender") #context = gpsbt.start() # ensure that GPS device is ready to connect and to receive commands time.sleep(2) #gpsdevice = gpsbt.gps() start_lon = 15.5775752 start_lat = 58.4065800 rad = 0.003 angle_step = 0.1 angle = 0 rad2 = 0.005 angle_step2 = 0.04 angle2 = 0 while True: ''' #read 3 times and show information for a in range(4): gpsdevice.get_fix() time.sleep(15) while gpsdevice.get_position() == (0,0): time.sleep(1) lat,lon = gpsdevice.get_position() print lon print lat ''' lon = start_lon + 2*rad*math.sin(angle) lon = lon + 2*rad2*math.sin(angle2) print "lon:",lon lat = start_lat + rad*math.cos(angle) lat = lat + rad2*math.cos(angle2) print "lat:",lat angle = angle + angle_step if angle > 2*math.pi: angle - 2*math.pi angle2 = angle2 + angle_step2 if angle2 > 2*math.pi: angle2 - 2*math.pi time.sleep(1) session = get_session() for units in session.query(Unit).filter(Unit.is_self==True): print "Skickar koordinater", time.time() rpc.send("main", "ping_with_coordinates", lon=lon, lat=lat) #gobject.timeout_add(0, rpc.send, "main", "ping_with_coordinates", {"lon":lon, "lat":lat}) print "Klar med skickar koordinater", time.time()
def main(): rpc.set_name("rpcsender") context = gpsbt.start() # ensure that GPS device is ready to connect and to receive commands time.sleep(2) gpsdevice = gpsbt.gps() while True: # read 3 times and show information for a in range(4): gpsdevice.get_fix() time.sleep(15) while gpsdevice.get_position() == (0,0): time.sleep(1) lon, lat = gpsdevice.get_position() print rpc.send("main", "ping_with_coordinates", lon=lon, lat=lat) #stop gps devices gpsbt.stop(context)
def hille_e_tjock(self, widget, data=None): print "tjockade på hille" alarm = str(packet.Packet("alarm", id = "", sub_type = "skogsbrand", name = "Vallarondellen", timestamp = time.time(), poi_id = "", contact_person = "", contact_number = "", other = "")) print rpc.send("qos", "add_packet", packet=alarm)