Beispiel #1
0
 /// <summary>
 /// 初始化全局变量
 /// </summary>
 /// <param name="bvcuSdkHandle"></param>
 /// <param name="session"></param>
 /// <param name="dialog"></param>
 public void init(IntPtr bvcuSdkHandle, Session session, Dialog dialog)
 {
     m_session = session;
     m_dialog  = dialog;
     BVCU.ManagedLayer_CuSetPuControlResultProcFunc(bvcuSdkHandle, onControlResult);
     BVCU.ManagedLayer_CuSetPuQueryResultProcFunc(bvcuSdkHandle, onQueryResult);
 }
Beispiel #2
0
        public int openGpsDialog(Pu pu, int channelNo)
        {
            foreach (OneDialog dlg in m_gpsDialogs)
            {
                if (dlg.pu.id.Equals(pu.id, StringComparison.CurrentCultureIgnoreCase) &&
                    dlg.channelNo == channelNo)
                {
                    LogHelper.LogHelper.RecordLog(51, string.Format("已经发送打开[{0}, {1}]Gps通道的命令", pu.puName, channelNo));
                    return(-1);
                }
            }
            IntPtr dialog = IntPtr.Zero;
            int    ret    = BVCU.ManagedLayer_CuOpenGpsDialog(m_bvsdkHandle, ref dialog, m_session.Handle, Encoding.UTF8.GetBytes(pu.id), channelNo, m_bvsdkEventHandler.gpsDialog_OnEvent, m_bvsdkEventHandler.gpsDialog_OnData);

            if (BVCU.BVCU_RESULT_S_OK == ret)
            {
                OneDialog dlg = new OneDialog();
                dlg.dialogHandle = dialog;
                dlg.channelNo    = channelNo;
                dlg.pu           = pu;
                m_gpsDialogs.Add(dlg);

                LogHelper.LogHelper.RecordLog(3, string.Format("正在打开{0}, {1}的Gps通道...", pu.puName, channelNo));
                return(0);
            }
            else
            {
                LogHelper.LogHelper.RecordLog(3, string.Format("打开{0}, {1}的Gps通道失败, 错误码:{2}", pu.puName, channelNo, ret));
            }
            return(-1);
        }
Beispiel #3
0
        /// <summary>
        /// 录像
        /// </summary>
        public void record(Panel panel)
        {
            if (m_mainForm.RecordPath.Length == 0)
            {
                MessageBox.Show("未设置录像路径");
                return;
            }
            foreach (OneDialog dlg in m_dialogs)
            {
                if (dlg.panel == panel)
                {
                    dlg.recording = !dlg.recording;
                    if (dlg.recording)
                    {
                        try
                        {
                            //录像
                            int ret = BVCU.ManagedLayer_CuSetRecordStorageParam(m_bvsdkHandle, dlg.dialogHandle, Encoding.UTF8.GetBytes(m_mainForm.RecordPath), 3600);

                            BVCU.FAILED(ret);
                        }
                        catch
                        {
                            MessageBox.Show("保存文件失败");
                            dlg.recording = false;
                        }
                    }
                    else
                    {
                        BVCU.ManagedLayer_CuSetRecordStorageParam(m_bvsdkHandle, dlg.dialogHandle, Encoding.UTF8.GetBytes(""), 0);
                    }
                    break;
                }
            }
        }
Beispiel #4
0
 void displayFont(IntPtr dialog, Int64 timeStamp)
 {
     Dialog.OneDialog cuDlg = m_dialog.getDialog(dialog);
     if (null == cuDlg)
     {
         return;
     }
     if (cuDlg.panel != null)
     {
         AfterRenderIndex idx = getIdx(dialog);
         if (idx == null)
         {
             return;
         }
         cuDlg.panel.BeginInvoke(refreshAfterRenderIdx, new object[] { cuDlg, timeStamp });
         BVCU.Color color = new BVCU.Color(0xFFFFFFFF);
         try
         {
             BVCU.BVDisplay_DisplayFont(idx.dispHandle, idx.index, ref idx.dispRect,
                                        ref color, cuDlg.timeStamp.ToString("yyyy'/'MM'/'dd HH:mm:ss"));
         }
         catch
         { }
     }
 }
