Commit 9f0e9f3d123be745752fe76bf6172536ea6d29ed

Authored by Perry Werneck
1 parent 87b4a51a
Exists in master and in 1 other branch develop

Refactoring IPC compatiblity module for linux.

@@ -3,11 +3,12 @@ @@ -3,11 +3,12 @@
3 <FileVersion major="1" minor="6" /> 3 <FileVersion major="1" minor="6" />
4 <Project> 4 <Project>
5 <Option title="pw3270 HLLAPI v5.1 compatibility plugin" /> 5 <Option title="pw3270 HLLAPI v5.1 compatibility plugin" />
  6 + <Option makefile_is_custom="1" />
6 <Option pch_mode="2" /> 7 <Option pch_mode="2" />
7 <Option compiler="gcc" /> 8 <Option compiler="gcc" />
8 <Build> 9 <Build>
9 <Target title="Debug"> 10 <Target title="Debug">
10 - <Option output=".bin/Debug/pw3270 HLLAPI v5" prefix_auto="1" extension_auto="1" /> 11 + <Option output=".bin/Debug/ipc3270c" prefix_auto="1" extension_auto="1" />
11 <Option object_output=".obj/Debug/" /> 12 <Option object_output=".obj/Debug/" />
12 <Option type="1" /> 13 <Option type="1" />
13 <Option compiler="gcc" /> 14 <Option compiler="gcc" />
@@ -16,7 +17,7 @@ @@ -16,7 +17,7 @@
16 </Compiler> 17 </Compiler>
17 </Target> 18 </Target>
18 <Target title="Release"> 19 <Target title="Release">
19 - <Option output=".bin/Release/pw3270 HLLAPI v5" prefix_auto="1" extension_auto="1" /> 20 + <Option output=".bin/Release/ipc3270c" prefix_auto="1" extension_auto="1" />
20 <Option object_output=".obj/Release/" /> 21 <Option object_output=".obj/Release/" />
21 <Option type="1" /> 22 <Option type="1" />
22 <Option compiler="gcc" /> 23 <Option compiler="gcc" />
@@ -31,6 +32,21 @@ @@ -31,6 +32,21 @@
31 <Compiler> 32 <Compiler>
32 <Add option="-Wall" /> 33 <Add option="-Wall" />
33 </Compiler> 34 </Compiler>
  35 + <Unit filename="src/plugin/linux/daemon.h" />
  36 + <Unit filename="src/plugin/linux/globals.h" />
  37 + <Unit filename="src/plugin/linux/gobject.c">
  38 + <Option compilerVar="CC" />
  39 + </Unit>
  40 + <Unit filename="src/plugin/linux/main.c">
  41 + <Option compilerVar="CC" />
  42 + </Unit>
  43 + <Unit filename="src/plugin/linux/misc.c">
  44 + <Option compilerVar="CC" />
  45 + </Unit>
  46 + <Unit filename="src/plugin/linux/service.h" />
  47 + <Unit filename="src/testprogram/testprogram.c">
  48 + <Option compilerVar="CC" />
  49 + </Unit>
