def eVV_VP_ACK_FAILED(ip, port):
    packet = SocketPacket()
    packet.add_int(VV_VP_ACK_FAILED)
    packet.add_string(ip)
    packet.add_int(port)
    packet.encode_header()
    
    datagram = NetDatagram()
    datagram.appendData('' + packet.get_header() + packet.get_body())
    return datagram
def eVV_ACK_OK(ip, port, client_id):
    packet = SocketPacket()
    packet.add_int(VV_ACK_OK)
    packet.add_string(ip)
    packet.add_int(port)
    packet.add_int(client_id)
    packet.encode_header()
    
    datagram = NetDatagram()
    datagram.appendData('' + packet.get_header() + packet.get_body())
    return datagram
def eVV_READY(ip, port, vv_id):
    packet = SocketPacket()
    packet.add_int(VV_READY)
    packet.add_string(ip)
    packet.add_int(port)
    packet.add_int(vv_id)
    packet.encode_header()
    
    datagram = NetDatagram()
    datagram.appendData('' + packet.get_header() + packet.get_body())
    return datagram
def eVV_REQ_SIGNATURE(ip, port, object_id):
    packet = SocketPacket()
    packet.add_int(VV_REQ_SIGNATURE)
    packet.add_string(ip)
    packet.add_int(port)
    packet.add_int(object_id)
    packet.encode_header()
    
    datagram = NetDatagram()
    datagram.appendData('' + packet.get_header() + packet.get_body())
    return datagram
def eVV_VP_ACK_OK(ip, port, cam_id):
    packet = SocketPacket()
    packet.add_int(VV_VP_ACK_OK)
    packet.add_string(ip)
    packet.add_int(port)
    packet.add_int(cam_id)  ## Added this
    packet.encode_header()

    datagram = NetDatagram()
    datagram.appendData("" + packet.get_header() + packet.get_body())
    return datagram
def eVV_CAM_MESSAGE(ip, port, cam_id, message):
    packet = SocketPacket()
    packet.add_int(VV_CAM_MESSAGE)
    packet.add_string(ip)
    packet.add_int(port)
    packet.add_int(cam_id)
    packet.add_packet(message)
    packet.encode_header()
    
    datagram = NetDatagram()
    datagram.appendData('' + packet.get_header() + packet.get_body())
    return datagram
def eVV_CAM_LIST(ip, port, cam_list):
    packet = SocketPacket()
    packet.add_int(VV_CAM_LIST)
    packet.add_string(ip)
    packet.add_int(port)
    packet.add_int(len(cam_list))
    for cam in cam_list:
      packet.add_int(cam)
    packet.encode_header()
    
    datagram = NetDatagram()
    datagram.appendData('' + packet.get_header() + packet.get_body())
    return datagram
def eVV_REQ_VIDEO_ANALYSIS(ip, port, cam_id, width, height, jpeg):
    packet = SocketPacket()
    packet.add_int(VV_REQ_VIDEO_ANALYSIS)
    packet.add_string(ip)
    packet.add_int(port)
    packet.add_int(cam_id)
    packet.add_int(width)
    packet.add_int(height)
    packet.add_int(jpeg)
    packet.encode_header()
    
    datagram = NetDatagram()
    datagram.appendData('' + packet.get_header() + packet.get_body())
    return datagram
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 eVV_IMG(ip, port, cam_id, width, height, depth, color_code, jpeg, timestamp, image_data):
    packet = SocketPacket()
    packet.add_int(VV_IMG)
    packet.add_string(ip)
    packet.add_int(port)
    packet.add_int(cam_id)
    packet.add_int(width)
    packet.add_int(height)
    packet.add_int(depth)
    packet.add_char(color_code)
    packet.add_bool(jpeg)
    packet.add_double(timestamp)
    packet.add_string(image_data)
    packet.encode_header()

    datagram = NetDatagram()
    datagram.appendData("" + packet.get_header() + packet.get_body())
    return datagram
def eVV_IMG(ip, port, cam_id, width, height, depth, color_code, jpeg, timestamp,
            image_data):
    packet = SocketPacket()
    packet.add_int(VV_IMG)
    packet.add_string(ip)
    packet.add_int(port)
    packet.add_int(cam_id)
    packet.add_int(width)
    packet.add_int(height)
    packet.add_int(depth)
    packet.add_char(color_code)
    packet.add_bool(jpeg)
    packet.add_double(timestamp)
    packet.add_string(image_data)
    packet.encode_header()
    
    datagram = NetDatagram()
    datagram.appendData('' + packet.get_header() + packet.get_body())
    return datagram
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