scientific linux下 用Python for S60的Bluetooth Console编写手机程序

本文详细介绍如何在Scientific Linux下通过蓝牙建立与手机的串口连接。包括安装Putty、配置蓝牙设备、创建串口服务及监听连接等步骤。

参考文章:http://www.handaoliang.com/article_63.html

                   http://sidrit.wordpress.com/2009/01/23/ubuntu-serial-port-bluetooth-console-nokia-e61i-python/

 

首先,再scientific linux下安装Putty.

如果在编译的时候,出现错误,试着修改Makefile文件。去掉 -Werror选项。

 

 

First we need to know if the BT dongle is up and running. Open a shell window and type:


hcitool dev

 

If everything is running properly, the output should be something similar to this:
sid@dev:~$ hcitool dev
Devices:
hci0 00:02:72:XX:XX:XX

The next two steps are quite a logical following :


1. Create a serial port on the pc


sdptool add --channel=3 SP

that should output:
Serial Port service registered

 

2. Start listening for connections on that port:


rfcomm listen rfcomm0 3

that should output:
Waiting for connection on channel 3

 

Now on the phone, enable bluetooth, start up the python shell the choose:
Options -> Bluetooth console and select from the devices list the BT device of the computer

Done this, on the phone screen’s python shell you should see something similar:


Connecting to ('00:02:72:XX:XX:XX', 3)... OK.
telling that the connection with our device succeeded.

Meanwhile on the command line, where we are listening for connections on the serial port 3, the output should be:

 

rfcomm listen rfcomm0 3
Waiting for connection on channel 3
Connection from 00:17:E5:XX:XX:XX to /dev/rfcomm0
Press CTRL-C for hangup

 

If you’ve gotten this far with these results, we’re all good and we have one more step left.

 

由于貌似scientific linux下没有 cu 命令,所以要用Putty来解决

 

 

首先,connect type选择Serial,然后在Serial line中填入地址,Save一下,然后Open,就可以连接到手机Python控制台了。

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值