EasyNVR支持预置位控制,包括转到指定预置位,设置指定预置位,删除指定预置位。预置位在安防领域有较为普遍的应用,可以进行很多既定位置的跳转,很方便。之前我们说过如何用Onvif协议进行设备的发现,探测,以及云台控制等,今天我们来说一下如何使用Onvif进行预置位的操作。
流程
1、获取设备能力Capabilities
获取设备的能力,并且可以获取到Media和PTZ的URI,使用这两个URL可以进行流和预置位操作,这里如果PTZ URI获取不到意味着这个设备无法支持预置位控制
_tds__GetCapabilities* capabilities = soap_new__tds__GetCapabilities(proxyDevice, -1);
tt__CapabilityCategory* category = new tt__CapabilityCategory;
capabilities->Category = category;
*(capabilities->Category) = tt__CapabilityCategory__All;
_tds__GetCapabilitiesResponse* response = soap_new__tds__GetCapabilitiesResponse (proxyDevice, -1);
if (SOAP_OK == proxyDevice->GetCapabilities(capabilities, response))
{
if (response->Capabilities)
{
//Media URI: response->Capabilities->Media->XAddr;
//PTZ URI: response->Capabilities->PTZ->XAddr;
}
}
2、获取Media Profile
_trt__GetProfiles* getProfiles = soap_new__trt__GetProfiles(proxyMedia, -1);
_trt__GetProfilesResponse* response = soap_new__trt__GetProfilesResponse(proxyMedia, -1);
if (SOAP_OK == proxyMedia->GetProfiles(getProfiles, response))
{
int size = response->__sizeProfiles;
for (int i = 0; i < size; ++i)
{
if (response->Profiles[i])
{
//Media Profile Token: response->Profiles[i]->token;
//一般设备包含多个Profile Token,包含主码流、子码流、第三码流
}
}
}
- 预置位控制
bool result = false;
PTZBindingProxy* ptzProxy = new PTZBindingProxy;
ptzProxy->soap_endpoint = ptzUrl.c_str();
if (!security(ptzProxy, username, password))
{
delete ptzProxy;
return result;
}
char presetToken[8];
itoa(index, presetToken, 10);
if (command == PRESET_GOTO)
{
_tptz__GotoPreset* preset = soap_new__tptz__GotoPreset(ptzProxy, -1);
_tptz__GotoPresetResponse* response = soap_new__tptz__GotoPresetResponse(ptzProxy, -1);
preset->ProfileToken = const_cast<char*>(profile.c_str());
preset->PresetToken = presetToken;
if (SOAP_OK == ptzProxy->GotoPreset(preset, response))
result = true;
if (response)
soap_delete__tptz__GotoPresetResponse(ptzProxy, response);
if (preset)
soap_delete__tptz__GotoPreset(ptzProxy, preset);
}
else if (command == PRESET_SET)
{
_tptz__SetPreset* preset = soap_new__tptz__SetPreset(ptzProxy, -1);
_tptz__SetPresetResponse* response = soap_new__tptz__SetPresetResponse(ptzProxy, -1);
preset->ProfileToken = const_cast<char*>(profile.c_str());
preset->PresetToken = presetToken;
if (SOAP_OK == ptzProxy->SetPreset(preset, response))
result = true;
if (response)
soap_delete__tptz__SetPresetResponse(ptzProxy, response);
if (preset)
soap_delete__tptz__SetPreset(ptzProxy, preset);
}
else if (command == PRESET_REMOVE)
{
_tptz__RemovePreset* preset = soap_new__tptz__RemovePreset(ptzProxy, -1);
_tptz__RemovePresetResponse* response = soap_new__tptz__RemovePresetResponse(ptzProxy, -1);
preset->ProfileToken = const_cast<char*>(profile.c_str());
preset->PresetToken = presetToken;
if (SOAP_OK == ptzProxy->RemovePreset(preset, response))
result = true;
if (response)
soap_delete__tptz__RemovePresetResponse(ptzProxy, response);
if (preset)
soap_delete__tptz__RemovePreset(ptzProxy, preset);
}
delete ptzProxy;
return result;
EasyNVR应用场景
EasyNVR可以说已经成为国内视频互联网化基础建设的排头兵,几乎各个民生行业都已经有了EasyNVR视频能力输出的身影,EasyNVR多年服务于各行各业视频基础建设,EasyNVR的可靠性、完整性、稳定性已经受到了业界的广泛认可!
风景直播
雪亮工程
平安校园
平安工地
明厨亮灶
EasyNVR安防摄像机网页流媒体服务
EasyNVR是一款拥有完整、自主、可控知识产权,同时又能够具备软硬一体功能的安防互联网化流媒体服务器,能够通过简单的网络摄像机通道配置,将传统监控行业里面的高清网络摄像机IP Camera、NVR等具有RTSP、Onvif协议输出的设备接入到EasyNVR,EasyNVR能够将这些视频源的音视频数据进行拉取,转换为RTMP/HLS,进行全平台终端H5直播(Web、Android、iOS),并且EasyNVR能够将视频源的直播数据对接到第三方CDN网络,实现互联网级别的直播分发。详情可访问EasyNVR官网:http://www.easynvr.com