Commit 0e14822ff0e49f20bb231ae01c6571f18f5db168
1 parent
b749539c
Exists in
master
and in
1 other branch
Updating API definitions.
Showing
2 changed files
with
17 additions
and
8 deletions
Show diff stats
host.cc
| ... | ... | @@ -90,6 +90,16 @@ |
| 90 | 90 | return *this; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | + bool Host::isReady() const { | |
| 94 | + this->session->waitForReady(this->timeout); | |
| 95 | + return getProgramMessage() == MESSAGE_NONE; | |
| 96 | + } | |
| 97 | + | |
| 98 | + bool Host::isConnected() const { | |
| 99 | + this->session->waitForReady(this->timeout); | |
| 100 | + return getConnectionState() == CONNECTED_TN3270E; | |
| 101 | + } | |
| 102 | + | |
| 93 | 103 | std::string Host::toString() const { |
| 94 | 104 | |
| 95 | 105 | this->session->waitForReady(this->timeout); | ... | ... |
local/session.cc
| ... | ... | @@ -268,7 +268,9 @@ |
| 268 | 268 | baddr = lib3270_get_next_unprotected(hSession,0); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - lib3270_set_cursor_address(hSession,baddr); | |
| 271 | + if(lib3270_set_cursor_address(hSession,baddr)) { | |
| 272 | + throw std::system_error(errno, std::system_category()); | |
| 273 | + } | |
| 272 | 274 | |
| 273 | 275 | return *this; |
| 274 | 276 | } |
| ... | ... | @@ -278,12 +280,10 @@ |
| 278 | 280 | /// @param addr Cursor address. |
| 279 | 281 | void Local::Session::setCursorPosition(unsigned short addr) { |
| 280 | 282 | |
| 281 | - if(!lib3270_is_connected(hSession)) { | |
| 282 | - throw std::system_error(ENOTCONN, std::system_category()); | |
| 283 | + if(lib3270_set_cursor_address(hSession,addr) < 0) { | |
| 284 | + throw std::system_error(errno, std::system_category()); | |
| 283 | 285 | } |
| 284 | 286 | |
| 285 | - lib3270_set_cursor_address(hSession,baddr); | |
| 286 | - | |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /// @brief Set cursor position. |
| ... | ... | @@ -292,11 +292,10 @@ |
| 292 | 292 | /// @param col New cursor column. |
| 293 | 293 | void Local::Session::setCursorPosition(unsigned short row, unsigned short col) { |
| 294 | 294 | |
| 295 | - if(!lib3270_is_connected(hSession)) { | |
| 296 | - throw std::system_error(ENOTCONN, std::system_category()); | |
| 295 | + if(lib3270_set_cursor_position(hSession,row,col)) { | |
| 296 | + throw std::system_error(errno, std::system_category()); | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - lib3270_set_cursor_position(hSession,row,col); | |
| 300 | 299 | } |
| 301 | 300 | |
| 302 | 301 | ... | ... |