fn build_avrcp_service_definition() -> (bredr::ServiceDefinition, ServiceRecord) {
        use bredr::ServiceClassProfileIdentifier::AvRemoteControl;
        use bredr::ServiceClassProfileIdentifier::AvRemoteControlController;
        let prof_descs = vec![bredr::ProfileDescriptor {
            profile_id: bredr::ServiceClassProfileIdentifier::AvRemoteControl,
            major_version: 1,
            minor_version: 6,
        }];
        let avrcp_attribute = Attribute {
            id: SDP_SUPPORTED_FEATURES, // SDP Attribute "SUPPORTED FEATURES"
            element: DataElement::Uint16(1),
        };

        let mut avrcp_ids = HashSet::new();
        avrcp_ids.insert(bredr::ServiceClassProfileIdentifier::AvRemoteControl);
        avrcp_ids.insert(bredr::ServiceClassProfileIdentifier::AvRemoteControlController);
        let mut additional_psms = HashSet::new();
        additional_psms.insert(Psm::new(27));

        let def = bredr::ServiceDefinition {
            service_class_uuids: Some(vec![
                Uuid::new16(AvRemoteControl as u16).into(),
                Uuid::new16(AvRemoteControlController as u16).into(),
            ]),
            protocol_descriptor_list: Some(vec![
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::L2Cap,
                    params: vec![bredr::DataElement::Uint16(bredr::PSM_AVCTP as u16)],
                },
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::Avctp,
                    params: vec![bredr::DataElement::Uint16(0x0103)], // Indicate v1.3
                },
            ]),
            additional_protocol_descriptor_lists: Some(vec![vec![
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::L2Cap,
                    params: vec![bredr::DataElement::Uint16(bredr::PSM_AVCTP_BROWSE as u16)],
                },
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::Avctp,
                    params: vec![bredr::DataElement::Uint16(0x0103)],
                },
            ]]),
            profile_descriptors: Some(prof_descs.clone()),
            additional_attributes: Some(vec![(&avrcp_attribute).into()]),
            ..bredr::ServiceDefinition::new_empty()
        };
        let connection = Some(Connection::L2cap(Psm::new(23)));
        let record = ServiceRecord::new(
            avrcp_ids,
            connection,
            additional_psms,
            prof_descs,
            vec![avrcp_attribute],
        );

        (def, record)
    }
/// Builds an example AVRCP Service Definition and the expected parsed ServiceRecord.
/// This is done in the same function to maintain data consistency, such that if the
/// parsing implementation changes, only this builder will need to be updated.
Builds an example AVRCP Service Definition and the expected parsed ServiceRecord.
This is done in the same function to maintain data consistency, such that if the
parsing implementation changes, only this builder will need to be updated.
Builds an example AVRCP Service Definition and the expected parsed ServiceRecord . This is done in the same function to maintain data consistency such that if the parsing implementation changes only this builder will need to be updated .
fn build_avrcp_service_definition() -> (bredr::ServiceDefinition, ServiceRecord) {
        use bredr::ServiceClassProfileIdentifier::AvRemoteControl;
        use bredr::ServiceClassProfileIdentifier::AvRemoteControlController;
        let prof_descs = vec![bredr::ProfileDescriptor {
            profile_id: bredr::ServiceClassProfileIdentifier::AvRemoteControl,
            major_version: 1,
            minor_version: 6,
        }];
        let avrcp_attribute = Attribute {
            id: SDP_SUPPORTED_FEATURES, // SDP Attribute "SUPPORTED FEATURES"
            element: DataElement::Uint16(1),
        };
        let mut avrcp_ids = HashSet::new();
        avrcp_ids.insert(bredr::ServiceClassProfileIdentifier::AvRemoteControl);
        avrcp_ids.insert(bredr::ServiceClassProfileIdentifier::AvRemoteControlController);
        let mut additional_psms = HashSet::new();
        additional_psms.insert(Psm::new(27));
        let def = bredr::ServiceDefinition {
            service_class_uuids: Some(vec![
                Uuid::new16(AvRemoteControl as u16).into(),
                Uuid::new16(AvRemoteControlController as u16).into(),
            ]),
            protocol_descriptor_list: Some(vec![
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::L2Cap,
                    params: vec![bredr::DataElement::Uint16(bredr::PSM_AVCTP as u16)],
                },
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::Avctp,
                    params: vec![bredr::DataElement::Uint16(0x0103)], // Indicate v1.3
                },
            ]),
            additional_protocol_descriptor_lists: Some(vec![vec![
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::L2Cap,
                    params: vec![bredr::DataElement::Uint16(bredr::PSM_AVCTP_BROWSE as u16)],
                },
                bredr::ProtocolDescriptor {
                    protocol: bredr::ProtocolIdentifier::Avctp,
                    params: vec![bredr::DataElement::Uint16(0x0103)],
                },
            ]]),
            profile_descriptors: Some(prof_descs.clone()),
            additional_attributes: Some(vec![(&avrcp_attribute).into()]),
            ..bredr::ServiceDefinition::new_empty()
        };
        let connection = Some(Connection::L2cap(Psm::new(23)));
        let record = ServiceRecord::new(
            avrcp_ids,
            connection,
            additional_psms,
            prof_descs,
            vec![avrcp_attribute],
        );
        (def, record)
    }
