From: Claudio Fiorini Date: 2008-09-24T21:24:40+09:00 Subject: [ruby-core:18853] problem with argument type Hi, in my Rbluez::Hci class i'have added this function using rb_define_method that accept just one param VALUE bz_hci_connect(VALUE klass, VALUE rb_bdaddr) { bdaddr_t bd_addr; rzconn_t *rzc = malloc(sizeof(rzconn_t)); rzadapter_t* rza; struct hci_dev_info di; str2ba(RSTRING(rb_bdaddr)->ptr, &bd_addr); Data_Get_Struct(klass, rzadapter_t, rza); if(hci_devinfo(rza->dev_id, &di) < 0) { return Qnil; } if (hci_create_connection(rza->sock_id, &bd_addr, htobs(di.pkt_type & ACL_PTYPE_MASK), 0, 0x01, &rzc->handle, 25000) < 0) { close(rza->sock_id); return Qnil; } return Data_Wrap_Struct(klass, rzconn_mark, rzconn_free, rzc); } but when i invoke from ruby seems to work because on my phone the bluetooth turns on as connected but after i get these this error(...and disconnect): wrong argument type Rbluez::Hci (expected Class) (TypeError) rzconn_t is a typedef struct that holds uint16_t handle; and rzconn_mark and rzconn_free just register in memory 'handle' and free. I Hci is declared: rb_define_class_under(rb_mRbluez, "Hci", rb_cObject); any suggestions on this? thanks claudio