Skip to content

Commit

Permalink
fix: add missing state fields
Browse files Browse the repository at this point in the history
  • Loading branch information
gmallios committed Apr 28, 2024
1 parent 7631c28 commit c603e3b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
25 changes: 21 additions & 4 deletions soundcore-lib/src/api/state/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{
SideTone, SoundMode, TwsStatus, WearDetection,
},
};
use crate::models::{AmbientSoundNotice, AutoPowerOff, BassUp, DeviceColor, HearingProtect, InEarBeep, LDAC, PowerOnBatteryNotice, PromptLanguage, SupportTwoCnn, ThreeDimensionalEffect, TouchTone};

/// This is a generalized version of the state for all devices
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq, Clone, Hash, Default)]
Expand All @@ -20,12 +21,28 @@ pub struct SoundcoreDeviceState {
pub eq_configuration: EQConfiguration,
pub serial: Option<SerialNumber>,
pub fw: Option<FirmwareVer>,
pub host_device: Option<u8>,
pub tws_status: Option<TwsStatus>,
pub button_model: Option<ButtonModel>,
pub host_device: Option<u8>,
pub side_tone: Option<SideTone>,
pub age_range: Option<AgeRange>,
/// HearID
pub hearid_eq_preset: Option<u16>,
pub wear_detection: Option<WearDetection>,
pub hear_id: Option<HearID>,
pub age_range: Option<AgeRange>,
pub hear_id_has_data: Option<bool>,
// Toggles
pub touch_tone: Option<TouchTone>,
pub tws_status: Option<TwsStatus>,
pub wear_detection: Option<WearDetection>,
pub bass_up: Option<BassUp>,
pub auto_power_off: Option<AutoPowerOff>,
pub support_two_cnn: Option<SupportTwoCnn>,
pub in_ear_beep: Option<InEarBeep>,
pub ambient_sound_notice: Option<AmbientSoundNotice>,
pub power_on_battery_notice: Option<PowerOnBatteryNotice>,
// Other
pub three_dimensional_effect: Option<ThreeDimensionalEffect>,
pub device_color: Option<DeviceColor>,
pub ldac: Option<LDAC>,
pub prompt_language: Option<PromptLanguage>,
pub hearing_protect: Option<HearingProtect>,
}
13 changes: 13 additions & 0 deletions soundcore-lib/src/packets/response/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ impl From<DeviceStateResponse> for SoundcoreDeviceState {
wear_detection: value.wear_detection,
hear_id: value.hear_id,
age_range: value.age_range,
touch_tone: value.touch_tone,
bass_up: value.bass_up,
auto_power_off: value.auto_power_off,
support_two_cnn: value.support_two_cnn,
in_ear_beep: value.in_ear_beep,
ambient_sound_notice: value.ambient_sound_notice,
power_on_battery_notice: value.power_on_battery_notice,
three_dimensional_effect: value.three_dimensional_effect,
device_color: value.device_color,
ldac: value.ldac,
prompt_language: value.prompt_language,
hearing_protect: value.hearing_protect,
hear_id_has_data: value.hear_id_has_data,
}
}
}
Expand Down

0 comments on commit c603e3b

Please sign in to comment.