Environment

C++ in MFC using namespace Vieworks::vivix,
Instance : CVivixSDK vivixSDK; CDetector* detectorIns;
C# in Winform using Vieworks.vivix.net, using Vieworks.vivix.net.detector; using Vieworks.vivix.net.scu;
Instance: VivixNet netSDK; DETECTOR_INFO DetInfo;Detector detectorIns;

Discription

Sometimes, software might be crushed suddenly. Unfortunately, the crush occurred acquiring image .  For preventing losing image in this situation. you can set keeping image option in local area.

C++
void CSDKCplusExampleApp::KeepImage(int keepcount, FILE_PATH path)
{
bool enough = true;
vivixSDK.KeepRecentImageSet(true, keepcount, path, &enough);
if (enough == false)
{
return;
}

//you can skip the setting delegate code if you register already
{
detectorIns->SetNotifyFrameGrabberImageInStart((NotifyFrameGrabberImageInStart)NotifyImageInStart);
detectorIns->SetNotifyFrameGrabberImageIn((NotifyFrameGrabberImageIn)NotifyImageIn);
detectorIns->SetNotifyFrameGrabberImageInEnd((NotifyFrameGrabberImageInEnd)NotifyImageInEnd);

}

}

void CSDKCplusExampleApp::GetKeepingImage(int id)
{
detectorIns->RecentImageGet(id);
}

void CSDKCplusExampleApp::NotifyImageInStart(DETECTOR_ID id, IMAGE_MODE imgMode)
{
// A function call when the image starts to be sent.
}

void CSDKCplusExampleApp::NotifyImageIn(DETECTOR_ID id, IMAGE_MODE imgMode, IMAGE_INFO* image)
{
// A function call when sending the acquired image. keeping image will be sent this delegate by IMAGE_MODE.IMAGE_MODE_BACKUP
if (imgMode == IMAGE_MODE_NORMAL)
{
KeepImageID(image->imageID);
}
}

void CSDKCplusExampleApp::NotifyImageInEnd(DETECTOR_ID id, IMAGE_MODE imgMode)
{
// A function call when the completing to send the image.
}

void CSDKCplusExampleApp::KeepImageID(unsigned int id)
{
//Save Image ID and matching patint info
}

 

C#
public void KeepImage(int keepcount, string path)
{
bool enough = true;
sdk.KeepRecentImageSet(true, keepcount, path, ref enough);
if(enough == false)
{
return;
}

//you can skip the setting delegate code if you register already
{

detectorIns.SetDelegateFrameGrabberImageInStart(OnDelegateFrameGrabberImageInStart);
detectorIns.SetDelegateFrameGrabberImageIn(OnDelegateFrameGrabberImageIn);
detectorIns.SetDelegateFrameGrabberImageInEnd(OnDelegateFrameGrabberImageInEnd);

}

}

public void GetKeptImage(int id)
{
detectorIns.RecentImageGet(id);
}

void OnDelegateFrameGrabberImageInStart(int id, IMAGE_MODE imgMode)
{
// A function call when the image starts to be sent.
}

void OnDelegateFrameGrabberImageIn(int id, IMAGE_MODE imgMode, IMAGE_INFO image)
{
// A function call when sending the acquired image. keeping image will be sent this delegate by IMAGE_MODE.IMAGE_MODE_BACKUP
if (imgMode == IMAGE_MODE.IMAGE_MODE_NORMAL)
{
KeepImageID(image.imageID);
}

}

void OnDelegateFrameGrabberImageInEnd(int id, IMAGE_MODE imgMode)
{
// A function call when the completing to send the image.
}

public void KeepImageID(uint ID)
{
//Save Image ID and matching patint info
}