Skip to content

Commit af95746

Browse files
committed
fix: fix up stream de-sync
1 parent b335907 commit af95746

File tree

5 files changed

+96
-14
lines changed

5 files changed

+96
-14
lines changed

GUI/ETVR/src-tauri/src/modules/m_dnsquery/mod.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! A mdns query client.
22
3-
use log::error;
3+
use log::{error, info};
44
use mdns_sd::{ServiceDaemon, ServiceEvent};
55
use serde::Serialize;
66
use std::collections::hash_map::HashMap;
@@ -92,7 +92,7 @@ pub async fn run_query(
9292
if let Ok(event) = receiver.recv_async().await {
9393
match event {
9494
ServiceEvent::ServiceResolved(info) => {
95-
println!(
95+
info!(
9696
"At {:?}: Resolved a new service: {} IP: {:#?}:{:#?} Hostname: {:#?}",
9797
now.elapsed(),
9898
info.get_fullname(),
@@ -102,13 +102,13 @@ pub async fn run_query(
102102
);
103103
//* split the fullname by '.' and take the first element
104104
let name = info.get_hostname();
105-
println!("Service name: {}", name);
105+
info!("Service name: {}", name);
106106
//* remove the period at the end of the name
107107
let mut name = name.trim_end_matches('.');
108108
//* append name to 'http://' to get the base url
109109
let mut base_url = String::from("http://");
110110
base_url.push_str(name);
111-
println!("Base URL: {}", base_url);
111+
info!("Base URL: {}", base_url);
112112
//* add the base url to the hashmap
113113
instance
114114
.base_url
@@ -128,7 +128,7 @@ pub async fn run_query(
128128
mdns_data.ips = instance.ip.clone();
129129
}
130130
other_event => {
131-
println!(
131+
info!(
132132
"At {:?} : Received other event: {:?}",
133133
now.elapsed(),
134134
&other_event
@@ -138,7 +138,8 @@ pub async fn run_query(
138138
}
139139
}
140140
std::thread::sleep(std::time::Duration::from_nanos(1));
141-
mdns.stop_browse(&service_type).map_err(|e| e.to_string())?;
141+
//mdns.stop_browse(&service_type).map_err(|e| e.to_string())?;
142+
info!("Stopping mDNS query daemon - refresh to restart");
142143
mdns.shutdown().map_err(|e| e.to_string())?;
143144
Ok(())
144145
}

GUI/ETVR/src-tauri/src/modules/tauri_commands/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ pub async fn run_mdns_query(
3939
service_type: String,
4040
scan_time: u64,
4141
) -> Result<m_dnsquery::MdnsData, String> {
42-
println!("Starting MDNS query to find devices");
42+
info!("Starting MDNS query to find devices");
4343
let mut mdns: m_dnsquery::Mdns = m_dnsquery::Mdns::new();
4444
let mut mdns_data = m_dnsquery::MdnsData::new();
4545
let ref_mdns = &mut mdns;
46-
println!("MDNS Service Thread acquired lock");
46+
info!("MDNS Service Thread acquired lock");
4747
m_dnsquery::run_query(ref_mdns, service_type, &mut mdns_data, scan_time)
4848
.await
4949
.expect("Error in mDNS query");
50-
println!("MDNS query complete");
51-
println!(
50+
info!("MDNS query complete");
51+
info!(
5252
"MDNS query results: {:#?}",
5353
m_dnsquery::get_urls(&*ref_mdns)
5454
); // get's an array of the base urls found
@@ -129,7 +129,7 @@ pub fn handle_debug<R: tauri::Runtime>(
129129
) -> Result<log::LevelFilter, String> {
130130
// read the Store file
131131
let stores = app.state::<tauri_plugin_store::StoreCollection<R>>();
132-
let path = std::path::PathBuf::from(".app-settings.etvr");
132+
let path = std::path::PathBuf::from(".app-settings.bin");
133133
// match the store value to a LogFilter
134134
let mut debug_state: String = String::new();
135135
with_store(app.clone(), stores, path, |store| {
+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import { EraseButton } from '@components/Button/EraseButton'
2+
import { OpenDocs } from '@components/Button/OpenDocs'
3+
import { WebSerial } from '@components/Button/WebSerial'
4+
import { FirmwareList } from '@components/FirmwareList'
5+
import { Form } from '@components/Form'
6+
import { useAppAPIContext } from '@src/store/context/api'
7+
import { useAppNotificationsContext } from '@src/store/context/notifications'
8+
import AppSettings from '@src/views/AppSettings'
9+
10+
const AppSettingsPage = () => {
11+
let download: (firmware: string) => Promise<void> = () => Promise.resolve()
12+
13+
const { downloadAsset } = useAppAPIContext()
14+
15+
if (downloadAsset) download = downloadAsset
16+
17+
const { handleSound } = useAppNotificationsContext()
18+
19+
return (
20+
<div class="flex justify-center items-center content-center flex-col pt-[100px] text-white">
21+
<AppSettings
22+
onClickFlipLeftXAxis={() => console.log('onClickFlipLeftXAxis')}
23+
onClickFlipRightXAxis={() => {
24+
console.log('onClickFlipRightXAxis')
25+
}}
26+
onClickFlipYAxis={() => {
27+
console.log('onClickFlipYAxis')
28+
}}
29+
onClickDualEyeFalloff={() => {
30+
console.log('onClickDualEyeFalloff')
31+
}}
32+
onClickSyncBlinks={() => {
33+
console.log('onClickSyncBlinks')
34+
}}
35+
onClickBlobFallback={() => {
36+
console.log('onClickBlobFallback')
37+
}}
38+
onChange={(format, value) => {
39+
console.log(format, value)
40+
}}
41+
onChangeAddress={() => {
42+
console.log('onChangeAddress')
43+
}}
44+
onChangeOSCPort={() => {
45+
console.log('onChangeOSCPort')
46+
}}
47+
onChangeOSCReceiverPort={() => {
48+
console.log('onChangeOSCReceiverPort')
49+
}}
50+
onChangeOSCRecenterPort={() => {
51+
console.log('onChangeOSCRecenterPort')
52+
}}
53+
onChangeOSCRecalibrateAddress={() => {
54+
console.log('onChangeOSCRecalibrateAddress')
55+
}}
56+
/>
57+
<button
58+
class="rounded-[8px] bg-blue-700 p-2 text-white mt-1 hover:bg-blue-600 focus:bg-blue-500"
59+
onClick={() => {
60+
download('esp32AIThinker')
61+
console.log('[Download Asset]: Downloading...')
62+
}}>
63+
Download Release Asset
64+
</button>
65+
<button
66+
class="rounded-[8px] bg-blue-700 p-2 text-white mt-1 hover:bg-blue-600 focus:bg-blue-500"
67+
onClick={() => {
68+
handleSound('EyeTrackApp_Audio_start.wav')
69+
console.log('[Audio Handler]: Sound Played')
70+
}}>
71+
Play Sound
72+
</button>
73+
<EraseButton />
74+
<WebSerial />
75+
<OpenDocs />
76+
<FirmwareList />
77+
<Form />
78+
</div>
79+
)
80+
}
81+
82+
export default AppSettingsPage

GUI/ETVR/src/routes/Routes.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ const AppRoutes = () => {
6060
generateWebsocketClients()
6161
//})
6262
})
63-
64-
// TODO: check notif perms and request GH data
6563
checkPermission()
6664
doGHRequest()
6765
})
@@ -75,6 +73,7 @@ const AppRoutes = () => {
7573
enableNotificationsSounds: getEnableNotificationsSounds(),
7674
globalNotificationsType: getGlobalNotificationsType(),
7775
enableMDNS: getEnableMDNS(),
76+
// TODO: expose the debug levels to the user
7877
debugMode: 'info',
7978
scanForCamerasOnStartup: getScanForCamerasOnStartup(),
8079
}

GUI/ETVR/src/store/tauriStore/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { Store } from 'tauri-plugin-store-api'
55
import type { PersistentSettings } from '@src/static/types'
66

7-
const persistentStore = new Store('.app-settings.etvr')
7+
const persistentStore = new Store('.app-settings.bin')
88

99
export const usePersistentStore = () => {
1010
const save = async () => {

0 commit comments

Comments
 (0)