use crate::lowlevel;
use crate::highlevel;
use crate::serde::DeserializeErrorCause;
use crate::translate_util::*;
use num_traits::FromPrimitive;
pub fn raise_command(lowlevel: &lowlevel::Command) -> Result<highlevel::Command, DeserializeErrorCause> {
match lowlevel {
lowlevel::Command::Execute { name, is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "TESTEX"
&& delimiter == &None
=> {
Ok(highlevel::Command::Testex {
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "TESTEXEXT"
&& delimiter == &None
=> {
Ok(highlevel::Command::Testexext {
})
},
lowlevel::Command::Execute { name, is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "TESTNEX"
&& delimiter == &None
=> {
Ok(highlevel::Command::TestCommand {
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTEXEXTFI"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Testexextfi {
field,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTEXEXTFIC"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Testexextfic {
field,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTNSD"
&& delimiter == &Some(String::from(">"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Testnsd {
field,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTNST"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Testnst {
field,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTNSDNST"
&& delimiter == &Some(String::from(">"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Testnsdnst {
field,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTNOD"
&& delimiter == &None
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Testnod {
field,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTEXEXTFS"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = field_option_unwrapped_primitive.clone();
Ok(highlevel::Command::Testexextfs {
field,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTEXEXTFSI"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field1_option = arg_vec.get(0);
let field1_option_unwrapped = field1_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field1_option_unwrapped_primitive = extract_primitive_from_field(field1_option_unwrapped, &arguments)?;
let field1 = field1_option_unwrapped_primitive.clone();
let field2_option = arg_vec.get(1);
let field2_option_unwrapped = field2_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field2_option_unwrapped_primitive = extract_primitive_from_field(field2_option_unwrapped, &arguments)?;
let field2 = extract_int_from_primitive(field2_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Testexextfsi {
field1,
field2,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTEXEXTFSIC"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field1_option = arg_vec.get(0);
let field1_option_unwrapped = field1_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field1_option_unwrapped_primitive = extract_primitive_from_field(field1_option_unwrapped, &arguments)?;
let field1 = field1_option_unwrapped_primitive.clone();
let field2_option = arg_vec.get(1);
let field2_option_unwrapped = field2_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field2_option_unwrapped_primitive = extract_primitive_from_field(field2_option_unwrapped, &arguments)?;
let field2 = extract_int_from_primitive(field2_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Testexextfsic {
field1,
field2,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTIO"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field1_option = arg_vec.get(0);
let field1_option_unwrapped = field1_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field1_option_unwrapped_primitive = extract_primitive_from_field(field1_option_unwrapped, &arguments)?;
let field1 = extract_int_from_primitive(field1_option_unwrapped_primitive, &arguments)?;
let field2_option = arg_vec.get(1);
let field2 = match field2_option {
Some(field2_option_unwrapped) if !field2_option_unwrapped.is_empty() => {
let field2_option_unwrapped_primitive = extract_primitive_from_field(field2_option_unwrapped, &arguments)?;
let field2_unwrapped = extract_int_from_primitive(field2_option_unwrapped_primitive, &arguments)?;
Some(field2_unwrapped)
}
_ => None,
};
Ok(highlevel::Command::Testio {
field1,
field2,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTL"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let mut field = Vec::new();
for field_element_raw in arg_vec[0..].into_iter() {
let field_element_option = if field_element_raw.is_empty() { None } else { Some(field_element_raw) };
let field_element_option_unwrapped = field_element_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_element_option_unwrapped_primitive = extract_primitive_from_field(field_element_option_unwrapped, &arguments)?;
let field_element = extract_int_from_primitive(field_element_option_unwrapped_primitive, &arguments)?;
field.push(field_element);
}
Ok(highlevel::Command::Testl {
field,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTOL"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let mut field = Vec::new();
for field_element_raw in arg_vec[0..].into_iter() {
let field_element_option = if field_element_raw.is_empty() { None } else { Some(field_element_raw) };
let field_element = match field_element_option {
Some(field_element_option_unwrapped) if !field_element_option_unwrapped.is_empty() => {
let field_element_option_unwrapped_primitive = extract_primitive_from_field(field_element_option_unwrapped, &arguments)?;
let field_element_unwrapped = extract_int_from_primitive(field_element_option_unwrapped_primitive, &arguments)?;
Some(field_element_unwrapped)
}
_ => None,
};
field.push(field_element);
}
Ok(highlevel::Command::Testol {
field,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTM"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let mut field = std::collections::HashMap::new();
for field_element in arg_vec[0..].into_iter() {
let field_element_primitive = extract_key_from_field(field_element, &arguments)?;
let field_key = extract_int_from_primitive(field_element_primitive, &arguments)?;
let field_element_primitive = extract_value_from_field(field_element, &arguments)?;
let field_value = field_element_primitive.clone();
let _ = field.insert(field_key, field_value);
}
Ok(highlevel::Command::Testm {
field,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTP"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ParenthesisDelimitedArgumentLists(_))
=> {
let arg_vec_vec = extract_vec_vec_from_args(&arguments)?;
let arg_vec = arg_vec_vec.get(0).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Testp {
field,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTPP"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ParenthesisDelimitedArgumentLists(_))
=> {
let arg_vec_vec = extract_vec_vec_from_args(&arguments)?;
let arg_vec = arg_vec_vec.get(0).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field1_option = arg_vec.get(0);
let field1_option_unwrapped = field1_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field1_option_unwrapped_primitive = extract_primitive_from_field(field1_option_unwrapped, &arguments)?;
let field1 = extract_int_from_primitive(field1_option_unwrapped_primitive, &arguments)?;
let arg_vec = arg_vec_vec.get(1).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field2_option = arg_vec.get(0);
let field2_option_unwrapped = field2_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field2_option_unwrapped_primitive = extract_primitive_from_field(field2_option_unwrapped, &arguments)?;
let field2 = extract_int_from_primitive(field2_option_unwrapped_primitive, &arguments)?;
let field3_option = arg_vec.get(1);
let field3_option_unwrapped = field3_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field3_option_unwrapped_primitive = extract_primitive_from_field(field3_option_unwrapped, &arguments)?;
let field3 = field3_option_unwrapped_primitive.clone();
Ok(highlevel::Command::Testpp {
field1,
field2,
field3,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTPMPIL"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ParenthesisDelimitedArgumentLists(_))
=> {
let arg_vec_vec = extract_vec_vec_from_args(&arguments)?;
let arg_vec = arg_vec_vec.get(0).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let mut field1 = std::collections::HashMap::new();
for field1_element in arg_vec[0..].into_iter() {
let field1_element_primitive = extract_key_from_field(field1_element, &arguments)?;
let field1_key = extract_int_from_primitive(field1_element_primitive, &arguments)?;
let field1_element_primitive = extract_value_from_field(field1_element, &arguments)?;
let field1_value = field1_element_primitive.clone();
let _ = field1.insert(field1_key, field1_value);
}
let arg_vec = arg_vec_vec.get(1).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field2_option = arg_vec.get(0);
let field2_option_unwrapped = field2_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field2_option_unwrapped_primitive = extract_primitive_from_field(field2_option_unwrapped, &arguments)?;
let field2 = extract_int_from_primitive(field2_option_unwrapped_primitive, &arguments)?;
let mut field3 = Vec::new();
for field3_element_raw in arg_vec[1..].into_iter() {
let field3_element_option = if field3_element_raw.is_empty() { None } else { Some(field3_element_raw) };
let field3_element_option_unwrapped = field3_element_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field3_element_option_unwrapped_primitive = extract_primitive_from_field(field3_element_option_unwrapped, &arguments)?;
let field3_element = extract_int_from_primitive(field3_element_option_unwrapped_primitive, &arguments)?;
field3.push(field3_element);
}
Ok(highlevel::Command::Testpmpil {
field1,
field2,
field3,
})
},
lowlevel::Command::Read { name, is_extension: false, ..} if
name == "TESTR"
=> {
Ok(highlevel::Command::TestrRead {})
},
lowlevel::Command::Read { name, is_extension: true, ..} if
name == "TESTREX"
=> {
Ok(highlevel::Command::TestrexRead {})
},
lowlevel::Command::Test { name, is_extension: false, ..} if
name == "TESTT"
=> {
Ok(highlevel::Command::TesttTest {})
},
lowlevel::Command::Test { name, is_extension: true, ..} if
name == "TESTTEX"
=> {
Ok(highlevel::Command::TesttexTest {})
},
lowlevel::Command::Execute { name, is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTENUM"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field_option_unwrapped_int = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
let field = super::types::TestOneVariantComma::from_i64(field_option_unwrapped_int).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
Ok(highlevel::Command::Testenum {
field,
})
},
lowlevel::Command::Execute { name, is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTBOOL"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field_option_unwrapped_int = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
let field = field_option_unwrapped_int != 0;
Ok(highlevel::Command::Testbool {
field,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "TESTOTHERFILE"
&& delimiter == &None
=> {
Ok(highlevel::Command::Testotherfile {
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "BRSF"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let features_option = arg_vec.get(0);
let features_option_unwrapped = features_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let features_option_unwrapped_primitive = extract_primitive_from_field(features_option_unwrapped, &arguments)?;
let features = extract_int_from_primitive(features_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Brsf {
features,
})
},
lowlevel::Command::Test { name, is_extension: true, ..} if
name == "CIND"
=> {
Ok(highlevel::Command::CindTest {})
},
lowlevel::Command::Read { name, is_extension: true, ..} if
name == "CIND"
=> {
Ok(highlevel::Command::CindRead {})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "CLCC"
&& delimiter == &None
=> {
Ok(highlevel::Command::Clcc {
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "BCC"
&& delimiter == &None
=> {
Ok(highlevel::Command::Bcc {
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "BCS"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let codec_option = arg_vec.get(0);
let codec_option_unwrapped = codec_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let codec_option_unwrapped_primitive = extract_primitive_from_field(codec_option_unwrapped, &arguments)?;
let codec = extract_int_from_primitive(codec_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Bcs {
codec,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "BAC"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let mut codecs = Vec::new();
for codecs_element_raw in arg_vec[0..].into_iter() {
let codecs_element_option = if codecs_element_raw.is_empty() { None } else { Some(codecs_element_raw) };
let codecs_element_option_unwrapped = codecs_element_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let codecs_element_option_unwrapped_primitive = extract_primitive_from_field(codecs_element_option_unwrapped, &arguments)?;
let codecs_element = extract_int_from_primitive(codecs_element_option_unwrapped_primitive, &arguments)?;
codecs.push(codecs_element);
}
Ok(highlevel::Command::Bac {
codecs,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "BIND"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let mut indicators = Vec::new();
for indicators_element_raw in arg_vec[0..].into_iter() {
let indicators_element_option = if indicators_element_raw.is_empty() { None } else { Some(indicators_element_raw) };
let indicators_element_option_unwrapped = indicators_element_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let indicators_element_option_unwrapped_primitive = extract_primitive_from_field(indicators_element_option_unwrapped, &arguments)?;
let indicators_element = extract_int_from_primitive(indicators_element_option_unwrapped_primitive, &arguments)?;
indicators.push(indicators_element);
}
Ok(highlevel::Command::Bind {
indicators,
})
},
lowlevel::Command::Test { name, is_extension: true, ..} if
name == "BIND"
=> {
Ok(highlevel::Command::BindTest {})
},
lowlevel::Command::Read { name, is_extension: true, ..} if
name == "BIND"
=> {
Ok(highlevel::Command::BindRead {})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "BIEV"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let anum_option = arg_vec.get(0);
let anum_option_unwrapped = anum_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let anum_option_unwrapped_primitive = extract_primitive_from_field(anum_option_unwrapped, &arguments)?;
let anum_option_unwrapped_int = extract_int_from_primitive(anum_option_unwrapped_primitive, &arguments)?;
let anum = super::types::BluetoothHFIndicator::from_i64(anum_option_unwrapped_int).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let value_option = arg_vec.get(1);
let value_option_unwrapped = value_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let value_option_unwrapped_primitive = extract_primitive_from_field(value_option_unwrapped, &arguments)?;
let value = extract_int_from_primitive(value_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Biev {
anum,
value,
})
},
lowlevel::Command::Test { name, is_extension: true, ..} if
name == "CHLD"
=> {
Ok(highlevel::Command::ChldTest {})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "CMER"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let mode_option = arg_vec.get(0);
let mode_option_unwrapped = mode_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let mode_option_unwrapped_primitive = extract_primitive_from_field(mode_option_unwrapped, &arguments)?;
let mode = extract_int_from_primitive(mode_option_unwrapped_primitive, &arguments)?;
let keyp_option = arg_vec.get(1);
let keyp_option_unwrapped = keyp_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let keyp_option_unwrapped_primitive = extract_primitive_from_field(keyp_option_unwrapped, &arguments)?;
let keyp = extract_int_from_primitive(keyp_option_unwrapped_primitive, &arguments)?;
let disp_option = arg_vec.get(2);
let disp_option_unwrapped = disp_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let disp_option_unwrapped_primitive = extract_primitive_from_field(disp_option_unwrapped, &arguments)?;
let disp = extract_int_from_primitive(disp_option_unwrapped_primitive, &arguments)?;
let ind_option = arg_vec.get(3);
let ind_option_unwrapped = ind_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let ind_option_unwrapped_primitive = extract_primitive_from_field(ind_option_unwrapped, &arguments)?;
let ind = extract_int_from_primitive(ind_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Cmer {
mode,
keyp,
disp,
ind,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "NREC"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let nrec_option = arg_vec.get(0);
let nrec_option_unwrapped = nrec_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let nrec_option_unwrapped_primitive = extract_primitive_from_field(nrec_option_unwrapped, &arguments)?;
let nrec_option_unwrapped_int = extract_int_from_primitive(nrec_option_unwrapped_primitive, &arguments)?;
let nrec = nrec_option_unwrapped_int != 0;
Ok(highlevel::Command::Nrec {
nrec,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "COPS"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let three_option = arg_vec.get(0);
let three_option_unwrapped = three_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let three_option_unwrapped_primitive = extract_primitive_from_field(three_option_unwrapped, &arguments)?;
let three = extract_int_from_primitive(three_option_unwrapped_primitive, &arguments)?;
let format_option = arg_vec.get(1);
let format_option_unwrapped = format_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let format_option_unwrapped_primitive = extract_primitive_from_field(format_option_unwrapped, &arguments)?;
let format_option_unwrapped_int = extract_int_from_primitive(format_option_unwrapped_primitive, &arguments)?;
let format = super::types::NetworkOperatorNameFormat::from_i64(format_option_unwrapped_int).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
Ok(highlevel::Command::Cops {
three,
format,
})
},
lowlevel::Command::Read { name, is_extension: true, ..} if
name == "COPS"
=> {
Ok(highlevel::Command::CopsRead {})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "CMEE"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let enable_option = arg_vec.get(0);
let enable_option_unwrapped = enable_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let enable_option_unwrapped_primitive = extract_primitive_from_field(enable_option_unwrapped, &arguments)?;
let enable_option_unwrapped_int = extract_int_from_primitive(enable_option_unwrapped_primitive, &arguments)?;
let enable = enable_option_unwrapped_int != 0;
Ok(highlevel::Command::Cmee {
enable,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "CCWA"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let enable_option = arg_vec.get(0);
let enable_option_unwrapped = enable_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let enable_option_unwrapped_primitive = extract_primitive_from_field(enable_option_unwrapped, &arguments)?;
let enable_option_unwrapped_int = extract_int_from_primitive(enable_option_unwrapped_primitive, &arguments)?;
let enable = enable_option_unwrapped_int != 0;
Ok(highlevel::Command::Ccwa {
enable,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "CLIP"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let enable_option = arg_vec.get(0);
let enable_option_unwrapped = enable_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let enable_option_unwrapped_primitive = extract_primitive_from_field(enable_option_unwrapped, &arguments)?;
let enable_option_unwrapped_int = extract_int_from_primitive(enable_option_unwrapped_primitive, &arguments)?;
let enable = enable_option_unwrapped_int != 0;
Ok(highlevel::Command::Clip {
enable,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "CNUM"
&& delimiter == &None
=> {
Ok(highlevel::Command::Cnum {
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "VTS"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let code_option = arg_vec.get(0);
let code_option_unwrapped = code_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let code_option_unwrapped_primitive = extract_primitive_from_field(code_option_unwrapped, &arguments)?;
let code = code_option_unwrapped_primitive.clone();
Ok(highlevel::Command::Vts {
code,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "VGS"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let level_option = arg_vec.get(0);
let level_option_unwrapped = level_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let level_option_unwrapped_primitive = extract_primitive_from_field(level_option_unwrapped, &arguments)?;
let level = extract_int_from_primitive(level_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Vgs {
level,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "VGM"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let level_option = arg_vec.get(0);
let level_option_unwrapped = level_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let level_option_unwrapped_primitive = extract_primitive_from_field(level_option_unwrapped, &arguments)?;
let level = extract_int_from_primitive(level_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Command::Vgm {
level,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "BIA"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let mut indrep = Vec::new();
for indrep_element_raw in arg_vec[0..].into_iter() {
let indrep_element_option = if indrep_element_raw.is_empty() { None } else { Some(indrep_element_raw) };
let indrep_element = match indrep_element_option {
Some(indrep_element_option_unwrapped) if !indrep_element_option_unwrapped.is_empty() => {
let indrep_element_option_unwrapped_primitive = extract_primitive_from_field(indrep_element_option_unwrapped, &arguments)?;
let indrep_element_option_unwrapped_int = extract_int_from_primitive(indrep_element_option_unwrapped_primitive, &arguments)?;
let indrep_element_unwrapped = indrep_element_option_unwrapped_int != 0;
Some(indrep_element_unwrapped)
}
_ => None,
};
indrep.push(indrep_element);
}
Ok(highlevel::Command::Bia {
indrep,
})
},
lowlevel::Command::Execute { name, is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "A"
&& delimiter == &None
=> {
Ok(highlevel::Command::Answer {
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "CHUP"
&& delimiter == &None
=> {
Ok(highlevel::Command::Chup {
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "CHLD"
&& delimiter == &Some(String::from("="))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let command_option = arg_vec.get(0);
let command_option_unwrapped = command_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let command_option_unwrapped_primitive = extract_primitive_from_field(command_option_unwrapped, &arguments)?;
let command = command_option_unwrapped_primitive.clone();
Ok(highlevel::Command::Chld {
command,
})
},
lowlevel::Command::Execute { name, is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "D"
&& delimiter == &None
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let number_option = arg_vec.get(0);
let number_option_unwrapped = number_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let number_option_unwrapped_primitive = extract_primitive_from_field(number_option_unwrapped, &arguments)?;
let number = number_option_unwrapped_primitive.clone();
Ok(highlevel::Command::AtdNumber {
number,
})
},
lowlevel::Command::Execute { name, is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "D"
&& delimiter == &Some(String::from(">"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let location_option = arg_vec.get(0);
let location_option_unwrapped = location_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let location_option_unwrapped_primitive = extract_primitive_from_field(location_option_unwrapped, &arguments)?;
let location = location_option_unwrapped_primitive.clone();
Ok(highlevel::Command::AtdMemory {
location,
})
},
lowlevel::Command::Execute { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "BLDN"
&& delimiter == &None
=> {
Ok(highlevel::Command::Bldn {
})
},
_ => Err(DeserializeErrorCause::UnknownCommand(lowlevel.clone())),
}
}
pub fn raise_success(lowlevel: &lowlevel::Response) -> Result<highlevel::Success, DeserializeErrorCause> {
match lowlevel {
lowlevel::Response::Success { name, is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "TEST"
&& delimiter == &Some(String::from(":"))
=> {
Ok(highlevel::Success::Test {
})
},
lowlevel::Response::Success { name, is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "TESTNOD"
&& delimiter == &None
=> {
Ok(highlevel::Success::Testnod {
})
},
lowlevel::Response::Success { name, is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "TESTN"
&& delimiter == &Some(String::from(":"))
=> {
Ok(highlevel::Success::TestResponse {
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "TESTEXT"
&& delimiter == &Some(String::from(":"))
=> {
Ok(highlevel::Success::Testext {
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "TESTEXTNOD"
&& delimiter == &None
=> {
Ok(highlevel::Success::Testextnod {
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTI"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Testi {
field,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTINOD"
&& delimiter == &None
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Testinod {
field,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTIC"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Testic {
field,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTS"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = field_option_unwrapped_primitive.clone();
Ok(highlevel::Success::Tests {
field,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTSI"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field1_option = arg_vec.get(0);
let field1_option_unwrapped = field1_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field1_option_unwrapped_primitive = extract_primitive_from_field(field1_option_unwrapped, &arguments)?;
let field1 = field1_option_unwrapped_primitive.clone();
let field2_option = arg_vec.get(1);
let field2_option_unwrapped = field2_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field2_option_unwrapped_primitive = extract_primitive_from_field(field2_option_unwrapped, &arguments)?;
let field2 = extract_int_from_primitive(field2_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Testsi {
field1,
field2,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTSIC"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field1_option = arg_vec.get(0);
let field1_option_unwrapped = field1_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field1_option_unwrapped_primitive = extract_primitive_from_field(field1_option_unwrapped, &arguments)?;
let field1 = field1_option_unwrapped_primitive.clone();
let field2_option = arg_vec.get(1);
let field2_option_unwrapped = field2_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field2_option_unwrapped_primitive = extract_primitive_from_field(field2_option_unwrapped, &arguments)?;
let field2 = extract_int_from_primitive(field2_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Testsic {
field1,
field2,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTIO"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field1_option = arg_vec.get(0);
let field1_option_unwrapped = field1_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field1_option_unwrapped_primitive = extract_primitive_from_field(field1_option_unwrapped, &arguments)?;
let field1 = extract_int_from_primitive(field1_option_unwrapped_primitive, &arguments)?;
let field2_option = arg_vec.get(1);
let field2 = match field2_option {
Some(field2_option_unwrapped) if !field2_option_unwrapped.is_empty() => {
let field2_option_unwrapped_primitive = extract_primitive_from_field(field2_option_unwrapped, &arguments)?;
let field2_unwrapped = extract_int_from_primitive(field2_option_unwrapped_primitive, &arguments)?;
Some(field2_unwrapped)
}
_ => None,
};
Ok(highlevel::Success::Testio {
field1,
field2,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTL"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let mut field = Vec::new();
for field_element_raw in arg_vec[0..].into_iter() {
let field_element_option = if field_element_raw.is_empty() { None } else { Some(field_element_raw) };
let field_element_option_unwrapped = field_element_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_element_option_unwrapped_primitive = extract_primitive_from_field(field_element_option_unwrapped, &arguments)?;
let field_element = extract_int_from_primitive(field_element_option_unwrapped_primitive, &arguments)?;
field.push(field_element);
}
Ok(highlevel::Success::Testl {
field,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTOL"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let mut field = Vec::new();
for field_element_raw in arg_vec[0..].into_iter() {
let field_element_option = if field_element_raw.is_empty() { None } else { Some(field_element_raw) };
let field_element = match field_element_option {
Some(field_element_option_unwrapped) if !field_element_option_unwrapped.is_empty() => {
let field_element_option_unwrapped_primitive = extract_primitive_from_field(field_element_option_unwrapped, &arguments)?;
let field_element_unwrapped = extract_int_from_primitive(field_element_option_unwrapped_primitive, &arguments)?;
Some(field_element_unwrapped)
}
_ => None,
};
field.push(field_element);
}
Ok(highlevel::Success::Testol {
field,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTM"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let mut field = std::collections::HashMap::new();
for field_element in arg_vec[0..].into_iter() {
let field_element_primitive = extract_key_from_field(field_element, &arguments)?;
let field_key = extract_int_from_primitive(field_element_primitive, &arguments)?;
let field_element_primitive = extract_value_from_field(field_element, &arguments)?;
let field_value = field_element_primitive.clone();
let _ = field.insert(field_key, field_value);
}
Ok(highlevel::Success::Testm {
field,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTP"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ParenthesisDelimitedArgumentLists(_))
=> {
let arg_vec_vec = extract_vec_vec_from_args(&arguments)?;
let arg_vec = arg_vec_vec.get(0).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Testp {
field,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTPP"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ParenthesisDelimitedArgumentLists(_))
=> {
let arg_vec_vec = extract_vec_vec_from_args(&arguments)?;
let arg_vec = arg_vec_vec.get(0).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field1_option = arg_vec.get(0);
let field1_option_unwrapped = field1_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field1_option_unwrapped_primitive = extract_primitive_from_field(field1_option_unwrapped, &arguments)?;
let field1 = extract_int_from_primitive(field1_option_unwrapped_primitive, &arguments)?;
let arg_vec = arg_vec_vec.get(1).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field2_option = arg_vec.get(0);
let field2_option_unwrapped = field2_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field2_option_unwrapped_primitive = extract_primitive_from_field(field2_option_unwrapped, &arguments)?;
let field2 = extract_int_from_primitive(field2_option_unwrapped_primitive, &arguments)?;
let field3_option = arg_vec.get(1);
let field3_option_unwrapped = field3_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field3_option_unwrapped_primitive = extract_primitive_from_field(field3_option_unwrapped, &arguments)?;
let field3 = field3_option_unwrapped_primitive.clone();
Ok(highlevel::Success::Testpp {
field1,
field2,
field3,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "TESTPMPIL"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ParenthesisDelimitedArgumentLists(_))
=> {
let arg_vec_vec = extract_vec_vec_from_args(&arguments)?;
let arg_vec = arg_vec_vec.get(0).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let mut field1 = std::collections::HashMap::new();
for field1_element in arg_vec[0..].into_iter() {
let field1_element_primitive = extract_key_from_field(field1_element, &arguments)?;
let field1_key = extract_int_from_primitive(field1_element_primitive, &arguments)?;
let field1_element_primitive = extract_value_from_field(field1_element, &arguments)?;
let field1_value = field1_element_primitive.clone();
let _ = field1.insert(field1_key, field1_value);
}
let arg_vec = arg_vec_vec.get(1).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field2_option = arg_vec.get(0);
let field2_option_unwrapped = field2_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field2_option_unwrapped_primitive = extract_primitive_from_field(field2_option_unwrapped, &arguments)?;
let field2 = extract_int_from_primitive(field2_option_unwrapped_primitive, &arguments)?;
let mut field3 = Vec::new();
for field3_element_raw in arg_vec[1..].into_iter() {
let field3_element_option = if field3_element_raw.is_empty() { None } else { Some(field3_element_raw) };
let field3_element_option_unwrapped = field3_element_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field3_element_option_unwrapped_primitive = extract_primitive_from_field(field3_element_option_unwrapped, &arguments)?;
let field3_element = extract_int_from_primitive(field3_element_option_unwrapped_primitive, &arguments)?;
field3.push(field3_element);
}
Ok(highlevel::Success::Testpmpil {
field1,
field2,
field3,
})
},
lowlevel::Response::Success { name, is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "SAME"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::SameOne {
field,
})
},
lowlevel::Response::Success { name, is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "SAME"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ParenthesisDelimitedArgumentLists(_))
=> {
let arg_vec_vec = extract_vec_vec_from_args(&arguments)?;
let arg_vec = arg_vec_vec.get(0).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option = arg_vec.get(0);
let field_option_unwrapped = field_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let field_option_unwrapped_primitive = extract_primitive_from_field(field_option_unwrapped, &arguments)?;
let field = extract_int_from_primitive(field_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::SameTwo {
field,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "BRSF"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let features_option = arg_vec.get(0);
let features_option_unwrapped = features_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let features_option_unwrapped_primitive = extract_primitive_from_field(features_option_unwrapped, &arguments)?;
let features = extract_int_from_primitive(features_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Brsf {
features,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "CIND"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let service_option = arg_vec.get(0);
let service_option_unwrapped = service_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let service_option_unwrapped_primitive = extract_primitive_from_field(service_option_unwrapped, &arguments)?;
let service_option_unwrapped_int = extract_int_from_primitive(service_option_unwrapped_primitive, &arguments)?;
let service = service_option_unwrapped_int != 0;
let call_option = arg_vec.get(1);
let call_option_unwrapped = call_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let call_option_unwrapped_primitive = extract_primitive_from_field(call_option_unwrapped, &arguments)?;
let call_option_unwrapped_int = extract_int_from_primitive(call_option_unwrapped_primitive, &arguments)?;
let call = call_option_unwrapped_int != 0;
let callsetup_option = arg_vec.get(2);
let callsetup_option_unwrapped = callsetup_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let callsetup_option_unwrapped_primitive = extract_primitive_from_field(callsetup_option_unwrapped, &arguments)?;
let callsetup = extract_int_from_primitive(callsetup_option_unwrapped_primitive, &arguments)?;
let callheld_option = arg_vec.get(3);
let callheld_option_unwrapped = callheld_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let callheld_option_unwrapped_primitive = extract_primitive_from_field(callheld_option_unwrapped, &arguments)?;
let callheld = extract_int_from_primitive(callheld_option_unwrapped_primitive, &arguments)?;
let signal_option = arg_vec.get(4);
let signal_option_unwrapped = signal_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let signal_option_unwrapped_primitive = extract_primitive_from_field(signal_option_unwrapped, &arguments)?;
let signal = extract_int_from_primitive(signal_option_unwrapped_primitive, &arguments)?;
let roam_option = arg_vec.get(5);
let roam_option_unwrapped = roam_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let roam_option_unwrapped_primitive = extract_primitive_from_field(roam_option_unwrapped, &arguments)?;
let roam_option_unwrapped_int = extract_int_from_primitive(roam_option_unwrapped_primitive, &arguments)?;
let roam = roam_option_unwrapped_int != 0;
let battchg_option = arg_vec.get(6);
let battchg_option_unwrapped = battchg_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let battchg_option_unwrapped_primitive = extract_primitive_from_field(battchg_option_unwrapped, &arguments)?;
let battchg = extract_int_from_primitive(battchg_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Cind {
service,
call,
callsetup,
callheld,
signal,
roam,
battchg,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "CLCC"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let index_option = arg_vec.get(0);
let index_option_unwrapped = index_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let index_option_unwrapped_primitive = extract_primitive_from_field(index_option_unwrapped, &arguments)?;
let index = extract_int_from_primitive(index_option_unwrapped_primitive, &arguments)?;
let dir_option = arg_vec.get(1);
let dir_option_unwrapped = dir_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let dir_option_unwrapped_primitive = extract_primitive_from_field(dir_option_unwrapped, &arguments)?;
let dir = extract_int_from_primitive(dir_option_unwrapped_primitive, &arguments)?;
let status_option = arg_vec.get(2);
let status_option_unwrapped = status_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let status_option_unwrapped_primitive = extract_primitive_from_field(status_option_unwrapped, &arguments)?;
let status = extract_int_from_primitive(status_option_unwrapped_primitive, &arguments)?;
let mode_option = arg_vec.get(3);
let mode_option_unwrapped = mode_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let mode_option_unwrapped_primitive = extract_primitive_from_field(mode_option_unwrapped, &arguments)?;
let mode = extract_int_from_primitive(mode_option_unwrapped_primitive, &arguments)?;
let mpty_option = arg_vec.get(4);
let mpty_option_unwrapped = mpty_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let mpty_option_unwrapped_primitive = extract_primitive_from_field(mpty_option_unwrapped, &arguments)?;
let mpty = extract_int_from_primitive(mpty_option_unwrapped_primitive, &arguments)?;
let number_option = arg_vec.get(5);
let number_option_unwrapped = number_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let number_option_unwrapped_primitive = extract_primitive_from_field(number_option_unwrapped, &arguments)?;
let number = number_option_unwrapped_primitive.clone();
let ty_option = arg_vec.get(6);
let ty_option_unwrapped = ty_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let ty_option_unwrapped_primitive = extract_primitive_from_field(ty_option_unwrapped, &arguments)?;
let ty = extract_int_from_primitive(ty_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Clcc {
index,
dir,
status,
mode,
mpty,
number,
ty,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "BCS"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let codec_option = arg_vec.get(0);
let codec_option_unwrapped = codec_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let codec_option_unwrapped_primitive = extract_primitive_from_field(codec_option_unwrapped, &arguments)?;
let codec = extract_int_from_primitive(codec_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Bcs {
codec,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "BIND"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ParenthesisDelimitedArgumentLists(_))
=> {
let arg_vec_vec = extract_vec_vec_from_args(&arguments)?;
let arg_vec = arg_vec_vec.get(0).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let mut indicators = Vec::new();
for indicators_element_raw in arg_vec[0..].into_iter() {
let indicators_element_option = if indicators_element_raw.is_empty() { None } else { Some(indicators_element_raw) };
let indicators_element_option_unwrapped = indicators_element_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let indicators_element_option_unwrapped_primitive = extract_primitive_from_field(indicators_element_option_unwrapped, &arguments)?;
let indicators_element_option_unwrapped_int = extract_int_from_primitive(indicators_element_option_unwrapped_primitive, &arguments)?;
let indicators_element = super::types::BluetoothHFIndicator::from_i64(indicators_element_option_unwrapped_int).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
indicators.push(indicators_element);
}
Ok(highlevel::Success::BindList {
indicators,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "BIND"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let anum_option = arg_vec.get(0);
let anum_option_unwrapped = anum_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let anum_option_unwrapped_primitive = extract_primitive_from_field(anum_option_unwrapped, &arguments)?;
let anum_option_unwrapped_int = extract_int_from_primitive(anum_option_unwrapped_primitive, &arguments)?;
let anum = super::types::BluetoothHFIndicator::from_i64(anum_option_unwrapped_int).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let state_option = arg_vec.get(1);
let state_option_unwrapped = state_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let state_option_unwrapped_primitive = extract_primitive_from_field(state_option_unwrapped, &arguments)?;
let state_option_unwrapped_int = extract_int_from_primitive(state_option_unwrapped_primitive, &arguments)?;
let state = state_option_unwrapped_int != 0;
Ok(highlevel::Success::BindStatus {
anum,
state,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "CHLD"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ParenthesisDelimitedArgumentLists(_))
=> {
let arg_vec_vec = extract_vec_vec_from_args(&arguments)?;
let arg_vec = arg_vec_vec.get(0).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let mut commands = Vec::new();
for commands_element_raw in arg_vec[0..].into_iter() {
let commands_element_option = if commands_element_raw.is_empty() { None } else { Some(commands_element_raw) };
let commands_element_option_unwrapped = commands_element_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let commands_element_option_unwrapped_primitive = extract_primitive_from_field(commands_element_option_unwrapped, &arguments)?;
let commands_element = commands_element_option_unwrapped_primitive.clone();
commands.push(commands_element);
}
Ok(highlevel::Success::Chld {
commands,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "COPS"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let format_option = arg_vec.get(0);
let format_option_unwrapped = format_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let format_option_unwrapped_primitive = extract_primitive_from_field(format_option_unwrapped, &arguments)?;
let format_option_unwrapped_int = extract_int_from_primitive(format_option_unwrapped_primitive, &arguments)?;
let format = super::types::NetworkOperatorNameFormat::from_i64(format_option_unwrapped_int).ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let zero_option = arg_vec.get(1);
let zero_option_unwrapped = zero_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let zero_option_unwrapped_primitive = extract_primitive_from_field(zero_option_unwrapped, &arguments)?;
let zero = extract_int_from_primitive(zero_option_unwrapped_primitive, &arguments)?;
let operator_option = arg_vec.get(2);
let operator_option_unwrapped = operator_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let operator_option_unwrapped_primitive = extract_primitive_from_field(operator_option_unwrapped, &arguments)?;
let operator = operator_option_unwrapped_primitive.clone();
Ok(highlevel::Success::Cops {
format,
zero,
operator,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "CLIP"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let number_option = arg_vec.get(0);
let number_option_unwrapped = number_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let number_option_unwrapped_primitive = extract_primitive_from_field(number_option_unwrapped, &arguments)?;
let number = number_option_unwrapped_primitive.clone();
let ty_option = arg_vec.get(1);
let ty_option_unwrapped = ty_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let ty_option_unwrapped_primitive = extract_primitive_from_field(ty_option_unwrapped, &arguments)?;
let ty = extract_int_from_primitive(ty_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Clip {
number,
ty,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "CNUM"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let alpha_option = arg_vec.get(0);
let alpha_option_unwrapped = alpha_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let alpha_option_unwrapped_primitive = extract_primitive_from_field(alpha_option_unwrapped, &arguments)?;
let alpha = alpha_option_unwrapped_primitive.clone();
let number_option = arg_vec.get(1);
let number_option_unwrapped = number_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let number_option_unwrapped_primitive = extract_primitive_from_field(number_option_unwrapped, &arguments)?;
let number = number_option_unwrapped_primitive.clone();
let ty_option = arg_vec.get(2);
let ty_option_unwrapped = ty_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let ty_option_unwrapped_primitive = extract_primitive_from_field(ty_option_unwrapped, &arguments)?;
let ty = extract_int_from_primitive(ty_option_unwrapped_primitive, &arguments)?;
let speed_option = arg_vec.get(3);
let speed_option_unwrapped = speed_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let speed_option_unwrapped_primitive = extract_primitive_from_field(speed_option_unwrapped, &arguments)?;
let speed = speed_option_unwrapped_primitive.clone();
let service_option = arg_vec.get(4);
let service_option_unwrapped = service_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let service_option_unwrapped_primitive = extract_primitive_from_field(service_option_unwrapped, &arguments)?;
let service = extract_int_from_primitive(service_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Cnum {
alpha,
number,
ty,
speed,
service,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "VGS"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let level_option = arg_vec.get(0);
let level_option_unwrapped = level_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let level_option_unwrapped_primitive = extract_primitive_from_field(level_option_unwrapped, &arguments)?;
let level = extract_int_from_primitive(level_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Vgs {
level,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "VGM"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let level_option = arg_vec.get(0);
let level_option_unwrapped = level_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let level_option_unwrapped_primitive = extract_primitive_from_field(level_option_unwrapped, &arguments)?;
let level = extract_int_from_primitive(level_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Vgm {
level,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "CIEV"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let ind_option = arg_vec.get(0);
let ind_option_unwrapped = ind_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let ind_option_unwrapped_primitive = extract_primitive_from_field(ind_option_unwrapped, &arguments)?;
let ind = extract_int_from_primitive(ind_option_unwrapped_primitive, &arguments)?;
let value_option = arg_vec.get(1);
let value_option_unwrapped = value_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let value_option_unwrapped_primitive = extract_primitive_from_field(value_option_unwrapped, &arguments)?;
let value = extract_int_from_primitive(value_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Ciev {
ind,
value,
})
},
lowlevel::Response::Success { name, is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter, arguments, .. }} if
name == "CCWA"
&& delimiter == &Some(String::from(":"))
&& matches!(arguments, lowlevel::Arguments::ArgumentList(_))
=> {
let arg_vec = extract_vec_from_args(&arguments)?;
let number_option = arg_vec.get(0);
let number_option_unwrapped = number_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let number_option_unwrapped_primitive = extract_primitive_from_field(number_option_unwrapped, &arguments)?;
let number = number_option_unwrapped_primitive.clone();
let ty_option = arg_vec.get(1);
let ty_option_unwrapped = ty_option.ok_or_else(|| DeserializeErrorCause::UnknownArguments(arguments.clone()))?;
let ty_option_unwrapped_primitive = extract_primitive_from_field(ty_option_unwrapped, &arguments)?;
let ty = extract_int_from_primitive(ty_option_unwrapped_primitive, &arguments)?;
Ok(highlevel::Success::Ccwa {
number,
ty,
})
},
lowlevel::Response::Success { name, is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter, .. }} if
name == "RING"
&& delimiter == &None
=> {
Ok(highlevel::Success::Ring {
})
},
_ => Err(DeserializeErrorCause::UnknownResponse(lowlevel.clone())),
}
}
pub fn lower_command(highlevel: &highlevel::Command) -> lowlevel::Command {
match highlevel {
highlevel::Command::Testex { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Command::Execute { name: String::from("TESTEX"), is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
highlevel::Command::Testexext { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Command::Execute { name: String::from("TESTEXEXT"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
highlevel::Command::TestCommand { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Command::Execute { name: String::from("TESTNEX"), is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
highlevel::Command::Testexextfi {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string = i64::to_string(&field);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTEXEXTFI"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Testexextfic {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string = i64::to_string(&field);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTEXEXTFIC"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Testnsd {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string = i64::to_string(&field);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTNSD"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(">")), arguments, terminator: None } }
},
highlevel::Command::Testnst {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string = i64::to_string(&field);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTNST"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: Some(String::from(";")) } }
},
highlevel::Command::Testnsdnst {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string = i64::to_string(&field);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTNSDNST"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(">")), arguments, terminator: Some(String::from(";")) } }
},
highlevel::Command::Testnod {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string = i64::to_string(&field);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTNOD"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
highlevel::Command::Testexextfs {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string = field.clone();
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTEXEXTFS"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Testexextfsi {
field1,
field2,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field1_string = field1.clone();
let field1_primitive = lowlevel::Argument::PrimitiveArgument(field1_string);
raw_arguments.push(field1_primitive);
let field2_string = i64::to_string(&field2);
let field2_primitive = lowlevel::Argument::PrimitiveArgument(field2_string);
raw_arguments.push(field2_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTEXEXTFSI"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Testexextfsic {
field1,
field2,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field1_string = field1.clone();
let field1_primitive = lowlevel::Argument::PrimitiveArgument(field1_string);
raw_arguments.push(field1_primitive);
let field2_string = i64::to_string(&field2);
let field2_primitive = lowlevel::Argument::PrimitiveArgument(field2_string);
raw_arguments.push(field2_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTEXEXTFSIC"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Testio {
field1,
field2,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field1_string = i64::to_string(&field1);
let field1_primitive = lowlevel::Argument::PrimitiveArgument(field1_string);
raw_arguments.push(field1_primitive);
match field2 {
None => {
raw_arguments.push(lowlevel::Argument::PrimitiveArgument(String::new()));
}
Some(field2_unwrapped) => {
let field2_unwrapped_string = i64::to_string(&field2_unwrapped);
let field2_primitive = lowlevel::Argument::PrimitiveArgument(field2_unwrapped_string);
raw_arguments.push(field2_primitive);
}
}
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTIO"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Testl {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
for field_element in field.into_iter() {
let field_element_string = i64::to_string(&field_element);
let field_element_primitive = lowlevel::Argument::PrimitiveArgument(field_element_string);
raw_arguments.push(field_element_primitive);
}
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTL"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Testol {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
for field_element in field.into_iter() {
match field_element {
None => {
raw_arguments.push(lowlevel::Argument::PrimitiveArgument(String::new()));
}
Some(field_element_unwrapped) => {
let field_element_unwrapped_string = i64::to_string(&field_element_unwrapped);
let field_element_primitive = lowlevel::Argument::PrimitiveArgument(field_element_unwrapped_string);
raw_arguments.push(field_element_primitive);
}
}
}
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTOL"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Testm {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
for (field_typed_key, field_typed_value) in field {
let field_primitive_key = i64::to_string(&field_typed_key);
let field_primitive_value = field_typed_value.clone();
let field_untyped_pair = lowlevel::Argument::KeyValueArgument { key: field_primitive_key, value: field_primitive_value };
raw_arguments.push(field_untyped_pair);
}
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTM"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Testp {
field,
} => {
let mut raw_arguments_outer = Vec::<Vec<lowlevel::Argument>>::new();
let mut raw_arguments_inner = Vec::<lowlevel::Argument>::new();
let field_string = i64::to_string(&field);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments_inner.push(field_primitive);
raw_arguments_outer.push(raw_arguments_inner);
let arguments = lowlevel::Arguments::ParenthesisDelimitedArgumentLists(raw_arguments_outer);
lowlevel::Command::Execute { name: String::from("TESTP"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Testpp {
field1,
field2,
field3,
} => {
let mut raw_arguments_outer = Vec::<Vec<lowlevel::Argument>>::new();
let mut raw_arguments_inner = Vec::<lowlevel::Argument>::new();
let field1_string = i64::to_string(&field1);
let field1_primitive = lowlevel::Argument::PrimitiveArgument(field1_string);
raw_arguments_inner.push(field1_primitive);
raw_arguments_outer.push(raw_arguments_inner);
let mut raw_arguments_inner = Vec::<lowlevel::Argument>::new();
let field2_string = i64::to_string(&field2);
let field2_primitive = lowlevel::Argument::PrimitiveArgument(field2_string);
raw_arguments_inner.push(field2_primitive);
let field3_string = field3.clone();
let field3_primitive = lowlevel::Argument::PrimitiveArgument(field3_string);
raw_arguments_inner.push(field3_primitive);
raw_arguments_outer.push(raw_arguments_inner);
let arguments = lowlevel::Arguments::ParenthesisDelimitedArgumentLists(raw_arguments_outer);
lowlevel::Command::Execute { name: String::from("TESTPP"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Testpmpil {
field1,
field2,
field3,
} => {
let mut raw_arguments_outer = Vec::<Vec<lowlevel::Argument>>::new();
let mut raw_arguments_inner = Vec::<lowlevel::Argument>::new();
for (field1_typed_key, field1_typed_value) in field1 {
let field1_primitive_key = i64::to_string(&field1_typed_key);
let field1_primitive_value = field1_typed_value.clone();
let field1_untyped_pair = lowlevel::Argument::KeyValueArgument { key: field1_primitive_key, value: field1_primitive_value };
raw_arguments_inner.push(field1_untyped_pair);
}
raw_arguments_outer.push(raw_arguments_inner);
let mut raw_arguments_inner = Vec::<lowlevel::Argument>::new();
let field2_string = i64::to_string(&field2);
let field2_primitive = lowlevel::Argument::PrimitiveArgument(field2_string);
raw_arguments_inner.push(field2_primitive);
for field3_element in field3.into_iter() {
let field3_element_string = i64::to_string(&field3_element);
let field3_element_primitive = lowlevel::Argument::PrimitiveArgument(field3_element_string);
raw_arguments_inner.push(field3_element_primitive);
}
raw_arguments_outer.push(raw_arguments_inner);
let arguments = lowlevel::Arguments::ParenthesisDelimitedArgumentLists(raw_arguments_outer);
lowlevel::Command::Execute { name: String::from("TESTPMPIL"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::TestrRead {} => {
lowlevel::Command::Read { name: String::from("TESTR"), is_extension: false }
},
highlevel::Command::TestrexRead {} => {
lowlevel::Command::Read { name: String::from("TESTREX"), is_extension: true }
},
highlevel::Command::TesttTest {} => {
lowlevel::Command::Test { name: String::from("TESTT"), is_extension: false }
},
highlevel::Command::TesttexTest {} => {
lowlevel::Command::Test { name: String::from("TESTTEX"), is_extension: true }
},
highlevel::Command::Testenum {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string_int = *field as i64;
let field_string = i64::to_string(&field_string_int);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTENUM"), is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Testbool {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string_int = if *field { 1 } else { 0 };
let field_string = i64::to_string(&field_string_int);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("TESTBOOL"), is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Testotherfile { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Command::Execute { name: String::from("TESTOTHERFILE"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
highlevel::Command::Brsf {
features,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let features_string = i64::to_string(&features);
let features_primitive = lowlevel::Argument::PrimitiveArgument(features_string);
raw_arguments.push(features_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("BRSF"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::CindTest {} => {
lowlevel::Command::Test { name: String::from("CIND"), is_extension: true }
},
highlevel::Command::CindRead {} => {
lowlevel::Command::Read { name: String::from("CIND"), is_extension: true }
},
highlevel::Command::Clcc { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Command::Execute { name: String::from("CLCC"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
highlevel::Command::Bcc { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Command::Execute { name: String::from("BCC"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
highlevel::Command::Bcs {
codec,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let codec_string = i64::to_string(&codec);
let codec_primitive = lowlevel::Argument::PrimitiveArgument(codec_string);
raw_arguments.push(codec_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("BCS"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Bac {
codecs,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
for codecs_element in codecs.into_iter() {
let codecs_element_string = i64::to_string(&codecs_element);
let codecs_element_primitive = lowlevel::Argument::PrimitiveArgument(codecs_element_string);
raw_arguments.push(codecs_element_primitive);
}
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("BAC"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Bind {
indicators,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
for indicators_element in indicators.into_iter() {
let indicators_element_string = i64::to_string(&indicators_element);
let indicators_element_primitive = lowlevel::Argument::PrimitiveArgument(indicators_element_string);
raw_arguments.push(indicators_element_primitive);
}
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("BIND"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::BindTest {} => {
lowlevel::Command::Test { name: String::from("BIND"), is_extension: true }
},
highlevel::Command::BindRead {} => {
lowlevel::Command::Read { name: String::from("BIND"), is_extension: true }
},
highlevel::Command::Biev {
anum,
value,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let anum_string_int = *anum as i64;
let anum_string = i64::to_string(&anum_string_int);
let anum_primitive = lowlevel::Argument::PrimitiveArgument(anum_string);
raw_arguments.push(anum_primitive);
let value_string = i64::to_string(&value);
let value_primitive = lowlevel::Argument::PrimitiveArgument(value_string);
raw_arguments.push(value_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("BIEV"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::ChldTest {} => {
lowlevel::Command::Test { name: String::from("CHLD"), is_extension: true }
},
highlevel::Command::Cmer {
mode,
keyp,
disp,
ind,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let mode_string = i64::to_string(&mode);
let mode_primitive = lowlevel::Argument::PrimitiveArgument(mode_string);
raw_arguments.push(mode_primitive);
let keyp_string = i64::to_string(&keyp);
let keyp_primitive = lowlevel::Argument::PrimitiveArgument(keyp_string);
raw_arguments.push(keyp_primitive);
let disp_string = i64::to_string(&disp);
let disp_primitive = lowlevel::Argument::PrimitiveArgument(disp_string);
raw_arguments.push(disp_primitive);
let ind_string = i64::to_string(&ind);
let ind_primitive = lowlevel::Argument::PrimitiveArgument(ind_string);
raw_arguments.push(ind_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("CMER"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Nrec {
nrec,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let nrec_string_int = if *nrec { 1 } else { 0 };
let nrec_string = i64::to_string(&nrec_string_int);
let nrec_primitive = lowlevel::Argument::PrimitiveArgument(nrec_string);
raw_arguments.push(nrec_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("NREC"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Cops {
three,
format,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let three_string = i64::to_string(&three);
let three_primitive = lowlevel::Argument::PrimitiveArgument(three_string);
raw_arguments.push(three_primitive);
let format_string_int = *format as i64;
let format_string = i64::to_string(&format_string_int);
let format_primitive = lowlevel::Argument::PrimitiveArgument(format_string);
raw_arguments.push(format_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("COPS"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::CopsRead {} => {
lowlevel::Command::Read { name: String::from("COPS"), is_extension: true }
},
highlevel::Command::Cmee {
enable,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let enable_string_int = if *enable { 1 } else { 0 };
let enable_string = i64::to_string(&enable_string_int);
let enable_primitive = lowlevel::Argument::PrimitiveArgument(enable_string);
raw_arguments.push(enable_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("CMEE"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Ccwa {
enable,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let enable_string_int = if *enable { 1 } else { 0 };
let enable_string = i64::to_string(&enable_string_int);
let enable_primitive = lowlevel::Argument::PrimitiveArgument(enable_string);
raw_arguments.push(enable_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("CCWA"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Clip {
enable,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let enable_string_int = if *enable { 1 } else { 0 };
let enable_string = i64::to_string(&enable_string_int);
let enable_primitive = lowlevel::Argument::PrimitiveArgument(enable_string);
raw_arguments.push(enable_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("CLIP"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Cnum { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Command::Execute { name: String::from("CNUM"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
highlevel::Command::Vts {
code,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let code_string = code.clone();
let code_primitive = lowlevel::Argument::PrimitiveArgument(code_string);
raw_arguments.push(code_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("VTS"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Vgs {
level,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let level_string = i64::to_string(&level);
let level_primitive = lowlevel::Argument::PrimitiveArgument(level_string);
raw_arguments.push(level_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("VGS"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Vgm {
level,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let level_string = i64::to_string(&level);
let level_primitive = lowlevel::Argument::PrimitiveArgument(level_string);
raw_arguments.push(level_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("VGM"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Bia {
indrep,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
for indrep_element in indrep.into_iter() {
match indrep_element {
None => {
raw_arguments.push(lowlevel::Argument::PrimitiveArgument(String::new()));
}
Some(indrep_element_unwrapped) => {
let indrep_element_unwrapped_string_int = if *indrep_element_unwrapped { 1 } else { 0 };
let indrep_element_unwrapped_string = i64::to_string(&indrep_element_unwrapped_string_int);
let indrep_element_primitive = lowlevel::Argument::PrimitiveArgument(indrep_element_unwrapped_string);
raw_arguments.push(indrep_element_primitive);
}
}
}
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("BIA"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::Answer { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Command::Execute { name: String::from("A"), is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
highlevel::Command::Chup { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Command::Execute { name: String::from("CHUP"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
highlevel::Command::Chld {
command,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let command_string = command.clone();
let command_primitive = lowlevel::Argument::PrimitiveArgument(command_string);
raw_arguments.push(command_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("CHLD"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from("=")), arguments, terminator: None } }
},
highlevel::Command::AtdNumber {
number,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let number_string = number.clone();
let number_primitive = lowlevel::Argument::PrimitiveArgument(number_string);
raw_arguments.push(number_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("D"), is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: Some(String::from(";")) } }
},
highlevel::Command::AtdMemory {
location,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let location_string = location.clone();
let location_primitive = lowlevel::Argument::PrimitiveArgument(location_string);
raw_arguments.push(location_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Command::Execute { name: String::from("D"), is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(">")), arguments, terminator: Some(String::from(";")) } }
},
highlevel::Command::Bldn { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Command::Execute { name: String::from("BLDN"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
}
}
pub fn lower_success(highlevel: &highlevel::Success) -> lowlevel::Response {
match highlevel {
highlevel::Success::Test { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Response::Success { name: String::from("TEST"), is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Testnod { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Response::Success { name: String::from("TESTNOD"), is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
highlevel::Success::TestResponse { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Response::Success { name: String::from("TESTN"), is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Testext { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Response::Success { name: String::from("TESTEXT"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Testextnod { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Response::Success { name: String::from("TESTEXTNOD"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
highlevel::Success::Testi {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string = i64::to_string(&field);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("TESTI"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Testinod {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string = i64::to_string(&field);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("TESTINOD"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
highlevel::Success::Testic {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string = i64::to_string(&field);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("TESTIC"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Tests {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string = field.clone();
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("TESTS"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Testsi {
field1,
field2,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field1_string = field1.clone();
let field1_primitive = lowlevel::Argument::PrimitiveArgument(field1_string);
raw_arguments.push(field1_primitive);
let field2_string = i64::to_string(&field2);
let field2_primitive = lowlevel::Argument::PrimitiveArgument(field2_string);
raw_arguments.push(field2_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("TESTSI"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Testsic {
field1,
field2,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field1_string = field1.clone();
let field1_primitive = lowlevel::Argument::PrimitiveArgument(field1_string);
raw_arguments.push(field1_primitive);
let field2_string = i64::to_string(&field2);
let field2_primitive = lowlevel::Argument::PrimitiveArgument(field2_string);
raw_arguments.push(field2_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("TESTSIC"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Testio {
field1,
field2,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field1_string = i64::to_string(&field1);
let field1_primitive = lowlevel::Argument::PrimitiveArgument(field1_string);
raw_arguments.push(field1_primitive);
match field2 {
None => {
raw_arguments.push(lowlevel::Argument::PrimitiveArgument(String::new()));
}
Some(field2_unwrapped) => {
let field2_unwrapped_string = i64::to_string(&field2_unwrapped);
let field2_primitive = lowlevel::Argument::PrimitiveArgument(field2_unwrapped_string);
raw_arguments.push(field2_primitive);
}
}
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("TESTIO"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Testl {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
for field_element in field.into_iter() {
let field_element_string = i64::to_string(&field_element);
let field_element_primitive = lowlevel::Argument::PrimitiveArgument(field_element_string);
raw_arguments.push(field_element_primitive);
}
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("TESTL"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Testol {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
for field_element in field.into_iter() {
match field_element {
None => {
raw_arguments.push(lowlevel::Argument::PrimitiveArgument(String::new()));
}
Some(field_element_unwrapped) => {
let field_element_unwrapped_string = i64::to_string(&field_element_unwrapped);
let field_element_primitive = lowlevel::Argument::PrimitiveArgument(field_element_unwrapped_string);
raw_arguments.push(field_element_primitive);
}
}
}
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("TESTOL"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Testm {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
for (field_typed_key, field_typed_value) in field {
let field_primitive_key = i64::to_string(&field_typed_key);
let field_primitive_value = field_typed_value.clone();
let field_untyped_pair = lowlevel::Argument::KeyValueArgument { key: field_primitive_key, value: field_primitive_value };
raw_arguments.push(field_untyped_pair);
}
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("TESTM"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Testp {
field,
} => {
let mut raw_arguments_outer = Vec::<Vec<lowlevel::Argument>>::new();
let mut raw_arguments_inner = Vec::<lowlevel::Argument>::new();
let field_string = i64::to_string(&field);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments_inner.push(field_primitive);
raw_arguments_outer.push(raw_arguments_inner);
let arguments = lowlevel::Arguments::ParenthesisDelimitedArgumentLists(raw_arguments_outer);
lowlevel::Response::Success { name: String::from("TESTP"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Testpp {
field1,
field2,
field3,
} => {
let mut raw_arguments_outer = Vec::<Vec<lowlevel::Argument>>::new();
let mut raw_arguments_inner = Vec::<lowlevel::Argument>::new();
let field1_string = i64::to_string(&field1);
let field1_primitive = lowlevel::Argument::PrimitiveArgument(field1_string);
raw_arguments_inner.push(field1_primitive);
raw_arguments_outer.push(raw_arguments_inner);
let mut raw_arguments_inner = Vec::<lowlevel::Argument>::new();
let field2_string = i64::to_string(&field2);
let field2_primitive = lowlevel::Argument::PrimitiveArgument(field2_string);
raw_arguments_inner.push(field2_primitive);
let field3_string = field3.clone();
let field3_primitive = lowlevel::Argument::PrimitiveArgument(field3_string);
raw_arguments_inner.push(field3_primitive);
raw_arguments_outer.push(raw_arguments_inner);
let arguments = lowlevel::Arguments::ParenthesisDelimitedArgumentLists(raw_arguments_outer);
lowlevel::Response::Success { name: String::from("TESTPP"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Testpmpil {
field1,
field2,
field3,
} => {
let mut raw_arguments_outer = Vec::<Vec<lowlevel::Argument>>::new();
let mut raw_arguments_inner = Vec::<lowlevel::Argument>::new();
for (field1_typed_key, field1_typed_value) in field1 {
let field1_primitive_key = i64::to_string(&field1_typed_key);
let field1_primitive_value = field1_typed_value.clone();
let field1_untyped_pair = lowlevel::Argument::KeyValueArgument { key: field1_primitive_key, value: field1_primitive_value };
raw_arguments_inner.push(field1_untyped_pair);
}
raw_arguments_outer.push(raw_arguments_inner);
let mut raw_arguments_inner = Vec::<lowlevel::Argument>::new();
let field2_string = i64::to_string(&field2);
let field2_primitive = lowlevel::Argument::PrimitiveArgument(field2_string);
raw_arguments_inner.push(field2_primitive);
for field3_element in field3.into_iter() {
let field3_element_string = i64::to_string(&field3_element);
let field3_element_primitive = lowlevel::Argument::PrimitiveArgument(field3_element_string);
raw_arguments_inner.push(field3_element_primitive);
}
raw_arguments_outer.push(raw_arguments_inner);
let arguments = lowlevel::Arguments::ParenthesisDelimitedArgumentLists(raw_arguments_outer);
lowlevel::Response::Success { name: String::from("TESTPMPIL"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::SameOne {
field,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let field_string = i64::to_string(&field);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments.push(field_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("SAME"), is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::SameTwo {
field,
} => {
let mut raw_arguments_outer = Vec::<Vec<lowlevel::Argument>>::new();
let mut raw_arguments_inner = Vec::<lowlevel::Argument>::new();
let field_string = i64::to_string(&field);
let field_primitive = lowlevel::Argument::PrimitiveArgument(field_string);
raw_arguments_inner.push(field_primitive);
raw_arguments_outer.push(raw_arguments_inner);
let arguments = lowlevel::Arguments::ParenthesisDelimitedArgumentLists(raw_arguments_outer);
lowlevel::Response::Success { name: String::from("SAME"), is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Brsf {
features,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let features_string = i64::to_string(&features);
let features_primitive = lowlevel::Argument::PrimitiveArgument(features_string);
raw_arguments.push(features_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("BRSF"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Cind {
service,
call,
callsetup,
callheld,
signal,
roam,
battchg,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let service_string_int = if *service { 1 } else { 0 };
let service_string = i64::to_string(&service_string_int);
let service_primitive = lowlevel::Argument::PrimitiveArgument(service_string);
raw_arguments.push(service_primitive);
let call_string_int = if *call { 1 } else { 0 };
let call_string = i64::to_string(&call_string_int);
let call_primitive = lowlevel::Argument::PrimitiveArgument(call_string);
raw_arguments.push(call_primitive);
let callsetup_string = i64::to_string(&callsetup);
let callsetup_primitive = lowlevel::Argument::PrimitiveArgument(callsetup_string);
raw_arguments.push(callsetup_primitive);
let callheld_string = i64::to_string(&callheld);
let callheld_primitive = lowlevel::Argument::PrimitiveArgument(callheld_string);
raw_arguments.push(callheld_primitive);
let signal_string = i64::to_string(&signal);
let signal_primitive = lowlevel::Argument::PrimitiveArgument(signal_string);
raw_arguments.push(signal_primitive);
let roam_string_int = if *roam { 1 } else { 0 };
let roam_string = i64::to_string(&roam_string_int);
let roam_primitive = lowlevel::Argument::PrimitiveArgument(roam_string);
raw_arguments.push(roam_primitive);
let battchg_string = i64::to_string(&battchg);
let battchg_primitive = lowlevel::Argument::PrimitiveArgument(battchg_string);
raw_arguments.push(battchg_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("CIND"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Clcc {
index,
dir,
status,
mode,
mpty,
number,
ty,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let index_string = i64::to_string(&index);
let index_primitive = lowlevel::Argument::PrimitiveArgument(index_string);
raw_arguments.push(index_primitive);
let dir_string = i64::to_string(&dir);
let dir_primitive = lowlevel::Argument::PrimitiveArgument(dir_string);
raw_arguments.push(dir_primitive);
let status_string = i64::to_string(&status);
let status_primitive = lowlevel::Argument::PrimitiveArgument(status_string);
raw_arguments.push(status_primitive);
let mode_string = i64::to_string(&mode);
let mode_primitive = lowlevel::Argument::PrimitiveArgument(mode_string);
raw_arguments.push(mode_primitive);
let mpty_string = i64::to_string(&mpty);
let mpty_primitive = lowlevel::Argument::PrimitiveArgument(mpty_string);
raw_arguments.push(mpty_primitive);
let number_string = number.clone();
let number_primitive = lowlevel::Argument::PrimitiveArgument(number_string);
raw_arguments.push(number_primitive);
let ty_string = i64::to_string(&ty);
let ty_primitive = lowlevel::Argument::PrimitiveArgument(ty_string);
raw_arguments.push(ty_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("CLCC"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Bcs {
codec,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let codec_string = i64::to_string(&codec);
let codec_primitive = lowlevel::Argument::PrimitiveArgument(codec_string);
raw_arguments.push(codec_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("BCS"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::BindList {
indicators,
} => {
let mut raw_arguments_outer = Vec::<Vec<lowlevel::Argument>>::new();
let mut raw_arguments_inner = Vec::<lowlevel::Argument>::new();
for indicators_element in indicators.into_iter() {
let indicators_element_string_int = *indicators_element as i64;
let indicators_element_string = i64::to_string(&indicators_element_string_int);
let indicators_element_primitive = lowlevel::Argument::PrimitiveArgument(indicators_element_string);
raw_arguments_inner.push(indicators_element_primitive);
}
raw_arguments_outer.push(raw_arguments_inner);
let arguments = lowlevel::Arguments::ParenthesisDelimitedArgumentLists(raw_arguments_outer);
lowlevel::Response::Success { name: String::from("BIND"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::BindStatus {
anum,
state,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let anum_string_int = *anum as i64;
let anum_string = i64::to_string(&anum_string_int);
let anum_primitive = lowlevel::Argument::PrimitiveArgument(anum_string);
raw_arguments.push(anum_primitive);
let state_string_int = if *state { 1 } else { 0 };
let state_string = i64::to_string(&state_string_int);
let state_primitive = lowlevel::Argument::PrimitiveArgument(state_string);
raw_arguments.push(state_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("BIND"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Chld {
commands,
} => {
let mut raw_arguments_outer = Vec::<Vec<lowlevel::Argument>>::new();
let mut raw_arguments_inner = Vec::<lowlevel::Argument>::new();
for commands_element in commands.into_iter() {
let commands_element_string = commands_element.clone();
let commands_element_primitive = lowlevel::Argument::PrimitiveArgument(commands_element_string);
raw_arguments_inner.push(commands_element_primitive);
}
raw_arguments_outer.push(raw_arguments_inner);
let arguments = lowlevel::Arguments::ParenthesisDelimitedArgumentLists(raw_arguments_outer);
lowlevel::Response::Success { name: String::from("CHLD"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Cops {
format,
zero,
operator,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let format_string_int = *format as i64;
let format_string = i64::to_string(&format_string_int);
let format_primitive = lowlevel::Argument::PrimitiveArgument(format_string);
raw_arguments.push(format_primitive);
let zero_string = i64::to_string(&zero);
let zero_primitive = lowlevel::Argument::PrimitiveArgument(zero_string);
raw_arguments.push(zero_primitive);
let operator_string = operator.clone();
let operator_primitive = lowlevel::Argument::PrimitiveArgument(operator_string);
raw_arguments.push(operator_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("COPS"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Clip {
number,
ty,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let number_string = number.clone();
let number_primitive = lowlevel::Argument::PrimitiveArgument(number_string);
raw_arguments.push(number_primitive);
let ty_string = i64::to_string(&ty);
let ty_primitive = lowlevel::Argument::PrimitiveArgument(ty_string);
raw_arguments.push(ty_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("CLIP"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Cnum {
alpha,
number,
ty,
speed,
service,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let alpha_string = alpha.clone();
let alpha_primitive = lowlevel::Argument::PrimitiveArgument(alpha_string);
raw_arguments.push(alpha_primitive);
let number_string = number.clone();
let number_primitive = lowlevel::Argument::PrimitiveArgument(number_string);
raw_arguments.push(number_primitive);
let ty_string = i64::to_string(&ty);
let ty_primitive = lowlevel::Argument::PrimitiveArgument(ty_string);
raw_arguments.push(ty_primitive);
let speed_string = speed.clone();
let speed_primitive = lowlevel::Argument::PrimitiveArgument(speed_string);
raw_arguments.push(speed_primitive);
let service_string = i64::to_string(&service);
let service_primitive = lowlevel::Argument::PrimitiveArgument(service_string);
raw_arguments.push(service_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("CNUM"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Vgs {
level,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let level_string = i64::to_string(&level);
let level_primitive = lowlevel::Argument::PrimitiveArgument(level_string);
raw_arguments.push(level_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("VGS"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Vgm {
level,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let level_string = i64::to_string(&level);
let level_primitive = lowlevel::Argument::PrimitiveArgument(level_string);
raw_arguments.push(level_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("VGM"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Ciev {
ind,
value,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let ind_string = i64::to_string(&ind);
let ind_primitive = lowlevel::Argument::PrimitiveArgument(ind_string);
raw_arguments.push(ind_primitive);
let value_string = i64::to_string(&value);
let value_primitive = lowlevel::Argument::PrimitiveArgument(value_string);
raw_arguments.push(value_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("CIEV"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Ccwa {
number,
ty,
} => {
let mut raw_arguments = Vec::<lowlevel::Argument>::new();
let number_string = number.clone();
let number_primitive = lowlevel::Argument::PrimitiveArgument(number_string);
raw_arguments.push(number_primitive);
let ty_string = i64::to_string(&ty);
let ty_primitive = lowlevel::Argument::PrimitiveArgument(ty_string);
raw_arguments.push(ty_primitive);
let arguments = lowlevel::Arguments::ArgumentList(raw_arguments);
lowlevel::Response::Success { name: String::from("CCWA"), is_extension: true, arguments: lowlevel::DelimitedArguments { delimiter: Some(String::from(":")), arguments, terminator: None } }
},
highlevel::Success::Ring { } => {
let arguments = lowlevel::Arguments::ArgumentList(Vec::new());
lowlevel::Response::Success { name: String::from("RING"), is_extension: false, arguments: lowlevel::DelimitedArguments { delimiter: None, arguments, terminator: None } }
},
}
}