142
+        if(!isLastQueryReturned){
143
+            LogHelper.d("czy","fetchPhotoTask last query not finished,return ");
144
+            return;
145
+        }
146
+
147
+        isLastQueryReturned = false;
148
+        String eventMsg = CameraJNIInterface.getInstance().java_mygpcamerawaitforevent(sessionWorkingDirPath);
149
+        LogHelper.d("czy","mygpcamerawaitforevent return result = "+eventMsg);
150
+        if(eventMsg!=null && eventMsg.length()>0){
151
+            if(MSG_TYPE_NOT_INIT.equalsIgnoreCase(eventMsg)||MSG_TYPE_CAMERA_ERROR.equalsIgnoreCase(eventMsg)){
152
+                Bundle bundle = new Bundle();
153
+                bundle.putInt(EXTRA_STATUS_PART, MSG_CAMERA_CONN_ERROR);
154
+                sendCameraIntent(bundle);
155
+                stopCameraService();
156
+            }else if(MSG_TYPE_TIME_OUT.equalsIgnoreCase(eventMsg)){
157
+
158
+            }else{
159
+                String sub = eventMsg.substring(0,1);
160
+                if(TextUtils.isDigitsOnly(sub)){
161
+                    LogHelper.d("czy","fetchPhotoTask new photo found");
162
+                    Bundle bundle = new Bundle();
163
+                    bundle.putInt(EXTRA_STATUS_PART, MSG_CAMERA_NEW_PHOTO_FOUND);
164
+                    bundle.putString(EXTRA_DATA_PART,eventMsg);
165
+                    sendCameraIntent(bundle);
166
+                }
167
+            }
168
+        }
169
+
170
+        isLastQueryReturned = true;
171
+    }
172
+
173
+    private void sendCameraIntent(Bundle bundle){
174
+        Intent intent = new Intent(ACTION_CAMERA_SERVICE_STATUS_CHANGE);
175
+        intent.putExtras(bundle);
176
+        sendBroadcast(intent);
177
+    }
178
+
15 179
 }

Sign In - Gogs: Go Git Service

Sign In