(
codec: Codec,
f_port: u8,
variables: &HashMap<String, String>,
encoder_config: &str,
obj: &prost_types::Struct,
)
| 92 | } |
| 93 | |
| 94 | pub async fn struct_to_binary( |
| 95 | codec: Codec, |
| 96 | f_port: u8, |
| 97 | variables: &HashMap<String, String>, |
| 98 | encoder_config: &str, |
| 99 | obj: &prost_types::Struct, |
| 100 | ) -> Result<(u8, Vec<u8>)> { |
| 101 | Ok(match codec { |
| 102 | Codec::NONE => (f_port, Vec::new()), |
| 103 | Codec::CAYENNE_LPP => ( |
| 104 | f_port, |
| 105 | cayenne_lpp::encode(obj).context("CayenneLpp encode")?, |
| 106 | ), |
| 107 | Codec::JS => js::encode(f_port, variables, encoder_config, obj).await?, |
| 108 | }) |
| 109 | } |
| 110 | |
| 111 | pub fn get_measurements(s: &pbjson_types::Struct) -> HashMap<String, pbjson_types::value::Kind> { |
| 112 | let mut out: HashMap<String, pbjson_types::value::Kind> = HashMap::new(); |
no test coverage detected