diff options
Diffstat (limited to 'lib/libUPnP/Platinum/Source/Platform/Android/module/platinum/jni/platinum-jni.cpp')
-rw-r--r-- | lib/libUPnP/Platinum/Source/Platform/Android/module/platinum/jni/platinum-jni.cpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/lib/libUPnP/Platinum/Source/Platform/Android/module/platinum/jni/platinum-jni.cpp b/lib/libUPnP/Platinum/Source/Platform/Android/module/platinum/jni/platinum-jni.cpp new file mode 100644 index 0000000..eb5209a --- /dev/null +++ b/lib/libUPnP/Platinum/Source/Platform/Android/module/platinum/jni/platinum-jni.cpp @@ -0,0 +1,81 @@ +/***************************************************************** +| +| Android JNI Interface +| +| (c) 2002-2012 Plutinosoft LLC +| Author: Sylvain Rebaud (sylvain@plutinosoft.com) +| + ****************************************************************/ + +/*---------------------------------------------------------------------- +| includes ++---------------------------------------------------------------------*/ +#include <assert.h> +#include <jni.h> +#include <string.h> +#include <sys/types.h> + +#include "platinum-jni.h" +#include "Platinum.h" + +#include <android/log.h> + +/*---------------------------------------------------------------------- +| logging ++---------------------------------------------------------------------*/ +NPT_SET_LOCAL_LOGGER("platinum.android.jni") + +/*---------------------------------------------------------------------- +| functions ++---------------------------------------------------------------------*/ +__attribute__((constructor)) static void onDlOpen(void) +{ +} + +/*---------------------------------------------------------------------- +| JNI_OnLoad ++---------------------------------------------------------------------*/ +JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) +{ + NPT_LogManager::GetDefault().Configure("plist:.level=FINE;.handlers=ConsoleHandler;.ConsoleHandler.outputs=2;.ConsoleHandler.colors=false;.ConsoleHandler.filter=59"); + return JNI_VERSION_1_4; +} + +/* + * Class: com_plutinosoft_platinum_UPnP + * Method: _init + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_com_plutinosoft_platinum_UPnP__1init(JNIEnv *env, jclass) +{ + NPT_LOG_INFO("init"); + PLT_UPnP* self = new PLT_UPnP(); + return (jlong)self; +} + +/* + * Class: com_plutinosoft_platinum_UPnP + * Method: _start + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_com_plutinosoft_platinum_UPnP__1start(JNIEnv *, jclass, jlong _self) +{ + NPT_LOG_INFO("start"); + PLT_UPnP* self = (PLT_UPnP*)_self; + + return self->Start(); +} + +/* + * Class: com_plutinosoft_platinum_UPnP + * Method: _stop + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_com_plutinosoft_platinum_UPnP__1stop(JNIEnv *, jclass, jlong _self) +{ + NPT_LOG_INFO("stop"); + PLT_UPnP* self = (PLT_UPnP*)_self; + + return self->Stop(); +} + |