/*
* OCPP.Core - https://github.com/dallmann-consulting/OCPP.Core
* Copyright (C) 2020-2021 dallmann consulting GmbH.
* All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
using System;
using System.Collections.Generic;
using System.Net.WebSockets;
using Newtonsoft.Json;
using OCPP.Core.Database;
namespace OCPP.Core.Server
{
///
/// Encapsulates the data of a connected chargepoint in the server
///
public class ChargePointStatus
{
private Dictionary _onlineConnectors;
public ChargePointStatus()
{
}
public ChargePointStatus(ChargePoint chargePoint)
{
Id = chargePoint.ChargePointId;
Name = chargePoint.Name;
}
///
/// ID of chargepoint
///
[Newtonsoft.Json.JsonProperty("id")]
public string Id { get; set; }
///
/// Name of chargepoint
///
[Newtonsoft.Json.JsonProperty("name")]
public string Name { get; set; }
///
/// OCPP protocol version
///
[Newtonsoft.Json.JsonProperty("protocol")]
public string Protocol { get; set; }
///
/// Dictionary with online connectors
///
public Dictionary OnlineConnectors
{
get
{
if (_onlineConnectors == null)
{
_onlineConnectors = new Dictionary();
}
return _onlineConnectors;
}
set
{
_onlineConnectors = value;
}
}
///
/// WebSocket for internal processing
///
[JsonIgnore]
public WebSocket WebSocket { get; set; }
}
///
/// Encapsulates details about online charge point connectors
///
public class OnlineConnectorStatus
{
///
/// Status of charge connector
///
public ConnectorStatusEnum Status { get; set; }
///
/// Current charge rate in kW
///
public double? ChargeRateKW { get; set; }
///
/// Current meter value in kWh
///
public double? MeterKWH { get; set; }
///
/// StateOfCharges in percent
///
public double? SoC { get; set; }
}
public enum ConnectorStatusEnum
{
[System.Runtime.Serialization.EnumMember(Value = @"")]
Undefined = 0,
[System.Runtime.Serialization.EnumMember(Value = @"Available")]
Available = 1,
[System.Runtime.Serialization.EnumMember(Value = @"Occupied")]
Occupied = 2,
[System.Runtime.Serialization.EnumMember(Value = @"Unavailable")]
Unavailable = 3,
[System.Runtime.Serialization.EnumMember(Value = @"Faulted")]
Faulted = 4
}
}