def __init__(self, on_write_request): options = { 'uuid': "6E400002-B5A3-F393-E0A9-E50E24DCCA9E", 'properties': ['notify', 'writeWithoutResponse'], 'descriptors': [Descriptor({ 'uuid': '02', 'value': 'Write data' })], 'onWriteRequest': on_write_request, } self.update_value_callback = None super().__init__(options)
def __init__(self, on_read_notify, on_read_request): options = { 'uuid': "6E400003-B5A3-F393-E0A9-E50E24DCCA9E", 'properties': ['notify', 'read'], 'descriptors': [Descriptor({ 'uuid': '03', 'value': 'Read data' })], 'onNotify': on_read_notify, 'onReadRequest': on_read_request, 'onSubscribe': self.onSubscribe, 'onUnsubscribe': self.onUnsubscribe, } super().__init__(options)
def __init__(self, uuid): Characteristic.__init__( self, { 'uuid': uuid, 'properties': ['read', 'write', 'notify'], 'value': None, 'descriptors': [ Descriptor({ 'uuid': '2901', 'value': 'Descriptor' }), Descriptor({ 'uuid': '2902', 'value': 'String 2902' }) ] }) print('jbBMSCharacteristic __init__', uuid) self._uuid = uuid self._value = array.array('B', [0] * 0) self._updateValueCallback = None self._maxValueSize = 20
def __init__(self, uuid, description): super().__init__({ 'uuid': uuid, 'properties': ['read', 'notify'], 'value': None, # needs to be None because characteristic is not constant value 'descriptors': [Descriptor({ 'uuid': '2901', 'value': description })] }) self._updateValueCallback = None self._value = 99 # initial value only
def __init__(self, uuid, description): self._value = [] self._updateValueCallback = None super().__init__({ 'uuid': uuid, 'properties': ['read', 'notify'], 'value': None, 'descriptors': [ Descriptor({ 'uuid': '2901', 'value': description }), ] })
def __init__(self, uuid, min_length, max_length, description, callback): self._callbackFn = callback self._minLength = min_length self._maxLength = max_length super().__init__({ 'uuid': uuid, 'properties': ['write'], 'value': None, 'descriptors': [ Descriptor({ 'uuid': '2901', 'value': description }), ] })