Skip to content

DrivingBehavior Events

Info

This document is a work in progress.

Currently, Vehicle events contain below events, still working in progress:

  • DrivingBehavior Events
    • Hard Brake Event - Should be sent when a hard brake event is detected based on real time data processing from a variety of sensors.
    • Hard Acceleration Event - Should be sent when a hard acceleration event is detected based on real time data processing from a variety of sensors.
    • Sharp Turn Event - Should be sent when a sharp cornering event is detected based on real time data processing from a variety of sensors.
    • Speeding Event - Should be sent when a speeding event is detected based on real time data processing from a variety of sensors.
    • DriverDistraction Event - Should be sent when a driver distraction event is detected like answer a phone call, based on real time data processing from a variety of sensors.

DrivingBehavior Events

Hard Brake Event

Should be sent when a hard brake event is detected based on real time data processing from a variety of sensors

Key methods:

Method Details
setLevel(LevelType level) Set overall hard brake level, mandatory data field.
setDuration(Long duration) Set duration for current hard brake event in milliseconds, optional data field.
setStartSpeed(VehicleSpeedItem start_speed) The VehicleSpeedItem when event starts, optional data field.
setEndSpeed(VehicleSpeedItem end_speed) The VehicleSpeedItem when event ends, optional data field.
setBrakingDecelItem(BrakingDecelItem braking_decel_item) The BrakingDecelItem during the event, optinal data field.
enum index LevelType
0 LOW
1 MEDIUM
2 HIGH

Sample code

