|
|
@ -56,11 +56,22 @@ bool HangYuCtrl::SetOsd(uint8_t channel, std::string osdstring, uint8_t pos)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// /LAPI/V1.0/Channels/<ID>/Media/OSDs/Contents
|
|
|
|
// /LAPI/V1.0/Channels/<ID>/Media/OSDs/Contents
|
|
|
|
//左上OSD
|
|
|
|
//左上OSD
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool hasDateTime = (osdstring.find("$$DATETIME$$") != std::string::npos);
|
|
|
|
|
|
|
|
size_t posi = osdstring.find("$$DATETIME$$");
|
|
|
|
|
|
|
|
if (posi != std::string::npos) {
|
|
|
|
|
|
|
|
size_t endPos = posi + 12;
|
|
|
|
|
|
|
|
while (endPos < osdstring.size() && osdstring[endPos] == ' ') {
|
|
|
|
|
|
|
|
endPos++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
osdstring.erase(posi, endPos - posi);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char url[128] = { 0 };
|
|
|
|
char url[128] = { 0 };
|
|
|
|
snprintf(url, sizeof(url), "http://%s/Pictures/%u/MultiOSDV2", m_ip.c_str(), (uint32_t)channel);
|
|
|
|
snprintf(url, sizeof(url), "http://%s/Pictures/%u/MultiOSDV2", m_ip.c_str(), (uint32_t)channel);
|
|
|
|
std::vector<uint8_t> resData;
|
|
|
|
std::vector<uint8_t> resData;
|
|
|
|
std::replace(osdstring.begin(), osdstring.end(), '\n', '^');
|
|
|
|
std::replace(osdstring.begin(), osdstring.end(), '\n', '^');
|
|
|
|
string xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><MultiLineOSD><DisplayTime><Enable>true</Enable><PosX>8</PosX><PosY>0</PosY></DisplayTime><OSD><ID>1</ID><Enable>true</Enable><Text>"+ osdstring+ "</Text><x>8</x><y>24</y></MultiLineOSD>";
|
|
|
|
string xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><MultiLineOSD><DisplayTime><Enable>" + string(hasDateTime ? "true" : "false") + "</Enable><PosX>8</PosX><PosY>0</PosY></DisplayTime><OSD><ID>1</ID><Enable>true</Enable><Text>"+ osdstring+ "</Text><x>8</x><y>" + string(hasDateTime ? "24" : "0") + "</y></MultiLineOSD>";
|
|
|
|
int res = DoPutRequest(url, HTTP_AUTH_TYPE_BASIC, m_userName.c_str(), m_password.c_str(), m_netHandle, xmlString.c_str(), resData);
|
|
|
|
int res = DoPutRequest(url, HTTP_AUTH_TYPE_BASIC, m_userName.c_str(), m_password.c_str(), m_netHandle, xmlString.c_str(), resData);
|
|
|
|
return res;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|