Ejemplo n.º 1
0
  /** 从记录仪上获取突发视频的数据 */
  private void getEventDataFromCamera() {
    Logger.i(TAG, "getEventDataFromCamera()");
    CameraMessage getLSMessage =
        new CameraMessage(
            CommandID.AMBA_LS_NEW,
            new CameraMessageCallback() {
              @Override
              public void onReceiveErrorMessage(
                  CameraMessage cameraMessage, JSONObject jsonObject) {
                Logger.e(TAG, "onReceiveErrorMessage" + jsonObject.toString());
              }

              @Override
              public void onReceiveMessage(CameraMessage cameraMessage, JSONObject jsonObject) {
                Logger.e(TAG, "onReceiveMessage:" + jsonObject.toString());
                //                mEventListingInfo = GsonUtils.fromJson(jsonObject.toString(),
                // ListingInfo.class);
                //                Logger.i(TAG, "EventListingInfo:" + mEventListingInfo.toString());
                // 只初始化Event页的数据
              }

              @Override
              public void onReceiveNotification(JSONObject jsonObject) {}
            });
    getLSMessage.put("type", "event");

    remoteCamHelper.sendCommand(getLSMessage);
  }
Ejemplo n.º 2
0
  /** 发命令让记录仪切换为sta状态 */
  private void apStatrt() {
    final String password = "******";
    CameraMessage cameraMessage =
        new CameraMessage(
            1543,
            new CameraMessageCallback() {
              @Override
              public void onReceiveErrorMessage(
                  CameraMessage cameraMessage, JSONObject jsonObject) {}

              @Override
              public void onReceiveMessage(CameraMessage cameraMessage, JSONObject jsonObject) {
                //                wifiAp.startWifiAp(ssid, password);
                Constant.token = 0;
                RemoteCamHelper.getRemoteCam().closeChannel();
              }

              @Override
              public void onReceiveNotification(JSONObject jsonObject) {}
            });
    cameraMessage.put("type", "sta");
    cameraMessage.put("ssid", ssid);
    cameraMessage.put("password", password);
    cameraMessage.put("times", 30);
    remoteCamHelper.sendCommand(cameraMessage);
    Logger.e("Send 'sta' command to recorder!");
    //        CheckUDPService.chekUdpTimeOut();
  }
Ejemplo n.º 3
0
  /** 从记录仪上获取手动记录的数据 */
  private void getPhotoDataFromCamera() {
    Logger.i(TAG, "getPhotoDataFromCamera()");
    CameraMessage getLSMessage =
        new CameraMessage(
            CommandID.AMBA_LS_NEW,
            new CameraMessageCallback() {
              @Override
              public void onReceiveErrorMessage(
                  CameraMessage cameraMessage, JSONObject jsonObject) {
                Logger.e(TAG, "onReceiveErrorMessage" + jsonObject.toString());
              }

              @Override
              public void onReceiveMessage(CameraMessage cameraMessage, JSONObject jsonObject) {
                Logger.e(TAG, "onReceiveMessage:" + jsonObject.toString());
                mPhotoListingInfo = GsonUtils.fromJson(jsonObject.toString(), ListingInfo.class);
                // shimeng add for protect null point,20160416,begin
                if (null != mPhotoListingInfo) {
                  List<ListingInfo.FileInfo> fileInfos = mPhotoListingInfo.getListing();
                  int count = Math.min(3, fileInfos.size());
                  homePhotoInfos.clear();
                  for (int i = fileInfos.size(); i > fileInfos.size() - 3 && i > 0; i--) {
                    String thumbName = fileInfos.get(i - 1).getFilename().replace("A", "T");
                    HomePhotoInfo homePI = new HomePhotoInfo(thumbName, HomePhotoInfo.NORMAL_PIC);
                    homePhotoInfos.add(homePI);
                  }
                  showPhoto();
                  Logger.i(TAG, "PhotoListingInfo:" + mPhotoListingInfo.toString());
                }
                // shimeng add for protect null point,20160416,end
              }

              @Override
              public void onReceiveNotification(JSONObject jsonObject) {}
            });
    getLSMessage.put("type", "photo");

    RemoteCamHelper.getRemoteCam().sendCommand(getLSMessage);
  }
Ejemplo n.º 4
0
  /** 获取到当前的状态 */
  private void getCameraStatus() {
    CameraMessage getCameraStatus =
        new CameraMessage(
            CommandID.AMBA_GET_SETTING,
            new CameraMessageCallback() {
              @Override
              public void onReceiveErrorMessage(
                  CameraMessage cameraMessage, JSONObject jsonObject) {}

              @Override
              public void onReceiveMessage(CameraMessage cameraMessage, JSONObject jsonObject) {
                cameraStatus = jsonObject.optString("param");
                if (mPlayer.isPlaying()) {
                  initRecordedIcon();
                }
              }

              @Override
              public void onReceiveNotification(JSONObject jsonObject) {}
            });
    getCameraStatus.put("type", "app_status");
    remoteCamHelper.sendCommand(getCameraStatus);
  }