Beispiel #5
0
        public int openTspDialog(Pu pu, int channelNo)
        {
            foreach (OneDialog dlg in m_tspDialogs)
            {
                if (dlg.pu.id.Equals(pu.id, StringComparison.CurrentCultureIgnoreCase) &&
                    dlg.channelNo == channelNo)
                {
                    LogHelper.LogHelper.RecordLog(51, string.Format("已经发送打开[{0}, {1}]串口通道的命令", pu.puName, channelNo));
                    return(-1);
                }
            }
            IntPtr dialog = IntPtr.Zero;

            int ret = BVCU.ManagedLayer_CuOpenTspDialog(m_bvsdkHandle, ref dialog, m_session.Handle, Encoding.UTF8.GetBytes(pu.id), channelNo, m_bvsdkEventHandler.tspDialog_OnEvent, m_bvsdkEventHandler.tspDialog_OnData);

            if (BVCU.BVCU_RESULT_S_OK == ret)
            {
                OneDialog dlg = new OneDialog();
                dlg.dialogHandle = dialog;
                dlg.channelNo    = channelNo;
                dlg.pu           = pu;
                m_tspDialogs.Add(dlg);

                LogHelper.LogHelper.RecordLog(0, string.Format("正在打开设备:{0}, 通道:{1}的串口", pu.puName, channelNo));
                return(0);
            }
            else
            {
                string errorMsg = string.Format("打开{0}的{1}串口失败(错误码:{2})", pu.puName, channelNo, ret);
                MessageBox.Show(errorMsg);
                LogHelper.LogHelper.RecordLog(100, errorMsg);
            }
            return(-1);
        }
Beispiel #6
0
        /// <summary>
        /// 登录成功后调用;获取设备列表
        /// </summary>
        void procOnLoginOk()
        {
            Console.WriteLine("登录服务器 {0} 成功", m_server.ip);
            releaseReloginTimer();
            m_iLoginRetryCount = 0;
            m_bServerRetry     = true;
            int result = 0;

            for (int i = 0; i < BVCU.FAIL_RETRY_TIMES; i++)//试BVCU.FAIL_RETRY_TIMES(=10)次-L
            {
                result = BVCU.ManagedLayer_CuGetPuList(m_bvsdkHandle, m_server.sessionHandle,
                                                       m_bvsdkEventHandler.cmd_OnGetPuList);

                if (!BVCU.SUCCEEDED(result))
                {
                    Thread.Sleep(BVCU.FAIL_RETRY_INTERVAL);
                }
                else
                {
                    Console.WriteLine("获取设备列表成功");
                    return;
                }
            }

            MessageBox.Show("获取设备列表失败");
        }
Beispiel #7
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);
        }
Beispiel #8
0
        public int openTspDialog(Session.Pu pu, int channelNo)
        {
            foreach (OneDialog dlg in m_tspDialogs)
            {
                if (dlg.pu.id.Equals(pu.id, StringComparison.CurrentCultureIgnoreCase) &&
                    dlg.channelNo == channelNo)
                {
                    return(-1);
                }
            }
            IntPtr dialog = IntPtr.Zero;

            if (BVCU.ManagedLayer_CuOpenTspDialog(m_bvsdkHandle, ref dialog, m_session.Handle, Encoding.UTF8.GetBytes(pu.id),
                                                  channelNo, m_bvsdkEventHandler.tspDialog_OnEvent, m_bvsdkEventHandler.tspDialog_OnData)
                == BVCU.BVCU_RESULT_S_OK)
            {
                OneDialog dlg = new OneDialog();
                dlg.dialogHandle = dialog;
                dlg.channelNo    = channelNo;
                dlg.pu           = pu;
                m_tspDialogs.Add(dlg);
                return(0);
            }
            return(-1);
        }
