Send a control command to the test peripheral's Control Point characteristic.
(peripheral: &Peripheral, opcode: u8)
| 154 | |
| 155 | /// Send a control command to the test peripheral's Control Point characteristic. |
| 156 | pub 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. |
| 170 | pub async fn reset_peripheral(peripheral: &Peripheral) { |