Buttplug sex toy control library

fix: Fix schema, step count comparisons so tests pass

+27 -23
+1 -1
crates/buttplug_client/src/device/feature.rs
··· 47 47 } 48 48 49 49 fn check_step_value(&self, feature_output: &DeviceFeatureOutput, steps: u32) -> Result<u32, ButtplugClientError> { 50 - if steps < feature_output.step_count() { 50 + if steps <= feature_output.step_count() { 51 51 Ok(steps) 52 52 } else { 53 53 Err(ButtplugClientError::ButtplugOutputCommandConversionError(format!("{} is larger than the maximum number of steps ({}).", steps, feature_output.step_count())))
+25 -21
crates/buttplug_core/schema/buttplug-schema.json
··· 517 517 "Id": { "$ref": "#/components/ServerId" }, 518 518 "Devices": { 519 519 "description": "Array of device ids and names.", 520 - "type": "array", 521 - "items": { 522 - "type": "object", 523 - "properties": { 524 - "DeviceName": { "$ref": "#/components/DeviceName" }, 525 - "DeviceIndex": { "$ref": "#/components/DeviceIndex" }, 526 - "DeviceDisplayName": { "type": "string" }, 527 - "DeviceMessageTimingGap": { "type": "integer" }, 528 - "DeviceFeatures": { 529 - "type": "array", 530 - "items": { 531 - "$ref": "#/components/DeviceFeatureV4" 520 + "type": "object", 521 + "patternProperties": { 522 + "^[0-9]*": { 523 + "type": "object", 524 + "properties": { 525 + "DeviceName": { "$ref": "#/components/DeviceName" }, 526 + "DeviceIndex": { "$ref": "#/components/DeviceIndex" }, 527 + "DeviceDisplayName": { "type": "string" }, 528 + "DeviceMessageTimingGap": { "type": "integer" }, 529 + "DeviceFeatures": { 530 + "type": "object", 531 + "patternProperties": { 532 + "^[0-9]*": { 533 + "$ref": "#/components/DeviceFeatureV4" 534 + } 535 + } 532 536 } 533 - } 534 - }, 535 - "additionalProperties": false, 536 - "required": [ 537 - "DeviceName", 538 - "DeviceIndex", 539 - "DeviceMessageTimingGap", 540 - "DeviceFeatures" 541 - ] 537 + }, 538 + "additionalProperties": false, 539 + "required": [ 540 + "DeviceName", 541 + "DeviceIndex", 542 + "DeviceMessageTimingGap", 543 + "DeviceFeatures" 544 + ] 545 + } 542 546 } 543 547 } 544 548 },
+1 -1
crates/buttplug_tests/tests/test_device_protocols.rs
··· 134 134 #[test_case("test_xuanhuan_protocol.yaml" ; "Xuanhuan Protocol")] 135 135 #[tokio::test] 136 136 async fn test_device_protocols_embedded_v4(test_file: &str) { 137 - tracing_subscriber::fmt::init(); 137 + //tracing_subscriber::fmt::init(); 138 138 util::device_test::client::client_v4::run_embedded_test_case(&load_test_case(test_file).await) 139 139 .await; 140 140 }