2 * //******************************************************************
4 * // Copyright 2015 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.Arrays;
30 * OcProvisionig represents functions corresponding to the provisioing of
33 public class OcProvisioning {
36 * Method to Intialize Provisioning Manager.This will load the provisioning
37 * Manager's persistent database.
39 * @param dbPath dbPath file path of the sqlite3 db.
42 public static native void provisionInit(String dbPath) throws OcException;
45 * Method to Discover un-owned devices in its subnet.Un-owned devices need
46 * to be owned by calling ownershipTransferCBdata.
48 * @param timeout Timeout in sec.Time to listen for responses before
49 * returining the Array.
50 * @return Array of OcSecureResource class objects.
53 public static List<OcSecureResource> discoverUnownedDevices(int timeout) throws OcException {
54 return Arrays.asList(OcProvisioning.discoverUnownedDevices1(timeout));
56 private static native OcSecureResource[] discoverUnownedDevices1(int timeout) throws OcException;
59 * Method to Discover owned devices in its subnet.
61 * @param timeout Timeout in sec.Time to listen for responses before
62 * returining the Array.
63 * @return Array of OcSecureResource class objects.
66 public static List<OcSecureResource> discoverOwnedDevices(int timeout) throws OcException {
67 return Arrays.asList(OcProvisioning.discoverOwnedDevices1(timeout));
69 private static native OcSecureResource[] discoverOwnedDevices1(int timeout) throws OcException;
72 * API for registering Ownership transfer methods for a particular
75 * @param type OxmType ownership transfer type.
78 public static void SetownershipTransferCBdata(OxmType type,
79 PinCallbackListener pinCallbackListener) throws OcException
81 OcProvisioning.ownershipTransferCBdata(type.getValue(), pinCallbackListener);
84 private static native void ownershipTransferCBdata(int oxmType, PinCallbackListener pinCallbackListener);
86 public static interface PinCallbackListener {
87 public String pinCallbackListener();
91 * Server API to set Callback for Displaying stack generated PIN.
93 * @param DisplayPinListener Pin callback Listener to be registered.
96 public static native void setDisplayPinListener(DisplayPinListener displayPinListener)
99 public static interface DisplayPinListener {
100 public void displayPinListener(String Pin);
104 * Method to get Array of owned and un-owned devices in the current subnet.
106 * @param timeout timeout in sec for the API to return.
107 * @retrun Array of OcSecureResource class objects.
109 * @throws OcException
111 public static List<OcSecureResource> getDeviceStatusList(int timeout) throws OcException {
112 return Arrays.asList(OcProvisioning.getDeviceStatusList1(timeout));
114 private static native OcSecureResource[] getDeviceStatusList1(int timeout) throws OcException;