easydbus.c

Go to the documentation of this file.
00001 /*
00002  EasyDbus: DBUS Binding Library.
00003  Copyright (C) 2007  Daniele Rondina aka ge@@ru, geaaru@gmail.com 
00004 
00005  This program is free software; you can redistribute it and/or
00006  modify it under the terms of the GNU General Public License
00007  as published by the Free Software Foundation; either version 2
00008  of the License, or (at your option) any later version.
00009 
00010  This program is distributed in the hope that it will be useful,
00011  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  GNU General Public License for more details.
00014 
00015  You should have received a copy of the GNU General Public License
00016  along with this program; if not, write to the Free Software
00017  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018 
00019   Filename:  easydbus_hlf.c
00020  
00021   Description:  
00022  
00023   Version:  1.0
00024   Created:  06/13/07 23:59:59 CEST
00025   Revision:  none
00026  
00027   Author:   Daniele Rondina aka Ge@@ru (geaaru@gmail.com) 
00028   License:  GPL 2.0
00029 */
00030 
00031 
00032 #include <stdio.h>
00033 #include <stdlib.h>
00034 #include <string.h>
00035 #include "config.h"
00036 // easydbus includes 
00037 #include "debug.h"
00038 #include "easydbus-core.h"
00039 #include "utils.h"
00040 
00046 void
00047 easydbus_init (void)
00048 {
00049    EasyDbusDebug ("%s version %s", PACKAGE_NAME, VERSION); 
00050 
00051    // see if manage this call through a flags
00052    dbus_threads_init_default ();
00053 }
00054 
00055 
00061 inline void
00062 easydbus_deinit (void)
00063 {
00064    EasyDbusDebug ("Deinit %s %s library...", PACKAGE_NAME, VERSION);
00065    dbus_shutdown ();
00066 }
00067 
00068 
00078 int
00079 easydbus_start_service (EasyDbus_conn * data,
00080                         char *service_name)
00081 {
00082    struct EasyDbus_core *core =
00083       (struct EasyDbus_core *) data;
00084    DBusError err;
00085 
00086    dbus_error_init (&err);
00087 
00088    if (dbus_bus_start_service_by_name
00089        (core->conn, service_name, 0, NULL, &err)) {
00090       return 0;
00091    }
00092 
00093    EasyDbusDebug ("Error on start service: %s\n",
00094                   err.message);
00095 
00096    dbus_error_free (&err);
00097    return -1;
00098 }
00099 
00100 // vim: ts=3 shiftwidth=3 expandtab

Generated on Thu Apr 10 10:00:18 2008 for EasyDbus-0.2 by  doxygen 1.5.4