Commit 409647dc0d0e5dec2a52d2c9f6896fae2ce82f1d

Authored by Perry Werneck
1 parent 4bd7f27b
Exists in master and in 1 other branch develop

Adding more methods.

client/src/include/ipc-client-internals.h
@@ -194,6 +194,7 @@ @@ -194,6 +194,7 @@
194 194
195 TN3270::Session & setCursorPosition(unsigned short addr) override; 195 TN3270::Session & setCursorPosition(unsigned short addr) override;
196 TN3270::Session & setCursorPosition(unsigned short row, unsigned short col) override; 196 TN3270::Session & setCursorPosition(unsigned short row, unsigned short col) override;
  197 + unsigned short getCursorPosition() override;
197 198
198 TN3270::Session & pfkey(unsigned short value); 199 TN3270::Session & pfkey(unsigned short value);
199 TN3270::Session & pakey(unsigned short value); 200 TN3270::Session & pakey(unsigned short value);
@@ -361,6 +362,7 @@ @@ -361,6 +362,7 @@
361 362
362 TN3270::Session & setCursorPosition(unsigned short addr) override; 363 TN3270::Session & setCursorPosition(unsigned short addr) override;
363 TN3270::Session & setCursorPosition(unsigned short row, unsigned short col) override; 364 TN3270::Session & setCursorPosition(unsigned short row, unsigned short col) override;
  365 + unsigned short getCursorPosition() override;
364 366
365 TN3270::Session & pfkey(unsigned short value); 367 TN3270::Session & pfkey(unsigned short value);
366 TN3270::Session & pakey(unsigned short value); 368 TN3270::Session & pakey(unsigned short value);
client/src/session/local/session.cc
@@ -399,6 +399,20 @@ @@ -399,6 +399,20 @@
399 return *this; 399 return *this;
400 } 400 }
401 401
  402 + /// @brief Get cursor address.
  403 + ///
  404 + /// @return
  405 + unsigned short Local::Session::getCursorPosition() {
  406 +
  407 + unsigned int position = lib3270_get_cursor_address(hSession);
  408 +
  409 + if(!position)
  410 + throw std::system_error(errno, std::system_category());
  411 +
  412 + return position;
  413 + }
  414 +
  415 +
402 /// @brief Set cursor position. 416 /// @brief Set cursor position.
403 /// 417 ///
404 /// @param row New cursor row. 418 /// @param row New cursor row.
client/src/session/remote/session.cc
@@ -338,6 +338,13 @@ @@ -338,6 +338,13 @@
338 338
339 } 339 }
340 340
  341 + unsigned short IPC::Session::getCursorPosition() {
  342 +
  343 + // TODO: Implement it.
  344 + throw std::system_error((int) ENOTSUP, std::system_category());
  345 +
  346 + }
  347 +
341 /// @brief Set cursor position. 348 /// @brief Set cursor position.
342 /// 349 ///
343 /// @param row New cursor row. 350 /// @param row New cursor row.
common/src/include/lib3270/ipc.h
@@ -271,6 +271,9 @@ @@ -271,6 +271,9 @@
271 /// @brief Set cursor position. 271 /// @brief Set cursor position.
272 virtual TN3270::Session & setCursorPosition(unsigned short row, unsigned short col) = 0; 272 virtual TN3270::Session & setCursorPosition(unsigned short row, unsigned short col) = 0;
273 273
  274 + /// @brief Get cursor address
  275 + virtual unsigned short getCursorPosition() = 0;
  276 +
274 /// @brief Send PF. 277 /// @brief Send PF.
275 virtual Session & pfkey(unsigned short value) = 0; 278 virtual Session & pfkey(unsigned short value) = 0;
276 279
@@ -371,6 +374,11 @@ @@ -371,6 +374,11 @@
371 session->setCursorPosition(row,col); 374 session->setCursorPosition(row,col);
372 } 375 }
373 376
  377 + /// @brief Get cursor address
  378 + inline unsigned short getCursorPosition() {
  379 + return session->getCursorPosition();
  380 + }
  381 +
374 // Get properties 382 // Get properties
375 383
376 /// @brief Get lib3270 version. 384 /// @brief Get lib3270 version.