prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
enough for a sleep computation to run prv_feed_steps_min(3 * ACTIVITY_SESSION_UPDATE_MIN); // We should have only nap sessions now prv_count_sleep_sessions(test_start_utc, &sleep_count, &nap_count); PBL_LOG(LOG_LEVEL_DEBUG, "Found %d sleep sessions and %d nap sessions", sleep_count, nap_count); if (nap_count...
(ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD, &disabled_settings)
; prv_feed_steps_min(k_num_minutes); activity_insights_settings_write(ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD, &original_settings); activity_prefs_activity_insights_set_enabled(prev_insights_enabled); prv_test_end(context, passed); } // ---------------------------------------------------------------------...
me, sizeof(data->ble_pairing_name)) && prv_field_valid((uint8_t *)&data->pinned_address, sizeof(data->pinned_address)) && prv_field_valid((uint8_t *)&data->local_name, sizeof(data->local_name)) && prv_field_valid((uint8_t *)&data->getting_started, sizeof(data->getting_started)))) { return true;...
{ // Struct that is written is currently unpopulated. Set it up and write // the struct's Magic and Version prv_write_to_current_page(data, true); }
else if ((old_crc == new_crc) && same_data) { // We are trying to write the same data, ignore the write goto cleanup; } else if (old_crc != SPRF_UNWRITTEN_CRC) { // We are writing different data. Clear the field, write the struct again, and later write // the new data in the empty field memset(((...
}; 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.will_change, prv_will_change); const GRect from_area = GRect(0, 0, DISP_COLS, 400); con...
(s_data.num_will_change_calls, 1)
; cl_assert_equal_i(s_data.num_change_calls, 1); cl_assert_equal_i(s_data.last_change_progress, progress); } void test_unobstructed_area_service__did_change(void) { UnobstructedAreaHandlers handlers = { .did_change = prv_did_change, }; app_unobstructed_area_service_subscribe(handlers, s_data.context); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
snprintf(accel_text, sizeof(accel_text), "Accel delta: %"PRIu32, delta)
; APP_LOG(APP_LOG_LEVEL_INFO, accel_text); #else snprintf(accel_text, sizeof(accel_text), "x:%"PRId16 ", y:%"PRId16 ", z:%"PRId16, accel_data.x, accel_data.y, accel_data.z); APP_LOG(APP_LOG_LEVEL_INFO, accel_text); #endif text_layer_set_text(text_layer, accel_text); } void handle_init(void) { // Create...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ GPIO_InitTypeDef init = { .GPIO_Pin = af_config->gpio_pin, .GPIO_Mode = GPIO_Mode_AN, .GPIO_Speed = GPIO_Speed_2MHz, .GPIO_PuPd = GPIO_PuPd_NOPULL }; gpio_use(af_config->gpio); GPIO_Init(af_config->gpio, &init); gpio_release(af_config->gpio); }
void gpio_af_configure_fixed_output(const AfConfig *af_config, bool asserted) { GPIO_InitTypeDef init = { .GPIO_Pin = af_config->gpio_pin, .GPIO_Mode = GPIO_Mode_OUT, .GPIO_Speed = GPIO_Speed_2MHz, .GPIO_OType = GPIO_OType_PP, .GPIO_PuPd = GPIO_PuPd_NOPULL }; gpio_use(af_config->gpio); GP...
data starts prv_convert_accel_raw_data_to_mgs(&frame_buf[a_begin], data); } static void prv_drain_fifo(void) { // we can't drain the fifo if we are in low power mode so we have // to temporarily enter normal mode bool was_low_power = (s_accel_power_mode == BMI160_Accel_Mode_Low); if (was_low_power) { bmi...
(BOARD_CONFIG_ACCEL.accel_ints[i])
; } prv_read_modify_write(BMI160_REG_INT_OUT_CTRL, int_cfg, int_mask); BMI160_DBG("INT_OUT_CTRL = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_OUT_CTRL)); } } void bmi160_init(void) { gpio_input_init(&BOARD_CONFIG_ACCEL.accel_int_gpios[0]); gpio_input_init(&BOARD_CONFIG_ACCEL.accel_int_gpios[1]); ex...
t_size(KinoReelTransformData *data) { return prv_is_currently_from(data) ? data->from.size : data->to.size; } static GPoint prv_get_interpolated_origin(KinoReelTransformData *data) { const GSize size = prv_get_current_size(data); const GPoint offset = interpolate_gpoint(data->normalized, grect_center_point(&data...
interpolate_gsize(data->normalized, data->from.size, data->to.size)
; } static void prv_transform_list(KinoReelTransformData *data) { KinoReel *reel = prv_get_current_reel(data); GDrawCommandList *source_list = kino_reel_get_gdraw_command_list(reel); GDrawCommandList *list = prv_get_or_create_list_copy(data, source_list); if (!list) { return; } if (!gdraw_command_list_...
70, 106}, { 1450, 268, 202}, { 1059, 385, -66}, { 939, 460, -196}, { 902, 354, -24}, { 885, 250, 26}, { 821, 178, 48}, { 755, 238, 63}, { 780, 311, 31}, { 837, 360, -5}, { 843, 335, -28}, { 900, 323, -15}, { 1122, 353, 5}, { 1255, 393, -13}, { 1237, 410, 38}, ...
{ 757, 281, -60}, { 774, 302, -46}, { 847, 288, -42}, { 878, 310, -39}, { 951, 357, -26}, { 1174, 425, 15}, { 1180, 443, 31}, { 1152, 450, 52}, { 1165, 488, 62}, { 1291, 533, 41}, { 1239, 511, 70}, { 1131, 465, 103}, { 1062, 384, 119}, { 852, 312, 110}, { 707,...
{ 837, 234, 119}, { 822, 193, 138}, { 853, 169, 171}, { 807, 162, 155}, { 790, 181, 169}, { 1024, 166, 247}, { 1074, 174, 231}, { 1185, 257, 112}, { 1371, 252, 195}, { 1042, 327, 5}, { 1045, 432, -158}, { 1037, 350, -3}, { 933, 303, 14}, { 814, 239, -13}, { 7...
k(s_lock); voice_cancel_dictation(session_id); return; } s_state = SessionState_WaitForSessionResult; prv_stop_recording(); prv_start_result_timeout(); unlock: mutex_unlock(s_lock); } void voice_cancel_dictation(VoiceSessionId session_id) { mutex_lock(s_lock); if ((session_id != s_session_id) |...
{ return false; }
// stop timer before changing state variable new_timer_stop(s_timeout); if (s_state != SessionState_WaitForSessionResult) { // This handles erroneous replies from the phone app (sometimes the phone app sends a session // result immediately after we start streaming PBL_LOG(LOG_LEVEL_WARNING, "Sessio...
(comm_session_get_system_session(), BtConsumerPpPutBytes, ResponseTimeMin, timeout_secs)
; } static void prv_send_nack_from_system_task(void *data) { const uint32_t token = (uintptr_t)data; prv_send_response(ResponseNack, token); } static void prv_add_nack_system_callback(uint32_t token) { system_task_add_callback(prv_send_nack_from_system_task, (void *)(uintptr_t)token); } static void prv_add_nac...
m_enabled; menu_layer_reload_data(menu_layer); break; #endif #if CAPABILITY_HAS_MICROPHONE case RXMenuIdx_Microphone: data->is_mic_enabled = !data->is_mic_enabled; menu_layer_reload_data(menu_layer); break; #endif case RXMenuIdx_RunStop: if (data->current_test...
window_init(&data->payload_window, "")
; prv_status_window_init(data); prv_init_main_menu(data); app_window_stack_push(&data->main_menu_window, true); app_event_loop(); } const PebbleProcessMd* mfg_btle_app_get_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = &prv_main, .name = "Test BTLE", }; retu...
/* * 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...
graphics_fill_rect(ctx, &box)
; } //! Get the corresponding data point for a weekday. //! Sunday is 0, and the day data begins with today and continues into the past. static int32_t prv_get_day_point(HealthGraphCard *graph_card, int weekday) { const int index = positive_modulo(graph_card->current_day - weekday, DAYS_PER_WEEK); return graph_car...
/* * 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_p(value, NULL)
; buffer = NULL; } *write = (const Write) { .characteristic = characteristic, .client = client, .is_response_required = is_response_required, .value = buffer, .value_length = value_length, }; if (s_write_head) { list_append((ListNode *)s_write_head, &write->node); } else { s_wr...
/* * 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...
kino_player_rewind(kino_layer_get_player(&data->icon_layer))
; kino_layer_play(&data->icon_layer); } static void prv_click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, prv_select_click_handler); window_set_click_context(BUTTON_ID_UP, context); window_set_click_context(BUTTON_ID_SELECT, context); window_set_click_context(BUTTON_ID_DO...
129}, { -768, 485, -290}, { -796, 530, -255}, { -900, 510, -141}, { -970, 376, -113}, { -891, 346, -100}, { -797, 395, -38}, { -774, 526, -58}, { -837, 453, -35}, { -840, 405, 9}, { -844, 380, 31}, { -854, 443, 22}, { -892, 420, 43}, { -889, 378, 65}, { -872, 362,...
(s_walk_30_steps, 2 * SAMPLES_PER_SECOND)
OvalScaleMode oval_scale_mode = GOvalScaleModeFitCircle; // Calculate the radial rect const GRect inset_layer_bounds = grect_inset((*layer_bounds), GEdgeInsets(shape_size->h / 2)); const GRect shape_rect = grect_centered_from_polar(inset_layer_bounds, oval_scale_mode, ...
handle_init()
; app_event_loop(); handle_deinit(); } const PebbleProcessMd *gdrawmask_demo_get_app_info() { static const PebbleProcessMdSystem gdrawmask_demo_app_info = { .common.main_func = s_main, .name = "GDrawMask Demo" }; return (const PebbleProcessMd*) &gdrawmask_demo_app_info; }
l.h" #include "syscall/syscall_internal.h" #include "system/logging.h" #include "process_management/app_manager.h" typedef struct EventedTimer { ListNode list_node; //! The TimerID type used for sys_timers is a non-repeating integer that we also use as our key for finding //! EventedTimers by id. TimerID sys...
{ // If there's no timer in the list, that means we've been cancelled already. // When we cancel a timer, we immediately free the EventedTimer* and // call new_time_delete() to delete the timer. It's possible however that this // callback got entered after we grabbed the mutex but before we issued the ...
timer->expired = !timer->repeating; mutex_unlock(s_mutex); PebbleEvent e = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_evented_timer_event_callback, .data = (void*)(intptr_t)id, } }; switch (timer->target_task) { case PebbleTask_KernelMain: event_put(&...
/tick_timer_service.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/ui.h" #include "apps/system_apps/timeline/text_node.h" #include "kernel/pbl_malloc.h" #include "applib/pbl_std/pbl_std.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "services/common/cl...
(&frame, start_outer_point, fill_thickness)
DLS_TOTAL_STORAGE_BYTES); } // ---------------------------------------------------------------------------------------- // Test logging a LOT of data. void test_data_logging__large_session(void) { const int item_size = DLS_ENDPOINT_MAX_PAYLOAD; DataLoggingSessionRef logging_session; Uuid system_uuid = UUID_SYST...
data_logging_finish(0)
; data_logging_finish(&data); } // ---------------------------------------------------------------------------------------- //! Try using sessions after we've closed them. void test_data_logging__invalid_session_use_after_close(void) { uint32_t data[] = { 1, 2, 3 }; DataLoggingSessionRef session = data_logging_...
_smartstrap_attribute_read(attr)); // attempt to issue another read request assert_result_busy(app_smartstrap_attribute_read(attr)); // trigger the read request to be sent and expect a did_write handler call stub_pebble_tasks_set_current(PebbleTask_KernelBackground); prv_prepare_for_did_write(attr); cl_as...
cl_assert(write_buffer == (uint8_t *)attr)
; cl_assert(write_length == 100); // end the write request with request_read=true assert_result_ok(app_smartstrap_attribute_end_write(attr, 100, true)); // trigger the write request to be sent and expect a did_write handler call stub_pebble_tasks_set_current(PebbleTask_KernelBackground); prv_prepare_for_d...
_schedule(WeekdaySchedule, &schedule_1); do_not_disturb_set_schedule_enabled(WeekdaySchedule, true); active = do_not_disturb_is_active(); cl_assert(active == true); // Scheduled ON DoNotDisturbSchedule schedule_2 = { .from_hour = 5, .from_minute = 0, .to_hour = 13, .to_minute = 0, }; do_not...
cl_assert(active == false)
/* * 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...
prv_time_64()
/* * 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...
{ PBL_ASSERT(runlevel < RunLevel_COUNT, "Unknown runlevel %d", runlevel); PBL_LOG(LOG_LEVEL_INFO, "Setting runlevel to %d", runlevel); services_common_set_runlevel(runlevel); #ifndef RECOVERY_FW services_normal_set_runlevel(runlevel); #endif }
static const char *s_runlevel_debug_names[] = { #define RUNLEVEL(number, name) [number] = #name, #include "runlevel.def" #undef RUNLEVEL }; void prv_list_runlevels(void) { for (size_t i = 0; i < ARRAY_LENGTH(s_runlevel_debug_names); ++i) { char response[80]; itoa_int(i, response, 10); strcat(response, ...
/* * 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_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_health_sleep_detail_card__render_sleep_data_1(void) { HealthData health_data = { .sleep_data[0] = (7 * SECONDS_PER_HOUR) + (11 * SECONDS_PER_MINUTE), .sleep_data[1] = (6 * SECONDS_PER_HOUR) + (52 * SECONDS_PER_MINUTE), .sleep_data[2] = (7 * SECONDS_PER_HOUR) + (13 * SECONDS_PER_MINUTE), ...
ess/2 + total/2, total); } static bool prv_write_new_firmware(bool new_world, uint32_t flash_new_fw_start, uint32_t firmware_length) { dbgserial_putstr("write_new_firmware"); uint32_t system_flash_base = new_world ? FIRMWARE_NEWWORLD_BASE : FIRMWARE_OLDWORLD_BASE; // We can't j...
boot_bit_clear(BOOT_BIT_NEW_FW_AVAILABLE)
; boot_bit_clear(BOOT_BIT_NEW_FW_INSTALLED); return; } dbgserial_putstr("New firmware is available!"); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_RECOVERY_LOA...
d) { RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE); } static void prv_disable_flash_spi_clock(void) { RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, DISABLE); } static void prv_flash_start(void) { gpio_use(FLASH_CONFIG.spi_gpio); // Enable the GPIOA clock RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENA...
prv_flash_read_next_byte()
; } while (status_register & 0x1); prv_flash_end_cmd(); } static void prv_flash_deep_sleep_exit(void) { prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_WAKE); prv_flash_end_cmd(); // wait a sufficient amount of time to enter standby mode // It appears violating these timing conditions ...
&ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_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_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_ny_...
(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw2_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 2); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw2_clip_xy.$...
/* * 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_prev_send_data_hdr, data, sizeof(s_prev_send_data_hdr))
; data_length -= sizeof(s_prev_send_data_hdr); data += sizeof(s_prev_send_data_hdr); if (data_length > 0) { s_prev_send_data_bytes = data_length; memcpy(s_prev_send_data, data, data_length); } else { s_prev_send_data_bytes = 0; } } } // -----------------------------------------...
cl_assert_equal_b(shared_prf_storage_get_bt_classic_pairing_data(NULL, NULL, NULL, NULL), false); BTDeviceAddress addr = { .octets = { 0x11, 0x22, 0x33, 0x44, 0x55, }, }; char device_name[BT_DEVICE_NAME_BUFFER_SIZE] = "ABCDEFGHIJKLMNOPQRS"; SM128BitKey link_key = { .data = { 0x11, 0x22,...
(write_count < fake_flash_write_count())
; cl_assert(erase_count < fake_flash_erase_count()); write_count = fake_flash_write_count(); erase_count = fake_flash_erase_count(); shared_prf_storage_set_getting_started_complete(true); // Expect flash NOT getting touched: cl_assert_equal_i(write_count, fake_flash_write_count()); cl_assert_equal_i(eras...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 4), 0); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 6), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 8), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 10), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4); ...
GPoint(8, 0)
, 2); graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 0), 3); graphics_draw_vertical_line_dotted(&ctx, GPoint(12, 0), 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(14, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(16, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(18, 0), 22); ...
yer, &GRectZero); manager.window = &window; Layer layer_a, layer_b, layer_c; layer_init(&layer_a, &GRectZero); layer_init(&layer_b, &GRectZero); layer_init(&layer_c, &GRectZero); layer_add_child(&window.layer, &layer_a); layer_add_child(&layer_a, &layer_b); layer_add_child(&window.layer, &layer_c); m...
(ctx.triggered, r)
/* * 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...
prv_selection_config()
; if (!clock_is_24h_style() && (i == (num_cells - 1))) { return config->ampm_cell_width; } else { return config->cell_width; } } static void prv_update_selection_layer(TimeSelectionWindowData *time_selection_window) { const TimeSelectionSizeConfig * const config = prv_selection_config(); const int to...
/* * 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...
(weighting_factor_inverted != 0)
; // Divide by zero is not awesome *timer = (IntervalTimer) { .min_expected_ms = min_expected_ms, .max_expected_ms = max_expected_ms, .weighting_factor_inverted = weighting_factor_inverted }; } //! Record a sample that marks the start/end of an interval. //! Safe to call from an ISR. void interval_tim...
end_hours, end_minutes, false); } static void prv_set_deep_sleep(char *buffer, size_t buffer_size, int32_t sleep_duration, void *i18n_owner) { if (sleep_duration <= 0) { strncpy(buffer, EN_DASH, buffer_size); return; } health_util_format_hours_and_minutes(buffer, buff...
app_free(card_data->headings[i].secondary_value)
; } for (int i = 0; i < card_data->num_subtitles; i++) { app_free(card_data->subtitles[i].label); } for (int i = 0; i < card_data->num_zones; i++) { app_free(card_data->zones[i].label); } i18n_free_all(card_data); app_free(card_data); health_detail_card_destroy(card); }
ntal_line_dotted(&ctx, GPoint(0, 11), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 13), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 15), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 17), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 19), 22); graphics_draw_hor...
graphics_draw_vertical_line_dotted(&ctx, GPoint(17, 0), 21)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(19, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 0), MAX_NUM_ROWS + 1 ); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origi...
{ 848, 352, -8}, { 800, 424, -96}, { 912, 464, -80}, { 1160, 400, 8}, { 1264, 248, 184}, { 1880, 216, 232}, { 1352, 312, 152}, { 1192, 184, 112}, { 1448, 88, 168}, { 1512, 72, 240}, { 1280, 32, 208}, { 1072, 0, 128}, { 944, -8, 64}, { 816, -8, 56}, { 704, 0, 16}...
{ 1200, 424, 56}, // 80 seconds { 1120, 296, 104}, { 1272, 136, 216}, { 1288, 64, 256}, { 1184, 24, 256}, { 1056, 32, 216}, { 944, 32, 192}, { 896, 16, 176}, { 864, -24, 160}, { 888, -72, 136}, { 928, -72, 64}, { 960, 24, -40}, { 1352, -144, 8}, { 1408, -176, ...
{ 1736, -160, 272}, { 1824, 336, 280}, { 1296, 816, -48}, { 1080, 464, 104}, { 1048, 32, 384}, { 904, 112, 440}, { 960, 264, 336}, // 83 seconds { 944, 296, 352}, { 840, 432, 328}, { 728, 360, 280}, { 792, 344, 152}, { 920, 368, 96}, { 1168, 496, 48}, { 1384,...
/* * 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...
(window, (WindowHandlers) { .load = window_load, })
; window_stack_push(window, true); } static void deinit(void) { window_destroy(window); } int main(void) { init(); app_event_loop(); deinit(); }
{ 1136, 40, -112}, { 1176, -96, 16}, { 1024, -224, 176}, { 1032, -152, -16}, { 1080, -8, -88}, { 1048, -56, -88}, { 1056, -80, -112}, { 976, -88, -192}, { 920, -120, -232}, { 976, -136, -216}, // 13 seconds { 928, -136, -192}, { 896, -96, -192}, { 984, -16, -200},...
{ 1000, -88, -56}, { 1048, -96, -72}, { 1072, -96, -80}, { 1040, -112, -112}, { 1056, -96, -152}, { 1048, -168, -144}, { 1032, -256, -120}, { 1064, -344, -112}, { 1080, -360, -224}, { 1160, -584, -360}, { 1320, -456, -376}, { 1152, -280, -160}, { 1128, -120, -136}, ...
24}, { -512, 336, 16}, { -568, 352, 0}, { -896, 408, -8}, { -952, 416, -72}, { -1184, 456, -144}, { -1304, 480, -144}, { -1208, 552, -392}, { -976, 496, -336}, { -872, 352, -248}, { -736, 272, -208}, // 44 seconds { -544, 272, -160}, { -424, 272, -168}, { -424, 22...
{ -488, 328, -136}, { -528, 288, -72}, { -640, 344, -80}, { -680, 408, -96}, { -632, 424, -104}, { -792, 472, -152}, { -1032, 496, -168}, { -1104, 424, -80}, { -1232, 560, -240}, { -1288, 672, -256}, { -1160, 568, -96}, { -1128, 504, -32}, { -848, 408, -32}, { -57...
{ -632, 424, -72}, { -808, 464, -120}, { -968, 504, -160}, { -1024, 416, -56}, { -1320, 528, -144}, { -1296, 680, -264}, { -1120, 608, -200}, { -1096, 552, -160}, { -944, 464, -80}, // 52 seconds { -696, 360, -56}, { -520, 376, -88}, { -440, 344, -40}, { -456, 31...
eof(GPoint) * 2)); GDrawCommandList *command_list = &image->command_list; *command_list = (GDrawCommandList) { .num_commands = 1 }; GDrawCommand *command; command = gdraw_command_list_get_command(command_list, 0); *command = (GDrawCommand) { .type = GDrawCommandTypePath, .hidden = false, .st...
{ GDrawCommandList *command_list = prv_create_command_list_3(); GColor stroke_color = GColorTiffanyBlue; SetStrokeColorProcessor stroke_processor = { .processor = { .command = prv_set_stroke_color, }, .stroke_color = stroke_color, }; // ctx can't be null pass in random pointer to satisfy fu...
void test_gdraw_command__get_max_command_size_in_list(void) { GDrawCommandList *command_list = prv_create_command_list_3(); // The third command in the list is the largest so it's size should be returned by // prv_get_list_max_command_size cl_assert_equal_i(gdraw_command_get_data_size(gdraw_command_list_get_...
///////////////////////////////////////////////////////////////////////// //! Drawing static void prv_render_activity_type(GContext *ctx, Layer *layer, KinoReel *icon, const char *name) { const GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD); const GTextOverflowMode...
layer_add_child(&window->layer, &summary_window->base_layer)
; StatusBarLayer *status_layer = &summary_window->status_layer; status_bar_layer_init(status_layer); status_bar_layer_set_colors(status_layer, GColorClear, TEXT_COLOR); layer_add_child(&window->layer, status_bar_layer_get_layer(status_layer)); #if PBL_RECT GRect status_layer_bounds = window->layer.bounds; ...
/* * 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 (process_manager_compiled_with_legacy2_sdk() || process_manager_compiled_with_legacy3_sdk()) { // This value is new in 4.x. Use the old CompassStatusDataInvalid value instead for old apps // that may not know how to handle the previously undefined status. return CompassStatusDataInvalid; }
/* * 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 (address < s_sector_addresses[0]) { dbgserial_print("address "); dbgserial_print_hex(address); dbgserial_print(" is outside system flash\r\n"); return -1; } for (size_t i=0; i < ARRAY_LENGTH(s_sector_addresses)-1; ++i) { if (s_sector_addresses[i] <= address && address < s_sector_a...
IMASK and FAULTMASK "mov lr, 0xFFFFFFFF\n" "mov sp, %[initial_sp]\n" "bx %[reset_handler]\n" : : [initial_sp] "r" (initial_stack_pointer), [reset_handler] "r" (reset_handler) ); __builtin_unreachable(); } static bool prv_check_and_increment_reset_loop_detection_bits(void) { ...
(&reset_vector, &initial_sp)
; if ((uintptr_t)reset_vector == 0xffffffff || (uintptr_t)initial_sp == 0xffffffff) { dbgserial_putstr("Firmware is erased"); return true; } return false; } static void prv_sad_watch(uint32_t error_code) { dbgserial_putstr("SAD WATCH"); char error_code_buffer[12]; itoa_hex(error_code, error_...
/* * 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...
(app_manager_get_current_app_id())
t_info; ActionableDialog *actionable_dialog; #if PBL_ROUND StatusBarLayer status_bar_layer; #endif } NotificationsData; static NotificationsData *s_data = NULL; static const unsigned int MAX_ACTIVE_NOTIFICATIONS = 6; static bool prv_loaded_notification_list_filter_cb(ListNode *node, void *data) { LoadedNotific...
app_malloc_check(sizeof(LoadedNotificationNode))
; list_init((ListNode*) loaded_node); loaded_node->notification = notification; TimelineResourceId timeline_res_id = attribute_get_uint32(&notification.attr_list, AttributeIdIconTiny, NOTIF_FA...
ler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); // Complete sequence prv_advance_to_ms_with_timers(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS + 1)...
(prv_count_handler_entries(&s_setup_handler_calls, b), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); #endif } // -------------------------------------------------------------------------------------- // Test a sequence animation with a play count of 0 void t...
t, (ListNode*) new_node); return new_node; } static void prv_notification_list_remove_notification_by_id( NotificationNode **notification_list, Uuid *id) { NotificationNode *node = prv_find_notification(*notification_list, id); list_remove((ListNode *)node, (ListNode **)notification_list, NULL); } s...
prv_unload_loaded_notification(node)
; } } // Return true if successful static bool prv_push_notification_window(NotificationsData *data) { notification_window_init(false /*is_modal*/); // Bail if a notification came in ahead of us and created a modal window // before we had a chance to react to the select button event. if (notification_window...
/* * 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...
(array && num)
; size_t i = 0; while (i < *num) { if (array[i] == NULL) { for (size_t j = i + 1; j < *num; j++) { array[j-1] = array[j]; } (*num)--; } else { i++; } } }
&new_data.bt_classic_data.link_key, new_data.bt_classic_data.name, &new_data.bt_classic_data.platform_bits); } BtPersistBondingOp op; SM128BitKey nil...
bt_persistent_storage_get_bt_classic_pairing_by_id(key, NULL, link_key_out, name_out, platform_bits_out)
) { return BT_BONDING_ID_INVALID; } return key; } bool bt_persistent_storage_has_active_bt_classic_gateway_bonding(void) { return prv_has_active_gateway_by_type(BtPersistBondingTypeBTClassic); } typedef struct { BtPersistBondingDBEachBTClassic cb; void *cb_data; } ForEachBTCPairingData; static bool bt...
uint8_t *field_ptr = ((uint8_t *)data) + offset; memset(field_ptr, 0xFF, field_size); prv_persist_field(field_ptr, offset, field_size, false); prv_dealloc_struct(data); } static bool prv_fetch_field(uint8_t *field_out, size_t offset, size_t field_size) { flash_read_bytes(field_out, prv_current_page_flash_add...
prv_unlock()
; return rv; } void shared_prf_storage_set_root_keys(SM128BitKey *keys_in) { prv_lock(); { SprfRootKeys data = {}; if (keys_in) { memcpy(&data.keys, keys_in, sizeof(data.keys)); } SPRF_PERSIST_FIELD(data, root_keys); } prv_unlock(); } //! //! BLE Pairing Data APIs //! bool shared_prf_...
992, -24, -112}, { 984, 16, -56}, { 1280, 0, -16}, { 1352, -32, 56}, { 1216, -40, 56}, { 1096, -72, 64}, { 992, -104, 64}, { 936, -88, 8}, { 920, -64, -40}, { 864, -72, -88}, { 824, -88, -120}, { 864, -120, -136}, { 896, -128, -112}, { 984, -120, -144}, { 1112, -...
{ 920, 0, -152}, { 960, -48, -184}, { 1024, -56, -184}, { 1016, -80, -168}, { 1016, -40, -176}, { 944, 0, -168}, { 944, 24, -136}, // 37 seconds { 1048, 72, -112}, { 1056, 48, -48}, { 1320, 48, -24}, { 1344, 96, -16}, { 1336, 136, 8}, { 1136, 128, 80}, { 992, ...
{ 1320, -8, -200}, { 896, -24, -328}, { 672, -96, -304}, { 1000, -160, -192}, { 1112, -216, -112}, { 1064, -208, -120}, { 1000, -112, -160}, { 992, -104, -176}, { 960, -104, -144}, { 960, -176, -144}, { 992, -184, -120}, { 984, -168, -144}, { 928, -152, -160}, { ...
/* * 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...
(id, numeric_id, bg_color, text_color, timeline_resource_id)
\ timeline_resource_id, #include "services/normal/weather/weather_type_tuples.def" }; static const size_t s_num_weather_types = ARRAY_LENGTH(s_weather_type_names); static size_t prv_get_array_index_of_type(WeatherType type) { return (type == WeatherType_Unknown) ? (s_num_weather_types - 1) : type; } const cha...
HEIGHT / 2); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_top_clipped.${BIT_DEPTH_NAME}.pbi")); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT / 2); ...
prv_reset()
) { I2CTransfer *transfer = &bus->state->transfer; if (transfer->type == I2CTransferType_SendRegisterAddress) { transfer->state = I2CTransferState_WriteRegAddress; } else { if (transfer->direction == I2CTransferDirection_Read) { transfer->state = I2CTransferState_ReadData; } else { transf...
{ prv_end_transfer_irq(bus, I2CTransferEvent_TransferComplete); return; }
break; case I2CTransferState_WriteData: if ((i2c->ISR & I2C_ISR_TXIS) != 0) { i2c->TXDR = transfer->data[transfer->idx++]; } if ((i2c->ISR & I2C_ISR_NACKF) != 0) { i2c->ICR |= I2C_ICR_NACKCF; return i2c_handle_transfer_event(bus, I2CTransferEvent_NackReceived); ...
ed_prf_storage_set_ble_pinned_address(&DEVICE_ADDR); BTDeviceAddress addr_buf; bool rv = shared_prf_storage_get_ble_pinned_address(&addr_buf); cl_assert_equal_b(rv, true); cl_assert_equal_m(&DEVICE_ADDR, &addr_buf, sizeof(DEVICE_ADDR)); shared_prf_storage_set_ble_pinned_address(&DEVICE_ADDR); cl_assert_equ...
(&PAIRING_INFO, &pairing_info_out)
, true); cl_assert_equal_s(device_name_out, DEVICE_NAME); // Check local_name cl_assert_equal_b(shared_prf_storage_get_local_device_name(device_name_out, sizeof(device_name_out)), true); cl_assert_equal_s(DEVICE_NAME, device_name_out); } // Sets the...
ion); short_phrase = pstring_create_pstring16_from_string(phrase); data_size = strlen(location) + strlen(phrase) + sizeof(uint16_t) * 2; // One for each string const size_t entry_size = sizeof(WeatherDBEntry) + data_size; WeatherDBEntry *entry = task_zalloc_check(entry_size); *en...
weather_shared_data_get_index_of_key(key)
; if (index == -1) { cl_fail("key not found!"); } cl_assert_equal_i(pstring->str_length, strlen(s_entry_names[index])); char loc[WEATHER_SERVICE_MAX_WEATHER_LOCATION_BUFFER_SIZE]; pstring_pstring16_to_string(pstring, loc); cl_assert_equal_s(loc, s_entry_names[index]); pstring = pstring_get_pstring16...
/* * 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_s(dest, "Katharine")
; cl_assert_equal_m(dest + buffer_length, GUARD_REFERENCE, buffer_length); } void test_phone_formatting__overflowing_multibyte_initial(void) { const size_t buffer_length = 9; char dest[NAME_LENGTH]; memset(dest, GUARD_CHAR, NAME_LENGTH); // This wouldn't overflow if E_ACUTE was one byte. phone_format_call...
tion_menu, cb_data); prv_request_responsive_session(); prv_cleanup_action_result(data, true /* succeeded */); } static void prv_cleanup_do_response_menu(ActionMenu *action_menu, const ActionMenuItem *item, void *context) { timeline_item_des...
ancs_perform_action(ancs_uid, ActionIDNegative)
; } break; } case ActionResultTypeChaining: prv_handle_chaining_response(data, e); break; case ActionResultTypeDoResponse: prv_handle_do_response_response(data); break; default: prv_cleanup_action_result(data, false /* success */); PBL_LOG(LOG_LEVEL_WARNIN...
0, 264, -264}, { 1104, 216, -224}, { 1160, 200, -280}, { 1320, 240, -280}, { 1280, 160, -240}, { 1168, 104, -248}, { 1136, 24, -208}, { 888, -200, -200}, { 1184, -16, -16}, { 1208, 40, -336}, { 1264, 136, -336}, { 1288, 192, -400}, { 1048, 256, -344}, { 832, 200, -360...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-16 12:37:54 local AccelRawData *activity_sample_walk_100_pbl_28397_10(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_28397_10 //> TE...
/* * 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...
while (SPI_I2S_GetFlagStatus(SPI3, SPI_I2S_FLAG_TXE) == RESET) {}
// Send the byte on the SPI bus SPI_I2S_SendData(BMA255_SPI, byte); } //! Set SCS for transaction, start spi clock, and send address void bma255_prepare_txn(uint8_t address) { while (rtc_get_ticks() < (s_last_write_ticks + MIN_TICKS_AFTER_WRITE)) { psleep(1); } gpio_output_set(&BMA255_SCS_CONFIG, 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...
PBL_IF_ROUND_ELSE(2, 4)
; const uint16_t text_x = TEXT_LEFT_MARGIN_PX; const uint16_t text_y = icon_top_margin_px + MAX(icon_size.h, 6) + icon_text_spacing_px; const uint16_t text_w = frame_size.w - TEXT_LEFT_MARGIN_PX - TEXT_RIGHT_MARGIN_PX; // Limit to 2 lines if there is an icon const uint16_t text_h = icon_size.h ? TEXT_MAX_HEI...
cs_types.h" #include "comm/ble/kernel_le_client/ancs/ancs_util.h" #include "util/buffer.h" #include "clar.h" #include <string.h> // Stubs /////////////////////////////////////////////////////////// #include "stubs_analytics.h" #include "stubs_ble.h" #include "stubs_bt_stack.h" #include "stubs_logging.h" #include ...
ancs_util_is_complete_notif_attr_response(b->data, b->bytes_written, &error)
); cl_assert(!error); ANCSAttribute *attr_ptrs[NUM_FETCHED_NOTIF_ATTRIBUTES]; const GetNotificationAttributesMsg *msg = (const GetNotificationAttributesMsg*) b->data; const size_t attributes_length = b->bytes_written - sizeof(*msg); cl_assert(ancs_util_get_attr_ptrs(msg->attributes_data, attributes_length...
nclude "applib/ui/ui.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "process_management/pebble_process_md.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "services/common/i18n/i18n.h" #include "services/normal/timeline/timeline.h" #include "servi...
event_service_client_unsubscribe(&data->weather_event_info)
x_erase) { max_erase = hdr.erase_count; } if (hdr.last_written == LAST_WRITTEN_TAG) { last_written_pg = i + start_page; } } prv_flash_erase_sector(start_page); prv_write_erased_header_on_page_range(start_page, start_page + PFS_PAGES_PER_ERASE_SECTOR, max_erase); if (last_written...
{ // TODO: For safety, could disallow this op if user has orig file hdl open pfs_remove(f->name); // Note: if we reboot before updating the tmp state flag to done, the tmp & // original file will be deleted. This is an extremely small window, but // could be resolved by checking on reboot to see if ...
// Note: We don't free f->name here because we keep the file metadata // (including the name, so we can detect hits) in the cache until we // have to evict it to make room for a new file. PFS_FD(fd).fd_status = FD_STATUS_UNREFERENCED; PFS_FD(fd).time_closed = time_closed_counter++; // If this file was m...
_container_nodes); vertical_container_node->vertical_alignment = GVerticalAlignmentCenter; graphics_text_node_container_add_child(&vertical_container_node->container, node); return &vertical_container_node->container.node; } static GTextNode *prv_create_subtitle_node(LauncherAppGlanceStructured *structured_gla...
{ // Nothing to do, bail out return; }
NULL, NULL), false); // Store a classic pairing BTDeviceAddress addr = { .octets = { 0x11, 0x22, 0x33, 0x44, 0x55,}, }; char device_name_classic[BT_DEVICE_NAME_BUFFER_SIZE] = "CLASSIC"; SM128BitKey link_key = { .data = { 0x55, }, }; shared_prf_storage_store_bt_classic_pairing_data(&addr, device_...
shared_prf_storage_get_root_key(SMRootKeyTypeIdentity, NULL)
, false); SM128BitKey keys[2]; for (int i = 0; i < sizeof(keys); ++i) { ((uint8_t *) keys)[i] = i; } shared_prf_storage_set_root_keys(keys); SM128BitKey keys_out[2]; for (SMRootKeyType key_type = 0; key_type < SMRootKeyTypeNum; ++key_type) { cl_assert_equal_b(shared_prf_storage_get_root_key(key_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 in w...
{ if (r->value_length == value_length && r->description == description && memcmp(r->value, value, value_length) == 0) { PBL_LOG(LOG_LEVEL_DEBUG, "Key & value already exist."); return 0; } PBL_LOG(LOG_LEVEL_DEBUG, "Key already exists. Updating record."); r->description = descr...
int idx = registry_get_next_available_index(registry); if (idx < 0) { PBL_LOG(LOG_LEVEL_WARNING, "Registry full."); return -1; } PBL_ASSERTN(idx >= 0 && idx < registry->num_records); r = registry->records + idx; r->active = true; strncpy(r->key, key, key_length); r->key[MAX_KEY_SIZE_BYTES ...
data->result_animation = animation; animation_schedule(animation); #else // Don't animate to a dot on old platforms, just finish immediately. static const bool success = true; prv_finished(data, success); #endif } static void prv_schedule_progress_failure_animation(ProgressWindow *data, uint32_t timeline_res...
{ if (window->state == ProgressWindowState_Result) { // Ignore requests to change the result once we already have one return; } window->state = ProgressWindowState_Result; prv_cancel_fake_progress_timer(window); prv_set_progress(window, MAX_PROGRESS_PERCENT); prv_schedule_progress_success_animation...
void progress_window_set_result_failure(ProgressWindow *window, uint32_t timeline_res, const char *message, uint32_t delay) { if (window->state == ProgressWindowState_Result) { // Ignore requests to change the result once we already have one return; } window->sta...
/* * 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_ad_data, copied_uuids, 0)
perties; typedef struct AppData { uint8_t property; GColor bg_color; GColor fg_color; uint8_t alpha; TextLayer *alpha_text; char alpha_text_buffer[30]; TextLayer *fg_text; char fg_text_buffer[5]; TextLayer *fg_color_text; char fg_color_text_buffer[20]; uint8_t fg_color_index; TextLayer *bg_te...
GPoint(point.x + 1, point.y)
); graphics_draw_pixel(ctx, GPoint(point.x, point.y + 1)); } else if (alpha == ALPHA_33) { graphics_context_set_stroke_color(ctx, fg_color); graphics_draw_pixel(ctx, point); graphics_context_set_stroke_color(ctx, bg_color); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y)); graphics_draw_...
ics_heartbeat_set(heartbeat, ANALYTICS_APP_METRIC_SDK_MAJOR_VERSION, sdk_major_version); // Verify that things were set as expected, and adjacent metrics were not // overwritten. int64_t got_time_interval = analytics_heartbeat_get(heartbeat, ANALYTICS_APP_METRIC_TIME_INTERVAL); cl_assert(time_interval == got_t...
kernel_free(heartbeat)
; }
/* * 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 (length != sizeof(ExternalFlashEraseOptions)) { return E_INVALID_ARGUMENT; } ExternalFlashEraseOptions *options = (ExternalFlashEraseOptions*)packet_data; ExternalFlashEraseState *state = kernel_malloc(sizeof(ExternalFlashEraseState)); *state = (ExternalFlashEraseState) { .address = options->ad...
static status_t external_flash_domain_open(uint8_t *packet_data, size_t length, void **resp) { return S_SUCCESS; } static status_t external_flash_domain_close(void *context) { return S_SUCCESS; } PulseBulkIODomainHandler pulse_bulkio_domain_external_flash = { .id = PulseBulkIODomainType_ExternalFlash, .open...
/* * 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...
WINDOW_NAME("test_mpu")
, 368, -608}, { 600, 456, -656}, { 568, 352, -624}, { 528, 488, -640}, { 584, 448, -680}, { 616, 480, -680}, { 584, 472, -656}, { 552, 464, -656}, // 50 seconds { 560, 416, -656}, { 592, 424, -640}, { 560, 432, -672}, { 504, 440, -832}, { 584, 496, -800}, { 544, 3...
{ 504, 576, -712}, { 504, 672, -768}, { 480, 424, -520}, { 456, 648, -712}, { 600, 560, -840}, { 376, 576, -744}, { 440, 496, -696}, { 456, 488, -680}, { 472, 528, -720}, { 432, 528, -768}, { 280, 480, -760}, { 400, 448, -760}, { 400, 416, -752}, { 376, 480, -760}...
{ 296, 408, -752}, // 58 seconds { 408, 336, -696}, { 400, 568, -680}, { 424, 728, -656}, { 392, 640, -672}, { 384, 624, -680}, { 400, 416, -696}, { 408, 568, -672}, { 400, 664, -664}, { 384, 560, -680}, { 408, 568, -672}, { 392, 592, -664}, { 384, 552, -680}, ...
aw 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 permissions and * limitations under the License. */ #include "applib/ui/dialogs/...
comm_session_send_data(session, PING_ENDPOINT, (uint8_t *)&pong, sizeof(pong), COMM_SESSION_DEFAULT_TIMEOUT)
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_health_detail_card__render_crown(void) { HealthDetailZone zones[] = DEFAULT_ZONES; zones[1].show_crown = true; HealthDetailCardConfig config = { .num_headings = 1, .headings = &(HealthDetailHeading) { .primary_label = "LABEL1", .primary_value = "value1", .fill_color = GC...
s in a grid pattern while increasing the stroke width for each circle static void prv_draw_circles(GContext *ctx) { GPoint pt = CENTER_OF_ORIGIN_RECT; for (int sw = 0; sw <= 10; sw++) { ctx->draw_state.stroke_width = sw; graphics_draw_circle(ctx, pt, 0); // center point follows a grid pt.x += 30; ...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_arc_origin_aa_stroke_bigger_than_radius.${BIT_DEPTH_NAME}.pbi"))
; // Negative angle letter C angle_end -= TRIG_MAX_ANGLE; angle_start -= TRIG_MAX_ANGLE; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 4); graphics_draw_arc_internal(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG, angle_start, angle_end); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "dra...
0x09, 0x1e, 0x0e, 0x05, 0x1a, 0x0a, 0x2f, 0x1f, 0x0f, 0x0b, 0x06, 0x1b, 0x07, 0x01, 0x16, 0x02, 0x2b, 0x17, 0x03, 0x13, 0x12, 0x27, 0x23, 0x11, 0x26, 0x22, 0x3b, 0x37, 0x33, 0x32, 0x21, 0x36, 0x31, }; // Sorted by Hue, Saturation, Value static uint8_t ...
{ set_text_element(data->bg_color_text, data->bg_color_text_buffer, false); }
layer_mark_dirty(text_layer_get_layer(data->alpha_text)); layer_mark_dirty(text_layer_get_layer(data->fg_text)); layer_mark_dirty(text_layer_get_layer(data->bg_text)); } static void draw_color_point(GContext* ctx, AppData *data, GPoint point) { GColor fg_color = (GColor){ .argb = (data->fg_color.argb | ALPHA...
/* * 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...
imu_power_down()
; boot_bit_set(boot_bit); PBL_LOG(LOG_LEVEL_ALWAYS, "Rebooting to enter Standby mode."); reboot_reason_set_restarted_safely(); system_hard_reset(); } static NORETURN prv_enter_standby_pmic(void) { reboot_reason_set_restarted_safely(); #if defined(TARGET_QEMU) #if MICRO_FAMILY_STM32F7 WTF; // Unsupporte...
prv_cleanup(AppFetchResultPhoneBusy); break; case APP_FETCH_RESPONSE_UUID_INVALID: PBL_LOG(LOG_LEVEL_WARNING, "Error: UUID Invalid"); prv_cleanup(AppFetchResultUUIDInvalid); break; case APP_FETCH_RESPONSE_NO_DATA: PBL_LOG(LOG_LEVEL_WARNING, "Error: No data on phone"); p...
prv_app_fetch_protocol_handle_msg((AppFetchResponseData *)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...
window_create()
; window_set_window_handlers(window, (WindowHandlers) { .load = window_load, }); window_stack_push(window, true); } static void deinit(void) { window_destroy(window); } int main(void) { init(); app_event_loop(); deinit(); }
d then s_last_args_for_mock will be updated #define ASSERT_NO_CHANGE(code_block) \ do {\ ArgsForMock actual_args; \ reset_last_args_for_mock(); \ copy_last_args_for_mock(&actual_args, &s_last_args_for_mock); \ code_block; \ bool cmp_result = validate_args(&actual_args, &s_last_args_for_mock); \ ...
graphics_context_set_text_color(&context, color)
dotted_line_origin_checkerboard_no_clip"))); // Clipping on even boundaries - no offset setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_EVEN, ORIGIN_RECT_NO_CLIP, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check...
GPoint(0, row)
, MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_even_offset_checkerboard_no_clip"))); // Clipping on even boundaries - no offset setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_EVEN, OFFSET_RECT_EVEN, false, 1); for (int16_t row = 0; row < MAX_NUM_...
------------------------------------------------------------------------------------- bool property_animation_init(PropertyAnimation *animation_h, const PropertyAnimationImplementation *implementation, void *subject, void *from_value, void *to_value) { if (anima...
if (property_animation_get_subject(prop_anim, (void**)&subject) && subject) { layer_mark_dirty(subject); }
} static const PropertyAnimationImplementation s_dirty_layer_implementation = { .base = { .update = property_animation_update_mark_dirty, }, }; PropertyAnimation *property_animation_create_mark_dirty(struct Layer *layer) { // no legacy2 support as this was never exposed on 2.x PropertyAnimation *...
/* * 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...
fake_pbl_malloc_clear_tracking()
; rocky_runtime_context_init(); jerry_init(JERRY_INIT_EMPTY); } void test_rocky_text_encoding__cleanup(void) { jerry_cleanup(); rocky_runtime_context_deinit(); fake_pbl_malloc_check_net_allocs(); } void test_rocky_text_encoding__jerry_handles_cesu8_strings_in_source(void) { // Although CESU-8 and UTF-8 ar...
char *): { char *output = NULL; ROCKY_ARGS_ASSIGN(ROCKY_ARG(output)); cl_assert_equal_s(output, cases[i].expected_output); ASSERT_JS_ERROR(error_value, NULL /* Never errors out! */); task_free(output); } // Exercise ROCKY_ARG (automatic binding creation, defaults to copy/no-m...
(output.size.h.raw_value, cases[i].expected_output.size.h.raw_value)
; } for (uint32_t j = 0; j < argc; ++j) { jerry_release_value(argv[j]); } } } void test_rocky_api_util_args__gcolor(void) { const char *type_error_msg = "TypeError: Argument at index 0 is not a String ('color name' or '#hex') or Number"; const char *invalid_value_msg = "TypeError: ...
* 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 permissions and * limitations under the License. */ #include "applib/ui/layer.h" #include "applib/ui/layer_private.h" ...
for (int i = 0; i < ARRAY_LENGTH(layers); ++i) { layer_init(layers[i], &GRectZero); }
// Create this hierarchy: // // +-parent // | // '->child_a->child_b // layer_add_child(&parent, &child_a); layer_add_child(&parent, &child_b); layer_remove_child_layers(&parent); cl_assert(child_a.parent == NULL); cl_assert(child_a.next_sibling == NULL); cl_assert(child_b.parent == NUL...
_bitmap_h = shadow_top->bounds.size.h; const int16_t shadow_top_y_offset = -shadow_top_bitmap_h - CLIP(content_offset.y, -shadow_top_bitmap_h, 0); if (shadow_top_y_offset >= -shadow_top_bitmap_h) { graphics_draw_bitmap_in_rect(ctx, shadow_top, &GRect(0, shadow_top_y_offset, ...
if (page_height) { // showing full page-aligned contents of last page min_y_offset = ROUND_TO_MOD_CEIL(min_y_offset, page_height); }
} if (scroll_layer_get_clips_content_offset(scroll_layer)) { bounds.origin.x = CLIP(offset.x, MIN(min_x_offset, 0), 0); bounds.origin.y = CLIP(offset.y, MIN(min_y_offset, 0), 0); } else { bounds.origin = offset; } if (gpoint_equal(&old_offset, &bounds.origin)) { // Not changed. // still...
ace for them info->get_val(file, (uint8_t *)&header, sizeof(CommonTimelineItemHeader)); // Flags & Status are stored inverted. header.flags = ~header.flags; header.status = ~header.status; prv_add_nodes_for_serialized_item(list_head, &header); return true; // continue iteration } static void prv_set_indic...
time_util_get_midnight_of( timeline_iter_state->node->timestamp)
; timeline_iter_state->index = timeline_iter_state->node->index; #ifdef TIMELINE_SERVICE_DEBUG prv_debug_print_pins(timeline_iter_state->node); #endif return (rv == S_SUCCESS); } static bool prv_iter_prev(IteratorState state) { TimelineIterState *timeline_iter_state = (TimelineIterState *)state; // at the pa...
leep_count, &nap_count); PBL_LOG(LOG_LEVEL_DEBUG, "Found %d sleep sessions and %d nap sessions", sleep_count, nap_count); if (nap_count > 0 || sleep_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "FAILED: expected only sleep but got %d naps and %d sleep", nap_count, sleep_count); prv_test_end(context, f...
time_util_get_midnight_of(rtc_get_time())
ck_i2c_error(); return false; } } // Take binary semaphore so that next take will block PBL_ASSERT(prv_semaphore_take(bus->state), "Could not acquire semaphore token"); // Set up transfer bus->state->transfer = (I2CTransfer) { .device_address = device_address, .register_address = register_...
PBL_LOG(LOG_LEVEL_ERROR, "Block read failed on bus %s", slave->bus->name)
; } return result; } bool i2c_write_register(I2CSlavePort *slave, uint8_t register_address, uint8_t value) { return i2c_write_register_block(slave, register_address, 1, &value); } bool i2c_write_register_block(I2CSlavePort *slave, uint8_t register_address_start, uint32_t write_siz...
/* * 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...
((GTextLayoutCacheRef) &layout, TEXT_FLOW_INSET_PX)
(TimelineItem)); if (!item_out) { return NULL; } memcpy(&item_out->header, &src->header, sizeof(CommonTimelineItemHeader)); if (!prv_deep_copy_attributes_actions(&src->attr_list, &src->action_group, item_out)) { timeline_item_destroy(item_out); return NULL; } return item_out; } size_t timelin...
timeline_item_free_allocated_buffer(item)
ent_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 12 H", time_buf); // June 12th 2015, 00:29:30 (T-11:30:30) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) + (29 * SECONDS_PER_MINUTE) + 30); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN ...
(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("10 MIN AGO", time_buf); // June 9th 2015, 12:10:59 (T+00:10:59) rtc_set_time(event_time + (10 * SECONDS_PER_MINUTE) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("10 MIN AGO", time_buf); // June 9th 2015, 12:59:29 ...
4}, { 248, 352, -944}, { 160, 104, -760}, { 240, 272, -904}, { 288, 280, -800}, { 248, 352, -856}, { 248, 344, -832}, { 248, 360, -832}, { 248, 320, -800}, { 264, 312, -832}, { 256, 272, -824}, { 280, 328, -760}, { 240, 344, -824}, { 224, 320, -840}, { 208, 336, -...
{ 320, 288, -800}, { 272, 288, -800}, { 280, 272, -808}, { 272, 280, -896}, { 280, 368, -792}, { 240, 224, -808}, { 200, 152, -896}, { 224, 200, -904}, { 144, 128, -904}, { 96, 184, -968}, { 104, 136, -936}, { 112, 128, -928}, { 112, 168, -936}, { 136, 144, -880},...
{ 144, 144, -912}, { 136, 144, -904}, { 144, 160, -920}, { 144, 176, -944}, { 120, 64, -912}, { 160, 64, -920}, { 152, 40, -904}, // 43 seconds { 144, 88, -912}, { 144, 72, -928}, { 144, 56, -920}, { 144, 64, -920}, { 144, 72, -920}, { 144, 64, -904}, { 152, ...
GAPLEClientApp, NULL); free(value_out); return milliseconds_to_ticks(5); } void test_gatt_client_subscriptions__notification_buffer_full(void) { // Subscribe app: BLECharacteristic characteristic = prv_get_indicatable_characteristic(); BTErrno e = gatt_client_subscri...
(next_length, 0)
; } void test_gatt_client_subscriptions__consume_but_nothing_in_buffer(void) { // Subscribe app: BLECharacteristic characteristic = prv_get_indicatable_characteristic(); BTErrno e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, G...
* bytes 3184 - 3200 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* bytes 3200 - 3216 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* bytes 3216 - 3232 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf...
load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, APP_RESOURCES_FIXTURE_NAME, filename)
; size_t image_size = resource_size(resource_bank, no_litter_res_id); uint8_t image_buf[image_size]; // read the last byte, and make sure it returns a a failure 0 byte return value cl_assert_equal_i( resource_load_byte_range_system(resource_bank, no_litter_res_id, image_size, image_buf, 1), 0); return; ...
, 0), 0); graphics_draw_vertical_line_dotted(&ctx, GPoint(7, 0), 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(9, 0), 2); graphics_draw_vertical_line_dotted(&ctx, GPoint(11, 0), 3); graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 0), 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(15, 0), 20); ...
graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 0), 4)
32 " POL: %"PRIu32 " MMP: %"PRIu32, size, dma_time, pol_time, mmap_time); kernel_free(buffer_dma_ptr); kernel_free(buffer_pol); kernel_free(buffer_mmap); return success; } struct FlashReadTestValues { int size; int offset; }; const struct FlashReadTestValues FLASH_READ_TEST_T...
if (is_blank != S_TRUE) { ++failures; prompt_send_response("FAILURE: sector not blank!?!"); } else { ++passes; }
profiler_start(); is_blank = flash_impl_blank_check_subsector(FLASH_REGION_FIRMWARE_SCRATCH_BEGIN); profiler_stop(); blank = profiler_get_total_duration(true); prompt_send_response_fmt(buf, buf_size, "Subsector blank check via read took: %"PRIu32, blank); if (is_blank != S_TRUE...