Skip to content

Commit 8b7c8b0

Browse files
martinjaegercarlescufi
authored andcommitted
lorawan: rename lorawan_set_battery_level_callback and make it void
Rename the lorawan_set_battery_level_callback to lorawan_register_battery_level_callback to make it consistent with other functions for downlink and data rate changed callbacks. Also making the function void for consistency. The get_battery_level already checks if the callback is NULL before invoking it. Signed-off-by: Martin Jäger <[email protected]>
1 parent 31200fb commit 8b7c8b0

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

doc/releases/migration-guide-3.6.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ Bluetooth
7373
been renamed, from ``samples/bluetooth/hci_rpmsg`` to
7474
``samples/bluetooth/hci_ipc``.
7575

76+
LoRaWAN
77+
=======
78+
79+
* The API to register a callback to provide battery level information to the LoRaWAN stack has been
80+
renamed from ``lorawan_set_battery_level_callback`` to
81+
:c:func:`lorawan_register_battery_level_callback` and the return type is now ``void``. This
82+
is more consistent with similar functions for downlink and data rate changed callbacks.
83+
7684
Networking
7785
==========
7886

include/zephyr/lorawan/lorawan.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,8 @@ struct lorawan_downlink_cb {
187187
* Should no callback be provided the lorawan backend will report 255.
188188
*
189189
* @param battery_lvl_cb Pointer to the battery level function
190-
*
191-
* @return 0 if successful, negative errno code if failure
192190
*/
193-
int lorawan_set_battery_level_callback(uint8_t (*battery_lvl_cb)(void));
191+
void lorawan_register_battery_level_callback(uint8_t (*battery_lvl_cb)(void));
194192

195193
/**
196194
* @brief Register a callback to be run on downlink packets

subsys/lorawan/lorawan.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -621,15 +621,9 @@ int lorawan_send(uint8_t port, uint8_t *data, uint8_t len,
621621
return ret;
622622
}
623623

624-
int lorawan_set_battery_level_callback(uint8_t (*battery_lvl_cb)(void))
624+
void lorawan_register_battery_level_callback(uint8_t (*battery_lvl_cb)(void))
625625
{
626-
if (battery_lvl_cb == NULL) {
627-
return -EINVAL;
628-
}
629-
630626
get_battery_level_user = battery_lvl_cb;
631-
632-
return 0;
633627
}
634628

635629
void lorawan_register_downlink_callback(struct lorawan_downlink_cb *cb)

0 commit comments

Comments
 (0)