niujiuru 2 месяцев назад
Родитель
Сommit
62ff166033
1 измененных файлов с 11 добавлено и 6 удалено
  1. 11 6
      hk_takephoto/takephoto.c

+ 11 - 6
hk_takephoto/takephoto.c

@@ -160,7 +160,7 @@ findp:
   if(!pDevInfo)
   {
     ret = -4;
-    sw_log_error("[%s] unexpected internal error, unable to obtain detailed information about the industrial camera!!", MODULE_NAME);
+    sw_log_error("[%s] unexpected internal error, failed to obtain camera information!!", MODULE_NAME);
     goto end_p;
   }
 
@@ -179,11 +179,16 @@ findp:
     strcpy(imgMark.camModelName, (const char *)pDevInfo->SpecialInfo.stGigEInfo.chModelName);
     strcpy(imgMark.camSerialNum, (const char *)pDevInfo->SpecialInfo.stGigEInfo.chSerialNumber);
   }
+  else { // SDK出错, 我只枚举了U口和G口相机, 不可能出现其他类型
+    ret = -5;
+    sw_log_error("[%s] unexpected internal error, unknown camera type(%u)!!", MODULE_NAME, pDevInfo->nTLayerType);
+    goto end_p;
+  }
 
   if(xstrcasecmp(ctx.manuName, manufacturer) != 0 && !is_hikrobot_manu_alias(ctx.manuName))
   {
     if(index < devList.nDeviceNum) goto findp;
-    ret = -5;
+    ret = -6;
     sw_log_error("[%s] 没有找到 \"%s\" 的相机!!", MODULE_NAME, manufacturer);
     goto end_p;
   }
@@ -199,7 +204,7 @@ findp:
   { // 探测网络最佳包大小(只对GigE相机有效)
     int size = MV_CC_GetOptimalPacketSize(hCam);
     if(size > 0) ret = MV_CC_SetIntValueEx(hCam, "GevSCPSPacketSize", size);
-    else ret = -6;
+    else ret = -7;
   }
   if(MV_OK != ret)
   {
@@ -238,7 +243,7 @@ findp:
   ctx.hESig = sw_signal_create();
   if(!ctx.hESig)
   {
-    ret = -7;
+    ret = -8;
     sw_log_error("[%s] SIG信号量创建失败!!", MODULE_NAME);
     goto end_p;
   }
@@ -247,7 +252,7 @@ findp:
   HANDLE hThrd = sw_thrd_create("PhotoProc", THREAD_DEFAULT_PRIORITY, THREAD_DEFAULT_STACK_SIZE, PhotoProc, (unsigned long)&ctx, 0);
   if(!hThrd)
   {
-    ret = -8;
+    ret = -9;
     sw_signal_destroy(ctx.hESig);
     sw_log_error("[%s] 拍照线程-创建失败!!", MODULE_NAME);
     goto end_p;
@@ -258,7 +263,7 @@ findp:
   if(0 == ret) ret = ctx.rCode;
   else
   {
-    ret = -9;
+    ret = 10;
     sw_log_error("[%s] 拍照过程-等待超时!!", MODULE_NAME);
   }