public void saveStstemTime(int timeZone, string Date, String time) { /* Save system time */ NETDEV_TIME_CFG_S stTimeCfg = new NETDEV_TIME_CFG_S(); stTimeCfg.stTime.dwYear = Convert.ToInt32(Date.Split('/')[0]); stTimeCfg.stTime.dwMonth = Convert.ToInt32(Date.Split('/')[1]); stTimeCfg.stTime.dwDay = Convert.ToInt32(Date.Split('/')[2]); stTimeCfg.stTime.dwHour = Convert.ToInt32(time.Split(':')[0]); stTimeCfg.stTime.dwMinute = Convert.ToInt32(time.Split(':')[1]); stTimeCfg.stTime.dwSecond = Convert.ToInt32(time.Split(':')[2]); stTimeCfg.dwTimeZone = (NETDEV_TIME_ZONE_E)timeZone; int iRet = NETDEVSDK.NETDEV_SetSystemTimeCfg(m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_lpDevHandle, ref stTimeCfg); if (NETDEVSDK.TRUE != iRet) { m_oNetDemo.showFailLogInfo(m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_oNetDemo.m_curSelectedTreeChannelIndex + 1), "Save device system time", NETDEVSDK.NETDEV_GetLastError()); return; } m_oNetDemo.showSuccessLogInfo(m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_oNetDemo.m_curSelectedTreeChannelIndex + 1), "Save device system time"); m_deviceInfoList[m_oNetDemo.m_curSelectedTreeDeviceIndex].m_channelInfoList[m_oNetDemo.m_curSelectedTreeChannelIndex].m_basicInfo.stSystemTime = stTimeCfg; }
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; }
public void saveStstemTime(int timeZone, string Date, String time) { int dwDeviceIndex = m_oNetDemo.getDeviceIndex(); if (dwDeviceIndex < 0) { return; } /* Save system time */ NETDEV_TIME_CFG_S stTimeCfg = new NETDEV_TIME_CFG_S(); stTimeCfg.stTime.dwYear = Convert.ToInt32(Date.Split('/')[0]); stTimeCfg.stTime.dwMonth = Convert.ToInt32(Date.Split('/')[1]); stTimeCfg.stTime.dwDay = Convert.ToInt32(Date.Split('/')[2]); stTimeCfg.stTime.dwHour = Convert.ToInt32(time.Split(':')[0]); stTimeCfg.stTime.dwMinute = Convert.ToInt32(time.Split(':')[1]); stTimeCfg.stTime.dwSecond = Convert.ToInt32(time.Split(':')[2]); stTimeCfg.dwTimeZone = (NETDEV_TIME_ZONE_E)timeZone; int iRet = NETDEVSDK.NETDEV_SetSystemTimeCfg(m_deviceInfoList[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_lpDevHandle, ref stTimeCfg); if (NETDEVSDK.TRUE != iRet) { m_oNetDemo.showFailLogInfo(m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Save device system time", NETDEVSDK.NETDEV_GetLastError()); return; } m_oNetDemo.showSuccessLogInfo(m_oNetDemo.getDeviceInfoList()[m_oNetDemo.m_CurSelectTreeNodeInfo.dwDeviceIndex].m_ip + " chl:" + (m_oNetDemo.getChannelID()), "Save device system time"); if (NETDEMO.NETDEMO_DEVICE_TYPE_E.NETDEMO_DEVICE_VMS == m_deviceInfoList[dwDeviceIndex].m_eDeviceType) { m_deviceInfoList[dwDeviceIndex].stVmsDevInfo.stSystemTime = stTimeCfg; } else { m_deviceInfoList[dwDeviceIndex].m_channelInfoList[m_oNetDemo.getChannelIndex()].m_basicInfo.stSystemTime = stTimeCfg; } }