replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / android / android_api / base / src / main / java / org / iotivity / base / OcProvisioning.java
index 636e590..395021f 100644 (file)
@@ -1,23 +1,23 @@
 /*
- * //******************************************************************
- * //
- * // Copyright 2015 Samsung Electronics All Rights Reserved.
- * //
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- * //
- * // Licensed under the Apache License, Version 2.0 (the "License");
- * // you may not use this file except in compliance with the License.
- * // You may obtain a copy of the License at
- * //
- * //      http://www.apache.org/licenses/LICENSE-2.0
- * //
- * // Unless required by applicable law or agreed to in writing, software
- * // distributed under the License is distributed on an "AS IS" BASIS,
- * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * // See the License for the specific language governing permissions and
- * // limitations under the License.
- * //
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ *******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  */
 
 package org.iotivity.base;
@@ -25,6 +25,7 @@ package org.iotivity.base;
 import java.util.List;
 import java.util.Arrays;
 import java.util.Map;
+import java.util.EnumSet;
 
 /**
  * OcProvisionig represents functions corresponding to the provisioing of
@@ -88,6 +89,81 @@ public class OcProvisioning {
     }
 
     /**
+     * Server API to set Callback for Displaying stack generated PIN.
+     *
+     * @param DisplayPinListener Pin callback Listener to be registered.
+     * @throws OcException
+     */
+    public static native void setDisplayPinListener(DisplayPinListener displayPinListener)
+        throws OcException;
+
+    public static interface DisplayPinListener {
+        public void displayPinListener(String Pin);
+    }
+
+    /**
+     * API to Set callback for displaying verifNum in verified Just-Works.
+     *
+     *@param DisplayNumListener callback Listener to be registered for
+                                            displaying VerifyNUm.
+     *@throws OcException
+     */
+    public static native void setDisplayNumListener(
+            DisplayNumListener displayNumListener) throws OcException;
+
+    public static interface DisplayNumListener {
+        public int displayNumListener(String verifyNum);
+    }
+
+    /**
+     * API to unregister DisplayNumListener Listener
+     *
+     *@return  0 on success, 1 on failure
+     *@throws OcException
+     */
+    public static native int unsetDisplayNumListener() throws OcException;
+
+    /**
+     * API to Set callback for getting user confirmation in verified
+     * Just-Works
+     *
+     *@param ConfirmNumListener callback Listener to be registered for getting user confirmation.
+     *@throws OcException
+     */
+    public static native void setConfirmNumListener(ConfirmNumListener
+            confirmNumListener) throws OcException;
+
+    public static interface ConfirmNumListener {
+        public int confirmNumListener();
+    }
+
+    /**
+     * API to unregister ConfirmMutualVerifyNum Listener
+     *
+     *@return  0 on success, 1 on failure
+     *@throws OcException
+     */
+    public static native int unsetConfirmNumListener() throws OcException;
+
+    /**
+     * API to set options for Mutual Verified Just-works
+     * Default is  for both screen PIN display and get user confirmation.
+     *
+     */
+    public static int setMVJustWorksOptions(EnumSet<MVJustWorksOptionMask> optionMask) throws OcException {
+
+        int optionMaskInt = 0;
+
+        for (MVJustWorksOptionMask ops : MVJustWorksOptionMask.values()) {
+            if (optionMask.contains(ops))
+                optionMaskInt |= ops.getValue();
+        }
+        return setMVJustWorksOptions0(optionMaskInt);
+    }
+
+    private static native int setMVJustWorksOptions0(int optionsMask) throws OcException;
+
+    /**
      * Method to get Array of owned and un-owned devices in the current subnet.
      *
      * @param timeout    timeout in sec for the API to return.
@@ -99,4 +175,63 @@ public class OcProvisioning {
         return Arrays.asList(OcProvisioning.getDeviceStatusList1(timeout));
     }
     private static native OcSecureResource[] getDeviceStatusList1(int timeout) throws OcException;
+
+    /**
+     *  Method to save the Trust certificate chain to SVR.
+     *
+     *  @param byte[]            trustCertChain
+     *  @param EncodingType                          encodingType
+     *  @throws OcException
+     */
+    public static int saveTrustCertChain(byte[] trustCertChain, EncodingType encodingType) throws OcException {
+        return saveTrustCertChain1(trustCertChain,encodingType.getValue());
+    }
+    private static native int saveTrustCertChain1(byte[] trustCertChain, int encodingType)
+        throws OcException;
+
+    /**
+     *  Method to save pin type.
+     *
+     *  @param pinSize Byte Len of Random pin.
+     *  @param pinType Enumset of pin, see PinType for enums
+     *  @throws OcException
+     */
+    public static int setPinType(int pinSize, EnumSet<PinType>  pinType) throws OcException {
+
+        int pinTypeInt = 0;
+
+        for (PinType ops : PinType.values()) {
+            if (pinType.contains(ops))
+                pinTypeInt |= ops.getValue();
+        }
+        return setPinType0(pinSize, pinTypeInt);
+    }
+    private static native int setPinType0(int pinSize, int pinType) throws OcException;
+
+    /**
+     *  Method to save the seed value to generate device UUID
+     *
+     *  @param seed   buffer of seed value
+     *  @throws OcException
+     */
+    public static int setDeviceIdSeed(byte[] seed) throws OcException {
+        return setDeviceIdSeed1(seed);
+    }
+    private static native int setDeviceIdSeed1(byte[] seed)
+        throws OcException;
+    
+    /**
+     * API to save ACL, having multiple ACE's
+     *
+     *@param acl object
+     *@throws OcException
+     */
+    public static native void saveACL(Object acl) throws OcException;
+
+    /**
+     * API to do self ownership transfer.
+     *
+     *@throws OcException
+     */
+    public static native void doSelfOwnershiptransfer() throws OcException;
 }