Skip to content

Commit fba645e

Browse files
committed
Modify the comments and delete the unused API
1 parent dbdb7e4 commit fba645e

File tree

7 files changed

+105
-38
lines changed

7 files changed

+105
-38
lines changed

libraries/CurieBLE/src/BLEAttribute.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ class BLEAttribute {
4242
* @return const char* string representation of the Attribute
4343
*/
4444
const char* uuid(void) const;
45+
46+
/**
47+
* @brief Get the UUID raw data
48+
*
49+
* @param none
50+
*
51+
* @return struct bt_uuid* The pointer of UUID
52+
*
53+
* @note none
54+
*/
4555
struct bt_uuid *uuid(void);
4656

4757
protected:
@@ -60,15 +70,15 @@ class BLEAttribute {
6070
BLEAttribute(const char* uuid, enum BLEAttributeType type);
6171

6272
BLEAttributeType type(void) const;
63-
bt_uuid btUuid(void) const;
6473
uint16_t handle(void);
6574
void setHandle(uint16_t handle);
6675

6776
static unsigned char numAttributes(void);
6877
// The below APIs are for central device to discover the
6978
virtual void discover(struct bt_gatt_discover_params *params) = 0;
7079
virtual void discover(const struct bt_gatt_attr *attr,
71-
struct bt_gatt_discover_params *params) = 0;
80+
struct bt_gatt_discover_params *params) = 0;
81+
7282
/**
7383
* @brief Get attribute's discover state
7484
*

libraries/CurieBLE/src/BLECentralRole.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ void BLECentralRole::handleParamUpdated(struct bt_conn *conn,
245245
{
246246
if (_event_handlers[BLEUpdateParam])
247247
{
248-
// Fix me Add parameter proc
249248
BLEPeripheralHelper *temp = peripheral(conn);
249+
temp->setConnParames(interval, interval, latency, timeout);
250250
_event_handlers[BLEUpdateParam](*temp);
251251
}
252252
}

libraries/CurieBLE/src/BLEHelper.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,7 @@ BLEHelper::BLEHelper()
1616

1717
BLEHelper::~BLEHelper()
1818
{
19-
#if 0
20-
if (NULL != _conn)
21-
{
22-
bt_conn_unref(_conn);
23-
}
24-
#endif
25-
}
26-
27-
#if 0
28-
void BLEHelper::setConn(struct bt_conn *conn)
29-
{
30-
if (conn == _conn)
31-
{
32-
return;
33-
}
34-
35-
if (NULL != _conn)
36-
{
37-
bt_conn_unref(_conn);
38-
}
39-
_conn = conn;
4019
}
41-
#endif
4220

4321
BLEHelper::operator bool() const
4422
{

libraries/CurieBLE/src/BLEHelper.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,21 @@ class BLEHelper {
3131
virtual bool connected(void) = 0;
3232

3333
/**
34-
* Get the address of the Central in string form
34+
* Get the address of the BLE in string format
3535
*
36-
* @return const char* address of the Central in string form
36+
* @return const char* address of the BLE in string format
3737
*/
3838
const char* address(void) const;
3939

40+
/**
41+
* @brief Get the address of the BLE in raw format
42+
*
43+
* @param none
44+
*
45+
* @return const bt_addr_le_t * address of the BLE in raw format
46+
*
47+
* @note none
48+
*/
4049
const bt_addr_le_t *bt_le_address(void) const;
4150
/**
4251
* Disconnect the central if it is connected
@@ -69,9 +78,8 @@ class BLEHelper {
6978
virtual ~BLEHelper();
7079

7180
private:
72-
bt_addr_le_t _address;
73-
//struct bt_conn *_conn;
74-
struct bt_le_conn_param _conn_params;
81+
bt_addr_le_t _address; /// BT low energy address
82+
struct bt_le_conn_param _conn_params; /// Connection parameter
7583
};
7684

7785
#endif

libraries/CurieBLE/src/BLEPeripheralHelper.h

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,41 @@ class BLEPeripheralHelper : public BLEHelper {
5555
*/
5656
BleStatus addAttribute(BLEAttribute& attribute);
5757

58+
/**
59+
* @brief Get BLEAttribute by subscribe parameter
60+
*
61+
* @param params Subscribe parameter
62+
*
63+
* @return BLEAttribute * NULL - Not found
64+
* Not NULL - The BLEAttribute object
65+
*
66+
* @note none
67+
*/
5868
BLEAttribute *attribute(struct bt_gatt_subscribe_params *params);
69+
70+
/**
71+
* @brief Get BLEAttribute by characteristic handle
72+
*
73+
* @param handle The characteristic handle
74+
*
75+
* @return BLEAttribute * NULL - Not found
76+
* Not NULL - The BLEAttribute object
77+
*
78+
* @note none
79+
*/
5980
BLEAttribute *attribute(uint16_t handle);
6081

6182
/**
62-
* For central to discover the profile
83+
* @brief Discover the BLE peripheral profile for central
84+
*
85+
* @param none
86+
*
87+
* @return none
88+
*
89+
* @note This function only for the central device.
90+
*
91+
* @note The central deivce didn't know the connected BLE's profile.
92+
* Need send discover request to search the attribute in the BLE peripheral
6393
*/
6494
void discover();
6595

@@ -76,13 +106,51 @@ class BLEPeripheralHelper : public BLEHelper {
76106
*/
77107
uint8_t discover(const struct bt_gatt_attr *attr);
78108

79-
// For peripheral to register the tree
109+
/**
110+
* @brief For peripheral to register the profile tree
111+
*
112+
* @param none
113+
*
114+
* @return int 0 - success
115+
* other - error code
116+
*
117+
* @note none
118+
*/
80119
int registerProfile();
120+
121+
/**
122+
* @brief Process the link lost event
123+
*
124+
* @param none
125+
*
126+
* @return none
127+
*
128+
* @note none
129+
*/
81130
void linkLost(void);
82131

83-
// Get value handle.
84-
// 0 is invalid
132+
/**
133+
* @brief Get the characteristic value handle
134+
*
135+
* @param attr Attribute object
136+
*
137+
* @return uint16_t The value hander of attribute
138+
* 0 is invalid
139+
*
140+
* @note Only for central mode
141+
*/
85142
uint16_t valueHandle(BLEAttribute *attr);
143+
144+
/**
145+
* @brief Get characteristic configuration descriptor value handle
146+
*
147+
* @param attr Attribute object
148+
*
149+
* @return uint16_t The value hander of attribute
150+
* 0 is invalid
151+
*
152+
* @note Only for central mode
153+
*/
86154
uint16_t cccdHandle(BLEAttribute *attr);
87155

88156
protected:

libraries/CurieBLE/src/BLEPeripheralRole.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,10 @@ void BLEPeripheralRole::handleParamUpdated(struct bt_conn *conn,
281281
pr_info(LOG_MODULE_BLE, "Parameter updated\r\n\tConn: %p\r\n\tinterval: %d\r\n\tlatency: %d\r\n\ttimeout: %d",
282282
conn, interval, latency, timeout);
283283
if (_event_handlers[BLEUpdateParam])
284+
{
285+
_central.setConnParames(interval, interval, latency, timeout);
284286
_event_handlers[BLEUpdateParam](_central);
287+
}
285288
}
286289

287290

libraries/CurieBLE/src/BLEProfile.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class BLEProfile{
5656
/**
5757
* @brief Get BLEAttribute by subscribe parameter
5858
*
59-
* @param struct bt_gatt_subscribe_params * Subscribe parameter
59+
* @param params Subscribe parameter
6060
*
6161
* @return BLEAttribute * NULL - Not found
6262
* Not NULL - The BLEAttribute object
@@ -68,7 +68,7 @@ class BLEProfile{
6868
/**
6969
* @brief Get BLEAttribute by characteristic handle
7070
*
71-
* @param uint16_t The characteristic handle
71+
* @param handle The characteristic handle
7272
*
7373
* @return BLEAttribute * NULL - Not found
7474
* Not NULL - The BLEAttribute object
@@ -120,7 +120,7 @@ class BLEProfile{
120120
/**
121121
* @brief Get the characteristic value handle
122122
*
123-
* @param none
123+
* @param attr Attribute object
124124
*
125125
* @return uint16_t The value handle
126126
* 0 is invalid handle
@@ -132,7 +132,7 @@ class BLEProfile{
132132
/**
133133
* @brief Get characteristic configuration descriptor value handle
134134
*
135-
* @param none
135+
* @param attr Attribute object
136136
*
137137
* @return uint16_t The value handle
138138
* 0 is invalid handle

0 commit comments

Comments
 (0)