peripheral can connect mid stream and start go into streaming immidiately
This commit is contained in:
@@ -85,7 +85,8 @@ type PeripheralStateStore struct {
|
||||
// Messaging for UI and stuff
|
||||
Messages chan string
|
||||
// Callbacks
|
||||
telemetryProvider func() (string, error)
|
||||
telemetryProvider func() (string, error)
|
||||
onPeripheralConfigured func(string)
|
||||
// Internal State
|
||||
isStreaming bool
|
||||
}
|
||||
@@ -204,6 +205,12 @@ func (pss *PeripheralStateStore) OnStopStream() {
|
||||
pss.mu.Lock()
|
||||
pss.isStreaming = false
|
||||
pss.mu.Unlock()
|
||||
|
||||
for _, state := range pss.GetStates() {
|
||||
if state.State == DeviceIsStreaming {
|
||||
pss.setDeviceConfigured(state.device.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// "Events" [END] --------------------------------------------------------------
|
||||
@@ -270,8 +277,10 @@ func (pss *PeripheralStateStore) setDeviceConfigured(pname string) {
|
||||
pss.Logger.Info("device is configured and ready for data", "device", pname)
|
||||
|
||||
pss.mu.Lock()
|
||||
defer pss.mu.Unlock()
|
||||
pss.store[pname].State = DeviceIsConfigured
|
||||
pss.mu.Unlock()
|
||||
|
||||
pss.onPeripheralConfigured(pname)
|
||||
}
|
||||
|
||||
func (pss *PeripheralStateStore) setDeviceIsStreaming(pname string) {
|
||||
|
||||
Reference in New Issue
Block a user