Imported Upstream version 1.0.1
[platform/upstream/iotivity.git] / service / simulator / java / sdk / src / org / oic / simulator / clientcontroller / SimulatorConnectivityType.java
1 /*
2  * Copyright 2015 Samsung Electronics All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.oic.simulator.clientcontroller;
18
19 /**
20  * Supported connectivity types.
21  */
22 public enum SimulatorConnectivityType {
23     SIMULATOR_CT_DEFAULT(0),
24
25     /** IPv4 and IPv6, including 6LoWPAN. */
26     SIMULATOR_CT_ADAPTER_IP(1 << 16),
27
28     /** GATT over Bluetooth LE. */
29     SIMULATOR_CT_ADAPTER_GATT_BTLE(1 << 17),
30
31     /** RFCOMM over Bluetooth EDR. */
32     SIMULATOR_CT_ADAPTER_RFCOMM_BTEDR(1 << 18),
33
34     /** Remote Access over XMPP. */
35     SIMULATOR_CT_ADAPTER_REMOTE_ACCESS(1 << 19),
36
37     /** Insecure transport is the default (subject to change). */
38
39     /** secure the transport path. */
40     SIMULATOR_CT_FLAG_SECURE(1 << 4),
41
42     /** IPv4 & IPv6 autoselection is the default. */
43
44     /** IP adapter only. */
45     SIMULATOR_CT_IP_USE_V6(1 << 5),
46
47     /** IP adapter only. */
48     SIMULATOR_CT_IP_USE_V4(1 << 6),
49
50     /**
51      * Link-Local multicast is the default multicast scope for IPv6. These are
52      * placed here to correspond to the IPv6 address bits.
53      */
54
55     /** IPv6 Interface-Local scope(loopback). */
56     SIMULATOR_CT_SCOPE_INTERFACE(0x1),
57
58     /** IPv6 Link-Local scope (default). */
59     SIMULATOR_CT_SCOPE_LINK(0x2),
60
61     /** IPv6 Realm-Local scope. */
62     SIMULATOR_CT_SCOPE_REALM(0x3),
63
64     /** IPv6 Admin-Local scope. */
65     SIMULATOR_CT_SCOPE_ADMIN(0x4),
66
67     /** IPv6 Site-Local scope. */
68     SIMULATOR_CT_SCOPE_SITE(0x5),
69
70     /** IPv6 Organization-Local scope. */
71     SIMULATOR_CT_SCOPE_ORG(0x8),
72
73     /** IPv6 Global scope. */
74     SIMULATOR_CT_SCOPE_GLOBAL(0xE);
75
76     private int value;
77
78     private SimulatorConnectivityType(int value) {
79         this.value = value;
80     }
81
82     public int getValue() {
83         return this.value;
84     }
85
86     /**
87      * Method to get the {@link SimulatorConnectivityType} from an integer
88      * value.
89      *
90      * @param value
91      *            Integral value of {@link SimulatorConnectivityType}.
92      * @return {@link SimulatorConnectivityType} corresponding to the given
93      *         value.
94      */
95     public static SimulatorConnectivityType getConnectivityType(int value) {
96         SimulatorConnectivityType result = null;
97         SimulatorConnectivityType[] types = SimulatorConnectivityType.values();
98         for (SimulatorConnectivityType type : types) {
99             if (type.getValue() == value) {
100                 result = type;
101                 break;
102             }
103         }
104         return result;
105     }
106 }