예제 #1
0
파일: MainC.c 프로젝트: wifigeek/ohNet
int main(int argc, char* argv[])
{
    OhNetHandleInitParams initParams = OhNetInitParamsCreate();
    OhNetInitParamsSetLogOutput(initParams, logger, NULL);
    OhNetTestRunner(initParams);
    return 0;
}
예제 #2
0
/*
 * Class:     org_openhome_net_core_InitParams
 * Method:    OhNetInitParamsSetLogOutput
 * Signature: (JLorg/openhome/net/core/IMessageListener;)J
 */
JNIEXPORT jlong JNICALL Java_org_openhome_net_core_InitParams_OhNetInitParamsSetLogOutput
  (JNIEnv *aEnv, jclass aClass, jlong aParams, jobject aListener)
{
    OhNetHandleInitParams params = (OhNetHandleInitParams) (size_t)aParams;
    OhNetCallbackMsg callback = (OhNetCallbackMsg) &CallbackMessage;
    JniObjRef *ref = (JniObjRef*) malloc(sizeof(JniObjRef));
    int ret;
    aClass = aClass;

    ret = (*aEnv)->GetJavaVM(aEnv, &ref->vm);
    if (ret < 0) {
        printf("Unable to get reference to the current Java VM.\n");
    }
    ref->callbackObj = (*aEnv)->NewGlobalRef(aEnv, aListener);
    
    OhNetInitParamsSetLogOutput(params, callback, ref);

    return (jlong) (size_t)ref;
}