camera
private class EventHandler extends Handler
223 {
224 private Camera mCamera;
225
226 public EventHandler(Camera c, Looper looper) {
227 super(looper);
228 mCamera = c;
229 }
230
231 @Override
232 public void handleMessage(Message msg) {
233 switch(msg.what) {
234 case SHUTTER_CALLBACK:
235 if (mShutterCallback != null) {
236 mShutterCallback.onShutter();
237 }
238 return;
239 case RAW_PICTURE_CALLBACK:
240 if (mRawImageCallback != null)
241 mRawImageCallback.onPictureTaken((byte[])msg.obj, mCamera);
242 return;
243
244 case JPEG_PICTURE_CALLBACK:
245 if (mJpegCallback != null)
246 mJpegCallback.onPictureTaken((byte[])msg.obj, mCamera);
247 return;
248
249 case PREVIEW_CALLBACK:
250 if (mPreviewCallback != null) {
251 mPreviewCallback.onPreviewFrame((byte[])msg.obj, mCamera);
252 if (mOneShot) {
253 mPreviewCallback = null;
254 }
255 }
256 return;
257
258 case AUTOFOCUS_CALLBACK:
259 if (mAutoFocusCallback != null)
260 mAutoFocusCallback.onAutoFocus(msg.arg1 == 0 ? false : true, mCamera);
261 return;
262
263 case ERROR_CALLBACK:
264 Log.e(TAG, "Error " + msg.arg1);
265 if (mErrorCallback != null)
266 mErrorCallback.onError(msg.arg1, mCamera);
267 return;
268
269 default:
270 Log.e(TAG, "Unknown message type " + msg.what);
271 return;
272 }
273 }