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

Function send_control_command

tests/common/peripheral_finder.rs:156–167  ·  view source on GitHub ↗

Send a control command to the test peripheral's Control Point characteristic.

(peripheral: &Peripheral, opcode: u8)

Source from the content-addressed store, hash-verified

154
155/// Send a control command to the test peripheral's Control Point characteristic.
156pub async fn send_control_command(peripheral: &Peripheral, opcode: u8) {
157 let chars = peripheral.characteristics();
158 let control_point = chars
159 .iter()
160 .find(|c| c.uuid == gatt_uuids::CONTROL_POINT)
161 .expect("Control Point characteristic not found");
162
163 peripheral
164 .write(control_point, &[opcode], WriteType::WithResponse)
165 .await
166 .expect("failed to write control command");
167}
168
169/// Reset the test peripheral to its default state.
170pub async fn reset_peripheral(peripheral: &Peripheral) {

Calls 3

iterMethod · 0.80
characteristicsMethod · 0.45
writeMethod · 0.45