Loading system/gd/rust/linux/service/src/iface_bluetooth_media.rs +3 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,9 @@ impl IBluetoothMedia for IBluetoothMediaDBus { true } #[dbus_method("SetVolume")] fn set_volume(&mut self, volume: i32) {} #[dbus_method("StartAudioRequest")] fn start_audio_request(&mut self) {} Loading system/gd/rust/linux/stack/src/bluetooth_media.rs +8 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ pub trait IBluetoothMedia { bits_per_sample: i32, channel_mode: i32, ) -> bool; fn set_volume(&mut self, volume: i32); fn start_audio_request(&mut self); fn stop_audio_request(&mut self); } Loading Loading @@ -198,6 +199,13 @@ impl IBluetoothMedia for BluetoothMedia { true } fn set_volume(&mut self, volume: i32) { let i8v = i8::try_from(volume); if i8v.is_ok() { self.avrcp.as_mut().unwrap().set_volume(i8::try_from(volume).ok().unwrap()); } } fn start_audio_request(&mut self) { self.a2dp.as_mut().unwrap().start_audio_request(); } Loading system/gd/rust/topshim/btav/btav_shim.cc +3 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,9 @@ int AvrcpIntf::disconnect(RustRawAddress bt_addr) { return intf_->DisconnectDevice(addr); } void AvrcpIntf::set_volume(int8_t volume) { return mVolumeInterface.SetVolume(volume); } } // namespace rust } // namespace topshim } // namespace bluetooth system/gd/rust/topshim/btav/btav_shim.h +3 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,9 @@ class AvrcpIntf { int connect(RustRawAddress bt_addr); int disconnect(RustRawAddress bt_addr); // interface for Audio server void set_volume(int8_t volume); private: bluetooth::avrcp::ServiceInterface* intf_; }; Loading system/gd/rust/topshim/src/profiles/avrcp.rs +5 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ pub mod ffi { fn init(self: Pin<&mut AvrcpIntf>); fn cleanup(self: Pin<&mut AvrcpIntf>); fn set_volume(self: Pin<&mut AvrcpIntf>, volume: i8); } extern "Rust" {} Loading Loading @@ -43,4 +44,8 @@ impl Avrcp { self.internal.pin_mut().cleanup(); true } pub fn set_volume(&mut self, volume: i8) { self.internal.pin_mut().set_volume(volume); } } Loading
system/gd/rust/linux/service/src/iface_bluetooth_media.rs +3 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,9 @@ impl IBluetoothMedia for IBluetoothMediaDBus { true } #[dbus_method("SetVolume")] fn set_volume(&mut self, volume: i32) {} #[dbus_method("StartAudioRequest")] fn start_audio_request(&mut self) {} Loading
system/gd/rust/linux/stack/src/bluetooth_media.rs +8 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ pub trait IBluetoothMedia { bits_per_sample: i32, channel_mode: i32, ) -> bool; fn set_volume(&mut self, volume: i32); fn start_audio_request(&mut self); fn stop_audio_request(&mut self); } Loading Loading @@ -198,6 +199,13 @@ impl IBluetoothMedia for BluetoothMedia { true } fn set_volume(&mut self, volume: i32) { let i8v = i8::try_from(volume); if i8v.is_ok() { self.avrcp.as_mut().unwrap().set_volume(i8::try_from(volume).ok().unwrap()); } } fn start_audio_request(&mut self) { self.a2dp.as_mut().unwrap().start_audio_request(); } Loading
system/gd/rust/topshim/btav/btav_shim.cc +3 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,9 @@ int AvrcpIntf::disconnect(RustRawAddress bt_addr) { return intf_->DisconnectDevice(addr); } void AvrcpIntf::set_volume(int8_t volume) { return mVolumeInterface.SetVolume(volume); } } // namespace rust } // namespace topshim } // namespace bluetooth
system/gd/rust/topshim/btav/btav_shim.h +3 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,9 @@ class AvrcpIntf { int connect(RustRawAddress bt_addr); int disconnect(RustRawAddress bt_addr); // interface for Audio server void set_volume(int8_t volume); private: bluetooth::avrcp::ServiceInterface* intf_; }; Loading
system/gd/rust/topshim/src/profiles/avrcp.rs +5 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ pub mod ffi { fn init(self: Pin<&mut AvrcpIntf>); fn cleanup(self: Pin<&mut AvrcpIntf>); fn set_volume(self: Pin<&mut AvrcpIntf>, volume: i8); } extern "Rust" {} Loading Loading @@ -43,4 +44,8 @@ impl Avrcp { self.internal.pin_mut().cleanup(); true } pub fn set_volume(&mut self, volume: i8) { self.internal.pin_mut().set_volume(volume); } }