Example #1
1
        public void ReConnect(object source, System.Timers.ElapsedEventArgs e)
        {
            foreach (DEV_INFO devinfo in dictDiscontDev.Values)
            {
                H264_DVR_DEVICEINFO OutDev = new H264_DVR_DEVICEINFO();
                int nError = 0;

                int lLogin = XMSDK.H264_DVR_Login(devinfo.szIpaddress, (ushort)devinfo.nPort, devinfo.szUserName, devinfo.szPsw, out OutDev, out nError, SocketStyle.TCPSOCKET);
                if (lLogin <= 0)
                {
                    int nErr = XMSDK.H264_DVR_GetLastError();
                    if (nErr == (int)SDK_RET_CODE.H264_DVR_PASSWORD_NOT_VALID)
                    {
                        MessageBox.Show(("Password Error"));
                    }
                    else if (nErr == (int)SDK_RET_CODE.H264_DVR_LOGIN_USER_NOEXIST)
                    {
                        MessageBox.Show(("User Not Exist"));
                    }

                    return;
                }
                dictDiscontDev.Remove(devinfo.lLoginID);

                ClientDemo clientForm = new ClientDemo();

                foreach (Form form in Application.OpenForms)
                {
                    if (form.Name == "ClientDemo")
                    {
                        clientForm = (ClientDemo)form;
                        break;
                    }
                }
                DEV_INFO devAdd = new DEV_INFO();
                devAdd          = devinfo;
                devAdd.lLoginID = lLogin;


                foreach (TreeNode node in clientForm.devForm.DevTree.Nodes)
                {
                    if (node.Name == "Device")
                    {
                        DEV_INFO dev = (DEV_INFO)node.Tag;
                        if (dev.lLoginID == devinfo.lLoginID)
                        {
                            node.Text = devAdd.szDevName;
                            node.Tag  = devAdd;
                            node.Name = "Device";

                            foreach (TreeNode channelnode in node.Nodes)
                            {
                                CHANNEL_INFO chInfo = (CHANNEL_INFO)channelnode.Tag;
                                if (chInfo.nWndIndex > -1)
                                {
                                    clientForm.m_videoform[chInfo.nWndIndex].ConnectRealPlay(ref devAdd, chInfo.nChannelNo);
                                    Thread.Sleep(10);
                                }
                            }
                            break;
                        }
                    }
                }

                dictDevInfo.Add(lLogin, devAdd);
                XMSDK.H264_DVR_SetupAlarmChan(lLogin);
            }
            if (0 == dictDiscontDev.Count)
            {
                timerDisconnect.Enabled = false;
                timerDisconnect.Stop();
            }
        }
Example #2
0
        private void comboBoxDevice_SelectedIndexChanged(object sender, EventArgs e)
        {
            TreeNode node = (TreeNode)comboBoxDevice.SelectedItem;

            if (node.Tag != null)
            {
                DEV_INFO devInfo  = (DEV_INFO)node.Tag;
                int      nLoginID = devInfo.lLoginID;

                ///获取系统能力集



                int     nChannel = -1;
                TabPage tab      = tabControlConfigs.SelectedTab;
                uint    nConfig  = 0;
                if (tab.Name == "tabPageGeneral")
                {
                    nConfig = (uint)SDK_CONFIG_TYPE.E_SDK_CONFIG_SYSNORMAL;
                }
                if (nConfig != 0)
                {
                    UpdateConfig(nLoginID, nChannel, nConfig);
                }
            }
        }
Example #3
0
        bool StartTalk(ref DEV_INFO pDevice)
        {
            IntPtr pdev = new IntPtr();

            Marshal.StructureToPtr(pDevice, pdev, false);

            unsafe
            {
                if (pdev.ToPointer() == null)
                {
                    return(false);
                }

                if (m_lTalkHandle.ToPointer() == null)
                {
                    return(false);
                }
                else
                {
                    m_lTalkHandle = (IntPtr)XMSDK.H264_DVR_StartLocalVoiceCom(pDevice.lLoginID);
                    if (m_lTalkHandle != (IntPtr)null)
                    {
                        return(true);
                    }
                    else
                    {
                        m_lTalkHandle = (IntPtr)null;;
                        return(false);
                    }
                }
            }
        }
Example #4
0
        private void tabControlConfigs_Selected(object sender, TabControlEventArgs e)
        {
            uint     nConfig = 0;
            TreeNode node    = (TreeNode)comboBoxDevice.SelectedItem;

            if (node.Tag != null)
            {
                DEV_INFO devInfo  = (DEV_INFO)node.Tag;
                int      nLoginID = devInfo.lLoginID;
                int      nChannel = -1;

                TabPage tab = tabControlConfigs.SelectedTab;
                if (tab.Name == "tabPageGeneral")
                {
                    nConfig = (uint)SDK_CONFIG_TYPE.E_SDK_CONFIG_SYSNORMAL;
                }
                else if (tab.Name == "tabPageWifi")
                {
                    nConfig = (uint)SDK_CONFIG_TYPE.E_SDK_CONFIG_NET_WIFI;
                    UpdateConfig(nLoginID, nChannel, (uint)SDK_CONFIG_TYPE.E_SDK_CONFIG_NET_DHCP);
                }

                if (nConfig != 0)
                {
                    UpdateConfig(nLoginID, nChannel, nConfig);
                }
            }
        }
Example #5
0
        private void buttonSearchWifi_Click(object sender, EventArgs e)
        {
            TreeNode node = (TreeNode)comboBoxDevice.SelectedItem;

            if (node.Tag != null)
            {
                DEV_INFO devInfo  = (DEV_INFO)node.Tag;
                int      nLoginID = devInfo.lLoginID;
                int      nChannel = -1;

                UpdateConfig(nLoginID, nChannel, (uint)SDK_CONFIG_TYPE.E_SDK_CONFIG_NET_WIFI_AP_LIST);
            }
        }
Example #6
0
 bool StopTalk(ref DEV_INFO pDevice)
 {
     unsafe
     {
         if (m_lTalkHandle.ToPointer() != null)
         {
             XMSDK.H264_DVR_StopVoiceCom(m_lTalkHandle.ToInt32());
             m_lTalkHandle = (IntPtr)null;
             return(true);
         }
         return(false);
     }
 }
Example #7
0
        private void comboDev_SelectedIndexChanged(object sender, EventArgs e)
        {
            DEV_INFO   devInfo      = new DEV_INFO();
            ComboxItem selecteditem = (ComboxItem)comboDev.SelectedItem;

            devInfo = (DEV_INFO)selecteditem.Value;

            for (int i = 0; i < devInfo.NetDeviceInfo.byChanNum + devInfo.NetDeviceInfo.iDigChannel; i++)
            {
                comboChannel.Items.Add(i + 1);
            }
            comboChannel.SelectedIndex = 0;
            m_lLoginID = devInfo.lLoginID;
        }
