aboutsummaryrefslogtreecommitdiff
path: root/light.go
diff options
context:
space:
mode:
authorCollin Guarino <collin.guarino@gmail.com>2016-02-18 23:30:40 -0500
committerCollin Guarino <collin.guarino@gmail.com>2016-02-18 23:30:40 -0500
commita95deb0690428f3c793ae7b4e2401ff56de72343 (patch)
treef16db5adb2f62fa034f962445ccb3179905d2bb7 /light.go
parent4715205f959490a55b8a2ad8aef56ce503709dbb (diff)
Implemented Bridge.Login() func that will assign Bridge.Username and create the user if it does not exist. Also convered more functions to Bridge.func()
Diffstat (limited to 'light.go')
-rw-r--r--light.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/light.go b/light.go
index 90fadbf..06d5682 100644
--- a/light.go
+++ b/light.go
@@ -172,7 +172,7 @@ func (light *Light) SetState(newState LightState) error {
}
// GetAllLights retreives the state of all lights that the bridge is aware of.
-func GetAllLights(bridge *Bridge) ([]Light, error) {
+func (bridge *Bridge) GetAllLights() ([]Light, error) {
// Loop through all light indicies to see if they exist
// and parse their values. Supports 100 lights.
var lights []Light
@@ -212,8 +212,8 @@ func GetLightByIndex(bridge *Bridge, index int) (Light, error) {
}
// GetLight returns a light struct containing data on a given name.
-func GetLightByName(bridge *Bridge, name string) (Light, error) {
- lights, _ := GetAllLights(bridge)
+func (bridge *Bridge) GetLightByName(name string) (Light, error) {
+ lights, _ := bridge.GetAllLights()
for _, light := range lights {
if light.Name == name {
return light, nil