ubit
umservice.hpp
1 /* ==================================================== ======== ======= *
2  *
3  * umservice.hpp: acess to the UMS (Ubit Mouse/Message Server) services
4  * Ubit GUI Toolkit - Version 6
5  * (C) 2009 | Eric Lecolinet | TELECOM ParisTech | http://www.enst.fr/~elc/ubit
6  *
7  * ***********************************************************************
8  * COPYRIGHT NOTICE :
9  * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE
10  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
11  * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU
12  * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
13  * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
14  * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
15  * ***********************************************************************/
16 
17 #ifndef _umservice_hpp_
18 #define _umservice_hpp_
19 #include <ubit/udefs.hpp>
20 #include <ubit/usocket.hpp>
21 namespace ubit {
22 
25  class UMService : public USocket {
26  public:
27  UMService(const UStr& host, int port = 0);
43  ~UMService();
44 
45  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
46 
48  struct BrowseReply {
50  int flags, errorCode;
51  long interfaceIndex;
52  UStr serviceName, serviceType, replyDomain;
53  int status;
54  bool isRemoved() {return status == false;}
55  bool isAdded() {return status == true;}
56  };
57 
58  bool browseUMServers(UCall& callback);
76  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
77 
79  struct ResolveReply {
81  int flags, errorCode;
82  long interfaceIndex;
83  UStr fullname, hosttarget; //, txtRecord;
84  int port;
85  };
86 
87  bool resolveUMServer(const UStr& name, UCall& callback);
108  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
109 
110  bool browseUMSNeighbors(UCall& callback);
116  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
117 
118  //bool tactos(const char* data);
119  // tactile output stream.
120 
121  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
122 
123  bool pressMouse(int event_flow, int button_id);
124  bool releaseMouse(int event_flow, int button_id);
125  bool moveMouse(int event_flow, int x, int y, bool absolute_coords);
138  bool pressKey(int event_flow, int keycode);
139  bool releaseKey(int event_flow, int keycode);
144  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
145 
146  bool sendMouseClick(const char* target, int x, int y, int button_id, int modifiers);
147  bool sendMousePress(const char* target, int x, int y, int button_id, int modifiers);
148  bool sendMouseRelease(const char* target, int x, int y, int button_id, int modifiers);
162  bool sendMessage(const char* target, const UStr& message);
163  bool sendMessage(const char* target, const char* message);
172  bool sendRequest(int ums_request, const UStr& data);
173  bool sendRequest(int ums_request, const char* data = null);
175 
176  // - - - impl. - - - - - - - - - - - - - - - - - - - - - - - - - - -
177 
178  UMService(const UStr& host, int port, const char* client_name);
180 
181  virtual void inputCallback();
183 
184  protected:
185  uptr<UCall> browse_call, neighbor_call;
186  };
187 
188 }
189 #endif
bool browseUMSNeighbors(UCall &callback)
browse the neigbors of this UMS.
Definition: umservice.cpp:91
see browseUMServers().
Definition: umservice.hpp:48
UMService: Ubit Mouse/Message Service.
Definition: umservice.hpp:25
bool moveMouse(int event_flow, int x, int y, bool absolute_coords)
control the pointer(s) of the display managed by this UMS server.
Definition: umservice.cpp:188
bool sendMouseRelease(const char *target, int x, int y, int button_id, int modifiers)
sends an event to a window located on the display managed by this UMS server.
Definition: umservice.cpp:237
Smart Pointer for UObject instances (.
Definition: uobject.hpp:365
see resolveUMServer().
Definition: umservice.hpp:79
base class of callback objects for firing functions or methods.
Definition: ucall.hpp:144
bool browseUMServers(UCall &callback)
browse available UMSservers on a local net by using ZeroConf/Rendezvous.
Definition: umservice.cpp:82
virtual void inputCallback()
[impl].
Definition: umservice.cpp:61
Ubit Simple Sockets.
Definition: usocket.hpp:64
UMService(const UStr &host, int port=0)
opens a connection with a remote UMS server (Ubit Mouse/Message Server).
Definition: umservice.cpp:46
Definition: uhardfont.hpp:31
bool resolveUMServer(const UStr &name, UCall &callback)
resolves a UMS server name into a IP address by using ZeroConf/Rendezvous.
Definition: umservice.cpp:148
bool releaseKey(int event_flow, int keycode)
sends key events on the display managed by this UMS server.
Definition: umservice.cpp:212
Ubit String.
Definition: ustr.hpp:72
Ubit Message events.
Definition: uevent.hpp:462