Example #8
0
 private void DevTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     if (e.Node.Name == "Channel")
     {
         TreeNode     nodeDev     = e.Node.Parent;
         DEV_INFO     devinfo     = (DEV_INFO)nodeDev.Tag;
         CHANNEL_INFO chanInfo    = (CHANNEL_INFO)e.Node.Tag;
         int          iRealHandle = ((ClientDemo)this.Parent).m_videoform[((ClientDemo)this.Parent).m_nCurIndex].ConnectRealPlay(ref devinfo, chanInfo.nChannelNo);
         if (iRealHandle > 0)
         {
             CHANNEL_INFO chInfo = (CHANNEL_INFO)e.Node.Tag;
             chInfo.nWndIndex = ((ClientDemo)this.Parent).m_nCurIndex;
             e.Node.Tag       = chInfo;
         }
     }
 }
Example #9
0
        int DevLogin(ref DEV_INFO pdev)
        {
            if (pdev.bSerialID)                 //如果之前是DDNS获取ip;这里先获取动态ip
            {
                int         maxDeviceNum = 100; //最大支持设备数量100
                DDNS_INFO[] pDDNSInfo    = new DDNS_INFO[maxDeviceNum];
                SearchMode  searchmode;
                int         nReNum = 0; //实际获得的设备数量
                searchmode.nType        = (int)SearchModeType.DDNS_SERIAL;
                searchmode.szSerIP      = pdev.szSerIP;
                searchmode.nSerPort     = pdev.nSerPort;
                searchmode.szSerialInfo = pdev.szSerialInfo;
                bool bret = Convert.ToBoolean(XMSDK.H264_DVR_GetDDNSInfo(ref searchmode, out pDDNSInfo, maxDeviceNum, out nReNum));
                if (!bret)
                {
                    return(0);
                }
                pdev.szIpaddress = pDDNSInfo[0].IP;
                pdev.nPort       = pDDNSInfo[0].MediaPort;
            }

            H264_DVR_DEVICEINFO OutDev;
            int nError = 0;

            //设置尝试连接设备次数和等待时间
            XMSDK.H264_DVR_SetConnectTime(3000, 1);//设置尝试连接1次,等待时间3s

            int lLogin = XMSDK.H264_DVR_Login(pdev.szIpaddress, Convert.ToUInt16(pdev.nPort), pdev.szUserName,
                                              pdev.szPsw, out OutDev, out nError, SocketStyle.TCPSOCKET);

            if (lLogin <= 0)
            {
                int nErr = XMSDK.H264_DVR_GetLastError();
                if (nErr == (int)SDK_RET_CODE.H264_DVR_PASSWORD_NOT_VALID)
                {
                    MessageBox.Show("Error.PwdErr");
                }
                else
                {
                    MessageBox.Show("Error.NotFound");
                }
                return(lLogin);
            }
            XMSDK.H264_DVR_SetupAlarmChan(lLogin);
            return(lLogin);
        }
        int DevLogin(ref DEV_INFO pdev)
        {
            if (pdev.bSerialID)//���֮ǰ��DDNS��ȡip;�����Ȼ�ȡ��̬ip
            {
                int maxDeviceNum = 100;  //���֧���豸����100
                DDNS_INFO[] pDDNSInfo = new DDNS_INFO[maxDeviceNum];
                SearchMode searchmode;
                int nReNum = 0;  //ʵ�ʻ�õ��豸����
                searchmode.nType = (int)SearchModeType.DDNS_SERIAL;
                searchmode.szSerIP = pdev.szSerIP;
                searchmode.nSerPort = pdev.nSerPort;
                searchmode.szSerialInfo = pdev.szSerialInfo;
                bool bret = Convert.ToBoolean(XMSDK.H264_DVR_GetDDNSInfo(ref searchmode, out pDDNSInfo, maxDeviceNum, out nReNum));
                if (!bret)
                {
                    return 0;
                }
                pdev.szIpaddress=pDDNSInfo[0].IP;
                pdev.nPort = pDDNSInfo[0].MediaPort;
            }

            H264_DVR_DEVICEINFO OutDev;
            int nError = 0;
            //���ó��������豸�����͵ȴ�ʱ��
            XMSDK.H264_DVR_SetConnectTime(3000, 1);//���ó�������1�Σ��ȴ�ʱ��3s

            int lLogin = XMSDK.H264_DVR_Login(pdev.szIpaddress, Convert.ToUInt16(pdev.nPort), pdev.szUserName,
                pdev.szPsw, out OutDev,  out nError,SocketStyle.TCPSOCKET);
            if (lLogin <= 0)
            {
                int nErr = XMSDK.H264_DVR_GetLastError();
                if (nErr == (int)SDK_RET_CODE.H264_DVR_PASSWORD_NOT_VALID)
                {
                    MessageBox.Show("Error.PwdErr");
                }
                else
                {
                    MessageBox.Show("Error.NotFound");

                }
                return lLogin;
            }
            XMSDK.H264_DVR_SetupAlarmChan(lLogin);
            return lLogin;
        }
Example #11
0
        public int Connect(ref DEV_INFO pDev, int nChannel, int nWndIndex)
        {
            int nRet = 0;

            //if device did not login,login first
            if (pDev.lLoginID <= 0)
            {
                H264_DVR_DEVICEINFO OutDev;
                int nError = 0;
                //设置尝试连接设备次数和等待时间
                int lLogin = XMSDK.H264_DVR_Login(pDev.szIpaddress, (ushort)pDev.nPort, pDev.szUserName, pDev.szPsw, out OutDev, out nError, SocketStyle.TCPSOCKET);
                if (lLogin <= 0)
                {
                    int nErr = XMSDK.H264_DVR_GetLastError();
                    if (nErr == (int)SDK_RET_CODE.H264_DVR_PASSWORD_NOT_VALID)
                    {
                        MessageBox.Show(("Error.PwdErr"));
                    }
                    else
                    {
                        MessageBox.Show(("Error.NotFound"));
                    }

                    return(nRet);
                }

                pDev.lLoginID = lLogin;
                XMSDK.H264_DVR_SetupAlarmChan(lLogin);
            }

            int nWnd = m_nCurIndex;

            if (nWndIndex >= 0)
            {
                nWnd = nWndIndex;
            }

            if (nWnd >= m_nTotalWnd)
            {
                return(nRet);
            }

            return(m_videoform[nWnd].ConnectRealPlay(ref pDev, nChannel));
        }
