qthighway/xqserviceutil/src/xqserviceutil.cpp
changeset 24 9d760f716ca8
parent 19 46686fb6258c
child 26 3d09643def13
equal deleted inserted replaced
19:46686fb6258c 24:9d760f716ca8
   106     return ret;
   106     return ret;
   107 }
   107 }
   108 
   108 
   109 
   109 
   110 // ======== MEMBER FUNCTIONS ========
   110 // ======== MEMBER FUNCTIONS ========
       
   111 
       
   112 /*!
       
   113     Send service application to backround in asynchronous service call.
       
   114     \param value Defines should application be send to backround (if set to true)
       
   115                  or to be brought back to foreground (if set to false)
       
   116 */
   111 void XQServiceUtil::toBackground( bool value )
   117 void XQServiceUtil::toBackground( bool value )
   112 {
   118 {
   113     XQSERVICE_DEBUG_PRINT("XQServiceUtil::toBackground");
   119     XQSERVICE_DEBUG_PRINT("XQServiceUtil::toBackground");
   114     XQSERVICE_DEBUG_PRINT("value: %d", value);
   120     XQSERVICE_DEBUG_PRINT("value: %d", value);
   115     RWsSession ws;
   121     RWsSession ws;
   131 
   137 
   132         ws.Close();
   138         ws.Close();
   133     }
   139     }
   134 }
   140 }
   135 
   141 
       
   142 /*!
       
   143     Check if service application is being launched as an embedded application.
       
   144     This information is passed in the command line arguments to started service application.
       
   145     \return true if service application is as an embedded application, otherwise false.
       
   146 */
   136 bool XQServiceUtil::isEmbedded()
   147 bool XQServiceUtil::isEmbedded()
   137 {
   148 {
   138     XQSERVICE_DEBUG_PRINT("XQServiceUtil::isEmbedded");
   149     XQSERVICE_DEBUG_PRINT("XQServiceUtil::isEmbedded");
   139     return isKeySet(QString::fromLatin1(XQServiceUtils::StartupArgEmbedded));
   150     return isKeySet(QString::fromLatin1(XQServiceUtils::StartupArgEmbedded));
   140 }
   151 }
   141 
   152 
       
   153 /*!
       
   154     Check if service application is being launched as service (other include stand-alone launch
       
   155     or activity launch). This information is valid upon service application launch. It is passed
       
   156     in the command line arguments so can be used already in main() function before initializing any UI. 
       
   157     \return true if launched as service, false otherwise (lanched as stand-alone or activity or other mode).
       
   158 */
   142 bool XQServiceUtil::isService()
   159 bool XQServiceUtil::isService()
   143 {
   160 {
   144     XQSERVICE_DEBUG_PRINT("XQServiceUtil::isService");
   161     XQSERVICE_DEBUG_PRINT("XQServiceUtil::isService");
   145     return isKeySet(QString::fromLatin1(XQServiceUtils::StartupArgService));
   162     return isKeySet(QString::fromLatin1(XQServiceUtils::StartupArgService));
   146 }
   163 }
   147 
   164 
       
   165 /*!
       
   166     Returns the interface name part of the full service name to be called later.
       
   167     This information is valid upon service application launch. It is passed
       
   168     in the command line arguments so can be used already in main() function before
       
   169     initializing any UI. For example for initializing only necessary components,
       
   170     for generating interface specific UI etc.
       
   171     \return Interface name part of the full service name.
       
   172     - \b Note: The service name part should be known already by the service provider implicitly.
       
   173 */
   148 QString XQServiceUtil::interfaceName()
   174 QString XQServiceUtil::interfaceName()
   149 {
   175 {
   150     XQSERVICE_DEBUG_PRINT("XQServiceUtil::interfaceName");
   176     XQSERVICE_DEBUG_PRINT("XQServiceUtil::interfaceName");
   151     return keyValue(QString::fromLatin1(XQServiceUtils::StartupArgInterfaceName));
   177     return keyValue(QString::fromLatin1(XQServiceUtils::StartupArgInterfaceName));
   152 }
   178 }
   153 
   179 
       
   180 /*!
       
   181     Returns the operation name within the interfaceName() to be called later.
       
   182     This information is valid upon service application launch. It is passed
       
   183     in the command line arguments so can be used already in main() function before
       
   184     initializing any UI. For example for initializing only necessary components
       
   185     for the coming slot call.
       
   186     \return Operation name within the interfaceName()
       
   187 */
   154 QString XQServiceUtil::operationName()
   188 QString XQServiceUtil::operationName()
   155 {
   189 {
   156     XQSERVICE_DEBUG_PRINT("XQServiceUtil::operationName");
   190     XQSERVICE_DEBUG_PRINT("XQServiceUtil::operationName");
   157     return keyValue(QString::fromLatin1(XQServiceUtils::StartupArgOperationName));
   191     return keyValue(QString::fromLatin1(XQServiceUtils::StartupArgOperationName));
   158 }
   192 }
   159 
   193 
       
   194 /*!
       
   195     
       
   196 */
   160 QString XQServiceUtil::serviceName()
   197 QString XQServiceUtil::serviceName()
   161 {
   198 {
   162     XQSERVICE_DEBUG_PRINT("XQServiceUtil::serviceName");
   199     XQSERVICE_DEBUG_PRINT("XQServiceUtil::serviceName");
   163     return keyValue(QString::fromLatin1(XQServiceUtils::StartupArgServiceName));
   200     return keyValue(QString::fromLatin1(XQServiceUtils::StartupArgServiceName));
   164 }
   201 }
   165 
   202 
       
   203 /*!
       
   204     Check if service application is being launched as an embedded application,
       
   205     based on passed \a argv arguments.
       
   206     \param argc Number of command line arguments.
       
   207     \param argv List of command line arguments.
       
   208     \return true if service application is as an embedded application, otherwise false.
       
   209     \sa isEmbedded()
       
   210 */
   166 bool XQServiceUtil::isEmbedded(int argc, char **argv)
   211 bool XQServiceUtil::isEmbedded(int argc, char **argv)
   167 {
   212 {
   168     XQSERVICE_DEBUG_PRINT("XQServiceUtil::isEmbedded argv");
   213     XQSERVICE_DEBUG_PRINT("XQServiceUtil::isEmbedded argv");
   169     return isKeySet(argc,argv,QString::fromLatin1(XQServiceUtils::StartupArgEmbedded));
   214     return isKeySet(argc,argv,QString::fromLatin1(XQServiceUtils::StartupArgEmbedded));
   170 }
   215 }
   171 
   216 
   172 
   217 /*!
       
   218     Check if service application is being launched as service (other include stand-alone launch
       
   219     or activity launch), based on passed \a argv arguments.
       
   220     \param argc Number of command line arguments.
       
   221     \param argv List of command line arguments.
       
   222     \return true if launched as service, false otherwise (lanched as stand-alone or activity or other mode).
       
   223     \sa isService()
       
   224 */
   173 bool XQServiceUtil::isService(int argc, char **argv)
   225 bool XQServiceUtil::isService(int argc, char **argv)
   174 {
   226 {
   175     XQSERVICE_DEBUG_PRINT("XQServiceUtil::isService argv");
   227     XQSERVICE_DEBUG_PRINT("XQServiceUtil::isService argv");
   176     return isKeySet(argc,argv,QString::fromLatin1(XQServiceUtils::StartupArgService));
   228     return isKeySet(argc,argv,QString::fromLatin1(XQServiceUtils::StartupArgService));
   177 }
   229 }
   178 
   230 
       
   231 /*!
       
   232     Returns the interface name part of the full service name to be called later,
       
   233     based on passed \a argv arguments.
       
   234     \param argc Number of command line arguments.
       
   235     \param argv List of command line arguments.
       
   236     \return Interface name part of the full service name.
       
   237     \sa interfaceName()
       
   238 */
   179 QString XQServiceUtil::interfaceName(int argc, char **argv)
   239 QString XQServiceUtil::interfaceName(int argc, char **argv)
   180 {
   240 {
   181     XQSERVICE_DEBUG_PRINT("XQServiceUtil::interfaceName");
   241     XQSERVICE_DEBUG_PRINT("XQServiceUtil::interfaceName");
   182     return keyValue(argc,argv,QString::fromLatin1(XQServiceUtils::StartupArgInterfaceName));
   242     return keyValue(argc,argv,QString::fromLatin1(XQServiceUtils::StartupArgInterfaceName));
   183 }
   243 }
   184 
   244 
   185 
   245 /*!
       
   246     Returns the operation name within the interfaceName() to be called later,
       
   247     based on passed \a argv arguments.
       
   248     \param argc Number of command line arguments.
       
   249     \param argv List of command line arguments.
       
   250     \return Operation name within the interfaceName()
       
   251     \sa operationName()
       
   252 */
   186 QString XQServiceUtil::operationName(int argc, char **argv)
   253 QString XQServiceUtil::operationName(int argc, char **argv)
   187 {
   254 {
   188     XQSERVICE_DEBUG_PRINT("XQServiceUtil::operationName argv");
   255     XQSERVICE_DEBUG_PRINT("XQServiceUtil::operationName argv");
   189     return keyValue(argc,argv,QString::fromLatin1(XQServiceUtils::StartupArgOperationName));
   256     return keyValue(argc,argv,QString::fromLatin1(XQServiceUtils::StartupArgOperationName));
   190 }
   257 }
   191 
   258 
       
   259 /*!
       
   260     
       
   261 */
   192 QString XQServiceUtil::serviceName(int argc, char **argv)
   262 QString XQServiceUtil::serviceName(int argc, char **argv)
   193 {
   263 {
   194     XQSERVICE_DEBUG_PRINT("XQServiceUtil::serviceName argv");
   264     XQSERVICE_DEBUG_PRINT("XQServiceUtil::serviceName argv");
   195     return keyValue(argc,argv,QString::fromLatin1(XQServiceUtils::StartupArgServiceName));
   265     return keyValue(argc,argv,QString::fromLatin1(XQServiceUtils::StartupArgServiceName));
   196 }
   266 }