fn build_avrcp_service_definition ( ) -> ( bredr :: ServiceDefinition , ServiceRecord ) { use bredr :: ServiceClassProfileIdentifier :: AvRemoteControl ; use bredr :: ServiceClassProfileIdentifier :: AvRemoteControlController ; let prof_descs = vec ! [ bredr ProfileDescriptor { profile_id bredr ServiceClassProfileIdentifier AvRemoteControl major_version 1 minor_version 6 } ] ; let avrcp_attribute = Attribute { id : SDP_SUPPORTED_FEATURES , // SDP Attribute "SUPPORTED FEATURES" element : DataElement :: Uint16 ( 1 ) , } ; let mut avrcp_ids = HashSet :: new ( ) ; avrcp_ids . insert ( bredr :: ServiceClassProfileIdentifier :: AvRemoteControl ) ; avrcp_ids . insert ( bredr :: ServiceClassProfileIdentifier :: AvRemoteControlController ) ; let mut additional_psms = HashSet :: new ( ) ; additional_psms . insert ( Psm :: new ( 27 ) ) ; let def = bredr :: ServiceDefinition { service_class_uuids : Some ( vec ! [ Uuid new16 ( AvRemoteControl as u16 ) into ( ) Uuid new16 ( AvRemoteControlController as u16 ) into ( ) ] ) , protocol_descriptor_list : Some ( vec ! [ bredr ProtocolDescriptor { protocol bredr ProtocolIdentifier L2Cap params vec [ bredr DataElement Uint16 ( bredr PSM_AVCTP as u16 ) ] } bredr ProtocolDescriptor { protocol bredr ProtocolIdentifier Avctp params vec [ bredr DataElement Uint16 ( 0x0103 ) ] // Indicate v1.3 } ] ) , additional_protocol_descriptor_lists : Some ( vec ! [ vec [ bredr ProtocolDescriptor { protocol bredr ProtocolIdentifier L2Cap params vec [ bredr DataElement Uint16 ( bredr PSM_AVCTP_BROWSE as u16 ) ] } bredr ProtocolDescriptor { protocol bredr ProtocolIdentifier Avctp params vec [ bredr DataElement Uint16 ( 0x0103 ) ] } ] ] ) , profile_descriptors : Some ( prof_descs . clone ( ) ) , additional_attributes : Some ( vec ! [ ( avrcp_attribute ) into ( ) ] ) , .. bredr :: ServiceDefinition :: new_empty ( ) } ; let connection = Some ( Connection :: L2cap ( Psm :: new ( 23 ) ) ) ; let record = ServiceRecord :: new ( avrcp_ids , connection , additional_psms , prof_descs , vec ! [ avrcp_attribute ] , ) ; ( def , record ) }
Builds an example AVRCP Service Definition and the expected parsed ServiceRecord.
Builds an example AVRCP Service Definition and the expected parsed ServiceRecord .