BluetoothStatusCode.fromId constructor

BluetoothStatusCode.fromId(
  1. int id
)

Implementation

factory BluetoothStatusCode.fromId(int id) {
  if (Platform.isAndroid) {
    switch (id) {
      case _AndroidBluetoothStatusCodeConst.Success:
        return BluetoothStatusSuccess(id);
      case _AndroidBluetoothStatusCodeConst.HCIUnknownBTLECommand:
        return BluetoothHCIStatusUnknownBTLECommand();
      case _AndroidBluetoothStatusCodeConst.HCIUnknownConnectionId:
        return BluetoothHCIStatusUnknownConnectionId();
      case _AndroidBluetoothStatusCodeConst.HCIAuthenticationFailure:
        return BluetoothHCIAuthenticationFailure();
      case _AndroidBluetoothStatusCodeConst.HCIPinOrKeyMissing:
        return BluetoothHCIPinOrKeyMissing();
      case _AndroidBluetoothStatusCodeConst.HCIMemoryCapacityExceeded:
        return BluetoothOutOfSpace(id);
      case _AndroidBluetoothStatusCodeConst.HCIConnectionTimeout:
        return BluetoothHCIConnectionTimeout();
      case _AndroidBluetoothStatusCodeConst.HCICommandDisallowed:
        return BluetoothHCICommandDisallowed();
      case _AndroidBluetoothStatusCodeConst.HCIInvalidBTLECommandParameters:
        return BluetoothInvalidParameters(id);
      case _AndroidBluetoothStatusCodeConst.HCIRemoteUserTerminatedConnection:
        return BluetoothPeripheralDisconnect(id);
      case _AndroidBluetoothStatusCodeConst
          .HCIRemoteDevTerminationDueToLowResources:
        return BluetoothHCIRemoteDevTerminationDueToLowResources();
      case _AndroidBluetoothStatusCodeConst
          .HCIRemoteDevTerminationDueToPowerOff:
        return BluetoothHCIRemoteDevTerminationDueToPowerOff();
      case _AndroidBluetoothStatusCodeConst.HCILocalHostTerminatedConnection:
        return BluetoothPeerDeleteParingInformation(id);
      case _AndroidBluetoothStatusCodeConst.HCIUnsupportedRemoteFeature:
        return BluetoothHCIUnsupportedRemoteFeature();
      case _AndroidBluetoothStatusCodeConst.HCIInvalidLMPParameters:
        return BluetoothInvalidParameters(id);
      case _AndroidBluetoothStatusCodeConst.HCIUnspecifiedError:
        return BluetoothHCIUnspecifiedError();
      case _AndroidBluetoothStatusCodeConst.HCILMPResponseTimeout:
        return BluetoothHCILMPResponseTimeout();
      case _AndroidBluetoothStatusCodeConst.HCILMPPDUNotAllowed:
        return BluetoothHCILMPPDUNotAllowed();
      case _AndroidBluetoothStatusCodeConst.HCIInstantPassed:
        return BluetoothHCIInstantPassed();
      case _AndroidBluetoothStatusCodeConst.HCIPairingWithUnitKeyUnsupported:
        return BluetoothHCIPairingWithUnitKeyUnsupported();
      case _AndroidBluetoothStatusCodeConst.HCIDifferentTransactionCollision:
        return BluetoothHCIDifferentTransactionCollision();
      case _AndroidBluetoothStatusCodeConst.HCIControllerBusy:
        return BluetoothHCIControllerBusy();
      case _AndroidBluetoothStatusCodeConst.HCIConnIntervalUnAcceptable:
        return BluetoothHCIConnIntervalUnAcceptable();
      case _AndroidBluetoothStatusCodeConst.HCIDirectedAdvertiserTimeout:
        return BluetoothHCIDirectedAdvertiserTimeout();
      case _AndroidBluetoothStatusCodeConst.HCIConnTerminatedDueToMicFailure:
        return BluetoothHCIConnTerminatedDueToMicFailure();
      case _AndroidBluetoothStatusCodeConst.HCIConnFailedToBeEstablished:
        return BluetoothConnectionFailed(id);
      case _AndroidBluetoothStatusCodeConst.GATTNoResources:
        return BluetoothGATTNoResources();
      case _AndroidBluetoothStatusCodeConst.GATTInternalError:
        return BluetoothGATTInternalError();
      case _AndroidBluetoothStatusCodeConst.GATTWrongState:
        return BluetoothGATTWrongState();
      case _AndroidBluetoothStatusCodeConst.GATTDBFull:
        return BluetoothGATTDBFull();
      case _AndroidBluetoothStatusCodeConst.GATTBusy:
        return BluetoothGATTBusy();
      case _AndroidBluetoothStatusCodeConst.GATTError:
        return BluetoothGATTError();
      case _AndroidBluetoothStatusCodeConst.GATTCmdStarted:
        return BluetoothGATTCmdStarted();
      case _AndroidBluetoothStatusCodeConst.GATTIllegalParameter:
        return BluetoothGATTIllegalParameter();
      case _AndroidBluetoothStatusCodeConst.GATTAuthFail:
        return BluetoothGATTAuthFail();
      case _AndroidBluetoothStatusCodeConst.GATTMore:
        return BluetoothGATTMore();
      case _AndroidBluetoothStatusCodeConst.GATTInvalidCfg:
        return BluetoothGATTInvalidCfg();
      case _AndroidBluetoothStatusCodeConst.GATTServiceStarted:
        return BluetoothGATTServiceStarted();
      case _AndroidBluetoothStatusCodeConst.GATTEncryptedNoMITM:
        return BluetoothGATTEncryptedNoMITM();
      case _AndroidBluetoothStatusCodeConst.GATTNotEncrypted:
        return BluetoothGATTNotEncrypted();
      case _AndroidBluetoothStatusCodeConst.GATTCongested:
        return BluetoothGATTCongested();
      case _AndroidBluetoothStatusCodeConst.GATTCCCCfgErr:
        return BluetoothGATTCCCCfgErr();
      case _AndroidBluetoothStatusCodeConst.GATTPrcInProgress:
        return BluetoothGATTPrcInProgress();
      case _AndroidBluetoothStatusCodeConst.GATTOutOfRange:
        return BluetoothGATTOutOfRange();
    }
  } else if (Platform.isIOS) {
    switch (id) {
      case _IOSBluetoothStatusCodeConst.CBUnknownError:
        return BluetoothStatusSuccess(id);
      case _IOSBluetoothStatusCodeConst.CBErrorInvalidParameters:
        return BluetoothInvalidParameters(id);
      case _IOSBluetoothStatusCodeConst.CBErrorInvalidHandle:
        return BluetoothInvalidHandle();
      case _IOSBluetoothStatusCodeConst.CBErrorNotConnected:
        return BluetoothNotConnected();
      case _IOSBluetoothStatusCodeConst.CBErrorOutOfSpace:
        return BluetoothOutOfSpace(id);
      case _IOSBluetoothStatusCodeConst.CBErrorOperationCancelled:
        return BluetoothOperationCancelled();
      case _IOSBluetoothStatusCodeConst.CBErrorPeripheralDisconnected:
        return BluetoothPeripheralDisconnect(id);
      case _IOSBluetoothStatusCodeConst.CBErrorUUIDNotAllowed:
        return BluetoothUUIDDisallowed();
      case _IOSBluetoothStatusCodeConst.CBErrorAlreadyAdvertising:
        return BluetoothAlreadyAdvertising();
      case _IOSBluetoothStatusCodeConst.CBErrorConnectionFailed:
        return BluetoothConnectionFailed(id);
      case _IOSBluetoothStatusCodeConst.CBErrorConnectionLimitReached:
        return BluetoothConnectionLimitReached();
      case _IOSBluetoothStatusCodeConst.CBErrorOperationNotSupported:
        return BluetoothOperationNotSupported();
      case _IOSBluetoothStatusCodeConst.CBErrorUnknownDevice:
        return BluetoothUnknownDevice();
      case _IOSBluetoothStatusCodeConst.CBErrorEncryptionTimedOut:
        return BluetoothEncryptionTimedOut();
      case _IOSBluetoothStatusCodeConst
          .CBErrorLeGattExceedBackgroundNotificationLimit:
        return BluetoothLeGattExceedBackgroundNotificationLimit();
      case _IOSBluetoothStatusCodeConst
          .CBErrorLeGattNearBackgroundNotificationLimit:
        return BluetoothLeGattNearBackgroundNotificationLimit();
      case _IOSBluetoothStatusCodeConst.CBErrorPeerRemovedPairingInformation:
        return BluetoothPeerDeleteParingInformation(id);
      case _IOSBluetoothStatusCodeConst.CBErrorTooManyLEPairedDevices:
        return BluetoothTooManyLEPairedDevices();
    }
  }
  return BluetoothStatusCode('Unknown', -1);
}