MCPcopy Create free account
hub / github.com/deviceplug/btleplug / test_properties_contain_peripheral_info

Function test_properties_contain_peripheral_info

tests/common/test_cases.rs:613–646  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

611}
612
613pub async fn test_properties_contain_peripheral_info() {
614 let peripheral = peripheral_finder::find_and_connect().await;
615
616 let id_str = format!("{:?}", peripheral.id());
617 assert!(!id_str.is_empty(), "Peripheral ID should not be empty");
618
619 let addr_str = format!("{:?}", peripheral.address());
620 assert!(
621 !addr_str.is_empty(),
622 "Peripheral address should not be empty"
623 );
624
625 let props = peripheral
626 .properties()
627 .await
628 .unwrap()
629 .expect("properties should be available");
630
631 let expected_name = std::env::var("BTLEPLUG_TEST_PERIPHERAL")
632 .unwrap_or_else(|_| gatt_uuids::TEST_PERIPHERAL_NAME.to_string());
633 assert_eq!(props.local_name.as_deref(), Some(expected_name.as_str()),);
634 assert!(
635 props
636 .manufacturer_data
637 .contains_key(&gatt_uuids::MANUFACTURER_COMPANY_ID),
638 "Properties should contain manufacturer data with company ID 0xFFFF"
639 );
640 assert!(props.rssi.is_some(), "RSSI from scan should be present");
641 assert!(
642 props.tx_power_level.is_some(),
643 "TX Power Level should be present in advertisement properties"
644 );
645 peripheral.disconnect().await.unwrap();
646}
647
648pub async fn test_connection_parameters() {
649 let peripheral = peripheral_finder::find_and_connect().await;

Callers

nothing calls this directly

Calls 3

find_and_connectFunction · 0.85
propertiesMethod · 0.45
disconnectMethod · 0.45

Tested by

no test coverage detected