Example #12
0
        private void buttonWifiOK_Click(object sender, EventArgs e)
        {
            TreeNode node = (TreeNode)comboBoxDevice.SelectedItem;

            if (node.Tag != null)
            {
                DEV_INFO devInfo  = (DEV_INFO)node.Tag;
                int      nLoginID = devInfo.lLoginID;
                int      nChannel = -1;
                TabPage  tab      = tabControlConfigs.SelectedTab;
                uint     nConfig  = 0;
                if (tab.Name == "tabPageWifi")
                {
                    nConfig = (uint)SDK_CONFIG_TYPE.E_SDK_CONFIG_NET_WIFI;
                    SaveConfig(nLoginID, nChannel, (uint)SDK_CONFIG_TYPE.E_SDK_CONFIG_NET_DHCP);
                }
                if (nConfig != 0)
                {
                    SaveConfig(nLoginID, nChannel, nConfig);
                }
            }
        }
        public int ConnectRealPlay( ref DEV_INFO pDev, int nChannel)
        {
            if(m_iPlayhandle != -1)
            {

                if (0 != XMSDK.H264_DVR_StopRealPlay(m_iPlayhandle, (uint)this.Handle))
                {
                    //TRACE("H264_DVR_StopRealPlay fail m_iPlayhandle = %d", m_iPlayhandle);
                }
                if(m_bSound)
                {
                    OnCloseSound();
                }
            }

            H264_DVR_CLIENTINFO playstru = new H264_DVR_CLIENTINFO();

            playstru.nChannel = nChannel;
            playstru.nStream = 0;
            playstru.nMode = 0;
            playstru.hWnd=this.Handle;
            m_iPlayhandle = XMSDK.H264_DVR_RealPlay(pDev.lLoginID, ref playstru);
            if(m_iPlayhandle <= 0 )
            {
                Int32 dwErr = XMSDK.H264_DVR_GetLastError();
                    StringBuilder sTemp = new StringBuilder("");
                    sTemp.AppendFormat("access {0} channel{1} fail, dwErr = {2}",pDev.szDevName,nChannel, dwErr);
                    MessageBox.Show(sTemp.ToString());
            }
            else
            {
                XMSDK.H264_DVR_MakeKeyFrame(pDev.lLoginID, nChannel, 0);
            }
            m_lLogin = pDev.lLoginID;
            m_iChannel = nChannel;
            return m_iPlayhandle;
        }
Example #14
0
        public int ConnectRealPlay(ref DEV_INFO pDev, int nChannel)
        {
            if (m_iPlayhandle != -1)
            {
                if (0 != XMSDK.H264_DVR_StopRealPlay(m_iPlayhandle, (uint)this.Handle))
                {
                    //TRACE("H264_DVR_StopRealPlay fail m_iPlayhandle = %d", m_iPlayhandle);
                }
                if (m_bSound)
                {
                    OnCloseSound();
                }
            }

            H264_DVR_CLIENTINFO playstru = new H264_DVR_CLIENTINFO();

            playstru.nChannel = nChannel;
            playstru.nStream  = 0;
            playstru.nMode    = 0;
            playstru.hWnd     = this.Handle;
            m_iPlayhandle     = XMSDK.H264_DVR_RealPlay(pDev.lLoginID, ref playstru);
            if (m_iPlayhandle <= 0)
            {
                Int32         dwErr = XMSDK.H264_DVR_GetLastError();
                StringBuilder sTemp = new StringBuilder("");
                sTemp.AppendFormat("access {0} channel{1} fail, dwErr = {2}", pDev.szDevName, nChannel, dwErr);
                MessageBox.Show(sTemp.ToString());
            }
            else
            {
                XMSDK.H264_DVR_MakeKeyFrame(pDev.lLoginID, nChannel, 0);
            }
            m_lLogin   = pDev.lLoginID;
            m_iChannel = nChannel;
            return(m_iPlayhandle);
        }
        public void ReConnect(object source, System.Timers.ElapsedEventArgs e)
        {
            foreach( DEV_INFO devinfo in dictDiscontDev.Values )
            {

                H264_DVR_DEVICEINFO OutDev = new H264_DVR_DEVICEINFO();
                int nError = 0;

                int lLogin = XMSDK.H264_DVR_Login(devinfo.szIpaddress, (ushort)devinfo.nPort, devinfo.szUserName, devinfo.szPsw, out OutDev, out nError, SocketStyle.TCPSOCKET);
                if (lLogin <= 0)
                {

                    int nErr = XMSDK.H264_DVR_GetLastError();
                    if (nErr == (int)SDK_RET_CODE.H264_DVR_PASSWORD_NOT_VALID)
                    {
                        MessageBox.Show(("Password Error"));
                    }
                    else if (nErr == (int)SDK_RET_CODE.H264_DVR_LOGIN_USER_NOEXIST)
                    {
                        MessageBox.Show(("User Not Exist"));
                    }

                    return;
                }
                dictDiscontDev.Remove(devinfo.lLoginID);

                ClientDemo clientForm = new ClientDemo();

                foreach (Form form in Application.OpenForms)
                {
                    if (form.Name == "ClientDemo")
                    {
                        clientForm = (ClientDemo)form;
                        break;
                    }
                }
                DEV_INFO devAdd = new DEV_INFO();
                devAdd = devinfo;
                devAdd.lLoginID = lLogin;

                foreach (TreeNode node in clientForm.devForm.DevTree.Nodes)
                {
                    if (node.Name == "Device")
                    {
                        DEV_INFO dev = (DEV_INFO)node.Tag;
                        if (dev.lLoginID == devinfo.lLoginID)
                        {
                            node.Text = devAdd.szDevName;
                            node.Tag = devAdd;
                            node.Name = "Device";

                            foreach (TreeNode channelnode in node.Nodes)
                            {
                                CHANNEL_INFO chInfo = (CHANNEL_INFO)channelnode.Tag;
                                if ( chInfo.nWndIndex > -1  )
                                {
                                    clientForm.m_videoform[chInfo.nWndIndex].ConnectRealPlay(ref devAdd, chInfo.nChannelNo);
                                    Thread.Sleep(10);
                                }

                            }
                            break;
                        }

                    }

                }

                dictDevInfo.Add(lLogin, devAdd);
                XMSDK.H264_DVR_SetupAlarmChan(lLogin);
            }
            if (0 == dictDiscontDev.Count)
            {
                timerDisconnect.Enabled = false;
                timerDisconnect.Stop();
            }
        }
