feat: confirm socket controls by readback
This commit is contained in:
@@ -133,6 +133,25 @@ class AbsdkBridge internal constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun commandPower(
|
||||
profileId: ProviderProfileId,
|
||||
deviceName: DeviceName,
|
||||
powerState: SocketPowerState,
|
||||
): DomainResult<Unit> = serialized {
|
||||
withActiveSession(profileId) {
|
||||
when (val control = call {
|
||||
client.setSocketPower(deviceName.value, powerState.toSdkStatus())
|
||||
}) {
|
||||
is ClientCall.Failed -> DomainResult.Failure(control.error)
|
||||
is ClientCall.Completed -> if (control.response.isSuccess()) {
|
||||
DomainResult.Success(Unit)
|
||||
} else {
|
||||
DomainResult.Failure(AbsdkErrorMapper.fromResponse(control.response))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getReading(
|
||||
profileId: ProviderProfileId,
|
||||
deviceName: DeviceName,
|
||||
|
||||
Reference in New Issue
Block a user