fix: resolve buttplug-wasm build error by using Vec and slices
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 5m26s
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 5m26s
This commit is contained in:
@@ -7,7 +7,6 @@ use buttplug_server::device::hardware::communication::{
|
|||||||
HardwareCommunicationManagerEvent,
|
HardwareCommunicationManagerEvent,
|
||||||
};
|
};
|
||||||
use futures::future;
|
use futures::future;
|
||||||
use js_sys::Array;
|
|
||||||
use tokio::sync::mpsc::Sender;
|
use tokio::sync::mpsc::Sender;
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
use wasm_bindgen_futures::{spawn_local, JsFuture};
|
use wasm_bindgen_futures::{spawn_local, JsFuture};
|
||||||
@@ -63,8 +62,8 @@ impl HardwareCommunicationManager for WebBluetoothCommunicationManager {
|
|||||||
// way for anyone to add device configurations through FFI yet anyways.
|
// way for anyone to add device configurations through FFI yet anyways.
|
||||||
let config_manager = create_test_dcm(false);
|
let config_manager = create_test_dcm(false);
|
||||||
let options = web_sys::RequestDeviceOptions::new();
|
let options = web_sys::RequestDeviceOptions::new();
|
||||||
let filters = Array::new();
|
let mut filters = Vec::new();
|
||||||
let optional_services = Array::new();
|
let mut optional_services = Vec::new();
|
||||||
for vals in config_manager.base_communication_specifiers().iter() {
|
for vals in config_manager.base_communication_specifiers().iter() {
|
||||||
for config in vals.1.iter() {
|
for config in vals.1.iter() {
|
||||||
if let ProtocolCommunicationSpecifier::BluetoothLE(btle) = &config {
|
if let ProtocolCommunicationSpecifier::BluetoothLE(btle) = &config {
|
||||||
@@ -77,16 +76,16 @@ impl HardwareCommunicationManager for WebBluetoothCommunicationManager {
|
|||||||
} else {
|
} else {
|
||||||
filter.set_name(&name);
|
filter.set_name(&name);
|
||||||
}
|
}
|
||||||
filters.push(&filter.into());
|
filters.push(filter);
|
||||||
}
|
}
|
||||||
for (service, _) in btle.services() {
|
for (service, _) in btle.services() {
|
||||||
optional_services.push(&service.to_string().into());
|
optional_services.push(js_sys::JsString::from(service.to_string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
options.set_filters(filters.as_ref());
|
options.set_filters(&filters);
|
||||||
options.set_optional_services(optional_services.as_ref());
|
options.set_optional_services(&optional_services);
|
||||||
let nav = web_sys::window().unwrap().navigator();
|
let nav = web_sys::window().unwrap().navigator();
|
||||||
//nav.bluetooth().get_availability();
|
//nav.bluetooth().get_availability();
|
||||||
//JsFuture::from(nav.bluetooth().request_device()).await;
|
//JsFuture::from(nav.bluetooth().request_device()).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user