Commit bbd4411c51db511772bf52d485e1651889106acc

Authored by Perry Werneck
1 parent 61b78c9b
Exists in master

Incluindo mais métodos no gateway D-Bus.

src/gobject.c
... ... @@ -280,3 +280,39 @@ void pw3270_dbus_get_connection_state(PW3270Dbus *object, const gchar *id, DBusG
280 280 dbus_g_method_return(context,lib3270_get_connection_state(ses->host));
281 281  
282 282 }
  283 +
  284 +void pw3270_dbus_get_screen_width(PW3270Dbus *object, const gchar *id, DBusGMethodInvocation *context) {
  285 +
  286 + struct session * ses = session_find(id);
  287 +
  288 + if(!ses) {
  289 + pw3270_dbus_return_error(context,ENOENT);
  290 + return;
  291 + }
  292 +
  293 + dbus_g_method_return(context,lib3270_get_width(ses->host));
  294 +}
  295 +
  296 +void pw3270_dbus_get_screen_height(PW3270Dbus *object, const gchar *id, DBusGMethodInvocation *context) {
  297 +
  298 + struct session * ses = session_find(id);
  299 +
  300 + if(!ses) {
  301 + pw3270_dbus_return_error(context,ENOENT);
  302 + return;
  303 + }
  304 +
  305 + dbus_g_method_return(context,lib3270_get_height(ses->host));
  306 +}
  307 +
  308 +void pw3270_dbus_get_screen_length(PW3270Dbus *object, const gchar *id, DBusGMethodInvocation *context) {
  309 +
  310 + struct session * ses = session_find(id);
  311 +
  312 + if(!ses) {
  313 + pw3270_dbus_return_error(context,ENOENT);
  314 + return;
  315 + }
  316 +
  317 + dbus_g_method_return(context,lib3270_get_length(ses->host));
  318 +}
... ...
src/pw3270service.xml
... ... @@ -109,6 +109,24 @@
109 109 <arg type="i" name="status" direction="out" />
110 110 </method>
111 111  
  112 + <method name="getScreenHeight">
  113 + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
  114 + <arg type="s" name="id" direction="in" />
  115 + <arg type="i" name="height" direction="out" />
  116 + </method>
  117 +
  118 + <method name="getScreenWidth">
  119 + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
  120 + <arg type="s" name="id" direction="in" />
  121 + <arg type="i" name="width" direction="out" />
  122 + </method>
  123 +
  124 + <method name="getScreenLength">
  125 + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
  126 + <arg type="s" name="id" direction="in" />
  127 + <arg type="i" name="length" direction="out" />
  128 + </method>
  129 +
112 130 </interface>
113 131  
114 132 </node>
... ...
src/service.h
... ... @@ -79,6 +79,10 @@
79 79  
80 80 void pw3270_dbus_get_connection_state(PW3270Dbus *object, const gchar *id, DBusGMethodInvocation *context);
81 81  
  82 + void pw3270_dbus_get_screen_width(PW3270Dbus *object, const gchar *id, DBusGMethodInvocation *context);
  83 + void pw3270_dbus_get_screen_height(PW3270Dbus *object, const gchar *id, DBusGMethodInvocation *context);
  84 + void pw3270_dbus_get_screen_length(PW3270Dbus *object, const gchar *id, DBusGMethodInvocation *context);
  85 +
82 86 /*
83 87 void pw3270_dbus_quit(PW3270Dbus *object, DBusGMethodInvocation *context);
84 88 void pw3270_dbus_connect(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context);
... ... @@ -101,9 +105,6 @@
101 105 void pw3270_dbus_set_cursor_address(PW3270Dbus *object, int addr, DBusGMethodInvocation *context);
102 106 void pw3270_dbus_get_cursor_address(PW3270Dbus *object, DBusGMethodInvocation *context);
103 107  
104   - void pw3270_dbus_get_screen_width(PW3270Dbus *object, DBusGMethodInvocation *context);
105   - void pw3270_dbus_get_screen_height(PW3270Dbus *object, DBusGMethodInvocation *context);
106   - void pw3270_dbus_get_screen_length(PW3270Dbus *object, DBusGMethodInvocation *context);
107 108  
108 109 void pw3270_dbus_set_toggle(PW3270Dbus *object, int id, int value, DBusGMethodInvocation *context);
109 110  
... ...
testscripts/getheight.sh 0 → 100755
... ... @@ -0,0 +1,5 @@
  1 +#!/bin/bash
  2 +DEST=br.com.bb.pw3270.service
  3 +PATH=/br/com/bb/pw3270/service
  4 +/bin/dbus-send --session --print-reply --dest=$DEST $PATH $DEST.getScreenHeight string:$1
  5 +
... ...
testscripts/getlength.sh 0 → 100755
... ... @@ -0,0 +1,5 @@
  1 +#!/bin/bash
  2 +DEST=br.com.bb.pw3270.service
  3 +PATH=/br/com/bb/pw3270/service
  4 +/bin/dbus-send --session --print-reply --dest=$DEST $PATH $DEST.getScreenLength string:$1
  5 +
... ...
testscripts/getwidth.sh 0 → 100755
... ... @@ -0,0 +1,5 @@
  1 +#!/bin/bash
  2 +DEST=br.com.bb.pw3270.service
  3 +PATH=/br/com/bb/pw3270/service
  4 +/bin/dbus-send --session --print-reply --dest=$DEST $PATH $DEST.getScreenWidth string:$1
  5 +
... ...