From c603e3bebbc6f6c0ce42fda2649a8258b4630a6b Mon Sep 17 00:00:00 2001 From: Gregory Mallios Date: Mon, 29 Apr 2024 00:44:54 +0300 Subject: [PATCH] fix: add missing state fields --- soundcore-lib/src/api/state/state.rs | 25 +++++++++++++++++---- soundcore-lib/src/packets/response/state.rs | 13 +++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/soundcore-lib/src/api/state/state.rs b/soundcore-lib/src/api/state/state.rs index bd86897..37d5f27 100644 --- a/soundcore-lib/src/api/state/state.rs +++ b/soundcore-lib/src/api/state/state.rs @@ -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)] @@ -20,12 +21,28 @@ pub struct SoundcoreDeviceState { pub eq_configuration: EQConfiguration, pub serial: Option, pub fw: Option, - pub host_device: Option, - pub tws_status: Option, pub button_model: Option, + pub host_device: Option, pub side_tone: Option, + pub age_range: Option, + /// HearID pub hearid_eq_preset: Option, - pub wear_detection: Option, pub hear_id: Option, - pub age_range: Option, + pub hear_id_has_data: Option, + // Toggles + pub touch_tone: Option, + pub tws_status: Option, + pub wear_detection: Option, + pub bass_up: Option, + pub auto_power_off: Option, + pub support_two_cnn: Option, + pub in_ear_beep: Option, + pub ambient_sound_notice: Option, + pub power_on_battery_notice: Option, + // Other + pub three_dimensional_effect: Option, + pub device_color: Option, + pub ldac: Option, + pub prompt_language: Option, + pub hearing_protect: Option, } diff --git a/soundcore-lib/src/packets/response/state.rs b/soundcore-lib/src/packets/response/state.rs index 779bd46..cd0a8ac 100644 --- a/soundcore-lib/src/packets/response/state.rs +++ b/soundcore-lib/src/packets/response/state.rs @@ -114,6 +114,19 @@ impl From 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, } } }