#172 fixed bug with full builds not being sent

This commit is contained in:
Mikayla Fischler
2023-02-20 14:50:20 -05:00
parent 8df67245c5
commit e2d2a0f1dc
8 changed files with 63 additions and 25 deletions

View File

@@ -422,7 +422,22 @@ function coordinator.comms(version, modem, sv_port, sv_listen, api_listen, range
-- handle packet
if protocol == PROTOCOLS.SCADA_CRDN then
if self.sv_linked then
if packet.type == SCADA_CRDN_TYPES.FAC_BUILDS then
if packet.type == SCADA_CRDN_TYPES.INITIAL_BUILDS then
if packet.length == 2 then
-- record builds
local fac_builds = iocontrol.record_facility_builds(packet.data[1])
local unit_builds = iocontrol.record_unit_builds(packet.data[2])
if fac_builds and unit_builds then
-- acknowledge receipt of builds
_send_sv(PROTOCOLS.SCADA_CRDN, SCADA_CRDN_TYPES.INITIAL_BUILDS, {})
else
log.error("received invalid INITIAL_BUILDS packet")
end
else
log.debug("INITIAL_BUILDS packet length mismatch")
end
elseif packet.type == SCADA_CRDN_TYPES.FAC_BUILDS then
if packet.length == 1 then
-- record facility builds
if iocontrol.record_facility_builds(packet.data[1]) then