2 * //******************************************************************
4 * // Copyright 2015 Intel Corporation.
6 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
8 * // Licensed under the Apache License, Version 2.0 (the "License");
9 * // you may not use this file except in compliance with the License.
10 * // You may obtain a copy of the License at
12 * // http://www.apache.org/licenses/LICENSE-2.0
14 * // Unless required by applicable law or agreed to in writing, software
15 * // distributed under the License is distributed on an "AS IS" BASIS,
16 * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * // See the License for the specific language governing permissions and
18 * // limitations under the License.
20 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
23 package org.iotivity.base;
25 import java.security.InvalidParameterException;
26 import java.util.EnumSet;
28 public enum OcConnectivityType {
29 /** use when defaults are ok. */
32 /** IPv4 and IPv6, including 6LoWPAN.*/
33 CT_ADAPTER_IP (1 << 16),
35 /** GATT over Bluetooth LE.*/
36 CT_ADAPTER_GATT_BTLE (1 << 17),
38 /** RFCOMM over Bluetooth EDR.*/
39 CT_ADAPTER_RFCOMM_BTEDR (1 << 18),
41 /** Remote Access over XMPP.*/
42 CT_ADAPTER_REMOTE_ACCESS(1 << 19),
44 /** Insecure transport is the default (subject to change).*/
46 /** secure the transport path.*/
47 CT_FLAG_SECURE (1 << 4),
49 /** IPv4 & IPv6 autoselection is the default.*/
51 /** IP adapter only.*/
52 CT_IP_USE_V6 (1 << 5),
54 /** IP adapter only.*/
55 CT_IP_USE_V4 (1 << 6),
57 /** Link-Local multicast is the default multicast scope for IPv6.
58 * These are placed here to correspond to the IPv6 address bits.*/
60 /** IPv6 Interface-Local scope(loopback).*/
61 CT_SCOPE_INTERFACE (0x1),
63 /** IPv6 Link-Local scope (default).*/
66 /** IPv6 Realm-Local scope.*/
69 /** IPv6 Admin-Local scope.*/
72 /** IPv6 Site-Local scope.*/
75 /** IPv6 Organization-Local scope.*/
78 /** IPv6 Global scope.*/
79 CT_SCOPE_GLOBAL (0xE),
84 private OcConnectivityType(int value) {
88 public int getValue() {
92 public static EnumSet<OcConnectivityType> convertToEnumSet(int value) {
93 EnumSet<OcConnectivityType> typeSet = null;
95 for (OcConnectivityType v : values()) {
96 if (0 != (value & v.getValue())) {
97 if (null == typeSet) {
98 typeSet = EnumSet.of(v);
105 if (null == typeSet || typeSet.isEmpty()) {
106 throw new InvalidParameterException("Unexpected OcConnectivityType value:" + value);