internal bool DispenseProduct(EspBeltAddress address, uint quantity) { for (int i = 0; i < quantity; i++) { byte[] response = _channel.SendCommand(VendCommand(address.Tray, address.Belt)); VisionEsPlusResponseCodes code = ParseResponse(response); } return(true); }
internal (DeviceStateSeverity state, string message) Status(bool retryIfFaulty = true) { byte[] response = _channel.SendCommand(StatusCommand()); if ((response == null || response.Length == 0) && _lastTestResponse != null) { response = _lastTestResponse; } _lastTestResponse = response; VisionEsPlusResponseCodes code = ParseResponse(response); switch (code) { case VisionEsPlusResponseCodes.Unknown: // need to resend request in case of unknown status { if (retryIfFaulty) { return(Status(false)); } else { return(DeviceStateSeverity.Inoperable, "The door is probably open"); } } case VisionEsPlusResponseCodes.Ok: case VisionEsPlusResponseCodes.Ready: case VisionEsPlusResponseCodes.FaultIn485Bus: return(DeviceStateSeverity.Normal, string.Empty); default: switch (TryGetDoorState(response)) { case DoorState.DoorClosed: return(DeviceStateSeverity.Normal, "The door was closed"); case DoorState.DoorOpen: return(DeviceStateSeverity.MaintenanceService, "The door is open"); case DoorState.Unknown: default: return(DeviceStateSeverity.Inoperable, string.Empty); } } }