Closed kira-bruneau closed 1 month ago
Thanks!
Hmm the enum*.rs is autogenerated by https://github.com/ssalonen/libcec-sys/blob/master/scripts/run-bindgen/bindgen.sh
So somethings needs to be done there... need to have a bit closer look to comment something sensible
can you add simple tests to the conversion similar to other such functions in this lib?
Oh ok! I'll just add them back. I mainly just removed them because the new struct made those enums unnecessary.
I'll also keep using the constants from libcec_sys
for the struct, because CEC_AUDIO_VOLUME_STATUS_UNKNOWN
conflicts with CEC_AUDIO_VOLUME_STATUS_MASK
. It'd be a bit confusing to useCecAudioStatus::MuteStatusMask
to check when the status is unknown.
Yes I think it's ok to keep all enums as-is and having this usability-layer separately like you have done here with new struct
I refactored my changes a bit so this new struct can be used with https://github.com/ssalonen/cec-alsa-sync.
KnownCecAudioStatus::new
with a method that takes a separate volume
& is_muted
parameter.TryFrom<u8>
implementation to handle converting from a raw status (also adds a variant for the reserved value error case)
audio_get_status
returns an audio status, and doesn't propagate the transmit result:Also the status doesn't neatly fit into a Rust enum, so I removed the existing enum and added a wrapper struct.
Page 260 of High-Definition Multimedia Interface Specification 1.3a