net: lwm2m: rd_client: added init function
To write tests it is necessary to offer init function for the RDClient to define custom fakes before. Signed-off-by: Andreas Chmielewski <andreas.chmielewski@grandcentrix.net>
This commit is contained in:
parent
cf871aec64
commit
022ff636da
|
@ -458,6 +458,15 @@ int lwm2m_engine_add_service(k_work_handler_t service, uint32_t period_ms)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (!service) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* First, try if the service is already registered, and modify it*/
|
||||
if (lwm2m_engine_update_service_period(service, period_ms) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* find an unused service index node */
|
||||
for (i = 0; i < MAX_PERIODIC_SERVICE; i++) {
|
||||
if (!service_node_data[i].service_work) {
|
||||
|
|
|
@ -1504,7 +1504,7 @@ bool lwm2m_rd_client_is_registred(struct lwm2m_ctx *client_ctx)
|
|||
return true;
|
||||
}
|
||||
|
||||
static int lwm2m_rd_client_init(const struct device *dev)
|
||||
int lwm2m_rd_client_init(void)
|
||||
{
|
||||
client.ctx = NULL;
|
||||
client.rd_message.ctx = NULL;
|
||||
|
@ -1516,5 +1516,13 @@ static int lwm2m_rd_client_init(const struct device *dev)
|
|||
|
||||
}
|
||||
|
||||
SYS_INIT(lwm2m_rd_client_init, APPLICATION,
|
||||
static int sys_lwm2m_rd_client_init(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
return lwm2m_rd_client_init();
|
||||
}
|
||||
|
||||
|
||||
SYS_INIT(sys_lwm2m_rd_client_init, APPLICATION,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#ifndef LWM2M_RD_CLIENT_H
|
||||
#define LWM2M_RD_CLIENT_H
|
||||
|
||||
int lwm2m_rd_client_init(void);
|
||||
void engine_trigger_update(bool update_objects);
|
||||
int engine_trigger_bootstrap(void);
|
||||
int lwm2m_rd_client_pause(void);
|
||||
|
|
Loading…
Reference in a new issue