47 lines
1.4 KiB
Swift
47 lines
1.4 KiB
Swift
import Foundation
|
|
|
|
enum BluetoothRequestType: UInt8 {
|
|
/**
|
|
* Request the number of bytes already recorded
|
|
*
|
|
* Request:
|
|
* - No additional bytes expected
|
|
*
|
|
* Response:
|
|
* - `BluetoothResponseType.success`
|
|
* - the number of recorded bytes as a `Uint16` (2 bytes)
|
|
* - the number of seconds until the next measurement as a `Uint16` (2 bytes)
|
|
* - the number of seconds between measurements as a `Uint16` (2 bytes)
|
|
* - the number of measurements as a `Uint16` (2 bytes)
|
|
* - the maximum number of bytes to request as a `Uint16` (2 bytes)
|
|
* - the number of seconds since power on as a `Uint32` (4 bytes)
|
|
*/
|
|
case getInfo = 0
|
|
|
|
/**
|
|
* Request recording data
|
|
*
|
|
* Request:
|
|
* - Bytes 1-2: Memory offset (`UInt16`)
|
|
* - Bytes 3-4: Number of bytes (`UInt16`)
|
|
*
|
|
* Response:
|
|
* - `BluetoothResponseType.success`, plus the requested bytes
|
|
* - `BluetoothResponseType.responseTooLarge` if too many bytes are requested
|
|
*/
|
|
case getRecordingData = 1
|
|
|
|
/**
|
|
* Request deletion of recordings
|
|
*
|
|
* Request:
|
|
* - Bytes 1-2: Number of bytes to clear (uint16_t)
|
|
*
|
|
* Response:
|
|
* - `BluetoothResponseType.success`
|
|
* - `BluetoothResponseType.invalidNumberOfBytesToDelete`, if the number of bytes does not match.
|
|
* This may happen when a new temperature recording is performed in between calls
|
|
*/
|
|
case clearRecordingBuffer = 2
|
|
}
|