123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
-
- 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<ClientData>
- { /// <summary>
- /// 根據unique id來儲存.取出OCPP Request
- /// </summary>
- 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<string,string> UserPrices { set; get; }
- public Dictionary<string, string> UserDisplayPrices { set; get; }
- public List<ChargingPrice> ChargingPrices { set; get; }
- /// <summary>
- /// 電樁顯示費率
- /// </summary>
- public string DisplayPrice { set; get; }
- /// <summary>
- /// 充電費率 以小時計費
- /// </summary>
- public decimal ChargingFeebyHour { set; get; }
- /// <summary>
- /// 停車費率 以小時計費
- /// </summary>
- public decimal ParkingFee { set; get; }
- /// <summary>
- /// 電樁是否計費
- /// </summary>
- public bool IsBilling { set; get; }
- /// <summary>
- /// 收費方式 1: 以度計費 2:以小時計費
- /// </summary>
- public int BillingMethod { set; get; }
-
- /// <summary>
- /// 電樁適用幣別
- /// </summary>
- public string Currency { get; internal set; }
- #endregion
- public string CustomerName { get; set; }
- public string StationId { set; get; }
-
- public delegate void OCPPClientDataEventHandler<ClientData, String>(ClientData clientdata, String msg);
- public event OCPPClientDataEventHandler<ClientData, String> m_ReceiveData;
- public ClientData()
- {
- IsAC = true;
-
- IsCheckIn = false;
- ChargeBoxId = SessionID;
- MachineId = SessionID;
- UserPrices = new Dictionary<string, string>();
- UserDisplayPrices = new Dictionary<string, string>();
- }
- /// <summary>
- /// Sends the raw binary data to client.
- /// </summary>
- /// <param name="data">The data.</param>
- /// <param name="offset">The offset.</param>
- /// <param name="length">The length.</param>
- 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);
- }
- /// <summary>
- /// Called when [session closed].
- /// </summary>
- /// <param name="reason">The reason.</param>
- protected override void OnSessionClosed(CloseReason reason)
- {
- }
- }
- }
|