1 //******************************************************************
3 // Copyright 2014 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 /// @file ThingsManager.h
23 /// @brief This file contains the declaration of classes and its members related to TGMClient.
25 #ifndef __OC_THINGSMANAGER__
26 #define __OC_THINGSMANAGER__
32 #include "OCPlatform.h"
34 #include "GroupManager.h"
43 * Constructor for TGMClient. Constructs a new TGMClient
53 * API for candidate resources discovery.
54 * Callback only call when all resource types found.
56 * @param resourceTypes - required resource types(called "candidate")
57 * @param candidateCallback - callback. OCResource vector.
59 * @return OCStackResult return value of this API. Returns OC_STACK_OK if success.
61 * NOTE: OCStackResult is defined in ocstack.h.
63 OCStackResult findCandidateResources(std::vector< std::string > resourceTypes,
64 std::function< void(std::vector< std::shared_ptr< OCResource > >) > callback, int waitsec = -1);
67 * API for Collection member's state subscribe.
71 OCStackResult subscribeCollectionPresence(std::shared_ptr< OCResource >, std::function< void(std::string, OCStackResult) > );
73 // Group Synchronization
74 OCStackResult findGroup (std::vector <std::string> collectionResourceTypes, FindCallback resourceHandler);
75 OCStackResult createGroup (std::string collectionResourceType);
76 OCStackResult joinGroup (std::string collectionResourceType, OCResourceHandle resourceHandle);
77 OCStackResult joinGroup (const std::shared_ptr<OCResource> resource, OCResourceHandle resourceHandle);
78 OCStackResult leaveGroup (std::string collectionResourceType, OCResourceHandle resourceHandle);
79 void deleteGroup (std::string collectionResourceType);
80 std::map<std::string, OCResourceHandle> getGroupList ();
82 // Things Configuration
83 OCStackResult updateConfigurations(std::shared_ptr< OCResource > resource, std::map<std::string, std::string> configurations,
84 std::function< void(const HeaderOptions& headerOptions, const OCRepresentation& rep, const int eCode) > callback);
85 OCStackResult getConfigurations(std::shared_ptr< OCResource > resource, std::vector<std::string> configurations,
86 std::function< void(const HeaderOptions& headerOptions, const OCRepresentation& rep, const int eCode) > callback);
87 std::string getListOfSupportedConfigurationUnits();
88 OCStackResult doBootstrap(
89 std::function< void(const HeaderOptions& headerOptions, const OCRepresentation& rep, const int eCode) > callback);
92 OCStackResult reboot(std::shared_ptr< OCResource > resource,
93 std::function< void(const HeaderOptions& headerOptions, const OCRepresentation& rep, const int eCode) > callback);
94 OCStackResult factoryReset(std::shared_ptr< OCResource > resource,
95 std::function< void(const HeaderOptions& headerOptions, const OCRepresentation& rep, const int eCode) > callback);
101 std::string getStringFromActionSet(const ActionSet *newActionSet);
102 ActionSet* getActionSetfromString(std::string desc);
104 OCStackResult addActionSet(std::shared_ptr< OCResource > resource, const ActionSet* newActionSet, PutCallback cb);
105 OCStackResult executeActionSet(std::shared_ptr< OCResource > resource, std::string actionsetName, PostCallback cb);
106 OCStackResult getActionSet(std::shared_ptr< OCResource > resource, std::string actionsetName, GetCallback cb);
107 OCStackResult deleteActionSet(std::shared_ptr< OCResource > resource, std::string actionsetName, PostCallback);
111 #endif /* __OC_THINGSMANAGER__*/