leo hendrickson
/
S
simple-mbed-cloud-client/mbed-cloud-client/mbed-client/mbed-client/m2minterfacefactory.h@0:25fa8795676b, 2021-04-18 (annotated)
- Committer:
- leothedragon
- Date:
- Sun Apr 18 15:20:23 2021 +0000
- Revision:
- 0:25fa8795676b
DS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
leothedragon | 0:25fa8795676b | 1 | /* |
leothedragon | 0:25fa8795676b | 2 | * Copyright (c) 2015 ARM Limited. All rights reserved. |
leothedragon | 0:25fa8795676b | 3 | * SPDX-License-Identifier: Apache-2.0 |
leothedragon | 0:25fa8795676b | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
leothedragon | 0:25fa8795676b | 5 | * not use this file except in compliance with the License. |
leothedragon | 0:25fa8795676b | 6 | * You may obtain a copy of the License at |
leothedragon | 0:25fa8795676b | 7 | * |
leothedragon | 0:25fa8795676b | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
leothedragon | 0:25fa8795676b | 9 | * |
leothedragon | 0:25fa8795676b | 10 | * Unless required by applicable law or agreed to in writing, software |
leothedragon | 0:25fa8795676b | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
leothedragon | 0:25fa8795676b | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
leothedragon | 0:25fa8795676b | 13 | * See the License for the specific language governing permissions and |
leothedragon | 0:25fa8795676b | 14 | * limitations under the License. |
leothedragon | 0:25fa8795676b | 15 | */ |
leothedragon | 0:25fa8795676b | 16 | #ifndef M2M_INTERFACE_FACTORY_H |
leothedragon | 0:25fa8795676b | 17 | #define M2M_INTERFACE_FACTORY_H |
leothedragon | 0:25fa8795676b | 18 | |
leothedragon | 0:25fa8795676b | 19 | #include <stdlib.h> |
leothedragon | 0:25fa8795676b | 20 | #include "mbed-client/m2msecurity.h" |
leothedragon | 0:25fa8795676b | 21 | #include "mbed-client/m2mresource.h" |
leothedragon | 0:25fa8795676b | 22 | #include "mbed-client/m2minterfaceobserver.h" |
leothedragon | 0:25fa8795676b | 23 | |
leothedragon | 0:25fa8795676b | 24 | //FORWARD DECLARATION |
leothedragon | 0:25fa8795676b | 25 | class M2MDevice; |
leothedragon | 0:25fa8795676b | 26 | class M2MServer; |
leothedragon | 0:25fa8795676b | 27 | class M2MInterfaceImpl; |
leothedragon | 0:25fa8795676b | 28 | class M2MFirmware; |
leothedragon | 0:25fa8795676b | 29 | |
leothedragon | 0:25fa8795676b | 30 | /*! \file m2minterfacefactory.h |
leothedragon | 0:25fa8795676b | 31 | * \brief M2MInterfaceFactory. |
leothedragon | 0:25fa8795676b | 32 | * This is a factory class that provides an interface for creating an mbed Client Interface |
leothedragon | 0:25fa8795676b | 33 | * object for an application to utilize the LWM2M features provided by the client. |
leothedragon | 0:25fa8795676b | 34 | */ |
leothedragon | 0:25fa8795676b | 35 | |
leothedragon | 0:25fa8795676b | 36 | class M2MInterfaceFactory { |
leothedragon | 0:25fa8795676b | 37 | private: |
leothedragon | 0:25fa8795676b | 38 | // Prevents the use of an assignment operator by accident. |
leothedragon | 0:25fa8795676b | 39 | M2MInterfaceFactory& operator=( const M2MInterfaceFactory& /*other*/ ); |
leothedragon | 0:25fa8795676b | 40 | |
leothedragon | 0:25fa8795676b | 41 | // Prevents the use of a copy constructor by accident. |
leothedragon | 0:25fa8795676b | 42 | M2MInterfaceFactory( const M2MInterfaceFactory& /*other*/ ); |
leothedragon | 0:25fa8795676b | 43 | |
leothedragon | 0:25fa8795676b | 44 | public: |
leothedragon | 0:25fa8795676b | 45 | |
leothedragon | 0:25fa8795676b | 46 | /** |
leothedragon | 0:25fa8795676b | 47 | * \brief Creates an interface object for the mbed Client Inteface. With this, the |
leothedragon | 0:25fa8795676b | 48 | * client can handle client operations like Bootstrapping, Client |
leothedragon | 0:25fa8795676b | 49 | * Registration, Device Management and Information Reporting. |
leothedragon | 0:25fa8795676b | 50 | * \param endpoint_name The endpoint name of mbed Client. |
leothedragon | 0:25fa8795676b | 51 | * \param endpoint_type The endpoint type of mbed Client, default is empty. |
leothedragon | 0:25fa8795676b | 52 | * \param life_time The lifetime of the endpoint in seconds, |
leothedragon | 0:25fa8795676b | 53 | * if -1 it is optional. |
leothedragon | 0:25fa8795676b | 54 | * \param listen_port The listening port for the endpoint, default is 5683. |
leothedragon | 0:25fa8795676b | 55 | * \param domain The domain of the endpoint, default is empty. |
leothedragon | 0:25fa8795676b | 56 | * \param mode The binding mode of the endpoint, default is NOT_SET. |
leothedragon | 0:25fa8795676b | 57 | * \param stack The underlying network stack to be used for the connection, |
leothedragon | 0:25fa8795676b | 58 | * default is LwIP_IPv4. |
leothedragon | 0:25fa8795676b | 59 | * \param context_address The context address for M2M-HTTP, not used currently. |
leothedragon | 0:25fa8795676b | 60 | * \return M2MInterfaceImpl An object for managing other client operations. |
leothedragon | 0:25fa8795676b | 61 | */ |
leothedragon | 0:25fa8795676b | 62 | static M2MInterface *create_interface(M2MInterfaceObserver &observer, |
leothedragon | 0:25fa8795676b | 63 | const String &endpoint_name, |
leothedragon | 0:25fa8795676b | 64 | const String &endpoint_type = "", |
leothedragon | 0:25fa8795676b | 65 | const int32_t life_time = -1, |
leothedragon | 0:25fa8795676b | 66 | const uint16_t listen_port = 5683, |
leothedragon | 0:25fa8795676b | 67 | const String &domain = "", |
leothedragon | 0:25fa8795676b | 68 | M2MInterface::BindingMode mode = M2MInterface::NOT_SET, |
leothedragon | 0:25fa8795676b | 69 | M2MInterface::NetworkStack stack = M2MInterface::LwIP_IPv4, |
leothedragon | 0:25fa8795676b | 70 | const String &context_address = ""); |
leothedragon | 0:25fa8795676b | 71 | |
leothedragon | 0:25fa8795676b | 72 | /** |
leothedragon | 0:25fa8795676b | 73 | * \brief Creates a security object for the mbed Client Inteface. With this, the |
leothedragon | 0:25fa8795676b | 74 | * client can manage Bootstrapping and Client Registration. |
leothedragon | 0:25fa8795676b | 75 | * \param ServerType The type of the Security Object, bootstrap or LWM2M server. |
leothedragon | 0:25fa8795676b | 76 | * \return M2MSecurity An object for managing other client operations. |
leothedragon | 0:25fa8795676b | 77 | */ |
leothedragon | 0:25fa8795676b | 78 | static M2MSecurity *create_security(M2MSecurity::ServerType server_type); |
leothedragon | 0:25fa8795676b | 79 | |
leothedragon | 0:25fa8795676b | 80 | /** |
leothedragon | 0:25fa8795676b | 81 | * \brief Creates a server object for the mbed Client Inteface. With this, the |
leothedragon | 0:25fa8795676b | 82 | * client can manage the server resources used for client operations |
leothedragon | 0:25fa8795676b | 83 | * such as Client Registration, server lifetime. |
leothedragon | 0:25fa8795676b | 84 | * \return M2MServer An object for managing server client operations. |
leothedragon | 0:25fa8795676b | 85 | */ |
leothedragon | 0:25fa8795676b | 86 | static M2MServer *create_server(); |
leothedragon | 0:25fa8795676b | 87 | |
leothedragon | 0:25fa8795676b | 88 | /** |
leothedragon | 0:25fa8795676b | 89 | * \brief Creates a device object for the mbed Client Inteface. With this, the |
leothedragon | 0:25fa8795676b | 90 | * client can manage the device resources used for client operations |
leothedragon | 0:25fa8795676b | 91 | * such as Client Registration, Device Management and Information Reporting. |
leothedragon | 0:25fa8795676b | 92 | * \param name The name of the device object. |
leothedragon | 0:25fa8795676b | 93 | * \return M2MDevice An object for managing other client operations. |
leothedragon | 0:25fa8795676b | 94 | */ |
leothedragon | 0:25fa8795676b | 95 | static M2MDevice *create_device(); |
leothedragon | 0:25fa8795676b | 96 | |
leothedragon | 0:25fa8795676b | 97 | /** |
leothedragon | 0:25fa8795676b | 98 | * \brief Creates a firmware object for the mbed Client Inteface. With this, the |
leothedragon | 0:25fa8795676b | 99 | * client can manage the firmware resources used for the client operations |
leothedragon | 0:25fa8795676b | 100 | * such as Client Registration, Device Management and Information Reporting. |
leothedragon | 0:25fa8795676b | 101 | * \return M2MFirmware An object for managing other client operations. |
leothedragon | 0:25fa8795676b | 102 | */ |
leothedragon | 0:25fa8795676b | 103 | static M2MFirmware *create_firmware(); |
leothedragon | 0:25fa8795676b | 104 | |
leothedragon | 0:25fa8795676b | 105 | /** |
leothedragon | 0:25fa8795676b | 106 | * \brief Creates a generic object for the mbed Client Inteface. With this, the |
leothedragon | 0:25fa8795676b | 107 | * client can manage its own customized resources used for registering |
leothedragon | 0:25fa8795676b | 108 | * Device Management and Information Reporting for those resources. |
leothedragon | 0:25fa8795676b | 109 | * \param name The name of the object. |
leothedragon | 0:25fa8795676b | 110 | * \return M2MObject An object for managing other mbed Client operations. |
leothedragon | 0:25fa8795676b | 111 | */ |
leothedragon | 0:25fa8795676b | 112 | static M2MObject *create_object(const String &name); |
leothedragon | 0:25fa8795676b | 113 | |
leothedragon | 0:25fa8795676b | 114 | #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION |
leothedragon | 0:25fa8795676b | 115 | /** |
leothedragon | 0:25fa8795676b | 116 | * \brief Creates a endpoint object for the mbed Client Inteface. With this, the |
leothedragon | 0:25fa8795676b | 117 | * client can manage multiple endpoints and their resources. Common directory path "d/" |
leothedragon | 0:25fa8795676b | 118 | * will be prepended to the endpoint path, resulting in the endpoint having final path of |
leothedragon | 0:25fa8795676b | 119 | * "d/name". |
leothedragon | 0:25fa8795676b | 120 | * \param name The name of the object. |
leothedragon | 0:25fa8795676b | 121 | * \return M2MObject An object for managing other mbed Client operations. |
leothedragon | 0:25fa8795676b | 122 | */ |
leothedragon | 0:25fa8795676b | 123 | static M2MEndpoint* create_endpoint(const String &name); |
leothedragon | 0:25fa8795676b | 124 | #endif |
leothedragon | 0:25fa8795676b | 125 | |
leothedragon | 0:25fa8795676b | 126 | friend class Test_M2MInterfaceFactory; |
leothedragon | 0:25fa8795676b | 127 | }; |
leothedragon | 0:25fa8795676b | 128 | |
leothedragon | 0:25fa8795676b | 129 | #endif // M2M_INTERFACE_FACTORY_H |