| @@ -1,12 +1,18 @@ | |||||
| #include "XNetSDKTest.h" | #include "XNetSDKTest.h" | ||||
| XSDK_HANDLE hDeviceArr[6]; | |||||
| char DeviceIdArr[6][128]; | |||||
| void OnDASServerStart(XSDK_HANDLE hServer, int nResult) | void OnDASServerStart(XSDK_HANDLE hServer, int nResult) | ||||
| { | { | ||||
| printf("OnDASServerStart-->%d:%d\r\n", hServer, nResult); | printf("OnDASServerStart-->%d:%d\r\n", hServer, nResult); | ||||
| } | } | ||||
| void OnDASDeviceReg(XSDK_HANDLE hDevice, SXSDKDASDeviceInfo *pDASInfo) | |||||
| void OnDASDeviceReg(XSDK_HANDLE hDevice, SXSDKDASDeviceInfo *pDASInfo, int dPos) | |||||
| { | { | ||||
| hDeviceArr[dPos] = hDevice; | |||||
| strncpy(DeviceIdArr[dPos], pDASInfo->sDevId, 127); | |||||
| dPos++; | |||||
| // hDevice---等同于XSDK_DevLoginSyn/XSDK_DevLogin的返回值 | // 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", | 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); | pDASInfo->sDevIP, pDASInfo->nDevPort, pDASInfo->sDevId, pDASInfo->sUserName, pDASInfo->sPassword, pDASInfo->nChannelNum, pDASInfo->sEncryptType); | ||||
| @@ -32,7 +32,7 @@ int CALLBACK Test_MediaCallBack(XSDK_HANDLE hMedia, const unsigned char *pData, | |||||
| string fmt("/media-file/origin/%s/%04d-%02d-%02d-%02d.dat"); | string fmt("/media-file/origin/%s/%04d-%02d-%02d-%02d.dat"); | ||||
| char file_name[1024]; | char file_name[1024]; | ||||
| snprintf(file_name,sizeof(file_name),fmt.c_str(),DeviceIdArr[pos],pFrame->nYear,pFrame->nMonth,pFrame->nDay,pFrame->nHour) ; | snprintf(file_name,sizeof(file_name),fmt.c_str(),DeviceIdArr[pos],pFrame->nYear,pFrame->nMonth,pFrame->nDay,pFrame->nHour) ; | ||||
| printf("path: %s", file_name); | |||||
| printf("path: %s \r\n", file_name); | |||||
| // ABFile("video_header.dat", pFrame->pHeader, pFrame->nLength); | // ABFile("video_header.dat", pFrame->pHeader, pFrame->nLength); | ||||
| ABFile(file_name, pFrame->pContent, pFrame->nFrameLength); | ABFile(file_name, pFrame->pContent, pFrame->nFrameLength); | ||||
| } | } | ||||
| @@ -2,8 +2,6 @@ | |||||
| #include "XNetSDKSyn.h" | #include "XNetSDKSyn.h" | ||||
| XSDK_HANDLE g_hDevice ; | XSDK_HANDLE g_hDevice ; | ||||
| XSDK_HANDLE hDeviceArr[6]; | |||||
| char DeviceIdArr[6][128]; | |||||
| SXMediaRecordByFileReq info = {0}; | SXMediaRecordByFileReq info = {0}; | ||||
| bool bFindFile = false; | bool bFindFile = false; | ||||
| @@ -72,12 +70,7 @@ int CALLBACK Main_MessageCallBack(XSDK_HANDLE hDevice, int nMsgId, int nParam1, | |||||
| g_hDevice = hDevice; | g_hDevice = hDevice; | ||||
| #endif | #endif | ||||
| { | |||||
| OnDASDeviceReg(hDevice, (SXSDKDASDeviceInfo *)pObject); | |||||
| hDeviceArr[dPos] = hDevice ; | |||||
| strncpy_s(DeviceIdArr[dPos], ((SXSDKDASDeviceInfo*)pObject)->sDevId,127); | |||||
| dPos++ ; | |||||
| } | |||||
| OnDASDeviceReg(hDevice, (SXSDKDASDeviceInfo *)pObject,dPos); | |||||
| } | } | ||||
| break; | break; | ||||
| case ESXSDK_DEV_SNAP: | case ESXSDK_DEV_SNAP: | ||||
| @@ -70,7 +70,7 @@ int TestOPMachine(); | |||||
| //接收设备返回的配置数据 | //接收设备返回的配置数据 | ||||
| extern XSDK_HANDLE g_hDasServer; | extern XSDK_HANDLE g_hDasServer; | ||||
| void OnDASServerStart(XSDK_HANDLE hServer, int nResult); | void OnDASServerStart(XSDK_HANDLE hServer, int nResult); | ||||
| void OnDASDeviceReg(XSDK_HANDLE hDevice, SXSDKDASDeviceInfo *pDevInfo); | |||||
| void OnDASDeviceReg(XSDK_HANDLE hDevice, SXSDKDASDeviceInfo *pDevInfo,int dPos); | |||||
| int TestDASServer(); | int TestDASServer(); | ||||
| // 测试设备通道抓图 | // 测试设备通道抓图 | ||||