예제 #1
0
        /// <summary>
        /// Create a new acknowledgement.
        /// </summary>
        /// <param name="Result">The result of the operation.</param>
        /// <param name="Description">An optional description of the result code.</param>
        /// <param name="Warnings">Warnings or additional information.</param>
        /// <param name="Runtime">The runtime of the request.</param>
        private PushChargingStationDataResult(IId Id,
                                              IReceiveData IReceiveData,
                                              PushDataResultTypes Result,
                                              IEnumerable <PushSingleChargingStationDataResult> RejectedEVSEs = null,
                                              String Description             = null,
                                              IEnumerable <Warning> Warnings = null,
                                              TimeSpan?Runtime = null)
        {
            this.Id = Id;

            this.IReceiveData = IReceiveData;

            this.Result = Result;

            this.RejectedEVSEs = RejectedEVSEs ?? new PushSingleChargingStationDataResult[0];

            this.Description = Description.IsNotNullOrEmpty()
                                      ? Description.Trim()
                                      : null;

            this.Warnings = Warnings != null
                                      ? Warnings.Where(warning => warning.IsNotNullOrEmpty())
                                      : new Warning[0];

            this.Runtime = Runtime;
        }
예제 #2
0
        public void InvokeReceive(IReceiveData rd)
        {
            ReceiveData data    = (ReceiveData)rd;
            Channel     channel = (Channel)data.Channel;

            channel.ReceiveDispatch.Add(data);
        }
예제 #3
0
    public UdpConnection(int port, IReceiveData receiver = null)
    {
        connection = new UdpClient(port);

        this.receiver = receiver;

        connection.BeginReceive(OnReceive, null);
    }
예제 #4
0
    public TcpConnection(string host, int port, IReceiveData receiver = null)
    {
        connection = new TcpClient(/* Elegir la sobrecarga correcta */);

        this.receiver = receiver;

        connection.BeginConnect(host, port, OnReceive, null); // Buscar bien que va aca
    }
예제 #5
0
    public UdpConnection(IPAddress ip, int port, IReceiveData receiver = null)
    {
        connection = new UdpClient();
        connection.Connect(ip, port);

        this.receiver = receiver;

        connection.BeginReceive(OnReceive, null);
    }
예제 #6
0
 public void InvokeReceive(IReceiveData data)
 {
     if (ChannelReceive != null)
     {
         ReceiveData rd = (ReceiveData)data;
         rd.CREA.Channel = rd.Channel;
         ChannelReceive(Server, rd.CREA);
     }
 }
예제 #7
0
    public TcpConnection(IPAddress ip, int port, IReceiveData receiver = null)
    {
        connection = new TcpClient(/* Elegir la sobrecarga correcta */);
        connection.Connect(ip, port);

        this.receiver = receiver;

        connection.BeginConnect(ip, port, OnReceive, null);
    }
예제 #8
0
        NoOperation(IId AuthId,
                    IReceiveData IReceiveData,
                    String Description             = null,
                    IEnumerable <Warning> Warnings = null,
                    TimeSpan?Runtime = null)

        => new PushChargingStationDataResult(AuthId,
                                             IReceiveData,
                                             PushDataResultTypes.NoOperation,
                                             new PushSingleChargingStationDataResult[0],
                                             Description,
                                             Warnings,
                                             Runtime);
예제 #9
0
        Success(IId AuthId,
                IReceiveData IReceiveData,
                String Description             = null,
                IEnumerable <Warning> Warnings = null,
                TimeSpan?Runtime = null)

        => new PushEVSEDataResult(AuthId,
                                  IReceiveData,
                                  PushDataResultTypes.Success,
                                  new EVSE[0],
                                  Description,
                                  Warnings,
                                  Runtime);
예제 #10
0
        Error(IId AuthId,
              IReceiveData IReceiveData,
              IEnumerable <PushSingleChargingStationDataResult> RejectedEVSEs = null,
              String Description             = null,
              IEnumerable <Warning> Warnings = null,
              TimeSpan?Runtime = null)

        => new PushChargingStationDataResult(AuthId,
                                             IReceiveData,
                                             PushDataResultTypes.Error,
                                             RejectedEVSEs,
                                             Description,
                                             Warnings,
                                             Runtime);
예제 #11
0
        AdminDown(IId AuthId,
                  IReceiveData IReceiveData,
                  IEnumerable <EVSE> RejectedEVSEs = null,
                  String Description             = null,
                  IEnumerable <Warning> Warnings = null,
                  TimeSpan?Runtime = null)

        => new PushEVSEDataResult(AuthId,
                                  IReceiveData,
                                  PushDataResultTypes.AdminDown,
                                  RejectedEVSEs,
                                  Description,
                                  Warnings,
                                  Runtime);
예제 #12
0
        /// <summary>
        /// Create a new PushEVSEData result.
        /// </summary>
        /// <param name="AuthId">The unqiue identification of the authenticator.</param>
        /// <param name="IReceiveData">An object implementing IReceiveData.</param>
        /// <param name="Result">The result of the operation.</param>
        /// <param name="Description">An optional description of the result code.</param>
        /// <param name="RejectedEVSEs">An enumeration of rejected EVSEs.</param>
        /// <param name="Warnings">Warnings or additional information.</param>
        /// <param name="Runtime">The runtime of the request.</param>
        internal PushEVSEDataResult(IId AuthId,
                                    IReceiveData IReceiveData,
                                    PushDataResultTypes Result,
                                    IEnumerable <EVSE> RejectedEVSEs = null,
                                    String Description             = null,
                                    IEnumerable <Warning> Warnings = null,
                                    TimeSpan?Runtime = null)

            : this(AuthId,
                   Result,
                   Description,
                   RejectedEVSEs,
                   Warnings,
                   Runtime)

        {
            this.IReceiveData = IReceiveData;
        }
예제 #13
0
 public void Push(string userid, string culltime, string kind, string value, int mode)
 {
     Utilities.GetLoger().Info("befor SubscribeList" + userid);
     if (SubscribeManager.SubscribeList.Contains(userid))
     {
         var config     = Utilities.GetConfiguration();
         var serviceurl = config.AppSettings.Settings["PushServiceURL"].Value;
         try
         {
             using (ChannelFactory <IReceiveData> channelFactory = new ChannelFactory <IReceiveData>(new BasicHttpBinding(), serviceurl + "/WCF/MonitoringHub.svc"))
             {
                 IReceiveData proxy = channelFactory.CreateChannel();
                 Utilities.GetLoger().Info("befor Receive" + userid);
                 proxy.Receive(userid, DateTime.Parse(culltime), kind, value, mode);
             }
         }
         catch (Exception ex)
         {
             Utilities.GetLoger().Error(ex.Message);
         }
     }
 }
 public ReceiveDataProvider(IReceiveData receiveData)
 {
     _receiveData = receiveData;
 }
예제 #15
0
 public void InvokeReceive(IReceiveData rd)
 {
     mReceiveDispatch.Add((ReceiveData)rd);
 }