{
  "$id": "https://Orange-OpenSource.github.io/its-client/schema/cam",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "CAM JSon schema",
  "properties": {
    "message": {
      "properties": {
        "basic_container": {
          "properties": {
            "confidence": {
              "$comment": "mandatory on ETSI specification, FIXME?",
              "properties": {
                "altitude": {
                  "$comment": "if not provided, 'altitude' = 15 (unavailable)",
                  "default": 15,
                  "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": {
                  "$comment": "mandatory on ETSI specification, FIXME?",
                  "properties": {
                    "semi_major_confidence": {
                      "$comment": "if not provided, 'semi_major_confidence' = 4095 (unavailable)",
                      "default": 4095,
                      "description": "oneCentimeter(1), outOfRange(4094), unavailable(4095)",
                      "maximum": 4095,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "semi_major_orientation": {
                      "$comment": "if not provided, 'semi_major_orientation' = 3601 (unavailable)",
                      "default": 3601,
                      "description": "wgs84North(0), wgs84East(900), wgs84South(1800), wgs84West(2700), unavailable(3601)",
                      "maximum": 3601,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "semi_minor_confidence": {
                      "$comment": "if not provided, 'semi_minor_confidence' = 4095 (unavailable)",
                      "default": 4095,
                      "description": "oneCentimeter(1), outOfRange(4094), unavailable(4095)",
                      "maximum": 4095,
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "type": "object"
                }
              },
              "type": "object"
            },
            "reference_position": {
              "properties": {
                "altitude": {
                  "default": 800001,
                  "description": "Unit: 0.01 meter. referenceEllipsoidSurface(0), oneCentimeter(1), unavailable(800001)",
                  "maximum": 800001,
                  "minimum": -100000,
                  "type": "integer"
                },
                "latitude": {
                  "default": 900000001,
                  "description": "Unit: 0.1 microdegree. oneMicrodegreeNorth (10), oneMicrodegreeSouth (-10), unavailable(900000001)",
                  "maximum": 900000001,
                  "minimum": -900000000,
                  "type": "integer"
                },
                "longitude": {
                  "default": 1800000001,
                  "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": {
              "$comment": "if not provided, 'station_type' = 0 (unknown)",
              "default": 0,
              "description": "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": [
            "reference_position"
          ],
          "type": "object"
        },
        "generation_delta_time": {
          "description": "time of the reference position in the CAM, considered as time of the CAM generation. TimestampIts mod 65 536. TimestampIts represents an integer value in milliseconds since 2004-01-01T00:00:00:000Z. oneMilliSec(1)",
          "examples": [
            1,
            1245
          ],
          "maximum": 65535,
          "minimum": 0,
          "type": "integer"
        },
        "high_frequency_container": {
          "description": "The basic vehicle container high frequency",
          "properties": {
            "acceleration_control": {
              "description": "Current controlling mechanism for longitudinal movement of the vehicle. Represented as a bit string: brakePedalEngaged (0), gasPedalEngaged (1), emergencyBrakeEngaged (2), collisionWarningEngaged(3), accEngaged(4), cruiseControlEngaged(5), speedLimiterEngaged(6)",
              "example": [
                "0000000",
                "1000000",
                "0000011"
              ],
              "maxLength": 7,
              "minLength": 7,
              "type": "string"
            },
            "confidence": {
              "$comment": "mandatory on ETSI specification, FIXME?",
              "description": "the high frequency container confidence fields. Note that no vehicle_width is defined",
              "properties": {
                "curvature": {
                  "description": "onePerMeter-0-00002 (0), onePerMeter-0-0001 (1), onePerMeter-0-0005 (2), onePerMeter-0-002 (3), onePerMeter-0-01 (4), onePerMeter-0-1 (5), outOfRange (6), unavailable (7)",
                  "maximum": 7,
                  "minimum": 0,
                  "type": "integer"
                },
                "heading": {
                  "$comment": "if not provided, 'heading' = 127 (unavailable)",
                  "default": 127,
                  "description": "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": {
                  "$comment": "if not provided, 'speed' = 127 (unavailable)",
                  "default": 127,
                  "description": "equalOrWithinOneCentimeterPerSec(1), equalOrWithinOneMeterPerSec(100), outOfRange(126), unavailable(127)",
                  "maximum": 127,
                  "minimum": 1,
                  "type": "integer"
                },
                "vehicle_length": {
                  "$comment": "if not provided, 'vehicle_length' = 4 (unavailable)",
                  "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": {
                  "$comment": "if not provided, 'yaw_rate' = 8 (unavailable)",
                  "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"
                }
              },
              "type": "object"
            },
            "curvature": {
              "$comment": "if not provided, 'curvature' = 30001 (unavailable)",
              "default": 1023,
              "description": "straight(0), unavailable(1023)",
              "maximum": 1023,
              "minimum": -1023,
              "type": "integer"
            },
            "curvature_calculation_mode": {
              "$comment": "if not provided, 'curvature_calculation_mode' = 2 (unavailable)",
              "default": 2,
              "description": "It describes whether the yaw rate is used to calculate the curvature: yawRateUsed(0), yawRateNotUsed(1), unavailable(2)",
              "maximum": 2,
              "minimum": 0,
              "type": "integer"
            },
            "drive_direction": {
              "$comment": "if not provided, 'drive_direction' = 2 (unavailable)",
              "default": 2,
              "description": "forward (0), backward (1), unavailable (2)",
              "maximum": 2,
              "minimum": 0,
              "type": "integer"
            },
            "heading": {
              "$comment": "if not provided, 'heading' = 3601 (unavailable)",
              "default": 3601,
              "description": "Unit: 0.1 degree. wgs84North(0), wgs84East(900), wgs84South(1800), wgs84West(2700), unavailable(3601)",
              "maximum": 3601,
              "minimum": 0,
              "type": "integer"
            },
            "lane_position": {
              "description": "offTheRoad(-1), innerHardShoulder(0), innermostDrivingLane(1), secondLaneFromInside(2), outterHardShoulder(14)",
              "maximum": 14,
              "minimum": -1,
              "type": "integer"
            },
            "lateral_acceleration": {
              "description": "Unit: 0.1 m/s2. pointOneMeterPerSecSquaredToRight(-1), pointOneMeterPerSecSquaredToLeft(1), unavailable(161)",
              "maximum": 161,
              "minimum": -160,
              "type": "integer"
            },
            "longitudinal_acceleration": {
              "$comment": "if not provided, 'longitudinal_acceleration' = 161 (unavailable)",
              "default": 161,
              "description": "unit: 0.1 m/s2. pointOneMeterPerSecSquaredForward(1), pointOneMeterPerSecSquaredBackward(-1), unavailable(161)",
              "maximum": 161,
              "minimum": -160,
              "type": "integer"
            },
            "speed": {
              "$comment": "if not provided, 'speed' = 16383 (unavailable)",
              "default": 16383,
              "description": "Unit 0.01 m/s. standstill(0), oneCentimeterPerSec(1), unavailable(16383)",
              "maximum": 16383,
              "minimum": 0,
              "type": "integer"
            },
            "vehicle_length": {
              "$comment": "if not provided, 'vehicle_length' = 1023 (unavailable)",
              "default": 1023,
              "description": "tenCentimeters(1), outOfRange(1022), unavailable(1023)",
              "maximum": 1023,
              "minimum": 1,
              "type": "integer"
            },
            "vehicle_width": {
              "$comment": "if not provided, 'vehicle_width' = 62(unavailable)",
              "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": {
              "$comment": "if not provided, 'yaw_rate' = 32767 (unavailable)",
              "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"
            }
          },
          "type": "object"
        },
        "low_frequency_container": {
          "description": "The basic vehicle container low frequency",
          "properties": {
            "exterior_lights": {
              "description": "Status of the exterior light switches represented as a bit string: lowBeamHeadlightsOn (0), highBeamHeadlightsOn (1), leftTurnSignalOn (2), rightTurnSignalOn (3), daytimeRunningLightsOn (4), reverseLightOn (5), fogLightOn (6), parkingLightsOn (7)",
              "example": [
                "00000000",
                "10011010",
                "00000110"
              ],
              "maxLength": 8,
              "minLength": 8,
              "type": "string"
            },
            "path_history": {
              "description": "the path history, a path with a set of path points",
              "items": {
                "properties": {
                  "path_delta_time": {
                    "description": "time travelled by the detecting ITS-S since the previous detected event point (generation_delta_time). tenMilliSecondsInPast(1)",
                    "maximum": 65535,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "path_position": {
                    "description": "offset position of a detected event point with regards to the previous detected event point (reference_position).",
                    "properties": {
                      "delta_altitude": {
                        "$comment": "if not provided, 'delta_altitude' = 12800 (unavailable)",
                        "default": 12800,
                        "description": "oneCentimeterUp (1), oneCentimeterDown (-1), unavailable(12800)",
                        "maximum": 12800,
                        "minimum": -12700,
                        "type": "integer"
                      },
                      "delta_latitude": {
                        "$comment": "if not provided, 'delta_latitude' = 131072 (unavailable)",
                        "default": 131072,
                        "description": "oneMicrodegreeNorth (10), oneMicrodegreeSouth (-10) , unavailable(131072)",
                        "maximum": 131072,
                        "minimum": -131071,
                        "type": "integer"
                      },
                      "delta_longitude": {
                        "$comment": "if not provided, 'delta_longitude' = 131072 (unavailable)",
                        "default": 131072,
                        "description": "oneMicrodegreeEast (10), oneMicrodegreeWest (-10), unavailable(131072)",
                        "maximum": 131072,
                        "minimum": -131071,
                        "type": "integer"
                      }
                    },
                    "type": "object"
                  }
                },
                "required": [
                  "path_position"
                ],
                "type": "object"
              },
              "maxItems": 40,
              "type": "array"
            },
            "vehicle_role": {
              "$comment": "if not provided, 'vehicle_role' = 0 (default)",
              "default": 0,
              "description": "default(0), publicTransport(1), specialTransport(2), dangerousGoods(3), roadWork(4), rescue(5), emergency(6), safetyCar(7), agriculture(8),commercial(9),military(10),roadOperator(11),taxi(12), reserved1(13), reserved2(14), reserved3(15)",
              "maximum": 15,
              "minimum": 0,
              "type": "integer"
            }
          },
          "required": [
            "exterior_lights",
            "path_history"
          ],
          "type": "object"
        },
        "protocol_version": {
          "description": "version of the ITS message and/or communication protocol",
          "examples": [
            1
          ],
          "maximum": 255,
          "minimum": 0,
          "type": "integer"
        },
        "station_id": {
          "description": "identifier for an ITS-S",
          "examples": [
            1,
            42
          ],
          "maximum": 4294967295,
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "protocol_version",
        "station_id",
        "generation_delta_time",
        "basic_container",
        "high_frequency_container"
      ],
      "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",
      "examples": [
        "UNKNOWN",
        "42"
      ],
      "type": "string"
    },
    "timestamp": {
      "description": "Unit: millisecond. The timestamp when the message was generated since Unix Epoch (1970/01/01)",
      "examples": [
        1574778515424
      ],
      "maximum": 1830297600000,
      "minimum": 1514764800000,
      "type": "integer"
    },
    "type": {
      "const": "cam",
      "description": "message type",
      "type": "string"
    },
    "version": {
      "const": "1.1.3",
      "description": "json message format version",
      "type": "string"
    }
  },
  "required": [
    "type",
    "origin",
    "version",
    "source_uuid",
    "timestamp",
    "message"
  ],
  "type": "object"
}