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 194  
195 195 TN3270::Session & setCursorPosition(unsigned short addr) override;
196 196 TN3270::Session & setCursorPosition(unsigned short row, unsigned short col) override;
  197 + unsigned short getCursorPosition() override;
197 198  
198 199 TN3270::Session & pfkey(unsigned short value);
199 200 TN3270::Session & pakey(unsigned short value);
... ... @@ -361,6 +362,7 @@
361 362  
362 363 TN3270::Session & setCursorPosition(unsigned short addr) override;
363 364 TN3270::Session & setCursorPosition(unsigned short row, unsigned short col) override;
  365 + unsigned short getCursorPosition() override;
364 366  
365 367 TN3270::Session & pfkey(unsigned short value);
366 368 TN3270::Session & pakey(unsigned short value);
... ...
client/src/session/local/session.cc
... ... @@ -399,6 +399,20 @@
399 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 416 /// @brief Set cursor position.
403 417 ///
404 418 /// @param row New cursor row.
... ...
client/src/session/remote/session.cc
... ... @@ -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 348 /// @brief Set cursor position.
342 349 ///
343 350 /// @param row New cursor row.
... ...
common/src/include/lib3270/ipc.h
... ... @@ -271,6 +271,9 @@
271 271 /// @brief Set cursor position.
272 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 277 /// @brief Send PF.
275 278 virtual Session & pfkey(unsigned short value) = 0;
276 279  
... ... @@ -371,6 +374,11 @@
371 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 382 // Get properties
375 383  
376 384 /// @brief Get lib3270 version.
... ...