00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: MobileInterface.h,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.17 $ $Date: 2019年01月17日 21:21:00 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * 00019 * The Mobile UI object, which maintains the current state of the 00020 * mobile phone, tablet, or other WiFi input or auxiliary display device. 00021 * 00022 ***************************************************************************/ 00023 #ifndef MOBILEINTERFACE_H 00024 #define MOBILEINTERFACE_H 00025 00026 #include "UIObject.h" 00027 #include "Command.h" 00028 #include "JString.h" 00029 #include "NameList.h" 00030 #include "WKFUtils.h" 00031 00032 #if 0 00033 class MobileClientList { 00034 public: 00035 MobileClientList() {} 00036 MobileClientList(const JString n, const JString i, const bool a) : 00037 nick(n), ip(i), active(a) {} 00038 private: 00039 JString nick; 00040 JString ip; 00041 bool active; 00042 }; 00043 #endif 00044 00046 class Mobile : public UIObject { 00047 public: 00049 enum MoveMode { OFF, MOVE, ANIMATE, TRACKER, USER }; 00050 00052 enum TouchMode { ROTATE, TRANSLATE, SCALEROTZ }; 00053 00055 static const char *get_mode_str(MoveMode mode); 00056 00057 private: 00058 void *mobile; 00059 int port; 00060 00061 MoveMode moveMode; 00062 int maxstride; 00063 float transInc; 00064 float rotInc; 00065 float scaleInc; 00066 float animInc; 00067 int buttonDown; 00068 00069 int touchinprogress; 00070 int touchcount; 00071 int touchmode; 00072 wkf_timerhandle packtimer; 00073 float touchstartX; 00074 float touchstartY; 00075 float touchdeltaX; 00076 float touchdeltaY; 00077 float touchscale; 00078 float touchscalestartdist; 00079 float touchrotstartangle; 00080 00081 float tranScaling; 00082 float rotScaling; 00083 float zoomScaling; 00084 00085 00087 float trtx; 00088 float trty; 00089 float trtz; 00090 float trrx; 00091 float trry; 00092 float trrz; 00093 int trbuttons; 00094 00095 ResizeArray <JString *> clientNick; 00096 ResizeArray <JString *> clientIP; 00097 ResizeArray <bool> clientActive; 00098 ResizeArray <int> clientListenerPort; 00099 ResizeArray <wkf_timerhandle> clientLastContact; 00100 00102 bool isInControl(JString* nick, JString* ip, const int port, 00103 const int packtype); 00104 00105 float statusSendSeconds; 00106 wkf_timerhandle statustimer; 00107 void checkAndSendStatus(); 00108 void sendStatus(const int event); 00109 00115 unsigned char statusSendBuffer[1536]; 00116 int statusSendBufferLength; 00117 00119 void prepareSendBuffer(const int eventType); 00120 00122 void sendMsgToIp(const bool isActive, 00123 const int tmpInt, 00124 const char *msg, 00125 const char *ip, 00126 const int port); 00127 00128 public: 00129 Mobile(VMDApp *); 00130 virtual ~Mobile(void); 00131 00132 // 00133 // virtual routines for UI init/display 00134 // 00135 00137 virtual void reset(void); 00138 00143 virtual int act_on_command(int, Command *); 00144 00146 virtual int check_event(void); 00147 00149 int get_port (); 00150 00152 int get_APIsupported (); 00153 00155 int get_move_mode (); 00156 00158 void get_client_list(ResizeArray <JString*>* &nick, 00159 ResizeArray <JString*>* &ip, 00160 ResizeArray <bool>* &active); 00161 00163 int move_mode(MoveMode mm); 00164 00166 int set_activeClient(const char *nick, const char *ip); 00167 00169 int sendMsgToClient(const char *nick, const char *ip, const char *msgType, const char *msg); 00170 00172 int network_port(int newport); 00173 00175 void set_max_stride(int ms) { 00176 maxstride = ms; 00177 } 00178 00181 void get_tracker_status(float &tx, float &ty, float &tz, 00182 float &rx, float &ry, float &rz, int &buttons); 00183 00184 00186 int addNewClient(JString* nick, JString* ip, const int port, const bool active); 00187 00189 int removeClient(const int num); 00190 00192 void removeAllClients(); 00193 }; 00194 00195 00199 class CmdMobileMode : public Command { 00200 public: 00202 CmdMobileMode(int mm) : Command(MOBILE_MODE), mobileMode(mm) {} 00203 00205 int mobileMode; 00206 }; 00207 00208 00209 #endif 00210