|
|
@ -76,7 +76,7 @@ public class CertActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
|
|
|
bres = dsSdk.mcuPowerOffCPR();
|
|
|
|
bres = dsSdk.mcuPowerOffCPR();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Thread.sleep(1000);
|
|
|
|
Thread.sleep(100);
|
|
|
|
} catch (Exception ex) {
|
|
|
|
} catch (Exception ex) {
|
|
|
|
ex.printStackTrace();
|
|
|
|
ex.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -86,18 +86,11 @@ public class CertActivity extends AppCompatActivity {
|
|
|
|
// res = dsSdk.nrsecInit();
|
|
|
|
// res = dsSdk.nrsecInit();
|
|
|
|
// res = dsSdk.nrsecOpen();
|
|
|
|
// res = dsSdk.nrsecOpen();
|
|
|
|
|
|
|
|
|
|
|
|
String version = MicroPhotoService.querySecVersion();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mTextView = (TextView)findViewById(R.id.textView);
|
|
|
|
mTextView = (TextView)findViewById(R.id.textView);
|
|
|
|
mTextView.setText(R.string.nrsec_version + version);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ActionBar actionBar = getSupportActionBar();
|
|
|
|
|
|
|
|
String text = getResources().getString(R.string.nrsec_version);
|
|
|
|
|
|
|
|
actionBar.setTitle(actionBar.getTitle().toString() + " " + text + " " + version);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
Date dt = new Date();
|
|
|
|
Date dt = new Date();
|
|
|
|
text = format.format(dt);
|
|
|
|
String text = format.format(dt);
|
|
|
|
|
|
|
|
|
|
|
|
mTextView.setText(text);
|
|
|
|
mTextView.setText(text);
|
|
|
|
|
|
|
|
|
|
|
@ -114,30 +107,21 @@ public class CertActivity extends AppCompatActivity {
|
|
|
|
setEditText(R.id.uid_end, sharedPreferences.getString("uidEnd", ""));
|
|
|
|
setEditText(R.id.uid_end, sharedPreferences.getString("uidEnd", ""));
|
|
|
|
setSpinnerPosition(R.id.company, sharedPreferences.getInt("company", 0));
|
|
|
|
setSpinnerPosition(R.id.company, sharedPreferences.getInt("company", 0));
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
mHandler.postDelayed(new Runnable() {
|
|
|
|
final Intent intent = getIntent();
|
|
|
|
|
|
|
|
if (intent != null) {
|
|
|
|
|
|
|
|
if (mCommandThread != null) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
mCommandThread.interrupt();
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mCommandThread = new Thread(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
try {
|
|
|
|
String version = MicroPhotoService.querySecVersion();
|
|
|
|
handleCommand(intent);
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
mTextView.setText(R.string.nrsec_version + version);
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
ActionBar actionBar = getSupportActionBar();
|
|
|
|
}
|
|
|
|
String text = getResources().getString(R.string.nrsec_version);
|
|
|
|
});
|
|
|
|
actionBar.setTitle(actionBar.getTitle().toString() + " " + text + " " + version);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
processActivityIntent();
|
|
|
|
|
|
|
|
|
|
|
|
mCommandThread.start();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
|
|
|
|
findViewById(R.id.btnGenKeys).setOnClickListener(new View.OnClickListener() {
|
|
|
|
findViewById(R.id.btnGenKeys).setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -262,6 +246,31 @@ public class CertActivity extends AppCompatActivity {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void processActivityIntent() {
|
|
|
|
|
|
|
|
final Intent intent = getIntent();
|
|
|
|
|
|
|
|
if (intent != null) {
|
|
|
|
|
|
|
|
if (mCommandThread != null) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
mCommandThread.interrupt();
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mCommandThread = new Thread(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
handleCommand(intent);
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mCommandThread.start();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected int getItemData(int viewId) {
|
|
|
|
protected int getItemData(int viewId) {
|
|
|
|
Spinner spinnerView = (Spinner) findViewById(viewId);
|
|
|
|
Spinner spinnerView = (Spinner) findViewById(viewId);
|
|
|
|
if (spinnerView != null) {
|
|
|
|
if (spinnerView != null) {
|
|
|
@ -524,10 +533,13 @@ public class CertActivity extends AppCompatActivity {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
activity.finish();
|
|
|
|
activity.finish();
|
|
|
|
|
|
|
|
System.exit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mCommandThread = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void ensureDirectoryExisted(String fileName) {
|
|
|
|
protected void ensureDirectoryExisted(String fileName) {
|
|
|
@ -573,6 +585,9 @@ public class CertActivity extends AppCompatActivity {
|
|
|
|
public void onReceive(Context context, final Intent intent) {
|
|
|
|
public void onReceive(Context context, final Intent intent) {
|
|
|
|
final Intent finalIntent = intent;
|
|
|
|
final Intent finalIntent = intent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CertActivity.this.mHandler.postDelayed(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
if (intent != null) {
|
|
|
|
if (intent != null) {
|
|
|
|
|
|
|
|
|
|
|
|
if (mCommandThread != null) {
|
|
|
|
if (mCommandThread != null) {
|
|
|
@ -596,5 +611,7 @@ public class CertActivity extends AppCompatActivity {
|
|
|
|
mCommandThread.start();
|
|
|
|
mCommandThread.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}, 2000);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|