replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / android / android_api / base / src / main / java / org / iotivity / base / OcProvisioning.java
index 8cb282b..395021f 100644 (file)
@@ -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
@@ -101,6 +102,68 @@ public class OcProvisioning {
     }
 
     /**
+     * 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.
@@ -125,4 +188,50 @@ public class OcProvisioning {
     }
     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;
 }