Example #1
0
        /// <summary>
        /// 获取设备时间
        /// </summary>
        /// <param name="_LoginID"></param>
        /// <returns></returns>
        public DateTime GetDVRTime(IntPtr _LoginID)
        {
            NET_TIME time     = new NET_TIME();
            uint     ret      = 0;
            IntPtr   inPtr    = IntPtr.Zero;
            DateTime datatime = DateTime.Today;

            try
            {
                inPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_TIME)));
                Marshal.StructureToPtr(time, inPtr, true);
                bool result = NETClient.GetDevConfig(_LoginID, EM_DEV_CFG_TYPE.TIMECFG, -1, inPtr, (uint)Marshal.SizeOf(typeof(NET_TIME)), ref ret, 5000);
                if (result && ret == (uint)Marshal.SizeOf(typeof(NET_TIME)))
                {
                    time     = (NET_TIME)Marshal.PtrToStructure(inPtr, typeof(NET_TIME));
                    datatime = time.ToDateTime();
                }

                return(datatime);
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                Marshal.FreeHGlobal(inPtr);
            }
        }
Example #2
0
        /// <summary>
        /// 手动设定与服务器时间同步
        /// </summary>
        /// <param name="_LoginID"></param>
        /// <returns></returns>
        public bool SetDVRTime(IntPtr _LoginID, DateTime nowtime)
        {
            NET_TIME time;

            time = NET_TIME.FromDateTime(nowtime);
            IntPtr inPtr = IntPtr.Zero;

            try
            {
                inPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_TIME)));
                Marshal.StructureToPtr(time, inPtr, true);
                bool result = NETClient.SetDevConfig(_LoginID, EM_DEV_CFG_TYPE.TIMECFG, -1, inPtr, (uint)Marshal.SizeOf(typeof(NET_TIME)), 5000);
                return(result);
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                Marshal.FreeHGlobal(inPtr);
            }
        }
Example #3
0
 private static extern Int32 CLIENT_SetupDeviceTime(int lLoginID, ref NET_TIME pDeviceTime);
Example #4
0
 private static extern bool CLIENT_QueryRecordFile(int lLoginID, int nChannelId, int nRecordFileType, ref NET_TIME tmStart,ref NET_TIME tmEnd, string pchCardid, ref NET_RECORDFILE_INFO nriFileinfo, int maxlen, ref  int filecount, int waittime, bool bTime);
Example #5
0
 private static extern int CLIENT_PlayBackByTimeEx(int lLoginID, int nChannelID, ref NET_TIME lpStartTime,
                                                   ref NET_TIME lpStopTime, IntPtr hWnd,
                                                   fDownLoadPosCallBack cbDownLoadPos, int dwPosUser,
                                                   fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser);
Example #6
0
 /// <summary>
 ///  get DVD time
 /// </summary>
 /// <param name="lLoginID">Equipment user Login ID: CLIENT Login return values</param>
 /// <param name="dvrTime">time parameters</param>
 /// <param name="waittime">waitime</param>
 /// <returns>true:succeed;false:fail</returns>
 public static bool NETGetDevConfig(int lLoginID, ref NET_TIME dvrTime, int waittime)
 {
     object result = new object();
     bool returnValue = false;
     returnValue = PGetDevConfig(lLoginID, -1, CONFIG_COMMAND.NET_DEV_TIMECFG, ref result, typeof(NET_TIME), waittime);
     dvrTime = (NET_TIME)result;
     return returnValue;
 }
Example #7
0
 public static extern bool CLIENT_GetPlayBackOsdTime(IntPtr lPlayHandle, ref NET_TIME lpOsdTime, ref NET_TIME lpStartTime, ref NET_TIME lpEndTime);
Example #8
0
 public static extern bool CLIENT_SetupDeviceTime(IntPtr lLoginID, ref NET_TIME pDeviceTime);
Example #9
0
 private static extern bool CLIENT_QueryDeviceTime(int lLoginID, out NET_TIME pDeviceTime, int waittime = 1000);
Example #10
0
 private static extern bool CLIENT_GetPlayBackOsdTime(int lPlayHandle, out NET_TIME lpOsdTime, out NET_TIME lpStartTime, out NET_TIME lpEndTime);
Example #11
0
 /// <summary>
 /// Set the DVR time [the default wait time 3000]
 /// </summary>
 /// <param name="lLoginID">quipment user Login ID: CLIENT Login return values</param>
 /// <param name="dvrTime">time parameters</param>
 /// <returns>true:succeed;false:fail</returns>
 public static bool NETSetDevConfig(int lLoginID, NET_TIME dvrTime)
 {
     return NETSetDevConfig(lLoginID, dvrTime, 3000);
 }
Example #12
0
 /// <summary>
 /// set DVR time
 /// </summary>
 /// <param name="lLoginID">Equipment user Login ID: CLIENT Login return values</param>
 /// <param name="dvrTime">time parameters</param>
 /// <param name="waittime">waittime</param>
 /// <returns>true:succeed;false:fail</returns>
 public static bool NETSetDevConfig(int lLoginID,NET_TIME dvrTime, int waittime)
 {
     bool returnValue = false;
     returnValue = PSetDevConfig(lLoginID, -1, CONFIG_COMMAND.NET_DEV_TIMECFG, (object)dvrTime, typeof(NET_TIME), waittime);
     return returnValue;
 }
