prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
.unload = prv_window_unload }); WindowStack *stack = app_state_get_window_stack(); // Switch to the app state to push a window stub_pebble_tasks_set_current(PebbleTask_App); cl_check(stack); cl_assert_equal_i(window_stack_count(stack), 0); window_stack_push(stack, window, true); cl_assert_equal...
(prv_get_load_unload_count(), 0)
; cl_assert_equal_i(prv_get_appear_disappear_count(), 0); // FIXME: PBL-25460 // cl_assert_equal_b(animation_is_scheduled(fake_animation_get_first_animation()), false); } // Push two windows back to back, before the first transition completes. This should cancel the // first transition and instead run the secon...
height, item_height); } const int16_t header_padding = 6 * aml->num_items; const int16_t header_height = ((bounds->size.h - total_h) / 2) - padding; return MAX(header_height - header_padding, 0); } static void prv_draw_header_cb(GContext *ctx, const Layer *cell_layer, uint16_t section_index, ...
prv_set_selected_index(aml, selected_index, false /* animated */)
/* * 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...
flash_read_bytes(buffer, flash_addr, chunk_size)
; legacy_defective_checksum_update(&checksum, buffer, chunk_size); num_bytes -= chunk_size; flash_addr += chunk_size; } flash_read_bytes(buffer, flash_addr, num_bytes); legacy_defective_checksum_update(&checksum, buffer, num_bytes); kernel_free(buffer); return legacy_defective_checksum_finish(...
y); cl_check_(gcolor_equal(get_bitmap_color(&s_bmp, x, y), s_palette[x]), print_buf); cl_check_(gcolor_equal(get_bitmap_color(&s_bmp, x, y), s_palette[x]), print_buf); } } #endif bitblt_bitmap_into_bitmap(&dest_bitmap, &s_bmp, GPointZero, GCompOpAssign, GColorWhite); cl_assert(prv_check_source_...
{ case GCompOpSet: { if (transparent) { memset(s_palette, color.argb, sizeof(s_palette)); } break; } case GCompOpAssign: break; case GCompOpTint: { for (uint8_t idx = 0; idx < WIDTH; idx++) { if (s_palette[idx].a == 3 || transparent) { s_palette[id...
cl_assert(prv_check_source_stripe_blit(dest_bitmap_data, &s_bmp, GColorWhite)); } void test_bitblt_palette__2Bit_assign_opaque(void) { prv_opaque_2bit_simple(GCompOpAssign); } void test_bitblt_palette__2Bit_set_opaque(void) { prv_opaque_2bit_simple(GCompOpSet); } void test_bitblt_palette__2Bit_comptint_opaqu...
return 0; } static int prv_app_override_comparator(AppInstallId app_id, AppInstallId new_id) { return (prv_override_index(app_id) - prv_override_index(new_id)); } static int prv_comparator_ascending_zero_last(unsigned int a, unsigned int b) { return ((a != 0) && (b != 0)) ? (b - a) : // Sort in ascending order...
data_source->callbacks.changed(data_source->callback_context)
; } } static void prv_do_app_added(AppMenuDataSource *source, AppInstallId install_id); static void prv_do_app_removed(AppMenuDataSource *source, AppInstallId install_id); static void prv_do_app_icon_name_updated(AppMenuDataSource *source, AppInstallId install_id); static void prv_do_app_db_cleared(AppMenuDataSource...
connected()) { // If BT Classic connected, show the name of the connected device bt_driver_classic_copy_connected_device_name(data->name_text_buffer); } else if ((comm_session_get_system_session() != NULL) && (gap_conn != NULL)) { // If we have connected to a device and we have a connection to the mobile ...
layer_add_child(&window->layer, &url_text_layer->layer)
C_CTRL_1_REG, DCDC_GLOBAL_MAX_IDLE_TIME, 0x20); REG_SETF(DCDC, DCDC_CTRL_1_REG, DCDC_TIMEOUT, 0x10); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TIMEOUT_IRQ_TRIG, 0x8); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TIMEOUT_IRQ_RES, 0x8); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TUNE, 0x0); REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_L...
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, DCDC_IRQ_CLEAR_REG, DCDC_V18P_TIMEOUT_IRQ_CLEAR, 0x0); REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_VDD_TIMEOUT_IRQ_CLEAR, 0x0); REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_V18_TIME...
0x1000000); pfs_init(false); pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); memset(&s_font_info, 0, sizeof(s_font_info)); resource_init(); fb = malloc(sizeof(FrameBuff...
{ prv_prepare_canvas_and_render_emoji(RESOURCE_ID_GOTHIC_14_EMOJI); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); }
void test_emoji_fonts__gothic_18_emoji(void) { prv_prepare_canvas_and_render_emoji(RESOURCE_ID_GOTHIC_18_EMOJI); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_emoji_fonts__gothic_24_emoji(void) { prv_prepare_canvas_and_render_emoji(RESOURCE_ID_GOTHIC_24_EMOJI); cl_check(gbitmap_pbi_eq(s...
etricActiveSeconds, start_of_today, start_of_today + (9 * SECONDS_PER_HOUR), HealthServiceTimeScopeDailyWeekdayOrWeekend); cl_assert_equal_i(value, exp_value); // --- // Compute weekend step average from 4am to 9...
cl_assert_equal_i(123, result)
; // This is the equivalent to `peek_value` with HeartRateBPM. Make sure it is equal. result = health_service_aggregate_averaged(HealthMetricHeartRateBPM, now_utc - 60, now_utc - 60, HealthAggregationAvg, HealthServiceTimeSco...
icense is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <applib/graphics/gcontext.h> #include <applib/graphics/gtypes.h> #include "rocky_a...
jerry_create_string((const jerry_char_t *)align_str)
; } // we speed this up, e.g. by sorting and doing binary search if this ever becomes an issue T_STATIC const RockyAPISystemFontDefinition s_font_definitions[] = { {.js_name = "18px bold Gothic", .res_key = FONT_KEY_GOTHIC_18_BOLD}, {.js_name = "14px Gothic", .res_key = FONT_KEY_GOTHIC_14}, {.js_name = "14px bol...
nd: return AttributeTypeUint8; case AttributeIdIconTiny: case AttributeIdIconSmall: case AttributeIdIconLarge: case AttributeIdIconPin: case AttributeIdIcon: return AttributeTypeResourceId; case AttributeIdLastUpdated: case AttributeIdLaunchCode: case AttributeIdAncsId: c...
MIN(ATTRIBUTE_APP_GLANCE_SUBTITLE_MAX_LEN, attribute->length)
+ 1; } else { string_alloc_size += attribute->length + 1; } break; case AttributeTypeStringList: string_alloc_size += sizeof(StringList) + MIN(MAX_LENGTH_CANNED_RESPONSES, attribute->length) + 1; break; case AttributeTypeUint32List: string_alloc_size += att...
/* * 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...
cl_assert_equal_i(s_cache_keys[cache_idx], s_test_data[data_idx].key)
; cl_assert_equal_m(&s_cache_buffer[cache_idx], &s_test_data[data_idx].item, sizeof(TestCacheItem)); } static void prv_test_backing_data_empty(int cache_idx) { cl_assert_equal_i(s_cache_keys[cache_idx], 0); cl_assert_equal_m(&s_cache_buffer[cache_idx], &ZERO_ITEM, sizeof(TestCacheItem)); } 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...
{ if (!res_info) { return NULL; } KinoReel *icon = kino_reel_create_with_resource_system(res_info->res_app_num, res_info->res_id); if (!icon) { return NULL; } const GSize size = kino_reel_get_size(icon); // Not const to deal with horrifying GCC bug GSize max_size = legacy_icon_size_limit ? LAU...
static bool prv_app_resource_info_equal(const AppResourceInfo *a, const AppResourceInfo *b) { PBL_ASSERTN(a && b); return ((a == b) || ((a->res_id == b->res_id) && (a->res_app_num == b->res_app_num))); } static void prv_generic_glance_set_icon(LauncherAppGlanceGeneric *generic_glance, ...
_layer) { int16_t max_dy = swap_layer->current->layer.frame.size.h - swap_layer->layer.frame.size.h; // we are peeking the next notification if we have a next. if (swap_layer->next != NULL) { max_dy += PEEK_PX; } else { #if PBL_ROUND // The last notification has to be able to scroll past content to sta...
(swap_layer, prv_direction_for_recognizer(recognizer), is_repeating)
l prv_dummy_device(uint8_t octet) { BTDeviceAddress address = { .octets = { [0] = octet, [1] = octet, [2] = octet, [3] = octet, [4] = octet, [5] = octet, }, }; BTDevice device = bt_device_init_with_address(address, true /* is_random */); return *(BTDeviceInternal *)(&...
(characteristic_ref)
prv_update_permission(connection, HrmSharingPermission_Declined); prv_disconnect_to_kill_subscription(connection); } bt_unlock(); analytics_event_ble_hrm(BleHrmEventSubtype_SharingRevoked); } static void prv_revoke_gap_le_connection_for_each_cb(GAPLEConnection *connection, void *unused) { prv_update_p...
gap_le_slave_reconnect_hrm_stop()
/* * 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 (data->progress_source == PROGRESS_UI_SOURCE_FW_UPDATE) { return success ? i18n_get("Update Complete", data) : i18n_get("Update Failed", data); } else { return ""; } }
ert(uuid_equal(&item1.header.id, &temp.header.id)); temp.attr_list.attributes = NULL; cl_assert(memcmp(&item1, &temp, sizeof(TimelineItem)) == 0); cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */)); cl_assert(reminder_db_get_len((uint8_t *)&item1.header.id, sizeof(Uuid)) == ...
((uint8_t*)&item4.header.id, sizeof(Uuid))
> 0); } void test_reminder_db__bad_item(void) { cl_assert(S_SUCCESS != reminder_db_insert((uint8_t *)&bad_item.common.id, UUID_SIZE, (uint8_t *)&bad_item, sizeof(bad_item))); } void test_reminder_db__read_nonexistant(void) { TimelineItem item = {{{0}}}; cl_assert_equal_i(E_DOES_NOT_EXIST, reminder_db_read_item...
/* * 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...
{ remaining_framebuffer_row_bytes = remaining_chunk_bytes; }
#ifdef PLATFORM_SPALDING const GBitmapDataRowInfoInternal *row_infos = g_gbitmap_spalding_data_row_infos; const size_t framebuffer_row_min_pixel = row_infos[state->row].min_x; const size_t framebuffer_row_max_pixel = row_infos[state->row].max_x; for (uint32_t i = 0; i < remaining_framebuffer_row_bytes...
lash_dump_log_file(log_gen, prv_flash_log_line_dump, prv_flash_log_dump_completed_cb); cl_assert(success); while (!s_completed) { fake_system_task_callbacks_invoke_pending(); } cl_assert(s_completed_success); cl_assert_equal_i(s_msg.num_processed, s_msg.num_items); } ...
(log, 100, "Generation 0x%x", i - gen)
true), play_count_spawn * (MAX(total_duration_a, total_duration_b))); cl_assert_equal_i(animation_get_duration(spawn, true, false), delay_spawn + MAX(total_duration_a, total_duration_b)); cl_assert_equal_i(animation_get_duration(spawn, true, true), duration_total); animat...
(animation_get_duration(h, true, true) == duration)
PebbleEvent event = fake_event_get_last(); \ cl_assert_equal_i(event.type, PEBBLE_PUT_BYTES_EVENT); \ cl_assert_equal_i(event.put_bytes.type, PebblePutBytesEventTypeCleanup); \ cl_assert_equal_i(event.put_bytes.object_type, object_type_); \ cl_assert_equal_i(event.put_bytes.total_size, object_size_); \ cl_as...
{ // When the PutBytes lock is taken for a long time when a PutBytes message is prepared, // expect to receive a Nack: // Take and hold for a long time: xSemaphoreTake(put_bytes_get_semaphore(), portMAX_DELAY); fake_queue_set_yield_callback(put_bytes_get_semaphore(), prv_taking_too_long_yield_cb); prv_rec...
/* * 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...
(s_dls_records)
); s_dls_records[s_num_dls_records++] = records[i]; } return DATA_LOGGING_SUCCESS; } DataLoggingSession *dls_create(uint32_t tag, DataLoggingItemType item_type, uint16_t item_size, bool buffered, bool resume, const Uuid *uuid) { if (tag == DlsSystemTagProtobufLogSession) { ...
(LOG_LEVEL_DEBUG, "App Fetch: Got the start event")
; // We have received a new progress event } else if (af_event->type == AppFetchEventTypeProgress) { progress_window_set_progress(&data->window, af_event->progress_percent); // We have finished the app fetch. Launching } else if (af_event->type == AppFetchEventTypeFinish) { progress_window_set_result_...
H); char *time_range = kernel_zalloc_check(max_attr_length); const char *time_range_fmt = i18n_get("%s - %s", &pin_attr_list); /// "10:00AM - 11:00PM" clock_copy_time_string_timestamp(start_time, TIME_STRING_TIME_LENGTH, session->start_utc); clock_copy_time_string_timestamp(end_time, TIME_STRING_TIME_LENGTH, ...
(now_utc, session)
; } // ----------------------------------------------------------------------------------------- static void prv_do_sleep_notification(time_t now_utc, time_t sleep_exit_utc, int32_t sleep_total_seconds) { if (!activity_prefs_sleep_insights_are_enabled()) { return; } if ...
/* * 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...
accel_service_private_get_session(task)
mezone(tz_info); // Update the RTC registers with the latest timezone info rtc_set_timezone(tz_info); // We are pivoting to UTC from localtime for the first time if (timezone_migration_needed) { time_t t = rtc_get_time(); t = prv_migrate_local_time_to_UTC(t); rtc_sanitize_time_t(&t); rtc_set_t...
{ if (tz_info->dst_id == 0) { tz_info->dst_start = 0; tz_info->dst_end = 0; return; } #if defined(RECOVERY_FW) return; #else // Load the pair of TimezoneDSTRule objects from the timezone database TimezoneDSTRule dst_rule_begin; TimezoneDSTRule dst_rule_end; if (!timezone_database_load_dst_...
tz_info->dst_end = dst_end_stamps[end_idx]; #endif // RECOVERY_FW } static void prv_clock_get_timezone_info_from_region_id( int16_t region_id, time_t utc_time, TimezoneInfo *tz_info) { #ifdef RECOVERY_FW *tz_info = (TimezoneInfo) { .dst_id = 0 }; #else timezone_database_load_region_info(region_id, tz_info...
alog); dialog_set_text(dialog, snooze_buf); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_CONFIRMATION_LARGE); dialog_set_background_color(dialog, GColorJaegerGreen); dialog_set_timeout(dialog, DIALOG_TIMEOUT_SNOOZE); simple_dialog_push(simple_dialog, prv_get_window_stack()); } // -----------------------------...
(VIBE_DURATION, vibe_repeat_interval_ms)
; #else s_alarm_popup_data->max_vibes = TINTIN_MAX_VIBES; #endif s_alarm_popup_data->vibe_timer = new_timer_create(); prv_vibe(NULL); new_timer_start(s_alarm_popup_data->vibe_timer, vibe_repeat_interval_ms, prv_vibe, NULL, TIMER_START_FLAG_REPEATING); } // ------------------------------------...
272, 24}, { 832, 256, 16}, // 52 seconds { 1064, 232, 32}, { 1232, 272, 32}, { 1704, 232, 72}, { 1672, 424, 8}, { 992, 264, 112}, { 1048, 120, 104}, { 1208, 128, 104}, { 1168, 128, 136}, { 1008, 88, 152}, { 912, 72, 120}, { 872, 0, 192}, { 872, 0, 176}, { 832...
{ 1400, 544, 160}, { 864, 248, 24}, { 1208, 216, 80}, { 1440, 120, 216}, { 1264, 96, 184}, { 1040, -24, 208}, { 864, -24, 144}, // 58 seconds { 736, -16, 112}, { 696, -24, 120}, { 672, -32, 88}, { 752, -40, 72}, { 896, 48, -40}, { 1080, 56, -128}, { 1544, -240...
{ 1200, 0, 40}, { 1712, -216, 320}, { 1792, 88, 360}, { 1352, 848, -120}, { 920, 432, 144}, { 952, 160, 280}, { 944, 176, 288}, { 856, 80, 312}, { 816, 256, 224}, { 760, 312, 152}, { 736, 304, 112}, { 840, 320, 80}, { 968, 360, 0}, { 1184, 288, 56}, // 61 sec...
/* * 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...
{ free(fb); gbitmap_destroy(s_dest_bitmap); s_dest_bitmap = NULL; }
ssions and * limitations under the License. */ #include "applib/applib_malloc.auto.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "process_management/process_manager.h" #include "services/common/new_timer/new_timer.h" #include "services/common/system_task.h" #include "services/normal/accessory...
pebble_task_get_current()
== CONSUMER_TASK; } else if ((current_state == SmartstrapAttributeStateRequestPending) && (new_state == SmartstrapAttributeStateIdle)) { return pebble_task_get_current() == PebbleTask_KernelBackground; } else if ((current_state == SmartstrapAttributeStateRequestPending) && (new_state ...
age governing permissions and * limitations under the License. */ #include "app_inbox_service.h" #include "kernel/pbl_malloc.h" #include "kernel/pebble_tasks.h" #include "process_management/process_manager.h" #include "os/mutex.h" #include "syscall/syscall_internal.h" #include "system/logging.h" #include "system/pa...
syscall_assert_userspace_buffer(storage, storage_size)
; } const AppInboxServiceTag service_tag = prv_tag_for_event_handlers(message_handler, dropped_handler); if (AppInboxServiceTagInvalid == service_tag) { PBL_LOG(LOG_LEVEL_ERROR, "AppInbox event handlers not allowed <0x%"PRIx32", 0x%"PRIx32">"...
ty_hr_preferences(HeartRatePreferences *new_settings) { if (new_settings->resting_hr > new_settings->elevated_hr || new_settings->elevated_hr > new_settings->max_hr) { return false; } if (new_settings->zone1_threshold > new_settings->zone2_threshold || new_settings->zone2_threshold > new_settings-...
if (settings_file_exists(file, PREF_KEY_BACKLIGHT_BEHAVIOUR_DEPRECATED, sizeof(PREF_KEY_BACKLIGHT_BEHAVIOUR_DEPRECATED))) { bool temp; BacklightBehaviour backlight_behaviour = BacklightBehaviour_Auto; settings_file_get(file, PREF_KEY_BACKLIGHT_BEHAVIOUR_DEPRECATED, ...
} // ------------------------------------------------------------------------------------ void shell_prefs_init(void) { s_backlight_intensity = prv_convert_backlight_percent_to_intensity(BOARD_CONFIG.backlight_on_percent); s_mutex = mutex_create(); SettingsFile file = {{0}}; if (settings_file_open(&fi...
r flags to see if the page is a file start page or an erased page if (IS_PAGE_TYPE(hdr.page_flags, PAGE_FLAG_ERASED_PAGE) || IS_PAGE_TYPE(hdr.page_flags, PAGE_FLAG_START_PAGE) || IS_PAGE_TYPE(hdr.page_flags, PAGE_FLAG_CONT_PAGE) || page_is_deleted(hdr.page_flags)) { return (true); } ...
(s_head_callback_node_list, &node->list_node)
rent_click_manager(); ClickConfig *cfg = &mgr->recognizers[button_id].config; cfg->click.repeat_interval_ms = repeat_interval_ms; cfg->click.handler = handler; } void window_multi_click_subscribe(ButtonId button_id, uint8_t min_clicks, uint8_t max_clicks, uint16_t timeout, bool...
if (new_on_screen == window->on_screen) { return; }
// Window went from offscreen to onscreen (or vice versa) // Provides internal signaling to ui elements of appear/disappear layer_property_changed_tree(&window->layer); window->on_screen = new_on_screen; if (window->on_screen) { window_schedule_render(window); // The click provider was set but not ...
GContext ctx; test_graphics_context_init(&ctx, fb); // AA = true, SW = 1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 0); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r0_aa_sw1_no_clip.${BIT_DEP...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11)
; graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); graphics_draw_roun...
active_window->action_bar_start); gbitmap_destroy(active_window->action_bar_pause); gbitmap_destroy(active_window->action_bar_stop); gbitmap_destroy(active_window->action_bar_more); gbitmap_destroy(active_window->action_bar_next); gbitmap_destroy(active_window->heart_icon); gbitmap_destroy(activ...
layer_set_update_proc(&active_window->middle_metric_layer, prv_static_layer_update_proc)
; layer_add_child(&active_window->base_layer, &active_window->middle_metric_layer); GRect scrollable_metric_bounds = middle_metric_bounds; scrollable_metric_bounds.origin.y = top_metric_bounds.size.h + middle_metric_bounds.size.h; scrollable_metric_bounds.size.h = layer_height + 10; layer_init(&act...
{ -232, 352, -928}, { -232, 352, -928}, { -224, 352, -928}, { -224, 344, -936}, { -232, 344, -936}, { -232, 352, -936}, { -224, 344, -928}, { -232, 352, -936}, { -232, 352, -936}, { -224, 352, -936}, { -232, 344, -928}, { -232, 352, -944}, { -232, 360, -936}, { -2...
{ -232, 320, -936}, { -224, 336, -936}, { -216, 344, -936}, { -224, 336, -936}, { -224, 344, -944}, { -224, 344, -944}, { -224, 344, -936}, { -224, 344, -944}, { -216, 336, -944}, { -216, 336, -944}, { -216, 328, -936}, { -224, 336, -936}, { -216, 344, -936}, { -...
----------------------------------------------------------------------------- // Log local bluetooth disconnection reason void analytics_event_local_bt_disconnect(uint16_t conn_handle, uint32_t lr) { AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_LocalBtDisconnect, }; event_blob.local_bt_disconnec...
{ AnalyticsEventBlob event_blob = { .event = (is_rocky_app ? AnalyticsEvent_RockyAppCrash : AnalyticsEvent_AppCrash), .app_crash_report = { .uuid = *uuid, .pc = pc, .lr = lr, }, }; if (build_id) { memcpy(event_blob.app_crash_report.build_id_slice, build_id, sizeof(eve...
extern bool comm_session_is_valid(const CommSession *session); // ------------------------------------------------------------------------------------------ static bool prv_get_connection_details(CommSession *session, bool *is_ppogatt, uint16_t *conn_interval) { bt_lock(); ...
ributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "timeline_layer.h" #include "timeline_animations.h" #include "t...
if (second_icon_frame_out) { *second_icon_frame_out = second_icon_frame; }
const int total_space = second_icon_frame.origin.y - grect_get_max_y(&first_icon_frame); return total_space - (REL_BAR_VERT_MARGIN * 2); } static int prv_get_overlap_line_length(TimelineLayer *layer, GRect *first_icon_frame_out, GRect *second_icon_frame_out) { const int f...
free(fb); } // Tests //////////////////////////////////// void inside_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(14, 14), 12); } void white_layer_update_callback(Layer* me,...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 1)
{ GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__1bit_to_8bit_assign.1bit.pbi"); uint8_t dest_data[100*100]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = 100, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = { { 0, 0 }, { 100, 100 }...
memset(dest_data, GColorBlue.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpSet, GColorWhite); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_set-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Setup: // - Source is an image of a whi...
estamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertReminder)); cl_assert(alerts_should_notify_for_type(AlertOther)); cl_assert(!alerts_should_vibrate_for_type(AlertOther)); alerts_set_notification_vibe_timestamp(); fake_r...
(!alerts_should_enable_backlight_for_type(AlertMobile))
2CSlavePort * const I2C_MAX14690 = &I2C_SLAVE_MAX14690; I2CSlavePort * const I2C_MAG3110 = &I2C_SLAVE_MAG3110; I2CSlavePort * const I2C_MFI = NULL; IRQ_MAP(I2C1_EV, i2c_hal_event_irq_handler, &I2C_PMIC_MAG_BUS); IRQ_MAP(I2C1_ER, i2c_hal_error_irq_handler, &I2C_PMIC_MAG_BUS); // VOLTAGE MONITOR DEVICES static const ...
MHZ_TO_HZ(32)
, .creset = { .gpio = GPIOG, .gpio_pin = GPIO_Pin_15, .active_high = true, }, .cdone = { .gpio = GPIOG, .gpio_pin = GPIO_Pin_9, }, .busy = { .gpio = GPIOG, .gpio_pin = GPIO_Pin_10, }, .cdone_exti = { .exti_port_source = EXTI_PortSourceGPIOG, .exti_line = 9, }, .busy...
e. * 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 distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *...
if (blob_db_id != BlobDBIdAppGlance) { // We only care about app glance changes return; }
prv_glance_event_put((Uuid *)blob_db_event->key); } static void prv_handle_app_cache_event(PebbleEvent *e, void *context) { if (e->app_cache_event.cache_event_type == PebbleAppCacheEvent_Removed) { Uuid app_uuid; app_install_get_uuid_for_install_id(e->app_cache_event.install_id, &app_uuid); app_glanc...
pending) { s_deferred_render.app.pending = false; compositor_app_render_ready(); } if (s_deferred_render.transition_start.pending) { s_deferred_render.transition_start.pending = false; compositor_transition(s_deferred_render.transition_start.compositor_animation); } } static void prv_compositor_f...
kernel_ui_get_graphics_context()
; // Save the draw state in a static to save stack space static GDrawState prev_state; prev_state = ctx->draw_state; func(ctx, animation, distance_normalized); ctx->draw_state = prev_state; if (!s_animation_state.impl->skip_modal_render_after_update) { compositor_render_modal(); } prv_composito...
layouts[TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER - 1] = NULL; layer->layouts_info[TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER - 1] = NULL; } else if (delta == -1) { if (layer->layouts[s_nonvisible_items[1]]) { prv_destroy_layout(layer, s_nonvisible_items[1]); } for (int i = TIMELINE_NUM_ITEMS_IN_TIMELINE_L...
GPoint(direction.x * INTERPOLATE_MOOOK_BOUNCE_BACK, direction.y * INTERPOLATE_MOOOK_BOUNCE_BACK)
); layer_set_frame(layer, &from); Animation *animation = (Animation *)property_animation_create_layer_frame(layer, &from, &to); animation_set_curve(animation, AnimationCurveEaseOut); animation_set_duration(animation, TIMELINE_LAYER_SLIDE_MS); animation_set_handlers(animation, (AnimationHandlers) { .stoppe...
= 1; while (cur_node) { if (cur_node->id == id) { return list_idx; } list_idx++; cur_node = (AlarmNode* )list_get_next((ListNode*) cur_node); } return 0; } static void prv_update_menu_layer(AlarmsAppData* data, AlarmId select_alarm) { MenuIndex selected_menu_index = {0, prv_get_list_idx...
(ctx, text, font, box, GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL)
/* * 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...
gap_le_slave_is_discoverable()
!= is_ble_pairable_and_discoverable) { if (is_ble_pairable_and_discoverable) { bt_local_addr_pause_cycling(); } else { bt_local_addr_resume_cycling(); } gap_le_slave_set_discoverable(is_ble_pairable_and_discoverable); } if (bt_driver_supports_bt_classic()) { bt_driver_classic_paira...
/* * 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...
cl_assert(vibe_intensity_cycle_next(VibeIntensityLow) == VibeIntensityMedium)
; // Medium -> High cl_assert(vibe_intensity_cycle_next(VibeIntensityMedium) == VibeIntensityHigh); // High -> Low cl_assert(vibe_intensity_cycle_next(VibeIntensityHigh) == VibeIntensityLow); }
/* * 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...
(&s_cache, i)
; // check that the others are still around cl_assert(output); cl_assert(*output == i); } } void test_lru_cache__use_and_evict(void) { int i; for (i = 0; i < CACHE_BUFFER_SIZE / (sizeof(CacheEntry) + sizeof(uint32_t)); ++i) { uint32_t input = i; lru_cache_put(&s_cache, i, &input); } // us...
n.y += levels_layer->frame.origin.y + levels_layer->bounds.origin.y; ctx->draw_state.drawing_box.size = levels_layer->bounds.size; } if (!grect_is_empty(&ctx->draw_state.clip_box)) { // call the current node's render procedure if (node->update_proc) { node->update_proc(node,...
if (!child || child->parent == NULL) { return; }
if (child->parent->window) { window_schedule_render(child->parent->window); } Layer *node = child->parent->first_child; if (node == child) { child->parent->first_child = node->next_sibling; } else { while (node->next_sibling != child) { node = node->next_sibling; } node->next_siblin...
/* * 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...
malloc(row_size_bytes * bounds.h)
, .bounds = (GRect){.size = bounds}, .row_size_bytes = row_size_bytes, .info.version = 1, .info.format = GBitmapFormat8Bit, }; ctx->draw_state.clip_box = ctx->dest_bitmap.bounds; ctx->draw_state.drawing_box = ctx->draw_state.clip_box; // Always use anti-aliased graphics_context_set_antialias...
/* * 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...
(missed_text)
+ missed_app_titles_len; char *missed_message = kernel_zalloc(missed_message_len + 1); strncpy(missed_message, missed_text, strlen(missed_text)); i18n_free(missed_text, data); prv_each_app_ids(data->count, data->app_ids, prv_string_builder, missed_message); missed_message[missed_message_len] = '\0'; // ...
ord(addr_region, data_buffer, data_buffer, true); if (status != 0) { PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Data bit %d not returning correct data value", bitpos); return status; } bitpos++; addr_region += 4; // increment to the next address to avoid extra erases } PBL_LOG(LOG_LEVEL_DEBUG, "...
((uint8_t*) &read_buffer, test_addr, sizeof(read_buffer))
y */); #endif } // ----------------------------------------------------------------------------------------- // List of incoming message handlers static const QemuMessageHandler s_qemu_endpoints[] = { // IMPORTANT: These must be in sorted order!! { QemuProtocol_SPP, qemu_transport_handle_received_data }, { Qemu...
shared_circular_buffer_get_write_space_remaining(&s_qemu_state.isr_buffer)
) { // There's no more room in the buffer, so disable the RX interrupt. No more // data will be read from the UART until prv_process_receive_buffer() is // run, draining the buffer and re-enabling the RX interrupt. QEMU will // buffer the remaining data until the interrupt is re-enabled. uart_set_rx...
const time_t advance = 1448064000 - s_2015_nov12_123456_gmt; prv_basic_test(&s_timezone_gmt, &test_cron, s_2015_nov12_123456_gmt, advance, advance, 1); } void test_cron__dst_simple_from(void) { // Dec 21st, 01:00:00 local CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute =...
cl_assert_equal_i((uintptr_t)jobs[0].cb_data, 0)
; cl_assert_equal_i((uintptr_t)new_job.cb_data, 0); cl_assert_equal_i(cron_service_get_job_count(), ARRAY_LENGTH(jobs) + 1); fake_rtc_increment_time(0); cron_service_wakeup(); cl_assert_equal_i((uintptr_t)jobs[0].cb_data, 1); cl_assert_equal_i((uintptr_t)new_job.cb_data, 2); cl_assert_equal_i(cron_servi...
workout_active_create_for_activity_type( ActivitySessionType_Walk, &s_workout_data, &s_workout_controller); prv_create_window_and_render(active_window, 0); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__workout_render_walk_no_hrm(void) { s_hrm_is_present = false; ...
health_util_get_pace(789, 234)
, .bpm = 197, .hr_zone = 3, }; WorkoutActiveWindow *active_window = workout_active_create_for_activity_type( ActivitySessionType_Run, &s_workout_data, &s_workout_controller); prv_create_window_and_render(active_window, 0); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_...
TransformNumber)) == 0)); t_c = GTransform(GTransformNumberFromNumber(1), GTransformNumberFromNumber(2), GTransformNumberFromNumber(3), GTransformNumberFromNumber(4), GTransformNumberFromNumber(5), GTransformNumberFromNumber(6)); int32_t test_array[6] = {1 * (1 << FIXED_S32...
(-(float)sine / TRIG_MAX_RATIO)
, GTransformNumberFromNumber((float)sine / TRIG_MAX_RATIO), GTransformNumberFromNumber((float)cosine / TRIG_MAX_RATIO), GTransformNumberZero, GTransformNumberZero); cl_assert(!gtransform_is_equal(&t, &t_c)); t = GTransformRotation(0); // 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...
list_find((ListNode *) s_presented_notifs, prv_filter_presented_notification_by_id, id)
; } Uuid *notifications_presented_list_first(void) { NotifList * node = (NotifList *)list_get_head((ListNode*)s_presented_notifs); return node ? &node->notif.id : NULL; } Uuid *notifications_presented_list_last(void) { NotifList * node = (NotifList *)list_get_tail((ListNode*)s_presented_notifs); return node ?...
/* * 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...
(&layer, &ctx)
#include "applib/ui/dialogs/simple_dialog.h" #include "applib/ui/ui.h" #include "applib/voice/transcription_dialog.h" #include "applib/voice/voice_window.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "resource...
(dialog, DIALOG_TIMEOUT_DEFAULT)
; app_simple_dialog_push(simple_dialog); i18n_free_all(dialog); } static void prv_confirm_cb(void *context) { ReminderAppData *data = context; data->ui_state = ReminderAppUIState_Exit; prv_create_reminder(data); prv_push_success_dialog(); } static void prv_push_transcription_dialog(ReminderAppData *data) ...
/* * 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...
{ size_t src_size = gdraw_command_list_get_data_size(src); if (buffer_length < src_size) { return false; } memcpy(buffer, src, src_size); return true; }
GDrawCommandList *gdraw_command_list_clone(GDrawCommandList *list) { if (!list) { return NULL; } size_t size = gdraw_command_list_get_data_size(list); GDrawCommandList *result = applib_malloc(size); if (result) { memcpy(result, list, size); } return result; } void gdraw_command_list_destroy(G...
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 distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES O...
{ const FileResourceData *file = &g_file_resource_stores[i]; entry->store_data = file; entry->id -= file->resource_id_offset; return true; }
} return false; } static ResourceCallbackHandle resource_storage_file_watch(ResourceStoreEntry *entry, ResourceChangedCallback callback, void* data) { const FileResourceData *file = entry->store_...
ation_set_implementation(bg_anim, &prv_bg_animation_implementation); health_card_view->slide_animation = animation_spawn_create(curr_out, next_in, bg_anim, NULL); animation_schedule(health_card_view->slide_animation); health_card_view->current_card_index = next_card_index; } //////////////////////////////////...
const int content_indicator_height = PBL_IF_ROUND_ELSE(18, 11); const GRect down_arrow_layer_frame = grect_inset(window_root->frame, GEdgeInsets(window_root->frame.size.h - content_indicator_height, 0, 0)); layer_init(&health_card_view->down_arrow_layer, &down_arrow_layer_frame); layer_add_child(window_ro...
alog_set_text(dialog, i18n_get("End Workout?", workout_dialog)); dialog_set_background_color(dialog, BACKGROUND_COLOR); dialog_set_text_color(dialog, TEXT_COLOR); dialog_set_icon(dialog, RESOURCE_ID_WORKOUT_APP_END); dialog_set_icon_animate_direction(dialog, DialogIconAnimateNone); dialog_set_destroy_on_pop(d...
(active_window)
; app_free(active_window); } } //////////////////////////////////////////////////////////////////////////////////////////////////// //! Common Setup static void prv_create_window_common(WorkoutActiveWindow *active_window, void *workout_data, ...
(&argv[i], type_error_out)
) { type_error_out->arg_offset = i; return false; } } return true; } static bool prv_check_color_type(const jerry_value_t argv[], RockyArgTypeCheckError *type_error_out) { if (jerry_value_is_number(argv[0]) || jerry_value_is_string(argv[0])) { return true; }...
.lr = lr, .lr_known = true }; } static void prv_save_debug_registers(unsigned int* stacked_args) { s_fault_saved_lr = (uint32_t)stacked_args[5]; s_fault_saved_pc = (uint32_t)stacked_args[6]; s_fault_saved_sp = (uint32_t)&stacked_args[8]; } static void prv_log_app_lr_and_pc_system_task(void *data) { CrashInf...
app_manager_get_task_context()
->safe_to_kill = true; } else if (task == PebbleTask_Worker) { app_crashed(); worker_manager_get_task_context()->safe_to_kill = true; // If not release mode, generate a core dump so we can get debugging information #ifdef WORKER_CRASH_CAUSES_RESET kernel_fault(RebootReasonCode_WorkerHardFault, stashed...
nt16_t corrected_dst_y = fctl.y_offset + y + bitmap->bounds.origin.y; const GBitmapDataRowInfo row_info = gbitmap_get_data_row_info(bitmap, corrected_dst_y); int16_t delta_x = fctl.x_offset + bitmap->bounds.origin.x; for (int32_t x = MAX(0, row_info.min_x - delta_x); x < MIN((int32_t)fctl.w...
if (bitmap_sequence) { return bitmap_sequence->current_frame_delay_ms; }
return 0; } uint32_t gbitmap_sequence_get_total_num_frames(GBitmapSequence *bitmap_sequence) { if (bitmap_sequence) { return bitmap_sequence->total_frames; } return 0; } uint32_t gbitmap_sequence_get_play_count(GBitmapSequence *bitmap_sequence) { if (bitmap_sequence) { return bitmap_sequence->play_...
return app_id; } /////////////////////////// // App DB API /////////////////////////// //! Fills an AppDBEntry for a given UUID. This is a wrapper around app_db_read to keep it uniform //! with `app_db_get_app_entry_for_install_id` status_t app_db_get_app_entry_for_uuid(const Uuid *uuid, AppDBEntry *entry) { retur...
(&s_app_db.settings_file, (uint8_t *)&app_id, sizeof(AppInstallId), val, val_len)
; } prv_close_file_and_unlock_mutex(); if (rv == S_SUCCESS) { // app install something app_install_do_callbacks(new_install ? APP_AVAILABLE : APP_UPGRADED, app_id, NULL, NULL, NULL); } return rv; } int app_db_get_len(const uint8_t *key, int key_len) { status_t rv = prv_lock_mutex_and_open_file()...
= prv_check_whoami(dev); qspi_release(dev->qspi); return result; } static void prv_set_fast_read_ddr_enabled(QSPIFlash *dev, bool enabled) { // If we're supposed to use DDR for fast read, make sure the part can support it PBL_ASSERTN(!enabled || dev->state->part->supports_fast_read_ddr); dev->state->fast_re...
(dev->qspi)
s)) typedef struct SwapLayerDemoData { Window window; StatusBarLayer status_layer; SwapLayer swap_layer; LayoutLayer *layout_layers[NUM_NOTIFS]; uint32_t idx; } SwapLayerDemoData; static LayoutLayer *prv_get_layout_handler(SwapLayer *swap_layer, int8_t rel_position, ...
("Swap Layer")
id2, 23, 46, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule); } void test_alarm__alarm_set_recurring_daily(void) { AlarmId id; id = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_WEEKENDS }); prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule); alarm_set_...
(id2, schedule_2)
; prv_assert_alarm_config(id2, 4, 14, false, ALARM_KIND_CUSTOM, schedule_2); alarm_get_custom_days(id2, verify_schedule_2); prv_assert_alarm_config(id2, 4, 14, false, ALARM_KIND_CUSTOM, verify_schedule_2); } void test_alarm__alarm_get_string_for_custom(void) { bool schedule_1[7] = {true, false, false, false, f...
ate 2 property animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_play_count(b, play_count_b); // Create a sequence out of them. Animation *seq = animation_sequence...
prv_count_handler_entries(&s_stopped_handler_calls, c)
, 1); // ------------------------------------------------------------------------------------- // animation a has completed, but it shouldn't be deleted yet until the top-level // animation is done. uint32_t duration = animation_get_duration(a, false, false); cl_assert_equal_i(duration, duration_a); // ...
s_app_state_framebuffer = &(FrameBuffer) { .size = DISP_FRAME.size }; unobstructed_area_service_init(app_state_get_unobstructed_area_state(), DISP_ROWS); } void test_unobstructed_area_service__cleanup(void) { app_unobstructed_area_service_unsubscribe(); unobstructed_area_service_deinit(app_state_get_unobstruc...
{ UnobstructedAreaHandlers handlers = { .change = prv_change, }; app_unobstructed_area_service_subscribe(handlers, s_data.context); cl_assert(fake_event_service_get_info(PEBBLE_UNOBSTRUCTED_AREA_EVENT)->handler); cl_assert_equal_p(app_state_get_unobstructed_area_state()->handlers.change, prv_change); c...
void test_unobstructed_area_service__change_after_subscribe(void) { const GRect from_area = GRect(0, 0, DISP_COLS, 400); const GRect to_area = GRect(0, 0, DISP_COLS, 200); unobstructed_area_service_will_change(from_area.size.h, to_area.size.h); UnobstructedAreaHandlers handlers = { .will_change = prv_wil...
riph_DCMI | RCC_AHB2Periph_CRYP | RCC_AHB2Periph_HASH | RCC_AHB2Periph_RNG | RCC_AHB2Periph_OTG_FS; RCC_AHB2PeriphResetCmd(ahb2_periphs, ENABLE); RCC_AHB2PeriphResetCmd(ahb2_periphs, DISABLE); const uint32_t ahb3_periphs = 0 | RCC_AHB3Periph_FSMC; RCC_AHB3PeriphResetCmd(ahb3_periphs, ENAB...
boot_bit_test(BOOT_BIT_RECOVERY_START_IN_PROGRESS)
/* * 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...
framebuffer_get_line(fb, s_current_flush_line)
; #if PLATFORM_SILK // Draw rounded corners onto the screen without modifying the // system framebuffer. if (s_current_flush_line < ARRAY_LENGTH(s_corner_shape) || s_current_flush_line >= DISP_ROWS - ARRAY_LENGTH(s_corner_shape)) { memcpy(s_line_buffer, fb_line, FRAMEBUFFER_BYTES_PER_ROW); ...
prv_get_curr_system_time_ms()
* 1000; BMA255_DBG("%"PRId16" %"PRId16" %"PRId16, data->x, data->y, data->z); } typedef enum { BMA255Axis_X = 0, BMA255Axis_Y, BMA255Axis_Z, } BMA255Axis; static void prv_drain_fifo(void) { // TODO: I think the ideal thing to do here would be to invoke the accel_cb_new_sample() while // the SPI transact...
ams_util_float_string_parse((const char *)in, input_length, multiplier, &result)); \ if (succeeds) { \ cl_assert_equal_i(result, expected_result); \ } \ } void test_ams_util__float_string_parse_negative_number(void) { // "-1" * 3 assert_float_parse("-1", 3, true, -1 * 3); } void test_ams_util__f...
assert_result(0, "", 0)
; assert_result(1, "", 0); } void test_ams_util__csv_null(void) { const uint8_t count = ams_util_csv_parse(NULL, 0, NULL, prv_result_callback); cl_assert_equal_i(s_results_count, 0); cl_assert_equal_i(count, 0); } void test_ams_util__csv_one_value(void) { const cha...
------------------------- static void cl_assert_equal_gtransform(const GTransform a, const GTransform b) { cl_assert_equal_i(a.a.raw_value, b.a.raw_value); cl_assert_equal_i(a.b.raw_value, b.b.raw_value); cl_assert_equal_i(a.c.raw_value, b.c.raw_value); cl_assert_equal_i(a.d.raw_value, b.d.raw_value); cl_asse...
(dst_time - now)
; return; } now = prv_now_ms(); } } // ============================================================================================= // Started. stopped, setup, and teardown handler call histories. Every time a handler runs, we // append the time animation handle and timestamp to the history list. ty...
_b.parent == &parent); cl_assert(child_b.next_sibling == &child_a); cl_assert(child_a.next_sibling == NULL); // Insert child_c above child_b (next_sibling code path): // // +-parent // | // '->child_b->child_c->child_a // layer_insert_above_sibling(&child_c, &child_b); cl_assert(parent.firs...
layer_is_descendant(&child_b, &parent)
); layer_add_child(&parent, &child_b); cl_assert(layer_is_descendant(&child_b, &parent)); cl_assert(!layer_is_descendant(&child_b, &child_a)); cl_assert(!layer_is_descendant(&child_c, &child_a)); layer_add_child(&child_a, &child_c); cl_assert(layer_is_descendant(&child_c, &child_a)); cl_assert(layer_is_...
bool *defer_transition) { // StateWaitForReady is unique because it can be re-entered when session setup times // out if ((current_state == next_state) && (next_state == StateWaitForReady)) { *defer_transition = false; return next_state; } PBL_ASSERT(current_state != next...
prv_shrink_progress_bar(data)
ocale(void) { if (s_i18n_locale_other) { return "es_ES"; } else { return "en_US"; } } char *app_get_system_locale(void) { return "es_ES"; } const char *i18n_get(const char *msgid, const void *owner) { if (s_i18n_translate) { return "Hola"; } else { return msgid; } } void i18n_get_with_bu...
strftime(tmbuf, sizeof(tmbuf), "%P", &jan_2_2015__13_00_00)
; cl_assert_equal_s(tmbuf, "pm"); #endif tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%S %U", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "00 00"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%w %W", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "5 00"); tmbuf[0] = '\0'; strftime(t...
/* * 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...
("Up Button")
/* * 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 PebbleTask_KernelMain; }
else { return pebble_task_get_current(); } } // -------------------------------------------------------------------------------------------- // Return a pointer to the LogState to use for kernel (non app task) code. The LogState contains // the buffers for formatting the log message. // Returns NULL if a kernel...
{ 1128, -168, -144}, { 944, -304, 8}, { 1128, -120, -168}, { 1296, -32, -48}, { 1360, 192, -192}, { 1432, 80, -160}, { 1624, 168, -304}, { 1504, 248, -328}, { 1400, 336, -296}, { 1448, 432, -168}, { 1544, 616, 8}, { 1376, 728, -48}, { 1352, 1088, -392}, { 1304, 976...
{ 1136, 1480, -144}, { 768, 752, -120}, { 1128, 952, -88}, { 1080, 648, -152}, { 1312, 648, -72}, { 1648, 688, 8}, { -2040, 672, 8}, { 2000, 544, 64}, { 1848, 304, 144}, { 1744, 248, 48}, { 1608, 304, -136}, { 1424, 312, -200}, { 1184, 24, -120}, { 792, -320, -8},...
{ 1536, 152, -56}, { 1728, 232, 8}, { 1704, 448, -16}, { 1632, 568, -56}, { 1696, 688, -48}, { 1792, 808, -16}, { 1456, 672, -120}, { 1064, 1072, -680}, { 1256, 1032, -496}, { 928, 528, -144}, { 1088, 640, -128}, { 960, 720, -160}, { 1112, 864, -256}, { 1432, 816...
rame.size.h + instruction_frame.size.h) }; const bool clips = true; grect_align(&text_container_frame, &max_text_container_frame, GAlignCenter, clips); grect_align(&title_frame, &text_container_frame, GAlignTop, clips); grect_align(&instruction_frame, &text_container_frame, GAlignBottom, clips); const int...
{ // set a new user offset shell_prefs_set_display_offset(data->offset); analytics_inc(ANALYTICS_DEVICE_METRIC_DISPLAY_OFFSET_MODIFIED_COUNT, AnalyticsClient_System); window_stack_remove(&data->window, true /* animated */); return; }
data->state++; layer_mark_dirty(&data->window.layer); } static void prv_back_click_handler(ClickRecognizerRef recognizer, void *context) { DisplayCalibrationData *data = context; if (data->state == INITIAL_STATE) { // exit the calibration window without changing the prefs window_stack_remove(&data->w...
ude "activity.h" #include "activity_algorithm.h" #include "activity_calculators.h" #include "activity_insights.h" #include "activity_private.h" // Our globals static ActivityState s_activity_state; static bool s_hrm_present = false; // ----------------------------------------------------------------------------------...
("HR bpm: %"PRIu8", qual: %"PRId8" ", hrm_event->bpm.bpm, (int8_t) hrm_event->bpm.quality)
; // Perform a basic validity check so we only proceed with reasonable data // TODO: Use quality to filter out some readings, // TODO PBL-40784: Use HRMQuality_OffWrist as a special case to slow down the HRM subscription bool valid_hr_reading = true; if (hrm_event->bpm.bpm < ACTIVITY_DEFAULT_MIN_HR...
840, 216, 0}, { 808, 248, -16}, { 800, 248, -32}, { 816, 224, -16}, { 952, 240, 0}, { 1112, 328, 16}, { 1056, 368, 48}, { 1256, 440, 0}, { 1120, 416, 72}, { 960, 344, 32}, { 968, 304, 40}, { 976, 280, 88}, { 920, 224, 128}, { 880, 176, 136}, { 856, 176, 128}, ...
{ 936, 280, 16}, { 1192, 288, 40}, { 1056, 288, 64}, { 1048, 320, 120}, { 1008, 336, 120}, { 920, 312, 144}, { 952, 360, 192}, { 984, 432, 240}, { 1016, 512, 264}, { 1008, 624, 264}, { 952, 656, 248}, { 904, 752, 128}, { 832, 824, 16}, { 776, 768, -96}, { 688,...
// ---------------------------------------------------------------- // Sample captured: 2015-09-24 06:50:23 local AccelRawData *activity_sample_50_steps_barefoot_2(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_50_barefoot_2 //> TEST_EXPECTED 50 //> TEST_...
ystem", FLASH_REGION_FILESYSTEM_BEGIN, FLASH_REGION_FILESYSTEM_END }, }; typedef struct { Window window; SimpleMenuLayer menu_layer; SimpleMenuSection menu_section; SimpleMenuItem menu_items[NUM_MENU_ITEMS]; } FlashDiagAppData; typedef struct { Window window; TextLayer *text_layer; int stress_...
(status, sizeof(status), "%d / %d %s", iter, tot, failed ? "Failed Out" : "Complete")
; text_layer_set_text(stress_data.text_layer, (char *)status); } static void app_timer_cb(void *data) { static const int num_stress_iters = 1000; struct Region region = s_flash_regions[2]; PBL_LOG(LOG_LEVEL_INFO, ">>>> %s %d", "Test Loop", stress_data.stress_iteration); PBL_LOG(LOG_LEVEL_INFO, "Erasing 0x%l...
/* * 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...
cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_assign-expect.8bit.pbi"))
------------------------------------------------------------------------------ static void prv_send_next_packets(PPoGATTClient *client) { uint16_t payload_size = 0; const PPoGATTPacket *packet = NULL; PPoGATTPacket *heap_packet = NULL; // Cap the number of times we loop here, to avoid blocking the task for to...
{ return ((PPoGATTClient *)transport)->destination; }
bool ppogatt_has_client_for_uuid(const Uuid *uuid) { return (prv_find_client_with_uuid(uuid) != NULL); } uint32_t ppogatt_client_count(void) { return list_count((ListNode *) s_ppogatt_head); } void ppogatt_trigger_rx_ack_send_timeout(void) { PPoGATTClient *client = s_ppogatt_head; while (client) { rx_ac...
ty_state.sample_collection_session_id++; s_activity_state.sample_collection_seconds = rtc_get_time(); s_activity_state.sample_collection_num_samples = 0; s_activity_state.sample_collection_enabled = true; } if (disable && s_activity_state.sample_collection_enabled) { // Finish up the cur...
(file, &key, sizeof(key), history, sizeof(*history))
; activity_private_settings_close(file); } } // ------------------------------------------------------------------------------------------------ // Used by unit tests to init state. Clears all stored data and re-initializes. bool activity_test_reset(bool reset_settings, bool tracking_on, ...
ed_active_kcalories); cl_assert_equal_i(stored_session->step_data.resting_kcalories, ROUND(activity_private_compute_resting_calories(stored_session->length_min), ACTIVITY_CALORIES_PER_KCAL)); cl_assert_equal_b(stored_session->manual, true); cl_assert(stored_session->s...
(bpm, 100)
; // Time forward X seconds prv_inc_time(30); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(bpm, 100); // Time forward X seconds prv_inc_time(30); cl_assert(workout_service_g...
ots = 320, .duration_secs = 5, }, { .min_interval_slots = 480, .max_interval_slots = 620, .duration_secs = 5, }, }; // Schedule job "A": BLEAdData *ad_a = create_ad("A", NULL); GAPLEAdvertisingJobRef job_a; job_a = gap_le_advert_schedule(ad_a, ...
cl_assert_equal_p(job, NULL)
; advert_term.min_interval_slots = 160; advert_term.max_interval_slots = 160; job = gap_le_advert_schedule(ad_scannable, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert(jo...
e License. */ #include "services/normal/notifications/alerts.h" #include "services/normal/notifications/alerts_private.h" #include "clar.h" #include "stdbool.h" // Stubs ///////////////////////////////// #include "stubs_analytics.h" #include "stubs_events.h" #include "stubs_firmware_update.h" #include "stubs_hexdu...
rtc_get_ticks()
+ NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile)); cl_assert(alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_should_vibrate_for_type(AlertReminder)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATIO...
ERT_JS_ERROR(error_value, "TypeError: Not enough arguments"); } void test_rocky_api_util_args__numbers_get_rounded_when_converting_to_integer(void) { struct { double input; int16_t expected_output; } cases[] = { { .input = 0.5, .expected_output = 1, }, { .input = -0.5, ....
jerry_create_number(c->d)
, ); ROCKY_ARGS_ASSIGN( ROCKY_ARG(u8), ROCKY_ARG(u16), ROCKY_ARG(u32), ROCKY_ARG(u64), ROCKY_ARG(s8), ROCKY_ARG(s16), ROCKY_ARG(s32), ROCKY_ARG(s64), ROCKY_ARG(d), ); ASSERT_JS_ERROR(error_value, c->expected_error_msg); if (!c->...
ent(r, &(TouchEvent) { .type = TouchEvent_Touchdown }); cl_assert_equal_i(last_touch_event.type, TouchEvent_Touchdown); cl_assert_equal_b(updated, false); new_state = RecognizerState_Completed; recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_Liftoff }); cl_assert_equal_i(last_touch_event....
NEW_RECOGNIZER(r1)
/* * 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...
(PDCI_SIZE_OFFSET == PDCS_SIZE_OFFSET, "code re-use between PDCI/PDCS requires same file format header")
, 328, -784}, { 224, 344, -840}, { 216, 336, -808}, { 240, 344, -840}, { 240, 344, -792}, { 256, 344, -784}, { 256, 384, -792}, { 256, 360, -720}, { 256, 384, -688}, { 256, 600, -816}, { 248, 440, -448}, { 232, 944, -576}, { 288, 984, -424}, { 296, 848, -272}, { 3...
{ 192, 1256, 200}, { 152, 1056, 416}, { 104, 1192, 344}, // 8 seconds { 40, 896, 296}, { 120, 704, 144}, { 224, 584, 80}, { 264, 576, 200}, { 248, 632, 200}, { -72, 920, 176}, { 72, 1168, 320}, { -8, 1112, 328}, { -32, 1136, 184}, { -56, 920, 248}, { 0, 1224, ...