2020-05-06 18:03:37 +08:00
|
|
|
|
//
|
|
|
|
|
// Created by dell on 2017/9/1.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#ifndef DXL_TOOLS_H
|
|
|
|
|
#define DXL_TOOLS_H
|
|
|
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
|
#include <android/log.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
//JNI LOG
|
2020-05-07 16:57:15 +08:00
|
|
|
|
#define TAG "PM3"
|
2020-05-06 18:03:37 +08:00
|
|
|
|
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE,TAG,__VA_ARGS__)
|
|
|
|
|
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,TAG,__VA_ARGS__)
|
|
|
|
|
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,TAG,__VA_ARGS__)
|
|
|
|
|
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,TAG,__VA_ARGS__)
|
|
|
|
|
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,TAG,__VA_ARGS__)
|
|
|
|
|
|
2020-05-07 16:57:15 +08:00
|
|
|
|
// a global jvm instance
|
2020-05-06 18:03:37 +08:00
|
|
|
|
JavaVM *g_JavaVM;
|
|
|
|
|
|
2020-05-07 16:57:15 +08:00
|
|
|
|
// get current env for jvm
|
2020-05-06 18:03:37 +08:00
|
|
|
|
JNIEnv *getJniEnv();
|
|
|
|
|
|
2020-05-07 16:57:15 +08:00
|
|
|
|
// detach native thread from jvm, must native thread can detach!
|
|
|
|
|
void detachThread();
|
2020-05-06 18:03:37 +08:00
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
char **cmd;
|
|
|
|
|
int len;
|
|
|
|
|
} CMD;
|
|
|
|
|
|
2020-05-07 16:57:15 +08:00
|
|
|
|
// cmd arg parse
|
2020-05-06 18:03:37 +08:00
|
|
|
|
CMD *parse_command_line(const char *commandStr);
|
|
|
|
|
|
2020-05-07 16:57:15 +08:00
|
|
|
|
// cmd arg struct free
|
2020-05-06 18:03:37 +08:00
|
|
|
|
void free_command_line(CMD *);
|
|
|
|
|
|
2020-05-06 19:38:51 +08:00
|
|
|
|
#endif //DXL_TOOLS_H
|