Closed rohanpurohit closed 2 years ago
Partial review of the existing Nonin OEM III code:
using Flags = std::array<bool, packet_size>
and then just use that for all these declarations?'
for readability)output
method has an unclear description which doesn't describe what it actually doesframe_
?size_t
since it's used for array indexing (and then we can remove a static_cast in the cpp file)/* Increment the frame buffer index */
), it adds too much noise to code comments.received_length_++
:
++
and --
rather than the postfix ++
and --
: e.g. ++received_length_
BufferStatus input()
, BufferStatus output()
:
BufferStatus::partial
abuses the semantics for BufferStatus
, where partial
means "only a partial buffer operation was possible" - this is a safety problem. FrameBuffer
should instead have something more like ok
and waiting
, and maybe empty
and fullif needed, or else we should redesign the interface and separation of responsibilities between
FrameBufferand
BufferReceiverto remove the need for a
partialor
waitingstatus code from
FrameBuffer. Or we could just have
okand
waiting, and also
input_overwrittenlike in
ChunkSplitter`.if (received_length_ == 0) return;
This PR includes:
SignalAmplitude
toSignalQuality
Pleth
toPlethPulseAmplitudes
PacketMeasurements
toSample
StatusByteStruct
toStatus
StatusByteStruct
fields as per datasheetheart_rate
tohr
spo2_d_beat
tospo2_b_b
spo2_d_fast
tospo2_fast
(as per datasheet)nonin_oem_revision
tofirmware_revision
get_6bit_data
toget_spo2_data
as it essentialy only gets SpO2 data from the packetget_9bit_data
toget_hr_data
mask_6bit
tospo2_missing_data
which is equal to0x7F
or 127, this is an indicator for missing SpO2 data, we just ignore it if we get these bytesmask_9bit
tohr_missing_data
which is0x01FF
or 511 this is an indicator for missing HR data, we just ignore it if we get these bytesFrameInputStatus
available
enum tooutput_ready
FrameInputStatus
framing_error
enum tochecksum_failed
PacketStatus
framing_error
enum tochecksum_failed
PacketStatus
missed_data
enum toframe_loss
PacketInputStatus
missed_data
enum toframe_loss
PacketStatus
available
enum took
TODO: check for other changes