diff --git a/configure.ac b/configure.ac index b3cb893..48a34a3 100644 --- a/configure.ac +++ b/configure.ac @@ -323,7 +323,7 @@ dnl --------------------------------------------------------------------------- AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(locale/Makefile) -AC_CONFIG_FILES(sdk/libhllapi.pc) +AC_CONFIG_FILES(sdk/hllapi.pc) dnl --------------------------------------------------------------------------- dnl Output the generated config.status script. diff --git a/sdk/hllapi.pc.in b/sdk/hllapi.pc.in new file mode 100644 index 0000000..f18e731 --- /dev/null +++ b/sdk/hllapi.pc.in @@ -0,0 +1,16 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +version_major=@PACKAGE_MAJOR_VERSION@ +version_minor=@PACKAGE_MINOR_VERSION@ + +Name: @PACKAGE_NAME@ +Description: @PACKAGE_DESCRIPTION@ +Version: @PACKAGE_VERSION@ +Requires: ipc3270 lib3270 +Libs: -lhllapi +Libs.private: @LIBS@ @INTL_LIBS@ @IPC3270_LIBS@ +Cflags: + diff --git a/sdk/libhllapi.pc.in b/sdk/libhllapi.pc.in deleted file mode 100644 index 32d9b18..0000000 --- a/sdk/libhllapi.pc.in +++ /dev/null @@ -1,16 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -version_major=@PACKAGE_MAJOR_VERSION@ -version_minor=@PACKAGE_MINOR_VERSION@ - -Name: @PACKAGE_NAME@ -Description: @PACKAGE_DESCRIPTION@ -Version: @PACKAGE_VERSION@ -Requires: libipc3270 lib3270 -Libs: -lhllapi -Libs.private: @LIBS@ @INTL_LIBS@ @IPC3270_LIBS@ -Cflags: - diff --git a/src/core/calls.cc b/src/core/calls.cc index f9e2b0b..256d014 100644 --- a/src/core/calls.cc +++ b/src/core/calls.cc @@ -88,6 +88,8 @@ HLLAPI_API_CALL hllapi_get_state(void) { + debug("",__FUNCTION__); + try { switch(hllapi_get_message_id()) { @@ -144,6 +146,7 @@ HLLAPI_API_CALL hllapi_disconnect(void) { + trace("%s",__FUNCTION__); try { getSession().disconnect(); @@ -222,12 +225,7 @@ try { - TN3270::Host &host = getSession(); - - if(!host.isConnected()) - return HLLAPI_STATUS_DISCONNECTED; - - host.wait(seconds); + getSession().wait(seconds); return hllapi_get_state(); @@ -257,6 +255,24 @@ } + HLLAPI_API_CALL hllapi_wait_for_text_at(WORD row, WORD col, LPSTR text) { + + try { + + getSession().wait((unsigned short) row, (unsigned short) col, (const char *) text); + + return HLLAPI_STATUS_SUCCESS; + + } catch(std::exception &e) { + + hllapi_lasterror = e.what(); + + } + + return HLLAPI_STATUS_SYSTEM_ERROR; + + } + HLLAPI_API_CALL hllapi_cmp_text_at_address(WORD addr, LPSTR text) { try { diff --git a/src/core/controller.cc b/src/core/controller.cc index 1d98683..6b51e26 100644 --- a/src/core/controller.cc +++ b/src/core/controller.cc @@ -32,7 +32,6 @@ /*--[ Globals ]--------------------------------------------------------------------------------------*/ static TN3270::Host * hllapi_host = nullptr; - static time_t hllapi_timeout = 120; std::string hllapi_lasterror = ""; /*--[ Implement ]------------------------------------------------------------------------------------*/ @@ -69,7 +68,7 @@ hllapi_host = new TN3270::Host(*id ? id : nullptr, "UTF-8"); #endif // _WIN32 - hllapi_host->setTimeout(hllapi_timeout); + hllapi_host->setTimeout(120); } catch(std::exception &e) @@ -78,6 +77,7 @@ return HLLAPI_STATUS_SYSTEM_ERROR; } + debug("hllapi_host=%p",hllapi_host); return HLLAPI_STATUS_SUCCESS; } @@ -110,6 +110,7 @@ throw runtime_error( _("Not initialized") ); } + trace("%s()=%p",__FUNCTION__,hllapi_host); return *hllapi_host; } diff --git a/src/core/hllapi.cc b/src/core/hllapi.cc index 776410b..e05debc 100644 --- a/src/core/hllapi.cc +++ b/src/core/hllapi.cc @@ -453,6 +453,11 @@ HLLAPI_API_CALL hllapi_set_session_parameter(LPSTR param, WORD len, WORD value) // UNLOCKDELAY hllapi_set_unlock_delay(value); + } else if(!strncasecmp(param,"TIMEOUT",len)) { + + // UNLOCKDELAY + hllapi_set_timeout(value); + } else { return HLLAPI_STATUS_BAD_PARAMETER; diff --git a/src/core/keyboard.cc b/src/core/keyboard.cc index d7aa895..d2c0373 100644 --- a/src/core/keyboard.cc +++ b/src/core/keyboard.cc @@ -103,3 +103,19 @@ static DWORD set(std::function worker) noexcept { return HLLAPI_STATUS_SYSTEM_ERROR; } + HLLAPI_API_CALL hllapi_set_timeout(WORD seconds) { + + try { + + getSession().setTimeout((time_t) seconds); + return HLLAPI_STATUS_SUCCESS; + + } catch(std::exception &e) { + + hllapi_lasterror = e.what(); + + } + + return HLLAPI_STATUS_SYSTEM_ERROR; + + } diff --git a/src/include/lib3270/hllapi.h b/src/include/lib3270/hllapi.h index 3b3e6bb..872ef41 100644 --- a/src/include/lib3270/hllapi.h +++ b/src/include/lib3270/hllapi.h @@ -137,7 +137,7 @@ #else - #include + #include // From wtypesbase.h typedef uint8_t BYTE; @@ -324,6 +324,7 @@ HLLAPI_API_CALL hllapi_wait_for_ready(WORD seconds); HLLAPI_API_CALL hllapi_wait_for_change(WORD seconds); + HLLAPI_API_CALL hllapi_wait_for_text_at(WORD row, WORD col, LPSTR text); HLLAPI_API_CALL hllapi_wait(WORD seconds); HLLAPI_API_CALL hllapi_pfkey(WORD key); HLLAPI_API_CALL hllapi_pakey(WORD key); @@ -346,6 +347,7 @@ HLLAPI_API_CSTR hllapi_get_last_error(); HLLAPI_API_CALL hllapi_set_unlock_delay(WORD ms); + HLLAPI_API_CALL hllapi_set_timeout(WORD seconds); HLLAPI_API_CALL hllapi_set_cursor_address(WORD pos); HLLAPI_API_CALL hllapi_set_cursor_position(WORD row, WORD col); -- libgit2 0.21.2