#include "ParameterBool.h"
using namespace std;

/*
 * Constructor
 */
ParameterBool::ParameterBool(string name):SilentOnOff(false) {

	SetName(name);
	SetValue(false);
}


/*
 * Returns log message
 */
string ParameterBool::ToString() {

	bool value;

	GetValue(value);
	return value ? "true" : "false";
}


/*
 * Set on/off silent mode
 */
void ParameterBool::SetSilentMode(const bool& value) {

	// do some action only if value's different
	if (SilentOnOff != value) {

		// set the value on the hardware

		// store new value
		SilentOnOff = value;

		string strData = SilentOnOff ? "true" : "false";
		Log("Value changed. Silent mode is (" +strData+ ") ");
	}
	else {

		Log("No need to change");
	}
}


/*
 * Get state of silent mode
 */
void ParameterBool::GetSilentMode(bool& value) const {

	value = SilentOnOff;
}