Skip to content

Commit d3b5232

Browse files
MirkoCovizzieivindj-nordic
authored andcommitted
lib: bm_zms: reword bm_zms_evt_t member names
* Rewords the event ID `id` to `evt_id` * Rewords the entry ID `ate_id` to `id` This aligns the `id` parameters for write/delete operations with the name of the event struct member for the corresponding ID reported. Signed-off-by: Mirko Covizzi <[email protected]>
1 parent 3dc4ae1 commit d3b5232

File tree

5 files changed

+22
-15
lines changed

5 files changed

+22
-15
lines changed

doc/nrf-bm/release_notes/release_notes_changelog.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ Libraries
5454

5555
* :ref:`lib_bm_zms` library:
5656

57-
* Updated the :c:func:`bm_zms_register` function to return ``-EINVAL`` when passing ``NULL`` input parameters.
57+
* Updated:
58+
59+
* The :c:func:`bm_zms_register` function to return ``-EINVAL`` when passing ``NULL`` input parameters.
60+
* The name of the :c:struct:`bm_zms_evt_t` ``id`` field to :c:member:`bm_zms_evt_t.evt_id`.
61+
* The name of the :c:struct:`bm_zms_evt_t` ``ate_id`` field to :c:member:`bm_zms_evt_t.id`.
62+
5863
* Added the :c:enumerator:`BM_ZMS_EVT_DELETE` event ID to distinguish :c:func:`bm_zms_delete` events.
5964

6065
* :ref:`lib_ble_conn_params` library:

include/bm_zms.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ typedef enum {
4141

4242
/**@brief A BM_ZMS event. */
4343
typedef struct {
44-
bm_zms_evt_id_t id; /* The event ID. See @ref bm_zms_evt_id_t. */
45-
uint32_t result; /* The result of the operation related to this event. */
46-
uint32_t ate_id; /* The ATE id in case of a write operation. */
44+
bm_zms_evt_id_t evt_id; /* The event ID. See @ref bm_zms_evt_id_t. */
45+
uint32_t result; /* The result of the operation related to this event. */
46+
uint32_t id; /* The ID of the entry as specified in the corresponding
47+
* write/delete operation.
48+
*/
4749
} bm_zms_evt_t;
4850

4951
/* Init flags. */

lib/bm_zms/bm_zms.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,21 @@ static void event_prepare(bm_zms_evt_t *p_evt)
6969
{
7070
switch (cur_op.op_code) {
7171
case ZMS_OP_INIT:
72-
p_evt->id = BM_ZMS_EVT_INIT;
72+
p_evt->evt_id = BM_ZMS_EVT_INIT;
7373
break;
7474

7575
case ZMS_OP_WRITE:
7676
atomic_sub(&cur_op.fs->ongoing_writes, 1);
77-
p_evt->id = cur_op.len ? BM_ZMS_EVT_WRITE : BM_ZMS_EVT_DELETE;
78-
p_evt->ate_id = cur_op.id;
77+
p_evt->evt_id = cur_op.len ? BM_ZMS_EVT_WRITE : BM_ZMS_EVT_DELETE;
78+
p_evt->id = cur_op.id;
7979
break;
8080

8181
case ZMS_OP_CLEAR:
82-
p_evt->id = BM_ZMS_EVT_CLEAR;
82+
p_evt->evt_id = BM_ZMS_EVT_CLEAR;
8383
break;
8484

8585
case ZMS_OP_NONE:
86-
p_evt->id = BM_ZMS_EVT_NONE;
86+
p_evt->evt_id = BM_ZMS_EVT_NONE;
8787
break;
8888
default:
8989
/* Should not happen. */

samples/peripherals/bm_zms/src/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ static int delete_basic_items(struct bm_zms_fs *fs)
112112

113113
void bm_zms_sample_handler(bm_zms_evt_t const *p_evt)
114114
{
115-
if (p_evt->id == BM_ZMS_EVT_INIT) {
115+
if (p_evt->evt_id == BM_ZMS_EVT_INIT) {
116116
if (p_evt->result) {
117117
LOG_ERR("BM_ZMS initialization failed with error %d", p_evt->result);
118118
return;
119119
}
120-
} else if ((p_evt->id == BM_ZMS_EVT_WRITE) || (p_evt->id == BM_ZMS_EVT_DELETE)) {
120+
} else if ((p_evt->evt_id == BM_ZMS_EVT_WRITE) || (p_evt->evt_id == BM_ZMS_EVT_DELETE)) {
121121
if (!p_evt->result) {
122122
return;
123123
}
@@ -127,7 +127,7 @@ void bm_zms_sample_handler(bm_zms_evt_t const *p_evt)
127127
}
128128
LOG_ERR("BM_ZMS Error received %d", p_evt->result);
129129
} else {
130-
LOG_WRN("Unhandled BM_ZMS event ID %u", p_evt->id);
130+
LOG_WRN("Unhandled BM_ZMS event ID %u", p_evt->evt_id);
131131
}
132132
}
133133

tests/lib/bm_zms/src/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ static void wait_for_init(struct bm_zms_fs *fs)
9292

9393
void bm_zms_test_handler(bm_zms_evt_t const *p_evt)
9494
{
95-
if (p_evt->id == BM_ZMS_EVT_INIT) {
95+
if (p_evt->evt_id == BM_ZMS_EVT_INIT) {
9696
zassert_true(p_evt->result == 0, "bm_zms_init call failure: %d",
9797
p_evt->result);
98-
} else if ((p_evt->id == BM_ZMS_EVT_WRITE) || (p_evt->id == BM_ZMS_EVT_DELETE)) {
98+
} else if ((p_evt->evt_id == BM_ZMS_EVT_WRITE) || (p_evt->evt_id == BM_ZMS_EVT_DELETE)) {
9999
if (p_evt->result == 0) {
100100
return;
101101
}
@@ -104,7 +104,7 @@ void bm_zms_test_handler(bm_zms_evt_t const *p_evt)
104104
return;
105105
}
106106
printf("BM_ZMS Error received %d\n", p_evt->result);
107-
} else if (p_evt->id == BM_ZMS_EVT_CLEAR) {
107+
} else if (p_evt->evt_id == BM_ZMS_EVT_CLEAR) {
108108
zassert_true(p_evt->result == 0, "bm_zms_clear call failure: %d",
109109
p_evt->result);
110110
}

0 commit comments

Comments
 (0)