Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to reset lwm2m-context of a client #664

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions core/liblwm2m.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,16 @@ int lwm2m_configure(lwm2m_context_t * contextP,
return COAP_NO_ERROR;
}

void lwm2m_reset(lwm2m_context_t *contextP) {
LOG("Entering");
contextP->state = STATE_INITIAL;
prv_deleteServerList(contextP);
prv_deleteBootstrapServerList(contextP);
prv_deleteObservedList(contextP);

prv_deleteTransactionList(contextP);
}

int lwm2m_add_object(lwm2m_context_t * contextP,
lwm2m_object_t * objectP)
{
Expand Down
1 change: 1 addition & 0 deletions include/liblwm2m.h
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ void lwm2m_handle_packet(lwm2m_context_t *contextP, uint8_t *buffer, size_t leng
// LWM2M Security Object (ID 0) must be present with either a bootstrap server or a LWM2M server and
// its matching LWM2M Server Object (ID 1) instance
int lwm2m_configure(lwm2m_context_t * contextP, const char * endpointName, const char * msisdn, const char * altPath, uint16_t numObject, lwm2m_object_t * objectList[]);
void lwm2m_reset(lwm2m_context_t *contextP);
int lwm2m_add_object(lwm2m_context_t * contextP, lwm2m_object_t * objectP);
int lwm2m_remove_object(lwm2m_context_t * contextP, uint16_t id);

Expand Down