resDeviceInfoAvailable function

void resDeviceInfoAvailable()

Implementation

void resDeviceInfoAvailable() {
  slog('resDeviceInfoAvailable: entered');
  Pointer<PERIPHERAL_DEVICE_INFO_CONTEXT> info =
      malloc<PERIPHERAL_DEVICE_INFO_CONTEXT>();

  slog('call cwsGetDeviceInfo now.');
  clingNative.cwsGetDeviceInfo(info);
  slog('got device info: ${info.ref}');
  slog('+++++++++++++++++++ device info VALID: ${info.ref.isValid}');

  clingNative.cwsCheckAuthorizationState();

  if (!info.ref.isValid) {
    Future.delayed(const Duration(seconds: 1)).then((value) {
      clingNative.cwsLoadDeviceInfo();
    });
  }else{
    CLCmdDeviceInfo.subject.add(CLCmdDeviceInfo.from(info.ref));
  }

  slog('resDeviceInfoAvailable exits');
}