00001
00002
00003
00004
00005
00006
00007
00008 #include "JoystickData.h"
00009 #include "Platform/SystemCall.h"
00010 #include "Representations/Motion/MotionRequest.h"
00011
00012 JoystickData::JoystickData():x(0),y(0),z(0),accel(0),button(0),coolie(0),directSpecialAction(false),specialActionID(SpecialActionRequest::numOfSpecialAction)
00013 {
00014 timeStamp = SystemCall::getCurrentSystemTime();
00015 }
00016
00017 In& operator>>(In& stream,JoystickData& joystickData)
00018 {
00019 joystickData.timeStamp = SystemCall::getCurrentSystemTime();
00020 int directSpecialAction, specialActionID;
00021 stream >> joystickData.x >> joystickData.y >> joystickData.z >> joystickData.accel >> joystickData.button >> joystickData.coolie >> directSpecialAction >> specialActionID;
00022 joystickData.directSpecialAction = directSpecialAction!=0;
00023 joystickData.specialActionID = (SpecialActionRequest::SpecialActionID)specialActionID;
00024 return stream;
00025 }
00026
00027 Out& operator<<(Out& stream, const JoystickData& joystickData)
00028 {
00029 stream << joystickData.x << joystickData.y << joystickData.z << joystickData.accel << joystickData.button << joystickData.coolie << (int)joystickData.directSpecialAction << (int)joystickData.specialActionID;
00030 return stream;
00031 }
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059