replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / resource-encapsulation / android / service / src / main / jni / JniRcsRemoteResourceObject.cpp
index 91e4b99..fd84e22 100644 (file)
@@ -135,7 +135,8 @@ namespace
         }
     }
 
-    void onCacheUpdated(const RCSResourceAttributes& attrs, const JavaGlobalRef& listener)
+    void onCacheUpdated(const RCSResourceAttributes& attrs, int eCode,
+                        const JavaGlobalRef& listener)
     {
         LOGD("onCacheUpdated");
 
@@ -186,7 +187,7 @@ void initRCSRemoteResourceObject(JNIEnvWrapper* env)
 
     auto clsOnCacheUpdatedListener = env->FindClass(CLS_NAME_ON_CACHE_UPDATED_LISTENER);
     g_method_onCacheUpdated = env->GetMethodID(clsOnCacheUpdatedListener, "onCacheUpdated",
-            "(" AS_SIG(CLS_NAME_RESOURCEATTRIBUTES) ")V");
+            "(" AS_SIG(CLS_NAME_RESOURCEATTRIBUTES) "I)V");
 
     auto clsOnRemoteAttributesReceivedListener =
             env->FindClass(CLS_NAME_ON_REMOTE_ATTRIBUTES_RECEIVED_LISTENER);
@@ -297,7 +298,7 @@ Java_org_iotivity_service_client_RcsRemoteResourceObject_nativeStartMonitoring
         res->startMonitoring(
                 std::bind(onStateChanged, std::placeholders::_1, JavaGlobalRef{ env, listener }));
     }
-    catch (const BadRequestException& e)
+    catch (const RCSBadRequestException& e)
     {
         env->ThrowNew(env->FindClass(EXC_NAME_ILLEGAL_STATE), e.what());
     }
@@ -341,14 +342,15 @@ Java_org_iotivity_service_client_RcsRemoteResourceObject_nativeStartCaching
         if (listener)
         {
             res->startCaching(std::bind(onCacheUpdated,
-                    std::placeholders::_1, JavaGlobalRef{ env, listener }));
+                    std::placeholders::_1, std::placeholders::_2,
+                    JavaGlobalRef{ env, listener }));
         }
         else
         {
             res->startCaching();
         }
     }
-    catch (const BadRequestException& e)
+    catch (const RCSBadRequestException& e)
     {
         env->ThrowNew(env->FindClass(EXC_NAME_ILLEGAL_STATE), e.what());
     }
@@ -391,7 +393,7 @@ Java_org_iotivity_service_client_RcsRemoteResourceObject_nativeIsCachedAvailable
     {
         return res->isCachedAvailable();
     }
-    catch (const BadRequestException& e)
+    catch (const RCSBadRequestException& e)
     {
         env->ThrowNew(env->FindClass(EXC_NAME_ILLEGAL_STATE), e.what());
         return false;
@@ -414,7 +416,7 @@ Java_org_iotivity_service_client_RcsRemoteResourceObject_nativeGetCachedAttribut
 
         return newAttributesObject(env, attrs);
     }
-    catch (const BadRequestException& e)
+    catch (const RCSBadRequestException& e)
     {
         env->ThrowNew(env->FindClass(EXC_NAME_ILLEGAL_STATE), e.what());
         return { };
@@ -436,7 +438,7 @@ Java_org_iotivity_service_client_RcsRemoteResourceObject_nativeGetRemoteAttribut
         res->getRemoteAttributes(std::bind(onRemoteAttributesReceived,
                 std::placeholders::_1, std::placeholders::_2, JavaGlobalRef{ env, listener }));
     }
-    catch (const PlatformException& e) {
+    catch (const RCSPlatformException& e) {
         throwPlatformException(env, e);
     }
 }
@@ -457,7 +459,7 @@ Java_org_iotivity_service_client_RcsRemoteResourceObject_nativeSetRemoteAttribut
         res->setRemoteAttributes(attrs, std::bind(onRemoteAttributesReceived,
                 std::placeholders::_1, std::placeholders::_2, JavaGlobalRef{ env, listener }));
     }
-    catch (const PlatformException& e) {
+    catch (const RCSPlatformException& e) {
         throwPlatformException(env, e);
     }
 }