Contiki 3.x
lwm2m-engine.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Yanzi Networks AB.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the copyright holder nor the names of its
14  * contributors may be used to endorse or promote products derived
15  * from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28  * OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 /**
32  * \addtogroup oma-lwm2m
33  * @{
34  */
35 
36 /**
37  * \file
38  * Header file for the Contiki OMA LWM2M engine
39  * \author
40  * Joakim Eriksson <joakime@sics.se>
41  * Niclas Finne <nfi@sics.se>
42  */
43 
44 #ifndef LWM2M_ENGINE_H
45 #define LWM2M_ENGINE_H
46 
47 #include "lwm2m-object.h"
48 
49 #define LWM2M_FLOAT32_BITS 10
50 #define LWM2M_FLOAT32_FRAC (1L << LWM2M_FLOAT32_BITS)
51 
52 /* LWM2M / CoAP Content-Formats */
53 typedef enum {
54  LWM2M_TEXT_PLAIN = 1541,
55  LWM2M_TLV = 1542,
56  LWM2M_JSON = 1543,
57  LWM2M_OPAQUE = 1544
58 } lwm2m_content_format_t;
59 
60 void lwm2m_engine_init(void);
61 void lwm2m_engine_register_default_objects(void);
62 void lwm2m_engine_use_bootstrap_server(int use);
63 void lwm2m_engine_use_registration_server(int use);
64 void lwm2m_engine_register_with_server(const uip_ipaddr_t *server, uint16_t port);
65 void lwm2m_engine_register_with_bootstrap_server(const uip_ipaddr_t *server, uint16_t port);
66 
67 const lwm2m_object_t *lwm2m_engine_get_object(uint16_t id);
68 
69 int lwm2m_engine_register_object(const lwm2m_object_t *object);
70 
71 void lwm2m_engine_handler(const lwm2m_object_t *object,
72  void *request, void *response,
73  uint8_t *buffer, uint16_t preferred_size,
74  int32_t *offset);
75 
76 void lwm2m_engine_delete_handler(const lwm2m_object_t *object,
77  void *request, void *response,
78  uint8_t *buffer, uint16_t preferred_size,
79  int32_t *offset);
80 
81 #endif /* LWM2M_ENGINE_H */
82 /** @} */
Header file for the Contiki OMA LWM2M object API