prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
js_global_get_value("event"); cl_assert_equal_b(true, jerry_value_is_null(event_null)); jerry_release_value(event_null); Layer *l = &app_window_stack_get_top_window()->layer; l->update_proc(l, NULL); const jerry_value_t event = prv_js_global_get_value("event"); cl_assert_equal_b(true, jerry_value_is_object...
(29.5, 39.5)
, lc->fill_radial_precise.center); cl_assert_equal_i(10*8, lc->fill_radial_precise.radius_inner.raw_value); cl_assert_equal_i(30*8, lc->fill_radial_precise.radius_outer.raw_value); cl_assert_equal_i(TRIG_MAX_ANGLE * 1 / 4, lc->fill_radial_precise.angle_start); cl_assert_equal_i(TRIG_MAX_ANGLE * 5 / 4, lc->fill_...
SPI, SPI_I2S_FLAG_BSY)) continue; GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET); } static bool prv_wait_busy(void) { // The display should come out of busy within 35 milliseconds; // it is a waste of time to wait more than twice that. int timeout = 50 * 10; while (display_busy()) { if (timeout-- == 0) ...
(" retries.")
; return; } prv_reset_fpga(); } // It's taken too many attempts and the FPGA still isn't behaving. Give up on // showing the splash screen and keep the screen off so that the user doesn't // see a broken-looking staticky screen on boot. dbgserial_putstr("Display initialization failed."); prv...
nclude "system/bootbits.h" #include "system/logging.h" #include "process_management/app_manager.h" //! @file system_app_state_machine.c //! //! This file implements our app to app flow that makes up our normal shell. It defines //! which app first runs at start up and what app should be launched to replace the current...
{ s_rooted_in_watchface = true; }
// Other app launches don't modify our root so just ignore them. } void system_app_state_machine_panic(void) { if (app_manager_is_initialized()) { app_manager_launch_new_app(&(AppLaunchConfig) { .md = panic_app_get_app_info(), }); } // Else, just wait for the app_manager to initialize to show ...
aded, so we can't convert the entry point's offset into // an address until it's actually been loaded into that address. // Just shove the unmodified offset into the struct and let the // process loader convert it into an absolute address. // TODO: refactor the PebbleProcessMd stuff so that metadata that // i...
version_compare(app_sdk_version, first_4x_version)
/* * 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...
display_error_code(0xbad1ce40)
; delay_ms(200); display_error_code(0xbeefcace); delay_ms(200); display_error_code(0x0defaced); delay_ms(200); display_error_code(0xd15ea5e5); delay_ms(200); display_error_code(0xdeadbeef); delay_ms(200); display_boot_splash(); delay_ms(1000); } } #endif void display_init(...
>val_len); settings_file_set(new_file, &key, info->key_len, data, info->val_len); kernel_free(data); } // ---------------------------------------------------------------------------------------------- // Migrate settings from an earlier version now if necessary static SettingsFile *prv_settings_migrate(Settings...
{ // Save stored activities ActivitySettingsKey key = ActivitySettingsKeyStoredActivities; settings_file_set(file, &key, sizeof(key), s_activity_state.activity_sessions, sizeof(s_activity_state.activity_sessions)); s_activity_state.need_activities_saved = false;...
s_activity_state.update_settings_counter = ACTIVITY_SETTINGS_UPDATE_MIN; } if (file) { activity_private_settings_close(file); } } mutex_unlock_recursive(s_activity_state.mutex); } // ------------------------------------------------------------------------------------------------ // Tail...
et_request(s_characteristics[0][PPoGATTCharacteristicData]); fake_gatt_client_op_assert_no_write(); // Simulate outbound queue having space again: fake_gatt_client_op_set_write_return_value(BTErrnoOK); ppogatt_handle_buffer_empty(); // Expect Reset Complete to be sent out, but nothing more than that: prv_...
(NULL, ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid))
e_size); cl_assert(pfs_close(fd) == S_SUCCESS); } free(bigbuf); // now read back the large files curr = 0; for (int i = 0; i < 2; i++) { snprintf(file_large, sizeof(file_large), "large%d", i); int fd = pfs_open(file_large, OP_FLAG_READ, 0, 0); cl_assert(fd >= 0); size_t sz = pfs_get_file_...
pfs_remove(name)
, S_SUCCESS); } } } void test_pfs__active_in_region(void) { cl_assert(pfs_active_in_region(0, pfs_get_size())); } void test_pfs__get_size(void) { cl_assert(pfs_get_size() == (ftl_get_size() - SECTOR_SIZE_BYTES)); } void test_pfs__migration(void) { // reset the flash fake_spi_flash_cleanup(); fake_spi...
/* * 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...
(ctx, GPoint(15, -5))
k.h" #include "stubs_gap_le_advert.h" #include "stubs_bluetooth_analytics.h" #include "stubs_gatt_client_discovery.h" #include "stubs_gatt_client_subscriptions.h" #include "stubs_hexdump.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pebble_pairing_service.h" #include ...
gap_le_connection_is_connected(device)
, false); } static void prv_assert_client_event(const BTDeviceInternal *device, bool connected, PebbleTaskBitset client_tasks, uint8_t hci_reason) { // Verify the Pebble event: PebbleEvent event = fake_event...
ListLiteral("Pace\0Run duration\0Calories burned\0Distance"); static StringList values = StringListLiteral("7:45\0" "30M\0" "8384\0" "3.3 miles"); attribute_list_add_string_list(&list, AttributeIdMetricNames, &names); attribute_list_add_string_list(&list, AttributeIdMetricValues, &values); attribute_list_add_ui...
prv_add_notification(-1)
/* * 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...
{ for (size_t i = 0; i < size; ++i) { if (codepoints[i] >= codepoint) { return (codepoints[i] == codepoint); } } return false; }
as_resource(TEST_IMAGES_PATH, GET_APNG_NAME); cl_assert(resource_id != UINT32_MAX); GRect orig_bounds = GRect(0, 0, 180, 180); int xshift = 71; int yshift = 39; GRect shift_bounds = GRect(xshift, yshift, orig_bounds.size.w - xshift, orig_bounds.size.h...
(bitmap, filename_buffer)
); } }
MAX(reminder_stale_time, event_stale_time); const time_t now = rtc_get_time(); if (stale_time <= now && window_data->is_modal) { PBL_LOG(LOG_LEVEL_INFO, "Removing stale reminder from notification popup window"); prv_remove_notification(window_data, id, true /* close am */); } } static void prv_clear_st...
{ NotificationWindowData *window_data = (NotificationWindowData *) action_menu_item->action_data; TimelineItem *item = prv_get_current_notification(window_data); // Snooze reminder. // It's highly unlikely we'll get E_INVALID_OPERATION based on the snooze logic parameters. if (reminders_snooze((Reminder *) i...
static void prv_push_muted_dialog(void) { SimpleDialog *simple_dialog = simple_dialog_create("Muted"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); const char *msg = i18n_get("Muted", dialog); dialog_set_text(dialog, msg); dialog_set_icon(dialog, RESOURCE_ID_RESULT_MUTE_LARGE); dialog_set_ti...
MMY_CHUNK(); EXPECT_OUTBOX_RESET_REQUEST(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaitingResetCompleteLocalInitiated); // Receive yet another chunk in "Awaiting Reset Complete Local Initiated": RCV_DUMMY_CHUNK(); // https://pebbletechnology.atlassian.net/...
prv_rcv_app_message_ack(APP_MSG_OK)
; cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaitingResetCompleteRemoteInitiated); RCV_RESET_COMPLETE(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateSessionOpen); } void test_rocky_api_app_message__postmessageconnected_and_postmessagedisco...
]; for (int y = 0; y < HEIGHT; ++y) { for (int x = 0; x < WIDTH; ++x) { snprintf(print_buf, sizeof(print_buf), "Failed index = %d, %d", x, 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]), p...
(prv_check_source_stripe_blit(dest_bitmap_data, &s_bmp, GColorWhite))
; } static void prv_4bit_simple(GCompOp compositing_mode, GColor color, bool transparent) { const int BITS_PER_PIXEL = 4; const int PIXELS_PER_BYTE = (8 / BITS_PER_PIXEL); const int WIDTH = 16; const int HEIGHT = 16; const int ROW_STRIDE = (WIDTH + (PIXELS_PER_BYTE - 1)) / PIXELS_PER_BYTE; uint8_t s_data[...
y_len != sizeof(AppInstallId))) { return true; // continue iterating } struct AppDBInitData *data = context; AppInstallId app_id; info->get_key(file, (uint8_t *)&app_id, sizeof(AppInstallId)); data->max_id = MAX(data->max_id, app_id); data->num_apps++; return true; // continue iterating } struct ...
(sizeof(AppDBEntry))
; EnumerateData cb_data = { .cb = cb, .data = data, .entry_buf = db_entry, }; settings_file_each(&s_app_db.settings_file, prv_enumerate_entries, &cb_data); prv_close_file_and_unlock_mutex(); kernel_free(db_entry); return; } ///////////////////////// // Blob DB API ///////////////////////// v...
ke_progress_percent, 0, MAX_PROGRESS_PERCENT); } void progress_window_set_progress(ProgressWindow *window, int16_t progress) { if (window->state == ProgressWindowState_FakeProgress) { // We've seen our first bit of real progress, stop faking it. prv_cancel_fake_progress_timer(window); window->state = Pro...
{ if (window) { progress_window_pop(window); } progress_window_deinit(window); applib_free(window); }
= action; } } } // Snooze is not needed for Reminders App items Uuid items_originator_id; timeline_get_originator_id(item, &items_originator_id); const bool has_snooze_action = ((item->header.type == TimelineItemTypeReminder) && !uuid_equal(&(Uuid)UUID_REMINDERS_DATA_SOURCE, ...
{ const uint8_t number_mute_actions = 3; ActionMenuLevel *mute_level = action_menu_level_create(number_mute_actions); action_menu_level_add_child(root_level, mute_level, mute_label_buf); action_menu_level_add_action(mute_level...
ios_notif_pref_db_free_prefs(notif_prefs); } if (has_dismiss_all_action) { action_menu_level_add_action(root_level, i18n_get("Dismiss All", root_level), prv_dismiss_all_action_cb, window_data); } if (ha...
and //! version of each log page for validity. If any header looks completely bogus, //! we format the log region to put us back into a known state //! //! @return addr of the first active section static uint32_t prv_validate_flash_log_region(uint8_t *first_log_file_id) { uint32_t first_used_region = UINT32_MAX; f...
(first_used_region, offset)
; FlashLoggingHeader hdr; flash_read_bytes((uint8_t *)&hdr, flash_addr, sizeof(hdr)); if (prv_flash_log_valid(&hdr)) { // we use serial distance to find the gap in the numbering int32_t dist = serial_distance(prev_log_id, hdr.log_file_id, LOG_ID_BITWIDTH); if ((dist == 0) || (di...
e parser static const struct { const char *instr; time_t intime; const char *expect_str; time_t expect_time; bool expect_rv; TemplateStringErrorStatus expect_status; size_t expect_index; } s_full_tests[] = { { "Basicist test~", 1000000000, "Basicist test~", 0, true, }, { "\\\\\\", 10000...
if (err.status >= TemplateStringErrorStatusCount) { printf("Invalid status code\n"); } else { printf("%s\n", s_error_strings[err.status]); }
} printf("\n"); #endif cl_assert_equal_s(s_output, s_full_tests[i].expect_str); cl_assert_equal_i(rv, s_full_tests[i].expect_rv); cl_assert_equal_i(cond.eval_time, s_full_tests[i].expect_time); if (cond.eval_time != 0) { cl_assert_equal_b(cond.force_eval_on_time, true); } else { ...
/* * 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...
(buffer, *size_in_out)
handlers(seq, handlers, seq); // Play it prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); prv_advance_to_ms_with_timers(start_ms + total_duration + 5 * MIN_FRAME_INTERVAL_MS); // Make sure neither inner_seq, a, nor b played cl_assert_equal_i(prv_count_handler_...
(prv_count_handler_entries(&s_started_handler_calls, a), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 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_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0...
return rv; } static HcProtocolMessageHandler prv_get_handler_for_endpoint_id(HcEndpointID endpoint_id) { if (endpoint_id >= HcEndpointIDCount) { return NULL; } return g_hc_protocol_endpoints_table[endpoint_id]; } static void prv_dispatch_message_to_static_handler(HcProtocolMessage *message, bool *should_f...
vTaskDelay(2)
; } // At this point it should no longer be possible for someone to use the retry // semaphore so delete it SemaphoreHandle_t s_retry_semph_tmp = s_retry_semph; s_retry_semph = NULL; vSemaphoreDelete(s_retry_semph_tmp); prv_lock(); HcExpectation *expectation = s_expectations_head; while (expectation...
GDrawCommandList *list) { if (data->list_copy && (gdraw_command_list_get_data_size(data->list_copy) >= gdraw_command_list_get_data_size(list))) { return data->list_copy; } prv_free_list_copy(data); data->list_copy = gdraw_command_list_clone(list); return data->list_copy; } ...
graphics_context_move_draw_box(ctx, offset)
{ 1432, 328, -112}, { 1640, 280, -96}, { 1408, 144, -32}, { 1120, -64, -64}, { 656, -240, -32}, { 1016, -136, -136}, { 752, -248, 64}, { 1152, 184, -304}, { 1216, 104, -136}, { 1112, 216, -224}, { 1000, 136, -200}, { 1040, 312, -224}, { 1312, 400, -248}, { 1648, 584, ...
{ 1272, 936, -488}, { 912, 1080, -376}, { 768, 1360, -296}, // 94 seconds { 808, 808, -160}, { 984, 880, -176}, { 1240, 712, -56}, { 1352, 624, -72}, { 1224, 400, -56}, { 1192, 368, -64}, { 1360, 344, -144}, { 1728, 280, -152}, { 1616, 168, -136}, { 1632, 128, -20...
{ 1232, 88, -224}, { 1248, 352, -360}, { 1280, 136, -208}, { 1408, 376, -176}, { 1608, 704, -200}, { 1704, 840, -256}, { 1520, 888, -168}, { 1144, 1080, -176}, { 752, 1216, -208}, { 760, 1224, -96}, { 880, 896, -80}, { 1096, 872, -96}, { 1376, 744, -80}, // 97 se...
//////////////////////////////////////////////////////////////////////////////////////////////////// // Test pipeline parser static const struct { const char *instr; time_t intime; const char *expect_str; time_t expect_time; bool expect_rv; TemplateStringErrorStatus expect_status; size_t expect_index; }...
printf("%*s^\n", (int)err.index_in_string + 1, "")
; if (err.status >= TemplateStringErrorStatusCount) { printf("Invalid status code\n"); } else { printf("%s\n", s_error_strings[err.status]); } } printf("\n"); #endif cl_assert_equal_s(s_output, s_full_tests[i].expect_str); cl_assert_equal_i(rv, s_full_tests[i].expect_r...
= 33142, })); // clamps value that goes into the future const time_t first_valid_time = time_util_get_midnight_of(now - (ACTIVITY_HISTORY_DAYS - 1) * SECONDS_PER_DAY); result = prv_calculate_time_range(first_valid_time - 12, first_valid_time + 13, &range); cl_assert_e...
cl_assert_equal_i(values[1], 1000); cl_assert_equal_i(values[2], 1000); // ensure we can handle empty ranges range.num_days = 0; prv_adjust_value_boundaries(values, ARRAY_LENGTH(values), &range); cl_assert_equal_i(values[0], 1000); cl_assert_equal_i(values[1], 1000); cl_assert_equal_i(values[2], 1000);...
void test_health__sum_fraction_days(void) { // use values structured as binary mask so we can detect if we sum up currect days s_sys_activity_get_metric_values.out.history[0] = 1000; s_sys_activity_get_metric_values.out.history[1] = 2000; s_sys_activity_get_metric_values.out.history[2] = 4000; s_sys_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...
if (metric == ActivityMetricLastVMC) { *history = s_last_vmc; return true; }
cl_assert(false); return false; } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Helper Functions static void prv_set_time(time_t day, int hour, int minute) { s_current_day = day; s_current_hour = hour; s_current_minute = minute; rtc_set_time(day ...
--------------------- // Test getting the sleep sessions void test_activity__get_sleep_sessions(void) { int32_t value; // Start activity tracking. This method assumes it can be called from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_tracking(false /*test_mode...
{ printf("\nRecord:%d, steps: %d", j, (int)received_records[j].steps); }
// Verify the contents of the records for (int j = 0; j < num_records; j++) { cl_assert_equal_i(received_records[j].steps, (start_time + (j * SECONDS_PER_MINUTE)) % 255); } // Advance another minute. rtc_set_time(utc_sec + (i * SECONDS_PER_MINUTE)); } } // ------...
("var model = _rocky.watchInfo.model")
; ASSERT_JS_GLOBAL_EQUALS_S("model", "qemu_platform_basalt"); } void test_rocky_api_watchinfo__language(void) { rocky_global_init(s_watchinfo_api); EXECUTE_SCRIPT("var language = _rocky.watchInfo.language"); ASSERT_JS_GLOBAL_EQUALS_S("language", TEST_LOCALE); } void test_rocky_api_watchinfo__platform(void) {...
nclude "kernel/util/sleep.h" #include "services/common/bluetooth/bt_compliance_tests.h" #include "services/common/new_timer/new_timer.h" #include "services/common/system_task.h" #include "system/passert.h" #include "system/reboot_reason.h" #include "system/reset.h" EventServiceInfo bt_state_change_event_info; typedef...
window_set_overrides_back_button(window, true)
/* * 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 (feed_watchdog) { task_watchdog_bit_set(pebble_task_get_current()); }
} static void prv_erase_optimal_range(uint32_t min_start, uint32_t max_start, uint32_t min_end, uint32_t max_end, bool feed_watchdog) { PBL_LOG(LOG_LEVEL_DEBUG, "flash_region_erase_optimal_range, 0x%"PRIx32" 0x%"PRIx32" 0x%"PRIx32" 0x%"PRIx32, min_start, max_start, min_end,...
/* * 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...
bma255_query_whoami()
) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to query BMA255"); return; } const bool pass = bma255_selftest(); if (pass) { PBL_LOG(LOG_LEVEL_DEBUG, "BMA255 self test pass, all 3 axis"); } else { PBL_LOG(LOG_LEVEL_ERROR, "BMA255 self test failed one or more axis"); } // Workaround to fix FIFO Frame ...
do_not_disturb_set_manually_enabled(true)
; enabled = do_not_disturb_is_manually_enabled(); cl_assert(enabled == true); cl_assert(do_not_disturb_is_active() == true); prv_assert_manually_dnd_setting_val(true); cl_assert_equal_i(s_num_dnd_events_put, 1); do_not_disturb_set_manually_enabled(false); enabled = do_not_disturb_is_manually_enabled(); ...
/* * 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...
display_error_code(0xdeadbeef)
; delay_ms(200); display_boot_splash(); delay_ms(1000); } } #endif void display_init(void) { display_start(); if (!prv_reset_fpga()) { dbgserial_putstr("FPGA configuration failed."); return; } // enable the power rails display_power_enable(); // start with the screen off prv_scree...
/* * 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...
(structured_glance)
; return NULL_SAFE_FIELD_ACCESS(workout_glance, icon, NULL); } static const char *prv_get_title(LauncherAppGlanceStructured *structured_glance) { LauncherAppGlanceWorkout *workout_glance = launcher_app_glance_structured_get_data(structured_glance); return NULL_SAFE_FIELD_ACCESS(workout_glance, title, 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...
(old_head)
; old_head = NULL; } } static void prv_add_alarm_to_list(AlarmId id, const AlarmInfo *info, void *callback_context) { AlarmsAppData *data = (AlarmsAppData *)callback_context; AlarmNode *new_node = task_malloc_check(sizeof(AlarmNode)); list_init((ListNode*) new_node); new_node->id = id; new_node->info ...
/* * 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...
(&rons_birthday)
/* * 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...
(args, animation_c)
; Animation *animation = prv_create_from_vararg(animation_a, animation_b, animation_c, args); va_end(args); return animation; } Animation *WEAK animation_spawn_create_from_array(Animation **animation_array, uint32_t array_len) { return prv_create_from_array(ani...
_update_proc(&layer, &across_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_y_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tre...
graphics_context_set_fill_color(&ctx, GColorRed)
; ctx.draw_state.fill_color.a = 0; graphics_fill_rect(&ctx, &GRect(20, 20, 70, 20)); ctx.draw_state.fill_color.a = 1; graphics_fill_rect(&ctx, &GRect(20, 50, 70, 20)); ctx.draw_state.fill_color.a = 2; graphics_fill_rect(&ctx, &GRect(20, 80, 70, 20)); ctx.draw_state.fill_color.a = 3; graphics_fill_rect(&...
ND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "gpath.h" #include "graphics.h" #include "graphics_private.h" #include "applib/applib_malloc.auto.h" #include "applib/app_logging.h" #include "system/logging.h" #includ...
gpath_draw_stroke(ctx, path, true)
; } void gpath_draw_stroke(GContext* ctx, GPath* path, bool open) { if (!path || path->num_points < 2) { return; } // for each line segment (do not draw line returning to the first point if open is true) for (uint32_t i = 0; i < (open ? (path->num_points - 1) : path->num_points); ++i) { int i2 = (i + 1...
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 "template_string.h" #include "template_string_private.h" #include "services/common/i18n/i18n.h" #include ...
if (*state->position == '<') { *cond = PredicateCondition_L; } else if (*state->position == '>') { *cond = PredicateCondition_G; } else { WTF; }
state->position++; if (*state->position == '=') { (*cond)++; state->position++; } else if (!isdigit(*state->position)) { state->error->status = TemplateStringErrorStatus_InvalidTimeUnit; return false; } *value = prv_template_predicate_time(state); if (state->error->status != TemplateStrin...
render, GSize *size_out, void *user_data) { WorkoutActiveWindow *active_window = user_data; GRect bounds = gbitmap_get_bounds(active_window->heart_icon); bounds.origin = box->origin; prv_draw_heart_icon(ctx, active_window->heart_icon, &bounds, render, size_out); } stati...
PBL_IF_RECT_ELSE(35, 41)
; } else if (active_window->layout == WorkoutLayout_StaticAndScrollable) { rect.origin.y = prefer_larger_font ? PBL_IF_RECT_ELSE(2, 13) : PBL_IF_RECT_ELSE(5, 1); } else if (active_window->layout == WorkoutLayout_TwoStaticAndScrollable) { rect.origin.y = (&active_window->scrollable_metric_layer == layer) ? ...
/* * 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...
IRQ_MAP(I2C4_ER, i2c_hal_error_irq_handler, &I2C_PMIC_MAG_BUS)
; void board_init(void) { i2c_init(&I2C_PMIC_MAG_BUS); }
/* * 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...
uuid_equal(&md->uuid, &app_process->uuid)
) { return APP_WORKER_RESULT_ALREADY_RUNNING; } // We have to get confirmation first that it is OK to launch the new worker launcher_task_add_callback(prv_switch_worker, (void *) install_id); return APP_WORKER_RESULT_ASKING_CONFIRMATION; } worker_manager_put_launch_worker_event(install_id); ...
cl_assert_equal_s(buffer, ""); cl_assert_equal_i(mfg_info_get_disp_offsets().x, 0); cl_assert_equal_i(mfg_info_get_disp_offsets().y, 0); // Set x and y offsets and make sure others don't change. mfg_info_set_disp_offsets((GPoint) {-2, 1}); cl_assert_equal_i(mfg_info_get_disp_offsets().x, -2); cl_ass...
flash_read_bytes(fpga_buffer, BOOT_FPGA_FLASH_ADDR, sizeof(fpga_buffer))
; const int16_t y_offset = 1; const int16_t padding = r.size.w / 6; const uint16_t corner_radius = 4; GRect bg_rect = r; bg_rect.origin.y = layer_bounds->origin.y; bg_rect.size.h = layer_bounds->size.h; bg_rect = grect_inset_internal(bg_rect, padding, y_offset); graphics...
{ animation_unschedule(aml->item_animation.animation); aml->item_animation.animation = NULL; }
static void prv_animate_cell(ActionMenuLayer *aml, GRect *label_text_frame, bool *draw_top_shading, bool *draw_bottom_shading) { // Check to see if this item spans more than max number of visible lines, // in which case we want to make it scroll. const int16_t item_height = aml->lay...
mutex_unlock_recursive(s_accel_manager_mutex); } #ifdef TEST_KERNEL_SUBSCRIPTION static void prv_kernel_data_subscription_handler(AccelData *accel_data, uint32_t num_samples) { PBL_LOG(LOG_LEVEL_INFO, "Received %" PRIu32 " accel samples for KernelMain.", num_samples); } static void prv_kernel_tap_subscription...
(sizeof(AccelManagerState))
; *state = (AccelManagerState) { .task = handler_task, .data_cb_handler = data_cb, .data_cb_context = context, .sampling_interval_us = (US_PER_SECOND / rate), .samples_per_update = ACCEL_MAX_SAMPLES_PER_UPDATE, }; bool no_subscribers_before = (s_data_subscribers == NULL); ...
key[4]; int key_len = sizeof(key) - 1; memcpy(key, "key", sizeof(key)); uint8_t val[7]; int val_len = 6; printf("Setting key 10 times and verifying we get the same value back...\n"); for (int i = 0; i < 10; i++) { snprintf((char *)val, 7, "val%03d", i); printf("Iteration %d val %s\n", i, val); ...
(file.used_space, file_copy.used_space)
tionUpdateImplementation) prv_complex_animation_update, }; // ------------------------------------------------------------------------------------------- static Animation *prv_complex_init(Animation *parent_h, Animation **animation_array, uint32_t array_len, AnimationType type) { A...
(children, num_children, from->type)
; clone = prv_find_animation_by_handle(state, clone_h, false /*quiet*/); } if (!clone) { for (int i = 0; i < num_children; i++) { animation_destroy(children[i]); } return NULL; } } else { if (from->is_property_animation) { PropertyAnimationPrivate *prop = propert...
MINUTE); cl_assert(workout_service_start_workout(ActivitySessionType_Run)); // Workout of 30 seconds duration. Should be invalid, not keep HR on after leaving prv_inc_time(30); cl_assert(workout_service_stop_workout()); workout_service_frontend_closed(); cl_assert_equal_b(s_hrm_subscribed, false); cl_ass...
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 0)
; cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 10); prv_inc_time(10); prv_put_bpm_event(ZONE_0_HR, HRMQuality_Good); cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s)); cl...
); cl_assert(memcmp(out_buffer, (uint8_t*) "56789", 5) == 0); cl_assert(shared_circular_buffer_consume(&buffer, &client, 5)); // Get the rest of the wrapped read cl_assert(shared_circular_buffer_read(&buffer, &client, 1, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 1); cl_assert(memcmp(out_buf...
(memcmp(out_buffer, "def", 3) == 0)
; cl_assert(shared_circular_buffer_consume(&buffer, &client1, 3)); cl_assert(shared_circular_buffer_read(&buffer, &client1, 2, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 2); cl_assert(memcmp(out_buffer, "gh", 2) == 0); cl_assert(shared_circular_buffer_consume(&buffer, &client1, 2)); cl_asse...
es) == num_bytes; } //! Note! This count includes rule 0 which isn't actually stored in the database. static int prv_get_dst_rule_count(void) { uint16_t dst_rule_count; prv_database_read(offsetof(TimezoneDatabaseFlashHeader, dst_rule_count), &dst_rule_count, sizeof(dst_rule_count)); return ds...
prv_database_read(dst_rule_pair_offset, start, DST_RULE_BYTES)
|| !prv_database_read(dst_rule_pair_offset + DST_RULE_BYTES, end, DST_RULE_BYTES)) { PBL_LOG(LOG_LEVEL_WARNING, "Failed to load timezone for DST ID %"PRIu8, dst_id); return false; } if (start->ds_label == '\0' || end->ds_label == '\0') { // Does not observe DST return false; } return tr...
// No record found return false; } static status_t cleanup_partial_transactions(SettingsFile *file) { for (settings_raw_iter_begin(&file->iter); !settings_raw_iter_end(&file->iter); settings_raw_iter_next(&file->iter)) { if (partially_written(&file->iter.hdr)) { // Compact will remove partially wr...
if (key_len > SETTINGS_KEY_MAX_LEN) { return E_RANGE; }
/* * 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...
{ MpuRegion region = mpu_get_region(i); if (!region.enabled) { PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, sizeof(buffer), "%u Not enabled", i); continue; } PBL_LOG_FROM_FAULT_HANDLER_FMT( buffer, sizeof(buffer), "%u < %-22s>: Addr %p Size 0x%08"PRIx32" Priv: %c%c User: %c%c", ...
} #ifdef UNITTEST static const uint32_t __privileged_functions_start__ = 0; static const uint32_t __privileged_functions_size__ = 0; static const uint32_t __unpriv_ro_bss_start__ = 0; static const uint32_t __unpriv_ro_bss_size__ = 0; static const uint32_t __isr_stack_start__ = 0; static const uint32_t __stack_guard_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...
(ctx, GColorBlack)
#include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "process_management/app_manager.h" #include "process_state/app_state/app_state.h" #include "system/logging.h" #include <limits.h> struct AppState { Window window; ScrollLayer scroll_layer; TextLayer text; }; static GFont s_system_font; static GFo...
(FONT_KEY_GOTHIC_14)
; s_fonts[1] = fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD); s_fonts[2] = fonts_get_system_font(FONT_KEY_GOTHIC_18); s_fonts[3] = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD); s_fonts[4] = fonts_get_system_font(FONT_KEY_GOTHIC_24); s_fonts[5] = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD); s_fonts[6] ...
60Hz clock which is used for VCOM. // This setting is a divisor of 16 and a high/low duration of 195us, as // given in the following: 1000000 / (16 * 195 * 2) = ~160Hz static void prv_start_160hz_clock(void) { const uint8_t pwm_high_low_time_us = (195 - 1); prv_write_register(PmicRegisters_PWM_CNTL_H, pwm_high_low_...
prv_configure_battery_measure()
; prv_configure_interrupts(); prv_configure_charging(); // Override OTP setting for 'onkey_lpress_ reset=1' so that we shutdown instead of triggering a // reset on a long button hold prv_set_register_bit(PmicRegisters_REFERENCE_CNTL, 5, false); return true; } // On the as3701b, a power_off will cut power...
er_seconds, exit_seconds, total_seconds - deviate_seconds, total_seconds, &uuid); uuid = UUID_INVALID; prv_push_sleep_summary_pin(now_utc, exit_utc, enter_seconds, exit_seconds, total_seconds - 3 * deviate_seconds, total_seconds, &uuid); if (activity_prefs...
{ const time_t now_utc = rtc_get_time(); const int length_min = MINUTES_PER_HOUR + MINUTES_PER_HOUR / 2; ActivitySession session = { .type = ActivitySessionType_Nap, .start_utc = now_utc - length_min * SECONDS_PER_MINUTE, .length_min = length_min, }; prv_push_nap_session(now_utc, &session); }
y, '_') != NULL; // invalid key } static bool prv_value_is_valid(const uint8_t *key, int key_len, const uint8_t *val, int val_len) { return val_len && val_len % sizeof(uint32_t) == 0; } static bool prv_is_last_processed_tim...
snprintf(key, HEALTH_DB_MAX_KEY_LEN, "%s%s", WEEKDAY_NAMES[day], SLEEP_DATA_KEY_SUFFIX)
; const int key_len = strlen(key); SettingsFile file; if (prv_file_open_and_lock(&file) != S_SUCCESS) { return false; } // We cheat a bit here because the only typical values we store are sleep related SleepData data; status_t s = settings_file_get(&file, key, key_len, (uint8_t *)&data, sizeof(data...
rocess_event_queue = s_to_app_event_queue; // Init services required for this process before it starts to execute process_manager_process_setup(PebbleTask_App); char task_name[configMAX_TASK_NAME_LEN]; snprintf(task_name, sizeof(task_name), "App <%s>", process_metadata_get_name(s_app_task_context.app_md)); ...
simple_dialog_get_dialog(crash_dialog)
; const char *text_fmt = i18n_get("%.*s is not responding", crash_dialog); unsigned int name_len = 15; char text[DIALOG_MAX_MESSAGE_LEN]; sniprintf(text, DIALOG_MAX_MESSAGE_LEN, text_fmt, name_len, entry.name); dialog_set_text(dialog, text); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_WARNING_LARGE); dia...
DEFINE_SYSCALL(int, persist_read_data, const uint32_t key, void *buffer, const size_t buffer_size)
{ if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(buffer, buffer_size); } LOCK_AND_GET_STORE(store); const int len = settings_file_get_len(store, &key, sizeof(key)); if (len == 0) { return E_DOES_NOT_EXIST; } else if (FAILED(len)) { RETURN_STATUS_UP(len); } const size_t rest...
e previously //! crashed. //! //! Files are referred to in multiple ways. The "file generation" is how recent the file is. 0 is the generation of the current //! boot, 1 is the generation of the previous boot, and so on. The "file index" is which physical slot the file is in. File index //! 0 has the lowest address in ...
(file_id[i - 1])
; *current_file_index = i; return; } } } // Everything was increasing which means everything was in order from oldest to newest // and we need to wrap around. *current_file_index = 0; *current_file_id = get_next_file_id(file_id[DEBUG_DB_NUM_FILES - 1]); } void debug_db_init(void) {...
/* * 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...
(entry->key)
; kernel_free(entry->val); kernel_free(entry); } status_t ram_storage_insert(RamStorage *storage, const uint8_t *key, int key_len, const uint8_t *val, int val_len) { // delete entry if it already exists RamStorageEntry *entry = prv_get_entry(storage->entries, key, key_len); if (entry) { prv_delete(&s...
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. * See the License for the specific language governing p...
_Static_assert(offsetof(Window, layer) == 0, "")
; _Static_assert(offsetof(NumberWindow, window) == 0, ""); NumberWindow *nw = (NumberWindow*) layer; graphics_context_set_text_color(ctx, GColorBlack); GRect frame = prv_get_text_frame(layer); frame.size.h = 54; TextLayoutExtended cached_label_layout = {}; graphics_draw_text(ctx, nw->label, fonts_get_s...
_call(s_graphics_line_draw_precise_stroked) { .ctx = ctx, .pp0 = p0, .pp1 = p1, }; } void graphics_draw_line(GContext* ctx, GPoint p0, GPoint p1) { // TODO: remove me PBL-42458 (still used for drawing arc) record_mock_call(s_graphics_line_draw_precise_stroked) {.ctx = ctx}; } MockCallRecordings s_graphics_d...
cl_assert_equal_i(1, s_graphics_line_draw_precise_stroked.call_count)
; cl_assert_equal_point_precise(PP(0.5, 1.5), s_graphics_line_draw_precise_stroked.last_call.pp0); cl_assert_equal_point_precise(PP(3, -5), s_graphics_line_draw_precise_stroked.last_call.pp1); EXECUTE_SCRIPT( "ctx.fill();\n" ); cl_assert_equal_i(0, s_gpath_draw_filled.call_count); } void test_rocky_api...
ming out static bool prv_wait_int_low(HRMDevice *dev) { const int max_attempts = 2000; int attempt; for (attempt = 0; attempt < max_attempts; attempt++) { if (!gpio_input_read(&dev->int_gpio)) { break; } system_task_watchdog_feed(); psleep(1); } return (attempt < max_attempts); } // Wai...
{ system_task_add_callback(prv_watchdog_timer_system_cb, (void *)dev); }
if (s_missing_interrupt_count > 1) { PBL_LOG(LOG_LEVEL_DEBUG, "Missing interrupt count: %"PRIu8" ", s_missing_interrupt_count); } } // Enable the watchdog timer. This gets enabled when we enable the sensor and detects if // the sensor stops generating interrupts. static void prv_enable_watchdog(HRMDevice *dev...
/* * 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 (angle % QUADRANT_ANGLE == 0) { radius_x <<= FIXED_S16_3_PRECISION; radius_y <<= FIXED_S16_3_PRECISION; switch (angle / QUADRANT_ANGLE) { case 0: return GPointPrecise(center.x.raw_value, center.y.raw_value - radius_y); case 1: return GPointPrecise(center.x.raw_value + radius_x, c...
Y, true, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_c...
(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_clip_xy.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 11); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__origin_...
----------------- void test_ble_ad_parse__ad_and_scan_resp_boundaries(void) { } void test_ble_ad_parse__start_scan_response(void) { BLEAdData *ad = ble_ad_create(); ble_ad_start_scan_response(ad); uint8_t expected_scan_resp_data[] = { 1 /* +1 for Type byte */ + strlen("Pebble 1234"), 0x09, // Local Nam...
cl_assert_equal_b(ble_ad_set_service_uuids(ad, uuid, 14), true)
; ble_ad_destroy(ad); // 15x 16-bit UUIDs does not fit, expect false: ad = ble_ad_create(); cl_assert_equal_b(ble_ad_set_service_uuids(ad, uuid, 15), false); ble_ad_destroy(ad); } void test_ble_ad_parse__set_local_name(void) { BLEAdData *ad; ad = ble_ad_create(); uint8_t expected_ad_data[] = { 1 ...
gin_center, radius, (TRIG_MAX_ANGLE * 3 / 4)); cl_assert_equal_gpoint(result, GPoint(-5, 0)); const GPoint offset_center = GPoint(1, 1); // 90 degrees should be (6, 1) result = gpoint_from_polar_internal(&offset_center, radius, (TRIG_MAX_ANGLE / 4)); cl_assert_equal_gpoint(result, GPoint(6, 1)); // 270 (90...
grect_centered_internal(&p2, GSize(2, 2))
); // Repeat for a positive offset center point with 0.5 fractions GPointPrecise p3 = GPointPreciseFromGPoint(GPoint(5, 5)); p3.x.raw_value += FIXED_S16_3_HALF.raw_value; p3.y.raw_value += FIXED_S16_3_HALF.raw_value; // GRectZero + standardize cl_assert_equal_grect(GRect(6, 6, 0, 0), grect_centered_intern...
e && pdFAIL == event_queue_cleanup_and_reset(context->to_process_event_queue)) { PBL_LOG(LOG_LEVEL_ERROR, "The to processs queue could not be reset!"); } context->to_process_event_queue = NULL; } // --------------------------------------------------------------------------------------------------------...
(AppLaunchReason, sys_process_get_launch_reason, void)
{ return prv_get_context()->launch_reason; } // ------------------------------------------------------------------------------------------- DEFINE_SYSCALL(ButtonId, sys_process_get_launch_button, void) { return prv_get_context()->launch_button; } // ---------------------------------------------------------------...
r_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); } // Expect "Reset Request" sent by FW: prv_assert_sent_reset_request(s_characteristics[0][PPoGATTCharacteristicData]); } void test_ppogatt__timeout_waiting_for_reset_complete_self_initiated(void) { prv_discover_and_read_meta_and_reset(); // Timeout...
test_ppogatt__open_session_when_found_pebble_app()
; ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicData], NULL, 0, BLEGATTErrorSuccess); // No crash etc, client still alive: cl_assert_equal_i(ppogatt_client_count(), 1); cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid)...
false); // Timer will go off at 01:00 on Saturday. (0.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 1800 * MS_PER_SECOND); rtc_set_time(s_saturday_01_30); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == true); // Timer will go off a...
(active == false)
b, 0, 0x0}, { 0, 0x3b, 11, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, // 495: Local time: 03:07:00 AM { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0...
{ 0, 0x4c, 0, 0x0}, { 0, 0x4c, 0, 0x0}, { 0, 0x6b, 1481, 0x0}, { 0, 0x88, 0, 0x0}, // 615: Local time: 05:07:00 AM { 0, 0x88, 0, 0x0}, { 0, 0x88, 0, 0x0}, { 0, 0x88, 0, 0x0}, { 0, 0x87, 0, 0x0}, { 0, 0x87, 0, 0x0}, { 0, 0x5b, 794, 0x0}, { 0, 0x5b, 0, 0x0}, { 0, 0x5b, ...
{ 0, 0x6b, 0, 0x0}, { 0, 0x6b, 0, 0x0}, { 0, 0x6b, 0, 0x0}, { 0, 0x6b, 0, 0x0}, { 0, 0x6b, 337, 0x0}, { 0, 0x5b, 145, 0x0}, // 675: Local time: 06:06:00 AM { 0, 0x4c, 808, 0x0}, { 0, 0x3c, 0, 0x0}, { 0, 0x3c, 0, 0x0}, { 0, 0x3c, 0, 0x0}, { 0, 0x3c, 350, 0x0}, { 0, 0x...
sh protection #define MIN_PRF_TIMESTAMP_SUPPORTING_PROTECTION (1466531458) //! True if the installed PRF version supports flash protection static bool s_flash_protection_supported = false; bool flash_check_whoami(void) { return qspi_flash_check_whoami(QSPI_FLASH); } FlashAddress flash_impl_get_sector_base_address(...
(QSPI_FLASH, addr, false /* !is_subsector */)
; } status_t flash_impl_blank_check_subsector(FlashAddress addr) { return qspi_flash_blank_check(QSPI_FLASH, addr, true /* is_subsector */); } uint32_t flash_impl_get_typical_sector_erase_duration_ms(void) { return 400; } uint32_t flash_impl_get_typical_subsector_erase_duration_ms(void) { return 40; }
mation_set_duration(b, duration_b); animation_set_delay(b, delay_b); Animation *c = prv_create_test_animation(); animation_set_duration(c, duration_c); animation_set_delay(c, delay_c); Animation *d = prv_create_test_animation(); animation_set_duration(d, duration_d); animation_set_delay(d, delay_d); ...
animation_set_delay(c, delay_a)
; animation_set_auto_destroy(c, auto_destroy); animation_schedule(c); prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); animation_destroy(a); animation_destroy(b); animation_destroy(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...
("test_model")
; cl_assert_equal_i(mfg_info_get_watch_color(), 5); cl_assert_equal_i(mfg_info_get_rtc_freq(), 4); mfg_info_get_model(buffer); cl_assert_equal_s(buffer, "test_model"); } void test_spalding_mfg_info__1_to_3_conversion(void) { // Force in an old data version. typedef struct { uint32_t data_version...
/* * 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...
(bitmap, TEST_PBI_FILE)
); } // Tests 4-bit transparent palettized PBI loading into gbitmap // Result: // - gbitmap matches platform loaded PBI void test_pbi__color_4_bit_transparent(void) { GBitmap *bitmap = setup_pbi_test(TEST_PBI_FILE); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE)); } // Tests 8-bit transparent PBI loading into ...
ces/common/new_timer/new_timer.h" #include "services/common/system_task.h" #include "services/common/system_task.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/notifications/alerts_preferences_private.h" #include "services/normal/settings/settings_file.h" #include <stdint.h> #include <string....
do_not_disturb_init()
; do_not_disturb_set_manually_enabled(false); do_not_disturb_set_schedule_enabled(WeekdaySchedule, false); do_not_disturb_set_schedule_enabled(WeekendSchedule, false); if (do_not_disturb_is_smart_dnd_enabled()) { do_not_disturb_toggle_smart_dnd(); } alerts_preferences_check_and_set_first_use_complete(...
alid. */ if((used) && (free) && (max_free) && (heap->begin)) { heap_lock(heap); prv_calc_totals(heap, used, free, max_free); heap_unlock(heap); } } void heap_init(Heap* const heap, void* start, void* end, bool fuzz_on_free) { UTIL_ASSERT(start && end); // Align the pointer by advancing it to ...
{ memset(ptr, 0xBD, (heap_info_ptr->Size - HEAP_INFO_BLOCK_SIZE(0)) * ALIGNMENT_SIZE); }
#endif // Update metrics #ifdef MALLOC_INSTRUMENTATION heap_info_ptr->pc = client_pc; #endif heap->current_size -= heap_info_ptr->Size * ALIGNMENT_SIZE; /* If the segment to be freed is at the begin of the heap, */ /* then we do not have to merge or update any sizes of the */ /* previous 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...
(&frame->command_list, NULL, NULL)
; } GDrawCommandSequence *gdraw_command_sequence_create_with_resource(uint32_t resource_id) { ResAppNum app_num = sys_get_current_resource_num(); return gdraw_command_sequence_create_with_resource_system(app_num, resource_id); } GDrawCommandSequence *gdraw_command_sequence_create_with_resource_system(ResAppNum ap...
ng GCompOpAssignInverted. const uint32_t icon_id[] = { RESOURCE_ID_ACTION_BAR_ICON_CHECK, RESOURCE_ID_ACTION_BAR_ICON_X }; for (unsigned i = 0; i < ARRAY_LENGTH(icon_id); ++i) { GBitmap tmp; gbitmap_init_with_resource(&tmp, icon_id[i]); GBitmap *icon = gbitmap_create_blank(tmp.bounds.size, tmp.info.f...
bt_pairability_use()
; MfgMenuAppData *data = app_malloc_check(sizeof(MfgMenuAppData)); *data = (MfgMenuAppData){}; app_state_set_user_data(data); data->window = window_create(); window_init(data->window, ""); window_set_window_handlers(data->window, &(WindowHandlers) { .load = prv_window_load, }); window_set_overrid...
/* * 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...
MAX(0, clipped_rect.origin.x - rect.origin.x)
; const int32_t right_cropped_columns_count = MAX(0, rect.size.w - clipped_rect.size.w - left_cropped_columns_count); if (top_cropped_rows_count) { // Skip over rows for each one that's cropped off the top. corner_insets_left >>= 4 * MIN(top_cropped_rows_co...
se; } if (space_needed == 0) { // If no extra space needed, we are done because we successfully opened the file. return true; } // Get the file size size_t file_size = prv_pfs_get_file_size(session->storage.fd); if (file_size == 0) { prv_release_session_file(session); return false; } ...
{ const uint8_t *data_ptr = data; // Write out in chunks while (remaining_bytes > 0) { uint8_t data_chunk_length = MIN(DLS_MAX_CHUNK_SIZE_BYTES, remaining_bytes); // Write the data first, so if an error occurs, the header is left in the uninitialized state if (!prv_pfs_seek(storage->fd, storage->wri...
// ----------------------------------------------------------------------------------------- // Migrate a session's data to a new file, removing already consumed bytes from the front static bool prv_realloc_storage(DataLoggingSession *session, uint32_t new_size) { bool success; uint8_t *tmp_buf = NULL; // Rec...
k; default: WTF; } data->last_session_successful = success; } // Only use stable state for determining how to handle input events and voice service events static VoiceUiState prv_get_simple_state(VoiceUiState state) { static const VoiceUiState state_map[] = { StateStart, StateWaitForReady, ...
ARRAY_LENGTH(VIBE_DURATIONS)
, }; vibes_enqueue_custom_pattern(pattern); } #endif ///////////// CREATE DOT ANIMATIONS static void prv_dot_layer_update_proc(Layer *layer, GContext *ctx) { VoiceUiData *data = window_get_user_data(layer_get_window(layer)); // get frame to place dot in middle of layer graphics_context_set_fill_color(ctx, GC...
opyright 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 in writi...
(layout_ref)
) { clock_get_friendly_date(buffer, config->buffer_size, layout->info->timestamp); } } static GTextNode *prv_card_view_constructor(TimelineLayout *timeline_layout) { static const LayoutNodeTextDynamicConfig s_title_config = { .text.extent.node.type = LayoutNodeType_TextDynamic, .update = prv_title_upda...
/! -100 = backwards at normal rate int32_t playback_rate_percent; //! The current playback state MusicPlayState playback_state; } s_music_ctx; void music_init(void) { s_music_ctx.mutex = mutex_create_recursive(); } static void copy_and_truncate(char *dest, const char *src, size_t src_length) { size_t cropp...
(player_name, player_name_length, o)
; } void music_update_track_title(const char *title, size_t title_length) { off_t o = offsetof(__typeof__(s_music_ctx), title); prv_update_string_and_put_event(title, title_length, o); } void music_update_track_artist(const char *artist, size_t artist_length) { off_t o = offsetof(__typeof__(s_music_ctx), artist...
acy2.h" #include "applib/legacy2/ui/animation_private_legacy2.h" #include "applib/app_logging.h" #include "applib/applib_malloc.auto.h" #include "process_state/app_state/app_state.h" #include "kernel/kernel_applib_state.h" #include "kernel/memory_layout.h" #include "services/common/animation_service.h" #include "s...
list_find(state->scheduled_head, prv_parent_list_filter, &info)
/* * 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...
("Start Time")
, /// Shows up in the Timeline settings as a "Timing" subtitle and submenu option. i18n_noop("5 Min Before"), /// Shows up in the Timeline settings as a "Timing" subtitle and submenu option. i18n_noop("10 Min Before"), /// Shows up in the Timeline settings as a "Timing" subtitle and submenu option. i18n_noo...
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 <stdbool.h> #include <stdint.h> #include <stdio.h> #include <string.h> #include "clar.h" #...
system_flash_erase(FLASH_BASE, 512 KiB, error_in_middle_cb, &countdown)
); cl_assert(flash_locked); cl_assert_(countdown <= 0, "Callback not called enough times"); } void malloc_flash_data(uint32_t size) { flash_data_length = size; flash_written_data = malloc(size * sizeof(uint8_t)); cl_assert(flash_written_data); flash_written_flag = malloc(size * sizeof(bool)); cl_assert(...
app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = install_id, .common.args = (void *)(uintptr_t)launch_code, .common.reason = APP_LAUNCH_TIMELINE_ACTION, })
; PBL_LOG(LOG_LEVEL_INFO, "Opening watch app %s", uuid_buffer); // Wait for the app we just launched to have something to render before hiding all modals. // If we don't we'll end up with flashing in a blank framebuffer. OpenAppContext *ctx = kernel_malloc_check(sizeof(OpenAppContext)); *...
XTENSION_SU tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%C %h", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "20 Jan"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%D %e", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "01/02/15 2"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%n...
cl_assert_equal_i(strftime(tmbuf, 4, "%a ", &jan_2_2015__13_00_00), 0)
; // This is how our current strftime works, so we need to obey... cl_assert_equal_m(tmbuf, "Fri\xFF\xFF", 5); #endif memset(tmbuf, 0xFF, sizeof(tmbuf)); cl_assert_equal_i(strftime(tmbuf, 4, "%a", &jan_2_2015__13_00_00), 3); cl_assert_equal_m(tmbuf, "Fri\x00\xFF", 5); } #if EXTENSION_SU typedef struct { 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...
DIV_X(frame.size.h * (1000 - MULT_X((cur - limit_d), (limit_e - limit_d))))
); } else { // zone e - 0 return GPoint(frame.origin.x + DIV_X(frame.size.w / 2 * MULT_X((cur - limit_e), (total - limit_e))), frame.origin.y); } #elif PBL_ROUND // Simply a calculated point on the circumference const int32_t angle = DIV_X(360 * MULT_X(cur, total)...
_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 1); #endif } static Animation *s_parent_for_sequence_unschedule_from_child; static void prv_unschedule_parent(Animation *animation, bool fini...
(&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_update_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c),...
ble) { NotificationWindowData *data = &s_notification_window_data; if (is_visible == data->dnd_icon_visible) { // nothing to do here return; } const GRect icon_rect = gbitmap_get_bounds(&data->dnd_icon); #if PBL_ROUND GRect new_status_frame = data->status_layer.layer.frame; const int16_t icon_text...
layer_add_child(root_layer, (Layer *)status_layer)
; // bubble on right for action button layer_init(&data->action_button_layer, &data->window.layer.bounds); data->action_button_layer.update_proc = action_button_update_proc; layer_add_child(root_layer, &data->action_button_layer); layer_set_hidden((Layer *)&data->action_button_layer, true); // Ideally th...
ask_watchdog.h" #include "fake_rtc.h" #include "fake_spi_flash.h" // Tests //////////////////////////////////// extern status_t settings_file_compact(SettingsFile *file); void test_settings_file__initialize(void) { fake_spi_flash_init(0, 0x1000000); pfs_init(false); } void test_settings_file__cleanup(void) {} #...
settings_file_open(&file, "test_file_compaction", 2048)
); uint32_t value = 0; static const uint32_t LOOPS = 10; static const uint32_t NUMBER_ENTRIES = 50; // set all keys to 0 for (uint32_t i = 0; i < NUMBER_ENTRIES; i++) { settings_file_set(&file, (uint8_t *)&i, sizeof(uint32_t), (uint8_t *)&value, sizeof(uint32_t)); } for (uint32_t i = 0; i < LOOPS; ...
i/window.h" #include "applib/ui/recognizer/recognizer.h" #include "applib/ui/recognizer/recognizer_impl.h" #include "applib/ui/recognizer/recognizer_list.h" #include "applib/ui/recognizer/recognizer_manager.h" #include "applib/ui/recognizer/recognizer_private.h" #include "util/size.h" // Stubs #include "stubs_app_sta...
{ RecognizerHandled *rec = malloc(sizeof(RecognizerHandled)); cl_assert(rec); *rec = (RecognizerHandled){ .idx = *idx }; *list = list_get_head(list_append(*list, &rec->node)); }
} static bool prv_handle_dummy_touch_event(Recognizer *recognizer, void *unused) { prv_store_recognizer_idx(recognizer, &s_recognizers_handled); return true; } static Recognizer **prv_create_recognizers(int count) { Recognizer **recognizers = malloc(sizeof(Recognizer*) * count); cl_assert(recognizers); for...
/* * 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...
(emx_resources_get_size(1, id_4) == 0)
; ASSERT(s_size_4_called == 1); // add 4 again id_4 = emx_resources_register_custom(custom_res_read_4, custom_res_size_4); ASSERT(emx_resources_get_size(1, id_4) == 4); buf = 0; ASSERT(emx_resources_read(1, id_4, 0, (uint8_t *)&buf, 1) == 4); ASSERT(buf == 4); ASSERT(s_read_4_called == 3); ASSERT(s_s...