|
|
@@ -29,6 +29,10 @@ public class SessionInteractor implements Callback{
|
29
|
29
|
private Handler cameraInitHandler;
|
30
|
30
|
private static final int MSG_CAMERA_INIT_EVENT = 1001;
|
31
|
31
|
|
|
32
|
+ private static final String MSG_TYPE_CAMERA_ERROR = "camero error";//相机错误,可能是线松动了。先exit,然后重新init
|
|
33
|
+ private static final String MSG_TYPE_NOT_INIT = "not init"; //需要初始化
|
|
34
|
+ private static final String MSG_TYPE_TIME_OUT = "time out"; //继续调用waitforevent
|
|
35
|
+
|
32
|
36
|
private static final String TAG = "SessionInteractor";
|
33
|
37
|
|
34
|
38
|
public SessionInteractor(SessionBean sessionBean, SessionListener listener) {
|
|
|
@@ -109,25 +113,32 @@ public class SessionInteractor implements Callback{
|
109
|
113
|
}
|
110
|
114
|
|
111
|
115
|
isLastQueryReturned = false;
|
112
|
|
- String photoName = CameraJNIInterface.getInstance().java_mygpcamerawaitforevent(sessionWorkingDirPath);
|
113
|
|
- LogHelper.d("czy","mygpcamerawaitforevent return result = "+photoName);
|
114
|
|
- if(photoName!=null && photoName.length()>0){
|
115
|
|
- String sub = photoName.substring(0,1);
|
116
|
|
- if(TextUtils.isDigitsOnly(sub)){
|
117
|
|
- LogHelper.d(TAG,"fetchPhotoTask new photo found");
|
118
|
|
- PhotoBean bean = new PhotoBean();
|
119
|
|
- bean.photoName = photoName;
|
120
|
|
- bean.photoId = Long.parseLong(photoName.substring(0,photoName.lastIndexOf(".")));
|
121
|
|
- bean.captureTime = bean.photoId;
|
122
|
|
- bean.isRawPhoto = true;
|
123
|
|
- bean.uploadStatus = PhotoBean.UploadStatus.STATUS_NO_BEGIN;
|
124
|
|
- bean.sessionId = sessionBean.sessionId;
|
125
|
|
- bean.lensmanId = sessionBean.lensmanId;
|
126
|
|
- bean.sessionSeq = sessionBean.sessionSeq;
|
127
|
|
- bean.sessionDate = sessionBean.sessionDate;
|
128
|
|
- bean.sessionCreateTime = sessionBean.createTime;
|
129
|
|
- bean.photoPath = sessionWorkingDirPath+File.separator+photoName;
|
130
|
|
- listener.onSessionPhotoCaptured(bean);
|
|
116
|
+ String eventMsg = CameraJNIInterface.getInstance().java_mygpcamerawaitforevent(sessionWorkingDirPath);
|
|
117
|
+ LogHelper.d("czy","mygpcamerawaitforevent return result = "+eventMsg);
|
|
118
|
+ if(eventMsg!=null && eventMsg.length()>0){
|
|
119
|
+ if(MSG_TYPE_NOT_INIT.equalsIgnoreCase(eventMsg)||MSG_TYPE_CAMERA_ERROR.equalsIgnoreCase(eventMsg)){
|
|
120
|
+ endSession();
|
|
121
|
+ startSession();
|
|
122
|
+ }else if(MSG_TYPE_TIME_OUT.equalsIgnoreCase(eventMsg)){
|
|
123
|
+
|
|
124
|
+ }else{
|
|
125
|
+ String sub = eventMsg.substring(0,1);
|
|
126
|
+ if(TextUtils.isDigitsOnly(sub)){
|
|
127
|
+ LogHelper.d(TAG,"fetchPhotoTask new photo found");
|
|
128
|
+ PhotoBean bean = new PhotoBean();
|
|
129
|
+ bean.photoName = eventMsg;
|
|
130
|
+ bean.photoId = Long.parseLong(eventMsg.substring(0,eventMsg.lastIndexOf(".")));
|
|
131
|
+ bean.captureTime = bean.photoId;
|
|
132
|
+ bean.isRawPhoto = true;
|
|
133
|
+ bean.uploadStatus = PhotoBean.UploadStatus.STATUS_NO_BEGIN;
|
|
134
|
+ bean.sessionId = sessionBean.sessionId;
|
|
135
|
+ bean.lensmanId = sessionBean.lensmanId;
|
|
136
|
+ bean.sessionSeq = sessionBean.sessionSeq;
|
|
137
|
+ bean.sessionDate = sessionBean.sessionDate;
|
|
138
|
+ bean.sessionCreateTime = sessionBean.createTime;
|
|
139
|
+ bean.photoPath = sessionWorkingDirPath+File.separator+eventMsg;
|
|
140
|
+ listener.onSessionPhotoCaptured(bean);
|
|
141
|
+ }
|
131
|
142
|
}
|
132
|
143
|
}
|
133
|
144
|
|