use automotive_diag::uds::UdsCommand;
pub use automotive_diag::uds::{
encode_communication_type, CommunicationLevel, CommunicationType as EcuCommunicationType,
Subnet,
};
use crate::{dynamic_diag::DynamicDiagSession, DiagServerResult};
impl DynamicDiagSession {
pub fn uds_control_communication(
&self,
communication_type: EcuCommunicationType,
subnet: Subnet,
comm_level: CommunicationLevel,
) -> DiagServerResult<()> {
let level: u8 = comm_level.into();
let communication_type = encode_communication_type(communication_type, subnet);
self.send_command_with_response(
UdsCommand::CommunicationControl,
&[level, communication_type],
)?;
Ok(())
}
}