diff --git a/src/core/keyboard/kybd.c b/src/core/keyboard/kybd.c index b9e8df7..40951b7 100644 --- a/src/core/keyboard/kybd.c +++ b/src/core/keyboard/kybd.c @@ -2228,7 +2228,15 @@ int kybd_prime(H3270 *hSession) } #endif /*]*/ -LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_unlock(H3270 *hSession, int seconds) +LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_get_keyboard_lock_state(H3270 *hSession) +{ + if(check_online_session(hSession)) + return LIB3270_KL_NOT_CONNECTED; + + return (LIB3270_KEYBOARD_LOCK_STATE) hSession->kybdlock; +} + +LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H3270 *hSession, int seconds) { time_t end = time(0)+seconds; diff --git a/src/core/properties.c b/src/core/properties.c index dd4090e..99e51eb 100644 --- a/src/core/properties.c +++ b/src/core/properties.c @@ -36,6 +36,7 @@ #include #include #include + #include #if defined(HAVE_LIBSSL) #include @@ -58,7 +59,7 @@ unsigned int lib3270_get_kybdlock_as_int(H3270 *hSession) { - return hSession->kybdlock; + return (unsigned int) lib3270_get_keyboard_lock_state(hSession); } const LIB3270_INT_PROPERTY * lib3270_get_boolean_properties_list(void) diff --git a/src/core/session.c b/src/core/session.c index e1773c6..db5a764 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -467,7 +467,7 @@ void check_session_handle(H3270 **hSession) #endif // ANDROID } -LIB3270_INTERNAL int check_online_session(H3270 *hSession) { +LIB3270_INTERNAL int check_online_session(const H3270 *hSession) { // Is the session valid? if(!hSession) @@ -480,7 +480,7 @@ LIB3270_INTERNAL int check_online_session(H3270 *hSession) { return 0; } -LIB3270_INTERNAL int check_offline_session(H3270 *hSession) { +LIB3270_INTERNAL int check_offline_session(const H3270 *hSession) { // Is the session valid? if(!hSession) diff --git a/src/include/lib3270-internals.h b/src/include/lib3270-internals.h index 30fdedf..8b35786 100644 --- a/src/include/lib3270-internals.h +++ b/src/include/lib3270-internals.h @@ -750,8 +750,8 @@ LIB3270_INTERNAL int lib3270_check_for_auto_reconnect(H3270 *hSession); LIB3270_INTERNAL void check_session_handle(H3270 **hSession); #endif // DEBUG -LIB3270_INTERNAL int check_online_session(H3270 *hSession); -LIB3270_INTERNAL int check_offline_session(H3270 *hSession); +LIB3270_INTERNAL int check_online_session(const H3270 *hSession); +LIB3270_INTERNAL int check_offline_session(const H3270 *hSession); /// @brief Returns -1 if the session is invalid or not online (sets errno). #define FAIL_IF_NOT_ONLINE(x) if(check_online_session(x)) return errno; diff --git a/src/include/lib3270/keyboard.h b/src/include/lib3270/keyboard.h index 94f6f7c..8fa0a2c 100644 --- a/src/include/lib3270/keyboard.h +++ b/src/include/lib3270/keyboard.h @@ -67,7 +67,9 @@ * * @return keyboard lock status. */ - LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_unlock(H3270 *hSession, int seconds); + LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H3270 *hSession, int seconds); + + LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_get_keyboard_lock_state(H3270 *hSession); #ifdef __cplusplus } -- libgit2 0.21.2