Пример #1
0
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (m_oNetDemo.getChannelID() == -1)
            {
                return;
            }

            int    dwChannelID = m_oNetDemo.getChannelID();
            IntPtr lpHandle    = m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_lpDevHandle;


            if (IntPtr.Zero == lpHandle)
            {
                MessageBox.Show("Device Handle is 0 ", "warning");
                return;
            }

            String szPresetName;

            Int32 lPresetID = -1;

            try
            {
                lPresetID = Convert.ToInt32(this.presetIDText.Text);
            }
            catch (FormatException)
            {
                return;
            }

            szPresetName = this.presetNameText.Text;

            if (0 >= lPresetID || lPresetID > NETDEVSDK.NETDEV_MAX_PRESET_NUM)
            {
                MessageBox.Show("Preset ID invalid.", "warning");
                return;
            }

            byte[] byPresetName;
            GetUTF8Buffer(szPresetName, NETDEVSDK.NETDEV_LEN_32, out byPresetName);

            int bRet = NETDEVSDK.NETDEV_PTZPreset_Other(lpHandle, dwChannelID, (int)NETDEV_PTZ_PRESETCMD_E.NETDEV_PTZ_SET_PRESET, byPresetName, lPresetID);

            if (NETDEVSDK.TRUE != bRet)
            {
                m_oNetDemo.showFailLogInfo(m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Set preset", NETDEVSDK.NETDEV_GetLastError());
            }
            else
            {
                m_oNetDemo.showSuccessLogInfo(m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Set preset");

                m_oNetDemo.presetGetBtn_Click(null, null);
                this.Close();
            }
        }
Пример #2
0
        public void refreshBasicInfo()
        {
            /* Get Device System time */
            NETDEV_TIME_CFG_S stTimeCfg = new NETDEV_TIME_CFG_S();
            int iRet = NETDEVSDK.NETDEV_GetSystemTimeCfg(m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_lpDevHandle, ref stTimeCfg);

            if (NETDEVSDK.TRUE != iRet)
            {
                m_oNetDemo.showFailLogInfo(m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Get device system time", NETDEVSDK.NETDEV_GetLastError());
                return;
            }
            else
            {
                m_oNetDemo.showSuccessLogInfo(m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Get device system time");
                m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_channelInfoList[m_oNetDemo.getChannelIndex()].m_basicInfo.stSystemTime = stTimeCfg;
            }

            m_oNetDemo.showSystemTime(stTimeCfg);

            /* Get Device name */
            NETDEV_DEVICE_BASICINFO_S stDeviceInfo = new NETDEV_DEVICE_BASICINFO_S();
            Int32 dwBytesReturned = 0;

            iRet = NETDEVSDK.NETDEV_GetDevConfig(m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_lpDevHandle, m_oNetDemo.getChannelID(), (int)NETDEV_CONFIG_COMMAND_E.NETDEV_GET_DEVICECFG, ref stDeviceInfo, Marshal.SizeOf(stDeviceInfo), ref dwBytesReturned);
            if (NETDEVSDK.TRUE != iRet)
            {
                m_oNetDemo.showFailLogInfo(m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Get device name", NETDEVSDK.NETDEV_GetLastError());
                return;
            }

            m_oNetDemo.showSuccessLogInfo(m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Get device name");

            string strDevName = GetDefaultString(stDeviceInfo.szDeviceName);

            m_oNetDemo.showDeviceName(strDevName);
            m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_channelInfoList[m_oNetDemo.getChannelIndex()].m_basicInfo.szDeviceName = strDevName;

            /* Get disk info */
            NETDEV_DISK_INFO_LIST_S stDiskInfoList = new NETDEV_DISK_INFO_LIST_S();

            iRet = NETDEVSDK.NETDEV_GetDevConfig(m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_lpDevHandle, m_oNetDemo.getChannelID(), (int)NETDEV_CONFIG_COMMAND_E.NETDEV_GET_DISKSINFO, ref stDiskInfoList, Marshal.SizeOf(stDiskInfoList), ref dwBytesReturned);
            if (NETDEVSDK.TRUE != iRet)
            {
                m_oNetDemo.showFailLogInfo(m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Get disk info", NETDEVSDK.NETDEV_GetLastError());
                return;
            }

            m_oNetDemo.showSuccessLogInfo(m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Get disk info");

            m_oNetDemo.showDiskInfoList(stDiskInfoList);
            m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_channelInfoList[m_oNetDemo.getChannelIndex()].m_basicInfo.stDiskInfoList = stDiskInfoList;

            m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_channelInfoList[m_oNetDemo.getChannelIndex()].m_basicInfo.existFlag = true;
        }