(
codec: Codec,
recv_time: DateTime<Utc>,
f_port: u8,
variables: &HashMap<String, String>,
decoder_config: &str,
b: &[u8],
)
| 77 | } |
| 78 | |
| 79 | pub async fn binary_to_struct( |
| 80 | codec: Codec, |
| 81 | recv_time: DateTime<Utc>, |
| 82 | f_port: u8, |
| 83 | variables: &HashMap<String, String>, |
| 84 | decoder_config: &str, |
| 85 | b: &[u8], |
| 86 | ) -> Result<Option<pbjson_types::Struct>> { |
| 87 | Ok(match codec { |
| 88 | Codec::NONE => None, |
| 89 | Codec::CAYENNE_LPP => Some(cayenne_lpp::decode(b).context("CayenneLpp decode")?), |
| 90 | Codec::JS => Some(js::decode(recv_time, f_port, variables, decoder_config, b).await?), |
| 91 | }) |
| 92 | } |
| 93 | |
| 94 | pub async fn struct_to_binary( |
| 95 | codec: Codec, |
no test coverage detected