34 <Extensions> 50 <Extensions>
35 <code_completion /> 51 <code_completion />
36 <envvars /> 52 <envvars />
src/dbus3270/test.sh
@@ -1,126 +0,0 @@ @@ -1,126 +0,0 @@
1 -#!/bin/bash  
2 -  
3 -SESSION=a  
4 -DEST=br.com.bb.pw3270  
5 -BPATH=/br/com/bb/pw3270  
6 -  
7 -run_command()  
8 -{  
9 -  
10 - case $1 in  
11 -  
12 - revision)  
13 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getRevision  
14 - ;;  
15 -  
16 - message)  
17 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getMessageID  
18 - ;;  
19 -  
20 - ssl)  
21 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getSecureState  
22 - ;;  
23 -  
24 - connect)  
25 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.connect string:$2 int32:10  
26 - ;;  
27 -  
28 - disconnect)  
29 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.disconnect  
30 - ;;  
31 -  
32 - url)  
33 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getURL  
34 - ;;  
35 -  
36 - quit)  
37 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.quit  
38 - ;;  
39 -  
40 - get)  
41 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getScreenContents  
42 - ;;  
43 -  
44 - gettext)  
45 -# addr,len,lf  
46 -# dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getText int32:1 int32:-1 byte:0  
47 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getText int32:1 int32:-1 byte:10  
48 - ;;  
49 -  
50 - protect)  
51 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getIsProtectedAt int32:$2 int32:$3  
52 - ;;  
53 -  
54 - set)  
55 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.setTextAt int32:$2 int32:$3 string:$4  
56 - ;;  
57 -  
58 - action)  
59 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.action string:$2  
60 - ;;  
61 -  
62 - enter)  
63 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.enter  
64 - ;;  
65 -  
66 - isconnected)  
67 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.isConnected  
68 - ;;  
69 -  
70 - hostcharset)  
71 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getHostCharset  
72 - ;;  
73 -  
74 - displaycharset)  
75 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getDisplayCharset  
76 - ;;  
77 -  
78 - unlockdelay)  
79 - dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.setUnlockDelay int32:$2  
80 - ;;  
81 -  
82 - *)  
83 - echo "Comando $1 desconhecido"  
84 - ;;  
85 -  
86 - esac  
87 -}  
88 -  
89 -  
90 -  
91 -until [ -z "$1" ]  
92 -do  
93 - if [ ${1:0:2} = '--' ]; then  
94 - tmp=${1:2}  
95 - parameter=${tmp%%=*}  
96 - parameter=$(echo $parameter | tr "[:lower:]" "[:upper:]")  
97 - value=${tmp##*=}  
98 -  
99 - case "$parameter" in  
100 - SESSION)  
101 - SESSION=$value  
102 - ;;  
103 - HELP)  
104 - echo "$0 options"  
105 - echo ""  
106 - echo "Options:"  
107 - echo ""  
108 - echo " --session pw3270's session manager"  
109 - echo ""  
110 - exit 0  
111 - ;;  
112 -  
113 - *)  
114 - eval $parameter=$value  
115 - ;;  
116 -  
117 - esac  
118 -  
119 - else  
120 - run_command $@  
121 - exit 0  
122 - fi  
123 -  
124 - shift  
125 -done  
126 -  
src/plugin/linux/gobject.c
@@ -66,11 +66,12 @@ static void pw3270_dbus_class_init(PW3270DbusClass *klass) @@ -66,11 +66,12 @@ static void pw3270_dbus_class_init(PW3270DbusClass *klass)
66 GObjectClass *object_class; 66 GObjectClass *object_class;
67 object_class = G_OBJECT_CLASS (klass); 67 object_class = G_OBJECT_CLASS (klass);
68 object_class->finalize = pw3270_dbus_finalize; 68 object_class->finalize = pw3270_dbus_finalize;
  69 + debug("%s",__FUNCTION__);