Beispiel #9
0
        public void procShowAlarmEventMessage(BVCU_Event_Source source)
        {
            string strEvent     = source.szID;
            string strEventType = BVCU.ConvertEventType2String(source.iEventType);

            if (strEvent.Length == 0)
            {
                strEvent = "null" + " " + strEventType + " " + source.szEventDesc;
            }
            else if (source.iEventType >= BVCU.BVCU_EVENT_TYPE.VIDEOLOST &&
                     source.iEventType <= BVCU.BVCU_EVENT_TYPE.OUTROUTE)
            {
                if (null != m_sdkOperator && null != m_sdkOperator.m_session)
                {
                    string puName = "";
                    Pu     pu     = m_sdkOperator.m_session.getPu(source.szID);
                    if (pu != null)
                    {
                        puName = pu.puName;
                    }

                    strEvent = puName + "(" + source.szID + ")" + " " + strEventType + " " + source.szEventDesc;
                    if (source.iEventType != BVCU.BVCU_EVENT_TYPE.PUONLINE &&
                        source.iEventType != BVCU.BVCU_EVENT_TYPE.PUOFFLINE)
                    {
                        if (source.bEnd == 1)
                        {
                            strEvent += " " + "结束";
                        }
                    }
                }
            }

            MessageBox.Show(strEvent, "WinformDemo");
        }
Beispiel #10
0
        /// <summary>
        /// 截图
        /// </summary>
        public void capture(Panel panel)
        {
            if (m_mainForm.CapturePath.Length == 0)
            {
                MessageBox.Show("未设置截图路径");
                return;
            }
            try
            {
                foreach (OneDialog dlg in m_dialogs)
                {
                    if (dlg.panel == panel)
                    {
                        string path = m_mainForm.CapturePath + "\\"
                                      + dlg.timeStamp.Year + dlg.timeStamp.Month.ToString().PadLeft(2, '0')
                                      + dlg.timeStamp.Day.ToString().PadLeft(2, '0') + dlg.timeStamp.Hour.ToString().PadLeft(2, '0')
                                      + dlg.timeStamp.Minute.ToString().PadLeft(2, '0') + dlg.timeStamp.Second.ToString().PadLeft(2, '0')
                                      + dlg.timeStamp.Millisecond.ToString().PadLeft(3, '0') + ".jpg";


                        //截图
                        int ret = BVCU.ManagedLayer_CuSnapshot(m_bvsdkHandle, dlg.dialogHandle, Encoding.UTF8.GetBytes(path), 85);

                        BVCU.FAILED(ret);
                        break;
                    }
                }
            }
            catch
            {
                MessageBox.Show("截图失败");
            }
        }
Beispiel #11
0
 public BVCUSDKOperator(Form1 mainform)
 {
     m_mainForm = mainform;
     BVCU.FAILED(BVCU.ManagedLayer_CuInit(ref m_bvcuSdkHandle));
     m_eventHandler = new EventHandler();
     m_session      = new Session(m_bvcuSdkHandle, m_eventHandler, m_mainForm);
     m_dialog       = new Dialog(m_bvcuSdkHandle, m_eventHandler, m_mainForm, m_session);
     m_eventHandler.init(m_bvcuSdkHandle, m_session, m_dialog);
 }
Beispiel #12
0
 public AfterRender(Dialog dlg)
 {
     m_dialog = dlg;
     afterRenderDisplayFont = new BVCU.DisplayFont(displayFont);
     BVCU.ManagedLayer_DispSetDisplayFontFunc(afterRenderDisplayFont);
     m_afterRenderList     = new ArrayList();
     refreshAfterRenderIdx = new DelegateCuDialogAndTimeStampIn(procRefreshAfterRenderIdx);
     createFontInDialog    = new DelegateCuDialogIn(procCreateFontInDialog);
 }
Beispiel #13
0
 void getChannel(Session.Channel chnl, BVCU_PUOneChannelInfo channel)
 {
     chnl.channelName = channel.szName;
     BVCU.AVDirection avDir = BVCU.GetAVDirection(channel.iMediaDir);
     chnl.audioPlayback = avDir.audioRecv;
     chnl.speak         = avDir.audioSnd;
     chnl.video         = avDir.videoRecv;
     chnl.ptzIdx        = channel.iPTZIndex;
     chnl.channelNo     = channel.iChannelIndex;
 }
Beispiel #14
0
 public void getPtzAttr(string puId, int channelNo)
 {
     Session.Channel channel = m_session.getChannel(puId, channelNo);
     if (channel == null)
     {
         return;
     }
     BVCU.ManagedLayer_CuGetPuPtzAttr(m_bvcuSdkHandle, m_session.Handle, Encoding.UTF8.GetBytes(puId),
                                      channel.ptzIdx, m_eventHandler.onGetPtzAttr);
 }
