BLEStatus.swift 339 B

12345678910111213141516
  1. import enum CoreBluetooth.CBManagerState
  2. func encode(_ centralState: CBManagerState) -> Int32 {
  3. switch (centralState) {
  4. case .unknown, .resetting:
  5. return 0
  6. case .unsupported:
  7. return 1
  8. case .unauthorized:
  9. return 2
  10. case .poweredOff:
  11. return 3
  12. case .poweredOn:
  13. return 5
  14. }
  15. }