Example #16
0
        private void DownloadByName()
        {
            if (m_DownLoadFileHandle > 0)
            {
                timerDownload.Stop();
                XMSDK.H264_DVR_StopGetFile(m_DownLoadFileHandle);
                m_DownLoadFileHandle         = 0;
                progressBarDownloadPos.Value = 0;

                btnDownload.Text = "Download";

                return;
            }

            string csFileName;

            //inCount;
            //if ( nSelected < 0 )
            //{
            //    MessageBox.Show("SelectFile !");
            //    return;
            //}


            H264_DVR_FILE_DATA FileInfo = (H264_DVR_FILE_DATA)listFile.FocusedItem.Tag;


            string strSaveName;
            //strSaveName.Format("c:\\record\\record.h264");
            int nSelectedIndex = comboDev.SelectedIndex;

            if (nSelectedIndex < 0)
            {
                MessageBox.Show("SelectDevice !");
                return;
            }
            DEV_INFO DevTemp = (DEV_INFO)((ComboxItem)comboDev.SelectedItem).Value;

            string strInitDir;

            strInitDir = Application.StartupPath;
            if (strInitDir.EndsWith("\\"))
            {
                strInitDir += "Download";
            }
            else
            {
                strInitDir += "\\Download";
            }

            DirectoryInfo dir = new DirectoryInfo(strInitDir);

            //if ( dir.Attributes )
            {
                dir.Create();
            }

            string strFileTpye = "h264";
            string strFileName = FileInfo.sFileName;

            if (strFileName.EndsWith(".h264"))
            {
                strFileTpye = "h264";
            }
            else
            {
                strFileTpye = "jpg";
            }
            strFileName = string.Format("{0}_{1}_{2}{3}_{4}{5}{6}.{7}",
                                        DevTemp.szDevName, FileInfo.ch + 1,
                                        FileInfo.stBeginTime.year, FileInfo.stBeginTime.month,
                                        FileInfo.stBeginTime.day, FileInfo.stBeginTime.hour,
                                        FileInfo.stBeginTime.minute, FileInfo.stBeginTime.second, strFileTpye);

            SaveFileDialog dlg = new SaveFileDialog();

            dlg.AddExtension     = true;
            dlg.CheckPathExists  = true;
            dlg.DefaultExt       = ".h264";
            dlg.Filter           = "All File(*.h264;*.jpg)|*.*||";
            dlg.InitialDirectory = strInitDir;          //默认路径
            dlg.ShowDialog();

            if (dlg.DereferenceLinks)
            {
                strSaveName = dlg.FileName;
                //m_lSaveHandle = H264_DVR_GetFileByName(m_lLoginID, pstrFileInfo,strSaveName.GetBuffer(0),SDKDownLoadPosCallback,(DWORD)this);
                m_DownLoadFileHandle = XMSDK.H264_DVR_GetFileByName(m_lLoginID, ref FileInfo, strSaveName, null, 0);
                if (m_DownLoadFileHandle >= 0)
                {
                    progressBarDownloadPos.Value = 0;
                    btnDownload.Text             = "Stop";
                    //update the progress control
                    //SetTimer(1,0,NULL);
                }
                else
                {
                    string sTemp = string.Format("dowload fail ERROR = {0}", XMSDK.H264_DVR_GetLastError());
                    MessageBox.Show(sTemp);
                }
            }
        }