Beispiel #15
0
            public int FileTransferOpen(ref IntPtr phTransfer, BVCU_File_TransferParam transferParam, object userData)
            {
                IntPtr pParam = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(BVCU_File_TransferParam)));

                Marshal.StructureToPtr(transferParam, pParam, false);
                int rc = BVCU.ManagedLayer_BVFileTransferOpen(m_sdkOperator.m_bvcuSdkHandle, ref phTransfer, pParam);

                timerGetTransInfo.Start();
                Marshal.FreeHGlobal(pParam);
                return(rc);
            }
Beispiel #16
0
        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);
        }
Beispiel #17
0
 /// <summary>
 /// 设置当前窗口(panel)的播放音量
 /// </summary>
 public void setVolume(Panel panel, int volume)
 {
     foreach (OneDialog dialog in m_dialogs)
     {
         if (dialog.panel == panel)
         {
             BVCU.ManagedLayer_CuPlayVolume(m_bvsdkHandle, dialog.dialogHandle, volume);
             break;
         }
     }
 }
Beispiel #18
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="mainform">主窗口</param>
        public BVCUSdkOperator(MainWinForm mainform)
        {
            m_mainForm = mainform;

            BVCU.FAILED(BVCU.ManagedLayer_CuInit(ref m_bvcuSdkHandle));//初始化库
            m_eventHandler = new EventHandler();
            m_session      = new Session(m_bvcuSdkHandle, m_eventHandler, m_mainForm);
            m_dialog       = new Dialog(m_bvcuSdkHandle, m_eventHandler, m_mainForm, m_session);
            m_eventHandler.init(m_bvcuSdkHandle, m_session, m_dialog);
            m_session.SetBVCUSdk(this);
        }
Beispiel #19
0
 public void OnResizeDialog()
 {
     foreach (OneDialog dlg in m_dialogs)
     {
         BVRect rect = new BVRect();
         rect.left   = dlg.panel.DisplayRectangle.Left;
         rect.top    = dlg.panel.DisplayRectangle.Top;
         rect.right  = dlg.panel.DisplayRectangle.Right;
         rect.bottom = dlg.panel.DisplayRectangle.Bottom;
         BVCU.ManagedLayer_CuResizeDialogWindow(m_bvsdkHandle, dlg.dialogHandle, ref rect);
     }
 }
Beispiel #20
0
 /// <summary>
 /// 关闭浏览对话框(Diglog)
 /// </summary>
 /// <param name="panel">需要关闭的浏览框对应的Panel</param>
 public void closeBrowse(Panel panel)
 {
     foreach (OneDialog dlg in m_dialogs)
     {
         if (dlg.panel == panel)
         {
             BVCU.ManagedLayer_CuCloseDialog(m_bvsdkHandle, dlg.dialogHandle);
             m_dialogs.Remove(dlg);
             break;
         }
     }
 }
Beispiel #21
0
 public void closeTspDialog(string puId, int channelNo)
 {
     foreach (OneDialog dlg in m_tspDialogs)
     {
         if (dlg.pu.id.Equals(puId, StringComparison.CurrentCultureIgnoreCase) &&
             dlg.channelNo == channelNo)
         {
             BVCU.ManagedLayer_CuCloseDialog(m_bvsdkHandle, dlg.dialogHandle);
             return;
         }
     }
 }
Beispiel #22
0
 void TickGetTransInfoLoop(object sender, EventArgs e)
 {
     if (hTransfer != IntPtr.Zero)
     {
         int rc = BVCU.ManagedLayer_BVFileTransferGetInfo(m_sdkOperator.m_bvcuSdkHandle, hTransfer, ref transferInfo);
         OnProgress(transferInfo);
         if (transferInfo.Percentage == 1)
         {
             timerGetTransInfo.Stop();
             return;
         }
     }
 }
