HCNet developers out there: I'm trying to remotely config my camera but...

BoraTSN

n3wb
Joined
Nov 23, 2021
Messages
1
Reaction score
0
Location
istanbul
NET_DVR_DEVICEINFO_V30 struDeviceInfo;


char ip_address [] = "192.168.1.64";
WORD port = 8000;
char user_name [] = "admin";
char password [] = "12345abc";


printf("try to connect...\n");
/lUserID = NET_DVR_Login_V40(&struLoginInfo, &struDeviceInfoV40);
lUserID = NET_DVR_Login_V30(ip_address, port, user_name, password, &struDeviceInfo);
if (lUserID < 0)
{
printf("Login failed, error code: %d\n", NET_DVR_GetLastError());
NET_DVR_Cleanup();
return;
}
printf("connection established.");

Here is my code, im getting error no 29 and can not figure out why. Can connect to camera via ip but can not connect it with script.
 

Dominik21

Young grasshopper
Joined
May 25, 2023
Messages
46
Reaction score
8
Location
Germany
Maybe you didn't use the right libs. Try the dlls, libs, and header-files which are used in the sdk from hikvision.
 

NoFate

Getting the hang of it
Joined
Oct 24, 2020
Messages
479
Reaction score
63
Location
Belgium
Yeah, error 29 , means , incombatible OS, I figured it out :+) , working now..

Seems not all is are supported, the lib is not compiled for them, I was testing with Alpine
 

Dominik21

Young grasshopper
Joined
May 25, 2023
Messages
46
Reaction score
8
Location
Germany
Here is written that error 29 means Device operation failed. Whatever it means... In wireshark I saw that the Login-message was to short and that no password was transmitted.
I work with Windows with and without error. I only changed the libs.
This stuff is a little bit mysteries for me, so I'm lucky that it works :D.
 

NoFate

Getting the hang of it
Joined
Oct 24, 2020
Messages
479
Reaction score
63
Location
Belgium
Yeah, windows works, but I have created my project based on Linux, and not all distros are supported, works on debain for example, but not on alpine
 

Dominik21

Young grasshopper
Joined
May 25, 2023
Messages
46
Reaction score
8
Location
Germany
Yes I tried Linux to (Ubuntu) and it didn't work but here was the error code 41. Wireshark said that no data was transmitted for login.
 

Dominik21

Young grasshopper
Joined
May 25, 2023
Messages
46
Reaction score
8
Location
Germany

Dominik21

Young grasshopper
Joined
May 25, 2023
Messages
46
Reaction score
8
Location
Germany
No, but I will work with it privatly if I find time for this.
For this issue I want to read the temperature data from a thermal camera and log them.
 

NoFate

Getting the hang of it
Joined
Oct 24, 2020
Messages
479
Reaction score
63
Location
Belgium
Ah ok, my project was for Home Assistant users, for video intercom, to capture call events, alarm events, open door, ...
 

trempa92

Pulling my weight
Joined
Mar 26, 2020
Messages
700
Reaction score
215
Location
Croatia,Zagreb
We switched from SDK to ISAPI, its way easier and less messy.With isapi you cant get OS problems, as you use http requests which work on every OS there is.
 

NoFate

Getting the hang of it
Joined
Oct 24, 2020
Messages
479
Reaction score
63
Location
Belgium
Yeah, I know, but I don't like polling :)

And SDK can do more that Isapi, not all devices have port 80 open, especially for alarm systems or indoor devices
 

trempa92

Pulling my weight
Joined
Mar 26, 2020
Messages
700
Reaction score
215
Location
Croatia,Zagreb
Well if you look at 2022+ date devices, i dont see a single one without isapi(might be really few like DS-k2804). Plus with ISAPI u get to have ISUP which is way better than having arming on device(unstable af).

You open port on server not on each individual device.
 

NoFate

Getting the hang of it
Joined
Oct 24, 2020
Messages
479
Reaction score
63
Location
Belgium
Yeah, but we shared project as open source for home assistant or openhab or others, and we wanted to be compatible with all devices also older....


Also newer indoor devices for intercom , 2023 + do still have port 80 closed, only way is to use 8000 to capture events for tamper/gas/water leak...
 

NoFate

Getting the hang of it
Joined
Oct 24, 2020
Messages
479
Reaction score
63
Location
Belgium
Also our user community don't have server or nvr, just a single outdoor station for example
 

Dominik21

Young grasshopper
Joined
May 25, 2023
Messages
46
Reaction score
8
Location
Germany
Ok now I'm confused... I'm a beginner in this topic maybe you could help me...
When I said SDK I ment the SDK from HikVision (SDK) . I thought the communication runs over the ISAPI there. For the communication is Port 8000 used.
What do you mean with ISAPI and SDK and where is the different?
 

trempa92

Pulling my weight
Joined
Mar 26, 2020
Messages
700
Reaction score
215
Location
Croatia,Zagreb
Well, sdk have some part of isapi not all of it is isapi requests.

Doing everything with SDK is heavily relying on SDK version which does change aswell arming on device.
Arming have 1 fault and that is if network is not ideal. When connection is interrupted in small timeline, you wont be able to get arming up again due to devices still having "arming" status in their buffer. And in order to use logout, you would need to arm first, but you are not armed even tho device think it is.

Isapi is different, it does not require ideal network enviroment , work with post/get/put requests and you get xml/json data.

I think its way better than working with byte arrays.

SDK is limited to some OS's which makes harder to find cheap servers to be reliable with .net app/script. While using purely ISAPI over 80, i believe any language can do it and OS.

Tell me which stuff you cant do via ISAPI requests which u can do with SDK. There might be some, but hikvision is going in direction of requests rather than SDK.

Also to mention, new access control devices dont even support sdk arming anymore, and its all switchinbg toward ISUP/isapi requests.
 

NoFate

Getting the hang of it
Joined
Oct 24, 2020
Messages
479
Reaction score
63
Location
Belgium
Isapi is sending request over http 80, nothing needed...
SDK is used for sending request over port 8000, SDK LIB needed from Hikvision
 
Top