Skip to content

Commit 24c43c6

Browse files
committed
btle: info -> debug
1 parent 7183f8e commit 24c43c6

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/btle.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ pub async fn run_btle_server(
6060
adapter: &Adapter,
6161
state: AppState,
6262
) -> bluer::Result<bluer::gatt::local::ApplicationHandle> {
63-
info!("{} 🥏 BLE Starting", NAME);
64-
info!(
63+
debug!("{} 🥏 BLE Starting", NAME);
64+
debug!(
6565
"{} 🥏 BLE Started alias: <bold><green>{}</>",
6666
NAME,
6767
adapter.name()
@@ -102,7 +102,7 @@ pub async fn run_btle_server(
102102

103103
match adapter.serve_gatt_application(app).await {
104104
Ok(h) => {
105-
info!("GATT registered successfully");
105+
debug!("GATT registered successfully");
106106
// move `new_char_control` out so caller can use it
107107
break (h, new_char_control);
108108
}
@@ -114,12 +114,12 @@ pub async fn run_btle_server(
114114
}
115115
};
116116

117-
info!("{} 🥏 GATT server running", NAME);
117+
debug!("{} 🥏 GATT server running", NAME);
118118

119119
let mut char_control = char_control;
120120

121121
tokio::spawn(async move {
122-
info!("{} 🥏 char_control task starting", NAME);
122+
debug!("{} 🥏 char_control task starting", NAME);
123123

124124
let mut reader_opt = None;
125125
let mut writer_opt = None;
@@ -128,14 +128,14 @@ pub async fn run_btle_server(
128128
loop {
129129
match char_control.next().await {
130130
Some(evt) => {
131-
info!("{} 🥏 Event received: {:?}", NAME, evt);
131+
debug!("{} 🥏 Event received: {:?}", NAME, evt);
132132

133133
match evt {
134134
bluer::gatt::local::CharacteristicControlEvent::Write(req) => {
135-
info!("{} 🥏 Got Write event (mtu={})", NAME, req.mtu());
135+
debug!("{} 🥏 Got Write event (mtu={})", NAME, req.mtu());
136136
match req.accept() {
137137
Ok(reader) => {
138-
info!(
138+
debug!(
139139
"{} 🥏 Accepted write request (reader mtu={})",
140140
NAME,
141141
reader.mtu()
@@ -149,7 +149,7 @@ pub async fn run_btle_server(
149149
}
150150

151151
bluer::gatt::local::CharacteristicControlEvent::Notify(notifier) => {
152-
info!(
152+
debug!(
153153
"{} 🥏 Got Notify subscription event (mtu={})",
154154
NAME,
155155
notifier.mtu()
@@ -169,19 +169,19 @@ pub async fn run_btle_server(
169169
break;
170170
}
171171
Ok(n) => {
172-
info!("{} 🥏 Read {} bytes from client (drain)", NAME, n);
172+
debug!("{} 🥏 Read {} bytes from client (drain)", NAME, n);
173173
buf.extend_from_slice(&tmp[..n]);
174174

175175
// Debug print tail
176176
if buf.len() > 64 {
177177
let tail = &buf[buf.len() - 64..];
178-
info!(
178+
debug!(
179179
"{} 🥏 Buffer tail (hex): {}",
180180
NAME,
181181
hex::encode(tail)
182182
);
183183
} else {
184-
info!("{} 🥏 Buffer (hex): {}", NAME, hex::encode(&buf));
184+
debug!("{} 🥏 Buffer (hex): {}", NAME, hex::encode(&buf));
185185
}
186186

187187
// Check for finish marker at end
@@ -193,7 +193,7 @@ pub async fn run_btle_server(
193193
{
194194
// Found finish. Remove marker and process request.
195195
buf.truncate(len - 4);
196-
info!("{} 🥏 Finish marker detected; total payload {} bytes", NAME, buf.len());
196+
debug!("{} 🥏 Finish marker detected; total payload {} bytes", NAME, buf.len());
197197

198198
// Decompress & parse safely
199199
let parsed_req = match std::panic::catch_unwind(|| {
@@ -207,7 +207,7 @@ pub async fn run_btle_server(
207207
}
208208
};
209209

210-
info!("{} 🥏 Parsed request: {:?}", NAME, parsed_req);
210+
debug!("{} 🥏 Parsed request: {:?}", NAME, parsed_req);
211211

212212
// Build response (may use blocking inside craft_response; it already blocks internally)
213213
let resp =
@@ -227,10 +227,10 @@ pub async fn run_btle_server(
227227

228228
// Send response if we have a writer (notify subscription)
229229
if let Some(writer) = writer_opt.as_mut() {
230-
info!("{} 🥏 Writing {} compressed bytes back (writer mtu={})", NAME, compressed.len(), writer.mtu());
230+
debug!("{} 🥏 Writing {} compressed bytes back (writer mtu={})", NAME, compressed.len(), writer.mtu());
231231
for c in compressed.chunks(writer.mtu() - 4) {
232232
match writer.write_all(c).await {
233-
Ok(_) => info!(
233+
Ok(_) => debug!(
234234
"{} 🥏 wrote chunk {} bytes",
235235
NAME,
236236
c.len()
@@ -248,7 +248,7 @@ pub async fn run_btle_server(
248248
.write_all(&FINISH_SIGNAL.to_le_bytes())
249249
.await
250250
{
251-
Ok(_) => info!(
251+
Ok(_) => debug!(
252252
"{} 🥏 Finish marker written to client",
253253
NAME
254254
),
@@ -282,13 +282,13 @@ pub async fn run_btle_server(
282282
}
283283

284284
None => {
285-
info!("{} 🥏 char_control.next() returned None - control stream closed; exiting task", NAME);
285+
debug!("{} 🥏 char_control.next() returned None - control stream closed; exiting task", NAME);
286286
break;
287287
}
288288
} // end match char_control.next()
289289
} // end outer loop
290290

291-
info!("{} 🥏 char_control task ended", NAME);
291+
debug!("{} 🥏 char_control task ended", NAME);
292292
});
293293

294294
Ok(app_handle)
@@ -341,7 +341,7 @@ async fn craft_response(req: &Request, state: AppState) -> Response {
341341
let cfg_guard = state.config_json.read().await;
342342
let cfg_str = serde_json::to_string(&*cfg_guard).unwrap_or_default();
343343

344-
info!("{} 🥏 /get-config-data response: {}", NAME, cfg_str);
344+
debug!("{} 🥏 /get-config-data response: {}", NAME, cfg_str);
345345

346346
Response {
347347
s: 200,
@@ -354,7 +354,7 @@ async fn craft_response(req: &Request, state: AppState) -> Response {
354354
let cfg_guard = state.config.read().await;
355355
let cfg_str = serde_json::to_string(&*cfg_guard).unwrap_or_default();
356356

357-
info!("{} 🥏 /get-config response: {}", NAME, cfg_str);
357+
debug!("{} 🥏 /get-config response: {}", NAME, cfg_str);
358358

359359
Response {
360360
s: 200,
@@ -399,7 +399,7 @@ async fn craft_response(req: &Request, state: AppState) -> Response {
399399
cfg.save((&state.config_file).to_path_buf());
400400
}
401401

402-
info!(
402+
debug!(
403403
"{} 🥏 /update-config response: {}",
404404
NAME,
405405
"{ \"status\": 1 }".to_string()
@@ -500,7 +500,7 @@ async fn craft_response(req: &Request, state: AppState) -> Response {
500500
}
501501
}
502502

503-
info!("{} Received battery data: {:?}", NAME, data);
503+
debug!("{} Received battery data: {:?}", NAME, data);
504504

505505
if let Some(ch) = *state.sensor_channel.lock().await {
506506
if let Some(tx) = state.tx.lock().await.clone() {

0 commit comments

Comments
 (0)