Example #17
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            // 条件检测
            if (comboDev.SelectedIndex < 0)
            {
                MessageBox.Show("Select a Device!");
                return;
            }
            if (!checkFile.Checked && !checkTime.Checked)
            {
                MessageBox.Show("Select a Search mode!");
                return;
            }


            ClearResult();

            H264_DVR_TIME StartTime;
            H264_DVR_TIME StopTime;

            int nChannel  = comboChannel.SelectedIndex;    //channel No.
            int nFileType = comboRecordType.SelectedIndex; //file type

            StartTime.dwYear   = beginDate.Value.Year;
            StartTime.dwMonth  = beginDate.Value.Month;
            StartTime.dwDay    = beginDate.Value.Day;
            StartTime.dwHour   = beginTime.Value.Hour;
            StartTime.dwMinute = beginTime.Value.Minute;
            StartTime.dwSecond = beginTime.Value.Second;

            StopTime.dwYear   = endDate.Value.Year;
            StopTime.dwMonth  = endDate.Value.Month;
            StopTime.dwDay    = endDate.Value.Day;
            StopTime.dwHour   = endDate.Value.Hour;
            StopTime.dwMinute = endDate.Value.Minute;
            StopTime.dwSecond = endDate.Value.Second;
            H264_DVR_FILE_DATA[] szSend = new H264_DVR_FILE_DATA[100];

            ComboxItem item = (ComboxItem)comboDev.SelectedItem;

            if (item.Value != null)
            {
                DEV_INFO devInfo = (DEV_INFO)item.Value;


                int lLoginID = devInfo.lLoginID;
                int nMaxLen  = 100;
                int waitTime = 4000;
                int nNum     = 0;
                H264_DVR_FINDINFO searchInfo = new H264_DVR_FINDINFO();
                searchInfo.startTime  = StartTime;
                searchInfo.endTime    = StopTime;
                searchInfo.nChannelN0 = nChannel;
                searchInfo.nFileType  = nFileType;


                IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(H264_DVR_FILE_DATA)) * 100);



                int nRet = XMSDK.H264_DVR_FindFile(lLoginID, ref searchInfo, ptr, nMaxLen, out nNum, waitTime);
                m_nCurRecNum = nNum;

                for (int index = 0; index < 100; index++)
                {
                    unsafe
                    {
                        int *pDev = (int *)ptr.ToPointer();
                        pDev += Marshal.SizeOf(typeof(H264_DVR_FILE_DATA)) * index / 4;

                        IntPtr ptrTemp = new IntPtr(pDev);
                        szSend[index] = (H264_DVR_FILE_DATA)Marshal.PtrToStructure(ptrTemp, typeof(H264_DVR_FILE_DATA));
                    }
                }

                if (nRet > 0)
                {
                    if (nNum > 0)
                    {
                        m_nGetPage++;
                        m_nCurPage = 1;
                        if (m_nCurRecNum > m_listFile.Capacity)
                        {
                            m_listFile.Capacity = m_nCurRecNum;
                        }


                        for (int i = 0; i < m_nCurRecNum; i++)
                        {
                            m_listFile.Add(szSend[i]);
                        }

                        m_nSearchInfo.nChannelN0         = nChannel;
                        m_nSearchInfo.nFileType          = nFileType;
                        m_nSearchInfo.startTime.dwYear   = szSend[m_nCurRecNum - 1].stEndTime.year;
                        m_nSearchInfo.startTime.dwMonth  = szSend[m_nCurRecNum - 1].stEndTime.month;
                        m_nSearchInfo.startTime.dwDay    = szSend[m_nCurRecNum - 1].stEndTime.day;
                        m_nSearchInfo.startTime.dwHour   = szSend[m_nCurRecNum - 1].stEndTime.hour;
                        m_nSearchInfo.startTime.dwMinute = szSend[m_nCurRecNum - 1].stEndTime.minute;
                        m_nSearchInfo.startTime.dwSecond = szSend[m_nCurRecNum - 1].stEndTime.second;
                        m_nSearchInfo.endTime            = searchInfo.endTime;

                        if (nNum < PLAYBACK_MAX_FILE_NUM)
                        {
                            m_nTotalPage = m_nGetPage;
                        }

                        AddFileListInfo(m_nCurRecNum);//add list item
                        SetPageBtnState();
                    }
                    else
                    {
                        MessageBox.Show("No File");
                    }
                }
                else
                {
                    MessageBox.Show("SearchFail");
                }
            }
        }
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (textBoxDevName.Text.Trim() != "" &&
                textBoxIP.Text.Trim() != "" &&
                textBoxport.Text.Trim() != "" &&
                textBoxUsername.Text.Trim() != "")
            {
                H264_DVR_DEVICEINFO dvrdevInfo = new H264_DVR_DEVICEINFO();
                int      nError;
                int      nLoginID = XMSDK.H264_DVR_Login(textBoxIP.Text.Trim(), ushort.Parse(textBoxport.Text.Trim()), textBoxUsername.Text, textBoxPassword.Text, out dvrdevInfo, out nError, SocketStyle.TCPSOCKET);
                DEV_INFO devInfo  = new DEV_INFO();
                if (nLoginID > 0)
                {
                    ClientDemo clientForm = new ClientDemo();

                    foreach (Form form in  Application.OpenForms)
                    {
                        if (form.Name == "ClientDemo")
                        {
                            clientForm = (ClientDemo)form;
                            break;
                        }
                    }


                    TreeNode nodeDev = new TreeNode();
                    nodeDev.Text          = textBoxDevName.Text;
                    devInfo.szDevName     = textBoxDevName.Text;
                    devInfo.lLoginID      = nLoginID;
                    devInfo.nPort         = Int32.Parse(textBoxport.Text.Trim());
                    devInfo.szIpaddress   = textBoxIP.Text.Trim();
                    devInfo.szUserName    = textBoxUsername.Text;
                    devInfo.szPsw         = textBoxPassword.Text;
                    devInfo.NetDeviceInfo = dvrdevInfo;
                    //  nodeDev.Tag = nLoginID;
                    nodeDev.Tag  = devInfo;
                    nodeDev.Name = "Device";
                    for (int i = 0; i < devInfo.NetDeviceInfo.byChanNum + devInfo.NetDeviceInfo.iDigChannel; i++)
                    {
                        TreeNode nodeChannel = new TreeNode(string.Format("CAM{0}", i));
                        nodeChannel.Name = "Channel";
                        CHANNEL_INFO ChannelInfo = new CHANNEL_INFO();
                        ChannelInfo.nChannelNo = i;
                        ChannelInfo.nWndIndex  = -1;
                        nodeChannel.Tag        = ChannelInfo;
                        nodeDev.Nodes.Add(nodeChannel);
                    }

                    clientForm.devForm.DevTree.Nodes.Add(nodeDev);
                    ClientDemo.dictDevInfo.Add(devInfo.lLoginID, devInfo);
                    this.Close();
                }
                else
                {
                    string strErr;
                    switch (nError)
                    {
                    case -11301:
                        strErr = string.Format("Passwd is Error");
                        break;

                    case -11300:
                        strErr = string.Format("The user has no permissions");
                        break;

                    case -11302:
                        strErr = string.Format("The user does not exist");
                        break;

                    case -11303:
                        strErr = string.Format("The user is locked");
                        break;

                    case -11304:
                        strErr = string.Format("The user is in the blacklist");
                        break;

                    case -11305:
                        strErr = string.Format("The user has landed");
                        break;

                    case -11307:
                        strErr = string.Format("There is no equipment");
                        break;

                    default:
                    {
                        strErr = string.Format("Login Error:{0}", nError);
                    }
                    break;
                    }
                    MessageBox.Show(strErr);
                }
            }
            else
            {
                MessageBox.Show("Please input all data!");
            }
        }
Example #19
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (textBoxDevName.Text.Trim() != "" &&
                textBoxIP.Text.Trim() != "" &&
                textBoxport.Text.Trim() != "" &&
                textBoxUsername.Text.Trim() != "")
            {
                H264_DVR_DEVICEINFO dvrdevInfo = new H264_DVR_DEVICEINFO();
                int      nError;
                int      nLoginID = XMSDK.H264_DVR_Login(textBoxIP.Text.Trim(), ushort.Parse(textBoxport.Text.Trim()), textBoxUsername.Text, textBoxPassword.Text, out dvrdevInfo, out nError, SocketStyle.TCPSOCKET);
                DEV_INFO devInfo  = new DEV_INFO();
                if (nLoginID > 0)
                {
                    ClientDemo clientForm = new ClientDemo();

                    foreach (Form form in  Application.OpenForms)
                    {
                        if (form.Name == "ClientDemo")
                        {
                            clientForm = (ClientDemo)form;
                            break;
                        }
                    }


                    TreeNode nodeDev = new TreeNode();
                    nodeDev.Text          = textBoxDevName.Text;
                    devInfo.szDevName     = textBoxDevName.Text;
                    devInfo.lLoginID      = nLoginID;
                    devInfo.nPort         = Int32.Parse(textBoxport.Text.Trim());
                    devInfo.szIpaddress   = textBoxIP.Text.Trim();
                    devInfo.szUserName    = textBoxUsername.Text;
                    devInfo.szPsw         = textBoxPassword.Text;
                    devInfo.NetDeviceInfo = dvrdevInfo;
                    //  nodeDev.Tag = nLoginID;
                    nodeDev.Tag  = devInfo;
                    nodeDev.Name = "Device";
                    for (int i = 0; i < devInfo.NetDeviceInfo.byChanNum + devInfo.NetDeviceInfo.iDigChannel; i++)
                    {
                        TreeNode nodeChannel = new TreeNode(string.Format("CAM{0}", i));
                        nodeChannel.Name = "Channel";
                        CHANNEL_INFO ChannelInfo = new CHANNEL_INFO();
                        ChannelInfo.nChannelNo = i;
                        ChannelInfo.nWndIndex  = -1;
                        nodeChannel.Tag        = ChannelInfo;
                        nodeDev.Nodes.Add(nodeChannel);
                    }

                    clientForm.devForm.DevTree.Nodes.Add(nodeDev);
                    ClientDemo.dictDevInfo.Add(devInfo.lLoginID, devInfo);
                }
                else
                {
                }
                this.Close();
            }
            else
            {
                MessageBox.Show("Please input all data!");
            }
        }
