예제 #1
0
        public void OnQueryResult(IntPtr session, IntPtr pCommand, IntPtr pEvent)
        {
            BVCU_Command          command    = (BVCU_Command)Marshal.PtrToStructure(pCommand, typeof(BVCU_Command));
            BVCU_Event_SessionCmd sessionCmd = (BVCU_Event_SessionCmd)Marshal.PtrToStructure(pEvent, typeof(BVCU_Event_SessionCmd));

            if (command.stMsgContent.pData == IntPtr.Zero || sessionCmd.stContent.pData == IntPtr.Zero)
            {
                return;
            }
            if (command.iSubMethod == 18)
            {
                Test_Struct        s1      = (Test_Struct)Marshal.PtrToStructure(command.pUserData, typeof(Test_Struct));
                BVCU_PUCFG_GPSData gpsdata = (BVCU_PUCFG_GPSData)Marshal.PtrToStructure(sessionCmd.stContent.pData, typeof(BVCU_PUCFG_GPSData));
            }
            else if (command.iSubMethod == BVSDKAdapter.BVCU_SUBMETHOD.BVCU_SUBMETHOD_SEARCH_LIST)
            {
                BVCU_Search_Response searchResponse = (BVCU_Search_Response)Marshal.PtrToStructure(sessionCmd.stContent.pData, typeof(BVCU_Search_Response));
                if (searchResponse.stSearchInfo.iType == (Int32)BVSDKAdapter.BVCU_SEARCH_TYPE.BVCU_SEARCH_TYPE_FILE)
                {
                    BVCU_SearchInfo  stSearchInfo = searchResponse.stSearchInfo;
                    BVSearchResponse searchRes    = new BVSearchResponse(searchResponse);//读取文件列表
                    m_session.showSearchRecordFiles(searchRes, command.szTargetID);
                }
            }
        }
예제 #2
0
        public int SearchFileBySeach(string puId, DateTime beginTime, DateTime endTime)
        {
            string CurrentPuId        = puId;
            int    CurrentChannelInex = 0;
            object userData           = null;

            int             FilterFileType = (int)BVSDKAdapter.BVCU_STORAGE_FILE_TYPE.ALL;
            int             rc             = -1;
            BVCU_SearchInfo searchInfo     = new BVCU_SearchInfo();

            searchInfo.iPostition = 0;
            searchInfo.iCount     = 128;
            searchInfo.iType      = (int)BVSDKAdapter.BVCU_SEARCH_TYPE.BVCU_SEARCH_TYPE_FILE;
            BVCU_Search_FileFilter fileFilter = new BVCU_Search_FileFilter();

            fileFilter.puID          = CurrentPuId;
            fileFilter.iChannelIndex = CurrentChannelInex;
            fileFilter.iTimeBegin    = BVSDKAdapter.getSec(beginTime);
            fileFilter.iTimeEnd      = BVSDKAdapter.getSec(endTime);
            fileFilter.iFileType     = FilterFileType;

            //(m_bvsdkHandle, m_server.sessionHandle);

            int isize = Marshal.SizeOf(typeof(BVCU_Search_FileFilter));
            BVCU_Search_Request request = new BVCU_Search_Request();

            request.stSearchInfo = searchInfo;
            IntPtr ptFileFilter = IntPtr.Zero;
            IntPtr ptRequest    = IntPtr.Zero;
            int    iSize        = Marshal.SizeOf(typeof(BVCU_Search_FileFilter));

            ptFileFilter = Marshal.AllocHGlobal(iSize);
            if (ptFileFilter == IntPtr.Zero)
            {
                return(BVSDKAdapter.BVCU_RESULT_E.FAILED);
            }
            request.pData = BVCU_Search_Request.CreateDataArray();
            Marshal.StructureToPtr(fileFilter, ptFileFilter, false);
            Marshal.Copy(ptFileFilter, request.pData, 0, Marshal.SizeOf(typeof(BVCU_Search_FileFilter)));
            ptRequest = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(BVCU_Search_Request)));
            if (ptRequest == IntPtr.Zero)
            {
                Marshal.FreeHGlobal(ptFileFilter);
                return(BVSDKAdapter.BVCU_RESULT_E.FAILED);
            }
            Marshal.StructureToPtr(request, ptRequest, false);
            IntPtr ptNruTarget = Marshal.StringToHGlobalAnsi(CurrentPuId);

            SearchCommon.SearchUserData searchUserData = new SearchCommon.SearchUserData();
            searchUserData.stSearchInfo = searchInfo;
            searchUserData.oData        = fileFilter;
            searchUserData.userData     = userData;
            int iIndexUserData = userDataDeposit.DepositAData(searchUserData);

            rc = BVCU.ManagedLayer_Search_File(m_bvsdkHandle, m_server.sessionHandle, ptNruTarget, ptRequest, (IntPtr)iIndexUserData);
            Marshal.FreeHGlobal(ptFileFilter);
            Marshal.FreeHGlobal(ptRequest);
            Marshal.FreeHGlobal(ptNruTarget);
            return(rc);
        }
예제 #3
0
            public BVSearchResponse(BVCU_Search_Response searchResponse)
            {
                searchInfo = searchResponse.stSearchInfo;
                IntPtr ptr = searchResponse.pData;

                switch (searchResponse.stSearchInfo.iType)
                {
                case (int)BVSDKAdapter.BVCU_SEARCH_TYPE.BVCU_SEARCH_TYPE_FILE:
                    fileInfo = new List <BVCU_Search_FileInfo>();
                    int size = Marshal.SizeOf(typeof(BVCU_Search_FileInfo));
                    for (int i = 0; i < searchResponse.iCount; i++)
                    {
                        BVCU_Search_FileInfo file = (BVCU_Search_FileInfo)Marshal.PtrToStructure(ptr, typeof(BVCU_Search_FileInfo));
                        fileInfo.Add(file);
                        ptr += Marshal.SizeOf(typeof(BVCU_Search_FileInfo));
                    }
                    break;

                case (int)BVSDKAdapter.BVCU_SEARCH_TYPE.BVCU_SEARCH_TYPE_PULIST:
                    pulist = new List <BVCU_PUChannelInfo>();
                    for (int i = 0; i < searchResponse.iCount; i++)
                    {
                        pulist.Add((BVCU_PUChannelInfo)Marshal.PtrToStructure(ptr, typeof(BVCU_PUChannelInfo)));
                        ptr += Marshal.SizeOf(typeof(BVCU_PUChannelInfo));
                    }
                    break;

                default:
                    break;
                }
            }