Skip to content

Commit 66bac36

Browse files
author
wenlong
committed
增加调试pid信息
1 parent 1b5ec2b commit 66bac36

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
<string name="menu_settings">Settings</string>
66
<string name="hello_world">Hello world!</string>
77
<string name="stop">{"MAF":"0\r\n","AVGSPD":"029","STARTS":"068","MILE-T":"0003.6","MAXRPM":"11642","POWER":"0","RACLS":"000","FUELS":"0037.241","FUEL-T":"000.605","MAXACL":"008","TIMES":"0007.7","MAXSPD":"030","BRAKES":"000","MINRPM":"00000","MILES":"005558.7"}</string>
8+
<string name="pid">{"MPH":"018.943\r\n","MILE-T":"0001.0","VBAT":"11.7","ECT":"065","TIMES":"00127","SPD":"030","RPM":"11630","LOD":"000.0"}</string>
89
</resources>

src/com/obd/simpleexample/MainActivity.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public void onClick(View v){
3737
switch (v.getId()) {
3838
case R.id.start:
3939
EventBus.getDefault().post("IGNITION");
40+
startPid();
4041
break;
4142
case R.id.stop:
4243
JsonMsg msg = new JsonMsg();
@@ -52,11 +53,38 @@ public void onClick(View v){
5253
}
5354

5455
EventBus.getDefault().post(msg);
56+
stopPid();
5557
break;
5658
default:
5759
break;
5860
}
5961
}
62+
63+
private void startPid(){
64+
mHandler.postDelayed(mPidPostRunnale, 30*1000);
65+
}
66+
private void stopPid(){
67+
mHandler.removeCallbacks(mPidPostRunnale);
68+
}
69+
Runnable mPidPostRunnale = new Runnable(){
70+
@Override
71+
public void run() {
72+
JsonMsg msg = new JsonMsg();
73+
msg.what = 1;
74+
String json = getString(R.string.pid);
75+
MyLog.D( json);
76+
77+
try {
78+
msg.obj = new JSONObject(json);
79+
} catch (JSONException e) {
80+
// TODO Auto-generated catch block
81+
e.printStackTrace();
82+
}
83+
84+
EventBus.getDefault().post(msg);
85+
mHandler.postDelayed(mPidPostRunnale, 30*1000);
86+
}
87+
};
6088

6189
@Override
6290
public boolean onCreateOptionsMenu(Menu menu) {

src/com/obd/widget/GetLoaction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
public class GetLoaction {
22-
public static final boolean isDebug = false;
22+
public static final boolean isDebug = true;
2323

2424
public String mIMEI = "33333333333";
2525
int mGSMsingle;

0 commit comments

Comments
 (0)