Merge branch 'master' into windows-port
[platform/upstream/iotivity.git] / android / android_api / base / src / main / java / org / iotivity / base / OcPlatform.java
index 5b2388d..d08b1c6 100644 (file)
@@ -1,28 +1,29 @@
 /*
- * //******************************************************************
- * //
- * // Copyright 2015 Intel Corporation.
- * //
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- * //
- * // 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 Intel Corporation.
+ *
+ *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ *
+ * 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;
 
 import org.iotivity.ca.CaInterface;
+import org.iotivity.base.BuildConfig;
 
 import java.util.EnumSet;
 import java.util.Iterator;
@@ -40,6 +41,10 @@ public final class OcPlatform {
         System.loadLibrary("octbstack");
         System.loadLibrary("connectivity_abstraction");
         System.loadLibrary("oc");
+        if (0 != BuildConfig.SECURED)
+        {
+            System.loadLibrary("ocprovision");
+        }
         System.loadLibrary("ocstack-jni");
     }
 
@@ -70,6 +75,7 @@ public final class OcPlatform {
     public static final String PRESENCE_URI = "/oic/ad";
 
     private static volatile boolean sIsPlatformInitialized = false;
+    private static QualityOfService sPlatformQualityOfService = QualityOfService.NA;
 
     private OcPlatform() {
     }
@@ -84,7 +90,9 @@ public final class OcPlatform {
      */
     public synchronized static void Configure(PlatformConfig platformConfig) {
         if (!sIsPlatformInitialized) {
-            CaInterface.initialize(platformConfig.getContext());
+            CaInterface.initialize(platformConfig.getActivity(), platformConfig.getContext());
+
+            sPlatformQualityOfService = platformConfig.getQualityOfService();
 
             OcPlatform.configure(
                     platformConfig.getServiceType().getValue(),
@@ -463,7 +471,7 @@ public final class OcPlatform {
 
     /**
      * This API registers a resource with the server
-     * <P>
+     * <p/>
      * Note: This API applies to server & client side.
      * </P>
      *
@@ -482,9 +490,10 @@ public final class OcPlatform {
 
     /**
      * This API registers a resource with the server NOTE: This API applies to server side only.
-     * <P>
+     * <p/>
      * Note: This API applies to server side only.
      * </P>
+     *
      * @param resourceUri         The URI of the resource. Example: "a/light"
      * @param resourceTypeName    The resource type. Example: "light"
      * @param resourceInterface   The resource interface (whether it is collection etc).
@@ -933,4 +942,14 @@ public final class OcPlatform {
                     "OcPlatform.Configure before any other API calls are permitted");
         }
     }
+
+    /**
+     * Gets platform quality of service
+     *
+     * @return quality of service
+     */
+    public static QualityOfService getPlatformQualityOfService() {
+        OcPlatform.initCheck();
+        return sPlatformQualityOfService;
+    }
 }