Beispiel #1
0
 /*
  * 搜索录像文件
  */
 private ArrayList<HashMap<String, Object>> onSearchFile() {
   mFileDataList.clear();
   int count = 0;
   ArrayList<HashMap<String, Object>> list = new ArrayList<HashMap<String, Object>>();
   FindInfo findInfo = new FindInfo();
   Date date = new Date(System.currentTimeMillis());
   findInfo.nChannelN0 = 0;
   findInfo.nFileType = FileType.SDK_RECORD_ALL;
   findInfo.startTime.year = date.getYear() + 1900;
   findInfo.startTime.month = date.getMonth() + 1;
   findInfo.startTime.day = date.getDate();
   findInfo.startTime.hour = 0;
   findInfo.endTime.year = date.getYear() + 1900;
   findInfo.endTime.month = date.getMonth() + 1;
   findInfo.endTime.day = date.getDate();
   findInfo.endTime.hour = 24;
   do {
     FileData[] filedata = new FileData[64];
     for (int i = 0; i < 64; ++i) filedata[i] = new FileData();
     count = mNetSdk.FindFile(mLoginId, findInfo, filedata, 256, 5000);
     if (count == 64) {
       findInfo.startTime.year = filedata[63].stEndTime.year;
       findInfo.startTime.month = filedata[63].stEndTime.month;
       findInfo.startTime.day = filedata[63].stEndTime.day;
       findInfo.startTime.hour = filedata[63].stEndTime.hour;
       findInfo.startTime.minute = filedata[63].stEndTime.minute;
       findInfo.startTime.second = filedata[63].stEndTime.second;
     }
     for (int j = 0; j < count; ++j) {
       if (count <= 64) {
         String starttime =
             String.format(
                 "%02d.%02d.%02d",
                 filedata[j].stBeginTime.hour,
                 filedata[j].stBeginTime.minute,
                 filedata[j].stBeginTime.second);
         mFileDataList.add(filedata[j]);
         HashMap<String, Object> map = new HashMap<String, Object>();
         map.put("filename", starttime);
         map.put("filetype", filedata[j].filetype);
         list.add(map);
       } else break;
     }
   } while (count == 64);
   return list;
 }
Beispiel #2
0
 private void onTimeSearch(TimeObject startTime, TimeObject endTime) {
   // mFileDataList = new ArrayList<FileData>();
   FindInfo findInfo = new FindInfo();
   findInfo.startTime.year = startTime.getYear();
   findInfo.startTime.month = startTime.getMonth();
   findInfo.startTime.day = startTime.getDay();
   findInfo.startTime.hour = startTime.getHour();
   findInfo.startTime.minute = startTime.getMinute();
   findInfo.startTime.second = 0;
   findInfo.endTime.year = endTime.getYear();
   findInfo.endTime.month = endTime.getMonth();
   findInfo.endTime.day = endTime.getDay();
   findInfo.endTime.hour = endTime.getHour();
   findInfo.endTime.minute = endTime.getMinute();
   findInfo.endTime.second = 0;
   findInfo.nChannelN0 = 0;
   findInfo.nFileType = 0;
   findInfo.szFileName = "";
   if (mWndSelected >= channelNum) findInfo.nChannelN0 = 0;
   else findInfo.nChannelN0 = mWndSelected;
   int position = 0;
   for (int i : Channel) {
     if (i == findInfo.nChannelN0) {
       onStopChn(position);
     }
     position++;
   }
   mlPlayHandle[mWndSelected] = mNetSdk.PlayBackByTime(mWndSelected, mLoginId, findInfo, 1, 1);
   if (mlPlayHandle[mWndSelected] > 0 && compareTime(startTime, endTime)) {
     mPlayState = PlayState.MPS_PLAYING;
     getMySurface(mWndSelected).initData();
     ReviewState[mWndSelected] = 1;
     Channel[mWndSelected] = findInfo.nChannelN0;
     Toast.makeText(getApplicationContext(), "打开成功", Toast.LENGTH_SHORT).show();
     mStartTime[mWndSelected] =
         findInfo.startTime.hour * 3600
             + findInfo.startTime.minute * 60
             + findInfo.startTime.second;
     mEndTime[mWndSelected] =
         findInfo.endTime.hour * 3600 + findInfo.endTime.minute * 60 + findInfo.endTime.second;
     mTotalTime[mWndSelected] = (mEndTime[mWndSelected] - mStartTime[mWndSelected]);
     timeSeek.setMax(mTotalTime[mWndSelected]);
     timeSeek.setProgress(0);
     getMySurface(mWndSelected).setOnPlayBackPosListener(onPlayBackPosLs);
     System.out.println(
         "录像长度:"
             + mTotalTime[mWndSelected]
             + " "
             + mStartTime[mWndSelected]
             + " "
             + mEndTime[mWndSelected]);
     myListPart.setVisibility(View.INVISIBLE);
   } else {
     Toast.makeText(getApplicationContext(), "打开失败,请检查输入时间是否正确...", Toast.LENGTH_SHORT).show();
   }
 }