mirror of
https://github.com/RfidResearchGroup/RFIDtools.git
synced 2026-05-12 11:19:59 -07:00
Generated
+29
-14
@@ -4,20 +4,35 @@
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/AndroidProject-RFID-Tools.iml" filepath="$PROJECT_DIR$/AndroidProject-RFID-Tools.iml" group="RFID-Tools" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/RFID-Tools.iml" filepath="$PROJECT_DIR$/.idea/RFID-Tools.iml" group="RFID-Tools" />
|
||||
<module fileurl="file://$PROJECT_DIR$/app_main/app_main.iml" filepath="$PROJECT_DIR$/app_main/app_main.iml" group="RFID-Tools/app_main" />
|
||||
<module fileurl="file://$PROJECT_DIR$/chameleon/chameleon.iml" filepath="$PROJECT_DIR$/chameleon/chameleon.iml" group="RFID-Tools/chameleon" />
|
||||
<module fileurl="file://$PROJECT_DIR$/communication/communication.iml" filepath="$PROJECT_DIR$/communication/communication.iml" group="RFID-Tools/communication" />
|
||||
<module fileurl="file://$PROJECT_DIR$/console/console.iml" filepath="$PROJECT_DIR$/console/console.iml" group="RFID-Tools/console" />
|
||||
<module fileurl="file://$PROJECT_DIR$/crapto1/crapto1.iml" filepath="$PROJECT_DIR$/crapto1/crapto1.iml" group="RFID-Tools/crapto1" />
|
||||
<module fileurl="file://$PROJECT_DIR$/io_redirect/io_redirect.iml" filepath="$PROJECT_DIR$/io_redirect/io_redirect.iml" group="RFID-Tools/io_redirect" />
|
||||
<module fileurl="file://$PROJECT_DIR$/libnfc_pn53x/libnfc_pn53x.iml" filepath="$PROJECT_DIR$/libnfc_pn53x/libnfc_pn53x.iml" group="RFID-Tools/libnfc_pn53x" />
|
||||
<module fileurl="file://$PROJECT_DIR$/mfkey_32_64/mfkey_32_64.iml" filepath="$PROJECT_DIR$/mfkey_32_64/mfkey_32_64.iml" group="RFID-Tools/mfkey_32_64" />
|
||||
<module fileurl="file://$PROJECT_DIR$/mifaretag/mifaretag.iml" filepath="$PROJECT_DIR$/mifaretag/mifaretag.iml" group="RFID-Tools/mifaretag" />
|
||||
<module fileurl="file://$PROJECT_DIR$/pm3flasher/pm3flasher.iml" filepath="$PROJECT_DIR$/pm3flasher/pm3flasher.iml" group="RFID-Tools/pm3flasher" />
|
||||
<module fileurl="file://$PROJECT_DIR$/pm3iceman/pm3iceman.iml" filepath="$PROJECT_DIR$/pm3iceman/pm3iceman.iml" group="RFID-Tools/pm3iceman" />
|
||||
<module fileurl="file://$PROJECT_DIR$/pm3official/pm3official.iml" filepath="$PROJECT_DIR$/pm3official/pm3official.iml" group="RFID-Tools/pm3official" />
|
||||
<module fileurl="file://$PROJECT_DIR$/pm3rdv4rrg/pm3rdv4rrg.iml" filepath="$PROJECT_DIR$/pm3rdv4rrg/pm3rdv4rrg.iml" group="RFID-Tools/pm3rdv4rrg" />
|
||||
<module fileurl="file://$PROJECT_DIR$/utils/utils.iml" filepath="$PROJECT_DIR$/utils/utils.iml" group="RFID-Tools/utils" />
|
||||
<module fileurl="file://$PROJECT_DIR$/RFIDtools.iml" filepath="$PROJECT_DIR$/RFIDtools.iml" group="RFIDtools" />
|
||||
<module fileurl="file://$PROJECT_DIR$/app_main/RFIDtools-app_main.iml" filepath="$PROJECT_DIR$/app_main/RFIDtools-app_main.iml" group="RFIDtools/app_main" />
|
||||
<module fileurl="file://$PROJECT_DIR$/chameleon/RFIDtools-chameleon.iml" filepath="$PROJECT_DIR$/chameleon/RFIDtools-chameleon.iml" group="RFIDtools/chameleon" />
|
||||
<module fileurl="file://$PROJECT_DIR$/communication/RFIDtools-communication.iml" filepath="$PROJECT_DIR$/communication/RFIDtools-communication.iml" group="RFIDtools/communication" />
|
||||
<module fileurl="file://$PROJECT_DIR$/console/RFIDtools-console.iml" filepath="$PROJECT_DIR$/console/RFIDtools-console.iml" group="RFIDtools/console" />
|
||||
<module fileurl="file://$PROJECT_DIR$/crapto1/RFIDtools-crapto1.iml" filepath="$PROJECT_DIR$/crapto1/RFIDtools-crapto1.iml" group="RFIDtools/crapto1" />
|
||||
<module fileurl="file://$PROJECT_DIR$/io_redirect/RFIDtools-io_redirect.iml" filepath="$PROJECT_DIR$/io_redirect/RFIDtools-io_redirect.iml" group="RFIDtools/io_redirect" />
|
||||
<module fileurl="file://$PROJECT_DIR$/libnfc_pn53x/RFIDtools-libnfc_pn53x.iml" filepath="$PROJECT_DIR$/libnfc_pn53x/RFIDtools-libnfc_pn53x.iml" group="RFIDtools/libnfc_pn53x" />
|
||||
<module fileurl="file://$PROJECT_DIR$/mfkey_32_64/RFIDtools-mfkey_32_64.iml" filepath="$PROJECT_DIR$/mfkey_32_64/RFIDtools-mfkey_32_64.iml" group="RFIDtools/mfkey_32_64" />
|
||||
<module fileurl="file://$PROJECT_DIR$/mifaretag/RFIDtools-mifaretag.iml" filepath="$PROJECT_DIR$/mifaretag/RFIDtools-mifaretag.iml" group="RFIDtools/mifaretag" />
|
||||
<module fileurl="file://$PROJECT_DIR$/pm3flasher/RFIDtools-pm3flasher.iml" filepath="$PROJECT_DIR$/pm3flasher/RFIDtools-pm3flasher.iml" group="RFIDtools/pm3flasher" />
|
||||
<module fileurl="file://$PROJECT_DIR$/pm3iceman/RFIDtools-pm3iceman.iml" filepath="$PROJECT_DIR$/pm3iceman/RFIDtools-pm3iceman.iml" group="RFIDtools/pm3iceman" />
|
||||
<module fileurl="file://$PROJECT_DIR$/pm3official/RFIDtools-pm3official.iml" filepath="$PROJECT_DIR$/pm3official/RFIDtools-pm3official.iml" group="RFIDtools/pm3official" />
|
||||
<module fileurl="file://$PROJECT_DIR$/pm3rdv4rrg/RFIDtools-pm3rdv4rrg.iml" filepath="$PROJECT_DIR$/pm3rdv4rrg/RFIDtools-pm3rdv4rrg.iml" group="RFIDtools/pm3rdv4rrg" />
|
||||
<module fileurl="file://$PROJECT_DIR$/utils/RFIDtools-utils.iml" filepath="$PROJECT_DIR$/utils/RFIDtools-utils.iml" group="RFIDtools/utils" />
|
||||
<module fileurl="file://$PROJECT_DIR$/app_main/app_main.iml" filepath="$PROJECT_DIR$/app_main/app_main.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/chameleon/chameleon.iml" filepath="$PROJECT_DIR$/chameleon/chameleon.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/communication/communication.iml" filepath="$PROJECT_DIR$/communication/communication.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/console/console.iml" filepath="$PROJECT_DIR$/console/console.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/crapto1/crapto1.iml" filepath="$PROJECT_DIR$/crapto1/crapto1.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/io_redirect/io_redirect.iml" filepath="$PROJECT_DIR$/io_redirect/io_redirect.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/libnfc_pn53x/libnfc_pn53x.iml" filepath="$PROJECT_DIR$/libnfc_pn53x/libnfc_pn53x.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/mfkey_32_64/mfkey_32_64.iml" filepath="$PROJECT_DIR$/mfkey_32_64/mfkey_32_64.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/mifaretag/mifaretag.iml" filepath="$PROJECT_DIR$/mifaretag/mifaretag.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/pm3flasher/pm3flasher.iml" filepath="$PROJECT_DIR$/pm3flasher/pm3flasher.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/pm3iceman/pm3iceman.iml" filepath="$PROJECT_DIR$/pm3iceman/pm3iceman.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/pm3official/pm3official.iml" filepath="$PROJECT_DIR$/pm3official/pm3official.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/pm3rdv4rrg/pm3rdv4rrg.iml" filepath="$PROJECT_DIR$/pm3rdv4rrg/pm3rdv4rrg.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/utils/utils.iml" filepath="$PROJECT_DIR$/utils/utils.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@@ -65,7 +65,7 @@ Download and flash [Compiled FW 12 August](https://www.dropbox.com/s/416lsrqpr2l
|
||||
|
||||
## App core implementation
|
||||
|
||||
If you want to join our project, you must comply with the following development specifications to some extent, including macro architecture and micro implementation. Let us have fun time coding.
|
||||
If you want to join our project, you must comply with the following development specifications to some extent, including macro architecture and micro implementation. Let us have target time coding.
|
||||
|
||||
- Communication implementation: using JNI mapping C & Java communication, encapsulating posix-compliant UART library, using Google API in the upper layer (Java) and posix-compliant UART in the lower layer (C/C+++).
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ android {
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 29
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
versionCode 6
|
||||
versionName "1.3.3"
|
||||
versionCode 13
|
||||
versionName "1.4"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
<activity android:name=".activities.connect.PN53XUsbBulkTransferActivity" />
|
||||
<activity android:name=".activities.tools.DumpListActivity" />
|
||||
<activity android:name=".activities.tools.KeyFileListActivity" />
|
||||
<activity android:name=".activities.main.FlasherMainActivity" />
|
||||
<activity android:name=".activities.main.PM3FlasherMainActivity" />
|
||||
|
||||
</application>
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+12
-8
@@ -2,6 +2,8 @@ package cn.rrg.rdv.activities.connect;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -12,6 +14,7 @@ import android.widget.TextView;
|
||||
|
||||
import cn.dxl.common.util.DisplayUtil;
|
||||
import cn.rrg.rdv.R;
|
||||
import cn.rrg.rdv.activities.main.PM3FlasherMainActivity;
|
||||
import cn.rrg.rdv.activities.main.Proxmark3Rdv4RRGMain;
|
||||
import cn.rrg.rdv.activities.tools.DeviceConnectActivity;
|
||||
import cn.rrg.rdv.callback.ConnectFailedCtxCallback;
|
||||
@@ -43,9 +46,7 @@ public class Proxmark3Rdv4RRGConnectActivity
|
||||
@Override
|
||||
public AbstractDeviceModel[] getModels() {
|
||||
return new AbstractDeviceModel[]{
|
||||
//RDV4支持SPP数据源,因此提供SPP的通信!
|
||||
new Proxmark3Rdv4SppModel(),
|
||||
//RDV4还支持USB的数据源,同样提供USB的通信!
|
||||
new Proxmark3Rdv4UsbModel()
|
||||
};
|
||||
}
|
||||
@@ -76,14 +77,17 @@ public class Proxmark3Rdv4RRGConnectActivity
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int paddingValue = DisplayUtil.dip2px(activity, 16);
|
||||
TextView msg = new TextView(activity);
|
||||
msg.setTextIsSelectable(true);
|
||||
msg.setPadding(paddingValue, paddingValue, paddingValue, paddingValue);
|
||||
msg.setText(Html.fromHtml(activity.getString(R.string.connect_errr_msg_1)));
|
||||
new AlertDialog.Builder(activity)
|
||||
.setTitle(R.string.connect_faild)
|
||||
.setView(msg).show();
|
||||
.setMessage(R.string.connect_errr_msg_1)
|
||||
.setPositiveButton(getString(R.string.flash) + "(OTG)", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
startActivity(new Intent(context, PM3FlasherMainActivity.class));
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package cn.rrg.rdv.activities.main;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
|
||||
@@ -42,9 +41,6 @@ public class AppMain extends BaseActivity {
|
||||
initActions();
|
||||
|
||||
gotoFragment(appMainDevicesFragment);
|
||||
|
||||
startActivity(new Intent(context, FlasherMainActivity.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
|
||||
@@ -1,150 +0,0 @@
|
||||
package cn.rrg.rdv.activities.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.proxgrind.pm3flasher.Proxmark3Flasher;
|
||||
|
||||
import cn.dxl.com.Com;
|
||||
import cn.dxl.common.util.LogUtils;
|
||||
import cn.dxl.common.widget.ToastUtil;
|
||||
import cn.rrg.com.ContextCallback;
|
||||
import cn.rrg.com.DevCallback;
|
||||
import cn.rrg.com.UsbSerialControl;
|
||||
import cn.rrg.devices.EmptyDeivce;
|
||||
import cn.rrg.rdv.R;
|
||||
|
||||
public class FlasherMainActivity extends BaseActivity {
|
||||
|
||||
private UsbSerialControl control = UsbSerialControl.get();
|
||||
private Proxmark3Flasher flasher = Proxmark3Flasher.getFlasher();
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.act_pm3_flasher);
|
||||
|
||||
Com.initCom(control, new EmptyDeivce());
|
||||
|
||||
control.setContextCallback(new ContextCallback() {
|
||||
@Override
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
});
|
||||
|
||||
control.register(this, new DevCallback<String>() {
|
||||
@Override
|
||||
public void onAttach(String dev) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach(String dev) {
|
||||
flasher.closeProxmark3();
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btnStatusCheck).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
flasher.isBootloaderMode();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btnClientClose).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
flasher.closeProxmark3();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btnClientOpen).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
flasher.openProxmark3();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btnDeviceConnect).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (control.connect(null)) {
|
||||
ToastUtil.show(context, "连接成功", false);
|
||||
} else {
|
||||
ToastUtil.show(context, "连接失败", false);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btnFlashStart).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String bootrom = "/storage/emulated/0/Download/bootrom.elf";
|
||||
String fullimg = "/storage/emulated/0/Download/fullimage.elf";
|
||||
if (!flasher.isPM3Opened()) {
|
||||
if (!flasher.openProxmark3()) {
|
||||
LogUtils.d("PM3打开失败!");
|
||||
return;
|
||||
} else {
|
||||
LogUtils.d("PM3打开成功!");
|
||||
}
|
||||
}
|
||||
// 如果没有在Bootloader模式下,我们需要先重启设备使其进入Bootloader模式下!
|
||||
if (flasher.isBootloaderMode()) {
|
||||
LogUtils.d("当前处于Bootloader模式下,将会开始刷机!");
|
||||
if (flasher.flashBootRom(bootrom)) {
|
||||
LogUtils.d("PM3刷写BootRom成功!");
|
||||
} else {
|
||||
LogUtils.d("PM3刷写BootRom失败!");
|
||||
}
|
||||
if (flasher.flashFullImg(fullimg)) {
|
||||
LogUtils.d("PM3刷写BootRom成功!");
|
||||
} else {
|
||||
LogUtils.d("PM3刷写BootRom失败!");
|
||||
}
|
||||
flasher.flashModeClose();
|
||||
flasher.closeProxmark3();
|
||||
} else {
|
||||
if (!flasher.enterBootloader()) {
|
||||
LogUtils.d("PM3进入刷写模式失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
control.unregister(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package cn.rrg.rdv.activities.main;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.proxgrind.pm3flasher.Proxmark3Flasher;
|
||||
import com.proxgrind.pm3flasher.Target;
|
||||
|
||||
import cn.dxl.com.Com;
|
||||
import cn.dxl.common.util.LogUtils;
|
||||
import cn.dxl.common.widget.ToastUtil;
|
||||
import cn.rrg.com.DevCallback;
|
||||
import cn.rrg.com.UsbSerialControl;
|
||||
import cn.rrg.devices.EmptyDeivce;
|
||||
import cn.rrg.rdv.R;
|
||||
import cn.rrg.rdv.util.Paths;
|
||||
|
||||
public class PM3FlasherMainActivity extends BaseActivity implements DevCallback<String> {
|
||||
|
||||
private enum MODE {
|
||||
BOOT, OS
|
||||
}
|
||||
|
||||
private UsbSerialControl control = UsbSerialControl.get();
|
||||
private Proxmark3Flasher flasher = Proxmark3Flasher.getFlasher();
|
||||
|
||||
//在程序执行读卡,写卡操作时的程序后台交互性提醒对话框
|
||||
private AlertDialog mDialogWorkingState = null;
|
||||
|
||||
private Button btnFlash;
|
||||
|
||||
private MODE mode = MODE.BOOT;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.act_pm3_flasher);
|
||||
|
||||
// init and try to connect.
|
||||
control.register(this, this);
|
||||
Com.initCom(control, new EmptyDeivce());
|
||||
|
||||
initViews();
|
||||
initActions();
|
||||
|
||||
setStatus(true);
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
mDialogWorkingState = new AlertDialog.Builder(context).create();
|
||||
View _workingStateMsgView = View.inflate(context, R.layout.dialog_working_msg, null);
|
||||
mDialogWorkingState.setView(_workingStateMsgView);
|
||||
mDialogWorkingState.setTitle(R.string.tips);
|
||||
mDialogWorkingState.setCancelable(false);
|
||||
|
||||
btnFlash = findViewById(R.id.btnFlash);
|
||||
}
|
||||
|
||||
private void initActions() {
|
||||
btnFlash.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mode = MODE.BOOT;
|
||||
if (control.connect(null)) {
|
||||
flashDefaultFW();
|
||||
} else {
|
||||
ToastUtil.show(context, getString(R.string.tips_device_no_found), false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void flashDefaultFW() {
|
||||
if (!mDialogWorkingState.isShowing())
|
||||
mDialogWorkingState.show();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!flasher.isStart(Target.CLIENT)) {
|
||||
if (!flasher.start(Target.CLIENT)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 如果没有在Bootloader模式下,我们需要先重启设备使其进入Bootloader模式下!
|
||||
if (flasher.isStart(Target.BOOT)) {
|
||||
switch (mode) {
|
||||
case BOOT:
|
||||
if (flasher.flashBootRom(Paths.PM3_IMAGE_BOOT_FILE)) {
|
||||
ToastUtil.show(context, getString(R.string.tips_boot_flash_success), false);
|
||||
} else {
|
||||
ToastUtil.show(context, getString(R.string.tips_boot_flash_failed), false);
|
||||
}
|
||||
finishFlash();
|
||||
// 开启下一轮!
|
||||
mode = MODE.OS;
|
||||
break;
|
||||
|
||||
case OS:
|
||||
if (flasher.flashFullImg(Paths.PM3_IMAGE_OS_FILE)) {
|
||||
ToastUtil.show(context, getString(R.string.tips_os_flash_success), false);
|
||||
} else {
|
||||
ToastUtil.show(context, getString(R.string.tips_os_flash_failed), false);
|
||||
}
|
||||
finishFlash();
|
||||
ToastUtil.show(context, getString(R.string.finish), false);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!flasher.start(Target.BOOT)) {
|
||||
ToastUtil.show(context, getString(R.string.tips_pm3_enter_failed), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void finishFlash() {
|
||||
flasher.close(Target.BOOT);
|
||||
flasher.close(Target.CLIENT);
|
||||
}
|
||||
|
||||
private void closeClient() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
flasher.close(Target.CLIENT);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mDialogWorkingState.dismiss();
|
||||
control.unregister(this);
|
||||
closeClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(String dev) {
|
||||
// 自动连接设备!
|
||||
control.connect(dev);
|
||||
flashDefaultFW();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach(String dev) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
// LogUtils.d("X: " + event.getRawX());
|
||||
// LogUtils.d("Y: " + event.getRawY());
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
}
|
||||
@@ -454,7 +454,6 @@ public abstract class BaseConsoleActivity extends BaseActivity {
|
||||
// 我们需要单独处理其中的每个/r,进行视觉更新!
|
||||
for (String s : newLineReturnArr) {
|
||||
arr[arr.length - 1] = s;
|
||||
Log.d(LOG_TAG, "当前被newLineReturnArr拼接的行: " + arr[arr.length - 1]);
|
||||
// 拼接回去!
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int j = 0; j < arr.length; ++j) {
|
||||
@@ -466,7 +465,6 @@ public abstract class BaseConsoleActivity extends BaseActivity {
|
||||
}
|
||||
} else {
|
||||
arr[arr.length - 1] = line;
|
||||
Log.d(LOG_TAG, "当前被arr拼接的行: " + arr[arr.length - 1]);
|
||||
// 拼接回去!
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < arr.length; ++i) {
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class DeviceConnectActivity
|
||||
public abstract ConnectFailedCtxCallback getCallback();
|
||||
|
||||
//数据源承载数组!
|
||||
AbstractDeviceModel[] models;
|
||||
public AbstractDeviceModel[] models;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -62,16 +62,8 @@ public abstract class DeviceConnectActivity
|
||||
model.register(this);
|
||||
}
|
||||
|
||||
Bundle data = new Bundle();
|
||||
data.putSerializable("models", models);
|
||||
data.putSerializable("target", getTarget());
|
||||
data.putSerializable("callback", getCallback());
|
||||
data.putString("msg", getConnectingMsg());
|
||||
|
||||
Fragment newDevFragment = new DeviceConnectNewFragment();
|
||||
Fragment allDevFragment = new DeviceConnectAllFragment();
|
||||
newDevFragment.setArguments(data);
|
||||
allDevFragment.setArguments(data);
|
||||
|
||||
//初始化分页适配器!
|
||||
FragmentPagerAdapter mAdapter =
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.widget.TextView;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cn.rrg.rdv.R;
|
||||
import cn.rrg.rdv.activities.tools.DeviceConnectActivity;
|
||||
import cn.rrg.rdv.callback.ConnectFailedCtxCallback;
|
||||
import cn.rrg.rdv.fragment.base.AppMainDevicesFragment;
|
||||
import cn.rrg.rdv.models.AbstractDeviceModel;
|
||||
@@ -33,12 +34,13 @@ public abstract class DeviceConnectFragment
|
||||
|
||||
@Override
|
||||
protected void initResource() {
|
||||
Bundle data = getArguments();
|
||||
if (data != null) {
|
||||
this.models = (AbstractDeviceModel[]) data.getSerializable("models");
|
||||
this.target = (Class) data.getSerializable("target");
|
||||
this.connectCallback = (ConnectFailedCtxCallback) data.getSerializable("callback");
|
||||
Activity activity = getActivity();
|
||||
if (activity == null) return;
|
||||
if (activity instanceof DeviceConnectActivity) {
|
||||
this.models = ((DeviceConnectActivity) activity).models;
|
||||
if (models != null) {
|
||||
this.target = ((DeviceConnectActivity) activity).getTarget();
|
||||
this.connectCallback = ((DeviceConnectActivity) activity).getCallback();
|
||||
for (AbstractDeviceModel m : models) {
|
||||
//初始化中介者并且绑定视图!
|
||||
DevicePresenter<DeviceView> presenter = new DevicePresenter<>(m);
|
||||
@@ -46,15 +48,13 @@ public abstract class DeviceConnectFragment
|
||||
presenter.attachView(this);
|
||||
presenters.add(presenter);
|
||||
}
|
||||
String msg = ((DeviceConnectActivity) activity).getConnectingMsg();
|
||||
if (msg != null) {
|
||||
((TextView) (msgView.findViewById(R.id.text1))).setText(msg);
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Models container null exception!");
|
||||
throw new RuntimeException("Models not init exception!");
|
||||
}
|
||||
String msg = data.getString("msg");
|
||||
if (msg != null) {
|
||||
((TextView) (msgView.findViewById(R.id.text1))).setText(msg);
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Models not init exception!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,18 +19,7 @@ public abstract class AbsUsb2UartModel extends AbstractDeviceModel<String, UsbMa
|
||||
|
||||
@Override
|
||||
public DriverInterface<String, UsbManager> getDriverInterface() {
|
||||
DriverInterface di = DriverSource.driverMap.get(0x04);
|
||||
if (di != null) {
|
||||
ContextHandle contextHandle = (ContextHandle) di;
|
||||
contextHandle.setContextCallback(new ContextCallback() {
|
||||
@Override
|
||||
public Context getContext() {
|
||||
return AppUtil.getInstance().getApp();
|
||||
}
|
||||
});
|
||||
return di;
|
||||
}
|
||||
return null;
|
||||
return DriverSource.driverMap.get(0x04);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,10 +3,12 @@ package cn.rrg.rdv.models;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.dxl.common.util.LogUtils;
|
||||
import cn.rrg.com.DevCallback;
|
||||
import cn.rrg.com.DriverInterface;
|
||||
|
||||
@@ -172,6 +174,13 @@ public abstract class AbstractDeviceModel<D, A>
|
||||
if (Com.initCom(mDI, mDevice)) {
|
||||
callback.onInitSuccess();
|
||||
} else {
|
||||
try {
|
||||
LogUtils.d("初始化失败,将会调用设备封装类关闭设备!");
|
||||
// close device!
|
||||
mDevice.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
callback.onInitFail();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,8 @@ import cn.dxl.common.util.DiskKVUtil;
|
||||
|
||||
public class InitUtil {
|
||||
|
||||
//短称路径
|
||||
public static final String LOG_TAG = InitUtil.class.getSimpleName();
|
||||
|
||||
//初始化dump文件目录
|
||||
public static void initApplicationResource(Context context) {
|
||||
AssetsUtil au = new AssetsUtil(context);
|
||||
File dump_dir = new File(Paths.DUMP_DIRECTORY);
|
||||
@@ -74,11 +72,13 @@ public class InitUtil {
|
||||
if (!pm3_dir.mkdirs()) {
|
||||
Log.d(LOG_TAG, "init pm3 dir fail!");
|
||||
} else {
|
||||
initProxmark3RDV4ImageFile(au);
|
||||
initEasyButtonFile(au);
|
||||
initPM3ForwardFile();
|
||||
initHardnestedFile(au);
|
||||
}
|
||||
} else {
|
||||
initProxmark3RDV4ImageFile(au);
|
||||
initEasyButtonFile(au);
|
||||
initPM3ForwardFile();
|
||||
initHardnestedFile(au);
|
||||
@@ -99,17 +99,28 @@ public class InitUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static void initProxmark3RDV4ImageFile(AssetsUtil au) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//初始化标准输入的文件!
|
||||
File boot = new File(Paths.PM3_IMAGE_BOOT_FILE);
|
||||
File os = new File(Paths.PM3_IMAGE_OS_FILE);
|
||||
au.moveFile(Paths.PM3_BOOT_FILE_NAME, boot.getAbsolutePath());
|
||||
au.moveFile(Paths.PM3_OS_FILE_NAME, os.getAbsolutePath());
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private static void initMfInfoMapsFile(AssetsUtil au) {
|
||||
File f1 = new File(Paths.COMMON_DIRECTORY + "/" + "template_mifare_info_en.html");
|
||||
File f2 = new File(Paths.COMMON_DIRECTORY + "/" + "template_tag_info_en.html");
|
||||
|
||||
//移动两个标签信息HTML文件到指定目录!
|
||||
if (/*!f1.exists()*/true)
|
||||
au.moveFile("template_mifare_info_en.html",
|
||||
new File(Paths.COMMON_DIRECTORY + "/" + "template_mifare_info_en.html").getAbsolutePath());
|
||||
if (/*!f2.exists()*/true)
|
||||
au.moveFile("template_tag_info_en.html",
|
||||
new File(Paths.COMMON_DIRECTORY + "/" + "template_tag_info_en.html").getAbsolutePath());
|
||||
au.moveFile("template_mifare_info_en.html",
|
||||
new File(Paths.COMMON_DIRECTORY + "/" + "template_mifare_info_en.html").getAbsolutePath());
|
||||
au.moveFile("template_tag_info_en.html",
|
||||
new File(Paths.COMMON_DIRECTORY + "/" + "template_tag_info_en.html").getAbsolutePath());
|
||||
}
|
||||
|
||||
private static void initDumpFile(AssetsUtil au) {
|
||||
@@ -230,7 +241,6 @@ public class InitUtil {
|
||||
}
|
||||
}
|
||||
|
||||
//进行日志记录开始!
|
||||
public static void startLogcat(boolean open) {
|
||||
//拼接名字
|
||||
String name = "log.txt";
|
||||
@@ -257,7 +267,6 @@ public class InitUtil {
|
||||
}
|
||||
}
|
||||
|
||||
//初始化必须要的设置!
|
||||
public static void initSettings() throws IOException {
|
||||
File dir = new File(Paths.SETTINGS_DIRECTORY);
|
||||
if (dir.exists()) {
|
||||
@@ -269,7 +278,6 @@ public class InitUtil {
|
||||
}
|
||||
}
|
||||
|
||||
//私有初始化函数!
|
||||
private static void initSets() throws IOException {
|
||||
File file = new File(Paths.SETTINGS_FILE);
|
||||
if (!file.exists())
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.os.Environment;
|
||||
|
||||
public interface Paths {
|
||||
|
||||
//常用的相对路径文件夹 | 文件名定义!
|
||||
String EXTERNAL_STORAGE_DIRECTORY = Environment.getExternalStorageDirectory().getPath();
|
||||
String TOOLS_PATH = "NfcTools";
|
||||
String SETTINGS_PATH = "Settings";
|
||||
@@ -26,7 +25,6 @@ public interface Paths {
|
||||
String DEFAULT_DUMP_NAME = "BLANK(空白).dump";
|
||||
String DEFAULT_CMD_NAME = "cmd.json";
|
||||
|
||||
//绝对路径
|
||||
String TOOLS_DIRECTORY = EXTERNAL_STORAGE_DIRECTORY + "/" + TOOLS_PATH;
|
||||
String KEY_DIRECTORY = TOOLS_DIRECTORY + "/" + KEY_PATH;
|
||||
String LOG_DIRECTORY = TOOLS_DIRECTORY + "/" + LOG_PATH;
|
||||
@@ -53,11 +51,15 @@ public interface Paths {
|
||||
String SETTINGS_DIRECTORY = TOOLS_DIRECTORY + "/" + SETTINGS_PATH;
|
||||
String SETTINGS_FILE = SETTINGS_DIRECTORY + "/" + "set.dat";
|
||||
|
||||
//一些重定向文件
|
||||
String PM3_BOOT_FILE_NAME = "bootrom.elf";
|
||||
String PM3_OS_FILE_NAME = "fullimage.elf";
|
||||
String PM3_FORWARD_O = PM3_DIRECTORY + "/" + "pm3_forward_o.txt";
|
||||
String PM3_FORWARD_E = PM3_DIRECTORY + "/" + "pm3_forward_e.txt";
|
||||
//PM3的RDV4动态按钮
|
||||
//PM3 Easy Button
|
||||
String PM3_CMD_FILE = PM3_DIRECTORY + "/" + DEFAULT_CMD_NAME;
|
||||
// PM3 Image
|
||||
String PM3_IMAGE_BOOT_FILE = Paths.PM3_DIRECTORY + "/" + PM3_BOOT_FILE_NAME;
|
||||
String PM3_IMAGE_OS_FILE = Paths.PM3_DIRECTORY + "/" + PM3_OS_FILE_NAME;
|
||||
|
||||
String PN53X_FORWARD_O = PN53X_DIRRECTORY + "/" + "pn53x_forward_o.txt";
|
||||
String PN53X_FORWARD_E = PN53X_DIRRECTORY + "/" + "pn53x_forward_e.txt";
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 118 KiB |
@@ -1,46 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorBackground"
|
||||
android:orientation="vertical">
|
||||
|
||||
<cn.dxl.common.widget.StatusBarHeightView
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/rdv4_2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDeviceConnect"
|
||||
android:id="@+id/btnFlash"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="连接设备"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:padding="16dp"
|
||||
android:text="@string/flash"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/colorPrimary" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnClientOpen"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="打开设备"
|
||||
android:textColor="@color/colorPrimary" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnClientClose"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="关闭设备"
|
||||
android:textColor="@color/colorPrimary" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnFlashStart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始刷机"
|
||||
android:textColor="@color/colorPrimary" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnStatusCheck"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="状态查询"
|
||||
android:textColor="@color/colorPrimary" />
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgUsbConnect"
|
||||
android:layout_width="256dp"
|
||||
android:layout_height="256dp"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
</LinearLayout>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user