Mistake on this page? Email us
dmc_connect_api.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // Copyright 2019-2020 ARM Ltd.
3 //
4 // SPDX-License-Identifier: Apache-2.0
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 // ----------------------------------------------------------------------------
18 
19 #ifndef __DMC_CONNECT_API_H__
20 #define __DMC_CONNECT_API_H__
21 
26 #include "lwm2m_interface.h"
27 #include "lwm2m_registry.h"
28 
29 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE
30 #include "dmc_update_api.h"
31 #endif
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
41 typedef enum {
45 
49 typedef struct pdmc_endpoint_info_ {
50  char endpoint_name[MAX_ALLOWED_STRING_LENGTH];
51  char device_id[MAX_ALLOWED_STRING_LENGTH];
53 
54 /***
55  * The normal sequence of use:
56  * -# pdmc_connect_init
57  * -# lwm2m_interface_t* if = pdmc_connect_get_interface
58  * -# registry_t* reg = &if.endpoint.registry
59  * -# pdmc_connect_add_cloud_resource(reg, ...)
60  * -# pdmc_connect_register
61  * See also `lwm2m_registry.h` for relevant value modification functions.
62 **/
63 
68 void pdmc_connect_init(uint8_t event_handler_id);
69 
73 void pdmc_connect_deinit(void);
74 
79 void pdmc_connect_register(void* iface);
80 
85 
89 void pdmc_connect_close(void);
90 
96 lwm2m_interface_t *pdmc_connect_get_interface(void);
97 
98 #ifndef MBED_CLOUD_CLIENT_DISABLE_REGISTRY
99 
111 int pdmc_connect_add_cloud_resource(registry_t *registry, registry_path_t *path,
112  const uint16_t object, const uint16_t object_instance, const uint16_t resource,
113  bool auto_observable, registry_callback_t callback);
114 
128 int pdmc_connect_add_cloud_resource_instance(registry_t *registry, registry_path_t *path,
129  const uint16_t object, const uint16_t object_instance, const uint16_t resource,
130  const uint16_t resource_instance,
131  bool auto_observable, registry_callback_t callback);
132 #endif // !MBED_CLOUD_CLIENT_DISABLE_REGISTRY
133 
140 
148 bool pdmc_connect_get_endpoint_name(char *endpoint_name, size_t size);
149 
156 bool pdmc_connect_get_device_id(char *device_id, size_t size);
157 
166 void pdmc_connect_pause(void);
167 
175 void pdmc_connect_resume(void *iface);
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #endif // __DMC_CONNECT_API_H__
182 
void pdmc_connect_init(uint8_t event_handler_id)
Device Management Client connection initialization. This must be called before using other operations...
bool pdmc_connect_get_device_id(char *device_id, size_t size)
Get device id of a connected device.
lwm2m_interface_t * pdmc_connect_get_interface(void)
Get lwm2m_interface. This interface has an endpoint containing a registry that is a necessary paramet...
Internal client setup completed.
Definition: dmc_connect_api.h:42
Describes the path of an item in the LwM2M Object registry.
Definition: lwm2m_types.h:160
struct pdmc_endpoint_info_ pdmc_endpoint_info_s
m2m_client_event_t
Definition: dmc_connect_api.h:41
int pdmc_connect_add_cloud_resource(registry_t *registry, registry_path_t *path, const uint16_t object, const uint16_t object_instance, const uint16_t resource, bool auto_observable, registry_callback_t callback)
A helper function for adding Resources to Device Management (the Resources should be defined in oma_l...
int pdmc_connect_add_cloud_resource_instance(registry_t *registry, registry_path_t *path, const uint16_t object, const uint16_t object_instance, const uint16_t resource, const uint16_t resource_instance, bool auto_observable, registry_callback_t callback)
A helper function for adding Resource instances to Device Management (the Resources should be defined...
void pdmc_connect_close(void)
Deregister from Device Management.
void pdmc_connect_resume(void *iface)
Resume Device Management Client's timed functionality and network connection to Device Management...
void pdmc_connect_pause(void)
Pause Device Management Client's timed functionality and close network connection to Device Managemen...
bool pdmc_connect_endpoint_info(pdmc_endpoint_info_s *endpoint_info)
Get information on a connected endpoint.
bool pdmc_connect_get_endpoint_name(char *endpoint_name, size_t size)
Get endpoint name. Can be called before connecting, but must only be called after pdmc_connect_init()...
void pdmc_connect_register(void *iface)
Device Management Client registration. If necessary, initiates the internal update component and perf...
Network setup completed.
Definition: dmc_connect_api.h:43
Definition: dmc_connect_api.h:49
Update-related Device Management Client API functions.
void pdmc_connect_register_update(void)
Device Management Client updates register information to Device Management.
void pdmc_connect_deinit(void)
Deinitialize Device Management Client.