Esempio n. 1
0
func (cmd *Sensor) show(application, entity, sensor string) {
	sensorValue, err := entity_sensors.SensorValue(cmd.network, application, entity, sensor)
	if nil != err {
		error_handler.ErrorExit(err)
	}
	displayValue, err := stringRepresentation(sensorValue)
	if nil != err {
		error_handler.ErrorExit(err)
	}
	fmt.Println(displayValue)
}
Esempio n. 2
0
func (cmd *Sensor) list(application, entity string) {
	sensors, err := entity_sensors.SensorList(cmd.network, application, entity)
	if nil != err {
		error_handler.ErrorExit(err)
	}
	var theSensors sensorList = sensors
	table := terminal.NewTable([]string{"Name", "Description", "Value"})

	sort.Sort(theSensors)

	for _, sensor := range theSensors {
		value, err := entity_sensors.SensorValue(cmd.network, application, entity, sensor.Name)
		if nil != err {
			error_handler.ErrorExit(err)
		}
		displayValue, err := stringRepresentation(value)
		if nil != err {
			error_handler.ErrorExit(err)
		}
		table.Add(sensor.Name, sensor.Description, displayValue)
	}
	table.Print()
}