feat: Add MPPS Settting interface call function to Reconclient
This commit is contained in:
@@ -26,4 +26,13 @@ struct PACSSetting
|
||||
int Port = 0;
|
||||
};
|
||||
|
||||
struct MPPSSetting
|
||||
{
|
||||
int On = 0;
|
||||
std::string ServerAETitle;
|
||||
std::string IP;
|
||||
int Port = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // __SCAN_H__
|
||||
@@ -13,6 +13,8 @@ namespace
|
||||
const char *QUERY_RECON_URL = "/Task/Query/";
|
||||
const char *QUERY_TRANSFER_URL = "/Transfer/Query/";
|
||||
const char *SET_PACS_URL = "/Transfer/Setting/";
|
||||
const char *SET_MPPS_URL = "/Transfer/MSetting/";
|
||||
|
||||
}
|
||||
|
||||
ReconClient::ReconClient(std::string aCerPath, std::string aKeyPath)
|
||||
@@ -170,3 +172,36 @@ RequestResult ReconClient::SetPACSSetting(const PACSSetting &aSetting)
|
||||
return RequestResult::Fail(mErrorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
RequestResult ReconClient::SetMPPSSetting(const MPPSSetting &aSetting)
|
||||
{
|
||||
cJSON *obj = cJSON_CreateObject();
|
||||
if (!aSetting.ServerAETitle.empty())
|
||||
{
|
||||
cJSON_AddStringToObject(obj, "ServerAETitle", aSetting.ServerAETitle.c_str());
|
||||
}
|
||||
if (!aSetting.IP.empty())
|
||||
{
|
||||
cJSON_AddStringToObject(obj, "IP", aSetting.IP.c_str());
|
||||
}
|
||||
cJSON_AddNumberToObject(obj, "On", aSetting.On);
|
||||
if (aSetting.Port > 0)
|
||||
{
|
||||
cJSON_AddNumberToObject(obj, "Port", aSetting.Port);
|
||||
}
|
||||
char *str = cJSON_Print(obj);
|
||||
cJSON_Delete(obj);
|
||||
std::string content;
|
||||
content.append(str);
|
||||
free(str);
|
||||
auto resp = mRequest.post(mHost + SET_MPPS_URL, content, mHeaders);
|
||||
if (resp.httpCode() == 200)
|
||||
{
|
||||
return RequestResult::Success();
|
||||
}
|
||||
else
|
||||
{
|
||||
mErrorMessage = resp.getContent();
|
||||
return RequestResult::Fail(mErrorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ public:
|
||||
RequestResult QueryScan(const std::string &aScanID, int &state);
|
||||
RequestResult QueryVersion();
|
||||
RequestResult SetPACSSetting(const PACSSetting &aSetting);
|
||||
RequestResult SetMPPSSetting(const MPPSSetting &aSetting);
|
||||
|
||||
|
||||
private:
|
||||
std::string mVersionContent;
|
||||
|
||||
Reference in New Issue
Block a user