void sendFacialExpressionAnimation(SocketClient& sock, EmoStateHandle eState) { std::ostringstream output; IEE_FacialExpressionAlgo_t upperFaceType = IS_FacialExpressionGetUpperFaceAction(eState); IEE_FacialExpressionAlgo_t lowerFaceType = IS_FacialExpressionGetLowerFaceAction(eState); float upperFaceAmp = IS_FacialExpressionGetUpperFaceActionPower(eState); float lowerFaceAmp = IS_FacialExpressionGetLowerFaceActionPower(eState); if (IS_FacialExpressionIsBlink(eState)) { output << "B,"; } if (IS_FacialExpressionIsLeftWink(eState)) { output << "l,"; } if (IS_FacialExpressionIsRightWink(eState)) { output << "r,"; } if (upperFaceAmp > 0.0) { switch (upperFaceType) { case FE_SURPRISE: output << "b"; break; case FE_FROWN: output << "f"; break; default: break; } output << numberToString(static_cast<int>(upperFaceAmp*100.0f)) << ","; } if (lowerFaceAmp > 0.0) { switch (lowerFaceType) { case FE_CLENCH: output << "G"; break; case FE_SMILE: output << "S"; break; default: break; } output << numberToString(static_cast<int>(lowerFaceAmp*100.0f)) << ","; } std::string outString = output.str(); // Remove the last comma if (outString.length()) { outString.resize(outString.length()-1); } if (!outString.length()) { outString = std::string("neutral"); } sock.SendBytes(outString); }
void sendCognitivAnimation(SocketClient& sock, EmoStateHandle eState) { std::ostringstream os; EE_CognitivAction_t actionType = ES_CognitivGetCurrentAction(eState); float actionPower = ES_CognitivGetCurrentActionPower(eState); int intType = static_cast<int>(actionType); int intPower = static_cast<int>(actionPower*100.0f); os << intType << "," << intPower; std::cout << os.str()<< std::endl; sock.SendBytes(os.str()); }