using EVCB_OCPP.Packet.Messages.Basic; using EVCB_OCPP.WSServer.Dto; using SuperSocket.SocketBase; using SuperWebSocket; using System; using System.Collections.Generic; namespace OCPPServer.Protocol { public class ClientData : WebSocketSession { /// /// 根據unique id來儲存.取出OCPP Request /// public Queue queue = new Queue(); public EVCB_OCPP20.Packet.Messages.Basic.Queue queue20 = new EVCB_OCPP20.Packet.Messages.Basic.Queue(); public bool? IsPending { set; get; } public bool IsCheckIn { set; get; } public string ChargeBoxId { set; get; } public Guid CustomerId { get; set; } public string MachineId { set; get; } public bool ISOCPP20 { set; get; } public bool ResetSecurityProfile { set; get; } public bool IsAC { set; get; } #region Billing public Dictionary UserPrices { set; get; } public Dictionary UserDisplayPrices { set; get; } public List ChargingPrices { set; get; } /// /// 電樁顯示費率 /// public string DisplayPrice { set; get; } /// /// 充電費率 以小時計費 /// public decimal ChargingFeebyHour { set; get; } /// /// 停車費率 以小時計費 /// public decimal ParkingFee { set; get; } /// /// 電樁是否計費 /// public bool IsBilling { set; get; } /// /// 收費方式 1: 以度計費 2:以小時計費 /// public int BillingMethod { set; get; } /// /// 電樁適用幣別 /// public string Currency { get; internal set; } #endregion public string CustomerName { get; set; } public string StationId { set; get; } public delegate void OCPPClientDataEventHandler(ClientData clientdata, String msg); public event OCPPClientDataEventHandler m_ReceiveData; public ClientData() { IsAC = true; IsCheckIn = false; ChargeBoxId = SessionID; MachineId = SessionID; UserPrices = new Dictionary(); UserDisplayPrices = new Dictionary(); } /// /// Sends the raw binary data to client. /// /// The data. /// The offset. /// The length. public void SendRawData(byte[] data, int offset, int length) { base.Send(data, offset, length); } //receive data event trigger public void ReceiveData(ClientData clientdata, string msg) { if (m_ReceiveData != null) m_ReceiveData(clientdata, msg); } /// /// Called when [session closed]. /// /// The reason. protected override void OnSessionClosed(CloseReason reason) { } } }