|
8 | 8 | import Foundation |
9 | 9 | import CoreBluetooth |
10 | 10 |
|
11 | | -struct Peripheral: Identifiable { |
12 | | - let id: Int |
13 | | - let name: String |
14 | | - let rssi: Int |
15 | | - let peripheralHash: Int |
16 | | -} |
17 | | - |
18 | | -// declare some CBUUIDs for easier reference |
19 | | -let hrmCBUUID = CBUUID(string: "2A37") |
20 | | -let batCBUUID = CBUUID(string: "2A19") |
21 | | -let timeCBUUID = CBUUID(string: "2A2B") |
22 | | -let notifyCBUUID = CBUUID(string: "2A46") |
23 | | -let musicControlCBUUID = CBUUID(string: "00000001-78FC-48FE-8E23-433B3A1942D0") |
24 | | -let musicTrackCBUUID = CBUUID(string: "00000004-78FC-48FE-8E23-433B3A1942D0") |
25 | | -let musicArtistCBUUID = CBUUID(string: "00000003-78FC-48FE-8E23-433B3A1942D0") |
26 | 11 |
|
27 | 12 | class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate { |
28 | 13 |
|
@@ -50,6 +35,22 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate { |
50 | 35 | @Published var peripheralDictionary: [Int: CBPeripheral] = [:] // this is the dictionary that relates human-readable peripheral names to the CBPeripheral class that CoreBluetooth actually interacts with |
51 | 36 | @Published var infiniTime: CBPeripheral! // variable to save the CBPeripheral that you're connecting to |
52 | 37 |
|
| 38 | + // declare some CBUUIDs for easier reference |
| 39 | + let hrmCBUUID = CBUUID(string: "2A37") |
| 40 | + let batCBUUID = CBUUID(string: "2A19") |
| 41 | + let timeCBUUID = CBUUID(string: "2A2B") |
| 42 | + let notifyCBUUID = CBUUID(string: "2A46") |
| 43 | + let musicControlCBUUID = CBUUID(string: "00000001-78FC-48FE-8E23-433B3A1942D0") |
| 44 | + let musicTrackCBUUID = CBUUID(string: "00000004-78FC-48FE-8E23-433B3A1942D0") |
| 45 | + let musicArtistCBUUID = CBUUID(string: "00000003-78FC-48FE-8E23-433B3A1942D0") |
| 46 | + |
| 47 | + struct Peripheral: Identifiable { |
| 48 | + let id: Int |
| 49 | + let name: String |
| 50 | + let rssi: Int |
| 51 | + let peripheralHash: Int |
| 52 | + } |
| 53 | + |
53 | 54 | override init() { |
54 | 55 | super.init() |
55 | 56 |
|
|
0 commit comments