Fixed compiler warnings in LWM2M logging

This commit is contained in:
Niclas Finne 2017-12-03 23:37:00 +01:00
parent 770ace0339
commit 04acccf9a0
3 changed files with 17 additions and 12 deletions

View File

@ -362,7 +362,7 @@ void lwm2m_engine_set_opaque_callback(lwm2m_context_t *ctx, lwm2m_write_opaque_c
{
/* Here we should set the callback for the opaque that we are currently generating... */
/* And we should in the future associate the callback with the CoAP message info - MID */
LOG_DBG("Setting opaque handler - offset: %d,%d\n",
LOG_DBG("Setting opaque handler - offset: %"PRIu32",%d\n",
ctx->offset, ctx->outbuf->len);
current_opaque_offset = 0;
@ -655,7 +655,7 @@ perform_multi_resource_read_op(lwm2m_object_t *object,
return LWM2M_STATUS_SERVICE_UNAVAILABLE;
}
LOG_DBG("MultiRead: %d/%d/%d lv:%d offset:%d\n",
LOG_DBG("MultiRead: %d/%d/%d lv:%d offset:%"PRIu32"\n",
ctx->object_id, ctx->object_instance_id, ctx->resource_id,
ctx->level, ctx->offset);
@ -696,7 +696,7 @@ perform_multi_resource_read_op(lwm2m_object_t *object,
if(instance->resource_ids != NULL && instance->resource_count > 0) {
/* show all the available resources (or read all) */
while(last_rsc_pos < instance->resource_count) {
LOG_DBG("READ: %x %x %x lv:%d\n",
LOG_DBG("READ: 0x%"PRIx32" 0x%x 0x%x lv:%d\n",
instance->resource_ids[last_rsc_pos],
RSC_ID(instance->resource_ids[last_rsc_pos]),
ctx->resource_id, ctx->level);
@ -1083,8 +1083,9 @@ perform_multi_resource_write_op(lwm2m_object_t *object,
future */
if(coap_get_header_block1(ctx->request, &num, &more, &size, &offset)) {
LOG_DBG("CoAP BLOCK1: %d/%d/%d offset:%d\n", num, more, size, offset);
LOG_DBG("LWM2M CTX->offset= %d\n", ctx->offset);
LOG_DBG("CoAP BLOCK1: %"PRIu32"/%d/%d offset:%"PRIu32
" LWM2M CTX->offset=%"PRIu32"\n",
num, more, size, offset, ctx->offset);
LOG_DBG("Last TLV ID:%d final:%d\n", last_tlv_id,
lwm2m_object_is_final_incoming(ctx));
if(offset > 0) {
@ -1562,7 +1563,8 @@ lwm2m_handler_callback(coap_message_t *request, coap_message_t *response,
coap_set_header_content_format(response, context.content_type);
if(offset != NULL) {
LOG_DBG("Setting new offset: oo %d, no: %d\n", *offset, context.offset);
LOG_DBG("Setting new offset: oo %"PRIu32
", no: %"PRIu32"\n", *offset, context.offset);
if(context.writer_flags & WRITER_HAS_MORE) {
*offset = context.offset;
} else {

View File

@ -39,6 +39,7 @@
#include "lwm2m-engine.h"
#include "lwm2m-firmware.h"
#include "coap.h"
#include <inttypes.h>
#include <string.h>
/* Log configuration */
@ -110,15 +111,16 @@ lwm2m_callback(lwm2m_object_instance_t *object,
if(LOG_DBG_ENABLED) {
if(coap_get_header_block1(ctx->request, &num, &more, &size, &offset)) {
LOG_DBG("CoAP BLOCK1: %d/%d/%d offset:%d\n", num, more, size, offset);
LOG_DBG("LWM2M CTX->offset= %d\n", ctx->offset);
LOG_DBG("CoAP BLOCK1: %"PRIu32"/%u/%u offset:%"PRIu32
" LWM2M CTX->offset=%"PRIu32"\n",
num, more, size, offset, ctx->offset);
}
}
switch(ctx->resource_id) {
case UPDATE_PACKAGE:
/* The firmware is written */
LOG_DBG("Firmware received: %d %d fin:%d\n", ctx->offset,
LOG_DBG("Firmware received: %"PRIu32" %d fin:%d\n", ctx->offset,
(int)ctx->inbuf->size, lwm2m_object_is_final_incoming(ctx));
if(lwm2m_object_is_final_incoming(ctx)) {
state = STATE_DOWNLOADED;
@ -128,7 +130,7 @@ lwm2m_callback(lwm2m_object_instance_t *object,
return LWM2M_STATUS_OK;
case UPDATE_PACKAGE_URI:
/* The firmware URI is written */
LOG_DBG("Firmware URI received: %d %d fin:%d\n", ctx->offset,
LOG_DBG("Firmware URI received: %"PRIu32" %d fin:%d\n", ctx->offset,
(int)ctx->inbuf->size, lwm2m_object_is_final_incoming(ctx));
if(LOG_DBG_ENABLED) {
int i;

View File

@ -44,6 +44,7 @@
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
#include "lwm2m-object.h"
#include "lwm2m-engine.h"
#include "lwm2m-server.h"
@ -100,7 +101,7 @@ create_instance(uint16_t instance_id, lwm2m_status_t *status)
sizeof(resources) / sizeof(lwm2m_resource_id_t);
list_add(instances_list, &instances[i].instance);
LOG_DBG("Create new security instance\n");
LOG_DBG("Create new security instance %u\n", instance_id);
return &instances[i].instance;
}
}
@ -194,7 +195,7 @@ lwm2m_callback(lwm2m_object_instance_t *object,
{
int32_t v2;
value = lwm2m_object_read_int(ctx, ctx->inbuf->buffer, ctx->inbuf->size, &v2);
LOG_DBG("Writing security MODE value: %d len: %d\n", v2,
LOG_DBG("Writing security MODE value: %"PRId32" len: %d\n", v2,
(int)ctx->inbuf->size);
security->security_mode = v2;
}