Commit 3dff46b8e9d4367acd4381709e267eb25d7bf99b
1 parent
9c22cccf
Exists in
master
and in
5 other branches
Implementando novo módulo de serviço.
Showing
4 changed files
with
21 additions
and
2 deletions
Show diff stats
src/include/pw3270cpp.h
| ... | ... | @@ -144,6 +144,8 @@ |
| 144 | 144 | static bool has_default(void); |
| 145 | 145 | static void set_plugin(session * (*factory)(const char *name)); |
| 146 | 146 | |
| 147 | + virtual string get_session_name(void) const; | |
| 148 | + | |
| 147 | 149 | // Log management |
| 148 | 150 | void log(const char *fmt, ...); |
| 149 | 151 | void logva(const char *fmt, va_list args); | ... | ... |
src/libpw3270cpp/service.cc
| ... | ... | @@ -266,7 +266,11 @@ |
| 266 | 266 | DBusError err; |
| 267 | 267 | |
| 268 | 268 | dbus_error_init(&err); |
| 269 | +#ifdef DEBUG | |
| 269 | 270 | conn = dbus_bus_get(DBUS_BUS_SESSION, &err); |
| 271 | +#else | |
| 272 | + conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); | |
| 273 | +#endif | |
| 270 | 274 | |
| 271 | 275 | if(dbus_error_is_set(&err)) |
| 272 | 276 | { |
| ... | ... | @@ -305,6 +309,13 @@ |
| 305 | 309 | |
| 306 | 310 | } |
| 307 | 311 | |
| 312 | + virtual string get_session_name(void) const | |
| 313 | + { | |
| 314 | + string rc = "service://"; | |
| 315 | + rc += this->name; | |
| 316 | + return rc; | |
| 317 | + } | |
| 318 | + | |
| 308 | 319 | virtual bool is_connected(void) |
| 309 | 320 | { |
| 310 | 321 | return getInteger("isConnected", DBUS_TYPE_STRING, &this->id, DBUS_TYPE_INVALID); | ... | ... |
src/libpw3270cpp/session.cc
| ... | ... | @@ -692,7 +692,8 @@ |
| 692 | 692 | int rows = get_height(); |
| 693 | 693 | int cols = get_width(); |
| 694 | 694 | |
| 695 | - for(int r = 0; r < rows; r++) { | |
| 695 | + for(int r = 0; r < rows; r++) | |
| 696 | + { | |
| 696 | 697 | rc += get_string_at(r+1,0,cols).c_str(); |
| 697 | 698 | rc += "\n"; |
| 698 | 699 | } |
| ... | ... | @@ -700,6 +701,10 @@ |
| 700 | 701 | return rc; |
| 701 | 702 | } |
| 702 | 703 | |
| 704 | + string session::get_session_name(void) const | |
| 705 | + { | |
| 706 | + return string(); | |
| 707 | + } | |
| 703 | 708 | |
| 704 | 709 | } |
| 705 | 710 | ... | ... |
src/libpw3270cpp/testprogram.cc
| ... | ... | @@ -47,7 +47,8 @@ |
| 47 | 47 | // session *session = session::start("new"); |
| 48 | 48 | |
| 49 | 49 | cout << "pw3270 version: " << session->get_version() << endl; |
| 50 | - cout << "pw3270 revision: " << session->get_revision() << endl << endl; | |
| 50 | + cout << "pw3270 revision: " << session->get_revision() << endl; | |
| 51 | + cout << "pw3270 session: " << session->get_session_name() << endl << endl; | |
| 51 | 52 | |
| 52 | 53 | if(session->is_connected()) |
| 53 | 54 | cout << "\tConnected to host" << endl; | ... | ... |