Compare commits
1 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
2f48e3f31d | 8 months ago |
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="com.codeverse.userSettings.MarscodeWorkspaceAppSettingsState">
|
|
||||||
<option name="ckgOperationStatus" value="SUCCESS" />
|
|
||||||
<option name="progress" value="0.90625" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AndroidTestResultsUserPreferences">
|
||||||
|
<option name="androidTestResultsTableState">
|
||||||
|
<map>
|
||||||
|
<entry key="-941396539">
|
||||||
|
<value>
|
||||||
|
<AndroidTestResultsTableState>
|
||||||
|
<option name="preferredColumnWidths">
|
||||||
|
<map>
|
||||||
|
<entry key="Duration" value="90" />
|
||||||
|
<entry key="Tests" value="360" />
|
||||||
|
<entry key="alps k62v1_3h" value="120" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</AndroidTestResultsTableState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="-531529726">
|
||||||
|
<value>
|
||||||
|
<AndroidTestResultsTableState>
|
||||||
|
<option name="preferredColumnWidths">
|
||||||
|
<map>
|
||||||
|
<entry key="Duration" value="90" />
|
||||||
|
<entry key="Pixel_2_API_33" value="120" />
|
||||||
|
<entry key="Tests" value="360" />
|
||||||
|
<entry key="alps k62v1_3h" value="120" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</AndroidTestResultsTableState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="1094103868">
|
||||||
|
<value>
|
||||||
|
<AndroidTestResultsTableState>
|
||||||
|
<option name="preferredColumnWidths">
|
||||||
|
<map>
|
||||||
|
<entry key="Duration" value="90" />
|
||||||
|
<entry key="Tests" value="360" />
|
||||||
|
<entry key="alps k62v1_3h" value="120" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</AndroidTestResultsTableState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,140 @@
|
|||||||
|
package com.example.writeepc;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.example.writeepc.been.MESInfo;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class ShuangqianActivity2Test extends TestCase {
|
||||||
|
|
||||||
|
|
||||||
|
public void test() {
|
||||||
|
String result = """
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<soap:Body>
|
||||||
|
<GetRFIDBindingInfoResponse xmlns="http://tempuri.org/">
|
||||||
|
<GetRFIDBindingInfoResult>
|
||||||
|
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="Table" msdata:UseCurrentLocale="true">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
<xs:element name="Table">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="品牌" type="xs:string" minOccurs="0"/>
|
||||||
|
<xs:element name="规格" type="xs:string" minOccurs="0"/>
|
||||||
|
<xs:element name="花纹类型" type="xs:string" minOccurs="0"/>
|
||||||
|
<xs:element name="胎号" type="xs:string" minOccurs="0"/>
|
||||||
|
<xs:element name="DOT" type="xs:string" minOccurs="0"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
|
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
|
||||||
|
<NewDataSet xmlns="">
|
||||||
|
<Table diffgr:id="Table1" msdata:rowOrder="0">
|
||||||
|
<品牌>123</品牌>
|
||||||
|
<规格>1234</规格>
|
||||||
|
<花纹类型>1235</花纹类型>
|
||||||
|
<胎号>1236</胎号>
|
||||||
|
<DOT>1236</DOT>
|
||||||
|
</Table>
|
||||||
|
</NewDataSet>
|
||||||
|
</diffgr:diffgram>
|
||||||
|
</GetRFIDBindingInfoResult>
|
||||||
|
</GetRFIDBindingInfoResponse>
|
||||||
|
</soap:Body>
|
||||||
|
</soap:Envelope>
|
||||||
|
""";
|
||||||
|
|
||||||
|
String regex = "<Table .*\">";
|
||||||
|
Pattern pattern = Pattern.compile(regex);
|
||||||
|
Matcher matcher = pattern.matcher(result);
|
||||||
|
if (!matcher.find()) {
|
||||||
|
System.out.println("未找到匹配的内容");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String matched = matcher.group();// 匹配内容
|
||||||
|
int beginIndex = matcher.start() + matched.length();
|
||||||
|
int endIndex = result.indexOf("</Table>");
|
||||||
|
Log.e("TAG", "test1:" + beginIndex);
|
||||||
|
Log.e("TAG", "test2:" + endIndex);
|
||||||
|
if (beginIndex >= endIndex) {
|
||||||
|
System.out.println("未找到匹配的内容");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
result = result.substring(beginIndex, endIndex);
|
||||||
|
System.out.println("截取内容:" + result);
|
||||||
|
// <品牌>风神</品牌><规格>10.00R20</规格><花纹类型>AGC08</花纹类型)<胎号>ZB250901399</胎号><DOT>3625</DOT>
|
||||||
|
|
||||||
|
|
||||||
|
String[] str=new String[]{"品牌","规格","花纹类型","胎号","DOT"};
|
||||||
|
for (String s : str) {
|
||||||
|
String tag = "<" + s + ">";
|
||||||
|
System.out.println("-"+result.substring(result.indexOf(tag) + tag.length(), result.indexOf("</"+s+">"))+"-");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* InputStream inputStream = new StringBufferInputStream(result);
|
||||||
|
XmlPullParser parser = Xml.newPullParser();
|
||||||
|
parser.setInput(inputStream, "utf-8"); // 设置输入流和编码
|
||||||
|
int eventType = parser.getEventType();
|
||||||
|
boolean isInTable = false; // 是否进入<Table>节点
|
||||||
|
while (eventType != XmlPullParser.END_DOCUMENT) {
|
||||||
|
String tagName = parser.getName();
|
||||||
|
System.out.println("tab name :"+tagName);
|
||||||
|
switch (eventType) {
|
||||||
|
case XmlPullParser.START_TAG:
|
||||||
|
// 找到<Table>节点,初始化数据对象
|
||||||
|
if ("Table".equals(tagName)) {
|
||||||
|
isInTable = true;
|
||||||
|
|
||||||
|
} else if (isInTable) {
|
||||||
|
switch (tagName) {
|
||||||
|
case "品牌":
|
||||||
|
String trim = parser.nextText().trim();
|
||||||
|
System.out.println(trim);
|
||||||
|
break;
|
||||||
|
case "规格":
|
||||||
|
String trim2 = parser.nextText().trim();
|
||||||
|
System.out.println(trim2);
|
||||||
|
break;
|
||||||
|
case "花纹类型":
|
||||||
|
String trim3 = parser.nextText().trim();
|
||||||
|
System.out.println(trim3);
|
||||||
|
break;
|
||||||
|
case "胎号":
|
||||||
|
String trim4 = parser.nextText().trim();
|
||||||
|
System.out.println(trim4);
|
||||||
|
break;
|
||||||
|
case "DOT":
|
||||||
|
String trim5 = parser.nextText().trim();
|
||||||
|
System.out.println(trim5);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case XmlPullParser.END_TAG:
|
||||||
|
// 退出<Table>节点
|
||||||
|
if ("Table".equals(tagName)) {
|
||||||
|
isInTable = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
eventType = parser.next(); // 解析下一个事件
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<litepal>
|
|
||||||
<dbname value="write_tag_info" />
|
|
||||||
<version value="1" />
|
|
||||||
<list>
|
|
||||||
<mapping class="com.example.writeepc.been.WriteInfo"></mapping>
|
|
||||||
</list>
|
|
||||||
</litepal>
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
package com.example.writeepc;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.KeyEvent;
|
|
||||||
import android.widget.RadioButton;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.example.writeepc.base.BaseActivity;
|
|
||||||
import com.example.writeepc.base.MyApplication;
|
|
||||||
import com.handheld.uhfr.UHFRManager;
|
|
||||||
|
|
||||||
public class HomeActivity2 extends BaseActivity {
|
|
||||||
private UHFRManager uhfrManager;
|
|
||||||
private long exitTime = 0L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_home2);
|
|
||||||
uhfrManager = UHFRManager.getInstance();
|
|
||||||
MyApplication.getApplication().setUhfrManager(uhfrManager);
|
|
||||||
|
|
||||||
RadioButton button4 = this.findViewById(R.id.home2_4);
|
|
||||||
RadioButton button3 = this.findViewById(R.id.home2_3);
|
|
||||||
button4.setOnClickListener(v -> {
|
|
||||||
startActivity(new Intent(this, SettingsActivity2.class));
|
|
||||||
});
|
|
||||||
|
|
||||||
button3.setOnClickListener(v -> {
|
|
||||||
startActivity(new Intent(this, IntentSelectActivity.class));
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
||||||
if (keyCode == 4) {
|
|
||||||
if ((System.currentTimeMillis() - exitTime) > 2000) {
|
|
||||||
Toast.makeText(getApplicationContext(), "再按一次退出程序", Toast.LENGTH_SHORT).show();
|
|
||||||
exitTime = System.currentTimeMillis();
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
if (uhfrManager != null) {
|
|
||||||
uhfrManager.close();
|
|
||||||
uhfrManager = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,238 +0,0 @@
|
|||||||
package com.example.writeepc;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.text.Editable;
|
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
|
|
||||||
import com.example.writeepc.adapter.MyMesInfoAdapter;
|
|
||||||
import com.example.writeepc.base.BaseActivity;
|
|
||||||
import com.example.writeepc.base.okgo.MyRecultCall;
|
|
||||||
import com.example.writeepc.base.okgo.MyResult;
|
|
||||||
import com.example.writeepc.been.MESInfo;
|
|
||||||
import com.example.writeepc.databinding.ActivityIntentSelectBinding;
|
|
||||||
import com.example.writeepc.utils.SharedPreferencesUtils;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
import com.lzy.okgo.OkGo;
|
|
||||||
import com.lzy.okgo.model.Response;
|
|
||||||
import com.uhf.api.cls.Reader;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import okhttp3.MediaType;
|
|
||||||
import okhttp3.RequestBody;
|
|
||||||
|
|
||||||
public class IntentSelectActivity extends BaseActivity {
|
|
||||||
private final Handler handler = new Handler();
|
|
||||||
public MediaType JSON = MediaType.parse("application/json; charset=utf-8");
|
|
||||||
private ActivityIntentSelectBinding binding;
|
|
||||||
private MyMesInfoAdapter adapter;
|
|
||||||
private Button traceSanButton;
|
|
||||||
private boolean sanState = true;
|
|
||||||
private Runnable runnable;
|
|
||||||
private Runnable tokenRunnable;
|
|
||||||
private MyKeyReceiver keyReceiver;
|
|
||||||
private String ip;
|
|
||||||
private String token;
|
|
||||||
|
|
||||||
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
binding = DataBindingUtil.setContentView(this, R.layout.activity_intent_select);
|
|
||||||
initUHFRManager1();
|
|
||||||
// 设置功率
|
|
||||||
String powerTrace1 = SharedPreferencesUtils.getstring("powerTrace2", "22");
|
|
||||||
int powerTrace = Integer.parseInt(powerTrace1);
|
|
||||||
Reader.READER_ERR readerErr = uhfrManager.setPower(powerTrace, powerTrace);
|
|
||||||
Log.e("TAG", "追溯设置功率" + powerTrace1 + ":" + readerErr.name());
|
|
||||||
initDialog();
|
|
||||||
adapter = new MyMesInfoAdapter(this);
|
|
||||||
binding.setAdapter(adapter);
|
|
||||||
traceSanButton = binding.traceSanButton;
|
|
||||||
runnable = () -> {
|
|
||||||
if (sanState) {
|
|
||||||
handler.removeCallbacks(runnable);
|
|
||||||
} else {
|
|
||||||
readEPC(12);
|
|
||||||
handler.postDelayed(runnable, 1000);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// tokenRunnable = () -> {
|
|
||||||
// requestToken();
|
|
||||||
// };
|
|
||||||
handler.postDelayed(tokenRunnable, 0);
|
|
||||||
keyReceiver = new MyKeyReceiver();
|
|
||||||
IntentFilter intentFilter = new IntentFilter();
|
|
||||||
intentFilter.addAction("android.rfid.FUN_KEY");
|
|
||||||
registerReceiver(keyReceiver, intentFilter);
|
|
||||||
String ACTION_CLOSE_SCAN = "com.rfid.CLOSE_SCAN";
|
|
||||||
Intent toKillService = new Intent();
|
|
||||||
toKillService.setAction(ACTION_CLOSE_SCAN);
|
|
||||||
sendBroadcast(toKillService);
|
|
||||||
binding.dataEpc.addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
if (s.length() == 24) {
|
|
||||||
|
|
||||||
requestToken(s.toString());
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ip = SharedPreferencesUtils.getstring("ip", "https://rfidpub.haohuatire.com:7443");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void requestToken(String epc) {
|
|
||||||
Map<String, String> map = new HashMap<>();
|
|
||||||
map.put("AppId", "app-20250704032545-nmmhn8jw");
|
|
||||||
map.put("AppSecret", "dXJZQKubbqhSPCugtA49rsDGACmN5CMD4ItTfP11+DA=");
|
|
||||||
OkGo.<MyResult>post(ip + "/UMInterface/Auth/AccessToken").upRequestBody(RequestBody.create(JSON, gson.toJson(map))).execute(new MyRecultCall(dialog, this) {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Response<MyResult> response) {
|
|
||||||
super.onSuccess(response);
|
|
||||||
MyResult body = response.body();
|
|
||||||
if (body.getCode() == 200) {
|
|
||||||
String dataJson = body.getDataJson();
|
|
||||||
JsonObject jsonObject = JsonParser.parseString(dataJson).getAsJsonObject();
|
|
||||||
token = jsonObject.get("Token").getAsString();
|
|
||||||
Log.e("TAG", "onSuccess:token=" + token);
|
|
||||||
binding.traceSanButton1.setVisibility(View.GONE);
|
|
||||||
// handler.postDelayed(tokenRunnable, 60 * 1000 * 90);
|
|
||||||
haohuaMesSelect(epc);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
tipsDialog.setTip(false, body.getInfo());
|
|
||||||
tipsDialog.show();
|
|
||||||
binding.traceSanButton1.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void intentRequestToken(View view) {
|
|
||||||
requestToken(binding.dataEpc.getText().toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dataReadRFID(View view) {
|
|
||||||
if (sanState) {
|
|
||||||
handler.postDelayed(runnable, 0);
|
|
||||||
sanState = false;
|
|
||||||
traceSanButton.setBackgroundResource(R.drawable.button_bg2);
|
|
||||||
traceSanButton.setText("停止扫描");
|
|
||||||
} else {
|
|
||||||
sanState = true;
|
|
||||||
handler.removeCallbacks(runnable);
|
|
||||||
traceSanButton.setBackgroundResource(R.drawable.button_bg1);
|
|
||||||
traceSanButton.setText("开始扫描");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void readTidReault(boolean readState, String result, byte[] rdata) {
|
|
||||||
super.readTidReault(readState, result, rdata);
|
|
||||||
binding.dataEpc.setText(result);
|
|
||||||
|
|
||||||
if (readState) {
|
|
||||||
dataReadRFID(null);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void haohuaMesSelect(String result) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OkGo.<MyResult>post(ip + "/UMInterface/RFID/sellTyreTracingBack")
|
|
||||||
.headers("Token", token)
|
|
||||||
.params("rfid", result).execute(new MyRecultCall(dialog, this) {
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Response<MyResult> response) {
|
|
||||||
super.onSuccess(response);
|
|
||||||
MyResult body = response.body();
|
|
||||||
try {
|
|
||||||
if (body.getCode() == 200) {
|
|
||||||
String dataJson = body.getDataJson();
|
|
||||||
if (dataJson == null || dataJson.equals("[]")) {
|
|
||||||
tipsDialog.setTip(false, "未查询到相关信息");
|
|
||||||
tipsDialog.show();
|
|
||||||
adapter.setList(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
dataJson = dataJson.replace("[{", "").replace("\"", "").trim();
|
|
||||||
String[] split = dataJson.split(",");
|
|
||||||
List<MESInfo> mesInfos = new ArrayList<>();
|
|
||||||
for (String item : split) {
|
|
||||||
String[] split1 = item.split(":");
|
|
||||||
MESInfo mesInfo = new MESInfo();
|
|
||||||
mesInfo.setTitle(split1[0]);
|
|
||||||
mesInfo.setInfo(split1[1]);
|
|
||||||
mesInfos.add(mesInfo);
|
|
||||||
}
|
|
||||||
;
|
|
||||||
adapter.setList(mesInfos);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
tipsDialog.setTip(false, body.getInfo());
|
|
||||||
tipsDialog.show();
|
|
||||||
adapter.setList(null);
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
tipsDialog.setTip(false, "接口返回信息异常,解析失败");
|
|
||||||
tipsDialog.show();
|
|
||||||
|
|
||||||
}
|
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
unregisterReceiver(keyReceiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class MyKeyReceiver extends BroadcastReceiver {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
var keydown = intent.getBooleanExtra("keydown", false);
|
|
||||||
if (!keydown) {
|
|
||||||
dataReadRFID(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,45 +0,0 @@
|
|||||||
package com.example.writeepc;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.Spinner;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
|
|
||||||
import com.example.writeepc.databinding.SettingsActivity2Binding;
|
|
||||||
import com.example.writeepc.databinding.SettingsActivityBinding;
|
|
||||||
import com.example.writeepc.utils.SharedPreferencesUtils;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class SettingsActivity2 extends AppCompatActivity {
|
|
||||||
|
|
||||||
private Spinner powerTrace;
|
|
||||||
private EditText settingIp;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
SettingsActivity2Binding binding =
|
|
||||||
DataBindingUtil.setContentView(this, R.layout.settings_activity2);
|
|
||||||
|
|
||||||
powerTrace = binding.selectPowerTrace;
|
|
||||||
settingIp = binding.settingIp;
|
|
||||||
|
|
||||||
String tracePower = SharedPreferencesUtils.getstring("powerTrace2", "22");
|
|
||||||
List<String> powerList = Arrays.asList(getResources().getStringArray(R.array.power));
|
|
||||||
|
|
||||||
powerTrace.setSelection(powerList.indexOf(tracePower));
|
|
||||||
settingIp.setText(SharedPreferencesUtils.getstring("ip", "https://rfidpub.haohuatire.com:7443"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveInfo(View view) {
|
|
||||||
|
|
||||||
SharedPreferencesUtils.putstring("powerTrace2", powerTrace.getSelectedItem().toString());
|
|
||||||
SharedPreferencesUtils.putstring("ip", settingIp.getText().toString());
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,108 +0,0 @@
|
|||||||
package com.example.writeepc;
|
|
||||||
|
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
|
|
||||||
import com.example.writeepc.base.BaseActivity;
|
|
||||||
import com.example.writeepc.databinding.ActivityUserXuanchuanBinding;
|
|
||||||
import com.example.writeepc.utils.ASCIIUtil;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class UserXuanchuanActivity extends BaseActivity {
|
|
||||||
private ActivityUserXuanchuanBinding binding;
|
|
||||||
private int flag = 0;
|
|
||||||
private byte[] rdata;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
binding = DataBindingUtil.setContentView(this, R.layout.activity_user_xuanchuan);
|
|
||||||
Locale locale = new Locale("es");
|
|
||||||
Locale.setDefault(locale);
|
|
||||||
Configuration config = new Configuration();
|
|
||||||
config.locale = locale;
|
|
||||||
getBaseContext().getResources().updateConfiguration(config,
|
|
||||||
getBaseContext().getResources().getDisplayMetrics());
|
|
||||||
|
|
||||||
initReceiver();
|
|
||||||
initUHFRManager(33);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void readTid(View view) {
|
|
||||||
flag = 1;
|
|
||||||
readTid();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeUser(View view) {
|
|
||||||
String trim = binding.writeInfo.getText().toString().trim();
|
|
||||||
if (rdata == null) {
|
|
||||||
Toast.makeText(this, "请先读取TID", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (trim.isEmpty()) {
|
|
||||||
Toast.makeText(this, "请输入要写入的用户信息", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int length = trim.length();
|
|
||||||
// 32,128
|
|
||||||
if (length > 32 ) {
|
|
||||||
Toast.makeText(this, "长度不能超过32个字符", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String writeData = ASCIIUtil.str4Hex(trim);
|
|
||||||
int writeLenth = writeData.length();
|
|
||||||
Log.e("TAG", "数据长度:" + length + " ," + writeLenth);
|
|
||||||
if (writeLenth < 128) {
|
|
||||||
writeData = writeData+String.format("%0"+(128-writeLenth)+"d", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.e("TAG", "写入数据:" + writeData+" ,长度:" + writeData.length());
|
|
||||||
writeUserDataByTid(writeData, rdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void readUser(View view) {
|
|
||||||
flag = 2;
|
|
||||||
readUser(64);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receiverSan() {
|
|
||||||
super.receiverSan();
|
|
||||||
readUser(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void readTidReault(boolean readState, String result, byte[] rdata) {
|
|
||||||
super.readTidReault(readState, result, rdata);
|
|
||||||
if (readState) {
|
|
||||||
if (flag == 1) {
|
|
||||||
binding.tidCode.setText(result);
|
|
||||||
this.rdata = rdata;
|
|
||||||
} else {
|
|
||||||
Log.e("TAG", "readTidReault:" + result);
|
|
||||||
String text = ASCIIUtil.hexTo4ZN(result);
|
|
||||||
binding.readInfo.setText(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
if (uhfrManager != null) {
|
|
||||||
uhfrManager.close();
|
|
||||||
uhfrManager = null;
|
|
||||||
}
|
|
||||||
if (myReceiver != null) {
|
|
||||||
unregisterReceiver(myReceiver);
|
|
||||||
myReceiver = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,182 +0,0 @@
|
|||||||
package com.example.writeepc;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.databinding.DataBindingUtil;
|
|
||||||
|
|
||||||
import com.example.writeepc.base.BaseActivity;
|
|
||||||
import com.example.writeepc.been.InfoData;
|
|
||||||
import com.example.writeepc.been.WriteInfo;
|
|
||||||
import com.example.writeepc.databinding.ActivityWriteUserBinding;
|
|
||||||
import com.example.writeepc.utils.SharedPreferencesUtils;
|
|
||||||
import com.example.writeepc.utils.WriteExportExcelUtil;
|
|
||||||
import com.uhf.api.cls.Reader;
|
|
||||||
|
|
||||||
import org.litepal.LitePal;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class WriteUserActivity extends BaseActivity {
|
|
||||||
private ActivityWriteUserBinding binding;
|
|
||||||
private InfoData infoData;
|
|
||||||
private boolean isReadUser = false;
|
|
||||||
private WriteExportExcelUtil writeExportExcelUtil;
|
|
||||||
private MyKeyReceiver keyReceiver;
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
binding = DataBindingUtil.setContentView(this, R.layout.activity_write_user);
|
|
||||||
infoData = new InfoData();
|
|
||||||
binding.setData(infoData);
|
|
||||||
int power = SharedPreferencesUtils.getInt("power", 30);
|
|
||||||
binding.selectPower.setSelection(power-5);
|
|
||||||
initUHFRManager(power);
|
|
||||||
writeExportExcelUtil = new WriteExportExcelUtil(this);
|
|
||||||
keyReceiver = new MyKeyReceiver();
|
|
||||||
IntentFilter intentFilter = new IntentFilter();
|
|
||||||
intentFilter.addAction("android.rfid.FUN_KEY");
|
|
||||||
registerReceiver(keyReceiver, intentFilter);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void readTidReault(boolean readState, String result, byte[] rdata) {
|
|
||||||
Log.e("TAG", "readTidReault:" + result);
|
|
||||||
if (isReadUser) {
|
|
||||||
infoData.setTidBytes(rdata);
|
|
||||||
infoData.setReadTId(result);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
infoData.setReadUser(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeUser(View view) {
|
|
||||||
String readTId = infoData.getReadTId();
|
|
||||||
if (readTId == null || readTId.isEmpty()) {
|
|
||||||
Toast.makeText(this, "请先读取TID", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String writeData = infoData.getWriteUser();
|
|
||||||
if (writeData == null || writeData.isEmpty()) {
|
|
||||||
Toast.makeText(this, "请输入要写入的数据", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
WriteInfo writeInfo = new WriteInfo(readTId, writeData, sdf.format(new Date()));
|
|
||||||
// boolean b = writeUserDataByTid(writeData + "0000000000", infoData.getTidBytes());
|
|
||||||
boolean b = writeEPCDataByTid("00"+writeData , infoData.getTidBytes());
|
|
||||||
if (b) {
|
|
||||||
writeInfo.save();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Toast.makeText(this, "写入用户数据失败,请检查胎号是否正确", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void readUser(View view) {
|
|
||||||
isReadUser = false;
|
|
||||||
// readUser(6);
|
|
||||||
readEPC(6);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void userClearView(View view) {
|
|
||||||
// infoData.setWriteUser(null);
|
|
||||||
// infoData.setReadUser(null);
|
|
||||||
infoData.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeUserReadTid(View view) {
|
|
||||||
isReadUser = true;
|
|
||||||
readTid();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receiverSan() {
|
|
||||||
this.readUser(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
if (uhfrManager != null) {
|
|
||||||
uhfrManager.close();
|
|
||||||
uhfrManager = null;
|
|
||||||
}
|
|
||||||
// if (myReceiver != null) {
|
|
||||||
// unregisterReceiver(myReceiver);
|
|
||||||
// }
|
|
||||||
if (keyReceiver != null) {
|
|
||||||
unregisterReceiver(keyReceiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
exportExcel(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void exportExcel(View view) {
|
|
||||||
// File file= writeExportExcelUtil.getFilePath("RFID写入记录.xls");
|
|
||||||
// if (file.exists()) {
|
|
||||||
// file.delete();
|
|
||||||
// }
|
|
||||||
// writeExportExcelUtil.export(LitePal.findAll(WriteInfo.class), "RFID写入记录.xls");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
// 点击两次返回结束程序
|
|
||||||
private long exitTime = 0;
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
if (System.currentTimeMillis() - exitTime > 2000) {
|
|
||||||
Toast.makeText(this, "再按一次退出程序", Toast.LENGTH_SHORT).show();
|
|
||||||
exitTime = System.currentTimeMillis();
|
|
||||||
} else {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MyKeyReceiver extends BroadcastReceiver {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
|
|
||||||
var keydown = intent.getBooleanExtra("keydown", false);
|
|
||||||
var keyCode = intent.getIntExtra("keyCode", 0);
|
|
||||||
Log.e("TAG", "onReceive:" + keyCode);
|
|
||||||
if (!keydown) {
|
|
||||||
if (keyCode == 135) {
|
|
||||||
writeUserReadTid(null);
|
|
||||||
}else if (keyCode ==136){
|
|
||||||
writeUser(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPower(View view) {
|
|
||||||
String powerString = binding.selectPower.getSelectedItem().toString();
|
|
||||||
int power = Integer.parseInt(powerString);
|
|
||||||
SharedPreferencesUtils.putInt("power", power);
|
|
||||||
Reader.READER_ERR readerErr = uhfrManager.setPower(power, power);
|
|
||||||
Log.e("TAG", "setPower:" + readerErr.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
package com.example.writeepc.been;
|
|
||||||
|
|
||||||
import org.litepal.crud.LitePalSupport;
|
|
||||||
|
|
||||||
public class WriteInfo extends LitePalSupport {
|
|
||||||
private int id;
|
|
||||||
private String tid;
|
|
||||||
private String writeInfo;
|
|
||||||
private String dateTime;
|
|
||||||
|
|
||||||
public WriteInfo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public WriteInfo(String tid, String writeInfo, String dateTime) {
|
|
||||||
this.tid = tid;
|
|
||||||
this.writeInfo = writeInfo;
|
|
||||||
this.dateTime = dateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTid() {
|
|
||||||
return tid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTid(String tid) {
|
|
||||||
this.tid = tid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWriteInfo() {
|
|
||||||
return writeInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWriteInfo(String writeInfo) {
|
|
||||||
this.writeInfo = writeInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDateTime() {
|
|
||||||
return dateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDateTime(String dateTime) {
|
|
||||||
this.dateTime = dateTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<corners android:radius="6dp"/>
|
|
||||||
<solid android:color="@color/white"/>
|
|
||||||
</shape>
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:context=".HomeActivity2">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:background="#6750A4"
|
|
||||||
android:letterSpacing="0.2"
|
|
||||||
android:text="主页"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="22sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<RadioGroup
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/home2_3"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:button="@null"
|
|
||||||
android:drawableTop="@mipmap/ic_info"
|
|
||||||
android:drawablePadding="10dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="轮胎信息查询"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/home2_4"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:button="@null"
|
|
||||||
android:drawableTop="@mipmap/home_setting"
|
|
||||||
android:drawablePadding="10dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="设置"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
</RadioGroup>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@ -1,105 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<data>
|
|
||||||
|
|
||||||
<variable
|
|
||||||
name="adapter"
|
|
||||||
type="com.example.writeepc.adapter.MyMesInfoAdapter" />
|
|
||||||
</data>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:context=".IntentSelectActivity">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:background="#6750A4"
|
|
||||||
android:letterSpacing="0.2"
|
|
||||||
android:text="轮胎追溯"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="22sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="110dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="扫描RFID:" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/data_epc"
|
|
||||||
style="@style/san_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/data_info"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="left|center"
|
|
||||||
android:padding="20dp"
|
|
||||||
android:textSize="18sp"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="110dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:text="查询信息"
|
|
||||||
android:textColor="@color/blue" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:adapter="@{adapter}"
|
|
||||||
android:padding="10dp"
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="15dp">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/trace_san_button1"
|
|
||||||
style="@style/button_style"
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:background="@drawable/button_bg2"
|
|
||||||
android:onClick="intentRequestToken"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:text="重新连接" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/trace_san_button"
|
|
||||||
style="@style/button_style"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:onClick="dataReadRFID"
|
|
||||||
android:background="@drawable/button_bg1"
|
|
||||||
android:text="开始扫描" />
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</layout>
|
|
||||||
@ -1,108 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<data>
|
|
||||||
|
|
||||||
</data>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="@mipmap/test1"
|
|
||||||
tools:context=".UserXuanchuanActivity">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="@color/blue2"
|
|
||||||
android:letterSpacing="0.2"
|
|
||||||
android:text="RFID Tag writing"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="22sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="110dp"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="San TID:" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tid_code"
|
|
||||||
style="@style/san_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_gravity="center" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/button_style"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:onClick="readTid"
|
|
||||||
android:backgroundTint="@color/blue2"
|
|
||||||
android:text="Query TID" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="110dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="Input data:" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/write_info"
|
|
||||||
style="@style/info_text2"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:gravity="center"
|
|
||||||
android:minHeight="45dp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/button_style"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:backgroundTint="@color/blue2"
|
|
||||||
android:onClick="writeUser"
|
|
||||||
android:text="Write data" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/read_info"
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/button_style"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:backgroundTint="@color/blue2"
|
|
||||||
android:onClick="readUser"
|
|
||||||
android:text="Scan RFID" />
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</layout>
|
|
||||||
@ -1,201 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<data>
|
|
||||||
|
|
||||||
<variable
|
|
||||||
name="data"
|
|
||||||
type="com.example.writeepc.been.InfoData" />
|
|
||||||
</data>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:context=".WriteUserActivity">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="#6750A4"
|
|
||||||
android:letterSpacing="0.2"
|
|
||||||
android:text="EPC区读写"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="22sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:layout_marginTop="30dp"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="110dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="读取长度:" />
|
|
||||||
|
|
||||||
<Spinner
|
|
||||||
android:id="@+id/user_read_lenth"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:entries="@array/read_lenth"
|
|
||||||
android:textAlignment="center" />
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="110dp"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="设置功率:" />
|
|
||||||
|
|
||||||
<Spinner
|
|
||||||
android:id="@+id/select_power"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:entries="@array/power"
|
|
||||||
android:textAlignment="center"
|
|
||||||
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/button_style"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:onClick="setPower"
|
|
||||||
android:text="设置功率" />
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="110dp"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="扫描TID:" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tid_code"
|
|
||||||
style="@style/san_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="@{data.readTId}" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/button_style"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:backgroundTint="@color/blue2"
|
|
||||||
android:onClick="writeUserReadTid"
|
|
||||||
android:text="1-查询TID" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:layout_marginTop="30dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="110dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="写入数据:" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@={data.writeUser}" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/button_style"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:layout_marginTop="12dp"
|
|
||||||
android:onClick="writeUser"
|
|
||||||
android:text="写入数据" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="110dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="EPC:" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/san_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:minHeight="55dp"
|
|
||||||
android:padding="5dp"
|
|
||||||
android:text="@={data.readUser}" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/button_style"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:layout_marginTop="12dp"
|
|
||||||
android:onClick="readUser"
|
|
||||||
android:text="扫描验证" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="12dp">
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/button_style"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:backgroundTint="#FFD600"
|
|
||||||
android:onClick="userClearView"
|
|
||||||
android:text="清空操作" />
|
|
||||||
|
|
||||||
<!-- <Button-->
|
|
||||||
<!-- style="@style/button_style"-->
|
|
||||||
<!-- android:layout_width="wrap_content"-->
|
|
||||||
<!-- android:layout_height="55dp"-->
|
|
||||||
<!-- android:backgroundTint="@color/blue"-->
|
|
||||||
<!-- android:onClick="exportExcel"-->
|
|
||||||
<!-- android:text="设置功率" />-->
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</layout>
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<data>
|
|
||||||
|
|
||||||
</data>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:context=".SettingsActivity2">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="55dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="#6750A4"
|
|
||||||
android:letterSpacing="1"
|
|
||||||
android:text="设置"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="22sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="110dp"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="追溯功率:" />
|
|
||||||
|
|
||||||
<Spinner
|
|
||||||
android:id="@+id/select_power_trace"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:entries="@array/power"
|
|
||||||
android:textAlignment="center" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/info_text"
|
|
||||||
android:layout_width="110dp"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_gravity="center|left"
|
|
||||||
android:text="请求地址:" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/setting_ip"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:entries="@array/power"
|
|
||||||
android:lines="1"
|
|
||||||
android:textAlignment="center" />
|
|
||||||
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/button_style"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="20dp"
|
|
||||||
android:onClick="saveInfo"
|
|
||||||
android:text="保存并退出" />
|
|
||||||
</LinearLayout>
|
|
||||||
</layout>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 292 KiB |
Loading…
Reference in New Issue