public class MockDrive extends Object
DriveInfo
and AccidentInfo
objects returned by the ZendriveSDK
callbacks via ZendriveBroadcastReceiver
.
Currently only onDriveStart
,
onDriveEnd
,
onDriveAnalyzed
and
onAccident
ZendriveSDK callbacks
will be received by the application.
Use MockDrive.Builder
to construct MockDrive
instances.
To build a custom MockDrive
, use MockDrive.Builder.newAutoDrive(long, long)
.
To build a predefined MockDrive
, use MockDrive.Builder.presetMockDrive(android.content.Context, com.zendrive.sdk.testing.mockdrive.PresetTripType)
and one
of the PresetTripType
.
DriveInfo
Modifier and Type | Class and Description |
---|---|
static class |
MockDrive.Builder
A builder for
MockDrive . |
Modifier and Type | Field and Description |
---|---|
List<MockAccidentInfo> |
accidentInfoList
A list of
mockAccidentInfos containing information for sending
onAccident and
onPotentialAccident
callbacks. |
double |
averageSpeed |
double |
distanceMeters |
String |
driveId |
DriveScore |
driveScore |
ZendriveDriveType |
driveType |
long |
endTimeMillis |
ZendriveEventRatings |
eventRatings |
double |
maxSpeed |
long |
onDriveAnalyzedDelayMillis
The duration between the
onDriveEnd callback and the
onDriveAnalyzed callback. |
long |
onDriveEndDelayMillis
The duration between the
end timestamp of the drive and
the onDriveEnd callback. |
long |
onDriveStartDelayMillis
The duration between the
start timestamp of the drive and
the onDriveStart callback. |
PhonePosition |
phonePosition |
long |
startTimeMillis |
ZendriveUserMode |
userMode |
ZendriveVehicleTaggingDetails |
vehicleTaggingDetails |
ZendriveVehicleType |
vehicleType |
List<LocationPointWithTimestamp> |
waypoints |
List<ZendriveEvent> |
zendriveEvents |
Modifier and Type | Method and Description |
---|---|
MockZendriveOperationResult |
simulate(Context context,
long runTimeInSecs)
Starts the simulation of the
MockDrive . |
public final double averageSpeed
public final double maxSpeed
public final double distanceMeters
public final String driveId
public final ZendriveDriveType driveType
public final long startTimeMillis
public final long endTimeMillis
public final List<ZendriveEvent> zendriveEvents
public final DriveScore driveScore
public final ZendriveUserMode userMode
public final List<LocationPointWithTimestamp> waypoints
public final PhonePosition phonePosition
public final ZendriveEventRatings eventRatings
public final ZendriveVehicleTaggingDetails vehicleTaggingDetails
public final ZendriveVehicleType vehicleType
public final long onDriveStartDelayMillis
start timestamp
of the drive and
the onDriveStart
callback.public final long onDriveEndDelayMillis
end timestamp
of the drive and
the onDriveEnd
callback.public final long onDriveAnalyzedDelayMillis
onDriveEnd
callback and the
onDriveAnalyzed
callback.public final List<MockAccidentInfo> accidentInfoList
mockAccidentInfos
containing information for sending
onAccident
and
onPotentialAccident
callbacks.public MockZendriveOperationResult simulate(Context context, long runTimeInSecs)
MockDrive
.
The application will receive the ZendriveSDK callbacks via
ZendriveBroadcastReceiver
at the times configured in the
MockDrive.Builder
.
This method will return quickly and the simulation will continue.
The simulation will stop if the process gets killed for any reason.
This is the typical usage:
MockZendriveOperationResult result = mockDrive.simulate(context, runTimeInSecs);
if (!result.isSuccess()) {
Log.e(result.getErrorCode().name(), result.getErrorMessage());
}
context
- the context
object of the enclosing application.runTimeInSecs
- the duration of simulation in seconds.
Can be set to 0 to run the simulation as fast as possible.result
of the simulate operation. Refer to
MockDriveErrorCode
for the possible error codes.