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); } } }
public void GetGpsData(string puId, int channelNo, Test_Struct s) { //int i = BVCU.ManagedLayer_CuGetPuGpsInfo(m_bvcuSdkHandle, m_session.Handle, Encoding.UTF8.GetBytes(puId), // channelNo - BVCU.BVCU_SUBDEV_INDEXMAJOR_MIN_GPS); IntPtr pt = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Test_Struct))); Marshal.StructureToPtr(s, pt, false); int j = BVCU.ManagedLayer_CuGetPuGpsInfoV2(m_bvcuSdkHandle, m_session.Handle, Encoding.UTF8.GetBytes(puId), channelNo - BVCU.BVCU_SUBDEV_INDEXMAJOR_MIN_GPS, pt); }
private void buttonGetGps_Click(object sender, EventArgs e) { if (g_channelNo < BVCU.BVCU_SUBDEV_INDEXMAJOR_MIN_GPS && g_channelNo > BVCU.BVCU_SUBDEV_INDEXMAJOR_MAX_GPS || g_pu == null) { return; } Test_Struct s = new Test_Struct(); s.i = 2; m_sdkOperator.GetGpsData(g_pu.id, g_channelNo, s); }