Removed execute permissions from non-executable files.
[platform/upstream/iotivity.git] / service / things-manager / sdk / inc / ThingsManager.h
1 //******************************************************************
2 //
3 // Copyright 2014 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
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
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
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.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 /// @file   ThingsManager.h
22
23 /// @brief  This file contains the declaration of classes and its members related to TGMClient.
24
25 #ifndef __OC_THINGSMANAGER__
26 #define __OC_THINGSMANAGER__
27
28 #include <string>
29 #include <vector>
30 #include <map>
31 #include <cstdlib>
32 #include "OCPlatform.h"
33 #include "OCApi.h"
34 #include "GroupManager.h"
35
36 using namespace OC;
37
38
39 class ThingsManager
40 {
41 public:
42     /**
43      * Constructor for TGMClient. Constructs a new TGMClient
44      */
45     ThingsManager(void);
46
47     /**
48      * Virtual destructor
49      */
50     ~ThingsManager(void);
51
52     /**
53      * API for candidate resources discovery.
54      * Callback only call when all resource types found.
55      *
56      * @param resourceTypes - required resource types(called "candidate")
57      * @param candidateCallback - callback. OCResource vector.
58      *
59      * @return OCStackResult return value of this API. Returns OC_STACK_OK if success.
60      *
61      * NOTE: OCStackResult is defined in ocstack.h.
62      */
63     OCStackResult findCandidateResources(std::vector< std::string > resourceTypes,
64             std::function< void(std::vector< std::shared_ptr< OCResource > >) >  callback, int waitsec = -1);
65
66     /**
67      * API for Collection member's state subscribe.
68      *
69      *
70      */
71     OCStackResult subscribeCollectionPresence(std::shared_ptr< OCResource >, std::function< void(std::string, OCStackResult) > );
72
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 ();
81
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);
90
91     // Things Diagnostics
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);
96
97
98
99
100     // Group Action.
101     std::string getStringFromActionSet(const ActionSet *newActionSet);
102     ActionSet* getActionSetfromString(std::string desc);
103
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);
108
109 };
110
111 #endif  /* __OC_THINGSMANAGER__*/