#include "XNetSDKTest.h" XSDK_HANDLE hDeviceArr[6]; char DeviceIdArr[6][128]; void OnDASServerStart(XSDK_HANDLE hServer, int nResult) { printf("OnDASServerStart-->%d:%d\r\n", hServer, nResult); } void OnDASDeviceReg(XSDK_HANDLE hDevice, SXSDKDASDeviceInfo *pDASInfo, int dPos) { printf("hDevice::%d, dPos::%d, DeiveID::%s\r\n",hDevice,dPos,pDASInfo->sDevId); hDeviceArr[dPos] = hDevice; strncpy(DeviceIdArr[dPos], pDASInfo->sDevId, 127); // hDevice---等同于XSDK_DevLoginSyn/XSDK_DevLogin的返回值 //printf("OnDASDeviceReg-->\r\nIP:%s\r\nPort:%d\r\nDeiveID:%s\r\nUserName:%s\r\nPassword:%s\r\nChannelNum:%d\r\nEncryptyType:%s\r\n", // pDASInfo->sDevIP, pDASInfo->nDevPort, pDASInfo->sDevId, pDASInfo->sUserName, pDASInfo->sPassword, pDASInfo->nChannelNum, pDASInfo->sEncryptType); } XSDK_HANDLE g_hDasServer = 0; int TestDASServer() { printf("%s\r\n", __FUNCTION__); g_hDasServer = XSDK_StartDASServer("0.0.0.0", 8989); // 设备操作句柄获取三种方式 // 1:XSDK_DevLoginSyn/XSDK_DevLogin // 2:通过回调函数Main_MessageCallBack(命令IDESXSDK_ON_DAS_DEVICE_REGIST)回调hDevice // 3:XSDK_GetDASDevHandle(已经注册的设备) // 等待回调的操作句柄 char c = 0; while((c = getchar()) != 'q') { if (g_hDevice != 0) { break; } } return 0; }