From: "rohit puri" <rohitpuri.rohit@gmail.com>
To: Bluez-users@lists.sourceforge.net
Subject: [Bluez-users] problem in discovering device using dbus APIs
Date: Tue, 9 Oct 2007 17:37:55 +0530 [thread overview]
Message-ID: <d5d240eb0710090507i71fadfb0n88ac6e8d5dcec0a3@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 3530 bytes --]
hi all,
I have trimmed the program comes with gnome. The program compiles but
doesnt give any output.There may be some problem.here I am attaching the
code.
#include<stdlib.h>
#include<stdio.h>
#include<dbus-1.0/dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <string.h>
#include<glib-object.h>
#include "marshal.h"
extern void marshal_VOID__STRING_UINT_INT (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
extern void marshal_VOID__STRING_STRING (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
static void remote_device_found(DBusGProxy *object, const char *address,
const unsigned int class, const int rssi, gpointer
user_data)
{
//DBusGConnection *conn = user_data;
/* bluetooth_device_store_add_device(BLUETOOTH_DEVICE_STORE(store),
address, class, rssi);*/
printf("(%s )\n :Remote device address found",address);
#if 0
object = dbus_g_proxy_new_for_name(conn, "org.bluez",
"/org/bluez/hci0", "org.bluez.Test");
dbus_g_proxy_call(object, "AuditRemoteDevice", NULL, G_TYPE_STRING,
address, G_TYPE_INVALID);
#endif
}
static void discovery_started(DBusGProxy *object, gpointer user_data)
{
printf("devices discovered: DiscoveryStarted()\n");
}
static void setup_dbus(DBusGConnection *conn)
{
/*creating the proxy object*/
DBusGProxy *object;
/*creating a message and sending a message to the remote object
blocking call*/
object = dbus_g_proxy_new_for_name(conn, "org.bluez",
"/org/bluez/hci0", "org.bluez.Adapter");
/*registering a marshal */
dbus_g_object_register_marshaller(marshal_VOID__STRING_UINT_INT,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID);
dbus_g_proxy_add_signal(object, "RemoteDeviceFound", G_TYPE_STRING,
G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID);
dbus_g_proxy_connect_signal(object, "RemoteDeviceFound",
G_CALLBACK(remote_device_found), conn, NULL);
dbus_g_proxy_add_signal(object, "DiscoveryStarted", G_TYPE_INVALID);
dbus_g_proxy_connect_signal(object, "DiscoveryStarted",
G_CALLBACK(discovery_started), NULL, NULL);
}
int main(int argc, char *argv[])
{
DBusGConnection *conn;
GError *error = NULL;
g_type_init();
/*getting the system bus connection*/
conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
if (error != NULL) {
g_printerr("Connecting to system bus failed: %s\n",
error->message);
g_error_free(error);
exit(EXIT_FAILURE);
}
setup_dbus(conn);
DBusGProxy *object;
object = dbus_g_proxy_new_for_name(conn, "org.bluez",
"/org/bluez/hci0", "org.bluez.Adapter");
dbus_g_proxy_call(object, "DiscoverDevices", &error,
G_TYPE_INVALID, G_TYPE_INVALID);
if (error != NULL) {
printf ("\n Error ... message is %s",error->message);
}
dbus_g_connection_unref(conn);
return 0;
can some one figure out the problem.
Thanks
Rohit
[-- Attachment #1.2: Type: text/html, Size: 7130 bytes --]
[-- Attachment #2: Type: text/plain, Size: 314 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
reply other threads:[~2007-10-09 12:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d5d240eb0710090507i71fadfb0n88ac6e8d5dcec0a3@mail.gmail.com \
--to=rohitpuri.rohit@gmail.com \
--cc=Bluez-users@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox