prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ax_elapsed_ticks - The max amount of time to spend attempting to //! find / create the free space. If 0, then there is no timeout static void pfs_prepare_for_file_creation(uint32_t file_size, uint32_t max_elapsed_ticks) { uint16_t pages_to_find = (file_size + PFS_PAGE_SIZE...
(&next_page, use_gc_allocator, true)
) != S_SUCCESS) { unlink_flash_file(start_page); // on failure, unallocate return (rv); } pg_hdr.next_page_crc = crc8_next_page(next_page); pg_hdr.next_page = next_page; write_pg_header(&pg_hdr, curr_page); curr_page = next_page; // continuation page header settings ...
, "v255", 5); cl_assert_equal_i(settings_file_set(&file, key, key_len, val, val_len), E_OUT_OF_STORAGE); int val_len_out = settings_file_get_len(&file, key, key_len); cl_must_pass(val_len_out); uint8_t *val_out = malloc(val_len_out); cl_assert_equal_i(settings_file_get(&file, key, key_len, val_out, val_len_ou...
{ fake_spi_flash_init(0, 0x1000000); // Wednesday (the 1st) at 00:00 // date -d "2014/01/01 00:00:00" "+%s" ==> 1388563200 fake_rtc_init(0, 1388563200); pfs_init(false); SettingsFile file_original; cl_must_pass(settings_file_open(&file_original, "test_file_atomic", 4096)); uint8_t key[4]; int key_le...
cl_must_pass(val_len_out); uint8_t *val_out = malloc(val_len_out); cl_must_pass(settings_file_get(&file_new, key, key_len, val_out, val_len_out)); if (val_len_out == original_value_length) { printf("original! %d\n", original_value_length); cl_assert_equal_m(original_value, val_out, val_le...
nstall_id != install_id || (crash_info.crash_ticks + RETURN_CRASH_TIMEOUT_TICKS) < rtc_get_ticks()) { crash_info = (AppCrashInfo) { .install_id = install_id, .crash_ticks = rtc_get_ticks() }; // Re-launch immediately watchface_launch_default(NULL); return; } SimpleDialog *cras...
if (!process_manager_make_process_safe_to_kill(PebbleTask_App, gracefully)) { // Maybe next time... return false; }
AppInstallId old_install_id = s_app_task_context.install_id; // Kill the current app prv_app_cleanup(); // If we had to ungracefully kill the current app, switch to the launcher app if (!gracefully) { app_install_release_md(s_next_app.md); s_next_app = (NextApp) { .md = system_app_state_mach...
/* * 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("Invalid PDC sequence: %s\n", filename); return; }
// Create directory from base name (with extension stripped) char output[strlen(filename) + 1 + strlen("_65535.png")]; // max size of a file path size_t len = prv_get_base_path(filename, output); // Write out each frame as a PNG for (int i = 0; i < gdraw_command_sequence_get_num_frames(sequence); i++) { ...
ndowCallbacks){ .selected = prv_number_window_selected_cb, }, value); number_window_set_min(number_window, 0); number_window_set_max(number_window, max); number_window_set_value(number_window, *value); app_window_stack_push(number_window_get_window(number_window), true); } //---------------------------------...
(&data->txrx_menu_layer)
); } static uint16_t prv_menu_get_num_rows(MenuLayer *menu_layer, uint16_t section, void *context) { AppData *data = context; if (data->current_test == BTLETestType_TX) { uint16_t count = TXMenuIdx_Count; if (data->is_unmodulated_cw_enabled) { count -= TX_MENU_NUM_PAYLOAD_ROWS; // Payload rows are hi...
tionUpdateImplementation) property_animation_update_int16, }, .accessors = { .setter = { .int16 = prv_set_char_index } } }; Dialog *dialog = expandable_dialog_get_dialog((ExpandableDialog *)transcription_dialog); // Count the number of codepoints in the message *transcription_dialog->zero = ...
(transcription_dialog)
; } } void transcription_dialog_push(TranscriptionDialog *transcription_dialog, WindowStack *window_stack) { PBL_ASSERTN(transcription_dialog); expandable_dialog_push((ExpandableDialog *)transcription_dialog, window_stack); } void app_transcription_dialog_push(TranscriptionDialog ...
e "lis3dh.h" #include "board/board.h" #include "drivers/exti.h" #include "drivers/gpio.h" #include "drivers/i2c.h" #include "drivers/legacy/accel.h" #include "drivers/periph_config.h" #include "drivers/vibe.h" #include "kernel/events.h" #include "pebble_errors.h" #include "registers.h" #include "services/common/accel_...
(LIS3DH_FIFO_CTRL_REG, mode)
) { return; } } } static void prv_reset(void) { lis3dh_lock(); if (i2c_bitbang_recovery(I2C_LIS3DH)) { prv_clear_fifo(); } lis3dh_unlock(); analytics_inc(ANALYTICS_DEVICE_METRIC_ACCEL_RESET_COUNT, AnalyticsClient_System); } bool lis3dh_read(uint8_t register_address, uint8_t read_size, uint8...
/* * 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...
("Music", (void *)0x12345)
; cl_assert(strcmp(first, "Musique") == 0); cl_assert(prv_list_find_string("Music", (void *)0x12345) != NULL); const char *second = i18n_get("Music", (void *)0x12345); cl_assert(first == second); const char *third = i18n_get("Music", (void *)0xdeadbeef); cl_assert(first != third); i18n_free_all((void *)0x...
_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, layer_w, shadow_top_bitmap_h)); } // Draw bottom shadow, if (partially) visible: const...
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, call update_content indicator to refresh potential timers ...
*kino_reel = kino_reel_create_with_resource(resource_id); cl_assert(kino_reel); cl_assert(kino_reel_get_type(kino_reel) == KinoReelTypeGBitmap); cl_assert_equal_i(kino_reel_get_data_size(kino_reel), 2308); kino_reel_draw(kino_reel, &ctx, GPointZero); } void test_kino_reel__resource_gbitmap_sequence(void) { ...
{ cl_assert_equal_p(processor, &s_dummy_processor); }
void test_kino_reel__draw_processed(void) { // Calling kino_reel_draw_processed() should pass the processor to the .draw_processed function const KinoReelImpl dummy_impl = (KinoReelImpl) { .draw_processed = prv_dummy_impl_draw_processed, }; KinoReel *kino_reel = kino_reel_custom_create(&dummy_impl, NULL);...
} void test_cron__dst_simple_to(void) { // Nov 21st, 01:00:00 local CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = 0, .hour = 1, .mday = 20, .month = 10, .may_be_instant = true, }; // 2015 Nov 21, 00:00:00 GMT const time_t advance = 1448064000 - s...
{ CronJob jobs[] = { CRON_JOB(CRON_MINUTE_ANY, CRON_HOUR_ANY, CRON_MDAY_ANY, CRON_MONTH_ANY, prv_counting_cb) CRON_JOB(CRON_MINUTE_ANY, CRON_HOUR_ANY, CRON_MDAY_ANY, CRON_MONTH_ANY, prv_cron_callback) CRON_JOB(1, CRON_HOUR_ANY, CRON_MDAY_ANY, CRON_MONTH_ANY, prv_cron_callback) CRON_JOB(3, CRON_HOUR_AN...
CLIP(app_peek_offset_y, 0, bezel_height)
; PBL_ASSERTN((bezel_width > 0) && (bezel_height > 0)); uint8_t *dst = (uint8_t *)s_framebuffer.buffer; uint8_t *app_buffer = (uint8_t *)app_framebuffer->buffer; // Set all the black pixels from the start, which is the sum of the following: // - app_offset_y * DISP_COLS - the top part of the bezel...
.0 uint8_t incomplete_playback_info_update[] = { 0x00, 0x01, 0x00, 0x31, 0x2c, 0x32, 0x2e, 0x30, }; prv_receive_entity_update(incomplete_playback_info_update, sizeof(incomplete_playback_info_update)); prv_assert_initial_playback_state(); } void test_ams__receive_malformed_playe...
ams_handle_subscribe(entity_update, BLESubscriptionNotifications, BLEGATTErrorSuccess)
; ams_destroy(); cl_assert_equal_s(music_get_connected_server_debug_name(), NULL); } // Test setup /////////////////////////////////////////////////////////// void test_ams__initialize(void) { s_launcher_task_callback = NULL; memset(s_conn_mgr_states, 0, sizeof(s_conn_mgr_states)); fake_rtc_init(1234, 5678...
, TouchEventType type, const GPoint *pos, TouchPressure pressure, uint64_t time_ms) { // Note: pos might be NULL for liftoff events GPoint diff_pos = pos ? gpoint_sub(*pos, ctx->start_pos) : GPointZero; int64_t diff_time = time_ms - ctx->start_time_ms; TouchPressure diff_pressur...
(ctx->touch_queue.events)
; ctx->touch_queue.count--; // unlock the mutex so that any calculations done in the callback do not block touch updates // from the driver. mutex_unlock(s_touch_mutex); event_handler(&event, context); mutex_lock(s_touch_mutex); } ctx->update_pending = false; unlock: mutex_unlock(s_touch...
bool prv_wait_int_low(HRMDevice *dev) { const int max_attempts = 2000; int attempt; for (attempt = 0; attempt < max_attempts; attempt++) { if (!gpio_input_read(&dev->int_gpio)) { break; } system_task_watchdog_feed(); psleep(1); } return (attempt < max_attempts); } // Wait for the INT li...
{ HRMDevice *dev = (HRMDevice *)data; if (++s_missing_interrupt_count >= AS7000_MAX_WATCHDOG_INTERRUPTS) { system_task_add_callback(prv_watchdog_timer_system_cb, (void *)dev); } if (s_missing_interrupt_count > 1) { PBL_LOG(LOG_LEVEL_DEBUG, "Missing interrupt count: %"PRIu8" ", s_missing_interrupt_count)...
// Enable the watchdog timer. This gets enabled when we enable the sensor and detects if // the sensor stops generating interrupts. static void prv_enable_watchdog(HRMDevice *dev) { mutex_assert_held_by_curr_task(dev->state->lock, true); s_as7000_watchdog_timer = (RegularTimerInfo) { .cb = prv_watchdog_timer_...
TE(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateSessionOpen); EXPECT_OUTBOX_NO_MESSAGE_PENDING(); } void test_rocky_api_app_message__awaiting_reset_complete_rem_init__receive_complete_unsupported_ver(void) { prv_init_and_goto_awaiting_reset_complete_remote_initiated(); const PostMe...
{ prv_init_and_goto_awaiting_reset_complete_local_initiated(); RCV_DUMMY_CHUNK(); // https://pebbletechnology.atlassian.net/browse/PBL-42466 // TODO: assert that chunk is NACK'd // Chunk is ignored, state isn't changed: cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageS...
static void prv_init_and_goto_session_open(void) { prv_init_and_goto_awaiting_reset_complete_remote_initiated(); RCV_RESET_COMPLETE(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateSessionOpen); } void test_rocky_api_app_message__session_open__rcv_reset_request(void) { prv_init_and_got...
); cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(4)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx...
timeline_model_get_iter_state(1)
== timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(timeline_model_iter_prev(&new_idx, NULL)); cl_assert_equal_i(new_idx, 0); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_...
(!battery_monitor_critical_lockout())
; fake_battery_set_millivolts(critical_mv); periodic_timer_trigger(25); cl_assert(battery_monitor_critical_lockout()); cl_assert_equal_i(standby_timer_get_timeout(), 30000); standby_timer_trigger(1); cl_assert(s_entered_standby); } void test_battery_monitor__critical_plugged_in(void) { int good_mv = ba...
move_result)) { rocky_log_exception("removing event listener", remove_result); } for (size_t i = 0; i < ARRAY_LENGTH(args); i++) { jerry_release_value(args[i]); } // mark item as removed and stop iterating query_data->found = true; return false; } return true; } T_STATIC bool p...
jerry_set_object_field(rocky, name_to, on)
; } void rocky_global_init(const RockyGlobalAPI *const *global_apis) { PBL_ASSERTN(global_apis); s_global_apis = global_apis; JS_VAR rocky = jerry_create_object(); // this keeps a permanent reference to the singleton rocky_set_rocky_singleton(rocky); rocky_add_function(rocky, ROCKY_ON, prv_add_event_list...
ocky_log_exception("e2", e2); cl_assert(*s_log_internal__expected == NULL); // number s_log_internal__expected = (const char *[]){ "Exception while e3", "ReferenceError", NULL, }; rocky_log_exception("e3", e3); cl_assert(*s_log_internal__expected == NULL); } /* * FIXME: JS Tests should be built in a ...
cl_assert(date_builtin == global_date)
; jerry_release_value(global_date); jerry_release_value(global_object); jerry_release_value(date_builtin); } void test_js__get_global_builtin_changed(void) { jerry_value_t date_builtin = jerry_get_global_builtin((const jerry_char_t *)"Date"); jerry_value_t global_object = jerry_get_global_object(); const...
ess_callback, NULL); } void command_flash_stress(void) { // WARNING!! Running this test can shorten the life of your flash chip because it violates the // "wait 90 seconds between erases of the same sector" spec. prompt_send_response("Stress flash"); system_task_add_callback(prv_flash_stress_callback, NULL); ...
if (context->num_presses_remaining > 0) { // Toggle the state of the button context->button_is_held_down = !button_is_held_down; // Restart the timer new_timer_start(s_console_button_timer, next_timeout_ms, command_button_press_callback, context, 0 /* flags */); } else { kernel...
} static bool prv_convert_and_validate_timeout_value(const char *timeout_string, uint32_t default_value, uint32_t *result) { if (!result) { return false; } if (!timeout_string) { *result = default_valu...
se(minute_file); } return success; } // ------------------------------------------------------------------------------------- static DataLoggingSession *prv_get_dls_minute_session(void) { // Open up the data logging session if we don't have one if (s_alg_state->dls_session == NULL) { // We don't need to b...
{ // nothing to send, even if we really wanted to return false; }
else if (!force_send && minutes_this_record < minutes_per_record) { // didn't collect enough data for our regularly scheduled program return false; } // Fill up the next record AlgMinuteRecord *cbuf_record = &s_alg_state->cbuf_record; for (int i = 0; i < minutes_this_record; i++) { uint16_t length...
/* * 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_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_rect(ctx, &GRect(4, 2, 16, 8)); }
void across_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_round_rect(ctx, &GRect(10, 2, 18, 4), 4, GCornersAll); } void across_nx_layer_update_callback(Layer* me, GContext* ctx) { graphics_con...
/* * 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...
(date, "getSeconds")
; JS_VAR js_minutes = jerry_get_object_getter_result(date, "getMinutes"); JS_VAR js_hours = jerry_get_object_getter_result(date, "getHours"); JS_VAR js_mdays = jerry_get_object_getter_result(date, "getDate"); JS_VAR js_month = jerry_get_object_getter_result(date, "getMonth"); JS_VAR js_year = jerry_get_object...
l_assert_equal_s("Jun 7", time_buf); // June 16th 2015, 13:00:00 (-07:00:00) format_time = event_time + (7 * SECONDS_PER_DAY) + (1 * SECONDS_PER_HOUR); clock_get_month_named_abbrev_date(time_buf, sizeof(time_buf), format_time); cl_assert_equal_s("Jun 16", time_buf); } void test_clock__relative_daypart_string(...
clock_get_relative_daypart_string(timestamp, 67 /* hours_in_the_future */)
; cl_assert_equal_s(day_after_tomorrow, daypart_string); // (midnight 2 days from now) time between 2 days from now 9am and midnight // is the day after tomorrow daypart_string = clock_get_relative_daypart_string(timestamp, 68 /* hours_in_the_future */); cl_assert_equal_s(day_after_tomorrow, daypart_string);...
ode.node.cached_size.h); cl_assert_equal_i(s_num_draw_custom_calls, 1); graphics_text_node_get_size(&custom_node.node, ctx, &TEST_TEXT_BOX, NULL, &size); cl_assert(size.w > 0); cl_assert(size.h > 0); cl_assert_equal_i(size.w, TEST_TEXT_SIZE.w); cl_assert_equal_i(size.h, TEST_TEXT_SIZE.h); cl_assert_equal...
cl_assert_equal_grect(ctx->draw_state.clip_box, DISP_FRAME)
; // Clipping on custom_node.node.clip = true; s_data.gcontext.draw_state.clip_box = DISP_FRAME; s_data.clip_box = TEST_CLIP_BOX; graphics_text_node_draw(&custom_node.node, ctx, &TEST_CLIP_BOX, NULL, NULL); cl_assert_equal_grect(ctx->draw_state.clip_box, DISP_FRAME); }
y draw box and clipping x1.integer += ctx->draw_state.drawing_box.origin.x; x2.integer += ctx->draw_state.drawing_box.origin.x; y += ctx->draw_state.drawing_box.origin.y; GBitmap *framebuffer = graphics_capture_frame_buffer(ctx); if (!framebuffer) { // Couldn't capture framebuffer retur...
(clip_box)
/* * 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 (exti_line == ExtiLineOther_RTCAlarm) { return RTC_Alarm_IRQn; }
for (j = 0; j < _clar_suite_count; ++j) printf(" %3d: %s\n", (int)j, _clar_suites[j].name);
printf("\nCategories (use -i<category> to include):\n"); clar_category_enable_all(_clar_suite_count, _clar_suites); clar_category_print_enabled(" - "); printf("\nTest names (use -t<name> to run just one):\n"); for (j = 0; j < _clar_suite_count; ++j) { const struct clar_suite *su...
HealthAggregationAvg, HealthServiceTimeScopeOnce); cl_assert_equal_i(123, result); // The function call is the equivalent to `peek_value` with HeartRateBPM except for the // time stamps, make sure it returns 0 because we haven't filled in that data) result = health_servi...
(&daily_stats, value)
; } // ---------------------------------------- // Compute each combination of agg/stat and compare to expected for (HealthAggregation agg = HealthAggregationSum; agg <= HealthAggregationMax; agg++) { for (HealthServiceTimeScope scope = HealthServiceTimeScopeOnce; scope <= HealthServiceTimeScopeD...
pen_file(); if (rv != S_SUCCESS) { return; } AppDBEntry *db_entry = kernel_malloc_check(sizeof(AppDBEntry)); EnumerateData cb_data = { .cb = cb, .data = data, .entry_buf = db_entry, }; settings_file_each(&s_app_db.settings_file, prv_enumerate_entries, &cb_data); prv_close_file_and_unloc...
PBL_LOG(LOG_LEVEL_WARNING, "Tried to delete an app that is currently being fetched, %"PRId32, app_id)
; rv = prv_cancel_app_fetch(app_id); } if (rv == S_SUCCESS) { rv = settings_file_delete(&s_app_db.settings_file, (uint8_t *)&app_id, sizeof(AppInstallId)); } prv_close_file_and_unlock_mutex(); if (rv == S_SUCCESS) { // uuid will be free'd by app_install_manager Uuid *uuid_copy = kernel_mal...
/* * 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...
(error_code)
/* * 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_single_repeating_click_subscribe(BUTTON_ID_DOWN, 200, prv_down_click_handler)
; } static void prv_window_load(Window *window) { ProgressAppData *data = window_get_user_data(window); data->progress = (MIN_PROGRESS_PERCENT + MAX_PROGRESS_PERCENT) / 2; ProgressLayer* progress_layer = &data->progress_layer; const GRect *frame = &window_get_root_layer(window)->frame; static const uint32...
prv_reset(void) { s_state = SessionState_Idle; s_session_id = AUDIO_ENDPOINT_SESSION_INVALID_ID; } static void prv_cancel_session(void) { prv_cancel_recording(); prv_reset(); } static void prv_start_result_timeout(void) { new_timer_start(s_timeout, TIMEOUT_SESSION_RESULT, prv_session_result_timeout, NULL, ...
{ case VoiceEndpointResultFailServiceUnavailable: status = VoiceStatusErrorConnectivity; break; case VoiceEndpointResultFailDisabled: status = VoiceStatusErrorDisabled; break; case VoiceEndpointResultFailInvalidRecognizerResponse: status = VoiceStatusRecognizerResponseError; ...
return status; } void voice_init(void) { s_lock = mutex_create(); } // This will kick off a dictation session. After the setup session message is sent via the // voice control endpoint, we wait for a session ready response via the // voice_handle_session_setup_result call or a session setup timeout occurs (timer...
t_px == 10); cl_assert(line.width_px == HORIZ_ADVANCE_PX * 1); cl_assert(line.origin.x == 0); cl_assert(line.suffix_codepoint == 0); cl_assert(*line.start == 'b'); // \n cl_assert(*word_iter_state.current.start == '\n'); cl_assert(*word_iter_state.current.end == '\n'); cl_assert(word_iter_state.current...
{ // Allocate mutable types Iterator line_iter = ITERATOR_EMPTY; LineIterState line_iter_state = { 0 }; // Allocate immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "\n\n\0"); cl_assert(success); s_ctx.text_draw_state.text_box = (TextBoxParams) { .utf8...
_gatt_client_op_set_read_return_value(BTErrnoInvalidParameter); prv_notify_services_discovered(1); cl_assert_equal_i(ppogatt_client_count(), 0); } void test_ppogatt__cleanup_client_when_meta_read_gets_error_response(void) { fake_gatt_client_op_set_read_return_value(BTErrnoOK); prv_notify_services_discovered(1)...
{ test_ppogatt__open_session_when_found_pebble_app(); // Simulate getting an Ack that's outside of the window of outstanding SNs: prv_receive_ack(s_characteristics[0][PPoGATTCharacteristicData], PPOGATT_SN_MOD_DIV / 2); // Expect Reset to be initiated ("Reset Request" sent by FW): prv_assert_sent_reset_reques...
void test_ppogatt__ignore_retransmitted_ack(void) { test_ppogatt__open_session_when_found_pebble_app(); Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); for (uint8_t sn = 0; sn < 3; ++sn) { const bool success = fake_comm_session_send_buffer_write_raw_by_transport(transpor...
ime[timer_idx_0] != 0); PBL_ASSERTN(s_app_data->fired_time[timer_idx_1] != 0); PBL_ASSERTN(s_app_data->fired_time[timer_idx_1] < s_app_data->fired_time[timer_idx_0]); bool scheduled = new_timer_scheduled(s_app_data->timer[timer_idx_0], &expire_ms); PBL_ASSERTN(!scheduled); scheduled = new_timer_scheduled(s_ap...
{ menu_callback_prefix(index, ctx); s_app_data->reg_timers[0].cb = reg_timer_1_callback; regular_timer_add_minutes_callback(&s_app_data->reg_timers[0]); // This should assert when the callback runs because it tries to reschedule as a seconds callback }
task_heap_get_for_current_task(), size, saved_lr); } void *task_zalloc_check(size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; Heap *heap = task_heap_get_for_current_task(); void *mem = heap_zalloc(heap, bytes, saved_lr); if (!mem && bytes != 0) { PBL_CROAK_OOM(bytes, saved_lr...
if (!mem && bytes != 0) { PBL_CROAK_OOM(bytes, saved_lr, heap); }
return mem; } void *kernel_realloc(void *ptr, size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_realloc(kernel_heap_get(), ptr, bytes, saved_lr); } void *kernel_zalloc(size_t size) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_zalloc(k...
alls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); #endif } // -------------------------------------------------------...
(&s_setup_handler_calls, a)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, inner_seq), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_ca...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
heap_zalloc(task_heap_get_for_current_task(), size, saved_lr)
; } void *task_zalloc_check(size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; Heap *heap = task_heap_get_for_current_task(); void *mem = heap_zalloc(heap, bytes, saved_lr); if (!mem && bytes != 0) { PBL_CROAK_OOM(bytes, saved_lr, heap); } return mem; } void *task_calloc(s...
s_bar, !music_is_progress_reporting_supported()); char artist_buffer[MUSIC_BUFFER_LENGTH]; char title_buffer[MUSIC_BUFFER_LENGTH]; music_get_now_playing(title_buffer, artist_buffer, NULL); if (music_needs_user_to_start_playback_on_phone()) { prv_push_no_music_window(data); } else { prv_pop_no_music_...
prv_cassette_rect()
; const GRect track_rect = prv_track_rect(); prv_configure_music_text_layer(&data->artist_text_layer, data->artist_buffer, &artist_rect, ARTIST_BOUNDS_OFFSET, ARTIST_TITLE_TEXT_ALIGNMENT, system_theme_get_font_for_de...
/* * 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_reel_transform_create(&MORPH_SQUARE_TRANSFORM_IMPL, data)
; if (reel) { data->reel = reel; kino_reel_transform_set_from_reel(reel, from_reel, take_ownership); kino_reel_transform_set_layer_frame(reel, frame); kino_reel_transform_set_from_frame(reel, frame); kino_reel_transform_set_to_frame(reel, frame); } else { prv_destructor(data); } return r...
_handler(ClickRecognizerRef recognizer, void *context) { AppWorkerResult result = app_worker_kill(); APP_LOG(APP_LOG_LEVEL_INFO, "kill result: %d", result); } static void click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler); window_single_click_subscribe(...
(GRect(7, 40, 144-7, 168-40))
////////////// //! Return true if the type-specific serialized slice's attribute list is valid. You don't have to //! check the attribute list pointer (we check it before calling this callback). typedef bool (*AttributeListValidationFunc)(const AttributeList *attr_list); //! Callback for copying the type-specific att...
if (!serialized_glance || !cb) { return false; }
SerializedAppGlanceSliceHeader *current_slice = (SerializedAppGlanceSliceHeader *)serialized_glance->data; size_t glance_size_processed = sizeof(SerializedAppGlanceHeader); // Note that we'll stop iterating after reading the max supported number of slices per glance for (unsigned int i = 0; i < APP_GL...
p, "fill_rect_origin_r3_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 4, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r4_no_clip.${BIT_DEPTH_NAME}.pbi")); ...
(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 7, GCornersAll)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r7_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 8, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
layer_mark_dirty(&kino_layer->layer)
; } void kino_layer_play(KinoLayer *kino_layer) { kino_player_play(&kino_layer->player); } void kino_layer_play_section(KinoLayer *kino_layer, uint32_t from_position, uint32_t to_position) { kino_player_play_section(&kino_layer->player, from_position, to_position); } ImmutableAnimation *kino_layer_create_play_an...
(BleRemoteVersionInfoReceivedEvent *)msg->payload; bt_driver_handle_peer_version_info_event(e); break; } }
} int hc_endpoint_gap_le_disconnect(const BTDeviceInternal *address) { HcProtocolMessage *resp = hc_protocol_enqueue_with_payload_and_expect( HcEndpointID_GapLEConnect, HcMessageID_GapLEConnect_Disconnect, (const uint8_t *)address, sizeof(BTDeviceInternal)...
tTypeCurr); int16_t curr_from_rel_bar_value = 0; int16_t curr_to_rel_bar_value = 0; static const PropertyAnimationImplementation curr_implementation = { .base.update = (AnimationUpdateImplementation) property_animation_update_int16, .accessors.setter.int16 = prv_curr_rel_bar_setter, .accessors.getter...
graphics_fill_rect(ctx, &line); // Bottom Notch for Bar 1 // Filled rect used to draw line of REL_BAR_LINE_WIDTH stroke width GRect line2; line2.size.w = REL_BAR_LINE_CHECK_LENGTH + REL_BAR_LINE_WIDTH; line2.size.h = REL_BAR_LINE_WIDTH; line2.origin.x = line.origin.x - REL_BAR_LINE_NOTCH_HORIZ_OFFSET + 1...
#define REL_BAR_DOT_SIZE 2 static void prv_draw_rel_bar_dotted(TimelineLayer *timeline_layer, GContext* ctx, bool current, int16_t rel_bar_value) { int16_t prev_offset = 0; // Used to animate the previous animation offset if (!current) { prev_offset = REL_BAR_PREV_ANIM_OFFS...
/* * 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...
(true /*ignore_paused*/)
manager, NULL); manager->state = RecognizerManagerState_WaitForTouchdown; manager->active_layer = NULL; } static void prv_fail_then_reset_if_no_active_recognizers(RecognizerManager *manager) { bool other_recognizers_active = prv_fail_other_recognizers(manager); // Reset if all recognizers are complete or fail...
(manager->window)
; Layer *new_active_layer = manager->window ? layer_find_layer_containing_point(root, &touch_event->start_pos) : NULL; if (new_active_layer == root) { new_active_layer = NULL; } if (manager->state == RecognizerManagerState_WaitForTouchdown) { manager->state = RecognizerManagerState_...
latform(); return _ACTION_BAR_WIDTH(platform); } static int prv_vertical_icon_margin(void) { const PlatformType platform = process_manager_current_platform(); return PBL_PLATFORM_SWITCH(platform, /*aplite*/ 24, /*basalt*/ 24, ...
GPoint(-animation_offset, 0)
, GPoint(0, -animation_offset), GPoint(animation_offset, 0), GPoint(0, animation_offset), }; return offset[action_bar->animation[button_index]]; } static void prv_draw_background_rect(ActionBarLayer *action_bar, GContext *ctx, GColor bg_color) { graphics_fill_rect(ctx, &action_bar->layer.bounds...
nse, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed ...
(data->distance_string, new_tuple->value->cstring, sizeof(data->distance_string))
; break; case SPORTS_TIME_KEY: strncpy(data->duration_string, new_tuple->value->cstring, sizeof(data->duration_string)); break; case SPORTS_LABEL_KEY: { const bool is_pace = MIN(new_tuple->value->uint8, 1); WorkoutMetricType metric_type = is_pace ? WorkoutMetricType_Pace : Work...
//// // Stubs #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_app_state.h" #include "stubs_fonts.h" #include "stubs_graphics_context.h" #include "stubs_gbitmap.h" #include "stubs_heap.h" #include "stubs_text_resources.h" #include "stubs_text_render.h" #include "stubs_pbl_malloc.h" #include "stub...
(*word_iter_state.current.start == '\n')
; cl_assert(*word_iter_state.current.end == '\n'); cl_assert(iter_next(&word_iter)); cl_assert(*word_iter_state.current.start == '\n'); cl_assert(*word_iter_state.current.end == 'N'); cl_assert(iter_next(&word_iter)); cl_assert(*word_iter_state.current.start == 'N'); cl_assert(*word_iter_state.current.e...
o be implemented */ void accel_manager_enable(bool on) { } void accel_manager_exit_low_power_mode(void) { } // Return true if we are "idle", defined as seeing no movement in the last hour. bool accel_is_idle(void) { // It was idle recently, see if it's still idle. Note we avoid reading the accel hardware // aga...
mutex_lock_recursive(s_accel_manager_mutex)
; bool rv = accel_run_selftest(); mutex_unlock_recursive(s_accel_manager_mutex); return rv; } #if !defined(PLATFORM_SILK) // Note: This selftest is only used for MFG today. When we start to build out a // gyro API, we will need to come up with a more generic way to handle locking // for a gyro only part vs gyro ...
ctor erases / minimize seek time // for large files, deploying a variable length page size may be beneficial. // Therefore, isolating the page offset related calculations to one location. static uint32_t prv_page_to_flash_offset(uint16_t page) { return ((uint32_t)page * PFS_PAGE_SIZE); } static void prv_flash_read(v...
prv_page_to_flash_offset(start_page)
+ METADATA_OFFSET; prv_flash_write((uint8_t *)&state, sizeof(state), offset); } static bool get_curr_state(uint16_t start_page, uint32_t offset, uint16_t state) { uint16_t curr_state; offset += prv_page_to_flash_offset(start_page) + METADATA_OFFSET; prv_flash_read((uint8_t *)&curr_state, sizeof(state), of...
/ 2, SCREEN_HEIGHT); graphics_context_set_antialiased(&ctx, true); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_left_clipped_aa.${BIT_DEPTH_NAME}.pbi")); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; ctx.draw_state...
(&ctx, fb)
; graphics_context_set_antialiased(&ctx, true); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_house_105_aa.8bit.pbi")); // Safety s_path_angle = 0; } void test_graphics_gpath_8bit__clipping_aa(void) { // NOTE: This test verifies correct clipping of anti-alia...
---------------------------------------------------------------------- // Create a new timer TaskTimerID task_timer_create(TaskTimerManager *manager) { TaskTimer *timer = kernel_malloc(sizeof(TaskTimer)); if (!timer) { return TASK_TIMER_INVALID_ID; } // Grab lock on timer structures, create a unique ID for...
prv_find_timer(manager, timer_id)
/* * 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 (!s_mfg_mode) { mfg_enter_mfg_mode(); launcher_task_add_callback(prv_launch_mfg_app, NULL); }
} bool mfg_is_mfg_mode(void) { return s_mfg_mode; } void command_enter_mfg(void) { mfg_enter_mfg_mode_and_launch_app(); }
if (min_size >= 2 * radius) { return radius; } else { return (min_size / 2); }
} typedef void (*FillCircleImplFunc)(GContext *, GPoint pt, uint16_t radius, GCornerMask mask); //! generic fill_rect implementation to avoid code-duplication between aa and non-aa fill_rect void prv_fill_rect_internal(GContext *ctx, const GRect *rect, uint16_t radius, GCornerMask corner_...
ActivitySession *session, int32_t avg_hr, int32_t *hr_zone_time_s) { if (session->length_min <= 0) { return; } ActivityInsightType type; TimelineResou...
{ INSIGHTS_LOG_DEBUG("Not adding session pin - asleep"); return; }
if (session->length_min < s_activity_session_settings.session.activity.trigger_elapsed_minutes) { INSIGHTS_LOG_DEBUG("Not adding session pin - not long enough (%"PRIu16" < %"PRIu16")", session->length_min, s_activity_session_settings.session.activity.trigger_elapsed...
maining(&buffer), 0); cl_assert_equal_i(circular_buffer_get_read_space_remaining(&buffer), 8); contiguous_num_bytes_left = circular_buffer_write_prepare(&buffer, &data_out); cl_assert_equal_i(contiguous_num_bytes_left, 0); cl_assert_equal_p(data_out, NULL); const uint16_t copy_out_size = 8; uint8_t copy_o...
circular_buffer_write_finish(&buffer, sizeof(letterB))
; cl_assert(circular_buffer_read( &buffer, sizeof(letterB), (const uint8_t **)&data_buf, &num_bytes)); cl_assert_equal_i(num_bytes, sizeof(letterB)); cl_assert_equal_m(data_buf, &letterB, sizeof(letterB)); }
/* * 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...
(&pstring16_list, WeatherDbStringIndex_LocationName)
; PascalString16 *phrase_pstring = pstring_get_pstring16_from_list(&pstring16_list, WeatherDbStringIndex_ShortPhrase); const bool is_valid_entry_update_time = (entry->last_update_time_utc != WEATHER_SERVICE_INVALID_DATA_LAST_UPDATE_TIME); const uint16_t location_pstring_length = location_pstring->st...
se. */ #include <applib/rockyjs/api/rocky_api_graphics_path2d.h> #include "clar.h" #include "test_jerry_port_common.h" #include "test_rocky_common.h" #include "applib/graphics/gpath.h" #include "applib/graphics/gtypes.h" #include "applib/rockyjs/api/rocky_api_global.h" #include "applib/rockyjs/api/rocky_api_graphics...
prv_create_canvas_context_2d_for_layer(&l)
; cl_assert_equal_b(jerry_value_is_object(ctx), true); jerry_set_object_field(jerry_get_global_object(), "ctx", ctx); } void test_rocky_api_graphics_path2d__initialize(void) { fake_malloc_set_largest_free_block(~0); s_log_internal__expected = NULL; rocky_runtime_context_init(); fake_app_timer_init(); je...
serialized_glance->creation_time, existing_glance.creation_time); return E_INVALID_ARGUMENT; } // Validate the slices (which also records a `validated_size` we'll use to trim excess slices) SliceValidationIteratorContext validation_context = { // Start by taking into account the header of th...
prv_close_file_and_unlock_mutex()
; return length; } status_t app_glance_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len) { if ((key_len != UUID_SIZE) || val_out == NULL) { return E_INVALID_ARGUMENT; } status_t rv = prv_lock_mutex_and_open_file(); if (rv != S_SUCCESS) { return rv; } rv = settings_fil...
/* * 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...
_theirs(i)
; \ int us = CHK(i++); \ cl_assert_equal_b(them, us); \ } void test_ctype__isalpha(void) { ISCTYPE_TEST(isalpha) } void test_ctype__isupper(void) { ISCTYPE_TEST(isupper) } void test_ctype__islower(void) { ISCTYPE_TEST(islower) } void test_ctype__isdigit(void) { ISCTYPE_TEST(isdigit) } void test_ctype__isxdig...
8, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 32, -992}, { 40, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}...
{ 48, 16, -1000}, { 48, 16, -1008}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 40, 24, -992}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -992}, { 48, 16, -1000}, { 56, 24, ...
ame->size.w - UNFOLD_DOT_SIZE_PX) / 2, .origin.y = layer_frame->origin.y + (layer_frame->size.h - UNFOLD_DOT_SIZE_PX) / 2, .size = UNFOLD_DOT_SIZE, }; #elif ANIMATION_SLIDE GRect icon_frame; TimelineLayout *first_timeline_layout = timeline_layer_get_current_layout(&data->timeline_layer); if (first_timel...
prv_create_peek_exit_anim(data, prev_state, duration)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return; }
const uint32_t total_size = heap_size(heap); unsigned int used = 0; unsigned int total_free = 0; unsigned int largest_free_block = 0; heap_calc_totals(heap, &used, &total_free, &largest_free_block); analytics_event_app_oom(AnalyticsEvent_AppOOMNative, requested_size, total_size, t...
(&s_stopped_handler_calls, b)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // Just before A completes prv_advance_to_ms_with_timers(start_ms + duration_a - 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_...
t_all_day_event, &state.pin.header.id)); cl_assert(state.node->all_day); // correct end of line behaviour cl_assert(!iter_prev(&iterator)); } void test_timeline__all_day_future_with_others(void) { prv_insert_all_day_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = N...
(&iterator)
); Uuid first_all_day_event = state.pin.header.id; cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[1].header.id) || uuid_equal(&state.pin.header.id, &s_all_day_items[2].header.id)); cl_assert(state.node->all_day); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_...
* limitations under the License. */ #include "process_state/app_state/app_state.h" #include "applib/app_message/app_message_internal.h" #include "applib/event_service_client.h" #include "applib/graphics/framebuffer.h" #include "applib/graphics/graphics.h" #include "applib/pbl_std/locale.h" #include "applib/ui/animat...
if (!s_app_state_ptr->legacy2_framebuffer) { return 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...
{ --result; }
/* * 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 (!*prefs_out) { return 0; }
status_t rv = prv_read_serialized_prefs(file, app_id, key_len, (void *) *prefs_out, prefs_len); if (rv != S_SUCCESS) { kernel_free(*prefs_out); return 0; } return (prefs_len - sizeof(SerializedNotifPrefs)); } static void prv_free_serialzed_prefs(SerializedNotifPrefs *prefs) { kernel_free(prefs); }...
hild_c, grand_child_a; Layer *layers[] = {&parent, &child_a, &child_b, &child_c, &grand_child_a}; for (int i = 0; i < ARRAY_LENGTH(layers); ++i) { layer_init(layers[i], &GRectZero); } // Create this hierarchy: // This hits first_child and next_sibling add code paths. // // +-parent // | // ...
(&child_a, &child_b)
; cl_assert(child_b.parent == &parent); cl_assert(child_b.next_sibling == &child_a); cl_assert(child_a.next_sibling == NULL); // Insert child_c above child_b (next_sibling code path): // // +-parent // | // '->child_b->child_c->child_a // layer_insert_above_sibling(&child_c, &child_b); cl...
, AnalyticsMetric metric, const void* data) { uint8_t *location = prv_heartbeat_get_array_location(heartbeat, metric, 0); uint32_t size = analytics_metric_size(metric); memcpy(location, data, size); } ///////// // Get int64_t analytics_heartbeat_get(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric) { uint...
for (uint32_t i = 0; i < analytics_metric_num_elements(metric); i++) { if (written > BUF_LENGTH) { PBL_LOG(LOG_LEVEL_DEBUG, "print buffer overflow by %lu bytes", BUF_LENGTH - written); continue; } int64_t val = analytics_heartbeat_get_array(heartbeat, metric, i); cons...
PBL_LOG(LOG_LEVEL_DEBUG, "%3" PRIu32 ": %s: %s", analytics_metric_offset(metric), name, buf); } } void analytics_heartbeat_print(AnalyticsHeartbeat *heartbeat) { switch (heartbeat->kind) { case ANALYTICS_HEARTBEAT_KIND_DEVICE: PBL_LOG(LOG_LEVEL_DEBUG, "Device heartbeat:"); prv_print_heartbeat(heartb...
ardown_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, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_te...
animation_set_duration(a, duration_a)
/* * 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_ctx, fb)
; framebuffer_clear(fb); } void test_emoji_fonts__cleanup(void) { free(fb); fb = NULL; gbitmap_destroy(s_dest_bitmap); s_dest_bitmap = NULL; } // Helpers ////////////////////// static char s_emoji_string[] = "😄😃😀😊☺😉😍😘😚😗😙😜😝😛😳😁😔😌😒😞😣😢😂😭😥😪😰😅😓😩😫😨😱" "😠😡😤😖😆😋😷😎😴😵😲😟�...
h (button) { case BUTTON_ID_UP: return s_quick_launch_up.enabled; case BUTTON_ID_DOWN: return s_quick_launch_down.enabled; case BUTTON_ID_SELECT: return s_quick_launch_select.enabled; case BUTTON_ID_BACK: return s_quick_launch_back.enabled; case NUM_BUTTONS: break; } ...
PBL_LOG(LOG_LEVEL_WARNING, "Ignoring attempt to set content size to invalid size %d", content_size)
GRect(0, 0, -10, -20); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, -5.5, -10.5); cl_assert_fixedS16_3(radius, 4.5); } void test_graphics_circle__grect_polar_calc_values_square(void) { GPointPrecise center = {}; Fixed_S16_3 radius = {}; GRect r = GRect(0, 0, 5, 5); ...
{ GContext *ctx = (GContext *)&ctx; cl_assert_gpoint_precise(s_center, 0, 0); cl_assert_fixedS16_3(s_radius_inner, 0); cl_assert_fixedS16_3(s_radius_outer, 0); graphics_fill_radial(NULL, GRect(0, 0, 10, 12), GOvalScaleModeFitCircle, 3, 0, 0); cl_assert_gpoint_precise(s_center, 4.5, 5.5); cl_assert_fixedS...
void test_graphics_circle__DEG_TO_TRIGANGLE(void) { cl_assert_equal_i(DEG_TO_TRIGANGLE(720), TRIG_MAX_ANGLE * 2); cl_assert_equal_i(DEG_TO_TRIGANGLE(-720), -TRIG_MAX_ANGLE * 2); cl_assert_equal_i(DEG_TO_TRIGANGLE(360), TRIG_MAX_ANGLE); cl_assert_equal_i(DEG_TO_TRIGANGLE(-360), -TRIG_MAX_ANGLE); cl_assert_...
/* * 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...
(dest, 0, 5)
; size_t copied = utf8_copy_character(dest, (utf8_t *)NIHAO, 5); cl_assert_equal_i(copied, NIHAO_FIRST_CHARACTER_BYTES); cl_assert_equal_s((char *)dest, NIHAO_FIRST_CHARACTER); } void test_utf8__copy_insufficient_space(void) { utf8_t dest[5]; dest[0] = 0; size_t copied = utf8_copy_character(dest, (utf8_...
/* * 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...
strcmp(buf, "365")
); itoa_int(-365, buf, 10); cl_assert(0 == strcmp(buf, "-365")); // max int32 itoa_int(2147483647, buf, 10); cl_assert(0 == strcmp(buf, "2147483647")); // min int32 itoa_int(-2147483647, buf, 10); cl_assert(0 == strcmp(buf, "-2147483647")); } void test_string__test_byte_stream_to_hex_string(void) { ...
_must_ occur before setting // the getting started completed below. welcome_push_notification(factory_reset_or_first_use); if (factory_reset_or_first_use) { bt_persistent_storage_set_unfaithful(true); } // As soon as we boot normally for the first time, we've therefore completed first use mode and // ...
(workout_e)
/* * 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...
memcpy(&buffer->buffer[write_index], data, length)
; return true; } uint16_t circular_buffer_write_prepare(CircularBuffer *buffer, uint8_t **data_out) { if (!get_write_length_available(buffer) || buffer->write_in_progress) { *data_out = NULL; return 0; } buffer->write_in_progress = true; const uint16_t write_index = get_write_index(buffer); *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...
(GColorRed.a == 0b11)
; } void test_graphics_colors__green(void) { cl_assert(GColorGreen.r == 0b00); cl_assert(GColorGreen.g == 0b11); cl_assert(GColorGreen.b == 0b00); cl_assert(GColorGreen.a == 0b11); } void test_graphics_colors__blue(void) { cl_assert(GColorBlue.r == 0b00); cl_assert(GColorBlue.g == 0b00); cl_assert(GColo...
al_i(mfg_info_get_rtc_freq(), 4); mfg_info_get_model(buffer); cl_assert_equal_s(buffer, ""); // Make sure we have space for the model. mfg_info_set_model("test_model"); cl_assert_equal_i(mfg_info_get_disp_offsets().x, -2); cl_assert_equal_i(mfg_info_get_disp_offsets().y, 1); cl_assert_equal_i(...
cl_assert(memcmp(fpga_buffer + HEADER_SIZE, s_boot_fpga, sizeof(s_boot_fpga)) != 0)
; // Now update it and make sure we healed the corruption mfg_info_update_constant_data(); flash_read_bytes(fpga_buffer, BOOT_FPGA_FLASH_ADDR, sizeof(fpga_buffer)); cl_assert(memcmp(fpga_buffer + HEADER_SIZE, s_boot_fpga, sizeof(s_boot_fpga)) == 0); }
ons[num_animations++] = relbar_animation; } #endif Animation *animation = animation_spawn_create_from_array(animations, num_animations); return animation; } static void prv_place_day_separator(TimelineLayer *layer) { if (!layer_get_hidden((Layer *)&layer->day_separator)) { // already on screen return;...
(ctx, circle_center, circle_radius)
; } else { // Otherwise, use fill_radial to fill the sidebar as a radial on the right side of the screen const GPoint circle_center = GPoint(sidebar_x - circle_radius, bounds_center.y); // Add half the final sidebar width to the radius so we see a bounce-back effect at the end const TimelineLayerStyle...
ialize timer on first use if (s_console_button_timer == TIMER_INVALID_ID) { s_console_button_timer = new_timer_create(); } // If the callback is already scheduled, notify busy and exit if (new_timer_scheduled(s_console_button_timer, NULL)) { prompt_send_response("BUSY"); return; } // Construct...
(0, prv_serial_dump_chunk_callback, prv_serial_dump_completed_callback)
; prompt_command_continues_after_returning(); } void command_log_dump_last(void) { flash_dump_log_file(1, prv_serial_dump_chunk_callback, prv_serial_dump_completed_callback); prompt_command_continues_after_returning(); } void command_log_dump_generation(const char* generation_str) { int generation = atoi(gene...
app_name) { app_name = entry->name; } len = strlen(app_name) + 1; node->name = app_malloc_check(len); strncpy(node->name, app_name, len); prv_sorted_add(source, node); } static AppMenuNode * prv_find_node_with_install_id(const AppInstallId install_id, cons...
{ if (node->install_id == install_id) { return prv_transform_index(source, index); } node = (AppMenuNode*)list_get_next((ListNode*)node); ++index; }
return MENU_INDEX_NOT_FOUND; } GBitmap *app_menu_data_source_get_node_icon(AppMenuDataSource *source, AppMenuNode *node) { if (!node->icon && source->show_icons) { // If the icon is currently NULL and we should be showing icons, load the icon prv_load_list_item_icon(source, node); } // Will return the...
animation_schedule(seq); // Start A prv_advance_to_ms_with_timers(start_ms + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s...
prv_clear_handler_histories()
; uint64_t start_ms = prv_now_ms(); animation_schedule(clone); // Start A prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, NULL), 0); // Execute to the star...
zeof(Tuple); static int s_context; static DictionaryIterator s_expected_iter; uint8_t s_expected_buffer[MAX_SIZE_OUTBOUND]; static int s_out_sent_call_count = 0; static int s_out_failed_call_count = 0; static AppMessageResult s_failure_result = APP_MSG_OK; static bool s_ack_sent_is_called = false; static bool s_nack...
cl_fail("Unhandled endpoint")
; } } static void prv_nack_sent_callback(uint16_t endpoint_id, const uint8_t* data, unsigned int length) { s_nack_sent_is_called = true; prv_send_ack_nack(endpoint_id, data, length, true); } static void prv_ack_sent_callback(uint16_t endpoint_id, const uint8_t* data, unsigned int length) { s_ack_sent_is_calle...
*window) { prv_call_click_provider(window); } void window_set_click_config_provider_with_context( Window *window, ClickConfigProvider click_config_provider, void *context) { PBL_ASSERTN(window); window->click_config_provider = click_config_provider; window->click_config_context = context; if (window->o...
PBL_LOG(LOG_LEVEL_DEBUG, "Cannot register BUTTON_ID_BACK raw handler")
; return; } ClickManager *mgr = prv_get_current_click_manager(); ClickConfig *cfg = &mgr->recognizers[button_id].config; cfg->raw.up_handler = up_handler; cfg->raw.down_handler = down_handler; cfg->raw.context = context; } ClickConfigProvider window_get_click_config_provider(const Window *window) { ...
----------------------------------------------------- // teardown handler void prv_teardown_handler(Animation *animation) { prv_add_handler_entry(&s_teardown_handler_calls, animation, false, NULL); DPRINTF("%"PRIu64" ms: Executing teardown handler for %d\n", prv_now_ms(), (int)animation); } // --------------------...
(h, &implementation)
; return h; } // -------------------------------------------------------------------------------------- // Setup. Called before each of the tests execute void test_animation__initialize(void) { fake_rtc_init(1024*200 /*ticks */, 200 /*seconds */); AnimationState *state = kernel_applib_get_animation_state(); ...
}, { -16, 720, -224}, { 64, 424, -128}, { 144, 352, -96}, // 21 seconds { 192, 280, -88}, { 248, 368, -96}, { 320, 392, -104}, { 440, 400, -112}, { 512, 784, -96}, { 520, 1280, -104}, { 584, 1176, 80}, { 496, 1520, 96}, { 272, 1408, 104}, { 248, 1296, 88}, { 1...
{ -184, 960, -312}, { -24, 904, -368}, { 32, 592, -368}, { 152, 240, -176}, { 168, 320, -120}, { 200, 312, -32}, { 288, 240, -8}, { 376, 160, -48}, { 440, 304, -56}, { 464, 648, 16}, { 504, 1040, 168}, { 784, 1480, 104}, // 27 seconds { 552, 1672, 8}, { 352, 1...
{ 256, 1200, 240}, { 224, 912, 272}, { 304, 872, 248}, { 144, 792, 264}, { 48, 672, 240}, { 64, 480, 160}, { 104, 392, 160}, { 168, 456, 120}, { 176, 464, 64}, { 200, 592, 48}, { 240, 880, 24}, { 312, 1184, -72}, { 288, 1528, -136}, { 168, 1560, 16}, { 80, 15...
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)
; enter_standby_mode(); } else if (PWR_GetFlagStatus(PWR_FLAG_SB) == SET) { // Woke up from standby // Clear the standby flag since only a power reset clears it PWR_ClearFlag(PWR_FLAG_SB); // Before coming out of standby make sure we should be waking up if (should_leave_standby_mode()) { le...
0 ? characteristics[0] : 0; BLECharacteristic char2 = num_characteristics > 1 ? characteristics[1] : 0; PBL_LOG(LOG_LEVEL_WARNING, "No ppog client removed? 0x%x 0x%x vs 0x%x 0x%x", (int)meta, (int)data, (int)char1, (int)char2); } } bt_unlock(); } void ppogatt_invalidate_all_reference...
kernel_malloc_check(sizeof(PPoGATTPacket) + max_payload_size)
; *heap_packet_in_out = packet; } return packet; } // ------------------------------------------------------------------------------------------------- static const PPoGATTPacket * prv_prepare_next_reset_packet(const PPoGATTClient *client, PPoGATTPacket **...
len = strlen(data->long_message); strncpy(transcription, data->long_message, len); transcription_dialog_update_text(transcription_dialog, transcription, len); app_transcription_dialog_push(transcription_dialog); transcription_dialog_set_callback(transcription_dialog, prv_transcription_dialog_cb, data); } ////...
(window, WINDOW_NAME("Dialogs"))
; window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); const bool animated = true; app_window_stack_push(window, animated); } static void prv_handle_deinit() { DialogsData *data = app_state_get_user_data(); menu_layer_deinit(&data->me...
s_manager_state = (struct HRMManagerState) { .lock = mutex_create_recursive(), .accel_data_lock = mutex_create(), .update_enable_timer_id = new_timer_create(), .enabled_charging_state = !battery_is_usb_connected(), .charger_subscription = (EventServiceInfo) { .type = PEBBLE_BATTERY_STATE_CH...
{ ref = state->session_ref; }
mutex_unlock_recursive(s_manager_state.lock); return ref; } DEFINE_SYSCALL(bool, sys_hrm_manager_get_subscription_info, HRMSessionRef session, AppInstallId *app_id, uint32_t *update_interval_s, uint16_t *expire_s, HRMFeature *features) { mutex_lock_recursive(s_manager_state.lock);...
/* * 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...
{ *content_origin_on_screen = MOCKED_PAGING_ORIGIN; *page_rect_on_screen = MOCKED_PAGING_PAGE; return s_text_layer_calc_text_flow_paging_values_result; }
// Tests ////////////////////// #define cl_assert_mocks_called(expected) \ do { \ cl_assert_equal_p((expected).disable_text_flow.layout, s_actual.disable_text_flow.layout); \ cl_assert_equal_p((expected).enable_text_flow.layout, s_actual.enable_text_flow.layout); \ cl_assert_equal_i((expected).enable_text_fl...
/* * 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...
(RTC_BKP_BOOTBIT_DR)
; current_value &= ~bit; RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, current_value); } bool boot_bit_test(BootBitValue bit) { uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR); return (current_value & bit); } void boot_bit_dump(void) { dbgserial_print("Boot bits: "); dbgserial_print_hex(...
X * elapsed / duration = whole_number test_reel_data->duration_ms = ANIMATION_DURATION_INFINITE; kino_player_play(test_player); animation_set_elapsed(test_player->animation, 20); animation_set_duration(test_player->animation, ANIMATION_DURATION_INFINITE); prv_play_animation_update(test_player->animation, 0);...
animation_set_reverse(test_player->animation, true)
; animation_set_duration(test_player->animation, ANIMATION_DURATION_INFINITE); animation_set_elapsed(test_player->animation, 20); prv_play_animation_update(test_player->animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), ANIMATION_DURATION_INFINITE); } void test_kino...