OSDN Git Service

Pan role is never GN
authorZach Johnson <zachoverflow@google.com>
Wed, 26 Aug 2020 00:03:23 +0000 (17:03 -0700)
committerZach Johnson <zachoverflow@google.com>
Wed, 26 Aug 2020 00:03:55 +0000 (17:03 -0700)
we only support PANU and NAP

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I7b30020bc76d94a2e91fb0b0d9aff2a4e4c99344

bta/include/bta_pan_api.h
bta/pan/bta_pan_act.cc
internal_include/bt_target.h
stack/include/pan_api.h
stack/pan/pan_api.cc
stack/pan/pan_main.cc

index 1ddb477..0873ddb 100644 (file)
@@ -48,7 +48,6 @@ typedef uint8_t tBTA_PAN_EVT;
 
 /* pan roles */
 #define BTA_PAN_ROLE_PANU PAN_ROLE_CLIENT
-#define BTA_PAN_ROLE_GN PAN_ROLE_GN_SERVER
 #define BTA_PAN_ROLE_NAP PAN_ROLE_NAP_SERVER
 
 typedef uint8_t tBTA_PAN_ROLE;
index 14e80fd..e805ccd 100644 (file)
@@ -114,8 +114,6 @@ static void bta_pan_conn_state_cback(uint16_t handle, const RawAddress& bd_addr,
 
     if (src_role == PAN_ROLE_CLIENT)
       p_scb->app_id = bta_pan_cb.app_id[0];
-    else if (src_role == PAN_ROLE_GN_SERVER)
-      p_scb->app_id = bta_pan_cb.app_id[1];
     else if (src_role == PAN_ROLE_NAP_SERVER)
       p_scb->app_id = bta_pan_cb.app_id[2];
   } else if ((state != PAN_SUCCESS) && !is_role_change) {
@@ -345,11 +343,6 @@ void bta_pan_set_role(tBTA_PAN_DATA* p_data) {
     else
       bta_sys_remove_uuid(UUID_SERVCLASS_NAP);
 
-    if (p_data->api_set_role.role & PAN_ROLE_GN_SERVER)
-      bta_sys_add_uuid(UUID_SERVCLASS_GN);
-    else
-      bta_sys_remove_uuid(UUID_SERVCLASS_GN);
-
     if (p_data->api_set_role.role & PAN_ROLE_CLIENT)
       bta_sys_add_uuid(UUID_SERVCLASS_PANU);
     else
index e332425..92e894a 100644 (file)
 #define PAN_SUPPORTS_ROLE_PANU TRUE
 #endif
 
-/* This will enable the GN role */
-#ifndef PAN_SUPPORTS_ROLE_GN
-#define PAN_SUPPORTS_ROLE_GN TRUE
-#endif
-
 /* This will enable the NAP role */
 #ifndef PAN_SUPPORTS_ROLE_NAP
 #define PAN_SUPPORTS_ROLE_NAP TRUE
 #define PAN_NAP_DEFAULT_SERVICE_NAME "Network Access Point Service"
 #endif
 
-/* Default service name for GN role */
-#ifndef PAN_GN_DEFAULT_SERVICE_NAME
-#define PAN_GN_DEFAULT_SERVICE_NAME "Group Network Service"
-#endif
-
 /* Default service name for PANU role */
 #ifndef PAN_PANU_DEFAULT_SERVICE_NAME
 #define PAN_PANU_DEFAULT_SERVICE_NAME "PAN User Service"
 #define PAN_NAP_DEFAULT_DESCRIPTION "NAP"
 #endif
 
-/* Default description for GN role service */
-#ifndef PAN_GN_DEFAULT_DESCRIPTION
-#define PAN_GN_DEFAULT_DESCRIPTION "GN"
-#endif
-
 /* Default description for PANU role service */
 #ifndef PAN_PANU_DEFAULT_DESCRIPTION
 #define PAN_PANU_DEFAULT_DESCRIPTION "PANU"
index 7020767..9284c79 100644 (file)
@@ -45,7 +45,6 @@
 
 /* Bit map for PAN roles */
 #define PAN_ROLE_CLIENT 0x01     /* PANU role */
-#define PAN_ROLE_GN_SERVER 0x02  /* GN role */
 #define PAN_ROLE_NAP_SERVER 0x04 /* NAP role */
 
 /* Bitmap to indicate the usage of the Data */
@@ -240,7 +239,6 @@ extern void PAN_Deregister(void);
  *
  * Parameters:      role        - is bit map of roles to be active
  *                                      PAN_ROLE_CLIENT is for PANU role
- *                                      PAN_ROLE_GN_SERVER is for GN role
  *                                      PAN_ROLE_NAP_SERVER is for NAP role
  *                  sec_mask    - Security mask for different roles
  *                                      It is array of uint8_t. The bytes
@@ -270,7 +268,6 @@ extern tPAN_RESULT PAN_SetRole(uint8_t role, const char* p_user_name,
  *                  src_role    - Role of the local device for the connection
  *                  dst_role    - Role of the remote device for the connection
  *                                      PAN_ROLE_CLIENT is for PANU role
- *                                      PAN_ROLE_GN_SERVER is for GN role
  *                                      PAN_ROLE_NAP_SERVER is for NAP role
  *                  *handle     - Pointer for returning Handle to the connection
  *
index 4a9b5b9..3097c8c 100644 (file)
@@ -109,7 +109,6 @@ void PAN_Deregister(void) {
  *
  * Parameters:      role        - is bit map of roles to be active
  *                                      PAN_ROLE_CLIENT is for PANU role
- *                                      PAN_ROLE_GN_SERVER is for GN role
  *                                      PAN_ROLE_NAP_SERVER is for NAP role
  *                  p_user_name - Service name for PANU role
  *                  p_gn_name   - Service name for GN role
@@ -132,8 +131,7 @@ tPAN_RESULT PAN_SetRole(uint8_t role, const char* p_user_name,
   const char* p_desc;
 
   /* If the role is not a valid combination reject it */
-  if ((!(role &
-         (PAN_ROLE_CLIENT | PAN_ROLE_GN_SERVER | PAN_ROLE_NAP_SERVER))) &&
+  if ((!(role & (PAN_ROLE_CLIENT | PAN_ROLE_NAP_SERVER))) &&
       role != PAN_ROLE_INACTIVE) {
     PAN_TRACE_ERROR("PAN role %d is invalid", role);
     return PAN_FAILURE;
@@ -174,32 +172,6 @@ tPAN_RESULT PAN_SetRole(uint8_t role, const char* p_user_name,
   }
 #endif
 
-#if (PAN_SUPPORTS_ROLE_GN == TRUE)
-  if (role & PAN_ROLE_GN_SERVER) {
-    /* Check the service name */
-    if ((p_gn_name == NULL) || (*p_gn_name == 0))
-      p_gn_name = PAN_GN_DEFAULT_SERVICE_NAME;
-
-    /* Registering for GN service with SDP */
-    p_desc = PAN_GN_DEFAULT_DESCRIPTION;
-
-    if (pan_cb.pan_gn_sdp_handle != 0)
-      SDP_DeleteRecord(pan_cb.pan_gn_sdp_handle);
-
-    pan_cb.pan_gn_sdp_handle =
-        pan_register_with_sdp(UUID_SERVCLASS_GN, p_gn_name, p_desc);
-    bta_sys_add_uuid(UUID_SERVCLASS_GN);
-  }
-  /* If the GN role is already active and now being cleared delete the record */
-  else if (pan_cb.role & PAN_ROLE_GN_SERVER) {
-    if (pan_cb.pan_gn_sdp_handle != 0) {
-      SDP_DeleteRecord(pan_cb.pan_gn_sdp_handle);
-      pan_cb.pan_gn_sdp_handle = 0;
-      bta_sys_remove_uuid(UUID_SERVCLASS_GN);
-    }
-  }
-#endif
-
 #if (PAN_SUPPORTS_ROLE_PANU == TRUE)
   if (role & PAN_ROLE_CLIENT) {
     /* Check the service name */
@@ -242,7 +214,6 @@ tPAN_RESULT PAN_SetRole(uint8_t role, const char* p_user_name,
  *                  src_role    - Role of the local device for the connection
  *                  dst_role    - Role of the remote device for the connection
  *                                      PAN_ROLE_CLIENT is for PANU role
- *                                      PAN_ROLE_GN_SERVER is for GN role
  *                                      PAN_ROLE_NAP_SERVER is for NAP role
  *                  *handle     - Pointer for returning Handle to the connection
  *
@@ -272,10 +243,8 @@ tPAN_RESULT PAN_Connect(const RawAddress& rem_bda, uint8_t src_role,
   }
 
   /* Validate the parameters before proceeding */
-  if ((src_role != PAN_ROLE_CLIENT && src_role != PAN_ROLE_GN_SERVER &&
-       src_role != PAN_ROLE_NAP_SERVER) ||
-      (dst_role != PAN_ROLE_CLIENT && dst_role != PAN_ROLE_GN_SERVER &&
-       dst_role != PAN_ROLE_NAP_SERVER)) {
+  if ((src_role != PAN_ROLE_CLIENT && src_role != PAN_ROLE_NAP_SERVER) ||
+      (dst_role != PAN_ROLE_CLIENT && dst_role != PAN_ROLE_NAP_SERVER)) {
     PAN_TRACE_ERROR("Either source %d or destination role %d is invalid",
                     src_role, dst_role);
     return PAN_FAILURE;
@@ -302,8 +271,6 @@ tPAN_RESULT PAN_Connect(const RawAddress& rem_bda, uint8_t src_role,
     src_uuid = UUID_SERVCLASS_PANU;
     if (dst_role == PAN_ROLE_CLIENT) {
       dst_uuid = UUID_SERVCLASS_PANU;
-    } else if (dst_role == PAN_ROLE_GN_SERVER) {
-      dst_uuid = UUID_SERVCLASS_GN;
     } else {
       dst_uuid = UUID_SERVCLASS_NAP;
     }
@@ -317,11 +284,7 @@ tPAN_RESULT PAN_Connect(const RawAddress& rem_bda, uint8_t src_role,
     }
 
     dst_uuid = UUID_SERVCLASS_PANU;
-    if (src_role == PAN_ROLE_GN_SERVER) {
-      src_uuid = UUID_SERVCLASS_GN;
-    } else {
-      src_uuid = UUID_SERVCLASS_NAP;
-    }
+    src_uuid = UUID_SERVCLASS_NAP;
     mx_chan_id = src_uuid;
   }
   /* The role combination is not valid */
index fcf8107..e4301e3 100644 (file)
@@ -184,8 +184,6 @@ void pan_conn_ind_cb(uint16_t handle, const RawAddress& p_bda,
   /* Requested destination role is */
   if (local_uuid16 == UUID_SERVCLASS_PANU)
     req_role = PAN_ROLE_CLIENT;
-  else if (local_uuid16 == UUID_SERVCLASS_GN)
-    req_role = PAN_ROLE_GN_SERVER;
   else
     req_role = PAN_ROLE_NAP_SERVER;
 
@@ -333,15 +331,11 @@ void pan_connect_state_cb(uint16_t handle,
   /* Requested destination role is */
   if (pcb->src_uuid == UUID_SERVCLASS_PANU)
     pan_cb.active_role = PAN_ROLE_CLIENT;
-  else if (pcb->src_uuid == UUID_SERVCLASS_GN)
-    pan_cb.active_role = PAN_ROLE_GN_SERVER;
   else
     pan_cb.active_role = PAN_ROLE_NAP_SERVER;
 
   if (pcb->dst_uuid == UUID_SERVCLASS_PANU)
     peer_role = PAN_ROLE_CLIENT;
-  else if (pcb->dst_uuid == UUID_SERVCLASS_GN)
-    peer_role = PAN_ROLE_GN_SERVER;
   else
     peer_role = PAN_ROLE_NAP_SERVER;