[maemo-developers] [maemo-developers] osso-gwconnect ,still seem not work

From: 程波 程 chengbobo807 at yahoo.com.cn
Date: Thu Jan 19 10:48:05 EET 2006
omit some #include,code snipper below:

static DBusHandlerResult signal_filter(DBusConnection*
connection,DBusMessage* message,void *user_data)
{
    g_assert(message);
    g_assert(connection);

   
if(dbus_message_is_signal(message,"com.nokia.btsearch.signal","dev_found")==TRUE)

    {  
gtk_infoprintf(GTK_WINDOW(p->app),"dev_found");

    }
  
if(dbus_message_is_signal(message,"com.nokia.btsearch.signal","search_complete")==TRUE)
    {
       
gtk_infoprintf(GTK_WINDOW(p->app),"no_dev_found");
   }

    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}

void search(GtkWidget* gtkwidget,gpointer data)
{
    gtk_infoprintf(NULL, "Connecting...");

    if(osso_get_dbus_connection(p->context)==NULL)
        dprint("can not to session bus");
    if(osso_get_sys_dbus_connection(p->context)==NULL)
        dprint("con not to sys bus");
osso_rpc_run(p->context,"com.nokia.btsearch","/com/nokia/btsearch/request","start_search",N
ULL,NULL,DBUS_TYPE_INVALID);
}

int main(int argc,char** argv)
{
   gtk_init(&argc,&argv);
    p=(loop*)malloc(sizeof(loop)) ;
    p->b=gtk_button_new_with_label("seach device");
   
p->context=osso_initialize("search","1",FALSE,NULL);
   
p->appview=HILDON_APPVIEW(hildon_appview_new("appview"));
   
p->app=HILDON_APP(hildon_app_new_with_appview(p->appview));
    hildon_app_set_title(p->app,"search bluetooth
device");
    gtk_container_add(GTK_CONTAINER(p->appview),p->b);
   
g_signal_connect(G_OBJECT(p->b),"clicked",G_CALLBACK(search),NULL);
dbus_connection_add_filter((DBusConnection*)osso_get_sys_dbus_connection(p->context),signal_filter,NULL,NULL);
dbus_bus_add_match((DBusConnection*)osso_get_sys_dbus_connection(p->context),"type='signal',interface='com.nokia.btsearch.signal'",NULL);
   gtk_widget_show_all(GTK_WIDGET(p->app));
    gtk_main();
    return ;
}
but It doesn't work ,when I click the button,nothing
happen. by the way,
btsearch search what?  fuzzy .when implementing file
transport to phone, is gw_obex helpful? 


__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com

More information about the maemo-developers mailing list