This commit is contained in:
nutchayut
2024-05-31 00:38:31 +07:00
commit 88ddddd7c2
234 changed files with 37557 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
using OCPP.Core.Database;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace OCPP.Core.Management.Models
{
/// <summary>
/// Encapsulates the data of a connected chargepoint in the server
/// Attention: Identical class in OCPP.Server (shoud be external common...)
/// </summary>
public class ChargePointStatus
{
public ChargePointStatus()
{
OnlineConnectors = new Dictionary<int, OnlineConnectorStatus>();
}
/// <summary>
/// ID of chargepoint
/// </summary>
[Newtonsoft.Json.JsonProperty("id")]
public string Id { get; set; }
/// <summary>
/// Name of chargepoint
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
public string Name { get; set; }
/// <summary>
/// OCPP protocol version
/// </summary>
[Newtonsoft.Json.JsonProperty("protocol")]
public string Protocol { get; set; }
/// <summary>
/// Dictionary with online connectors
/// </summary>
public Dictionary<int, OnlineConnectorStatus> OnlineConnectors { get; set; }
}
/// <summary>
/// Encapsulates details about online charge point connectors
/// </summary>
public class OnlineConnectorStatus
{
/// <summary>
/// Status of charge connector
/// </summary>
public ConnectorStatusEnum Status { get; set; }
/// <summary>
/// Current charge rate in kW
/// </summary>
public double? ChargeRateKW { get; set; }
/// <summary>
/// Current meter value in kWh
/// </summary>
public double? MeterKWH { get; set; }
/// <summary>
/// StateOfCharges in percent
/// </summary>
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
}
}

View File

@@ -0,0 +1,54 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
using OCPP.Core.Database;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace OCPP.Core.Management.Models
{
public class ChargePointViewModel
{
public List<ChargePoint> ChargePoints { get; set; }
public string CurrentId { get; set; }
[Required, StringLength(100)]
public string ChargePointId { get; set; }
[Required, StringLength(100)]
public string Name { get; set; }
[StringLength(100)]
public string Comment { get; set; }
[StringLength(50)]
public string Username { get; set; }
[StringLength(50)]
public string Password { get; set; }
[StringLength(100)]
public string ClientCertThumb { get; set; }
}
}

View File

@@ -0,0 +1,84 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace OCPP.Core.Management.Models
{
public class ChargePointsOverviewViewModel
{
/// <summary>
/// ID of this chargepoint
/// </summary>
public string ChargePointId { get; set; }
/// <summary>
/// Connector-ID
/// </summary>
public int ConnectorId { get; set; }
/// <summary>
/// Name of this chargepoint
/// </summary>
public string Name { get; set; }
/// <summary>
/// Comment of this chargepoint
/// </summary>
public string Comment { get; set; }
/// <summary>
/// Meter start value of last transaction
/// </summary>
public double MeterStart { get; set; }
/// <summary>
/// Meter stop value of last transaction (or null if charging)
/// </summary>
public double? MeterStop { get; set; }
/// <summary>
/// Start time of last transaction
/// </summary>
public DateTime? StartTime { get; set; }
/// <summary>
/// Stop time of last transaction (or null if charging)
/// </summary>
public DateTime? StopTime { get; set; }
/// <summary>
/// Status of chargepoint
/// </summary>
public ConnectorStatusEnum ConnectorStatus { get; set; }
/// <summary>
/// Is this chargepoint currently connected to OCPP.Server?
/// </summary>
public bool Online { get; set; }
/// <summary>
/// Details about the current charge process
/// </summary>
public string CurrentChargeData { get; set; }
}
}

View File

@@ -0,0 +1,50 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
using OCPP.Core.Database;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace OCPP.Core.Management.Models
{
public class ChargeTagViewModel
{
public List<ChargeTag> ChargeTags { get; set; }
public string CurrentTagId { get; set; }
[Required, StringLength(50)]
public string TagId { get; set; }
[Required, StringLength(200)]
public string TagName { get; set; }
[StringLength(50)]
public string ParentTagId { get; set; }
[DataType(DataType.Date)]
public DateTime? ExpiryDate { get; set; }
public bool Blocked { get; set; }
}
}

View File

@@ -0,0 +1,49 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
using OCPP.Core.Database;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace OCPP.Core.Management.Models
{
public class ConnectorStatusViewModel
{
public List<ConnectorStatus> ConnectorStatuses { get; set; }
public string ChargePointId { get; set; }
public int ConnectorId { get; set; }
public string LastStatus { get; set; }
public DateTime? LastStatusTime { get; set; }
public double? LastMeter { get; set; }
public DateTime? LastMeterTime { get; set; }
[StringLength(100)]
public string ConnectorName { get; set; }
}
}

View File

@@ -0,0 +1,40 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace OCPP.Core.Management.Models
{
public class OverviewViewModel
{
/// <summary>
/// List of chargepoints with status information
/// </summary>
public List<ChargePointsOverviewViewModel> ChargePoints { get; set; }
/// <summary>
/// Does the status contain live information from the OCPP.Server?
/// </summary>
public bool ServerConnection { get; set; }
}
}

View File

@@ -0,0 +1,47 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
using OCPP.Core.Database;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace OCPP.Core.Management.Models
{
public class TransactionListViewModel
{
public List<ChargePoint> ChargePoints { get; set; }
public List<ConnectorStatus> ConnectorStatuses { get; set; }
public Dictionary<string, ChargeTag> ChargeTags { get; set; }
public string CurrentChargePointId { get; set; }
public int CurrentConnectorId { get; set; }
//public string CurrentConnectorName { get; set; }
public List<Transaction> Transactions { get; set; }
public int Timespan { get; set; }
}
}

View File

@@ -0,0 +1,35 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace OCPP.Core.Management.Models
{
public class UserModel
{
public string Username { get; set; }
public string Password { get; set; }
public bool IsAdmin { get; set; }
}
}