带摄像头IP设备的阵列

问题描述:

Hi , I have a function inside a windows service in visual studio 2017 that captures alarms from a security camera, when I want to get an IP from the camera it returns a number "48" which is the sum of the numbers of IP 192.168.xx.xx, but I need not that number but the IP in a char [16] , some data that I need to change the code ?, I only get a number 48 in the position m_storeDev [0],functions get data from the cameras with communication SDK  C++ 







cDeviceIP[0] = 48 (it is the sum of the numbers of IP 192.168.xx.xx)
cDeviceIP[1] = 0
cDeviceIP[2] = 0
cDeviceIP[3] = 0
cDeviceIP[4] = 0
cDeviceIP[5] = 0
cDeviceIP[6] = 0
cDeviceIP[7] = 0
cDeviceIP[8] = 0
cDeviceIP[9] = 0
cDeviceIP[10] = 0
cDeviceIP[11] = 0
cDeviceIP[12] = 0
cDeviceIP[13] = 0
cDeviceIP[14] = 0
cDeviceIP[15] = 0

I need to have the IP numbers in each position of the array m_storeDev[16]





我尝试过:



Declation struct(NVSSDK.dll)



What I have tried:

Declation struct (NVSSDK.dll)

[StructLayout(LayoutKind.Sequential)]
    public struct PNVS_NFS_DEV
    {
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
        public Char[] cDeviceIP;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 250)]
        public Char[] cStorePath;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
        public Char[] cUsername;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
        public Char[] cPassword;
        public int iState;
    };





来自Windows服务的电话



Call from Windows Service

PNVS_NFS_DEV m_storeDev;
int iRetx1 = NVSSDK.NetClient_NetFileGetMapStoreDevice(_ulLogonID, ref m_storeDev);

很多ip-camera和设备这些天支持 ONVIF 协议,您可以尝试使用ONVIF例程或应用程序,请参阅:

GitHub - ozekiltd / Onvif-IP-Camera-Viewer [ ^ ]

C#Camera SDK:如何在C#中实现Onvif IP Camera Manager [ ^ ]

如果这不起作用你可以尝试像 WireShark (复杂)或 Fiddler 这样的嗅探器。

如果你对连接感兴趣串,以下是开源iSpy视频应用程序的详细列表:将iSpy连接到IP摄像机 [ ^ ]

还告诉我们什么牌子的ip-camera你我们可能会提供更多帮助。
A lot of ip-camera's and equipment these days support the ONVIF protocol, you could try using an ONVIF routine or application, see:
GitHub - ozekiltd/Onvif-IP-Camera-Viewer[^]
C# Camera SDK: How to implement an Onvif IP Camera Manager in C#[^]
If that does not work you could try a sniffer like WireShark (complicated) or Fiddler.
If you are interested in connection strings, here is an extensive list from the open-source iSpy video application: Connecting iSpy to IP Cameras[^]
Also let us know what brand of ip-camera you have, maybe we can offer more help.