本文整理汇总了C++中ITheFramework::AddEventConsumer方法的典型用法代码示例。如果您正苦于以下问题:C++ ITheFramework::AddEventConsumer方法的具体用法?C++ ITheFramework::AddEventConsumer怎么用?C++ ITheFramework::AddEventConsumer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITheFramework
的用法示例。
在下文中一共展示了ITheFramework::AddEventConsumer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ex_event
bool ex_event(void *args)
{
ITheFramework *frame = Factory::GetFramework();
ITheEventBoard *board = Factory::GetEventBoard();
Decorator *decorator = ssi_create(Decorator, 0, true);
frame->AddDecorator(decorator);
Mouse *mouse = ssi_create(Mouse, 0, true);
mouse->getOptions()->mask = Mouse::LEFT;
ITransformable *button_t = frame->AddProvider(mouse, SSI_MOUSE_BUTTON_PROVIDER_NAME);
ITransformable *cursor_t = frame->AddProvider(mouse, SSI_MOUSE_CURSOR_PROVIDER_NAME);
frame->AddSensor(mouse);
PythonConsumer *py_send = ssi_create_id(PythonConsumer, 0, "pysend");
py_send->getOptions()->setScript("ssi_send");
ITransformable *input[] = { button_t, cursor_t };
frame->AddConsumer(2, input, py_send, "100ms");
board->RegisterSender(*py_send);
PythonObject *py_listen = ssi_create_id(PythonObject, 0, "pylisten");
py_listen->getOptions()->setScript("ssi_listen");
board->RegisterListener(*py_listen, py_send->getEventAddress());
EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
board->RegisterListener(*monitor, 0, 10000u);
SignalPainter *plot = 0;
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("CURSOR");
frame->AddEventConsumer(cursor_t, plot, board, py_send->getEventAddress());
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
return true;
}
示例2: ex_annotation
bool ex_annotation(void *arg) {
ITheFramework *frame = Factory::GetFramework();
ITheEventBoard *board = Factory::GetEventBoard();
Mouse *mouse = ssi_create(Mouse, 0, true);
mouse->getOptions()->sr = 50.0;
mouse->getOptions()->mask = Mouse::LEFT;
ITransformable *cursor_p = frame->AddProvider(mouse, SSI_MOUSE_CURSOR_PROVIDER_NAME);
ITransformable *button_p = frame->AddProvider(mouse, SSI_MOUSE_BUTTON_PROVIDER_NAME);
frame->AddSensor(mouse);
TriggerEventSender *ezero = 0;
ezero = ssi_create(TriggerEventSender, 0, true);
ezero->getOptions()->triggerType = TriggerEventSender::TRIGGER::NOT_EQUAL;
ezero->getOptions()->setAddress("[email protected]");
ezero->getOptions()->minDuration = 0.2;
frame->AddConsumer(button_p, ezero, "0.25s");
board->RegisterSender(*ezero);
ezero = ssi_create(TriggerEventSender, 0, true);
ezero->getOptions()->triggerType = TriggerEventSender::TRIGGER::NOT_EQUAL;
ezero->getOptions()->setAddress("[email protected]");
ezero->getOptions()->minDuration = 0.2;
ezero->getOptions()->eventType = SSI_ETYPE_STRING;
ezero->getOptions()->setEventString("string");
frame->AddConsumer(button_p, ezero, "0.25s");
board->RegisterSender(*ezero);
StringEventSender *ssender = ssender = ssi_create(StringEventSender, 0, true);
ssender->getOptions()->setAddress("[email protected]");
ssender->getOptions()->mean = true;
frame->AddEventConsumer(cursor_p, ssender, board, ezero->getEventAddress());
board->RegisterSender(*ssender);
MapEventSender *msender = 0;
msender = ssi_create(MapEventSender, 0, true);
msender->getOptions()->setAddress("[email protected]");
msender->getOptions()->setKeys("x,y");
frame->AddEventConsumer(cursor_p, msender, board, ezero->getEventAddress());
board->RegisterSender(*msender);
msender = ssi_create(MapEventSender, 0, true);
msender->getOptions()->setAddress("[email protected]");
msender->getOptions()->setKeys("y,x");
frame->AddEventConsumer(cursor_p, msender, board, ezero->getEventAddress());
board->RegisterSender(*msender);
FileAnnotationWriter *annotation = 0;
annotation = ssi_create(FileAnnotationWriter, 0, true);
annotation->getOptions()->setAnnoPath("discrete_empty_and_string");
annotation->getOptions()->setSchemePath("scheme_discrete.annotation");
annotation->getOptions()->setDefaultLabel("empty");
annotation->getOptions()->defaultConfidence = 0.5f;
annotation->getOptions()->setMeta("annotator=hans;role=wurscht");
board->RegisterListener(*annotation, ezero->getEventAddress());
annotation = ssi_create(FileAnnotationWriter, 0, true);
annotation->getOptions()->setAnnoPath("discrete_map");
annotation->getOptions()->setSchemePath("scheme_discrete.annotation");
annotation->getOptions()->mapKeyIndex = 1;
annotation->getOptions()->setMeta("annotator=hans;role=wurscht");
board->RegisterListener(*annotation, msender->getEventAddress());
annotation = ssi_create(FileAnnotationWriter, 0, true);
annotation->getOptions()->setAnnoPath("free_empty_and_string");
annotation->getOptions()->setSchemePath("scheme_free");
annotation->getOptions()->setDefaultLabel("empty");
annotation->getOptions()->defaultConfidence = 0.5f;
annotation->getOptions()->setMeta("annotator=hans;role=wurscht");
board->RegisterListener(*annotation, ezero->getEventAddress());
annotation = ssi_create(FileAnnotationWriter, 0, true);
annotation->getOptions()->setAnnoPath("free_map");
annotation->getOptions()->setSchemePath("scheme_free");
annotation->getOptions()->mapKeyIndex = 1;
annotation->getOptions()->setMeta("annotator=hans;role=wurscht");
board->RegisterListener(*annotation, msender->getEventAddress());
annotation = ssi_create(FileAnnotationWriter, 0, true);
annotation->getOptions()->setAnnoPath("continuous");
annotation->getOptions()->setSchemePath("scheme_continuous");
annotation->getOptions()->setMeta("annotator=hans;role=wurscht");
frame->AddConsumer(cursor_p, annotation, "1.0s");
EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
monitor->getOptions()->setPos(CONSOLE_WIDTH, 0, 600, 300);
board->RegisterListener(*monitor, 0, 60000);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
//.........这里部分代码省略.........
示例3: ex_sender_events
bool ex_sender_events (void *arg) {
Socket::TYPE::List *type = ssi_pcast(Socket::TYPE::List, arg);
ITheFramework *frame = Factory::GetFramework();
ITheEventBoard *board = Factory::GetEventBoard();
// start mouse
Mouse *mouse = ssi_create(Mouse, 0, true);
mouse->getOptions()->mask = Mouse::LEFT;
mouse->getOptions()->sendEvent = true;
mouse->getOptions()->setAddress("[email protected]");
ITransformable *cursor_p = frame->AddProvider(mouse, SSI_MOUSE_CURSOR_PROVIDER_NAME);
frame->AddSensor(mouse);
board->RegisterSender(*mouse);
MapEventSender *msender = ssi_create(MapEventSender, 0, true);
msender->getOptions()->setAddress("[email protected]");
msender->getOptions()->setKeys("x,y");
frame->AddEventConsumer(cursor_p, msender, board, mouse->getEventAddress());
board->RegisterSender(*msender);
// start sender and receiver
SocketEventWriter *socket_event_writer = 0;
socket_event_writer = ssi_create(SocketEventWriter, 0, true);
socket_event_writer->getOptions()->setUrl(*type, "localhost", 1111);
board->RegisterListener(*socket_event_writer, msender->getEventAddress());
socket_event_writer = ssi_create(SocketEventWriter, 0, true);
socket_event_writer->getOptions()->setUrl(*type, "localhost", 2222);
socket_event_writer->getOptions()->osc = true;
socket_event_writer->getOptions()->xml = false;
board->RegisterListener(*socket_event_writer, msender->getEventAddress());
SocketEventReader *socket_event_reader = 0;
socket_event_reader = ssi_create(SocketEventReader, 0, true);
socket_event_reader->getOptions()->setUrl(*type, "localhost", 1111);
socket_event_reader->getOptions()->setAddress("[email protected]");
board->RegisterSender(*socket_event_reader);
socket_event_reader = ssi_create(SocketEventReader, 0, true);
socket_event_reader->getOptions()->setUrl(*type, "localhost", 2222);
socket_event_reader->getOptions()->osc = true;
socket_event_reader->getOptions()->setAddress("[email protected]");
board->RegisterSender(*socket_event_reader);
EventMonitor *monitor = ssi_create_id (EventMonitor, 0, "monitor");
monitor->getOptions()->setPos(CONSOLE_WIDTH, 0, 600, CONSOLE_HEIGHT);
board->RegisterListener(*monitor, socket_event_reader->getEventAddress(), 60000);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
return true;
}
示例4: ex_gsr_peaks_online
bool ex_gsr_peaks_online(void *args) {
ITheEventBoard *board = Factory::GetEventBoard();
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create(Decorator, 0, true);
frame->AddDecorator(decorator);
FileReader *reader = ssi_create(FileReader, 0, true);
reader->getOptions()->setPath("data\\gsr");
reader->getOptions()->block = 0.2;
ITransformable *gsr_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
frame->AddSensor(reader);
Butfilt *lowpass = ssi_create(Butfilt, 0, true);
lowpass->getOptions()->low = 0.01;
lowpass->getOptions()->order = 3;
lowpass->getOptions()->type = Butfilt::LOW;
lowpass->getOptions()->zero = true;
ITransformable *gsr_low = frame->AddTransformer(gsr_p, lowpass, "0.2s");
GSREventSender *gsr_event = ssi_create(GSREventSender, 0, true);
gsr_event->getOptions()->tuple = true;
gsr_event->setLogLevel(SSI_LOG_LEVEL_DEBUG);
frame->AddConsumer(gsr_low, gsr_event, "4.0s");
board->RegisterSender(*gsr_event);
EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
board->RegisterListener(*monitor, gsr_event->getEventAddress());
SignalPainter *plot = 0;
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("gsr");
plot->getOptions()->size = 150.0;
frame->AddConsumer(gsr_p, plot, "0.2s");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("gsr(lowpassed)");
plot->getOptions()->size = 150.0;
frame->AddConsumer(gsr_low, plot, "0.2s");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("peak");
plot->getOptions()->reset = true;
frame->AddEventConsumer(gsr_low, plot, board, "[email protected]");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("slope");
plot->getOptions()->reset = true;
frame->AddEventConsumer(gsr_low, plot, board, "[email protected]");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("drop");
plot->getOptions()->reset = true;
frame->AddEventConsumer(gsr_low, plot, board, "[email protected]");
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
board->Start();
frame->Start();
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
return true;
}