SecurityProfileHandler.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using EVCB_OCPP.Domain;
  2. using EVCB_OCPP.Packet.Features;
  3. using EVCB_OCPP.Packet.Messages;
  4. using EVCB_OCPP.Packet.Messages.Security;
  5. using OCPPServer.Protocol;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Diagnostics;
  9. using System.IO;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. namespace EVCB_OCPP.WSServer.Message
  14. {
  15. internal partial class ProfileHandler
  16. {
  17. internal MessageResult ExecuteSecurityRequest(Actions action, ClientData session, IRequest request)
  18. {
  19. MessageResult result = new MessageResult() { Success = false };
  20. try
  21. {
  22. switch (action)
  23. {
  24. default:
  25. {
  26. Console.WriteLine(string.Format("Not Implement {0} Logic(ExecuteCoreRequest)", request.GetType().ToString().Replace("OCPPPackage.Messages.Core.", "")));
  27. }
  28. break;
  29. }
  30. }
  31. catch (Exception ex)
  32. {
  33. logger.Fatal(string.Format("chargeBoxId:{0} {1}", session.ChargeBoxId, action));
  34. logger.Fatal(string.Format("Data {0}", request.ToString()));
  35. logger.Fatal(string.Format("Error {0}", ex.ToString()));
  36. result.Exception = ex;
  37. }
  38. return result;
  39. }
  40. internal MessageResult ExecuteSecurityConfirm(Actions action, ClientData session, IConfirmation confirm, string requestId)
  41. {
  42. MessageResult result = new MessageResult() { Success = false };
  43. switch (action)
  44. {
  45. default:
  46. {
  47. Console.WriteLine(string.Format("Not Implement {0} Logic", confirm.GetType().ToString().Replace("OCPPPackage.Messages.RemoteTrigger.", "")));
  48. }
  49. break;
  50. }
  51. return result;
  52. }
  53. internal MessageResult ReceivedSecurityError(Actions action, string errorMsg, ClientData session, string requestId)
  54. {
  55. MessageResult result = new MessageResult() { Success = true };
  56. switch (action)
  57. {
  58. default:
  59. {
  60. Console.WriteLine(string.Format("Not Implement {0} Logic", action));
  61. }
  62. break;
  63. }
  64. return result;
  65. }
  66. }
  67. }