|
|
@@ -1,7 +1,7 @@ |
|
|
|
|
|
|
|
using BPA.Helper; |
|
|
|
using BPASmartClient.KLMCoffee.Protocal; |
|
|
|
using BPASmartClient.Message; |
|
|
|
|
|
|
|
using BPASmartClient.Model; |
|
|
|
using BPASmartClient.Model.咖啡机.Enum; |
|
|
|
using BPASmartClient.Peripheral; |
|
|
@@ -12,7 +12,7 @@ using System.Linq; |
|
|
|
using System.Text; |
|
|
|
using System.Threading; |
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
using static BPA.Helper.EventBus; |
|
|
|
|
|
|
|
namespace BPASmartClient.KLMCoffee |
|
|
|
{ |
|
|
@@ -112,7 +112,7 @@ namespace BPASmartClient.KLMCoffee |
|
|
|
{ |
|
|
|
byte item = dataStorage.GetData(); |
|
|
|
List<byte> data = new List<byte>() { item }; |
|
|
|
if (Encoding.ASCII.GetString(data.ToArray()) == ":") |
|
|
|
if (Encoding.ASCII.GetString(data.ToArray()) == ":") |
|
|
|
{ |
|
|
|
temp.Add(item); |
|
|
|
while (dataStorage.GetSize() < 32) { Thread.Sleep(5); } |
|
|
@@ -127,7 +127,7 @@ namespace BPASmartClient.KLMCoffee |
|
|
|
//帧尾 |
|
|
|
//if (Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\\r\\n" || Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\r\n") |
|
|
|
var package = Encoding.ASCII.GetString(temp.ToArray()); |
|
|
|
if(package.Contains("\\r\\n")) |
|
|
|
if (package.Contains("\\r\\n")) |
|
|
|
{ |
|
|
|
ProcessMsg(package); |
|
|
|
} |
|
|
@@ -147,10 +147,10 @@ namespace BPASmartClient.KLMCoffee |
|
|
|
if (systemStatus != null) |
|
|
|
{ |
|
|
|
status["CoffeeIsConnected"] = OnLine; |
|
|
|
if((K95SysTemStatus)status["CoffeeStatus"] == K95SysTemStatus.正在制作咖啡&&systemStatus.temStatus != K95SysTemStatus.正在制作咖啡) |
|
|
|
if ((K95SysTemStatus)status["CoffeeStatus"] == K95SysTemStatus.正在制作咖啡 && systemStatus.temStatus != K95SysTemStatus.正在制作咖啡) |
|
|
|
{ |
|
|
|
status["CoffeeStatus"] = systemStatus.temStatus; |
|
|
|
EventBus.EventBus.GetInstance().Publish(new KLMCoffee_CoffeEndCookEvent { DeviceId = DeviceId }); |
|
|
|
EventBus.GetInstance().Publish(new KLMCoffee_CoffeEndCookEvent { DeviceId = DeviceId }); |
|
|
|
} |
|
|
|
else status["CoffeeStatus"] = systemStatus.temStatus; |
|
|
|
status["CoffeedrinkType"] = systemStatus.drinkType; |
|
|
@@ -187,64 +187,64 @@ namespace BPASmartClient.KLMCoffee |
|
|
|
commProxy.SetDataStorage(dataStorage); |
|
|
|
|
|
|
|
//伽乐美咖啡机制作 |
|
|
|
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
free = true; |
|
|
|
Thread.Sleep(300); |
|
|
|
K95deFaultCoffeeEnum K95Code = (K95deFaultCoffeeEnum)((KLMCoffee_MakeCoffeeEvent)@event).KLMDrinkFaultCode; |
|
|
|
//byte[] data = command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(), new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode)); |
|
|
|
byte[] data = command.ReturnsCommandData(K95CommandEnum.咖啡制作.GetString(), K95Code.GetString()); |
|
|
|
commProxy.SendData(data); |
|
|
|
MessageLog.GetInstance.Show($"制作{K95Code}数据发送完成"); |
|
|
|
Thread.Sleep(200); |
|
|
|
free = false; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); |
|
|
|
} |
|
|
|
}); |
|
|
|
EventBus.GetInstance().Subscribe<KLMCoffee_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
free = true; |
|
|
|
Thread.Sleep(300); |
|
|
|
K95deFaultCoffeeEnum K95Code = (K95deFaultCoffeeEnum)((KLMCoffee_MakeCoffeeEvent)@event).KLMDrinkFaultCode; |
|
|
|
//byte[] data = command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(), new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode)); |
|
|
|
byte[] data = command.ReturnsCommandData(K95CommandEnum.咖啡制作.GetString(), K95Code.GetString()); |
|
|
|
commProxy.SendData(data); |
|
|
|
MessageLog.GetInstance.Show($"制作{K95Code}数据发送完成"); |
|
|
|
Thread.Sleep(200); |
|
|
|
free = false; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//伽乐美咖啡机取消制作咖啡 |
|
|
|
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CancelMakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
free = true; |
|
|
|
Thread.Sleep(200); |
|
|
|
byte[] data = command.ReturnsCancelMake(); |
|
|
|
commProxy.SendData(data); |
|
|
|
Thread.Sleep(200); |
|
|
|
free = false; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); |
|
|
|
} |
|
|
|
}); |
|
|
|
EventBus.GetInstance().Subscribe<KLMCoffee_CancelMakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
free = true; |
|
|
|
Thread.Sleep(200); |
|
|
|
byte[] data = command.ReturnsCancelMake(); |
|
|
|
commProxy.SendData(data); |
|
|
|
Thread.Sleep(200); |
|
|
|
free = false; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//伽乐美咖啡机清洗冲泡器 |
|
|
|
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_WashCPJEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
free = true; |
|
|
|
Thread.Sleep(200); |
|
|
|
byte[] data = command.ReturnsWashCPJ(); |
|
|
|
commProxy.SendData(data); |
|
|
|
Thread.Sleep(200); |
|
|
|
free = false; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); |
|
|
|
} |
|
|
|
}); |
|
|
|
EventBus.GetInstance().Subscribe<KLMCoffee_WashCPJEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
free = true; |
|
|
|
Thread.Sleep(200); |
|
|
|
byte[] data = command.ReturnsWashCPJ(); |
|
|
|
commProxy.SendData(data); |
|
|
|
Thread.Sleep(200); |
|
|
|
free = false; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
//伽乐美咖啡机放杯确认 |
|
|
|
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CupIsOKEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) |
|
|
|
EventBus.GetInstance().Subscribe<KLMCoffee_CupIsOKEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
@@ -263,26 +263,26 @@ namespace BPASmartClient.KLMCoffee |
|
|
|
|
|
|
|
|
|
|
|
//伽乐美咖啡机清洗奶沫器 |
|
|
|
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_WashNMJEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
free = true; |
|
|
|
Thread.Sleep(200); |
|
|
|
byte[] data = command.ReturnsWashNMJ(); |
|
|
|
commProxy.SendData(data); |
|
|
|
Thread.Sleep(200); |
|
|
|
free = false; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); |
|
|
|
} |
|
|
|
}); |
|
|
|
EventBus.GetInstance().Subscribe<KLMCoffee_WashNMJEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
free = true; |
|
|
|
Thread.Sleep(200); |
|
|
|
byte[] data = command.ReturnsWashNMJ(); |
|
|
|
commProxy.SendData(data); |
|
|
|
Thread.Sleep(200); |
|
|
|
free = false; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//伽乐美咖啡机清洗奶沫器确认 |
|
|
|
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_WashNMJIsOKEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) |
|
|
|
EventBus.GetInstance().Subscribe<KLMCoffee_WashNMJIsOKEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|