CJNIEXPORT jobject JNICALL Java_com_nextuc_IGroupTableDataSource_00024CppProxy_native_1objectAt(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jint j_section, jint j_row)
{
    try {
        DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
        const auto& ref = ::djinni::objectFromHandleAddress<::core_gen::IGroupTableDataSource>(nativeRef);
        auto r = ref->objectAt(::djinni::I32::toCpp(jniEnv, j_section),
                               ::djinni::I32::toCpp(jniEnv, j_row));
        return ::djinni::release(::djinni_generated::NativeRGroup::fromCpp(jniEnv, r));
    } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
CJNIEXPORT void JNICALL Java_com_demicapps_AnalyticsListener_00024CppProxy_native_1trackEvent(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jstring j_eventCategory, jstring j_eventAction, jstring j_eventLabel, jint j_eventValue)
{
    try {
        DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
        const auto& ref = ::djinni::objectFromHandleAddress<::demicapps::AnalyticsListener>(nativeRef);
        ref->TrackEvent(::djinni::String::toCpp(jniEnv, j_eventCategory),
                        ::djinni::String::toCpp(jniEnv, j_eventAction),
                        ::djinni::String::toCpp(jniEnv, j_eventLabel),
                        ::djinni::I32::toCpp(jniEnv, j_eventValue));
    } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
CJNIEXPORT jboolean JNICALL Java_dyno_fun_lapse_LapseSettingDlgGen_00024CppProxy_native_1onSave(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jint j_fps, jfloat j_lapse, jobject j_mode)
{
    try {
        DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
        const auto& ref = ::djinni::objectFromHandleAddress<::lpase::LapseSettingDlgGen>(nativeRef);
        auto r = ref->onSave(::djinni::I32::toCpp(jniEnv, j_fps),
                             ::djinni::F32::toCpp(jniEnv, j_lapse),
                             ::djinni_generated::NativeIntervalMode::toCpp(jniEnv, j_mode));
        return ::djinni::release(::djinni::Bool::fromCpp(jniEnv, r));
    } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
Exemplo n.º 4
0
CJNIEXPORT void JNICALL Java_de_knejp_schedulerstest_MainActivity_executeOnMainLooperScheduler(JNIEnv *jniEnv, jobject /*this*/, jobject j_r)
{
  struct java_lang_Runnable
  {
    const djinni::GlobalRef<jclass> clazz{djinni::jniFindClass("java/lang/Runnable")};
    const jmethodID method_run{djinni::jniGetMethodID(clazz.get(), "run", "()V")};
  };

  try {
    DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);

    // Don't bother the proxy cache for runnables as every task needs its own std::function anyway
    class F
    {
    public:
      F(JNIEnv* jniEnv, jobject runnable)
          : _runnable(jniEnv->NewGlobalRef(runnable))
      { }
      F(const F& other)
      {
        auto jniEnv = djinni::jniGetThreadEnv();
        _runnable = other._runnable ? jniEnv->NewGlobalRef(other._runnable) : nullptr;
      }
      F(F&& other) noexcept
      {
        _runnable = other._runnable;
        other._runnable = nullptr;
      }
      ~F()
      {
        if(_runnable)
        {
          djinni::jniGetThreadEnv()->DeleteGlobalRef(_runnable);
        }
      }

      void operator()() const
      {
        assert(_runnable && "lost runnable reference");
        auto& data = djinni::JniClass<java_lang_Runnable>::get();
        auto* env = djinni::jniGetThreadEnv();
        env->CallVoidMethod(_runnable, data.method_run);
        djinni::jniExceptionCheck(env);
      }

    private:
      // Can't use djinni::GlobalRef<jobject> because std::function requires CopyConstructible
      jobject _runnable;
    };

    (*theLooper)(F{jniEnv, j_r});

  } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
Exemplo n.º 5
0
CJNIEXPORT jlong JNICALL Java_org_rocketspeed_ClientImpl_00024CppProxy_native_1resubscribe(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jobject j_params, jobject j_deliverCb, jobject j_subscribeCb)
{
    try {
        DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
        const auto& ref = ::djinni::CppProxyHandle<::rocketspeed::djinni::ClientImpl>::get(nativeRef);
        auto r = ref->Resubscribe(::djinni_generated::NativeSubscriptionParameters::toCpp(jniEnv, j_params),
                                  ::djinni_generated::NativeMessageReceivedCallback::toCpp(jniEnv, j_deliverCb),
                                  ::djinni_generated::NativeSubscribeCallback::toCpp(jniEnv, j_subscribeCb));
        return ::djinni::I64::fromCpp(jniEnv, r);
    } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
Exemplo n.º 6
0
CJNIEXPORT jlong JNICALL Java_org_rocketspeed_ClientImpl_00024CppProxy_native_1subscribe(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jint j_tenantId, jstring j_namespaceId, jstring j_topicName, jlong j_startSeqno, jobject j_deliverCb, jobject j_subscribeCb)
{
    try {
        DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
        const auto& ref = ::djinni::CppProxyHandle<::rocketspeed::djinni::ClientImpl>::get(nativeRef);
        auto r = ref->Subscribe(::djinni::I32::toCpp(jniEnv, j_tenantId),
                                ::djinni::String::toCpp(jniEnv, j_namespaceId),
                                ::djinni::String::toCpp(jniEnv, j_topicName),
                                ::djinni::I64::toCpp(jniEnv, j_startSeqno),
                                ::djinni_generated::NativeMessageReceivedCallback::toCpp(jniEnv, j_deliverCb),
                                ::djinni_generated::NativeSubscribeCallback::toCpp(jniEnv, j_subscribeCb));
        return ::djinni::I64::fromCpp(jniEnv, r);
    } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
Exemplo n.º 7
0
CJNIEXPORT jobject JNICALL Java_org_rocketspeed_ClientImpl_00024CppProxy_native_1publish(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jint j_tenantId, jstring j_namespaceId, jstring j_topicName, jbyteArray j_data, jobject j_publishCb, jobject j_messageId)
{
    try {
        DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
        const auto& ref = ::djinni::CppProxyHandle<::rocketspeed::djinni::ClientImpl>::get(nativeRef);
        auto r = ref->Publish(::djinni::I32::toCpp(jniEnv, j_tenantId),
                              ::djinni::String::toCpp(jniEnv, j_namespaceId),
                              ::djinni::String::toCpp(jniEnv, j_topicName),
                              ::djinni::Binary::toCpp(jniEnv, j_data),
                              ::djinni_generated::NativePublishCallback::toCpp(jniEnv, j_publishCb),
                              ::djinni_generated::NativeMsgId::toCpp(jniEnv, j_messageId));
        return ::djinni_generated::NativeMsgId::fromCpp(jniEnv, r).release();
    } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}