StatusNotificationRequest.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using Newtonsoft.Json;
  2. using Newtonsoft.Json.Converters;
  3. using EVCB_OCPP.Packet.Utilities;
  4. using EVCB_OCPP.Packet.Messages.SubTypes;
  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. using EVCB_OCPP.Packet.Features;
  12. namespace EVCB_OCPP.Packet.Messages.Core
  13. {
  14. public class StatusNotificationRequest : IRequest
  15. {
  16. public StatusNotificationRequest()
  17. {
  18. Action = Actions.StatusNotification.ToString();
  19. }
  20. [JsonIgnore]
  21. public string Action { set; get; }
  22. [Required]
  23. public int connectorId { set; get; }
  24. [Required]
  25. [JsonConverter(typeof(StringEnumConverter))]
  26. public ChargePointErrorCode errorCode { set; get; }
  27. [MaxLength(50)]
  28. public string info { set; get; }
  29. [Required]
  30. [JsonConverter(typeof(StringEnumConverter))]
  31. public ChargePointStatus status { set; get; }
  32. [JsonConverter(typeof(UTCDateTimeConverter))]
  33. public DateTime? timestamp { set; get; }
  34. [MaxLength(255)]
  35. public string vendorId { set; get; }
  36. [MaxLength(50)]
  37. public string vendorErrorCode { set; get; }
  38. public bool TransactionRelated()
  39. {
  40. return false;
  41. }
  42. public bool Validate()
  43. {
  44. return Validator.TryValidateObject(this, new ValidationContext(this), null, true);
  45. }
  46. }
  47. }