Commit d980cf95cc08ce6d9a511f4d2029ebea29c172fc

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

Updating ipc methods.

client/src/include/ipc-client-internals.h
... ... @@ -186,10 +186,16 @@
186 186  
187 187 // Set properties.
188 188 void setUnlockDelay(unsigned short delay = 350) override;
  189 + void setHostURL(const char *url) override;
189 190  
190 191 std::string getVersion() const override;
191 192 std::string getRevision() const override;
192 193 std::string getLUName() const override;
  194 + std::string getHostURL() const override;
  195 +
  196 + unsigned short getScreenWidth() const override;
  197 + unsigned short getScreenHeight() const override;
  198 + unsigned short getScreenLength() const override;
193 199  
194 200 // Gets
195 201 std::string toString(int baddr, size_t len, char lf) const override;
... ... @@ -366,10 +372,18 @@
366 372 std::string getVersion() const override;
367 373 std::string getRevision() const override;
368 374 std::string getLUName() const override;
  375 + std::string getHostURL() const override;
  376 +
  377 + unsigned short getScreenWidth() const override;
  378 + unsigned short getScreenHeight() const override;
  379 + unsigned short getScreenLength() const override;
369 380  
370 381 // Set properties.
371 382 void setProperty(const char *name, const int value) const;
  383 + void setProperty(const char *name, const char * value) const;
372 384 void setUnlockDelay(unsigned short delay = 350) override;
  385 + void setHostURL(const char *url) override;
  386 +
373 387  
374 388 // Gets
375 389 std::string toString(int baddr, size_t len, char lf) const override;
... ...
client/src/session/local/session.cc
... ... @@ -675,6 +675,26 @@
675 675 lib3270_set_unlock_delay(hSession,delay);
676 676 }
677 677  
  678 + std::string Local::Session::getHostURL() const {
  679 + return lib3270_get_url(hSession);
  680 + }
  681 +
  682 + void Local::Session::setHostURL(const char *url) {
  683 + lib3270_set_url(hSession,url);
  684 + }
  685 +
  686 + unsigned short Local::Session::getScreenWidth() const {
  687 + return (unsigned short) lib3270_get_width(hSession);
  688 + }
  689 +
  690 + unsigned short Local::Session::getScreenHeight() const {
  691 + return (unsigned short) lib3270_get_height(hSession);
  692 + }
  693 +
  694 + unsigned short Local::Session::getScreenLength() const {
  695 + return (unsigned short) lib3270_get_length(hSession);
  696 + }
  697 +
678 698 }
679 699  
680 700  
... ...
client/src/session/remote/session.cc
... ... @@ -326,6 +326,21 @@
326 326  
327 327 }
328 328  
  329 + void IPC::Session::setProperty(const char *name, const char *value) const {
  330 +
  331 + int32_t rc;
  332 +
  333 + Request(*this,true,name)
  334 + .push(value)
  335 + .call()
  336 + .pop(rc);
  337 +
  338 + if(rc) {
  339 + throw std::system_error((int) rc, std::system_category());
  340 + }
  341 +
  342 + }
  343 +
329 344 void IPC::Session::getProperty(const char *name, std::string &value) const {
330 345  
331 346 Request(*this,false,name)
... ... @@ -399,6 +414,41 @@
399 414  
400 415 }
401 416  
  417 + std::string IPC::Session::getHostURL() const {
  418 +
  419 + std::string value;
  420 + getProperty("url",value);
  421 + return value;
  422 +
  423 + }
  424 +
  425 + void IPC::Session::setHostURL(const char *url) {
  426 + setProperty("url",url);
  427 + }
  428 +
  429 + unsigned short IPC::Session::getScreenWidth() const {
  430 +
  431 + int value;
  432 + getProperty("width",value);
  433 + return (unsigned short) value;
  434 +
  435 + }
  436 +
  437 + unsigned short IPC::Session::getScreenHeight() const {
  438 +
  439 + int value;
  440 + getProperty("height",value);
  441 + return (unsigned short) value;
  442 +
  443 + }
  444 +
  445 + unsigned short IPC::Session::getScreenLength() const {
  446 +
  447 + int value;
  448 + getProperty("length",value);
  449 + return (unsigned short) value;
  450 + }
  451 +
402 452 }
403 453  
404 454  
... ...
common/src/include/lib3270/ipc.h
... ... @@ -254,6 +254,11 @@
254 254 virtual std::string getVersion() const = 0;
255 255 virtual std::string getRevision() const = 0;
256 256 virtual std::string getLUName() const = 0;
  257 + virtual std::string getHostURL() const = 0;
  258 +
  259 + virtual unsigned short getScreenWidth() const = 0;
  260 + virtual unsigned short getScreenHeight() const = 0;
  261 + virtual unsigned short getScreenLength() const = 0;
257 262  
258 263 virtual ProgramMessage getProgramMessage() const = 0;
259 264 inline operator ProgramMessage() const {
... ... @@ -272,6 +277,7 @@
272 277 // Set properties.
273 278 virtual void setUnlockDelay(unsigned short delay = 350) = 0;
274 279 void setCharSet(const char *charset);
  280 + virtual void setHostURL(const char *url) = 0;
275 281  
276 282 // Set contents.
277 283  
... ...