Example #20
0
        private void SearchDevice()
        {
            int    nRetLength = 0;
            IntPtr ptr        = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SDK_CONFIG_NET_COMMON)) * 100);

            int bRet = H264_DVR_SearchDevice(ptr, Marshal.SizeOf(typeof(SDK_CONFIG_NET_COMMON)) * 100, ref nRetLength, 5000);


            for (int index = 0; index < 100; index++)
            {
                unsafe
                {
                    int *pDev = (int *)ptr.ToPointer();
                    pDev += Marshal.SizeOf(typeof(SDK_CONFIG_NET_COMMON)) * index / 4;

                    IntPtr ptrTemp = new IntPtr(pDev);
                    m_Device[index] = (SDK_CONFIG_NET_COMMON)Marshal.PtrToStructure(ptrTemp, typeof(SDK_CONFIG_NET_COMMON));
                }
            }

            if (bRet > 0 && nRetLength > 0)
            {
                this.m_nDevNum = nRetLength / Marshal.SizeOf(this.m_Device[0]);
            }


            searchThread.Interrupt();
            buttonSearch.Enabled = true;
            this.Cursor          = Cursors.Default;
            //m_PromptDlg.ShowMsg(false);

            int count = listViewDevSearched.Items.Count;
            int i     = 0;

            //check
            for (i = 0; i < count; i++)
            {
                string strIp;
                string strIp2;
                int    nPort;
                int    nPort2;
                strIp = string.Format("{0}.{1}.{2}.{3}", m_Device[i].HostIP.c[0], m_Device[i].HostIP.c[1], m_Device[i].HostIP.c[2], m_Device[i].HostIP.c[3]);
                nPort = m_Device[i].TCPPort;

                for (int j = i + 1; j < count; j++)
                {
                    strIp2 = string.Format("{0}.{1}.{2}.{3}", m_Device[j].HostIP.c[0], m_Device[j].HostIP.c[1],
                                           m_Device[j].HostIP.c[2], m_Device[j].HostIP.c[3]);
                    nPort2 = m_Device[j].TCPPort;

                    if (strIp2 == strIp && nPort2 == nPort)
                    {
                        // m_Device[j];
                    }
                }
            }

            int nIndex = 0;

            for (i = 0; i < m_nDevNum; i++)
            {
                int l = (m_Device[i].HostIP.c[0] << 3) | m_Device[i].HostIP.c[1] << 2 | m_Device[i].HostIP.c[2] << 1 | m_Device[i].HostIP.c[3];
                if (m_Device[i].TCPPort == 0 || l == 0)
                {
                    continue;
                }
                //Edit Device Information

                DEV_INFO pData = new DEV_INFO();
                pData.nPort       = m_Device[i].TCPPort;
                pData.szIpaddress = String.Format("{0}.{1}.{2}.{3}", m_Device[i].HostIP.c[0], m_Device[i].HostIP.c[1], m_Device[i].HostIP.c[2], m_Device[i].HostIP.c[3]);
                pData.szUserName  = "******";
                pData.szPsw       = "";
                pData.NetComm     = m_Device[i];

                //过滤已经存在的IP和mac相同的设备
                int nFlag = 1;


                if (nFlag == 0)
                {
                    //delete pData;
                    //pData = NULL;
                    continue;
                }
                else
                {
                    ListViewItem item = new ListViewItem();
                    ListViewItem.ListViewSubItem subitem0 = new ListViewItem.ListViewSubItem();
                    ListViewItem.ListViewSubItem subitem1 = new ListViewItem.ListViewSubItem();
                    ListViewItem.ListViewSubItem subitem2 = new ListViewItem.ListViewSubItem();

                    subitem0.Text = string.Format("{0}", count + nIndex + 1);
                    subitem0.Name = "NO";
                    subitem1.Text = string.Format("{0}.{1}.{2}.{3}", m_Device[i].HostIP.c[0], m_Device[i].HostIP.c[1], m_Device[i].HostIP.c[2], m_Device[i].HostIP.c[3]);
                    subitem1.Name = "IP";
                    subitem2.Text = string.Format("{0}", m_Device[i].TCPPort);
                    subitem2.Name = "Port";

                    item.SubItems.Insert(0, subitem0);
                    item.SubItems.Insert(1, subitem1);
                    item.SubItems.Insert(2, subitem2);

                    pData.nListNum = count + nIndex;
                    //m_mapDev[ nIndex ] = pData;

                    item.Tag = pData;
                    listViewDevSearched.Items.Insert(count + nIndex, item);

                    nIndex++;
                }
            }
            this.Capture = false;          //释放鼠标
        }
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if ( textBoxDevName.Text.Trim() != ""
                && textBoxIP.Text.Trim() != ""
                && textBoxport.Text.Trim() != ""
                && textBoxUsername.Text.Trim() != "")
            {
                H264_DVR_DEVICEINFO dvrdevInfo = new H264_DVR_DEVICEINFO();
                int nError;
                int nLoginID = XMSDK.H264_DVR_Login(textBoxIP.Text.Trim(), ushort.Parse(textBoxport.Text.Trim()), textBoxUsername.Text, textBoxPassword.Text, out dvrdevInfo, out nError, SocketStyle.TCPSOCKET);
                DEV_INFO devInfo = new DEV_INFO();
                if ( nLoginID > 0 )
                {
                    ClientDemo clientForm = new ClientDemo();

                    foreach( Form form in  Application.OpenForms)
                    {
                        if ( form.Name == "ClientDemo" )
                        {
                            clientForm = (ClientDemo)form;
                            break;
                        }
                    }

                    TreeNode nodeDev = new TreeNode();
                    nodeDev.Text = textBoxDevName.Text;
                    devInfo.szDevName = textBoxDevName.Text;
                    devInfo.lLoginID = nLoginID;
                    devInfo.nPort = Int32.Parse(textBoxport.Text.Trim());
                    devInfo.szIpaddress = textBoxIP.Text.Trim();
                    devInfo.szUserName = textBoxUsername.Text;
                    devInfo.szPsw = textBoxPassword.Text;
                    devInfo.NetDeviceInfo = dvrdevInfo;
                //  nodeDev.Tag = nLoginID;
                    nodeDev.Tag = devInfo;
                    nodeDev.Name = "Device";
                    for (int i = 0; i < devInfo.NetDeviceInfo.byChanNum + devInfo.NetDeviceInfo.iDigChannel; i++ )
                    {
                         TreeNode nodeChannel = new TreeNode(string.Format("CAM{0}",i));
                         nodeChannel.Name = "Channel";
                         CHANNEL_INFO ChannelInfo = new CHANNEL_INFO();
                         ChannelInfo.nChannelNo = i;
                         ChannelInfo.nWndIndex = -1;
                         nodeChannel.Tag = ChannelInfo;
                         nodeDev.Nodes.Add(nodeChannel);
                    }

                    clientForm.devForm.DevTree.Nodes.Add(nodeDev);
                    ClientDemo.dictDevInfo.Add(devInfo.lLoginID, devInfo);
                }
                else
                {

                }
                 this.Close();
            }
            else
            {
                MessageBox.Show("Please input all data!");
            }
        }
        bool StartTalk( ref DEV_INFO pDevice)
        {
            IntPtr pdev = new IntPtr();
            Marshal.StructureToPtr(pDevice, pdev, false);

            unsafe
            {
                if (pdev.ToPointer() == null)
                {
                    return false;
                }

                if (m_lTalkHandle.ToPointer() == null)
                {
                    return false;
                }
                else
                {
                    m_lTalkHandle = (IntPtr)XMSDK.H264_DVR_StartLocalVoiceCom(pDevice.lLoginID);
                    if (m_lTalkHandle!=(IntPtr)null)
                    {
                        return true;
                    }
                    else
                    {
                        m_lTalkHandle = (IntPtr)null; ;
                        return false;
                    }

                }

            }
        }
