ConnectionState.swift 303 B

1234567891011121314
  1. import enum CoreBluetooth.CBPeripheralState
  2. func encode(_ connectionState: CBPeripheralState) -> Int32 {
  3. switch connectionState {
  4. case .disconnected:
  5. return 3
  6. case .connecting:
  7. return 0
  8. case .connected:
  9. return 1
  10. case .disconnecting:
  11. return 2
  12. }
  13. }