Commit 3f3862ca0fb6f049941034e3a0f93bac1b98ac39

Authored by Perry Werneck
1 parent 92d61be1
Exists in master and in 1 other branch develop

Updating IPC methods.

client/src/core/constants.cc
@@ -79,7 +79,8 @@ TN3270_PUBLIC const char * toCharString(const TN3270::Action action) { @@ -79,7 +79,8 @@ TN3270_PUBLIC const char * toCharString(const TN3270::Action action) {
79 "break", 79 "break",
80 "deleteword", 80 "deleteword",
81 "deletefield", 81 "deletefield",
82 - "sysreq" 82 + "sysreq",
  83 + "kybdunlock"
83 }; 84 };
84 85
85 if( ((size_t) action) > (sizeof(actions)/sizeof(actions[0]))) { 86 if( ((size_t) action) > (sizeof(actions)/sizeof(actions[0]))) {
client/src/session/local/actions.cc
@@ -105,33 +105,34 @@ @@ -105,33 +105,34 @@
105 typedef int (*ActionCallback)(H3270 *); 105 typedef int (*ActionCallback)(H3270 *);
106 106
107 static const ActionCallback actions[] = { 107 static const ActionCallback actions[] = {
108 - lib3270_enter, // ENTER  
109 - lib3270_erase, // ERASE  
110 - lib3270_eraseeof, // ERASE_EOF  
111 - lib3270_eraseeol, // ERASE_EOL  
112 - lib3270_eraseinput, // ERASE_INPUT  
113 - lib3270_kybdreset, // KYBD_RESET  
114 - lib3270_newline, // NEWLINE  
115 - lib3270_clear, // CLEAR  
116 - lib3270_select_field, // SELECT_FIELD  
117 - lib3270_select_all, // SELECT_ALL  
118 - lib3270_unselect, // UNSELECT  
119 - lib3270_reselect, // RESELECT  
120 - lib3270_delete, // DELETE  
121 - lib3270_dup, // DUP  
122 - lib3270_fieldmark, // FIELDMARK  
123 - lib3270_backspace, // BACKSPACE  
124 - lib3270_previousword, // WORD_PREVIOUS  
125 - lib3270_nextword, // WORD_NEXT  
126 - lib3270_fieldend, // FIELD_END  
127 - lib3270_firstfield, // FIELD_FIRST  
128 - lib3270_nextfield, // FIELD_NEXT  
129 - lib3270_previousfield, // FIELD_PREVIOUS  
130 - lib3270_attn, // ATTN  
131 - lib3270_break, // BREAK  
132 - lib3270_deleteword, // WORD_DELETE  
133 - lib3270_deletefield, // FIELD_DELETE  
134 - lib3270_sysreq, // SYSREQ 108 + lib3270_enter, // ENTER
  109 + lib3270_erase, // ERASE
  110 + lib3270_eraseeof, // ERASE_EOF
  111 + lib3270_eraseeol, // ERASE_EOL
  112 + lib3270_eraseinput, // ERASE_INPUT
  113 + lib3270_kybdreset, // KYBD_RESET
  114 + lib3270_newline, // NEWLINE
  115 + lib3270_clear, // CLEAR
  116 + lib3270_select_field, // SELECT_FIELD
  117 + lib3270_select_all, // SELECT_ALL
  118 + lib3270_unselect, // UNSELECT
  119 + lib3270_reselect, // RESELECT
  120 + lib3270_delete, // DELETE
  121 + lib3270_dup, // DUP
  122 + lib3270_fieldmark, // FIELDMARK
  123 + lib3270_backspace, // BACKSPACE
  124 + lib3270_previousword, // WORD_PREVIOUS
  125 + lib3270_nextword, // WORD_NEXT
  126 + lib3270_fieldend, // FIELD_END
  127 + lib3270_firstfield, // FIELD_FIRST
  128 + lib3270_nextfield, // FIELD_NEXT
  129 + lib3270_previousfield, // FIELD_PREVIOUS
  130 + lib3270_attn, // ATTN
  131 + lib3270_break, // BREAK
  132 + lib3270_deleteword, // WORD_DELETE
  133 + lib3270_deletefield, // FIELD_DELETE
  134 + lib3270_sysreq, // SYSREQ
  135 + lib3270_clear_operator_error, // KYBD_UNLOCK
135 }; 136 };
136 137
137 if( ((size_t) action) > (sizeof(actions)/sizeof(actions[0]))) { 138 if( ((size_t) action) > (sizeof(actions)/sizeof(actions[0]))) {
client/src/session/local/private.h
@@ -130,6 +130,7 @@ @@ -130,6 +130,7 @@
130 unsigned short getScreenHeight() const override; 130 unsigned short getScreenHeight() const override;
131 unsigned short getScreenLength() const override; 131 unsigned short getScreenLength() const override;
132 void setUnlockDelay(unsigned short delay) override; 132 void setUnlockDelay(unsigned short delay) override;
  133 + void setLockOnOperatorError(bool lock) override;
133 void setCharSet(const char *charset = NULL) override; 134 void setCharSet(const char *charset = NULL) override;
134 void setCursor(unsigned short addr) override; 135 void setCursor(unsigned short addr) override;
135 void setCursor(unsigned short row, unsigned short col) override; 136 void setCursor(unsigned short row, unsigned short col) override;
client/src/session/local/properties.cc
@@ -166,6 +166,11 @@ @@ -166,6 +166,11 @@
166 chkResponse(lib3270_set_unlock_delay(hSession,delay)); 166 chkResponse(lib3270_set_unlock_delay(hSession,delay));
167 } 167 }
168 168
  169 + void Local::Session::setLockOnOperatorError(bool lock) {
  170 + std::lock_guard<std::mutex> guard(sync);
  171 + chkResponse(lib3270_set_lock_on_operator_error(hSession,lock ? 1 : 0));
  172 + }
  173 +
169 void Local::Session::setCursor(unsigned short addr) { 174 void Local::Session::setCursor(unsigned short addr) {
170 std::lock_guard<std::mutex> lock(sync); 175 std::lock_guard<std::mutex> lock(sync);
171 chkResponse(lib3270_set_cursor_address(hSession,addr)); 176 chkResponse(lib3270_set_cursor_address(hSession,addr));
client/src/session/remote/private.h
@@ -128,6 +128,7 @@ @@ -128,6 +128,7 @@
128 unsigned short getScreenHeight() const override; 128 unsigned short getScreenHeight() const override;
129 unsigned short getScreenLength() const override; 129 unsigned short getScreenLength() const override;
130 void setUnlockDelay(unsigned short delay) override; 130 void setUnlockDelay(unsigned short delay) override;
  131 + void setLockOnOperatorError(bool lock) override;
131 void setCharSet(const char *charset = NULL) override; 132 void setCharSet(const char *charset = NULL) override;
132 void setCursor(unsigned short addr) override; 133 void setCursor(unsigned short addr) override;
133 void setCursor(unsigned short row, unsigned short col) override; 134 void setCursor(unsigned short row, unsigned short col) override;
client/src/session/remote/properties.cc
@@ -133,15 +133,15 @@ @@ -133,15 +133,15 @@
133 } 133 }
134 134
135 void IPC::Session::setUnlockDelay(unsigned short delay) { 135 void IPC::Session::setUnlockDelay(unsigned short delay) {
136 -  
137 setProperty("unlock_delay", (uint32_t) delay); 136 setProperty("unlock_delay", (uint32_t) delay);
  137 + }
138 138
  139 + void IPC::Session::setLockOnOperatorError(bool lock) {
  140 + setProperty("oerrlock", (uint32_t) lock);
139 } 141 }
140 142
141 void IPC::Session::setCursor(unsigned short addr) { 143 void IPC::Session::setCursor(unsigned short addr) {
142 -  
143 - setProperty("setCursorAddress", (uint32_t) addr);  
144 - 144 + setProperty("cursor_address", (uint32_t) addr);
145 } 145 }
146 146
147 void IPC::Session::setCursor(unsigned short row, unsigned short col) { 147 void IPC::Session::setCursor(unsigned short row, unsigned short col) {
common/src/include/lib3270/ipc.h
@@ -216,7 +216,8 @@ @@ -216,7 +216,8 @@
216 BREAK, 216 BREAK,
217 WORD_DELETE, ///< @brief Backspaces the cursor until it hits the front of a word (does a ^W). 217 WORD_DELETE, ///< @brief Backspaces the cursor until it hits the front of a word (does a ^W).
218 FIELD_DELETE, ///< @brief Delete field key (does a ^U). 218 FIELD_DELETE, ///< @brief Delete field key (does a ^U).
219 - SYSREQ 219 + SYSREQ,
  220 + KYBD_UNLOCK, ///< @brief Unlock the keyboard if it was locked by operator error.
220 }; 221 };
221 222
222 /// @brief TN3270 Session. 223 /// @brief TN3270 Session.
@@ -303,6 +304,7 @@ @@ -303,6 +304,7 @@
303 virtual void setHostURL(const char *url) = 0; 304 virtual void setHostURL(const char *url) = 0;
304 305
305 virtual void setUnlockDelay(unsigned short delay = 350) = 0; 306 virtual void setUnlockDelay(unsigned short delay = 350) = 0;
  307 + virtual void setLockOnOperatorError(bool lock = true) = 0;
306 308
307 virtual unsigned short getScreenWidth() const = 0; 309 virtual unsigned short getScreenWidth() const = 0;
308 virtual unsigned short getScreenHeight() const = 0; 310 virtual unsigned short getScreenHeight() const = 0;
@@ -492,6 +494,10 @@ @@ -492,6 +494,10 @@
492 return session->setUnlockDelay(delay); 494 return session->setUnlockDelay(delay);
493 } 495 }
494 496
  497 + inline void setLockOnOperatorError(bool lock = true) {
  498 + return session->setLockOnOperatorError(lock);
  499 + }
  500 +
495 inline void setCharSet(const char *charset) { 501 inline void setCharSet(const char *charset) {
496 return session->setCharSet(charset); 502 return session->setCharSet(charset);
497 } 503 }