WsClientData.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. 
  2. using EVCB_OCPP.Packet.Messages.Basic;
  3. using EVCB_OCPP.WSServer.Dto;
  4. namespace EVCB_OCPP.WSServer.Service.WsService
  5. {
  6. public class WsClientData : WsSession
  7. { /// <summary>
  8. /// 根據unique id來儲存.取出OCPP Request
  9. /// </summary>
  10. public Queue queue = new Queue();
  11. public EVCB_OCPP20.Packet.Messages.Basic.Queue queue20 = new EVCB_OCPP20.Packet.Messages.Basic.Queue();
  12. public bool? IsPending { set; get; }
  13. public bool IsCheckIn { set; get; } = false;
  14. public string ChargeBoxId { set; get; }
  15. public Guid CustomerId { get; set; }
  16. public string MachineId { set; get; }
  17. public bool ISOCPP20 { set; get; }
  18. public bool ResetSecurityProfile { set; get; }
  19. public bool IsAC { set; get; } = true;
  20. #region Billing
  21. public Dictionary<string, string> UserPrices { set; get; } = new Dictionary<string, string>();
  22. public Dictionary<string, string> UserDisplayPrices { set; get; } = new Dictionary<string, string>();
  23. public List<ChargingPrice> ChargingPrices { set; get; }
  24. /// <summary>
  25. /// 電樁顯示費率
  26. /// </summary>
  27. public string DisplayPrice { set; get; }
  28. /// <summary>
  29. /// 充電費率 以小時計費
  30. /// </summary>
  31. public decimal ChargingFeebyHour { set; get; }
  32. /// <summary>
  33. /// 停車費率 以小時計費
  34. /// </summary>
  35. public decimal ParkingFee { set; get; }
  36. /// <summary>
  37. /// 電樁是否計費
  38. /// </summary>
  39. public bool IsBilling { set; get; }
  40. /// <summary>
  41. /// 收費方式 1: 以度計費 2:以小時計費
  42. /// </summary>
  43. public int BillingMethod { set; get; }
  44. /// <summary>
  45. /// 電樁適用幣別
  46. /// </summary>
  47. public string Currency { get; internal set; }
  48. #endregion
  49. public string CustomerName { get; set; }
  50. public string StationId { set; get; }
  51. public event EventHandler<string> m_ReceiveData;
  52. public WsClientData()
  53. {
  54. ChargeBoxId = SessionID;
  55. MachineId = SessionID;
  56. }
  57. /// <summary>
  58. /// Sends the raw binary data to client.
  59. /// </summary>
  60. /// <param name="data">The data.</param>
  61. /// <param name="offset">The offset.</param>
  62. /// <param name="length">The length.</param>
  63. public void SendRawData(byte[] data, int offset, int length)
  64. {
  65. Send(data, offset, length);
  66. }
  67. internal override void HandleReceivedData(string msg)
  68. {
  69. m_ReceiveData?.Invoke(this, msg);
  70. }
  71. }
  72. }