Parameter Configuration You can modify device time, device network settings, etc.
Interface Overview Note For detailed parameters of the interface, see the interface definition section.
Process Description ---
title: Parameter Configuration
---
flowchart TD
A(Device SDK Initialization <br><strong>NET_SDK_Init</strong>)
B(User Registers Device <br><strong>NET_SDK_Login</strong> or <br><strong>NET_SDK_LoginEx</strong>)
C("Modify Device System Time <br><strong>NET_SDK_ChangeTime</strong>")
D("Modify Device Network Configuration <br><strong>NET_SDK_ModifyDeviceNetInfo</strong>")
E(Deregister Device <br><strong>NET_SDK_Logout</strong>)
F(Release SDK Resources <br><strong>NET_SDK_Cleanup</strong>)
B --> C --> E
A --> B --> D --> E --> F Sample Code Modify Device Time Modify Device Network Configuration
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 #include <string>
#include <iostream>
#include <string>
#include "stdafx.h"
#include "DVR_NET_SDK.h"
#include <iomanip>
#include <sstream>
#include <ctime>
#include <afx.h>
void DemoUniversal::ChangeTime ()
{
// device info
CString username = "admin" ;
CString password = "123456" ;
CString device_ip = "10.80.1.177" ;
DWORD device_port = 6036 ;
// init sdk
NET_SDK_Init();
// device login
NET_SDK_DEVICEINFO device_info;
memset(& device_info, 0 , sizeof (NET_SDK_DEVICEINFO));
int userid = NET_SDK_Login(device_ip.GetBuffer(), device_port, username.GetBuffer(), password.GetBuffer(), & device_info);
if (userid > 0 )
{
cout << "Login successful: " << userid << endl;
}
else
{
cout << "Login failed: " << userid << endl;
return ;
}
// set device time
time_t now = time(nullptr );
CTime current_time(now);
bool isOk = NET_SDK_ChangTime(userid, current_time.GetTime());
if (isOk)
{
cout << "Time setting successful: " << isOk << endl;
}
else
{
cout << "Time setting failed: " << isOk << endl;
}
// logout
NET_SDK_Logout(userid);
NET_SDK_Cleanup();
}
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 #include <string>
#include <iostream>
#include <string>
#include "stdafx.h"
#include "DVR_NET_SDK.h"
#include <iomanip>
#include <sstream>
#include <ctime>
#include <afx.h>
void ModifyDeviceNetInfo ()
{
// device info
CString username = "admin" ;
CString password = "123456" ;
CString device_ip = "10.80.1.177" ;
DWORD device_port = 6036 ;
// init sdk
NET_SDK_Init();
// device login
NET_SDK_DEVICEINFO device_info;
memset(& device_info, 0 , sizeof (NET_SDK_DEVICEINFO));
int userid = NET_SDK_Login(device_ip.GetBuffer(), device_port, username.GetBuffer(), password.GetBuffer(), & device_info);
if (userid > 0 )
{
cout << "Login successful: " << userid << endl;
}
else
{
cout << "Login failed: " << userid << endl;
return ;
}
// set device info
NET_SDK_DEVICE_IP_INFO pDeviceIPInfo;
memset(& pDeviceIPInfo, 0 , sizeof (NET_SDK_DEVICE_IP_INFO));
strcpy_s(pDeviceIPInfo.szMac, mBase-> convertMacAddr(device_info.deviceMAC)); // Current MAC address of the device
strcpy_s(pDeviceIPInfo.szIpAddr, "10.80.1.178" );
strcpy_s(pDeviceIPInfo.szMark, "255.255.255.0" );
strcpy_s(pDeviceIPInfo.szGateway, "10.80.1.1" );
strcpy_s(pDeviceIPInfo.szDdns1, "223.6.6.6" );
strcpy_s(pDeviceIPInfo.szDdns2, "8.8.8.8" );
strcpy_s(pDeviceIPInfo.szPassword, "123456" );
pDeviceIPInfo.ucIPMode = 0 ;
bool isOk = NET_SDK_ModifyDeviceNetInfo(& pDeviceIPInfo);
if (isOk)
{
cout << "Device information setting successful: " << isOk << endl;
}
else
{
cout << "Device information setting failed: " << isOk << endl;
}
// logout
NET_SDK_Logout(userid);
NET_SDK_Cleanup();
}