Skip to content

Commit

Permalink
examples/lte_lwm2m: Fix compile error without LWM2M_BOOTSTRAP
Browse files Browse the repository at this point in the history
Fix build error when LWM2M_BOOTSTRAP is not defined.
  • Loading branch information
SPRESENSE committed Dec 17, 2021
1 parent 97a9101 commit aa0623a
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions examples/lte_lwm2m/lwm2mclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,27 +653,6 @@ static void prv_remove(lwm2m_context_t * lwm2mH,
return;
}

#ifdef LWM2M_BOOTSTRAP

static void prv_initiate_bootstrap(lwm2m_context_t * lwm2mH,
char * buffer,
void * user_data)
{
lwm2m_server_t * targetP;

/* unused parameter */
(void)user_data;

// HACK !!!
lwm2mH->state = STATE_BOOTSTRAP_REQUIRED;
targetP = lwm2mH->bootstrapServerList;
while (targetP != NULL)
{
targetP->lifetime = 0;
targetP = targetP->next;
}
}

static void prv_display_objects(lwm2m_context_t * lwm2mH,
char * buffer,
void * user_data)
Expand Down Expand Up @@ -716,6 +695,27 @@ static void prv_display_objects(lwm2m_context_t * lwm2mH,
}
}

#ifdef LWM2M_BOOTSTRAP

static void prv_initiate_bootstrap(lwm2m_context_t * lwm2mH,
char * buffer,
void * user_data)
{
lwm2m_server_t * targetP;

/* unused parameter */
(void)user_data;

// HACK !!!
lwm2mH->state = STATE_BOOTSTRAP_REQUIRED;
targetP = lwm2mH->bootstrapServerList;
while (targetP != NULL)
{
targetP->lifetime = 0;
targetP = targetP->next;
}
}

static void prv_display_backup(lwm2m_context_t * lwm2mH,
char * buffer,
void * user_data)
Expand Down Expand Up @@ -1300,6 +1300,7 @@ int main(int argc, char FAR *argv[])
if (result != 0)
{
fprintf(stderr, "lwm2m_step() failed: 0x%X\r\n", result);
#ifdef LWM2M_BOOTSTRAP
if(previousState == STATE_BOOTSTRAPPING)
{
#ifdef LWM2M_WITH_LOGS
Expand All @@ -1309,6 +1310,9 @@ int main(int argc, char FAR *argv[])
lwm2mH->state = STATE_INITIAL;
}
else return -1;
#else
return -1;
#endif
}
#ifdef LWM2M_BOOTSTRAP
update_bootstrap_info(&previousState, lwm2mH);
Expand Down

0 comments on commit aa0623a

Please sign in to comment.