1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/pkg/wakaama/contrib/lwm2m_client_objects.c
Leandro Lanzieri c392a4ad34
pkg/wakaama: Move configurations to 'CONFIG_' namespace
Macros that changed:
LWM2M_STANDARD_PORT -> CONFIG_LWM2M_STANDARD_PORT
LWM2M_DTLS_PORT -> CONFIG_LWM2M_DTLS_PORT
LWM2M_BSSERVER_PORT -> CONFIG_LWM2M_BSSERVER_PORT
LWM2M_LOCAL_PORT -> CONFIG_LWM2M_LOCAL_PORT
LWM2M_DEVICE_NAME -> CONFIG_LWM2M_DEVICE_NAME
LWM2M_DEVICE_TTL -> CONFIG_LWM2M_DEVICE_TTL
LWM2M_SERVER_URI -> CONFIG_LWM2M_SERVER_URI
LWM2M_SERVER_ID -> CONFIG_LWM2M_SERVER_ID
LWM2M_ALT_PATH -> CONFIG_LWM2M_ALT_PATH
LWM2M_BOOTSTRAP -> CONFIG_LWM2M_BOOTSTRAP
LWM2M_DEVICE_MANUFACTURER -> CONFIG_LWM2M_DEVICE_MANUFACTURER
LWM2M_DEVICE_MODEL -> CONFIG_LWM2M_DEVICE_MODEL
LWM2M_DEVICE_SERIAL -> CONFIG_LWM2M_DEVICE_SERIAL
LWM2M_DEVICE_FW_VERSION -> CONFIG_LWM2M_DEVICE_FW_VERSION
LWM2M_DEVICE_BINDINGS -> CONFIG_LWM2M_DEVICE_BINDINGS
LWM2M_DEVICE_TYPE -> CONFIG_LWM2M_DEVICE_TYPE
LWM2M_DEVICE_HW_VERSION -> CONFIG_LWM2M_DEVICE_HW_VERSION
LWM2M_DEVICE_SW_VERSION -> CONFIG_LWM2M_DEVICE_SW_VERSION
LWM2M_WITH_LOGS -> CONFIG_LWM2M_WITH_LOGS
2020-04-07 16:28:55 +02:00

73 lines
2.2 KiB
C

/*
* Copyright (C) 2019 HAW Hamburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @{
* @ingroup lwm2m_client
*
* @file
* @brief Helper functions to interact with the basic objects provided by
* Wakaama from a LwM2M client.
*
* @author Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
* @}
*/
#include "kernel_defines.h"
#include "lwm2m_client.h"
#include "lwm2m_client_config.h"
#include "lwm2m_client_objects.h"
/* These functions are defined by the objects (object_security.c and
* object_server.c are implemented by the Wakaama package. device.c can be
* found in 'contrib/objects') */
lwm2m_object_t *get_security_object(int server_id, const char *server_uri,
char *bs_psk_id, char *psk,
uint16_t psk_len, bool is_bootstrap);
lwm2m_object_t *get_server_object(int server_id, const char *binding,
int lifetime, bool storing);
lwm2m_object_t *lwm2m_get_object_device(void);
lwm2m_object_t *lwm2m_client_get_security_object(
lwm2m_client_data_t *client_data)
{
lwm2m_object_t *ret;
char *server_uri = CONFIG_LWM2M_SERVER_URI;
int server_id = CONFIG_LWM2M_SERVER_ID;
uint16_t psk_len = -1;
char *psk_buffer = NULL;
char *psk_id = NULL;
ret = get_security_object(server_id, server_uri, psk_id, psk_buffer,
psk_len, IS_ACTIVE(CONFIG_LWM2M_BOOTSTRAP));
client_data->obj_security = ret;
return ret;
}
lwm2m_object_t *lwm2m_client_get_server_object(
lwm2m_client_data_t *client_data)
{
(void)client_data;
lwm2m_object_t *ret;
int server_id = CONFIG_LWM2M_SERVER_ID;
int lifetime = CONFIG_LWM2M_DEVICE_TTL;
ret = get_server_object(server_id, CONFIG_LWM2M_DEVICE_BINDINGS, lifetime,
false);
return ret;
}
lwm2m_object_t *lwm2m_client_get_device_object(
lwm2m_client_data_t *client_data)
{
(void)client_data;
return lwm2m_get_object_device();
}