Skip to content

Commit

Permalink
roll back unrelated change
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaskollmer committed Nov 29, 2024
1 parent 049b5ae commit 4a57d93
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import ByteCoding
import Foundation
import NIO
import SpeziNumerics


/// A temperature measurement.
Expand Down Expand Up @@ -39,7 +38,7 @@ public struct TemperatureMeasurement {
/// The temperature value encoded as a `medfloat32`.
///
/// The unit of this value is defined by the ``unit-swift.property`` property.
public let temperature: MedFloat32
public let temperature: UInt32
/// The unit of the temperature value .
///
/// This property defined the unit of the ``temperature`` property.
Expand All @@ -57,7 +56,7 @@ public struct TemperatureMeasurement {
/// - unit: The unit of the temperature measurement.
/// - timeStamp: The timestamp of the measurement.
/// - temperatureType: The type of the measurement.
public init(temperature: MedFloat32, unit: Unit, timeStamp: DateTime? = nil, temperatureType: TemperatureType? = nil) {
public init(temperature: UInt32, unit: Unit, timeStamp: DateTime? = nil, temperatureType: TemperatureType? = nil) {
self.temperature = temperature
self.unit = unit
self.timeStamp = timeStamp
Expand Down Expand Up @@ -87,8 +86,8 @@ extension TemperatureMeasurement.Flags: ByteCodable {

extension TemperatureMeasurement: ByteCodable {
public init?(from byteBuffer: inout ByteBuffer) {
guard let flags = Flags(from: &byteBuffer),
let temperature = MedFloat32(from: &byteBuffer) else {
guard let flags = Flags(from: &byteBuffer),
let temperature = UInt32(from: &byteBuffer) else {
return nil
}

Expand Down
13 changes: 6 additions & 7 deletions Tests/SpeziBluetoothServicesTests/HealthThermometerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import CoreBluetooth
import NIO
import SpeziNumerics
@_spi(TestingSupport)
@testable import SpeziBluetooth
@_spi(TestingSupport)
Expand All @@ -24,15 +23,15 @@ final class HealthThermometerTests: XCTestCase {
}

func testTemperatureMeasurement() throws {
let temp = MedFloat32(bitPattern: 0xAFAFAFAF) // 4 bytes for the medfloat
let data: UInt32 = 0xAFAFAFAF // 4 bytes for the medfloat
let time = DateTime(hours: 13, minutes: 12, seconds: 12)

try testIdentity(from: TemperatureMeasurement(temperature: temp, unit: .celsius))
try testIdentity(from: TemperatureMeasurement(temperature: temp, unit: .fahrenheit))
try testIdentity(from: TemperatureMeasurement(temperature: data, unit: .celsius))
try testIdentity(from: TemperatureMeasurement(temperature: data, unit: .fahrenheit))

try testIdentity(from: TemperatureMeasurement(temperature: temp, unit: .celsius, timeStamp: time, temperatureType: .ear))
try testIdentity(from: TemperatureMeasurement(temperature: temp, unit: .celsius, temperatureType: .ear))
try testIdentity(from: TemperatureMeasurement(temperature: temp, unit: .celsius, timeStamp: time))
try testIdentity(from: TemperatureMeasurement(temperature: data, unit: .celsius, timeStamp: time, temperatureType: .ear))
try testIdentity(from: TemperatureMeasurement(temperature: data, unit: .celsius, temperatureType: .ear))
try testIdentity(from: TemperatureMeasurement(temperature: data, unit: .celsius, timeStamp: time))
}

func testTemperatureType() throws {
Expand Down

0 comments on commit 4a57d93

Please sign in to comment.