Example #1
0
func deviceConfigToDevices(dces []*DeviceConfigEntry) (devices []db.Device, err error) {
	for _, dce := range dces {
		if dce.Kids == "" {
			continue
		}
		d := db.NewDevice(dce.IP, dce.Name)
		devices = append(devices, d)
	}
	return
}
Example #2
0
func addDeviceImp(r *http.Request) (err error) {
	if r.Method != "POST" {
		err = fmt.Errorf("Method != POST")
		return
	}
	ip := r.FormValue("ip")
	name := r.FormValue("name")
	err = watch.AddDevice(db.NewDevice(ip, name))
	return
}