* read phonebook
@ 2016-06-11 16:41 Marco Trapanese
2016-06-11 18:08 ` Georg Chini
0 siblings, 1 reply; 8+ messages in thread
From: Marco Trapanese @ 2016-06-11 16:41 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 486 bytes --]
Hello,
I have this setup:
- RPi3
- Raspbian Jessie Lite
- bluez 5.40
- ofono 1.18
in /etc/bluetooth/main.conf I set this class: 0x640408.
Using bluetoothctl I connected my phone to the SBC and I can make a call
using the ofono tests.
I wonder how to read the contacts. I launched test-phonebook but I got
this error:
> Method "Import" with signature "" on interface "org.ofono.Phonebook" doesn't exist
Do I need to enable something other before?
Thanks
Marco
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: read phonebook 2016-06-11 16:41 read phonebook Marco Trapanese @ 2016-06-11 18:08 ` Georg Chini 2016-06-11 21:54 ` Jason Gauthier 0 siblings, 1 reply; 8+ messages in thread From: Georg Chini @ 2016-06-11 18:08 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 803 bytes --] On 11.06.2016 18:41, Marco Trapanese wrote: > Hello, > I have this setup: > > - RPi3 > - Raspbian Jessie Lite > - bluez 5.40 > - ofono 1.18 > > in /etc/bluetooth/main.conf I set this class: 0x640408. > Using bluetoothctl I connected my phone to the SBC and I can make a > call using the ofono tests. > > I wonder how to read the contacts. I launched test-phonebook but I got > this error: > >> Method "Import" with signature "" on interface "org.ofono.Phonebook" >> doesn't exist > > Do I need to enable something other before? > Thanks > Marco Hi Marco, see attached python script for how to get the phone book from a bluetooth device. I think you need obexd for this, although I am not quite sure because I programmed it long ago. Regards Georg [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: phonebook_phone.py --] [-- Type: text/x-python, Size: 2842 bytes --] #!/usr/bin/python # -*- coding: utf-8 -*- import gtk, gobject, os, dbus, dbus.service, logging class Phonebook_Phone: bus = None session_p = None session = None pbap_object = None transfer_path = None transfer_file = None phone_book = [] cb_done = None def __init__(self, phone, done_cb): self.cb_done = done_cb self.bus = dbus.SessionBus() client = dbus.Interface(self.bus.get_object("org.bluez.obex", "/org/bluez/obex"), "org.bluez.obex.Client1") self.session_p = client.CreateSession(phone, { "Target": "PBAP" }) obj = self.bus.get_object("org.bluez.obex", self.session_p) self.session = dbus.Interface(obj, "org.bluez.obex.Session1") self.pbap_object = dbus.Interface(obj, "org.bluez.obex.PhonebookAccess1") self.bus.add_signal_receiver(self.properties_changed, dbus_interface="org.freedesktop.DBus.Properties", signal_name="PropertiesChanged", path_keyword="path") self.pbap_object.Select("int", "PB") self.get_book() def properties_changed(self, interface, properties, invalidated, path): if self.transfer_file == None: return if "Transferred" in properties: return if properties['Status'] == 'complete': self.transfer_complete(path) return if properties['Status'] == 'error': self.error(path) return def get_book(self): params = dbus.Dictionary({ "Format" : "vcard30", "Fields" : ["PHOTO"] }) self.pbap_object.PullAll("", params, reply_handler=self.register, error_handler=self.error) def register(self, path, properties): self.transfer_path = path self.transfer_file = properties["Filename"] def error(self, err): logging.error("Error while retrieving the Phonebook: %s", err) def transfer_complete(self, path): if self.transfer_file == None: return try: f = open(self.transfer_file, "r") lines = f.readlines() f.close() os.remove(self.transfer_file) self.result_cb(lines) except: pass def result_cb(self, lines): for line in lines: line = line.strip() if line[:3] == "FN:": my_name = line[3:] my_numbers = [] elif line[:4] == "TEL;": my_numbers.append(line[line.find(":") + 1:]) elif line == "END:VCARD" and len(my_numbers) != 0: for i in range(0, len(my_numbers)): my_name_1 = my_name if i != 0: my_name_1 = my_name_1 + " " + str(i) self.phone_book.append([my_name_1, my_numbers[i]]) if self.cb_done: self.cb_done() ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: read phonebook 2016-06-11 18:08 ` Georg Chini @ 2016-06-11 21:54 ` Jason Gauthier 2016-06-12 9:23 ` Marco Trapanese 0 siblings, 1 reply; 8+ messages in thread From: Jason Gauthier @ 2016-06-11 21:54 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 2632 bytes --] I've done some work with this. Here are a few points I've learned about dealing with PBAP. Yes, it definitely requires obexd. Obexd uses dbus, in session mode. This implies that the user that runs obex must access the data in the same session. If you want to run obexd in one shell, and access the information from another shell, or application, you'll want to use the system bus like so: export DBUS_SESSION_BUS_ADDRESS="unix:path=/var/run/dbus/system_bus_socket" You can validate that with "qdbus --system" in another session. If you see orf.bluez.obex that you've connected it to the system dbus. You'll also need to add dbus permissions to access via dbus, or a non-root user won't even be able to start it. to /etc/dbus-1/system.d/bluetooth.conf add: <policy user="user"> <allow own="org.bluez.obex"/> <allow send_destination="org.bluez.obex"/> </policy> oh, also, the files downloaded are in vcard format. I would highly recommend python's vobject module, or similar for ease of managing the data. The device needs to be paired and trusted, but it does not have to be connected to pull PBAP information. I don't think this is important, but I always found it interesting. All of my code written depends on the device currently being connected though. This isn't ofono specific stuff, so if you have any questions you can email me off list. I also have a git repo out there with some pbap handling. I'd like to do more with MAP, and other obex based protocols, but time is limited. Jason On Sat, Jun 11, 2016 at 2:08 PM, Georg Chini <georg@chini.tk> wrote: > On 11.06.2016 18:41, Marco Trapanese wrote: >> >> Hello, >> I have this setup: >> >> - RPi3 >> - Raspbian Jessie Lite >> - bluez 5.40 >> - ofono 1.18 >> >> in /etc/bluetooth/main.conf I set this class: 0x640408. >> Using bluetoothctl I connected my phone to the SBC and I can make a call >> using the ofono tests. >> >> I wonder how to read the contacts. I launched test-phonebook but I got >> this error: >> >>> Method "Import" with signature "" on interface "org.ofono.Phonebook" >>> doesn't exist >> >> >> Do I need to enable something other before? >> Thanks >> Marco > > > Hi Marco, > > see attached python script for how to get the phone book from a bluetooth > device. > I think you need obexd for this, although I am not quite sure because I > programmed > it long ago. > > Regards > Georg > > _______________________________________________ > ofono mailing list > ofono(a)ofono.org > https://lists.ofono.org/mailman/listinfo/ofono > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: read phonebook 2016-06-11 21:54 ` Jason Gauthier @ 2016-06-12 9:23 ` Marco Trapanese 2016-06-12 9:56 ` Georg Chini 0 siblings, 1 reply; 8+ messages in thread From: Marco Trapanese @ 2016-06-12 9:23 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 4127 bytes --] Hello Georg, hello Jason! Thank you both for your interesting answers. As far as I understand obex is now integrated in bluez5: > https://packages.debian.org/jessie/bluez-obexd > http://www.bluez.org/page/7/ (see Release of BlueZ 5.0) > http://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/obex-api.txt Thus my confusion about the test script in ofono! So, if I'm running off-topic, I will move to the bluez mailing-list. Anyway, following the hints of Jason I exported the dbus session address (because I don't use X) and set the dbus policies in bluetooth.conf. I paired and trusted my phone. Running the bluez/test/pbap-client script or the Georg's code leads to: > dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.bluez.obex was not provided by any .service files while the ofono/test/test-phonebook returns: > dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method "Import" with signature "" on interface "org.ofono.Phonebook" doesn't exist Because obex is under org.bluez I don't think I need the obexd-client Debian package, do I? Thanks! Marco -- Il 11/06/2016 23:54, Jason Gauthier ha scritto: > I've done some work with this. Here are a few points I've learned > about dealing with PBAP. > Yes, it definitely requires obexd. Obexd uses dbus, in session mode. > This implies that the user that runs obex must access the data in the > same session. If you want to run obexd in one shell, and access the > information from another shell, or application, you'll want to use the > system bus like so: > > export DBUS_SESSION_BUS_ADDRESS="unix:path=/var/run/dbus/system_bus_socket" > You can validate that with "qdbus --system" in another session. If you > see orf.bluez.obex that you've connected it to the system dbus. > > You'll also need to add dbus permissions to access via dbus, or a > non-root user won't even be able to start it. > > to /etc/dbus-1/system.d/bluetooth.conf > add: > <policy user="user"> > <allow own="org.bluez.obex"/> > <allow send_destination="org.bluez.obex"/> > </policy> > > > oh, also, the files downloaded are in vcard format. I would highly > recommend python's vobject module, or similar for ease of managing the > data. > > The device needs to be paired and trusted, but it does not have to be > connected to pull PBAP information. I don't think this is important, > but I always found it interesting. All of my code written depends on > the device currently being connected though. > > This isn't ofono specific stuff, so if you have any questions you can > email me off list. I also have a git repo out there with some pbap > handling. > > I'd like to do more with MAP, and other obex based protocols, but time > is limited. > > Jason > > On Sat, Jun 11, 2016 at 2:08 PM, Georg Chini <georg@chini.tk> wrote: >> On 11.06.2016 18:41, Marco Trapanese wrote: >>> >>> Hello, >>> I have this setup: >>> >>> - RPi3 >>> - Raspbian Jessie Lite >>> - bluez 5.40 >>> - ofono 1.18 >>> >>> in /etc/bluetooth/main.conf I set this class: 0x640408. >>> Using bluetoothctl I connected my phone to the SBC and I can make a call >>> using the ofono tests. >>> >>> I wonder how to read the contacts. I launched test-phonebook but I got >>> this error: >>> >>>> Method "Import" with signature "" on interface "org.ofono.Phonebook" >>>> doesn't exist >>> >>> >>> Do I need to enable something other before? >>> Thanks >>> Marco >> >> >> Hi Marco, >> >> see attached python script for how to get the phone book from a bluetooth >> device. >> I think you need obexd for this, although I am not quite sure because I >> programmed >> it long ago. >> >> Regards >> Georg >> >> _______________________________________________ >> ofono mailing list >> ofono(a)ofono.org >> https://lists.ofono.org/mailman/listinfo/ofono >> > _______________________________________________ > ofono mailing list > ofono(a)ofono.org > https://lists.ofono.org/mailman/listinfo/ofono > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: read phonebook 2016-06-12 9:23 ` Marco Trapanese @ 2016-06-12 9:56 ` Georg Chini 2016-06-12 9:58 ` Marco Trapanese 0 siblings, 1 reply; 8+ messages in thread From: Georg Chini @ 2016-06-12 9:56 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1291 bytes --] On 12.06.2016 11:23, Marco Trapanese wrote: > > Hello Georg, hello Jason! > Thank you both for your interesting answers. > As far as I understand obex is now integrated in bluez5: > >> https://packages.debian.org/jessie/bluez-obexd > >> http://www.bluez.org/page/7/ > > (see Release of BlueZ 5.0) > >> http://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/obex-api.txt > > > Thus my confusion about the test script in ofono! > So, if I'm running off-topic, I will move to the bluez mailing-list. > > Anyway, following the hints of Jason I exported the dbus session > address (because I don't use X) and set the dbus policies in > bluetooth.conf. I paired and trusted my phone. > > Running the bluez/test/pbap-client script or the Georg's code leads to: > >> dbus.exceptions.DBusException: >> org.freedesktop.DBus.Error.ServiceUnknown: The name org.bluez.obex >> was not provided by any .service files > > while the ofono/test/test-phonebook returns: > >> dbus.exceptions.DBusException: >> org.freedesktop.DBus.Error.UnknownMethod: Method "Import" with >> signature "" on interface "org.ofono.Phonebook" doesn't exist > > Because obex is under org.bluez I don't think I need the obexd-client > Debian package, do I? I have bluez-obexd installed. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: read phonebook 2016-06-12 9:56 ` Georg Chini @ 2016-06-12 9:58 ` Marco Trapanese 2016-06-12 10:03 ` Georg Chini 0 siblings, 1 reply; 8+ messages in thread From: Marco Trapanese @ 2016-06-12 9:58 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 308 bytes --] Il 12/06/2016 11:56, Georg Chini ha scritto: > I have bluez-obexd installed. I'm trying right now but it would be weird because: https://packages.debian.org/en/jessie/bluez-obexd "This was the software that is independent as obexd, but this has been integrated into BlueZ from BlueZ 5.0." ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: read phonebook 2016-06-12 9:58 ` Marco Trapanese @ 2016-06-12 10:03 ` Georg Chini 2016-06-12 10:17 ` Marco Trapanese 0 siblings, 1 reply; 8+ messages in thread From: Georg Chini @ 2016-06-12 10:03 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 584 bytes --] On 12.06.2016 11:58, Marco Trapanese wrote: > Il 12/06/2016 11:56, Georg Chini ha scritto: > >> I have bluez-obexd installed. > > I'm trying right now but it would be weird because: > > https://packages.debian.org/en/jessie/bluez-obexd > > "This was the software that is independent as obexd, but this has been > integrated into BlueZ from BlueZ 5.0." I think it just means that once it was independent and now it is part of bluez but nevertheless is still delivered as an extra package. BTW, I also have obexfs and obexftp installed, not sure if they are needed. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: read phonebook 2016-06-12 10:03 ` Georg Chini @ 2016-06-12 10:17 ` Marco Trapanese 0 siblings, 0 replies; 8+ messages in thread From: Marco Trapanese @ 2016-06-12 10:17 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 367 bytes --] Il 12/06/2016 12:03, Georg Chini ha scritto: > I think it just means that once it was independent and now it is part of > bluez > but nevertheless is still delivered as an extra package. Yeah it works! I apologize, but my understanding of English misled me. I understood that the bluez-obexd package was integrated into bluez5! Thanks a lot! Marco ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-06-12 10:17 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-06-11 16:41 read phonebook Marco Trapanese 2016-06-11 18:08 ` Georg Chini 2016-06-11 21:54 ` Jason Gauthier 2016-06-12 9:23 ` Marco Trapanese 2016-06-12 9:56 ` Georg Chini 2016-06-12 9:58 ` Marco Trapanese 2016-06-12 10:03 ` Georg Chini 2016-06-12 10:17 ` Marco Trapanese
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.