Commit 87803e61daa84649caa5c2970fbf84d17c7b36bf

Authored by Perry Werneck
1 parent a21e48be

Adjustments in the keyboard API.

src/core/keyboard/kybd.c
... ... @@ -2228,7 +2228,15 @@ int kybd_prime(H3270 *hSession)
2228 2228 }
2229 2229 #endif /*]*/
2230 2230  
2231   -LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_unlock(H3270 *hSession, int seconds)
  2231 +LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_get_keyboard_lock_state(H3270 *hSession)
  2232 +{
  2233 + if(check_online_session(hSession))
  2234 + return LIB3270_KL_NOT_CONNECTED;
  2235 +
  2236 + return (LIB3270_KEYBOARD_LOCK_STATE) hSession->kybdlock;
  2237 +}
  2238 +
  2239 +LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H3270 *hSession, int seconds)
2232 2240 {
2233 2241 time_t end = time(0)+seconds;
2234 2242  
... ...
src/core/properties.c
... ... @@ -36,6 +36,7 @@
36 36 #include <string.h>
37 37 #include <lib3270.h>
38 38 #include <lib3270/properties.h>
  39 + #include <lib3270/keyboard.h>
39 40  
40 41 #if defined(HAVE_LIBSSL)
41 42 #include <openssl/ssl.h>
... ... @@ -58,7 +59,7 @@
58 59  
59 60 unsigned int lib3270_get_kybdlock_as_int(H3270 *hSession)
60 61 {
61   - return hSession->kybdlock;
  62 + return (unsigned int) lib3270_get_keyboard_lock_state(hSession);
62 63 }
63 64  
64 65 const LIB3270_INT_PROPERTY * lib3270_get_boolean_properties_list(void)
... ...
src/core/session.c
... ... @@ -467,7 +467,7 @@ void check_session_handle(H3270 **hSession)
467 467 #endif // ANDROID
468 468 }
469 469  
470   -LIB3270_INTERNAL int check_online_session(H3270 *hSession) {
  470 +LIB3270_INTERNAL int check_online_session(const H3270 *hSession) {
471 471  
472 472 // Is the session valid?
473 473 if(!hSession)
... ... @@ -480,7 +480,7 @@ LIB3270_INTERNAL int check_online_session(H3270 *hSession) {
480 480 return 0;
481 481 }
482 482  
483   -LIB3270_INTERNAL int check_offline_session(H3270 *hSession) {
  483 +LIB3270_INTERNAL int check_offline_session(const H3270 *hSession) {
484 484  
485 485 // Is the session valid?
486 486 if(!hSession)
... ...
src/include/lib3270-internals.h
... ... @@ -750,8 +750,8 @@ LIB3270_INTERNAL int lib3270_check_for_auto_reconnect(H3270 *hSession);
750 750 LIB3270_INTERNAL void check_session_handle(H3270 **hSession);
751 751 #endif // DEBUG
752 752  
753   -LIB3270_INTERNAL int check_online_session(H3270 *hSession);
754   -LIB3270_INTERNAL int check_offline_session(H3270 *hSession);
  753 +LIB3270_INTERNAL int check_online_session(const H3270 *hSession);
  754 +LIB3270_INTERNAL int check_offline_session(const H3270 *hSession);
755 755  
756 756 /// @brief Returns -1 if the session is invalid or not online (sets errno).
757 757 #define FAIL_IF_NOT_ONLINE(x) if(check_online_session(x)) return errno;
... ...
src/include/lib3270/keyboard.h
... ... @@ -67,7 +67,9 @@
67 67 *
68 68 * @return keyboard lock status.
69 69 */
70   - LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_unlock(H3270 *hSession, int seconds);
  70 + LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H3270 *hSession, int seconds);
  71 +
  72 + LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_get_keyboard_lock_state(H3270 *hSession);
71 73  
72 74 #ifdef __cplusplus
73 75 }
... ...