Sha256: f41e11b1524bcbf10bd7e9b2dd0177b47a7c737a015ce7b92ff70d789124d41a

Contents?: true

Size: 1.57 KB

Versions: 14

Compression:

Stored size: 1.57 KB

Contents

#include "rhodes.h"
#include "PrinterZebra.h"

#include "logging/RhoLog.h"
#undef DEFAULT_LOGCATEGORY
#define DEFAULT_LOGCATEGORY "PrintingZebra_impl"

#define PRINTINGZEBRA_FACTORY_CLASS "com.rho.printerzebra.PrinterZebraFactory"

extern "C" void Init_PrinterZebra_API(void);

extern "C" void Init_PrintingZebra(void)
{
    RAWTRACE(__FUNCTION__);

    JNIEnv *env = jnienv();
    if(env)
    {
        jclass cls = rho_find_class(env, PRINTINGZEBRA_FACTORY_CLASS);
        if(!cls)
        {
            RAWLOG_ERROR1("Failed to find java class: %s", PRINTINGZEBRA_FACTORY_CLASS);
            return;
        }
        jmethodID midFactory = env->GetMethodID(cls, "<init>", "()V");
        if(!midFactory)
        {
            RAWLOG_ERROR1("Failed to get constructor for java class %s", PRINTINGZEBRA_FACTORY_CLASS);
            return;
        }
        jobject jFactory = env->NewObject(cls, midFactory);
        if(env->IsSameObject(jFactory, NULL))
        {
            RAWLOG_ERROR1("Failed to create %s instance", PRINTINGZEBRA_FACTORY_CLASS);
            return;
        }
        
        RAWTRACE("Initializing Java factory");

        rho::CPrinterZebraBase::setJavaFactory(env, jFactory);

        RAWTRACE("Deleting JNI reference");

        env->DeleteLocalRef(jFactory);

        RAWTRACE("Initializing API");

        Init_PrinterZebra_API();

        RAWTRACE("Init_PrintingZebra succeeded");
    }
    else
    {
        RAWLOG_ERROR("Failed to initialize PrintingZebra API: jnienv() is failed");
    }

}

extern "C" void Init_PrintingZebra_extension() {
    Init_PrintingZebra();
}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rhodes-7.6.0 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp
rhodes-7.5.1 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp
rhodes-7.4.1 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp
rhodes-7.1.17 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp
rhodes-6.2.0 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp
rhodes-6.0.11 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp
rhodes-5.5.18 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp
rhodes-5.5.17 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp
rhodes-5.5.15 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp
rhodes-5.5.0.22 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp
rhodes-5.5.2 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp
rhodes-5.5.0.7 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp
rhodes-5.5.0.3 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp
rhodes-5.5.0 lib/commonAPI/printing_zebra/ext/platform/android/jni/PrinterZebra_impl.cpp