小编Tim*_*lly的帖子

RFCOMM没有在Debian上使用PyBluez配对?

我正在尝试使用Python创建一个RFCOMM服务器进程,无需配对即可使用.最初,我从PyBluez文档中抓取了两个示例脚本:

服务器:

# file: rfcomm-server.py

# auth: Albert Huang <albert@csail.mit.edu>
# desc: simple demonstration of a server application that uses RFCOMM sockets
#
# $Id: rfcomm-server.py 518 2007-08-10 07:20:07Z albert $

from bluetooth import *

server_sock=BluetoothSocket( RFCOMM )
server_sock.bind(("",PORT_ANY))
server_sock.listen(1)

port = server_sock.getsockname()[1]

uuid = "94f39d29-7d6d-437d-973b-fba39e49d4ee"

advertise_service( server_sock, "SampleServer",
                   service_id = uuid,
                   service_classes = [ uuid, SERIAL_PORT_CLASS ],
                   profiles = [ SERIAL_PORT_PROFILE ], 
#                   protocols = [ OBEX_UUID ] 
                    )

print "Waiting for connection on RFCOMM channel %d" % port …
Run Code Online (Sandbox Code Playgroud)

python bluetooth rfcomm bluez

15
推荐指数
1
解决办法
1万
查看次数

标签 统计

bluetooth ×1

bluez ×1

python ×1

rfcomm ×1