void MemorizeStorageSpace::onRecvMsg(sigverse::RecvMsgEvent &evt) { std::string sender = evt.getSender(); std::string msg = evt.getMsg(); std::string s = msg; //ヘッダーの取り出し int strPos1 = 0; int strPos2; std::string headss; std::string tmpss; strPos2 = msg.find(" ", strPos1); headss.assign(msg, strPos1, strPos2 - strPos1); tmpss.assign(msg, strPos2 + 1, msg.length() - strPos2); if (headss == "object"){ m_objectName = tmpss; if (!findObject(m_objectName)){ addObject(m_objectName); } receiveObject = true; } else if (headss == "storageSpace"){ m_storageSpaceName = tmpss; if (!findStorageSpace(m_storageSpaceName)){ addStorageSpace(m_storageSpaceName); } receiveStorageSpace = true; } else if (msg == autoMode){ sendMsg(robotName, findBestStorageSpace()); } printf("Message : %s \n", s.c_str()); std::wstring ws; printf("Sender : %s \n", sender.c_str()); }
void VoiceRecognition::onRecvMsg(sigverse::RecvMsgEvent &evt) { std::string sender = evt.getSender(); std::string msg = evt.getMsg(); std::string s = msg; printf("Message : %s \n", s.c_str()); std::wstring ws; printf("Sender : %s \n", sender.c_str()); if (strcmp(s.c_str(), "Stop_Reco") == 0) { Enable = false; } else if (strcmp(s.c_str(), "Start_Reco") == 0) { Enable = true; } else{ ms.noWaitSpeak(englishMessage2japaneseMessage(s));//発話 } }
void MyService::onRecvMsg(sigverse::RecvMsgEvent &evt) { string sender = evt.getSender(); string msg = evt.getMsg(); strSplit(msg, ":"); if (sender == "man_0"){ if (msg == "Start"){ start = true; } else if (headStr == "Question") { this->string2double(bodyStr); cout << "Question index is " << question_index << endl; } else if (headStr == "NEXT") { this->sendMsgToCtr("man_0", "go"); } } else if (sender == "sigverse_DB"){ if (msg == "あり") { cout << "同じ質問をします" << endl; this->sendMsgToCtr("man_0", "roop"); } else if (msg == "なし") { cout << "次の質問をします" << endl; this->sendMsgToCtr("man_0", "inc"); question_counter++; cout << question_counter << endl; if (question_counter > question_index - 1) { cout << "これ以上質問がないので次の物体に切り替えます" << endl; this->sendMsgToCtr("man_0", "fin"); obj_counter++; question_counter = 0; } } } }