net: lwm2m: Remove deprecated functions

Remove deprecated functions that have been marked deprecated since
Zephyr 2.0.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-06-08 10:51:36 -05:00 committed by Jukka Rissanen
commit 59708769ea
2 changed files with 1 additions and 151 deletions

View file

@ -183,8 +183,7 @@ typedef int (*lwm2m_engine_user_cb_t)(uint16_t obj_inst_id);
/**
* @brief Power source types used for the "Available Power Sources" resource of
* the LwM2M Device object. An LwM2M client can use one of the following
* codes to register a power source using lwm2m_device_add_pwrsrc().
* the LwM2M Device object.
*/
#define LWM2M_DEVICE_PWR_SRC_TYPE_DC_POWER 0
#define LWM2M_DEVICE_PWR_SRC_TYPE_BAT_INT 1
@ -225,48 +224,6 @@ typedef int (*lwm2m_engine_user_cb_t)(uint16_t obj_inst_id);
#define LWM2M_DEVICE_BATTERY_STATUS_NOT_INST 5
#define LWM2M_DEVICE_BATTERY_STATUS_UNKNOWN 6
/**
* @brief Register a power source with the LwM2M Device object.
*
* @param[in] pwr_src_type Power source type code.
*
* @return The newly added index of the power source. The index is used
* for removing the power source, setting voltage or setting current.
*/
__deprecated int lwm2m_device_add_pwrsrc(uint8_t pwr_src_type);
/**
* @brief Remove power source previously registered in the LwM2M Device object.
*
* @param[in] index Index of the power source returned by
* lwm2m_device_add_pwrsrc().
*
* @return 0 for success or negative in case of error.
*/
__deprecated int lwm2m_device_remove_pwrsrc(int index);
/**
* @brief Set power source voltage (in millivolts).
*
* @param[in] index Index of the power source returned by
* lwm2m_device_add_pwrsrc().
* @param[in] voltage_mv New voltage in millivolts.
*
* @return 0 for success or negative in case of error.
*/
__deprecated int lwm2m_device_set_pwrsrc_voltage_mv(int index, int voltage_mv);
/**
* @brief Set power source current (in milliamps).
*
* @param[in] index Index of the power source returned by
* lwm2m_device_add_pwrsrc().
* @param[in] current_ma New current value milliamps.
*
* @return 0 for success or negative in case of error.
*/
__deprecated int lwm2m_device_set_pwrsrc_current_ma(int index, int current_ma);
/**
* @brief Register a new error code with LwM2M Device object.
*

View file

@ -163,113 +163,6 @@ static int current_time_post_write_cb(uint16_t obj_inst_id, uint16_t res_id,
return -EINVAL;
}
/* special setter functions */
__deprecated int lwm2m_device_add_pwrsrc(uint8_t pwrsrc_type)
{
int i;
struct lwm2m_engine_res *res;
if (pwrsrc_type >= LWM2M_DEVICE_PWR_SRC_TYPE_MAX) {
LOG_ERR("power source id %d is invalid", pwrsrc_type);
return -EINVAL;
}
i = lwm2m_engine_get_resource("3/0/6", &res);
if (i < 0 || !res || !res->res_instances) {
return -ENOENT;
}
for (i = 0; i < res->res_inst_count; i++) {
if (res->res_instances[i].res_inst_id ==
RES_INSTANCE_NOT_CREATED &&
res->res_instances[i].data_ptr != NULL) {
break;
}
}
if (i >= res->res_inst_count) {
return -ENOMEM;
}
*(uint8_t *)res->res_instances[i].data_ptr = pwrsrc_type;
res->res_instances[i].res_inst_id = i;
NOTIFY_OBSERVER(LWM2M_OBJECT_DEVICE_ID, 0,
DEVICE_AVAILABLE_POWER_SOURCES_ID);
return 0;
}
/*
* TODO: this will disable the index, but current printing function expects
* all indexes to be in order up to pwrsrc_count
*/
__deprecated int lwm2m_device_remove_pwrsrc(int index)
{
int ret;
struct lwm2m_engine_res *res;
ret = lwm2m_engine_get_resource("3/0/6", &res);
if (ret < 0 || !res || !res->res_instances) {
return -ENOENT;
}
if (index >= res->res_inst_count) {
LOG_ERR("index %d is invalid", index);
return -EINVAL;
}
if (res->res_instances[index].res_inst_id ==
RES_INSTANCE_NOT_CREATED ||
!res->res_instances[index].data_ptr) {
return -ENOMEM;
}
*(uint8_t *)res->res_instances[index].data_ptr = 0;
res->res_instances[index].res_inst_id = RES_INSTANCE_NOT_CREATED;
NOTIFY_OBSERVER(LWM2M_OBJECT_DEVICE_ID, 0,
DEVICE_AVAILABLE_POWER_SOURCES_ID);
return 0;
}
static int device_set_pwrsrc_value(char *pathstr, int index, int32_t value)
{
int ret;
struct lwm2m_engine_res *res;
ret = lwm2m_engine_get_resource(pathstr, &res);
if (ret < 0 || !res || !res->res_instances) {
return -ENOENT;
}
if (index >= res->res_inst_count) {
LOG_ERR("index %d is invalid", index);
return -EINVAL;
}
if (res->res_instances[index].res_inst_id ==
RES_INSTANCE_NOT_CREATED ||
!res->res_instances[index].data_ptr) {
return -ENOMEM;
}
*(int32_t *)res->res_instances[index].data_ptr = value;
NOTIFY_OBSERVER(LWM2M_OBJECT_DEVICE_ID, 0, res->res_id);
return 0;
}
__deprecated int lwm2m_device_set_pwrsrc_voltage_mv(int index, int voltage_mv)
{
return device_set_pwrsrc_value("3/0/7", index, voltage_mv);
}
__deprecated int lwm2m_device_set_pwrsrc_current_ma(int index, int current_ma)
{
return device_set_pwrsrc_value("3/0/8", index, current_ma);
}
/* error code function */
int lwm2m_device_add_err(uint8_t error_code)