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/01/12 08:20:02 UTC

[GitHub] [mynewt-nimble] KKopyscinski opened a new pull request #900: ble_gatt: Add subscribing helper functions

KKopyscinski opened a new pull request #900:
URL: https://github.com/apache/mynewt-nimble/pull/900


   Adds 2 helper functions for subscribing to notification/indication.
   Using these functions, app developer doesn't need to know what values
   to write to CCCD to subscribe and how these values have to be formatted.
   
   Adds functions mentioned in issue https://github.com/apache/mynewt-nimble/issues/24


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



[GitHub] [mynewt-nimble] sjanc commented on a change in pull request #900: ble_gatt: Add subscribing helper functions

Posted by GitBox <gi...@apache.org>.
sjanc commented on a change in pull request #900:
URL: https://github.com/apache/mynewt-nimble/pull/900#discussion_r636785853



##########
File path: nimble/host/src/ble_gattc.c
##########
@@ -4366,6 +4366,30 @@ ble_gattc_indicate(uint16_t conn_handle, uint16_t chr_val_handle)
     return ble_gattc_indicate_custom(conn_handle, chr_val_handle, NULL);
 }
 
+int
+ble_gattc_subscribe_notifications(uint16_t conn_handle, uint16_t cccd_handle,

Review comment:
       hmm I'd prefer if this take char value handle




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



[GitHub] [mynewt-nimble] KKopyscinski commented on pull request #900: ble_gatt: Add subscribing helper functions

Posted by GitBox <gi...@apache.org>.
KKopyscinski commented on pull request #900:
URL: https://github.com/apache/mynewt-nimble/pull/900#issuecomment-777464546


   @rymanluk Could you review this?


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



[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #900: ble_gatt: Add subscribing helper functions

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #900:
URL: https://github.com/apache/mynewt-nimble/pull/900#issuecomment-758489868


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### nimble/host/include/host/ble_gatt.h
   <details>
   
   ```diff
   @@ -528,7 +528,7 @@
     * @return                      0 on success; nonzero on failure.
     */
    int ble_gattc_subscribe_notifications(uint16_t conn_handle, uint16_t cccd_handle,
   -                                  ble_gatt_attr_fn *cb, void *cb_arg);
   +                                      ble_gatt_attr_fn *cb, void *cb_arg);
    
    /**
     * Subscribes to indication for characteristic of given CCCD.
   @@ -540,7 +540,7 @@
     * @return                      0 on success; nonzero on failure.
     */
    int ble_gattc_subscribe_indications(uint16_t conn_handle, uint16_t cccd_handle,
   -                                ble_gatt_attr_fn *cb, void *cb_arg);
   +                                    ble_gatt_attr_fn *cb, void *cb_arg);
    
    int ble_gattc_init(void);
    
   ```
   
   </details>
   
   #### nimble/host/src/ble_gattc.c
   <details>
   
   ```diff
   @@ -4366,8 +4366,9 @@
        return ble_gattc_indicate_custom(conn_handle, chr_val_handle, NULL);
    }
    
   -int ble_gattc_subscribe_notifications(uint16_t conn_handle, uint16_t cccd_handle,
   -                                      ble_gatt_attr_fn *cb, void *cb_arg)
   +int
   +ble_gattc_subscribe_notifications(uint16_t conn_handle, uint16_t cccd_handle,
   +                                  ble_gatt_attr_fn *cb, void *cb_arg)
    {
        int rc;
        uint16_t value = 0x0001;
   @@ -4377,8 +4378,9 @@
        return rc;
    }
    
   -int ble_gattc_subscribe_indications(uint16_t conn_handle, uint16_t cccd_handle,
   -                                      ble_gatt_attr_fn *cb, void *cb_arg)
   +int
   +ble_gattc_subscribe_indications(uint16_t conn_handle, uint16_t cccd_handle,
   +                                ble_gatt_attr_fn *cb, void *cb_arg)
    {
        int rc;
        uint16_t value = 0x0002;
   @@ -4389,8 +4391,8 @@
    }
    
    /*****************************************************************************
   - * $rx                                                                       *
   - *****************************************************************************/
   +* $rx                                                                       *
   +*****************************************************************************/
    
    /**
     * Dispatches an incoming ATT error-response to the appropriate active GATT
   ```
   
   </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



[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #900: ble_gatt: Add subscribing helper functions

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #900:
URL: https://github.com/apache/mynewt-nimble/pull/900#issuecomment-758495916


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### nimble/host/src/ble_gattc.c
   <details>
   
   ```diff
   @@ -4391,8 +4391,8 @@
    }
    
    /*****************************************************************************
   - * $rx                                                                       *
   - *****************************************************************************/
   +* $rx                                                                       *
   +*****************************************************************************/
    
    /**
     * Dispatches an incoming ATT error-response to the appropriate active GATT
   ```
   
   </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



[GitHub] [mynewt-nimble] KKopyscinski commented on pull request #900: ble_gatt: Add subscribing helper functions

Posted by GitBox <gi...@apache.org>.
KKopyscinski commented on pull request #900:
URL: https://github.com/apache/mynewt-nimble/pull/900#issuecomment-846908805


   As disgussed offline this would be better to do after implementation of GATT caching, as then user could use handle to characteristic not CCCD


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



[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #900: ble_gatt: Add subscribing helper functions

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #900:
URL: https://github.com/apache/mynewt-nimble/pull/900#issuecomment-758495916


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### nimble/host/src/ble_gattc.c
   <details>
   
   ```diff
   @@ -4391,8 +4391,8 @@
    }
    
    /*****************************************************************************
   - * $rx                                                                       *
   - *****************************************************************************/
   +* $rx                                                                       *
   +*****************************************************************************/
    
    /**
     * Dispatches an incoming ATT error-response to the appropriate active GATT
   ```
   
   </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



[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #900: ble_gatt: Add subscribing helper functions

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #900:
URL: https://github.com/apache/mynewt-nimble/pull/900#issuecomment-758489868


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### nimble/host/include/host/ble_gatt.h
   <details>
   
   ```diff
   @@ -528,7 +528,7 @@
     * @return                      0 on success; nonzero on failure.
     */
    int ble_gattc_subscribe_notifications(uint16_t conn_handle, uint16_t cccd_handle,
   -                                  ble_gatt_attr_fn *cb, void *cb_arg);
   +                                      ble_gatt_attr_fn *cb, void *cb_arg);
    
    /**
     * Subscribes to indication for characteristic of given CCCD.
   @@ -540,7 +540,7 @@
     * @return                      0 on success; nonzero on failure.
     */
    int ble_gattc_subscribe_indications(uint16_t conn_handle, uint16_t cccd_handle,
   -                                ble_gatt_attr_fn *cb, void *cb_arg);
   +                                    ble_gatt_attr_fn *cb, void *cb_arg);
    
    int ble_gattc_init(void);
    
   ```
   
   </details>
   
   #### nimble/host/src/ble_gattc.c
   <details>
   
   ```diff
   @@ -4366,8 +4366,9 @@
        return ble_gattc_indicate_custom(conn_handle, chr_val_handle, NULL);
    }
    
   -int ble_gattc_subscribe_notifications(uint16_t conn_handle, uint16_t cccd_handle,
   -                                      ble_gatt_attr_fn *cb, void *cb_arg)
   +int
   +ble_gattc_subscribe_notifications(uint16_t conn_handle, uint16_t cccd_handle,
   +                                  ble_gatt_attr_fn *cb, void *cb_arg)
    {
        int rc;
        uint16_t value = 0x0001;
   @@ -4377,8 +4378,9 @@
        return rc;
    }
    
   -int ble_gattc_subscribe_indications(uint16_t conn_handle, uint16_t cccd_handle,
   -                                      ble_gatt_attr_fn *cb, void *cb_arg)
   +int
   +ble_gattc_subscribe_indications(uint16_t conn_handle, uint16_t cccd_handle,
   +                                ble_gatt_attr_fn *cb, void *cb_arg)
    {
        int rc;
        uint16_t value = 0x0002;
   @@ -4389,8 +4391,8 @@
    }
    
    /*****************************************************************************
   - * $rx                                                                       *
   - *****************************************************************************/
   +* $rx                                                                       *
   +*****************************************************************************/
    
    /**
     * Dispatches an incoming ATT error-response to the appropriate active GATT
   ```
   
   </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



[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #900: ble_gatt: Add subscribing helper functions

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #900:
URL: https://github.com/apache/mynewt-nimble/pull/900#issuecomment-759285798


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### apps/btshell/src/cmd.c
   <details>
   
   ```diff
   @@ -3481,8 +3482,8 @@
    };
    
    /*****************************************************************************
   - * cmd-gatt-subscribe-notification                                            *
   - *****************************************************************************/
   +* cmd-gatt-subscribe-notification                                            *
   +*****************************************************************************/
    
    static const struct shell_param cmd_gatt_subscribe_notification_params[] = {
        {"conn", "connection handle, usage: =<UINT16>"},
   @@ -3497,8 +3498,8 @@
    };
    
    /*****************************************************************************
   - * cmd-gatt-subscribe-indication                                            *
   - *****************************************************************************/
   +* cmd-gatt-subscribe-indication                                            *
   +*****************************************************************************/
    
    static const struct shell_param cmd_gatt_subscribe_indication_params[] = {
        {"conn", "connection handle, usage: =<UINT16>"},
   ```
   
   </details>
   
   #### nimble/host/src/ble_gattc.c
   <details>
   
   ```diff
   @@ -4391,8 +4391,8 @@
    }
    
    /*****************************************************************************
   - * $rx                                                                       *
   - *****************************************************************************/
   +* $rx                                                                       *
   +*****************************************************************************/
    
    /**
     * Dispatches an incoming ATT error-response to the appropriate active GATT
   ```
   
   </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