You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2021/11/09 14:07:13 UTC

[GitHub] [mynewt-nimble] michal-narajowski commented on a change in pull request #1085: apps/bttester: set filter accept list

michal-narajowski commented on a change in pull request #1085:
URL: https://github.com/apache/mynewt-nimble/pull/1085#discussion_r745640700



##########
File path: apps/bttester/src/gap.c
##########
@@ -1244,8 +1244,14 @@ static void connect(const uint8_t *data, uint16_t len)
 {
 	uint8_t status = BTP_STATUS_SUCCESS;
 
+	uint8_t tmp [6] = {0,0,0,0,0,0};
+	ble_addr_t *tmp_addr = (ble_addr_t *) data;
+
 	SYS_LOG_DBG("");
 
+	if (memcmp(tmp, tmp_addr->val, 6) == 0)

Review comment:
       ```suggestion
   	if (ble_addr_cmp(BLE_ADDR_ANY, addr) == 0)
   ```

##########
File path: apps/bttester/src/gap.c
##########
@@ -1244,8 +1244,14 @@ static void connect(const uint8_t *data, uint16_t len)
 {
 	uint8_t status = BTP_STATUS_SUCCESS;
 
+	uint8_t tmp [6] = {0,0,0,0,0,0};
+	ble_addr_t *tmp_addr = (ble_addr_t *) data;

Review comment:
       ```suggestion
   	ble_addr_t *addr = (ble_addr_t *) data;
   ```

##########
File path: apps/bttester/src/gap.c
##########
@@ -1244,8 +1244,14 @@ static void connect(const uint8_t *data, uint16_t len)
 {
 	uint8_t status = BTP_STATUS_SUCCESS;
 
+	uint8_t tmp [6] = {0,0,0,0,0,0};
+	ble_addr_t *tmp_addr = (ble_addr_t *) data;
+
 	SYS_LOG_DBG("");
 
+	if (memcmp(tmp, tmp_addr->val, 6) == 0)
+		data = NULL;

Review comment:
       ```suggestion
   		addr = NULL;
   ```

##########
File path: apps/bttester/src/gap.c
##########
@@ -1244,8 +1244,14 @@ static void connect(const uint8_t *data, uint16_t len)
 {
 	uint8_t status = BTP_STATUS_SUCCESS;
 
+	uint8_t tmp [6] = {0,0,0,0,0,0};

Review comment:
       ```suggestion
   ```

##########
File path: apps/bttester/src/gap.c
##########
@@ -1587,6 +1593,26 @@ static void set_mitm(const uint8_t *data, uint16_t len)
 		   CONTROLLER_INDEX, BTP_STATUS_SUCCESS);
 }
 
+static void set_filter_accept_list(const uint8_t *data, uint16_t len)
+{
+	uint8_t status = BTP_STATUS_SUCCESS;
+	struct gap_set_filter_accept_list_cmd *tmp =
+			(struct gap_set_filter_accept_list_cmd *) data;
+	SYS_LOG_DBG("");
+
+	/*
+	 * Check if the nb of bytes received matches the len of addrs list.
+	 * Then set the filter accept list.
+	 */
+	if (((len - sizeof(tmp->list_len))/sizeof(ble_addr_t) !=

Review comment:
       ```suggestion
   	if (len % sizeof(ble_addr_t) > 0)
   ```

##########
File path: apps/bttester/src/gap.c
##########
@@ -1244,8 +1244,14 @@ static void connect(const uint8_t *data, uint16_t len)
 {
 	uint8_t status = BTP_STATUS_SUCCESS;
 
+	uint8_t tmp [6] = {0,0,0,0,0,0};
+	ble_addr_t *tmp_addr = (ble_addr_t *) data;

Review comment:
       Empty line after the status declaration is unnecessary.

##########
File path: apps/bttester/src/gap.c
##########
@@ -1587,6 +1593,26 @@ static void set_mitm(const uint8_t *data, uint16_t len)
 		   CONTROLLER_INDEX, BTP_STATUS_SUCCESS);
 }
 
+static void set_filter_accept_list(const uint8_t *data, uint16_t len)
+{
+	uint8_t status = BTP_STATUS_SUCCESS;
+	struct gap_set_filter_accept_list_cmd *tmp =
+			(struct gap_set_filter_accept_list_cmd *) data;
+	SYS_LOG_DBG("");

Review comment:
       ```suggestion
   	
   	SYS_LOG_DBG("");
   ```

##########
File path: apps/bttester/src/gap.c
##########
@@ -1244,8 +1244,14 @@ static void connect(const uint8_t *data, uint16_t len)
 {
 	uint8_t status = BTP_STATUS_SUCCESS;
 
+	uint8_t tmp [6] = {0,0,0,0,0,0};
+	ble_addr_t *tmp_addr = (ble_addr_t *) data;
+
 	SYS_LOG_DBG("");
 
+	if (memcmp(tmp, tmp_addr->val, 6) == 0)
+		data = NULL;
+
 	if (ble_gap_connect(own_addr_type, (ble_addr_t *) data, 0,

Review comment:
       ```suggestion
   	if (ble_gap_connect(own_addr_type, addr, 0,
   ```

##########
File path: apps/bttester/src/bttester.h
##########
@@ -320,6 +320,11 @@ struct gap_set_mitm_cmd {
     uint8_t mitm;
 } __packed;
 
+#define GAP_SET_FILTER_ACCEPT_LIST	0x1c
+struct gap_set_filter_accept_list_cmd {
+    uint8_t list_len;

Review comment:
       No need for list_len param.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@mynewt.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org