1 /* 2 * Copyright (c) 2017 Linaro Limited 3 * Copyright (c) 2018-2019 Foundries.io 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8 /* 9 * Copyright (c) 2016, SICS Swedish ICT AB. 10 * All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 3. Neither the name of the copyright holder nor the names of its 21 * contributors may be used to endorse or promote products derived 22 * from this software without specific prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS 25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 28 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 33 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 35 * OF THE POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38 #ifndef LWM2M_RD_CLIENT_H 39 #define LWM2M_RD_CLIENT_H 40 41 #include <zephyr/net/lwm2m.h> /* struct lwm2m_ctx */ 42 43 int lwm2m_rd_client_init(void); 44 void engine_trigger_update(bool update_objects); 45 int engine_trigger_bootstrap(void); 46 int lwm2m_rd_client_pause(void); 47 int lwm2m_rd_client_resume(void); 48 49 int lwm2m_rd_client_timeout(struct lwm2m_ctx *client_ctx); 50 bool lwm2m_rd_client_is_registred(struct lwm2m_ctx *client_ctx); 51 bool lwm2m_rd_client_is_suspended(struct lwm2m_ctx *client_ctx); 52 #if defined(CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP) 53 void engine_bootstrap_finish(void); 54 #endif 55 int lwm2m_rd_client_connection_resume(struct lwm2m_ctx *client_ctx); 56 void engine_update_tx_time(void); 57 struct lwm2m_message *lwm2m_get_ongoing_rd_msg(void); 58 59 /** 60 * @brief Notify RD client that this server is disabled. 61 * 62 * This may return error -EPERM, if RD client is not registered on that server. 63 * 64 * @param inst_id server instance id 65 * @return int 0 on success, negative errno on failure. 66 */ 67 int lwm2m_rd_client_server_disabled(uint16_t inst_id); 68 69 /** 70 * @brief Set client context for the RD client. 71 * 72 * For testing purposes, it might be required to set the client context 73 * without starting the RD client. 74 * 75 * @param ctx context 76 */ 77 void lwm2m_rd_client_set_ctx(struct lwm2m_ctx *ctx); 78 79 #endif /* LWM2M_RD_CLIENT_H */ 80