Browse Source

Backed out changeset 07109e065126

JNI-88
Hussein Kasem 3 years ago
parent
commit
162a5aa6e2
2 changed files with 17 additions and 11 deletions
  1. +12
    -6
      src/foundation_pEp_jniadapter_AbstractEngine.cc
  2. +5
    -5
      src/gen_java_Engine.ysl2

+ 12
- 6
src/foundation_pEp_jniadapter_AbstractEngine.cc View File

@ -39,7 +39,7 @@ namespace pEp {
jmethodID messageConstructorMethodID = nullptr;
jmethodID messageToSendMethodID = nullptr;
jmethodID notifyHandShakeMethodID = nullptr;
jmethodID needsFastPollMethodID = nullptr;
jmethodID needsFastPollMethodID = nullptr;
jmethodID method_values = nullptr;
jobject obj = nullptr;
@ -91,7 +91,7 @@ namespace pEp {
messageConstructorMethodID = _env->GetMethodID(messageClass, "<init>", "(J)V");
messageToSendMethodID = _env->GetMethodID(
engineClass,
"messageToSendCallFromC",
"messageToSendCallFromC",
"(Lfoundation/pEp/jniadapter/Message;)I");
needsFastPollMethodID = _env->GetMethodID(
engineClass,
@ -143,14 +143,14 @@ namespace pEp {
assert(signalClass);
assert(method_values);
assert(field_value);
jobjectArray values = (jobjectArray) o.env()->CallStaticObjectMethod(signalClass,
method_values);
if (o.env()->ExceptionCheck()) {
o.env()->ExceptionClear();
return PEP_UNKNOWN_ERROR;
}
jsize values_size = o.env()->GetArrayLength(values);
for (jsize i = 0; i < values_size; i++) {
jobject element = o.env()->GetObjectArrayElement(values, i);
@ -268,7 +268,7 @@ extern "C" {
thread = (pthread_t *) env->GetLongField(obj, thread_handle);
if (thread)
return;
thread = (pthread_t *) calloc(1, sizeof(pthread_t));
assert(thread);
env->SetLongField(obj, thread_handle, (jlong) thread);
@ -304,7 +304,7 @@ extern "C" {
thread = (pthread_t *) env->GetLongField(obj, thread_handle);
if (!thread)
return;
queue = (locked_queue< pEp_identity * > *) env->GetLongField(obj, queue_handle);
env->SetLongField(obj, queue_handle, (jlong) 0);
@ -340,5 +340,11 @@ extern "C" {
shutdown();
}
JNIEXPORT jboolean JNICALL Java_foundation_pEp_jniadapter_AbstractEngine_isSyncRunning
(JNIEnv *, jobject)
{
return (jboolean) is_sync_thread(session());
}
} // extern "C"

+ 5
- 5
src/gen_java_Engine.ysl2 View File

@ -37,20 +37,20 @@ tstylesheet {
||
otherwise {
||
private native «$itype» _«@name»(`apply "parm/*", mode=basic_iparm`);
private native «$itype» «@name»(`apply "parm/*", mode=basic_iparm`);
public «$jtype» «@name»(`apply "parm/*", mode=basic_parm`) {
||
apply "parm/*", mode=basic_parm_set;
choose {
when "@type = 'void'"
|> _«@name»(`apply "parm/*", mode=basic_parm_name`);
|> «@name»(`apply "parm/*", mode=basic_parm_name`);
when "@type = 'identity'"
|> return new Identity(_«@name»(`apply "parm/*", mode=basic_parm_name`));
|> return new Identity(«@name»(`apply "parm/*", mode=basic_parm_name`));
when "@type = 'bool'"
|> return new Boolean(_«@name»(`apply "parm/*", mode=basic_parm_name`));
|> return new Boolean(«@name»(`apply "parm/*", mode=basic_parm_name`));
otherwise
|> return AbstractEngine.toUTF16(_«@name»(`apply "parm/*", mode=basic_parm_name`));
|> return AbstractEngine.toUTF16(«@name»(`apply "parm/*", mode=basic_parm_name`));
}
||
}


Loading…
Cancel
Save