Example #23
0
        DEV_INFO ReadXML()
        {
            XmlReader xml     = XmlReader.Create("");
            DEV_INFO  devInfo = new DEV_INFO();

            devInfo.nPort    = 0;
            devInfo.lLoginID = 0;
            devInfo.lID      = 0;

            while (xml.ReadToFollowing("ip"))
            {
                //read the information from XML
                string strIP, strUserName, strPsw, strDevName;
                uint   nPort;
                int    byChanNum = 0, lID = 0;

                uint   bSerialID, nSerPort;
                string szSerIP, szSerialInfo;
                xml = xml.ReadSubtree();


                strIP = xml.ReadElementString("ip2");

                strDevName = xml.ReadElementString("DEVICENAME");

                strUserName = xml.ReadElementString("username");

                nPort = Convert.ToUInt32(xml.ReadElementString("port"));

                strPsw = xml.ReadElementString("pwd");

                byChanNum = Convert.ToInt32(xml.ReadElementString("byChanNum"));

                lID = Convert.ToInt32(xml.ReadElementString("lID"));


                bSerialID = Convert.ToUInt32(xml.ReadElementString("bSerialID"));

                szSerIP = xml.ReadElementString("szSerIP");

                nSerPort = Convert.ToUInt32(xml.ReadElementString("nSerPort"));

                szSerialInfo = xml.ReadElementString("szSerialInfo");      //新增ddns记录

                devInfo.nTotalChannel = byChanNum;
                devInfo.nPort         = (int)nPort;

                devInfo.bSerialID    = Convert.ToBoolean(bSerialID);
                devInfo.nSerPort     = (int)nSerPort;
                devInfo.szSerIP      = szSerIP;
                devInfo.szSerialInfo = szSerialInfo;      //新增ddns记录
                devInfo.szDevName    = strDevName;
                devInfo.szUserName   = strUserName;
                devInfo.szPsw        = strPsw;
                devInfo.szIpaddress  = strIP;
                DEV_INFO pDev = new DEV_INFO();
                pDev = devInfo;
                IntPtr ptr = new IntPtr();
                Marshal.StructureToPtr(pDev, ptr, false);
                pDev.lID           = ptr.ToInt32();
                m_devMap[pDev.lID] = pDev;
                String   strName;
                TreeNode node = new  TreeNode();
                node.Text = strDevName;
                for (int i = 0; i < byChanNum; i++)
                {
                    strName = String.Format("CAM {0}", i + 1);
                    node.Nodes.Add(strName);
                }
                DevTree.Nodes.Add(node);
            }
            return(devInfo);
        }
 bool StopTalk( ref DEV_INFO pDevice)
 {
     unsafe
     {
         if (m_lTalkHandle.ToPointer() != null)
         {
             XMSDK.H264_DVR_StopVoiceCom(m_lTalkHandle.ToInt32());
             m_lTalkHandle = (IntPtr)null;
             return true;
         }
         return false;
     }
 }
