1 /* *****************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
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 ******************************************************************/
23 * This file provides a Enum which contains Status codes
24 * for Success and Errors
27 package org.iotivity.service.tm;
30 * This Enum contains Status codes for Success and Errors
32 public enum OCStackResult {
35 OC_STACK_RESOURCE_CREATED,
36 OC_STACK_RESOURCE_DELETED,
39 OC_STACK_INVALID_QUERY,
41 OC_STACK_INVALID_PORT,
42 OC_STACK_INVALID_CALLBACK,
43 OC_STACK_INVALID_METHOD,
44 OC_STACK_INVALID_PARAM,
45 OC_STACK_INVALID_OBSERVE_PARAM,
50 OC_STACK_RESOURCE_ERROR,
51 OC_STACK_SLOW_RESOURCE,
52 OC_STACK_REPEATED_REQUEST,
53 OC_STACK_NO_OBSERVERS,
54 OC_STACK_OBSERVER_NOT_FOUND,
55 OC_STACK_VIRTUAL_DO_NOT_HANDLE,
56 OC_STACK_INVALID_OPTION,
57 OC_STACK_MALFORMED_RESPONSE,
58 OC_STACK_PERSISTENT_BUFFER_REQUIRED,
59 OC_STACK_INVALID_REQUEST_HANDLE,
60 OC_STACK_INVALID_DEVICE_INFO,
61 OC_STACK_INVALID_JSON,
62 OC_STACK_PRESENCE_STOPPED,
63 OC_STACK_PRESENCE_TIMEOUT,
64 OC_STACK_PRESENCE_DO_NOT_HANDLE,
66 OC_STACK_LISTENER_NOT_SET;
68 public static OCStackResult conversion(int ordinal) {
70 OCStackResult result = OCStackResult.values()[31];
73 result = OCStackResult.values()[0];
74 else if (ordinal == 1)
75 result = OCStackResult.values()[1];
76 else if (ordinal == 2)
77 result = OCStackResult.values()[2];
78 else if (ordinal == 3)
79 result = OCStackResult.values()[3];
81 else if (ordinal == 20)
82 result = OCStackResult.values()[4];
83 else if (ordinal == 21)
84 result = OCStackResult.values()[5];
85 else if (ordinal == 22)
86 result = OCStackResult.values()[6];
87 else if (ordinal == 23)
88 result = OCStackResult.values()[7];
89 else if (ordinal == 24)
90 result = OCStackResult.values()[8];
91 else if (ordinal == 25)
92 result = OCStackResult.values()[9];
93 else if (ordinal == 26)
94 result = OCStackResult.values()[10];
95 else if (ordinal == 27)
96 result = OCStackResult.values()[11];
97 else if (ordinal == 28)
98 result = OCStackResult.values()[12];
99 else if (ordinal == 29)
100 result = OCStackResult.values()[13];
101 else if (ordinal == 30)
102 result = OCStackResult.values()[14];
103 else if (ordinal == 31)
104 result = OCStackResult.values()[15];
105 else if (ordinal == 32)
106 result = OCStackResult.values()[16];
107 else if (ordinal == 33)
108 result = OCStackResult.values()[17];
109 else if (ordinal == 34)
110 result = OCStackResult.values()[18];
111 else if (ordinal == 35)
112 result = OCStackResult.values()[19];
113 else if (ordinal == 36)
114 result = OCStackResult.values()[20];
115 else if (ordinal == 37)
116 result = OCStackResult.values()[21];
117 else if (ordinal == 38)
118 result = OCStackResult.values()[22];
119 else if (ordinal == 39)
120 result = OCStackResult.values()[23];
121 else if (ordinal == 40)
122 result = OCStackResult.values()[24];
123 else if (ordinal == 41)
124 result = OCStackResult.values()[25];
125 else if (ordinal == 42)
126 result = OCStackResult.values()[26];
127 else if (ordinal == 43)
128 result = OCStackResult.values()[27];
130 else if (ordinal == 128)
131 result = OCStackResult.values()[28];
132 else if (ordinal == 129)
133 result = OCStackResult.values()[29];
134 else if (ordinal == 130)
135 result = OCStackResult.values()[30];