read method

void read()

Implementation

void read() {
  state.status = WorkStatus.working;
  notifyState(state);

  () async {
    try {
      state.info = DeviceInfo(
        manufactureName:
            String.fromCharCodes(await _characteristicManufactureName.read()),
        hardwareName:
            String.fromCharCodes(await _characteristicHardwareName.read()),
        hardwareVersion:
            Version.fromList(await _characteristicHardwareVersion.read()),
        softwareName:
            String.fromCharCodes(await _characteristicSoftwareName.read()),
        softwareVersion:
            Version.fromList(await _characteristicSoftwareVersion.read()),
        isAvailable: true,
      );
      state.status = WorkStatus.success;
      notifyState(state);
    } catch (_) {
      _raiseError(Error.deviceError);
    }
  }.call();
}