#86 work on supervisor/coordinator comms

This commit is contained in:
Mikayla Fischler
2022-09-03 10:50:14 -04:00
parent d38e5ca5ec
commit c3f7407689
7 changed files with 148 additions and 17 deletions

View File

@ -397,8 +397,19 @@ function coordinator.comms(version, modem, sv_port, sv_listen, api_listen, sv_wa
else
log.debug("supervisor conn establish packet length mismatch")
end
elseif packet.type == SCADA_CRDN_TYPES.QUERY_UNIT then
elseif packet.type == SCADA_CRDN_TYPES.QUERY_FACILITY then
elseif packet.type == SCADA_CRDN_TYPES.STRUCT_BUILDS then
-- record builds
if database.populate_builds(packet.data) then
-- acknowledge receipt of builds
_send_sv(PROTOCOLS.SCADA_CRDN, SCADA_CRDN_TYPES.STRUCT_BUILDS, {})
else
log.error("supervisor build packet invalid")
end
elseif packet.type == SCADA_CRDN_TYPES.UNIT_STATUSES then
-- update statuses
if not database.update_statuses(packet.data) then
log.error("supervisor unit status packet invalid")
end
elseif packet.type == SCADA_CRDN_TYPES.COMMAND_UNIT then
elseif packet.type == SCADA_CRDN_TYPES.ALARM then
else