示例#1
0
        public static Result 机故上报2(int e1, int e2, int e3)
        {
            string datetime = DateTime.Now.ToString("yyyyMMddHHmmss");

            bool[] ErrorArray = new bool[96];
            for (int i = 0; i < 32; i++)
            {
                ErrorArray[i]      = BitHandle.GetBit(e1, i);
                ErrorArray[i + 32] = BitHandle.GetBit(e2, i);
                ErrorArray[i + 64] = BitHandle.GetBit(e3, i);
            }
            for (int i = 0; i < 96; i++)
            {
                if (ErrorArray[i] && !LastErrorArray[i])
                {
                    int    code      = i + 1;
                    string errorStr  = ErrorCodeCollection.GetError(code);
                    bool   IsSuccess = Post2(errorStr, datetime, out string responseContent);
                    LastErrorArray[i] = ErrorArray[i];
                    if (IsSuccess)
                    {
                        Log.Run(LogLevel.Info, "机故上报=>编码:" + code.ToString() + ";描述:" + errorStr);
                        Log.Debug("机故上报成功,IOT回复:" + responseContent);
                    }
                    else
                    {
                        return(new Result(false, "机故上报出错:" + responseContent /*, (int)ErrorCode.fatalError*/));
                    }
                }
            }
            LastErrorArray = ErrorArray;
            Thread.Sleep(50);
            return(new Result(true));
        }
 public ImageHandle(int width, int height)
 {
     Width     = width;
     Height    = height;
     Bits      = new byte[width * height * 4];
     BitHandle = GCHandle.Alloc(Bits, GCHandleType.Pinned);
     Bitmap    = new Bitmap(width, height, width * 4, PixelFormat.Format32bppArgb, BitHandle.AddrOfPinnedObject());
 }