Skip to content

Commit 7bfdedf

Browse files
committed
chore: Fix naming of InputProperties in DeviceList
1 parent 4e1372f commit 7bfdedf

File tree

25 files changed

+408
-401
lines changed

25 files changed

+408
-401
lines changed

crates/buttplug_client/src/device/feature.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl ClientDeviceFeature {
204204
if let Some(sensor_map) = self.feature.input()
205205
&& let Some(sensor) = sensor_map.get(sensor_type)
206206
&& sensor
207-
.input_commands()
207+
.command()
208208
.contains(&InputCommandType::Subscribe)
209209
{
210210
let msg = InputCmdV4::new(
@@ -226,7 +226,7 @@ impl ClientDeviceFeature {
226226
if let Some(sensor_map) = self.feature.input()
227227
&& let Some(sensor) = sensor_map.get(sensor_type)
228228
&& sensor
229-
.input_commands()
229+
.command()
230230
.contains(&InputCommandType::Subscribe)
231231
{
232232
let msg = InputCmdV4::new(
@@ -247,7 +247,7 @@ impl ClientDeviceFeature {
247247
fn read_input(&self, sensor_type: InputType) -> ButtplugClientResultFuture<InputTypeReading> {
248248
if let Some(sensor_map) = self.feature.input()
249249
&& let Some(sensor) = sensor_map.get(sensor_type)
250-
&& sensor.input_commands().contains(&InputCommandType::Read)
250+
&& sensor.command().contains(&InputCommandType::Read)
251251
{
252252
let msg = InputCmdV4::new(
253253
self.device_index,

crates/buttplug_core/schema/buttplug-schema.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,18 +414,25 @@
414414
"^.*$": {
415415
"type": "object",
416416
"properties": {
417-
"ValueRange": {
417+
"Value": {
418418
"type": "array",
419419
"items": {
420420
"type": "array",
421421
"items": {
422422
"type": "integer"
423423
}
424424
}
425+
},
426+
"Command": {
427+
"type": "array",
428+
"items": {
429+
"type": "string"
430+
}
425431
}
426432
},
427433
"required": [
428-
"ValueRange"
434+
"Value",
435+
"Command"
429436
]
430437
}
431438
}

crates/buttplug_core/src/message/device_feature.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,19 +275,19 @@ impl DeviceFeatureOutput {
275275
pub struct DeviceFeatureInputProperties {
276276
#[getset(get = "pub", get_mut = "pub(super)")]
277277
#[serde(serialize_with = "range_sequence_serialize")]
278-
value_range: Vec<RangeInclusive<i32>>,
278+
value: Vec<RangeInclusive<i32>>,
279279
#[getset(get = "pub")]
280-
input_commands: HashSet<InputCommandType>,
280+
command: HashSet<InputCommandType>,
281281
}
282282

283283
impl DeviceFeatureInputProperties {
284284
pub fn new(
285-
value_range: &Vec<RangeInclusive<i32>>,
285+
value: &Vec<RangeInclusive<i32>>,
286286
sensor_commands: &HashSet<InputCommandType>,
287287
) -> Self {
288288
Self {
289-
value_range: value_range.clone(),
290-
input_commands: sensor_commands.clone(),
289+
value: value.clone(),
290+
command: sensor_commands.clone(),
291291
}
292292
}
293293
}

crates/buttplug_server/src/message/v3/client_device_message_attributes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,12 @@ impl From<Vec<DeviceFeature>> for ClientDeviceMessageAttributesV3 {
338338
// Only convert Battery backwards. Other sensors weren't really built for v3 and we
339339
// never recommended using them or implemented much for them.
340340
if let Some(battery) = sensor_map.battery()
341-
&& battery.input_commands().contains(&InputCommandType::Read)
341+
&& battery.command().contains(&InputCommandType::Read)
342342
{
343343
sensor_vec.push(SensorDeviceMessageAttributesV3 {
344344
feature_descriptor: feature.description().to_owned(),
345345
sensor_type: InputType::Battery,
346-
sensor_range: battery.value_range().clone(),
346+
sensor_range: battery.value().clone(),
347347
feature: feature.clone(),
348348
index: 0,
349349
});

crates/buttplug_server/src/message/v3/server_device_message_attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl From<Vec<ServerDeviceFeature>> for ServerDeviceMessageAttributesV3 {
161161
sensor_vec.push(ServerSensorDeviceMessageAttributesV3 {
162162
feature_descriptor: feature.description().to_owned(),
163163
sensor_type: InputType::Battery,
164-
sensor_range: battery.value_range().clone(),
164+
sensor_range: battery.value().clone(),
165165
feature: feature.clone(),
166166
index: 0,
167167
});

0 commit comments

Comments
 (0)