MCPcopy Create free account
hub / github.com/buttplugio/buttplug / print_device_capabilities

Function print_device_capabilities

examples/src/bin/application.rs:38–76  ·  view source on GitHub ↗
(device: &ButtplugClientDevice)

Source from the content-addressed store, hash-verified

36}
37
38fn print_device_capabilities(device: &ButtplugClientDevice) {
39 println!(" {}", device.name());
40
41 // Check output capabilities (things we can make the device do)
42 let mut outputs = Vec::new();
43 if device.output_available(OutputType::Vibrate) {
44 outputs.push("Vibrate");
45 }
46 /*
47 if !device.rotate_features().is_empty() {
48 outputs.push("Rotate");
49 }
50 if !device.oscillate_features().is_empty() {
51 outputs.push("Oscillate");
52 }
53 if !device.position_features().is_empty() {
54 outputs.push("Position");
55 }
56 */
57
58 if !outputs.is_empty() {
59 println!(" Outputs: {}", outputs.join(", "));
60 }
61
62 // Check input capabilities (sensors we can read)
63 let mut inputs = Vec::new();
64 if device.input_available(buttplug_core::message::InputType::Battery) {
65 inputs.push("Battery");
66 }
67 if device.input_available(buttplug_core::message::InputType::Rssi) {
68 inputs.push("RSSI");
69 }
70
71 if !inputs.is_empty() {
72 println!(" Inputs: {}", inputs.join(", "));
73 }
74
75 println!();
76}
77
78#[tokio::main]
79async fn main() -> anyhow::Result<()> {

Callers 1

mainFunction · 0.85

Calls 3

output_availableMethod · 0.80
input_availableMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected