-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathn_proxy.cpp
More file actions
28 lines (26 loc) · 777 Bytes
/
Copy pathn_proxy.cpp
File metadata and controls
28 lines (26 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "deconz/aps_controller.h"
#include "deconz/n_proxy.h"
#include "deconz/u_memory.h"
int N_GetProxy(N_Proxy *proxy)
{
proxy->type = N_ProxyTypeNone;
auto *apsCtrl = deCONZ::ApsController::instance();
if (apsCtrl)
{
proxy->port = apsCtrl->getParameter(deCONZ::ParamHttpProxyPort);
const QString host = apsCtrl->getParameter(deCONZ::ParamHttpProxy);
if (host.size() < (int)sizeof(proxy->host))
{
U_memcpy(proxy->host, qPrintable(host), host.size());
proxy->host[host.size()] = '\0';
if (proxy->port != 0)
{
proxy->type = N_ProxyTypeHttp;
return 1;
}
}
}
proxy->port = 0;
proxy->host[0] = '\0';
return 0;
}