123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace EVCB_OCPP.Packet.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,
- //Security
- CertificateSigned,
- DeleteCertificate,
- ExtendedTriggerMessage,
- GetInstalledCertificateIds,
- GetLog,
- InstallCertificate,
- LogStatusNotification,
- SecurityEventNotification,
- SignCertificate,
- SignedFirmwareStatusNotification,
- SignedUpdateFirmware
- }
- public class Profile
- {
- public string Name { protected set; get; }
- protected List<Feature> features = new List<Feature>();
- protected List<string> actions = new List<string>();
- public List<Feature> 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);
- }
- }
- }
|