Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions controlbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@
fmt.Println("RemoteSKIConnected: " + ski)
h.isConnected[ski] = true

frontend.sendText(SelectService, ski)

Check failure on line 189 in controlbox.go

View workflow job for this annotation

GitHub Actions / Build

Error return value of `frontend.sendText` is not checked (errcheck)
}

func (h *controlbox) RemoteSKIDisconnected(service api.ServiceInterface, ski string) {
fmt.Println("RemoteSKIDisconnected: " + ski)
h.isConnected[ski] = false

frontend.sendNotification("", ServiceListChanged, "")

Check failure on line 196 in controlbox.go

View workflow job for this annotation

GitHub Actions / Build

Error return value of `frontend.sendNotification` is not checked (errcheck)
}

func (h *controlbox) VisibleRemoteServicesUpdated(service api.ServiceInterface, entries []shipapi.RemoteService) {
Expand All @@ -206,9 +206,21 @@
service.SetTrusted(true)
}

// Preserve any device that's still actively connected, even
// if the current mDNS record no longer includes it.
seen := make(map[string]bool, len(entries))
for _, e := range entries {
seen[e.Ski] = true
}
for _, prev := range h.currentRemoteServices {
if h.isConnected[prev.Ski] && !seen[prev.Ski] {
entries = append(entries, prev)
}
}

h.currentRemoteServices = entries

frontend.sendNotification("", ServiceListChanged, "")

Check failure on line 223 in controlbox.go

View workflow job for this annotation

GitHub Actions / Build

Error return value of `frontend.sendNotification` is not checked (errcheck)
}

func (h *controlbox) ServiceShipIDUpdate(ski string, shipdID string) {
Expand All @@ -223,7 +235,7 @@
os.Exit(1)
}

frontend.sendNotification("", ServiceListChanged, "")

Check failure on line 238 in controlbox.go

View workflow job for this annotation

GitHub Actions / Build

Error return value of `frontend.sendNotification` is not checked (errcheck)
}

func (h *controlbox) AllowWaitingForTrust(ski string) bool {
Expand Down Expand Up @@ -314,7 +326,7 @@
return
}

frontend.sendValue(entity.Device().Ski(), GetConsumptionNominalMax, "LPC", nominal)

Check failure on line 329 in controlbox.go

View workflow job for this annotation

GitHub Actions / Build

Error return value of `frontend.sendValue` is not checked (errcheck)
}

func (h *controlbox) OnLPCEvent(ski string, device spineapi.DeviceRemoteInterface, entity spineapi.EntityRemoteInterface, event api.EventType) {
Expand All @@ -333,9 +345,9 @@
defer h.mutex.Unlock()

h.updateEntityInfos(ski, device, "LPC")
frontend.sendEntityInfo(GetEntityInfos, h.remoteInfos)

Check failure on line 348 in controlbox.go

View workflow job for this annotation

GitHub Actions / Build

Error return value of `frontend.sendEntityInfo` is not checked (errcheck)
h.updateUseCaseInfos(ski, device)
frontend.sendUseCaseInfo(GetUseCaseInfos, h.useCaseInfos)

Check failure on line 350 in controlbox.go

View workflow job for this annotation

GitHub Actions / Build

Error return value of `frontend.sendUseCaseInfo` is not checked (errcheck)

switch event {
case lpc.UseCaseSupportUpdate:
Expand All @@ -353,7 +365,7 @@
} else {
fmt.Println("New consumption limit received: inactive,", currentLimit.Value, "W,", currentLimit.Duration)
}
frontend.sendLimit(ski, GetConsumptionLimit, "LPC", ucapi.LoadLimit{

Check failure on line 368 in controlbox.go

View workflow job for this annotation

GitHub Actions / Build

Error return value of `frontend.sendLimit` is not checked (errcheck)
IsActive: currentLimit.IsActive,
Duration: currentLimit.Duration / time.Second,
Value: currentLimit.Value})
Expand All @@ -366,7 +378,7 @@

h.consumptionFailsafeLimits.Value = limit

frontend.sendValue(ski, GetConsumptionFailsafeValue, "LPC", limit)

Check failure on line 381 in controlbox.go

View workflow job for this annotation

GitHub Actions / Build

Error return value of `frontend.sendValue` is not checked (errcheck)
}
}
case lpc.DataUpdateFailsafeDurationMinimum:
Expand All @@ -376,7 +388,7 @@

h.consumptionFailsafeLimits.Duration = duration

frontend.sendValue(ski, GetConsumptionFailsafeDuration, "LPC", float64(duration/time.Second))

Check failure on line 391 in controlbox.go

View workflow job for this annotation

GitHub Actions / Build

Error return value of `frontend.sendValue` is not checked (errcheck)
}
}
// TODO
Expand Down