Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

37 lignes
1.1 KiB

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