Example #25
0
 //public Dictionary<int,DEV_INFO> GetDeviceMap()
 //{
 //    return m_devDLg.GetDeviceMap();
 //}
 public void SetDevInfo(ref DEV_INFO pDev)
 {
     m_devInfo = pDev;
 }
        DEV_INFO ReadXML()
        {
            XmlReader xml = XmlReader.Create("");
            DEV_INFO devInfo = new DEV_INFO();

            devInfo.nPort=0;
            devInfo.lLoginID=0;
            devInfo.lID=0;

            while(xml.ReadToFollowing("ip"))
            {
                //read the information from XML
                string strIP,strUserName,strPsw,strDevName;
                uint nPort;
                int byChanNum=0,lID=0;

                uint bSerialID,nSerPort;
                string szSerIP,szSerialInfo;
                xml = xml.ReadSubtree();

                strIP=xml.ReadElementString("ip2");

                strDevName= xml.ReadElementString("DEVICENAME");

                strUserName=xml.ReadElementString("username");

                nPort= Convert.ToUInt32(xml.ReadElementString("port"));

                strPsw=xml.ReadElementString("pwd");

                byChanNum= Convert.ToInt32(xml.ReadElementString("byChanNum"));

                lID= Convert.ToInt32(xml.ReadElementString("lID"));

                bSerialID= Convert.ToUInt32(xml.ReadElementString("bSerialID"));

                szSerIP=xml.ReadElementString("szSerIP");

                nSerPort=Convert.ToUInt32(xml.ReadElementString("nSerPort"));

                szSerialInfo=xml.ReadElementString("szSerialInfo");//����ddns��¼

                devInfo.nTotalChannel =byChanNum;
                devInfo.nPort = (int)nPort;

                devInfo.bSerialID=Convert.ToBoolean(bSerialID);
                devInfo.nSerPort=(int)nSerPort;
                devInfo.szSerIP=szSerIP;
                devInfo.szSerialInfo=szSerialInfo;//����ddns��¼
                devInfo.szDevName=strDevName;
                devInfo.szUserName=strUserName;
                devInfo.szPsw=strPsw;
                devInfo.szIpaddress= strIP;
                DEV_INFO pDev = new DEV_INFO();
                pDev = devInfo;
                IntPtr ptr = new IntPtr();
                Marshal.StructureToPtr(pDev,ptr,false);
                pDev.lID =ptr.ToInt32();
                m_devMap[pDev.lID] = pDev;
                String strName;
                TreeNode node = new  TreeNode();
                node.Text = strDevName;
                for ( int i = 0; i < byChanNum; i ++)
                {
                    strName= String.Format("CAM {0}", i+1);
                    node.Nodes.Add(strName);
                }
                DevTree.Nodes.Add(node);
            }
            return devInfo;
        }
        public int Connect(ref DEV_INFO pDev, int nChannel, int nWndIndex)
        {
            int nRet = 0;

            //if device did not login,login first
            if (pDev.lLoginID <= 0)
            {
                H264_DVR_DEVICEINFO OutDev;
                int nError = 0;
                //���ó��������豸�����͵ȴ�ʱ��
                int lLogin = XMSDK.H264_DVR_Login(pDev.szIpaddress, (ushort)pDev.nPort, pDev.szUserName, pDev.szPsw, out OutDev, out nError, SocketStyle.TCPSOCKET);
                if (lLogin <= 0)
                {

                    int nErr = XMSDK.H264_DVR_GetLastError();
                    if (nErr == (int)SDK_RET_CODE.H264_DVR_PASSWORD_NOT_VALID)
                    {
                        MessageBox.Show(("Error.PwdErr"));
                    }
                    else
                    {
                        MessageBox.Show(("Error.NotFound"));
                    }

                    return nRet;
                }

                pDev.lLoginID = lLogin;
                XMSDK.H264_DVR_SetupAlarmChan(lLogin);
            }

            int nWnd = m_nCurIndex;
            if (nWndIndex >= 0)
            {
                nWnd = nWndIndex;
            }

            if (nWnd >= m_nTotalWnd)
            {
                return nRet;
            }

            return m_videoform[nWnd].ConnectRealPlay(ref pDev, nChannel);
        }
        private void SearchDevice()
        {
            int nRetLength = 0;
            IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SDK_CONFIG_NET_COMMON)) * 100);

            int bRet = H264_DVR_SearchDevice(ptr , Marshal.SizeOf(typeof(SDK_CONFIG_NET_COMMON)) * 100, ref nRetLength, 5000);

            for (int index = 0; index < 100; index++)
            {
                unsafe
                {
                    int* pDev = (int*)ptr.ToPointer();
                    pDev += Marshal.SizeOf(typeof(SDK_CONFIG_NET_COMMON)) * index / 4;

                    IntPtr ptrTemp = new IntPtr(pDev);
                    m_Device[index] = (SDK_CONFIG_NET_COMMON)Marshal.PtrToStructure(ptrTemp, typeof(SDK_CONFIG_NET_COMMON));
                }

            }

            if ( bRet > 0 && nRetLength > 0 )
            {
                this.m_nDevNum = nRetLength / Marshal.SizeOf(this.m_Device[0]);
            }

            searchThread.Interrupt();
            buttonSearch.Enabled = true;
            this.Cursor = Cursors.Default;
            //m_PromptDlg.ShowMsg(false);

            int count = listViewDevSearched.Items.Count;
            int i = 0;
            //check
            for ( i = 0; i < count; i ++ )
            {
                string strIp;
                string strIp2;
                int nPort;
                int nPort2;
                strIp = string.Format("{0}.{1}.{2}.{3}", m_Device[i].HostIP.c[0], m_Device[i].HostIP.c[1],m_Device[i].HostIP.c[2], m_Device[i].HostIP.c[3]);
                nPort=m_Device[i].TCPPort;

                for ( int j = i + 1; j < count; j ++ )
                {
                    strIp2 = string.Format("{0}.{1}.{2}.{3}", m_Device[j].HostIP.c[0], m_Device[j].HostIP.c[1],
                        m_Device[j].HostIP.c[2], m_Device[j].HostIP.c[3]);
                    nPort2 = m_Device[j].TCPPort;

                    if ( strIp2 == strIp && nPort2 == nPort )
                    {
                       // m_Device[j];
                    }
                }
            }

            int nIndex = 0;
            for (i = 0 ; i < m_nDevNum; i ++ )
            {
                int l = (m_Device[i].HostIP.c[0] << 3) | m_Device[i].HostIP.c[1]<<2 | m_Device[i].HostIP.c[2]<<1|m_Device[i].HostIP.c[3];
                if ( m_Device[i].TCPPort == 0 || l == 0 )
                {
                    continue;
                }
                //Edit Device Information

                DEV_INFO pData = new DEV_INFO();
                pData.nPort = m_Device[i].TCPPort;
                pData.szIpaddress = String.Format("{0}.{1}.{2}.{3}", m_Device[i].HostIP.c[0], m_Device[i].HostIP.c[1],m_Device[i].HostIP.c[2], m_Device[i].HostIP.c[3]);
                pData.szUserName = "******";
                pData.szPsw = "";
                pData.NetComm =m_Device[i];

                //�����Ѿ����ڵ�IP��mac��ͬ���豸
                int nFlag = 1;

                if ( nFlag==0 )
                {
                    //delete pData;
                    //pData = NULL;
                    continue;
                }else
                {

                    ListViewItem item = new ListViewItem();
                    ListViewItem.ListViewSubItem subitem0= new ListViewItem.ListViewSubItem();
                    ListViewItem.ListViewSubItem subitem1 = new ListViewItem.ListViewSubItem();
                    ListViewItem.ListViewSubItem subitem2 = new ListViewItem.ListViewSubItem();

                    subitem0.Text = string.Format("{0}", count + nIndex + 1);
                    subitem0.Name = "NO";
                    subitem1.Text = string.Format("{0}.{1}.{2}.{3}", m_Device[i].HostIP.c[0], m_Device[i].HostIP.c[1], m_Device[i].HostIP.c[2], m_Device[i].HostIP.c[3]);
                    subitem1.Name = "IP";
                    subitem2.Text = string.Format("{0}", m_Device[i].TCPPort);
                    subitem2.Name = "Port";

                    item.SubItems.Insert(0, subitem0);
                    item.SubItems.Insert(1, subitem1);
                    item.SubItems.Insert(2, subitem2);

                    pData.nListNum = count + nIndex;
                    //m_mapDev[ nIndex ] = pData;

                    item.Tag = pData;
                    listViewDevSearched.Items.Insert(count + nIndex,item);

                    nIndex ++;

                }
            }
            this.Capture = false;  //�ͷ����
        }
 //public Dictionary<int,DEV_INFO> GetDeviceMap()
 //{
 //    return m_devDLg.GetDeviceMap();
 //}
 public void SetDevInfo(ref DEV_INFO pDev)
 {
     m_devInfo = pDev;
 }
        private void comboDev_SelectedIndexChanged(object sender, EventArgs e)
        {
            DEV_INFO devInfo = new DEV_INFO();
            ComboxItem selecteditem = (ComboxItem)comboDev.SelectedItem;

            devInfo = (DEV_INFO)selecteditem.Value;

            for (int i = 0; i < devInfo.NetDeviceInfo.byChanNum + devInfo.NetDeviceInfo.iDigChannel; i++)
            {
                comboChannel.Items.Add(i + 1);
            }
            comboChannel.SelectedIndex = 0;
            m_lLoginID = devInfo.lLoginID;
        }