// +build ignore #include "takephoto.h" // 主函数入口, 测试拍照 int main(int argc,char *argv[]) { int ret = 0; unsigned long stime, wtime, etime; SImgMark imgMark = { 0 }; char filename[MAX_PATH_CHARS] = { 0 }; int timeout = 5*60; if(GetSysUsbfsMemCurrentSize() < 200) ret = SetSysUsbfsMemSize(200); if(0 != ret) { sw_log_error("Failed to set system usbfs's memory size, ret=%d!!", ret); return ret; } sw_log_info("Get HK camera count: %d", GetHKCameraCount()); sw_log_info("Photo taking..."); for(int i = 0; i < 9; i++) { sprintf(filename, "test%d.jpg", i+1); xgettickcount(&stime); ret = TakePhoto(IMG_TYPE_JPG, filename, timeout, &imgMark); xgettickcount(&etime); wtime = etime - stime; 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); else sw_log_error("+++ Failed to take a photo, ret=%d, time: %lums!! +++", ret, wtime); } return 0; }