def eSYNC_STEP(id, increment):
    packet = SocketPacket()
    packet.add_int(SYNC_STEP)
    packet.add_int(id)
    packet.add_float(increment)
    packet.encode_header()
    
    return packet
def eCAM_TRACK_SIGNATURE(cid, oid, feature_str, elements):
    packet = SocketPacket()
    packet.add_int(CAM_TRACK_SIGNATURE)
    packet.add_int(cid)
    packet.add_int(oid)
    packet.add_string(feature_str)
    packet.add_int(len(elements))
    for element in elements:
        packet.add_float(element)
    packet.encode_header()
    
    return packet
def eVV_TRACK_SIGNATURE(ip, port, object_id, feature_str, sig):
    packet = SocketPacket()
    packet.add_int(VV_TRACK_SIGNATURE)
    packet.add_string(ip)
    packet.add_int(port)
    packet.add_int(object_id)
    packet.add_string(feature_str)
    packet.add_int(len(sig))
    for element in sig:
        packet.add_float(element)
    packet.encode_header()
    
    datagram = NetDatagram()
    datagram.appendData('' + packet.get_header() + packet.get_body())
    return datagram
def eSYNC_REMOTE_CAM_LIST(conn_id, cam_list):
    packet = SocketPacket()
    packet.add_int(SYNC_REMOTE_CAM_LIST)
    packet.add_int(conn_id)
    num_cams = len(cam_list)
    packet.add_int(num_cams)
    for camera in cam_list:
        cid = camera['id']
        type = camera['type']
        position = camera['pos']
        direction = camera['dir']
        packet.add_int(cid)
        packet.add_int(type)
        packet.add_float(position[0])
        packet.add_float(position[1])
        packet.add_float(position[2])
        packet.add_float(direction[0])
        packet.add_float(direction[1])
        packet.add_float(direction[2])
    packet.encode_header()
    
    return packet
def eVV_ADV_CAM_LIST(ip, port, cam_list):
    packet = SocketPacket()
    packet.add_int(VV_ADV_CAM_LIST)
    packet.add_string(ip)
    packet.add_int(port)
    packet.add_int(len(cam_list))
    for camera in cam_list:
        id = camera.getId()
        type = camera.getType()
        position = camera.getPosition()
        direction = camera.getDirection()
        packet.add_int(id)
        packet.add_int(type)
        packet.add_float(position[0])
        packet.add_float(position[1])
        packet.add_float(position[2])
        packet.add_float(direction[0])
        packet.add_float(direction[1])
        packet.add_float(direction[2])
    packet.encode_header()
    
    datagram = NetDatagram()
    datagram.appendData('' + packet.get_header() + packet.get_body())
    return datagram