Skip to content

Commit

Permalink
Renamed AccessoryInformation.type
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Mar 4, 2024
1 parent 92e9f44 commit db6ca87
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions Example/Sources/TemperatureSensorAccessory/Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public actor BluetoothServer <Peripheral: AccessoryPeripheralManager, Authentica
self.server = try await BluetoothAccessoryServer(
peripheral: peripheral,
delegate: self,
id: id,
id: id,
type: accessoryType,
rssi: rssi,
name: name,
advertised: advertisedService,
Expand Down Expand Up @@ -238,7 +239,7 @@ extension BluetoothServer: BluetoothAccessoryServerDelegate {
assertionFailure()
return
}
log("Did identify with key \(key.name)")
log("Did identify with key \(key.id)")
lastIdentify = (key.id, Date())
// clear value
await self.server.update(InformationService.self) {
Expand All @@ -258,7 +259,7 @@ extension BluetoothServer: BluetoothAccessoryServerDelegate {
assertionFailure()
return
}
log("Setup owner key for \(request.name)")
log("Setup owner key for \(request.id)")
// clear value
let newKeysValue = await self.authenticationDelegate.allKeys
await self.server.update(AuthenticationService.self) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extension AccessoryAppEntity {
init(_ value: AccessoryInformation) {
self.id = value.id
self.name = value.name
self.type = .init(value.accessory)
self.type = .init(value.type)
self.service = .init(value.service)
self.manufacturer = value.manufacturer
self.serialNumber = value.serialNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ extension AccessoryEntityQuery: EntityStringQuery {
.map { $0.information }
.filter {
$0.name.localizedCaseInsensitiveContains(query)
|| $0.accessory.description.localizedCaseInsensitiveContains(query)
|| $0.type.description.localizedCaseInsensitiveContains(query)
|| $0.service.description.localizedCaseInsensitiveContains(query)
|| $0.manufacturer.description.localizedCaseInsensitiveContains(query)
|| $0.model.description.localizedCaseInsensitiveContains(query)
Expand Down Expand Up @@ -154,7 +154,7 @@ enum AccessoryEntityQueryPredicate {
case .serialNumberEqualTo(let string):
return value.serialNumber.lowercased() == string.lowercased()
case .accessoryTypeEqualTo(let accessoryType):
return value.accessory == accessoryType
return value.type == accessoryType
case .serviceTypeEqualTo(let serviceType):
return value.service == serviceType
case .manufacturerEqualTo(let string):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public struct AccessoryInformation: Equatable, Hashable, Codable, Identifiable,
public let name: String

/// Accessory type
public let accessory: AccessoryType
public let type: AccessoryType

/// Accessory advertised service
public let service: ServiceType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ internal extension AccessoryManager {
let information = AccessoryInformation(
id: id,
name: name,
accessory: accessoryType,
type: accessoryType,
service: scanResponse.service,
manufacturer: manufacturer,
serialNumber: serialNumber,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public extension AccessoryEntity {
) {
self.id = value.id
self.name = value.name
self.type = value.accessory
self.type = value.type
self.service = value.service
self.manufacturer = value.manufacturer
self.serialNumber = value.serialNumber
Expand Down

0 comments on commit db6ca87

Please sign in to comment.