예제 #1
0
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)
예제 #2
0
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("-----------------------------------------------")
예제 #3
0
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
예제 #4
0
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)
예제 #5
0
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)
예제 #6
0
def world_disconnect(world_socket):
    world_command = world_amazon_pb2.ACommands()
    world_command.finished = True
    my_send(world_socket, world_command)