void strap_init() { // Create the attribute, and allocate a buffer for its data attribute = smartstrap_attribute_create(SMARTSTRAP_RAW_DATA_SERVICE_ID, SMARTSTRAP_RAW_DATA_ATTRIBUTE_ID, STRAP_BUFFER_SIZE); smartstrap_subscribe((SmartstrapHandlers) { .availability_did_change = strap_availability_handler, .did_read = strap_read_handler });
window_set_click_config_provider(window, click_config_provider); window_set_window_handlers(window, (WindowHandlers) { .load = window_load, .unload = window_unload, }); const bool animated = true; window_stack_push(window, animated); // setup smartstrap SmartstrapHandlers handlers = (SmartstrapHandlers) { .availability_did_change = prv_availability_changed, .did_read = prv_did_read, .notified = prv_notified }; smartstrap_subscribe(handlers); led_attribute = smartstrap_attribute_create(SERVICE_ID, LED_ATTRIBUTE_ID, LED_ATTRIBUTE_LENGTH); uptime_attribute = smartstrap_attribute_create(SERVICE_ID, UPTIME_ATTRIBUTE_ID, UPTIME_ATTRIBUTE_LENGTH); } static void deinit(void) { window_destroy(window); smartstrap_attribute_destroy(led_attribute); smartstrap_attribute_destroy(uptime_attribute); } int main(void) { init(); app_event_loop(); deinit(); }