Simple interface for Mbed Cloud Client
Embed:
(wiki syntax)
Show/hide line numbers
simple-mbed-cloud-client.h
00001 // ---------------------------------------------------------------------------- 00002 // Copyright 2016-2017 ARM Ltd. 00003 // 00004 // SPDX-License-Identifier: Apache-2.0 00005 // 00006 // Licensed under the Apache License, Version 2.0 (the "License"); 00007 // you may not use this file except in compliance with the License. 00008 // You may obtain a copy of the License at 00009 // 00010 // http://www.apache.org/licenses/LICENSE-2.0 00011 // 00012 // Unless required by applicable law or agreed to in writing, software 00013 // distributed under the License is distributed on an "AS IS" BASIS, 00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 // See the License for the specific language governing permissions and 00016 // limitations under the License. 00017 // ---------------------------------------------------------------------------- 00018 00019 00020 #ifndef SIMPLEMBEDCLOUDCLIENT_H 00021 #define SIMPLEMBEDCLOUDCLIENT_H 00022 #include <stdio.h> 00023 #include "mbed-cloud-client/MbedCloudClient.h" 00024 #include "m2mdevice.h" 00025 #include "m2mresource.h" 00026 #include "mbed-client/m2minterface.h" 00027 #include "mbed-client/m2mvector.h" 00028 #include "mbed_cloud_client_resource.h" 00029 #include "mbed.h" 00030 #include "NetworkInterface.h" 00031 00032 class MbedCloudClientResource; 00033 00034 class SimpleMbedCloudClient { 00035 00036 public: 00037 00038 SimpleMbedCloudClient(NetworkInterface *net); 00039 ~SimpleMbedCloudClient(); 00040 00041 int init(); 00042 bool call_register(); 00043 void close(); 00044 void register_update(); 00045 void client_registered(); 00046 void client_unregistered(); 00047 void error(int error_code); 00048 bool is_client_registered(); 00049 bool is_register_called(); 00050 void register_and_connect(); 00051 MbedCloudClient& get_cloud_client(); 00052 MbedCloudClientResource* create_resource(const char *path, const char *name); 00053 00054 private: 00055 M2MObjectList _obj_list; 00056 MbedCloudClient _cloud_client; 00057 bool _registered; 00058 bool _register_called; 00059 Vector<MbedCloudClientResource*> _resources; 00060 NetworkInterface *net; 00061 }; 00062 00063 #endif // SIMPLEMBEDCLOUDCLIENT_H
Generated on Tue Jul 12 2022 19:01:37 by 1.7.2