{"id":11,"date":"2004-12-28T23:37:48","date_gmt":"2004-12-29T04:37:48","guid":{"rendered":"http:\/\/crschmidt.net\/blog\/?p=11"},"modified":"2004-12-28T23:37:48","modified_gmt":"2004-12-29T04:37:48","slug":"bluetooth-console","status":"publish","type":"post","link":"https:\/\/crschmidt.net\/blog\/archives\/11\/bluetooth-console\/","title":{"rendered":"Bluetooth Console"},"content":{"rendered":"<p>One of the nifties things I have on my cell phone is a bluetooth capability: the ability to communicate with other devices nearby at relatively high speeds over a wireless protocol. Bluetooth is a very useful tool for development: I don&#8217;t have to worry about USB cables or anything else, and I can talk equally well to my Linux desktop with an abicom BT adapter as I can to my Powerbook with its built-in bluetooth.<\/p>\n<p>One thing that no one has mentioned yet about the new Python release is the Bluetooth console. It took some doing, but I finally got it connected to my Linux desktop, and found an app that will let me connect to the port. Now, I basically have a way to tell my phone what to do over Bluetooth:<\/p>\n<pre>[crschmidt@peanut ~]$ sudo cu -l \/dev\/rfcomm0 \nConnected.\nPython 2.2.2 (#0, Dec  2 2004, 18:12:32) \n[GCC 2.9-psion-98r2 (Symbian build 540)] on symbian_s60\nType 'copyright', 'credits' or 'license' for more information.\nType 'commands' to see the commands available in this simple line editor.\n>>> <\/pre>\n<p>This has sped up my application development significantly: with this in place, I can start to experiment with different code at a rapid rate: without sending almost identical files to the phone several dozen times to test them, nor typing on the 3650&#8217;s keypad to enter my code. I just type into a normal tty, and it acts exactly like a local python interpreter.<\/p>\n<p>This is also possible, and documented as such, using TCP\/IP over GPRS instead of Bluetooth. However, the speed restrictions of that cause it to be much less practical. It&#8217;s like typing into ssh over bluetooth: sure, it&#8217;s okay, but you almost never want to do it if you can avoid it.<\/p>\n<p>Here&#8217;s what I ended up doing to get it working:<br \/>\n  &#8211; Get a working bluez install. Bluez is the standard Linux protocol stack, and is built in to most recent kernels.<br \/>\n  &#8211; Test that you can talk to the phone, using hcitool scan, hcitool info.<br \/>\n  &#8211; Register an &#8220;SP&#8221; (serial port) service with sdpd. <tt>sdptool add --channel=3 SP<\/tt><br \/>\n  &#8211; Ensure that sdpd is running<br \/>\n  &#8211; Set up an rfcomm port to receive the communications: <tt>rfcomm listen \/dev\/rfcomm0 3<\/tt><br \/>\n  &#8211; (On Phone) Open Python, then bt_console.py<br \/>\n  &#8211; On the computer, you should see:<\/p>\n<pre>[crschmidt@peanut ~]$ sudo rfcomm listen \/dev\/rfcomm0  3\nWaiting for connection on channel 3\nConnection from 00:60:57:41:86:C2 to \/dev\/rfcomm0\nPress CTRL-C for hangup<\/pre>\n<p>  &#8211; Using taylor-uucp, type cu -l \/dev\/rfcomm0<br \/>\n  &#8211; Welcome to the phone!<\/p>\n<p>If you want to test to make sure it&#8217;s working, you can do something simple like:<\/p>\n<pre>import appuifw\nappuifw.note(u'Howdy!', 'info')<\/pre>\n<p>from there, refer to the excellent Nokia documentation for more tips and tricks on what you can do. I think this is definitely a great example of what power the distribution has, and I&#8217;m surprised that more people haven&#8217;t been writing about it. Has anyone besides me (and Nokia employees) gotten this working?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the nifties things I have on my cell phone is a bluetooth capability: the ability to communicate with other devices nearby at relatively high speeds over a wireless protocol. Bluetooth is a very useful tool for development: I don&#8217;t have to worry about USB cables or anything else, and I can talk equally [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,10],"tags":[],"class_list":["post-11","post","type-post","status-publish","format-standard","hentry","category-bluetooth","category-symbian-python"],"_links":{"self":[{"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/comments?post=11"}],"version-history":[{"count":0,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"wp:attachment":[{"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}