Timothy Beight / Mbed 2 deprecated 6_songs-from-the-cloud

Dependencies:   mbed Socket lwip-eth lwip-sys lwip

Fork of 6_songs-from-the-cloud by MakingMusicWorkshop

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers m2minterfacefactory.h Source File

m2minterfacefactory.h

00001 /*
00002  * Copyright (c) 2015 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef M2M_INTERFACE_FACTORY_H
00017 #define M2M_INTERFACE_FACTORY_H
00018 
00019 #include <stdlib.h>
00020 #include "mbed-client/m2msecurity.h"
00021 #include "mbed-client/m2mresource.h"
00022 #include "mbed-client/m2minterfaceobserver.h"
00023 
00024 //FORWARD DECLARATION
00025 class M2MDevice;
00026 class M2MServer;
00027 class M2MInterfaceImpl;
00028 class M2MFirmware;
00029 
00030 /**
00031  *  @brief M2MInterfaceFactory.
00032  *  This is a factory class that provides an interface for creating an mbed Client Interface
00033  *  object for an application to utilize the LWM2M features provided by the client.
00034  */
00035 
00036 class  M2MInterfaceFactory {
00037 private:
00038     // Prevents the use of assignment operator by accident.
00039     M2MInterfaceFactory& operator=( const M2MInterfaceFactory& /*other*/ );
00040 
00041     // Prevents the use of copy constructor by accident
00042     M2MInterfaceFactory( const M2MInterfaceFactory& /*other*/ );
00043 
00044 public:
00045 
00046     /**
00047      * @brief Creates an interface object for the mbed Client Inteface. With this, the
00048      * client can handle client operations like Bootstrapping, Client
00049      * Registration, Device Management and Information Reporting.
00050      * @param endpoint_name, Endpoint name of the mbed client.
00051      * @param endpoint_type, Endpoint type of the mbed client, default is empty.
00052      * @param life_time, Lifetime of the endpoint in seconds,
00053      *        if -1 it is optional.
00054      * @param listen_port, Listening port for the endpoint, default is 5683.
00055      * @param domain, Domain of the endpoint, default is empty.
00056      * @param mode, Binding Mode of the endpoint, default is NOT_SET.
00057      * @param stack, Select the underlying network stack to be used for the connection,
00058      * default is LwIP_IPv4.
00059      * @param context_address, Context address for M2M-HTTP, not used currently.
00060      * @return M2MInterfaceImpl , Object to manage other client operations.
00061      */
00062     static M2MInterface *create_interface(M2MInterfaceObserver &observer,
00063                                               const String &endpoint_name,
00064                                               const String &endpoint_type = "",
00065                                               const int32_t life_time = -1,
00066                                               const uint16_t listen_port = 5683,
00067                                               const String &domain = "",
00068                                               M2MInterface::BindingMode mode = M2MInterface::NOT_SET,
00069                                               M2MInterface::NetworkStack stack = M2MInterface::LwIP_IPv4,
00070                                               const String &context_address = "");
00071 
00072     /**
00073      * @brief Creates a security object for the mbed Client Inteface. With this, the
00074      * client can manage Bootstrapping and Client Registration.
00075      * @param ServerType, Type of the Security Object, bootstrap or LWM2M server.
00076      * @return M2MSecurity, Object to manage other client operations.
00077      */
00078     static M2MSecurity *create_security(M2MSecurity::ServerType server_type);
00079 
00080     /**
00081      * @brief Creates a server object for the mbed Client Inteface. With this, the 
00082      * client can manage the server resources used for client operations
00083      * such as Client Registration, server lifetime etc.
00084      * @return M2MServer, Object to manage server client operations.
00085      */
00086     static M2MServer *create_server();
00087 
00088     /**
00089      * @brief Creates a device object for the mbed Client Inteface. With this, the
00090      * client can manage the device resources used for client operations
00091      * such as Client Registration, Device Management and Information Reporting.
00092      * @param name, Name of the device object.
00093      * @return M2MDevice, Object to manage other client operations.
00094      */
00095     static M2MDevice *create_device();
00096 
00097     /**
00098      * @brief Creates a firmware object for the mbed Client Inteface. With this, the
00099      * client can manage the firmware resources used for the client operations
00100      * such as Client Registration, Device Management and Information Reporting.
00101      * @return M2MFirmware, Object to manage other client operations.
00102      */
00103     static M2MFirmware *create_firmware();
00104 
00105     /**
00106      * @brief Creates a generic object for the mbed Client Inteface. With this, the
00107      * client can manage its own customized resources used for registering
00108      * Device Management and Information Reporting for those resources.
00109      * @param name, Name of the object.
00110      * @param id, Unique ID for the object. It should be other than the reserved
00111      * LWM2M object IDs.
00112      * @return M2MObject, Object to manage other mbed Client operations.
00113      */
00114     static M2MObject *create_object(const String &name);
00115 
00116 
00117     friend class Test_M2MInterfaceFactory;
00118 };
00119 
00120 #endif // M2M_INTERFACE_FACTORY_H