use crate::frame::enums::{Parameters, Response};
use crate::parameters::security;
impl TryFrom<Parameters> for security::check_key_context::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::CheckKeyContext(
response,
))) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::clear_key_table::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::ClearKeyTable(
response,
))) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::clear_transient_link_keys::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(
security::Response::ClearTransientLinkKeys(response),
)) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::erase_key_table_entry::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::EraseKeyTableEntry(
response,
))) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::export_key::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::ExportKey(response))) => {
Ok(response)
}
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::export_link_key_by_eui::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::ExportLinkKeyByEui(
response,
))) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::export_link_key_by_index::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::ExportLinkKeyByIndex(
response,
))) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::export_transient_key::by_eui::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(
security::Response::ExportTransientKeyByEui(response),
)) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::export_transient_key::by_index::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(
security::Response::ExportTransientKeyByIndex(response),
)) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::find_key_table_entry::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::FindKeyTableEntry(
response,
))) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::get_aps_key_info::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::GetApsKeyInfo(
response,
))) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::get_current_security_state::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(
security::Response::GetCurrentSecurityState(response),
)) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::get_key::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::GetKey(response))) => {
Ok(response)
}
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::get_network_key_info::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::GetNetworkKeyInfo(
response,
))) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::import_key::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::ImportKey(response))) => {
Ok(response)
}
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::import_link_key::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::ImportLinkKey(
response,
))) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::import_transient_key::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::ImportTransientKey(
response,
))) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::request_link_key::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::RequestLinkKey(
response,
))) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::send_trust_center_link_key::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(
security::Response::SendTrustCenterLinkKey(response),
)) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::set_initial_security_state::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(
security::Response::SetInitialSecurityState(response),
)) => Ok(response),
_ => Err(parameters),
}
}
}
impl TryFrom<Parameters> for security::update_tc_link_key::Response {
type Error = Parameters;
fn try_from(parameters: Parameters) -> Result<Self, Self::Error> {
match parameters {
Parameters::Response(Response::Security(security::Response::UpdateTcLinkKey(
response,
))) => Ok(response),
_ => Err(parameters),
}
}
}