Skip to content

Commit a80cb5c

Browse files
author
Julien Vermillard
committed
net: lwm2m: add send scheduler helper objects
Introduce the optional OMA 10523/10524 send scheduler extension to manage cached resources, including control and sampling rule objects, cache filter with gt/lt/st and pmin/pmax handling, max-age/max-sample limits, and registration flush helper. Signed-off-by: Julien Vermillard <[email protected]>
1 parent e02845b commit a80cb5c

File tree

6 files changed

+1779
-0
lines changed

6 files changed

+1779
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2025 Clunky Machines
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef ZEPHYR_NET_LWM2M_SEND_SCHEDULER_H_
8+
#define ZEPHYR_NET_LWM2M_SEND_SCHEDULER_H_
9+
10+
#include <stdbool.h>
11+
#include <zephyr/net/lwm2m.h>
12+
13+
/**
14+
* @brief Register the send scheduler LwM2M objects and initialise state.
15+
*
16+
* This installs the Scheduler Control (10523) and Sampling Rules (10524)
17+
* objects and prepares bookkeeping needed by the cache filter helpers.
18+
*/
19+
int lwm2m_send_sched_init(void);
20+
21+
/**
22+
* @brief Cache filter that enforces the configured scheduler rules.
23+
*
24+
* Hook this up via @ref lwm2m_set_cache_filter for each cached resource you
25+
* want the scheduler to control.
26+
*/
27+
bool lwm2m_send_sched_cache_filter(const struct lwm2m_obj_path *path,
28+
const struct lwm2m_time_series_elem *element);
29+
30+
/**
31+
* @brief Handle a registration or registration-update completion event.
32+
*
33+
* Applications should call this when their LwM2M RD client reports a successful
34+
* registration or registration update so the send scheduler can apply its
35+
* flush-on-update policy.
36+
*/
37+
void lwm2m_send_sched_handle_registration_event(void);
38+
39+
#endif /* ZEPHYR_NET_LWM2M_SEND_SCHEDULER_H_ */

subsys/net/lib/lwm2m/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ zephyr_library_sources_ifdef(CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT
3535
lwm2m_obj_firmware_pull.c
3636
lwm2m_pull_context.c
3737
)
38+
zephyr_library_sources_ifdef(CONFIG_LWM2M_SEND_SCHEDULER
39+
send_scheduler/send_scheduler_core.c
40+
send_scheduler/send_scheduler_lwm2m.c
41+
)
3842
zephyr_library_sources_ifdef(CONFIG_LWM2M_LOCATION_OBJ_SUPPORT
3943
lwm2m_obj_location.c
4044
)

subsys/net/lib/lwm2m/Kconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,24 @@ endchoice
253253

254254
endif # LWM2M_RESOURCE_DATA_CACHE_SUPPORT
255255

256+
config LWM2M_SEND_SCHEDULER
257+
bool "LwM2M send scheduler helper objects (10523/10524)"
258+
depends on LWM2M_VERSION_1_1
259+
depends on LWM2M_RESOURCE_DATA_CACHE_SUPPORT
260+
select CBPRINTF_FP_SUPPORT
261+
help
262+
Enable the optional send scheduler extension which exposes vendor
263+
objects to configure sampling rules, buffer limits, and SEND trigger
264+
policies on top of cached resources. Requires LwM2M 1.1 SEND support
265+
and resource data caching.
266+
267+
if LWM2M_SEND_SCHEDULER
268+
module = LWM2M_SEND_SCHEDULER
269+
module-str = Log level for LwM2M send scheduler helper
270+
module-dep = LOG
271+
source "subsys/net/Kconfig.template.log_config.net"
272+
endif # LWM2M_SEND_SCHEDULER
273+
256274
endmenu # "Engine features"
257275

258276
menu "Memory and buffer size configuration"

0 commit comments

Comments
 (0)