Merge "Merge branch 'master' into group-manager" into group-manager
[platform/upstream/iotivity.git] / service / scene-manager / src / SceneCommons.h
1 //******************************************************************
2 //
3 // Copyright 2016 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 /**
22  * @file
23  *
24  * This file contains the declaration of SceneUtils class and constant variables.
25  */
26
27 #ifndef SCENE_COMMONS_H
28 #define SCENE_COMMONS_H
29
30 #include <string>
31
32 namespace OIC
33 {
34     namespace Service
35     {
36         const std::string SCENE_LIST_DEFAULT_NAME = "list of scene Collections";
37
38         const std::string SCENE_KEY_LAST_SCENE = "lastScene";
39         const std::string SCENE_KEY_SCENEVALUES = "sceneValues";
40         const std::string SCENE_KEY_NAME = "n";
41         const std::string SCENE_KEY_ID = "id";
42         const std::string SCENE_KEY_RTS = "rts";
43         const std::string SCENE_KEY_RT = "rt";
44         const std::string SCENE_KEY_IF = "if";
45         const std::string SCENE_KEY_PAYLOAD_LINK = "link";
46         const std::string SCENE_KEY_SCENEMAPPINGS = "sceneMappings";
47         const std::string SCENE_KEY_HREF = "href";
48         const std::string SCENE_KEY_SCENE = "scene";
49         const std::string SCENE_KEY_MEMBERPROPERTY = "memberProperty";
50         const std::string SCENE_KEY_MEMBERVALUE = "memberValue";
51         const std::string SCENE_KEY_CREATEDLINK = "createdlink";
52
53         const std::string SCENE_KEY_URI = "uri";
54         const std::string SCENE_KEY_CHILD = "child";
55
56         const std::string SCENE_LIST_RT = "oic.wk.scenelist";
57         const std::string SCENE_MEMBER_RT = "oic.r.scenemember";
58         const std::string SCENE_COLLECTION_RT = "oic.wk.scenecollection";
59
60         const std::string COAP_TAG = "coap://";
61         const std::string SCENE_LIST_URI = "/SceneListResURI";
62         const std::string PREFIX_SCENE_COLLECTION_URI = "/a/sceneCollection";
63         const std::string PREFIX_SCENE_MEMBER_URI = "/a/sceneMember";
64
65         const int SCENE_RESPONSE_SUCCESS = 200;
66         const int SCENE_CLIENT_BADREQUEST = 400;
67         const int SCENE_SERVER_INTERNALSERVERERROR = 500;
68
69         class SceneUtils
70         {
71         public:
72             /**
73              * Returns UUID for Scene collection resource and members ID.
74              *
75              * @throw RCSException
76              */
77             static std::string OICGenerateUUIDStr();
78
79             /**
80              * Returns host resource's address and uri from coap address.
81              *
82              * @param address uri of host resource (e.g. coap://192.168.0.2:12345/a/light)
83              * @param[out] host host resource's address (e.g. 192.168.0.2:12345)
84              * @param[out] uri host resource's uri (e.g. /a/light)
85              *
86              * @throw RCSInvalidParameterException
87              */
88             static void getHostUriString(
89                     const std::string address, std::string *host, std::string *uri);
90
91             /**
92              * Returns information of my own network address.
93              *
94              * This functionality use the CA interface for getting network information.
95              * But It has design issue. So, It will should change to other interface.
96              *
97              * @throw RCSException
98              */
99             static std::string getNetAddress();
100         };
101     }
102 }
103
104 #endif // SCENE_COMMONS_H