# Google Maps FleetEngine Delivery V1 Client - Class DeliveryVehicle (0.5.3)

0.5.3 (latest) 0.5.2 0.4.1 0.3.1 0.2.0 0.1.8 Reference documentation and code samples for the Google Maps FleetEngine Delivery V1 Client class DeliveryVehicle.

The `DeliveryVehicle` message. A delivery vehicle transports shipments from a
depot to a delivery location, and from a pickup location to the depot. In
some cases, delivery vehicles also transport shipments directly from the
pickup location to the delivery location.

Note: gRPC and REST APIs use different field naming conventions. For example,
the `DeliveryVehicle.current_route_segment` field in the gRPC API and the
`DeliveryVehicle.currentRouteSegment` field in the REST API refer to the same
field.

Generated from protobuf message `maps.fleetengine.delivery.v1.DeliveryVehicle`

## Namespace

Google \\ Maps \\ FleetEngine \\ Delivery \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` The unique name of this Delivery Vehicle. The format is `providers/{provider}/deliveryVehicles/{vehicle}`. |
| `↳ last_location` | `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicleLocation` The last reported location of the Delivery Vehicle. |
| `↳ past_locations` | `array<https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicleLocation>` Input only. Locations where this Delivery Vehicle has been in the past that haven't yet been reported to Fleet Engine. This is used in `UpdateDeliveryVehicleRequest` to record locations which were previously unable to be sent to the server. Typically this happens when the Delivery Vehicle does not have internet connectivity. |
| `↳ navigation_status` | `int` The Delivery Vehicle's navigation status. |
| `↳ current_route_segment` | `string` The encoded polyline specifying the route that the navigation recommends taking to the next waypoint. Your driver app updates this when a stop is reached or passed, and when the navigation reroutes. These `LatLng`s are returned in `Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path` (gRPC) or `Task.journeySharingInfo.remainingVehicleJourneySegments[0].path` (REST) for all active Tasks assigned to the Vehicle. There are a few cases where this field might not be used to populate `Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path` (gRPC) or `Task.journeySharingInfo.remainingVehicleJourneySegments[0].path` (REST): \* \* The endpoint of the `current_route_segment` does not match `DeliveryVehicle.remaining_vehicle_journey_segments[0].stop` (gRPC) or `DeliveryVehicle.remainingVehicleJourneySegments[0].stop` (REST). \* \* The driver app has not updated its location recently, so the last updated value for this field might be stale. \* \* The driver app has recently updated its location, but the `current_route_segment` is stale, and points to a previous vehicle stop. In these cases, Fleet Engine populates this field with a route from the most recently passed VehicleStop to the upcoming VehicleStop to ensure that the consumer of this field has the best available information on the current path of the Delivery Vehicle. |
| `↳ current_route_segment_end_point` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Type.LatLng.html` The location where the `current_route_segment` ends. This is not currently populated by the driver app, but you can supply it on `UpdateDeliveryVehicle` calls. It is either the `LatLng` from the upcoming vehicle stop, or the last `LatLng` of the `current_route_segment`. Fleet Engine will then do its best to interpolate to an actual `VehicleStop`. This field is ignored in `UpdateDeliveryVehicle` calls if the `current_route_segment` field is empty. |
| `↳ remaining_distance_meters` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Int32Value` The remaining driving distance for the `current_route_segment`. The Driver app typically provides this field, but there are some circumstances in which Fleet Engine will override the value sent by the app. For more information, see [DeliveryVehicle.current_route_segment](https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicle#_Google_Maps_FleetEngine_Delivery_V1_DeliveryVehicle__getCurrentRouteSegment__). This field is returned in `Task.remaining_vehicle_journey_segments[0].driving_distance_meters` (gRPC) or `Task.remainingVehicleJourneySegments[0].drivingDistanceMeters` (REST) for all active `Task`s assigned to the Delivery Vehicle. Fleet Engine ignores this field in `UpdateDeliveryVehicleRequest` if the `current_route_segment` field is empty. |
| `↳ remaining_duration` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` The remaining driving time for the `current_route_segment`. The Driver app typically provides this field, but there are some circumstances in which Fleet Engine will override the value sent by the app. For more information, see [DeliveryVehicle.current_route_segment](https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicle#_Google_Maps_FleetEngine_Delivery_V1_DeliveryVehicle__getCurrentRouteSegment__). This field is returned in `Task.remaining_vehicle_journey_segments[0].driving_duration` (gRPC) or `Task.remainingVehicleJourneySegments[0].drivingDuration` (REST) for all active tasks assigned to the Delivery Vehicle. Fleet Engine ignores this field in `UpdateDeliveryVehicleRequest` if the `current_route_segment` field is empty. |
| `↳ remaining_vehicle_journey_segments` | `array<https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.VehicleJourneySegment>` The journey segments assigned to this Delivery Vehicle, starting from the Vehicle's most recently reported location. This field won't be populated in the response of `ListDeliveryVehicles`. |
| `↳ attributes` | `array<https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicleAttribute>` A list of custom Delivery Vehicle attributes. A Delivery Vehicle can have at most 100 attributes, and each attribute must have a unique key. |
| `↳ type` | `int` The type of this delivery vehicle. If unset, this will default to `AUTO`. |

### getName

The unique name of this Delivery Vehicle.

The format is `providers/{provider}/deliveryVehicles/{vehicle}`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

The unique name of this Delivery Vehicle.

The format is `providers/{provider}/deliveryVehicles/{vehicle}`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLastLocation

The last reported location of the Delivery Vehicle.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicleLocation|null` |   |

### hasLastLocation

### clearLastLocation

### setLastLocation

The last reported location of the Delivery Vehicle.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicleLocation` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPastLocations

Input only. Locations where this Delivery Vehicle has been in the past that
haven't yet been reported to Fleet Engine. This is used in
`UpdateDeliveryVehicleRequest` to record locations which were previously
unable to be sent to the server. Typically this happens when the Delivery
Vehicle does not have internet connectivity.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicleLocation>` |   |

### setPastLocations

Input only. Locations where this Delivery Vehicle has been in the past that
haven't yet been reported to Fleet Engine. This is used in
`UpdateDeliveryVehicleRequest` to record locations which were previously
unable to be sent to the server. Typically this happens when the Delivery
Vehicle does not have internet connectivity.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicleLocation>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getNavigationStatus

The Delivery Vehicle's navigation status.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setNavigationStatus

The Delivery Vehicle's navigation status.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCurrentRouteSegment

The encoded polyline specifying the route that the navigation recommends
taking to the next waypoint. Your driver app updates this when a
stop is reached or passed, and when the navigation reroutes. These
`LatLng`s are returned in
`Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path`
(gRPC) or `Task.journeySharingInfo.remainingVehicleJourneySegments[0].path`
(REST) for all active Tasks assigned to the Vehicle.

There are a few cases where this field might not be used to populate
`Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path`
(gRPC) or `Task.journeySharingInfo.remainingVehicleJourneySegments[0].path`
(REST):

- The endpoint of the `current_route_segment` does not match `DeliveryVehicle.remaining_vehicle_journey_segments[0].stop` (gRPC) or `DeliveryVehicle.remainingVehicleJourneySegments[0].stop` (REST).
- The driver app has not updated its location recently, so the last updated value for this field might be stale.
- The driver app has recently updated its location, but the `current_route_segment` is stale, and points to a previous vehicle stop. In these cases, Fleet Engine populates this field with a route from the most recently passed VehicleStop to the upcoming VehicleStop to ensure that the consumer of this field has the best available information on the current path of the Delivery Vehicle.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setCurrentRouteSegment

The encoded polyline specifying the route that the navigation recommends
taking to the next waypoint. Your driver app updates this when a
stop is reached or passed, and when the navigation reroutes. These
`LatLng`s are returned in
`Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path`
(gRPC) or `Task.journeySharingInfo.remainingVehicleJourneySegments[0].path`
(REST) for all active Tasks assigned to the Vehicle.

There are a few cases where this field might not be used to populate
`Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path`
(gRPC) or `Task.journeySharingInfo.remainingVehicleJourneySegments[0].path`
(REST):

- The endpoint of the `current_route_segment` does not match `DeliveryVehicle.remaining_vehicle_journey_segments[0].stop` (gRPC) or `DeliveryVehicle.remainingVehicleJourneySegments[0].stop` (REST).
- The driver app has not updated its location recently, so the last updated value for this field might be stale.
- The driver app has recently updated its location, but the `current_route_segment` is stale, and points to a previous vehicle stop. In these cases, Fleet Engine populates this field with a route from the most recently passed VehicleStop to the upcoming VehicleStop to ensure that the consumer of this field has the best available information on the current path of the Delivery Vehicle.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCurrentRouteSegmentEndPoint

The location where the `current_route_segment` ends. This is not currently
populated by the driver app, but you can supply it on
`UpdateDeliveryVehicle` calls. It is either the `LatLng` from the upcoming
vehicle stop, or the last `LatLng` of the `current_route_segment`. Fleet
Engine will then do its best to interpolate to an actual `VehicleStop`.

This field is ignored in `UpdateDeliveryVehicle` calls if the
`current_route_segment` field is empty.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Type.LatLng.html|null` |   |

### hasCurrentRouteSegmentEndPoint

### clearCurrentRouteSegmentEndPoint

### setCurrentRouteSegmentEndPoint

The location where the `current_route_segment` ends. This is not currently
populated by the driver app, but you can supply it on
`UpdateDeliveryVehicle` calls. It is either the `LatLng` from the upcoming
vehicle stop, or the last `LatLng` of the `current_route_segment`. Fleet
Engine will then do its best to interpolate to an actual `VehicleStop`.

This field is ignored in `UpdateDeliveryVehicle` calls if the
`current_route_segment` field is empty.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Type.LatLng.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRemainingDistanceMeters

The remaining driving distance for the `current_route_segment`.

The Driver app typically provides this field, but there are some
circumstances in which Fleet Engine will override the value sent by the
app. For more information, see
[DeliveryVehicle.current_route_segment](https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicle#_Google_Maps_FleetEngine_Delivery_V1_DeliveryVehicle__getCurrentRouteSegment__).
This field is returned in
`Task.remaining_vehicle_journey_segments[0].driving_distance_meters` (gRPC)
or `Task.remainingVehicleJourneySegments[0].drivingDistanceMeters` (REST)
for all active `Task`s assigned to the Delivery Vehicle.
Fleet Engine ignores this field in `UpdateDeliveryVehicleRequest` if the
`current_route_segment` field is empty.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Int32Value|null` |   |

### hasRemainingDistanceMeters

### clearRemainingDistanceMeters

### getRemainingDistanceMetersUnwrapped

Returns the unboxed value from `getRemainingDistanceMeters()`

The remaining driving distance for the `current_route_segment`.
The Driver app typically provides this field, but there are some
circumstances in which Fleet Engine will override the value sent by the
app. For more information, see
[DeliveryVehicle.current_route_segment](https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicle#_Google_Maps_FleetEngine_Delivery_V1_DeliveryVehicle__getCurrentRouteSegment__).
This field is returned in
`Task.remaining_vehicle_journey_segments[0].driving_distance_meters` (gRPC)
or `Task.remainingVehicleJourneySegments[0].drivingDistanceMeters` (REST)
for all active `Task`s assigned to the Delivery Vehicle.
Fleet Engine ignores this field in `UpdateDeliveryVehicleRequest` if the
`current_route_segment` field is empty.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int|null` |   |

### setRemainingDistanceMeters

The remaining driving distance for the `current_route_segment`.

The Driver app typically provides this field, but there are some
circumstances in which Fleet Engine will override the value sent by the
app. For more information, see
[DeliveryVehicle.current_route_segment](https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicle#_Google_Maps_FleetEngine_Delivery_V1_DeliveryVehicle__getCurrentRouteSegment__).
This field is returned in
`Task.remaining_vehicle_journey_segments[0].driving_distance_meters` (gRPC)
or `Task.remainingVehicleJourneySegments[0].drivingDistanceMeters` (REST)
for all active `Task`s assigned to the Delivery Vehicle.
Fleet Engine ignores this field in `UpdateDeliveryVehicleRequest` if the
`current_route_segment` field is empty.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Int32Value` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### setRemainingDistanceMetersUnwrapped

Sets the field by wrapping a primitive type in a Google\\Protobuf\\Int32Value object.

The remaining driving distance for the `current_route_segment`.
The Driver app typically provides this field, but there are some
circumstances in which Fleet Engine will override the value sent by the
app. For more information, see
[DeliveryVehicle.current_route_segment](https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicle#_Google_Maps_FleetEngine_Delivery_V1_DeliveryVehicle__getCurrentRouteSegment__).
This field is returned in
`Task.remaining_vehicle_journey_segments[0].driving_distance_meters` (gRPC)
or `Task.remainingVehicleJourneySegments[0].drivingDistanceMeters` (REST)
for all active `Task`s assigned to the Delivery Vehicle.
Fleet Engine ignores this field in `UpdateDeliveryVehicleRequest` if the
`current_route_segment` field is empty.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int|null` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRemainingDuration

The remaining driving time for the `current_route_segment`.

The Driver app typically provides this field, but there are some
circumstances in which Fleet Engine will override the value sent by the
app. For more information, see
[DeliveryVehicle.current_route_segment](https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicle#_Google_Maps_FleetEngine_Delivery_V1_DeliveryVehicle__getCurrentRouteSegment__).
This field is returned in
`Task.remaining_vehicle_journey_segments[0].driving_duration` (gRPC) or
`Task.remainingVehicleJourneySegments[0].drivingDuration` (REST) for all
active tasks assigned to the Delivery Vehicle.
Fleet Engine ignores this field in `UpdateDeliveryVehicleRequest` if the
`current_route_segment` field is empty.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration|null` |   |

### hasRemainingDuration

### clearRemainingDuration

### setRemainingDuration

The remaining driving time for the `current_route_segment`.

The Driver app typically provides this field, but there are some
circumstances in which Fleet Engine will override the value sent by the
app. For more information, see
[DeliveryVehicle.current_route_segment](https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicle#_Google_Maps_FleetEngine_Delivery_V1_DeliveryVehicle__getCurrentRouteSegment__).
This field is returned in
`Task.remaining_vehicle_journey_segments[0].driving_duration` (gRPC) or
`Task.remainingVehicleJourneySegments[0].drivingDuration` (REST) for all
active tasks assigned to the Delivery Vehicle.
Fleet Engine ignores this field in `UpdateDeliveryVehicleRequest` if the
`current_route_segment` field is empty.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRemainingVehicleJourneySegments

The journey segments assigned to this Delivery Vehicle, starting from the
Vehicle's most recently reported location. This field won't be populated
in the response of `ListDeliveryVehicles`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.VehicleJourneySegment>` |   |

### setRemainingVehicleJourneySegments

The journey segments assigned to this Delivery Vehicle, starting from the
Vehicle's most recently reported location. This field won't be populated
in the response of `ListDeliveryVehicles`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.VehicleJourneySegment>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAttributes

A list of custom Delivery Vehicle attributes. A Delivery Vehicle can have
at most 100 attributes, and each attribute must have a unique key.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicleAttribute>` |   |

### setAttributes

A list of custom Delivery Vehicle attributes. A Delivery Vehicle can have
at most 100 attributes, and each attribute must have a unique key.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/maps-fleetengine-delivery/latest/V1.DeliveryVehicleAttribute>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getType

The type of this delivery vehicle. If unset, this will default to `AUTO`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setType

The type of this delivery vehicle. If unset, this will default to `AUTO`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |