|
@ -11,7 +11,7 @@ import ( |
|
|
func NewSceneMap(resolver device.Resolver) *SceneMap { |
|
|
func NewSceneMap(resolver device.Resolver) *SceneMap { |
|
|
return &SceneMap{ |
|
|
return &SceneMap{ |
|
|
resolver: resolver, |
|
|
resolver: resolver, |
|
|
sceneMap: make(map[string]int64, 64), |
|
|
|
|
|
|
|
|
sceneMap: make(map[string]string, 64), |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -19,10 +19,10 @@ type SceneMap struct { |
|
|
resolver device.Resolver |
|
|
resolver device.Resolver |
|
|
|
|
|
|
|
|
mu sync.Mutex |
|
|
mu sync.Mutex |
|
|
sceneMap map[string]int64 |
|
|
|
|
|
|
|
|
sceneMap map[string]string |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (s *SceneMap) SceneID(id string) *int64 { |
|
|
|
|
|
|
|
|
func (s *SceneMap) SceneID(id string) *string { |
|
|
s.mu.Lock() |
|
|
s.mu.Lock() |
|
|
defer s.mu.Unlock() |
|
|
defer s.mu.Unlock() |
|
|
|
|
|
|
|
@ -48,7 +48,7 @@ func (s *SceneMap) HandleCommand(_ *lucifer3.EventBus, command lucifer3.Command) |
|
|
if len(matched) > 0 { |
|
|
if len(matched) > 0 { |
|
|
s.mu.Lock() |
|
|
s.mu.Lock() |
|
|
for _, ptr := range matched { |
|
|
for _, ptr := range matched { |
|
|
s.sceneMap[ptr.ID] = command.SceneID |
|
|
|
|
|
|
|
|
s.sceneMap[ptr.ID] = command.SceneName |
|
|
} |
|
|
} |
|
|
s.mu.Unlock() |
|
|
s.mu.Unlock() |
|
|
} |
|
|
} |
|
|