void BasicCommunication::onRequest(Json::Value &request) { std::string method = request["method"].asString(); int id = request["id"].asInt(); if (method == "BasicCommunication.MixingAudioSupported") { sendResult(id,"MixingAudioSupported"); }else if (method == "BasicCommunication.AllowAllApps") { sendResult(id,"AllowAllApps"); }else if (method == "BasicCommunication.AllowApp") { sendResult(id,"AllowApp"); }else if (method == "BasicCommunication.AllowDeviceToConnect") { sendResult(id,"AllowDeviceToConnect"); }else if (method == "BasicCommunication.UpdateAppList") { sendResult(id,"UpdateAppList"); }else if (method == "BasicCommunication.UpdateDeviceList") { // add by fanqiang Result result = m_pCallback->onRequest(request); sendResult(id,"UpdateDeviceList",result); }else if (method == "BasicCommunication.ActivateApp") { sendResult(id,"ActivateApp"); }else if (method == "BasicCommunication.IsReady") { sendResult(id,"IsReady"); }else if (method == "BasicCommunication.GetSystemInfo") { sendResult(id,"GetSystemInfo"); } else { Channel::onRequest(request); } }
void VehicleInfo::onRequest(Json::Value &request) { std::string method = request["method"].asString(); int id = request["id"].asInt(); if (method == "VehicleInfo.SubscribeVehicleData") { sendResult(id,"SubscribeVehicleData"); }else if (method == "VehicleInfo.UnsubscribeVehicleData") { sendResult(id,"UnsubscribeVehicleData"); }else if (method == "VehicleInfo.GetVehicleType") { sendResult(id,"GetVehicleType"); }else if (method == "VehicleInfo.IsReady") { sendResult(id,"IsReady"); }else if (method == "VehicleInfo.GetVehicleData") { Json::Value result; if (getVehicleData(request,result)) { sendResult(id, result); } else { sendError(id,result); } }else if (method == "VehicleInfo.ReadDID") { Json::Value result = vehicleInfoReadDIDResponse(request); sendResult(id,result); }else if (method == "VehicleInfo.GetDTCs") { Json::Value result = vehicleInfoGetDTCsResponse(request); sendResult(id,result); }else if (method =="VehicleInfo.DiagnosticMessage") { sendResult(id,"DiagnosticMessage"); } else { Channel::onRequest(request); } }
bool MythConfirmationDialog::keyPressEvent(QKeyEvent *event) { if (GetFocusWidget()->keyPressEvent(event)) return true; bool handled = false; QStringList actions; handled = GetMythMainWindow()->TranslateKeyPress("qt", event, actions); for (int i = 0; i < actions.size() && !handled; i++) { QString action = actions[i]; handled = true; if (action == "ESCAPE") sendResult(false); else handled = false; } if (!handled && MythScreenType::keyPressEvent(event)) handled = true; return handled; }
void matrix_mul::thread(void) { while (1) { readOperand(); multiplyMat(); sendResult(); } }
bool MythTextInputDialog::Create(void) { if (!CopyWindowFromBase("MythTextInputDialog", this)) return false; MythUIText *messageText = NULL; MythUIButton *okButton = NULL; MythUIButton *cancelButton = NULL; bool err = false; UIUtilE::Assign(this, m_textEdit, "input", &err); UIUtilE::Assign(this, messageText, "message", &err); UIUtilE::Assign(this, okButton, "ok", &err); UIUtilW::Assign(this, cancelButton, "cancel"); if (err) { LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'MythTextInputDialog'"); return false; } if (cancelButton) connect(cancelButton, SIGNAL(Clicked()), SLOT(Close())); connect(okButton, SIGNAL(Clicked()), SLOT(sendResult())); m_textEdit->SetFilter(m_filter); m_textEdit->SetText(m_defaultValue); m_textEdit->SetPassword(m_isPassword); messageText->SetText(m_message); BuildFocusList(); return true; }
bool SearchInputDialog::Create(void) { if (!LoadWindowFromXML("schedule-ui.xml", "searchpopup", this)) return false; MythUIText *messageText = NULL; MythUIButton *okButton = NULL; MythUIButton *cancelButton = NULL; bool err = false; UIUtilE::Assign(this, m_textEdit, "input", &err); UIUtilE::Assign(this, messageText, "message", &err); UIUtilE::Assign(this, okButton, "ok", &err); UIUtilW::Assign(this, cancelButton, "cancel"); if (err) { LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'searchpopup'"); return false; } if (cancelButton) connect(cancelButton, SIGNAL(Clicked()), SLOT(Close())); connect(okButton, SIGNAL(Clicked()), SLOT(sendResult())); m_textEdit->SetFilter(m_filter); m_textEdit->SetText(m_defaultValue); m_textEdit->SetPassword(m_isPassword); connect(m_textEdit, SIGNAL(valueChanged()), SLOT(editChanged())); BuildFocusList(); return true; }
void Loginutils::replyFinished(QNetworkReply *reply) { if (reply->error() == QNetworkReply::NoError) { QString response = reply->readAll(); if (!response.contains(":")) { if (response.contains("Bad login")) errCode = 1; else if (response.contains("Old version")) errCode = 2; else if (response.contains("User not premium")) errCode = 3; else errCode = 4; } else { errCode = 0; QStringList list = response.split(":"); latestVer = list[0]; downloadTicket = list[1]; username = list[2]; sessionId = list[3]; } emit sendResult(errCode); } else emit sendMessage("error", "Błąd logowania: " + reply->errorString()); }
void stopInput(rowcount_t c) { if (!stopped) { stopped = true; sendResult(c); CSlaveActivity::stopInput(input); } }
void stopInput(rowcount_t c) { if (!stopped) { stopped = true; sendResult(c); PARENT::stop(); } }
void ExperienceAssociationResponder::httpFailure() { LLSD msg; msg["error"]=(LLSD::Integer)getStatus(); msg["message"]=getReason(); LL_INFOS("ExperienceAssociation") << "Failed to look up associated experience: " << getStatus() << ": " << getReason() << LL_ENDL; sendResult(msg); }
void Slave::work(int &argc, char** &argv) { int64_t size = 0; int tag = 0; while(doWork) { waitForOrder(order); doWork = order.doWork; size = 0; if(true == order.doWork) { // printf("Received order %d: %d, %d, %d, %d, %d, %d, %lf, %lf, %lf\n", // order.orderID, // order.pictureWidth, // order.pictureHeight, // order.beginX, // order.beginY, // order.count, // order.doWork, // order.dotSize, // order.fractalX, // order.fractalY); size = executeOrder(order, resultArray); // if(rank > 2) // cout << "\n\nPoliczone!\n\n"; if(size > 0) { // for(auto i : resultArray) // cout<< i <<" "; int64_t id = order.orderID; // cout << "Wysyłanie...\n\n"; sendResult(id, resultArray, size); } else { // printf("Slave %d: Received size <= 0, stopping work.\n", rank); // printf("Received order %d: %d, %d, %d, %d, %d, %d\n", // rank, // order.pictureWidth, // order.pictureHeight, // order.beginX, // order.beginY, // order.count, // order.doWork); doWork = false; } } else { // printf("Slave %d: Received DIETAG, stopping work.\n", rank); } } }
void RemoteCallback::Stub::onTransact(int32_t what, int32_t arg1, int32_t arg2, const sp<Object>& obj, const sp<Bundle>& data, const sp<Object>& result) { switch (what) { case MSG_SEND_RESULT: { sendResult(data); break; } default: Binder::onTransact(what, arg1, arg2, obj, data, result); break; } }
////////////////////////////////////////////////////////////////////////////// /// /// Controller's algorithm /// ////////////////////////////////////////////////////////////////////////////// void controller::thread(void) { long operand1; long operand2; long result; Operation operation; while (1) { readData(&operand1, &operand2, &operation); result = delegateOperation(operation, operand1, operand2); sendResult(result); } }
static void retractPackage() { EdiRec *rec; cchar *password, *name; name = param("name"); password = param("password"); if (!name || !*name || !password || !*password) { sendResult(feedback("error", "Missing name or password parameters")); return; } if ((rec = readRecWhere("pak", "name", "==", name)) == 0) { sendResult(feedback("error", "Cannot find package")); return; } else if (!mprCheckPassword(password, getField(rec, "password"))) { sendResult(feedback("error", "Invalid password")); return; } sendResult(removeRec("pak", rec->id)); }
void menu(){ char ch; while(true){ if(exitNow){ break; } // TODO: OS specific console clear printMenuOptions(); ch=_getch(); switch(ch){ case '1': CpuTest::testSingleCore(); sendResult(CpuTest::getResultForTest(1)); break; case '2': CpuTest::testMultiCore(); sendResult(CpuTest::getResultForTest(2)); break; case '3': HddTest::testBad(); sendResult(HddTest::getResultForTest(1)); HddTest::testSlow(); sendResult(HddTest::getResultForTest(2)); #if defined(_WIN32) || defined(_WIN64) HddTest::testWindows(); sendResult(HddTest::getResultForTest(HDD_TESTS)); #endif break; case '4': exitNow=1; break; default: cout << "No such option." << endl; break; } if(ch == '1' || ch == '2' || ch == '3') askForMoreTest(); } }
void TransOnlinePro::run() { qDebug() << Q_FUNC_INFO; unsigned char ucResult; CleanError(); emit EableNotify(false); PreComm(); getTransNum(); switch(iOnlineType) { case TransMode_DownWK: //签到(工作密钥) ucResult = DownWK(); break; case TransMode_DownEWK: //签到(传输密钥) ucResult = DownEWK(); break; case TransMode_Settle: //结算 Settlement ucResult = SettlementPro(); break; case TransMode_CashDeposit: //存款 Deposit case TransMode_DepositVoid: //存款撤销 Deposit Void case TransMode_DepositAdjust: ucResult = DepositPro(); break; case TransMode_CashAdvance: //取款 Advance case TransMode_AdvanceVoid: //取款撤销 Advance Void case TransMode_AdvanceAdjust: ucResult = AdvancePro(); break; case TransMode_BalanceInquiry: //查余 Balance Inquiry ucResult = BalanceInquiryPro(); break; case TransMode_PINChange: ucResult = PINChangePro(); //改密 PIN Change break; case TransMode_CardTransfer: //转账 P2P Transfer ucResult = TransferPro(); break; default: ucResult = ERR_UNKNOWTRANSTYPE; break; } Os__gif_stop(); if(continueFlag == true) { FinComm(); emit sendResult(ucResult); } }
void Channel::onRequest(Json::Value &request) { int id = request["id"].asInt(); Json::Value method =request["method"]; std::string ref= MethodName(getChannelName(),method); if(m_StaticResult.isMember(ref)){ sendResult(id,ref); } else { LOGE("%s.%s NOT use",getChannelName().c_str(),ref.c_str()); } }
void Channel::sendResult(int id, std::string ref,Result code) { if(code == RESULT_USER_WAIT) return; Json::Value result; if(m_StaticResult[ref].isMember("result")) result = m_StaticResult[ref]["result"]; else result = m_StaticResult[ref]; result["code"]=code; sendResult(id,result); }
void matrix_mul::thread(void) { unsigned int result[MATRIX_ROWS * MATRIX_COLUMNS]; unsigned int operand1[MATRIX_ROWS * MATRIX_COLUMNS]; unsigned int operand2[MATRIX_ROWS * MATRIX_COLUMNS]; while(1) { // Add your code here... readOperand(operand1); readOperand(operand2); multMatrix(operand1, operand2, result); sendResult(result); // SpacePrint( "matrix_mul executing...\n" ); } }
////////////////////////////////////////////////////////////////////////////// /// /// Multiplication's algorithm /// ////////////////////////////////////////////////////////////////////////////// void multiplier::thread(void) { long operand1; long operand2; long result; while(1) { operand1 = readOperand(); operand2 = readOperand(); result = multiply(operand1, operand2); sendResult(result); } }
////////////////////////////////////////////////////////////////////////////// /// /// Addition's algorithm /// ////////////////////////////////////////////////////////////////////////////// void adder::thread(void) { long operand1; long operand2; long result; while(1) { operand1 = readOperand(); operand2 = readOperand(); result = add(operand1, operand2); sendResult(result); } }
int main() { while (1) { switch (action) { case NONE: // sleep a bit break; case DO_START: clearAction(); int result = task_do_work(); sendResult(result); break; } } }
void matrix_mul::thread(void) { long* operand1; long* operand2; long* result; while(1) { operand1 = readOperand(); operand2 = readOperand(); result = operand1; //result = multiply(operand1, operand2); sendResult(result); } }
PUBLIC bool canUser(cchar *abilities, bool warn) { HttpStream *stream; stream = getStream(); if (httpCanUser(stream, abilities)) { return 1; } if (warn) { setStatus(HTTP_CODE_UNAUTHORIZED); sendResult(feedback("error", "Access Denied. Insufficient Privilege.")); } return 0; }
void ExperienceAssociationResponder::httpSuccess() { if(!getContent().has("experience")) { LLSD msg; msg["message"]="no experience"; msg["error"]=-1; sendResult(msg); return; } LLExperienceCache::get(getContent()["experience"].asUUID(), boost::bind(&ExperienceAssociationResponder::sendResult, this, _1)); }
void MainMenuScene::onEnter() { CCLayer::onEnter(); CCLOG("MainMenuSceneEntry"); setSoundButtons(); if (!sendResult()) { CocosDenshion::SimpleAudioEngine::sharedEngine()->stopBackgroundMusic(); CocosDenshion::SimpleAudioEngine::sharedEngine()->playBackgroundMusic("sound/menuBGM.mp3", false); } updateChallengeCount(0); schedule(schedule_selector(MainMenuScene::updateChallengeCount),15); }
int searchAction(struct actionParameters *ap, union additionalActionParameters *aap) { uint16_t port = 0; pid_t pid; int sockfd = 0; (void) aap; if (iswhitespace((char *)ap->comline.buf)) return 1; switch (pid = fork()) { case -1: logmsg(ap->semid, ap->logfd, LOGLEVEL_FATAL, "(searchAction) Problem forking\n"); return -3; case 0: sockfd = createPassiveSocket(&port); if (sockfd<=0) return -3; if ( -1 == getTokenFromBuffer(&ap->comline, &ap->comword, "\n","\r\n",NULL)) return -3; logmsg(ap->semid, ap->logfd, LOGLEVEL_VERBOSE, "(searchAction) called upon to search for %s\n", ap->comword.buf); logmsg(ap->semid, ap->logfd, LOGLEVEL_VERBOSE, "created port %d to send search results\n", port); char *msg = stringBuilder("RESULT SOCKET %d\n", port); if ( -1 == reply(ap->comfd, ap->logfd, ap->semid, REP_COMMAND, msg)){ free(msg); return -3; } free(msg); setFdBlocking(sockfd); socklen_t addrlen = sizeof(ap->comip); if ((ap->comfd = accept(sockfd, &ap->comip, &addrlen)) == -1 ) { logmsg(ap->semid, ap->logfd, LOGLEVEL_FATAL, "(searchAction) Problem accepting connection\n"); return -3; } int ret = (sendResult(ap->comfd, ap, aap->sap)); close (ap->comfd); return (ret == -1)? -3: -2; default: return 1; } }
int main(int argc, char* argv[]){ if (argc < 2) { fprintf(stderr, "Usage: %s file [userid]\n", argv[0]); exit(1); } mailfile = argv[1]; if (argc > 2) mailto = argv[2]; readData(); if (mailto) mailUser(mailto); else sendResult(); return 0; }
void TTS::onRequest(Json::Value &request) { std::string method = request["method"].asString(); int id= request["id"].asInt(); if(method == "TTS.SetGlobalProperties") { sendResult(id,"SetGlobalProperties"); } else if(method == "TTS.GetCapabilities") { sendResult(id,"GetCapabilities");// capabilities:["TEXT"] } else if(method == "TTS.GetSupportedLanguages") { sendResult(id,"GetSupportedLanguages"); } else if(method == "TTS.GetLanguage") { sendResult(id,"GetLanguage"); } else if(method == "TTS.ChangeRegistration") { sendResult(id,"ChangeRegistration"); } else if(method == "TTS.IsReady") { sendResult(id,"IsReady"); } else if (method == "TTS.Speak") { Result result=m_pCallback->onRequest(request); //sendResult(id,"Speak",result); } else if(method == "TTS.StopSpeaking") { // ttsHandler action stop Result result=m_pCallback->onRequest(request); sendResult(id,"Speak",result); } else { Channel::onRequest(request); } }
CATCH_NEXTROW() { ActivityTimer t(totalCycles, timeActivities); if (abortSoon || eof) return NULL; eof = true; OwnedConstThorRow next = input->ungroupedNextRow(); RtlDynamicRowBuilder resultcr(queryRowAllocator()); size32_t sz = helper->clearAggregate(resultcr); if (next) { hadElement = true; sz = helper->processFirst(resultcr, next); if (container.getKind() != TAKexistsaggregate) { while (!abortSoon) { next.setown(input->ungroupedNextRow()); if (!next) break; sz = helper->processNext(resultcr, next); } } } doStopInput(); if (!firstNode()) { OwnedConstThorRow result(resultcr.finalizeRowClear(sz)); sendResult(result.get(),queryRowSerializer(), 1); // send partial result return NULL; } OwnedConstThorRow ret = getResult(resultcr.finalizeRowClear(sz)); if (ret) { dataLinkIncrement(); return ret.getClear(); } sz = helper->clearAggregate(resultcr); return resultcr.finalizeRowClear(sz); }