void TestabilityService::enableSignalTracking(QString signal, QString timeStamp) { //need to make a commandmodel for the fixture TasCommandModel* model = TasCommandModel::createModel(); model->addDomAttribute("service", FIXTURE); TasTarget& target = model->addTarget(); target.addDomAttribute("TasId", TasCoreUtils::objectId( qApp )); target.addDomAttribute("type", TYPE_APPLICATION_VIEW); TasCommand& command = target.addCommand(); command.addDomAttribute("name", "Fixture"); command.addDomAttribute("plugin","tassignal"); command.addDomAttribute("method","enable_signal"); command.addApiParameter(SIGNAL_KEY,signal, "QString"); command.addApiParameter(PROCESS_START_TIME,timeStamp, "QString"); QString message; if(!mFixtureService->performFixture(*model, message)){ TasLogger::logger()->error("TestabilityService::enableSignalTracking failed. " + message); } delete model; }
/*! Servers servicemanager first looks for a client to relay the message to. If none found then use the servers command chain to handle the service request. */ void TasServerServiceManager::handleServiceRequest(TasCommandModel& commandModel, TasSocket* requester, qint32 responseId) { TasLogger::logger()->debug("TasServerServiceManager::handleServiceRequest: " + commandModel.service() + ": " + commandModel.id()); TasClient* targetClient = 0; if (!commandModel.id().isEmpty() && commandModel.id() != "1"){ bool ok; quint64 clientPid = commandModel.id().toULongLong(&ok); targetClient = mClientManager->findByProcessId(clientPid); //no registered client check for platform specific handles for the process id if(!targetClient && extensionHandled(commandModel, requester, responseId)){ return; } if(!targetClient){ TasLogger::logger()->debug("TasServerServiceManager::handleServiceRequest: no target client send error..."); TasResponse response(responseId); response.setIsError(true); response.setErrorMessage("The application with Id " + commandModel.id() + " is no longer available."); requester->sendMessage(response); return; } } if(!targetClient && (commandModel.service() == APPLICATION_STATE || commandModel.service() == SCREEN_SHOT || commandModel.service() == FIND_OBJECT_SERVICE)){ targetClient = mClientManager->findClient(commandModel); } else if (commandModel.service() == RESOURCE_LOGGING_SERVICE){ targetClient = mClientManager->logMemClient(); } else{ } if(targetClient){ TasLogger::logger()->debug("TasServerServiceManager::handleServiceRequest client is: " + targetClient->processId() + "," + targetClient->applicationName()); int timeout = 10000; if(!commandModel.parameter("plugin_timeout").isEmpty()){ TasLogger::logger()->debug("TasServerServiceManager::handleServiceRequest set timeout " + commandModel.parameter("plugin_timeout")); timeout = commandModel.parameter("plugin_timeout").toInt(); } ResponseWaiter* waiter = new ResponseWaiter(responseId, requester, timeout); if(commandModel.service() == CLOSE_APPLICATION){ waiter->setResponseFilter(new CloseFilter(commandModel)); } connect(waiter, SIGNAL(responded(qint32)), this, SLOT(removeWaiter(qint32))); mResponseQueue.insert(responseId, waiter); if(commandModel.service() == APPLICATION_STATE || commandModel.service() == FIND_OBJECT_SERVICE){ commandModel.addDomAttribute("needFragment", "true"); //send request for qt uistate to client targetClient->socket()->sendRequest(responseId, commandModel.sourceString(false)); //in the meantime process native getNativeUiState(responseId, commandModel); } else{ //can respond as soon as response from qt side waiter->okToRespond(); targetClient->socket()->sendRequest(responseId, commandModel.sourceString()); } } else{ handleClientLess(commandModel, requester, responseId); } }