prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
// Keep track of which children we added so we can restore them in case of error bool used_children[array_len]; memset(used_children, 0, sizeof(bool) * array_len); // Set the parent on each of the components uint32_t child_idx = 0; for (uint32_t i = 0; i < array_len; i++) { AnimationPrivate *componen...
applib_type_malloc(AnimationPrivate)
; } if (!clone) { return NULL; } clone_h = animation_private_animation_init(clone); } // Copy the values into the clone clone->implementation = from->implementation; clone->handlers = from->handlers; clone->context = from->context; clone->delay_ms = from->delay_ms; clone->duration_m...
ervices = 0; static PebbleMutex *s_services_lock; void smartstrap_state_init(void) { s_state_lock = mutex_create(); s_services_lock = mutex_create(); s_max_services = smartstrap_profiles_get_max_services(); s_connected_services = kernel_zalloc_check(s_max_services * sizeof(uint16_t)); } static void prv_asser...
PBL_ASSERTN(s_num_connected_services < s_max_services)
; s_connected_services[s_num_connected_services++] = service_id; } else if (!prv_remove_connected_service(service_id)) { // we weren't previously connected return; } PBL_LOG(LOG_LEVEL_INFO, "Connection state for service (0x%x) changed to %d", service_id, connected); PebbleEvent event = { ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ if (!ctx->sle_buffer) { return false; } if (ctx->zeros_remaining) { *out = 0; --ctx->zeros_remaining; return true; } uint8_t byte = *(ctx->sle_buffer++); if (byte != ctx->escape) { *out = byte; } else { byte = *(ctx->sle_buffer++); if (byte == 0x00) { // end of stream ...
nstall_release_md(context->app_md); // Clear the old app metadata context->app_md = 0; context->install_id = INSTALL_ID_INVALID; if (context->to_process_event_queue && pdFAIL == event_queue_cleanup_and_reset(context->to_process_event_queue)) { PBL_LOG(LOG_LEVEL_ERROR, "The to processs queue could no...
(prv_get_context()->to_process_event_queue, event, portMAX_DELAY)
; } // ------------------------------------------------------------------------------------------- DEFINE_SYSCALL(AppLaunchReason, sys_process_get_launch_reason, void) { return prv_get_context()->launch_reason; } // ------------------------------------------------------------------------------------------- DEFINE_S...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
( layout_ref, (layout->state == GameStatePreGame ? &s_time_until_config.text.extent.node : &s_term_config.text.extent.node))
; } static void prv_game_line_node_callback(GContext *ctx, const GRect *box, const GTextNodeDrawConfig *config, bool render, GSize *size_out, void *user_data) { const SportsLayout *layout = user_data; const int16_t offset_top = (layout...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return system_theme_get_font(TextStyleFont_MenuCellTitle); }
//! Only used on round displays to achieve a fish-eye effect static GFont prv_get_unfocused_item_font(void) { return system_theme_get_font(TextStyleFont_Header); } static uint16_t prv_get_num_rows(MenuLayer *menu_layer, uint16_t section_index, void *callback_context) { ActionMenu...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_weather_app_layout__render_heavy_snow_rain_snow(void) { const WeatherLocationForecast forecast = { .location_name = "PALO ALTO", .current_temp = -88, .today_high = -88, .today_low = -88, .current_weather_type = WeatherType_HeavySnow, .current_weather_phrase = "Heavy Snow", ....
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
watchface_init()
; timeline_peek_init(); #if CAPABILITY_HAS_HEALTH_TRACKING // Start activity tracking if enabled if (activity_prefs_tracking_is_enabled()) { activity_start_tracking(false /*test_mode*/); } #endif } void shell_event_loop_handle_event(PebbleEvent *e) { switch (e->type) { case PEBBLE_APP_FETCH_REQUEST_E...
nk control responses before we try to reconnect #define MAX_STRIKES 3 //! How often we'll go without some valid data from the smartstrap before sending a status message //! and disconnecting if the smartstrap doesn't reply. This is in seconds. #define STATUS_CHECK_INTERVAL 5 //! The mi...
PBL_LOG(LOG_LEVEL_DEBUG, "Got link control status: Disconnect")
; smartstrap_link_control_disconnect(); } else { PBL_LOG(LOG_LEVEL_WARNING, "Got link control status: INVALID (%d)", status); smartstrap_link_control_disconnect(); success = false; } } else if (header->type == LinkControlTypeProfiles) { // profiles message if ((data_length % si...
, GRect(4, -40, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } void draw_text_single_line_ellipsis_clip_outside_y(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, 40, 72, 32)...
(ctx, &GRect(39, 39, 82, 42))
; } void test_graphics_draw_text_${BIT_DEPTH_NAME}__clipping(void) { GContext ctx; Layer canvas; Layer layer; prv_setup_resources(); uint32_t gothic_24_handle = RESOURCE_ID_GOTHIC_24_BOLD; cl_assert(text_resources_init_font(0, gothic_24_handle, 0, &s_font_info)); test_graphics_context_init(&ctx, fb); ...
0, 100, 200); // x, y, width, height to_r = GRect(1000, 2000, 100, 200); // x, y, width, height prop_h = property_animation_create_layer_frame(&layer, &from_r, &to_r); Animation *h = property_animation_get_animation(prop_h); void *context = &layer; animation_set_handlers(h, handlers, context); animatio...
(layer.frame.origin, to_r.origin)
; #endif } // -------------------------------------------------------------------------------------- // Test that auto-destroy works correctly void test_animation__auto_destroy(void) { #ifdef TEST_INCLUDE_BASIC PropertyAnimation *prop_h; Layer layer; GRect from_r; GRect to_r; const int duration = 100; c...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
snprintf(buffer + pos, buffer_size - pos, " %"PRId32, daily_avg)
; } else { snprintf(buffer + pos, buffer_size - pos, " "EN_DASH); } } Window *health_activity_detail_card_create(HealthData *health_data) { HealthActivityDetailCardData *card_data = app_zalloc_check(sizeof(HealthActivityDetailCardData)); card_data->daily_avg = health_data_steps_get_monthly_average(health_...
nizerManagerState_RecognizersActive); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible); ...
(manager.state, RecognizerManagerState_WaitForTouchdown)
; // The app's recognizer's gesture completes immediately. Only the app's recognizer sees the touch // events. All recognizers in the chain are reset e.type = TouchEvent_Touchdown; s_next_state = RecognizerState_Completed; s_idx_to_change = 4; recognizer_manager_handle_touch_event(&e, &manager); prv_comp...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
hc_protocol_enqueue_with_payload(HcEndpointID_Logging, HcMessageID_Logging_SetLevel, &level, sizeof(level))
; } bool hc_endpoint_logging_get_level(uint8_t *level) { HcProtocolMessage request = { .message_length = sizeof(request), .endpoint_id = HcEndpointID_Logging, .command_id = HcMessageID_Logging_GetLevel, }; HcProtocolMessage *response = hc_protocol_enqueue_and_expect(&request); if (!response) { ...
n.origin.y -= BOUNCEBACK_OFFSET; Animation *animation = property_animation_get_animation( property_animation_create(&s_frame_layer_implementation, layer, &origin, &target)); animation_set_duration(animation, 4 * ANIMATION_FRAME_MS); animation_set_curve(animation, AnimationCurveEaseOut); return animation; ...
(complete)
; } static void prv_update_icon(Animation *animation, bool finished, void *context) { MusicAppData *data = app_state_get_user_data(); GBitmap *bitmap = context; bitmap_layer_set_bitmap(&data->cassette_layer, bitmap); data->cassette_layer.layer.bounds.origin.y = 0; } static void prv_trigger_cassette_icon_switc...
s.background, option_menu->status_colors.foreground); } void option_menu_set_normal_colors(OptionMenu *option_menu, GColor background, GColor foreground) { option_menu->normal_colors.background = background; option_menu->normal_colors.foreground = foreground; menu_layer_set_normal_c...
status_bar_layer_deinit(&option_menu->status_layer)
; window_deinit(&option_menu->window); gbitmap_deinit(&option_menu->chosen_image); gbitmap_deinit(&option_menu->not_chosen_image); } OptionMenu *option_menu_create(void) { OptionMenu *option_menu = applib_type_malloc(OptionMenu); if (!option_menu) { return NULL; } option_menu_init(option_menu); re...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ uint8_t fd; }
close; struct PACKED ReadCommand { uint8_t fd; uint32_t address; uint32_t length; } read; struct PACKED WriteCommand { uint8_t fd; uint32_t address; uint8_t data[0]; } write; struct PACKED CRCCommand { uint8_t fd; uint32_t address; uint32_t leng...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME pbl_29350 //> TEST_VERSION 3 //> TEST_TOTAL -1 //> TEST_TOTAL_MIN -1 //> TEST_TOTAL_MAX -1 //> TEST_DEEP -1 //> TEST_DEEP_MIN -1 //> TEST_DEEP_MAX -1 //> TEST_START_AT -1 //> TEST_START_AT_MIN -1 //> TEST_START_A...
{ 0, 0x63, 4898, 146, 0}, { 0, 0x64, 2473, 140, 0}, { 0, 0x74, 2351, 151, 0}, { 0, 0x72, 1490, 144, 0}, { 0, 0x64, 239, 142, 0}, { 0, 0x64, 547, 150, 0}, { 0, 0x52, 519, 145, 0}, // 30: Local time: 2015-11-12 08:57:00 PM { 0, 0x62, 211, 143, 0}, { 0, 0x72, 908, 143, 0}, { 13...
to stop advertising before we can start a new job: PBL_LOG(GAP_LE_ADVERT_LOG_LEVEL, "Disable last Ad job"); bt_driver_advert_advertising_disable(); s_is_advertising = false; analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BLE_ESTIMATED_BYTES_ADVERTISED_COUNT); } } if (next) { // S...
if (terms[i].min_interval_slots < min_threshold || terms[i].max_interval_slots < terms[i].min_interval_slots) { return NULL; }
} // Create the job data structure: GAPLEAdvertisingJob *job = kernel_malloc_check(sizeof(GAPLEAdvertisingJob) + payload->ad_data_length + payload->scan_resp_data_length); *job = (const GAPLEAdvertisingJob) { .unschedul...
averages; health_db_get_typical_step_averages(i, &averages); int idx = i * 10; uint16_t val_expected = ((uint16_t *)entries[i].val)[idx]; cl_assert_equal_i(averages.average[idx], val_expected); } } void test_health_db__monthly_averages(void) { int32_t val_out; const char *average_step_key = "a...
cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_old_movement_data, sizeof(s_old_movement_data)), S_SUCCESS)
; cl_assert_equal_i(s_metric_updated_count, 0); s_metric_updated_count = 0; key = "monday_sleepData"; cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_old_sleep_data, sizeof(s_old_sleep_data)), S_SUCCESS); cl_assert_equal_i(...
.transform_index = prv_reverse_index, }, &menu_layer); uint16_t num_apps = app_menu_data_source_get_count(&data_source); cl_assert_equal_i(num_apps, ARRAY_LENGTH(app_default_order)); for (uint16_t i = 0; i < num_apps; i++) { AppMenuNode *node = app_menu_data_source_get_node_at_index(&data_source, i); ...
ARRAY_LENGTH(app_order)
h" #include "services/common/comm_session/protocol.h" #include "util/net.h" #include "util/size.h" #include "FreeRTOS.h" #include "semphr.h" #include "clar.h" extern SendBuffer * comm_session_send_buffer_create(bool is_system); extern void comm_session_send_buffer_destroy(SendBuffer *sb); extern SemaphoreHandle_t c...
comm_session_send_buffer_end_write(write_sb)
; // Set a yield callback that gives the semph in time but does not clear out the send buffer: SemaphoreHandle_t write_semph = comm_session_send_buffer_write_semaphore(); fake_queue_set_yield_callback(write_semph, prv_receive_but_no_bytes_freed_yield_cb); // Try to begin writing again, requesting only one byt...
.num_variants = 5, .variants = { i18n_noop("Workin' up a sweat?"), i18n_noop("Well done 💪"), i18n_noop("Endorphin rush?"), i18n_noop("Can't stop, won't stop 👊"), i18n_noop("Keepin' that heart healthy! ❤"), }, }; return prv_get_variant...
(headings, headings_buf_size, i18n_get("Steps", headings), headings_buf_size)
; string_list_add_string(values, values_buf_size, step_str, values_buf_size); } static void prv_add_active_calories_metric_info(StringList *headings, int headings_buf_size, StringList *values, int values_buf_size, Activit...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(item_layer)
.h; if (max_scroll > 0) { int16_t first_scroll = prv_get_first_scroll_offset(item_layer); return MAX(first_scroll, max_scroll); } else { return MAX(max_scroll, 0); } } static void prv_scroll_offset_setter(TimelineItemLayer *item_layer, int16_t value) { item_layer->scroll_offset_pixels = value; la...
ig, bool animated) { TimelineItem *item = NULL; const time_t now = rtc_get_time(); const time_t timestamp = config ? (config->timestamp ?: now) : now; if (config) { AttributeList list; attribute_list_init_list(3 /* num_attributes */, &list); attribute_list_add_cstring(&list, AttributeIdTitle, config...
(s_dest_bitmap, TEST_PBI_FILE)
); } void test_timeline_peek__peek_title_only_concurrent_2(void) { prv_render_timeline_peek(&(TimelinePeekItemConfig) { .title = "OMG I think the text fits!", .icon = TIMELINE_RESOURCE_GENERIC_WARNING, .num_concurrent = 2, }); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_timel...
11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16}}, {{0x21, 0x22, 0x23, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x11, 0x12, 0x13, 0x24, 0x25, 0x26}}, }; SM128BitKey keys_out[2]; bt_persistent_storage_set_root_keys(keys); bt_persistent_storage_get_root_key(0, &keys_out[0])...
(id_4, NULL, NULL, NULL)
; cl_assert(!ret); } // Test to make sure we don't accidentally change the serialized data formats. void test_bluetooth_persistent_storage__ble_serialized_data(void) { #if UNITTEST_BT_PERSISTENT_STORAGE_VERSION == 1 //0000 01 00 69 50 68 6f 6e 65 20 4d 61 72 74 79 00 00 ..iPhone Marty.. //0010 00 00 00 00...
static void prv_indirect_write(QSPIPort *dev, uint8_t instruction, uint32_t addr, const void *buffer, uint32_t length) { if (length) { PBL_ASSERTN(buffer); prv_set_num_data_bytes(length); } else { PBL_ASSERTN(!buffer); } prv_set_ddr_enabled(false); uint32_t modes_b...
QSPI_MemoryMappedMode_SetTimeout(10)
text_flow__draw_text_doom(void) { // text and configuration we see in text_flow demo app cl_assert(text_resources_init_font(0, RESOURCE_ID_GOTHIC_24_BOLD, 0, &s_font_info)); TextLayoutExtended layout = { .flow_data = { .perimeter.impl = &(GPerimeter){.callback = prv_perimeter_for_display_round}, ....
(&ctx, text, font, box, overflow_mode, ...
; // We should get different heights because the orphan avoidance algorithm adds an extra line cl_assert_equal_i(size_with_orphan_avoidance.h, 279); cl_assert_equal_i(size_without_orphan_avoidance.h, 255); } void test_graphics_draw_text_flow__no_infinite_loop(void) { TextLayoutExtended layout = { .flow_da...
ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r1_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11);...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 3)
; graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx...
IM4 | RCC_APB1Periph_TIM5 | RCC_APB1Periph_TIM6 | RCC_APB1Periph_TIM7 | RCC_APB1Periph_TIM12 | RCC_APB1Periph_TIM13 | RCC_APB1Periph_TIM14 | RCC_APB1Periph_WWDG | RCC_APB1Periph_SPI2 | RCC_APB1Periph_SPI3 | RCC_APB1Periph_USART2 | RCC_APB1Periph_USART3 | RCC_APB1Periph_UART4 | RCC_APB1Periph_UART5 |...
if (!watchdog_check_reset_flag() && !boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { // We're good, we're just starting normally. PBL_LOG_VERBOSE("We're good, we're just starting normally."); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); ...
// We failed to start our firmware successfully! if (watchdog_check_reset_flag()) { dbgserial_putstr("Watchdog caused a reset"); } if (boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { dbgserial_putstr("Software failure caused a reset"); } // Clean up after the last failure. boot_bit_clear(B...
xt_layout_get_max_used_size(ctx, no_activities_string, font, box, overflow, alignment, NULL); // We want to position the text in the center of the cell veritically, // we divide the height of the cell by two and subtract half of the text size. // H...
option_menu_set_status_colors(&data->option_menu, GColorWhite, GColorBlack)
if (rv != S_SUCCESS) { return 0; }
if (!settings_file_exists(&file, app_id, key_len)) { char buffer[key_len + 1]; strncpy(buffer, (const char *)app_id, key_len); buffer[key_len] = '\0'; PBL_LOG(LOG_LEVEL_DEBUG, "No prefs found for <%s>", buffer); prv_file_close_and_unlock(&file); return NULL; } SerializedNotifPrefs *seri...
NLINE to reduce the stack requirements during the minute handler (see PBL-38130) static void NOINLINE prv_set_file_minute_record_entry(AlgMinuteFileRecord *file_record, AlgMinuteDLSSample *data, uint16_t sample_idx, time_t sample_...
prv_init_minute_record(&dls_record->hdr, sample_utc, false /*to_file*/)
; } // Put in this minute dls_record->samples[sample_idx] = *data; dls_record->hdr.num_samples = sample_idx + 1; if (was_sleeping && (dls_record->samples[sample_idx].base.steps != 0)) { // Subtract from our total steps since we decided we were definitely sleeping during // this minute PBL_LOG(LOG...
_kind, &added_pin_uuid); cl_assert(uuid_equal(&added_pin_uuid, &s_last_timeline_item_added->header.id)); AttributeList *pin_attr_list = &s_last_timeline_item_added->attr_list; const uint32_t pin_icon_tiny = attribute_get_uint32(pin_attr_list, AttributeIdIconTiny, 0); cl_assert_equal_i((int)pin_icon_tiny, TIME...
cl_assert_equal_i(s_num_timeline_removes, 6)
void prv_advance_to_ms_with_timers(uint64_t dst_time) { uint64_t now = prv_now_ms(); while (now < dst_time) { TimerID sys_timer_id = animation_service_test_get_timer_id(); if (!sys_timer_id) { DPRINTF("timer not created\n"); prv_advance_by_ms_no_timers(dst_time - now); return; } ...
if (entry) { return (uint32_t)entry->context; } else { return 0; }
} // ============================================================================================= // Handlers // -------------------------------------------------------------------------------------- // Started handler static void prv_started_handler(Animation *animation, void *context) { prv_add_handler_entry(&...
, 0), 0); graphics_draw_vertical_line_dotted(&ctx, GPoint(7, 0), 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(9, 0), 2); graphics_draw_vertical_line_dotted(&ctx, GPoint(11, 0), 3); graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 0), 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(15, 0), 20); ...
graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 0), 4)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(15, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(17, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(19, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(23...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25663_5 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { -256, -368, -968}, { ...
{ -376, 656, -728}, { -400, 680, -632}, { -360, 752, -664}, { -368, 720, -728}, { -392, 672, -816}, { -480, 456, -712}, { -456, 400, -712}, { -400, 184, -888}, { -352, -64, -848}, { -184, -32, -1000}, { -160, -104, -1168}, { -160, -64, -1088}, { -144, -144, -1032}, ...
youtIdGeneric, &pin_attr_list, &action_group); item->header.from_watch = true; item->header.parent_id = (Uuid)UUID_REMINDERS_DATA_SOURCE; timeline_add(item); // Tweak the item before adding t...
(data->reminder_str)
; } const size_t reminder_str_len = strlen(e->dictation.text); data->reminder_str = app_zalloc_check(reminder_str_len + 1 /* \0 */); strcpy(data->reminder_str, e->dictation.text); data->reminder_str[reminder_str_len] = '\0'; data->timestamp = e->dictation.timestamp; if (data->timestamp == 0...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
((xLightMutexGetHolder(mutex) == xTaskGetCurrentTaskHandle()) == is_held, lr)
ual_i(windows[3][0]->is_click_configured, false); cl_assert_equal_i(windows[2][1]->on_screen, false); cl_assert_equal_i(windows[2][1]->is_click_configured, false); cl_assert_equal_p(s_last_click_configured_window, windows[3][0]); // Add priority 1 opaque window 0 cl_assert(NumModalPriorities > 1); window_s...
window_create()
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ 22, 0x42, 7516, 175, 0}, { 0, 0x41, 676, 159, 0}, { 48, 0x34, 3292, 150, 0}, { 101, 0x24, 4735, 171, 0}, { 0, 0x75, 6674, 145, 0}, { 0, 0x67, 1833, 145, 0}, { 0, 0x68, 1126, 148, 0}, { 0, 0x68, 208, 144, 0}, { 0, 0x68, 1096, 144, 0}, { 0, 0x66, 2257, 161, 0}, { 0, 0x54, 602...
{ 0, 0x55, 0, 180, 0}, { 0, 0x55, 0, 180, 0}, { 0, 0x55, 0, 180, 0}, { 0, 0x55, 0, 175, 0}, { 0, 0x55, 0, 150, 0}, { 0, 0x61, 1046, 144, 0}, { 0, 0x61, 0, 144, 0}, { 0, 0x61, 0, 144, 0}, { 0, 0x60, 926, 140, 0}, // 90: Local time: 2016-03-01 09:35:00 PM { 0, 0x6f, 340, 145, ...
an absolute address. // TODO: refactor the PebbleProcessMd stuff so that metadata that // isn't needed before load or can't be fully resolved until then // is left out of PebbleProcessMdCommon. common->main_func = (void *)(uintptr_t)info->offset; } void process_metadata_init_with_flash_header(PebbleProcessMd...
PBL_PLATFORM_SWITCH(PBL_PLATFORM_TYPE_CURRENT, /* aplite */ PlatformTypeAplite, // unreachable, since we don't build for Tintin anymore /* basalt */ PlatformTypeBasalt, /* chalk */ PlatformTypeChalk, /* diorite */ PlatformTypeAplite, // there's was no Diorite SDK prior to 4.0 ...
; } // 4.0 <= SDK < 4.2 if (version_compare(app_sdk_version, first_4_2_version) < 0) { return PBL_PLATFORM_SWITCH(PBL_PLATFORM_TYPE_CURRENT, /* aplite */ PlatformTypeAplite, // unreachable, since we don't build for Tintin anymore /* basalt */ PlatformTypeBasalt, /* chalk */ Platfor...
------------------------------------------------------- static void prv_debug_cmd_sleep_sessions(int index, void *context) { ActivityDemoAppData *data = context; // Allocate space for the sessions. Usually, there will only be about 4 or 5 sessions // (1 container and a handful of restful periods). Allocating spa...
(data->debug_card.dialog_text, prefix, sizeof(data->debug_card.dialog_text))
; // Write start time struct tm local_tm; char temp[64]; localtime_r(&session->start_utc, &local_tm); strftime(temp, sizeof(temp), "%H:%M", &local_tm); safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text)); // Write length snprintf(temp, sizeof(temp), " ...
fill_rect_${BIT_DEPTH_NAME}__origin_corners(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Currently prv_fill_rect only supports up to radius 8, fix in PBL-15916 to support // arbitrary radius values - this affects all tests here setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RE...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_right.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerTopLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_topleft.${BIT_DEPTH_NAME}.pbi")); setup_test...
L_FLASH #include "flash_test.h" #include "applib/app.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/simple_menu_layer.h" #include "applib/ui/text_layer.h" #include "applib/ui/window.h" #include "applib/ui/window_stack.h" #include "mfg/mfg_apps/mfg_flash_test.h" #include "process_state/app_state/app_...
{ text_layer_set_text(msg_text_layer, "Select To Confirm Switch"); }
else { text_layer_set_text(msg_text_layer, "Press Select To Start"); } text_layer_set_text_alignment(msg_text_layer, GTextAlignmentCenter); text_layer_set_background_color(msg_text_layer, GColorBlack); text_layer_set_text_color(msg_text_layer, GColorWhite); text_layer_set_font(msg_text_layer, fonts_get...
er.h" #include "graphics_private.h" #include "graphics_private_raw.h" #include "gtransform.h" #include "applib/app_logging.h" #include "applib/applib_malloc.auto.h" #include "kernel/ui/kernel_ui.h" #include "process_management/process_manager.h" #include "process_state/app_state/app_state.h" #include "system/passert.h...
PBL_ASSERTN(clipped_rect.origin.y < bitmap->bounds.size.h)
; PBL_ASSERTN(clipped_rect.origin.y >= 0); const uint16_t y = clipped_rect.origin.y; const uint16_t x_end = x + width; graphics_private_draw_horizontal_line_integral(ctx, &ctx->dest_bitmap, y, x, x_end, fill_color); } } //! Return the maximum rounded corner radius allowed for a given rectangle size ...
0, 0xc5, 0x00, /* bytes 784 - 800 */ 0x48, 0x00, 0xc6, 0x00, 0x48, 0x00, 0xc7, 0x00, 0x48, 0x00, 0xc8, 0x00, 0x48, 0x00, 0xc9, 0x00, /* bytes 800 - 816 */ 0x48, 0x00, 0xca, 0x00, 0x48, 0x00, 0xcb, 0x00, 0x48, 0x00, 0xcc, 0x00, 0x48, 0x00, 0xcd, 0x00, /* bytes 816 - 832 */ 0x48, 0x00, 0xce, 0x00, 0x48, 0x00, 0xcf,...
aligned (8)
)) static const uint8_t ACTION_BAR_ICON_UP_builtin_bytes[] = { 0x03, 0x00, 0x06, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x00, 0x18, 0x00, 0x00, /* bytes 0 - 16 */ 0xbc, 0x00, 0x02, 0xff, 0x00, 0x0b, 0xff, 0x40, 0x0f, 0xff, 0xd0, 0x1f, 0xff, 0xf4, 0x7f, 0xff, /* bytes 16 - 32 */ 0xfd, 0x00, 0xbf, 0x...
{ // If the device did not exchange an IRK, we have been given the devices identity address and // this is how we will associate our connection with the device in the future. Therefore, mark // is_remote_identity_info_valid as true but leave the irk 0'ed out to indicate it is unused PBL_LOG(LOG_...
info->is_mitm_protection_enabled = dev->mitm; bonding.is_gateway = connection_is_gateway(connection); if (connection_should_pin_address(connection)) { bonding.should_pin_address = true; connection_get_local_address(connection, &bonding.pinned_address); } BleBondingFlag flags = 0; ...
/ 1000); } void test_calendar_handle__ongoing_event_added_and_removed(void) { rtc_set_time(15 * 60); timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert_equal_i(timer_id, TIMER_INVALID_ID); cl...
(!stub_new_timer_is_scheduled(timer_id))
on) {.start_utc = now + (5 * SECONDS_PER_MINUTE), .length_min = 5}, HealthIterationDirectionPast)); // a ends later cl_assert(0 > prv_session_compare( &(ActivitySession) {.start_utc = now, .length_min = 10}, &(ActivitySession) {.start_utc = now + (2 * SECONDS_PER_MINUTE), .length_min = 5}, HealthIt...
(data, ARRAY_LENGTH(data), &time_start, &time_end)
; cl_assert_equal_i(1, s_sys_activity_get_minute_history_values.in[0].num_records); // respects time_end == time_start => 0 records s_sys_activity_get_minute_history_values.stage = 0; time_start = time_on_boundary; time_end = time_start; health_service_get_minute_history(data, ARRAY_LENGTH(data), &time_sta...
// page translations to be cached let's do that now if ((op_flags & OP_FLAG_USE_PAGE_CACHE) != 0) { allocate_page_cache(res); } // check to see if we should update the gc block prv_update_gc_reserved_region(); } mutex_unlock_recursive(s_pfs_mutex); return (res); } static int pfs_open...
(space_needed, true)
; GCData gcdata = { .version = 0, // Version 0 for now, bump if we change .flags = 0xff, .gc_start_page = sector_start_page, .num_entries = num_entries, .page_mask = sectors_active }; // write out the GCData to the file pfs_write(fd, &gcdata, sizeof(gcdata)); // copy all the data we need...
time_t time_end, HealthAggregation agg, HealthServiceTimeScope scope) { const time_t now_utc = sys_get_time(); switch (metric) { case HealthMetricStepCount: case HealthMetricActiveSeconds: case HealthMetricWalkedDistanceMeters: c...
(&now_utc)
; // Compute weekly, weekday, and daily stats *stats = (HealthServiceMetricStats) {}; const StatsBasicOp op = (StatsBasicOp_Sum | StatsBasicOp_Average | StatsBasicOp_Count | StatsBasicOp_Min | StatsBasicOp_Max); stats_calculate_basic(op, daily_totals.totals, ARRAY_LENGTH(daily_totals.totals), ...
alized_buffer[serialized_size], attr_list_out); other = attribute_get_uint32_list(&attr_list_out, AttributeIdMetricIcons); for (int i = 0; i < metric_values->num_values; i++) { cl_assert_equal_i(metric_values->values[i], other->values[i]); } } static void prv_check_attribute_list...
attribute_get_string(&list, AttributeIdTitle, "")
, "Title1"); cl_assert_equal_i(list.num_attributes, 2); attribute_list_add_cstring(&list, AttributeIdTitle, "Title2"); cl_assert_equal_s(attribute_get_string(&list, AttributeIdTitle, ""), "Title2"); cl_assert_equal_s(attribute_get_string(&list, AttributeIdSubtitle, ""), "Subtitle"); cl_assert_equal_i(list.nu...
ORM_ROBERT || PLATFORM_CALCULUS const int32_t info_text_y_offset = 36; #else const int32_t info_text_y_offset = PBL_IF_RECT_ELSE(10, 12); #endif KinoLayer *kino_layer = &data->kino_layer; kino_layer_init(kino_layer, &window->layer.bounds); layer_add_child(&window->layer, &kino_layer->layer); #if PLATFORM_RO...
{ BTPairingUIData *data = window_get_user_data(window); if (data) { kino_layer_deinit(&data->kino_layer); text_layer_deinit(&data->info_text_layer); text_layer_deinit(&data->device_name_text_layer); text_layer_deinit(&data->code_text_layer); gbitmap_destroy(data->approve_bitmap); gbitmap_des...
static void prv_show_failure_kernel_main_cb(void *unused) { prv_handle_pairing_complete(false /* success */); } static void prv_pairing_timeout_timer_callback(void *unused) { PBL_LOG(LOG_LEVEL_WARNING, "SSP timeout fired!"); launcher_task_add_callback(prv_show_failure_kernel_main_cb, NULL); } static void prv_...
O_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 5); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
_Static_assert((CORE_ID_BLE & PACKED_CORE_MASK) == CORE_ID_BLE, "Core number invalid")
; #define str(s) xstr(s) #define xstr(s) #s #define MAX_MSG_LEN (128) #define MAX_MSG_STR_LEN (MAX_MSG_LEN - sizeof(BinLogMessage_Param_v1) - (9 * sizeof(uint32_t))) #define MAX_MSG_STR_LEN_HALF (MAX_MSG_STR_LEN / 2) // Gives us ~13ms of message flush latency. #define LOG_BUFFER_SIZE (MAX_MSG_LEN * 3) #define MEMBE...
true); cl_assert_equal_i(window2->on_screen, false); modal_window_push(window1, base_priority - 2, false); modal_manager_event_loop_upkeep(); cl_assert_equal_i(window1->on_screen, false); cl_assert_equal_i(window2->on_screen, true); window_stack_remove(window2, false); modal_manager_event_loop_upkeep...
(PebbleTask_App)
; window_stack_push(app_stack, window1, true); cl_assert_equal_i(window_stack_count(app_stack), 1); cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_p(s_last_click_configured_window, window1); // Switch to the kernel to push a modal window stub_pebble_tasks_set_current(PebbleTask_KernelMain);...
ssert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_...
(spawn, delay_spawn)
; animation_set_play_count(spawn, play_count_spawn); // Check durations cl_assert_equal_i(animation_get_duration(a, false, false), duration_a); cl_assert_equal_i(animation_get_duration(a, false, true), play_count_a * duration_a); cl_assert_equal_i(animation_get_duration(a, true, false), delay_a + duration_a...
ntext, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); setup_test(&context, false, 2, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20...
(&context)
; graphics_context_set_text_color(&context, GColorRed); cl_assert(memcmp(&draw_state, &context.draw_state, sizeof(GDrawState)) == 0); // Antialiased draw_state = graphics_context_get_drawing_state(&context); graphics_context_set_antialiased(&context, true); cl_assert(memcmp(&draw_state, &context.draw_state...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ TimerID timer = stub_new_timer_get_next(); if (timer == TIMER_INVALID_ID) { return false; } stub_new_timer_fire(stub_new_timer_get_next()); bool callback_fired = s_launcher_callback_added; s_launcher_callback_added = false; return callback_fired; }
// defined in display_calibration_prompt.c bool prv_is_known_misaligned_serial_number(const char *serial); // Tests ////////////////////// void test_display_calibration_prompt__initialize(void) { s_should_prompt_display_calibration = true; s_mfg_offset = GPointZero; s_user_offset = GPointZero; s_launcher_ca...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
EXECUTE_SCRIPT("var size = _rocky.userPreferences.contentSize")
; ASSERT_JS_GLOBAL_EQUALS_S("size", "large"); } void test_rocky_api_preferences__extra_large(void) { s_preferred_content_size = PreferredContentSizeExtraLarge; rocky_global_init(s_preferences_api); EXECUTE_SCRIPT("var size = _rocky.userPreferences.contentSize"); ASSERT_JS_GLOBAL_EQUALS_S("size", "x-large");...
ow->layout == WorkoutLayout_StaticAndScrollable; prv_render_metric(ctx, metric_type, layer, bg_color, draw_zones, prefer_larger_font); if (layer == &active_window->top_metric_layer) { status_bar_layer_set_colors(&active_window->status_layer, bg_color, GColorBlack); } if (active_window->layout == WorkoutL...
{ prv_handle_pause_button(active_window); }
e Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is...
prv_support_sms_replies()
; ANCSAttribute *notif_attributes[NUM_FETCHED_NOTIF_ATTRIBUTES] = {0}; ANCSAttribute *app_attrs[NUM_FETCHED_APP_ATTRIBUTES] = {0}; const size_t header_len = sizeof(GetNotificationAttributesMsg); bool error = false; const bool complete = ancs_util_get_attr_ptrs(s_sms_ancs_data + header_len, ...
ognizerRef recognizer, void *data) { NotificationWindowData *window_data = data; TimelineItem *item = prv_get_current_notification(window_data); if (!prv_should_provide_action_menu_for_item(window_data, item)) { return; } LayoutLayer *layout = swap_layer_get_current_layout(&window_data->swap_layer); c...
layer_deinit(&data->dnd_icon_layer)
; window_deinit(window); i18n_free_all(data); s_in_use = false; } ////////////////////// // Callback Handlers ////////////////////// static void prv_layout_did_appear_handler(SwapLayer *swap_layer, LayoutLayer *layout, int8_t rel_change, void *context) { Notificatio...
clicks_counted >= prv_multi_click_get_min(recognizer)) && (recognizer->number_of_clicks_counted <= prv_multi_click_get_max(recognizer))) { const bool needs_reset = true; prv_dispatch_event(recognizer, ClickHandlerOffsetMulti, needs_reset); } else { prv_click_pattern_done(recognizer); } } void com...
if (should_fire_multi_click_handler) { if ((recognizer->number_of_clicks_counted >= prv_multi_click_get_min(recognizer)) && (recognizer->number_of_clicks_counted <= prv_multi_click_get_max(recognizer))) { reset_using_event = (false == local_can_more_clicks_follow); prv_dispatch_event(rec...
if (prv_can_more_clicks_follow(recognizer)) { const uint32_t timeout = prv_multi_click_get_timeout(recognizer); recognizer->multi_click_timer = app_timer_register( timeout, prv_multi_click_timeout_callback, recognizer); return; } else { if (reset_using_event) { return...
00); pfs_init(false); pfs_format(false); cron_service_init(); alarm_init(); alarm_service_enable_alarms(true); } void test_alarm_smart__cleanup(void) { cron_service_deinit(); } //////////////////////////////////////////////////////////////////////////////////////////////////// //! Smart alarms #define ...
stub_new_timer_invoke(1)
; if (i < num_checks - 1) { // Smart alarm non-trigger checks cl_assert_equal_i(s_num_alarms_fired, 1); cl_assert_equal_i(s_num_alarm_events_put, 0); } } // Smart alarm trigger checks cl_assert_equal_i(s_num_alarms_fired, 1); cl_assert_equal_i(s_num_alarm_events_put, 1); cl_assert_e...
_scs_assert(slave); } static void prv_spi_release_helper(const SPISlavePort *slave) { spi_ll_slave_scs_deassert(slave); spi_ll_slave_release(slave); } uint8_t spi_slave_read_write(const SPISlavePort *slave, uint8_t out) { prv_spi_acquire_helper(slave); uint8_t ret = spi_ll_slave_read_write(slave, out); prv_...
(slave->slave_state->scs_selected)
de event happened // Enable RXNE interrupt for writing bus->i2c->CR2 |= I2C_CR2_ITBUFEN; bus->transfer.state = TRANSFER_STATE_READ_DATA; break; case TRANSFER_STATE_READ_DATA: bus->transfer.data[bus->transfer.idx] = bus->i2c->DR; bus->transfer.idx++; if (bus->transfer.idx...
{ // Intentionally ignore the s_running_count and make it so! // This is intended for low level electrical test only if(!strcmp("on", arg)) { bus_rail_power_up(1); } else { bus_rail_power_down(1); } }
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4 }; static CommSession *s_fake_app_comm_session = (CommSession *) 0xaabbccdd; static bool s_is_connected; static bool s_is_app_message_receiver_open; static Uuid s_app_uuid; static Uuid s_remote_app_uuid; static bool s_app_receiver_oom; // Utils ////////////////////////...
memcpy(&message->payload->push.dictionary, s_expected_buffer, dict_length)
; PBL_LOG(LOG_LEVEL_DEBUG, "message->transaction_id = %"PRIu32, message->transaction_id); CommSession *session = s_fake_app_comm_session; app_message_app_protocol_msg_callback(session, buffer, message_length, NULL); } static void prv_receive_ack_nack_callback(uint16_t endpoint_id, const uint8_t* data, un...
, { 936, 152, -152}, { 1104, 328, -256}, { 1016, 488, -280}, { 1392, 672, -144}, { 1512, 648, -24}, { 832, 624, 192}, { 1288, 632, -112}, { 928, 504, 24}, { 896, 656, -72}, { 1168, 688, 88}, { 1496, 520, 248}, { 1400, 352, 160}, // 35 seconds { 1320, 224, 144}, ...
{ 984, 328, -168}, { 976, 336, -160}, { 1176, 376, -88}, { 1304, 416, -40}, { 984, 496, -32}, { 1312, 576, -104}, { 1304, 752, -272}, { 1088, 528, -176}, { 1240, 544, 48}, { 1536, 424, 128}, { 1360, 192, 88}, { 1136, 96, 40}, { 1024, 72, 80}, { 1008, 120, 48}, ...
b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); #endif } // ------------------------------------------------------------...
(a, b, NULL)
; cl_assert(seq != NULL); animation_set_play_count(seq, play_count_seq); // Check the duration cl_assert_equal_i(animation_get_duration(seq, true, true), 0); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); // Start prv_advance_to_ms_with_timers(start_ms +...
#include <inttypes.h> #include <stdint.h> #include <stdio.h> //! Evaluates to 1 iff execution will use the process stack when returning from //! the exception. #define RETURNS_TO_PSP(exc_return) ((exc_return & 0x4) == 0x4) //! This symbol and its contents are provided by the linker script, see the //! .note.gnu.bu...
(buffer_ptr, start_addr, buffer_size)
; } else { flash_read_bytes(buffer_ptr, start_addr, buffer_size); } } // ------------------------------------------------------------------------------------------------- // NOTE: We are explicitly avoiding use of vsniprintf and cohorts to reduce our stack // requirements static void prv_debug_str(const char* ...
00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, .timestamp = 100 * SECONDS_PER_MINUTE, .duration = 5, .type = TimelineItemTypePin, .all_day = false, .layout = LayoutIdCalendar, }, .attr_list = { .num_attributes = 1, .attributes = &title_attr, }, }; // not...
fake_event_init()
se. */ #include "spinner_ui_window.h" #include "applib/graphics/gpath_builder.h" #include "applib/graphics/graphics.h" #include "util/trig.h" #include "applib/ui/animation.h" #include "applib/ui/layer.h" #include "applib/ui/property_animation.h" #include "applib/ui/bitmap_layer.h" #include "kernel/pbl_malloc.h" #inc...
{ data->cur_distance_normalized = 0; animation_schedule(property_animation_get_animation(data->spinner_animation)); }
} //////////////////////////////////////////////////////////// // Window loading, unloading, initializing static void prv_window_unload_handler(Window* window) { SpinnerUIData *data = window_get_user_data(window); if (data) { gbitmap_destroy(data->bitmap); data->should_cancel_animation = true; proper...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
rocky_get_or_create_object(all_listeners, event_name, rocky_creator_empty_array, NULL, NULL)
; } // callback while iterating over listeners // @param event_listeners the array this listener is part of // @param idx position within the array at which the listener exists // @param listener the JS function that's registered as listener // @param data pointer provided when calling prv_iterate_event_listeners() //...
t)((float)2 * (1 << FIXED_S32_16_PRECISION)) }; num2 = (Fixed_S32_16){ .raw_value = (int32_t)((float)3 * (1 << FIXED_S32_16_PRECISION)) }; mul = Fixed_S32_16_mul(num1, num2); mul_c = (Fixed_S32_16){ .raw_value = (int32_t)((float)6 * (1 << FIXED_S32_16_PRECISION)) }; cl_assert(mul.raw_value == mul_c.raw_value); ...
(mul.raw_value != mul_c.raw_value)
{ -424, 608, 24}, { -432, 528, 72}, { -496, 616, 72}, { -544, 760, 16}, // 42 seconds { -656, 728, 64}, { -728, 792, 48}, { -824, 784, 8}, { -880, 872, 0}, { -768, 648, -8}, { -584, 744, -96}, { -656, 712, -96}, { -688, 744, -112}, { -528, 528, 24}, { -384, 4...
{ -672, 1096, 144}, { -576, 1024, 112}, { -512, 952, 64}, { -360, 616, 256}, { -216, 616, 64}, { -208, 600, 80}, { -272, 656, 120}, { -288, 632, 152}, { -328, 736, 128}, { -368, 856, 112}, { -504, 920, 144}, { -424, 880, 136}, { -624, 1104, 16}, // 48 seconds ...
{ -424, 1032, 112}, { -392, 1024, 88}, { -496, 1072, 64}, { -528, 960, 40}, { -416, 1040, 80}, { -400, 1008, 16}, { -360, 912, -16}, { -248, 664, 56}, { -184, 672, -48}, { -136, 560, 24}, { -152, 704, 24}, { -192, 744, -40}, { -232, 680, 24}, { -184, 808, 24}, ...
tton, ResourceId resource, GBitmap *storage) { if (resource == RESOURCE_ID_INVALID) { action_bar_layer_clear_icon(&s_phone_ui_data->action_bar, button); return; } gbitmap_deinit(storage); gbitmap_init_with_resource_system(storage, SYSTEM_APP, resource); action_bar_layer_set_icon(&s_phone_ui_data->act...
{ s_phone_ui_data->down_action = prv_decline_click_handler; down_icon = RESOURCE_ID_ACTION_BAR_ICON_X; }
prv_set_action_bar_icon(BUTTON_ID_UP, up_icon, &s_phone_ui_data->up_bitmap); prv_set_action_bar_icon(BUTTON_ID_SELECT, select_icon, &s_phone_ui_data->select_bitmap); prv_set_action_bar_icon(BUTTON_ID_DOWN, down_icon, &s_phone_ui_data->down_bitmap); } else { prv_hide_action_bar(); } action_bar_l...
ailMenuItemIndexNum * sizeof(ActionMenuItem)); if (!level) return NULL; *level = (ActionMenuLevel) { .num_items = DetailMenuItemIndexNum, .parent_level = NULL, .display_mode = ActionMenuLevelDisplayModeWide, }; return level; } static ActionMenuLevel *prv_create_snooze_menu(ActionMenuLevel *parent_l...
if (current_snooze_delay == snooze_delays[i]) { snooze_level->default_selected_item = i; }
} app_action_menu_open(&data->menu_config); }
eq(buf,sz,fmt,a,b) _snprintf_s(buf,sz,_TRUNCATE,fmt,a,b) # else # define snprint_eq snprintf # endif typedef struct _stat STAT_T; #else # ifdef UNITTEST_DEBUG # include <signal.h> # endif # include <sys/wait.h> /* waitpid(2) */ # include <unistd.h> # define _MAIN_CC # define snprint_eq snprintf typedef struct s...
if (_clar.report_errors_only) clar_report_errors(); else clar_print_ontest( test->name, _clar.test_count, (_clar.suite_errors > error_st) );
} static void clar_run_suite(const struct clar_suite *suite) { const struct clar_func *test = suite->tests; size_t i; if (!clar_category_is_suite_enabled(suite)) return; if (_clar.exit_on_error && _clar.total_errors) return; if (!_clar.report_errors_only) clar_print_onsuite(suite->name, suite...
* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distribut...
(app_data->window, animated)
; APP_LOG(APP_LOG_LEVEL_DEBUG, "Done initializing, pushed window: %p", app_data->window); } static void deinit(AppData *app_data) { dictation_session_destroy(app_data->session); window_destroy(app_data->window); } int main(void) { AppData *app_data = calloc(1, sizeof(AppData)); init(app_data); app_event...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(sizeof(AppMenuOrderStorage) + list_length * sizeof(AppInstallId))
; if (!storage) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to malloc stored order install_id list"); goto cleanup; } // read in entire list into array const int read_size = list_length * sizeof(AppInstallId); int rd_sz; if ((rd_sz = pfs_read(fd, (uint8_t *)storage->id_list, read_size)) != read_size) { ...
time and snooze s_smart_snooze_counter++; prv_snooze_alarm(SMART_ALARM_SNOOZE_DELAY_S); return; } } if (trigger) { prv_put_alarm_event(); // Alarm events are triggered for both the initial alarm time and subsequent user snoozes // Ensure that we only record the first alarm time ...
(file, &key, sizeof(key))
; return false; } *config_out = (AlarmConfig) { .hour = config.hour, .minute = config.minute, .is_disabled = config.is_disabled, .kind = config.kind, .is_smart = config.is_smart, }; memcpy(&config_out->scheduled_days, config.scheduled_days, sizeof(config.scheduled_da...
{ const uint32_t addr = TEST_ADDR + offset; flash_write_bytes(buffer, addr, BUFFER_SIZE); }
// read it back for (uint32_t offset = 0; offset < TEST_LENGTH; offset += BUFFER_SIZE) { memset(buffer, 0, BUFFER_SIZE); const uint32_t addr = TEST_ADDR + offset; flash_read_bytes(buffer, addr, BUFFER_SIZE); for (uint32_t i = 0; i < BUFFER_SIZE; i++) { if (buffer[i] != i) { char err_...
l_i(regular_timer_seconds_count(), 0); free(ad); } void test_gap_le_advert__job_round_robin(void) { GAPLEAdvertisingJobTerm advert_term = { .min_interval_slots = 160, .max_interval_slots = 320, .duration_secs = GAPLE_ADVERTISING_DURATION_INFINITE, }; // Schedule infinite job "A": BLEAdData *ad_...
assert_ad_data("B")
; regular_timer_fire_seconds(1); assert_ad_data("D"); } // "D" should be done now, so expect only infinite jobs to get air-time again: for (int i = 0; i < 10; ++i) { regular_timer_fire_seconds(1); assert_ad_data("E"); regular_timer_fire_seconds(1); assert_ad_data("A"); regular_timer_f...
zer_transition_state(r, RecognizerState_Possible)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Started)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Updated)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Cancelled)); cl_assert_passert(recognizer_t...
(r->state, RecognizerState_Possible)
{ -152, 912, 128}, { -160, 920, 136}, { -160, 920, 136}, { -160, 912, 136}, { -160, 920, 136}, { -160, 920, 136}, { -152, 912, 128}, { -152, 920, 136}, // 160 seconds { -160, 920, 136}, { -160, 912, 128}, { -160, 920, 128}, { -160, 920, 144}, { -152, 920, 128}, { ...
{ -168, 912, 144}, { -160, 912, 136}, { -160, 912, 144}, { -160, 920, 152}, { -160, 920, 136}, { -168, 920, 136}, { -168, 904, 144}, { -160, 904, 152}, { -168, 904, 152}, { -168, 912, 160}, { -176, 912, 168}, { -168, 912, 160}, { -168, 912, 160}, { -160, 920, 160}...
{ -168, 912, 176}, { -160, 904, 184}, { -160, 904, 184}, { -160, 904, 176}, { -160, 912, 176}, { -168, 904, 184}, { -168, 912, 176}, { -160, 904, 176}, { -160, 912, 176}, { -160, 904, 176}, { -160, 904, 176}, { -160, 904, 176}, { -160, 904, 176}, { -160, 912, 184...
t_background_color(dialog, GColorLightGray); dialog_set_icon(dialog, data->resource_id_25); dialog_show_status_bar_layer(dialog, true); expandable_dialog_set_select_action(expandable_dialog, RESOURCE_ID_ACTION_BAR_ICON_CHECK, prv_my_select_click_handler); app_expandable_dialog_push(expandable_dialog); } ...
simple_dialog_create("Simple Dialog")
; Dialog *dialog = simple_dialog_get_dialog(simple_dialog); dialog_set_text(dialog, "Pop!"); dialog_set_background_color(dialog, GColorRed); dialog_set_icon(dialog, data->resource_id_80); dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT); app_simple_dialog_push(simple_dialog); } static void prv_show_tran...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
kernel_free(config)
; if (s_comm_is_running) { bt_local_addr_init(); bt_persistent_storage_register_existing_ble_bondings(); gap_le_init(); bt_local_id_configure_driver(); #if CAPABILITY_HAS_BUILTIN_HRM ble_hrm_init(); #endif bt_pairability_init(); analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BT_OFF_TIME...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
analytics_set(ANALYTICS_APP_METRIC_FLASH_READ_BYTES_COUNT, s_analytics_read_bytes_count, AnalyticsClient_Worker)
; analytics_set(ANALYTICS_APP_METRIC_FLASH_WRITE_BYTES_COUNT, s_analytics_write_bytes_count, AnalyticsClient_Worker); } s_analytics_read_count = 0; s_analytics_read_bytes_count = 0; s_analytics_write_bytes_count = 0; } //! Assumes that s_flash_lock is held. static status_t prv_try_restar...
files will be written on then flash. We could also try to force apps to // be flushed out of the FS in an attempt to free up space since they are // only being cached on the FS pfs_format(true); } // get us off to a good start by ensuring there is some pre-erased space on // the filesystem. We do a l...
if (write_erase_headers == 1) { pfs_format(true /* write erase headers */); } else { pfs_format(false /* write erase headers */); }
} void pfs_command_dump_hdr(const char *page) { uint16_t pg = (uint16_t) atoi(page); if (pg > s_pfs_page_count) { prompt_send_response("ERROR"); return; } uint8_t hdr[FILE_NAME_OFFSET + 10]; prv_flash_read((uint8_t *)&hdr, sizeof(hdr), prv_page_to_flash_offset(pg)); PBL_HEXDUMP_D_SERIAL(LOG_LEVE...
, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_PSW, 0x0); REG_SETF(DCDC, DCDC_TEST_1_REG, DCDC_COMP_CLK, 0x0); REG_SETF(DCDC, DCDC_TEST_1_REG, DCDC_TEST_CURRENT, 0x0); REG_SETF(DCDC, DCDC_TEST_1_REG, DCDC_TEST_REG, 0x0); REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_BROWN_OUT_IRQ_CLEAR, 0x0); REG_SETF(DCDC,...
(QSPIC, QSPIC_DUMMYDATA_REG, QSPIC_DUMMYDATA, 0x0)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(animated)
; } data->warning_dialog = weather_app_warning_dialog_push(localized_text, prv_warning_dialog_dismiss_cb); } static void prv_handle_weather(PebbleEvent *unused_event, void *unused_context) { // Unschedule any ongoing animations that would try to touch the ...
(serialized_glance)
; } cleanup: // Destroy the attributes of each of the attribute lists in attr_lists for (unsigned int i = 0; i < glance->num_slices; i++) { attribute_list_destroy_list(&attr_lists[i].attr_list); } kernel_free(attr_lists); return rv; } ////////////////////////////////// // Serialized Slice Validation /...
rtc_get_time(); PBL_LOG(LOG_LEVEL_DEBUG, "test start time: %d", (int)now_utc); const time_t midnight_utc = time_util_get_midnight_of(now_utc); const time_t nap_time_start = midnight_utc + (ALG_PRIMARY_MORNING_MINUTE * SECONDS_PER_MINUTE); const time_t nap_time_end = midnight_utc + (ALG_PRIMARY_EVENING_MINUTE *...
activity_prefs_sleep_insights_set_enabled(prev_insights_enabled); prv_test_end(context, passed); }
font_cache->cache_data, sizeof(LineCacheData), LINE_CACHE_SIZE); graphics_context_set_default_drawing_state(context, init_mode); } void graphics_context_set_default_drawing_state(GContext *ctx, GContextInitializationMode init_mode) { PBL_ASSE...
PBL_ASSERTN(ctx)
; return ctx->lock; } GBitmap* graphics_capture_frame_buffer_format(GContext *ctx, GBitmapFormat format) { PBL_ASSERTN(ctx); if (ctx->lock) { APP_LOG(APP_LOG_LEVEL_WARNING, "Frame buffer has already been captured; it cannot be captured again until " "graphics_release_frame_buffer has ...
et_metric_value = workout_data_get_metric_value, .get_distance_string = health_util_get_distance_string, }; typedef struct SportsData { int32_t current_bpm; char *duration_string; char *distance_string; char *pace_string; char *custom_label_string; char *custom_value_string; } SportsData; static SportsD...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_workout_active__workout_render_walk(void) { s_workout_data = (WorkoutData) { .steps = 567, .duration_s = 84, .distance_m = 1234, .avg_pace = health_util_get_pace(84, 1234), .bpm = 71, .hr_zone = 0, }; WorkoutActiveWindow *active_window = workout_active_create_for_activity_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
UuidMakeFromBEBytes(uuid_bytes)
s_app_uuid = app_manager_get_current_app_md()->uuid; char uuid_str[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&s_app_uuid, uuid_str); PBL_LOG(LOG_LEVEL_INFO, "Starting app-initiated voice dictation session for app %s", uuid_str); } #if !defined(TARGET_QEMU) // TODO: replace stub #endif // TODO:...
(LOG_LEVEL_WARNING, "Received session setup result for app initiated session when it " "was not expected")
; } else { PBL_LOG(LOG_LEVEL_WARNING, "Received session setup result for non-app session when an app " "session result was expected"); } prv_send_event(VoiceEventTypeSessionSetup, VoiceStatusErrorGeneric, NULL); goto done; } has_error = false; done: if (has_error) { new_t...
lDriverSample *data) { const int a_begin = 0; // index within the frame where accel data starts prv_convert_accel_raw_data_to_mgs(&frame_buf[a_begin], data); } static void prv_drain_fifo(void) { // we can't drain the fifo if we are in low power mode so we have // to temporarily enter normal mode bool was_low...
for (unsigned int i = 0; i < ARRAY_LENGTH(BOARD_CONFIG_ACCEL.accel_ints); i++) { uint8_t int_cfg = 0; uint8_t int_mask = 0xf << (i * 4); if (enable) { int_cfg = 0xA << (i * 4); // INT EN, Push-Pull, Active High, Level Triggered exti_enable(BOARD_CONFIG_ACCEL.accel_ints[i]); } else { // disab...
} void bmi160_init(void) { gpio_input_init(&BOARD_CONFIG_ACCEL.accel_int_gpios[0]); gpio_input_init(&BOARD_CONFIG_ACCEL.accel_int_gpios[1]); exti_configure_pin(BOARD_CONFIG_ACCEL.accel_ints[0], ExtiTrigger_Rising, bmi160_IRQ1_handler); exti_configure_pin(BOARD_CONFIG_ACCEL.accel_ints[1], ExtiTrigger_Ri...