Mistake on this page? Email us
m2minterfacefactory.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 ARM Limited. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  * Licensed under the Apache License, Version 2.0 (the License); you may
5  * not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef M2M_INTERFACE_FACTORY_H
17 #define M2M_INTERFACE_FACTORY_H
18 
19 #include <stdlib.h>
23 
24 //FORWARD DECLARATION
25 class M2MDevice;
26 class M2MServer;
27 class M2MInterfaceImpl;
28 class M2MFirmware;
29 
37 private:
38  // Prevents the use of an assignment operator by accident.
39  M2MInterfaceFactory& operator=( const M2MInterfaceFactory& /*other*/ );
40 
41  // Prevents the use of a copy constructor by accident.
42  M2MInterfaceFactory( const M2MInterfaceFactory& /*other*/ );
43 
44 
45 public:
46 
64  const String &endpoint_name,
65  const String &endpoint_type = "",
66  const int32_t life_time = -1,
67  const uint16_t listen_port = 5683,
68  const String &domain = "",
69  M2MInterface::BindingMode mode = M2MInterface::NOT_SET,
70  M2MInterface::NetworkStack stack = M2MInterface::LwIP_IPv4,
71  const String &context_address = "");
72 
80 
87  static M2MServer *create_server();
88 
96  static M2MDevice *create_device();
97 
104  static M2MFirmware *create_firmware() m2m_deprecated;
105 
113  static M2MObject *create_object(const String &name);
114 
129  static M2MResource *create_resource(M2MObjectList &m2m_obj_list,
130  const uint16_t object_id,
131  const uint16_t object_instance_id,
132  const uint16_t resource_id,
133  const M2MResourceInstance::ResourceType resource_type,
134  const M2MBase::Operation allowed,
135  bool multiple_instance = false,
136  bool external_blockwise_store = false);
137 
138 #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION
139 
147  static M2MEndpoint* create_endpoint(const String &name);
148 #endif
149 
150 private:
159  static M2MObject* find_or_create_object(M2MObjectList &object_list,
160  const uint16_t object_id,
161  bool &object_created);
162 
171  static M2MObjectInstance* find_or_create_object_instance(M2MObject &object,
172  const uint16_t object_instance_id,
173  bool &object_instance_created);
174 
183  static M2MResource* find_or_create_resource(M2MObjectInstance &object_instance,
184  const uint16_t resource_id,
185  const M2MResourceInstance::ResourceType resource_type,
186  bool multiple_instance,
187  bool external_blockwise_store);
188 
189  friend class Test_M2MInterfaceFactory;
190 };
191 
192 #endif // M2M_INTERFACE_FACTORY_H
The base class for Client Objects.
Definition: m2mobject.h:39
Definition: m2mserver.h:31
ServerType
An enum defining an interface operation that can be handled by the Security Object.
Definition: m2msecurity.h:76
Definition: m2minterfaceobserver.h:32
Definition: m2mobjectinstance.h:36
A class representin the Device Object model of the LwM2M framework.
Definition: m2mdevice.h:38
static M2MObject * create_object(const String &name)
Creates a generic object for the mbed Client Inteface. With this, the client can manage its own custo...
ResourceType
Definition: m2mresourcebase.h:66
Definition: m2mfirmware.h:32
BindingMode
An enum defining different kinds of binding modes handled for client operations.
Definition: m2minterface.h:114
Definition: m2msecurity.h:31
static M2MDevice * create_device()
Creates a device object for the mbed Client Inteface. With this, the client can manage the device res...
Definition: m2mstring.h:33
NetworkStack
An enum defining different kinds of network stacks that can be used by mbed Client.
Definition: m2minterface.h:131
M2MInterfaceObserver This is an observer class that updates the calling application about various eve...
M2MResource. This class is the base class for mbed Client Resources.
static M2MSecurity * create_security(M2MSecurity::ServerType server_type)
Creates a security object for the mbed Client Inteface. With this, the client can manage Bootstrappin...
static M2MServer * create_server()
Creates a server object for the mbed Client Inteface. With this, the client can manage the server res...
Definition: m2minterface.h:82
Definition: m2mvector.h:30
static M2MFirmware * create_firmware() m2m_deprecated
Creates a firmware object for the mbed Client Inteface. With this, the client can manage the firmware...
The base class for Client Resources.
Definition: m2mresource.h:40
static M2MInterface * create_interface(M2MInterfaceObserver &observer, const String &endpoint_name, const String &endpoint_type="", const int32_t life_time=-1, const uint16_t listen_port=5683, const String &domain="", M2MInterface::BindingMode mode=M2MInterface::NOT_SET, M2MInterface::NetworkStack stack=M2MInterface::LwIP_IPv4, const String &context_address="")
Creates an interface object for the mbed Client Inteface. With this, the client can handle client ope...
Definition: m2minterfacefactory.h:36
M2MSecurity. This class represents an interface for the Security Object model of the LWM2M framework...
Operation
Enum defining an operation that can be supported by a given resource.
Definition: m2mbase.h:121
static M2MResource * create_resource(M2MObjectList &m2m_obj_list, const uint16_t object_id, const uint16_t object_instance_id, const uint16_t resource_id, const M2MResourceInstance::ResourceType resource_type, const M2MBase::Operation allowed, bool multiple_instance=false, bool external_blockwise_store=false)
Creates a M2M resource and places it to the given object list.