|
@@ -233,27 +233,23 @@ internal partial class ProfileHandler
|
|
|
BootNotificationRequest _request = request as BootNotificationRequest;
|
|
|
int heartbeat_interval = GlobalConfig.GetHEARTBEAT_INTERVAL();
|
|
|
//var _machine = db.Machine.FirstOrDefault(x => x.ChargeBoxId == session.ChargeBoxId);
|
|
|
- Machine _machine = new();
|
|
|
- _machine.ChargeBoxSerialNumber = string.IsNullOrEmpty(_request.chargeBoxSerialNumber) ? string.Empty : _request.chargeBoxSerialNumber;
|
|
|
- _machine.ChargePointSerialNumber = string.IsNullOrEmpty(_request.chargePointSerialNumber) ? string.Empty : _request.chargePointSerialNumber;
|
|
|
- _machine.ChargePointModel = string.IsNullOrEmpty(_request.chargePointModel) ? string.Empty : _request.chargePointModel;
|
|
|
- _machine.ChargePointVendor = string.IsNullOrEmpty(_request.chargePointVendor) ? string.Empty : _request.chargePointVendor;
|
|
|
- _machine.FwCurrentVersion = string.IsNullOrEmpty(_request.firmwareVersion) ? string.Empty : _request.firmwareVersion;
|
|
|
- _machine.Iccid = string.IsNullOrEmpty(_request.iccid) ? string.Empty : _request.iccid;
|
|
|
- //_machine.Iccid = DateTime.UtcNow.ToString("yy-MM-dd HH:mm");
|
|
|
- _machine.Imsi = string.IsNullOrEmpty(_request.imsi) ? string.Empty : _request.imsi;
|
|
|
- _machine.MeterSerialNumber = string.IsNullOrEmpty(_request.meterSerialNumber) ? string.Empty : _request.meterSerialNumber;
|
|
|
- _machine.MeterType = string.IsNullOrEmpty(_request.meterType) ? string.Empty : _request.meterType;
|
|
|
-
|
|
|
- await mainDbService.UpdateMachineBasicInfo(session.ChargeBoxId, _machine);
|
|
|
-
|
|
|
- var configValue = await mainDbService.GetMachineHeartbeatInterval(session.ChargeBoxId);
|
|
|
-
|
|
|
- if (configValue != null)
|
|
|
+
|
|
|
+ if (session.BootStatus == BootStatus.Startup)
|
|
|
{
|
|
|
- int.TryParse(configValue, out heartbeat_interval);
|
|
|
- heartbeat_interval = heartbeat_interval == 0 ? GlobalConfig.GetHEARTBEAT_INTERVAL() : heartbeat_interval;
|
|
|
- }
|
|
|
+ Machine _machine = new();
|
|
|
+ _machine.ChargeBoxSerialNumber = string.IsNullOrEmpty(_request.chargeBoxSerialNumber) ? string.Empty : _request.chargeBoxSerialNumber;
|
|
|
+ _machine.ChargePointSerialNumber = string.IsNullOrEmpty(_request.chargePointSerialNumber) ? string.Empty : _request.chargePointSerialNumber;
|
|
|
+ _machine.ChargePointModel = string.IsNullOrEmpty(_request.chargePointModel) ? string.Empty : _request.chargePointModel;
|
|
|
+ _machine.ChargePointVendor = string.IsNullOrEmpty(_request.chargePointVendor) ? string.Empty : _request.chargePointVendor;
|
|
|
+ _machine.FwCurrentVersion = string.IsNullOrEmpty(_request.firmwareVersion) ? string.Empty : _request.firmwareVersion;
|
|
|
+ _machine.Iccid = string.IsNullOrEmpty(_request.iccid) ? string.Empty : _request.iccid;
|
|
|
+ //_machine.Iccid = DateTime.UtcNow.ToString("yy-MM-dd HH:mm");
|
|
|
+ _machine.Imsi = string.IsNullOrEmpty(_request.imsi) ? string.Empty : _request.imsi;
|
|
|
+ _machine.MeterSerialNumber = string.IsNullOrEmpty(_request.meterSerialNumber) ? string.Empty : _request.meterSerialNumber;
|
|
|
+ _machine.MeterType = string.IsNullOrEmpty(_request.meterType) ? string.Empty : _request.meterType;
|
|
|
+
|
|
|
+ await mainDbService.UpdateMachineBasicInfo(session.ChargeBoxId, _machine);
|
|
|
+ }
|
|
|
|
|
|
int toReturnInterval = 5;
|
|
|
RegistrationStatus toReturnRegistrationStatus = RegistrationStatus.Rejected ;
|
|
@@ -267,6 +263,14 @@ internal partial class ProfileHandler
|
|
|
break;
|
|
|
case BootStatus.Pending:
|
|
|
case BootStatus.Accepted:
|
|
|
+ var configValue = await mainDbService.GetMachineHeartbeatInterval(session.ChargeBoxId);
|
|
|
+
|
|
|
+ if (configValue != null)
|
|
|
+ {
|
|
|
+ int.TryParse(configValue, out heartbeat_interval);
|
|
|
+ heartbeat_interval = heartbeat_interval == 0 ? GlobalConfig.GetHEARTBEAT_INTERVAL() : heartbeat_interval;
|
|
|
+ }
|
|
|
+
|
|
|
toReturnInterval = heartbeat_interval;
|
|
|
toReturnRegistrationStatus = RegistrationStatus.Accepted;
|
|
|
session.BootStatus = BootStatus.Accepted;
|