Beispiel #23
0
        /// <summary>
        /// 打开对话(Dialog)
        /// </summary>
        /// <param name="pu"></param>
        /// <param name="channelNo"></param>
        /// <param name="panel"></param>
        public void openBrowse(Pu pu, int channelNo, Panel panel)
        {
            try
            {
                BVCU_DialogControlParam_Network net = new BVCU_DialogControlParam_Network(0, 5, 1, 3);
                BVRect    dispRect = new BVRect(0, 0, panel.ClientRectangle.Height, panel.ClientRectangle.Width);
                OneDialog dlg      = new OneDialog();

                foreach (Channel channel in pu.channelList)
                {
                    int volume = -1;
                    if (channel.channelNo == channelNo)
                    {
                        if (channel.audioPlayback)
                        {
                            volume = 0;
                        }
                        //打开视屏浏览, 主要参数:sdkHandle、sessionHandle、puID、channelNo、显示区域的大小
                        int ret = BVCU.ManagedLayer_CuBrowsePu(m_bvsdkHandle,                 //sdk handle
                                                               ref dlg.dialogHandle,          //dialog handle
                                                               m_session.Handle,              //session handle
                                                               Encoding.UTF8.GetBytes(pu.id), //pu id
                                                               channelNo,                     //channel no
                                                               panel.Handle,                  //pannel handle
                                                               ref dispRect,                  //上下左右,矩形
                                                               volume,                        //音量
                                                               0,                             //single Rec File Sec
                                                               Encoding.UTF8.GetBytes(""),    //rec File Dir
                                                               true,                          //videoTrans
                                                               ref net,                       //network 时延
                                                               m_bvsdkEventHandler.dialog_OnDialogEvent,
                                                               m_bvsdkEventHandler.dialog_OnStorageEvent);

                        BVCU.FAILED(ret);
                        LogHelper.LogHelper.RecordLog(4, string.Format("打开[{0}, {1}]的视屏预览通道", pu.puName, channelNo));
                        break;
                    }
                }

                dlg.panel     = panel;
                dlg.pu        = pu;
                dlg.channelNo = channelNo;
                m_dialogs.Add(dlg);
            }
            catch
            {
                panel.ContextMenuStrip = null;
                MessageBox.Show("打开预览失败");
            }
        }
Beispiel #24
0
 public void closeGpsDialog(string puId, int channelNo)
 {
     foreach (OneDialog dlg in m_gpsDialogs)
     {
         if (dlg.pu.id.Equals(puId, StringComparison.CurrentCultureIgnoreCase) &&
             dlg.channelNo == channelNo)
         {
             int iresult = BVCU.ManagedLayer_CuCloseDialog(m_bvsdkHandle, dlg.dialogHandle);
             if (0 == iresult)
             {
                 m_gpsDialogs.Remove(dlg);
             }
             return;
         }
     }
 }
Beispiel #25
0
 public void closeTspDialog(OneDialog tspDialog)
 {
     if (null == tspDialog)
     {
         return;
     }
     foreach (OneDialog dlg in m_tspDialogs)
     {
         if (dlg == tspDialog && dlg.dialogHandle != null)
         {
             BVCU.ManagedLayer_CuCloseDialog(m_bvsdkHandle, dlg.dialogHandle);
             m_tspDialogs.Remove(dlg);
             break;
         }
     }
     m_tspDialogs.Clear();
 }
Beispiel #26
0
        public void ptzControl(int cmd, string puId, int channelNo, BVCU_PTZ_MOVE move, int presetNo = 0)
        {
            Channel channel = m_session.getChannel(puId, channelNo);

            if (channel == null)
            {
                return;
            }
            BVCU_PUCFG_PTZControl ptzCtrl = new BVCU_PUCFG_PTZControl();

            ptzCtrl.bStop       = (int)move;
            ptzCtrl.iPTZCommand = cmd;
            ptzCtrl.iParam3     = ptzCtrl.iParam2 = ptzCtrl.iParam1 = 0;
            switch (cmd)
            {
            case BVCU.BVCU_PTZ_COMMAND.LEFT:
            case BVCU.BVCU_PTZ_COMMAND.RIGHT:
            case BVCU.BVCU_PTZ_COMMAND.UP:
            case BVCU.BVCU_PTZ_COMMAND.DOWN:
                ptzCtrl.iParam2 = m_ptzSpeed;
                break;

            case BVCU.BVCU_PTZ_COMMAND.LEFTDOWN:
            case BVCU.BVCU_PTZ_COMMAND.LEFTTOP:
            case BVCU.BVCU_PTZ_COMMAND.RIGHTDOWN:
            case BVCU.BVCU_PTZ_COMMAND.RIGHTTOP:
                ptzCtrl.iParam1 = ptzCtrl.iParam2 = m_ptzSpeed;
                break;

            case BVCU.BVCU_PTZ_COMMAND.PRESET_GO:
                ptzCtrl.iParam1 = presetNo;
                ptzCtrl.iParam2 = ptzCtrl.iParam3 = m_ptzSpeed;
                break;

            case BVCU.BVCU_PTZ_COMMAND.CRUISE_GO:
                ptzCtrl.iParam1 = presetNo;
                break;

            default:
                break;
            }
            IntPtr pt = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(BVCU_PUCFG_PTZControl)));

            Marshal.StructureToPtr(ptzCtrl, pt, true);
            BVCU.ManagedLayer_CuSetPuPtzControl(m_bvcuSdkHandle, m_session.Handle, Encoding.UTF8.GetBytes(puId), channel.ptzIdx, pt);
        }
