using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace EVCB_OCPP.Packet20.Features { public enum Actions { //Core None, BootNotification, GetConfiguration, Heartbeat, StartTransaction, ChangeConfiguration, StatusNotification, Authorize, StopTransaction, MeterValues, RemoteStartTransaction, RemoteStopTransaction, ChangeAvailability, ClearCache, DataTransfer, Reset, UnlockConnector, //FirmwareManagement GetDiagnostics, UpdateFirmware, FirmwareStatusNotification, DiagnosticsStatusNotification, //LocalAuthListManagement SendLocalList, GetLocalListVersion, //Reservation CancelReservation, ReserveNow, //Remote Trigger TriggerMessage, //SmartCharging ClearChargingProfile, GetCompositeSchedule, SetChargingProfile } public class Profile { public string Name { protected set; get; } protected List features = new List(); protected List actions = new List(); public List GetAllFeatures() { return features; } public string GetActionFromConfirmation(Type seekType) { var _feature = features.Where(x => x.GetConfirmationType() == seekType).FirstOrDefault(); return _feature == null ? string.Empty : _feature.GetAction(); } public string GetActionFromRequest(Type seekType) { var feature = GetFeaturebyType(seekType); return feature == null ? string.Empty : feature.GetAction(); } public virtual Feature GetFeaturebyAction(string action) { return features.Where(x => x.GetAction() == action).FirstOrDefault(); ; ; } public virtual Feature GetFeaturebyType(Type seekType) { return features.Where(x => x.GetRequestType() == seekType).FirstOrDefault(); ; } public bool IsExisted(string action) { return actions.Contains(action); } public bool IsExisted(Actions action) { string _action = action.ToString(); return actions.Contains(_action); } } }