Skip to content

Commit 19b3ef8

Browse files
committed
完成
1 parent c6dda6e commit 19b3ef8

File tree

8 files changed

+32
-25
lines changed

8 files changed

+32
-25
lines changed

app/flirone热成像仪.apk

-12.8 MB
Binary file not shown.

app/src/main/java/com/flir/flirone/GlobalConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class GlobalConfig {
2020

2121
//网络服务
2222
public static final String SERVER_IP = "211.143.78.218:7044";
23-
public static final int NET_TIMEOUT_MS = 6000;
23+
public static final int NET_TIMEOUT_MS = 60000;
2424
public static final String NAMESPACE = "http://tempuri.org/";
2525
public static final String WEBSERVICE_URL = "http://211.143.78.218:7044//pcj_cloudtrain_ws//Service1.asmx";
2626
public static final String METHOD_NAME = "ReceiveHeatImageInfoWithGPS";

app/src/main/java/com/flir/flirone/PreviewActivity.java

+11-12
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ public class PreviewActivity extends Activity implements Device.Delegate, FrameP
7474
private TextView showTeleimei;
7575
private Device.TuningState currentTuningState = Device.TuningState.Unknown;
7676

77+
private ImageButton imageButton;
78+
7779
public void onDeviceConnected(Device device) {
7880
runOnUiThread(new Runnable() {
7981
@Override
@@ -116,6 +118,7 @@ public void run() {
116118
findViewById(R.id.tuningTextView).setVisibility(View.VISIBLE);
117119

118120
loading.setVisibility(View.GONE);
121+
imageButton.setEnabled(true);
119122
spotMeterIcon.setVisibility(View.VISIBLE);
120123
}
121124
});
@@ -267,26 +270,19 @@ public void run() {
267270
new Thread(new Runnable() {
268271
@Override
269272
public void run() {
270-
final String fileName = nfc_result.substring(1) + "_" + getFileName() + "_" + GlobalConfig.imgIndex;
273+
271274
try {
272-
lastSavedPath = GlobalConfig.IMAGE_PATH + "/" + fileName + "@" + (float) maxTemp + "#" + maxX + "$" + maxY + "%" + (float) meantTemp + ".jpg";
273275
Frame frame = renderedImage.getFrame();
274276
if (frame != null) {
277+
GlobalConfig.imgIndex++;
278+
final String fileName = nfc_result.substring(1) + "_" + getFileName() + "_" + GlobalConfig.imgIndex;
279+
lastSavedPath = GlobalConfig.IMAGE_PATH + "/" + fileName + "@" + (float) maxTemp + "#" + maxX + "$" + maxY + "%" + (float) meantTemp + ".jpg";
275280
frame.save(new File(lastSavedPath), RenderedImage.Palette.Iron, RenderedImage.ImageType.BlendedMSXRGBA8888Image);
276281
} else {
277282
Toast.makeText(PreviewActivity.this, "图片获取失败", Toast.LENGTH_SHORT).show();
278283
}
279284

280285
context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse(GlobalConfig.IMAGE_PATH)));
281-
282-
MediaScannerConnection.scanFile(context,
283-
new String[]{GlobalConfig.IMAGE_PATH + "/" + fileName}, null,
284-
new MediaScannerConnection.OnScanCompletedListener() {
285-
@Override
286-
public void onScanCompleted(String path, Uri uri) {
287-
}
288-
289-
});
290286
} catch (Exception e) {
291287

292288
}
@@ -313,7 +309,6 @@ public void onCaptureImageClicked(View v) {
313309
} else {
314310
sp.play(sound, 1, 1, 0, 0, 1);
315311
this.imageCaptureRequested = true;
316-
GlobalConfig.imgIndex++;
317312
}
318313

319314
setThumb();
@@ -396,6 +391,10 @@ protected void onCreate(Bundle savedInstanceState) {
396391
Toast.makeText(PreviewActivity.this, "权限错误", Toast.LENGTH_SHORT).show();
397392
}
398393

394+
//拍照按钮
395+
imageButton = (ImageButton) findViewById(R.id.imageButton);
396+
imageButton.setEnabled(false);
397+
399398
//是否开启警报
400399
warnButton = (ToggleButton) findViewById(R.id.warnButton);
401400
warnButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

app/src/main/java/com/flir/flirone/ShowImageActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private void setImageInfo(File file) {
4444
showImageSize.setText(imageHelp.getFileOrFilesSize(file));
4545
showImageTime.setText(imageHelp.getTimeFromName(info.getName()));
4646

47-
int dot = info.getAverTemp().indexOf(".") + 3;
47+
int dot = info.getAverTemp().indexOf(".") + 2;
4848

4949
showTemp.setText("最高温度:" + info.getMaxTemp() + "℃ 平均温度:" + info.getAverTemp().substring(0, dot) + "℃");
5050
showCoordinate.setText("最高温度坐标: (" + info.getMaxTempX() + "," + info.getMaxTempY() + ")");

app/src/main/java/com/flir/flirone/imagehelp/ImageHelp.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,16 @@ public ImageInfo getInfoFromName(String name) {
197197
return info;
198198
}
199199

200-
public void renameImage(File file) {
200+
public String renameImage(File file) {
201+
String newPath = "";
201202
if (file.getName().indexOf("_UP") < 0) {
202203
File oldFile = new File(file.getPath());
203204
String oldPath = file.getPath();
204205
int index1 = oldPath.indexOf("@");
205-
String newPath = oldPath.substring(0, index1) + "_UP@" + oldPath.substring(index1 + 1);
206+
newPath = oldPath.substring(0, index1) + "_UP@" + oldPath.substring(index1 + 1);
206207
oldFile.renameTo(new File(newPath));
207208
}
209+
return newPath;
208210
}
209211

210212
public boolean deleteFile(String path) {

app/src/main/java/com/flir/flirone/networkhelp/UpLoadService.java

+14-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class UpLoadService extends Service implements ConnectivityChangeReceiver
2424
private static boolean mIsInprogress = false;
2525

2626
WebServiceCall webServiceCall;
27-
final int TIME_DELAYED = 1000 * 60 * 10; //每10分钟重启一次服务
27+
final int TIME_DELAYED = 30 * 1000;//1000 * 60 * 10; //每10分钟重启一次服务
2828

2929
private Thread thread_create;
3030
private Context context = this;
@@ -61,13 +61,19 @@ public int onStartCommand(final Intent intent, int flags, int startId) {
6161

6262
@Override
6363
public void run() {
64-
if (isConnected) {
64+
if (isConnected & files != null) {
6565
for (int i = 0; i < files.length; i++) {
66-
if (files[i].getName().indexOf("_UP") < 0) {
66+
String fileName = files[i].getName();
67+
68+
Log.i("imageindex:", i + " " + fileName);
69+
70+
if (fileName.indexOf("_UP") < 0) {
6771
byte[] bytes = imageHelp.getFileToByte(files[i]);
6872
try {
69-
if (request(webServiceCall, imageHelp, imageHelp.getInfoFromName(files[i].getName()), telephonyManager.getDeviceId(), new String(bytes, "UTF-8"))) { //实际中是isSuccess
70-
imageHelp.renameImage(files[i]);
73+
boolean isUp = request(webServiceCall, imageHelp, imageHelp.getInfoFromName(fileName), telephonyManager.getDeviceId(), new String(bytes, "UTF-8"));
74+
if (isUp) { //实际中是isSuccess
75+
String newName = imageHelp.renameImage(files[i]);
76+
Log.i("imageindexsuccess", i + " " + isUp + " " + fileName + " newName:" + newName);
7177
}
7278
} catch (UnsupportedEncodingException e) {
7379
e.printStackTrace();
@@ -125,14 +131,14 @@ private boolean request(WebServiceCall call, ImageHelp imageHelp, ImageInfo imag
125131
if (imageInfo.getName().indexOf("_UP") < 0) {
126132
call.request.addProperty(GlobalConfig.PHONE_TAG, phoneId); //手机串号
127133
call.request.addProperty(GlobalConfig.NFC_TAG, imageInfo.getNfcCode());
128-
call.request.addProperty(GlobalConfig.IMAGE, image);
134+
call.request.addProperty(GlobalConfig.IMAGE, "image");
129135
call.request.addProperty(GlobalConfig.IMAGE_NAME, imageInfo.getName() + ".jpg");
130136
call.request.addProperty(GlobalConfig.IMAGE_TIME, imageHelp.getTimeFromName(imageInfo.getName()));
131-
int maxTempDot = imageInfo.getMaxTemp().indexOf(".") + 3;
137+
int maxTempDot = imageInfo.getMaxTemp().indexOf(".") + 2;
132138
call.request.addProperty(GlobalConfig.MAX_TEMP, imageInfo.getMaxTemp().substring(0, maxTempDot));
133139
call.request.addProperty(GlobalConfig.MAX_TEMP_X, imageInfo.getMaxTempX());
134140
call.request.addProperty(GlobalConfig.MAX_TEMP_Y, imageInfo.getMaxTempY());
135-
int averTempDot = imageInfo.getAverTemp().indexOf(".") + 3;
141+
int averTempDot = imageInfo.getAverTemp().indexOf(".") + 2;
136142
call.request.addProperty(GlobalConfig.AVERAGE_TEMP, imageInfo.getAverTemp().substring(0, averTempDot));
137143
call.request.addProperty(GlobalConfig.TELELONG, "90");
138144
call.request.addProperty(GlobalConfig.TELELAT, "90");

app/src/main/res/layout/activity_preview.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
android:id="@+id/loading"
177177
android:layout_width="50dp"
178178
android:layout_height="50dp"
179-
android:layout_gravity="center"/>
179+
android:layout_gravity="center" />
180180

181181
<TextView
182182
android:id="@+id/spotMeterValue"

app/巡检管理系统.apk

-33.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)