bool CameraNUI::onInit() { LOG(LTRACE) << "CameraNUI::initialize\n"; // Regsiter events newImage = registerEvent("newImage"); newDepthMap = registerEvent("newDepthMap"); // Register data streams registerStream("out_img", &outImg); registerStream("out_depth_map", &outDepthMap); // #ifdef WITH_OPENNI if(lib == opencv) { capture.open( CV_CAP_OPENNI ); std::cout << "Yes. We're here\n"; } else { #endif device = &freenectObj.createDevice<FreenectNUIDevice>(0); #ifdef WITH_OPENNI } #endif cameraFrame = Mat(Size(640,480),CV_8UC3,Scalar(0)); depthFrame = Mat(Size(640,480),CV_16UC1); return true; }
status_t SimpleSocketConnection::notifyWritable() { assert(sending_); ulong_t toSend = requestLenLeft_; if (requestLenLeft_ > chunkSize_) toSend = chunkSize_; uint_t dataSize = 0; status_t error = socket().send(dataSize, request_ + requestSent_, requestLenLeft_, transferTimeout()); if (errNone==error || netErrWouldBlock==error) { registerEvent(SocketSelector::eventRead); requestSent_ += dataSize; assert( requestLenLeft_ >= dataSize ); requestLenLeft_ -= dataSize; if (0 == requestLenLeft_) { sending_ = false; error = socket().shutdown(netSocketDirOutput); if (error) LogStrUlong(eLogDebug, _T("notifyWritable(): Socket::shutdown() returned error: "), error); } else registerEvent(SocketSelector::eventWrite); error = notifyProgress(); } else LogStrUlong(eLogError, _T("notifyWritable(): Socket::send() returned error: "), error); return error; }
uint8_t setRTS(uint8_t level) { int status; if(level) registerEvent("TX", "enabled"); else registerEvent("RX", "enabled"); if(ioctl(serialportFd, TIOCMGET, &status) == -1) { //perror("setRTS()"); return 0; } if(level) status|=TIOCM_RTS; else status&=~TIOCM_RTS; if(ioctl(serialportFd, TIOCMSET, &status) == -1) { //perror("setRTS()"); return 0; } return 1; }
/* this is ugly as hell, and it does not belong here. OTOH, all this event stuff in neutrino is horribly broken anyway, so who cares */ void CSectionsdClient::RegisterNeutrino() { registerEvent(CSectionsdClient::EVT_TIMESET, 222, NEUTRINO_UDS_NAME); registerEvent(CSectionsdClient::EVT_GOT_CN_EPG, 222, NEUTRINO_UDS_NAME); registerEvent(CSectionsdClient::EVT_SERVICES_UPDATE, 222, NEUTRINO_UDS_NAME); registerEvent(CSectionsdClient::EVT_BOUQUETS_UPDATE, 222, NEUTRINO_UDS_NAME); registerEvent(CSectionsdClient::EVT_WRITE_SI_FINISHED, 222, NEUTRINO_UDS_NAME); }
void TechniqueController::registerEvents() { registerEvent(NameChanged); registerEvent(SchemeChanged); registerEvent(LodIndexChanged); registerEvent(PassAdded); registerEvent(PassRemoved); }
void MenuCaptureWnd::init(){ paintManager_.AddMessageFilter(this); registerEvent(DUI_ITEMCLICK,_T("menu_Interfaces"),boost::bind(&MenuCaptureWnd::onInterfaces,this,_1)); registerEvent(DUI_ITEMCLICK,_T("menu_Options"),boost::bind(&MenuCaptureWnd::onOptions,this,_1)); registerEvent(DUI_ITEMCLICK,_T("menu_Start"),boost::bind(&MenuCaptureWnd::onStart,this,_1)); registerEvent(DUI_ITEMCLICK,_T("menu_Stop"),boost::bind(&MenuCaptureWnd::onStop,this,_1)); registerEvent(DUI_ITEMSELECT,_T("menu_capture"),boost::bind(&MenuCaptureWnd::onSelectItem,this,_1)); }
bool SystemListView::init() { registerEvent("refresh", this, &SystemListView::refresh); registerEvent("setTargetInstance", this, &SystemListView::setTargetInstance); LOG_INFO("Starting SystemListView"); return true; }
bool ExecTimer::onInit() { LOG(LTRACE) << "ExecTimer::initialize\n"; h_onStartExec.setup(this, &ExecTimer::onStartExec); registerHandler("onStartExec", &h_onStartExec); h_onStopExec.setup(this, &ExecTimer::onStopExec); registerHandler("onStopExec", &h_onStopExec); stopped = registerEvent("stopped"); started = registerEvent("started"); return true; }
bool DepthNormalEstimator::onInit() { LOG(LTRACE) << "DepthNormalEstimator::initialize\n"; h_onNewImage.setup(this, &DepthNormalEstimator::onNewImage); registerHandler("onNewImage", &h_onNewImage); registerStream("in_img", &in_img); newImage = registerEvent("newImage"); registerStream("out_img", &out_img); newNormals = registerEvent("newNormals"); registerStream("out_normals", &out_normals); return true; }
bool BlobExtractor_Processor::onInit() { LOG(LTRACE) << "BlobExtractor_Processor::initialize\n"; newBlobs = registerEvent("newBlobs"); newImage = registerEvent("newImage"); h_onNewImage.setup(this, &BlobExtractor_Processor::onNewImage); registerHandler("onNewImage", &h_onNewImage); registerStream("in_img", &in_img); registerStream("out_img", &out_img); registerStream("out_blobs", &out_blobs); return true; }
void OMXMLReaderExpat::endNamespaceDeclHandler(const XML_Char* prefix) { TRACE("OMXMLReaderExpat::endNamespaceDeclHandler"); if (prefix != 0) { wchar_t* workBuffer = getWorkBuffer(xmlStringLen(prefix) + 1); readCharacters(workBuffer, prefix, 0); _endNmspaceDecls.append(workBuffer); } else { _endNmspaceDecls.append(L""); } XML_Status status = XML_StopParser(_parser, true); if (status != XML_STATUS_OK) { XML_Error errorCode = XML_GetErrorCode(_parser); if (errorCode != XML_ERROR_SUSPENDED) { throw OMException(getErrorString()); } } registerEvent(END_PREFIX_MAPPING); }
void OMXMLReaderExpat::startNamespaceDeclHandler(const XML_Char* prefix, const XML_Char* uri) { TRACE("OMXMLReaderExpat::startNamespaceDeclHandler"); QName* qName = new QName; if (prefix != 0) { wchar_t* workBuffer = getWorkBuffer(xmlStringLen(prefix) + 1); readCharacters(workBuffer, prefix, 0); qName->prefix = workBuffer; } if (uri != 0) { wchar_t* workBuffer = getWorkBuffer(xmlStringLen(uri) + 1); readCharacters(workBuffer, uri, 0); qName->uri = workBuffer; } _startNmspaceDecls.append(qName); XML_Status status = XML_StopParser(_parser, true); if (status != XML_STATUS_OK) { XML_Error errorCode = XML_GetErrorCode(_parser); if (errorCode != XML_ERROR_SUSPENDED) { throw OMException(getErrorString()); } } registerEvent(START_PREFIX_MAPPING); }
void GameCore::argument_interpreter(int argv, char **argc) { int i; log(LOG_DEBUG, "Entered argument interpreter of Game Core"); // defaults args.debug = false; args.resx = 1024; args.resy = 768; args.type = SDL_WINDOW_OPENGL; for(i = 1; i < argv; i++) if(strcmp(argc[i], "--debug") == 0) { args.debug = true; logger.current_log_level = 9; } else if(strcmp(argc[i], "--ssaa") == 0) args.ssaa = true; else if(strcmp(argc[i], "--log") == 0) { freopen(argc[i + 1], "w", stdout); i++; } else if(strcmp(argc[i], "--res") == 0) { sscanf(argc[i + 1], "%fx%f", &args.resx, &args.resy); i++; } else if(strcmp(argc[i], "--fullscreen") == 0) { args.type = args.type | SDL_WINDOW_FULLSCREEN; } else if(strcmp(argc[i], "--debuglevel") == 0) { sscanf(argc[i + 1], "%d", &logger.current_log_level); i++; } Frame_Event = registerEvent("Frame"); }
SpectrogramComponent::SpectrogramComponent(std::string name) : PhyComponent(name, "spectrogram", "A PSD estimator using a spectral periodogram", "Paul Sutton", "0.1") ,sp_(0) { registerParameter("nfft", "FFT length", "512", false, nFft_x, Interval<int>(2,65536)); registerParameter("windowlength", "Spectrogram window length", "256", false, windowLength_x, Interval<int>(2,65536)); registerParameter("delay", "Delay between windows", "128", false, delay_x, Interval<int>(2,65536)); registerParameter("nwindows", "Number of windows to average over", "16", false, nWindows_x, Interval<int>(1,65536)); registerParameter("beta", "Kaiser-Bessel window parameter", "8.6", false, beta_x, Interval<float>(0,64)); registerParameter("isprobe", "Act as a probe (provide PSDs via events)", "false", false, isProbe_x); registerParameter("issink", "Act as a sink (do not provide output)", "false", false, isSink_x); registerEvent( "psdevent", "An event providing the current estimated PSD (in dB)", TypeInfo< float >::identifier); }
bool CvSplit_Processor::onInit() { LOG(LTRACE) << "CvSplit_Processor::initialize\n"; h_onNewImage.setup(this, &CvSplit_Processor::onNewImage); registerHandler("onNewImage", &h_onNewImage); registerStream("in_img", &in_img); newImage = registerEvent("newImage"); if (props.channels < 1) { LOG(LERROR) << "CvSplit_Processor::number of channels must be positive\n"; return false; } mv.resize(props.channels); out_img.resize(props.channels); for (int i = 0; i < props.channels; ++i) { out_img[i] = new Base::DataStreamOut<cv::Mat>; registerStream("out_img_"+int2str(i), out_img[i]); } return true; }
encrev2_pluginAPI::encrev2_pluginAPI(FB::BrowserHostPtr host, encrev2_plugin &plugin) : m_host(host), m_plugin(plugin) { // Callable registerMethod("testEvent", make_method(this, &encrev2_pluginAPI::testEvent)); registerMethod("stream", make_method(this, &encrev2_pluginAPI::stream)); registerMethod("play", make_method(this, &encrev2_pluginAPI::play)); registerMethod("stop", make_method(this, &encrev2_pluginAPI::stop)); registerMethod("setOptions",make_method(this, &encrev2_pluginAPI::setOptions)); // Read-only property registerProperty("version", make_property(this, &encrev2_pluginAPI::get_version)); // Read-Write property registerProperty("hostname", make_property(this, &encrev2_pluginAPI::get_hostname, &encrev2_pluginAPI::set_hostname)); registerProperty("port", make_property(this, &encrev2_pluginAPI::get_port, &encrev2_pluginAPI::set_port)); // Event registerEvent("onfired"); }
void OMXMLReaderExpat::endElementHandler(const XML_Char* name) { TRACE("OMXMLReaderExpat::endElementHandler"); wchar_t* workBuffer = getWorkBuffer(xmlStringLen(name) + 1); OMUInt32 strLen = readCharacters(workBuffer, name, NAMESPACE_SEPARATOR); _uri = workBuffer; if (strLen > 0) { strLen = readCharacters(workBuffer, &(name[strLen + 1]), 0); } else { strLen = readCharacters(workBuffer, &(name[strLen]), 0); } _localName = workBuffer; XML_Status status = XML_StopParser(_parser, true); if (status != XML_STATUS_OK) { XML_Error errorCode = XML_GetErrorCode(_parser); if (errorCode != XML_ERROR_SUSPENDED) { throw OMException(getErrorString()); } } registerEvent(END_ELEMENT); }
/////////////////////////////////////////////////////////////////////////////// /// @fn PyHelloWorldAPI::PyHelloWorldAPI(const PyHelloWorldPtr& plugin, const FB::BrowserHostPtr host) /// /// @brief Constructor for your JSAPI object. You should register your methods, properties, and events /// that should be accessible to Javascript from here. /// /// @see FB::JSAPIAuto::registerMethod /// @see FB::JSAPIAuto::registerProperty /// @see FB::JSAPIAuto::registerEvent /////////////////////////////////////////////////////////////////////////////// PyHelloWorldAPI::PyHelloWorldAPI(const PyHelloWorldPtr& plugin, const FB::BrowserHostPtr& host) : m_plugin(plugin), m_host(host) { Py_Initialize(); globals = PyDict_New (); PyDict_SetItemString (globals, "__builtins__", PyEval_GetBuiltins ()); registerMethod("echo", make_method(this, &PyHelloWorldAPI::echo)); registerMethod("testEvent", make_method(this, &PyHelloWorldAPI::testEvent)); // Read-write property registerProperty("testString", make_property(this, &PyHelloWorldAPI::get_testString, &PyHelloWorldAPI::set_testString)); // Read-only property registerProperty("version", make_property(this, &PyHelloWorldAPI::get_version)); registerEvent("onfired"); registerMethod("hello_py", make_method(this, &PyHelloWorldAPI::hello_py)); registerMethod("getHelloPyExtension", make_method(this, &PyHelloWorldAPI::hello_py_extension)); // registerMethod("eval", make_method(this, &PyHelloWorldAPI::eval)); }
bool DisplayCorrespondence::onInit() { matched = registerEvent("matched"); h_onNewImage.setup(this, &DisplayCorrespondence::onNewImage); registerHandler("onNewImage", &h_onNewImage); registerStream("in_image_params", &in_image_params); registerStream("in_img", &in_img); registerStream("in_path", &in_path); registerStream("out_image", &out_image); registerStream("in_MatchedSourceForTile", &in_MatchedSourceForTile); registerStream("in_PositionOfPatchesInImages", &in_PositionOfPatchesInImages); registerStream("in_MatchedPatchInMatcher", &in_MatchedPatchInMatcher); registerStream("in_DistanceMap", &in_DistanceMap); registerStream("in_all_file_paths", &in_all_file_paths); registerStream("in_match_map", &in_match_map); registerStream("in_match_quality", &in_match_quality); LOG(LTRACE) << "DisplayCorrespondence::initialize\n"; // Register data streams, events and event handlers HERE! return true; }
bool ModelImporterInstance::init() { modelImporters.push_back(new WaveformObjImporter()); registerEvent("import", this, &ModelImporterInstance::import); return true; }
//------------------------------------------------------------------------- void InitShell() { IncomingLength = 0; nodeid = CURRENT_NODE_ID; registerEvent(0xfefe, 64, &IncomingLength, IncomingMsg, PacketInfo, WakeupMe); init_breakpoint_table(); }
bool BaseEvents::loadFromXml() { if (m_loaded) { std::cout << "[Error - BaseEvents::loadFromXml] It's already loaded." << std::endl; return false; } std::string scriptsName = getScriptBaseName(); std::string basePath = "data/" + scriptsName + "/"; if (getScriptInterface().loadFile(basePath + "lib/" + scriptsName + ".lua") == -1) { std::cout << "[Warning - BaseEvents::loadFromXml] Can not load " << scriptsName << " lib/" << scriptsName << ".lua" << std::endl; } std::string filename = basePath + scriptsName + ".xml"; pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(filename.c_str()); if (!result) { std::cout << "[Error - BaseEvents::loadFromXml] Failed to load " << filename << ": " << result.description() << std::endl; return false; } m_loaded = true; for (pugi::xml_node node = doc.child(scriptsName.c_str()).first_child(); node; node = node.next_sibling()) { Event* event = getEvent(node.name()); if (!event) { continue; } if (!event->configureEvent(node)) { std::cout << "[Warning - BaseEvents::loadFromXml] Failed to configure event" << std::endl; delete event; continue; } bool success; pugi::xml_attribute scriptAttribute = node.attribute("script"); if (scriptAttribute) { std::string scriptFile = "scripts/" + std::string(scriptAttribute.as_string()); success = event->checkScript(basePath, scriptsName, scriptFile) && event->loadScript(basePath + scriptFile); } else { pugi::xml_attribute functionAttribute = node.attribute("function"); if (functionAttribute) { success = event->loadFunction(functionAttribute.as_string()); } else { success = false; } } if (!success || !registerEvent(event, node)) { delete event; } } return true; }
void NCLApplication::registerEditingCommands( void ) { printf( "[app::NCLApplication] Register editing commands\n" ); std::vector<std::string> names; NCLEventFinder iter(names); loopEvents( iter ); BOOST_FOREACH( const std::string &name, names ) { printf( "[app::NCLApplication] Editing command found: event=%s\n", name.c_str() ); registerEvent( name, "nclEditingCommand", boost::bind(&NCLApplication::onEditingCommand,this,_1) ); }
void OMXMLReaderExpat::notationDeclHandler(const XML_Char* notationName, const XML_Char* base, const XML_Char* systemId, const XML_Char* publicId) { TRACE("OMXMLReaderExpat::notationDeclHandler"); wchar_t* workBuffer = getWorkBuffer(xmlStringLen(notationName) + 1); OMUInt32 strLen = readCharacters(workBuffer, notationName, 0); _notationName = workBuffer; if (base != 0) { workBuffer = getWorkBuffer(xmlStringLen(base) + 1); strLen = readCharacters(workBuffer, base, 0); _base = workBuffer; } else { _base = L""; } if (systemId != 0) { workBuffer = getWorkBuffer(xmlStringLen(systemId) + 1); strLen = readCharacters(workBuffer, systemId, 0); _systemID = workBuffer; } else { _systemID = L""; } if (publicId != 0) { workBuffer = getWorkBuffer(xmlStringLen(publicId) + 1); strLen = readCharacters(workBuffer, publicId, 0); _publicID = workBuffer; } else { _publicID = L""; } XML_Status status = XML_StopParser(_parser, true); if (status != XML_STATUS_OK) { XML_Error errorCode = XML_GetErrorCode(_parser); if (errorCode != XML_ERROR_SUSPENDED) { throw OMException(getErrorString()); } } registerEvent(NOTATION_DECL); }
// Creates the stream, registers the data and end events and starts the stream void readFile( void * loop ){ gEventLoop = loop; void * stream = createStream( "prod", "stahp", chunk, initRead, loop ); if (stream == NULL){ fprintf(stderr, "cannot create stream\n"); exit(-1); } // remember the stream for use in terminate function gStream = stream; registerEvent( loop, "prod", addToSum ); registerEvent( loop, "stahp", terminate ); // start the stream startStream( stream, fileName ); }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void init(void) { play_led_en(); play_led_off(); dbg_led_en(); dbg_led_on(); // initialize effects sfx_init(); // initialize SPI EEPROM support spie_init(); // initialize USART uart_init(); // setup the UART receive interrupt handler uartBeginReceive(&receiveCallback); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // establish event timer & handler // timer1, event timer // Set CTC mode (Clear Timer on Compare Match) (p.133) // Have to set OCR1A *before anything else*, otherwise it gets reset to 0! PRR &= ~(1<<PRTIM1); OCR1A = (F_CPU / SAMPLE_RATE); TCCR1A = 0; TCCR1B = (1<<WGM12) | // CTC (1<<CS10); TIMSK1 = (1<<OCIE1A); setTimeBase(SAMPLE_RATE); // setup sleep mode set_sleep_mode(SLEEP_MODE_PWR_DOWN); sleep_enable(); // setup switch input SWITCH_DDR &= ~(1<<SWITCH_PIN); SWITCH_PINS |= (1<<SWITCH_PIN); SWITCH_PCMSK |= (1<<SWITCH_PCINT); PCICR |= (1<<SWITCH_PCICR); registerHighPriorityEvent(fadeStatusLed, 0, EVENT_STATE_NONE); registerEvent(readNextStatusVal, 500, EVENT_STATE_NONE); // enable all interrupts sei(); }
FBTestPluginAPI::FBTestPluginAPI(boost::shared_ptr<FBTestPlugin> plugin, FB::BrowserHostPtr host) : m_host(host), m_pluginWeak(plugin) { registerMethod("add", make_method(this, &FBTestPluginAPI::add)); registerMethod(L"echo", make_method(this, &FBTestPluginAPI::echo)); registerMethod(L"eval", make_method(this, &FBTestPluginAPI::eval)); registerMethod(L"asString", make_method(this, &FBTestPluginAPI::asString)); registerMethod(L"asBool", make_method(this, &FBTestPluginAPI::asBool)); registerMethod(L"asInt", make_method(this, &FBTestPluginAPI::asInt)); registerMethod("asDouble", make_method(this, &FBTestPluginAPI::asDouble)); registerMethod("listArray", make_method(this, &FBTestPluginAPI::listArray)); registerMethod("reverseArray", make_method(this, &FBTestPluginAPI::reverseArray)); registerMethod("getUserData", make_method(this, &FBTestPluginAPI::getUserData)); registerMethod("getUserArray", make_method(this, &FBTestPluginAPI::getUserArray)); registerMethod("getObjectKeys", make_method(this, &FBTestPluginAPI::getObjectKeys)); registerMethod("getObjectValues", make_method(this, &FBTestPluginAPI::getObjectValues)); registerMethod("testEvent", make_method(this, &FBTestPluginAPI::testEvent)); registerMethod("testStreams", make_method(this, &FBTestPluginAPI::testStreams)); registerMethod("getTagAttribute", make_method(this, &FBTestPluginAPI::getTagAttribute)); registerMethod("getPageLocation", make_method(this, &FBTestPluginAPI::getPageLocation)); registerMethod("createThreadRunner", make_method(this, &FBTestPluginAPI::createThreadRunner)); registerMethod("optionalTest", make_method(this, &FBTestPluginAPI::optionalTest)); registerMethod("getURL", make_method(this, &FBTestPluginAPI::getURL)); registerMethod("postURL", make_method(this, &FBTestPluginAPI::postURL)); registerMethod(L"скажи", make_method(this, &FBTestPluginAPI::say)); registerMethod("addWithSimpleMath", make_method(this, &FBTestPluginAPI::addWithSimpleMath)); registerMethod("createSimpleMath", make_method(this, &FBTestPluginAPI::createSimpleMath)); registerMethod("countArrayLength", make_method(this, &FBTestPluginAPI::countArrayLength)); // Read-write property registerProperty("testString", make_property(this, &FBTestPluginAPI::get_testString, &FBTestPluginAPI::set_testString)); registerProperty("simpleMath", make_property(this, &FBTestPluginAPI::get_simpleMath)); // Read-only property registerProperty("someInt", make_property(this, &FBTestPluginAPI::get_someInt)); registerProperty("pluginPath", make_property(this, &FBTestPluginAPI::get_pluginPath)); registerEvent("onfired"); m_simpleMath = boost::make_shared<SimpleMathAPI>(m_host); }
bool DcImageProcessing::onInit() { LOG(LTRACE) << "DcImageProcessing::initialize\n"; // Register handler. h_onNewImage.setup(this, &DcImageProcessing::onNewImage); registerHandler("onNewImage", &h_onNewImage); // Register event. newImage = registerEvent("newImage"); // Register data streams. registerStream("in_img", &in_img); registerStream("out_img", &out_img); return true; }
bool CvColorConv_Processor::onInit() { LOG(LTRACE) << "CvThreshold_Processor::initialize\n"; h_onNewImage.setup(this, &CvColorConv_Processor::onNewImage); registerHandler("onNewImage", &h_onNewImage); registerStream("in_img", &in_img); newImage = registerEvent("newImage"); registerStream("out_img", &out_img); return true; }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // main func int main(void) { init(); // run as fast as possible registerHighPriorityEvent(ledPWMHandler, 0, 0); // move to the next sleepy-eye value registerEvent(nextSleepyEyeHandler, SAMPLE_RATE / 4, 0); // slide-up/slide-down to current sleepy-eye value registerEvent(slideToSleepyEyeHandler, SAMPLE_RATE / 100, 0); // subscribe to a time-based ACD sampling registerHighPriorityEvent(adcSampleHandler, SAMPLE_RATE / 50, 0); registerOneShot(ampOnHandler, SAMPLE_RATE, 0); // main program loop while(1) { eventsDoEvents(); } }