BootNotificationResponse.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using EVCB_OCPP.Packet20.DataTypes.EnumTypes;
  2. using EVCB_OCPP.Packet20.Utilites;
  3. using Newtonsoft.Json;
  4. using Newtonsoft.Json.Converters;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel.DataAnnotations;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace EVCB_OCPP.Packet20.Messages
  12. {
  13. public class BootNotificationResponse:IConfirmation
  14. {
  15. /// <summary>
  16. /// This contains the CSMS’s current time.
  17. /// </summary>
  18. [Required]
  19. [JsonConverter(typeof(UTCDateTimeConverter))]
  20. public DateTime CurrentTime { set; get; }
  21. /// <summary>
  22. /// When Status is Accepted, this contains the
  23. /// heartbeat interval in seconds.If the CSMS returns
  24. ///something other than Accepted, the value of the interval
  25. ///field indicates the minimum wait time before sending a
  26. ///next BootNotification request.
  27. /// </summary>
  28. [Required]
  29. public int Interval { set; get; }
  30. /// <summary>
  31. /// This contains whether the Charging Station has
  32. /// been registered within the CSMS.
  33. /// </summary>
  34. [Required]
  35. [JsonConverter(typeof(StringEnumConverter))]
  36. public RegistrationStatusEnumType Status { set; get; }
  37. private IRequest _request = null;
  38. public IRequest GetRequest()
  39. {
  40. return _request;
  41. }
  42. public void SetRequest(IRequest request)
  43. {
  44. _request = request;
  45. }
  46. public bool Validate()
  47. {
  48. return Validator.TryValidateObject(this, new ValidationContext(this), null, true);
  49. }
  50. }
  51. }