comparison dbus-d-javatests/dsrc/DBusTestingGen.d @ 5:7c2c75740370

code generation for signals
author Frank Benoit <benoit@tionex.de>
date Sun, 21 Oct 2007 19:22:41 +0200
parents 427c0332a111
children 963d271f7c25
comparison
equal deleted inserted replaced
4:427c0332a111 5:7c2c75740370
27 public interface DBus { 27 public interface DBus {
28 // org.freedesktop.DBus.Peer 28 // org.freedesktop.DBus.Peer
29 public interface Peer { 29 public interface Peer {
30 public void Ping(); 30 public void Ping();
31 public char[] GetMachineId(); 31 public char[] GetMachineId();
32 template _StdJavaImpl(){
33 }
34 template _StdDImpl(){
35 void _init(){
36 }
37 }
32 } 38 }
33 // org.freedesktop.DBus.Introspectable 39 // org.freedesktop.DBus.Introspectable
34 public interface Introspectable { 40 public interface Introspectable {
35 public char[] Introspect(); 41 public char[] Introspect();
42 template _StdJavaImpl(){
43 }
44 template _StdDImpl(){
45 void _init(){
46 }
47 }
36 } 48 }
37 // org.freedesktop.DBus.Properties 49 // org.freedesktop.DBus.Properties
38 public interface Properties { 50 public interface Properties {
39 public DBusVariant Get( in char[] intf_name, in char[] prop_name ); 51 public DBusVariant Get( in char[] intf_name, in char[] prop_name );
40 public void Set( in char[] intf_name, in char[] prop_name, in DBusVariant prop ); 52 public void Set( in char[] intf_name, in char[] prop_name, in DBusVariant prop );
41 public DBusVariant[ char[] ] GetAll( in char[] intf_name ); 53 public DBusVariant[ char[] ] GetAll( in char[] intf_name );
54 template _StdJavaImpl(){
55 }
56 template _StdDImpl(){
57 void _init(){
58 }
59 }
42 } 60 }
43 } 61 }
44 } 62 }
45 } 63 }
46 // dbustest 64 // dbustest
47 public interface dbustest { 65 public interface dbustest {
48 // dbustest.OtherInterface 66 // dbustest.OtherInterface
49 public interface OtherInterface { 67 public interface OtherInterface {
50 public void dummy( in char[] arg1 ); 68 public void dummy( in char[] arg1 );
69 template _StdJavaImpl(){
70 }
71 template _StdDImpl(){
72 void _init(){
73 }
74 }
51 } 75 }
52 // dbustest.TestControl 76 // dbustest.TestControl
53 public interface TestControl { 77 public interface TestControl {
54 public char[] getName(); 78 public char[][] getCalledTests();
79 public void activateExceptions( in bool enable );
80 template _StdJavaImpl(){
81 }
82 template _StdDImpl(){
83 void _init(){
84 }
85 }
55 } 86 }
56 // dbustest.TestListener 87 // dbustest.TestListener
57 public interface TestListener { 88 public interface TestListener {
58 public char[] getName(); 89 public char[] getName();
90 template _StdJavaImpl(){
91 }
92 template _StdDImpl(){
93 void _init(){
94 }
95 }
59 } 96 }
60 // dbustest.JavaImpl 97 // dbustest.JavaImpl
61 public interface JavaImpl { 98 public interface JavaImpl {
62 public void testV_V(); 99 public void testV_V();
63 public int testI_I( in int arg1 ); 100 public int testI_I( in int arg1 );
101 template _StdJavaImpl(){
102 }
103 template _StdDImpl(){
104 void _init(){
105 }
106 }
64 } 107 }
65 // dbustest.DImpl 108 // dbustest.DImpl
66 public interface DImpl { 109 public interface DImpl {
67 public void testV_V(); 110 public void testV_V();
68 public int testI_I( in int arg1 ); 111 public int testI_I( in int arg1 );
112 public void testParamAllSimpleTyes( in bool i_bool, out bool o_bool, in byte i_byte, out byte o_byte, in short i_short, out short o_short, in ushort i_ushort, out ushort o_ushort, in int i_int, out int o_int, in uint i_uint, out uint o_uint, in long i_long, out long o_long, in ulong i_ulong, out ulong o_ulong, in double i_double, out double o_double, in char[] i_string, out char[] o_string );
113 public void triggerSignal( in int count );
114 public tango.core.Signal.Signal!( int )* testSigI();
115 template _StdJavaImpl(){
116 }
117 template _StdDImpl(){
118 void _init(){
119 }
120 protected tango.core.Signal.Signal!( int ) _testSigI;
121 public tango.core.Signal.Signal!( int )* testSigI(){
122 return &_testSigI;
123 }
124 }
69 } 125 }
70 } 126 }
71 } 127 }
72 128
73 129
129 " </method>\\n" 185 " </method>\\n"
130 "</interface>\\n"); 186 "</interface>\\n");
131 registerIntrospectionData( 187 registerIntrospectionData(
132 DBusInterface.dbustest.TestControl.classinfo, 188 DBusInterface.dbustest.TestControl.classinfo,
133 "<interface name=\"dbustest.TestControl\">\\n" 189 "<interface name=\"dbustest.TestControl\">\\n"
134 " <method name=\"getName\">\\n" 190 " <method name=\"getCalledTests\">\\n"
135 " <annotation name=\"org.dsource.dbus.d.Returns\" value=\"res\" />\\n" 191 " <annotation name=\"org.dsource.dbus.d.Returns\" value=\"res\" />\\n"
136 " <arg name=\"res\" type=\"s\" direction=\"out\" />\\n" 192 " <arg name=\"res\" type=\"as\" direction=\"out\" />\\n"
193 " </method>\\n"
194 " <method name=\"activateExceptions\">\\n"
195 " <arg name=\"enable\" type=\"b\" direction=\"in\" />\\n"
137 " </method>\\n" 196 " </method>\\n"
138 "</interface>\\n"); 197 "</interface>\\n");
139 registerIntrospectionData( 198 registerIntrospectionData(
140 DBusInterface.dbustest.TestListener.classinfo, 199 DBusInterface.dbustest.TestListener.classinfo,
141 "<interface name=\"dbustest.TestListener\">\\n" 200 "<interface name=\"dbustest.TestListener\">\\n"
163 " <method name=\"testI_I\">\\n" 222 " <method name=\"testI_I\">\\n"
164 " <annotation name=\"org.dsource.dbus.d.Returns\" value=\"res\" />\\n" 223 " <annotation name=\"org.dsource.dbus.d.Returns\" value=\"res\" />\\n"
165 " <arg name=\"res\" type=\"i\" direction=\"out\" />\\n" 224 " <arg name=\"res\" type=\"i\" direction=\"out\" />\\n"
166 " <arg name=\"arg1\" type=\"i\" direction=\"in\" />\\n" 225 " <arg name=\"arg1\" type=\"i\" direction=\"in\" />\\n"
167 " </method>\\n" 226 " </method>\\n"
227 " <method name=\"testParamAllSimpleTyes\">\\n"
228 " <arg name=\"i_bool\" type=\"b\" direction=\"in\" />\\n"
229 " <arg name=\"o_bool\" type=\"b\" direction=\"out\" />\\n"
230 " <arg name=\"i_byte\" type=\"y\" direction=\"in\" />\\n"
231 " <arg name=\"o_byte\" type=\"y\" direction=\"out\" />\\n"
232 " <arg name=\"i_short\" type=\"n\" direction=\"in\" />\\n"
233 " <arg name=\"o_short\" type=\"n\" direction=\"out\" />\\n"
234 " <arg name=\"i_ushort\" type=\"q\" direction=\"in\" />\\n"
235 " <arg name=\"o_ushort\" type=\"q\" direction=\"out\" />\\n"
236 " <arg name=\"i_int\" type=\"i\" direction=\"in\" />\\n"
237 " <arg name=\"o_int\" type=\"i\" direction=\"out\" />\\n"
238 " <arg name=\"i_uint\" type=\"u\" direction=\"in\" />\\n"
239 " <arg name=\"o_uint\" type=\"u\" direction=\"out\" />\\n"
240 " <arg name=\"i_long\" type=\"x\" direction=\"in\" />\\n"
241 " <arg name=\"o_long\" type=\"x\" direction=\"out\" />\\n"
242 " <arg name=\"i_ulong\" type=\"t\" direction=\"in\" />\\n"
243 " <arg name=\"o_ulong\" type=\"t\" direction=\"out\" />\\n"
244 " <arg name=\"i_double\" type=\"d\" direction=\"in\" />\\n"
245 " <arg name=\"o_double\" type=\"d\" direction=\"out\" />\\n"
246 " <arg name=\"i_string\" type=\"s\" direction=\"in\" />\\n"
247 " <arg name=\"o_string\" type=\"s\" direction=\"out\" />\\n"
248 " </method>\\n"
249 " <method name=\"triggerSignal\">\\n"
250 " <arg name=\"count\" type=\"i\" direction=\"in\" />\\n"
251 " </method>\\n"
168 "</interface>\\n"); 252 "</interface>\\n");
169 } 253 }
170 private DBusHandlerResult intfHandler__org_freedesktop_DBus_Peer( DBusConnection* conn, DBusMessage* message, void* user_data ){ 254 private DBusHandlerResult intfHandler__org_freedesktop_DBus_Peer( DBusConnection* conn, DBusMessage* message, void* user_data ){
171 DBusInterface.org.freedesktop.DBus.Peer o = cast(DBusInterface.org.freedesktop.DBus.Peer)cast(Object)user_data; 255 DBusInterface.org.freedesktop.DBus.Peer o = cast(DBusInterface.org.freedesktop.DBus.Peer)cast(Object)user_data;
172 if( o is null || !checkIntf( "org.freedesktop.DBus.Peer", message) ) 256 if( o is null || !checkIntf( "org.freedesktop.DBus.Peer", message) )
295 return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 379 return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
296 380
297 try{ 381 try{
298 char[METHOD_SIG_MAXLENGTH] buf; 382 char[METHOD_SIG_MAXLENGTH] buf;
299 switch( methodSignature( message, buf ) ){ 383 switch( methodSignature( message, buf ) ){
300 case "getName|": 384 case "getCalledTests|":
301 { 385 {
302 Struct!( char[] ) po; 386 Struct!( char[][] ) po;
303 po.t[0] = o.getName(); 387 po.t[0] = o.getCalledTests();
304 sendReplyData!( char[] )( conn, message, po ); 388 sendReplyData!( char[][] )( conn, message, po );
389 }
390 break;
391 case "activateExceptions|b":
392 {
393 Struct!( bool ) pi = getCallValues!( bool )( message );
394 o.activateExceptions( pi.t[0] );
395 sendReply( conn, message );
305 } 396 }
306 break; 397 break;
307 default: 398 default:
308 return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 399 return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
309 } 400 }
391 Struct!( int ) po; 482 Struct!( int ) po;
392 po.t[0] = o.testI_I( pi.t[0] ); 483 po.t[0] = o.testI_I( pi.t[0] );
393 sendReplyData!( int )( conn, message, po ); 484 sendReplyData!( int )( conn, message, po );
394 } 485 }
395 break; 486 break;
487 case "testParamAllSimpleTyes|bynqiuxtds":
488 {
489 Struct!( bool, byte, short, ushort, int, uint, long, ulong, double, char[] ) pi = getCallValues!( bool, byte, short, ushort, int, uint, long, ulong, double, char[] )( message );
490 Struct!( bool, byte, short, ushort, int, uint, long, ulong, double, char[] ) po;
491 o.testParamAllSimpleTyes( pi.t[0], po.t[0], pi.t[1], po.t[1], pi.t[2], po.t[2], pi.t[3], po.t[3], pi.t[4], po.t[4], pi.t[5], po.t[5], pi.t[6], po.t[6], pi.t[7], po.t[7], pi.t[8], po.t[8], pi.t[9], po.t[9] );
492 sendReplyData!( bool, byte, short, ushort, int, uint, long, ulong, double, char[] )( conn, message, po );
493 }
494 break;
495 case "triggerSignal|i":
496 {
497 Struct!( int ) pi = getCallValues!( int )( message );
498 o.triggerSignal( pi.t[0] );
499 sendReply( conn, message );
500 }
501 break;
502 case "testSigI>i":
503 {
504 Struct!( int ) pi = getCallValues!( int )( message );
505 o.testSigI().opCall( pi.t[0] );
506 }
507 break;
396 default: 508 default:
397 return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 509 return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
398 } 510 }
399 } 511 }
400 catch( Exception e ){ 512 catch( Exception e ){