-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
37 lines (36 loc) · 750 Bytes
/
Copy pathtest.cpp
File metadata and controls
37 lines (36 loc) · 750 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
29
30
31
32
33
34
35
36
37
#include "onvif_http.h"
#include <stdio.h>
int main()
{
string ip = "192.168.31.101";
int port = 80;
string username = "admin";
string password = "admin";
onvif_http onvif(ip, port);
onvif.onvif_http_init(username, password);
string token = onvif.get_profiletoken();
if (token == "")
{
printf("can not get profiletoken\n");
return -1;
}
int j = 0;
time_t startTime = time(0);
while (1)
{
string url = onvif.get_snapshot_uri(token);
if (url == "")
{
printf("can not get snapShotUri\n");
return -1;
}
string img = onvif.get_snapshot_img(url);
j++;
sleep(1);
if (j > 10)
break;
}
time_t endTime = time(0);
printf("span Time %d\n", (endTime - startTime));
return 0;
}