// // Created by Matthew on 2025/3/4. // #include "HangYuCtrl.h" #include "netcamera.h" #include "httpclient.h" #include HangYuCtrl::~HangYuCtrl() { } bool HangYuCtrl::SetOsd() { // /LAPI/V1.0/Channels//Media/OSDs/Contents } void HangYuCtrl::EnableOsd(bool enable) { // return false; } std::string HangYuCtrl::GetStreamingUrl(uint8_t channel) { // /LAPI/V1.0/Channels//Media/Video/Streams//LiveStreamURL?TransType=&TransProtocol= char url[128] = { 0 }; snprintf(url, sizeof(url), "http://%s/Streams/%u/1/Transport", m_ip.c_str(), (uint32_t)channel); std::vector resData; int res = 0; for (int idx = 0; idx < 10; idx++) { res = DoGetRequest(url, HTTP_AUTH_TYPE_BASIC, m_userName.c_str(), m_password.c_str(), m_netHandle, resData); if (res == 0 && !resData.empty()) { break; } } if (res != 0 || resData.empty()) { return ""; } resData.push_back(0); const char* start = strstr((const char*)&resData[0], ""); if (start == NULL) { return ""; } start += 9; const char* end = strstr(start, ""); if (end == NULL) { return ""; } return std::string(start, end); } bool HangYuCtrl::UpdateTime(time_t ts) { // /LAPI/V1.0/System/Time // // std::string reqData = ""; std::string url = "http://" + m_ip + "/System/Time"; std::vector resData; int res = DoPutRequest(url.c_str(), HTTP_AUTH_TYPE_BASIC, m_userName.c_str(), m_password.c_str(), m_netHandle, reqData.c_str(), resData); if (res != 0) { return false; } return true; } bool HangYuCtrl::TakePhoto(std::vector& img) { return false; } bool HangYuCtrl::TakeVideo(uint32_t duration, std::string path) { }