Skip to content
Snippets Groups Projects
Commit ef6898fb authored by Hsin-chen Chuang's avatar Hsin-chen Chuang
Browse files

Floss: btclient: Implement socket close command

Bug: 262813906
Tag: #floss
Test: test with the next CL
Test: mmm packages/modules/Bluetooth
Change-Id: I1cf1c722836e5b847021d3b0adbe34278ff0c986
parent 492306dc
No related branches found
No related tags found
No related merge requests found
...@@ -251,7 +251,7 @@ fn build_commands() -> HashMap<String, CommandOption> { ...@@ -251,7 +251,7 @@ fn build_commands() -> HashMap<String, CommandOption> {
String::from( String::from(
"socket connect <address> <l2cap|rfcomm> <psm|uuid> <auth-required> <Bredr|LE>", "socket connect <address> <l2cap|rfcomm> <psm|uuid> <auth-required> <Bredr|LE>",
), ),
String::from("socket disconnect <socket_id>"), String::from("socket close <socket_id>"),
String::from("socket set-on-connect-schedule <send|resend|dump>"), String::from("socket set-on-connect-schedule <send|resend|dump>"),
], ],
description: String::from("Socket manager utilities."), description: String::from("Socket manager utilities."),
...@@ -1626,6 +1626,26 @@ impl CommandHandler { ...@@ -1626,6 +1626,26 @@ impl CommandHandler {
status, id, addr, sock_type, psm_or_uuid); status, id, addr, sock_type, psm_or_uuid);
} }
} }
"close" => {
let sockid = String::from(get_arg(args, 1)?)
.parse::<u64>()
.or(Err("Failed parsing socket ID"))?;
let status = self
.context
.lock()
.unwrap()
.socket_manager_dbus
.as_mut()
.unwrap()
.close(callback_id, sockid);
if status != BtStatus::Success {
return Err(format!(
"Failed to close the listening socket, status = {:?}",
status,
)
.into());
}
}
_ => return Err(CommandError::InvalidArgs), _ => return Err(CommandError::InvalidArgs),
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment