2 * //******************************************************************
4 * // Copyright 2016 Samsung Electronics All Rights Reserved.
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.util.List;
26 import java.util.EnumSet;
28 import java.util.Arrays;
29 import java.util.ArrayList;
31 public class OcDirectPairDevice {
34 private long mNativeHandle;
35 private String mdeviceID;
38 private OcDirectPairDevice(long nativeHandle) {
39 this.mNativeHandle = nativeHandle;
42 public OcDirectPairDevice(String deviceID)
44 this.mdeviceID = deviceID;
47 public String getDevId()
49 return this.mdeviceID;
52 public native String getHost();
54 public List<Integer> getPairingMethodList() {
55 int [] intList = this.getPairingMethods();
56 List<Integer> prmList = new ArrayList<Integer>();
57 for (int i = 0; i < intList.length; i++)
59 prmList.add(intList[i]);
64 private native int[] getPairingMethods();
67 * Method to get the connectivity type of this resource
69 * @return EnumSet<OcConnectivityType></OcConnectivityType> connectivity type set
71 public EnumSet<OcConnectivityType> getConnectivityTypeSet() {
72 return OcConnectivityType.convertToEnumSet(
73 this.getConnectivityTypeN()
77 private native int getConnectivityTypeN();
81 * Method to get list of all paired devices for a given device.
83 * @param GetDirectPairedListener Callback function, which will receive the list of direct paired devices.
87 public native void getDirectPairedDevices(GetDirectPairedListener getDirectPairedListener) throws OcException;
89 public interface GetDirectPairedListener {
90 public void getDirectPairedListener(List<String> ocPairedDeviceList);
94 * Method to perform direct pairing between two devices.
96 * @param DirectPairingListener Callback function, which will be called after
97 * completion of direct pairing.
100 public native void doDirectPairing(OcDirectPairDevice peer,
101 OcPrmType pmSel, String pinNumber,
102 DirectPairingListener directPairingListener) throws OcException;
105 public interface DirectPairingListener {
106 public void directPairingListener(String devId, int result);
110 public String toString() {
111 return this.mdeviceID;