not_use package¶
Submodules¶
not_use.demo1_docstring module¶
A demo, test docsting
not_use.demo2_good_example module¶
A rest good example
-
class
not_use.demo2_good_example.SimpleBleDevice(client, addr=None, addrType='aad', iface=0, data=None, rssi=0, connectable=False, updateCount=0)[源代码]¶ 基类:
objectThis is a conceptual class representation of a simple BLE device (GATT Server). It is essentially an extended combination of the
bluepy.btle.Peripheralandbluepy.btle.ScanEntryclasses- 参数
client (class:simpleble.SimpleBleClient) – A handle to the
simpleble.SimpleBleClientclient object that detected the deviceaddr (str, optional) – Device MAC address, defaults to None
addrType (str, optional) – Device address type - one of ADDR_TYPE_PUBLIC or ADDR_TYPE_RANDOM, defaults to ADDR_TYPE_PUBLIC
iface (int, optional) – Bluetooth interface number (0 = /dev/hci0) used for the connection, defaults to 0
data (list, optional) – A list of tuples (adtype, description, value) containing the AD type code, human-readable description and value for all available advertising data items, defaults to None
rssi (int, optional) – Received Signal Strength Indication for the last received broadcast from the device. This is an integer value measured in dB, where 0 dB is the maximum (theoretical) signal strength, and more negative numbers indicate a weaker signal, defaults to 0
connectable (bool, optional) – True if the device supports connections, and False otherwise (typically used for advertising ‘beacons’)., defaults to False
updateCount (int, optional) – Integer count of the number of advertising packets received from the device so far, defaults to 0
-
__init__(client, addr=None, addrType='aad', iface=0, data=None, rssi=0, connectable=False, updateCount=0)[源代码]¶ Constructor method
-
connect()[源代码]¶ Attempts to initiate a connection with the device.
- 返回
True if connection was successful, False otherwise
- 返回类型
bool
-
getCharacteristics(startHnd=1, endHnd=65535, uuids=None)[源代码]¶ Returns a list containing
bluepy.btle.Characteristicobjects for the peripheral. If no arguments are given, will return all characteristics. If startHnd and/or endHnd are given, the list is restricted to characteristics whose handles are within the given range.- 参数
startHnd (int, optional) – Start index, defaults to 1
endHnd (int, optional) – End index, defaults to 0xFFFF
uuids (list, optional) – a list of UUID strings, defaults to None
- 返回
List of returned
bluepy.btle.Characteristicobjects- 返回类型
list
-
getServices(uuids=None)[源代码]¶ Returns a list of
bluepy.blte.Serviceobjects representing the services offered by the device. This will perform Bluetooth service discovery if this has not already been done; otherwise it will return a cached list of services immediately..- 参数
uuids (list, optional) – A list of string service UUIDs to be discovered, defaults to None
- 返回
A list of the discovered
bluepy.blte.Serviceobjects, which match the provideduuids- 返回类型
list On Python 3.x, this returns a dictionary view object, not a list
-
isConnected()[源代码]¶ Checks to see if device is connected
- 返回
True if connected, False otherwise
- 返回类型
bool
-
setNotificationCallback(callback)[源代码]¶ Set the callback function to be executed when the device sends a notification to the client.
- 参数
callback (function, optional) – A function handle of the form
callback(client, characteristic, data), whereclientis a handle to thesimpleble.SimpleBleClientthat invoked the callback,characteristicis the notifiedbluepy.blte.Characteristicobject and data is a bytearray containing the updated value. Defaults to None
not_use.demo3_partial module¶
demo3
not_use.demo4_immutable_class module¶
create a immutable object
-
class
not_use.demo4_immutable_class.MyImmutable(a, b)[源代码]¶ 基类:
object一个immutable的类 当这个实例初始化之后,禁用掉__setatt__和__delattr__,本实例即成为一个immutable对象 实际上用户当然可以用其它方式来修改这个对象,但是用户会自已负责
实际上这是一个约定,而非强烈的约束
-
class
not_use.demo4_immutable_class.my_immutable(a, b)¶ 基类:
tuple-
__getnewargs__()¶ Return self as a plain tuple. Used by copy and pickle.
-
static
__new__(_cls, a, b)¶ Create new instance of my_immutable(a, b)
-
__repr__()¶ Return a nicely formatted representation string
-
property
a¶ Alias for field number 0
-
property
b¶ Alias for field number 1
-
Module contents¶
一些随手写的东西 并非项目的一部分 用于试验/演示/练习等