Imported Upstream version 1.1.1
[platform/upstream/iotivity.git] / android / android_api / base / src / main / java / org / iotivity / base / OcPrmType.java
1 /*\r
2  * //******************************************************************\r
3  * //\r
4  * // Copyright 2016 Samsung Electronics All Rights Reserved.\r
5  * //\r
6  * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
7  * //\r
8  * // Licensed under the Apache License, Version 2.0 (the "License");\r
9  * // you may not use this file except in compliance with the License.\r
10  * // You may obtain a copy of the License at\r
11  * //\r
12  * //      http://www.apache.org/licenses/LICENSE-2.0\r
13  * //\r
14  * // Unless required by applicable law or agreed to in writing, software\r
15  * // distributed under the License is distributed on an "AS IS" BASIS,\r
16  * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
17  * // See the License for the specific language governing permissions and\r
18  * // limitations under the License.\r
19  * //\r
20  * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
21  */\r
22 /**\r
23  * @brief   direct pairing Method Type.\r
24  *              0:  not allowed\r
25  *              1:  pre-configured pin\r
26  *              2:  random pin\r
27  */\r
28 package org.iotivity.base;\r
29 \r
30 public enum OcPrmType {\r
31     DP_INVALID           (-1),\r
32     DP_NOT_ALLOWED       (0),\r
33     DP_PRE_CONFIGURED    (1 << 0),\r
34     DP_RANDOM_PIN        (1 << 1);\r
35 \r
36     private int value;\r
37 \r
38     private OcPrmType(int value) {\r
39         this.value = value;\r
40     }\r
41 \r
42     public int getValue() {\r
43         return this.value;\r
44     }\r
45 \r
46     public static OcPrmType convertOcPrmType(int value) {\r
47         switch (value)\r
48         {\r
49             case 0:\r
50                 return OcPrmType.DP_NOT_ALLOWED;\r
51             case 1:\r
52                 return OcPrmType.DP_PRE_CONFIGURED;\r
53             case 2:\r
54                 return OcPrmType.DP_RANDOM_PIN;\r
55         }\r
56         return OcPrmType.DP_INVALID;\r
57     }\r
58 }\r