You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

91 lines
1.7 KiB

#include "onvifDeviceNode.h"
#define LOG(X) m_pLog->Log("onvifDeviceNode", this, X)
#define LOG_ERROR(X) m_pLog->Log("onvifDeviceNode", this, _LOG_ERROR, X)
onvifDeviceNode::onvifDeviceNode(CSTR URL)
{
m_pLog = basicLogCollection::getInstance();
strncpy(m_pDeviceManagementURL, URL, 256);
if (strlen(m_pDeviceManagementURL))
{
CSTR tVal = (CSTR) malloc(strlen(m_pDeviceManagementURL));
strcpy(tVal, m_pDeviceManagementURL);
m_pTransport = new clientPort(tVal);
if (m_pTransport != NULL)
{
m_pProtocol = new protocolONVIF(m_pTransport);
if (m_pProtocol != NULL)
{
enquireDevice();
}
else
{
delete(m_pTransport);
};
};
}
else
{
LOG_ERROR("Provided URL is Invalid!");
m_pTransport = NULL;
m_pProtocol = NULL;
};
}
onvifDeviceNode::~onvifDeviceNode()
{
if (m_pProtocol != NULL)
{
delete(m_pProtocol);
}
if (m_pTransport != NULL)
{
delete(m_pTransport);
}
}
bool onvifDeviceNode::enquireDevice(void)
{
if (m_pProtocol->GetProfiles(m_pDeviceManagementURL))
{
LOG("Profiles Loaded.");
// LOG(m_pProtocol->GetStreamURI(m_pDeviceManagementURL, 0));
return true;
}
else
{
LOG_ERROR("Error get OnVif Profiles.");
};
return false;
}
CSTR onvifDeviceNode::getStreamURI(int P)
{
if (m_pProtocol != NULL)
{
return m_pProtocol->GetStreamURI(m_pDeviceManagementURL, P);
};
return NULL;
}
int onvifDeviceNode::getProfilesCount(void)
{
if (m_pProtocol != NULL)
{
return m_pProtocol->GetAccessProfiles()->size();
};
return 0;
}
vectorProfileOnvif * onvifDeviceNode::getProfilesVector(void)
{
if (m_pProtocol != NULL)
{
return m_pProtocol->GetAccessProfiles();
};
return NULL;
}
#undef LOG
#undef LOG_ERROR