00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _umsclient_hpp_
00026 #define _umsclient_hpp_
00027
00028 #include <ubit/udefs.hpp>
00029 #include <ubit/ubrick.hpp>
00030 #include <ubit/ustr.hpp>
00031
00032
00033 class UMSclient {
00034 public:
00035 enum Stat {
00036 HostNotFound = -2,
00037 CannotOpen = -1,
00038 NotOpened = 0,
00039 Opened = 1
00040 };
00041
00042 UMSclient(UAppli&);
00043 UMSclient(const UStr& client_name) ;
00044 ~UMSclient();
00045
00046 int open(const UStr& umsd_hostname, int umsd_port = 0);
00060 void close();
00061
00062 int getStatus() const;
00067
00068
00069 bool sendMessage(const char* target, const UStr& message);
00070 bool sendMessage(const char* target, const char* message);
00078
00079
00080 bool sendMouseClick(const char* target, u_pos x, u_pos y, u_id mouse_button);
00081 bool sendMousePress(const char* target, u_pos x, u_pos y, u_id mouse_button);
00082 bool sendMouseRelease(const char* target, u_pos x, u_pos y, u_id mouse_button);
00094
00095
00096 bool moveMouse(int mouse_event_flow, u_pos x, u_pos y, bool absolute_coords);
00107 bool pressMouse(int mouse_event_flow, u_id mouse_button);
00108 bool releaseMouse(int mouse_event_flow, u_id mouse_button);
00120
00121
00122 bool winOpened(u_id win_id);
00123 bool winClosed(u_id win_id);
00124 bool cnxOpened(const UStr& cnx_name);
00125 bool cnxClosed();
00126
00127
00128
00129 private:
00130 class UAppli* appli;
00131 struct sockaddr_in* rhost;
00132 uptr<UInput> input;
00133 UStr client_name;
00134 UStr remote_host;
00135 int remote_port;
00136 int com_sock;
00137 int stat;
00138
00139 void constructs(UAppli*, const UStr& client_name);
00140 int openCom(const UStr& cnx_name, bool keep_cnx_request);
00141 bool sendRequest(class UMSrequest& request);
00142 void receive();
00143 };
00144
00145 #endif
00146
00147