feat: integrate chat voice and diagnostics client

This commit is contained in:
Edison Jwa
2026-05-23 06:51:55 +09:00
parent 7e28791ec2
commit 7d5d8c2c90
93 changed files with 10273 additions and 3347 deletions
-1
View File
@@ -17,7 +17,6 @@ crate-type = ["cdylib", "staticlib", "rlib"]
[dependencies]
chanora_core = { path = "../../core/chanora_core" }
chanora_protocol = { path = "../chanora_protocol" }
chanora_audio = { path = "../chanora_audio" }
flutter_rust_bridge = "=2.12.0"
thiserror.workspace = true
+249 -40
View File
@@ -80,7 +80,10 @@ fn session() -> &'static chanora_core::ChanoraSession {
fn log_sink() -> &'static chanora_core::InMemoryLogSink {
static SINK: OnceLock<chanora_core::InMemoryLogSink> = OnceLock::new();
SINK.get_or_init(|| {
chanora_core::InMemoryLogSink::new(500, chanora_core::Redactor::with_default_policy())
chanora_core::InMemoryLogSink::new(
chanora_core::DEFAULT_LOG_CAPACITY,
chanora_core::Redactor::with_default_policy(),
)
})
}
@@ -342,6 +345,9 @@ pub struct BridgeChannel {
pub order: i64,
/// True when the server marks the channel as password-protected.
pub has_password: bool,
/// Talk power threshold required to speak in this channel.
/// None means no talk-power restriction.
pub needed_talk_power: Option<i32>,
}
/// Client as seen by Dart.
@@ -361,6 +367,10 @@ pub struct BridgeClient {
pub is_speaking: bool,
/// True for TeamSpeak ServerQuery clients.
pub is_server_query: bool,
/// Current talk power value assigned by the server.
pub talk_power: i32,
/// True when the server has granted talk power regardless of numeric value.
pub talk_power_granted: bool,
}
/// Server snapshot as seen by Dart.
@@ -384,8 +394,8 @@ pub struct BridgeSnapshot {
pub own_client_id: u64,
}
impl From<chanora_protocol::ServerSnapshot> for BridgeSnapshot {
fn from(s: chanora_protocol::ServerSnapshot) -> Self {
impl From<chanora_core::ServerSnapshot> for BridgeSnapshot {
fn from(s: chanora_core::ServerSnapshot) -> Self {
Self {
server_name: s.server_name,
welcome_message: s.welcome_message,
@@ -400,6 +410,7 @@ impl From<chanora_protocol::ServerSnapshot> for BridgeSnapshot {
name: c.name,
order: c.order,
has_password: c.has_password,
needed_talk_power: c.needed_talk_power,
})
.collect(),
clients: s
@@ -413,6 +424,8 @@ impl From<chanora_protocol::ServerSnapshot> for BridgeSnapshot {
output_muted: c.output_muted,
is_speaking: c.is_speaking,
is_server_query: c.is_server_query,
talk_power: c.talk_power,
talk_power_granted: c.talk_power_granted,
})
.collect(),
own_client_id: s.own_client_id,
@@ -501,24 +514,6 @@ pub fn handle_route_change(route: BridgeAudioRoute) {
}
}
/// Handle iOS AVAudioSession media-services reset (legacy, no route arg).
///
/// Called by the existing FRB-generated Dart binding. Uses
/// `AudioRoute::Unknown` which triggers a route-change recompute.
/// The AppDelegate now also calls `handle_media_services_reset_with_route`
/// directly after rebuilding the session.
#[frb(sync)]
pub fn handle_media_services_reset() {
let result = runtime().block_on(async {
session()
.ios_handle_media_services_reset(chanora_audio::AudioRoute::Unknown)
.await
});
if let Err(e) = result {
warn!(target: "chanora_bridge", error = %e, "iOS media-services reset handling failed");
}
}
/// Handle iOS AVAudioSession media-services reset with the current
/// route class. Called by AppDelegate after rebuilding the session.
///
@@ -552,11 +547,11 @@ pub fn handle_interruption_ended(should_resume: bool) {
}
}
/// Set the push-to-talk state.
/// Set the focused/on-screen push-to-talk hold state.
///
/// Superseded in v1 by [`set_transmit_mode`] + the binding capture
/// dialog. Retained so legacy callers and integration tests keep
/// working; the new VoiceBar UI no longer invokes this.
/// Binding capture chooses which physical key drives PTT, while this
/// command carries the actual press/release edge for fallback focused
/// keyboard handling and touch controls.
pub async fn set_ptt(active: bool) -> Result<(), BridgeError> {
runtime()
.spawn(async move { session().set_ptt(active).await })
@@ -691,6 +686,46 @@ pub enum BridgePttInputClass {
MouseSideButton,
}
/// Privacy-safe PTT capability descriptor for the UI.
#[derive(Debug, Clone)]
pub struct BridgePttDescriptor {
/// Stable capability level name.
pub level: String,
/// Stable backend identifier.
pub backend_id: String,
/// Coarse bound input class; empty when no binding is active.
pub bound_input_class: String,
}
impl From<chanora_core::PttDescriptorSnapshot> for BridgePttDescriptor {
fn from(desc: chanora_core::PttDescriptorSnapshot) -> Self {
Self {
level: desc.level,
backend_id: desc.backend_id,
bound_input_class: desc.bound_input_class,
}
}
}
/// Persisted PTT binding display state for the UI.
#[derive(Debug, Clone)]
pub struct BridgePttBinding {
/// Stable input category string (`""`, `"keyboard"`, or
/// `"mouse-side-button"`).
pub input_class: String,
/// Display-only key label; empty when no binding is active.
pub key_label: String,
}
impl From<chanora_core::PersistedPttBinding> for BridgePttBinding {
fn from(binding: chanora_core::PersistedPttBinding) -> Self {
Self {
input_class: binding.input_class,
key_label: binding.key_label,
}
}
}
impl From<BridgePttInputClass> for chanora_core::PttInputClass {
fn from(c: BridgePttInputClass) -> Self {
match c {
@@ -721,27 +756,34 @@ pub async fn set_ptt_binding(
Ok(())
}
/// Read the current PTT capability descriptor. Returns a
/// `(level, backend_id, bound_input_class)` triple matching the
/// privacy-safe `BridgeEvent::PttCapability` event shape; useful
/// for the initial UI render before the first event arrives.
pub async fn ptt_descriptor() -> (String, String, String) {
/// Read the current PTT capability descriptor. Matches the privacy-safe
/// `BridgeEvent::PttCapability` event shape; useful for the initial UI
/// render before the first event arrives.
pub async fn ptt_descriptor() -> BridgePttDescriptor {
runtime()
.spawn(async { session().ptt_descriptor().await })
.await
.unwrap_or_else(|_| (String::new(), String::new(), String::new()))
.map(Into::into)
.unwrap_or_else(|_| BridgePttDescriptor {
level: String::new(),
backend_id: String::new(),
bound_input_class: String::new(),
})
}
/// Return the persisted PTT binding as a
/// `(input_class, platform_key)` pair so the UI can hydrate its
/// display state at launch (e.g. show "PTT: Space" next to the
/// badge before the user re-opens the binding dialog). Empty
/// strings mean no binding has been persisted yet.
pub async fn get_ptt_binding() -> (String, String) {
/// Return the persisted PTT binding so the UI can hydrate its display
/// state at launch (e.g. show "PTT: Space" next to the badge before the
/// user re-opens the binding dialog). Empty strings mean no binding has
/// been persisted yet.
pub async fn get_ptt_binding() -> BridgePttBinding {
runtime()
.spawn(async { session().get_ptt_binding().await })
.await
.unwrap_or_else(|_| (String::new(), String::new()))
.map(Into::into)
.unwrap_or_else(|_| BridgePttBinding {
input_class: String::new(),
key_label: String::new(),
})
}
/// Move our own client to `channel_id`. Optional channel password
@@ -794,6 +836,36 @@ pub async fn set_output_gain(gain: f32) -> Result<(), BridgeError> {
Ok(())
}
/// Set per-client output volume (SRS-075). `1.0` is unity, `0.0`
/// mutes. No-op when client has no active voice queue. Volume is
/// applied directly to the tsclientlib AudioQueue and takes effect
/// immediately on the next render callback.
pub async fn set_client_volume(client_id: u64, volume: f32) -> Result<(), BridgeError> {
runtime()
.spawn(async move { session().set_client_volume(client_id, volume).await })
.await
.map_err(|e| task_join_error("set_client_volume", e))??;
Ok(())
}
/// Send a text message to the specified target.
pub async fn send_chat_message(
message: String,
target: BridgeMessageTarget,
) -> Result<(), BridgeError> {
let target_core: chanora_core::MessageTarget = match target {
BridgeMessageTarget::Server => chanora_core::MessageTarget::Server,
BridgeMessageTarget::Channel => chanora_core::MessageTarget::Channel,
BridgeMessageTarget::Client(id) => chanora_core::MessageTarget::Client(id),
BridgeMessageTarget::Poke(id) => chanora_core::MessageTarget::Poke(id),
};
runtime()
.spawn(async move { session().send_text_message(message, target_core).await })
.await
.map_err(|e| task_join_error("send_chat_message", e))??;
Ok(())
}
/// Statistics from the audio engine.
#[derive(Debug, Clone)]
pub struct BridgeAudioStats {
@@ -1164,8 +1236,14 @@ pub fn export_diagnostics() -> String {
let android_audio_yaml =
chanora_audio::mobile_voice_backend::current_android_audio_diagnostics()
.map(|d| d.to_yaml_fragment());
let network_info = runtime().block_on(async { session().network_diagnostics_summary().await });
let protocol_events = runtime().block_on(async { session().drain_protocol_events().await });
match chanora_core::DiagnosticExport::from_sink(log_sink(), metadata) {
Ok(exp) => exp.with_android_audio(android_audio_yaml).to_text(),
Ok(exp) => exp
.with_android_audio(android_audio_yaml)
.with_network_info(Some(network_info))
.with_protocol_events(protocol_events)
.to_text(),
Err(e) => format!("(diagnostic export failed: {e})"),
}
}
@@ -1417,6 +1495,46 @@ pub enum BridgeEvent {
/// Resolved permission state.
state: PermissionStateKind,
},
/// A text message received from the server.
ChatMessage {
/// Client id of the sender.
sender_id: u64,
/// Nickname of the sender.
sender_name: String,
/// Message content.
message: String,
/// Target scope (server/channel/private/poke).
target: BridgeMessageTarget,
},
/// Audio route changed (speaker/earpiece/BT/wired).
AudioRouteChanged {
/// The new audio route.
route: BridgeAudioRoute,
},
}
/// Bridge message target scope.
#[derive(Debug, Clone, Copy)]
pub enum BridgeMessageTarget {
/// Broadcast to entire server.
Server,
/// Broadcast to current channel.
Channel,
/// Private message to a specific client.
Client(u64),
/// Poke a specific client.
Poke(u64),
}
impl From<chanora_core::MessageTarget> for BridgeMessageTarget {
fn from(t: chanora_core::MessageTarget) -> Self {
match t {
chanora_core::MessageTarget::Server => Self::Server,
chanora_core::MessageTarget::Channel => Self::Channel,
chanora_core::MessageTarget::Client(id) => Self::Client(id),
chanora_core::MessageTarget::Poke(id) => Self::Poke(id),
}
}
}
/// Bridge mirror of core join projection sync state.
@@ -1563,6 +1681,22 @@ impl From<chanora_core::SessionEvent> for BridgeEvent {
began,
should_resume,
},
chanora_core::SessionEvent::ChatMessage {
sender_id,
sender_name,
message,
target,
} => BridgeEvent::ChatMessage {
sender_id,
sender_name,
message,
target: target.into(),
},
chanora_core::SessionEvent::AudioRouteChanged { route } => {
BridgeEvent::AudioRouteChanged {
route: route.into(),
}
}
}
}
}
@@ -1711,6 +1845,66 @@ pub async fn audio_processing_stats() -> Result<BridgeAudioProcessingStats, Brid
Ok(stats.into())
}
/// Audio device info from the platform.
#[derive(Debug, Clone)]
pub struct BridgeAudioDevice {
/// Human-readable device name.
pub name: String,
/// True if the OS reports this as the default device.
pub is_default: bool,
}
/// List of available audio devices.
#[derive(Debug, Clone)]
pub struct BridgeAudioDeviceList {
/// Available input devices.
pub input_devices: Vec<BridgeAudioDevice>,
/// Available output devices.
pub output_devices: Vec<BridgeAudioDevice>,
}
/// List available audio input and output devices from the platform.
pub fn list_audio_devices() -> BridgeAudioDeviceList {
let list = chanora_audio::list_audio_devices();
BridgeAudioDeviceList {
input_devices: list
.input_devices
.into_iter()
.map(|d| BridgeAudioDevice {
name: d.name,
is_default: d.is_default,
})
.collect(),
output_devices: list
.output_devices
.into_iter()
.map(|d| BridgeAudioDevice {
name: d.name,
is_default: d.is_default,
})
.collect(),
}
}
/// Set the preferred input device by name. Takes effect on next
/// `start_audio`.
pub async fn set_input_device(name: Option<String>) -> Result<(), BridgeError> {
runtime()
.spawn(async move { session().set_input_device(name).await })
.await
.map_err(|e| task_join_error("set_input_device", e))??;
Ok(())
}
/// Set the preferred output device by name.
pub async fn set_output_device(name: Option<String>) -> Result<(), BridgeError> {
runtime()
.spawn(async move { session().set_output_device(name).await })
.await
.map_err(|e| task_join_error("set_output_device", e))??;
Ok(())
}
/// Configure the VAD model path.
pub async fn set_vad_model_path(path: String) -> Result<(), BridgeError> {
if path.trim().is_empty() {
@@ -1733,7 +1927,7 @@ pub async fn set_ten_vad_model_path(path: String) -> Result<(), BridgeError> {
));
}
runtime()
.spawn(async move { chanora_audio::vad::set_ten_model_path(&path).map_err(|e| e) })
.spawn(async move { chanora_audio::vad::set_ten_model_path(&path) })
.await
.map_err(|e| task_join_error("set_ten_vad_model_path", e))?
.map_err(|e| BridgeError::Unmapped(format!("set_ten_vad_model_path: {e}")))?;
@@ -1785,3 +1979,18 @@ pub async fn set_ios_voice_processing_mode(
};
set_audio_processing_config(config).await
}
/// Set the preferred audio output route (Android/iOS).
#[frb(sync)]
pub fn set_audio_output_route(route: BridgeAudioRoute) {
runtime().block_on(async {
let _ = session().ios_handle_route_change(route.into()).await;
});
}
/// Called from Flutter when the app enters background/foreground.
#[frb(sync)]
pub fn record_lifecycle_event(state: String) {
runtime().block_on(async {
session().record_lifecycle_event(&state).await;
});
}
+639 -90
View File
@@ -38,7 +38,7 @@ flutter_rust_bridge::frb_generated_boilerplate!(
default_rust_auto_opaque = RustAutoOpaqueMoi,
);
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.12.0";
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = -436507436;
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 1433826599;
// Section: executor
@@ -602,37 +602,6 @@ fn wire__crate__api__handle_interruption_ended_impl(
},
)
}
fn wire__crate__api__handle_media_services_reset_impl(
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
rust_vec_len_: i32,
data_len_: i32,
) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse {
FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::<flutter_rust_bridge::for_generated::SseCodec, _>(
flutter_rust_bridge::for_generated::TaskInfo {
debug_name: "handle_media_services_reset",
port: None,
mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync,
},
move || {
let message = unsafe {
flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(
ptr_,
rust_vec_len_,
data_len_,
)
};
let mut deserializer =
flutter_rust_bridge::for_generated::SseDeserializer::new(message);
deserializer.end();
transform_result_sse::<_, ()>((move || {
let output_ok = Result::<_, ()>::Ok({
crate::api::handle_media_services_reset();
})?;
Ok(output_ok)
})())
},
)
}
fn wire__crate__api__handle_media_services_reset_with_route_impl(
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
rust_vec_len_: i32,
@@ -768,6 +737,38 @@ fn wire__crate__api__is_connected_impl(
},
)
}
fn wire__crate__api__list_audio_devices_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
rust_vec_len_: i32,
data_len_: i32,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::<flutter_rust_bridge::for_generated::SseCodec, _, _>(
flutter_rust_bridge::for_generated::TaskInfo {
debug_name: "list_audio_devices",
port: Some(port_),
mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
},
move || {
let message = unsafe {
flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(
ptr_,
rust_vec_len_,
data_len_,
)
};
let mut deserializer =
flutter_rust_bridge::for_generated::SseDeserializer::new(message);
deserializer.end();
move |context| {
transform_result_sse::<_, ()>((move || {
let output_ok = Result::<_, ()>::Ok(crate::api::list_audio_devices())?;
Ok(output_ok)
})())
}
},
)
}
fn wire__crate__api__list_bookmarks_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
@@ -905,6 +906,108 @@ fn wire__crate__api__ptt_descriptor_impl(
},
)
}
fn wire__crate__api__record_lifecycle_event_impl(
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
rust_vec_len_: i32,
data_len_: i32,
) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse {
FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::<flutter_rust_bridge::for_generated::SseCodec, _>(
flutter_rust_bridge::for_generated::TaskInfo {
debug_name: "record_lifecycle_event",
port: None,
mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync,
},
move || {
let message = unsafe {
flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(
ptr_,
rust_vec_len_,
data_len_,
)
};
let mut deserializer =
flutter_rust_bridge::for_generated::SseDeserializer::new(message);
let api_state = <String>::sse_decode(&mut deserializer);
deserializer.end();
transform_result_sse::<_, ()>((move || {
let output_ok = Result::<_, ()>::Ok({
crate::api::record_lifecycle_event(api_state);
})?;
Ok(output_ok)
})())
},
)
}
fn wire__crate__api__send_chat_message_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
rust_vec_len_: i32,
data_len_: i32,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::<flutter_rust_bridge::for_generated::SseCodec, _, _, _>(
flutter_rust_bridge::for_generated::TaskInfo {
debug_name: "send_chat_message",
port: Some(port_),
mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
},
move || {
let message = unsafe {
flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(
ptr_,
rust_vec_len_,
data_len_,
)
};
let mut deserializer =
flutter_rust_bridge::for_generated::SseDeserializer::new(message);
let api_message = <String>::sse_decode(&mut deserializer);
let api_target = <crate::api::BridgeMessageTarget>::sse_decode(&mut deserializer);
deserializer.end();
move |context| async move {
transform_result_sse::<_, crate::BridgeError>(
(move || async move {
let output_ok =
crate::api::send_chat_message(api_message, api_target).await?;
Ok(output_ok)
})()
.await,
)
}
},
)
}
fn wire__crate__api__set_audio_output_route_impl(
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
rust_vec_len_: i32,
data_len_: i32,
) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse {
FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::<flutter_rust_bridge::for_generated::SseCodec, _>(
flutter_rust_bridge::for_generated::TaskInfo {
debug_name: "set_audio_output_route",
port: None,
mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync,
},
move || {
let message = unsafe {
flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(
ptr_,
rust_vec_len_,
data_len_,
)
};
let mut deserializer =
flutter_rust_bridge::for_generated::SseDeserializer::new(message);
let api_route = <crate::api::BridgeAudioRoute>::sse_decode(&mut deserializer);
deserializer.end();
transform_result_sse::<_, ()>((move || {
let output_ok = Result::<_, ()>::Ok({
crate::api::set_audio_output_route(api_route);
})?;
Ok(output_ok)
})())
},
)
}
fn wire__crate__api__set_audio_processing_config_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
@@ -942,6 +1045,44 @@ fn wire__crate__api__set_audio_processing_config_impl(
},
)
}
fn wire__crate__api__set_client_volume_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
rust_vec_len_: i32,
data_len_: i32,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::<flutter_rust_bridge::for_generated::SseCodec, _, _, _>(
flutter_rust_bridge::for_generated::TaskInfo {
debug_name: "set_client_volume",
port: Some(port_),
mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
},
move || {
let message = unsafe {
flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(
ptr_,
rust_vec_len_,
data_len_,
)
};
let mut deserializer =
flutter_rust_bridge::for_generated::SseDeserializer::new(message);
let api_client_id = <u64>::sse_decode(&mut deserializer);
let api_volume = <f32>::sse_decode(&mut deserializer);
deserializer.end();
move |context| async move {
transform_result_sse::<_, crate::BridgeError>(
(move || async move {
let output_ok =
crate::api::set_client_volume(api_client_id, api_volume).await?;
Ok(output_ok)
})()
.await,
)
}
},
)
}
fn wire__crate__api__set_hard_mute_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
@@ -978,6 +1119,42 @@ fn wire__crate__api__set_hard_mute_impl(
},
)
}
fn wire__crate__api__set_input_device_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
rust_vec_len_: i32,
data_len_: i32,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::<flutter_rust_bridge::for_generated::SseCodec, _, _, _>(
flutter_rust_bridge::for_generated::TaskInfo {
debug_name: "set_input_device",
port: Some(port_),
mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
},
move || {
let message = unsafe {
flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(
ptr_,
rust_vec_len_,
data_len_,
)
};
let mut deserializer =
flutter_rust_bridge::for_generated::SseDeserializer::new(message);
let api_name = <Option<String>>::sse_decode(&mut deserializer);
deserializer.end();
move |context| async move {
transform_result_sse::<_, crate::BridgeError>(
(move || async move {
let output_ok = crate::api::set_input_device(api_name).await?;
Ok(output_ok)
})()
.await,
)
}
},
)
}
fn wire__crate__api__set_input_muted_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
@@ -1083,6 +1260,42 @@ fn wire__crate__api__set_network_state_impl(
},
)
}
fn wire__crate__api__set_output_device_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
rust_vec_len_: i32,
data_len_: i32,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::<flutter_rust_bridge::for_generated::SseCodec, _, _, _>(
flutter_rust_bridge::for_generated::TaskInfo {
debug_name: "set_output_device",
port: Some(port_),
mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
},
move || {
let message = unsafe {
flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire(
ptr_,
rust_vec_len_,
data_len_,
)
};
let mut deserializer =
flutter_rust_bridge::for_generated::SseDeserializer::new(message);
let api_name = <Option<String>>::sse_decode(&mut deserializer);
deserializer.end();
move |context| async move {
transform_result_sse::<_, crate::BridgeError>(
(move || async move {
let output_ok = crate::api::set_output_device(api_name).await?;
Ok(output_ok)
})()
.await,
)
}
},
)
}
fn wire__crate__api__set_output_gain_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr,
@@ -1567,6 +1780,30 @@ impl SseDecode for crate::api::BridgeAudioBackend {
}
}
impl SseDecode for crate::api::BridgeAudioDevice {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut var_name = <String>::sse_decode(deserializer);
let mut var_isDefault = <bool>::sse_decode(deserializer);
return crate::api::BridgeAudioDevice {
name: var_name,
is_default: var_isDefault,
};
}
}
impl SseDecode for crate::api::BridgeAudioDeviceList {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut var_inputDevices = <Vec<crate::api::BridgeAudioDevice>>::sse_decode(deserializer);
let mut var_outputDevices = <Vec<crate::api::BridgeAudioDevice>>::sse_decode(deserializer);
return crate::api::BridgeAudioDeviceList {
input_devices: var_inputDevices,
output_devices: var_outputDevices,
};
}
}
impl SseDecode for crate::api::BridgeAudioProcessingConfig {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -1704,12 +1941,14 @@ impl SseDecode for crate::api::BridgeChannel {
let mut var_name = <String>::sse_decode(deserializer);
let mut var_order = <i64>::sse_decode(deserializer);
let mut var_hasPassword = <bool>::sse_decode(deserializer);
let mut var_neededTalkPower = <Option<i32>>::sse_decode(deserializer);
return crate::api::BridgeChannel {
id: var_id,
parent: var_parent,
name: var_name,
order: var_order,
has_password: var_hasPassword,
needed_talk_power: var_neededTalkPower,
};
}
}
@@ -1724,6 +1963,8 @@ impl SseDecode for crate::api::BridgeClient {
let mut var_outputMuted = <bool>::sse_decode(deserializer);
let mut var_isSpeaking = <bool>::sse_decode(deserializer);
let mut var_isServerQuery = <bool>::sse_decode(deserializer);
let mut var_talkPower = <i32>::sse_decode(deserializer);
let mut var_talkPowerGranted = <bool>::sse_decode(deserializer);
return crate::api::BridgeClient {
id: var_id,
channel: var_channel,
@@ -1732,6 +1973,8 @@ impl SseDecode for crate::api::BridgeClient {
output_muted: var_outputMuted,
is_speaking: var_isSpeaking,
is_server_query: var_isServerQuery,
talk_power: var_talkPower,
talk_power_granted: var_talkPowerGranted,
};
}
}
@@ -1891,6 +2134,22 @@ impl SseDecode for crate::api::BridgeEvent {
state: var_state,
};
}
11 => {
let mut var_senderId = <u64>::sse_decode(deserializer);
let mut var_senderName = <String>::sse_decode(deserializer);
let mut var_message = <String>::sse_decode(deserializer);
let mut var_target = <crate::api::BridgeMessageTarget>::sse_decode(deserializer);
return crate::api::BridgeEvent::ChatMessage {
sender_id: var_senderId,
sender_name: var_senderName,
message: var_message,
target: var_target,
};
}
12 => {
let mut var_route = <crate::api::BridgeAudioRoute>::sse_decode(deserializer);
return crate::api::BridgeEvent::AudioRouteChanged { route: var_route };
}
_ => {
unimplemented!("");
}
@@ -1913,6 +2172,32 @@ impl SseDecode for crate::api::BridgeIosVoiceProcessingMode {
}
}
impl SseDecode for crate::api::BridgeMessageTarget {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut tag_ = <i32>::sse_decode(deserializer);
match tag_ {
0 => {
return crate::api::BridgeMessageTarget::Server;
}
1 => {
return crate::api::BridgeMessageTarget::Channel;
}
2 => {
let mut var_field0 = <u64>::sse_decode(deserializer);
return crate::api::BridgeMessageTarget::Client(var_field0);
}
3 => {
let mut var_field0 = <u64>::sse_decode(deserializer);
return crate::api::BridgeMessageTarget::Poke(var_field0);
}
_ => {
unimplemented!("");
}
}
}
}
impl SseDecode for crate::api::BridgeNetworkState {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -1926,6 +2211,32 @@ impl SseDecode for crate::api::BridgeNetworkState {
}
}
impl SseDecode for crate::api::BridgePttBinding {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut var_inputClass = <String>::sse_decode(deserializer);
let mut var_keyLabel = <String>::sse_decode(deserializer);
return crate::api::BridgePttBinding {
input_class: var_inputClass,
key_label: var_keyLabel,
};
}
}
impl SseDecode for crate::api::BridgePttDescriptor {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut var_level = <String>::sse_decode(deserializer);
let mut var_backendId = <String>::sse_decode(deserializer);
let mut var_boundInputClass = <String>::sse_decode(deserializer);
return crate::api::BridgePttDescriptor {
level: var_level,
backend_id: var_backendId,
bound_input_class: var_boundInputClass,
};
}
}
impl SseDecode for crate::api::BridgePttInputClass {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -2044,6 +2355,18 @@ impl SseDecode for i64 {
}
}
impl SseDecode for Vec<crate::api::BridgeAudioDevice> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut len_ = <i32>::sse_decode(deserializer);
let mut ans_ = Vec::with_capacity(len_ as usize);
for idx_ in 0..len_ {
ans_.push(<crate::api::BridgeAudioDevice>::sse_decode(deserializer));
}
return ans_;
}
}
impl SseDecode for Vec<crate::api::BridgeBookmark> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -2092,6 +2415,17 @@ impl SseDecode for Vec<u8> {
}
}
impl SseDecode for Option<String> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
if (<bool>::sse_decode(deserializer)) {
return Some(<String>::sse_decode(deserializer));
} else {
return None;
}
}
}
impl SseDecode for Option<crate::api::BridgeVoiceJoinErrorCode> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -2105,6 +2439,17 @@ impl SseDecode for Option<crate::api::BridgeVoiceJoinErrorCode> {
}
}
impl SseDecode for Option<i32> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
if (<bool>::sse_decode(deserializer)) {
return Some(<i32>::sse_decode(deserializer));
} else {
return None;
}
}
}
impl SseDecode for Option<u64> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -2130,25 +2475,6 @@ impl SseDecode for crate::api::PermissionStateKind {
}
}
impl SseDecode for (String, String) {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut var_field0 = <String>::sse_decode(deserializer);
let mut var_field1 = <String>::sse_decode(deserializer);
return (var_field0, var_field1);
}
}
impl SseDecode for (String, String, String) {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut var_field0 = <String>::sse_decode(deserializer);
let mut var_field1 = <String>::sse_decode(deserializer);
let mut var_field2 = <String>::sse_decode(deserializer);
return (var_field0, var_field1, var_field2);
}
}
impl SseDecode for u32 {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -2197,29 +2523,34 @@ fn pde_ffi_dispatcher_primary_impl(
12 => wire__crate__api__get_ptt_binding_impl(port, ptr, rust_vec_len, data_len),
13 => wire__crate__api__get_release_tail_ms_impl(port, ptr, rust_vec_len, data_len),
14 => wire__crate__api__get_transmit_mode_impl(port, ptr, rust_vec_len, data_len),
20 => wire__crate__api__init_storage_impl(port, ptr, rust_vec_len, data_len),
21 => wire__crate__api__is_connected_impl(port, ptr, rust_vec_len, data_len),
19 => wire__crate__api__init_storage_impl(port, ptr, rust_vec_len, data_len),
20 => wire__crate__api__is_connected_impl(port, ptr, rust_vec_len, data_len),
21 => wire__crate__api__list_audio_devices_impl(port, ptr, rust_vec_len, data_len),
22 => wire__crate__api__list_bookmarks_impl(port, ptr, rust_vec_len, data_len),
24 => wire__crate__api__move_to_channel_impl(port, ptr, rust_vec_len, data_len),
25 => wire__crate__api__ptt_descriptor_impl(port, ptr, rust_vec_len, data_len),
26 => wire__crate__api__set_audio_processing_config_impl(port, ptr, rust_vec_len, data_len),
27 => wire__crate__api__set_hard_mute_impl(port, ptr, rust_vec_len, data_len),
28 => wire__crate__api__set_input_muted_impl(port, ptr, rust_vec_len, data_len),
29 => {
27 => wire__crate__api__send_chat_message_impl(port, ptr, rust_vec_len, data_len),
29 => wire__crate__api__set_audio_processing_config_impl(port, ptr, rust_vec_len, data_len),
30 => wire__crate__api__set_client_volume_impl(port, ptr, rust_vec_len, data_len),
31 => wire__crate__api__set_hard_mute_impl(port, ptr, rust_vec_len, data_len),
32 => wire__crate__api__set_input_device_impl(port, ptr, rust_vec_len, data_len),
33 => wire__crate__api__set_input_muted_impl(port, ptr, rust_vec_len, data_len),
34 => {
wire__crate__api__set_ios_voice_processing_mode_impl(port, ptr, rust_vec_len, data_len)
}
31 => wire__crate__api__set_output_gain_impl(port, ptr, rust_vec_len, data_len),
32 => wire__crate__api__set_output_muted_impl(port, ptr, rust_vec_len, data_len),
33 => wire__crate__api__set_ptt_impl(port, ptr, rust_vec_len, data_len),
34 => wire__crate__api__set_ptt_binding_impl(port, ptr, rust_vec_len, data_len),
35 => wire__crate__api__set_release_tail_ms_impl(port, ptr, rust_vec_len, data_len),
36 => wire__crate__api__set_ten_vad_model_path_impl(port, ptr, rust_vec_len, data_len),
37 => wire__crate__api__set_transmit_mode_impl(port, ptr, rust_vec_len, data_len),
38 => wire__crate__api__set_vad_model_path_impl(port, ptr, rust_vec_len, data_len),
39 => wire__crate__api__snapshot_impl(port, ptr, rust_vec_len, data_len),
40 => wire__crate__api__update_bookmark_impl(port, ptr, rust_vec_len, data_len),
41 => wire__crate__api__voice_join_impl(port, ptr, rust_vec_len, data_len),
42 => wire__crate__api__voice_leave_impl(port, ptr, rust_vec_len, data_len),
36 => wire__crate__api__set_output_device_impl(port, ptr, rust_vec_len, data_len),
37 => wire__crate__api__set_output_gain_impl(port, ptr, rust_vec_len, data_len),
38 => wire__crate__api__set_output_muted_impl(port, ptr, rust_vec_len, data_len),
39 => wire__crate__api__set_ptt_impl(port, ptr, rust_vec_len, data_len),
40 => wire__crate__api__set_ptt_binding_impl(port, ptr, rust_vec_len, data_len),
41 => wire__crate__api__set_release_tail_ms_impl(port, ptr, rust_vec_len, data_len),
42 => wire__crate__api__set_ten_vad_model_path_impl(port, ptr, rust_vec_len, data_len),
43 => wire__crate__api__set_transmit_mode_impl(port, ptr, rust_vec_len, data_len),
44 => wire__crate__api__set_vad_model_path_impl(port, ptr, rust_vec_len, data_len),
45 => wire__crate__api__snapshot_impl(port, ptr, rust_vec_len, data_len),
46 => wire__crate__api__update_bookmark_impl(port, ptr, rust_vec_len, data_len),
47 => wire__crate__api__voice_join_impl(port, ptr, rust_vec_len, data_len),
48 => wire__crate__api__voice_leave_impl(port, ptr, rust_vec_len, data_len),
_ => unreachable!(),
}
}
@@ -2235,15 +2566,16 @@ fn pde_ffi_dispatcher_sync_impl(
10 => wire__crate__api__export_diagnostics_impl(ptr, rust_vec_len, data_len),
15 => wire__crate__api__handle_interruption_began_impl(ptr, rust_vec_len, data_len),
16 => wire__crate__api__handle_interruption_ended_impl(ptr, rust_vec_len, data_len),
17 => wire__crate__api__handle_media_services_reset_impl(ptr, rust_vec_len, data_len),
18 => wire__crate__api__handle_media_services_reset_with_route_impl(
17 => wire__crate__api__handle_media_services_reset_with_route_impl(
ptr,
rust_vec_len,
data_len,
),
19 => wire__crate__api__handle_route_change_impl(ptr, rust_vec_len, data_len),
18 => wire__crate__api__handle_route_change_impl(ptr, rust_vec_len, data_len),
23 => wire__crate__api__log_file_path_str_impl(ptr, rust_vec_len, data_len),
30 => wire__crate__api__set_network_state_impl(ptr, rust_vec_len, data_len),
26 => wire__crate__api__record_lifecycle_event_impl(ptr, rust_vec_len, data_len),
28 => wire__crate__api__set_audio_output_route_impl(ptr, rust_vec_len, data_len),
35 => wire__crate__api__set_network_state_impl(ptr, rust_vec_len, data_len),
_ => unreachable!(),
}
}
@@ -2274,6 +2606,45 @@ impl flutter_rust_bridge::IntoIntoDart<crate::api::BridgeAudioBackend>
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for crate::api::BridgeAudioDevice {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
[
self.name.into_into_dart().into_dart(),
self.is_default.into_into_dart().into_dart(),
]
.into_dart()
}
}
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for crate::api::BridgeAudioDevice {}
impl flutter_rust_bridge::IntoIntoDart<crate::api::BridgeAudioDevice>
for crate::api::BridgeAudioDevice
{
fn into_into_dart(self) -> crate::api::BridgeAudioDevice {
self
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for crate::api::BridgeAudioDeviceList {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
[
self.input_devices.into_into_dart().into_dart(),
self.output_devices.into_into_dart().into_dart(),
]
.into_dart()
}
}
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
for crate::api::BridgeAudioDeviceList
{
}
impl flutter_rust_bridge::IntoIntoDart<crate::api::BridgeAudioDeviceList>
for crate::api::BridgeAudioDeviceList
{
fn into_into_dart(self) -> crate::api::BridgeAudioDeviceList {
self
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for crate::api::BridgeAudioProcessingConfig {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
[
@@ -2414,6 +2785,7 @@ impl flutter_rust_bridge::IntoDart for crate::api::BridgeChannel {
self.name.into_into_dart().into_dart(),
self.order.into_into_dart().into_dart(),
self.has_password.into_into_dart().into_dart(),
self.needed_talk_power.into_into_dart().into_dart(),
]
.into_dart()
}
@@ -2435,6 +2807,8 @@ impl flutter_rust_bridge::IntoDart for crate::api::BridgeClient {
self.output_muted.into_into_dart().into_dart(),
self.is_speaking.into_into_dart().into_dart(),
self.is_server_query.into_into_dart().into_dart(),
self.talk_power.into_into_dart().into_dart(),
self.talk_power_granted.into_into_dart().into_dart(),
]
.into_dart()
}
@@ -2586,6 +2960,22 @@ impl flutter_rust_bridge::IntoDart for crate::api::BridgeEvent {
state.into_into_dart().into_dart(),
]
.into_dart(),
crate::api::BridgeEvent::ChatMessage {
sender_id,
sender_name,
message,
target,
} => [
11.into_dart(),
sender_id.into_into_dart().into_dart(),
sender_name.into_into_dart().into_dart(),
message.into_into_dart().into_dart(),
target.into_into_dart().into_dart(),
]
.into_dart(),
crate::api::BridgeEvent::AudioRouteChanged { route } => {
[12.into_dart(), route.into_into_dart().into_dart()].into_dart()
}
_ => {
unimplemented!("");
}
@@ -2620,6 +3010,35 @@ impl flutter_rust_bridge::IntoIntoDart<crate::api::BridgeIosVoiceProcessingMode>
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for crate::api::BridgeMessageTarget {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
match self {
crate::api::BridgeMessageTarget::Server => [0.into_dart()].into_dart(),
crate::api::BridgeMessageTarget::Channel => [1.into_dart()].into_dart(),
crate::api::BridgeMessageTarget::Client(field0) => {
[2.into_dart(), field0.into_into_dart().into_dart()].into_dart()
}
crate::api::BridgeMessageTarget::Poke(field0) => {
[3.into_dart(), field0.into_into_dart().into_dart()].into_dart()
}
_ => {
unimplemented!("");
}
}
}
}
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
for crate::api::BridgeMessageTarget
{
}
impl flutter_rust_bridge::IntoIntoDart<crate::api::BridgeMessageTarget>
for crate::api::BridgeMessageTarget
{
fn into_into_dart(self) -> crate::api::BridgeMessageTarget {
self
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for crate::api::BridgeNetworkState {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
match self {
@@ -2642,6 +3061,46 @@ impl flutter_rust_bridge::IntoIntoDart<crate::api::BridgeNetworkState>
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for crate::api::BridgePttBinding {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
[
self.input_class.into_into_dart().into_dart(),
self.key_label.into_into_dart().into_dart(),
]
.into_dart()
}
}
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for crate::api::BridgePttBinding {}
impl flutter_rust_bridge::IntoIntoDart<crate::api::BridgePttBinding>
for crate::api::BridgePttBinding
{
fn into_into_dart(self) -> crate::api::BridgePttBinding {
self
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for crate::api::BridgePttDescriptor {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
[
self.level.into_into_dart().into_dart(),
self.backend_id.into_into_dart().into_dart(),
self.bound_input_class.into_into_dart().into_dart(),
]
.into_dart()
}
}
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
for crate::api::BridgePttDescriptor
{
}
impl flutter_rust_bridge::IntoIntoDart<crate::api::BridgePttDescriptor>
for crate::api::BridgePttDescriptor
{
fn into_into_dart(self) -> crate::api::BridgePttDescriptor {
self
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for crate::api::BridgePttInputClass {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
match self {
@@ -2851,6 +3310,22 @@ impl SseEncode for crate::api::BridgeAudioBackend {
}
}
impl SseEncode for crate::api::BridgeAudioDevice {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<String>::sse_encode(self.name, serializer);
<bool>::sse_encode(self.is_default, serializer);
}
}
impl SseEncode for crate::api::BridgeAudioDeviceList {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<Vec<crate::api::BridgeAudioDevice>>::sse_encode(self.input_devices, serializer);
<Vec<crate::api::BridgeAudioDevice>>::sse_encode(self.output_devices, serializer);
}
}
impl SseEncode for crate::api::BridgeAudioProcessingConfig {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -2946,6 +3421,7 @@ impl SseEncode for crate::api::BridgeChannel {
<String>::sse_encode(self.name, serializer);
<i64>::sse_encode(self.order, serializer);
<bool>::sse_encode(self.has_password, serializer);
<Option<i32>>::sse_encode(self.needed_talk_power, serializer);
}
}
@@ -2959,6 +3435,8 @@ impl SseEncode for crate::api::BridgeClient {
<bool>::sse_encode(self.output_muted, serializer);
<bool>::sse_encode(self.is_speaking, serializer);
<bool>::sse_encode(self.is_server_query, serializer);
<i32>::sse_encode(self.talk_power, serializer);
<bool>::sse_encode(self.talk_power_granted, serializer);
}
}
@@ -3105,6 +3583,22 @@ impl SseEncode for crate::api::BridgeEvent {
<String>::sse_encode(permission, serializer);
<crate::api::PermissionStateKind>::sse_encode(state, serializer);
}
crate::api::BridgeEvent::ChatMessage {
sender_id,
sender_name,
message,
target,
} => {
<i32>::sse_encode(11, serializer);
<u64>::sse_encode(sender_id, serializer);
<String>::sse_encode(sender_name, serializer);
<String>::sse_encode(message, serializer);
<crate::api::BridgeMessageTarget>::sse_encode(target, serializer);
}
crate::api::BridgeEvent::AudioRouteChanged { route } => {
<i32>::sse_encode(12, serializer);
<crate::api::BridgeAudioRoute>::sse_encode(route, serializer);
}
_ => {
unimplemented!("");
}
@@ -3128,6 +3622,31 @@ impl SseEncode for crate::api::BridgeIosVoiceProcessingMode {
}
}
impl SseEncode for crate::api::BridgeMessageTarget {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
match self {
crate::api::BridgeMessageTarget::Server => {
<i32>::sse_encode(0, serializer);
}
crate::api::BridgeMessageTarget::Channel => {
<i32>::sse_encode(1, serializer);
}
crate::api::BridgeMessageTarget::Client(field0) => {
<i32>::sse_encode(2, serializer);
<u64>::sse_encode(field0, serializer);
}
crate::api::BridgeMessageTarget::Poke(field0) => {
<i32>::sse_encode(3, serializer);
<u64>::sse_encode(field0, serializer);
}
_ => {
unimplemented!("");
}
}
}
}
impl SseEncode for crate::api::BridgeNetworkState {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -3145,6 +3664,23 @@ impl SseEncode for crate::api::BridgeNetworkState {
}
}
impl SseEncode for crate::api::BridgePttBinding {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<String>::sse_encode(self.input_class, serializer);
<String>::sse_encode(self.key_label, serializer);
}
}
impl SseEncode for crate::api::BridgePttDescriptor {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<String>::sse_encode(self.level, serializer);
<String>::sse_encode(self.backend_id, serializer);
<String>::sse_encode(self.bound_input_class, serializer);
}
}
impl SseEncode for crate::api::BridgePttInputClass {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -3274,6 +3810,16 @@ impl SseEncode for i64 {
}
}
impl SseEncode for Vec<crate::api::BridgeAudioDevice> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<i32>::sse_encode(self.len() as _, serializer);
for item in self {
<crate::api::BridgeAudioDevice>::sse_encode(item, serializer);
}
}
}
impl SseEncode for Vec<crate::api::BridgeBookmark> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -3314,6 +3860,16 @@ impl SseEncode for Vec<u8> {
}
}
impl SseEncode for Option<String> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<bool>::sse_encode(self.is_some(), serializer);
if let Some(value) = self {
<String>::sse_encode(value, serializer);
}
}
}
impl SseEncode for Option<crate::api::BridgeVoiceJoinErrorCode> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -3324,6 +3880,16 @@ impl SseEncode for Option<crate::api::BridgeVoiceJoinErrorCode> {
}
}
impl SseEncode for Option<i32> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<bool>::sse_encode(self.is_some(), serializer);
if let Some(value) = self {
<i32>::sse_encode(value, serializer);
}
}
}
impl SseEncode for Option<u64> {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -3352,23 +3918,6 @@ impl SseEncode for crate::api::PermissionStateKind {
}
}
impl SseEncode for (String, String) {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<String>::sse_encode(self.0, serializer);
<String>::sse_encode(self.1, serializer);
}
}
impl SseEncode for (String, String, String) {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<String>::sse_encode(self.0, serializer);
<String>::sse_encode(self.1, serializer);
<String>::sse_encode(self.2, serializer);
}
}
impl SseEncode for u32 {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
+5 -4
View File
@@ -102,13 +102,14 @@ impl From<chanora_core::CoreError> for BridgeError {
chanora_core::CoreError::AudioNotStarted => {
BridgeError::InvalidCommand("audio not started".to_string())
}
chanora_core::CoreError::Protocol(chanora_protocol::ProtocolError::DnsFailed {
chanora_core::CoreError::Protocol(chanora_core::ProtocolError::DnsFailed {
host,
reason,
}) => BridgeError::DnsFailed { host, reason },
chanora_core::CoreError::Protocol(
chanora_protocol::ProtocolError::ServerRejected { code, message },
) => BridgeError::ServerRejected { code, message },
chanora_core::CoreError::Protocol(chanora_core::ProtocolError::ServerRejected {
code,
message,
}) => BridgeError::ServerRejected { code, message },
chanora_core::CoreError::Protocol(p) => BridgeError::Connection(format!("{p}")),
chanora_core::CoreError::Audio(a) => BridgeError::Connection(format!("audio: {a}")),
chanora_core::CoreError::Storage(s) => BridgeError::Connection(format!("storage: {s}")),