本文整理汇总了C++中serviceName函数的典型用法代码示例。如果您正苦于以下问题:C++ serviceName函数的具体用法?C++ serviceName怎么用?C++ serviceName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serviceName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qWarning
/*!
* Attempts to register the service on the local network.
*
* If noAutoRename is set to true, registration will fail if another service of the same service type
* is already registered with the same service name. Otherwise, the service name will be updated with
* a number to make it unique.
*
* \sa registered
* \sa registrationError
*/
void QxtDiscoverableService::registerService(bool noAutoRename)
{
if(state() != Unknown) {
qWarning() << "QxtDiscoverableService: Cannot register service while not in Unknown state";
emit registrationError(0);
return;
}
QStringList subtypes = qxt_d().serviceSubTypes;
subtypes.prepend(fullServiceType());
DNSServiceErrorType err;
err = DNSServiceRegister(&(qxt_d().service),
noAutoRename ? kDNSServiceFlagsNoAutoRename : 0,
qxt_d().iface,
serviceName().isEmpty() ? 0 : serviceName().toUtf8().constData(),
subtypes.join(",_").toUtf8().constData(),
domain().isEmpty() ? 0 : domain().toUtf8().constData(),
host().isEmpty() ? 0 : host().toUtf8().constData(),
qxt_d().port,
1, // must include null terminator
"",
QxtDiscoverableServicePrivate::registerServiceCallback,
&qxt_d());
if(err != kDNSServiceErr_NoError) {
qxt_d().state = Unknown;
emit registrationError(err);
} else {
qxt_d().state = Registering;
qxt_d().notifier = new QSocketNotifier(DNSServiceRefSockFD(qxt_d().service), QSocketNotifier::Read, this);
QObject::connect(qxt_d().notifier, SIGNAL(activated(int)), &qxt_d(), SLOT(socketData()));
}
}
示例2: isRunning
bool QtServiceController::isRunning() const
{
QtUnixSocket sock;
if (sock.connectTo(socketPath(serviceName())))
return true;
return false;
}
示例3: checkDaemonExistence
bool checkDaemonExistence(const char* daemonName)
{
SingleLogger* logger = SingleLogger::InitLogger();
std::string serviceName(daemonName);
bool isRunning = false;
std::string pidFileName("/var/run/" + serviceName + ".pid");
std::ifstream pidFile(pidFileName.c_str(), std::ifstream::binary);
if(pidFile.is_open())
{
long pid = 0;
std::string pidLine;
if (pidFile.is_open())
{
getline(pidFile, pidLine);
pid = std::stoi(pidLine);
kill(pid, 0);
isRunning = !(errno == ESRCH);
}
}
if (!isRunning)
{
std::ofstream pidFile(pidFileName.c_str(), std::ofstream::binary);
if (pidFile.is_open()) {
pidFile << getpid();
pidFile.close();
}
else
logger->logMessage(SingleLogger::WARNING, "pid file is not created");
}
else
logger->logMessage(SingleLogger::ERROR, "daemon already running");
return isRunning;
}
示例4: switch
void QtServiceBase::logMessage(const QString &message, QtServiceBase::MessageType type,
int, uint, const QByteArray &)
{
if (!d_ptr->sysd)
return;
int st;
switch(type) {
case QtServiceBase::Error:
st = LOG_ERR;
break;
case QtServiceBase::Warning:
st = LOG_WARNING;
break;
default:
st = LOG_INFO;
}
if (!d_ptr->sysd->ident) {
QString tmp = encodeName(serviceName(), TRUE);
int len = tmp.toLocal8Bit().size();
d_ptr->sysd->ident = new char[len+1];
d_ptr->sysd->ident[len] = '\0';
::memcpy(d_ptr->sysd->ident, tmp.toLocal8Bit().constData(), len);
}
openlog(d_ptr->sysd->ident, LOG_PID, LOG_DAEMON);
foreach(QString line, message.split('\n'))
syslog(st, "%s", line.toLocal8Bit().constData());
closelog();
}
示例5: executeService
bool ShellCommandService::executeService(TasCommandModel& model, TasResponse& response)
{
if(model.service() == serviceName() ){
TasCommand* command = getCommandParameters(model, "shellCommand");
if(command && !command->text().isEmpty()){
if (command->parameter("detached") == "true"){
detachedShellCommand(command->text(), response);
}
else if (command->parameter("threaded") == "true") {
shellTask(command->text(), response);
}
else if (command->parameter("status") == "true") {
TasCommand* command = getCommandParameters(model, "shellCommand");
if(command && !command->text().isEmpty()){
qint64 pid = command->text().toInt();
if (command->parameter("kill") == "true") {
killTask(pid, response);
} else {
shellStatus(pid, response);
}
}
}
else{
shellCommand(command->text(), response);
}
}
else{
response.setErrorMessage(NO_COMMAND_TO_EXECUTE);
}
return true;
}
else{
return false;
}
}
示例6: executeService
bool RegisterService::executeService(TasCommandModel& model, TasResponse& response)
{
if(model.service() == serviceName() ){
TasCommand* command = getCommandParameters(model, COMMAND_REGISTER);
if(command){
ClientDetails client;
bool ok;
//this should not really ever fail (app pid used to generate in client side)
quint64 clientPid = command->parameter(PLUGIN_ID).toULongLong(&ok);
client.processId = clientPid;
client.processName = command->parameter(PLUGIN_NAME);
#ifdef Q_OS_SYMBIAN
client.applicationUid = command->parameter(APP_UID);
#endif
client.pluginType = command->parameter(PLUGIN_TYPE);
client.socket = response.requester();
registerPlugin(client);
}
else{
command = getCommandParameters(model, COMMAND_UNREGISTER);
if(command){
unRegisterPlugin(*command);
}
}
return true;
}
else{
return false;
}
}
示例7: QDEBUG_WRITE
// ----------------------------------------------------------------------------
// MsgErrorWatcher::~MsgErrorWatcher
// @see MsgErrorWatcher.h
// ----------------------------------------------------------------------------
void MsgErrorWatcher::ShowNote(TMsgErrorNoteIds errornoteid)
{
QDEBUG_WRITE("MsgErrorWatcher::ShowNote : Enter")
QDEBUG_WRITE_FORMAT("errornoteid : ", errornoteid)
HbDeviceMessageBox messageBox(HbMessageBox::MessageTypeWarning);
QAction* actionView = NULL;
QAction* actionQuit = NULL;
const QAction* result = NULL;
//create dialog parameters
QString text("");
switch (errornoteid) {
case EDiskLowNote1:
text = LOC_MSG_ERRH_DISK_LOW_1;
break;
case EMemoryLowNote:
text = LOC_MSG_ERRH_MEMORY_LOW;
break;
case ERoamingNote:
text = LOC_MMS_OFF;
break;
case EInvalidAccessPointNote:
text = LOC_MSG_ERRH_ACCESS_POINTS_INV;
messageBox.setTimeout(HbPopup::NoTimeout);
messageBox.setText(text);
actionView = new QAction(LOC_OK, this);
messageBox.setAction(actionView, HbDeviceMessageBox::AcceptButtonRole);
actionQuit = new QAction(LOC_CANCEL, this);
messageBox.setAction(actionQuit, HbDeviceMessageBox::RejectButtonRole);
messageBox.setDismissPolicy(HbPopup::NoDismiss);
// launch Messagebox
result = messageBox.exec();
// if accepted launch view else quit
if (messageBox.isAcceptAction(result)) {
QList<QVariant> args;
QString serviceName("messagesettings");
QString operation("launchSettings(int)");
XQAiwRequest* request;
XQApplicationManager appManager;
request = appManager.create(serviceName, "com.nokia.symbian.IMessageSettings",
operation, false); // non embedded
if (request == NULL) {
return;
}
args << QVariant(MsgSettingsView::MMSView);
request->setArguments(args);
request->send();
delete request;
}
return;
default:
break;
}
HbDeviceNotificationDialog::notification("", text);
QDEBUG_WRITE("MsgErrorWatcher::ShowNote : Exit")
}
示例8: settings
bool QtServiceController::uninstall()
{
QSettings settings(QSettings::SystemScope, "QtSoftware");
settings.beginGroup("services");
settings.remove(serviceName());
settings.endGroup();
settings.sync();
QSettings::Status ret = settings.status();
if (ret == QSettings::AccessError) {
fprintf(stderr, "Cannot uninstall \"%s\". Cannot write to: %s. Check permissions.\n",
serviceName().toLatin1().constData(),
settings.fileName().toLatin1().constData());
}
return (ret == QSettings::NoError);
}
示例9: executeService
bool ObjectService::executeService(TasCommandModel& model, TasResponse& response)
{
if(model.service() == serviceName() ){
performObjectService(model, response);
return true;
}
else{
return false;
}
}
示例10: executeService
/*!
Passes service directed to plugins on to the correct plugin.
*/
bool InfoService::executeService(TasCommandModel& model, TasResponse& response)
{
if(model.service() == serviceName() ){
mLogger->performLogService(model, response);
return true;
}
else{
return false;
}
}
示例11: strcpy
void Master::executeInterruptionList()
{
int i = 0;
for(Linterrupt::interator n = interruptions.begin(); n != interruptions.end(); ++n)
{
//pegando o nome do servico
string serviceTemp = n->getService();
char *service = new char [serviceTemp.length()+1];
strcpy (service, serviceTemp.c_str());
char *name = strtok(service, "/");
string serviceName(name, strlen(name)+1);
if(inNodeList(serviceName))
{
for(Lnode::interator n = nodes.begin(); n != nodes.end(); ++n)
{
if(n->getName().compare(serviceTemp))
{
n->runService(serviceTemp);
}
}
Node *temp = n;
interruptions.remove(n);
detroy(temp);
continue;
}
if(inSuperNodeList(serviceName))
{
for(Lsnode::interator n = sNodes.begin(); n != sNodes.end(); ++n)
{
if(n->getName().compare(serviceTemp))
n->runService(serviceTemp);
}
Node *temp = n;
interruptions.remove(n);
detroy(temp);
continue;
}
int temp = inConnectionList(serviceName);
if(temp >= 0)
{
for(Lconection::interator n = connections.begin(); n != connections.end(); ++n)
{
if(temp == i)
n->sendMessage(serviceTemp);
i++;
}
Node *temp = n;
interruptions.remove(n);
detroy(temp);
}
}
}
示例12: Service
Service(int argc, char **argv)
: QtService<QCoreApplication>(argc, argv, "Elephant Service")
{
setServiceDescription("No description yet.");
qApp->setApplicationName(serviceName());
qApp->setOrganizationName("GKHY");
qApp->setOrganizationDomain("www.gkhy.com.cn");
setServiceFlags(QtService::Default);
setStartupType(QtServiceController::AutoStartup);
}
示例13: kdWarning
QString KInetSocketAddress::pretty() const
{
if(d->sockfamily != AF_INET
#ifdef AF_INET6
&& d->sockfamily != AF_INET6
#endif
)
{
kdWarning() << "KInetSocketAddress::pretty() called on uninitialized class\n";
return i18n("<empty>");
}
return i18n("1: hostname, 2: port number", "%1 port %2").arg(nodeName()).arg(serviceName());
}
示例14: nativeLlcpSocket_doConnectBy
/*******************************************************************************
**
** Function: nativeLlcpSocket_doConnectBy
**
** Description: Establish a connection to the peer.
** e: JVM environment.
** o: Java object.
** sn: Service name.
**
** Returns: True if ok.
**
*******************************************************************************/
static jboolean nativeLlcpSocket_doConnectBy (JNIEnv* e, jobject o, jstring sn)
{
ALOGD ("%s: enter", __FUNCTION__);
PeerToPeer::tJNI_HANDLE jniHandle = (PeerToPeer::tJNI_HANDLE) nfc_jni_get_nfc_socket_handle(e, o);
ScopedUtfChars serviceName(e, sn);
if (serviceName.c_str() == NULL)
{
return JNI_FALSE;
}
bool stat = PeerToPeer::getInstance().connectConnOriented(jniHandle, serviceName.c_str());
ALOGD ("%s: exit", __FUNCTION__);
return stat ? JNI_TRUE : JNI_FALSE;
}
示例15: executeService
bool ScreenshotService::executeService(TasCommandModel& model, TasResponse& response)
{
if(model.service() == serviceName() ){
TasLogger::logger()->debug("ScreenshotService::executeService in");
QGuiApplication *app = qobject_cast<QGuiApplication*>(qApp);
if(app){
getScreenshot(model, response);
}
else{
TasLogger::logger()->debug("ScreenshotService::executeService application has no ui!");
response.setErrorMessage(NO_UI_ERROR);
}
return true;
}
else{
return false;
}
}