Skip logging of ping messages, cleanup

This commit is contained in:
Maxime Augier 2024-08-13 16:10:02 +02:00
parent 28fdd10e0a
commit 4470f281fc

View File

@ -1,4 +1,4 @@
use serde::{de::IntoDeserializer, Deserialize}; use serde::Deserialize;
use serde_repr::Deserialize_repr; use serde_repr::Deserialize_repr;
use std::num::{ParseFloatError, ParseIntError}; use std::num::{ParseFloatError, ParseIntError};
use thiserror::Error; use thiserror::Error;
@ -6,7 +6,7 @@ use tracing::info;
use ureq::json; use ureq::json;
use crate::{ use crate::{
api::{ChargerOpMode, Context, OutputPhase, UtcDateTime}, api::{ChargerOpMode, Context, UtcDateTime},
signalr::{self, StreamError}, signalr::{self, StreamError},
stream::NegotiateError, stream::NegotiateError,
}; };
@ -90,6 +90,7 @@ impl ObservationData {
}) })
} }
/*
fn dynamic_type(&self) -> DataType { fn dynamic_type(&self) -> DataType {
match self { match self {
ObservationData::Boolean(_) => DataType::Boolean, ObservationData::Boolean(_) => DataType::Boolean,
@ -98,6 +99,7 @@ impl ObservationData {
ObservationData::String(_) => DataType::String, ObservationData::String(_) => DataType::String,
} }
} }
*/
} }
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
@ -278,7 +280,8 @@ impl Stream {
loop { loop {
let msg = self.inner.recv()?; let msg = self.inner.recv()?;
match &msg { match &msg {
Empty | Ping | InvocationResult { .. } => info!("Skipped message: {msg:?}"), Ping => continue,
Empty | InvocationResult { .. } => info!("Skipped message: {msg:?}"),
Invocation { target, arguments } if target == "ProductUpdate" => { Invocation { target, arguments } if target == "ProductUpdate" => {
if arguments.len() != 1 { if arguments.len() != 1 {
return de(msg); return de(msg);