Capability
Use checkXxxCapabilities to check feature support and allowed ranges. onComplete returns per-feature support information. Return types vary by API; see the capability package for shared models. See Obtaining a domain object for how to get a domain object, and API Reference for detailed API specifications.
This documentation tree describes capability APIs that also return CapabilityConfig.
| Type | Description |
|---|---|
| CapabilityConfig | Per-feature access level (AccessType: NONE, READ, WRITE, READ_WRITE) |
| AreaBounds | Per-area allowed value range (minValue, maxValue) |
Map<Area, AreaBounds> | Map of AreaBounds by area (e.g. DoorArea) |
The examples below assume the Vehicle instance (vehicle) has already been initialized.
- Kotlin
- Java
val door = vehicle.getDoor()
door.checkDoorPositionCapabilities(
onComplete = { config, areaMap ->
when (config.accessType) {
AccessType.READ, AccessType.READ_WRITE -> {
val bounds = areaMap[DoorArea(DoorValue.ROW_1_LEFT)]
// Use bounds?.minValue / bounds?.maxValue, then call getCurrentDoorPosition
}
else -> {
// NONE or WRITE only — disable UI or use an alternate flow
}
}
},
onFailed = { e: Exception ->
if (e is VehicleException) {
// Capability lookup failed: e.errorCode
}
}
)
Door door = vehicle.getDoor();
door.checkDoorPositionCapabilities(
(config, areaMap) -> {
if (config.getAccessType() == AccessType.READ
|| config.getAccessType() == AccessType.READ_WRITE) {
AreaBounds<Integer> bounds = areaMap.get(new DoorArea(DoorValue.ROW_1_LEFT));
// Use bounds.getMinValue() / bounds.getMaxValue(), then call getCurrentDoorPosition
} else {
// NONE or WRITE only — disable UI or use an alternate flow
}
return Unit.INSTANCE;
},
e -> {
if (e instanceof VehicleException) {
// Capability lookup failed: ((VehicleException) e).getErrorCode()
}
return Unit.INSTANCE;
}
);