{
  "$id": "https://tigroo31.github.io/its-client/schema/cam",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "CPM JSon schema",
  "properties": {
    "message": {
      "properties": {
        "generation_delta_time": {
          "description": "Unit: millisecond. Time of the reference position in the CPM, considered as time of the CPM generation. TimestampIts mod 65 536. TimestampIts represents an integer value in milliseconds since 2004-01-01T00:00:00:000Z",
          "maximum": 65535,
          "minimum": 0,
          "type": "integer"
        },
        "management_container": {
          "properties": {
            "confidence": {
              "properties": {
                "altitude": {
                  "description": "alt-000-01 (0), alt-000-02 (1), alt-000-05 (2), alt-000-10 (3), alt-000-20 (4), alt-000-50 (5), alt-001-00 (6), alt-002-00 (7), alt-005-00 (8), alt-010-00 (9), alt-020-00 (10), alt-050-00 (11), alt-100-00 (12), alt-200-00 (13), outOfRange (14), unavailable (15)",
                  "maximum": 15,
                  "minimum": 0,
                  "type": "integer"
                },
                "position_confidence_ellipse": {
                  "properties": {
                    "semi_major_confidence": {
                      "description": "Unit: 1 cm. oneCentimeter(1), outOfRange(4094), unavailable(4095)",
                      "maximum": 4095,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "semi_major_orientation": {
                      "description": "Unit: 0.1 degree. wgs84North(0), wgs84East(900), wgs84South(1800), wgs84West(2700), unavailable(3601)",
                      "maximum": 3601,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "semi_minor_confidence": {
                      "description": "Unit: 1 cm. oneCentimeter(1), outOfRange(4094), unavailable(4095)",
                      "maximum": 4095,
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "semi_major_confidence",
                    "semi_minor_confidence",
                    "semi_major_orientation"
                  ],
                  "type": "object"
                }
              },
              "required": [
                "position_confidence_ellipse",
                "altitude"
              ],
              "type": "object"
            },
            "reference_position": {
              "properties": {
                "altitude": {
                  "description": "Unit: 0.01 meter. referenceEllipsoidSurface(0), oneCentimeter(1), unavailable(800001)",
                  "maximum": 800001,
                  "minimum": -100000,
                  "type": "integer"
                },
                "latitude": {
                  "description": "Unit: 0.1 microdegree. oneMicrodegreeNorth (10), oneMicrodegreeSouth (-10), unavailable(900000001)",
                  "maximum": 900000001,
                  "minimum": -900000000,
                  "type": "integer"
                },
                "longitude": {
                  "description": "Unit: 0.1 microdegree. oneMicrodegreeEast (10), oneMicrodegreeWest (-10), unavailable(1800000001)",
                  "maximum": 1800000001,
                  "minimum": -1800000000,
                  "type": "integer"
                }
              },
              "required": [
                "latitude",
                "longitude",
                "altitude"
              ],
              "type": "object"
            },
            "station_type": {
              "description": "Station type of the originating ITS-S. unknown(0), pedestrian(1), cyclist(2), moped(3), motorcycle(4), passengerCar(5), bus(6), lightTruck(7), heavyTruck(8), trailer(9), specialVehicles(10), tram(11), roadSideUnit(15)",
              "maximum": 255,
              "minimum": 0,
              "type": "integer"
            }
          },
          "required": [
            "station_type",
            "reference_position",
            "confidence"
          ],
          "type": "object"
        },
        "message_id": {
          "description": "Type of ITS message",
          "maximum": 255,
          "minimum": 0,
          "type": "integer"
        },
        "number_of_perceived_objects": {
          "description": "The number of perceived objects by the transmitting ITS-S. This number does not have to match up with the number of objects included in the transmitted message due to the object inclusion scheme. ",
          "maximum": 255,
          "minimum": 0,
          "type": "integer"
        },
        "perceived_object_container": {
          "description": "List of information for individual perceived object",
          "items": {
            "properties": {
              "distance": {
                "properties": {
                  "x_distance": {
                    "description": "Unit: 0.01 meter. Distance value to detected object from the ITS-S's reference point in x-direction at the time of measurement; zeroPointZeroOneMeter(1), oneMeter(100)",
                    "maximum": 132767,
                    "minimum": -132768,
                    "type": "integer"
                  },
                  "y_distance": {
                    "description": "Unit: 0.01 meter. Distance value to detected object from the ITS-S's reference point in y-direction at the time of measurement; zeroPointZeroOneMeter(1), oneMeter(100)",
                    "maximum": 132767,
                    "minimum": -132768,
                    "type": "integer"
                  }
                },
                "required": [
                  "x_distance",
                  "y_distance"
                ],
                "type": "object"
              },
              "distance_confidence": {
                "properties": {
                  "x_distance": {
                    "description": "Unit: 0.01 meter. Distance confidence to detected object from the ITS-S's reference point in x-direction at the time of measurement; zeroPointZeroOneMeter(1), oneMeter(100), outOfRange(101), unavailable(102)",
                    "maximum": 102,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "y_distance": {
                    "description": "Unit: 0.01 meter. Distance confidence to detected object from the ITS-S's reference point in y-direction at the time of measurement; zeroPointZeroOneMeter(1), oneMeter(100), outOfRange(101), unavailable(102)",
                    "maximum": 102,
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "x_distance",
                  "y_distance"
                ],
                "type": "object"
              },
              "object_confidence": {
                "default": 0,
                "description": "The confidence associated to the object; unknown(0), onePercent(1), oneHundredPercent(100),unavailable(101)",
                "maximum": 101,
                "minimum": 0,
                "type": "integer"
              },
              "object_id": {
                "description": "Identifier assigned to a detected object",
                "maximum": 255,
                "minimum": 0,
                "type": "integer"
              },
              "object_ref_point": {
                "default": 0,
                "description": "The reference point on the perceived object relative to which the measurement data is provided. In case no object reference - point can be determined, it is assumed to be the center point of the detected object. {mid(0), bottomLeft(1), midLeft(2), topLeft(3), bottomMid(4), topMid(5), bottomRight(6), midRight(7), topRight(8)",
                "maximum": 8,
                "minimum": 0,
                "type": "integer"
              },
              "speed": {
                "properties": {
                  "x_speed": {
                    "description": "Unit: 0.01 m/s. Speed value of detected object from the ITS-S's reference point in x-direction at the time of measurement; standstill(0), oneCentimeterPerSec(1),unavailable(16383)",
                    "maximum": 16383,
                    "minimum": -16383,
                    "type": "integer"
                  },
                  "y_speed": {
                    "description": "Unit: 0.01 m/s. Speed value of detected object from the ITS-S's reference point in y-direction at the time of measurement; standstill(0), oneCentimeterPerSec(1),unavailable(16383)",
                    "maximum": 16383,
                    "minimum": -16383,
                    "type": "integer"
                  }
                },
                "required": [
                  "x_speed",
                  "y_speed"
                ],
                "type": "object"
              },
              "speed_confidence": {
                "properties": {
                  "x_speed": {
                    "description": "Unit: 0.01 m/s. Speed confidence of detected object from the ITS-S's reference point in x-direction at the time of measurement; equalOrWithinOneCentimeterPerSec(1),equalOrWithinOneMeterPerSec(100), outOfRange(126), unavailable(127)",
                    "maximum": 127,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "y_speed": {
                    "description": "Unit: 0.01 m/s. Speed confidence of detected object from the ITS-S's reference point in y-direction at the time of measurement; equalOrWithinOneCentimeterPerSec(1),equalOrWithinOneMeterPerSec(100), outOfRange(126), unavailable(127)",
                    "maximum": 127,
                    "minimum": 1,
                    "type": "integer"
                  }
                },
                "required": [
                  "x_speed",
                  "y_speed"
                ],
                "type": "object"
              },
              "time_of_measurement": {
                "description": "Unit: milliseconds. Time difference from the message's generation delta time to the time of the measurement of the object",
                "maximum": 1500,
                "minimum": -1500,
                "type": "integer"
              }
            },
            "required": [
              "object_id",
              "time_of_measurement",
              "object_confidence",
              "distance",
              "distance_confidence",
              "speed",
              "speed_confidence",
              "object_ref_point"
            ],
            "type": "object"
          },
          "maxItems": 128,
          "minItems": 0,
          "type": "array"
        },
        "protocol_version": {
          "description": "Version of the ITS message and/or communication protocol",
          "maximum": 255,
          "minimum": 0,
          "type": "integer"
        },
        "sensor_information_container": {
          "description": "List of information for individual sensor(s) which are mounted to a a vehicle or roadside",
          "items": {
            "properties": {
              "detection_area": {
                "properties": {
                  "vehicle_sensor": {
                    "properties": {
                      "ref_point_id": {
                        "default": 0,
                        "description": "Increasing counter of the trailer reference point (corresponding to the hitch point)",
                        "maximum": 255,
                        "minimum": 0,
                        "type": "integer"
                      },
                      "vehicle_sensor_property_list": {
                        "description": "List of information for individual sensor(s) which are mounted to a a vehicle or roadside",
                        "items": {
                          "properties": {
                            "horizontal_opening_angle_end": {
                              "description": "Unit: 0.1 degrees. End of the sensor's horizontal OpeningAngle extension relative to the body of the vehicle. The value is provided with respect to a body-fixed coordinate system according to the ISO 8855 [i.2] specification with angles counted positive in the counter-clockwise direction starting from the X-axis. The opening angle always extends from the horizontalOpeningAngleStart to the horizontalOpeningAngleEnd in counter-clockwise direction. zeroPointOneDegree(1), oneDegree(10), unavailable(3601)",
                              "maximum": 3601,
                              "minimum": 0,
                              "type": "integer"
                            },
                            "horizontal_opening_angle_start": {
                              "description": "Unit: 0.1 degrees. Start of the sensor's horizontal OpeningAngle extension relative to the body of the vehicle. The value is provided with respect to a body-fixed coordinate system according to the ISO 8855 [i.2] specification with angles counted positive in the counter-clockwise direction starting from the X-axis. The opening angle always extends from the horizontalOpeningAngleStart to horizontalOpeningAngleEnd in counter-clockwise direction. zeroPointOneDegree(1), oneDegree(10), unavailable(3601)",
                              "maximum": 3601,
                              "minimum": 0,
                              "type": "integer"
                            },
                            "range": {
                              "description": "Unit: 0.1 meter. Range of sensor within the indicated azimuth angle defined by the start and end opening angle. zeroPointOneMeter(1), oneMeter(10)",
                              "maximum": 10000,
                              "minimum": 0,
                              "type": "integer"
                            },
                            "vertical_opening_angle_end": {
                              "description": "Unit: 0.1 degrees. End of the sensor's vertical OpeningAngle extension. This is an optional DE. The angle refers to a rotation about the y-axis of a sensor-specific coordinate system with its origin located at the location defined by the offset. The X-axis of the sensor's coordinate system points in the direction of half of the horizontalOpeningAngle. zeroPointOneDegree(1), oneDegree(10), unavailable(3601)",
                              "maximum": 3601,
                              "minimum": 0,
                              "type": "integer"
                            },
                            "vertical_opening_angle_start": {
                              "description": "Unit: 0.1 degrees. Start of the sensor's vertical OpeningAngle extension. This is an optional DE. The angle refers to a rotation about the y-axis of a sensor-specific coordinate system with its origin located at the location defined by the offset. The x-axis of the sensor's coordinate system points in the direction of half of the horizontalOpeningAngle. zeroPointOneDegree(1), oneDegree(10), unavailable(3601)",
                              "maximum": 3601,
                              "minimum": 0,
                              "type": "integer"
                            }
                          },
                          "required": [
                            "range",
                            "horizontal_opening_angle_start",
                            "horizontal_opening_angle_end"
                          ],
                          "type": "object"
                        },
                        "maxItems": 10,
                        "minItems": 1,
                        "type": "array"
                      },
                      "x_sensor_offset": {
                        "description": "Unit: 0.01 meter. Mounting position of sensor in negative x-direction from Reference Point indicated by the refPointID. negativeZeroPointZeroOneMeter(-1), negativeOneMeter(-100)",
                        "maximum": 0,
                        "minimum": -5000,
                        "type": "integer"
                      },
                      "y_sensor_offset": {
                        "description": "Unit: 0.01 meter. Mounting position of sensor in y-direction from Reference Point indicated by the refPointID. zeroPointZeroOneMeter(1), oneMeter(100). zeroPointZeroOneMeter(1), oneMeter(100)",
                        "maximum": 1000,
                        "minimum": -1000,
                        "type": "integer"
                      },
                      "z_sensor_offset": {
                        "description": "Unit: 0.01 meter. Mounting position of sensor in z-direction from Reference Point indicated by the refPointID",
                        "maximum": 1000,
                        "minimum": 0,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "ref_point_id",
                      "x_sensor_offset",
                      "y_sensor_offset",
                      "vehicle_sensor_property_list"
                    ],
                    "type": "object"
                  }
                },
                "type": "object"
              },
              "sensor_id": {
                "description": "Sensor identifier",
                "maximum": 255,
                "minimum": 0,
                "type": "integer"
              },
              "type": {
                "description": "Type of attached sensor. undefined(0), radar(1), lidar(2), monovideo(3), stereovision(4), nightvision(5), ultrasonic(6), pmd(7), fusion(8), inductionloop(9), sphericalCamera(10), itssaggregation(11)",
                "maximum": 15,
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "sensor_id",
              "type",
              "detection_area"
            ],
            "type": "object"
          },
          "maxItems": 128,
          "minItems": 1,
          "type": "array"
        },
        "station_data_container": {
          "properties": {
            "originating_rsu_container": {
              "properties": {
                "intersection_reference_id": {
                  "properties": {
                    "intersection_id": {
                      "description": "Intersection id. Unique within that region.",
                      "maximum": 4294967295,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "road_regulator_id": {
                      "description": "Road regulator id. When is present the intersection_id is guaranteed to be globally unique.",
                      "maximum": 4294967295,
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "intersection_id"
                  ],
                  "type": "object"
                },
                "road_segment_reference_id": {
                  "description": "Intersection id. Unique within that region.",
                  "maximum": 4294967295,
                  "minimum": 0,
                  "type": "integer"
                }
              },
              "type": "object"
            },
            "originating_vehicle_container": {
              "properties": {
                "confidence": {
                  "properties": {
                    "heading": {
                      "description": "Unit: 0.1 degree. Heading accuracy of the vehicle movement of the originating ITS-S with regards to the true north; equalOrWithinZeroPointOneDegree (1), equalOrWithinOneDegree (10), outOfRange(126), unavailable(127)",
                      "maximum": 127,
                      "minimum": 1,
                      "type": "integer"
                    },
                    "lateral_acceleration": {
                      "description": "Unit: 0,1 m/s2. pointOneMeterPerSecSquared(1), outOfRange(101), unavailable(102)",
                      "maximum": 102,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "longitudinal_acceleration": {
                      "description": "pointOneMeterPerSecSquared(1), outOfRange(101), unavailable(102)",
                      "maximum": 102,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "speed": {
                      "description": "Unit: 0.01 m/s. Speed accuracy of the originating ITS-S; equalOrWithinOneCentimeterPerSec(1), equalOrWithinOneMeterPerSec(100), outOfRange(126), unavailable(127)",
                      "maximum": 127,
                      "minimum": 1,
                      "type": "integer"
                    },
                    "vehicle_length": {
                      "default": 4,
                      "description": "noTrailerPresent(0), trailerPresentWithKnownLength(1), trailerPresentWithUnknownLength(2), trailerPresenceIsUnknown(3), unavailable(4)",
                      "maximum": 4,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "vertical_acceleration": {
                      "description": "Unit: 0,1 m/s2. pointOneMeterPerSecSquared(1), outOfRange(101), unavailable(102)",
                      "maximum": 102,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "yaw_rate": {
                      "default": 8,
                      "description": "degSec-000-01 (0), degSec-000-05 (1), degSec-000-10 (2), degSec-001-00 (3), degSec-005-00 (4), degSec-010-00 (5), degSec-100-00 (6), outOfRange (7), unavailable (8)",
                      "maximum": 8,
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "heading",
                    "speed"
                  ],
                  "type": "object"
                },
                "drive_direction": {
                  "default": 2,
                  "description": "forward (0), backward (1), unavailable (2)",
                  "maximum": 2,
                  "minimum": 0,
                  "type": "integer"
                },
                "heading": {
                  "description": "Unit: 0.1 degree. Heading of the vehicle movement of the originating ITS-S with regards to the true north; wgs84North(0), wgs84East(900), wgs84South(1800), wgs84West(2700), unavailable(3601)",
                  "maximum": 3601,
                  "minimum": 0,
                  "type": "integer"
                },
                "lateral_acceleration": {
                  "description": "Unit: 0.1 m/s2. pointOneMeterPerSecSquaredToRight(-1), pointOneMeterPerSecSquaredToLeft(1), unavailable(161)",
                  "maximum": 161,
                  "minimum": -160,
                  "type": "integer"
                },
                "longitudinal_acceleration": {
                  "default": 161,
                  "description": "unit: 0,1 m/s2. pointOneMeterPerSecSquaredForward(1), pointOneMeterPerSecSquaredBackward(-1), unavailable(161)",
                  "maximum": 161,
                  "minimum": -160,
                  "type": "integer"
                },
                "speed": {
                  "description": "Unit: 0.01 m/s. Driving speed of the originating ITS-S; standstill(0), oneCentimeterPerSec(1), unavailable(16383)",
                  "maximum": 16383,
                  "minimum": 0,
                  "type": "integer"
                },
                "vehicle_length": {
                  "default": 1023,
                  "description": "tenCentimeters(1), outOfRange(1022), unavailable(1023)",
                  "maximum": 1023,
                  "minimum": 1,
                  "type": "integer"
                },
                "vehicle_width": {
                  "default": 62,
                  "description": "tenCentimeters(1), outOfRange(61), unavailable(62)",
                  "maximum": 62,
                  "minimum": 1,
                  "type": "integer"
                },
                "vertical_acceleration": {
                  "description": "Unit: 0.1 m/s2. pointOneMeterPerSecSquaredUp(1), pointOneMeterPerSecSquaredDown(-1), unavailable(161)",
                  "maximum": 161,
                  "minimum": -160,
                  "type": "integer"
                },
                "yaw_rate": {
                  "default": 32767,
                  "description": "Unit: 0,01 degree/s: straight(0), degSec-000-01ToRight(-1), degSec-000-01ToLeft(1), unavailable(32767)",
                  "maximum": 32767,
                  "minimum": -32766,
                  "type": "integer"
                }
              },
              "required": [
                "heading",
                "speed",
                "confidence"
              ],
              "type": "object"
            }
          },
          "type": "object"
        },
        "station_id": {
          "description": "Identifier for an ITS-S",
          "maximum": 4294967295,
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "protocol_version",
        "station_id",
        "message_id",
        "generation_delta_time",
        "management_container",
        "number_of_perceived_objects"
      ],
      "type": "object"
    },
    "origin": {
      "description": "The entity responsible for this message",
      "enum": [
        "self",
        "global_application",
        "mec_application",
        "on_board_application"
      ],
      "type": "string"
    },
    "source_uuid": {
      "description": "Identifier",
      "type": "string"
    },
    "timestamp": {
      "description": "Unit: millisecond. The timestamp when the message was generated since Unix Epoch (1970/01/01)",
      "maximum": 1830297600000,
      "minimum": 1514764800000,
      "type": "integer"
    },
    "type": {
      "const": "cpm",
      "description": "message type",
      "type": "string"
    },
    "version": {
      "const": "1.0.1",
      "description": "json message format version",
      "type": "string"
    }
  },
  "required": [
    "type",
    "origin",
    "version",
    "source_uuid",
    "timestamp",
    "message"
  ],
  "type": "object"
}