Now ANCS is implemented in Espruino, most of the work is done internally and it's just the bit I highlighed you need. It'll need modifying to use Apple's time service UUID, as well as a few other changes.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
It may be possible to use the JS ANCS code from @jeffmer as a base.
https://github.com/espruino/BangleApps/blob/3e0d263ceaa7f3dd3bdec29fd95822e52f913aba/apps/widancs/ancs.js#L106
Now ANCS is implemented in Espruino, most of the work is done internally and it's just the bit I highlighed you need. It'll need modifying to use Apple's time service UUID, as well as a few other changes.
It's going to be a decent size job though.