|
|
@ -46,7 +46,6 @@ import okhttp3.RequestBody;
|
|
|
|
|
|
|
|
|
|
|
|
public class ReadBlueToothActivity extends BaseActivity {
|
|
|
|
public class ReadBlueToothActivity extends BaseActivity {
|
|
|
|
private ResultAdapter adapter;
|
|
|
|
private ResultAdapter adapter;
|
|
|
|
|
|
|
|
|
|
|
|
private String[] stringArray;
|
|
|
|
private String[] stringArray;
|
|
|
|
private List<ReadTyreNoResult> list;
|
|
|
|
private List<ReadTyreNoResult> list;
|
|
|
|
private ActivityBluetoothReadBinding binding;
|
|
|
|
private ActivityBluetoothReadBinding binding;
|
|
|
@ -154,13 +153,23 @@ public class ReadBlueToothActivity extends BaseActivity {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void handleMessage(@NonNull Message msg) {
|
|
|
|
public void handleMessage(@NonNull Message msg) {
|
|
|
|
super.handleMessage(msg);
|
|
|
|
super.handleMessage(msg);
|
|
|
|
String receivedData = (String) msg.obj;
|
|
|
|
String receivedData = msg.obj.toString().trim();
|
|
|
|
if (receivedData.substring(0, 2).equals("GR")) {
|
|
|
|
if (receivedData.equals("N1")){
|
|
|
|
var trim = receivedData.substring(2, receivedData.length()).trim();
|
|
|
|
if (activityType) {
|
|
|
|
|
|
|
|
readInfo(null);
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
readEPCInfo(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (receivedData.startsWith("GR")) {
|
|
|
|
|
|
|
|
var trim = receivedData.substring(2);
|
|
|
|
if (activityType) {
|
|
|
|
if (activityType) {
|
|
|
|
if (user == null) {
|
|
|
|
if (user == null) {
|
|
|
|
user = trim;
|
|
|
|
user = trim;
|
|
|
|
// Log.e("TAG", "handleMessage1:" + user);
|
|
|
|
Log.e("TAG", "handleMessage1:" + user);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
outputStream.write("GR301F3E\r".getBytes());
|
|
|
|
outputStream.write("GR301F3E\r".getBytes());
|
|
|
|
} catch (IOException e) {
|
|
|
|
} catch (IOException e) {
|
|
|
@ -170,9 +179,9 @@ public class ReadBlueToothActivity extends BaseActivity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
user += receivedData.substring(2, receivedData.length()).trim();
|
|
|
|
user += receivedData.substring(2).trim();
|
|
|
|
// Log.e("TAG", "handleMessage-:" + "4532383036463132303030303030303234314632323541337E33323433323034303634307E4A494E59557E3338352F36355232322E357E4A593539387E323450527E3338352F36355232322E35203136344B2032345052204A5935393820424C34454A597E4B7E3136347E3535352E307E5F7E5F7E");
|
|
|
|
Log.e("TAG", "handleMessage-:" + "4532383036463132303030303030303234314632323541337E33323433323034303634307E4A494E59557E3338352F36355232322E357E4A593539387E323450527E3338352F36355232322E35203136344B2032345052204A5935393820424C34454A597E4B7E3136347E3535352E307E5F7E5F7E");
|
|
|
|
// Log.e("TAG", "handleMessage2:" + user);
|
|
|
|
Log.e("TAG", "handleMessage2:" + user);
|
|
|
|
readUserInfo(user);
|
|
|
|
readUserInfo(user);
|
|
|
|
user = null;
|
|
|
|
user = null;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -198,7 +207,7 @@ public class ReadBlueToothActivity extends BaseActivity {
|
|
|
|
public void readInfo(View view) {
|
|
|
|
public void readInfo(View view) {
|
|
|
|
user = null;
|
|
|
|
user = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
outputStream.write("GR300218\r".getBytes());
|
|
|
|
outputStream.write("GR30003E\r".getBytes());
|
|
|
|
} catch (IOException e) {
|
|
|
|
} catch (IOException e) {
|
|
|
|
// e.printStackTrace();
|
|
|
|
// e.printStackTrace();
|
|
|
|
Toast.makeText(context, getString(R.string.bluetooth_open_state), Toast.LENGTH_SHORT).show();
|
|
|
|
Toast.makeText(context, getString(R.string.bluetooth_open_state), Toast.LENGTH_SHORT).show();
|
|
|
|