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 2020/09/11 07:54:38 UTC

[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #838: apps: privacy added

apache-mynewt-bot commented on pull request #838:
URL: https://github.com/apache/mynewt-nimble/pull/838#issuecomment-690938374


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### apps/privacy_cent/src/main.c
   <details>
   
   ```diff
   @@ -84,36 +84,36 @@
    
        switch (event->type) {
        case BLE_GAP_EVENT_CONNECT:
   -            if (event->connect.status == 0) {
   -                ble_gap_conn_find(event->connect.conn_handle, &conn_desc);
   -                MODLOG_DFLT(INFO,"Connection was established\n");
   -                MODLOG_DFLT(INFO,"Role: ");
   -                if (conn_desc.role == 0) {
   -                    MODLOG_DFLT(INFO,"master\n");
   -                } else {
   -                    MODLOG_DFLT(INFO,"slave\n");
   -                }
   -                rc = ble_gap_security_initiate(conn_desc.conn_handle);
   -                if (rc == 0) {
   -                    MODLOG_DFLT(INFO, "Pairing initiated!\n");
   -                    break;
   -                } else if (rc == BLE_HS_ENOTCONN) {
   -                    MODLOG_DFLT(INFO, "There is no connection with this handle\n");
   -                } else if (BLE_HS_EALREADY) {
   -                    MODLOG_DFLT(INFO, "Devices already trying to pair\n");
   -                } else {
   -                    MODLOG_DFLT(ERROR, "Error occured during pairing\n");
   -                }
   -                if (!rc) {
   -                    MODLOG_DFLT(INFO, "Pairing finished with rc=0\n");
   -                }
   -            } else if (event->connect.status == BLE_ERR_ACL_CONN_EXISTS) {
   -                MODLOG_DFLT(INFO, "Connection already exists\n");
   +        if (event->connect.status == 0) {
   +            ble_gap_conn_find(event->connect.conn_handle, &conn_desc);
   +            MODLOG_DFLT(INFO,"Connection was established\n");
   +            MODLOG_DFLT(INFO,"Role: ");
   +            if (conn_desc.role == 0) {
   +                MODLOG_DFLT(INFO,"master\n");
   +            } else {
   +                MODLOG_DFLT(INFO,"slave\n");
   +            }
   +            rc = ble_gap_security_initiate(conn_desc.conn_handle);
   +            if (rc == 0) {
   +                MODLOG_DFLT(INFO, "Pairing initiated!\n");
                    break;
   +            } else if (rc == BLE_HS_ENOTCONN) {
   +                MODLOG_DFLT(INFO, "There is no connection with this handle\n");
   +            } else if (BLE_HS_EALREADY) {
   +                MODLOG_DFLT(INFO, "Devices already trying to pair\n");
                } else {
   -                MODLOG_DFLT(INFO,"Connection failed, error code: %i\n",
   +                MODLOG_DFLT(ERROR, "Error occured during pairing\n");
   +            }
   +            if (!rc) {
   +                MODLOG_DFLT(INFO, "Pairing finished with rc=0\n");
   +            }
   +        } else if (event->connect.status == BLE_ERR_ACL_CONN_EXISTS) {
   +            MODLOG_DFLT(INFO, "Connection already exists\n");
   +            break;
   +        } else {
   +            MODLOG_DFLT(INFO,"Connection failed, error code: %i\n",
                                event->connect.status);
   -            }
   +        }
            break;
        case BLE_GAP_EVENT_DISCONNECT:
            MODLOG_DFLT(INFO,"Disconnected, reason code: %i\n",
   ```
   
   </details>
   
   #### apps/privacy_periph/src/main.c
   <details>
   
   ```diff
   @@ -72,14 +72,14 @@
            break;
        case BLE_GAP_EVENT_CONNECT:
            if (event->connect.status == 0) {
   -                ble_gap_conn_find(event->connect.conn_handle, &conn_desc);
   -                MODLOG_DFLT(INFO,"Connection was established\n");
   -                MODLOG_DFLT(INFO,"Role: ");
   -                if (conn_desc.role == 0) {
   -                    MODLOG_DFLT(INFO,"master\n");
   -                } else {
   -                    MODLOG_DFLT(INFO,"slave\n");
   -                }
   +            ble_gap_conn_find(event->connect.conn_handle, &conn_desc);
   +            MODLOG_DFLT(INFO,"Connection was established\n");
   +            MODLOG_DFLT(INFO,"Role: ");
   +            if (conn_desc.role == 0) {
   +                MODLOG_DFLT(INFO,"master\n");
   +            } else {
   +                MODLOG_DFLT(INFO,"slave\n");
   +            }
            } else if (event->connect.status == BLE_ERR_ACL_CONN_EXISTS) {
                MODLOG_DFLT(INFO, "Connection already exists\n");
                break;
   ```
   
   </details>


----------------------------------------------------------------
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.

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