Commit e6ecbb07ae7654c58c1972260da7030fe89cab26

Authored by Perry Werneck
1 parent c5436696
Exists in master and in 1 other branch develop

Updating API calls.

client/src/session/local/actions.cc
@@ -73,10 +73,10 @@ @@ -73,10 +73,10 @@
73 chkResponse(lib3270_wait_for_ready(this->hSession, timeout)); 73 chkResponse(lib3270_wait_for_ready(this->hSession, timeout));
74 } 74 }
75 75
76 - void Local::Session::waitForUnlock(time_t timeout) const { 76 + LIB3270_KEYBOARD_LOCK_STATE Local::Session::waitForUnlock(time_t timeout) const {
77 77
78 std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync); 78 std::lock_guard<std::mutex> lock(const_cast<Local::Session *>(this)->sync);
79 - chkResponse(lib3270_wait_for_unlock(this->hSession, timeout)); 79 + return lib3270_wait_for_unlock(this->hSession, timeout);
80 } 80 }
81 81
82 void Local::Session::waitForChange(time_t seconds) const { 82 void Local::Session::waitForChange(time_t seconds) const {
client/src/session/local/private.h
@@ -103,7 +103,7 @@ @@ -103,7 +103,7 @@
103 void wait(time_t seconds) const override; 103 void wait(time_t seconds) const override;
104 void waitForReady(time_t timeout) const override; 104 void waitForReady(time_t timeout) const override;
105 void waitForChange(time_t timeout) const override; 105 void waitForChange(time_t timeout) const override;
106 - void waitForUnlock(time_t seconds) const override; 106 + LIB3270_KEYBOARD_LOCK_STATE waitForUnlock(time_t seconds) const override;
107 107
108 // States 108 // States
109 ProgramMessage getProgramMessage() const override; 109 ProgramMessage getProgramMessage() const override;
client/src/session/remote/actions.cc
@@ -128,7 +128,7 @@ @@ -128,7 +128,7 @@
128 128
129 } 129 }
130 130
131 - void IPC::Session::waitForUnlock(time_t timeout) const { 131 + LIB3270_KEYBOARD_LOCK_STATE IPC::Session::waitForUnlock(time_t timeout) const {
132 132
133 int rc; 133 int rc;
134 134
@@ -146,11 +146,11 @@ @@ -146,11 +146,11 @@
146 debug("Wait for unlock returned ",rc); 146 debug("Wait for unlock returned ",rc);
147 147
148 if(rc == 0) 148 if(rc == 0)
149 - return; 149 + return (LIB3270_KEYBOARD_LOCK_STATE) 0;
150 150
151 } 151 }
152 152
153 - throw std::runtime_error("Keyboard is locked"); 153 + return (LIB3270_KEYBOARD_LOCK_STATE) rc;
154 154
155 } 155 }
156 156
client/src/session/remote/private.h
@@ -101,7 +101,7 @@ @@ -101,7 +101,7 @@
101 void wait(time_t seconds) const override; 101 void wait(time_t seconds) const override;
102 void waitForReady(time_t timeout) const override; 102 void waitForReady(time_t timeout) const override;
103 void waitForChange(time_t timeout) const override; 103 void waitForChange(time_t timeout) const override;
104 - void waitForUnlock(time_t seconds) const override; 104 + LIB3270_KEYBOARD_LOCK_STATE waitForUnlock(time_t seconds) const override;
105 105
106 // States 106 // States
107 ProgramMessage getProgramMessage() const override; 107 ProgramMessage getProgramMessage() const override;
common/src/include/lib3270/ipc.h
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
36 #include <vector> 36 #include <vector>
37 #include <functional> 37 #include <functional>
38 #include <lib3270.h> 38 #include <lib3270.h>
  39 + #include <lib3270/keyboard.h>
39 40
40 #if defined(_WIN32) 41 #if defined(_WIN32)
41 42
@@ -336,7 +337,7 @@ @@ -336,7 +337,7 @@
336 virtual void waitForChange(time_t seconds = DEFAULT_TIMEOUT) const = 0; 337 virtual void waitForChange(time_t seconds = DEFAULT_TIMEOUT) const = 0;
337 338
338 /// @brief Wait for screen changes. 339 /// @brief Wait for screen changes.
339 - virtual void waitForUnlock(time_t seconds = DEFAULT_TIMEOUT) const = 0; 340 + virtual LIB3270_KEYBOARD_LOCK_STATE waitForUnlock(time_t seconds = DEFAULT_TIMEOUT) const = 0;
340 341
341 /// @brief Send PF. 342 /// @brief Send PF.
342 virtual void pfkey(unsigned short value) = 0; 343 virtual void pfkey(unsigned short value) = 0;
server/src/core/methods/wait.c
@@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
28 */ 28 */
29 29
30 #include "private.h" 30 #include "private.h"
  31 +#include <lib3270/keyboard.h>
31 32
32 int ipc3270_method_wait(GObject *session, GVariant *request, GObject *response, GError G_GNUC_UNUSED(**error)) { 33 int ipc3270_method_wait(GObject *session, GVariant *request, GObject *response, GError G_GNUC_UNUSED(**error)) {
33 34
@@ -60,7 +61,7 @@ int ipc3270_method_wait_for_unlock(GObject *session, GVariant *request, GObject @@ -60,7 +61,7 @@ int ipc3270_method_wait_for_unlock(GObject *session, GVariant *request, GObject
60 61
61 guint seconds = 1; 62 guint seconds = 1;
62 g_variant_get(request, "(u)", &seconds); 63 g_variant_get(request, "(u)", &seconds);
63 - ipc3270_response_append_int32(response, lib3270_wait_for_unlock(ipc3270_get_session(session),seconds)); 64 + ipc3270_response_append_int32(response, (int32_t) lib3270_wait_for_unlock(ipc3270_get_session(session),seconds));
64 return 0; 65 return 0;
65 66
66 } 67 }