pub(crate) fn build_a2dp_service_definition(
        psm: Psm,
    ) -> (bredr::ServiceDefinition, ServiceRecord) {
        let prof_descs = vec![bredr::ProfileDescriptor {
            profile_id: bredr::ServiceClassProfileIdentifier::AdvancedAudioDistribution,
            major_version: 1,
            minor_version: 2,
        }];
        let def = bredr::ServiceDefinition {
            service_class_uuids: Some(vec![Uuid::new16(0x110B).into()]), // Audio Sink UUID
            protocol_descriptor_list: Some(vec![
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::L2Cap,
                    params: vec![bredr::DataElement::Uint16(psm.into())],
                },
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::Avdtp,
                    params: vec![bredr::DataElement::Uint16(0x0103)], // Indicate v1.3
                },
            ]),
            profile_descriptors: Some(prof_descs.clone()),
            additional_attributes: Some(vec![]),
            ..bredr::ServiceDefinition::EMPTY
        };

        let mut a2dp_ids = HashSet::new();
        a2dp_ids.insert(bredr::ServiceClassProfileIdentifier::AudioSink);
        let connection = Some(Connection::L2cap(psm));
        let record = ServiceRecord::new(a2dp_ids, connection, HashSet::new(), prof_descs, vec![]);

        (def, record)
    }
/// Builds an A2DP Sink Service Definition and the expected parsed ServiceRecord.
/// Uses the provided `psm` for the service.
Builds an A2DP Sink Service Definition and the expected parsed ServiceRecord.
Uses the provided `psm` for the service.
Builds an A2DP Sink Service Definition and the expected parsed ServiceRecord . Uses the provided ` psm ` for the service .
pub(crate) fn build_a2dp_service_definition(
        psm: Psm,
    ) -> (bredr::ServiceDefinition, ServiceRecord) {
        let prof_descs = vec![bredr::ProfileDescriptor {
            profile_id: bredr::ServiceClassProfileIdentifier::AdvancedAudioDistribution,
            major_version: 1,
            minor_version: 2,
        }];
        let def = bredr::ServiceDefinition {
            service_class_uuids: Some(vec![Uuid::new16(0x110B).into()]), // Audio Sink UUID
            protocol_descriptor_list: Some(vec![
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::L2Cap,
                    params: vec![bredr::DataElement::Uint16(psm.into())],
                },
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::Avdtp,
                    params: vec![bredr::DataElement::Uint16(0x0103)], // Indicate v1.3
                },
            ]),
            profile_descriptors: Some(prof_descs.clone()),
            additional_attributes: Some(vec![]),
            ..bredr::ServiceDefinition::EMPTY
        };
        let mut a2dp_ids = HashSet::new();
        a2dp_ids.insert(bredr::ServiceClassProfileIdentifier::AudioSink);
        let connection = Some(Connection::L2cap(psm));
        let record = ServiceRecord::new(a2dp_ids, connection, HashSet::new(), prof_descs, vec![]);
        (def, record)
    }
pub ( crate ) fn build_a2dp_service_definition ( psm : Psm , ) -> ( bredr :: ServiceDefinition , ServiceRecord ) { let prof_descs = vec ! [ bredr ProfileDescriptor { profile_id bredr ServiceClassProfileIdentifier AdvancedAudioDistribution major_version 1 minor_version 2 } ] ; let def = bredr :: ServiceDefinition { service_class_uuids : Some ( vec ! [ Uuid new16 ( 0x110B ) into ( ) ] ) , // Audio Sink UUID protocol_descriptor_list : Some ( vec ! [ bredr ProtocolDescriptor { protocol bredr ProtocolIdentifier L2Cap params vec [ bredr DataElement Uint16 ( psm into ( ) ) ] } bredr ProtocolDescriptor { protocol bredr ProtocolIdentifier Avdtp params vec [ bredr DataElement Uint16 ( 0x0103 ) ] // Indicate v1.3 } ] ) , profile_descriptors : Some ( prof_descs . clone ( ) ) , additional_attributes : Some ( vec ! [ ] ) , .. bredr :: ServiceDefinition :: EMPTY } ; let mut a2dp_ids = HashSet :: new ( ) ; a2dp_ids . insert ( bredr :: ServiceClassProfileIdentifier :: AudioSink ) ; let connection = Some ( Connection :: L2cap ( psm ) ) ; let record = ServiceRecord :: new ( a2dp_ids , connection , HashSet :: new ( ) , prof_descs , vec ! [ ] ) ; ( def , record ) }
Builds an A2DP Sink Service Definition and the expected parsed ServiceRecord.
Builds an A2DP Sink Service Definition and the expected parsed ServiceRecord .
psm
Psm
psm
Psm