Loading system/gd/rust/linux/client/src/callbacks.rs +12 −3 Original line number Diff line number Diff line Loading @@ -248,10 +248,19 @@ impl IBluetoothCallback for BtCallback { fn on_sdp_search_complete( &mut self, _remote_device: BluetoothDevice, _searched_uuid: Uuid128Bit, _sdp_records: Vec<BtSdpRecord>, remote_device: BluetoothDevice, searched_uuid: Uuid128Bit, sdp_records: Vec<BtSdpRecord>, ) { print_info!( "SDP search of {} for UUID {} returned {} results", remote_device.address, UuidWrapper(&searched_uuid), sdp_records.len() ); if !sdp_records.is_empty() { print_info!("{:?}", sdp_records); } } fn on_sdp_record_created(&mut self, record: BtSdpRecord, handle: i32) { Loading system/gd/rust/linux/client/src/command_handler.rs +36 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,14 @@ fn build_commands() -> HashMap<String, CommandOption> { function_pointer: CommandHandler::cmd_advertise, }, ); command_options.insert( String::from("sdp"), CommandOption { rules: vec![String::from("sdp search <address> <uuid>")], description: String::from("Service Discovery Protocol utilities."), function_pointer: CommandHandler::cmd_sdp, }, ); command_options.insert( String::from("socket"), CommandOption { Loading Loading @@ -1386,6 +1394,34 @@ impl CommandHandler { Ok(()) } fn cmd_sdp(&mut self, args: &Vec<String>) -> CommandResult { if !self.lock_context().adapter_ready { return Err(self.adapter_not_ready()); } let command = get_arg(args, 0)?; match &command[..] { "search" => { let device = BluetoothDevice { address: String::from(get_arg(args, 1)?), name: String::from(""), }; let uuid = match UuidHelper::parse_string(get_arg(args, 2)?) { Some(uu) => uu.uu, None => return Err(CommandError::Failed("Invalid UUID".into())), }; let success = self.lock_context().adapter_dbus.as_ref().unwrap().sdp_search(device, uuid); if !success { return Err("Unable to execute SDP search".into()); } } _ => return Err(CommandError::InvalidArgs), } Ok(()) } fn cmd_socket(&mut self, args: &Vec<String>) -> CommandResult { if !self.lock_context().adapter_ready { return Err(self.adapter_not_ready()); Loading Loading
system/gd/rust/linux/client/src/callbacks.rs +12 −3 Original line number Diff line number Diff line Loading @@ -248,10 +248,19 @@ impl IBluetoothCallback for BtCallback { fn on_sdp_search_complete( &mut self, _remote_device: BluetoothDevice, _searched_uuid: Uuid128Bit, _sdp_records: Vec<BtSdpRecord>, remote_device: BluetoothDevice, searched_uuid: Uuid128Bit, sdp_records: Vec<BtSdpRecord>, ) { print_info!( "SDP search of {} for UUID {} returned {} results", remote_device.address, UuidWrapper(&searched_uuid), sdp_records.len() ); if !sdp_records.is_empty() { print_info!("{:?}", sdp_records); } } fn on_sdp_record_created(&mut self, record: BtSdpRecord, handle: i32) { Loading
system/gd/rust/linux/client/src/command_handler.rs +36 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,14 @@ fn build_commands() -> HashMap<String, CommandOption> { function_pointer: CommandHandler::cmd_advertise, }, ); command_options.insert( String::from("sdp"), CommandOption { rules: vec![String::from("sdp search <address> <uuid>")], description: String::from("Service Discovery Protocol utilities."), function_pointer: CommandHandler::cmd_sdp, }, ); command_options.insert( String::from("socket"), CommandOption { Loading Loading @@ -1386,6 +1394,34 @@ impl CommandHandler { Ok(()) } fn cmd_sdp(&mut self, args: &Vec<String>) -> CommandResult { if !self.lock_context().adapter_ready { return Err(self.adapter_not_ready()); } let command = get_arg(args, 0)?; match &command[..] { "search" => { let device = BluetoothDevice { address: String::from(get_arg(args, 1)?), name: String::from(""), }; let uuid = match UuidHelper::parse_string(get_arg(args, 2)?) { Some(uu) => uu.uu, None => return Err(CommandError::Failed("Invalid UUID".into())), }; let success = self.lock_context().adapter_dbus.as_ref().unwrap().sdp_search(device, uuid); if !success { return Err("Unable to execute SDP search".into()); } } _ => return Err(CommandError::InvalidArgs), } Ok(()) } fn cmd_socket(&mut self, args: &Vec<String>) -> CommandResult { if !self.lock_context().adapter_ready { return Err(self.adapter_not_ready()); Loading