Commit 169203fa134a6889cb8ce6c40f543221bef072b0

Authored by Perry Werneck
1 parent 2d55eeba

Working on the new IPC API.

src/lib3270++/ipc/session.cc
... ... @@ -81,11 +81,32 @@
81 81 }
82 82  
83 83 std::string IPC::Session::toString(int baddr, size_t len, char lf) const {
84   - throw std::system_error(EINVAL, std::system_category());
  84 +
  85 + std::string rc;
  86 +
  87 + Request(*this,"getStringAtAddress")
  88 + .push((uint32_t) baddr)
  89 + .push((uint32_t) len)
  90 + .push((uint8_t) lf)
  91 + .call()
  92 + .pop(rc);
  93 +
  94 + return rc;
85 95 }
86 96  
87 97 std::string IPC::Session::toString(int row, int col, size_t sz, char lf) const {
88   - throw std::system_error(EINVAL, std::system_category());
  98 +
  99 + std::string rc;
  100 +
  101 + Request(*this,"getStringAt")
  102 + .push((uint32_t) row)
  103 + .push((uint32_t) col)
  104 + .push((uint32_t) sz)
  105 + .push((uint8_t) lf)
  106 + .call()
  107 + .pop(rc);
  108 +
  109 + return rc;
89 110 }
90 111  
91 112 ProgramMessage IPC::Session::getProgramMessage() const {
... ...
src/lib3270++/linux/request.cc
... ... @@ -146,11 +146,27 @@
146 146 return *this;
147 147 }
148 148  
149   - IPC::Request & IPC::Request::push(int32_t arg) {
  149 + IPC::Request & IPC::Request::push(const bool arg) {
  150 + dbus_message_append_args(this->msg.out,DBUS_TYPE_BOOLEAN,&arg,DBUS_TYPE_INVALID);
  151 + return *this;
  152 + }
  153 +
  154 + IPC::Request & IPC::Request::push(const uint8_t arg) {
  155 + dbus_message_append_args(this->msg.out,DBUS_TYPE_BYTE,&arg,DBUS_TYPE_INVALID);
  156 + return *this;
  157 + }
  158 +
  159 + IPC::Request & IPC::Request::push(const int32_t arg) {
150 160 dbus_message_append_args(this->msg.out,DBUS_TYPE_INT32,&arg,DBUS_TYPE_INVALID);
151 161 return *this;
152 162 }
153 163  
  164 + IPC::Request & IPC::Request::push(const uint32_t arg) {
  165 + dbus_message_append_args(this->msg.out,DBUS_TYPE_UINT32,&arg,DBUS_TYPE_INVALID);
  166 + return *this;
  167 + }
  168 +
  169 +
154 170 IPC::Request & IPC::Request::pop(std::string &value) {
155 171  
156 172 const char * str = "";
... ...
src/lib3270++/private.h
... ... @@ -295,7 +295,10 @@
295 295  
296 296 // Push values
297 297 Request & push(const char *arg);
298   - Request & push(int32_t arg);
  298 + Request & push(const bool arg);
  299 + Request & push(const int32_t arg);
  300 + Request & push(const uint32_t arg);
  301 + Request & push(const uint8_t arg);
299 302  
300 303 // Pop values
301 304 Request & pop(std::string &value);
... ...