Control Monitoring¶
Once the settings are complete, becomes possible to get the live-view image(JPEG) using GetLiveViewImage().
A dedicated library is required to use this function. The storage location of the library differs depending on the OS. Please refer to the following link to set up your environment.
Example:
SCRSDK::CrMonitoringDeliverySetting* setting = new SCRSDK::CrMonitoringDeliverySetting[1];
setting->type = SCRSDK::CrMonitoringDeliveryType_Jpeg;
std::string hostIp = "192.168.0.123";
int ipLen = hostIp.length() + 1 + sizeof(CrInt16u); // +1 = Null-terminate
// sizeof(CrInt16u) = String length
setting->ipAddress = new CrInt8u[ipLen];
memset(setting->ipAddress, 0, ipLen);
CrInt16u* strLen = (CrInt16u*)setting->ipAddress; // pointer cast
*strLen = (CrInt16)hostIp.length() + 1; // String length, include Null-terminate
for (int i = 0; i < ipLen; i++) {
setting->ipAddress[sizeof(CrInt16u) + i] = (CrInt8u)hostIp[i];
}
setting->downTime = 5000; // 5 sec
setting->videoPort = 0; // If zero, the default value (55001) is used.
// Set
CrError err = SCRSDK::SetMonitoringDeliverySetting(handle, setting, 1);
if (CR_FAILED(err)) {
printf("Return SetMonitoringDeliverySetting err(%x)", err);
}
delete[] setting;
After setting up the delivery conditions, request the start of delivery.
Although it is possible to deliver live-view from one camera device to multiple host devices, if live-view delivery to the other application using different format has already started, the live-view image will not be delivered to this Camera Remote SDK.
Example:
// Start
CrError err = SCRSDK::ControlMonitoring(handle, SCRSDK::CrMonitoringOperation_Start);
if (CR_FAILED(err)) {
printf("Start request err(%x)", err);
}
If the delivery fails to start or stop, the failure result is notified in the OnWarning() callback. If successful, no notification is made.
If the OnWarning() callback notifies you of a delivery start failure, or if you cannot get a live-view with GetLiveViewImage() after a successful delivery start, please try setting the condition again. In some cases, it may be necessary to reboot the camera.
To request a delivery stop, replace CrMonitoringOperation_Start with CrMonitoringOperation_Stop in the example implementation.
Please set LiveViewEnable status to disable if it set enable. See SetDeviceSetting() for details.