69 } 70 }
70 71
71 -static void pw3270_dbus_init(PW3270Dbus G_GNUC_UNUSED(*object)) 72 +static void pw3270_dbus_init(PW3270Dbus *object)
72 { 73 {
73 - 74 + debug("%s(%p)",__FUNCTION__,object);
74 } 75 }
75 76
76 PW3270Dbus * pw3270_dbus_new(void) 77 PW3270Dbus * pw3270_dbus_new(void)
@@ -80,12 +81,8 @@ PW3270Dbus * pw3270_dbus_new(void) @@ -80,12 +81,8 @@ PW3270Dbus * pw3270_dbus_new(void)
80 81
81 void pw3270_dbus_get_revision(PW3270Dbus *object, DBusGMethodInvocation *context) 82 void pw3270_dbus_get_revision(PW3270Dbus *object, DBusGMethodInvocation *context)
82 { 83 {
83 - trace("%s object=%p context=%p",__FUNCTION__,object,context);  
84 -#ifdef PACKAGE_REVISION  
85 - dbus_g_method_return(context,PACKAGE_REVISION);  
86 -#else  
87 - dbus_g_method_return(context,BUILD_DATE);  
88 -#endif 84 + debug("%s object=%p context=%p",__FUNCTION__,object,context);
  85 + dbus_g_method_return(context,lib3270_get_revision());
89 } 86 }
90 87
91 void pw3270_dbus_connect(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context) 88 void pw3270_dbus_connect(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context)
src/plugin/linux/main.c
@@ -171,6 +171,7 @@ @@ -171,6 +171,7 @@
171 171
172 H3270 * pw3270_dbus_get_session_handle(PW3270Dbus G_GNUC_UNUSED(*object)) 172 H3270 * pw3270_dbus_get_session_handle(PW3270Dbus G_GNUC_UNUSED(*object))
173 { 173 {
  174 + debug("%s=%p",__FUNCTION__,lib3270_get_default_session_handle());
174 return lib3270_get_default_session_handle(); 175 return lib3270_get_default_session_handle();
175 } 176 }
176 177
src/testprogram/linux/test.sh 0 → 100755
@@ -0,0 +1,126 @@ @@ -0,0 +1,126 @@
  1 +#!/bin/bash
  2 +
  3 +SESSION=a
  4 +DEST=br.com.bb.pw3270
  5 +BPATH=/br/com/bb/pw3270
  6 +
  7 +run_command()
  8 +{
  9 +
  10 + case $1 in
  11 +
  12 + revision)
  13 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getRevision
  14 + ;;
  15 +
  16 + message)
  17 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getMessageID
  18 + ;;
  19 +
  20 + ssl)
  21 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getSecureState
  22 + ;;
  23 +
  24 + connect)
  25 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.connect string:$2 int32:10
  26 + ;;
  27 +
  28 + disconnect)
  29 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.disconnect
  30 + ;;
  31 +
  32 + url)
  33 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getURL
  34 + ;;
  35 +
  36 + quit)
  37 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.quit
  38 + ;;
  39 +
  40 + get)
  41 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getScreenContents
  42 + ;;
  43 +
  44 + gettext)
  45 +# addr,len,lf
  46 +# dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getText int32:1 int32:-1 byte:0
  47 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getText int32:1 int32:-1 byte:10
  48 + ;;
  49 +
  50 + protect)
  51 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getIsProtectedAt int32:$2 int32:$3
  52 + ;;
  53 +
  54 + set)
  55 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.setTextAt int32:$2 int32:$3 string:$4
  56 + ;;
  57 +
  58 + action)
  59 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.action string:$2
  60 + ;;
  61 +
  62 + enter)
  63 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.enter
  64 + ;;
  65 +
  66 + isconnected)
  67 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.isConnected
  68 + ;;
  69 +
  70 + hostcharset)
  71 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getHostCharset
  72 + ;;
  73 +
  74 + displaycharset)
  75 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.getDisplayCharset
  76 + ;;
  77 +
  78 + unlockdelay)
  79 + dbus-send --session --print-reply --dest=$DEST.$SESSION $BPATH $DEST.setUnlockDelay int32:$2
  80 + ;;
  81 +
  82 + *)
  83 + echo "Comando $1 desconhecido"
  84 + ;;
  85 +
  86 + esac
  87 +}
  88 +
  89 +
  90 +
  91 +until [ -z "$1" ]
  92 +do
  93 + if [ ${1:0:2} = '--' ]; then
  94 + tmp=${1:2}
  95 + parameter=${tmp%%=*}
  96 + parameter=$(echo $parameter | tr "[:lower:]" "[:upper:]")
  97 + value=${tmp##*=}
  98 +
  99 + case "$parameter" in
  100 + SESSION)
  101 + SESSION=$value
  102 + ;;
  103 + HELP)
  104 + echo "$0 options"
  105 + echo ""
  106 + echo "Options:"
  107 + echo ""
  108 + echo " --session pw3270's session manager"
  109 + echo ""
  110 + exit 0
  111 + ;;
  112 +
  113 + *)
  114 + eval $parameter=$value
  115 + ;;
  116 +
  117 + esac
  118 +
  119 + else
  120 + run_command $@
  121 + exit 0
  122 + fi
  123 +
  124 + shift
  125 +done
  126 +