{
port = static_cast<uint16_t>(jPort);
}
+
PlatformConfig cfg{
JniUtils::getServiceType(env, jServiceType),
JniUtils::getModeType(env, jModeType),
JniUtils::getQOS(env, static_cast<int>(jQOS)),
JniOcSecurity::getOCPersistentStorage()
};
-
OCPlatform::Configure(cfg);
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
return nullptr;
}
JniOcResourceHandle* jniHandle = new JniOcResourceHandle(resourceHandle);
{
LOGE("%s", e.reason().c_str());
delete entityHandler;
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
return nullptr;
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("Error is due to %s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
return nullptr;
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
return nullptr;
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
catch (OCException& e)
{
LOGE("%s", e.reason().c_str());
- ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
}
}
return m_sharedResource->observe(observeType, queryParametersMap, observeCallback, QoS);
}
-OCStackResult JniOcResource::cancelObserve(JNIEnv* env)
-{
- //this->m_onObserveManager.removeAllListeners(env);
- return m_sharedResource->cancelObserve();
-}
-
OCStackResult JniOcResource::cancelObserve(JNIEnv* env, QualityOfService qos)
{
- //TODO confirm behavior
- //add removal of java listeners by qos
- //this->m_onObserveManager.removeAllListeners(env);
+ if (QualityOfService::HighQos != qos)
+ {
+ this->m_onObserveManager.removeAllListeners(env);
+ }
return m_sharedResource->cancelObserve(qos);
}
/*
* Class: org_iotivity_base_OcResource
-* Method: cancelObserve
-* Signature: ()V
-*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_cancelObserve
-(JNIEnv *env, jobject thiz)
-{
- LOGD("OcResource_cancelObserve");
- JniOcResource *resource = JniOcResource::getJniOcResourcePtr(env, thiz);
- if (!resource) return;
-
- try
- {
- OCStackResult result = resource->cancelObserve(env);
-
- if (OC_STACK_OK != result)
- {
- ThrowOcException(result, "OcResource_cancelObserve");
- }
- }
- catch (OCException& e)
- {
- LOGE("%s", e.reason().c_str());
- ThrowOcException(e.code(), e.reason().c_str());
- }
-}
-
-/*
-* Class: org_iotivity_base_OcResource
* Method: cancelObserve1
* Signature: I)V
*/