prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * 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...
(data->window)
; task_free(data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* ambient_light_reading_get_info() { static const PebbleProcessMdSystem s_ambient_light_info = { .common.main_func = s_main, .name = "Amb Reading" }; return (const PebbleProce...
_notification_window_data.is_modal) { Window *window = &s_notification_window_data.window; window_set_overrides_back_button(window, true); ClickManager *mgr = modal_manager_get_click_manager(); ClickConfig *cfg = &mgr->recognizers[BUTTON_ID_BACK].config; cfg->long_click.delay_ms = QUICK_DND_HOLD_MS;...
window_get_root_layer(&data->window)
->bounds.size.w; const int16_t title_width = status_layer_get_title_text_width(&data->status_layer); const int16_t status_offset = (icon_rect.size.w + icon_text_horizontal_spacing) / 2; new_status_frame.origin.x += is_visible ? status_offset : -status_offset; const int16_t new_icon_layer_x_offset = ((window_b...
ick_config_provider(SelectionLayer *selection_layer) { // Config UP / DOWN button behavior: window_set_click_context(BUTTON_ID_UP, selection_layer); window_set_click_context(BUTTON_ID_DOWN, selection_layer); window_set_click_context(BUTTON_ID_SELECT, selection_layer); window_single_repeating_click_subscribe(...
{ window_set_click_config_provider_with_context(window, (ClickConfigProvider) prv_click_config_provider, selection_layer); }
qspi_release(dev->qspi); return result ? S_TRUE : S_FALSE; } void qspi_flash_ll_set_register_bits(QSPIFlash *dev, uint8_t read_instruction, uint8_t write_instruction, uint8_t value, uint8_t mask) { // make sure we're not trying to set any bits not within the mask PBL_ASSER...
(dev->qspi, instruction, 0, dummy_cycles, buffer_dma, size, is_ddr)
; profiler_stop(); uint32_t dma_time = profiler_get_total_duration(true); profiler_start(); qspi_indirect_read(dev->qspi, instruction, 0, dummy_cycles, buffer_pol, size, is_ddr); profiler_stop(); uint32_t pol_time = profiler_get_total_duration(true); if (memcmp(buffer_dma, buffer_pol, size) != 0) { ...
ut, &window); window_render(&window, &s_ctx); } static void prv_create_layout_for_forecast_and_render_with_down_arrow_indicator( const WeatherLocationForecast *forecast) { Window window; WeatherAppLayout layout = {}; prv_create_layout_for_forecast(forecast, &layout, &window); weather_app_layout_set_dow...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_weather_app_layout__render_heavy_snow_rain_snow(void) { const WeatherLocationForecast forecast = { .location_name = "PALO ALTO", .current_temp = -88, .today_high = -88, .today_low = -88, .current_weather_type = WeatherType_HeavySnow, .current_weather_phrase = "Heavy Snow", ...
ta; uint16_t length; } test_vectors[] = { { malformatted_artist, sizeof(malformatted_artist) }, { malformatted_album, sizeof(malformatted_album) }, { malformatted_title, sizeof(malformatted_title) }, { malformatted_player, sizeof(malformatted_player) } }; for (int i = 0; i < ARRAY_LENGTH(test_...
(true /* is_android */)
; cl_assert_equal_b(music_get_player_name(NULL), false); }
start_value); property_animation_get_to_uint32(prop_h, &test_value); cl_assert_equal_i(test_value, end_value); uint32_t set_value = 1; property_animation_set_from_uint32(prop_h, &set_value); property_animation_get_from_uint32(prop_h, &test_value); cl_assert_equal_i(test_value, 1); property_animation_se...
animation_schedule(h)
; uint64_t start_ms = prv_now_ms(); uint64_t unschedule_time = 0; uint64_t time_ms; for (int num_loops = 0; num_loops < 10; num_loops++) { prv_fire_animation_timer(); time_ms = prv_now_ms(); DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", time_ms - start_ms, layer.frame.origin.x, laye...
/* * 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...
{ AppMessageOutboxSent prev_cb = s_sent_callback; s_sent_callback = sent_callback; return prev_cb; }
static AppMessageOutboxFailed s_failed_callback; AppMessageOutboxFailed app_message_register_outbox_failed(AppMessageOutboxFailed failed_callback) { AppMessageOutboxFailed prev_cb = s_failed_callback; s_failed_callback = failed_callback; return prev_cb; } void app_message_deregister_callbacks(void) { s_recei...
ing confirmation from remote: prv_confirm_cccd_write(BLEGATTErrorSuccess); fake_event_clear_last(); BLECharacteristic handle_out = ~0; uint8_t out[1]; uint16_t value_length = sizeof(out); bool has_more = true; const uint16_t next_length = gatt_client_subscriptions_consume_notification(&handle_out...
(e, BTErrnoOK)
; e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, GAPLEClientKernel); cl_assert_equal_i(e, BTErrnoOK); prv_pend_events_to_kernel_and_app(); gatt_client_subscriptions_cleanup_by_connection(s_connection, false /* should_unsubscribe */...
/* * 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(&system, &system)
); cl_assert(uuid_equal(&invalid, &invalid)); cl_assert(!uuid_equal(&system, &invalid)); const Uuid test_uuid_1 = (Uuid) { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; // Different at the start Uuid test_uuid_2 = test_uuid_1; ++test_uuid_2.byte0; // Different at the end Uuid test_uuid_3 =...
buffer for %x", endpoint_id); return false; } comm_session_send_buffer_write(sb, data, length); comm_session_send_buffer_end_write(sb); return true; } // ------------------------------------------------------------------------------------------------- typedef struct { const Uuid *app_uuid; CommSession...
{ switch (type) { case CommSessionTypeSystem: return prv_get_system_session(); case CommSessionTypeApp: return prv_get_app_session(); case CommSessionTypeInvalid: default: return NULL; } }
const Uuid *comm_session_get_uuid(const CommSession *session) { bt_lock_assert_held(true); return prv_get_uuid(session); } CommSession *comm_session_get_by_type(CommSessionType type) { CommSession *session; bt_lock(); { session = prv_get_session_by_type(type); } bt_unlock(); return session; } Co...
graphics_draw_arc_internal(&ctx, pt, radius, 0, test_angles[i].angle)
; stroke_width += 1; radius += 3; pt.x += (radius + stroke_width) * 2; if (pt.x > 120) { pt.x = CENTER_OF_ORIGIN_RECT.x; pt.y += (radius + stroke_width) * 2; } } char filename[100]; snprintf(filename, sizeof(filename), "draw_arc_offset_aa_end_angl...
parameters(TextLayer *text_layer, const GRect *frame, const char *text, GFont font, GColor text_color, GColor back_color, GTextAlignment text_align, GTextOverflowMode overflow_mode) { PBL_ASSERTN(text_layer); *text_layer = (TextLayer){}; te...
{ return; }
text_layer->should_cache_layout = should_cache_layout; if (text_layer->should_cache_layout) { PBL_LOG(LOG_LEVEL_DEBUG, "Init layout"); graphics_text_layout_cache_init(&text_layer->layout_cache); } else { graphics_text_layout_cache_deinit(&text_layer->layout_cache); text_layer->layout_cache = NU...
C_APB1Periph_UART5 | RCC_APB1Periph_I2C1 | RCC_APB1Periph_I2C2 | RCC_APB1Periph_I2C3 | RCC_APB1Periph_I2C4 | RCC_APB1Periph_CAN1 | RCC_APB1Periph_CAN2 | RCC_APB1Periph_CEC | RCC_APB1Periph_PWR | RCC_APB1Periph_DAC | RCC_APB1Periph_UART7 | RCC_APB1Periph_UART8; const uint32_t apb2_periphs = RCC_APB2Per...
(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)
) { // We're good, we're just starting normally. PBL_LOG_VERBOSE("We're good, we're just starting normally."); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); return false; } // We failed to start our firmware successfully! if (watchdog_c...
pbl_malloc.h" #include "system/logging.h" #include "system/passert.h" #include "util/attributes.h" #include "util/legacy_checksum.h" #include "util/math.h" #include <inttypes.h> #include "FreeRTOS.h" #include "timers.h" typedef struct { ListNode list_node; DataLoggingSession *session; // Session metadata to ma...
{ *soonest_ack_timeout = session->comm.ack_timeout; }
return true; } static void reschedule_ack_timeout(void) { RtcTicks soonest_ack_timeout = 0; dls_list_for_each_session(find_soonest_ack_timeout_cb, &soonest_ack_timeout); if (soonest_ack_timeout == 0) { // No one is waiting for ack, just stop the timer new_timer_stop(s_endpoint_data.ack_timer); re...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ char *endptr; uintptr_t address = strtoul(address_str, &endptr, 0); if (*endptr != '\0') { // A non-address character encountered return -1; } return address; }
/* * 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...
{ DBGMCU->CR = 0; DBGMCU->APB1FZ = 0; DBGMCU->APB2FZ = 0; }
void command_low_power_debug(char *cmd) { bool low_power_debug_on = (strcmp(cmd, "on") == 0); #ifdef MICRO_FAMILY_STM32F4 sleep_mode_enable(!low_power_debug_on); #endif if (low_power_debug_on) { enable_mcu_debugging(); } else { disable_mcu_debugging(); } }
d while (!uart_is_tx_ready(dev)) continue; dev->periph->TDR = data; } uint8_t uart_read_byte(UARTDevice *dev) { // explicitly clear the error flags to match up with F4 behavior prv_clear_all_errors(dev); // read the data regardless since it will clear interrupt flags return dev->periph->RDR; } UARTRXErr...
uart_clear_all_interrupt_flags(dev)
; } else { const bool has_byte = uart_is_rx_ready(dev); // read the data register regardless to clear the error flags const uint8_t data = uart_read_byte(dev); if (has_byte) { if (dev->state->rx_irq_handler(dev, data, &err_flags)) { should_context_switch = 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...
prv_pulse_done_command()
/* * 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...
{ AnimatedDemoData *data = window_get_user_data(window); Layer *layer = &data->text_layer.layer; GRect to_rect; if (data->toggle) { to_rect = GRect(4, 4, 120, 60); } else { to_rect = GRect(84, 92, 60, 60); } data->toggle = !data->toggle; // Does nothing if prop_animation is NULL if (data->pr...
animation_set_handlers(animation, (AnimationHandlers) { .started = (AnimationStartedHandler) animation_started, .stopped = (AnimationStoppedHandler) animation_stopped, }, data); animation_schedule(animation); } void animated_demo_window_load(Window *window) { AnimatedDemoData *data = window_get_user_d...
GCornerTopRight, .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(90),GCornerBottomRight} })); cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(90), TO_TRIG(180)), ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(90),GCornerBottomRight}, .full_quadrants = GCornerBotto...
TO_TRIG(270 + 45)
), ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(45),GCornerTopRight}, .full_quadrants = GCornersBottom, .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(270 + 45),GCornerTopLeft} })); // Ending quadrant filling up and starting quadrant finishing cl_assert_equal_edc(prv_ca...
false /* first */, animated); return item; } static void prv_render_timeline_peek(const TimelinePeekItemConfig *config) { TimelineItem *item = prv_set_timeline_item(config, false /* animated */); // Force timeline peek to be visible timeline_peek_set_visible(true, false /* animated */); TimelinePee...
timeline_peek_get_peek()
; const Layer *layer = &peek->layout_layer; // Normally it is animated, but for this unit test, we don't request `animated` cl_assert(layer->frame.origin.y >= DISP_ROWS); // Peek service shows the peek UI. Not animated for this unit test. TimelineItem *item = prv_set_timeline_item(&(TimelinePeekItemConfig) {...
lib/ui/time_selection_window.h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "process_management/app_manager.h" #include "util/date.h" #include "util/time/time.h" #include "util/string.h" #include "services/common/clock.h" #include "services/common/i18n/i18n.h" #include "services/normal/timezone_d...
(data->continent_window, continent_animated)
; const bool region_animated = true; app_window_stack_remove(&option_menu->window, region_animated); } static void prv_region_menu_push(SettingsTimeData *data) { const char *title = prv_get_timezone_title(); const OptionMenuCallbacks callbacks = { .select = prv_region_menu_select, }; const int start_in...
!= NULL && ((CronJob*)s_scheduled_jobs)->cached_execute_time <= rtc_get_time()) { CronJob *job = (CronJob*)s_scheduled_jobs; // Remove the job from the list, it's done. s_scheduled_jobs = list_pop_head(s_scheduled_jobs); // Release the mutex while we execute the callback mutex_unlock(s_li...
{ list_remove(&job->list_node, &s_scheduled_jobs, NULL); removed = true; }
mutex_unlock(s_list_mutex); return removed; } // --------------------------------------------------------------------------------------- // For Testing: void cron_clear_all_jobs(void) { mutex_lock(s_list_mutex); // Iterate over all the jobs to remove them all. for (ListNode* iter = s_scheduled_jobs; ite...
onst ElfExternalNote TINTIN_BUILD_ID; extern const uint32_t __CCM_RAM_size__[]; extern const uint32_t __DTCM_RAM_size__[]; void cd_flash_init(void); uint32_t cd_flash_write_bytes(const void* buffer_ptr, uint32_t start_addr, uint32_t buffer_size); void cd_flash_erase_region(uint32_t start_addr, uint32_t total_bytes); ...
kernel_pbl_log_from_fault_handler(__FILE_NAME__, 0, msg)
; } // ------------------------------------------------------------------------------------------------- // NOTE: We are explicitly avoiding use of vsniprintf and cohorts to reduce our stack // requirements static void prv_debug_str_str(const char* msg, const char* s) { #if PULSE_EVERYWHERE void *ctx = pulse_loggin...
lowMode overflow_mode = GTextOverflowModeTrailingEllipsis; const GTextAlignment text_alignment = GTextAlignmentCenter; const GFont title_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD); const GFont instruction_font = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD); const int16_t title_line_height = fonts_...
(layer_get_window(layer))
; switch (data->state) { case DisplayCalibrationState_X_Adjust: if (data->offset.x > -MAX_OFFSET_MAGNITUDE) { prv_draw_arrow(layer, ctx, &data->arrow_left, GAlignLeft); } if (data->offset.x < MAX_OFFSET_MAGNITUDE) { prv_draw_arrow(layer, ctx, &data->arrow_right, GAlignRight); ...
/* * 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...
grect_center_point(&frame)
; const int32_t radius = grect_shortest_side(frame) / 2 - inset; return perimeter_for_circle(vertical_range, center, radius); } T_STATIC GRangeHorizontal perimeter_for_display_rect(const GPerimeter *perimeter, const GSize *ctx_size, ...
/* * 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...
dialog_show_status_bar_layer(dialog, true)
; dialog_set_callbacks(dialog, &(DialogCallbacks) { .unload = prv_bt_dialog_unload }, bt_dialog); }
ue - 1); record_func(ctx, x, y1, y2, src_color); } } cl_assert(graphics_context_mask_record(ctx, NULL)); test_graphics_context_mask_debug(ctx, mask); graphics_context_mask_destroy(ctx, mask); } /////////////////////////////////////// // APPLYING HORIZONTAL LINE HELPERS // ////////////////////////...
{ const int16_t starting_y = row_index * vline_applying_test_row_height; for (int16_t y = starting_y; y < starting_y + vline_applying_test_row_height; y++) { ctx->draw_state.stroke_color = (GColor) { .argb = (uint8_t)(row_index | 0b11000000) }; graphics_draw_pixel(ctx, GPoint(x, y)); }...
} } static GDrawMask *prv_create_mask_for_vline_applying_test(GContext *ctx) { // The initial transparency doesn't really matter since we're about to overwrite it const bool transparent = false; GDrawMask *mask = graphics_context_mask_create(ctx, transparent); cl_assert(mask); const GSize mask_size = ctx...
st another KILL event //! with graceful set to false. This will result in this method being alled again with gracefully = false. When //! we see this, we just try and make sure the app is not stuck in privilege code. If it's not, we return true //! and allow the caller to kill the task. //! //! If however, the task is ...
if (task == PebbleTask_App) { heap = app_state_get_heap(); } else if (task == PebbleTask_Worker) { heap = worker_state_get_heap(); } else { WTF; }
// FIXME: We cast heap_size's size_t result to int because for some reason our printf doesn't // like the %zd formatter APP_LOG(APP_LOG_LEVEL_INFO, "Heap Usage for %s: Total Size <%dB> Used <%uB> Still allocated <%uB>", pebble_task_get_name(task), (int) heap_size(heap), heap->high_water_mark, heap...
o_ms_with_timers(start_ms + 1); cl_assert_equal_i(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_update_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_...
(prv_count_handler_entries(&s_started_handler_calls, a), 1)
; 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, a), 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);...
// The prior minute was the most recent active one state->last_active_minute = time_util_minute_of_day_adjust(minute_of_day, -1); ACTIVITY_LOG_DEBUG("last active minute: %"PRIu16"", state->last_active_minute); } // Update the resting calories state->resting_calories = activity_private_compute_r...
{ // There wasn't enough data in the past minute to give us confidence that // the new HR zone will represents that minute, default to Zone0 new_hr_zone = HRZone_Zone0; }
data); } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_set_steps_at_avg(int index, void *context) { ActivityDemoAppData *data = context; prv_set_steps(CURRENT_STEP_AVG, data); } // ----------------------------------------------------------...
(data, "Active Time", ActivityMetricActiveSeconds)
; } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_distance_history(int index, void *context) { ActivityDemoAppData *data = context; prv_display_scalar_history_alert(data, "Distance(m)", ActivityMetricDistanceMeters); } // -----------------...
device, when registering one intent // using the resolvable address and one with a bonding. Pebble will not try to collate these, // because there are many addresses that resolve to the same bonding. The current implementation // uses one address or one bonding per intent. BTErrno e; bool registered; BTDevi...
(&device, true /* is_master*/)
; prv_assert_client_event(&device, true /* connected */, (1 << PebbleTask_App), HCI_ERROR_CODE_SUCCESS); // Disconnect & verify the client task gets the event: prv_fake_disconnect(&device, true /* is_master */); prv_assert_client_event(&device, false /* connected */, (1 << PebbleTask_...
od reading cl_assert_equal_b(hrm_is_enabled(HRM), true); // Send some data while enabled int num_updates; for (num_updates = 0; num_updates < 1000 && hrm_is_enabled(HRM); num_updates++) { prv_fake_send_new_data(); fake_system_task_callbacks_invoke_pending(); } // Should be disabled relatively quic...
prv_put_battery_state_change_event(false /* is plugged in */)
; cl_assert(prv_can_turn_sensor_on()); fake_system_task_callbacks_invoke_pending(); cl_assert(hrm_is_enabled(HRM)); }
/* * 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_handle_fault()
; }
MIN AGO", time_buf); // June 9th 2015, 12:59:58 (T+00:59:58) rtc_set_time(event_time + (59 * SECONDS_PER_MINUTE) + 58); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("59 MIN AGO", time_buf); // June 9th 2015, 12:59:59 (T+00:59:59) rtc_set_ti...
(event_time + SECONDS_PER_HOUR + (30 * SECONDS_PER_MINUTE))
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 H AGO", time_buf); // June 9th 2015, 13:59:59 (T+01:59:59) rtc_set_time(event_time + SECONDS_PER_HOUR + (59 * SECONDS_PER_MINUTE) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_bu...
p_create_func = prv_create_bitmap_from_png_file, .need_to_destroy_bitmap = true, }, #if PBL_COLOR { .test_name = "4bitTrns", .expected_test_image_bitmap_format = GBitmapFormat4BitPalette, .bitmap_create_func = prv_create_bitmap_from_png_file, .need_to_destroy_bitmap = true, }, { .test_na...
{ prv_origin_layer_test(GPointZero); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); }
void test_graphics_draw_bitmap__origin_layer_across_x(void) { prv_origin_layer_test(GPoint(25, 0)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__origin_layer_across_nx(void) { prv_origin_layer_test(GPoint(-25, 0)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, ...
********************/ void test_app_cache__easy_evict(void) { cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app1.id, app1.size)); cl_assert_equal_i(app1.id, app_cache_get_next_eviction()); } /************************************* * Add 3, remove 2, evict one * *************************************/ void tes...
cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app2.id, app2.size))
; cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app3.id, app3.size)); app_cache_flush(); cl_assert_equal_b(false, app_cache_entry_exists(app1.id)); cl_assert_equal_b(false, app_cache_entry_exists(app2.id)); cl_assert_equal_b(false, app_cache_entry_exists(app3.id)); } #define APP_CACHE_FILE_NAME "appcach...
; static void clar_print_shutdown(int test_count, int suite_count, int error_count); static void clar_print_error(int num, const struct clar_error *error); static void clar_print_ontest(const char *test_name, int test_number, int failed); static void clar_print_onsuite(const char *suite_name, int suite_index); static v...
if (argument[0] != '-') clar_usage(argv[0]);
switch (argument[1]) { case 's': { /* given suite number, name, or prefix */ int num = 0, offset = (argument[2] == '=') ? 3 : 2; int len = 0, is_num = 1, has_colon = 0, j; for (argument += offset; *argument; ++argument) { len++; if (*argument >= '0' && *argument <= '9') ...
----------------------- static void steps_window_unload(Window *window) { HealthAPITestAppData *data = window_get_user_data(window); text_layer_destroy(data->steps_card.cur_step_layer); data->steps_card.cur_step_layer = NULL; text_layer_destroy(data->steps_card.time_layer); data->steps_card.time_layer = NULL;...
{ HealthAPITestAppData *data = (HealthAPITestAppData *)context; window_stack_push(data->debug_window, true /* Animated */); }
// ------------------------------------------------------------------------------- static void prv_hr_click_config_provider(void *context) { const int k_long_press_timeout_ms = 1000; window_single_click_subscribe(BUTTON_ID_SELECT, prv_hr_select_click_handler); window_single_click_subscribe(BUTTON_ID_UP, prv_hr...
r_notification(s_characteristics[1][PPoGATTCharacteristicMeta], (const uint8_t *) &s_meta_v0_app, sizeof(s_meta_v0_app), BLEGATTErrorSuccess); cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_app.app_uuid), true); } void test_ppogatt...
(ppogatt_client_count(), 1)
; cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid), true); Transport *client = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); // Rediscovery: ppogatt_invalidate_all_references(); prv_notify_services_discovered(1); // Still one client: cl_assert_equal_i(ppogatt_client_count...
imeline_peek_enabled(bool *enabled) { s_timeline_peek_enabled = *enabled; timeline_peek_set_enabled(*enabled); return true; } static bool prv_set_s_timeline_peek_before_time_m(uint16_t *before_time_m) { s_timeline_peek_before_time_m = *before_time_m; timeline_peek_set_show_before_time(*before_time_m * SECOND...
{ settings_file_get(&file, entry->key, key_len, entry->value, entry->value_len); }
} settings_file_close(&file); } // ------------------------------------------------------------------------------------ // Find the PrefsTableEntry for the given key static const PrefsTableEntry *prv_prefs_entry(const uint8_t *key, size_t key_len) { uint32_t num_entries = ARRAY_LENGTH(s_prefs_table); const ...
OT_BIT_SOFTWARE_FAILURE_OCCURRED)) { // We're good, we're just starting normally. dbgserial_putstr("Booting normally"); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); return false; } // We failed to start our firmware successfully! if (w...
(BOOT_BIT_STANDBY_MODE_REQUESTED)
* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distribut...
kernel_free(impl)
; } static void prv_default_kernel_receiver_finish(Receiver *receiver) { DefaultReceiverImpl *impl = (DefaultReceiverImpl *)receiver; impl->handler_scheduled = true; if ((int)impl->total_payload_size != impl->curr_pos) { PBL_LOG(LOG_LEVEL_WARNING, "Got fewer bytes than expected for handler %p", ...
y <= (MAX_PLOT_BRIGHTNESS / 2)) { int16_t x1_rounded = (x1.raw_value + (FIXED_S16_3_ONE.raw_value / 2)) / FIXED_S16_3_ONE.raw_value; int16_t x2_rounded = (x2.raw_value + (FIXED_S16_3_ONE.raw_value / 2)) / FIXED_S16_3_ONE.raw_value; prv_assign_line_horizon...
graphics_private_draw_horizontal_line_delta_prepared(ctx, framebuffer, &ctx->draw_state.clip_box, y, x1, x2, delta1, delta2, ctx->draw_state.stroke_color)
; graphics_release_frame_buffer(ctx, framebuffer); } #endif // PBL_COLOR void graphics_private_draw_horizontal_line_delta_non_aa(GContext *ctx, int16_t y, Fixed_S16_3 x1, Fixed_S16_3 x2, Fixed_S16_3 delta1, Fixed...
/* * 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_unlock()
; } bool connection_is_valid(Connection *connection) { bool rv; prv_lock(); { rv = list_contains((ListNode *)s_connections, (const ListNode *)connection); } prv_unlock(); return rv; } static bool prv_connection_by_idx_list_filter_cb(ListNode *found_node, void *data) { uint16_t conn_idx = (uintptr_t)...
else { s_ancs_client->alive_check_pending = true; } } static void prv_is_ancs_alive_cb(void *data) { launcher_task_add_callback(prv_is_ancs_alive_launcher_task_cb, data); } // ----------------------------------------------------------------------------- //! With iOS 8.2 the pre-existing flag seems to be broke...
prv_is_reassembly_in_progress()
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(path->points, path->num_points, s_offset)
; s_path_open = open; s_path_stroke_count++; } void gpath_fill_precise_internal(GContext *ctx, GPointPrecise *points, size_t num_points) { s_fill_points = prv_copy_points((GPoint*)points, num_points, s_offset); s_path_fill_precise_count++; } void gpath_draw_filled(GContext* ctx, GPath *path) { s_fill_points...
vent_to_process(PebbleTask task, void (*callback)(void *data), void *data) { PBL_ASSERTN(callback != NULL); PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = callback, .data = data, }, }; process_manager_send_event_to_process(task, &event); } // -----------...
{ return false; }
*uuid_out = app_md->uuid; return true; } // ------------------------------------------------------------------------------------------- DEFINE_SYSCALL(AppInstallId, sys_process_manager_get_current_process_id, void) { return prv_get_context()->install_id; } // ---------------------------------------------------...
prv_config(); gbitmap_init_with_resource(&window->bitmap, RESOURCE_ID_MUSIC_IMAGE_NO_MUSIC); const GSize NO_MUSIC_IMAGE_SIZE = window->bitmap.bounds.size; const GRect NO_MUSIC_IMAGE_RECT = GRect(config->no_music_img_pos.x, config->no_music_img_pos.y, ...
(data->length_buffer, sizeof(data->length_buffer), data->track_length / 1000)
; } } static void prv_update_pos(void) { MusicAppData *data = app_state_get_user_data(); music_get_pos(&data->track_pos, &data->track_length); prv_update_track_progress(data); } static void prv_handle_tick_time(struct tm *time, TimeUnits units_changed) { if (music_get_playback_state() == MusicPlayStatePlayi...
ist_write_int(AppPersistKeyLapSteps, data->lap_steps); text_layer_set_text(data->steps_card.delta_step_layer, "0"); } // ------------------------------------------------------------------------------- static void steps_up_click_handler(ClickRecognizerRef recognizer, void *context) { HealthAPITestAppData *data = (H...
if (event == HealthEventSleepUpdate) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Got sleep update event"); } else if (event == HealthEventHeartRateUpdate) { prv_hr_update_text(data); } else if (event == HealthEventMetricAlert) { HealthValue now_bpm = health_service_peek_current_value(HealthMetricHeartRateBPM); ...
} // ------------------------------------------------------------------------------- static void steps_base_layer_update_proc(Layer *layer, GContext* ctx) { const GRect bounds = layer_get_bounds(layer); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_rect(ctx, bounds, 0, GCornerNone); // S...
necessarily. If you hit this // assert and you have a good reason for making the event bigger, feel free to relax the restriction. //PBL_LOG(LOG_LEVEL_DEBUG, "PebbleEvent size is %u", sizeof(PebbleEvent)); // FIXME: _Static_assert(sizeof(PebbleEvent) <= 12, "You made the PebbleEvent bigger! It ...
if (buffer && *buffer) { kernel_free(*buffer); *buffer = NULL; }
{ -288, 968, 472}, { -312, 848, 424}, { -232, 824, 320}, { -256, 640, 248}, { -296, 512, 208}, { -320, 504, 248}, { -384, 528, 248}, { -528, 600, 264}, { -520, 792, 400}, { -584, 864, 472}, { -560, 928, 504}, { -688, 928, 696}, { -488, 952, 536}, { -504, 760, 584}, ...
{ -568, 824, 424}, { -728, 1112, 664}, { -400, 1120, 544}, { -360, 800, 392}, { -432, 640, 520}, { -400, 904, 512}, // 455 seconds { -232, 648, 520}, { -320, 688, 344}, { -296, 672, 296}, { -328, 664, 352}, { -368, 736, 344}, { -424, 736, 320}, { -448, 736, 352}, ...
{ 72, -88, -1016}, { 56, -56, -1024}, { 56, -104, -1016}, { 40, -64, -1032}, { 56, -72, -1024}, { 72, -72, -1016}, { 104, -72, -1000}, { 184, -192, -976}, { 352, -224, -944}, { 440, -272, -928}, { 432, -232, -944}, { 336, 136, -840}, { 128, 640, -712}, { -200, 80...
/* * 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 (islower(c)) { return toupper(c); } else { return c; } }
int tolower_theirs(int c) { if (isupper(c)) { return tolower(c); } else { return c; } } // "Define" libc functions we're testing #include "pblibc_private.h" #include "include/ctype.h" /////////////////////////////////////////////////////////////////////////////////////////////////// //! Tests #define ...
/* * 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 (int i = 0; i < level->num_items; ++i) { const ActionMenuItem *item = &level->items[i]; if (!item->is_leaf && item->next_level) { prv_cleanup_helper(item->next_level, each_cb, context); } if (each_cb) { each_cb(item, context); } }
applib_free((void *)level); } void action_menu_hierarchy_destroy(const ActionMenuLevel *root, ActionMenuEachItemCb each_cb, void *context) { if (root) { prv_cleanup_helper(root, each_cb, context); } }
(key, key_len, PREF_KEY_SEND_TEXT_APP)
; const bool is_valid_weather_key = prv_is_key_valid(key, key_len, PREF_KEY_WEATHER_APP); const bool is_valid_reminder_key = prv_is_key_valid(key, key_len, PREF_KEY_REMINDER_APP); if (!is_valid_send_text_key && !is_valid_weather_key && !is_valid_reminder_key) { PBL_LOG(LOG_LEVEL_ERROR, "Error inserting app_p...
/* * 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...
(DlsSystemTagProtobufLogSession, DATA_LOGGING_BYTE_ARRAY, PLOG_DLS_RECORD_SIZE, buffered, resume, &system_uuid)
0}, { 1208, 152, -88}, { 1280, 208, -64}, { 1144, 256, -128}, { 848, 264, -152}, { 600, 200, -120}, { 496, 184, -88}, { 504, 192, -80}, { 616, 248, -104}, { 792, 328, -168}, { 1048, 368, -216}, { 1128, 352, -296}, { 1128, 272, -240}, { 1288, 336, -224}, { 1144, 36...
{ 1040, 112, -56}, { 1192, 144, -96}, { 1072, 96, -96}, { 1096, 104, -104}, { 1336, 176, -72}, { 1408, 264, -136}, // 24 seconds { 1112, 272, -160}, { 752, 240, -216}, { 568, 200, -208}, { 520, 192, -184}, { 576, 176, -200}, { 680, 224, -208}, { 808, 256, -224}, ...
{ 576, 256, -136}, { 752, 64, -216}, { 936, 440, -168}, { 968, 320, -240}, { 1056, 304, -240}, { 1056, 336, -280}, { 1176, 320, -208}, { 1184, 328, -216}, { 1032, 328, -184}, { 1120, 280, -104}, { 1264, 288, -56}, { 1248, 248, -8}, { 1008, 208, 24}, // 27 seconds...
eof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpAssignInverted, GColorWhite); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_assigninverted-expect.8bit.pbi")); memset(dest_data, GColorBlue.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap...
bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorWhite)
; cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_comptint_black_cross_white_corners-expect.8bit.pbi")); memset(dest_data, GColorBlack.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorBlack); cl_check(gbitmap_pbi_eq(&dest_bitmap, "te...
l_assert(circular_buffer_consume(&buffer, 4)); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 6); // Now there's just 56 in the buffer. Fill it to the brim cl_assert(circular_buffer_write(&buffer, (uint8_t*) "789", 3)); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer)...
circular_buffer_copy_offset(&buffer, 2 /* start_offset */, data_out, data_out_size)
, 6); cl_assert(memcmp("456789", data_out, 6) == 0); } void test_circular_buffer__direct_write(void) { CircularBuffer buffer; uint8_t storage[8]; circular_buffer_init(&buffer, storage, sizeof(storage)); circular_buffer_write(&buffer, (uint8_t *)"0123", 4); uint8_t *data_out; uint16_t contiguous_num_byt...
Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; cl_assert_equal_i(timeline_init(&head), S_SUCCESS); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1430236800 - 60 * 60), S_SUCCESS); const time_t midnight_apr_28_pst = 143020...
(uuid_equal(&state.node->id, &all_day_item.header.id))
; cl_assert(!state.node->all_day); cl_assert_equal_i(state.node->timestamp, midnight_march_3_utc); cl_assert_equal_i(state.node->duration, 0); cl_assert_equal_i(state.current_day, midnight_march_2_pst); // no more cl_assert(!iter_next(&iterator)); // 1 delete cl_assert(timeline_iter_remove_node_with_i...
/* * 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 (app_window_stack_count() == 0) { PBL_LOG(LOG_LEVEL_DEBUG, "No more windows, killing current app"); PebbleEvent event = { .type = PEBBLE_PROCESS_KILL_EVENT, .kill = { .gracefully = true, .task=PebbleTask_App } }; sys_send_pebble_event_to_kernel(&event); return; }
// Check to see if handling the previous event requires us to rerender ourselves. if (prv_app_is_render_scheduled() && !*app_state_get_framebuffer_render_pending()) { prv_render_app(); } } static void prv_app_will_focus_handler(PebbleEvent *e, void *context) { Window *window = app_window_stack_get_...
/* * 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...
(LOG_LEVEL_ERROR, "DMA Compositing never completed.")
/* * 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(graphics_context_mask_record(ctx, NULL))
; cl_assert_equal_p(ctx->draw_state.draw_implementation, &g_default_draw_implementation); cl_assert(graphics_context_mask_use(ctx, mask)); cl_assert_equal_p(ctx->draw_state.draw_mask, mask); graphics_context_set_fill_color(ctx, GColorRed); graphics_fill_rect(ctx, &ctx->dest_bitmap.bounds); cl_assert(grap...
} #define DRAWING_SPACING 40 char *mode_names[] = { "_90_degrees", "180_degrees", "270_degrees", }; char *precision_modes[] = { "without_faction", "with_fraction", }; void test_graphics_draw_circle_${BIT_DEPTH_NAME}__radial_precise(void){ GContext ctx; test_graphics_context_init(&ctx, fb); uint32_t ...
TO_TRIG(180)
, TO_TRIG(270)), ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(180),GCornerBottomLeft}, .full_quadrants = GCornerBottomLeft, .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(270),GCornerTopLeft} })); cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(270), TO_TRIG(360...
, 688, 24}, { 1976, 176, -128}, { 1688, -1008, -448}, { 1488, -552, -176}, { 1368, 8, 200}, { 1152, 136, 80}, { 2840, 4000, -984}, { 952, 4000, -1328}, // 15 seconds { -1232, 2928, -696}, { -872, 920, -232}, { -840, -120, -288}, { -1248, -464, -64}, { -1808, -392, -19...
{ 1776, 392, -40}, // 20 seconds { 1760, -272, -384}, { 1864, -328, 120}, { 1200, -360, 336}, { 1160, 880, -136}, { 728, 3872, 176}, { -128, 4000, 360}, { -312, 3080, -104}, { -968, 1384, 352}, { -680, 392, 0}, { -720, -72, -288}, { -1600, -368, -112}, { -1424, -1...
(num_fmt_conversions - num_strings) * sizeof(uint32_t); unsigned str1_len = 0; unsigned str2_len = 0; // Now, count the string size, if necessary if (num_strings) { va_list args; va_start(args, packed_loghash); for (unsigned index = 0; index < num_fmt_conversions; ++index) { const char *str...
((uint8_t *)msg_buffer, length)
; } #else // PBL_LOGS_HASHED static char prv_get_log_level_char(uint8_t log_level) { switch (log_level) { case LOG_LEVEL_ALWAYS: return 'A'; case LOG_LEVEL_ERROR: return 'E'; case LOG_LEVEL_WARNING: return 'W'; case LOG_LEVEL_INFO: return 'I'; case LOG_LEVEL_DEBUG: return 'D'; case LOG_LEVEL...
eck_atan2(1, -32768); // <- causes overflow for int16 check_atan2(20001, 20000); // <- causes overflow if numbers are added in an int16 check_atan2(32767, 1); check_atan2(1, 32767); check_atan2(32767, 0); check_atan2(0, 32767); check_atan2(23400, -25300); check_atan2(30500, -1930); check_atan2(-6, -310)...
(WITHIN(5, min, max), false)
; } void test_math__distance_to_boundary(void) { cl_assert_equal_i(10, distance_to_mod_boundary(10, 100)); cl_assert_equal_i(50, distance_to_mod_boundary(50, 100)); cl_assert_equal_i(10, distance_to_mod_boundary(90, 100)); cl_assert_equal_i(10, distance_to_mod_boundary(110, 100)); cl_assert_equal_i(10, dista...
ke_put_bytes_storage_mem.h" #include "fake_queue.h" #include "fake_rtc.h" #include "fake_session.h" #include "fake_spi_flash.h" #include "fake_system_task.h" #include "stubs_bt_lock.h" #include "stubs_freertos.h" #include "stubs_hexdump.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" ...
(total_size)
, .type = object_type | (1 << 7), .cookie = htonl(cookie), }; prv_receive_data(s_session, (const uint8_t *) &init_msg, sizeof(init_msg)); } static void prv_receive_init_file(uint32_t total_size, const char *fn, size_t fn_len) { uint8_t buffer[sizeof(InitRequest) + fn_len]; InitRequest *init_msg = (Ini...
descend = true; } node_hidden_do_not_descend: node = prv_layer_tree_traverse_next(stack, LAYER_TREE_STACK_SIZE, &current_depth, descend); ctx->draw_state = root_draw_state; } } void layer_property_changed_tree(Layer *node) { layer_process_tree(node, NULL, layer_property_changed_tree_node); } void ...
{ // Get the reference to the next now; layer_remove_from_parent will unlink them. Layer *next_sibling = child->next_sibling; layer_remove_from_parent(child); child = next_sibling; }
; } void layer_add_child(Layer *parent, Layer *child) { PBL_ASSERTN(parent != NULL); PBL_ASSERTN(child != NULL); if (child->parent) { layer_remove_from_parent(child); } PBL_ASSERTN(child->next_sibling == NULL); child->parent = parent; layer_set_window(child, parent->window); if (child->window) { ...
< ARRAY_LENGTH(thin_values); i++) { action_menu_level_add_action(root_level, thin_values[i], prv_noop_action_callback, NULL); } const unsigned int selected_index = 1; prv_prepare_canvas_and_render_action_menus_static(root_level, selected_index, 0); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); }...
(root_level, voice_level, "Dismiss")
; ActionMenuLevel *template_level = action_menu_level_create(1); action_menu_level_add_action(template_level, "This won't be seen", prv_noop_action_callback, NULL); action_menu_level_add_child(root_level, template_level,...
/* * 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...
(block_addr, SECTOR_SIZE_BYTES, BOARD_NOR_FLASH_SIZE - SECTOR_SIZE_BYTES - 1)
) { // Middle of flash has 64k lock units block_addr = flash_impl_get_sector_base_address(block_addr); block_size = SECTOR_SIZE_BYTES; } else { // Start and end of flash have 1 sector of 4k lock units block_addr = flash_impl_get_subsector_base_address(block_addr); block_size = SU...
nuteFileInfoContext *)context_arg; context->num_records++; return true; } bool activity_algorithm_minute_file_info(bool compact_first, uint32_t *num_records, uint32_t *data_bytes, uint32_t *minutes) { if (!prv_lock()) { return false; } bool success = false; Sett...
if (!dls_session) { return false; }
DataLoggingResult result = dls_log(dls_session, &record, 1); bool success = (result == DATA_LOGGING_SUCCESS); // Force data logging to send to the phone if (success) { dls_send_all_sessions(); } return success; }
/* * 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 (int count = 0; count < 100; ++count) { psleep(10); dialog_spi_transmit_data_no_wait((uint8_t *)core_dump_connect_ping, sizeof(core_dump_connect_ping)); psleep(10); dialog_spi_receive_data_no_wait(buffer, sizeof(buffer)); if (memcmp(buffer, core_dump_connec...
/* * 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...
sys_ble_consume_scan_results(buffer, &size)
; if (size == 0) { goto finally; } // Walk all the reports in the buffer: const uint8_t *cursor = buffer; while (cursor < buffer + size) { const GAPLERawAdReport *report = (GAPLERawAdReport *)cursor; const BTDeviceInternal device = (const BTDeviceInternal) { .address = report->address.add...
, -248}, { 496, -8, -160}, { 432, 56, -128}, { 496, 72, -112}, { 688, 184, -168}, { 936, 248, -296}, { 1176, 248, -320}, { 1280, 192, -224}, { 1200, 224, -336}, { 1264, 120, -256}, { 1440, 64, -184}, // 93 seconds { 1320, -16, -80}, { 928, -8, -152}, { 592, -8, -1...
{ 512, 104, -808}, // 99 seconds { 480, 24, -832}, { 440, 24, -808}, { 408, 8, -856}, { 384, -8, -808}, { 256, 16, -736}, { 360, 64, -848}, { 312, 56, -912}, { 296, 0, -984}, { 256, 136, -560}, { 256, 56, -880}, { 312, 48, -912}, { 344, 24, -928}, { 208, 0, -9...
// ---------------------------------------------------------------- // Sample captured: 2015-10-07 13:52:19 local AccelRawData *activity_sample_walk_200_pbl_25820_11(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25820_11 //> TEST_EXPECTED 200 //>...
DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 4 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, tru...
(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 2)
; graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw2_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 2); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_REC...
->size.w); if (overflow > 0) { rect_to_clip->size.w -= overflow; } if (rect_to_clip->origin.y < rect_clipper->origin.y) { overflow = rect_clipper->origin.y - rect_to_clip->origin.y; if (overflow > rect_to_clip->size.h) { rect_to_clip->size.h = 0; } else { rect_to_clip->size.h -= overfl...
rect->origin.x = inside_rect->origin.x; rect->origin.y = (inside_rect->size.h - rect->size.h) + inside_rect->origin.y; return; } }
} GRect grect_crop(GRect rect, const int32_t crop_size_px) { int16_t cropped_width = rect.size.w - 2 * crop_size_px; int16_t cropped_height = rect.size.h - 2 * crop_size_px; PBL_ASSERTN(cropped_width >= 0); PBL_ASSERTN(cropped_height >= 0); return grect_inset_internal(rect, crop_size_px, crop_size_px); } ...
/* * 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...
(FONT_KEY_GOTHIC_14_BOLD)
; text_layer_set_font(text_layer, font); if (highlight) { text_layer_set_background_color(text_layer, GColorWhite); text_layer_set_text_color(text_layer, GColorBlack); } else { text_layer_set_background_color(text_layer, GColorClear); text_layer_set_text_color(text_layer, GColorWhite); } text_...
/* * 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 (*s++ && maxlen--) { len++; }
return len; }
te_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled.${BIT_DEPTH_NAME}.pbi")); printf("-- left\n"); prv_reset(); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; gpath_move_to(s_house_path, GPoint(0, SCREEN_HEIGHT / 2)); ctx.draw_state.drawing_bo...
(NULL, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_bolt_aa.8bit.pbi")); // Duplicate points in GPath test - makes sure theres no division by zero ;) prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_duplicates_path; ctx.draw_state.clip_box = GRect(0, 0, ...
f SCREEN_COLOR_DEPTH_BITS == 1 return default_sep_height; #else const int16_t line_height = fonts_get_font_height(aml->layout_cache.font); const int16_t sep_height = MAX(menu_cell_small_cell_height() - line_height, default_sep_height) + 1; return sep_height; #endif } static int...
fonts_get_font_height(aml->layout_cache.font)
; const int16_t padding = prv_get_cell_padding(aml); const int16_t max_visible_height = line_height * MAX_NUM_VISIBLE_LINES; const GRect *bounds = &aml->layer.bounds; int16_t total_h = 0; for (int16_t idx = 0; idx < aml->num_items; idx++) { int16_t item_height = aml->layout_cache.item_heights[idx]; ...
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 "settings_notifications_private.h" #include "settings_menu.h" #include "settings_option_menu.h" #include "settings_window.h" #i...
vibes_short_pulse()
; } app_window_stack_remove(&option_menu->window, true /* animated */); } static void prv_vibe_menu_push(SettingsNotificationsData *data) { const OptionMenuCallbacks callbacks = { .select = prv_vibe_menu_select, }; /// The option in the Settings app for choosing a vibration intensity for notifications. ...
); } // ------------------------------------------------------------------------------- static void prv_test_activity_summary(void *context) { bool passed = true; activity_prefs_activity_insights_set_enabled(true); // Set to the trigger time struct tm time_tm = {}; const time_t now = rtc_get_time(); loca...
(LOG_LEVEL_DEBUG, "Test result: %s", result_str)
; data->menu_items[data->test_index].subtitle = result_str; layer_mark_dirty(simple_menu_layer_get_layer(data->menu_layer)); } // ------------------------------------------------------------------------------- static void prv_window_load(Window *window) { ActivityTestAppData *data = window_get_user_data(window...
_Static_assert((LOG_REGION_SIZE / ERASE_UNIT_SIZE) >= 2, "Need to have at least 2 eraseable units for flash logging to work")
; _Static_assert((LOG_REGION_SIZE % LOG_PAGE_SIZE) == 0, "The log page size must be divisible by the log region size"); _Static_assert(((FLASH_REGION_DEBUG_DB_END % ERASE_UNIT_SIZE) == 0) && ((FLASH_REGION_DEBUG_DB_END % ERASE_UNIT_SIZE) == 0), "Space for flash logging must be aligned on an erase region bou...
date, 0); cl_assert_equal_i(s_render_pending, true); // Now transition to a modal. The app framebuffer should be released. No animation should be started. s_modal_window_present = true; compositor_transition(&s_transition_a); cl_assert_equal_i(s_render_pending, false); cl_assert_equal_i(s_count_animation_c...
(&s_transition_a)
; cl_assert_equal_i(s_count_animation_create, 1); cl_assert_equal_i(s_count_display_update, 1); cl_assert_equal_i(s_count_animation_schedule, 0); // Have the app render once so the animation can start s_render_pending = true; compositor_app_render_ready(); cl_assert_equal_i(s_count_animation_schedule, 1)...
}, { .input = jerry_create_string((const jerry_char_t *)""), .expected_output = "", }, { .input = jerry_create_string((const jerry_char_t *)"js"), .expected_output = "js", }, { .input = jerry_create_null(), .expected_output = "null", }, { .input ...
((const jerry_char_t *)"123")
, }, .argc = 4, .error_msg = "TypeError: Argument at index 3 is not a Number", }, }; for (int i = 0; i < ARRAY_LENGTH(cases); ++i) { jerry_value_t *argv = cases[i].argv; jerry_length_t argc = cases[i].argc; GRectPrecise output; memset(&output, 0x55, sizeof(output)); ROCK...
///////////////////////////////////////////////////// static const uint8_t s_register_player_entity[] = {0x00, // Apple bug #21283910 // See ams.c, prv_get_registration_cmd_for_entity ...
(1 /* num_instances */)
; // Not connected yet (still need to subscribe): cl_assert_equal_s(music_get_connected_server_debug_name(), NULL); prv_set_dummy_server_connected(true /* connected */); // Simulate successful subscription: BLECharacteristic entity_update = s_characteristics[0][AMSCharacteristicEntityUpdate]; ams_handle_s...
specific language governing permissions and * limitations under the License. */ #include "timeline_resources.h" #include "applib/graphics/gdraw_command_private.h" #include "applib/ui/kino/kino_reel.h" #include "kernel/pbl_malloc.h" #include "process_management/app_install_manager.h" #include "resource/resource_ids...
{ return prv_get_sys_resource(timeline_id, size, res_info_out); }
else if (prv_validate_lut(res_app_num)) { const uint32_t res_id = prv_get_app_resource_id(res_app_num, timeline_id, size); if (res_id != RESOURCE_ID_INVALID) { const AppResourceInfo res_info = (AppResourceInfo) { .res_app_num = res_app_num, .res_id = res_id, }; if (prv_is_app_...
/* * 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, &end)
; } graphics_private_draw_horizontal_line_prepared(ctx, framebuffer, &ctx->draw_state.clip_box, y1, (Fixed_S16_3) {.integer = start}, (Fixed_S16_3) {.integer = end}, stroke_color); } else if (dx == 0) { ...
is the region erased ? FlashLoggingHeader erased_hdr; memset(&erased_hdr, 0xff, sizeof(erased_hdr)); bool region_erased = (memcmp(&erased_hdr, &hdr, sizeof(hdr)) == 0); if (!region_erased) { // unrecognized format, erase everything prv_format_flash_logging_region(); return (UINT3...
prv_erase_unit(prv_get_unit_base_address(flash_addr))
; } s_curr_state.log_file_id = prv_get_next_log_file_id(prev_log_id); s_curr_state.page_start_addr = flash_addr; new_log_region_found = true; break; } // everything was in increasing order or there was only one log generation // if there was only one log generation, we must find the oldest p...
s_list_for_each_session //! @param empty_all_data A bool that indicates if the session should be force emptied static bool prv_send_session(DataLoggingSession *logging_session, void *empty_all_data) { dls_private_send_session(logging_session, (bool) empty_all_data); return true; } //! @param empty_all_data A bool ...
(logging_session->item_size <= num_bytes)
; num_bytes -= (num_bytes % logging_session->item_size); uint32_t new_read_offset; int32_t read_bytes = dls_storage_read(logging_session, buffer, num_bytes, &new_read_offset); if (read_bytes < 0) { goto exit; } PBL_ASSERTN((uint32_t)read_bytes <= DLS_ENDPOINT_MAX_PAYLOAD); unsigned int leftover_byte...
in_lookup(angle) * radius_of_path / TRIG_MAX_RATIO) + circle_center_point.x, .y = (-cos_lookup(angle) * radius_of_path / TRIG_MAX_RATIO) + circle_center_point.y, }; const GPoint circle2_location = { .x = (-sin_lookup(angle) * (-radius_of_path) / TRIG_MAX_RATIO) + circle_center_point.x, .y = (-cos_lookup...
(animation, anim_handler, data)
; data->spinner_anim_impl = (AnimationImplementation) { .update = prv_anim_impl, }; animation_set_implementation(animation, &data->spinner_anim_impl); animation_schedule(animation); } } Window* spinner_ui_window_get(GColor spinner_color) { SpinnerUIData *data = kernel_malloc_check(sizeof(Sp...
/* * 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...
{ printf("%s:%d", src_filename, src_line_number); va_list args; va_start(args, fmt); vprintf(fmt, args); va_end(args); printf("\n"); }
GContext* app_state_get_graphics_context() { return emx_graphics_get_gcontext(); } bool app_state_get_text_perimeter_debugging_enabled(void) { return false; } Heap *app_state_get_heap(void) { return NULL; } GBitmap* app_state_legacy2_get_2bit_framebuffer(void) { return NULL; } bool heap_is_allocated(Heap*...
2, 0xFC, 0xFF, 0x80, 0x00, 0x44, 0x00, 0x26, 0x01, 0x11, 0x41, 0x08, 0x11, 0x84, 0x04, 0x82, 0xC0, 0x01, 0x40, 0x00}; uint32_t gothic_18_bold_handle = RESOURCE_ID_GOTHIC_18; uint32_t gothic_18_bold_extended_handle = RESOURC...
(text_resources_init_font(0, gothic_18_handle, 0, &s_font_info))
; cl_assert_equal_i(FONT_VERSION(s_font_info.base.md.version), 3); cl_assert(!HAS_FEATURE(s_font_info.base.md.version, VERSION_FIELD_FEATURE_RLE4)); // Load GOTHIC_18_COMPRESSED. This is the same font, added by hand to the system resource pack. // To do this, simply copy the GOTHIC_18 stanza in resource/normal...
}, { 48, 808, 328}, { 64, 832, 376}, { -32, 840, 408}, { -40, 728, 440}, { -72, 704, 432}, { -96, 752, 400}, { -88, 848, 440}, { 8, 1000, 528}, { 176, 1184, 648}, { 440, 1216, 520}, { 344, 1088, 104}, { 352, 1144, -216}, { 320, 680, 96}, // 310 seconds { 240, ...
{ -48, -152, -1016}, { -48, -144, -1024}, { -32, -184, -1016}, { -32, -160, -1024}, { -32, -208, -1024}, { -8, -248, -976}, { 40, -344, -880}, { 88, -168, -824}, { 80, 264, -584}, { 24, 832, -352}, { -112, 1232, -120}, { -248, 1224, -80}, { -264, 1104, 120}, { -28...
{ -464, 768, 408}, { -488, 696, 368}, // 318 seconds { -464, 688, 312}, { -464, 800, 368}, { -448, 864, 392}, { -448, 848, 432}, { -384, 856, 456}, { -392, 928, 528}, { -376, 944, 488}, { -312, 872, 384}, { -288, 736, 376}, { -248, 664, 328}, { -168, 896, 416}, ...
! Public Functions AlarmId alarm_create(const AlarmInfo *info) { prv_assert_alarm_params(info->hour, info->minute); SettingsFile file; if (!prv_file_open_and_lock(&file)) { return ALARM_INVALID_ID; } AlarmId id = prv_get_next_free_alarm_id(&file); AlarmConfig config = { .hour = info->hour, .mi...
(id, prv_set_alarm_kind_op, (void *)(uintptr_t)kind)
; } // ---------------------------------------------------------------------------------------------- static bool prv_set_alarm_custom_op(AlarmId id, AlarmConfig *config, void *context) { const bool (*scheduled_days)[DAYS_PER_WEEK] = context; config->kind = ALARM_KIND_CUSTOM; memcpy(&config->scheduled_days, sche...
dow = time_util_get_midnight_of(timestamp - TIMELINE_PAST_WINDOW); time_t end_time = node_timestamp + (node_duration * SECONDS_PER_MINUTE); time_t start_time = node_timestamp; return !(start_time >= future_window || end_time < past_window); } static bool prv_show_event(TimelineNode *node, time_t timestamp, time...
MAX(num_days, 1)
; } static void prv_set_nodes(TimelineNode *nodes[], CommonTimelineItemHeader *header, int num_nodes) { // Multiday events: // first day: timestamp at beginning of event, duration for rest of the day // middle days: all day events // end days: event at end time // // single event: // timestamp, duration ...
alse; } s_alg_state->steps = activity_metrics_prv_get_steps(); s_alg_state->prev_active_calories = activity_metrics_prv_get_active_calories(); s_alg_state->prev_resting_calories = activity_metrics_prv_get_resting_calories(); s_alg_state->prev_distance_mm = activity_metrics_prv_get_distance_mm(); prv_unlock(...
{ AlgReadMinutesContext *context = (AlgReadMinutesContext *)context_param; AlgMinuteFileRecord chunk; if (!prv_read_minute_file_record(file, info, context->oldest_key, context->newest_key, &chunk)) { // This record key not within the desired time range return true; } // Check the exact time range us...