mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
Translation some comments from Chinese to English.
This commit is contained in:
parent
59453aea8b
commit
e8999f3318
4 changed files with 48 additions and 70 deletions
|
@ -79,7 +79,7 @@ static bool open() {
|
|||
}
|
||||
|
||||
/*
|
||||
* 发送一条命令等待执行!
|
||||
* Transfers to the command buffer and waits for a new command to be executed
|
||||
* */
|
||||
jint sendCMD(JNIEnv *env, jobject instance, jstring cmd_) {
|
||||
//may be pm3 not running.
|
||||
|
@ -93,19 +93,9 @@ jint sendCMD(JNIEnv *env, jobject instance, jstring cmd_) {
|
|||
CloseProxmark();
|
||||
}
|
||||
}
|
||||
//无论如何,新的命令的输入了,就要换个行!
|
||||
// display on new line
|
||||
PrintAndLogEx(NORMAL, "\n");
|
||||
char *cmd = (char *)((*env)->GetStringUTFChars(env, cmd_, 0));
|
||||
// Many parts of the PM3 client will assume that they can read any write from pwd. So we set
|
||||
// pwd to whatever the PM3 "executable directory" is, to get consistent behaviour.
|
||||
/*int ret = chdir(get_my_executable_directory());
|
||||
if (ret == -1) {
|
||||
LOGW("Couldn't chdir(get_my_executable_directory()), errno=%s", strerror(errno));
|
||||
}
|
||||
char pwd[1024];
|
||||
memset((void *) &pwd, 0, sizeof(pwd));
|
||||
getcwd((char *) &pwd, sizeof(pwd));
|
||||
LOGI("pwd = %s", pwd);*/
|
||||
char *cmd = (char *) ((*env)->GetStringUTFChars(env, cmd_, 0));
|
||||
int ret = CommandReceived(cmd);
|
||||
if (ret == 99) {
|
||||
// exit / quit
|
||||
|
@ -117,14 +107,14 @@ jint sendCMD(JNIEnv *env, jobject instance, jstring cmd_) {
|
|||
}
|
||||
|
||||
/*
|
||||
* 是否在执行命令
|
||||
* Is client running!
|
||||
* */
|
||||
jboolean isExecuting(JNIEnv *env, jobject instance) {
|
||||
return (jboolean)((jboolean) conn.run);
|
||||
return (jboolean) ((jboolean) conn.run);
|
||||
}
|
||||
|
||||
/*
|
||||
* 进行设备链接验证!
|
||||
* test hw and hw and client.
|
||||
* */
|
||||
jboolean testPm3(JNIEnv *env, jobject instance) {
|
||||
bool ret1 = open();
|
||||
|
@ -133,13 +123,19 @@ jboolean testPm3(JNIEnv *env, jobject instance) {
|
|||
return false;
|
||||
}
|
||||
bool ret2 = TestProxmark() == PM3_SUCCESS;
|
||||
return (jboolean)(ret1 && ret2);
|
||||
return (jboolean) (ret1 && ret2);
|
||||
}
|
||||
|
||||
/*
|
||||
* stop pm3 client
|
||||
* */
|
||||
void stopPm3(JNIEnv *env, jobject instance) {
|
||||
CloseProxmark();
|
||||
}
|
||||
|
||||
/*
|
||||
* native function map to jvm
|
||||
* */
|
||||
JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
|
||||
JNIEnv *jniEnv = NULL;
|
||||
if ((*vm)->GetEnv(vm, (void **) &jniEnv, JNI_VERSION_1_4) != JNI_OK) {
|
||||
|
@ -152,21 +148,21 @@ JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
|
|||
}
|
||||
jclass clz_test = (*jniEnv)->FindClass(jniEnv, "cn/rrg/devices/Proxmark3RRGRdv4");
|
||||
JNINativeMethod methods[] = {
|
||||
{"startExecute", "(Ljava/lang/String;)I", (void *) sendCMD},
|
||||
{"stopExecute", "()V", (void *) stopPm3},
|
||||
{"isExecuting", "()Z", (void *) isExecuting}
|
||||
{"startExecute", "(Ljava/lang/String;)I", (void *) sendCMD},
|
||||
{"stopExecute", "()V", (void *) stopPm3},
|
||||
{"isExecuting", "()Z", (void *) isExecuting}
|
||||
};
|
||||
JNINativeMethod methods1[] = {
|
||||
{"testPm3", "()Z", (void *) testPm3},
|
||||
{"closePm3", "()V", stopPm3}
|
||||
{"testPm3", "()Z", (void *) testPm3},
|
||||
{"closePm3", "()V", stopPm3}
|
||||
};
|
||||
if ((*jniEnv)->RegisterNatives(jniEnv, clazz, methods, sizeof(methods) / sizeof(methods[0])) !=
|
||||
JNI_OK) {
|
||||
JNI_OK) {
|
||||
return -1;
|
||||
}
|
||||
if ((*jniEnv)->RegisterNatives(jniEnv, clz_test, methods1,
|
||||
sizeof(methods1) / sizeof(methods1[0])) !=
|
||||
JNI_OK) {
|
||||
JNI_OK) {
|
||||
return -1;
|
||||
}
|
||||
(*jniEnv)->DeleteLocalRef(jniEnv, clazz);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue