public void Update(MessageErrors message) { lock (_locker) { var changeErrors = false; var changeWarnings = false; for (var i = 0; i < MessageErrors.ErrorsArraySizeInBytes; i++) { if (MessageErrors.Errors[i] != message.Errors[i]) { changeErrors = true; } } for (var i = 0; i < MessageErrors.WarningArraySizeInBytes; i++) { if (MessageErrors.Warnings[i] != message.Warnings[i]) { changeWarnings = true; } } if (changeErrors) { Task.Run(() => { Core.Notify($"{{\"id\":\"devices\",\"update\":[\"{id}\",\"errors\"]}}"); }); } if (changeWarnings) { Task.Run(() => { Core.Notify($"{{\"id\":\"devices\",\"update\":[\"{id}\",\"warnings\"]}}"); }); } MessageErrors = message; } }
public object Get(MessageErrors request) { var client = new RedisClient(); using (var store = client.As<MessageError>()) { var list = store.Lists["urn:ServiceErrors:All"]; return list; } }
public PlcZone(Id64 zone) { Message = new MessageCyclic(); MessageErrors = new MessageErrors(); id = zone; _locker = new object(); _answersQueue = new BlockingCollection <Request>(new ConcurrentQueue <Request>()); Task.Run(Executor); }
public Message_Upload() { //mSuccess = MessageType.CommandAccepted; mError = MessageErrors.ERR_NONE; ; mTimeStamp = DateTime.Now; //NoAck = false; ResponseType = MessageResponseType.DataMessage; VendorName = "ESYSCORP"; ModelNum = "MES "; KeepAliveAddlTextMessage = ""; MachineID = "XXXX"; }
private static MessageErrors ProcessErrorFlags(MessageErrors errorFlags) { if (errorFlags == 0) { return(MessageErrors.Ok); } const int errorOffset = 24; var result = (int)errorFlags - errorOffset; if (result == 0) { return(MessageErrors.SlaveNotResponding); } return((MessageErrors)BitConverter.GetBytes(result).First()); }
public ClosedXmlParser(WorksheetInterpreter <T> parser, MessageErrors messageErrors) : base(parser, messageErrors) { }
public ValidationResult IsValueValid <T>(Field <T> field, T item, object value, int row, int column, MessageErrors messageErrors) { var validationResult = new ValidationResult(); if (!IsRequiredFieldFilled(field, value)) { validationResult.AddError(new Error(messageErrors.EmptyRequiredField(field.Name), row, column)); } foreach (var validation in field.GetValidations()) { validationResult.AddResult(validation.IsValid(item, value, row, column)); } return(validationResult); }
public ValidationResult SetValue <T>(Field <T> field, T item, object value, int row, int column, MessageErrors messageErrors) { var validationColumn = new ValidationResult(); try { value = converter.Convert(field.PropertyInfo.Type, value); } catch { var error = new Error(messageErrors.InvalidParseValue(field.Name), row, column); validationColumn.AddError(error); } if (!validationColumn.IsSuccess) { return(validationColumn); } validationColumn.AddResult(IsValueValid(field, item, value, row, column, messageErrors)); try { if (validationColumn.IsSuccess) { SetValue(field, item, field.PropertyInfo.Name, value); } } catch { var error = new Error(messageErrors.InvalidItemValue(field.Name, value), row, column); validationColumn.AddError(error); } return(validationColumn); }