diff --git a/lib3270.cbp b/lib3270.cbp
index f530e80..67cb45d 100644
--- a/lib3270.cbp
+++ b/lib3270.cbp
@@ -196,6 +196,7 @@
+
diff --git a/src/core/iocalls.c b/src/core/iocalls.c
index d9b65ac..a2088de 100644
--- a/src/core/iocalls.c
+++ b/src/core/iocalls.c
@@ -478,33 +478,6 @@ LIB3270_EXPORT int lib3270_wait_for_update(H3270 *hSession, int seconds)
return errno = ENOTSUP;
}
-LIB3270_EXPORT int lib3270_wait_for_unlock(H3270 *hSession, int seconds)
-{
- time_t end = time(0)+seconds;
-
- FAIL_IF_NOT_ONLINE(hSession);
-
- event_dispatcher(hSession,0);
-
- do
- {
- if(!lib3270_connected(hSession))
- {
- errno = ENOTCONN;
- return -1;
- }
-
- if(KYBDLOCK_IS_OERR(hSession))
- break;
-
- event_dispatcher(hSession,1);
-
- }
- while(hSession->kybdlock && time(0) < end);
-
- return hSession->kybdlock;
-}
-
LIB3270_EXPORT int lib3270_wait_for_ready(H3270 *hSession, int seconds)
{
time_t end = time(0)+seconds;
diff --git a/src/core/keyboard/kybd.c b/src/core/keyboard/kybd.c
index c1ea0a9..b9e8df7 100644
--- a/src/core/keyboard/kybd.c
+++ b/src/core/keyboard/kybd.c
@@ -337,7 +337,7 @@ static void kybdlock_set(H3270 *hSession, unsigned int bits)
* @brief Clear bits in the keyboard lock.
*
*/
-void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KL_STATE bits)
+void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KEYBOARD_LOCK_STATE bits)
{
unsigned int n = hSession->kybdlock & ~( (unsigned int) bits);
@@ -2227,3 +2227,26 @@ int kybd_prime(H3270 *hSession)
return len;
}
#endif /*]*/
+
+LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_unlock(H3270 *hSession, int seconds)
+{
+ time_t end = time(0)+seconds;
+
+ lib3270_main_iterate(hSession,0);
+
+ do
+ {
+ if(!lib3270_connected(hSession))
+ return LIB3270_KL_NOT_CONNECTED;
+
+ if(KYBDLOCK_IS_OERR(hSession))
+ break;
+
+ lib3270_main_iterate(hSession,1);
+
+ }
+ while(hSession->kybdlock && time(0) < end);
+
+ return (LIB3270_KEYBOARD_LOCK_STATE) hSession->kybdlock;
+}
+
diff --git a/src/core/properties.c b/src/core/properties.c
index 3fa8932..dd4090e 100644
--- a/src/core/properties.c
+++ b/src/core/properties.c
@@ -56,7 +56,7 @@
return hSession->starting != 0;
}
- unsigned int lib3270_get_kybdlock(H3270 *hSession)
+ unsigned int lib3270_get_kybdlock_as_int(H3270 *hSession)
{
return hSession->kybdlock;
}
@@ -242,7 +242,7 @@
{
"kybdlock", // Property name.
N_( "Keyboard lock status" ), // Property description.
- lib3270_get_kybdlock, // Get value.
+ lib3270_get_kybdlock_as_int, // Get value.
NULL // Set value.
},
diff --git a/src/include/kybdc.h b/src/include/kybdc.h
index 4399caf..be75838 100644
--- a/src/include/kybdc.h
+++ b/src/include/kybdc.h
@@ -19,6 +19,7 @@
#ifndef KYBDC_H_INCLUDED
#define KYBDC_H_INCLUDED
+ #include
/// @brief Element in typeahead queue.
struct ta
@@ -56,26 +57,6 @@
};
-
- /* keyboard lock states */
- typedef enum lib3270_kl_state
- {
- LIB3270_KL_OERR_MASK = 0x000f,
- LIB3270_KL_OERR_PROTECTED = 0x0001,
- LIB3270_KL_OERR_NUMERIC = 0x0002,
- LIB3270_KL_OERR_OVERFLOW = 0x0003,
- LIB3270_KL_OERR_DBCS = 0x0004,
- LIB3270_KL_NOT_CONNECTED = 0x0010,
- LIB3270_KL_AWAITING_FIRST = 0x0020,
- LIB3270_KL_OIA_TWAIT = 0x0040,
- LIB3270_KL_OIA_LOCKED = 0x0080,
- LIB3270_KL_DEFERRED_UNLOCK = 0x0100,
- LIB3270_KL_ENTER_INHIBIT = 0x0200,
- LIB3270_KL_SCROLLED = 0x0400,
- LIB3270_KL_OIA_MINUS = 0x0800
-
- } LIB3270_KL_STATE;
-
#define KL_OERR_MASK LIB3270_KL_OERR_MASK
#define KL_OERR_PROTECTED LIB3270_KL_OERR_PROTECTED
#define KL_OERR_NUMERIC LIB3270_KL_OERR_NUMERIC
@@ -97,8 +78,7 @@
LIB3270_INTERNAL void clear_xks(void);
LIB3270_INTERNAL void do_reset(H3270 *session, Boolean explicit);
- LIB3270_INTERNAL void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KL_STATE bits);
-
+ LIB3270_INTERNAL void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KEYBOARD_LOCK_STATE bits);
LIB3270_INTERNAL void kybd_inhibit(H3270 *session, Boolean inhibit);
LIB3270_INTERNAL int kybd_prime(H3270 *hSession);
diff --git a/src/include/lib3270.h b/src/include/lib3270.h
index 89323cd..cee8a95 100644
--- a/src/include/lib3270.h
+++ b/src/include/lib3270.h
@@ -1032,14 +1032,6 @@
LIB3270_EXPORT int lib3270_wait_for_ready(H3270 *hSession, int seconds);
/**
- * @brief Wait for keyboard unlock.
- * @param seconds Number of seconds to wait.
- *
- * @return keyboard lock status or -1 on error.
- */
- LIB3270_EXPORT int lib3270_wait_for_unlock(H3270 *hSession, int seconds);
-
- /**
* "beep" to notify user.
*
* If available play a sound signal do alert user.
diff --git a/src/include/lib3270/keyboard.h b/src/include/lib3270/keyboard.h
new file mode 100644
index 0000000..f1fa38f
--- /dev/null
+++ b/src/include/lib3270/keyboard.h
@@ -0,0 +1,75 @@
+/*
+ * Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+ * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+ * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
+ *
+ * Copyright (C) <2008>
+ *
+ * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+ * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+ * Free Software Foundation.
+ *
+ * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+ * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+ * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+ * obter mais detalhes.
+ *
+ * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+ * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
+ * St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
+ *
+ */
+
+#ifndef LIB3270_KEYBOARD_H_INCLUDED
+
+ #define LIB3270_KEYBOARD_H_INCLUDED 1
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ /**
+ * @brief keyboard lock states
+ */
+ typedef enum lib3270_keyboard_lock_state
+ {
+ // Operator errors
+ LIB3270_KL_OERR_MASK = 0x000f,
+ LIB3270_KL_OERR_PROTECTED = 0x0001,
+ LIB3270_KL_OERR_NUMERIC = 0x0002,
+ LIB3270_KL_OERR_OVERFLOW = 0x0003,
+ LIB3270_KL_OERR_DBCS = 0x0004,
+
+ LIB3270_KL_NOT_CONNECTED = 0x0010,
+ LIB3270_KL_AWAITING_FIRST = 0x0020,
+ LIB3270_KL_OIA_TWAIT = 0x0040,
+ LIB3270_KL_OIA_LOCKED = 0x0080,
+ LIB3270_KL_DEFERRED_UNLOCK = 0x0100,
+ LIB3270_KL_ENTER_INHIBIT = 0x0200,
+ LIB3270_KL_SCROLLED = 0x0400,
+ LIB3270_KL_OIA_MINUS = 0x0800
+
+ } LIB3270_KEYBOARD_LOCK_STATE;
+
+ /**
+ * @brief Wait for keyboard unlock.
+ *
+ * Return status if the keyboard is locked by operator error ou if disconnected from host, waits until keyboard is unlocked if not.
+ *
+ * @param seconds Number of seconds to wait.
+ *
+ * @return keyboard lock status.
+ */
+ LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_unlock(H3270 *hSession, int seconds);
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif // LIB3270_KEYBOARD_H_INCLUDED
+
--
libgit2 0.21.2