rename to resource-hosting from notification-manager.
[platform/upstream/iotivity.git] / service / resource-hosting / SampleApp / tizen / NMSampleApp / src / nmutil.cpp
1 /******************************************************************
2  *
3  * Copyright 2015 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 #include "nmutil.h"
22
23 // Utility function to return the string equivalent of OCStackResult for the given int value
24 std::string getOCStackResultStringFromInt(int result)
25 {
26     string ocresultstr;
27
28     switch (result)
29     {
30         case 0 :
31             ocresultstr = "OC_STACK_OK";
32             break;
33         case 1 :
34             ocresultstr = "OC_STACK_RESOURCE_CREATED";
35             break;
36         case 2 :
37             ocresultstr = "OC_STACK_RESOURCE_DELETED";
38             break;
39         case 3 :
40             ocresultstr = "OC_STACK_CONTINUE";
41             break;
42         case 20 :
43             ocresultstr = "OC_STACK_INVALID_URI";
44             break;
45         case 21 :
46             ocresultstr = "OC_STACK_INVALID_QUERY";
47             break;
48         case 22 :
49             ocresultstr = "OC_STACK_INVALID_QUERY";
50             break;
51         case 23 :
52             ocresultstr = "OC_STACK_INVALID_PORT";
53             break;
54         case 24 :
55             ocresultstr = "OC_STACK_INVALID_CALLBACK";
56             break;
57         case 25 :
58             ocresultstr = "OC_STACK_INVALID_METHOD";
59             break;
60         case 26 :
61             ocresultstr = "OC_STACK_INVALID_PARAM";
62             break;
63         case 27 :
64             ocresultstr = "OC_STACK_INVALID_OBSERVE_PARAM";
65             break;
66         case 28 :
67             ocresultstr = "OC_STACK_NO_MEMORY";
68             break;
69         case 29 :
70             ocresultstr = "OC_STACK_COMM_ERROR";
71             break;
72         case 30 :
73             ocresultstr = "OC_STACK_NOTIMPL";
74             break;
75         case 31 :
76             ocresultstr = "OC_STACK_NO_RESOURCE";
77             break;
78         case 32 :
79             ocresultstr = "OC_STACK_RESOURCE_ERROR";
80             break;
81         case 33 :
82             ocresultstr = "OC_STACK_SLOW_RESOURCE";
83             break;
84         case 34 :
85             ocresultstr = "OC_STACK_DUPLICATE_REQUEST";
86             break;
87         case 35 :
88             ocresultstr = "OC_STACK_NO_OBSERVERS";
89             break;
90         case 36 :
91             ocresultstr = "OC_STACK_OBSERVER_NOT_FOUND";
92             break;
93         case 37 :
94             ocresultstr = "OC_STACK_VIRTUAL_DO_NOT_HANDLE";
95             break;
96         case 38 :
97             ocresultstr = "OC_STACK_INVALID_OPTION";
98             break;
99         case 39 :
100             ocresultstr = "OC_STACK_MALFORMED_RESPONSE";
101             break;
102         case 40 :
103             ocresultstr = "OC_STACK_PERSISTENT_BUFFER_REQUIRED";
104             break;
105         case 41 :
106             ocresultstr = "OC_STACK_INVALID_REQUEST_HANDLE";
107             break;
108         case 42 :
109             ocresultstr = "OC_STACK_INVALID_DEVICE_INFO";
110             break;
111         case 43 :
112             ocresultstr = "OC_STACK_INVALID_JSON";
113             break;
114         case 128 :
115             ocresultstr = "OC_STACK_PRESENCE_STOPPED";
116             break;
117         case 129 :
118             ocresultstr = "OC_STACK_PRESENCE_TIMEOUT";
119             break;
120         case 130 :
121             ocresultstr = "OC_STACK_PRESENCE_DO_NOT_HANDLE";
122             break;
123         case 255 :
124             ocresultstr = "OC_STACK_ERROR";
125             break;
126         default :
127             ocresultstr = "OC_STACK_ERROR";
128     }
129     return ocresultstr;
130 }