コード例 #1
0
ファイル: Program.cs プロジェクト: lukazikus/mmc
 /// <summary>Prints a set of smc errors to the console in a user-friendly format.</summary>
 /// <param name="errors">The errors to print.</param>
 /// <param name="description">The description of this set of errors.</param>
 private static void printErrors(SmcError errors, string description)
 {
     if (errors == 0)
     {
         Console.WriteLine(description + ": None");
     }
     else
     {
         Console.WriteLine(description + ":");
         if (0 != (errors & SmcError.SafeStart))
         {
             Console.WriteLine("  Safe start violation");
         }
         if (0 != (errors & SmcError.ChannelInvalid))
         {
             Console.WriteLine("  Required channel invalid");
         }
         if (0 != (errors & SmcError.Serial))
         {
             Console.WriteLine("  Serial error");
         }
         if (0 != (errors & SmcError.CommandTimeout))
         {
             Console.WriteLine("  Command timeout");
         }
         if (0 != (errors & SmcError.LimitSwitch))
         {
             Console.WriteLine("  Limit/kill switch active");
         }
         if (0 != (errors & SmcError.VinLow))
         {
             Console.WriteLine("  Low VIN");
         }
         if (0 != (errors & SmcError.VinHigh))
         {
             Console.WriteLine("  High VIN");
         }
         if (0 != (errors & SmcError.TemperatureHigh))
         {
             Console.WriteLine("  Over temperature");
         }
         if (0 != (errors & SmcError.MotorDriverError))
         {
             Console.WriteLine("  Motor driver error");
         }
         if (0 != (errors & SmcError.ErrLineHigh))
         {
             Console.WriteLine("  ERR line high");
         }
     }
     Console.WriteLine();
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: Moomers/penguins
 /// <summary>Prints a set of smc errors to the console in a user-friendly format.</summary>
 /// <param name="errors">The errors to print.</param>
 /// <param name="description">The description of this set of errors.</param>
 private static void printErrors(SmcError errors, string description)
 {
     if (errors == 0)
     {
         Console.WriteLine(description + ": None");
     }
     else
     {
         Console.WriteLine(description + ":");
         if (0 != (errors & SmcError.SafeStart)) Console.WriteLine("  Safe start violation");
         if (0 != (errors & SmcError.ChannelInvalid)) Console.WriteLine("  Required channel invalid");
         if (0 != (errors & SmcError.Serial)) Console.WriteLine("  Serial error");
         if (0 != (errors & SmcError.CommandTimeout)) Console.WriteLine("  Command timeout");
         if (0 != (errors & SmcError.LimitSwitch)) Console.WriteLine("  Limit/kill switch active");
         if (0 != (errors & SmcError.VinLow)) Console.WriteLine("  Low VIN");
         if (0 != (errors & SmcError.VinHigh)) Console.WriteLine("  High VIN");
         if (0 != (errors & SmcError.TemperatureHigh)) Console.WriteLine("  Over temperature");
         if (0 != (errors & SmcError.MotorDriverError)) Console.WriteLine("  Motor driver error");
         if (0 != (errors & SmcError.ErrLineHigh)) Console.WriteLine("  ERR line high");
     }
     Console.WriteLine();
 }
コード例 #3
0
        /// <summary>
        /// 获取监控摄像头列表刷新状态,返回结果为0是表示刷新完毕,为1是刷新操作中。当查询刷新状态为0时,可调用获取监控摄像头列表接口,获取刷新后监控摄像头列表
        /// </summary>
        /// <param name="refreshStatus">返回值,刷新状态</param>
        /// <returns></returns>
        public Cgw.SmcError.SmcErr GetRefreshStatus(out SmcError.SmcErr refreshStatus)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: CgwMonitorManageAdapter.GetRefreshStatus");

            refreshStatus = new Cgw.SmcError.SmcErr();
            refreshStatus.ErrNo = Cgw.SmcError.CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END;

            Cgw.SmcError.SmcErr err = new Cgw.SmcError.SmcErr();
            try
            {
                //if (serviceControl.MonitorServiceRun() && client.State == CommunicationState.Opened)
                if(serviceControl.MonitorServiceRun())
                {
                    CgwMonitorManageServiceReference.SmcErr i_refreshStatus = new CgwMonitorManageServiceReference.SmcErr();

                    client = new MonitorManageServiceClient();
                    CgwMonitorManageServiceReference.SmcErr serviceErr = client.GetRefreshStatus(out i_refreshStatus);
                    client.Close();

                    refreshStatus.ErrNo = i_refreshStatus.ErrNo;
                    if (serviceErr.ErrNo != Cgw.SmcError.CgwError.ERR_MONITOR_MANAGE_SERVICE_SUCCESS)
                    {
                        logEx.Error("CgwMonitorManageAdapter.GetRefreshStatus failed. ErrNo = {0} ", serviceErr.ErrNo);
                        err = SetCgwErrNo(serviceErr);
                    }
                    else
                    {
                        logEx.Info("CgwMonitorManageAdapter.GetRefreshStatus Success. ");
                    }
                }
                else
                {
                    err.SetErrorNo(Cgw.SmcError.CgwError.ERR_MONITOR_MANAGE_SERVICE_RESTARTING);
                }
            }
            catch (System.Exception ex)
            {
                err.SetErrorNo(Cgw.SmcError.CgwError.ERR_MONITOR_MANAGE_SERVICE_RESTARTING);
                logEx.Error("CgwMonitorManageServiceReference.GetRefreshStatus failed. Exception is {0} ", ex.ToString());
            }
            return err;
        }