Revision 4bd3e852 server/include/RSB/EmotionCallbackWrapper.h
server/include/RSB/EmotionCallbackWrapper.h | ||
---|---|---|
30 | 30 |
#include "CallbackWrapper.h" |
31 | 31 |
|
32 | 32 |
//callback handler incoming emotion requests: |
33 |
class EmotionCallbackWrapper : public CallbackWrapper<rst::robot::EmotionState>{
|
|
33 |
class EmotionCallbackWrapper : public CallbackWrapper<rst::animation::EmotionExpression>{
|
|
34 | 34 |
public: |
35 | 35 |
EmotionCallbackWrapper(Middleware *mw) : CallbackWrapper(mw){} |
36 | 36 |
|
37 |
void call(const std::string& method_name, boost::shared_ptr<rst::robot::EmotionState> input){
|
|
38 |
printf("> incoming emotion (%s = %d)\n", method_name.c_str(),(int)input->value());
|
|
37 |
void call(const std::string& method_name, boost::shared_ptr<rst::animation::EmotionExpression> input){
|
|
38 |
printf("> incoming emotion (%s = %d)\n", method_name.c_str(),(int)input->emotion());
|
|
39 | 39 |
|
40 | 40 |
EmotionState emotion_state; |
41 |
rst::robot::EmotionState *emotion = input.get();
|
|
41 |
rst::animation::EmotionExpression *emotion = input.get();
|
|
42 | 42 |
|
43 | 43 |
//extract data & copy it to our datatype (might be good when we allow multiple middlewares in the feature) |
44 |
switch ((int)emotion->value()){
|
|
45 |
case(rst::robot::EmotionState_EmotionType_NEUTRAL): emotion_state.value = EmotionConfig::NEUTRAL; break;
|
|
46 |
case(rst::robot::EmotionState_EmotionType_HAPPY): emotion_state.value = EmotionConfig::HAPPY; break;
|
|
47 |
case(rst::robot::EmotionState_EmotionType_SAD): emotion_state.value = EmotionConfig::SAD; break;
|
|
48 |
case(rst::robot::EmotionState_EmotionType_ANGRY): emotion_state.value = EmotionConfig::ANGRY; break;
|
|
49 |
case(rst::robot::EmotionState_EmotionType_SURPRISED): emotion_state.value = EmotionConfig::SURPRISED; break;
|
|
50 |
case(rst::robot::EmotionState_EmotionType_FEAR): emotion_state.value = EmotionConfig::FEAR; break;
|
|
44 |
switch ((int)emotion->emotion()){
|
|
45 |
case(rst::animation::EmotionExpression_Emotion_NEUTRAL): emotion_state.value = EmotionConfig::NEUTRAL; break;
|
|
46 |
case(rst::animation::EmotionExpression_Emotion_HAPPY): emotion_state.value = EmotionConfig::HAPPY; break;
|
|
47 |
case(rst::animation::EmotionExpression_Emotion_SAD): emotion_state.value = EmotionConfig::SAD; break;
|
|
48 |
case(rst::animation::EmotionExpression_Emotion_ANGRY): emotion_state.value = EmotionConfig::ANGRY; break;
|
|
49 |
case(rst::animation::EmotionExpression_Emotion_SURPRISED): emotion_state.value = EmotionConfig::SURPRISED; break;
|
|
50 |
case(rst::animation::EmotionExpression_Emotion_FEAR): emotion_state.value = EmotionConfig::FEAR; break;
|
|
51 | 51 |
default: |
52 |
printf("> invalid EmotionState value. exiting\n"); exit(EXIT_FAILURE);
|
|
52 |
printf("> invalid EmotionExpression emotion value. exiting\n"); exit(EXIT_FAILURE);
|
|
53 | 53 |
} |
54 | 54 |
|
55 | 55 |
emotion_state.duration = emotion->duration(); |
Also available in: Unified diff