2023-03-23 10:44:26

by Simon Mikuda

[permalink] [raw]
Subject: [PATCH BlueZ 3/9] btgatt-client: Don't wait for discovery on read/write commands

---
tools/btgatt-client.c | 45 -------------------------------------------
1 file changed, 45 deletions(-)

diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index cce978869..2a0cb5181 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -490,11 +490,6 @@ static void cmd_read_multiple(struct client *cli, char *cmd_str)
int i;
char *endptr = NULL;

- if (!bt_gatt_client_is_ready(cli->gatt)) {
- printf("GATT client not initialized\n");
- return;
- }
-
if (!parse_args(cmd_str, sizeof(argv), argv, &argc) || argc < 2) {
read_multiple_usage();
return;
@@ -560,11 +555,6 @@ static void cmd_read_value(struct client *cli, char *cmd_str)
uint16_t handle;
char *endptr = NULL;

- if (!bt_gatt_client_is_ready(cli->gatt)) {
- printf("GATT client not initialized\n");
- return;
- }
-
if (!parse_args(cmd_str, 1, argv, &argc) || argc != 1) {
read_value_usage();
return;
@@ -594,11 +584,6 @@ static void cmd_read_long_value(struct client *cli, char *cmd_str)
uint16_t offset;
char *endptr = NULL;

- if (!bt_gatt_client_is_ready(cli->gatt)) {
- printf("GATT client not initialized\n");
- return;
- }
-
if (!parse_args(cmd_str, 2, argv, &argc) || argc != 2) {
read_long_value_usage();
return;
@@ -661,11 +646,6 @@ static void cmd_write_value(struct client *cli, char *cmd_str)
bool without_response = false;
bool signed_write = false;

- if (!bt_gatt_client_is_ready(cli->gatt)) {
- printf("GATT client not initialized\n");
- return;
- }
-
if (!parse_args(cmd_str, 514, argv + 1, &argc)) {
printf("Too many arguments\n");
write_value_usage();
@@ -791,11 +771,6 @@ static void cmd_write_long_value(struct client *cli, char *cmd_str)
uint8_t *value = NULL;
bool reliable_writes = false;

- if (!bt_gatt_client_is_ready(cli->gatt)) {
- printf("GATT client not initialized\n");
- return;
- }
-
if (!parse_args(cmd_str, 514, argv + 1, &argc)) {
printf("Too many arguments\n");
write_value_usage();
@@ -901,11 +876,6 @@ static void cmd_write_prepare(struct client *cli, char *cmd_str)
unsigned int length;
uint8_t *value = NULL;

- if (!bt_gatt_client_is_ready(cli->gatt)) {
- printf("GATT client not initialized\n");
- return;
- }
-
if (!parse_args(cmd_str, 514, argv + 1, &argc)) {
printf("Too many arguments\n");
write_value_usage();
@@ -1026,11 +996,6 @@ static void cmd_write_execute(struct client *cli, char *cmd_str)
unsigned int session_id;
bool execute;

- if (!bt_gatt_client_is_ready(cli->gatt)) {
- printf("GATT client not initialized\n");
- return;
- }
-
if (!parse_args(cmd_str, 514, argv, &argc)) {
printf("Too many arguments\n");
write_value_usage();
@@ -1193,11 +1158,6 @@ static void cmd_set_security(struct client *cli, char *cmd_str)
char *endptr = NULL;
int level;

- if (!bt_gatt_client_is_ready(cli->gatt)) {
- printf("GATT client not initialized\n");
- return;
- }
-
if (!parse_args(cmd_str, 1, argv, &argc)) {
printf("Too many arguments\n");
set_security_usage();
@@ -1225,11 +1185,6 @@ static void cmd_get_security(struct client *cli, char *cmd_str)
{
int level;

- if (!bt_gatt_client_is_ready(cli->gatt)) {
- printf("GATT client not initialized\n");
- return;
- }
-
level = bt_gatt_client_get_security(cli->gatt);
if (level < 0)
printf("Could not set sec level\n");
--
2.34.1