You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.4 KiB

  1. #include "XNetSDKTest.h"
  2. XSDK_HANDLE hDeviceArr[6];
  3. char DeviceIdArr[6][128];
  4. void OnDASServerStart(XSDK_HANDLE hServer, int nResult)
  5. {
  6. printf("OnDASServerStart-->%d:%d\r\n", hServer, nResult);
  7. }
  8. void OnDASDeviceReg(XSDK_HANDLE hDevice, SXSDKDASDeviceInfo *pDASInfo, int dPos)
  9. {
  10. printf("hDevice::%x, dPos::%d, DeiveID::%s\r\n",hDevice,dPos,pDASInfo->sDevId);
  11. hDeviceArr[dPos] = hDevice;
  12. strncpy(DeviceIdArr[dPos], pDASInfo->sDevId, 127);
  13. printf("cachedMedia %x\r\n", hDeviceArr[dPos]);
  14. // hDevice---等同于XSDK_DevLoginSyn/XSDK_DevLogin的返回值
  15. //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",
  16. // pDASInfo->sDevIP, pDASInfo->nDevPort, pDASInfo->sDevId, pDASInfo->sUserName, pDASInfo->sPassword, pDASInfo->nChannelNum, pDASInfo->sEncryptType);
  17. }
  18. XSDK_HANDLE g_hDasServer = 0;
  19. int TestDASServer()
  20. {
  21. printf("%s\r\n", __FUNCTION__);
  22. g_hDasServer = XSDK_StartDASServer("0.0.0.0", 8989);
  23. // 设备操作句柄获取三种方式
  24. // 1:XSDK_DevLoginSyn/XSDK_DevLogin
  25. // 2:通过回调函数Main_MessageCallBack(命令IDESXSDK_ON_DAS_DEVICE_REGIST)回调hDevice
  26. // 3:XSDK_GetDASDevHandle(已经注册的设备)
  27. // 等待回调的操作句柄
  28. char c = 0;
  29. while((c = getchar()) != 'q')
  30. {
  31. if (g_hDevice != 0)
  32. {
  33. break;
  34. }
  35. }
  36. return 0;
  37. }