bluetooth GATT questions
Can someone help clear up my understanding of bluetooth services and attributes on Infinitime? I figured out how to set date and time using gatttool, but am confused as to why there are three different characteristics associated with the CurrentTime service, and how I could have found that out from the source code instead of trial and error with gatttool until I found something that looked like a time and date code.

In Infinitime/src/components/ble/CurrentTimeService.h, I can see that ctsId sets the UUID of the CurrentTime service to 0x1805. gatttool tells me this has three characteristics with handles 17, 18, and 19. Handle 19 has the date and time, and gatttool can set time on the watch with char-write-cmd. But what are handles 17 and 18 doing? And where in the source code are these characteristics defined?

I've not been involved in (or even read) the implementation in Infinitime but the spec for the current time service is here ( ) and I note that two of the three specified characteristics are optional.
PineTime: wasp-os and MicroPython, Pinebook Pro:  Debian Bullseye
Thank you, @danielt .

Following a link in the doc you mentioned, I found this list of UUIDs. That must make it easy for companion app (GadgetBridge, etc.) developers if everyone sticks to the standards when declaring their services. Sure enough:
  • UUID 1805 is the Current Time Service, which is defined in CurrentTimeService.h. 
  • UUID 2a2b (handle 19 that I referred to earlier) is the current time characteristic, which is also defined in CurrentTimeService.h
  • UUID 2800 (handle 17) is a service declaration (?), I found a definition for it in one of the nimble headers
  • UUID 2803 (handle 18) is a GATT characteristic declaration (?), I found that also in a nimble header.
So I guess InfiniTime has implemented only one of the three characteristics you mentioned (uuid 2a2b) and the other three are just part of the GATT protocol? I found a book chapter about GATT that I think will clear it up.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Article: Bluetooth Time Sync and LVGL on PineTime Mynewt lupyuen 0 934 10-15-2020, 05:51 PM
Last Post: lupyuen
  Article: Your First Bluetooth Low Energy App with Flutter lupyuen 0 1,347 06-03-2020, 05:44 PM
Last Post: lupyuen
  Firmware Update over Bluetooth LE lupyuen 2 1,566 05-16-2020, 02:17 AM
Last Post: lupyuen

Forum Jump:

Users browsing this thread: 1 Guest(s)