net: lib: lwm2m: Replace deprecated function calls
Replace calls to deprecated functions with new ones. Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
This commit is contained in:
parent
3b3463ecba
commit
abafd7e810
10 changed files with 96 additions and 130 deletions
|
@ -100,7 +100,8 @@ static int get_buzzer_index(uint16_t obj_inst_id)
|
|||
static int start_buzzer(struct ipso_buzzer_data *buzzer)
|
||||
{
|
||||
uint32_t temp = 0U;
|
||||
char path[MAX_RESOURCE_LEN];
|
||||
struct lwm2m_obj_path path = LWM2M_OBJ(IPSO_OBJECT_BUZZER_ID, buzzer->obj_inst_id,
|
||||
DIGITAL_INPUT_STATE_RID);
|
||||
|
||||
/* make sure buzzer is currently not active */
|
||||
if (buzzer->active) {
|
||||
|
@ -116,9 +117,7 @@ static int start_buzzer(struct ipso_buzzer_data *buzzer)
|
|||
/* TODO: check delay_duration > 0 */
|
||||
|
||||
buzzer->trigger_offset = k_uptime_get();
|
||||
snprintk(path, MAX_RESOURCE_LEN, "%d/%u/%d", IPSO_OBJECT_BUZZER_ID,
|
||||
buzzer->obj_inst_id, DIGITAL_INPUT_STATE_RID);
|
||||
lwm2m_engine_set_bool(path, true);
|
||||
lwm2m_set_bool(&path, true);
|
||||
|
||||
temp = (uint32_t)(buzzer->delay_duration * MSEC_PER_SEC);
|
||||
k_work_reschedule(&buzzer->buzzer_work, K_MSEC(temp));
|
||||
|
@ -128,16 +127,15 @@ static int start_buzzer(struct ipso_buzzer_data *buzzer)
|
|||
|
||||
static int stop_buzzer(struct ipso_buzzer_data *buzzer, bool cancel)
|
||||
{
|
||||
char path[MAX_RESOURCE_LEN];
|
||||
struct lwm2m_obj_path path = LWM2M_OBJ(IPSO_OBJECT_BUZZER_ID, buzzer->obj_inst_id,
|
||||
DIGITAL_INPUT_STATE_RID);
|
||||
|
||||
/* make sure buzzer is currently active */
|
||||
if (!buzzer->active) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snprintk(path, MAX_RESOURCE_LEN, "%d/%u/%d", IPSO_OBJECT_BUZZER_ID,
|
||||
buzzer->obj_inst_id, DIGITAL_INPUT_STATE_RID);
|
||||
lwm2m_engine_set_bool(path, false);
|
||||
lwm2m_set_bool(&path, false);
|
||||
|
||||
if (cancel) {
|
||||
k_work_cancel_delayable(&buzzer->buzzer_work);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue