Guest User

Untitled

a guest
May 24th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. // this pastie is invalid now...problem was fixed in SVN
  2.  
  3. using GLib;
  4. using DBus;
  5.  
  6. public class TestClass : GLib.Object
  7. {
  8.  
  9. private DBus.Connection connection;
  10. private dynamic DBus.Object proxy;
  11.  
  12. private bool ConnectToBus(DBus.BusType busType)
  13. {
  14. try {
  15. connection = DBus.Bus.get(busType);
  16. return true;
  17. } catch (DBus.Error err) {
  18. return false;
  19. }
  20. }
  21.  
  22. private int run()
  23. {
  24. if (!ConnectToBus(DBus.BusType.SYSTEM))
  25. if (!ConnectToBus(DBus.BusType.SESSION))
  26. return 1;
  27.  
  28. proxy = connection.get_object("net.sf.cdemu.CDEMUD_Daemon",
  29. "/CDEMUD_Daemon",
  30. "net.sf.cdemu.CDEMUD_Daemon");
  31.  
  32. string sr, sg;
  33. try {
  34. proxy.DeviceGetMapping(0u, out sr, out sg);
  35. // this generates wrong Ccode...getting new pointers to param2 and
  36. // param3 instead of just passing them in the dbus_g_proxy_call...
  37. //
  38. // void _dynamic_DeviceGetMapping0 (DBusGProxy* obj, guint param1,
  39. // char** param2, char** param3,
  40. // GError** error) {
  41. // dbus_g_proxy_call (obj, "DeviceGetMapping", error, G_TYPE_UINT,
  42. // param1, G_TYPE_INVALID, G_TYPE_STRING, &param2,
  43. // G_TYPE_STRING, &param3, G_TYPE_INVALID);
  44. // if ((*error)) {
  45. // return;
  46. // }
  47. // }
  48. } catch (DBus.Error err) {
  49. stderr.printf("Error calling DeviceGetMapping: %s\n", err.message);
  50. }
  51.  
  52. stdout.printf("sr: %s, sg: %s\n", sr, sg);
  53.  
  54. return 0;
  55. }
  56.  
  57. public static int main(string[] args)
  58. {
  59. TestClass tc = new TestClass();
  60. return tc.run();
  61. }
  62.  
  63. }
Add Comment
Please, Sign In to add comment