Esempio n. 1
0
EnviDataSource *EnviApplication::createInstance(const ValueTree dataSourceInstance)
{
	const String type = dataSourceInstance.getProperty(Ids::type);

	if (disabledSources.indexOf (type) >= 0 && enviCLI->isSet("disabled-sources"))
	{
		_WRN("Data source type: ["+type+"] disabled on command line");
		return (nullptr);
	}
	else
	{
		EnviDataSource *ds = getInstanceFromType(dataSourceInstance.getProperty(Ids::type).toString());

		if (ds != nullptr)
		{
			dataSources.add (ds);

			Result res = ds->initialize (dataSourceInstance);
			if (!res.wasOk())
			{
				_WRN("Data source type ["+type+"] name ["+ds->getName()+"] failed to initialize ["+res.getErrorMessage()+"]");
			}
			ds->setInstanceNumber (getNumInstances(type));

			startTimer (ENVI_TIMER_OFFSET + dataSources.indexOf(ds), ds->getInterval());
		}
		else
		{
			_WRN("Unknown data source type in XML: ["+type+"]");
			return (nullptr);
		}
		return (ds);
	}
}
Esempio n. 2
0
EnviDataSource *EnviApplication::createInstance(const File &sourceState)
{
	ScopedPointer <XmlElement> xml(XmlDocument::parse (sourceState));

	if (xml)
	{
		ValueTree instanceState = ValueTree::fromXml (*xml);

		if (instanceState.isValid())
		{
			_INF(sourceState.getFileName()+" looks like a valid data source defintion.");
			return (createInstance (instanceState));
		}
		else
		{
			_WRN(sourceState.getFileName()+" is an invalid data source definition (not XML).");
			return (nullptr);
		}
	}
	else
	{
		_WRN(sourceState.getFileName()+" can't be parsed as a XML file.");
	}

	return (nullptr);
}
Esempio n. 3
0
void EnviApplication::sourceWrite(EnviDataSource *dataSource, const Result &failureReason)
{
	if (failureReason.wasOk())
	{
		enviDB->writeResult (dataSource);
	}
	else
	{
		_WRN("Data source: ["+dataSource->getName()+"] instance: "+_STR(dataSource->getInstanceNumber())+"] has failed: ["+failureReason.getErrorMessage()+"]");
	}
}
void CtrlrPanelCanvasLayer::setCustomLookAndFeel(const luabind::object &customLookAndFeel)
{
    try
    {
        setCustomLookAndFeel (luabind::object_cast <LookAndFeelBase *> (customLookAndFeel));
    }
    catch (luabind::error &e)
    {
        _WRN("Unable to cast passed LookAndFeel object to anything usable: "+_STR(e.what()));
    }
}
void CtrlrPanelMIDIInputThread::run()
{
	while (! threadShouldExit())
    {
		uint32 timeToWait = 500;

		{
			process();
		}

		wait ((int) timeToWait);
	}
	_WRN("CtrlrPanelMIDIInputThread::run stopping");
}
Esempio n. 6
0
void EnviApplication::timerCallback(int timerId)
{
	EnviDataSource *ds = dataSources[timerId - ENVI_TIMER_OFFSET];
	if (ds)
	{
		if (ds->isDisabled())
		{
			_INF("Timer triggered for data source \""+ds->getName()+"\". Source is disabled");
			return;
		}

		Result res = ds->startSource();
		if (!res.wasOk())
		{
			_WRN("Timer trigger for data source \""+ds->getName()+"\", execute failed ["+res.getErrorMessage()+"]");
		}
	}
}
void CtrlrLuaMethodDebuggerPrompt::sendCommand (const String &command)
{
    if (owner.getParentComponent()->isCurrentlyModal())
    {
        commandQueue.add (command);

        insertToOutput (command.trim() + "\n", Colours::black);

        if (owner.getParentComponent()->isCurrentlyModal())
        {
            owner.getParentComponent()->exitModalState(1);
        }
    }
    else
    {
        _WRN("CtrlrLuaMethodDebuggerPrompt::sendCommand debugger is not active");
    }
}
Esempio n. 8
0
bool EventLoopL::Prepare()
{
	_DBG("EventLoopL::Prepare");

	if(!EventConfig_)
	{
		EventConfig_ = event_config_new();
	}

	if(!EventConfig_)
	{
		throwSystemError("event_config_new allocate fail!");
	}

	//event_config_avoid_method(EventConfig_, "select");//avoid select
	//event_config_avoid_method(EventConfig_, "poll");//avoid poll
	if(0 != event_config_require_features(EventConfig_, EV_FEATURE_O1))//EV_FEATURE_ET ?
	{
		_ERR("set event config feature fail!");
		return false;
	}

	if(0 != event_config_set_flag(EventConfig_, EVENT_BASE_FLAG_NOLOCK))
	{
		_ERR("set event config flag fail!");
		return false;
	}

	if(!EventBase_)
	{
		EventBase_ = event_base_new_with_config(EventConfig_);
	}

	if(!EventBase_)
	{
		throwSystemError("event_base_new_with_config allocate fail!");
		return false;
	}

	_DBG("Current used method : %s", event_base_get_method(EventBase_));

	for(auto &data : Datas_)
	{
		if(data)
		{
			std::shared_ptr<IO> io(data->io.lock());
			if(!io)
			{
				_WRN("This io %d is not exist!", io->Index());
				continue;
			}

			if(io->Index() < 0)
			{
				_ERR("This IO has been removed!");
				continue;
			}
			
			if(data->ev)
			{
				event_del(data->ev);
				event_free(data->ev);
				data->ev = NULL;
			}

			event* ev = event_new(EventBase_, io->Fd(), io->Condition(), CEventCallBack, (void*)&(data->fn));	
			_DBG("Add io %p(index : %d  fd : %d  cond : %d)", ev, io->Index(), io->Fd(), io->Condition());

			if(ev == NULL)
			{
				_ERR("event_new fail, index %d", io->Index());
				continue;
			}
			data->ev = ev;

			if(event_add(ev, NULL))
			{
				_ERR("event_add fail, index %d!", io->Index());
				continue;
			}
		}
	}

	int evtfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
	if (evtfd < 0)
	{
		_ERR("Get eventfd fail!");
		return false;
	}
	Wakeup_.reset(new IO(evtfd, EV_READ | EV_PERSIST));
	Wakeup_->SetCallback(std::bind(&EventLoopL::quitAsync, this, std::placeholders::_1));
	AddIO(Wakeup_);

	return true;
}