Mercurial > projects > dbus-d
view 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 |
line wrap: on
line source
/** * Generated with TioLink * TioLink was written by Frank Benoit <benoit@tionex.de> * http://www.dsource.org/projects/tiolink * * File type: D programming language source code */ module DBusTestingGen; public import org.freedesktop.dbus.Struct; public import org.freedesktop.dbus.Variant; import tango.core.Signal; import org.freedesktop.dbus.DBus; import org.freedesktop.dbus.c.Connection : DBusConnection; import org.freedesktop.dbus.c.Message : DBusMessage; import org.freedesktop.dbus.c.Shared : DBusHandlerResult; // DBus interfaces public interface DBusInterface { // org public interface org { // org.freedesktop public interface freedesktop { // org.freedesktop.DBus public interface DBus { // org.freedesktop.DBus.Peer public interface Peer { public void Ping(); public char[] GetMachineId(); template _StdJavaImpl(){ } template _StdDImpl(){ void _init(){ } } } // org.freedesktop.DBus.Introspectable public interface Introspectable { public char[] Introspect(); template _StdJavaImpl(){ } template _StdDImpl(){ void _init(){ } } } // org.freedesktop.DBus.Properties public interface Properties { public DBusVariant Get( in char[] intf_name, in char[] prop_name ); public void Set( in char[] intf_name, in char[] prop_name, in DBusVariant prop ); public DBusVariant[ char[] ] GetAll( in char[] intf_name ); template _StdJavaImpl(){ } template _StdDImpl(){ void _init(){ } } } } } } // dbustest public interface dbustest { // dbustest.OtherInterface public interface OtherInterface { public void dummy( in char[] arg1 ); template _StdJavaImpl(){ } template _StdDImpl(){ void _init(){ } } } // dbustest.TestControl public interface TestControl { public char[][] getCalledTests(); public void activateExceptions( in bool enable ); template _StdJavaImpl(){ } template _StdDImpl(){ void _init(){ } } } // dbustest.TestListener public interface TestListener { public char[] getName(); template _StdJavaImpl(){ } template _StdDImpl(){ void _init(){ } } } // dbustest.JavaImpl public interface JavaImpl { public void testV_V(); public int testI_I( in int arg1 ); template _StdJavaImpl(){ } template _StdDImpl(){ void _init(){ } } } // dbustest.DImpl public interface DImpl { public void testV_V(); public int testI_I( in int arg1 ); 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 ); public void triggerSignal( in int count ); public tango.core.Signal.Signal!( int )* testSigI(); template _StdJavaImpl(){ } template _StdDImpl(){ void _init(){ } protected tango.core.Signal.Signal!( int ) _testSigI; public tango.core.Signal.Signal!( int )* testSigI(){ return &_testSigI; } } } } } // DBusObject public class DBusObject : DBusObjectImpl, DBusInterface.org.freedesktop.DBus.Introspectable { this(){ super(); } public char[] Introspect(){ return super.Introspect(); } } private void init_introspectionData(){ registerIntrospectionData( DBusInterface.org.freedesktop.DBus.Peer.classinfo, "<interface name=\"org.freedesktop.DBus.Peer\">\\n" " <method name=\"Ping\">\\n" " </method>\\n" " <method name=\"GetMachineId\">\\n" " <annotation name=\"org.dsource.dbus.d.Returns\" value=\"machine_uuid\" />\\n" " <arg name=\"machine_uuid\" type=\"s\" direction=\"out\" />\\n" " </method>\\n" "</interface>\\n"); registerIntrospectionData( DBusInterface.org.freedesktop.DBus.Introspectable.classinfo, "<interface name=\"org.freedesktop.DBus.Introspectable\">\\n" " <method name=\"Introspect\">\\n" " <annotation name=\"org.dsource.dbus.d.Returns\" value=\"xml_data\" />\\n" " <arg name=\"xml_data\" type=\"s\" direction=\"out\" />\\n" " </method>\\n" "</interface>\\n"); registerIntrospectionData( DBusInterface.org.freedesktop.DBus.Properties.classinfo, "<interface name=\"org.freedesktop.DBus.Properties\">\\n" " <method name=\"Get\">\\n" " <annotation name=\"org.dsource.dbus.d.Returns\" value=\"prop\" />\\n" " <arg name=\"intf_name\" type=\"s\" direction=\"in\" />\\n" " <arg name=\"prop_name\" type=\"s\" direction=\"in\" />\\n" " <arg name=\"prop\" type=\"v\" direction=\"out\" />\\n" " </method>\\n" " <method name=\"Set\">\\n" " <arg name=\"intf_name\" type=\"s\" direction=\"in\" />\\n" " <arg name=\"prop_name\" type=\"s\" direction=\"in\" />\\n" " <arg name=\"prop\" type=\"v\" direction=\"in\" />\\n" " </method>\\n" " <method name=\"GetAll\">\\n" " <annotation name=\"org.dsource.dbus.d.Returns\" value=\"allprops\" />\\n" " <arg name=\"intf_name\" type=\"s\" direction=\"in\" />\\n" " <arg name=\"allprops\" type=\"a{sv}\" direction=\"out\" />\\n" " </method>\\n" "</interface>\\n"); registerIntrospectionData( DBusInterface.dbustest.OtherInterface.classinfo, "<interface name=\"dbustest.OtherInterface\">\\n" " <method name=\"dummy\">\\n" " <arg name=\"arg1\" type=\"s\" direction=\"in\" />\\n" " </method>\\n" "</interface>\\n"); registerIntrospectionData( DBusInterface.dbustest.TestControl.classinfo, "<interface name=\"dbustest.TestControl\">\\n" " <method name=\"getCalledTests\">\\n" " <annotation name=\"org.dsource.dbus.d.Returns\" value=\"res\" />\\n" " <arg name=\"res\" type=\"as\" direction=\"out\" />\\n" " </method>\\n" " <method name=\"activateExceptions\">\\n" " <arg name=\"enable\" type=\"b\" direction=\"in\" />\\n" " </method>\\n" "</interface>\\n"); registerIntrospectionData( DBusInterface.dbustest.TestListener.classinfo, "<interface name=\"dbustest.TestListener\">\\n" " <method name=\"getName\">\\n" " <annotation name=\"org.dsource.dbus.d.Returns\" value=\"res\" />\\n" " <arg name=\"res\" type=\"s\" direction=\"out\" />\\n" " </method>\\n" "</interface>\\n"); registerIntrospectionData( DBusInterface.dbustest.JavaImpl.classinfo, "<interface name=\"dbustest.JavaImpl\">\\n" " <method name=\"testV_V\">\\n" " </method>\\n" " <method name=\"testI_I\">\\n" " <annotation name=\"org.dsource.dbus.d.Returns\" value=\"res\" />\\n" " <arg name=\"res\" type=\"i\" direction=\"out\" />\\n" " <arg name=\"arg1\" type=\"i\" direction=\"in\" />\\n" " </method>\\n" "</interface>\\n"); registerIntrospectionData( DBusInterface.dbustest.DImpl.classinfo, "<interface name=\"dbustest.DImpl\">\\n" " <method name=\"testV_V\">\\n" " </method>\\n" " <method name=\"testI_I\">\\n" " <annotation name=\"org.dsource.dbus.d.Returns\" value=\"res\" />\\n" " <arg name=\"res\" type=\"i\" direction=\"out\" />\\n" " <arg name=\"arg1\" type=\"i\" direction=\"in\" />\\n" " </method>\\n" " <method name=\"testParamAllSimpleTyes\">\\n" " <arg name=\"i_bool\" type=\"b\" direction=\"in\" />\\n" " <arg name=\"o_bool\" type=\"b\" direction=\"out\" />\\n" " <arg name=\"i_byte\" type=\"y\" direction=\"in\" />\\n" " <arg name=\"o_byte\" type=\"y\" direction=\"out\" />\\n" " <arg name=\"i_short\" type=\"n\" direction=\"in\" />\\n" " <arg name=\"o_short\" type=\"n\" direction=\"out\" />\\n" " <arg name=\"i_ushort\" type=\"q\" direction=\"in\" />\\n" " <arg name=\"o_ushort\" type=\"q\" direction=\"out\" />\\n" " <arg name=\"i_int\" type=\"i\" direction=\"in\" />\\n" " <arg name=\"o_int\" type=\"i\" direction=\"out\" />\\n" " <arg name=\"i_uint\" type=\"u\" direction=\"in\" />\\n" " <arg name=\"o_uint\" type=\"u\" direction=\"out\" />\\n" " <arg name=\"i_long\" type=\"x\" direction=\"in\" />\\n" " <arg name=\"o_long\" type=\"x\" direction=\"out\" />\\n" " <arg name=\"i_ulong\" type=\"t\" direction=\"in\" />\\n" " <arg name=\"o_ulong\" type=\"t\" direction=\"out\" />\\n" " <arg name=\"i_double\" type=\"d\" direction=\"in\" />\\n" " <arg name=\"o_double\" type=\"d\" direction=\"out\" />\\n" " <arg name=\"i_string\" type=\"s\" direction=\"in\" />\\n" " <arg name=\"o_string\" type=\"s\" direction=\"out\" />\\n" " </method>\\n" " <method name=\"triggerSignal\">\\n" " <arg name=\"count\" type=\"i\" direction=\"in\" />\\n" " </method>\\n" "</interface>\\n"); } private DBusHandlerResult intfHandler__org_freedesktop_DBus_Peer( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.org.freedesktop.DBus.Peer o = cast(DBusInterface.org.freedesktop.DBus.Peer)cast(Object)user_data; if( o is null || !checkIntf( "org.freedesktop.DBus.Peer", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "Ping|": { o.Ping(); sendReply( conn, message ); } break; case "GetMachineId|": { Struct!( char[] ) po; po.t[0] = o.GetMachineId(); sendReplyData!( char[] )( conn, message, po ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private DBusHandlerResult intfHandler__org_freedesktop_DBus_Introspectable( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.org.freedesktop.DBus.Introspectable o = cast(DBusInterface.org.freedesktop.DBus.Introspectable)cast(Object)user_data; if( o is null || !checkIntf( "org.freedesktop.DBus.Introspectable", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "Introspect|": { Struct!( char[] ) po; po.t[0] = o.Introspect(); sendReplyData!( char[] )( conn, message, po ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private DBusHandlerResult intfHandler__org_freedesktop_DBus_Properties( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.org.freedesktop.DBus.Properties o = cast(DBusInterface.org.freedesktop.DBus.Properties)cast(Object)user_data; if( o is null || !checkIntf( "org.freedesktop.DBus.Properties", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "Get|ss": { Struct!( char[], char[] ) pi = getCallValues!( char[], char[] )( message ); Struct!( DBusVariant ) po; po.t[0] = o.Get( pi.t[0], pi.t[1] ); sendReplyData!( DBusVariant )( conn, message, po ); } break; case "Set|ssv": { Struct!( char[], char[], DBusVariant ) pi = getCallValues!( char[], char[], DBusVariant )( message ); o.Set( pi.t[0], pi.t[1], pi.t[2] ); sendReply( conn, message ); } break; case "GetAll|s": { Struct!( char[] ) pi = getCallValues!( char[] )( message ); Struct!( DBusVariant[ char[] ] ) po; po.t[0] = o.GetAll( pi.t[0] ); sendReplyData!( DBusVariant[ char[] ] )( conn, message, po ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private DBusHandlerResult intfHandler__dbustest_OtherInterface( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.dbustest.OtherInterface o = cast(DBusInterface.dbustest.OtherInterface)cast(Object)user_data; if( o is null || !checkIntf( "dbustest.OtherInterface", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "dummy|s": { Struct!( char[] ) pi = getCallValues!( char[] )( message ); o.dummy( pi.t[0] ); sendReply( conn, message ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private DBusHandlerResult intfHandler__dbustest_TestControl( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.dbustest.TestControl o = cast(DBusInterface.dbustest.TestControl)cast(Object)user_data; if( o is null || !checkIntf( "dbustest.TestControl", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "getCalledTests|": { Struct!( char[][] ) po; po.t[0] = o.getCalledTests(); sendReplyData!( char[][] )( conn, message, po ); } break; case "activateExceptions|b": { Struct!( bool ) pi = getCallValues!( bool )( message ); o.activateExceptions( pi.t[0] ); sendReply( conn, message ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private DBusHandlerResult intfHandler__dbustest_TestListener( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.dbustest.TestListener o = cast(DBusInterface.dbustest.TestListener)cast(Object)user_data; if( o is null || !checkIntf( "dbustest.TestListener", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "getName|": { Struct!( char[] ) po; po.t[0] = o.getName(); sendReplyData!( char[] )( conn, message, po ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private DBusHandlerResult intfHandler__dbustest_JavaImpl( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.dbustest.JavaImpl o = cast(DBusInterface.dbustest.JavaImpl)cast(Object)user_data; if( o is null || !checkIntf( "dbustest.JavaImpl", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "testV_V|": { o.testV_V(); sendReply( conn, message ); } break; case "testI_I|i": { Struct!( int ) pi = getCallValues!( int )( message ); Struct!( int ) po; po.t[0] = o.testI_I( pi.t[0] ); sendReplyData!( int )( conn, message, po ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private DBusHandlerResult intfHandler__dbustest_DImpl( DBusConnection* conn, DBusMessage* message, void* user_data ){ DBusInterface.dbustest.DImpl o = cast(DBusInterface.dbustest.DImpl)cast(Object)user_data; if( o is null || !checkIntf( "dbustest.DImpl", message) ) return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; try{ char[METHOD_SIG_MAXLENGTH] buf; switch( methodSignature( message, buf ) ){ case "testV_V|": { o.testV_V(); sendReply( conn, message ); } break; case "testI_I|i": { Struct!( int ) pi = getCallValues!( int )( message ); Struct!( int ) po; po.t[0] = o.testI_I( pi.t[0] ); sendReplyData!( int )( conn, message, po ); } break; case "testParamAllSimpleTyes|bynqiuxtds": { Struct!( bool, byte, short, ushort, int, uint, long, ulong, double, char[] ) pi = getCallValues!( bool, byte, short, ushort, int, uint, long, ulong, double, char[] )( message ); Struct!( bool, byte, short, ushort, int, uint, long, ulong, double, char[] ) po; 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] ); sendReplyData!( bool, byte, short, ushort, int, uint, long, ulong, double, char[] )( conn, message, po ); } break; case "triggerSignal|i": { Struct!( int ) pi = getCallValues!( int )( message ); o.triggerSignal( pi.t[0] ); sendReply( conn, message ); } break; case "testSigI>i": { Struct!( int ) pi = getCallValues!( int )( message ); o.testSigI().opCall( pi.t[0] ); } break; default: return DBusHandlerResult.DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } } catch( Exception e ){ sendException( conn, message, e ); } return DBusHandlerResult.DBUS_HANDLER_RESULT_HANDLED; } private void init_handlers(){ registerHandler( DBusInterface.org.freedesktop.DBus.Peer.classinfo, & intfHandler__org_freedesktop_DBus_Peer ); registerHandler( DBusInterface.org.freedesktop.DBus.Introspectable.classinfo, & intfHandler__org_freedesktop_DBus_Introspectable ); registerHandler( DBusInterface.org.freedesktop.DBus.Properties.classinfo, & intfHandler__org_freedesktop_DBus_Properties ); registerHandler( DBusInterface.dbustest.OtherInterface.classinfo, & intfHandler__dbustest_OtherInterface ); registerHandler( DBusInterface.dbustest.TestControl.classinfo, & intfHandler__dbustest_TestControl ); registerHandler( DBusInterface.dbustest.TestListener.classinfo, & intfHandler__dbustest_TestListener ); registerHandler( DBusInterface.dbustest.JavaImpl.classinfo, & intfHandler__dbustest_JavaImpl ); registerHandler( DBusInterface.dbustest.DImpl.classinfo, & intfHandler__dbustest_DImpl ); } static this(){ init_introspectionData(); init_handlers(); }