takephoto_test.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // +build ignore
  2. #include "takephoto.h"
  3. // 主函数入口, 测试拍照
  4. int main(int argc,char *argv[])
  5. {
  6. int ret = 0; unsigned long stime, wtime, etime; SImgMark imgMark = { 0 };
  7. char filename[MAX_PATH_CHARS] = { 0 }; int timeout = 5*60;
  8. if(GetSysUsbfsMemCurrentSize() < 200) ret = SetSysUsbfsMemSize(200);
  9. if(0 != ret)
  10. {
  11. sw_log_error("Failed to set system usbfs's memory size, ret=%d!!", ret);
  12. return ret;
  13. }
  14. sw_log_info("Get HK camera count: %d", GetHKCameraCount());
  15. sw_log_info("Photo taking...");
  16. for(int i = 0; i < 9; i++)
  17. {
  18. sprintf(filename, "test%d.jpg", i+1);
  19. xgettickcount(&stime);
  20. ret = TakePhoto(IMG_TYPE_JPG, filename, timeout, &imgMark);
  21. xgettickcount(&etime);
  22. wtime = etime - stime;
  23. if(0 == ret) sw_log_info("+++ Take a photo: \"%s\", time: %lums, exposure time: %fus, camera sn: %s, camera model: %s +++", filename, wtime, imgMark.imgExposureTime, imgMark.camSerialNum, imgMark.camModelName);
  24. else sw_log_error("+++ Failed to take a photo, ret=%d, time: %lums!! +++", ret, wtime);
  25. }
  26. return 0;
  27. }