1
2
3
4
5
6
7
8
SendEventRequest.Builder builder = dataCollectorClient.sendEventRequest();
SendEventResponse response = builder
           .setEvent(HardBrakeEvent.builder()
              .setLevel(HardBrakeEvent.LevelType.MEDIUM)
              .setDuration(dt)
              .setStartSpeed(VehicleSpeedItem.builder().setValue(.0).setTimestamp(1597029160173L).build())
              .setEndSpeed(VehicleSpeedItem.builder().setValue(.0).setTimestamp(1597029160173L).build())
              .setBrakingDecelItem(BrakingDecelItem.builder().setDeceleration(-7.0).setTimestamp(1597029160173L).build()).build().execute(); 
1
2
3
4
5
6
7
8
var builder = dataCollectorClient.sendEventRequest()
var response = builder
           .setEvent(HardBrakeEvent.builder()
              .setLevel(HardBrakeEvent.LevelType.MEDIUM)
              .setDuration(dt)
              .setStartSpeed(VehicleSpeedItem.builder().setValue(.0).setTimestamp(1597029160173L).build())
              .setEndSpeed(VehicleSpeedItem.builder().setValue(.0).setTimestamp(1597029160173L).build())
              .setBrakingDecelItem(BrakingDecelItem.builder().setDeceleration(-7.0).setTimestamp(1597029160173L).build()).build().execute()

Response example

1
2
3
4
5
{
  "code": "SUCCESS",
  "message": "SendEventResponse Success",
  "response_time": 1
}

Hard Acceleration Event

Should be sent when a hard acceleration event is detected based on real time data processing from a variety of sensors.

Key methods:

Method Details
setLevel(LevelType level) Set overall hard acceleration level, mandatory data field.
setDuration(Long duration) Set duration for current hard brake event in milliseconds, optional data field.
setStartSpeed(VehicleSpeedItem start_speed) The VehicleSpeedItem when event starts, optional data field.
setEndSpeed(VehicleSpeedItem end_speed) The VehicleSpeedItem when event ends, optional data field.
AcceleratorPedalItem(AcceleratorPedalItem accelerator_pedal_item) The AcceleratorPedalItemduring the event, optinal data field.
enum index LevelType
0 LOW
1 MEDIUM
2 HIGH

Sample code

1
2
3
4
5
6
7
8
SendEventRequest.Builder builder = dataCollectorClient.sendEventRequest();
SendEventResponse response = builder
        .setEvent(HardAccelerationEvent.builder()
              .setLevel(HardAccelerationEvent.LevelType.MEDIUM)
              .setDuration(dt)
              .setStartSpeed(VehicleSpeedItem.builder().setValue(.0).setTimestamp(1597029160173L).build())
              .setEndSpeed(VehicleSpeedItem.builder().setValue(.0).setTimestamp(1597029160173L).build())
              .setAcceleratorPedalItem(AcceleratorPedalItem.builder().setPosition(7).setTimestamp(1597029160173L).build()).build().execute();
1
2
3
4
5
6
7
8
var builder = dataCollectorClient.sendEventRequest()
var response = builder
          .setEvent(HardAccelerationEvent.builder()
              .setLevel(HardAccelerationEvent.LevelType.MEDIUM)
              .setDuration(dt)
              .setStartSpeed(VehicleSpeedItem.builder().setValue(.0).setTimestamp(1597029160173L).build())
              .setEndSpeed(VehicleSpeedItem.builder().setValue(.0).setTimestamp(1597029160173L).build())
              .setAcceleratorPedalItem(AcceleratorPedalItem.builder().setPosition(7).setTimestamp(1597029160173L).build()).build().execute()

Response example

1
2
3
4
5
{
  "code": "SUCCESS",
  "message": "SendEventResponse Success",
  "response_time": 1
}

Sharp Turn Event

Should be sent when updates on current charge state of the vehicle.

Key methods:

Method Details
setLevel(LevelType level) Set overall sharp turn level, mandatory data field.
setDuration(Long duration) Set duration for current hard brake event in milliseconds, optional data field.
setTurnStartHeading(HeadingItem turn_start_heading) The HeadingItem when sharp turn starts, optional data field.
setTurnEndHeading(HeadingItem turn_end_heading) The HeadingItem when sharp turn ends, optional data field.

Sample code

1
2
3
4
5
6
7
8
SendEventRequest.Builder builder = dataCollectorClient.sendEventRequest();
SendEventResponse response = builder
        .setEvent(SharpTurnEvent.builder()
              .setLevel(SharpTurnEvent.LevelType.MEDIUM)
              .setDuration(dt)
              .setTurnStartHeading(HeadingItem.builder().setHeadingAngle(7).setTimestamp(1597029160173L).build())
              .setTurnEndHeading(HeadingItem.builder().setHeadingAngle(7).setTimestamp(1597029160173L).build())
              .build().execute();
1
2
3
4
5
6
7
8
var builder = dataCollectorClient.sendEventRequest()
var response = builder
          .setEvent(SharpTurnEvent.builder()
              .setLevel(SharpTurnEvent.LevelType.MEDIUM)
              .setDuration(dt)
              .setTurnStartHeading(HeadingItem.builder().setHeadingAngle(7).setTimestamp(1597029160173L).build())
              .setTurnEndHeading(HeadingItem.builder().setHeadingAngle(7).setTimestamp(1597029160173L).build())
              .build().execute()

Response example

1
2
3
4
5
{
  "code": "SUCCESS",
  "message": "SendEventResponse Success",
  "response_time": 1
}

Speeding Event

Should be sent when updates on current charge state of the vehicle.

Key methods:

Method Details
setSpeedingStartProbItem(ProbeListItem speeding_start_prob_item) Set ProbeListItem the first gps prob item which exceed the speed limit, mandatory data field.
setSpeedingEndProbItem(ProbeListItem speeding_end_prob_item) Set ProbeListItem the last gps prob item which exceed the speed limit, mandatory data field.
setMaxSpeedProbItem(ProbeListItem max_speed_prob_item) Set ProbeListItem the pgs prob item which record the max speed during this speeding event, optional data field.
setSpeedingDuration(Long speeding_duration) Set Speeding duration in ms, mandatory data field.
setSpeedingDistance(Double speeding_distance) Set Speeding distance in meters, mandatory data field.
setAverageSpeed(Double average_speed) Set Average speed of the device during this speeding item in meters per second, optional data field.
setSpeedDetails(SpeedingItem[] speeding_details) Set list of speeding items, it will describe different speeding phases. i.e. gps1 -> gps2 exceed speeding type LOW, gps3 -> gps4 exceed speeding type MEDIUM.

SpeedingItem

Method Details
setSpeedingStartProbItem(ProbeListItem speeding_start_prob_item) Set ProbeListItem the first gps prob item which exceed the speed limit, mandatory data field.
setSpeedingEndProbItem(ProbeListItem speeding_end_prob_item) Set ProbeListItem the last gps prob item which exceed the speed limit, mandatory data field.
setMaxSpeedProbItem(ProbeListItem max_speed_prob_item) Set ProbeListItem the pgs prob item which record the max speed during this speeding event, optional data field.
setRoadType(RoadType road_type) Set Uniform road type for speeding ranges, mandatory data field.
setSpeedLimit(Double speed_limit) Set Uniform speed limit for speeding ranges, mandatory data field.
setSpeedingType(SpeedingType speeding_type) Set Uniform speeding type for speeding ranges: e.g. LOW/MEDIUM/HIGH. For speed limit 65(mile), exceeding limit with 5 mile can be considered as LOW, while for speed limit 25(mile), exceeding limit with 5 mile could be considered MEDIUM, mandatory data field.
setSpeedingDuration(Long speeding_duration) Set Speeding duration in ms, mandatory data field.
setSpeedingDistance(Double speeding_distance) Set Speeding distance in meters, mandatory data field.
setAverageSpeed(Double average_speed) Set Average speed of the device during this speeding item in meters per second, mandatory data field.
setSpeedDetails(Double[] speeding_details) Set list of speeding items, it will describe different speeding phases. i.e. gps1 -> gps2 exceed speeding type LOW, gps3 -> gps4 exceed speeding type MEDIUM, optional data field.
enum index RoadType
1 FREEWAY
2 HIGHWAY
1 URBANHWY
3 THROUGHWAY
101 NATIONAL
102 MAINDISTRICT
4 LOCAL
5 FRONTAGE
6 LOWSPEED
7 PRIVATE
8 WALKWAY
9 NONNAVIGABLE
10 SHIPFERRY
11 TRAINFERRY
12 PUBLICVEHICLE
103 CARPOOL
14 LAYOUT
13 RESERVED
105 INVALID
enum index SpeedingType
0 LOW
1 MEDIUM
2 HIGH

Sample code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
SendEventRequest.Builder builder = dataCollectorClient.sendEventRequest();
SendEventResponse response = builder
    .setEvent(SpeedingEvent.builder()
    .setSpeedingStartProbItem(ProbeListItem.builder().setLat(37.123456).setLon(122.123456).setTimestamp(1597029160170L).build())
    .setSpeedingEndProbItem(ProbeListItem.builder().setLat(37.123456).setLon(122.123456).setTimestamp(1597029160180L).build())
    .setMaxSpeedProbItem(ProbeListItem.builder().setLat(37.123456).setLon(122.123456).setTimestamp(1597029160177L).build())
    .setSpeedingDuration(7L)
    .setSpeedingDistance(7.0)
    .setAverageSpeed(7.0)
    .setSpeedDetails(new SpeedingItem[] {
        SpeedingItem.builder()
        .setSpeedingStartProbItem(ProbeListItem.builder().setLat(37.123456).setLon(122.123456).setTimestamp(1597029160170L).build())
        .setSpeedingEndProbItem(ProbeListItem.builder().setLat(37.123456).setLon(122.123456).setTimestamp(1597029160180L).build())
        .setMaxSpeedProbItem(ProbeListItem.builder().setLat(37.123456).setLon(122.123456).setTimestamp(1597029160177L).build())
        .setRoadType(RoadType.HIGHWAY)
        .setSpeedLimit(77.0)
        .setSpeedingType(SpeedingItem.SpeedingType.HIGH)
        .setSpeedingDuration(7L)
        .setSpeedingDistance(7.0)
        .setAverageSpeed(7.0)
        .setSpeedDetails(new Double[] {7.0})
        .build()
    }).build().execute();
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var builder = dataCollectorClient.sendEventRequest()
var response = builder
    .setEvent(SpeedingEvent.builder()
    .setSpeedingStartProbItem(ProbeListItem.builder().setLat(37.123456).setLon(122.123456).setTimestamp(1597029160170L).build())
    .setSpeedingEndProbItem(ProbeListItem.builder().setLat(37.123456).setLon(122.123456).setTimestamp(1597029160180L).build())
    .setMaxSpeedProbItem(ProbeListItem.builder().setLat(37.123456).setLon(122.123456).setTimestamp(1597029160177L).build())
    .setSpeedingDuration(7L)
    .setSpeedingDistance(7.0)
    .setAverageSpeed(7.0)
    .setSpeedDetails(arrayof(
        SpeedingItem.builder()
        .setSpeedingStartProbItem(ProbeListItem.builder().setLat(37.123456).setLon(122.123456).setTimestamp(1597029160170L).build())
        .setSpeedingEndProbItem(ProbeListItem.builder().setLat(37.123456).setLon(122.123456).setTimestamp(1597029160180L).build())
        .setMaxSpeedProbItem(ProbeListItem.builder().setLat(37.123456).setLon(122.123456).setTimestamp(1597029160177L).build())
        .setRoadType(RoadType.HIGHWAY)
        .setSpeedLimit(77.0)
        .setSpeedingType(SpeedingItem.SpeedingType.HIGH)
        .setSpeedingDuration(7L)
        .setSpeedingDistance(7.0)
        .setAverageSpeed(7.0)
        .setSpeedDetails(arrayof(7.0))
        .build()))
    .build().execute()

Response example

1
2
3
4
5
{
  "code": "SUCCESS",
  "message": "SendEventResponse Success",
  "response_time": 1
}

DriverDistraction Event

Should be sent when a driver distraction event is detected like answer a phone call, based on real time data processing from a variety of sensors.

Key methods:

Method Details
setDistractionType(DistractionType distraction_type) Set distraction type, mandatory data field.
setDuration(Long duration) Set distraction duration in millisecond, optional data field.
setDistance(Double distance) Set distraction distance in meters, optional data field.
setSpeed(Double speed) Set average driving speed in meters per second during distraction happened. If there is no speed data available, use negative value, such as -100, optional data field, mandatory data field.
setSpeedLimit(Double speed_limit) Set road speed limit in meters per second when distraction happened, optional data field.
setDistractionStartProbeItem(ProbeListItem distraction_start_probe_item) Set ProbeListItem the first gps prob item of distraction, optional data field.
setDistractionEndProbeItem(ProbeListItem distraction_end_probe_item) Set ProbeListItem the last gps prob item of distraction, optional data field.
enum index DistractionType
0 HAND_HELD_PHONE_CALL
1 HAND_HELD_NON_CALL

Sample code

1
2
3
4
5
6
SendEventRequest.Builder builder = dataCollectorClient.sendEventRequest();
SendEventResponse response = builder
        .setEvent(DriverDistractionEvent.builder()
        .setDistractionType(DriverDistractionEvent.DistractionType.HAND_HELD_NON_CALL)
        .setSpeed(7.0)
        .build().execute();
1
2
3
4
5
6
var builder = dataCollectorClient.sendEventRequest()
var response = builder
.setEvent(DriverDistractionEvent.builder()
.setDistractionType(DriverDistractionEvent.DistractionType.HAND_HELD_NON_CALL)
.setSpeed(7.0)
.build().execute()

Response example

1
2
3
4
5
{
  "code": "SUCCESS",
  "message": "SendEventResponse Success",
  "response_time": 1
}