def send_world(world_socket, world_command, seqnum, world_acks): print("----------------- Send to World ---------------") my_send(world_socket, world_command) while not seqnum in world_acks: time.sleep(RESEND_INTERVAL) print("----------------- Send to World ---------------") my_send(world_socket, world_command)
def ack_back_world(world_socket, seqNum): world_command = world_amazon_pb2.ACommands() world_command.acks.append(seqNum) print("---------------- ACK back to world ------------") my_send(world_socket, world_command) print(world_command) print("-----------------------------------------------")
def connect_world_id(socket, id, wh_info): worldConnection = world_amazon_pb2.AConnect() if id: worldConnection.worldid = int(id) worldConnection.isAmazon = True for wh in wh_info: worldConnection.initwh.add(id=wh['id'], x=wh['x'], y=wh['y']) print(worldConnection) my_send(socket, worldConnection) command = world_amazon_pb2.AConnected() command.ParseFromString(my_recv(socket)) print(command) return command.result
def ack_back_ups(ups_socket, seqnum): ack_command = UA_pb2.AtoUCommand() ack_command.ack.append(seqnum) print("---------------- ACK back to UPS --------------") my_send(ups_socket, ack_command)
def send_ups(ups_socket, au_command, seqnum, ups_acks): while seqnum not in ups_acks: print("------------------ Send to UPS ----------------") my_send(ups_socket, au_command) time.sleep(RESEND_INTERVAL)
def world_disconnect(world_socket): world_command = world_amazon_pb2.ACommands() world_command.finished = True my_send(world_socket, world_command)