指定的数组不属于需要的类型。
函数原型:
LONG __stdcall IP_NET_DVR_GetIPCInfo(LONG index, IPC_ENTRY * pIPCInfo);
C#
[DllImport("NetSDKDLL.dll")]
public static extern UInt32 IP_NET_DVR_GetIPCInfo(UInt32 index, ref IPC_ENTRY pIPCInfo);
参数:
Index:要读取的第几个设备(从0开始编号),应该小于IP_NET_DVR_GetSearchIPCCount()返回值
pIPCInfo:信息保存指针
#define MAX_IP_NAME_LEN 256
#define MAC_ADDRESS_LEN 256
typedef struct
{
char MACAddress[MAC_ADDRESS_LEN];
int dhcpEnable;
char IPAddress[MAX_IP_NAME_LEN];
char netMask[MAX_IP_NAME_LEN];
char gateWay[MAX_IP_NAME_LEN];
char DNS1[MAX_IP_NAME_LEN];
char DNS2[MAX_IP_NAME_LEN];
}LANConfig;
typedef struct
{
int auth;
int videoPort;
int rtpoverrtsp;//added by johnnyling 20090323
int ptzPort;
int webPort;
}StreamAccessConfig;
#define GROUP_NAME_MAX_LEN 32
#define ACCOUNT_STATUS_MAX_LEN 8
#define ACCOUNT_NAME_MAX_LEN 40
#define ACCOUNT_PASSWORD_MAX_LEN 40
#define MAX_ACCOUNT_COUNT 20
typedef struct
{
char userName[ACCOUNT_NAME_MAX_LEN];
char password[ACCOUNT_PASSWORD_MAX_LEN];
char group[GROUP_NAME_MAX_LEN];
char status[ACCOUNT_STATUS_MAX_LEN];
}UserAccount;
typedef struct
{
int count;
UserAccount accounts[MAX_ACCOUNT_COUNT];
}UserConfig;
#define MAX_IPC_SERIALNUMBER 32
#define MAX_DEVICETYPE_LEN 32
typedef struct
{
char ipc_sn[MAX_IPC_SERIALNUMBER];
char deviceType[MAX_DEVICETYPE_LEN];
UserConfig userCfg;
StreamAccessConfig streamCfg;
LANConfig lanCfg;
}IPC_ENTRY;
c#
[StructLayout(LayoutKind.Sequential)]
public class LANConfig
{
static int MAC_ADDRESS_LEN = 256;
static int MAX_IP_NAME_LEN = 256;
public char[] MACAddress = new char[MAC_ADDRESS_LEN];
public int dhcpEnable;
public char[] IPAddress = new char[MAX_IP_NAME_LEN];
public char[] netMask = new char[MAX_IP_NAME_LEN];
public char[] gateWay = new char[MAX_IP_NAME_LEN];
public char[] DNS1 = new char[MAX_IP_NAME_LEN];
public char[] DNS2 = new char[MAX_IP_NAME_LEN];
}
[StructLayout(LayoutKind.Sequential)]
public class StreamAccessConfig
{
public int auth;
public int videoPort;
public int rtpoverrtsp;//added by johnnyling 20090323
public int ptzPort;
public int webPort;
}
[StructLayout(LayoutKind.Sequential)]
public class UserAccount
{
static int GROUP_NAME_MAX_LEN = 32;
static int ACCOUNT_STATUS_MAX_LEN = 8;
static int ACCOUNT_NAME_MAX_LEN = 40;
static int ACCOUNT_PASSWORD_MAX_LEN = 40;
static int MAX_ACCOUNT_COUNT = 20;
public char[] userName = new char[ACCOUNT_NAME_MAX_LEN];
public char[] password = new char[ACCOUNT_PASSWORD_MAX_LEN];
public char[] group = new char[GROUP_NAME_MAX_LEN];
public char[] status = new char[ACCOUNT_STATUS_MAX_LEN];
}
[StructLayout(LayoutKind.Sequential)]
public class UserConfig
{
static int MAX_ACCOUNT_COUNT = 20;
public int count;
public UserAccount[] accounts = new UserAccount[MAX_ACCOUNT_COUNT];
}
[StructLayout(LayoutKind.Sequential)]
public class IPC_ENTRY
{
static