readInput method

Future<Map<InputType, InputDataType>> readInput(
  1. InputType inputType
)

Implementation

Future<Map<InputType, InputDataType>> readInput(InputType inputType) async {
  if (feature.input == null) {
    throw ButtplugClientDeviceException("${feature.featureDescription} does not have a readable input");
  }
  logInfo(feature.input!);
  if (!feature.input!.containsKey(inputType)) {
    throw ButtplugClientDeviceException("${feature.featureDescription} does not have input type $inputType");
  }
  var sensorReadMsg = InputCmd();
  sensorReadMsg.deviceIndex = deviceIndex;
  sensorReadMsg.featureIndex = feature.featureIndex;
  sensorReadMsg.type = inputType;
  sensorReadMsg.command = InputCommand.read;
  ButtplugServerMessage returnMsg = await _communicator.sendMessageExpectReply(sensorReadMsg);
  if (returnMsg.inputReading == null) {
    throw ButtplugClientDeviceException("Did not receive InputReading back from InputCmd transaction");
  }
  return returnMsg.inputReading!.reading;
}