Example #13
0
 /// <summary>
 /// Query Device`s current Time
 /// </summary>
 /// <param name="lLoginID">Device handles user login</param>
 /// <param name="tmDevTime">Device time</param>
 /// <param name="waittime">Waiting Time</param>
 /// <returns>true:success;false:failure</returns>
 public static bool NETQueryDeviceTime(Int32 lLoginID, ref DateTime tmDevTime, int waittime)
 {
     bool returnValue = false;
     NET_TIME netQueryTime = new NET_TIME();
     returnValue = CLIENT_QueryDeviceTime(lLoginID, out netQueryTime, waittime);
     if (returnValue)
     {
         tmDevTime = ToDateTime(netQueryTime);
     }
     NETThrowLastError();
     return returnValue;
 }
Example #14
0
 /// <summary>
 /// Playback playback controls:Change position [i.e. drag,Only parameter function effectively hWnd parameter of the function of the image acquired before the effective opening,Otherwise meaningless]
 /// </summary>
 /// <param name="lPlayHandle">Play handle</param>
 /// <param name="pPlayCommand">Play command:SeekByBit,SeekByTime</param>
 /// <param name="offset">SeekByTime:Offset relative to the beginning of time to file,Seconds;SeekByBit:Byte offset relative to the beginning of the file;</param>
 /// <returns>true:success;false:failure</returns>
 public static bool NETGetPlayBackOsdTime(int lPlayHandle, ref DateTime tmOsdTime, ref DateTime tmStartTime, ref DateTime tmEndTime)
 {
     bool returnValue = false;
     NET_TIME lpOsdTime = new NET_TIME();
     NET_TIME lpStartTime = new NET_TIME();
     NET_TIME lpEndTime = new NET_TIME();
     returnValue = CLIENT_GetPlayBackOsdTime(lPlayHandle, out lpOsdTime, out lpStartTime, out lpEndTime);
     if (true == returnValue)
     {
         tmOsdTime = ToDateTime(lpOsdTime);
         tmStartTime = ToDateTime(lpStartTime);
         tmEndTime = ToDateTime(lpEndTime);
     }
     NETThrowLastError(returnValue);
     return returnValue;
 }
Example #15
0
 /// <summary>
 /// Windows system standard time format to a custom format
 /// </summary>
 /// <param name="dateTime">system time object</param>
 /// <returns>The time of the custom format data</returns>
 private static NET_TIME ToNetTime(DateTime dateTime)
 {
     NET_TIME result = new NET_TIME();
     result.dwYear = dateTime.Year;
     result.dwMonth = dateTime.Month;
     result.dwDay = dateTime.Day;
     result.dwHour = dateTime.Hour;
     result.dwMinute = dateTime.Minute;
     result.dwSecond = dateTime.Second;
     return result;
 }
Example #16
0
 private static extern bool CLIENT_SetupDeviceTime(Int32 lLoginID, ref NET_TIME pDeviceTime);
Example #17
0
 /// <summary>
 /// a custom format to WindowsSystem standard time format
 /// </summary>
 /// <param name="netTime">custom format time</param>
 /// <returns>System Time Object</returns>
 private static DateTime ToDateTime(NET_TIME netTime)
 {
     try
     {
         return new DateTime(netTime.dwYear, netTime.dwMonth, netTime.dwDay,
              netTime.dwHour, netTime.dwMinute, netTime.dwSecond);
     }
     catch
     {
         return DateTime.Now;
     }
 }
Example #18
0
 public static extern bool CLIENT_QueryDeviceTime(IntPtr lLoginID, ref NET_TIME pDeviceTime, int waittime);
Example #19
0
 private static extern int CLIENT_DownloadByTime(int lLoginID, int nChannelId, int nRecordFileType,
                                                 ref NET_TIME tmStart,
                                                 ref NET_TIME tmEnd, string sSavedFileName,
                                                 fTimeDownLoadPosCallBack cbTimeDownLoadPos, IntPtr dwUserData);
Example #20
0
 public static extern bool CLIENT_QueryRecordFile(IntPtr lLoginID, int nChannelId, int nRecordFileType, ref NET_TIME tmStart, ref NET_TIME tmEnd, string pchCardid, IntPtr nriFileinfo, int maxlen, ref int filecount, int waittime, bool bTime);
Example #21
0
 private static extern int CLIENT_PlayBackByTime(int lLoginID, int nChannelID, ref NET_TIME lpStartTime,
                                                 ref NET_TIME lpStopTime, IntPtr hWnd,
                                                 fDownLoadPosCallBack cbDownLoadPos,
                                                 IntPtr dwUserData);
Example #22
0
 public static extern IntPtr CLIENT_DownloadByTimeEx(IntPtr lLoginID, int nChannelId, int nRecordFileType, ref NET_TIME tmStart, ref NET_TIME tmEnd, string sSavedFileName,
                                                     fTimeDownLoadPosCallBack cbTimeDownLoadPos, IntPtr dwUserData,
                                                     fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser, IntPtr pReserved);
Example #23
0
 /// <summary>
 ///  获取DVR时间[默认等待时间3000]
 /// </summary>
 /// <param name="lLoginID">设备用户登录ID:CLIENT_Login的返回值</param>
 /// <param name="dvrTime">时间参数</param>
 /// <returns>true:成功;false:失败</returns>
 public static bool DHGetDevConfig(int lLoginID, ref NET_TIME dvrTime)
 {
     return DHGetDevConfig(lLoginID, ref dvrTime, 3000);
 }