Beispiel #1
0
        public void saveBaseNetworkInfo(NETDEV_NETWORKCFG_S stNetworkSetcfg)
        {
            int iRet = NETDEVSDK.NETDEV_SetDevConfig(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_lpDevHandle, m_oNetDemo.m_curSelectedTreeChannelIndex + 1, (int)NETDEV_CONFIG_COMMAND_E.NETDEV_SET_NETWORKCFG, ref stNetworkSetcfg, Marshal.SizeOf(stNetworkSetcfg));

            if (NETDEVSDK.TRUE != iRet)
            {
                m_oNetDemo.showFailLogInfo(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_oNetDemo.m_curSelectedTreeChannelIndex + 1), "Save network cfg", NETDEVSDK.NETDEV_GetLastError());
                return;
            }
            m_oNetDemo.showSuccessLogInfo(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_oNetDemo.m_curSelectedTreeChannelIndex + 1), "Save network cfg");

            m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_channelInfoList[m_oNetDemo.m_curSelectedTreeChannelIndex].m_networkInfo.stNetWorkIP = stNetworkSetcfg;
        }
Beispiel #2
0
        public void refreshNetworkInfo()
        {
            /* Get Network Config */
            NETDEV_NETWORKCFG_S stNetworkcfg = new NETDEV_NETWORKCFG_S();

            Int32 dwBytesReturned = 0;
            int   iRet            = NETDEVSDK.NETDEV_GetDevConfig(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_lpDevHandle, m_oNetDemo.m_curSelectedTreeChannelIndex + 1, (int)NETDEV_CONFIG_COMMAND_E.NETDEV_GET_NETWORKCFG, ref stNetworkcfg, Marshal.SizeOf(stNetworkcfg), ref dwBytesReturned);

            if (NETDEVSDK.TRUE != iRet)
            {
                m_oNetDemo.showFailLogInfo(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_oNetDemo.m_curSelectedTreeChannelIndex + 1), "Get network cfg", NETDEVSDK.NETDEV_GetLastError());
                return;
            }
            m_oNetDemo.showSuccessLogInfo(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_oNetDemo.m_curSelectedTreeChannelIndex + 1), "Get network cfg");

            m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_channelInfoList[m_oNetDemo.m_curSelectedTreeChannelIndex].m_networkInfo.stNetWorkIP = stNetworkcfg;
            m_oNetDemo.showBaseNetworkInfo(stNetworkcfg);

            /* Get protocal port */
            NETDEV_UPNP_NAT_STATE_S stNatState = new NETDEV_UPNP_NAT_STATE_S();

            iRet = NETDEVSDK.NETDEV_GetUpnpNatState(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_lpDevHandle, ref stNatState);
            if (NETDEVSDK.TRUE != iRet)
            {
                m_oNetDemo.showFailLogInfo(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_oNetDemo.m_curSelectedTreeChannelIndex + 1), "Get upnp nat state", NETDEVSDK.NETDEV_GetLastError());
                return;
            }
            m_oNetDemo.showSuccessLogInfo(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_oNetDemo.m_curSelectedTreeChannelIndex + 1), "Get upnp nat state");

            m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_channelInfoList[m_oNetDemo.m_curSelectedTreeChannelIndex].m_networkInfo.stNetWorkPort = stNatState;
            m_oNetDemo.showPortNetworkInfo(stNatState);

            /* Get NTP config */
            NETDEV_SYSTEM_NTP_INFO_S stNTPInfo = new NETDEV_SYSTEM_NTP_INFO_S();

            /* Failed to return Get information when NTP is not enabled for the NVR. Please perform Set operation first. */
            iRet = NETDEVSDK.NETDEV_GetDevConfig(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_lpDevHandle, m_oNetDemo.m_curSelectedTreeChannelIndex + 1, (int)NETDEV_CONFIG_COMMAND_E.NETDEV_GET_NTPCFG, ref stNTPInfo, Marshal.SizeOf(stNTPInfo), ref dwBytesReturned);
            if (NETDEVSDK.TRUE != iRet)
            {
                m_oNetDemo.showFailLogInfo(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_oNetDemo.m_curSelectedTreeChannelIndex + 1), "Get NTP cfg", NETDEVSDK.NETDEV_GetLastError());
                return;
            }
            m_oNetDemo.showSuccessLogInfo(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_oNetDemo.m_curSelectedTreeChannelIndex + 1), "Get NTP cfg");

            m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_channelInfoList[m_oNetDemo.m_curSelectedTreeChannelIndex].m_networkInfo.stNetWorkNTP = stNTPInfo;
            m_oNetDemo.showNTPNetworkInfo(stNTPInfo);

            m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_channelInfoList[m_oNetDemo.m_curSelectedTreeChannelIndex].m_networkInfo.existFlag = true;
        }