|
|
|
@ -116,7 +116,7 @@ int DoGetRequest(const char* url, int authType, const char* userName, const char
|
|
|
|
|
return ((0 == nRet) && (responseCode == 200)) ? 0 : 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int DoPutRequest(const char* url, int authType, const char* userName, const char* password, net_handle_t netHandle, const char* contents, std::vector<uint8_t>& data)
|
|
|
|
|
int DoPutRequest(const char* url, int authType, const char* userName, const char* password, net_handle_t netHandle, const char* contents, char* data)
|
|
|
|
|
{
|
|
|
|
|
std::string auth;
|
|
|
|
|
|
|
|
|
@ -225,6 +225,46 @@ bool requestCapture(uint8_t channel, uint8_t preset, const NET_PHOTO_INFO& photo
|
|
|
|
|
return (0 == nRet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UniviewResolutionSet(const NET_PHOTO_INFO& photoInfo, int channel, unsigned int cmd)
|
|
|
|
|
{
|
|
|
|
|
std::string path = "/LAPI/V1.0/Channels/" + std::to_string(channel) + "/Media/Capture";
|
|
|
|
|
Json::Value outdata; // 创建 Json::Value 对象来存储 JSON 数据
|
|
|
|
|
|
|
|
|
|
uniview_resolution_jsoncpp_file_info(outdata, cmd);
|
|
|
|
|
|
|
|
|
|
Json::StreamWriterBuilder writer;
|
|
|
|
|
std::string sendbuf = Json::writeString(writer, outdata);
|
|
|
|
|
|
|
|
|
|
char respContent[1024];
|
|
|
|
|
DoPutRequest(path.c_str(), photoInfo.authType, photoInfo.userName, photoInfo.password, photoInfo.netHandle, sendbuf.c_str(), respContent);
|
|
|
|
|
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_INFO, "sendlen= %zu, respContent=%s", sendbuf.size(), respContent);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int uniview_resolution_jsoncpp_file_info(Json::Value &outdata, unsigned int cmd)
|
|
|
|
|
{
|
|
|
|
|
PIC_RESOLUTION pic_resol[] = { {352,288},{640,360},{720,576},{1280,720},{1920,1080},{2688,1520},{3072,2048},{3840,2160},{2560,1440},{704,288} };
|
|
|
|
|
|
|
|
|
|
outdata["Enable"] = 1;
|
|
|
|
|
|
|
|
|
|
Json::Value Resolution;
|
|
|
|
|
outdata["Resolution"] = Resolution;
|
|
|
|
|
|
|
|
|
|
if ((cmd < 1) || (cmd > 10))
|
|
|
|
|
{
|
|
|
|
|
cmd = 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Resolution["Width"] = pic_resol[cmd-1].width;
|
|
|
|
|
Resolution["Height"] = pic_resol[cmd-1].height;
|
|
|
|
|
outdata["Picturesize"] = 900;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace nc_hk
|
|
|
|
|
{
|
|
|
|
|
bool requestCapture(uint8_t channel, uint8_t preset, const NET_PHOTO_INFO& photoInfo, std::vector<uint8_t>& img)
|
|
|
|
|