|
@@ -1,5 +1,6 @@
|
|
package com.example.administrator.wingcool_gt9_apk;
|
|
package com.example.administrator.wingcool_gt9_apk;
|
|
|
|
|
|
|
|
+import android.Manifest;
|
|
import android.app.Activity;
|
|
import android.app.Activity;
|
|
import android.app.PendingIntent;
|
|
import android.app.PendingIntent;
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
@@ -24,6 +25,7 @@ import android.os.Message;
|
|
import android.os.SystemClock;
|
|
import android.os.SystemClock;
|
|
import android.support.annotation.NonNull;
|
|
import android.support.annotation.NonNull;
|
|
import android.support.v4.app.ActivityCompat;
|
|
import android.support.v4.app.ActivityCompat;
|
|
|
|
+import android.support.v4.content.ContextCompat;
|
|
import android.support.v4.view.ViewPager;
|
|
import android.support.v4.view.ViewPager;
|
|
import android.support.v7.app.AppCompatActivity;
|
|
import android.support.v7.app.AppCompatActivity;
|
|
import android.text.Editable;
|
|
import android.text.Editable;
|
|
@@ -301,7 +303,7 @@ public class Config extends AppCompatActivity
|
|
private int seven = 0; //滑动条移动七页的距离
|
|
private int seven = 0; //滑动条移动七页的距离
|
|
//private int eight = 0; //滑动条移动八页的距离
|
|
//private int eight = 0; //滑动条移动八页的距离
|
|
//private int nine = 0; //滑动条移动九页的距离
|
|
//private int nine = 0; //滑动条移动九页的距离
|
|
- private int iChooseVPager = 0; //当前停在哪个vpager
|
|
|
|
|
|
+ private int iChooseVPager = 6; //当前停在哪个vpager
|
|
|
|
|
|
private byte mSendGetGt9ConfigData[]={
|
|
private byte mSendGetGt9ConfigData[]={
|
|
0x03,0x00,0x0f,(byte)0x80,0x50,0x00,0x3f,0x00,
|
|
0x03,0x00,0x0f,(byte)0x80,0x50,0x00,0x3f,0x00,
|
|
@@ -326,7 +328,7 @@ public class Config extends AppCompatActivity
|
|
case CONNECTED_SUCCESS://车机和手机连接成功
|
|
case CONNECTED_SUCCESS://车机和手机连接成功
|
|
//mError.setText("");
|
|
//mError.setText("");
|
|
mReadCfg.setEnabled(true);
|
|
mReadCfg.setEnabled(true);
|
|
-
|
|
|
|
|
|
+ mSendCfg.setEnabled(true);
|
|
break;
|
|
break;
|
|
|
|
|
|
case RECEIVER_MESSAGE_SUCCESS://成功接受到数据
|
|
case RECEIVER_MESSAGE_SUCCESS://成功接受到数据
|
|
@@ -1367,6 +1369,7 @@ public class Config extends AppCompatActivity
|
|
|
|
|
|
}
|
|
}
|
|
*/
|
|
*/
|
|
|
|
+ /*
|
|
public List<String> loadFile(String fileName){
|
|
public List<String> loadFile(String fileName){
|
|
List<String> lists = new ArrayList<>();
|
|
List<String> lists = new ArrayList<>();
|
|
try {
|
|
try {
|
|
@@ -1381,28 +1384,48 @@ public class Config extends AppCompatActivity
|
|
lists.add(line);
|
|
lists.add(line);
|
|
}
|
|
}
|
|
instream.close();
|
|
instream.close();
|
|
- //editdetail.setText(buffreader.toString()); //buffer.toString())就是读出的内容字符
|
|
|
|
- //mShow.setText(inputreader.toString());
|
|
|
|
|
|
+ edit_search.setText(buffreader.toString()); //buffer.toString())就是读出的内容字符
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- //Log.e(TAG, "****Load " + fileName + " Error****");
|
|
|
|
|
|
+ edit_search.setText(getResources().getString(R.string.invalidfile));
|
|
}
|
|
}
|
|
return lists;
|
|
return lists;
|
|
}
|
|
}
|
|
|
|
+ */
|
|
|
|
|
|
protected void onActivityResult ( int requestCode, int resultCode, Intent data){
|
|
protected void onActivityResult ( int requestCode, int resultCode, Intent data){
|
|
if (resultCode == Activity.RESULT_OK) {
|
|
if (resultCode == Activity.RESULT_OK) {
|
|
if (requestCode == 1) {
|
|
if (requestCode == 1) {
|
|
- Uri uri = data.getData();
|
|
|
|
- //Toast.makeText(this, "文件路径:" + uri.getPath().toString(), Toast.LENGTH_SHORT).show();
|
|
|
|
- edit_search.setText(uri.getPath().toString());
|
|
|
|
- //loadFile(uri.getPath().toString());
|
|
|
|
- ActivityCompat.requestPermissions( Config.this, new String[]{android
|
|
|
|
- .Manifest.permission.WRITE_EXTERNAL_STORAGE}, 2);
|
|
|
|
|
|
+
|
|
|
|
+ int permission_write = ContextCompat.checkSelfPermission(Config.this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
|
|
|
+ int permission_read = ContextCompat.checkSelfPermission(Config.this, Manifest.permission.READ_EXTERNAL_STORAGE);
|
|
|
|
+
|
|
|
|
+ if ((permission_write != PackageManager.PERMISSION_GRANTED)
|
|
|
|
+ ||(permission_read != PackageManager.PERMISSION_GRANTED))
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ ActivityCompat.requestPermissions(Config.this, new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
|
|
|
+ android.Manifest.permission.READ_EXTERNAL_STORAGE}, 3);
|
|
|
|
+ }
|
|
|
|
|
|
StringBuffer buffer = new StringBuffer();
|
|
StringBuffer buffer = new StringBuffer();
|
|
try {
|
|
try {
|
|
- FileInputStream fis = new FileInputStream(uri.getPath().toString());
|
|
|
|
|
|
+
|
|
|
|
+ File dir = Environment.getExternalStorageDirectory();
|
|
|
|
+ //Uri uri = data.getData();
|
|
|
|
+
|
|
|
|
+ edit_search.setText(dir.getPath() + "/GT9286_wingcool_config.cfg");
|
|
|
|
+
|
|
|
|
+ //File dir = Environment.getExternalStorageDirectory();
|
|
|
|
+ File dataFile = new File(dir.getPath(),"GT9286_wingcool_config.cfg");
|
|
|
|
+ FileInputStream fis = new FileInputStream(dataFile);
|
|
|
|
+ //byte[] bytes = new byte[fis.available()];
|
|
|
|
+ //fis.read(bytes);
|
|
|
|
+ //fis.close();
|
|
|
|
+ //String str = new String(bytes,"utf-8");
|
|
|
|
+ //edit_search.setText(str);
|
|
|
|
+
|
|
|
|
+ //FileInputStream fis = new FileInputStream(uri.getPath().toString());
|
|
InputStreamReader isr = new InputStreamReader(fis,"UTF-8");//文件编码Unicode,UTF-8,ASCII,GB2312,Big5
|
|
InputStreamReader isr = new InputStreamReader(fis,"UTF-8");//文件编码Unicode,UTF-8,ASCII,GB2312,Big5
|
|
Reader in = new BufferedReader(isr);
|
|
Reader in = new BufferedReader(isr);
|
|
int ch;
|
|
int ch;
|
|
@@ -1903,264 +1926,6 @@ public class Config extends AppCompatActivity
|
|
showid++;
|
|
showid++;
|
|
mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
showid++;
|
|
showid++;
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
- mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
|
- showid++;
|
|
|
|
|
|
|
|
ReadCfgNormal(mBytes);
|
|
ReadCfgNormal(mBytes);
|
|
//ReadCfgModuleSwitch(mBytes);
|
|
//ReadCfgModuleSwitch(mBytes);
|
|
@@ -2170,29 +1935,48 @@ public class Config extends AppCompatActivity
|
|
//ReadCfgHoppingSetting(mBytes);
|
|
//ReadCfgHoppingSetting(mBytes);
|
|
ReadCfgRam(stringCfgArr);
|
|
ReadCfgRam(stringCfgArr);
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
- //editdetail.setText("文件不存在!");
|
|
|
|
|
|
+ edit_search.setText(getResources().getString(R.string.invalidfile));
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
|
|
+ /*
|
|
|
|
+ Uri uri = data.getData();
|
|
File file = new File(uri.getPath());
|
|
File file = new File(uri.getPath());
|
|
|
|
+
|
|
|
|
+ edit_search.setText(uri.getPath().toString());
|
|
|
|
+ //loadFile(uri.getPath().toString());
|
|
|
|
+ ActivityCompat.requestPermissions( Config.this, new String[]{android
|
|
|
|
+ .Manifest.permission.WRITE_EXTERNAL_STORAGE}, 2);
|
|
|
|
+
|
|
|
|
+
|
|
String str = null;
|
|
String str = null;
|
|
try {
|
|
try {
|
|
InputStream is = new FileInputStream(file);
|
|
InputStream is = new FileInputStream(file);
|
|
InputStreamReader input = new InputStreamReader(is, "UTF-8");
|
|
InputStreamReader input = new InputStreamReader(is, "UTF-8");
|
|
BufferedReader reader = new BufferedReader(input);
|
|
BufferedReader reader = new BufferedReader(input);
|
|
while ((str = reader.readLine()) != null) {
|
|
while ((str = reader.readLine()) != null) {
|
|
- editdetail.setText(str);
|
|
|
|
- //editdetail.append("\n");
|
|
|
|
|
|
+ edit_search.setText(str);
|
|
}
|
|
}
|
|
|
|
|
|
} catch (FileNotFoundException e) {
|
|
} catch (FileNotFoundException e) {
|
|
// TODO Auto-generated catch block
|
|
// TODO Auto-generated catch block
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ //e.printStackTrace();
|
|
|
|
+ edit_search.setText(getResources().getString(R.string.invalidfile));
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
// TODO Auto-generated catch block
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
- */
|
|
|
|
|
|
+ */
|
|
|
|
+ /*
|
|
|
|
+ Uri uri = data.getData();
|
|
|
|
+ File file = new File(uri.getPath());
|
|
|
|
+
|
|
|
|
+ edit_search.setText(uri.getPath().toString());
|
|
|
|
+
|
|
|
|
+ ActivityCompat.requestPermissions( Config.this, new String[]{android
|
|
|
|
+ .Manifest.permission.WRITE_EXTERNAL_STORAGE}, 2);
|
|
|
|
+
|
|
|
|
+ loadFile(uri.getPath().toString());
|
|
|
|
+ */
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2203,67 +1987,15 @@ public class Config extends AppCompatActivity
|
|
mSendCfg.setOnClickListener(this);
|
|
mSendCfg.setOnClickListener(this);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- //byte[] mGt9PScFileData = new byte[197 * 1024 + 512];
|
|
|
|
private void initData() {
|
|
private void initData() {
|
|
mContext = getApplicationContext();
|
|
mContext = getApplicationContext();
|
|
mReadCfg.setEnabled(false); //
|
|
mReadCfg.setEnabled(false); //
|
|
|
|
|
|
mSendCfg.setEnabled(false);
|
|
mSendCfg.setEnabled(false);
|
|
|
|
|
|
- btnsave.setEnabled(false);
|
|
|
|
-
|
|
|
|
mThreadPool = Executors.newFixedThreadPool(5);
|
|
mThreadPool = Executors.newFixedThreadPool(5);
|
|
|
|
|
|
mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
|
|
mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
|
|
-
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- ActivityCompat.requestPermissions( Config.this, new String[]{android
|
|
|
|
- .Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); //申请权限,android6.0以上系统首次使用必须添加
|
|
|
|
-
|
|
|
|
- StringBuffer buffer = new StringBuffer();
|
|
|
|
- StringBuilder scfilestringbuilder = new StringBuilder("");
|
|
|
|
- if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- InputStream fis = getResources().openRawResource(R.raw.gt7288_2019091201);
|
|
|
|
- //gt9110h_config_20181108
|
|
|
|
- fis.read(mGt9PScFileData);
|
|
|
|
-
|
|
|
|
- //config.close();
|
|
|
|
- fis.close();
|
|
|
|
-
|
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- // mMessage.setText("文件没被发现");
|
|
|
|
- //Update_log = "文件没被发现";
|
|
|
|
- mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- catch (IOException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- // mMessage.setText("IOException");
|
|
|
|
- //Update_log = "IOException";
|
|
|
|
- mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- else{
|
|
|
|
- // mMessage.setText("SD卡不可读写!");
|
|
|
|
- //Update_log = "SD卡不可读写!";
|
|
|
|
- mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- for (int i = 0; i < mGt9PScFileData.length; i++)
|
|
|
|
- {
|
|
|
|
- mGt9PScFileData[i] -= 1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- String strGt9PScFileData = new String(mGt9PScFileData);
|
|
|
|
-
|
|
|
|
- int i = 0;
|
|
|
|
- */
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2286,11 +2018,11 @@ public class Config extends AppCompatActivity
|
|
HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
|
|
HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
|
|
if (deviceList != null) {
|
|
if (deviceList != null) {
|
|
for (UsbDevice usbDevice : deviceList.values()) {
|
|
for (UsbDevice usbDevice : deviceList.values()) {
|
|
- int productId = usbDevice.getProductId();
|
|
|
|
|
|
+ //int productId = usbDevice.getProductId();
|
|
int vendorId = usbDevice.getVendorId();
|
|
int vendorId = usbDevice.getVendorId();
|
|
- if ((productId == 0x0616 && vendorId == 0x27C0)
|
|
|
|
- ||(productId == 0x0818 && vendorId == 0x27C0)
|
|
|
|
- ||(productId == 0x0001 && vendorId == 0x222A)) //奕力的PID和VID
|
|
|
|
|
|
+ if ((vendorId == 0x27C0)
|
|
|
|
+ ||(vendorId == 0x27C6)
|
|
|
|
+ ||(vendorId == 0x222A)) //奕力的VID
|
|
{
|
|
{
|
|
//这里说明下,这里的377 , 7205是我这台机子上独有,因为我这上面有多台设备,所以我在这里
|
|
//这里说明下,这里的377 , 7205是我这台机子上独有,因为我这上面有多台设备,所以我在这里
|
|
//判断了下.只有一台设备的无需这一步.
|
|
//判断了下.只有一台设备的无需这一步.
|
|
@@ -2324,8 +2056,11 @@ public class Config extends AppCompatActivity
|
|
Collection<UsbDevice> values = deviceList.values();
|
|
Collection<UsbDevice> values = deviceList.values();
|
|
if (!values.isEmpty()) {
|
|
if (!values.isEmpty()) {
|
|
for (UsbDevice usbDevice : values) {
|
|
for (UsbDevice usbDevice : values) {
|
|
- int productId = usbDevice.getProductId();
|
|
|
|
- if (productId == 0x0818 || productId == 0x0001 || productId == 0x0616) { //0x0001是奕力的PID
|
|
|
|
|
|
+ int vendorId = usbDevice.getVendorId();
|
|
|
|
+ if ((vendorId == 0x27C0)
|
|
|
|
+ ||(vendorId == 0x27C6)
|
|
|
|
+ ||(vendorId == 0x222A)) //奕力的VID
|
|
|
|
+ {
|
|
if (mUsbManager.hasPermission(usbDevice)) {
|
|
if (mUsbManager.hasPermission(usbDevice)) {
|
|
UsbInterface usbInterface = usbDevice.getInterface(1);
|
|
UsbInterface usbInterface = usbDevice.getInterface(1);
|
|
|
|
|
|
@@ -2909,143 +2644,6 @@ public class Config extends AppCompatActivity
|
|
mCfg813D.setText(mConfigShow[showid++]);
|
|
mCfg813D.setText(mConfigShow[showid++]);
|
|
mCfg813E.setText(mConfigShow[showid++]);
|
|
mCfg813E.setText(mConfigShow[showid++]);
|
|
//mCfg813F.setText(mConfigShow[showid++]);
|
|
//mCfg813F.setText(mConfigShow[showid++]);
|
|
-
|
|
|
|
- mCfgBF7B.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF7C.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF7D.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF7E.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF7F.setText(mConfigShow[showid++]);
|
|
|
|
-
|
|
|
|
- mCfgBF80.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF81.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF82.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF83.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF84.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF85.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF86.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF87.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF88.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF89.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF8A.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF8B.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF8C.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF8D.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF8E.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF8F.setText(mConfigShow[showid++]);
|
|
|
|
-
|
|
|
|
- mCfgBF90.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF91.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF92.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF93.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF94.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF95.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF96.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF97.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF98.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF99.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF9A.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF9B.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF9C.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF9D.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF9E.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBF9F.setText(mConfigShow[showid++]);
|
|
|
|
-
|
|
|
|
- mCfgBFA0.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFA1.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFA2.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFA3.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFA4.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFA5.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFA6.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFA7.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFA8.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFA9.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFAA.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFAB.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFAC.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFAD.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFAE.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFAF.setText(mConfigShow[showid++]);
|
|
|
|
-
|
|
|
|
- mCfgBFB0.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFB1.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFB2.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFB3.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFB4.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFB5.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFB6.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFB7.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFB8.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFB9.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFBA.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFBB.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFBC.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFBD.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFBE.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFBF.setText(mConfigShow[showid++]);
|
|
|
|
-
|
|
|
|
- mCfgBFC0.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFC1.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFC2.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFC3.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFC4.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFC5.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFC6.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFC7.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFC8.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFC9.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFCA.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFCB.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFCC.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFCD.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFCE.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFCF.setText(mConfigShow[showid++]);
|
|
|
|
-
|
|
|
|
- mCfgBFD0.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFD1.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFD2.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFD3.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFD4.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFD5.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFD6.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFD7.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFD8.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFD9.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFDA.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFDB.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFDC.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFDD.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFDE.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFDF.setText(mConfigShow[showid++]);
|
|
|
|
-
|
|
|
|
- mCfgBFE0.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFE1.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFE2.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFE3.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFE4.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFE5.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFE6.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFE7.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFE8.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFE9.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFEA.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFEB.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFEC.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFED.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFEE.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFEF.setText(mConfigShow[showid++]);
|
|
|
|
-
|
|
|
|
- mCfgBFF0.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFF1.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFF2.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFF3.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFF4.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFF5.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFF6.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFF7.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFF8.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFF9.setText(mConfigShow[showid++]);
|
|
|
|
- mCfgBFFA.setText(mConfigShow[showid++]);
|
|
|
|
}
|
|
}
|
|
//=====================================读取CFG到各个View结束===================================//
|
|
//=====================================读取CFG到各个View结束===================================//
|
|
|
|
|
|
@@ -3819,153 +3417,7 @@ public class Config extends AppCompatActivity
|
|
configBuilder.append(mCfg813C.getText().toString() + ",");
|
|
configBuilder.append(mCfg813C.getText().toString() + ",");
|
|
configBuilder.append(mCfg813D.getText().toString() + ",");
|
|
configBuilder.append(mCfg813D.getText().toString() + ",");
|
|
//configBuilder.append(mCfg813E.getText().toString() + ",");
|
|
//configBuilder.append(mCfg813E.getText().toString() + ",");
|
|
- configBuilder.append("01" + ","); //补上01
|
|
|
|
- configBuilder.append("00" + ","); //补上00,多加一个,补齐是偶数
|
|
|
|
-
|
|
|
|
- //bCfgEx = (byte)Integer.parseInt(mCfg805A.getText().toString());
|
|
|
|
- //if ((bCfgEx & 0x40) == 0x40) //有扩展配置,则需要发送
|
|
|
|
- {
|
|
|
|
- //configBuilder.append(",");
|
|
|
|
-
|
|
|
|
- configBuilder.append(mCfgBF7B.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF7C.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF7D.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF7E.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF7F.getText().toString() + ",");
|
|
|
|
-
|
|
|
|
- configBuilder.append(mCfgBF80.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF81.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF82.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF83.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF84.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF85.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF86.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF87.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF88.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF89.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF8A.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF8B.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF8C.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF8D.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF8E.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF8F.getText().toString() + ",");
|
|
|
|
-
|
|
|
|
- configBuilder.append(mCfgBF90.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF91.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF92.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF93.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF94.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF95.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF96.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF97.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF98.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF99.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF9A.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF9B.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF9C.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF9D.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF9E.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBF9F.getText().toString() + ",");
|
|
|
|
-
|
|
|
|
- configBuilder.append(mCfgBFA0.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFA1.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFA2.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFA3.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFA4.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFA5.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFA6.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFA7.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFA8.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFA9.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFAA.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFAB.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFAC.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFAD.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFAE.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFAF.getText().toString() + ",");
|
|
|
|
-
|
|
|
|
- configBuilder.append(mCfgBFB0.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFB1.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFB2.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFB3.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFB4.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFB5.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFB6.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFB7.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFB8.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFB9.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFBA.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFBB.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFBC.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFBD.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFBE.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFBF.getText().toString() + ",");
|
|
|
|
-
|
|
|
|
- configBuilder.append(mCfgBFC0.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFC1.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFC2.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFC3.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFC4.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFC5.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFC6.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFC7.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFC8.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFC9.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFCA.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFCB.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFCC.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFCD.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFCE.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFCF.getText().toString() + ",");
|
|
|
|
-
|
|
|
|
- configBuilder.append(mCfgBFD0.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFD1.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFD2.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFD3.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFD4.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFD5.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFD6.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFD7.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFD8.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFD9.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFDA.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFDB.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFDC.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFDD.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFDE.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFDF.getText().toString() + ",");
|
|
|
|
-
|
|
|
|
- configBuilder.append(mCfgBFE0.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFE1.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFE2.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFE3.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFE4.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFE5.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFE6.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFE7.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFE8.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFE9.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFEA.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFEB.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFEC.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFED.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFEE.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFEF.getText().toString() + ",");
|
|
|
|
-
|
|
|
|
- configBuilder.append(mCfgBFF0.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFF1.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFF2.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFF3.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFF4.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFF5.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFF6.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFF7.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFF8.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFF9.getText().toString() + ",");
|
|
|
|
- configBuilder.append(mCfgBFFA.getText().toString());
|
|
|
|
- }
|
|
|
|
- //configBuilder.append(mCfg813E.getText().toString() + ",");
|
|
|
|
- //configBuilder.append(mCfg813F.getText().toString());
|
|
|
|
|
|
+ configBuilder.append("01"); //补上01
|
|
}else{ //在其他界面则保存
|
|
}else{ //在其他界面则保存
|
|
CombineCfg();
|
|
CombineCfg();
|
|
for (int i = 0; i < 185; i++){
|
|
for (int i = 0; i < 185; i++){
|
|
@@ -4039,48 +3491,8 @@ public class Config extends AppCompatActivity
|
|
mConfigShow[237] = Integer.toString(buff.array()[237] & 0xff);
|
|
mConfigShow[237] = Integer.toString(buff.array()[237] & 0xff);
|
|
mConfigShow[238] = Integer.toString(buff.array()[238] & 0xff);
|
|
mConfigShow[238] = Integer.toString(buff.array()[238] & 0xff);
|
|
|
|
|
|
-
|
|
|
|
- checksum = 0;
|
|
|
|
- for (int i = (239 + 1); i < (239 + 1 + 126); i += 2) { //要从偶数位开始,否则下面获取数据相加会出错
|
|
|
|
-
|
|
|
|
- //int k = ((int)mBytes[i] << 8) + mBytes[i + 1];
|
|
|
|
- int k = buff.asShortBuffer().get(i>>1);
|
|
|
|
- checksum = checksum + k;
|
|
|
|
-
|
|
|
|
- String hv = Integer.toHexString(buff.array()[i] & 0xff);
|
|
|
|
- if (hv.length() < 2){
|
|
|
|
- hv = "0" + hv;
|
|
|
|
- }
|
|
|
|
- mConfigShow[i - 1] = hv; //因为前面多加了一个,从偶数开始,这里要减回来
|
|
|
|
- hv = Integer.toHexString(buff.array()[i + 1] & 0xff);
|
|
|
|
- if (hv.length() < 2){
|
|
|
|
- hv = "0" + hv;
|
|
|
|
- }
|
|
|
|
- mConfigShow[i] = hv;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //将checksum填入配置
|
|
|
|
- buff.array()[239 + 1 + 126] = (byte) ((0 - (short)checksum) >> 8); //多加了一个从偶数位开始
|
|
|
|
- buff.array()[239 + 1 + 127] = (byte) ((0 - (short)checksum) & 0xff);
|
|
|
|
-
|
|
|
|
- //mConfigShow[239 + 126] = Integer.toString((short)checksum >> 8);//Integer.toString(buff.array()[239 + 126] & 0xff);
|
|
|
|
- //mConfigShow[239 + 127] = Integer.toString((short)checksum & 0xff);//Integer.toString(buff.array()[239 + 127] & 0xff);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- byte addressH = (byte)0xBF;
|
|
|
|
- byte addressL = (byte)0x7B;
|
|
|
|
- iicWrite(addressH,addressL,buff.array(),239 + 1,128);
|
|
|
|
- if (!recallCheck(addressH, addressL,buff.array(),239 + 1,128)) {
|
|
|
|
- mShow.setText("Recall check error,Send cfg failed");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- else{
|
|
|
|
- mShow.setText("Recall check success,Send cfg success");
|
|
|
|
- }
|
|
|
|
- //扩展命令 0x03,0x01,0x0f,-128,0x47,0x00,0x39,
|
|
|
|
- addressH = (byte)0x80;
|
|
|
|
- addressL = (byte)0x50;
|
|
|
|
|
|
+ byte addressH = (byte)0x80;
|
|
|
|
+ byte addressL = (byte)0x50;
|
|
iicWrite(addressH,addressL,buff.array(),0,239);
|
|
iicWrite(addressH,addressL,buff.array(),0,239);
|
|
if (!recallCheck(addressH, addressL,buff.array(),0,238)) {
|
|
if (!recallCheck(addressH, addressL,buff.array(),0,238)) {
|
|
mShow.setText("Recall check error,Send cfg failed");
|
|
mShow.setText("Recall check error,Send cfg failed");
|
|
@@ -4096,35 +3508,15 @@ public class Config extends AppCompatActivity
|
|
|
|
|
|
mCfg813C.setText(Integer.toHexString(buff.array()[236] & 0xff));
|
|
mCfg813C.setText(Integer.toHexString(buff.array()[236] & 0xff));
|
|
mCfg813D.setText(Integer.toHexString(buff.array()[237] & 0xff));
|
|
mCfg813D.setText(Integer.toHexString(buff.array()[237] & 0xff));
|
|
-
|
|
|
|
- //if ((bCfgEx & 0x40) == 0x40)
|
|
|
|
- {
|
|
|
|
- mCfgBFF9.setText(Integer.toHexString(buff.array()[239 + 1 + 126] & 0xff));
|
|
|
|
- mCfgBFFA.setText(Integer.toHexString(buff.array()[239 + 1 + 127] & 0xff));
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case R.id.readcfg: //read cfg
|
|
case R.id.readcfg: //read cfg
|
|
bottonMode = 2;
|
|
bottonMode = 2;
|
|
mSendData = mSendGetGt9ConfigData;
|
|
mSendData = mSendGetGt9ConfigData;
|
|
|
|
|
|
- iicWriteCommand((byte)0x12,(byte)0,(byte)0,0,0);
|
|
|
|
- while(true) {
|
|
|
|
- SystemClock.sleep(100);
|
|
|
|
-
|
|
|
|
- iicRead((byte) 0x81, (byte) 0x4e, mBytes, 1);
|
|
|
|
- if (mBytes[0] == (byte)0)
|
|
|
|
- {
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- iicWriteCommand((byte) 0x0f, (byte) 0x81, (byte) 0x4e, 0, 1);
|
|
|
|
- }
|
|
|
|
addressH = (byte)0x80;
|
|
addressH = (byte)0x80;
|
|
addressL = (byte)0x50;
|
|
addressL = (byte)0x50;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
iicRead(addressH,addressL,buff.array(),239);
|
|
iicRead(addressH,addressL,buff.array(),239);
|
|
buff.order(ByteOrder.BIG_ENDIAN);
|
|
buff.order(ByteOrder.BIG_ENDIAN);
|
|
StringBuilder stringBuilder = new StringBuilder("");
|
|
StringBuilder stringBuilder = new StringBuilder("");
|
|
@@ -4149,39 +3541,7 @@ public class Config extends AppCompatActivity
|
|
}
|
|
}
|
|
if((short)checksum == 0) //校验和正确
|
|
if((short)checksum == 0) //校验和正确
|
|
{
|
|
{
|
|
- //if ((buff.array()[10] & 0x40) == 0x40) //有扩展配置,再做校验
|
|
|
|
- {
|
|
|
|
- addressH = (byte)0xBF;
|
|
|
|
- addressL = (byte)0x7B;
|
|
|
|
- iicRead(addressH,addressL,buff.array(),128);
|
|
|
|
- checksum = 0;
|
|
|
|
- for (int i = 0,j = 239; i < 128; i += 2,j += 2) {
|
|
|
|
-
|
|
|
|
- int k = buff.asShortBuffer().get(i>>1);//((int)mBytes[i] << 8) + mBytes[i + 1];
|
|
|
|
- checksum = checksum + k;
|
|
|
|
- String hv = Integer.toHexString(buff.array()[i] & 0xff);
|
|
|
|
- if (hv.length() < 2){
|
|
|
|
- hv = "0" + hv;
|
|
|
|
- }
|
|
|
|
- mConfigShow[j] = hv;
|
|
|
|
- hv = Integer.toHexString(buff.array()[i + 1] & 0xff);
|
|
|
|
- if (hv.length() < 2){
|
|
|
|
- hv = "0" + hv;
|
|
|
|
- }
|
|
|
|
- mConfigShow[j + 1] = hv;
|
|
|
|
- }
|
|
|
|
- if((short)checksum == 0) //校验和正确
|
|
|
|
- {
|
|
|
|
- mShow.setText("Cfg Checksum is correct!");
|
|
|
|
- }
|
|
|
|
- else{
|
|
|
|
- mShow.setText("Cfg Checksum is error!");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- //else {
|
|
|
|
- // mShow.setText("Cfg Checksum is correct!");
|
|
|
|
- //}
|
|
|
|
|
|
+ mShow.setText("Cfg Checksum is correct!");
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
mShow.setText("Cfg Checksum is error!");
|
|
mShow.setText("Cfg Checksum is error!");
|
|
@@ -4196,22 +3556,16 @@ public class Config extends AppCompatActivity
|
|
//ReadCfgHoppingSetting(mBytes);
|
|
//ReadCfgHoppingSetting(mBytes);
|
|
ReadCfgRam(mConfigShow);
|
|
ReadCfgRam(mConfigShow);
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
addressH = (byte)0x81;
|
|
addressH = (byte)0x81;
|
|
addressL = (byte)0x40;
|
|
addressL = (byte)0x40;
|
|
iicRead(addressH,addressL,mBytes,16);
|
|
iicRead(addressH,addressL,mBytes,16);
|
|
tvVenderID.setText("VenderID:"+Integer.toString(mBytes[10] & 0xFF));
|
|
tvVenderID.setText("VenderID:"+Integer.toString(mBytes[10] & 0xFF));
|
|
|
|
|
|
- mSendCfg.setEnabled(true);
|
|
|
|
-
|
|
|
|
- btnsave.setEnabled(true);
|
|
|
|
-
|
|
|
|
break;
|
|
break;
|
|
case R.id.savecfg:
|
|
case R.id.savecfg:
|
|
|
|
|
|
if (editname.getText().length() == 0){
|
|
if (editname.getText().length() == 0){
|
|
- Toast.makeText(this,"请输入文件名及文件格式",Toast.LENGTH_SHORT).show();
|
|
|
|
|
|
+ Toast.makeText(this, getResources().getString(R.string.nameandformat), Toast.LENGTH_SHORT).show();
|
|
}else{
|
|
}else{
|
|
ActivityCompat.requestPermissions( Config.this, new String[]{android
|
|
ActivityCompat.requestPermissions( Config.this, new String[]{android
|
|
.Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
|
|
.Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
|
|
@@ -5034,7 +4388,18 @@ public class Config extends AppCompatActivity
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
+
|
|
|
|
+ case 3:
|
|
|
|
+ if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
|
|
|
|
+ //权限已成功申请
|
|
|
|
+ }else{
|
|
|
|
+ //用户拒绝授权
|
|
|
|
+ Toast.makeText(this,"无法获取SD卡读写权限", Toast.LENGTH_SHORT).show();
|
|
|
|
+ finish();
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
default:
|
|
default:
|
|
|
|
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|