2016-01-11 18:38:41

by Travis Griggs

[permalink] [raw]
Subject: example-gatt-server question/clarification

Having played with the example-gatt-server code, I have two basic questions that I need some help/clarification with:

1) I am writing a custom service with a single characteristic. Do *I* need to add any of my own descriptor stuff? Or is the basics handled by the library. The example is ambiguous because the interfaces to the stock attributes (e.g. heart rate, etc), do NOT add any descriptors. But the Test* variants, which are the only custom attributes in the example, does add a descriptor or two. So I’m left wondering is the purpose that these were added because A) you have to add descriptors for your own custom characteristics or B) because the example is demonstrating/testing additional things that you *could* do with additional descriptors.

2) In all WriteValue() implementations found in the code, a self.method() is never invoked. self.state might be adjusted/updated, but never is a method called. Is this just the way it turned out, or are there actual reasons not to do that? I’m finding that a pattern like:

class MySubclass(Characteristic):

def myOwnMethod(self):
print(“Hello World”)

def WriteValue(self, value):
self.myOwnMethod()

seems to stop at the invocation of myOwnMethod. I don’t know if this is a dbus call back issue or something else.

TIA