Ejemplo n.º 1
0
void InputManager::addControl(Control control)
{
	if(!m_controls_dict.contains(control.name))
	{
		control.id = m_controls.length();
		m_controls_dict.insert(control.name, control);
		m_controls.push_back(ControlStatus(control));
	}
	else
	{
		logWarn( "control " << control.name << " declared more than once");
	}
}
Ejemplo n.º 2
0
CommandStatus CommandResponder :: HandleControl(const BinaryOutput& aControl, size_t aIndex)
{
	CommandStatus cs = CS_TOO_MANY_OPS;
	if ( mLinkStatuses && (aControl.GetCode() == CC_LATCH_ON || aControl.GetCode() == CC_LATCH_OFF)) {
		try {
			Transaction t(mpObs);
			bool val = aControl.GetCode() == CC_LATCH_ON ? true : false;
			mpObs->Update(ControlStatus(val, ControlStatus::ONLINE), aIndex);
			cs = CS_SUCCESS;
			LOG_BLOCK(LEV_INFO, "Updated ControlStatus " << aIndex << " with " << val << "." );
		}
		catch (Exception& ex) {
			LOG_BLOCK(LEV_WARNING, "Failure trying to update point in response to control. " << ex.GetErrorString());
			cs = CS_FORMAT_ERROR;
		}
	}
	else {
		cs = GetResponseCode(true, aIndex);
	}
	LOG_BLOCK(LEV_INFO, "[" << aIndex << "] - " <<  aControl.ToString() << " returning " << ToString(cs));
	return cs;
}