GMTDVehicleReporter
@interface GMTDVehicleReporter
: NSObject <GMSNavigatorListener, GMSRoadSnappedLocationProviderListener>
Object for sending information to the Fleet Engine backend.
Use this class only from the main thread.
-
Unavailable
This class has no public initializers; obtain this object from the
vehicleReporter
property of theGMTDDeliveryDriverAPI
orGMTDRidesharingDriverAPI
object.Declaration
Objective-C
- (null_unspecified instancetype)init;
-
Indicates whether location tracking is enabled.
If set to YES, trip and vehicle updates are sent to the Fleet Engine backend at a regular interval based on the value set for
locationUpdateInterval
.If set to NO, updates stop and a one-off vehicle update request is sent to the Fleet Engine backend to set the vehicle state to
GMTDVehicleStateOffline
. SeeupdateVehicleState
for special considerations on handling failures whenlocationTrackingEnabled
is set to NO.Declaration
Swift
var locationTrackingEnabled: Bool { get set }
Objective-C
@property (nonatomic) BOOL locationTrackingEnabled;
-
Indicates the minimum interval at which location reports will be delivered to Fleet Engine.
NOTE: The default reporting interval is 10 seconds. The maximum supported value is 60 seconds and the minimum supported value is 5 seconds. If a value outside of this range is used, the requested value is clamped to that range.
Declaration
Swift
var locationReportingInterval: TimeInterval { get set }
Objective-C
@property (nonatomic) NSTimeInterval locationReportingInterval;
-
Updates the vehicle state. Used only for ridesharing.
If
locationTrackingEnabled
is set to NO, setting the state toGMTDVehicleStateOnline
fails.Setting a different state will send a one-off request to the Fleet Engine backend.
This method updates a server-side state, the client app should monitor
-fleetEngine:didSucceedVehicleUpdate:
and-fleetEngine:didFailVehicleUpdate:withError:
to confirm success or failure. Failures are retried automatically iflocationTrackingEnabled
is set to YES.Declaration
Swift
func update(_ vehicleState: GMTDVehicleState)
Objective-C
- (void)updateVehicleState:(GMTDVehicleState)vehicleState;
Parameters
vehicleState
The desired vehicle state.
-
Adds a listener. The listener is held with a weak reference.
Declaration
Swift
func add(_ listener: any GMTDVehicleReporterListener)
Objective-C
- (void)addListener:(nonnull id<GMTDVehicleReporterListener>)listener;
Parameters
listener
An object conforming to the
GMTDVehicleReporterListener
protocol. -
Removes a listener.
Declaration
Swift
func remove(_ listener: any GMTDVehicleReporterListener)
Objective-C
- (void)removeListener:(nonnull id<GMTDVehicleReporterListener>)listener;
Parameters
listener
An object conforming to the
GMTDVehicleReporterListener
protocol.