MYNEWT-751 Make ble_store_status() private.

Now ble_store_status() is private; it only gets called by the following
new functions:

    int ble_store_overflow_event(int obj_type,
                                 const union ble_store_value *value);
    int ble_store_overflow_next_event(int obj_type, uint16_t conn_handle);

X-Original-Commit: 049ee0a22b3db64d787bdd6fa40c9edcf8487ef7
This commit is contained in:
Christopher Collins
2017-06-19 11:54:42 -07:00
parent d410bf96d1
commit aaa684008f
3 changed files with 29 additions and 13 deletions
+2 -1
View File
@@ -243,7 +243,8 @@ int ble_store_read(int obj_type, const union ble_store_key *key,
union ble_store_value *val);
int ble_store_write(int obj_type, const union ble_store_value *val);
int ble_store_delete(int obj_type, const union ble_store_key *key);
int ble_store_status(struct ble_store_status_event *event);
int ble_store_overflow_event(int obj_type, const union ble_store_value *value);
int ble_store_overflow_next_event(int obj_type, uint16_t conn_handle);
int ble_store_read_our_sec(const struct ble_store_key_sec *key_sec,
struct ble_store_value_sec *value_sec);
+1 -6
View File
@@ -981,7 +981,6 @@ ble_sm_chk_store_overflow_by_type(int obj_type, uint16_t conn_handle)
return 0;
#endif
struct ble_store_status_event event;
int count;
int rc;
@@ -1003,11 +1002,7 @@ ble_sm_chk_store_overflow_by_type(int obj_type, uint16_t conn_handle)
/* No capacity for an additional bond. Tell the application to make
* room.
*/
memset(&event, 0, sizeof event);
event.obj_type = obj_type;
event.event_code = BLE_STORE_EVENT_OVERFLOW_NEXT;
event.conn_handle = conn_handle;
rc = ble_store_status(&event);
rc = ble_store_overflow_next_event(obj_type, conn_handle);
if (rc != 0) {
return rc;
}
+26 -6
View File
@@ -44,7 +44,6 @@ ble_store_read(int obj_type, const union ble_store_key *key,
int
ble_store_write(int obj_type, const union ble_store_value *val)
{
struct ble_store_status_event event;
int rc;
if (ble_hs_cfg.store_write_cb == NULL) {
@@ -63,10 +62,7 @@ ble_store_write(int obj_type, const union ble_store_value *val)
/* Record didn't fit. Give the application the opportunity to free
* up some space.
*/
event.obj_type = obj_type;
event.event_code = BLE_STORE_EVENT_OVERFLOW;
event.value = val;
rc = ble_store_status(&event);
rc = ble_store_overflow_event(obj_type, val);
if (rc != 0) {
return rc;
}
@@ -98,7 +94,7 @@ ble_store_delete(int obj_type, const union ble_store_key *key)
return rc;
}
int
static int
ble_store_status(struct ble_store_status_event *event)
{
int rc;
@@ -114,6 +110,30 @@ ble_store_status(struct ble_store_status_event *event)
return rc;
}
int
ble_store_overflow_event(int obj_type, const union ble_store_value *value)
{
struct ble_store_status_event event;
event.event_code = BLE_STORE_EVENT_OVERFLOW;
event.obj_type = obj_type;
event.value = value;
return ble_store_status(&event);
}
int
ble_store_overflow_next_event(int obj_type, uint16_t conn_handle)
{
struct ble_store_status_event event;
event.event_code = BLE_STORE_EVENT_OVERFLOW_NEXT;
event.obj_type = obj_type;
event.conn_handle = conn_handle;
return ble_store_status(&event);
}
int
ble_store_read_our_sec(const struct ble_store_key_sec *key_sec,
struct ble_store_value_sec *value_sec)