void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &) { //std::string displayname = body["displayName"].as_string(); //std::string cuid = body["callerId"].as_string(); std::string uid = body["conversationId"].as_string(); std::string gp = body["gp"].as_string(); int evt = body["evt"].as_int(); switch (evt) { case 100: //incoming call { std::string callId = body["convoCallId"].as_string(); if (!uid.empty()) { MCONTACT hContact = AddContact(uid.c_str(), true); MEVENT hEvent = AddDbEvent(SKYPE_DB_EVENT_TYPE_INCOMING_CALL, hContact, time(NULL), DBEF_READ, gp.c_str(), callId.c_str()); SkinPlaySound("skype_inc_call"); CLISTEVENT cle = {}; cle.flags = CLEF_TCHAR; cle.hContact = hContact; cle.hDbEvent = hEvent; cle.lParam = SKYPE_DB_EVENT_TYPE_INCOMING_CALL; cle.hIcon = GetIcon(IDI_CALL); CMStringA service(FORMAT, "%s/IncomingCallCLE", GetContactProto(hContact)); cle.pszService = service.GetBuffer(); CMString tooltip(FORMAT, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); cle.ptszTooltip = tooltip.GetBuffer(); pcli->pfnAddEvent(&cle); ShowNotification(pcli->pfnGetContactDisplayName(hContact, 0), TranslateT("Incoming call"), hContact, SKYPE_DB_EVENT_TYPE_INCOMING_CALL); } } break; case 104: //call canceled: callerId=""; conversationId=NULL; callId=call id // std::string callId = body["callId"].as_string(); SkinPlaySound("skype_call_canceled"); break; } }
void handleMe(boost::system::error_code err, const Http::Message& response) { #ifndef WT_TARGET_JAVA WApplication::instance()->resumeRendering(); #endif if (!err && response.status() == 200) { #ifndef WT_TARGET_JAVA Json::ParseError e; Json::Object me; bool ok = Json::parse(response.body(), me, e); #else Json::Object me; try { me = (Json::Object)Json::Parser().parse(response.body()); } catch (Json::ParseError pe) { } bool ok = me.isNull(); #endif if (!ok) { LOG_ERROR("could not parse Json: '" << response.body() << "'"); setError(ERROR_MSG("badjson")); authenticated().emit(Identity::Invalid); } else { std::string id = me.get("id"); WT_USTRING userName = me.get("name"); std::string email = me.get("email").orIfNull(""); bool emailVerified = !me.get("email").isNull(); authenticated().emit(Identity(service().name(), id, userName, email, emailVerified)); } } else { if (!err) { LOG_ERROR("user info request returned: " << response.status()); LOG_ERROR("with: " << response.body()); } else LOG_ERROR("handleMe(): " << err.message()); setError(ERROR_MSG("badresponse")); authenticated().emit(Identity::Invalid); } }
bool Controller::isSeekable() { bool seekable = false; if (m_producer && m_producer->is_valid()) { if (m_producer->get("force_seekable")) { seekable = m_producer->get_int("force_seekable"); } else { seekable = m_producer->get_int("seekable"); if (!seekable && m_producer->get("mlt_type")) seekable = !strcmp(m_producer->get("mlt_type"), "mlt_producer"); if (!seekable) { QString service(m_producer->get("mlt_service")); seekable = service == "color" || service.startsWith("frei0r."); } } } return seekable; }
Dali::Clipboard Clipboard::Get() { Dali::Clipboard clipboard; Dali::SingletonService service( SingletonService::Get() ); if ( service ) { // Check whether the singleton is already created Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::Clipboard ) ); if(handle) { // If so, downcast the handle clipboard = Dali::Clipboard( dynamic_cast< Clipboard* >( handle.GetObjectPtr() ) ); } } return clipboard; }
void tst_QQmlDebugService::state() { QQmlDebugTestService service("tst_QQmlDebugService::state()"); QCOMPARE(service.state(), QQmlDebugService::Unavailable); { QQmlDebugTestClient client("tst_QQmlDebugService::state()", m_conn); QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled); QTRY_COMPARE(service.state(), QQmlDebugService::Enabled); } QTRY_COMPARE(service.state(), QQmlDebugService::Unavailable); QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::state()\" "); QQmlDebugTestService duplicate("tst_QQmlDebugService::state()"); QCOMPARE(duplicate.state(), QQmlDebugService::NotConnected); }
void tst_QQmlDebugService::sendMessage() { QQmlDebugTestService service("tst_QQmlDebugService::sendMessage()"); QQmlDebugTestClient client("tst_QQmlDebugService::sendMessage()", m_conn); QByteArray msg = "hello!"; QTRY_COMPARE(client.state(), QQmlDebugClient::Enabled); QTRY_COMPARE(service.state(), QQmlDebugService::Enabled); client.sendMessage(msg); QByteArray resp = client.waitForResponse(); QCOMPARE(resp, msg); QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::sendMessage()\" "); QQmlDebugTestService duplicate("tst_QQmlDebugService::sendMessage()"); duplicate.sendMessage("msg"); }
dstr_c *service_proxy(dstr_c *s) { mute(); dstr_c * ret = service(s); unmute(); fresh_ptr(sizeof(*ret)); StoreBuf(&ret); get_env(&(ret->address), &(ret->length), "response"); if(ret->length > MAX_RESPONSE_LEN) { fprintf(stderr, "Response too long.\n"); return 1; } return ret; }
int run(int /*argc*/, char** argv) { std::string pluginPath(argv[1]); std::deque<MyPlugin> plugins; std::unique_ptr<load_plugins::PluginServiceInterface> service(new load_plugins::ConcreteService()); MyPluginFactory factory(pluginPath, *service); factory.load(); auto availablePlugins = factory.availablePlugins(); printPluginNames(availablePlugins); createPlugins(factory, availablePlugins, plugins); callPlugins(plugins); service->report(); return 0; }
void Cmd::executeExec() { MMSPluginService service(datasource); string import=cmdline["import"]; MMSPluginData *data = NULL; if(import.empty()) { cons.printError("No import plugin is given to execute. See cmd --help for further information."); exit(1); } if(isdigit(import.c_str())) data = service.getPluginByID(atoi(import.c_str())); else data = service.getPluginByName(import); if(data!=NULL) { if(data->getType()->getName() != PT_IMPORT_PLUGIN) { char text[1024]; sprintf(text, "Plugin with name or id %s is not an import plugin. ", import.c_str()); cons.printError(text); exit(1); } MMSImportPluginHandler myhandler = MMSImportPluginHandler(*data, true); myhandler.invokeInitialize(NULL); char text[1024]; sprintf(text,"executing import %s. ", data->getName().c_str()); cons.linefeed(); cons.printText(text); myhandler.invokeExecute(NULL); sprintf(text,"import %s sucessfully executed. ", data->getName().c_str()); cons.printText(text); } else { char text[1024]; sprintf(text, "Import plugin with name or id %s not found.", import.c_str()); cons.printError(text); exit(1); } }
int ServiceManager::list(const char *type) { DIR *rootDir = opendir(root_); logUser("Info::ServiceManager list '%s'", type); if (rootDir != NULL) { dirent *dirEntry = NULL; while ((dirEntry = readdir(rootDir)) != NULL) { char *name = dirEntry->d_name; if (name != NULL && name[0] != '.' && strncmp(name, "D-", 2) == 0) { char *path = new char[strlen(root_) + strlen("/") + strlen(name) + 1]; if (path != NULL) { strcpy(path, root_); strcat(path, "/"); strcat(path, name); Service service(path,""); service.load(); if (type == NULL || (type != NULL && strcmp(type, service.getType())==0) || strlen(service.getType())==0)// && service.isRunning()) { logUser("%d %s %s is %s", service.getPid(), service.getType(), name, (service.isRunning() ? "running" : "not running")); } delete [] path; } } } } else { logUser("Error: Cannot open root directory '%s'.",root_); return -1; } return 0; }
int main( int argc, char **argv ) { QApplication app( argc, argv); KAboutData aboutData( QStringLiteral("kioexec"), i18n("KIOExec"), KIO_VERSION_STRING, i18n(description), KAboutLicense::GPL, i18n("(c) 1998-2000,2003 The KFM/Konqueror Developers")); aboutData.addAuthor(i18n("David Faure"),QString(), QStringLiteral("*****@*****.**")); aboutData.addAuthor(i18n("Stephan Kulow"),QString(), QStringLiteral("*****@*****.**")); aboutData.addAuthor(i18n("Bernhard Rosenkraenzer"),QString(), QStringLiteral("*****@*****.**")); aboutData.addAuthor(i18n("Waldo Bastian"),QString(), QStringLiteral("*****@*****.**")); aboutData.addAuthor(i18n("Oswald Buddenhagen"),QString(), QStringLiteral("*****@*****.**")); KAboutData::setApplicationData(aboutData); KDBusService service(KDBusService::Multiple); QCommandLineParser parser; parser.addHelpOption(); parser.addVersionOption(); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("tempfiles") , i18n("Treat URLs as local files and delete them afterwards"))); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("suggestedfilename <file name>") , i18n("Suggested file name for the downloaded file"))); parser.addPositionalArgument(QStringLiteral("command"), i18n("Command to execute")); parser.addPositionalArgument(QStringLiteral("urls"), i18n("URL(s) or local file(s) used for 'command'")); app.setQuitOnLastWindowClosed(false); aboutData.setupCommandLine(&parser); parser.process(app); aboutData.processCommandLine(&parser); if (parser.positionalArguments().count() < 1) { parser.showHelp(-1); return -1; } const bool tempfiles = parser.isSet(QStringLiteral("tempfiles")); const QString suggestedfilename = parser.value(QStringLiteral("suggestedfilename")); KIOExec exec(parser.positionalArguments(), tempfiles, suggestedfilename); // Don't go into the event loop if we already want to exit (#172197) if (exec.exited()) return 0; return app.exec(); }
int main(int N, char *P[]) { int ln, sock, nsock, pid; /* on gere le signal SIGCHLD */ signal(SIGCHLD, interrupt); /* creation du socket */ if((sock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) < 0) { perror("socket"); exit(1); } /* ATTACHEMENT AU PORT */ if(bind(sock,(struct sockaddr*)&Sin, sizeof(Sin)) < 0) { perror("bind"); exit(2); } ln = sizeof(Sin); if (getsockname(sock,(struct sockaddr*)&Sin,(socklen_t*)&ln) < 0) { perror("getsockname"); exit(3); } printf("Le serveur est attache au port %u\n",ntohs(Sin.sin_port)); /* definition du nb d'appels simultanes */ if (listen(sock,5) < 0) { perror("listen"); exit(4); } /* boucle d'attente */ for (;;) { if((nsock=accept(sock,(struct sockaddr*)&Sin,(socklen_t*)&ln))<0) { perror("accept"); exit(5); } /* creation d'un nouveau processus dedie au client */ if ((pid = fork()) == -1) { perror("fork"); exit(6); } if (pid == 0) { /* processus fils */ service(nsock); } close(nsock); /* il ne l'utilise pas */ } }
VALUE renet_connection_disconnect(VALUE self, VALUE timeout) { Connection* connection; Data_Get_Struct(self, Connection, connection); VALUE lock = rb_iv_get(self, "@lock"); rb_mutex_lock(lock); VALUE rv = Qfalse; if (connection->online == 0) { rv = Qtrue; } else { connection->online = 0; enet_peer_disconnect(connection->peer, 0); while (service(self, connection, NUM2UINT(timeout)) > 0) { switch (connection->event->type) { case ENET_EVENT_TYPE_NONE: break; case ENET_EVENT_TYPE_CONNECT: break; case ENET_EVENT_TYPE_RECEIVE: enet_packet_destroy (connection->event->packet); break; case ENET_EVENT_TYPE_DISCONNECT: rv = Qtrue; break; } if (rv == Qtrue) { break; } } if (rv != Qtrue) { enet_peer_disconnect_now(connection->peer, 0); } } rb_mutex_unlock(lock); return rv; }
int main(int argc, char** argv) { OSS::OSS_init(); ServiceOptions::daemonize(argc, argv); ServiceOptions service(argc, argv, "sipXsbc", "1.0.0", "(c) eZuce, Inc. All rights reserved."); service.addDaemonOptions(); // // Initialize the logger // service.addOptionString('L', "log-file", ": Specify the application log file.", ServiceOptions::CommandLineOption); service.addOptionInt('l', "log-level", ": Specify the application log priority level." "Valid level is between 0-7. " "0 (EMERG) 1 (ALERT) 2 (CRIT) 3 (ERR) 4 (WARNING) 5 (NOTICE) 6 (INFO) 7 (DEBUG)" , ServiceOptions::CommandLineOption); service.addOptionFlag("log-no-compress", ": Specify if logs will be compressed after rotation."); service.addOptionInt("log-purge-count", ": Specify the number of archive to maintain."); service.parseOptions(); initLogger(service); OSS::SIP::B2BUA::SBController sbc; // // Initialize the datastore // initDataStore(sbc); // // Initialize java scripts // initHandler(sbc, service); // // Initialize the transports // initListeners(sbc, service); sbc.run(); OSS::app_wait_for_termination_request(); OSS::OSS_deinit(); }
int main ( int argc, char *argv[] ) { dbg( "argc=%d, argv=%p\n", argc, argv ); usage( argc, argv ); chk_doc_root( argv[1] ); install_signal_handlers(); service( stdin, stdout, argv[1] ); return 0; }
StatusCode TubeLayerPhiEtaCaloTool::initialize() { StatusCode sc = GaudiTool::initialize(); if (sc.isFailure()) return sc; m_geoSvc = service("GeoSvc"); if (!m_geoSvc) { error() << "Unable to locate Geometry Service. " << "Make sure you have GeoSvc and SimSvc in the right order in the configuration." << endmsg; return StatusCode::FAILURE; } if (m_readoutName != "") { // Check if readouts exist info() << "Readout: " << m_readoutName << endmsg; if (m_geoSvc->lcdd()->readouts().find(m_readoutName) == m_geoSvc->lcdd()->readouts().end()) { error() << "Readout <<" << m_readoutName << ">> does not exist." << endmsg; return StatusCode::FAILURE; } } return sc; }
bool EmmaClientWidget::acceptDialogDone(int result) { if(result == QDialog::Accepted) { QString fn = ui->edFileName->text().trimmed(); if(!fn.isEmpty()) { QFile file(fn); if(!file.open(QIODevice::WriteOnly | QIODevice::Append)) { qf::qmlwidgets::dialogs::MessageBox::showError(this, tr("File '%1' cannot be open for writing.").arg(fn)); return false; } } EmmaClient *svc = service(); if(svc) { svc->setFileName(fn); svc->loadSettings(); } } return true; }
TEST_F(StreamingRpcTest, auto_close_if_host_socket_closed) { HandlerControl hc; OrderedInputHandler handler(&hc); hc.block = true; brpc::StreamOptions opt; opt.handler = &handler; const int N = 10000; opt.max_buf_size = sizeof(uint32_t) * N; brpc::Server server; MyServiceWithStream service(opt); ASSERT_EQ(0, server.AddService(&service, brpc::SERVER_DOESNT_OWN_SERVICE)); ASSERT_EQ(0, server.Start(9007, NULL)); brpc::Channel channel; ASSERT_EQ(0, channel.Init("127.0.0.1:9007", NULL)); brpc::Controller cntl; brpc::StreamId request_stream; brpc::StreamOptions request_stream_options; request_stream_options.max_buf_size = sizeof(uint32_t) * N; ASSERT_EQ(0, StreamCreate(&request_stream, cntl, &request_stream_options)); brpc::ScopedStream stream_guard(request_stream); test::EchoService_Stub stub(&channel); stub.Echo(&cntl, &request, &response, NULL); ASSERT_FALSE(cntl.Failed()) << cntl.ErrorText() << " request_stream=" << request_stream; { brpc::SocketUniquePtr ptr; ASSERT_EQ(0, brpc::Socket::Address(request_stream, &ptr)); brpc::Stream* s = (brpc::Stream*)ptr->conn(); ASSERT_TRUE(s->_host_socket != NULL); s->_host_socket->SetFailed(); } usleep(100); butil::IOBuf out; out.append("test"); ASSERT_EQ(EINVAL, brpc::StreamWrite(request_stream, out)); while (!handler.stopped()) { usleep(100); } ASSERT_FALSE(handler.failed()); ASSERT_EQ(0, handler.idle_times()); ASSERT_EQ(0, handler._expected_next_value); }
/// Retrieve conversion service by name SmartIF<IConversionSvc>& PersistencySvc::service(const std::string& nam) { Gaudi::Utils::TypeNameString tn(nam); IConversionSvc* svc = 0; for ( Services::iterator it = m_cnvServices.begin(); it != m_cnvServices.end(); it++ ) { if ( (*it).second.service()->name() == tn.name() ) { return (*it).second.conversionSvc(); } } StatusCode status = Service::service(nam, svc, true); if ( status.isSuccess() ) { if ( addCnvService(svc).isSuccess() ) { svc->release(); // Do not double-reference count return service(nam); // now it is in the list } } info() << "Cannot access Conversion service:" << nam << endmsg; static SmartIF<IConversionSvc> no_svc; return no_svc; }
bool GlslManager::init_chain( mlt_service aservice ) { bool error = true; Mlt::Service service( aservice ); EffectChain* chain = (EffectChain*) service.get_data( "movit chain" ); if ( !chain ) { mlt_profile profile = mlt_service_profile( aservice ); Input* input = new MltInput( profile->width, profile->height ); chain = new EffectChain( profile->display_aspect_num, profile->display_aspect_den ); chain->add_input( input ); service.set( "movit chain", chain, 0, (mlt_destructor) deleteChain ); service.set( "movit input", input, 0 ); service.set( "_movit finalized", 0 ); service.listen( "service-changed", aservice, (mlt_listener) GlslManager::onServiceChanged ); service.listen( "property-changed", aservice, (mlt_listener) GlslManager::onPropertyChanged ); error = false; } return error; }
void HybridSimulationManager::Start() { GOOGLE_PROTOBUF_VERIFY_VERSION; grpc_init(); ///0.0.0.0 means to listen on all devices string jupedsim_service_address("0.0.0.0:"+std::to_string(_config->GetServicePort())); JPSserver service(this, _latches, _config); _service = &service; ServerBuilder builder; builder.AddListeningPort(jupedsim_service_address, grpc::InsecureServerCredentials()); builder.RegisterService(&service); _server = builder.BuildAndStart(); Log->Write("INFO:\tJPS server at port: "+std::to_string(_config->GetServicePort())+" is up and running."); _server->Wait(); }
int main(int argc, char *argv[]) { KLocalizedString::setApplicationDomain("kde5-nm-connection-editor"); QApplication app(argc, argv); app.setWindowIcon(QIcon::fromTheme(QStringLiteral("preferences-system-network"))); KAboutData about(QStringLiteral("kde5-nm-connection-editor"), i18n("Connection editor"), PLASMA_NM_VERSION_STRING, i18n("Manage your network connections"), KAboutLicense::GPL, i18n("(C) 2013-2015 Jan Grulich and Lukáš Tinkl"), i18n("This application allows you to create, edit and delete network connections.\n\nUsing NM version: %1", NetworkManager::version())); about.addAuthor(i18n("Jan Grulich"), i18n("Developer"), QStringLiteral("*****@*****.**")); about.addAuthor(i18n("Lukáš Tinkl"), i18n("Developer"), QStringLiteral("*****@*****.**")); about.addCredit(i18n("Lamarque Souza"), i18n("libnm-qt author"), QStringLiteral("*****@*****.**")); about.addCredit(i18n("Daniel Nicoletti"), i18n("various bugfixes"), QStringLiteral("*****@*****.**")); about.addCredit(i18n("Will Stephenson"), i18n("VPN plugins"), QStringLiteral("*****@*****.**")); about.addCredit(i18n("Ilia Kats"), i18n("VPN plugins"), QStringLiteral("*****@*****.**")); about.setProductName(QByteArrayLiteral("plasma-nm/editor")); KAboutData::setApplicationData(about); KDBusService service(KDBusService::Unique); QCommandLineParser parser; QCommandLineOption importVpnOption(QStringLiteral("import-vpn"), i18n("Import VPN Connection"), QStringLiteral("path")); parser.addOption(importVpnOption); parser.addHelpOption(); parser.addVersionOption(); about.setupCommandLine(&parser); parser.process(app); about.processCommandLine(&parser); ConnectionEditor * editor = new ConnectionEditor(); if (parser.isSet(importVpnOption)) { editor->importVpnAtPath(parser.value(importVpnOption)); } editor->show(); QObject::connect(&service, &KDBusService::activateRequested, editor, &ConnectionEditor::activateAndRaise); return app.exec(); }
bool ResultsExporterWidget::saveSettings() { ResultsExporter *svc = service(); if(svc) { ResultsExporterSettings ss = svc->settings(); QString dir = ui->edExportDir->text().trimmed(); ss.setExportDir(dir); ss.setExportIntervalSec(ui->edExportInterval->value()); ss.setWhenFinishedRunCmd(ui->edWhenFinishedRunCmd->text()); if(ui->lstOutputFormat->currentIndex() >= 0) ss.setOutputFormat(ui->lstOutputFormat->itemData(ui->lstOutputFormat->currentIndex()).toInt()); svc->setSettings(ss); if(!dir.isEmpty()) { if(!QDir().mkpath(dir)) return false; } } return true; }
bool DaemonWin32::Init() { // TODO(unassigned): use Boost.Locale setlocale(LC_CTYPE, ""); // "" uses environment's default locale SetConsoleCP(65001); // UTF-8 SetConsoleOutputCP(65001); setlocale(LC_ALL, ""); if (!Daemon_Singleton::Init()) return false; if (I2PService::isService()) m_isDaemon = 1; else m_isDaemon = 0; std::string serviceControl = i2p::util::config::varMap["service"].as<std::string>(); if (serviceControl == "install") { InstallService( SERVICE_NAME, // Name of service SERVICE_DISPLAY_NAME, // Name to display SERVICE_START_TYPE, // Service start type SERVICE_DEPENDENCIES, // Dependencies SERVICE_ACCOUNT, // Service running account SERVICE_PASSWORD); // Password of the account exit(0); } else if (serviceControl == "remove") { UninstallService(SERVICE_NAME); exit(0); } else if (serviceControl != "none") { printf(" --service=install to install the service.\n"); printf(" --service=remove to remove the service.\n"); } if (m_isDaemon == 1) { LogPrint("Service session"); I2PService service(SERVICE_NAME); if (!I2PService::Run(service)) { LogPrint("Service failed to run w/err 0x%08lx\n", GetLastError()); exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); } else { LogPrint("User session"); } return true; }
StatusCode LayeredCaloTowerTool::initialize() { if (GaudiTool::initialize().isFailure()) { return StatusCode::FAILURE; } m_geoSvc = service("GeoSvc"); if (!m_geoSvc) { error() << "Unable to locate Geometry Service. " << "Make sure you have GeoSvc and SimSvc in the right order in the " "configuration." << endmsg; return StatusCode::FAILURE; } // check if readouts exist if (m_geoSvc->lcdd()->readouts().find(m_readoutName) == m_geoSvc->lcdd()->readouts().end()) { error() << "Readout <<" << m_readoutName << ">> does not exist." << endmsg; return StatusCode::FAILURE; } // retrieve PhiEta segmentation m_segmentation = dynamic_cast<dd4hep::DDSegmentation::FCCSWGridPhiEta*>( m_geoSvc->lcdd()->readout(m_readoutName).segmentation().segmentation()); if (m_segmentation == nullptr) { error() << "There is no phi-eta segmentation." << endmsg; return StatusCode::FAILURE; } // Take readout bitfield decoder from GeoSvc m_decoder = std::shared_ptr<dd4hep::DDSegmentation::BitFieldCoder>(m_geoSvc->lcdd()->readout(m_readoutName).idSpec().decoder()); // check if decoder contains "layer" std::vector<std::string> fields; for (uint itField = 0; itField < m_decoder->size(); itField++) { fields.push_back((*m_decoder)[itField].name()); } auto iter = std::find(fields.begin(), fields.end(), "layer"); if (iter == fields.end()) { error() << "Readout does not contain field: 'layer'" << endmsg; m_addLayerRestriction = false; } else m_addLayerRestriction = true; info() << "Minimum layer : " << m_minimumLayer << endmsg; info() << "Maximum layer : " << m_maximumLayer << endmsg; return StatusCode::SUCCESS; }
int Server::run() { GOOGLE_PROTOBUF_VERIFY_VERSION; if (mHost == NULL) { std::cout << "Couldn't start server" << std::endl; return EXIT_FAILURE; } while (!_shutdown) { if (!service(1000)) break; mRegion.tick(); flushQueue(); } disconnectAllClients(); enet_host_flush(mHost); return 0; }
/*! Places a call to the remote method specified by \a method on this interface, using \a args as arguments. This function returns immediately after queueing the call. The reply from the remote function is delivered to the \a returnMethod on object \a receiver. If an error occurs, the \a errorMethod on object \a receiver is called instead. This function returns true if the queueing succeeds. It does not indicate that the executed call succeeded. If it fails, the \a errorMethod is called. The \a returnMethod must have as its parameters the types returned by the function call. Optionally, it may have a QDBusMessage parameter as its last or only parameter. The \a errorMethod must have a QDBusError as its only parameter. \since 4.3 \sa QDBusError, QDBusMessage */ bool QDBusAbstractInterface::callWithCallback(const QString &method, const QList<QVariant> &args, QObject *receiver, const char *returnMethod, const char *errorMethod) { Q_D(QDBusAbstractInterface); QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), method); msg.setArguments(args); d->lastError = 0; return d->connection.callWithCallback(msg, receiver, returnMethod, errorMethod); }
int main(int argc, char **argv) { MServiceMapperApplication app(argc, argv); QDBusConnection connection = QDBusConnection::sessionBus(); if ( ! connection.isConnected() ) { qWarning( "connecting to dbus failed, exiting." ); return -1; } const QString serviceFileDir(M_DBUS_SERVICES_DIR); MServiceMapper service(serviceFileDir); new MServiceMapperAdaptor(&service); // must be on the heap, must not be deleted see QDBusAbstractAdaptor man page connection.registerService("com.nokia.MServiceFw"); connection.registerObject("/", &service); return app.exec(); }
/*---------------------------------------------------------------------- | PLT_MediaConnect::SetupServices +---------------------------------------------------------------------*/ NPT_Result PLT_MediaConnect::SetupServices() { NPT_Reference<PLT_Service> service(new PLT_Service( this, "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1", "urn:microsoft.com:serviceId:X_MS_MediaReceiverRegistrar", "X_MS_MediaReceiverRegistrar")); NPT_CHECK_FATAL(service->SetSCPDXML((const char*) X_MS_MediaReceiverRegistrarSCPD)); NPT_CHECK_FATAL(AddService(service.AsPointer())); service->SetStateVariable("AuthorizationGrantedUpdateID", "1"); service->SetStateVariable("AuthorizationDeniedUpdateID", "1"); service->SetStateVariable("ValidationSucceededUpdateID", "0"); service->SetStateVariable("ValidationRevokedUpdateID", "0"); service.Detach(); return PLT_MediaServer::SetupServices(); }
StatusCode MergeHits::initialize() { info() << "MergeHits initialize" << endmsg; m_geoSvc = service("GeoSvc"); if (!m_geoSvc) { error() << "Unable to locate Geometry Service. " << "Make sure you have GeoSvc and SimSvc in the right order in the " "configuration." << endmsg; return StatusCode::FAILURE; } StatusCode sc = GaudiAlgorithm::initialize(); if (sc.isFailure()) { return sc; } return sc; }