Exemplo n.º 1
0
func removeDevice(c *cli.Context) {
	// TODO: add validation
	mac := strings.Trim(c.Args().First(), " ")

	buffer := bytes.NewBufferString(mac)
	invoker.SendPacket(invoker.TYPE_REMOVE_DEVICE, *buffer)
}
Exemplo n.º 2
0
func registerDevice(c *cli.Context) {
	// TODO: add validation
	mac := strings.Trim(c.Args().First(), " ")
	ip := strings.Trim(c.Args().Get(1), " ")

	buffer := bytes.NewBufferString(mac + " " + ip)
	invoker.SendPacket(invoker.TYPE_NEW_DEVICE, *buffer)
}
Exemplo n.º 3
0
func stopDaemon(c *cli.Context) {
	if !daemon.IsDaemonized() {
		log.Error("No daemon is running!")
		return
	}

	invoker.SendPacket(invoker.TYPE_STOP_DAEMON, *bytes.NewBufferString(""))
	log.Info("Stopping the daemon ..")
}
Exemplo n.º 4
0
func installPlugin(c *cli.Context) {
	//TODO: handle installation of plugins on specific nodes only, examine
	buffer := bytes.NewBufferString(c.Args().First())
	buffer.WriteString(" ")
	invoker.SendPacket(invoker.TYPE_INSTALL_PLUGIN, *buffer)
}