mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 10:03:50 +01:00
Merge pull request #20930 from moritzholzer/feature/wakaama_update
Feature/wakaama update on new version
This commit is contained in:
commit
5f661f424a
@ -9,7 +9,7 @@ menu "Application configuration"
|
|||||||
|
|
||||||
config LWM2M_SERVER_URI
|
config LWM2M_SERVER_URI
|
||||||
string "LwM2M Server URI to register/bootstrap with"
|
string "LwM2M Server URI to register/bootstrap with"
|
||||||
default "coap://[fd00:dead:beef::1]:5684"
|
default "coaps://[fd00:dead:beef::1]:5684"
|
||||||
help
|
help
|
||||||
The host part of the URI MUST be a valid IPv6 address.
|
The host part of the URI MUST be a valid IPv6 address.
|
||||||
|
|
||||||
|
|||||||
@ -38,10 +38,10 @@ USEPKG += tinydtls
|
|||||||
USEMODULE += prng_sha1prng
|
USEMODULE += prng_sha1prng
|
||||||
|
|
||||||
## Application-specific Configuration options
|
## Application-specific Configuration options
|
||||||
LWM2M_SERVER_URI ?= '"coap://[fd00:dead:beef::1]:5684"'
|
LWM2M_SERVER_URI ?= '"coaps://[fd00:dead:beef::1]:5684"'
|
||||||
LWM2M_SERVER_SHORT_ID ?= 1
|
LWM2M_SERVER_SHORT_ID ?= 1
|
||||||
|
|
||||||
CFLAGS += -DEVENT_THREAD_MEDIUM_STACKSIZE='(3*1024)'
|
CFLAGS += -DEVENT_THREAD_MEDIUM_STACKSIZE='(4*1024)'
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.include
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ BOARD_INSUFFICIENT_MEMORY := \
|
|||||||
airfy-beacon \
|
airfy-beacon \
|
||||||
arduino-mkr1000 \
|
arduino-mkr1000 \
|
||||||
b-l072z-lrwan1 \
|
b-l072z-lrwan1 \
|
||||||
|
bastwan \
|
||||||
blackpill-stm32f103c8 \
|
blackpill-stm32f103c8 \
|
||||||
blackpill-stm32f103cb \
|
blackpill-stm32f103cb \
|
||||||
bluepill-stm32f030c8 \
|
bluepill-stm32f030c8 \
|
||||||
@ -9,16 +10,22 @@ BOARD_INSUFFICIENT_MEMORY := \
|
|||||||
bluepill-stm32f103cb \
|
bluepill-stm32f103cb \
|
||||||
calliope-mini \
|
calliope-mini \
|
||||||
cc1350-launchpad \
|
cc1350-launchpad \
|
||||||
|
cc2538dk \
|
||||||
cc2650-launchpad \
|
cc2650-launchpad \
|
||||||
cc2650stk \
|
cc2650stk \
|
||||||
e104-bt5010a-tb \
|
e104-bt5010a-tb \
|
||||||
e104-bt5011a-tb \
|
e104-bt5011a-tb \
|
||||||
|
feather-m0-lora \
|
||||||
feather-m0-wifi \
|
feather-m0-wifi \
|
||||||
|
firefly \
|
||||||
gd32vf103c-start \
|
gd32vf103c-start \
|
||||||
|
generic-cc2538-cc2592-dk \
|
||||||
|
hamilton \
|
||||||
hifive1 \
|
hifive1 \
|
||||||
hifive1b \
|
hifive1b \
|
||||||
i-nucleo-lrwan1 \
|
i-nucleo-lrwan1 \
|
||||||
im880b \
|
im880b \
|
||||||
|
lobaro-lorabox \
|
||||||
lsn50 \
|
lsn50 \
|
||||||
maple-mini \
|
maple-mini \
|
||||||
microbit \
|
microbit \
|
||||||
@ -34,16 +41,29 @@ BOARD_INSUFFICIENT_MEMORY := \
|
|||||||
nucleo-f302r8 \
|
nucleo-f302r8 \
|
||||||
nucleo-f303k8 \
|
nucleo-f303k8 \
|
||||||
nucleo-f334r8 \
|
nucleo-f334r8 \
|
||||||
|
nucleo-f410rb \
|
||||||
|
nucleo-g070rb \
|
||||||
|
nucleo-g071rb \
|
||||||
|
nucleo-g431rb \
|
||||||
nucleo-l011k4 \
|
nucleo-l011k4 \
|
||||||
nucleo-l031k6 \
|
nucleo-l031k6 \
|
||||||
nucleo-l053r8 \
|
nucleo-l053r8 \
|
||||||
nucleo-l073rz \
|
nucleo-l073rz \
|
||||||
|
nucleo-l412kb \
|
||||||
olimexino-stm32 \
|
olimexino-stm32 \
|
||||||
|
omote \
|
||||||
opencm904 \
|
opencm904 \
|
||||||
openmote-b \
|
openmote-b \
|
||||||
|
openmote-cc2538 \
|
||||||
|
pba-d-01-kw2x \
|
||||||
|
remote-pa \
|
||||||
|
remote-reva \
|
||||||
|
remote-revb \
|
||||||
samd10-xmini \
|
samd10-xmini \
|
||||||
saml10-xpro \
|
saml10-xpro \
|
||||||
saml11-xpro \
|
saml11-xpro \
|
||||||
|
samr21-xpro \
|
||||||
|
samr30-xpro \
|
||||||
seeedstudio-gd32 \
|
seeedstudio-gd32 \
|
||||||
sipeed-longan-nano \
|
sipeed-longan-nano \
|
||||||
sipeed-longan-nano-tft \
|
sipeed-longan-nano-tft \
|
||||||
|
|||||||
@ -27,6 +27,14 @@ config LWM2M_DEVICE_TTL
|
|||||||
help
|
help
|
||||||
Lifetime of the device on the LwM2M server, expressed in seconds.
|
Lifetime of the device on the LwM2M server, expressed in seconds.
|
||||||
|
|
||||||
|
config LWM2M_COAP_DEFAULT_BLOCK_SIZE
|
||||||
|
int "CoAP block size"
|
||||||
|
range 4 10
|
||||||
|
default 10
|
||||||
|
help
|
||||||
|
Block transfer options support only power-of-two block sizes, from 2**4 (16) to 2**10 (1024) bytes.
|
||||||
|
This option represents the exponent of 2, which will be used for the block size.
|
||||||
|
|
||||||
config LWM2M_LOCAL_PORT
|
config LWM2M_LOCAL_PORT
|
||||||
string "Port for the local LwM2M CoAP"
|
string "Port for the local LwM2M CoAP"
|
||||||
default "5683"
|
default "5683"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
PKG_NAME=wakaama
|
PKG_NAME=wakaama
|
||||||
PKG_URL=https://github.com/eclipse/wakaama.git
|
PKG_URL=https://github.com/eclipse/wakaama.git
|
||||||
PKG_VERSION=da74b3c91570b9716fbb424e90935806b2b29814
|
PKG_VERSION=ee0c98da7495e1ab43358b49e970dbc97f73ce3b
|
||||||
PKG_LICENSE=EDL-1.0,EPL-1.0
|
PKG_LICENSE=EDL-1.0,EPL-1.0
|
||||||
|
|
||||||
include $(RIOTBASE)/pkg/pkg.mk
|
include $(RIOTBASE)/pkg/pkg.mk
|
||||||
@ -12,8 +12,11 @@ CFLAGS += -Wno-cast-align
|
|||||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42145
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42145
|
||||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90710#c1
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90710#c1
|
||||||
CFLAGS += -Wno-maybe-uninitialized
|
CFLAGS += -Wno-maybe-uninitialized
|
||||||
|
CFLAGS += -DLWM2M_SUPPORT_TLV
|
||||||
|
|
||||||
all:
|
all:
|
||||||
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/core -f $(RIOTBASE)/Makefile.base MODULE=wakaama_core
|
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/core -f $(RIOTBASE)/Makefile.base MODULE=wakaama_core
|
||||||
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/core/er-coap-13 -f $(RIOTBASE)/Makefile.base MODULE=wakaama_core_coap13
|
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/coap/er-coap-13 -f $(RIOTBASE)/Makefile.base MODULE=wakaama_core_coap13
|
||||||
|
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/coap -f $(RIOTBASE)/Makefile.base MODULE=wakaama_core_coap
|
||||||
|
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/data -f $(CURDIR)/wakaama_data.mk
|
||||||
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/examples/client -f $(CURDIR)/wakaama_client.mk
|
$(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR)/examples/client -f $(CURDIR)/wakaama_client.mk
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
USEMODULE += wakaama_core wakaama_core_coap13 wakaama_client
|
USEMODULE += wakaama_core wakaama_core_coap wakaama_core_coap13 wakaama_data wakaama_client
|
||||||
|
|
||||||
# include contrib code (platform adaption and client implementation)
|
# include contrib code (platform adaption and client implementation)
|
||||||
USEMODULE += wakaama_contrib
|
USEMODULE += wakaama_contrib
|
||||||
@ -12,7 +12,6 @@ USEMODULE += wakaama_objects
|
|||||||
USEMODULE += wakaama_objects_device
|
USEMODULE += wakaama_objects_device
|
||||||
USEMODULE += wakaama_objects_security
|
USEMODULE += wakaama_objects_security
|
||||||
|
|
||||||
|
|
||||||
ifneq (,$(filter wakaama_objects_barometer,$(USEMODULE)))
|
ifneq (,$(filter wakaama_objects_barometer,$(USEMODULE)))
|
||||||
USEMODULE += wakaama_objects_ipso_sensor_base
|
USEMODULE += wakaama_objects_ipso_sensor_base
|
||||||
endif
|
endif
|
||||||
@ -39,6 +38,7 @@ endif
|
|||||||
|
|
||||||
USEMODULE += ztimer
|
USEMODULE += ztimer
|
||||||
USEMODULE += ztimer_sec
|
USEMODULE += ztimer_sec
|
||||||
|
USEMODULE += random
|
||||||
USEPKG += tlsf
|
USEPKG += tlsf
|
||||||
|
|
||||||
# If logs for the package are active, we need fmt
|
# If logs for the package are active, we need fmt
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
DIRS += $(RIOTBASE)/pkg/wakaama/contrib
|
DIRS += $(RIOTBASE)/pkg/wakaama/contrib
|
||||||
|
|
||||||
INCLUDES += -I$(RIOTBASE)/pkg/wakaama/include
|
INCLUDES += -I$(RIOTBASE)/pkg/wakaama/include
|
||||||
|
INCLUDES += -I$(PKGDIRBASE)/wakaama/include
|
||||||
INCLUDES += -I$(PKGDIRBASE)/wakaama/core
|
INCLUDES += -I$(PKGDIRBASE)/wakaama/core
|
||||||
INCLUDES += -I$(PKGDIRBASE)/wakaama/core/er-coap-13
|
INCLUDES += -I$(PKGDIRBASE)/wakaama/data
|
||||||
|
INCLUDES += -I$(PKGDIRBASE)/wakaama/coap/er-coap-13
|
||||||
|
|
||||||
# NOTE: Use wakaama in client mode
|
# NOTE: Use wakaama in client mode
|
||||||
CFLAGS += -DLWM2M_CLIENT_MODE
|
CFLAGS += -DLWM2M_CLIENT_MODE
|
||||||
@ -17,5 +19,12 @@ ifneq (,$(or $(CONFIG_LWM2M_WITH_LOGS),$(filter -DCONFIG_LWM2M_WITH_LOGS=1,$(CFL
|
|||||||
CFLAGS += -DLWM2M_WITH_LOGS=1
|
CFLAGS += -DLWM2M_WITH_LOGS=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# NOTE: "Default CoAP block size; Used if not set on a per-target basis"
|
||||||
|
ifeq (,$(CONFIG_LWM2M_COAP_DEFAULT_BLOCK_SIZE))
|
||||||
|
CFLAGS += -DLWM2M_COAP_DEFAULT_BLOCK_SIZE=1024
|
||||||
|
else
|
||||||
|
CFLAGS += -DLWM2M_COAP_DEFAULT_BLOCK_SIZE='1<<$(CONFIG_LWM2M_COAP_DEFAULT_BLOCK_SIZE)'
|
||||||
|
endif
|
||||||
|
|
||||||
PSEUDOMODULES += wakaama
|
PSEUDOMODULES += wakaama
|
||||||
PSEUDOMODULES += wakaama_client_dtls
|
PSEUDOMODULES += wakaama_client_dtls
|
||||||
|
|||||||
@ -119,8 +119,6 @@ static credman_tag_t _get_credential(const sock_udp_ep_t *ep, uint8_t security_m
|
|||||||
/* prepare query */
|
/* prepare query */
|
||||||
lwm2m_uri_t query_uri = {
|
lwm2m_uri_t query_uri = {
|
||||||
.objectId = LWM2M_SECURITY_OBJECT_ID,
|
.objectId = LWM2M_SECURITY_OBJECT_ID,
|
||||||
// .resourceId = LWM2M_SECURITY_URI_ID,
|
|
||||||
.flag = LWM2M_URI_FLAG_OBJECT_ID | LWM2M_URI_FLAG_INSTANCE_ID | LWM2M_URI_FLAG_RESOURCE_ID
|
|
||||||
};
|
};
|
||||||
|
|
||||||
lwm2m_list_t *instance = sec->instanceList;
|
lwm2m_list_t *instance = sec->instanceList;
|
||||||
@ -413,7 +411,6 @@ void lwm2m_client_refresh_dtls_credentials(void)
|
|||||||
/* prepare query */
|
/* prepare query */
|
||||||
lwm2m_uri_t query_uri = {
|
lwm2m_uri_t query_uri = {
|
||||||
.objectId = LWM2M_SECURITY_OBJECT_ID,
|
.objectId = LWM2M_SECURITY_OBJECT_ID,
|
||||||
.flag = LWM2M_URI_FLAG_OBJECT_ID | LWM2M_URI_FLAG_INSTANCE_ID | LWM2M_URI_FLAG_RESOURCE_ID
|
|
||||||
};
|
};
|
||||||
|
|
||||||
lwm2m_list_t *instance = sec->instanceList;
|
lwm2m_list_t *instance = sec->instanceList;
|
||||||
|
|||||||
@ -284,7 +284,6 @@ static lwm2m_client_connection_t *_connection_create(uint16_t sec_obj_inst_id,
|
|||||||
.objectId = LWM2M_SECURITY_URI_ID,
|
.objectId = LWM2M_SECURITY_URI_ID,
|
||||||
.instanceId = sec_obj_inst_id,
|
.instanceId = sec_obj_inst_id,
|
||||||
.resourceId = LWM2M_SECURITY_URI_ID,
|
.resourceId = LWM2M_SECURITY_URI_ID,
|
||||||
.flag = LWM2M_URI_FLAG_OBJECT_ID | LWM2M_URI_FLAG_INSTANCE_ID | LWM2M_URI_FLAG_RESOURCE_ID
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int res = lwm2m_get_string(client_data, &resource_uri, uri, &uri_len);
|
int res = lwm2m_get_string(client_data, &resource_uri, uri, &uri_len);
|
||||||
|
|||||||
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include "ztimer.h"
|
#include "ztimer.h"
|
||||||
#include "tlsf.h"
|
#include "tlsf.h"
|
||||||
|
#include "random.h"
|
||||||
|
|
||||||
#include "lwm2m_platform.h"
|
#include "lwm2m_platform.h"
|
||||||
#include "lwm2m_client_config.h"
|
#include "lwm2m_client_config.h"
|
||||||
@ -106,6 +107,10 @@ time_t lwm2m_gettime(void)
|
|||||||
return (time_t)(ztimer_now(ZTIMER_SEC));
|
return (time_t)(ztimer_now(ZTIMER_SEC));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lwm2m_seed(void) {
|
||||||
|
return random_uint32();
|
||||||
|
}
|
||||||
|
|
||||||
/* For clang we need to specify that the first argument will be a format string
|
/* For clang we need to specify that the first argument will be a format string
|
||||||
* for print
|
* for print
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -76,7 +76,7 @@ static int _get_resource_data(lwm2m_client_data_t *client_data, const lwm2m_uri_
|
|||||||
data->id = uri->resourceId;
|
data->id = uri->resourceId;
|
||||||
|
|
||||||
/* read the resource from the specified instance */
|
/* read the resource from the specified instance */
|
||||||
uint8_t res = object->readFunc(uri->instanceId, &data_num, &data, object);
|
uint8_t res = object->readFunc(client_data->lwm2m_ctx, uri->instanceId, &data_num, &data, object);
|
||||||
if (res != COAP_205_CONTENT || data->type != expected_type) {
|
if (res != COAP_205_CONTENT || data->type != expected_type) {
|
||||||
result = -EINVAL;
|
result = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
@ -245,7 +245,7 @@ static int _set_resource_data(lwm2m_client_data_t *client_data, const lwm2m_uri_
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* write the resource of the specified instance */
|
/* write the resource of the specified instance */
|
||||||
uint8_t res = object->writeFunc(uri->instanceId, 1, data, object);
|
uint8_t res = object->writeFunc(client_data->lwm2m_ctx, uri->instanceId, 1, data, object, LWM2M_WRITE_PARTIAL_UPDATE);
|
||||||
lwm2m_resource_value_changed(client_data->lwm2m_ctx, uri);
|
lwm2m_resource_value_changed(client_data->lwm2m_ctx, uri);
|
||||||
|
|
||||||
if (res != COAP_204_CHANGED) {
|
if (res != COAP_204_CHANGED) {
|
||||||
|
|||||||
@ -36,6 +36,7 @@ static bool reboot;
|
|||||||
/**
|
/**
|
||||||
* @brief 'Execute' callback for the Device object.
|
* @brief 'Execute' callback for the Device object.
|
||||||
*
|
*
|
||||||
|
* @param[in] context LWM2M Context
|
||||||
* @param[in] instance_id Instance ID. Should be 0 as a single instance exists.
|
* @param[in] instance_id Instance ID. Should be 0 as a single instance exists.
|
||||||
* @param[in] resource_id ID of the resource to execute.
|
* @param[in] resource_id ID of the resource to execute.
|
||||||
* @param[in] buffer Information needed for the execution.
|
* @param[in] buffer Information needed for the execution.
|
||||||
@ -47,12 +48,13 @@ static bool reboot;
|
|||||||
* @return COAP_400_BAD_REQUEST when wrong information has been sent
|
* @return COAP_400_BAD_REQUEST when wrong information has been sent
|
||||||
* @return COAP_405_METHOD_NOT_ALLOWED when trying to execute a resource that is not supported
|
* @return COAP_405_METHOD_NOT_ALLOWED when trying to execute a resource that is not supported
|
||||||
*/
|
*/
|
||||||
static uint8_t _execute_cb(uint16_t instance_id, uint16_t resource_id, uint8_t *buffer, int length,
|
static uint8_t _execute_cb(lwm2m_context_t * context, uint16_t instance_id, uint16_t resource_id,
|
||||||
lwm2m_object_t *object);
|
uint8_t * buffer, int length, lwm2m_object_t * object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 'Read' callback for the Device object.
|
* @brief 'Read' callback for the Device object.
|
||||||
*
|
*
|
||||||
|
* @param[in] context LWM2M Context
|
||||||
* @param[in] instance_id Instance ID. Should be 0 as a single instance exists.
|
* @param[in] instance_id Instance ID. Should be 0 as a single instance exists.
|
||||||
* @param[in, out] num_data Number of resources requested. 0 means all.
|
* @param[in, out] num_data Number of resources requested. 0 means all.
|
||||||
* @param[in, out] data_array Initialized data array to output the values,
|
* @param[in, out] data_array Initialized data array to output the values,
|
||||||
@ -63,12 +65,13 @@ static uint8_t _execute_cb(uint16_t instance_id, uint16_t resource_id, uint8_t *
|
|||||||
* @return COAP_404_NOT_FOUND when resource can't be found
|
* @return COAP_404_NOT_FOUND when resource can't be found
|
||||||
* @return COAP_500_INTERNAL_SERVER_ERROR otherwise
|
* @return COAP_500_INTERNAL_SERVER_ERROR otherwise
|
||||||
*/
|
*/
|
||||||
static uint8_t _read_cb(uint16_t instance_id, int *num_data, lwm2m_data_t **data_array,
|
static uint8_t _read_cb(lwm2m_context_t * context, uint16_t instance_id, int * num_data,
|
||||||
lwm2m_object_t *object);
|
lwm2m_data_t ** data_array, lwm2m_object_t * object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 'Discover' callback for the Device object.
|
* @brief 'Discover' callback for the Device object.
|
||||||
*
|
*
|
||||||
|
* @param[in] context LWM2M Context
|
||||||
* @param[in] instance_id Instance ID. Should be 0 as a single instance exists.
|
* @param[in] instance_id Instance ID. Should be 0 as a single instance exists.
|
||||||
* @param[in, out] num_data Number of resources requested. 0 means all.
|
* @param[in, out] num_data Number of resources requested. 0 means all.
|
||||||
* @param[in, out] data_array Initialized data array to determine if the resource exists,
|
* @param[in, out] data_array Initialized data array to determine if the resource exists,
|
||||||
@ -79,8 +82,8 @@ static uint8_t _read_cb(uint16_t instance_id, int *num_data, lwm2m_data_t **data
|
|||||||
* @return COAP_404_NOT_FOUND when a resource is not supported
|
* @return COAP_404_NOT_FOUND when a resource is not supported
|
||||||
* @return COAP_500_INTERNAL_SERVER_ERROR otherwise
|
* @return COAP_500_INTERNAL_SERVER_ERROR otherwise
|
||||||
*/
|
*/
|
||||||
static uint8_t _discover_cb(uint16_t instance_id, int *num_data, lwm2m_data_t **data_array,
|
static uint8_t _discover_cb(lwm2m_context_t * context, uint16_t instance_id, int * num_data,
|
||||||
lwm2m_object_t *object);
|
lwm2m_data_t ** data_array, lwm2m_object_t * object);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
lwm2m_list_t list; /**< Linked list handle */
|
lwm2m_list_t list; /**< Linked list handle */
|
||||||
@ -95,7 +98,7 @@ static lwm2m_object_t _device_object = {
|
|||||||
.next = NULL,
|
.next = NULL,
|
||||||
.objID = LWM2M_DEVICE_OBJECT_ID,
|
.objID = LWM2M_DEVICE_OBJECT_ID,
|
||||||
.instanceList = (lwm2m_list_t *)&_instance,
|
.instanceList = (lwm2m_list_t *)&_instance,
|
||||||
.readFunc = _read_cb,
|
.readFunc = _read_cb,
|
||||||
.executeFunc = _execute_cb,
|
.executeFunc = _execute_cb,
|
||||||
.discoverFunc = _discover_cb,
|
.discoverFunc = _discover_cb,
|
||||||
.writeFunc = NULL,
|
.writeFunc = NULL,
|
||||||
@ -104,12 +107,13 @@ static lwm2m_object_t _device_object = {
|
|||||||
.userData = NULL
|
.userData = NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint8_t _discover_cb(uint16_t instance_id, int *num_data, lwm2m_data_t **data_array,
|
static uint8_t _discover_cb(lwm2m_context_t * context, uint16_t instance_id, int * num_data,
|
||||||
lwm2m_object_t *object)
|
lwm2m_data_t ** data_array, lwm2m_object_t * object)
|
||||||
{
|
{
|
||||||
uint8_t result;
|
uint8_t result;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
(void)context;
|
||||||
(void)object;
|
(void)object;
|
||||||
|
|
||||||
if (instance_id != 0) {
|
if (instance_id != 0) {
|
||||||
@ -166,9 +170,10 @@ static uint8_t _discover_cb(uint16_t instance_id, int *num_data, lwm2m_data_t **
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t _read_cb(uint16_t instance_id, int *num_data, lwm2m_data_t **data_array,
|
static uint8_t _read_cb(lwm2m_context_t * context, uint16_t instance_id, int * num_data,
|
||||||
lwm2m_object_t *object)
|
lwm2m_data_t ** data_array, lwm2m_object_t * object)
|
||||||
{
|
{
|
||||||
|
(void)context;
|
||||||
(void)object;
|
(void)object;
|
||||||
int i;
|
int i;
|
||||||
DEBUG("[lwm2m:device:read]\n");
|
DEBUG("[lwm2m:device:read]\n");
|
||||||
@ -264,9 +269,10 @@ static uint8_t _read_cb(uint16_t instance_id, int *num_data, lwm2m_data_t **data
|
|||||||
return COAP_205_CONTENT;
|
return COAP_205_CONTENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t _execute_cb(uint16_t instance_id, uint16_t resource_id, uint8_t *buffer, int length,
|
static uint8_t _execute_cb(lwm2m_context_t * context, uint16_t instance_id, uint16_t resource_id,
|
||||||
lwm2m_object_t *object)
|
uint8_t * buffer, int length, lwm2m_object_t * object)
|
||||||
{
|
{
|
||||||
|
(void)context;
|
||||||
(void)buffer;
|
(void)buffer;
|
||||||
(void)object;
|
(void)object;
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
/**
|
/**
|
||||||
* @brief 'Read' callback for the LwM2M Illuminance Sensor object implementation.
|
* @brief 'Read' callback for the LwM2M Illuminance Sensor object implementation.
|
||||||
*
|
*
|
||||||
|
* @param[in] context LWM2M Context
|
||||||
* @param[in] instance_id ID of the instance to read resource from.
|
* @param[in] instance_id ID of the instance to read resource from.
|
||||||
* @param[in] num_data Number of elements in @p data_array.
|
* @param[in] num_data Number of elements in @p data_array.
|
||||||
* @param[in, out] data_array IDs of resources to read. Array of data structures to place values.
|
* @param[in, out] data_array IDs of resources to read. Array of data structures to place values.
|
||||||
@ -38,12 +39,13 @@
|
|||||||
* @return COAP_404_NOT_FOUND if the instance was not found
|
* @return COAP_404_NOT_FOUND if the instance was not found
|
||||||
* @return COAP_500_INTERNAL_SERVER_ERROR otherwise
|
* @return COAP_500_INTERNAL_SERVER_ERROR otherwise
|
||||||
*/
|
*/
|
||||||
static uint8_t _read_cb(uint16_t instance_id, int *num_data, lwm2m_data_t **data_array,
|
static uint8_t _read_cb(lwm2m_context_t * context, uint16_t instance_id, int * num_data,
|
||||||
lwm2m_object_t *object);
|
lwm2m_data_t ** data_array, lwm2m_object_t * object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 'Execute' callback for the LwM2M Illuminance Sensor object implementation.
|
* @brief 'Execute' callback for the LwM2M Illuminance Sensor object implementation.
|
||||||
*
|
*
|
||||||
|
* @param[in] context LWM2M Context
|
||||||
* @param[in] instance_id ID of the instance to execute resource from.
|
* @param[in] instance_id ID of the instance to execute resource from.
|
||||||
* @param[in] resource_id ID of the resource to execute.
|
* @param[in] resource_id ID of the resource to execute.
|
||||||
* @param[in] buffer Pointer to the buffer containing the payload.
|
* @param[in] buffer Pointer to the buffer containing the payload.
|
||||||
@ -54,8 +56,8 @@ static uint8_t _read_cb(uint16_t instance_id, int *num_data, lwm2m_data_t **data
|
|||||||
* @return COAP_404_NOT_FOUND if the instance was not found
|
* @return COAP_404_NOT_FOUND if the instance was not found
|
||||||
* @return COAP_405_METHOD_NOT_ALLOWED if the resource is not executable
|
* @return COAP_405_METHOD_NOT_ALLOWED if the resource is not executable
|
||||||
*/
|
*/
|
||||||
static uint8_t _exec_cb(uint16_t instance_id, uint16_t resource_id, uint8_t *buffer, int length,
|
static uint8_t _exec_cb(lwm2m_context_t * context, uint16_t instance_id, uint16_t resource_id,
|
||||||
lwm2m_object_t *object);
|
uint8_t * buffer, int length, lwm2m_object_t * object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the current value of a given @p instance.
|
* @brief Gets the current value of a given @p instance.
|
||||||
@ -193,9 +195,11 @@ static uint8_t _get_value(lwm2m_data_t *data, lwm2m_obj_ipso_sensor_base_inst_t
|
|||||||
return COAP_205_CONTENT;
|
return COAP_205_CONTENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t _read_cb(uint16_t instance_id, int *num_data, lwm2m_data_t **data_array,
|
static uint8_t _read_cb(lwm2m_context_t * context, uint16_t instance_id, int * num_data,
|
||||||
lwm2m_object_t *object)
|
lwm2m_data_t ** data_array, lwm2m_object_t * object)
|
||||||
{
|
{
|
||||||
|
(void)context;
|
||||||
|
|
||||||
lwm2m_obj_ipso_sensor_base_inst_t *instance;
|
lwm2m_obj_ipso_sensor_base_inst_t *instance;
|
||||||
uint8_t result;
|
uint8_t result;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -252,9 +256,10 @@ out:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t _exec_cb(uint16_t instance_id, uint16_t resource_id, uint8_t *buffer, int length,
|
static uint8_t _exec_cb(lwm2m_context_t * context, uint16_t instance_id, uint16_t resource_id,
|
||||||
lwm2m_object_t *object)
|
uint8_t * buffer, int length, lwm2m_object_t * object);
|
||||||
{
|
{
|
||||||
|
(void)context;
|
||||||
(void)buffer;
|
(void)buffer;
|
||||||
(void)length;
|
(void)length;
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,7 @@ typedef struct lwm2m_obj_light_control_inst {
|
|||||||
/**
|
/**
|
||||||
* @brief 'Read' callback for the LwM2M Light Control object implementation.
|
* @brief 'Read' callback for the LwM2M Light Control object implementation.
|
||||||
*
|
*
|
||||||
|
* @param[in] context LWM2M Context
|
||||||
* @param[in] instance_id ID of the instance to read resource from.
|
* @param[in] instance_id ID of the instance to read resource from.
|
||||||
* @param[in] num_data Number of elements in @p data_array.
|
* @param[in] num_data Number of elements in @p data_array.
|
||||||
* @param[in, out] data_array IDs of resources to read. Array of data structures to place values.
|
* @param[in, out] data_array IDs of resources to read. Array of data structures to place values.
|
||||||
@ -56,12 +57,13 @@ typedef struct lwm2m_obj_light_control_inst {
|
|||||||
* @return COAP_404_NOT_FOUND if the instance was not found
|
* @return COAP_404_NOT_FOUND if the instance was not found
|
||||||
* @return COAP_500_INTERNAL_SERVER_ERROR otherwise
|
* @return COAP_500_INTERNAL_SERVER_ERROR otherwise
|
||||||
*/
|
*/
|
||||||
static uint8_t _read_cb(uint16_t instance_id, int *num_data, lwm2m_data_t **data_array,
|
static uint8_t _read_cb(lwm2m_context_t * context, uint16_t instance_id, int * num_data,
|
||||||
lwm2m_object_t *object);
|
lwm2m_data_t ** data_array, lwm2m_object_t * object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 'Write' callback for the LwM2M Light Control object implementation.
|
* @brief 'Write' callback for the LwM2M Light Control object implementation.
|
||||||
*
|
*
|
||||||
|
* @param[in] context LWM2M Context
|
||||||
* @param[in] instance_id ID of the instance to write resource to.
|
* @param[in] instance_id ID of the instance to write resource to.
|
||||||
* @param[in] num_data Number of elements in @p data_array.
|
* @param[in] num_data Number of elements in @p data_array.
|
||||||
* @param[in] data_array IDs of resources to write and values.
|
* @param[in] data_array IDs of resources to write and values.
|
||||||
@ -72,8 +74,8 @@ static uint8_t _read_cb(uint16_t instance_id, int *num_data, lwm2m_data_t **data
|
|||||||
* @return COAP_400_BAD_REQUEST if a value is not encoded correctly
|
* @return COAP_400_BAD_REQUEST if a value is not encoded correctly
|
||||||
* @return COAP_500_INTERNAL_SERVER_ERROR otherwise
|
* @return COAP_500_INTERNAL_SERVER_ERROR otherwise
|
||||||
*/
|
*/
|
||||||
static uint8_t _write_cb(uint16_t instance_id, int num_data, lwm2m_data_t * data_array,
|
static uint8_t _write_cb(lwm2m_context_t * context, uint16_t instance_id, int num_data,
|
||||||
lwm2m_object_t * object);
|
lwm2m_data_t * data_array, lwm2m_object_t * object, lwm2m_write_type_t write_type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the current value of a given @p instance.
|
* @brief Gets the current value of a given @p instance.
|
||||||
@ -154,9 +156,11 @@ static uint8_t _get_value(lwm2m_data_t *data, lwm2m_obj_light_control_inst_t *in
|
|||||||
return COAP_205_CONTENT;
|
return COAP_205_CONTENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t _read_cb(uint16_t instance_id, int *num_data, lwm2m_data_t **data_array,
|
static uint8_t _read_cb(lwm2m_context_t * context, uint16_t instance_id, int * num_data,
|
||||||
lwm2m_object_t *object)
|
lwm2m_data_t ** data_array, lwm2m_object_t * object)
|
||||||
{
|
{
|
||||||
|
(void)context;
|
||||||
|
|
||||||
lwm2m_obj_light_control_inst_t *instance;
|
lwm2m_obj_light_control_inst_t *instance;
|
||||||
uint8_t result = COAP_404_NOT_FOUND;
|
uint8_t result = COAP_404_NOT_FOUND;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -214,9 +218,12 @@ free_out:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t _write_cb(uint16_t instance_id, int num_data, lwm2m_data_t * data_array,
|
static uint8_t _write_cb(lwm2m_context_t * context, uint16_t instance_id, int num_data,
|
||||||
lwm2m_object_t * object)
|
lwm2m_data_t * data_array, lwm2m_object_t * object, lwm2m_write_type_t write_type)
|
||||||
{
|
{
|
||||||
|
(void)context;
|
||||||
|
(void)write_type;
|
||||||
|
|
||||||
lwm2m_obj_light_control_inst_t *instance;
|
lwm2m_obj_light_control_inst_t *instance;
|
||||||
uint8_t result = COAP_204_CHANGED;
|
uint8_t result = COAP_204_CHANGED;
|
||||||
bool call_cb = false;
|
bool call_cb = false;
|
||||||
@ -336,7 +343,6 @@ free_out:
|
|||||||
static void _mark_resource_changed(uint16_t instance_id, uint16_t resource_id)
|
static void _mark_resource_changed(uint16_t instance_id, uint16_t resource_id)
|
||||||
{
|
{
|
||||||
lwm2m_uri_t uri;
|
lwm2m_uri_t uri;
|
||||||
uri.flag = LWM2M_URI_FLAG_OBJECT_ID | LWM2M_URI_FLAG_INSTANCE_ID | LWM2M_URI_FLAG_RESOURCE_ID;
|
|
||||||
uri.objectId = LWM2M_LIGHT_CONTROL_OBJECT_ID;
|
uri.objectId = LWM2M_LIGHT_CONTROL_OBJECT_ID;
|
||||||
uri.instanceId = instance_id;
|
uri.instanceId = instance_id;
|
||||||
uri.resourceId = resource_id;
|
uri.resourceId = resource_id;
|
||||||
|
|||||||
@ -119,6 +119,7 @@ typedef struct lwm2m_obj_security_inst {
|
|||||||
/**
|
/**
|
||||||
* @brief 'Read' callback for the security object.
|
* @brief 'Read' callback for the security object.
|
||||||
*
|
*
|
||||||
|
* @param[in] context LWM2M Context
|
||||||
* @param[in] instance_id ID of the instance to read
|
* @param[in] instance_id ID of the instance to read
|
||||||
* @param[in, out] num_data Number of resources requested. 0 means all.
|
* @param[in, out] num_data Number of resources requested. 0 means all.
|
||||||
* @param[in, out] data_array Initialized data array to output the values,
|
* @param[in, out] data_array Initialized data array to output the values,
|
||||||
@ -129,12 +130,13 @@ typedef struct lwm2m_obj_security_inst {
|
|||||||
* @retval COAP_404_NOT_FOUND when resource can't be found
|
* @retval COAP_404_NOT_FOUND when resource can't be found
|
||||||
* @retval COAP_500_INTERNAL_SERVER_ERROR otherwise
|
* @retval COAP_500_INTERNAL_SERVER_ERROR otherwise
|
||||||
*/
|
*/
|
||||||
static uint8_t _read_cb(uint16_t instance_id, int *num_data, lwm2m_data_t *data_array[],
|
static uint8_t _read_cb(lwm2m_context_t * context, uint16_t instance_id, int * num_data,
|
||||||
lwm2m_object_t *object);
|
lwm2m_data_t ** data_array, lwm2m_object_t * object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 'Write' callback for the security object.
|
* @brief 'Write' callback for the security object.
|
||||||
*
|
|
||||||
|
* @param[in] context LWM2M Context
|
||||||
* @param[in] instance_id ID of the instance to write to
|
* @param[in] instance_id ID of the instance to write to
|
||||||
* @param[in] num_data Number of resources to write
|
* @param[in] num_data Number of resources to write
|
||||||
* @param[in] data_array Array of data to write
|
* @param[in] data_array Array of data to write
|
||||||
@ -143,23 +145,27 @@ static uint8_t _read_cb(uint16_t instance_id, int *num_data, lwm2m_data_t *data_
|
|||||||
* @retval COAP_204_CHANGED on success
|
* @retval COAP_204_CHANGED on success
|
||||||
* @retval COAP_400_BAD_REQUEST otherwise
|
* @retval COAP_400_BAD_REQUEST otherwise
|
||||||
*/
|
*/
|
||||||
static uint8_t _write_cb(uint16_t instance_id, int num_data, lwm2m_data_t *data_array,
|
static uint8_t _write_cb(lwm2m_context_t * context, uint16_t instance_id, int num_data,
|
||||||
lwm2m_object_t *object);
|
lwm2m_data_t * data_array, lwm2m_object_t * object,
|
||||||
|
lwm2m_write_type_t write_type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 'Delete' callback for the security object.
|
* @brief 'Delete' callback for the security object.
|
||||||
*
|
*
|
||||||
|
* @param[in] context LWM2M Context
|
||||||
* @param[in] instance_id ID of the instance to delete
|
* @param[in] instance_id ID of the instance to delete
|
||||||
* @param[in] object Security object pointer
|
* @param[in] object Security object pointer
|
||||||
*
|
*
|
||||||
* @retval COAP_202_DELETED on success
|
* @retval COAP_202_DELETED on success
|
||||||
* @retval COAP_404_NOT_FOUND when the instance can't be found
|
* @retval COAP_404_NOT_FOUND when the instance can't be found
|
||||||
*/
|
*/
|
||||||
static uint8_t _delete_cb(uint16_t instance_id, lwm2m_object_t *object);
|
static uint8_t _delete_cb(lwm2m_context_t * context, uint16_t instance_id,
|
||||||
|
lwm2m_object_t * object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 'Create' callback for the security object.
|
* @brief 'Create' callback for the security object.
|
||||||
*
|
*
|
||||||
|
* @param[in] context LWM2M Context
|
||||||
* @param[in] instance_id ID of the instance to create
|
* @param[in] instance_id ID of the instance to create
|
||||||
* @param[in] num_data Number of resources to write
|
* @param[in] num_data Number of resources to write
|
||||||
* @param[in] data_array Array of data to write
|
* @param[in] data_array Array of data to write
|
||||||
@ -168,8 +174,8 @@ static uint8_t _delete_cb(uint16_t instance_id, lwm2m_object_t *object);
|
|||||||
* @retval COAP_201_CREATED on success
|
* @retval COAP_201_CREATED on success
|
||||||
* @retval COAP_500_INTERNAL_SERVER_ERROR otherwise
|
* @retval COAP_500_INTERNAL_SERVER_ERROR otherwise
|
||||||
*/
|
*/
|
||||||
static uint8_t _create_cb(uint16_t instance_id, int num_data, lwm2m_data_t *data_array,
|
static uint8_t _create_cb(lwm2m_context_t * context, uint16_t instance_id, int num_data,
|
||||||
lwm2m_object_t *object);
|
lwm2m_data_t * data_array, lwm2m_object_t * object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get a value from a security object instance.
|
* @brief Get a value from a security object instance.
|
||||||
@ -392,9 +398,11 @@ static int _get_value(lwm2m_data_t *data, lwm2m_obj_security_inst_t *instance)
|
|||||||
return COAP_205_CONTENT;
|
return COAP_205_CONTENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t _read_cb(uint16_t instance_id, int *num_data, lwm2m_data_t *data_array[],
|
static uint8_t _read_cb(lwm2m_context_t * context, uint16_t instance_id, int * num_data,
|
||||||
lwm2m_object_t *object)
|
lwm2m_data_t ** data_array, lwm2m_object_t * object)
|
||||||
{
|
{
|
||||||
|
(void)context;
|
||||||
|
|
||||||
lwm2m_obj_security_inst_t *instance;
|
lwm2m_obj_security_inst_t *instance;
|
||||||
uint8_t result;
|
uint8_t result;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -458,9 +466,12 @@ out:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t _write_cb(uint16_t instance_id, int num_data, lwm2m_data_t *data_array,
|
static uint8_t _write_cb(lwm2m_context_t * context, uint16_t instance_id, int num_data,
|
||||||
lwm2m_object_t *object)
|
lwm2m_data_t * data_array, lwm2m_object_t * object,
|
||||||
|
lwm2m_write_type_t write_type)
|
||||||
{
|
{
|
||||||
|
(void)context;
|
||||||
|
(void)write_type;
|
||||||
lwm2m_obj_security_inst_t *instance;
|
lwm2m_obj_security_inst_t *instance;
|
||||||
int64_t value;
|
int64_t value;
|
||||||
uint8_t result = COAP_404_NOT_FOUND;
|
uint8_t result = COAP_404_NOT_FOUND;
|
||||||
@ -641,8 +652,10 @@ out:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t _delete_cb(uint16_t instance_id, lwm2m_object_t *object)
|
static uint8_t _delete_cb(lwm2m_context_t * context, uint16_t instance_id,
|
||||||
|
lwm2m_object_t * object)
|
||||||
{
|
{
|
||||||
|
(void)context;
|
||||||
uint8_t result = COAP_404_NOT_FOUND;
|
uint8_t result = COAP_404_NOT_FOUND;
|
||||||
lwm2m_obj_security_inst_t *instance;
|
lwm2m_obj_security_inst_t *instance;
|
||||||
|
|
||||||
@ -679,9 +692,11 @@ free_out:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t _create_cb(uint16_t instance_id, int num_data, lwm2m_data_t *data_array,
|
static uint8_t _create_cb(lwm2m_context_t * context, uint16_t instance_id, int num_data,
|
||||||
lwm2m_object_t *object)
|
lwm2m_data_t * data_array, lwm2m_object_t * object)
|
||||||
{
|
{
|
||||||
|
(void)context;
|
||||||
|
|
||||||
lwm2m_obj_security_inst_t *instance;
|
lwm2m_obj_security_inst_t *instance;
|
||||||
uint8_t result;
|
uint8_t result;
|
||||||
|
|
||||||
@ -718,10 +733,10 @@ static uint8_t _create_cb(uint16_t instance_id, int num_data, lwm2m_data_t *data
|
|||||||
object->instanceList = LWM2M_LIST_ADD(object->instanceList, instance);
|
object->instanceList = LWM2M_LIST_ADD(object->instanceList, instance);
|
||||||
|
|
||||||
/* write incoming data to the instance */
|
/* write incoming data to the instance */
|
||||||
result = _write_cb(instance_id, num_data, data_array, object);
|
result = _write_cb(context, instance_id, num_data, data_array, object, LWM2M_WRITE_PARTIAL_UPDATE);
|
||||||
|
|
||||||
if (result != COAP_204_CHANGED) {
|
if (result != COAP_204_CHANGED) {
|
||||||
_delete_cb(instance_id, object);
|
_delete_cb(context,instance_id, object);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = COAP_201_CREATED;
|
result = COAP_201_CREATED;
|
||||||
|
|||||||
@ -67,7 +67,7 @@
|
|||||||
* obj_list[1] = lwm2m_client_get_server_object(&client_data, CONFIG_LWM2M_SERVER_SHORT_ID);
|
* obj_list[1] = lwm2m_client_get_server_object(&client_data, CONFIG_LWM2M_SERVER_SHORT_ID);
|
||||||
*
|
*
|
||||||
* // device object has a single instance. All the information for now is defined at compile-time
|
* // device object has a single instance. All the information for now is defined at compile-time
|
||||||
* obj_list[2] = lwm2m_object_device_get();
|
* obj_list[2] = lwm2m_object_device_init(&client_data);
|
||||||
*
|
*
|
||||||
* // run the LwM2M client
|
* // run the LwM2M client
|
||||||
* lwm2m_client_run(&client_data, obj_list, ARRAY_SIZE(obj_list);
|
* lwm2m_client_run(&client_data, obj_list, ARRAY_SIZE(obj_list);
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
From 71152ca234e7af2bd96ec3a425976c818edb8753 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Thu, 23 Nov 2017 10:55:07 +0100
|
|
||||||
Subject: [PATCH 01/12] change header location
|
|
||||||
|
|
||||||
---
|
|
||||||
core/internals.h | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/core/internals.h b/core/internals.h
|
|
||||||
index 30d3942..79c6c4c 100644
|
|
||||||
--- a/core/internals.h
|
|
||||||
+++ b/core/internals.h
|
|
||||||
@@ -61,7 +61,7 @@
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
-#include "er-coap-13/er-coap-13.h"
|
|
||||||
+#include "er-coap-13.h"
|
|
||||||
|
|
||||||
#ifdef LWM2M_WITH_LOGS
|
|
||||||
#include <inttypes.h>
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
53
pkg/wakaama/patches/0001-fixed-coap-inlcudes.patch
Normal file
53
pkg/wakaama/patches/0001-fixed-coap-inlcudes.patch
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
From ce1dd5e82e3cff40446217b372324d3599910bd7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Moritz <moritz.holzer@haw-hamburg.de>
|
||||||
|
Date: Mon, 21 Oct 2024 13:26:18 +0200
|
||||||
|
Subject: [PATCH 1/3] fixed coap inlcudes
|
||||||
|
|
||||||
|
---
|
||||||
|
core/bootstrap.h | 2 +-
|
||||||
|
core/internals.h | 2 +-
|
||||||
|
core/registration.h | 2 +-
|
||||||
|
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/core/bootstrap.h b/core/bootstrap.h
|
||||||
|
index 64ff684..97d4594 100644
|
||||||
|
--- a/core/bootstrap.h
|
||||||
|
+++ b/core/bootstrap.h
|
||||||
|
@@ -17,7 +17,7 @@
|
||||||
|
*******************************************************************************/
|
||||||
|
#ifndef WAKAAMA_BOOTSTRAP_H
|
||||||
|
#define WAKAAMA_BOOTSTRAP_H
|
||||||
|
-#include "er-coap-13/er-coap-13.h"
|
||||||
|
+#include "er-coap-13.h"
|
||||||
|
#include "internals.h"
|
||||||
|
|
||||||
|
void bootstrap_step(lwm2m_context_t *contextP, time_t currentTime, time_t *timeoutP);
|
||||||
|
diff --git a/core/internals.h b/core/internals.h
|
||||||
|
index 7ad7c52..6b94c59 100644
|
||||||
|
--- a/core/internals.h
|
||||||
|
+++ b/core/internals.h
|
||||||
|
@@ -64,7 +64,7 @@
|
||||||
|
|
||||||
|
#include "bootstrap.h"
|
||||||
|
#include "discover.h"
|
||||||
|
-#include "er-coap-13/er-coap-13.h"
|
||||||
|
+#include "er-coap-13.h"
|
||||||
|
#include "logging.h"
|
||||||
|
#include "management.h"
|
||||||
|
#include "objects.h"
|
||||||
|
diff --git a/core/registration.h b/core/registration.h
|
||||||
|
index fe500c6..b05ad49 100644
|
||||||
|
--- a/core/registration.h
|
||||||
|
+++ b/core/registration.h
|
||||||
|
@@ -17,7 +17,7 @@
|
||||||
|
*******************************************************************************/
|
||||||
|
#ifndef WAKAAMA_REGISTRATION_H
|
||||||
|
#define WAKAAMA_REGISTRATION_H
|
||||||
|
-#include "er-coap-13/er-coap-13.h"
|
||||||
|
+#include "er-coap-13.h"
|
||||||
|
#include "internals.h"
|
||||||
|
|
||||||
|
uint8_t registration_handleRequest(lwm2m_context_t *contextP, lwm2m_uri_t *uriP, void *fromSessionH,
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
From 8497756fbb1bfdc283f98430e101cd89ab84c18d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Thu, 23 Nov 2017 10:55:57 +0100
|
|
||||||
Subject: [PATCH 02/12] define endianness
|
|
||||||
|
|
||||||
---
|
|
||||||
core/internals.h | 6 ++++++
|
|
||||||
1 file changed, 6 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/core/internals.h b/core/internals.h
|
|
||||||
index 79c6c4c..f6490d1 100644
|
|
||||||
--- a/core/internals.h
|
|
||||||
+++ b/core/internals.h
|
|
||||||
@@ -63,6 +63,12 @@
|
|
||||||
|
|
||||||
#include "er-coap-13.h"
|
|
||||||
|
|
||||||
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
||||||
+#define LWM2M_LITTLE_ENDIAN
|
|
||||||
+#else
|
|
||||||
+#define LWM2M_BIG_ENDIAN
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
#ifdef LWM2M_WITH_LOGS
|
|
||||||
#include <inttypes.h>
|
|
||||||
#define LOG(STR) lwm2m_printf("[%s:%d] " STR "\r\n", __func__ , __LINE__)
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
25
pkg/wakaama/patches/0002-fixes-unused-variables.patch
Normal file
25
pkg/wakaama/patches/0002-fixes-unused-variables.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
From cd7e74ec91b48282117d478e2dc1ef1f077a2048 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Moritz <moritz.holzer@haw-hamburg.de>
|
||||||
|
Date: Mon, 21 Oct 2024 13:26:33 +0200
|
||||||
|
Subject: [PATCH 2/3] fixes unused variables
|
||||||
|
|
||||||
|
---
|
||||||
|
examples/client/object_server.c | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/examples/client/object_server.c b/examples/client/object_server.c
|
||||||
|
index 3102abe..a6a05bc 100644
|
||||||
|
--- a/examples/client/object_server.c
|
||||||
|
+++ b/examples/client/object_server.c
|
||||||
|
@@ -795,6 +795,8 @@ static uint8_t prv_server_execute(lwm2m_context_t *contextP,
|
||||||
|
|
||||||
|
/* unused parameter */
|
||||||
|
(void)contextP;
|
||||||
|
+ (void)buffer;
|
||||||
|
+ (void)length;
|
||||||
|
|
||||||
|
targetP = (server_instance_t *)lwm2m_list_find(objectP->instanceList, instanceId);
|
||||||
|
if (NULL == targetP) return COAP_404_NOT_FOUND;
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
||||||
39
pkg/wakaama/patches/0003-fixed-const-parameter.patch
Normal file
39
pkg/wakaama/patches/0003-fixed-const-parameter.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
From 5f9f202974a10576afec2ed941b4b2c192ccbc00 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Moritz <moritz.holzer@haw-hamburg.de>
|
||||||
|
Date: Mon, 21 Oct 2024 13:26:54 +0200
|
||||||
|
Subject: [PATCH 3/3] fixed const parameter
|
||||||
|
|
||||||
|
---
|
||||||
|
core/observe.c | 2 +-
|
||||||
|
include/liblwm2m.h | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/core/observe.c b/core/observe.c
|
||||||
|
index af70fd6..3cd9c41 100644
|
||||||
|
--- a/core/observe.c
|
||||||
|
+++ b/core/observe.c
|
||||||
|
@@ -469,7 +469,7 @@ lwm2m_observed_t * observe_findByUri(lwm2m_context_t * contextP,
|
||||||
|
}
|
||||||
|
|
||||||
|
void lwm2m_resource_value_changed(lwm2m_context_t * contextP,
|
||||||
|
- lwm2m_uri_t * uriP)
|
||||||
|
+ const lwm2m_uri_t * uriP)
|
||||||
|
{
|
||||||
|
lwm2m_observed_t * targetP;
|
||||||
|
|
||||||
|
diff --git a/include/liblwm2m.h b/include/liblwm2m.h
|
||||||
|
index 58a1a53..3d12e03 100644
|
||||||
|
--- a/include/liblwm2m.h
|
||||||
|
+++ b/include/liblwm2m.h
|
||||||
|
@@ -877,7 +877,7 @@ int lwm2m_remove_object(lwm2m_context_t * contextP, uint16_t id);
|
||||||
|
int lwm2m_update_registration(lwm2m_context_t * contextP, uint16_t shortServerID, bool withObjects);
|
||||||
|
// send deregistration to all servers connected to client
|
||||||
|
void lwm2m_deregister(lwm2m_context_t * context);
|
||||||
|
-void lwm2m_resource_value_changed(lwm2m_context_t * contextP, lwm2m_uri_t * uriP);
|
||||||
|
+void lwm2m_resource_value_changed(lwm2m_context_t * contextP, const lwm2m_uri_t * uriP);
|
||||||
|
|
||||||
|
#ifndef LWM2M_VERSION_1_0
|
||||||
|
// send resources specified by URIs to the server specified by the server short
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
From cb33c63fad39a27b7164965f7ba3649852ab5104 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Thu, 23 Nov 2017 11:08:53 +0100
|
|
||||||
Subject: [PATCH 03/12] fixed warnings in er-coap-13.c
|
|
||||||
|
|
||||||
---
|
|
||||||
core/er-coap-13/er-coap-13.c | 5 ++++-
|
|
||||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/core/er-coap-13/er-coap-13.c b/core/er-coap-13/er-coap-13.c
|
|
||||||
index 67d1bb3..647bb88 100644
|
|
||||||
--- a/core/er-coap-13/er-coap-13.c
|
|
||||||
+++ b/core/er-coap-13/er-coap-13.c
|
|
||||||
@@ -381,7 +381,7 @@ coap_get_variable(const uint8_t *buffer, size_t length, const char *name, const
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
uint16_t
|
|
||||||
-coap_get_mid()
|
|
||||||
+coap_get_mid(void)
|
|
||||||
{
|
|
||||||
return ++current_mid;
|
|
||||||
}
|
|
||||||
@@ -860,6 +860,9 @@ coap_get_query_variable(void *packet, const char *name, const char **output)
|
|
||||||
return coap_get_variable(coap_pkt->uri_query, coap_pkt->uri_query_len, name, output);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
+ (void)packet;
|
|
||||||
+ (void)name;
|
|
||||||
+ (void)output;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
29
pkg/wakaama/patches/0004-define-endianness.patch
Normal file
29
pkg/wakaama/patches/0004-define-endianness.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
From 69cb133c87aca2b48184e5e22880fc312a16616f Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?=E2=80=9Emoritzholzer=E2=80=9C?= <moritz.holzer@outlook.de>
|
||||||
|
Date: Wed, 23 Oct 2024 09:25:41 +0200
|
||||||
|
Subject: [PATCH] define-endianness
|
||||||
|
|
||||||
|
---
|
||||||
|
core/internals.h | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/core/internals.h b/core/internals.h
|
||||||
|
index 6b94c59..2d5dd39 100644
|
||||||
|
--- a/core/internals.h
|
||||||
|
+++ b/core/internals.h
|
||||||
|
@@ -75,6 +75,12 @@
|
||||||
|
#include "uri.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||||
|
+#define LWM2M_LITTLE_ENDIAN
|
||||||
|
+#else
|
||||||
|
+#define LWM2M_BIG_ENDIAN
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#define LWM2M_DEFAULT_LIFETIME 86400
|
||||||
|
|
||||||
|
#ifdef LWM2M_SUPPORT_SENML_CBOR
|
||||||
|
--
|
||||||
|
2.47.0
|
||||||
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
From b3195957e4fa9217f71f3d5f4505aa463516abed Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Thu, 23 Nov 2017 11:11:17 +0100
|
|
||||||
Subject: [PATCH 04/12] fixed warnings in packet.c
|
|
||||||
|
|
||||||
---
|
|
||||||
core/packet.c | 5 +++++
|
|
||||||
1 file changed, 5 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/core/packet.c b/core/packet.c
|
|
||||||
index dc998d3..5e9d9c1 100644
|
|
||||||
--- a/core/packet.c
|
|
||||||
+++ b/core/packet.c
|
|
||||||
@@ -97,6 +97,9 @@ static void handle_reset(lwm2m_context_t * contextP,
|
|
||||||
void * fromSessionH,
|
|
||||||
coap_packet_t * message)
|
|
||||||
{
|
|
||||||
+ (void)contextP;
|
|
||||||
+ (void)fromSessionH;
|
|
||||||
+ (void)message;
|
|
||||||
#ifdef LWM2M_CLIENT_MODE
|
|
||||||
LOG("Entering");
|
|
||||||
observe_cancel(contextP, message->mid, fromSessionH);
|
|
||||||
@@ -108,6 +111,8 @@ static uint8_t handle_request(lwm2m_context_t * contextP,
|
|
||||||
coap_packet_t * message,
|
|
||||||
coap_packet_t * response)
|
|
||||||
{
|
|
||||||
+ (void)contextP;
|
|
||||||
+ (void)fromSessionH;
|
|
||||||
lwm2m_uri_t * uriP;
|
|
||||||
uint8_t result = COAP_IGNORE;
|
|
||||||
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
33
pkg/wakaama/patches/0005-fixed-format-specifier.patch
Normal file
33
pkg/wakaama/patches/0005-fixed-format-specifier.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
From 85072c812957133c02899e2e1f25dd46f5d576f1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Moritz <moritz.holzer@haw-hamburg.de>
|
||||||
|
Date: Wed, 23 Oct 2024 16:51:12 +0200
|
||||||
|
Subject: [PATCH] fixed format specifier
|
||||||
|
|
||||||
|
---
|
||||||
|
examples/client/object_server.c | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/examples/client/object_server.c b/examples/client/object_server.c
|
||||||
|
index a6a05bc..a19516d 100644
|
||||||
|
--- a/examples/client/object_server.c
|
||||||
|
+++ b/examples/client/object_server.c
|
||||||
|
@@ -51,6 +51,7 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
+#include <inttypes.h>
|
||||||
|
|
||||||
|
typedef struct _server_instance_
|
||||||
|
{
|
||||||
|
@@ -908,7 +909,7 @@ void display_server_object(lwm2m_object_t * object)
|
||||||
|
server_instance_t * serverInstance = (server_instance_t *)object->instanceList;
|
||||||
|
while (serverInstance != NULL)
|
||||||
|
{
|
||||||
|
- fprintf(stdout, " /%u/%u: instanceId: %u, shortServerId: %u, lifetime: %u, storing: %s, binding: %s",
|
||||||
|
+ fprintf(stdout, " /%u/%u: instanceId: %u, shortServerId: %u, lifetime: %" PRIu32 ", storing: %s, binding: %s",
|
||||||
|
object->objID, serverInstance->instanceId,
|
||||||
|
serverInstance->instanceId, serverInstance->shortServerId, serverInstance->lifetime,
|
||||||
|
serverInstance->storing ? "true" : "false", serverInstance->binding);
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
From b4060e323b9683f13f6e717ddbbba8fed5bb6d3d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Thu, 23 Nov 2017 11:28:37 +0100
|
|
||||||
Subject: [PATCH 05/12] fixed warnings in registration.c
|
|
||||||
|
|
||||||
---
|
|
||||||
core/registration.c | 3 +++
|
|
||||||
1 file changed, 3 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/core/registration.c b/core/registration.c
|
|
||||||
index 55d6ed8..a2fca3f 100644
|
|
||||||
--- a/core/registration.c
|
|
||||||
+++ b/core/registration.c
|
|
||||||
@@ -1283,6 +1283,9 @@ void registration_step(lwm2m_context_t * contextP,
|
|
||||||
time_t currentTime,
|
|
||||||
time_t * timeoutP)
|
|
||||||
{
|
|
||||||
+ (void)contextP;
|
|
||||||
+ (void)currentTime;
|
|
||||||
+ (void)timeoutP;
|
|
||||||
#ifdef LWM2M_CLIENT_MODE
|
|
||||||
lwm2m_server_t * targetP = contextP->serverList;
|
|
||||||
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
From 91e610adbf53342088242e7bc6a207fc4b48a715 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Thu, 23 Nov 2017 11:35:06 +0100
|
|
||||||
Subject: [PATCH 06/12] fixed warnings in utils.c
|
|
||||||
|
|
||||||
---
|
|
||||||
core/utils.c | 3 ++-
|
|
||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/core/utils.c b/core/utils.c
|
|
||||||
index 715dec9..a06d1f6 100644
|
|
||||||
--- a/core/utils.c
|
|
||||||
+++ b/core/utils.c
|
|
||||||
@@ -52,7 +52,6 @@
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <float.h>
|
|
||||||
|
|
||||||
-
|
|
||||||
int utils_textToInt(uint8_t * buffer,
|
|
||||||
int length,
|
|
||||||
int64_t * dataP)
|
|
||||||
@@ -376,6 +375,8 @@ lwm2m_server_t * utils_findServer(lwm2m_context_t * contextP,
|
|
||||||
lwm2m_server_t * utils_findBootstrapServer(lwm2m_context_t * contextP,
|
|
||||||
void * fromSessionH)
|
|
||||||
{
|
|
||||||
+ (void)contextP;
|
|
||||||
+ (void)fromSessionH;
|
|
||||||
#ifdef LWM2M_CLIENT_MODE
|
|
||||||
|
|
||||||
lwm2m_server_t * targetP;
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
From f7c65c6c3ad1c00fc9d10b0bd25e6119d1020f88 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Thu, 23 Nov 2017 11:58:52 +0100
|
|
||||||
Subject: [PATCH 07/12] fixed warnings in transaction.c
|
|
||||||
|
|
||||||
---
|
|
||||||
core/transaction.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/core/transaction.c b/core/transaction.c
|
|
||||||
index fd7d5d4..2dd86b1 100644
|
|
||||||
--- a/core/transaction.c
|
|
||||||
+++ b/core/transaction.c
|
|
||||||
@@ -377,7 +377,7 @@ int transaction_send(lwm2m_context_t * contextP,
|
|
||||||
|
|
||||||
if (!transacP->ack_received)
|
|
||||||
{
|
|
||||||
- long unsigned timeout;
|
|
||||||
+ long unsigned timeout = 0;
|
|
||||||
|
|
||||||
if (0 == transacP->retrans_counter)
|
|
||||||
{
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
From 63d29e3038c3cfd70cf10ee168f78209e29ae5d2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Wed, 29 Nov 2017 15:28:51 +0100
|
|
||||||
Subject: [PATCH 08/12] fixed warnings in bootstrap.c
|
|
||||||
|
|
||||||
---
|
|
||||||
core/bootstrap.c | 11 +++++++----
|
|
||||||
1 file changed, 7 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/core/bootstrap.c b/core/bootstrap.c
|
|
||||||
index 611566b..d0fc0c8 100644
|
|
||||||
--- a/core/bootstrap.c
|
|
||||||
+++ b/core/bootstrap.c
|
|
||||||
@@ -148,11 +148,11 @@ void bootstrap_step(lwm2m_context_t * contextP,
|
|
||||||
break;
|
|
||||||
|
|
||||||
case STATE_BS_HOLD_OFF:
|
|
||||||
- if (targetP->registration <= currentTime)
|
|
||||||
+ if (targetP->registration <= (time_t)currentTime)
|
|
||||||
{
|
|
||||||
prv_requestBootstrap(contextP, targetP);
|
|
||||||
}
|
|
||||||
- else if (*timeoutP > targetP->registration - currentTime)
|
|
||||||
+ else if (*timeoutP > targetP->registration - (time_t)currentTime)
|
|
||||||
{
|
|
||||||
*timeoutP = targetP->registration - currentTime;
|
|
||||||
}
|
|
||||||
@@ -163,12 +163,12 @@ void bootstrap_step(lwm2m_context_t * contextP,
|
|
||||||
break;
|
|
||||||
|
|
||||||
case STATE_BS_PENDING:
|
|
||||||
- if (targetP->registration <= currentTime)
|
|
||||||
+ if (targetP->registration <= (time_t)currentTime)
|
|
||||||
{
|
|
||||||
targetP->status = STATE_BS_FAILING;
|
|
||||||
*timeoutP = 0;
|
|
||||||
}
|
|
||||||
- else if (*timeoutP > targetP->registration - currentTime)
|
|
||||||
+ else if (*timeoutP > targetP->registration - (time_t)currentTime)
|
|
||||||
{
|
|
||||||
*timeoutP = targetP->registration - currentTime;
|
|
||||||
}
|
|
||||||
@@ -375,6 +375,7 @@ uint8_t bootstrap_handleCommand(lwm2m_context_t * contextP,
|
|
||||||
{
|
|
||||||
uint8_t result;
|
|
||||||
lwm2m_media_type_t format;
|
|
||||||
+ (void)response;
|
|
||||||
|
|
||||||
LOG_ARG("Code: %02X", message->code);
|
|
||||||
LOG_URI(uriP);
|
|
||||||
@@ -582,6 +583,8 @@ uint8_t bootstrap_handleRequest(lwm2m_context_t * contextP,
|
|
||||||
{
|
|
||||||
uint8_t result;
|
|
||||||
char * name;
|
|
||||||
+ (void)uriP;
|
|
||||||
+ (void)response;
|
|
||||||
|
|
||||||
LOG_URI(uriP);
|
|
||||||
if (contextP->bootstrapCallback == NULL) return COAP_500_INTERNAL_SERVER_ERROR;
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
From 13db42af916c31f9b6407a4f6f8ff800f3ac769b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Mon, 7 May 2018 18:26:08 +0200
|
|
||||||
Subject: [PATCH] fixed warnings in observe.c
|
|
||||||
|
|
||||||
---
|
|
||||||
core/observe.c | 5 +++--
|
|
||||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/core/observe.c b/core/observe.c
|
|
||||||
index 0f2f1dd..8858a68 100644
|
|
||||||
--- a/core/observe.c
|
|
||||||
+++ b/core/observe.c
|
|
||||||
@@ -164,6 +164,7 @@ uint8_t observe_handleRequest(lwm2m_context_t * contextP,
|
|
||||||
lwm2m_observed_t * observedP;
|
|
||||||
lwm2m_watcher_t * watcherP;
|
|
||||||
uint32_t count;
|
|
||||||
+ (void)size;
|
|
||||||
|
|
||||||
LOG_ARG("Code: %02X, server status: %s", message->code, STR_STATUS(serverP->status));
|
|
||||||
LOG_URI(uriP);
|
|
||||||
@@ -653,7 +654,7 @@ void observe_step(lwm2m_context_t * contextP,
|
|
||||||
{
|
|
||||||
LOG_ARG("Checking minimal period (%d s)", watcherP->parameters->minPeriod);
|
|
||||||
|
|
||||||
- if (watcherP->lastTime + watcherP->parameters->minPeriod > currentTime)
|
|
||||||
+ if (watcherP->lastTime + (time_t)watcherP->parameters->minPeriod > currentTime)
|
|
||||||
{
|
|
||||||
// Minimum Period did not elapse yet
|
|
||||||
interval = watcherP->lastTime + watcherP->parameters->minPeriod - currentTime;
|
|
||||||
@@ -675,7 +676,7 @@ void observe_step(lwm2m_context_t * contextP,
|
|
||||||
{
|
|
||||||
LOG_ARG("Checking maximal period (%d s)", watcherP->parameters->maxPeriod);
|
|
||||||
|
|
||||||
- if (watcherP->lastTime + watcherP->parameters->maxPeriod <= currentTime)
|
|
||||||
+ if (watcherP->lastTime + (time_t)watcherP->parameters->maxPeriod <= currentTime)
|
|
||||||
{
|
|
||||||
LOG("Notify on maximal period");
|
|
||||||
notify = true;
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
From ddbb2dc1078489131c77084934099c8a76c80fb7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Wed, 29 Nov 2017 16:04:41 +0100
|
|
||||||
Subject: [PATCH 10/12] fixed warnings registration.c
|
|
||||||
|
|
||||||
---
|
|
||||||
core/registration.c | 5 +++--
|
|
||||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/core/registration.c b/core/registration.c
|
|
||||||
index a2fca3f..647a980 100644
|
|
||||||
--- a/core/registration.c
|
|
||||||
+++ b/core/registration.c
|
|
||||||
@@ -69,7 +69,7 @@ static int prv_getRegistrationQueryLength(lwm2m_context_t * contextP,
|
|
||||||
{
|
|
||||||
int index;
|
|
||||||
int res;
|
|
||||||
- char buffer[21];
|
|
||||||
+ uint8_t buffer[21];
|
|
||||||
|
|
||||||
index = strlen(QUERY_STARTER QUERY_VERSION_FULL QUERY_DELIMITER QUERY_NAME);
|
|
||||||
index += strlen(contextP->endpointName);
|
|
||||||
@@ -170,7 +170,7 @@ static int prv_getRegistrationQuery(lwm2m_context_t * contextP,
|
|
||||||
res = utils_stringCopy(buffer + index, length - index, QUERY_DELIMITER QUERY_LIFETIME);
|
|
||||||
if (res < 0) return 0;
|
|
||||||
index += res;
|
|
||||||
- res = utils_intToText(server->lifetime, buffer + index, length - index);
|
|
||||||
+ res = utils_intToText(server->lifetime, (uint8_t *)(buffer + index), length - index);
|
|
||||||
if (res == 0) return 0;
|
|
||||||
index += res;
|
|
||||||
}
|
|
||||||
@@ -535,6 +535,7 @@ static void prv_handleDeregistrationReply(lwm2m_transaction_t * transacP,
|
|
||||||
void * message)
|
|
||||||
{
|
|
||||||
lwm2m_server_t * targetP;
|
|
||||||
+ (void)message;
|
|
||||||
|
|
||||||
targetP = (lwm2m_server_t *)(transacP->userData);
|
|
||||||
if (NULL != targetP)
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
From e3242ed0be22664d0c34f9fb5a1f363df24701f9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Wed, 29 Nov 2017 16:31:40 +0100
|
|
||||||
Subject: [PATCH 11/12] fixed warnings in objects.c
|
|
||||||
|
|
||||||
---
|
|
||||||
core/objects.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/core/objects.c b/core/objects.c
|
|
||||||
index f9b8962..e5a0edc 100644
|
|
||||||
--- a/core/objects.c
|
|
||||||
+++ b/core/objects.c
|
|
||||||
@@ -528,7 +528,7 @@ int object_getRegisterPayloadBufferLength(lwm2m_context_t * contextP)
|
|
||||||
size_t index;
|
|
||||||
int result;
|
|
||||||
lwm2m_object_t * objectP;
|
|
||||||
- char buffer[REG_OBJECT_MIN_LEN + 5];
|
|
||||||
+ uint8_t buffer[REG_OBJECT_MIN_LEN + 5];
|
|
||||||
|
|
||||||
LOG("Entering");
|
|
||||||
index = strlen(REG_START);
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
From 8a20d72f1cb54151995cb30f3650267f896e88d0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Wed, 29 Nov 2017 16:54:47 +0100
|
|
||||||
Subject: [PATCH 12/12] fixed warnings in liblwm2m.c
|
|
||||||
|
|
||||||
---
|
|
||||||
core/liblwm2m.c | 2 ++
|
|
||||||
1 file changed, 2 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/core/liblwm2m.c b/core/liblwm2m.c
|
|
||||||
index bf4b1b1..b7aafd7 100644
|
|
||||||
--- a/core/liblwm2m.c
|
|
||||||
+++ b/core/liblwm2m.c
|
|
||||||
@@ -365,7 +365,9 @@ int lwm2m_step(lwm2m_context_t * contextP,
|
|
||||||
time_t * timeoutP)
|
|
||||||
{
|
|
||||||
time_t tv_sec;
|
|
||||||
+#ifdef LWM2M_CLIENT_MODE
|
|
||||||
int result;
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
LOG_ARG("timeoutP: %" PRId64, *timeoutP);
|
|
||||||
tv_sec = lwm2m_gettime();
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
@ -1,101 +0,0 @@
|
|||||||
From 2ab2f722a18025be55f12f482975b66548ce307b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Tue, 9 Jan 2018 10:27:14 +0100
|
|
||||||
Subject: [PATCH] fixed warnings in example objects
|
|
||||||
|
|
||||||
---
|
|
||||||
examples/client/object_access_control.c | 2 +-
|
|
||||||
examples/client/object_security.c | 16 ----------------
|
|
||||||
examples/client/object_server.c | 22 ++++++----------------
|
|
||||||
3 files changed, 7 insertions(+), 33 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/examples/client/object_access_control.c b/examples/client/object_access_control.c
|
|
||||||
index 053546d..4a02438 100644
|
|
||||||
--- a/examples/client/object_access_control.c
|
|
||||||
+++ b/examples/client/object_access_control.c
|
|
||||||
@@ -261,7 +261,7 @@ static uint8_t prv_write_resources(uint16_t instanceId, int numData,
|
|
||||||
acc_ctrl_ri_t* acValListSave = accCtrlOiP->accCtrlValList;
|
|
||||||
accCtrlOiP->accCtrlValList = NULL;
|
|
||||||
|
|
||||||
- int ri;
|
|
||||||
+ unsigned int ri;
|
|
||||||
lwm2m_data_t* subTlvArray = tlvArray[i].value.asChildren.array;
|
|
||||||
|
|
||||||
if (tlvArray[i].value.asChildren.count == 0)
|
|
||||||
diff --git a/examples/client/object_security.c b/examples/client/object_security.c
|
|
||||||
index 901f92e..bfb5f85 100644
|
|
||||||
--- a/examples/client/object_security.c
|
|
||||||
+++ b/examples/client/object_security.c
|
|
||||||
@@ -479,22 +479,6 @@ void copy_security_object(lwm2m_object_t * objectDest, lwm2m_object_t * objectSr
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-void display_security_object(lwm2m_object_t * object)
|
|
||||||
-{
|
|
||||||
-#ifdef WITH_LOGS
|
|
||||||
- fprintf(stdout, " /%u: Security object, instances:\r\n", object->objID);
|
|
||||||
- security_instance_t * instance = (security_instance_t *)object->instanceList;
|
|
||||||
- while (instance != NULL)
|
|
||||||
- {
|
|
||||||
- fprintf(stdout, " /%u/%u: instanceId: %u, uri: %s, isBootstrap: %s, shortId: %u, clientHoldOffTime: %u\r\n",
|
|
||||||
- object->objID, instance->instanceId,
|
|
||||||
- instance->instanceId, instance->uri, instance->isBootstrap ? "true" : "false",
|
|
||||||
- instance->shortID, instance->clientHoldOffTime);
|
|
||||||
- instance = (security_instance_t *)instance->next;
|
|
||||||
- }
|
|
||||||
-#endif
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
void clean_security_object(lwm2m_object_t * objectP)
|
|
||||||
{
|
|
||||||
while (objectP->instanceList != NULL)
|
|
||||||
diff --git a/examples/client/object_server.c b/examples/client/object_server.c
|
|
||||||
index 2f0531e..d762c9b 100644
|
|
||||||
--- a/examples/client/object_server.c
|
|
||||||
+++ b/examples/client/object_server.c
|
|
||||||
@@ -150,6 +150,9 @@ static uint8_t prv_server_discover(uint16_t instanceId,
|
|
||||||
uint8_t result;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
+ (void)instanceId;
|
|
||||||
+ (void)objectP;
|
|
||||||
+
|
|
||||||
result = COAP_205_CONTENT;
|
|
||||||
|
|
||||||
// is the server asking for the full object ?
|
|
||||||
@@ -339,6 +342,9 @@ static uint8_t prv_server_execute(uint16_t instanceId,
|
|
||||||
{
|
|
||||||
server_instance_t * targetP;
|
|
||||||
|
|
||||||
+ (void)buffer;
|
|
||||||
+ (void)length;
|
|
||||||
+
|
|
||||||
targetP = (server_instance_t *)lwm2m_list_find(objectP->instanceList, instanceId);
|
|
||||||
if (NULL == targetP) return COAP_404_NOT_FOUND;
|
|
||||||
|
|
||||||
@@ -428,22 +434,6 @@ void copy_server_object(lwm2m_object_t * objectDest, lwm2m_object_t * objectSrc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-void display_server_object(lwm2m_object_t * object)
|
|
||||||
-{
|
|
||||||
-#ifdef WITH_LOGS
|
|
||||||
- fprintf(stdout, " /%u: Server object, instances:\r\n", object->objID);
|
|
||||||
- server_instance_t * serverInstance = (server_instance_t *)object->instanceList;
|
|
||||||
- while (serverInstance != NULL)
|
|
||||||
- {
|
|
||||||
- fprintf(stdout, " /%u/%u: instanceId: %u, shortServerId: %u, lifetime: %u, storing: %s, binding: %s\r\n",
|
|
||||||
- object->objID, serverInstance->instanceId,
|
|
||||||
- serverInstance->instanceId, serverInstance->shortServerId, serverInstance->lifetime,
|
|
||||||
- serverInstance->storing ? "true" : "false", serverInstance->binding);
|
|
||||||
- serverInstance = (server_instance_t *)serverInstance->next;
|
|
||||||
- }
|
|
||||||
-#endif
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
lwm2m_object_t * get_server_object(int serverId,
|
|
||||||
const char* binding,
|
|
||||||
int lifetime,
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
From 47d78e80ceb80a06e0cb9b0b7f7c959d04bd2c22 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Mon, 5 Feb 2018 15:52:10 +0100
|
|
||||||
Subject: [PATCH] Use lwm2m_strdup() instead of strdup()
|
|
||||||
|
|
||||||
---
|
|
||||||
examples/client/object_security.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/examples/client/object_security.c b/examples/client/object_security.c
|
|
||||||
index bfb5f85..d91f6e5 100644
|
|
||||||
--- a/examples/client/object_security.c
|
|
||||||
+++ b/examples/client/object_security.c
|
|
||||||
@@ -540,7 +540,7 @@ lwm2m_object_t * get_security_object(int serverId,
|
|
||||||
targetP->securityMode = LWM2M_SECURITY_MODE_PRE_SHARED_KEY;
|
|
||||||
if (bsPskId)
|
|
||||||
{
|
|
||||||
- targetP->publicIdentity = strdup(bsPskId);
|
|
||||||
+ targetP->publicIdentity = lwm2m_strdup(bsPskId);
|
|
||||||
targetP->publicIdLen = strlen(bsPskId);
|
|
||||||
}
|
|
||||||
if (pskLen > 0)
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
From 5d0fd8783b734e8adeec3b9393e84dc8f4f7eb1e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Christian Manal <moenoel@informatik.uni-bremen.de>
|
|
||||||
Date: Wed, 16 May 2018 11:30:02 +0200
|
|
||||||
Subject: [PATCH] fixed alignment problem in lwm2m_data_t
|
|
||||||
|
|
||||||
---
|
|
||||||
core/liblwm2m.h | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/core/liblwm2m.h b/core/liblwm2m.h
|
|
||||||
index 3f16a6d..53616bf 100644
|
|
||||||
--- a/core/liblwm2m.h
|
|
||||||
+++ b/core/liblwm2m.h
|
|
||||||
@@ -299,7 +299,6 @@ typedef struct _lwm2m_data_t lwm2m_data_t;
|
|
||||||
|
|
||||||
struct _lwm2m_data_t
|
|
||||||
{
|
|
||||||
- lwm2m_data_type_t type;
|
|
||||||
uint16_t id;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
@@ -322,6 +321,7 @@ struct _lwm2m_data_t
|
|
||||||
uint16_t objectInstanceId;
|
|
||||||
} asObjLink;
|
|
||||||
} value;
|
|
||||||
+ lwm2m_data_type_t type;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
--
|
|
||||||
2.1.4
|
|
||||||
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
From c3d723c0544b51dcea92453856447a4b9da6d288 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
|
||||||
Date: Mon, 4 Feb 2019 12:02:14 +0100
|
|
||||||
Subject: [PATCH] change liblwm2m.h include in er-coap-13.c
|
|
||||||
|
|
||||||
---
|
|
||||||
core/er-coap-13/er-coap-13.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/core/er-coap-13/er-coap-13.c b/core/er-coap-13/er-coap-13.c
|
|
||||||
index 7b9d43a..647bb88 100644
|
|
||||||
--- a/core/er-coap-13/er-coap-13.c
|
|
||||||
+++ b/core/er-coap-13/er-coap-13.c
|
|
||||||
@@ -46,7 +46,7 @@
|
|
||||||
|
|
||||||
#include "er-coap-13.h"
|
|
||||||
|
|
||||||
-#include "../liblwm2m.h" /* for lwm2m_malloc() and lwm2m_free() */
|
|
||||||
+#include "liblwm2m.h" /* for lwm2m_malloc() and lwm2m_free() */
|
|
||||||
|
|
||||||
#define DEBUG 0
|
|
||||||
#if DEBUG
|
|
||||||
--
|
|
||||||
2.17.1
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
From e3fcae282ad8c1788fd082dc5431cc71944e64da Mon Sep 17 00:00:00 2001
|
|
||||||
From: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
|
||||||
Date: Tue, 19 Feb 2019 17:36:50 +0100
|
|
||||||
Subject: [PATCH] fix access control object read
|
|
||||||
|
|
||||||
---
|
|
||||||
examples/client/object_access_control.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/examples/client/object_access_control.c b/examples/client/object_access_control.c
|
|
||||||
index e2b1f77..149ec24 100644
|
|
||||||
--- a/examples/client/object_access_control.c
|
|
||||||
+++ b/examples/client/object_access_control.c
|
|
||||||
@@ -95,7 +95,7 @@ static uint8_t prv_set_tlv(lwm2m_data_t* dataP, acc_ctrl_oi_t* accCtrlOiP)
|
|
||||||
subTlvP[ri].id = accCtrlRiP->resInstId;
|
|
||||||
lwm2m_data_encode_int(accCtrlRiP->accCtrlValue, &subTlvP[ri]);
|
|
||||||
}
|
|
||||||
- lwm2m_data_encode_instances(subTlvP, 2, dataP);
|
|
||||||
+ lwm2m_data_encode_instances(subTlvP, ri, dataP);
|
|
||||||
return COAP_205_CONTENT;
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
--
|
|
||||||
2.17.1
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
From 8c09cf9b771f4f4c856705f239529405dd20c303 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
|
||||||
Date: Wed, 20 Nov 2019 15:47:28 +0100
|
|
||||||
Subject: [PATCH 1/1] Fix log in lwm2m_configure.
|
|
||||||
|
|
||||||
This logs the parameters of lwm2m_configure only after checking that
|
|
||||||
they are not NULL pointers.
|
|
||||||
---
|
|
||||||
core/liblwm2m.c | 6 +++++-
|
|
||||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/core/liblwm2m.c b/core/liblwm2m.c
|
|
||||||
index a33f340..1dbcf7a 100644
|
|
||||||
--- a/core/liblwm2m.c
|
|
||||||
+++ b/core/liblwm2m.c
|
|
||||||
@@ -261,7 +261,6 @@ int lwm2m_configure(lwm2m_context_t * contextP,
|
|
||||||
int i;
|
|
||||||
uint8_t found;
|
|
||||||
|
|
||||||
- LOG_ARG("endpointName: \"%s\", msisdn: \"%s\", altPath: \"%s\", numObject: %d", endpointName, msisdn, altPath, numObject);
|
|
||||||
// This API can be called only once for now
|
|
||||||
if (contextP->endpointName != NULL || contextP->objectList != NULL) return COAP_400_BAD_REQUEST;
|
|
||||||
|
|
||||||
@@ -275,9 +274,12 @@ int lwm2m_configure(lwm2m_context_t * contextP,
|
|
||||||
if (objectList[i]->objID == LWM2M_SERVER_OBJECT_ID) found |= 0x02;
|
|
||||||
if (objectList[i]->objID == LWM2M_DEVICE_OBJECT_ID) found |= 0x04;
|
|
||||||
}
|
|
||||||
+ LOG_ARG("numObject: %d", numObject);
|
|
||||||
+
|
|
||||||
if (found != 0x07) return COAP_400_BAD_REQUEST;
|
|
||||||
if (altPath != NULL)
|
|
||||||
{
|
|
||||||
+ LOG_ARG("altPath: \"%s\"", altPath);
|
|
||||||
if (0 == utils_isAltPathValid(altPath))
|
|
||||||
{
|
|
||||||
return COAP_400_BAD_REQUEST;
|
|
||||||
@@ -292,9 +294,11 @@ int lwm2m_configure(lwm2m_context_t * contextP,
|
|
||||||
{
|
|
||||||
return COAP_500_INTERNAL_SERVER_ERROR;
|
|
||||||
}
|
|
||||||
+ LOG_ARG("endpointName: \"%s\"", endpointName);
|
|
||||||
|
|
||||||
if (msisdn != NULL)
|
|
||||||
{
|
|
||||||
+ LOG_ARG("msisdn: \"%s\"", msisdn);
|
|
||||||
contextP->msisdn = lwm2m_strdup(msisdn);
|
|
||||||
if (contextP->msisdn == NULL)
|
|
||||||
{
|
|
||||||
--
|
|
||||||
2.20.1
|
|
||||||
|
|
||||||
@ -1,90 +0,0 @@
|
|||||||
From 9f22d187cbd8a692b340aa6961ccfffde67fda9d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
|
||||||
Date: Tue, 26 Nov 2019 13:18:36 +0100
|
|
||||||
Subject: [PATCH 1/1] Fix multiple log of strings
|
|
||||||
|
|
||||||
---
|
|
||||||
core/data.c | 4 +++-
|
|
||||||
core/json.c | 4 +++-
|
|
||||||
core/transaction.c | 6 ++++--
|
|
||||||
core/uri.c | 8 +++++---
|
|
||||||
4 files changed, 15 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/core/data.c b/core/data.c
|
|
||||||
index 824d9bf..e4dc154 100644
|
|
||||||
--- a/core/data.c
|
|
||||||
+++ b/core/data.c
|
|
||||||
@@ -255,7 +255,9 @@ void lwm2m_data_encode_nstring(const char * string,
|
|
||||||
size_t length,
|
|
||||||
lwm2m_data_t * dataP)
|
|
||||||
{
|
|
||||||
- LOG_ARG("length: %d, string: \"%s\"", length, string);
|
|
||||||
+ if (string) {
|
|
||||||
+ LOG_ARG("length: %d, string: \"%s\"", length, string);
|
|
||||||
+ }
|
|
||||||
lwm2m_data_encode_opaque((uint8_t *)string, length, dataP);
|
|
||||||
|
|
||||||
if (dataP->type == LWM2M_TYPE_OPAQUE)
|
|
||||||
diff --git a/core/json.c b/core/json.c
|
|
||||||
index 459fe9d..91562ce 100644
|
|
||||||
--- a/core/json.c
|
|
||||||
+++ b/core/json.c
|
|
||||||
@@ -768,7 +768,9 @@ int json_parse(lwm2m_uri_t * uriP,
|
|
||||||
_record_t * recordArray;
|
|
||||||
lwm2m_data_t * parsedP;
|
|
||||||
|
|
||||||
- LOG_ARG("bufferLen: %d, buffer: \"%s\"", bufferLen, (char *)buffer);
|
|
||||||
+ if (buffer) {
|
|
||||||
+ LOG_ARG("bufferLen: %d, buffer: \"%s\"", bufferLen, (char *)buffer);
|
|
||||||
+ }
|
|
||||||
LOG_URI(uriP);
|
|
||||||
*dataP = NULL;
|
|
||||||
recordArray = NULL;
|
|
||||||
diff --git a/core/transaction.c b/core/transaction.c
|
|
||||||
index de78b83..1749003 100644
|
|
||||||
--- a/core/transaction.c
|
|
||||||
+++ b/core/transaction.c
|
|
||||||
@@ -152,8 +152,10 @@ lwm2m_transaction_t * transaction_new(void * sessionH,
|
|
||||||
lwm2m_transaction_t * transacP;
|
|
||||||
int result;
|
|
||||||
|
|
||||||
- LOG_ARG("method: %d, altPath: \"%s\", mID: %d, token_len: %d",
|
|
||||||
- method, altPath, mID, token_len);
|
|
||||||
+ LOG_ARG("method: %d, mID: %d, token_len: %d", method, mID, token_len);
|
|
||||||
+ if (altPath) {
|
|
||||||
+ LOG_ARG("altPath: \"%s\"", altPath);
|
|
||||||
+ }
|
|
||||||
LOG_URI(uriP);
|
|
||||||
|
|
||||||
// no transactions without peer
|
|
||||||
diff --git a/core/uri.c b/core/uri.c
|
|
||||||
index bfe0a48..4f2ecae 100644
|
|
||||||
--- a/core/uri.c
|
|
||||||
+++ b/core/uri.c
|
|
||||||
@@ -99,7 +99,9 @@ lwm2m_uri_t * uri_decode(char * altPath,
|
|
||||||
lwm2m_uri_t * uriP;
|
|
||||||
int readNum;
|
|
||||||
|
|
||||||
- LOG_ARG("altPath: \"%s\"", altPath);
|
|
||||||
+ if (altPath) {
|
|
||||||
+ LOG_ARG("altPath: \"%s\"", altPath);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
uriP = (lwm2m_uri_t *)lwm2m_malloc(sizeof(lwm2m_uri_t));
|
|
||||||
if (NULL == uriP) return NULL;
|
|
||||||
@@ -212,10 +214,10 @@ int lwm2m_stringToUri(const char * buffer,
|
|
||||||
size_t head;
|
|
||||||
int readNum;
|
|
||||||
|
|
||||||
- LOG_ARG("buffer_len: %u, buffer: \"%.*s\"", buffer_len, buffer_len, buffer);
|
|
||||||
-
|
|
||||||
if (buffer == NULL || buffer_len == 0 || uriP == NULL) return 0;
|
|
||||||
|
|
||||||
+ LOG_ARG("buffer_len: %u, buffer: \"%.*s\"", buffer_len, buffer_len, buffer);
|
|
||||||
+
|
|
||||||
memset(uriP, 0, sizeof(lwm2m_uri_t));
|
|
||||||
|
|
||||||
// Skip any white space
|
|
||||||
--
|
|
||||||
2.20.1
|
|
||||||
|
|
||||||
@ -1,95 +0,0 @@
|
|||||||
From 9a02f0d63cb14e7e6b195550882dd8363183e22c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
|
||||||
Date: Fri, 29 Nov 2019 18:17:54 +0100
|
|
||||||
Subject: [PATCH 1/1] Add logging function for 64-bits values
|
|
||||||
|
|
||||||
---
|
|
||||||
core/data.c | 6 ++++--
|
|
||||||
core/internals.h | 13 +++++++++++++
|
|
||||||
core/liblwm2m.c | 6 ++++--
|
|
||||||
3 files changed, 21 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/core/data.c b/core/data.c
|
|
||||||
index e4dc154..d304410 100644
|
|
||||||
--- a/core/data.c
|
|
||||||
+++ b/core/data.c
|
|
||||||
@@ -269,7 +269,8 @@ void lwm2m_data_encode_nstring(const char * string,
|
|
||||||
void lwm2m_data_encode_int(int64_t value,
|
|
||||||
lwm2m_data_t * dataP)
|
|
||||||
{
|
|
||||||
- LOG_ARG("value: %" PRId64 "", value);
|
|
||||||
+ LOG("value: ");
|
|
||||||
+ LOG_VALUE("%" PRId64, value);
|
|
||||||
dataP->type = LWM2M_TYPE_INTEGER;
|
|
||||||
dataP->value.asInteger = value;
|
|
||||||
}
|
|
||||||
@@ -334,7 +335,8 @@ int lwm2m_data_decode_int(const lwm2m_data_t * dataP,
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
- LOG_ARG("result: %d, value: %" PRId64, result, *valueP);
|
|
||||||
+ LOG_ARG("result: %d, value: ", result);
|
|
||||||
+ LOG_VALUE("%" PRId64, *valueP);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
diff --git a/core/internals.h b/core/internals.h
|
|
||||||
index 08e951c..84c841f 100644
|
|
||||||
--- a/core/internals.h
|
|
||||||
+++ b/core/internals.h
|
|
||||||
@@ -71,8 +71,20 @@
|
|
||||||
|
|
||||||
#ifdef LWM2M_WITH_LOGS
|
|
||||||
#include <inttypes.h>
|
|
||||||
+#include "fmt.h"
|
|
||||||
#define LOG(STR) lwm2m_printf("[%s:%d] " STR "\r\n", __func__ , __LINE__)
|
|
||||||
#define LOG_ARG(FMT, ...) lwm2m_printf("[%s:%d] " FMT "\r\n", __func__ , __LINE__ , __VA_ARGS__)
|
|
||||||
+/* Log a single value. Use this for 64-bits numbers */
|
|
||||||
+#define LOG_VALUE(FMT, VALUE) \
|
|
||||||
+{ \
|
|
||||||
+ if (!strcmp(FMT, "%"PRId64)) \
|
|
||||||
+ { \
|
|
||||||
+ char int64_str[20]; \
|
|
||||||
+ int64_str[fmt_s64_dec(int64_str, (VALUE))] = '\0'; \
|
|
||||||
+ lwm2m_printf("[%s:%d] %s \r\n", __func__ , __LINE__ , int64_str); \
|
|
||||||
+ } \
|
|
||||||
+ else lwm2m_printf("[%s:%d] " FMT "\r\n", __func__ , __LINE__ , (VALUE)); \
|
|
||||||
+}
|
|
||||||
#define LOG_URI(URI) \
|
|
||||||
{ \
|
|
||||||
if ((URI) == NULL) lwm2m_printf("[%s:%d] NULL\r\n", __func__ , __LINE__); \
|
|
||||||
@@ -119,6 +131,7 @@
|
|
||||||
#else
|
|
||||||
#define LOG_ARG(FMT, ...)
|
|
||||||
#define LOG(STR)
|
|
||||||
+#define LOG_VALUE(FMT, VALUE)
|
|
||||||
#define LOG_URI(URI)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
diff --git a/core/liblwm2m.c b/core/liblwm2m.c
|
|
||||||
index 1dbcf7a..140a85a 100644
|
|
||||||
--- a/core/liblwm2m.c
|
|
||||||
+++ b/core/liblwm2m.c
|
|
||||||
@@ -373,7 +373,8 @@ int lwm2m_step(lwm2m_context_t * contextP,
|
|
||||||
int result;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
- LOG_ARG("timeoutP: %" PRId64, *timeoutP);
|
|
||||||
+ LOG("timeoutP: ");
|
|
||||||
+ LOG_VALUE("%" PRId64, *timeoutP);
|
|
||||||
tv_sec = lwm2m_gettime();
|
|
||||||
if (tv_sec < 0) return COAP_500_INTERNAL_SERVER_ERROR;
|
|
||||||
|
|
||||||
@@ -481,7 +482,8 @@ next_step:
|
|
||||||
registration_step(contextP, tv_sec, timeoutP);
|
|
||||||
transaction_step(contextP, tv_sec, timeoutP);
|
|
||||||
|
|
||||||
- LOG_ARG("Final timeoutP: %" PRId64, *timeoutP);
|
|
||||||
+ LOG("Final timeoutP:");
|
|
||||||
+ LOG_VALUE("%" PRId64, *timeoutP);
|
|
||||||
#ifdef LWM2M_CLIENT_MODE
|
|
||||||
LOG_ARG("Final state: %s", STR_STATE(contextP->state));
|
|
||||||
#endif
|
|
||||||
--
|
|
||||||
2.20.1
|
|
||||||
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
From 2cd3bcccd3d60b90847e498d402c81ceb7e41328 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
|
||||||
Date: Fri, 29 Nov 2019 20:18:12 +0100
|
|
||||||
Subject: [PATCH 1/1] Fix warnings in discover.c
|
|
||||||
|
|
||||||
---
|
|
||||||
core/discover.c | 3 ++-
|
|
||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/core/discover.c b/core/discover.c
|
|
||||||
index a4947c7..c877769 100644
|
|
||||||
--- a/core/discover.c
|
|
||||||
+++ b/core/discover.c
|
|
||||||
@@ -439,4 +439,5 @@ int discover_serialize(lwm2m_context_t * contextP,
|
|
||||||
|
|
||||||
return (int)head;
|
|
||||||
}
|
|
||||||
-#endif
|
|
||||||
\ No newline at end of file
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
--
|
|
||||||
2.20.1
|
|
||||||
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
From 0ee68890355c4ebd15323511c46ff109ad106d49 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
|
||||||
Date: Fri, 5 Feb 2021 16:17:20 +0100
|
|
||||||
Subject: [PATCH] core/registration: cast to time_t
|
|
||||||
|
|
||||||
---
|
|
||||||
core/registration.c | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/core/registration.c b/core/registration.c
|
|
||||||
index 03fa851..aed3607 100644
|
|
||||||
--- a/core/registration.c
|
|
||||||
+++ b/core/registration.c
|
|
||||||
@@ -1313,9 +1313,9 @@ void registration_step(lwm2m_context_t * contextP,
|
|
||||||
time_t interval;
|
|
||||||
|
|
||||||
nextUpdate = targetP->lifetime;
|
|
||||||
- if (COAP_MAX_TRANSMIT_WAIT < nextUpdate)
|
|
||||||
+ if ((time_t)COAP_MAX_TRANSMIT_WAIT < nextUpdate)
|
|
||||||
{
|
|
||||||
- nextUpdate -= COAP_MAX_TRANSMIT_WAIT;
|
|
||||||
+ nextUpdate -= (time_t)COAP_MAX_TRANSMIT_WAIT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
--
|
|
||||||
2.30.0
|
|
||||||
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
From 92a5ae1f4289715546340ffcb31ac24e94a33efa Mon Sep 17 00:00:00 2001
|
|
||||||
From: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
|
||||||
Date: Thu, 25 Mar 2021 13:12:49 +0100
|
|
||||||
Subject: [PATCH] er-coap-13: cast COAP_EXCHANGE_LIFETIME to time_t
|
|
||||||
|
|
||||||
---
|
|
||||||
core/er-coap-13/er-coap-13.h | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/core/er-coap-13/er-coap-13.h b/core/er-coap-13/er-coap-13.h
|
|
||||||
index 495f49e..21af2af 100644
|
|
||||||
--- a/core/er-coap-13/er-coap-13.h
|
|
||||||
+++ b/core/er-coap-13/er-coap-13.h
|
|
||||||
@@ -62,7 +62,7 @@
|
|
||||||
|
|
||||||
#define COAP_MAX_TRANSMIT_WAIT ((COAP_RESPONSE_TIMEOUT * ( (1 << (COAP_MAX_RETRANSMIT + 1) ) - 1) * COAP_ACK_RANDOM_FACTOR))
|
|
||||||
#define COAP_MAX_TRANSMIT_SPAN ((COAP_RESPONSE_TIMEOUT * ( (1 << COAP_MAX_RETRANSMIT) - 1) * COAP_ACK_RANDOM_FACTOR))
|
|
||||||
-#define COAP_EXCHANGE_LIFETIME (COAP_MAX_TRANSMIT_SPAN + (2 * COAP_MAX_LATENCY) + COAP_PROCESSING_DELAY)
|
|
||||||
+#define COAP_EXCHANGE_LIFETIME (time_t)(COAP_MAX_TRANSMIT_SPAN + (2 * COAP_MAX_LATENCY) + COAP_PROCESSING_DELAY)
|
|
||||||
|
|
||||||
#define COAP_HEADER_LEN 4 /* | version:0x03 type:0x0C tkl:0xF0 | code | mid:0x00FF | mid:0xFF00 | */
|
|
||||||
#define COAP_ETAG_LEN 8 /* The maximum number of bytes for the ETag */
|
|
||||||
--
|
|
||||||
2.31.0
|
|
||||||
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
From 4cf9ceba3052b385eb2378e474307e1eb4b90aac Mon Sep 17 00:00:00 2001
|
|
||||||
From: Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
|
||||||
Date: Thu, 1 Feb 2024 10:23:27 +0100
|
|
||||||
Subject: [PATCH 1/1] Add const modifier to URI on lwm2m_resource_value_changed
|
|
||||||
|
|
||||||
---
|
|
||||||
core/liblwm2m.h | 2 +-
|
|
||||||
core/observe.c | 2 +-
|
|
||||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/core/liblwm2m.h b/core/liblwm2m.h
|
|
||||||
index 15fac32..4a439b7 100644
|
|
||||||
--- a/core/liblwm2m.h
|
|
||||||
+++ b/core/liblwm2m.h
|
|
||||||
@@ -696,7 +696,7 @@ int lwm2m_remove_object(lwm2m_context_t * contextP, uint16_t id);
|
|
||||||
// If withObjects is true, the registration update contains the object list.
|
|
||||||
int lwm2m_update_registration(lwm2m_context_t * contextP, uint16_t shortServerID, bool withObjects);
|
|
||||||
|
|
||||||
-void lwm2m_resource_value_changed(lwm2m_context_t * contextP, lwm2m_uri_t * uriP);
|
|
||||||
+void lwm2m_resource_value_changed(lwm2m_context_t * contextP, const lwm2m_uri_t * uriP);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LWM2M_SERVER_MODE
|
|
||||||
diff --git a/core/observe.c b/core/observe.c
|
|
||||||
index 308448d..3494799 100644
|
|
||||||
--- a/core/observe.c
|
|
||||||
+++ b/core/observe.c
|
|
||||||
@@ -445,7 +445,7 @@ lwm2m_observed_t * observe_findByUri(lwm2m_context_t * contextP,
|
|
||||||
}
|
|
||||||
|
|
||||||
void lwm2m_resource_value_changed(lwm2m_context_t * contextP,
|
|
||||||
- lwm2m_uri_t * uriP)
|
|
||||||
+ const lwm2m_uri_t * uriP)
|
|
||||||
{
|
|
||||||
lwm2m_observed_t * targetP;
|
|
||||||
|
|
||||||
--
|
|
||||||
2.43.0
|
|
||||||
|
|
||||||
8
pkg/wakaama/wakaama_data.mk
Normal file
8
pkg/wakaama/wakaama_data.mk
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
MODULE = wakaama_data
|
||||||
|
|
||||||
|
SRC = \
|
||||||
|
data.c \
|
||||||
|
tlv.c \
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(RIOTBASE)/Makefile.base
|
||||||
Loading…
x
Reference in New Issue
Block a user