Beispiel #27
0
        void Server_ProcNotifyChannelInfo(IntPtr session, IntPtr ptPuId, IntPtr ptPuName, int iStatus, ref BVCU_PUOneChannelInfo channel, int iFinished)
        {
            string puId   = Marshal.PtrToStringAnsi(ptPuId, BVCU.BVCU_MAX_ID_LEN + 1).Split('\0')[0];
            string puName = Marshal.PtrToStringAnsi(ptPuName, BVCU.BVCU_MAX_NAME_LEN + 1).Split('\0')[0];

            if (iStatus == BVCU.BVCU_ONLINE_STATUS_OFFLINE)
            {
                m_session.OnRemovePu(puId);
            }
            if (BVCU.TRUE(iFinished))
            {
                m_session.OnGetPuListFinished();
            }
            Session.Channel chnl = new Session.Channel();
            getChannel(chnl, channel);
            m_session.OnGetPu(puName, puId, chnl);
            return;
        }
Beispiel #28
0
 public void login(string ip, int port, string usrName, string psw)
 {
     m_server.ip      = ip;
     m_server.port    = port;
     m_server.usrName = usrName;
     m_server.psw     = psw;
     try
     {
         BVCU.FAILED(
             BVCU.ManagedLayer_CuLogin(m_bvsdkHandle, ref m_server.sessionHandle,
                                       Encoding.UTF8.GetBytes(ip), port, Encoding.UTF8.GetBytes(usrName), Encoding.UTF8.GetBytes(psw), SERVER_TIME_OUT_SECOND,
                                       m_bvsdkEventHandler.server_OnEvent, m_bvsdkEventHandler.server_ProcChannelInfo));
     }
     catch
     {
         MessageBox.Show("登录失败");
     }
 }
Beispiel #29
0
        void procOnLoginOk()
        {
            int result = 0;

            for (int i = 0; i < BVCU.FAIL_RETRY_TIMES; i++)
            {
                result = BVCU.ManagedLayer_CuGetPuList(m_bvsdkHandle, m_server.sessionHandle,
                                                       m_bvsdkEventHandler.cmd_OnGetPuList);
                if (!BVCU.SUCCEEDED(result))
                {
                    Thread.Sleep(BVCU.FAIL_RETRY_INTERVAL);
                }
                else
                {
                    return;
                }
            }
            MessageBox.Show("获取设备列表失败");
        }
Beispiel #30
0
        void procCreateFontInDialog(Dialog.OneDialog dialog)
        {
            AfterRenderIndex idx = new AfterRenderIndex();

            idx.type         = INDEX_TYPE.FONT;
            idx.dispHandle   = dialog.panel.Handle;
            idx.dialogHandle = dialog.dialogHandle;
            if (!BVCU.SUCCEEDED(BVCU.BVDisplay_CreateFont(idx.dispHandle,
                                                          ref idx.index, 15, "Arial")))
            {
                return;
            }
            BVCU.FontDisplayMode effect = new BVCU.FontDisplayMode();
            effect.size       = BVCU.FONT_DISPLAY_MODE_SIZE;
            effect.fontColor  = new BVCU.Color(0xFFFFFFFF);
            effect.backColor  = new BVCU.Color(0xFF000000);
            effect.effect     = BVCU.BVDISPLAY_TEXT_EFFECT_OUTLINE;
            effect.effectSize = 1;
            BVCU.BVDisplay_SetFontDisplayMode(idx.dispHandle, idx.index, ref effect);
            m_afterRenderList.Add(idx);
        }