Remove unused files

This commit is contained in:
Christoph Hagen 2023-08-16 10:41:37 +02:00
parent dfa9f716d4
commit 6771f511c5
3 changed files with 0 additions and 173 deletions

View File

@ -23,7 +23,6 @@
88CDE0512A2508E900114294 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88CDE0502A2508E900114294 /* ContentView.swift */; };
88CDE0532A2508EA00114294 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 88CDE0522A2508EA00114294 /* Assets.xcassets */; };
88CDE0562A2508EA00114294 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 88CDE0552A2508EA00114294 /* Preview Assets.xcassets */; };
88CDE0632A253AD900114294 /* TemperatureDataTransfer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88CDE0622A253AD900114294 /* TemperatureDataTransfer.swift */; };
88CDE0662A25D08F00114294 /* SFSafeSymbols in Frameworks */ = {isa = PBXBuildFile; productRef = 88CDE0652A25D08F00114294 /* SFSafeSymbols */; };
88CDE0682A2698B400114294 /* PersistentStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88CDE0672A2698B400114294 /* PersistentStorage.swift */; };
88CDE06D2A28A92000114294 /* DeviceInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88CDE06C2A28A92000114294 /* DeviceInfo.swift */; };
@ -39,7 +38,6 @@
E2A553FF2A3A1024005204C3 /* DayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2A553FE2A3A1024005204C3 /* DayView.swift */; };
E2A554012A3A6403005204C3 /* DeviceTime.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2A554002A3A6403005204C3 /* DeviceTime.swift */; };
E2A554052A4ADA93005204C3 /* TransferView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2A554042A4ADA93005204C3 /* TransferView.swift */; };
E2A554072A4ADB9C005204C3 /* TemperatureDataTransferDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2A554062A4ADB9C005204C3 /* TemperatureDataTransferDelegate.swift */; };
E2A5540C2A4ADFC6005204C3 /* DeviceInfoRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2A5540B2A4ADFC6005204C3 /* DeviceInfoRequest.swift */; };
E2A5540E2A4C9C4C005204C3 /* BluetoothRequestType.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2A5540D2A4C9C4C005204C3 /* BluetoothRequestType.swift */; };
E2A554102A4C9C68005204C3 /* DeviceRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2A5540F2A4C9C68005204C3 /* DeviceRequest.swift */; };
@ -68,7 +66,6 @@
88CDE0502A2508E900114294 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
88CDE0522A2508EA00114294 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
88CDE0552A2508EA00114294 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
88CDE0622A253AD900114294 /* TemperatureDataTransfer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemperatureDataTransfer.swift; sourceTree = "<group>"; };
88CDE0672A2698B400114294 /* PersistentStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistentStorage.swift; sourceTree = "<group>"; };
88CDE06C2A28A92000114294 /* DeviceInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceInfo.swift; sourceTree = "<group>"; };
88CDE06F2A28AEA300114294 /* TemperatureMeasurement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemperatureMeasurement.swift; sourceTree = "<group>"; };
@ -83,7 +80,6 @@
E2A553FE2A3A1024005204C3 /* DayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DayView.swift; sourceTree = "<group>"; };
E2A554002A3A6403005204C3 /* DeviceTime.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceTime.swift; sourceTree = "<group>"; };
E2A554042A4ADA93005204C3 /* TransferView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferView.swift; sourceTree = "<group>"; };
E2A554062A4ADB9C005204C3 /* TemperatureDataTransferDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemperatureDataTransferDelegate.swift; sourceTree = "<group>"; };
E2A5540B2A4ADFC6005204C3 /* DeviceInfoRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceInfoRequest.swift; sourceTree = "<group>"; };
E2A5540D2A4C9C4C005204C3 /* BluetoothRequestType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BluetoothRequestType.swift; sourceTree = "<group>"; };
E2A5540F2A4C9C68005204C3 /* DeviceRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceRequest.swift; sourceTree = "<group>"; };
@ -164,10 +160,8 @@
isa = PBXGroup;
children = (
88CDE06F2A28AEA300114294 /* TemperatureMeasurement.swift */,
88CDE0622A253AD900114294 /* TemperatureDataTransfer.swift */,
88CDE0752A28AF0900114294 /* TemperatureValue.swift */,
88CDE0772A28AF2C00114294 /* TemperatureSensor.swift */,
E2A554062A4ADB9C005204C3 /* TemperatureDataTransferDelegate.swift */,
);
path = Temperature;
sourceTree = "<group>";
@ -308,7 +302,6 @@
88404DDB2A2F4DCA00D30244 /* MeasurementDailyCount.swift in Sources */,
E2A554142A4C9C96005204C3 /* DeviceDataRequest.swift in Sources */,
88CDE0512A2508E900114294 /* ContentView.swift in Sources */,
88CDE0632A253AD900114294 /* TemperatureDataTransfer.swift in Sources */,
88CDE0702A28AEA300114294 /* TemperatureMeasurement.swift in Sources */,
E2A554162A4C9D2E005204C3 /* DeviceDataResetRequest.swift in Sources */,
88404DE12A31CA6B00D30244 /* BluetoothResponseType.swift in Sources */,
@ -334,7 +327,6 @@
88404DD22A2F0D8F00D30244 /* Double+Extensions.swift in Sources */,
E2A554102A4C9C68005204C3 /* DeviceRequest.swift in Sources */,
E253A9222A2B39B700EC6B28 /* Color+Extensions.swift in Sources */,
E2A554072A4ADB9C005204C3 /* TemperatureDataTransferDelegate.swift in Sources */,
E2E69B682A529FA800C6035E /* TransferHandler.swift in Sources */,
88404DEB2A37BE3000D30244 /* DeviceWakeCause.swift in Sources */,
88CDE06D2A28A92000114294 /* DeviceInfo.swift in Sources */,

