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