MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / binary_to_struct

Function binary_to_struct

chirpstack/src/codec/mod.rs:79–92  ·  view source on GitHub ↗
(
    codec: Codec,
    recv_time: DateTime<Utc>,
    f_port: u8,
    variables: &HashMap<String, String>,
    decoder_config: &str,
    b: &[u8],
)

Source from the content-addressed store, hash-verified

77}
78
79pub 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
94pub async fn struct_to_binary(
95 codec: Codec,

Callers 1

send_uplink_eventMethod · 0.85

Calls 1

decodeFunction · 0.50

Tested by

no test coverage detected