View File

@ -1,164 +0,0 @@
import Foundation
/*
final class TemperatureDataTransfer {
private let startDateOfCurrentTransfer: Date
private var interval: TimeInterval {
TimeInterval(info.measurementInterval) * dilation
}
private var dataBuffer: Data = Data()
private(set) var currentByteIndex = 0
private var info: DeviceInfo
private let dilation: Double
var size: Int {
info.numberOfRecordedBytes
}
var blockSize: Int {
min(50, info.transferBlockSize)
}
private var numberOfRecordingsInCurrentTransfer: Int {
measurements.count
}
var time: DeviceTime {
info.time
}
var measurements: [TemperatureMeasurement] = []
/// The last temperatures to calculate relative values
private var lastRecording: TemperatureMeasurement = .init(sensor0: .notFound, sensor1: .notFound, date: .now)
private var dateOfNextRecording: Date {
startDateOfCurrentTransfer.addingTimeInterval(TimeInterval(numberOfRecordingsInCurrentTransfer) * interval)
}
var unprocessedByteCount: Int {
dataBuffer.count
}
var remainingBytesToTransfer: Int {
size - currentByteIndex
}
init(info: DeviceInfo, previous: DeviceTime?) {
let (estimatedStart, dilation) = info.estimatedTimeDilation(to: previous)
log.info("Starting transfer")
log.info("Estimated start of recording: \(estimatedStart)")
log.info("Estimated time dilation: \(dilation)")
self.info = info
self.dilation = dilation
self.startDateOfCurrentTransfer = estimatedStart
log.info("True measurement interval: \(interval)")
}
func update(info: DeviceInfo) {
self.info = info
// Possible bug: Device time updated, but new measurement not transferred
// Future transfer will calculate wrong time
}
func nextRequest() -> BluetoothRequest {
guard remainingBytesToTransfer > 0 else {
return .clearRecordingBuffer(byteCount: currentByteIndex)
}
let chunkSize = min(remainingBytesToTransfer, blockSize)
return .getRecordingData(offset: currentByteIndex, count: chunkSize)
}
func add(data: Data, offset: Int, count: Int) -> Bool {
guard currentByteIndex == offset else {
log.warning("Transfer: Discarding \(data.count) bytes at offset \(offset), expected \(currentByteIndex)")
return false
}
guard data.count == count else {
log.warning("Transfer: Expected \(count) bytes, received only \(data.count)")
return false
}
dataBuffer.append(data)
currentByteIndex += data.count
log.info("Transfer: \(currentByteIndex) bytes (added \(data.count))")
return true
}
private func processBytes() {
while !dataBuffer.isEmpty {
let byte = dataBuffer.removeFirst()
guard (byte == 0xFF) else {
addRelative(byte: byte)
continue
}
guard dataBuffer.count >= 2 else {
// Missing data
return
}
let temp0 = TemperatureValue(byte: dataBuffer.removeFirst())
let temp1 = TemperatureValue(byte: dataBuffer.removeFirst())
add(sensor0: temp0, sensor1: temp1)
}
}
func completeTransfer() -> Bool {
let emptyIndices = dataBuffer.enumerated().filter { $0.element == 0 }.map { $0.offset }
processBytes()
guard dataBuffer.isEmpty else {
log.warning("\(dataBuffer.count) bytes remaining in transfer buffer")
return false
}
log.info("Transfer complete: \(currentByteIndex) bytes, \(measurements.count) points")
log.info("Empty bytes: \(emptyIndices)")
if measurements.count != info.numberOfStoredMeasurements {
log.warning("Decoded \(measurements.count) points, but only \(info.numberOfStoredMeasurements) recorded")
}
return true
}
private func addRelative(byte: UInt8) {
add(sensor0: convertTemp(value: (byte >> 4) & 0x0F, relativeTo: lastRecording.sensor0),
sensor1: convertTemp(value: byte & 0x0F, relativeTo: lastRecording.sensor1))
}
private func add(sensor0: TemperatureValue, sensor1: TemperatureValue) {
let measurement = TemperatureMeasurement(
sensor0: sensor0,
sensor1: sensor1,
date: dateOfNextRecording)
if measurement.sensor0.isValid {
lastRecording.sensor0 = measurement.sensor0
}
if measurement.sensor1.isValid {
lastRecording.sensor1 = measurement.sensor1
}
lastRecording.id = measurement.id
measurements.append(measurement)
}
private func convertTemp(value: UInt8, relativeTo previous: TemperatureValue) -> TemperatureValue {
if value == 0 {
return .notFound
}
let newValue = previous.relativeValue - (Double(value) - 8) * 0.5
return .value(newValue)
}
}
private extension TemperatureValue {
var relativeValue: Double {
if case .value(let double) = self {
return double
}
return 0
}
}
*/

View File

@ -1 +0,0 @@
import Foundation