sensorRead method
Implementation
Future<List<int>> sensorRead(int sensorIndex) async {
if (messageAttributes.sensorReadCmd == null) {
throw ButtplugClientDeviceException("$name ($displayName) does not support sensor read commands");
}
var sensorReadMsg = SensorReadCmd();
sensorReadMsg.deviceIndex = index;
if (messageAttributes.sensorReadCmd!.length < sensorIndex) {
throw ButtplugClientDeviceException("$name ($displayName) does not have a sensor read index of $sensorIndex");
}
sensorReadMsg.sensorIndex = sensorIndex;
sensorReadMsg.sensorType = messageAttributes.sensorReadCmd![sensorIndex].sensorType;
ButtplugServerMessage returnMsg = await _sendMessageExpectReturn(sensorReadMsg);
if (returnMsg.sensorReading == null) {
throw ButtplugClientDeviceException("Did not receive SensorReading back from SensorRead transaction");
}
return returnMsg.sensorReading!.data;
}