|
|
@@ -199,7 +199,7 @@ namespace TeamAAS_VP.Core.Cameras
|
|
|
{
|
|
|
SR7Link.ErrConnectCallBack ErrConnectDelegate = new SR7Link.ErrConnectCallBack(ErrConnectFunc);
|
|
|
ErrConnectDelegate = new ErrConnectCallBack(ErrConnectFunc);
|
|
|
- int nOpenRet = iSR7APi.Open(0, CameraIp, 2000, ErrConnectDelegate);
|
|
|
+ int nOpenRet = iSR7APi.Open(Index-1, CameraIp, 2000, ErrConnectDelegate);
|
|
|
if (nOpenRet == (int)SR7Link.SR7IF_ERROR.SR7IF_OK)
|
|
|
{
|
|
|
//设置相机参数,否则无法取图 / Set the camera parameters, otherwise you will not be able to take pictures
|
|
|
@@ -207,25 +207,25 @@ namespace TeamAAS_VP.Core.Cameras
|
|
|
//异步回调必须在Ed软件中设置 / Asynchronous callbacks must be set in the EdgeImaging software
|
|
|
int nReadBastchValue = -1;
|
|
|
int nSetParamRet = -1;
|
|
|
- int getParamRet = iSR7APi.GetParams(0, -1, SR7IF_SETTING_ITEM.BATCH_ON_OFF, out nReadBastchValue);
|
|
|
+ int getParamRet = iSR7APi.GetParams(Index - 1, -1, SR7IF_SETTING_ITEM.BATCH_ON_OFF, out nReadBastchValue);
|
|
|
if (nReadBastchValue != 1)
|
|
|
{
|
|
|
- nSetParamRet = iSR7APi.SetParams(0, (int)SAVEPOWEROFF.ESAPO_SAVE, -1, SR7IF_SETTING_ITEM.BATCH_ON_OFF, 1);
|
|
|
+ nSetParamRet = iSR7APi.SetParams(Index - 1, (int)SAVEPOWEROFF.ESAPO_SAVE, -1, SR7IF_SETTING_ITEM.BATCH_ON_OFF, 1);
|
|
|
LogHelper.WriteLogInfo($"Set Batch On Off: {nSetParamRet}");
|
|
|
}
|
|
|
- nSetParamRet = iSR7APi.SetParams(0, (int)SAVEPOWEROFF.ESAPO_SAVE, -1, SR7IF_SETTING_ITEM.CYCLICAL_PATTERN, 0);
|
|
|
- int nSetParamRet1 = iSR7APi.SetParams(0, (int)SAVEPOWEROFF.ESAPO_SAVE, -1, SR7IF_SETTING_ITEM.SEGMENT_BUFER, 0);
|
|
|
+ nSetParamRet = iSR7APi.SetParams(Index - 1, (int)SAVEPOWEROFF.ESAPO_SAVE, -1, SR7IF_SETTING_ITEM.CYCLICAL_PATTERN, 0);
|
|
|
+ int nSetParamRet1 = iSR7APi.SetParams(Index - 1, (int)SAVEPOWEROFF.ESAPO_SAVE, -1, SR7IF_SETTING_ITEM.SEGMENT_BUFER, 0);
|
|
|
LogHelper.WriteLogInfo($"Set Batch Data Receive: {nSetParamRet1}{nSetParamRet1}");
|
|
|
|
|
|
GetDataDelegate = new SR7IFGetDataCallBack(GetDataCallBack);
|
|
|
- iSR7APi.Init(0,0,2000, GetDataDelegate);
|
|
|
+ iSR7APi.Init(Index - 1, 0,2000, GetDataDelegate);
|
|
|
}
|
|
|
LogHelper.WriteLogInfo($"Connect Camera {nOpenRet} {GetSDKErrMsgByCode(nOpenRet)}");
|
|
|
}
|
|
|
|
|
|
if (!IsConnected)
|
|
|
{
|
|
|
- if (iSR7APi.CameraBOnline)
|
|
|
+ if (iSR7APi.CameraAOnline)
|
|
|
{
|
|
|
CameraConnectChangedEvent?.Invoke(ID, true);
|
|
|
}
|
|
|
@@ -264,6 +264,7 @@ namespace TeamAAS_VP.Core.Cameras
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
+ iSR7APi.Stop();
|
|
|
int nRet = iSR7APi.Close();
|
|
|
LogHelper.WriteLogInfo($"Close Camera: {nRet}{GetSDKErrMsgByCode(nRet)}");
|
|
|
}
|
|
|
@@ -465,14 +466,14 @@ namespace TeamAAS_VP.Core.Cameras
|
|
|
{
|
|
|
int[] tempHeightDataA = new int[nTempWidth * nHighlen];
|
|
|
byte[] tempGrayDataA = new byte[nTempWidth * nHighlen];
|
|
|
- iSR7APi.GetData(tempHeightDataA, tempGrayDataA, Encoder[0], (int)pcHead.width, (int)nHighlen, 0);
|
|
|
+ iSR7APi.GetData(tempHeightDataA, tempGrayDataA, Encoder[Index - 1], (int)pcHead.width, (int)nHighlen, Index - 1);
|
|
|
Array.Copy(tempHeightDataA, 0, ImgBuff32[0], offset, nTempWidth * nHighlen);
|
|
|
Array.Copy(tempGrayDataA, 0, GrayBuff[0], offset, nTempWidth * nHighlen);
|
|
|
//if (ImgBuff32 != null && ImgBuff32.Length != 0 && ImgBuff32[0] != null)
|
|
|
//{
|
|
|
// ShowRGBImage(ImgBuff32[0], pcHead, pictureBoxA);
|
|
|
//}
|
|
|
- CogImage16Range cogImage16Range = SSZNCognexParser.SSZNParser.LoadSSZN3DImage(ImgBuff32[0], (int)pcHead.width, (int)pcHead.height, pcHead.xInterval, pcHead.yInterval);
|
|
|
+ CogImage16Range cogImage16Range = SSZNCognexParser.SSZNParser.LoadSSZN3DImage(ImgBuff32[Index - 1], (int)pcHead.width, (int)pcHead.height, pcHead.xInterval, pcHead.yInterval);
|
|
|
Image= cogImage16Range;
|
|
|
ImageCallbackEvent?.Invoke(Image, TotalTime, ErrorMessage);
|
|
|
}
|