plugin_framework, debug listen event
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
9a457894b3
commit
12ab0a433a
@ -260,10 +260,15 @@ class PluginItem extends StatelessWidget {
|
|||||||
String? _getOption(OptionModel model, String key) {
|
String? _getOption(OptionModel model, String key) {
|
||||||
var v = model.value;
|
var v = model.value;
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
if (peerId.isEmpty) {
|
try {
|
||||||
v = bind.pluginGetSharedOption(id: pluginId, key: key);
|
if (peerId.isEmpty) {
|
||||||
} else {
|
v = bind.pluginGetSharedOption(id: pluginId, key: key);
|
||||||
v = bind.pluginGetSessionOption(id: pluginId, peer: peerId, key: key);
|
} else {
|
||||||
|
v = bind.pluginGetSessionOption(id: pluginId, peer: peerId, key: key);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('Failed to get option "$key", $e');
|
||||||
|
v = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
|
@ -965,10 +965,12 @@ impl<T: InvokeUiSession> Remote<T> {
|
|||||||
// on connection established client
|
// on connection established client
|
||||||
#[cfg(all(feature = "flutter", feature = "plugin_framework"))]
|
#[cfg(all(feature = "flutter", feature = "plugin_framework"))]
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
crate::plugin::handle_listen_event(
|
{
|
||||||
crate::plugin::EVENT_ON_CONN_CLIENT,
|
crate::plugin::handle_listen_event(
|
||||||
&self.handler.id,
|
crate::plugin::EVENT_ON_CONN_CLIENT.to_owned(),
|
||||||
);
|
self.handler.id.clone(),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.handler.is_file_transfer() {
|
if self.handler.is_file_transfer() {
|
||||||
|
@ -422,8 +422,7 @@ pub fn handle_server_event(id: &str, peer: &str, event: &[u8]) -> ResultType<()>
|
|||||||
handle_event(METHOD_HANDLE_PEER, id, peer, event)
|
handle_event(METHOD_HANDLE_PEER, id, peer, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
fn _handle_listen_event(event: String, peer: String) {
|
||||||
pub fn handle_listen_event(event: &str, peer: &str) {
|
|
||||||
let mut plugins = Vec::new();
|
let mut plugins = Vec::new();
|
||||||
for info in PLUGIN_INFO.read().unwrap().values() {
|
for info in PLUGIN_INFO.read().unwrap().values() {
|
||||||
if info.desc.listen_events().contains(&event.to_string()) {
|
if info.desc.listen_events().contains(&event.to_string()) {
|
||||||
@ -435,9 +434,7 @@ pub fn handle_listen_event(event: &str, peer: &str) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(mut evt) = serde_json::to_string(&MsgListenEvent {
|
if let Ok(mut evt) = serde_json::to_string(&MsgListenEvent { event }) {
|
||||||
event: event.to_string(),
|
|
||||||
}) {
|
|
||||||
let mut evt_bytes = evt.as_bytes().to_vec();
|
let mut evt_bytes = evt.as_bytes().to_vec();
|
||||||
evt_bytes.push(0);
|
evt_bytes.push(0);
|
||||||
let mut peer: String = peer.to_owned();
|
let mut peer: String = peer.to_owned();
|
||||||
@ -471,6 +468,11 @@ pub fn handle_listen_event(event: &str, peer: &str) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn handle_listen_event(event: String, peer: String) {
|
||||||
|
std::thread::spawn(|| _handle_listen_event(event, peer));
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn handle_client_event(id: &str, peer: &str, event: &[u8]) -> Message {
|
pub fn handle_client_event(id: &str, peer: &str, event: &[u8]) -> Message {
|
||||||
let mut peer: String = peer.to_owned();
|
let mut peer: String = peer.to_owned();
|
||||||
|
@ -565,10 +565,12 @@ impl Connection {
|
|||||||
}
|
}
|
||||||
#[cfg(all(feature = "flutter", feature = "plugin_framework"))]
|
#[cfg(all(feature = "flutter", feature = "plugin_framework"))]
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
crate::plugin::handle_listen_event(
|
{
|
||||||
crate::plugin::EVENT_ON_CONN_CLOSE_SERVER,
|
crate::plugin::handle_listen_event(
|
||||||
&conn.lr.my_id,
|
crate::plugin::EVENT_ON_CONN_CLOSE_SERVER.to_owned(),
|
||||||
);
|
conn.lr.my_id.clone(),
|
||||||
|
);
|
||||||
|
}
|
||||||
video_service::notify_video_frame_fetched(id, None);
|
video_service::notify_video_frame_fetched(id, None);
|
||||||
scrap::codec::Encoder::update(id, scrap::codec::EncodingUpdate::Remove);
|
scrap::codec::Encoder::update(id, scrap::codec::EncodingUpdate::Remove);
|
||||||
video_service::VIDEO_QOS.lock().unwrap().reset();
|
video_service::VIDEO_QOS.lock().unwrap().reset();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user