00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _umservice_hpp_
00021 #define _umservice_hpp_
00022
00023 #include <ubit/udefs.hpp>
00024 #include <ubit/usocket.hpp>
00025 namespace ubit {
00026
00027
00030 class UMService : public USocket {
00031 public:
00032 UMService(const UStr& host, int port = 0);
00048 ~UMService();
00049
00050
00051
00053 struct BrowseReply {
00054 BrowseReply(UMessageEvent&);
00055 int flags, errorCode;
00056 long interfaceIndex;
00057 UStr serviceName, serviceType, replyDomain;
00058 int status;
00059 bool isRemoved() {return status == false;}
00060 bool isAdded() {return status == true;}
00061 };
00062
00063 bool browseUMServers(UCall& callback);
00081
00082
00084 struct ResolveReply {
00085 ResolveReply(UMessageEvent&);
00086 int flags, errorCode;
00087 long interfaceIndex;
00088 UStr fullname, hosttarget;
00089 int port;
00090 };
00091
00092 bool resolveUMServer(const UStr& name, UCall& callback);
00113
00114
00115 bool browseUMSNeighbors(UCall& callback);
00121
00122
00123
00124
00125
00126
00127
00128 bool pressMouse(int event_flow, int button_id);
00129 bool releaseMouse(int event_flow, int button_id);
00130 bool moveMouse(int event_flow, int x, int y, bool absolute_coords);
00143 bool pressKey(int event_flow, unsigned long keysym);
00144 bool releaseKey(int event_flow, unsigned long keysym);
00149
00150
00151 bool sendMouseClick(const char* target, int x, int y, int button_id, int modifiers);
00152 bool sendMousePress(const char* target, int x, int y, int button_id, int modifiers);
00153 bool sendMouseRelease(const char* target, int x, int y, int button_id, int modifiers);
00167 bool sendMessage(const char* target, const UStr& message);
00168 bool sendMessage(const char* target, const char* message);
00177 bool sendRequest(int ums_request, const UStr& data);
00178 bool sendRequest(int ums_request, const char* data = null);
00180
00181
00182
00183 UMService(const UStr& host, int port, const char* client_name);
00185
00186 virtual void inputCallback();
00188
00189 protected:
00190 uptr<UCall> browse_call, neighbor_call;
00191 };
00192
00193 }
00194 #endif
00195
00196
00197