| Home | Trees | Index | Help |
|---|
| Module bluetooth |
|
| Classes | |
|---|---|
BluetoothSocket |
BluetoothSocket |
DeviceDiscoverer |
DeviceDiscoverer |
| Exceptions | |
|---|---|
BluetoothError |
|
| Function Summary | |
|---|---|
Advertises a service with the local SDP server. | |
discover_devices( duration=8, flush_cache=True, lookup_names=False ) -> results availability: GNU/Linux, Windows XP performs a bluetooth device discovery using the first available bluetooth resource. | |
find_service( name = None, uuid = None, address = None ) Searches for SDP services that match the specified criteria and returns the search results. | |
deprecated. | |
is_valid_address(address) -> bool availability: GNU/Linux, Windows XP returns True if address is a valid bluetooth address valid address are always strings of the form XX:XX:XX:XX:XX:XX where X is a hexadecimal character. | |
is_valid_uuid(uuid) -> bool availability: GNU/Linux, Windows XP returns True if uuid is a valid UUID. | |
lookup_name( address, timeout=10 ) -> name | |
set_l2cap_mtu( sock, mtu ) | |
set_packet_timeout( address, timeout ) | |
Instructs the local SDP server to stop advertising the service associated with sock. | |
| Variable Summary | |
|---|---|
str |
ADVANCED_AUDIO_CLASS = '110d'
|
tuple |
ADVANCED_AUDIO_PROFILE = ('110d', 256)
|
str |
AUDIO_SINK_CLASS = '110b'
|
tuple |
AUDIO_SINK_PROFILE = ('110b', 256)
|
str |
AUDIO_SOURCE_CLASS = '110a'
|
tuple |
AUDIO_SOURCE_PROFILE = ('110a', 256)
|
str |
AV_CLASS = '112c'
|
tuple |
AV_PROFILE = ('112c', 256)
|
str |
AV_REMOTE_CLASS = '110e'
|
tuple |
AV_REMOTE_PROFILE = ('110e', 256)
|
str |
AV_REMOTE_TARGET_CLASS = '110c'
|
tuple |
AV_REMOTE_TARGET_PROFILE = ('110c', 256)
|
str |
BASIC_PRINTING_CLASS = '1122'
|
tuple |
BASIC_PRINTING_PROFILE = ('1122', 256)
|
str |
BROWSE_GRP_DESC_CLASS = '1001'
|
tuple |
BROWSE_GRP_DESC_PROFILE = ('1001', 256)
|
str |
CIP_CLASS = '1128'
|
tuple |
CIP_PROFILE = ('1128', 256)
|
str |
CORDLESS_TELEPHONY_CLASS = '1109'
|
tuple |
CORDLESS_TELEPHONY_PROFILE = ('1109', 256)
|
str |
DIALUP_NET_CLASS = '1103'
|
tuple |
DIALUP_NET_PROFILE = ('1103', 256)
|
str |
DIRECT_PRINTING_CLASS = '1118'
|
tuple |
DIRECT_PRINTING_PROFILE = ('1118', 256)
|
str |
DIRECT_PRT_REFOBJS_CLASS = '1120'
|
tuple |
DIRECT_PRT_REFOBJS_PROFILE = ('1120', 256)
|
str |
FAX_CLASS = '1111'
|
tuple |
FAX_PROFILE = ('1111', 256)
|
str |
GENERIC_AUDIO_CLASS = '1203'
|
tuple |
GENERIC_AUDIO_PROFILE = ('1203', 256)
|
str |
GENERIC_FILETRANS_CLASS = '1202'
|
tuple |
GENERIC_FILETRANS_PROFILE = ('1202', 256)
|
str |
GENERIC_NETWORKING_CLASS = '1201'
|
tuple |
GENERIC_NETWORKING_PROFILE = ('1201', 256)
|
str |
GENERIC_TELEPHONY_CLASS = '1204'
|
tuple |
GENERIC_TELEPHONY_PROFILE = ('1204', 256)
|
str |
GN_CLASS = '1117'
|
tuple |
GN_PROFILE = ('1117', 256)
|
str |
HANDSFREE_AGW_CLASS = '111f'
|
tuple |
HANDSFREE_AGW_PROFILE = ('111f', 256)
|
str |
HANDSFREE_CLASS = '111e'
|
tuple |
HANDSFREE_PROFILE = ('111e', 256)
|
str |
HCR_CLASS = '1125'
|
str |
HCR_PRINT_CLASS = '1126'
|
tuple |
HCR_PRINT_PROFILE = ('1126', 256)
|
tuple |
HCR_PROFILE = ('1127', 256)
|
str |
HCR_SCAN_CLASS = '1127'
|
tuple |
HCR_SCAN_PROFILE = ('1127', 256)
|
str |
HEADSET_AGW_CLASS = '1112'
|
tuple |
HEADSET_AGW_PROFILE = ('1112', 256)
|
str |
HEADSET_CLASS = '1108'
|
tuple |
HEADSET_PROFILE = ('1108', 256)
|
str |
HID_CLASS = '1124'
|
tuple |
HID_PROFILE = ('1124', 256)
|
str |
IMAGING_ARCHIVE_CLASS = '111c'
|
tuple |
IMAGING_ARCHIVE_PROFILE = ('111c', 256)
|
str |
IMAGING_CLASS = '111a'
|
tuple |
IMAGING_PROFILE = ('111a', 256)
|
str |
IMAGING_REFOBJS_CLASS = '111d'
|
tuple |
IMAGING_REFOBJS_PROFILE = ('111d', 256)
|
str |
IMAGING_RESPONDER_CLASS = '111b'
|
tuple |
IMAGING_RESPONDER_PROFILE = ('111b', 256)
|
str |
INTERCOM_CLASS = '1110'
|
tuple |
INTERCOM_PROFILE = ('1110', 256)
|
str |
IRMC_SYNC_CLASS = '1104'
|
str |
IRMC_SYNC_CMD_CLASS = '1107'
|
tuple |
IRMC_SYNC_CMD_PROFILE = ('1107', 256)
|
tuple |
IRMC_SYNC_PROFILE = ('1104', 256)
|
int |
L2CAP = 3 |
str |
LAN_ACCESS_CLASS = '1102'
|
tuple |
LAN_ACCESS_PROFILE = ('1102', 256)
|
str |
NAP_CLASS = '1116'
|
tuple |
NAP_PROFILE = ('1116', 256)
|
str |
OBEX_FILETRANS_CLASS = '1106'
|
tuple |
OBEX_FILETRANS_PROFILE = ('1106', 256)
|
str |
OBEX_OBJPUSH_CLASS = '1105'
|
tuple |
OBEX_OBJPUSH_PROFILE = ('1105', 256)
|
str |
PANU_CLASS = '1115'
|
tuple |
PANU_PROFILE = ('1115', 256)
|
str |
PNP_INFO_CLASS = '1200'
|
tuple |
PNP_INFO_PROFILE = ('1200', 256)
|
int |
PORT_ANY = 0 |
str |
PRINTING_STATUS_CLASS = '1123'
|
tuple |
PRINTING_STATUS_PROFILE = ('1123', 256)
|
str |
PUBLIC_BROWSE_GROUP = '1002'
|
str |
REFERENCE_PRINTING_CLASS = '1119'
|
tuple |
REFERENCE_PRINTING_PROFILE = ('1119', 256)
|
str |
REFLECTED_UI_CLASS = '1121'
|
tuple |
REFLECTED_UI_PROFILE = ('1121', 256)
|
int |
RFCOMM = 0 |
str |
SAP_CLASS = '112d'
|
tuple |
SAP_PROFILE = ('112d', 256)
|
str |
SDP_SERVER_CLASS = '1000'
|
tuple |
SDP_SERVER_PROFILE = ('1000', 256)
|
str |
SERIAL_PORT_CLASS = '1101'
|
tuple |
SERIAL_PORT_PROFILE = ('1101', 256)
|
str |
UDI_MT_CLASS = '112a'
|
tuple |
UDI_MT_PROFILE = ('112a', 256)
|
str |
UDI_TA_CLASS = '112b'
|
tuple |
UDI_TA_PROFILE = ('112b', 256)
|
str |
UPNP_CLASS = '1205'
|
str |
UPNP_IP_CLASS = '1206'
|
tuple |
UPNP_IP_PROFILE = ('1206', 256)
|
str |
UPNP_L2CAP_CLASS = '1302'
|
tuple |
UPNP_L2CAP_PROFILE = ('1302', 256)
|
str |
UPNP_LAP_CLASS = '1301'
|
tuple |
UPNP_LAP_PROFILE = ('1301', 256)
|
str |
UPNP_PAN_CLASS = '1300'
|
tuple |
UPNP_PAN_PROFILE = ('1300', 256)
|
tuple |
UPNP_PROFILE = ('1205', 256)
|
str |
VIDEO_CONF_CLASS = '110f'
|
str |
VIDEO_CONF_GW_CLASS = '1129'
|
tuple |
VIDEO_CONF_GW_PROFILE = ('1129', 256)
|
tuple |
VIDEO_CONF_PROFILE = ('110f', 256)
|
str |
VIDEO_SINK_CLASS = '1304'
|
tuple |
VIDEO_SINK_PROFILE = ('1304', 256)
|
str |
VIDEO_SOURCE_CLASS = '1303'
|
tuple |
VIDEO_SOURCE_PROFILE = ('1303', 256)
|
str |
WAP_CLASS = '1113'
|
str |
WAP_CLIENT_CLASS = '1114'
|
tuple |
WAP_CLIENT_PROFILE = ('1114', 256)
|
tuple |
WAP_PROFILE = ('1113', 256)
|
| Function Details |
|---|
advertise_service(sock, name, service_id='', service_classes=[], profiles=[], provider='', description='')
Advertises a service with the local SDP server. sock must be a bound,
listening socket. name should be the name of the service, and service_id
(if specified) should be a string of the form
"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", where each 'X' is a hexadecimal digit.
service_classes is a list of service classes whose this service belongs to.
Each class service is a 16-bit UUID in the form "XXXX", where each 'X' is a
hexadecimal digit, or a 128-bit UUID in the form
"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX". There are some constants for
standard services, e.g. SERIAL_PORT_CLASS that equals to "1101". Some class
constants:
SERIAL_PORT_CLASS LAN_ACCESS_CLASS DIALUP_NET_CLASS
HEADSET_CLASS CORDLESS_TELEPHONY_CLASS AUDIO_SOURCE_CLASS
AUDIO_SINK_CLASS PANU_CLASS NAP_CLASS
GN_CLASS
profiles is a list of service profiles that thie service fulfills. Each
profile is a tuple with ( uuid, version ). Most standard profiles use
standard classes as UUIDs. PyBluez offers a list of standard profiles,
for example SERIAL_PORT_PROFILE. All standard profiles have the same
name as the classes, except that _CLASS suffix is replaced by _PROFILE.
provider is a text string specifying the provider of the service
description is a text string describing the service
A note on working with Symbian smartphones:
bt_discover in Python for Series 60 will only detect service records
with service class SERIAL_PORT_CLASS and profile SERIAL_PORT_PROFILE
|
discover_devices(duration=8, flush_cache=True, lookup_names=False)
discover_devices( duration=8, flush_cache=True, lookup_names=False ) -> results
availability: GNU/Linux, Windows XP
performs a bluetooth device discovery using the first available bluetooth
resource.
if lookup_names is False, returns a list of bluetooth addresses.
if lookup_names is True, returns a list of (address, name) tuples
duration=8
how long, in units of 1.28 seconds, to search for devices. To find as
many devices as possible, you should set this to at least 8.
This parameter only works with GNU/Linux systems
flush_cache=True
if set to False, then discover_devices may return devices found during
previous discoveries.
lookup_names=False
if set to True, then discover_devices also attempts to lookup the
display name of each detected device.
|
find_service(name=None, uuid=None, address=None)
find_service( name = None, uuid = None, address = None )
Searches for SDP services that match the specified criteria and returns
the search results. If no criteria are specified, then returns a list of
all nearby services detected. If more than one is specified, then
the search results will match all the criteria specified. If uuid is
specified, it must be either a 16-bit UUID in the form "XXXX", where each
'X' is a hexadecimal digit, or as a 128-bit UUID in the form
"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX". A special case of address is
"localhost", which will search for services on the local machine.
The search results will be a list of dictionaries. Each dictionary
represents a search match and will have the following key/value pairs:
host - the bluetooth address of the device advertising the
service
name - the name of the service being advertised
description - a description of the service being advertised
provider - the name of the person/organization providing the service
protocol - either 'RFCOMM', 'L2CAP', None if the protocol was not
specified, or 'UNKNOWN' if the protocol was specified but
unrecognized
port - the L2CAP PSM # if the protocol is 'L2CAP', the RFCOMM
channel # if the protocol is 'RFCOMM', or None if it
wasn't specified
service-classes - a list of service class IDs (UUID strings). possibly
empty
profiles - a list of profiles - (UUID, version) pairs - the
service claims to support. possibly empty.
service-id - the Service ID of the service. None if it wasn't set
See the Bluetooth spec for the difference between
Service ID and Service Class ID List
|
get_available_port(protocol)deprecated. bind to port zero instead. |
is_valid_address(address)
is_valid_address(address) -> bool
availability: GNU/Linux, Windows XP
returns True if address is a valid bluetooth address
valid address are always strings of the form XX:XX:XX:XX:XX:XX
where X is a hexadecimal character. For example,
01:23:45:67:89:AB is a valid address, but
IN:VA:LI:DA:DD:RE is not
|
is_valid_uuid(uuid)
is_valid_uuid(uuid) -> bool
availability: GNU/Linux, Windows XP
returns True if uuid is a valid UUID.
valid UUIDs are always strings taking one of the following forms:
XXXX
XXXXXXXX
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
where each X is a hexadecimal digit (case insensitive)
|
lookup_name(address, timeout=10)lookup_name( address, timeout=10 ) -> name availability: GNU/Linux Tries to determine the friendly name (human readable) of the device with the specified bluetooth address. Returns the name on success, and None on failure. timeout=10 how many seconds to search before giving up. |
set_l2cap_mtu(sock, mtu)set_l2cap_mtu( sock, mtu ) availability: GNU/Linux Adjusts the MTU for the specified L2CAP socket. This method needs to be invoked on both sides of the connection for it to work! The default mtu that all L2CAP connections start with is 672 bytes. mtu must be between 48 and 65535, inclusive. |
set_packet_timeout(address, timeout)set_packet_timeout( address, timeout ) Availability: GNU/Linux Adjusts the ACL flush timeout for the ACL connection to the specified device. This means that all L2CAP and RFCOMM data being sent to that device will be dropped if not acknowledged in timeout milliseconds (maximum 1280). A timeout of 0 means to never drop packets. Since this affects all Bluetooth connections to that device, and not just those initiated by this process or PyBluez, a call to this method requires superuser privileges. You must have an active connection to the specified device before invoking this method |
stop_advertising(sock)Instructs the local SDP server to stop advertising the service associated with sock. You should typically call this right before you close sock. |
| Variable Details |
|---|
ADVANCED_AUDIO_CLASS
|
ADVANCED_AUDIO_PROFILE
|
AUDIO_SINK_CLASS
|
AUDIO_SINK_PROFILE
|
AUDIO_SOURCE_CLASS
|
AUDIO_SOURCE_PROFILE
|
AV_CLASS
|
AV_PROFILE
|
AV_REMOTE_CLASS
|
AV_REMOTE_PROFILE
|
AV_REMOTE_TARGET_CLASS
|
AV_REMOTE_TARGET_PROFILE
|
BASIC_PRINTING_CLASS
|
BASIC_PRINTING_PROFILE
|
BROWSE_GRP_DESC_CLASS
|
BROWSE_GRP_DESC_PROFILE
|
CIP_CLASS
|
CIP_PROFILE
|
CORDLESS_TELEPHONY_CLASS
|
CORDLESS_TELEPHONY_PROFILE
|
DIALUP_NET_CLASS
|
DIALUP_NET_PROFILE
|
DIRECT_PRINTING_CLASS
|
DIRECT_PRINTING_PROFILE
|
DIRECT_PRT_REFOBJS_CLASS
|
DIRECT_PRT_REFOBJS_PROFILE
|
FAX_CLASS
|
FAX_PROFILE
|
GENERIC_AUDIO_CLASS
|
GENERIC_AUDIO_PROFILE
|
GENERIC_FILETRANS_CLASS
|
GENERIC_FILETRANS_PROFILE
|
GENERIC_NETWORKING_CLASS
|
GENERIC_NETWORKING_PROFILE
|
GENERIC_TELEPHONY_CLASS
|
GENERIC_TELEPHONY_PROFILE
|
GN_CLASS
|
GN_PROFILE
|
HANDSFREE_AGW_CLASS
|
HANDSFREE_AGW_PROFILE
|
HANDSFREE_CLASS
|
HANDSFREE_PROFILE
|
HCR_CLASS
|
HCR_PRINT_CLASS
|
HCR_PRINT_PROFILE
|
HCR_PROFILE
|
HCR_SCAN_CLASS
|
HCR_SCAN_PROFILE
|
HEADSET_AGW_CLASS
|
HEADSET_AGW_PROFILE
|
HEADSET_CLASS
|
HEADSET_PROFILE
|
HID_CLASS
|
HID_PROFILE
|
IMAGING_ARCHIVE_CLASS
|
IMAGING_ARCHIVE_PROFILE
|
IMAGING_CLASS
|
IMAGING_PROFILE
|
IMAGING_REFOBJS_CLASS
|
IMAGING_REFOBJS_PROFILE
|
IMAGING_RESPONDER_CLASS
|
IMAGING_RESPONDER_PROFILE
|
INTERCOM_CLASS
|
INTERCOM_PROFILE
|
IRMC_SYNC_CLASS
|
IRMC_SYNC_CMD_CLASS
|
IRMC_SYNC_CMD_PROFILE
|
IRMC_SYNC_PROFILE
|
L2CAP
|
LAN_ACCESS_CLASS
|
LAN_ACCESS_PROFILE
|
NAP_CLASS
|
NAP_PROFILE
|
OBEX_FILETRANS_CLASS
|
OBEX_FILETRANS_PROFILE
|
OBEX_OBJPUSH_CLASS
|
OBEX_OBJPUSH_PROFILE
|
PANU_CLASS
|
PANU_PROFILE
|
PNP_INFO_CLASS
|
PNP_INFO_PROFILE
|
PORT_ANY
|
PRINTING_STATUS_CLASS
|
PRINTING_STATUS_PROFILE
|
PUBLIC_BROWSE_GROUP
|
REFERENCE_PRINTING_CLASS
|
REFERENCE_PRINTING_PROFILE
|
REFLECTED_UI_CLASS
|
REFLECTED_UI_PROFILE
|
RFCOMM
|
SAP_CLASS
|
SAP_PROFILE
|
SDP_SERVER_CLASS
|
SDP_SERVER_PROFILE
|
SERIAL_PORT_CLASS
|
SERIAL_PORT_PROFILE
|
UDI_MT_CLASS
|
UDI_MT_PROFILE
|
UDI_TA_CLASS
|
UDI_TA_PROFILE
|
UPNP_CLASS
|
UPNP_IP_CLASS
|
UPNP_IP_PROFILE
|
UPNP_L2CAP_CLASS
|
UPNP_L2CAP_PROFILE
|
UPNP_LAP_CLASS
|
UPNP_LAP_PROFILE
|
UPNP_PAN_CLASS
|
UPNP_PAN_PROFILE
|
UPNP_PROFILE
|
VIDEO_CONF_CLASS
|
VIDEO_CONF_GW_CLASS
|
VIDEO_CONF_GW_PROFILE
|
VIDEO_CONF_PROFILE
|
VIDEO_SINK_CLASS
|
VIDEO_SINK_PROFILE
|
VIDEO_SOURCE_CLASS
|
VIDEO_SOURCE_PROFILE
|
WAP_CLASS
|
WAP_CLIENT_CLASS
|
WAP_CLIENT_PROFILE
|
WAP_PROFILE
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Tue May 9 02:23:39 2006 | http://epydoc.sf.net |