TempTrack-iOS/TempTrack/Connection/DeviceDataResetRequest.swift
2023-06-29 10:13:37 +02:00

33 lines
781 B
Swift

import Foundation
struct DeviceDataResetRequest: DeviceRequest {
typealias Response = Void
static var type: BluetoothRequestType { .clearRecordingBuffer }
var payload: Data {
byteCount.twoByteData
}
let byteCount: Int
init(byteCount: Int) {
self.byteCount = byteCount
}
func makeResponse(from responseData: Data, responseType: BluetoothResponseType) -> Void? {
switch responseType {
case .success:
return ()
case .invalidNumberOfBytesToDelete:
log.error("Device data reset failed: Invalid number of bytes")
return nil
default:
log.warning("Invalid response \(responseType) to device data reset request")
return nil
}
}
}