pub(crate) fn build_rfcomm_service_definition(
        additional_psm: Option<Psm>,
    ) -> (bredr::ServiceDefinition, ServiceRecord) {
        let prof_descs = vec![bredr::ProfileDescriptor {
            profile_id: bredr::ServiceClassProfileIdentifier::SerialPort,
            major_version: 1,
            minor_version: 2,
        }];
        let mut def = bredr::ServiceDefinition {
            service_class_uuids: Some(vec![Uuid::new16(
                bredr::ServiceClassProfileIdentifier::SerialPort as u16,
            )
            .into()]),
            protocol_descriptor_list: Some(vec![
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::L2Cap,
                    params: vec![],
                },
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::Rfcomm,
                    params: vec![], // This will be assigned.
                },
            ]),
            profile_descriptors: Some(prof_descs.clone()),
            ..bredr::ServiceDefinition::EMPTY
        };
        let mut addl_psms = HashSet::new();
        if let Some(psm) = additional_psm {
            def.additional_protocol_descriptor_lists =
                Some(vec![vec![bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::L2Cap,
                    params: vec![bredr::DataElement::Uint16(psm.into())],
                }]]);
            addl_psms.insert(psm);
        }
        let mut spp_ids = HashSet::new();
        spp_ids.insert(bredr::ServiceClassProfileIdentifier::SerialPort);
        let connection = Some(Connection::Rfcomm(None));
        let record = ServiceRecord::new(spp_ids, connection, addl_psms, prof_descs, vec![]);
        (def, record)
    }
/// Builds an example RFCOMM Service Definition and returns the expected parsed ServiceRecord.
/// Uses an optional `additional_psm` for an additional service.
Builds an example RFCOMM Service Definition and returns the expected parsed ServiceRecord.
Uses an optional `additional_psm` for an additional service.
Builds an example RFCOMM Service Definition and returns the expected parsed ServiceRecord . Uses an optional ` additional_psm ` for an additional service .
pub(crate) fn build_rfcomm_service_definition(
        additional_psm: Option<Psm>,
    ) -> (bredr::ServiceDefinition, ServiceRecord) {
        let prof_descs = vec![bredr::ProfileDescriptor {
            profile_id: bredr::ServiceClassProfileIdentifier::SerialPort,
            major_version: 1,
            minor_version: 2,
        }];
        let mut def = bredr::ServiceDefinition {
            service_class_uuids: Some(vec![Uuid::new16(
                bredr::ServiceClassProfileIdentifier::SerialPort as u16,
            )
            .into()]),
            protocol_descriptor_list: Some(vec![
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::L2Cap,
                    params: vec![],
                },
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::Rfcomm,
                    params: vec![], // This will be assigned.
                },
            ]),
            profile_descriptors: Some(prof_descs.clone()),
            ..bredr::ServiceDefinition::EMPTY
        };
        let mut addl_psms = HashSet::new();
        if let Some(psm) = additional_psm {
            def.additional_protocol_descriptor_lists =
                Some(vec![vec![bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::L2Cap,
                    params: vec![bredr::DataElement::Uint16(psm.into())],
                }]]);
            addl_psms.insert(psm);
        }
        let mut spp_ids = HashSet::new();
        spp_ids.insert(bredr::ServiceClassProfileIdentifier::SerialPort);
        let connection = Some(Connection::Rfcomm(None));
        let record = ServiceRecord::new(spp_ids, connection, addl_psms, prof_descs, vec![]);
        (def, record)
    }
pub ( crate ) fn build_rfcomm_service_definition ( additional_psm : Option < Psm > , ) -> ( bredr :: ServiceDefinition , ServiceRecord ) { let prof_descs = vec ! [ bredr ProfileDescriptor { profile_id bredr ServiceClassProfileIdentifier SerialPort major_version 1 minor_version 2 } ] ; let mut def = bredr :: ServiceDefinition { service_class_uuids : Some ( vec ! [ Uuid new16 ( bredr ServiceClassProfileIdentifier SerialPort as u16 ) into ( ) ] ) , protocol_descriptor_list : Some ( vec ! [ bredr ProtocolDescriptor { protocol bredr ProtocolIdentifier L2Cap params vec [ ] } bredr ProtocolDescriptor { protocol bredr ProtocolIdentifier Rfcomm params vec [ ] // This will be assigned. } ] ) , profile_descriptors : Some ( prof_descs . clone ( ) ) , .. bredr :: ServiceDefinition :: EMPTY } ; let mut addl_psms = HashSet :: new ( ) ; if let Some ( psm ) = additional_psm { def . additional_protocol_descriptor_lists = Some ( vec ! [ vec [ bredr ProtocolDescriptor { protocol bredr ProtocolIdentifier L2Cap params vec [ bredr DataElement Uint16 ( psm into ( ) ) ] } ] ] ) ; addl_psms . insert ( psm ) ; } let mut spp_ids = HashSet :: new ( ) ; spp_ids . insert ( bredr :: ServiceClassProfileIdentifier :: SerialPort ) ; let connection = Some ( Connection :: Rfcomm ( None ) ) ; let record = ServiceRecord :: new ( spp_ids , connection , addl_psms , prof_descs , vec ! [ ] ) ; ( def , record ) }
Builds an example RFCOMM Service Definition and returns the expected parsed ServiceRecord.
Builds an example RFCOMM Service Definition and returns the expected parsed ServiceRecord .
additional_psm
Option<Psm>
additional_psm
Option<Psm>