MockRileyLinkDevice.swift 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // MockRileyLinkDevice.swift
  3. // MinimedKitTests
  4. //
  5. // Created by Pete Schwamb on 9/5/22.
  6. // Copyright © 2022 LoopKit Authors. All rights reserved.
  7. //
  8. import Foundation
  9. import RileyLinkBLEKit
  10. import CoreBluetooth
  11. class MockRileyLinkDevice: RileyLinkDevice {
  12. var isConnected: Bool = true
  13. var rlFirmwareDescription: String = "Mock"
  14. var hasOrangeLinkService: Bool = false
  15. var hardwareType: RileyLinkHardwareType? = .riley
  16. var rssi: Int? = nil
  17. var name: String? = "Mock"
  18. var deviceURI: String = "rileylink://Mock"
  19. var peripheralIdentifier: UUID = UUID()
  20. var peripheralState: CBPeripheralState = .connected
  21. func readRSSI() {}
  22. func setCustomName(_ name: String) {}
  23. func updateBatteryLevel() {}
  24. func orangeAction(_ command: OrangeLinkCommand) {}
  25. func setOrangeConfig(_ config: OrangeLinkConfigurationSetting, isOn: Bool) {}
  26. func orangeWritePwd() {}
  27. func orangeClose() {}
  28. func orangeReadSet() {}
  29. func orangeReadVDC() {}
  30. func findDevice() {}
  31. func setDiagnosticeLEDModeForBLEChip(_ mode: RileyLinkLEDMode) {}
  32. func readDiagnosticLEDModeForBLEChip(completion: @escaping (RileyLinkLEDMode?) -> Void) {}
  33. func assertOnSessionQueue() {}
  34. func sessionQueueAsyncAfter(deadline: DispatchTime, execute: @escaping () -> Void) {}
  35. func runSession(withName name: String, _ block: @escaping (CommandSession) -> Void) {
  36. assertionFailure("MockRileyLinkDevice.runSession should not be called during testing. Use MockPumpOps for communication stubs.")
  37. }
  38. func getStatus(_ completion: @escaping (RileyLinkDeviceStatus) -> Void) {
  39. completion(RileyLinkDeviceStatus(
  40. lastIdle: Date(),
  41. name: name,
  42. version: rlFirmwareDescription,
  43. ledOn: false,
  44. vibrationOn: false,
  45. voltage: 3.0,
  46. battery: nil,
  47. hasPiezo: false))
  48. }
  49. }