prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
* 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 * distributed u...
(!(start_addr & 0xFF000000))
{ row->data = fb_line; }
#else row->data = fb_line; #endif s_current_flush_line++; return true; } return false; } //! display_update complete callback static void prv_flush_complete_cb(void) { s_current_flush_line = 0; framebuffer_reset_dirty(compositor_get_framebuffer()); if (s_update_complete_handler) { s_update...
/* * 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...
(0xfefc54f9)
; } void test_legacy_checksum__start_and_finish_with_partial(void) { update("12", 2); update("3456", 4); update("78", 2); assert_checksum(0xfefc54f9); } void test_legacy_checksum__long_input(void) { update("1234567890abcdefghijklmnopqrstuvwxyz", 36); assert_checksum(0x586c447d); } void test_legacy_checks...
ill go to sleep static void prv_watch_is_motionless(void) { // Check if we should enable stationary mode and disabled unneeded features if (s_stationary_count_down > 0) { PBL_LOG_D(DEBUG_STATIONARY, LOG_LEVEL_DEBUG, "Countdown to stationary: %d", s_stationary_count_down); s_stationary_count_do...
(s_accel_session)
r_level); result->tx_power_level = tx_power_level; } // Try getting Local Name: if (ble_ad_copy_local_name(ad_data, result->local_name, sizeof(result->local_name))) { APP_LOG(APP_LOG_LEVEL_INFO, "Local Name: %s", result->local_name); } else { // Clear out the local name...
(ctx, cell_layer, cell_index, data)
; break; default: break; } } static void menu_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *data) { if (cell_index->section == SectionControl) { toggle_scan(); return; } // Connect ScanResult *result = list_get_by_index(cell_inde...
Context *ctx, const GSize *max_size, const GPoint *center, const GFont font, const GColor color, const char *text) { GSize text_size = app_graphics_text_layout_get_content_size( text, font, (GRect) { .size = *max_size }, GTe...
graphics_context_set_fill_color(ctx, face->bob_center_color)
; graphics_fill_oval(ctx, bob_center_rect, GOvalScaleModeFitCircle); } static void prv_draw_non_local_clock(GContext *ctx, NonLocalClockFace *clock) { // TODO: The non-local clock text is currently baked into the background image. prv_draw_clock_face(ctx, &clock->face); } static void prv_update_proc(Layer *lay...
/* * 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...
{ case ANALYTICS_METRIC_ELEMENT_TYPE_NIL: return 0; case ANALYTICS_METRIC_ELEMENT_TYPE_INT8: case ANALYTICS_METRIC_ELEMENT_TYPE_UINT8: return 1; case ANALYTICS_METRIC_ELEMENT_TYPE_UINT16: case ANALYTICS_METRIC_ELEMENT_TYPE_INT16: return 2; case ANALYTICS_METRIC_ELEMENT_TYPE_UINT32: case ANALYT...
PBL_CROAK("no such element_type %d", type->element_type); } uint32_t analytics_metric_size(AnalyticsMetric metric) { uint32_t num_elements = analytics_metric_num_elements(metric); uint32_t element_size = analytics_metric_element_size(metric); return num_elements * element_size; } bool analytics_metric_is_arr...
/* * 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...
{ // wait for the bus supply to stabilize and the peripherals to start up. // the MFI chip requires its reset pin to be stable for at least 10ms from startup. delay_ms(20); }
} //! Power down I2C bus power supply //! Always lock bus and peripheral config access before use static void prv_bus_rail_power_down(I2CBus *bus) { if (!bus->rail_ctl_fn) { return; } prv_rail_ctl(bus, false); // Drain through pull-ups OutputConfig out_scl = { .gpio = bus->scl_gpio.gpio, .gpio_...
nit the flash hardware flash_hw_init(); // Make sure we are not in deep sleep prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_WAKE); prv_flash_end_cmd(); // See if we can successfully access the flash // TODO: Will we successfully recover if the flash HW was left midstream in a command ...
CD_ASSERTN(((start_addr & SUBSECTOR_ADDR_MASK) == start_addr) && ((total_bytes & SUBSECTOR_ADDR_MASK) == total_bytes))
; while (total_bytes > 0) { if (((start_addr & SECTOR_ADDR_MASK) == start_addr) && (total_bytes >= SECTOR_SIZE_BYTES)) { prv_flash_erase_sector(start_addr); total_bytes -= SECTOR_SIZE_BYTES; start_addr += SECTOR_SIZE_BYTES; } else { prv_flash_erase_subsector(start_addr); total_b...
ATION_INFINITE); prv_play_animation_update(animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 20); } void test_kino_player__infinite_animation_finite_reel_reverse(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed...
prv_play_animation_update(animation, 0)
imation_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 start of B and C prv_advance_to_ms_with_timer...
(prv_count_handler_entries(&s_stopped_handler_calls, a3), 1)
{ 472, -240, -488}, { 360, -304, -408}, { 160, -296, -520}, { -128, -440, -760}, { -128, -384, -928}, { -104, -392, -976}, { -232, -320, -1272}, { -280, -264, -1432}, { -160, -184, -1544}, { -192, 0, -1688}, { 48, -40, -1520}, { -136, 16, -1240}, { -168, 168, -1176}, ...
{ 1536, 512, -40}, { 1360, 352, -104}, { 1368, 344, -120}, { 1512, 304, -160}, { 1624, 248, -104}, { 1448, 200, -144}, { 1312, 128, -168}, { 808, -528, -64}, { 888, -296, -96}, { 576, -344, -192}, { 1000, 112, -232}, { 1280, 88, -152}, // 110 seconds { 1256, 368, ...
{ -104, -744, -920}, { 88, -664, -888}, { 176, -592, -928}, { 224, -520, -944}, { 200, -632, -896}, { 184, -608, -896}, { 120, -584, -856}, { 88, -568, -904}, { 120, -568, -912}, { 88, -592, -880}, { 32, -632, -888}, { 16, -592, -896}, { 48, -616, -864}, { 72, -6...
LOG_INT_CONFIG_PTR)) { int_exti_cb(NULL); } exti_configure_pin(DIALOG_EXTI, ExtiTrigger_Rising, int_exti_cb); exti_enable(DIALOG_EXTI); } void dialog_spi_set_pending_int(void) { exti_set_pending(DIALOG_EXTI); } void dialog_spi_indicate_data_ready_to_tx(void) { // Note: Double purposing the CS as an INT...
{ dialog_spi_assert_chip_select(false); prv_disable_spi_clock(); }
sion); // pfs filesystem is a newer version than we support return (false); } hdr.page_flags = prv_get_page_flags(pg); // read the header flags to see if the page is a file start page or an erased page if (IS_PAGE_TYPE(hdr.page_flags, PAGE_FLAG_ERASED_PAGE) || IS_PAGE_TYPE(hdr.page_...
kernel_strdup_check(filename)
; } else { node->name = ((PFSFileChangedCallbackNode *)find_str)->name; } s_head_callback_node_list = list_prepend(s_head_callback_node_list, &node->list_node); mutex_unlock_recursive(s_pfs_mutex); return node; } void pfs_unwatch_file(PFSCallbackHandle cb_handle) { mutex_lock_recursive(s_pfs_mutex); ...
ND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "drivers/gpio.h" #include "drivers/periph_config.h" #include "drivers/voltage_monitor.h" #include "kernel/util/delay.h" #include "os/mutex.h" #include "system/passert.h" ...
periph_config_disable(ADC1, RCC_APB2Periph_ADC1)
; mutex_unlock(s_adc_mutex); }
/* * 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 (state->last_time.tm_sec != currtime.tm_sec) { units_changed |= SECOND_UNIT; } if (state->last_time.tm_min != currtime.tm_min) { units_changed |= MINUTE_UNIT; } if (state->last_time.tm_hour != currtime.tm_hour) { units_changed |= HOUR_UNIT; } if (state->last_time.tm_md...
state->last_time = currtime; state->first_tick = false; if ((state->tick_units & units_changed) || (units_changed == 0)) { state->handler(&currtime, units_changed); } } void tick_timer_service_init(void) { TickTimerServiceState *state = prv_get_state(PebbleTask_Unknown); state->handler = NULL; even...
/* * 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...
mutex_lock(s_mutex)
; if (prv_pref_set(PREF_KEY_CLOCK_24H, &s_is_24h_style, sizeof(s_is_24h_style))) { s_is_24h_style = is_24h_style; } mutex_unlock(s_mutex); } bool shell_prefs_is_timezone_source_manual(void) { // Force things to automatic return false; } void shell_prefs_set_timezone_source_manual(bool manual) { } int16...
lta_ticks); rtc_set_time(rtc_get_time() + ms / MS_PER_SECOND); } // Test that we handle different update intervals correctly void test_hrm_manager__update_interval(void) { AppInstallId app_id = 1; uint32_t update_interval_s = 600; const uint16_t expire_s = 30 * SECONDS_PER_MINUTE; HRMFeature features = HRMFe...
hrm_manager_handle_prefs_changed()
; cl_assert(!prv_can_turn_sensor_on()); fake_system_task_callbacks_invoke_pending(); cl_assert(!hrm_is_enabled(HRM)); s_activity_prefs_heart_rate_is_enabled = true; hrm_manager_handle_prefs_changed(); cl_assert(prv_can_turn_sensor_on()); fake_system_task_callbacks_invoke_pending(); cl_assert(hrm_is_ena...
.type = GDrawCommandTypePath, .hidden = false, .stroke_color = GColorRed, .stroke_width = 1, .fill_color = GColorBlue, .path_open = true, .num_points = 2, }; GPoint points[] = {{ 6, 1 }, {5, -5} }; memcpy(command_list->commands[0].points, points, sizeof(points)); GContext *ctx = (G...
(command_list)
; } void test_gdraw_command__get_max_command_size_in_list(void) { GDrawCommandList *command_list = prv_create_command_list_3(); // The third command in the list is the largest so it's size should be returned by // prv_get_list_max_command_size cl_assert_equal_i(gdraw_command_get_data_size(gdraw_command_list_g...
cense. */ #include "apps/system_apps/health/health_detail_card.h" #include "apps/system_apps/health/health_progress.h" #include "test_health_app_includes.h" #define BG_COLOR PBL_IF_COLOR_ELSE(GColorBlueMoon, GColorWhite) #define FILL_COLOR PBL_IF_COLOR_ELSE(GColorKellyGreen, GColorDarkGray) #define TODAY_FILL_COLOR...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_health_detail_card__render_no_subtitle(void) { HealthDetailCardConfig config = { .num_headings = 1, .headings = &(HealthDetailHeading) { .primary_label = "LABEL1", .primary_value = "value1", .fill_color = GColorWhite, #if PBL_BW .outline_color = GColorBlack, #endif ...
hrm_manager_unsubscribe(session_ref); fake_system_task_callbacks_invoke_pending(); cl_assert(prv_get_subscriber_state_from_ref(session_ref) == NULL); cl_assert_equal_b(hrm_is_enabled(HRM), false); } // When we cleanup after an app process, its subscription, if any, should get an expriration time // placed on it ...
fake_system_task_callbacks_invoke_pending()
; cl_assert_equal_i(s_num_cb_events_1, 3); cl_assert_equal_i(s_cb_events_1[1].event_type, HRMEvent_SubscriptionExpiring); cl_assert_equal_i(s_cb_events_1[2].event_type, HRMEvent_BPM); // Now advance time to past expiration time rtc_set_time(rtc_get_time() + expire_s + 1); // Send more data, the subscrip...
///////////////////////// void test_timeline__initialize(void) { fake_rtc_init(0, 0); // Note: creating a settings file is going to result in one malloc for the FD name pin_db_init(); time_util_update_timezone(&tz); uint8_t num_net_allocs = fake_pbl_malloc_num_net_allocs(); for (unsigned int i = 0; i < ARR...
(iter_next(&iterator))
; cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id)); // check sixth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); } void test_timeline__none_backwards(void) { Iterator iterator = {0}; TimelineIterStat...
ib_free(ad); } // ----------------------------------------------------------------------------- //! The smallest UUID width, by reducing the width when a UUID is based on the //! Bluetooth base UUID. @see bt_uuid_expand_16bit @see bt_uuid_expand_32bit static uint8_t prv_smallest_bt_uuid_width_in_bytes(const Uuid *uuid...
{ case 16: element->uuid_128[i] = uuids[i]; break; case 4: element->uuid_32[i] = prv_convert_to_32bit_uuid(&uuids[i]); break; case 2: element->uuid_16[i] = prv_convert_to_16bit_uuid(&uuids[i]); break; default: WTF; }
} return prv_write_element_to_ad_data(ad, (const BLEAdElement *) element); } // ----------------------------------------------------------------------------- bool ble_ad_set_local_name(BLEAdData *ad, const char *local_name) { if (!local_name) { return false; } const size_t le...
{ icon_from = kino_reel_get_elapsed(prev_reel) ? kino_reel_transform_get_to_frame(prev_reel) : kino_reel_transform_get_from_frame(prev_reel); }
kino_layer_set_reel(&peek_layer->kino_layer, NULL, false); KinoReel *from_reel = kino_reel_create_with_resource_system(peek_layer->res_info.res_app_num, peek_layer->res_info.res_id); if (!from_reel) { return; } KinoReel *to_reel = NULL; if...
urn entry->icon_resource_id; } ResAppNum app_install_get_app_icon_bank(const AppInstallEntry *entry) { if (app_install_id_from_system(entry->install_id)) { return SYSTEM_APP; } else { return entry->install_id; } } bool app_install_is_app_running(AppInstallId id) { return app_manager_get_task_context()...
{ #if PLATFORM_TINTIN || PLATFORM_SILK return GColorClear; #endif color = gcolor_closest_opaque(color); if (!gcolor_equal(color, GColorClear)) { return color; } color = prv_hard_coded_color_for_3rd_party_apps(uuid); if (!gcolor_equal(color, GColorClear)) { return color; } // if color isn't pr...
static bool prv_app_install_entry_from_app_db_entry(AppInstallId id, AppDBEntry *db_entry, AppInstallEntry *entry) { *entry = (AppInstallEntry) { .install_id = id, .type = AppInstallStorageFlash, .visibility = process_metadata_flags_visibility(db_entr...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(APP_LOG_LEVEL_INFO, "launch result: %d", result)
; } static void select_click_handler(ClickRecognizerRef recognizer, void *context) { AppWorkerMessage m; app_worker_send_message('x', &m); APP_LOG(APP_LOG_LEVEL_INFO, "crashing worker"); } static void down_click_handler(ClickRecognizerRef recognizer, void *context) { AppWorkerResult result = app_worker_kill()...
ER_DAY) + (1 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Jun 9, 4:00 PM", time_buf); } void test_clock__time_24h_style(void) { char time_buf[64]; const int jun10th_noon_2015 = 1433937600; prv_clock_reset(0); rtc_se...
(event_time + SECONDS_PER_HOUR)
; clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("An hour ago", time_buf); // June 9th 2015, 17:30:00 (T+01:30:00) rtc_set_time(event_time + SECONDS_PER_HOUR + (30 * SECONDS_PER_MINUTE)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELAT...
M_MAX_LV, 0x6); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_IDLE_HYST, 0x4); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_IDLE_MIN, 0x10); REG_SETF(DCDC, DCDC_V18_0_REG, DCDC_V18_FAST_RAMPING, 0x1); REG_SETF(DCDC, DCDC_V18_0_REG, DCDC_V18_VOLTAGE, 0x18); REG_SETF(DCDC, DCDC_V18_0_REG, DCDC_V18_CUR_LIM_MAX_HV, 0x1F); ...
REG_SETF(DCDC, DCDC_TEST_1_REG, DCDC_TEST_REG, 0x0); REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_BROWN_OUT_IRQ_CLEAR, 0x0); REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_V18P_TIMEOUT_IRQ_CLEAR, 0x0); REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_VDD_TIMEOUT_IRQ_CLEAR, 0x0); REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_V18_TIMEOU...
/* * 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...
gdraw_command_frame_draw(ctx, data->pulsing_heart, frame, offset)
; return; } } static void prv_render_bpm(GContext *ctx, Layer *base_layer) { HealthHrSummaryCardData *data = layer_get_data(base_layer); const int units_offset_y = fonts_get_font_height(data->bpm_font) - fonts_get_font_height(data->units_font); GTextNodeHorizontal *horiz_container = graphics_text_n...
te_Started)); r->state = RecognizerState_Possible; cl_assert_passert(recognizer_transition_state(r, RecognizerState_Possible)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Updated)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Cancelled)); recognizer_transition_stat...
(recognizer_set_failed(r))
_stop_le_scan(); kernel_free(s_reports_buffer); s_reports_buffer = NULL; s_is_scanning = false; if (s_dropped_reports) { PBL_LOG(LOG_LEVEL_INFO, "LE Scan -- Dropped reports: %" PRIu32, s_dropped_reports); } } } bt_unlock(); return success; } // -------------------------...
{ gap_le_stop_scan(); s_is_scanning = false; }
bt_unlock(); } // For UNIT Tests uint32_t gap_le_scan_get_dropped_reports_count(void) { return s_dropped_reports; }
_current_address(s_current_chunk, 0), sizeof(chunk_header)); s_current_offset = sizeof(LogChunkHeader); } static void make_space_for_log(int length) { if (s_current_offset + sizeof(LogHeader) + length + sizeof(LogHeader) < CHUNK_SIZE_BYTES) { // We got space, nothing to do here return; } // Need to r...
{ s_enabled = enabled; }
; app_outbox_init(); } void test_app_outbox__cleanup(void) { app_outbox_service_deinit(); kernel_free(s_test_data); } static size_t s_consumer_data_length = 1; static void prv_register(void) { app_outbox_service_register(AppOutboxServiceTagUnitTest, prv_message_handler, ...
{ app_outbox_service_consume_message(message[i], AppOutboxStatusSuccess); cl_assert_equal_i(s_num_app_outbox_events_sent, i + 1); assert_sent_cb_last_status(AppOutboxStatusSuccess); }
fake_kernel_malloc_mark_assert_equal(); } void test_app_outbox__unregister_with_pending_message(void) { fake_kernel_malloc_mark(); prv_register(); app_outbox_send(s_test_data, s_test_data_length, test_app_outbox_sent_handler, s_expected_cb_ctx); cl_assert(s_last_message); app_outbox_s...
if (address == -1) { prompt_send_response("Invalid address"); return; } int length = atoi(length_str); if (length == 0) { prompt_send_response("Invalid length"); return; } uint32_t crc = flash_calculate_legacy_defective_checksum(address, length); char buffer[32]; prompt_send_response_fm...
{ prompt_send_response("FAIL: sector not erased"); return; }
// write data into the sector const uint32_t BUFFER_SIZE = 256; uint8_t buffer[BUFFER_SIZE]; for (uint32_t i = 0; i < BUFFER_SIZE; i++) { buffer[i] = i; } for (uint32_t offset = 0; offset < TEST_LENGTH; offset += BUFFER_SIZE) { const uint32_t addr = TEST_ADDR + offset; flash_write_bytes(buffer...
{ 752, -128, 64}, { 952, -24, 128}, { 968, 24, 136}, { 1560, -56, 224}, { 1280, 128, 224}, { 1184, 248, 72}, { 1296, 312, 32}, { 1064, 408, 104}, { 880, 136, 168}, // 102 seconds { 1000, 200, 96}, { 1016, 320, 0}, { 968, 416, -88}, { 912, 336, -272}, { 864, 208, ...
{ -112, 1168, -48}, { -120, 1008, -128}, { -176, 912, -256}, { -152, 768, -488}, { -120, 776, -648}, { -80, 504, -720}, { -32, 192, -880}, { 72, 112, -944}, { 112, 160, -976}, { 112, -64, -880}, { 152, -96, -912}, { 144, -136, -968}, }; *len = ARRAY_LENGTH(samples); ...
// ---------------------------------------------------------------- // Sample captured: 2015-09-29 15:28:05 local AccelRawData *activity_sample_walk_200_pbl_25297_11(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25297_11 //> TEST_EXPECTED 200 //>...
/* * 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, GColorLavenderIndigo)
; dialog_set_icon(dialog, data->resource_id_80); dialog_set_vibe(dialog, true); dialog_show_status_bar_layer(dialog, true); app_simple_dialog_push(simple_dialog); } ////////////////////// // Confirmation Dialog static void prv_confirm_click_handler(ClickRecognizerRef recognizer, void *context) { app_window...
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 on an "AS IS" BASIS, * WITHOUT WARRANTI...
check_disconnected()
; //! Get disconnected event prv_send_connection_event(false); check_waiting_to_send_second_disconnect(); // No event put cl_assert_equal_i(s_event_count, 0); } void test_debounced_connection_service__disconnected_wait_disconnected(void) { //! Currently disconnected init(false /* disconnected */); ...
== (sizeof(buf) - off)); rv = pfs_seek(fd, 0, FSeekSet); cl_assert(rv == 0); memset(buf, 0x00, sizeof(buf)); uint8_t bigbuf[11]; rv = pfs_write(fd, bigbuf, sizeof(bigbuf)); cl_assert(rv == E_RANGE); rv = pfs_read(fd, buf, sizeof(buf)); cl_assert(rv == sizeof(buf)); for (int i = 0; i < sizeof(buf); ...
cl_assert(pfs_close(fd) == S_SUCCESS)
; cl_assert(pfs_remove(fname) == S_SUCCESS); cl_assert(pfs_remove(fname) == E_DOES_NOT_EXIST); cl_assert(pfs_open(fname, OP_FLAG_READ, 0, 0) == E_DOES_NOT_EXIST); } #define NUM_ENTRIES 3 void test_pfs__close_and_remove(void) { cl_assert(pfs_close_and_remove(-1) == E_INVALID_ARGUMENT); // there shouldn't be ...
; cl_assert_equal_i(s_out_failed_call_count, 0); cl_assert_equal_b(app_message_is_closed_outbound(), true); } void test_app_message__send_while_closing(void) { prv_set_remote_receive_handler(prv_ack_sent_callback); prv_send_test_data(); // Close the AppMessage context app_message_close(); // Make fake ...
cl_assert_equal_i(app_message_outbox_begin(NULL), APP_MSG_INVALID_ARGS)
; } void test_app_message__send_while_not_begun(void) { cl_assert_equal_i(app_message_outbox_send(), APP_MSG_INVALID_STATE); } void test_app_message__zero_inbox(void) { app_message_close(); cl_assert_equal_i(app_message_open(0, MAX_SIZE_OUTBOUND), APP_MSG_OK); cl_assert_equal_b(app_message_is_closed_inbound()...
cl_assert(memcmp(&item2, &temp, sizeof(TimelineItem)) == 0); cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */)); cl_assert(reminder_db_get_len((uint8_t *)&item2.header.id, sizeof(Uuid)) == 0); // check item 3 or 4 memset(&temp, 0, sizeof(TimelineItem)); cl_assert(S_SUCC...
cl_assert(memcmp(&item3, &temp, sizeof(TimelineItem)) == 0); cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */)); cl_assert(reminder_db_get_len((uint8_t *)&item3.header.id, sizeof(Uuid)) == 0); } cl_assert(S_NO_MORE_ITEMS == reminder_db_next_item_header(&temp)); } ...
tionDialog *transcription_dialog = context; app_timer_cancel(transcription_dialog->pop_timer); prv_stop_text_animation(transcription_dialog); } static void prv_transcription_dialog_load(void *context) { TranscriptionDialog *transcription_dialog = context; transcription_dialog->was_pushed = true; if (transcri...
expandable_dialog_set_select_action((ExpandableDialog *)transcription_dialog, RESOURCE_ID_ACTION_BAR_ICON_CHECK, prv_transcription_dialog_select_handler)
; Dialog *dialog = expandable_dialog_get_dialog((ExpandableDialog *)transcription_dialog); dialog_set_callbacks(dialog, &(DialogCallbacks) { .unload = prv_transcription_dialog_unload, .load = prv_transcription_dialog_load }, transcription_dialog); dialog_show_status_bar_layer(dialog, true /...
prv_deinit_icon(timeline_layout); layer_deinit(&timeline_layout->layout_layer.layer); i18n_free_all(timeline_layout); } void timeline_layout_init_info(TimelineLayoutInfo *info, TimelineItem *item, time_t current_day) { *info = (TimelineLayoutInfo) { .timestamp = item->header.timestamp, .duration_s = i...
(&timeline_layout->layout_layer.layer, &icon_layer->layer)
// Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); // Make Bluetopia's GATT_Start_Service_Discovery fail: // (Disconnected in the mean time, ...) fake_gatt_set_start_return_value(BTGATT_ERROR_INVALID_PARAMETER); // Fire the watchdog timer: const TimerID watchdo...
cl_assert_equal_i(1, fake_event_get_count())
; prv_assert_event(&device, BTErrnoOK); cl_assert_equal_i(2, fake_gatt_is_service_discovery_start_count()); // next job should be in progress cl_assert_equal_b(fake_gatt_is_service_discovery_running(), true); // BP service was discovered fake_gatt_put_discovery_indication_blood_pressure_service(TEST_GATT_...
malformed_test_string_utf8 = utf8_get_next(malformed_test_string_utf8); } // When we decode the invalid codepoint, it should return an invalid stream // error and set the pointer to the stream to be null cl_assert_equal_i(utf8_peek_codepoint(malformed_test_string_utf8, NULL), 0); cl_assert_(*malformed_test_...
utf8_truncate_with_ellipsis("Hey", output_buffer, 3)
; cl_assert_equal_i(trunc_size, 0); // test where max_length == ellipsis_length output_buffer = realloc(output_buffer, 4); trunc_size = utf8_truncate_with_ellipsis("Hello", output_buffer, 4); cl_assert_equal_s(output_buffer, "\xe2\x80\xa6"); cl_assert_equal_i(trunc_size, 4); // test where max_length == ...
ert(animation_get_delay(h) == 0); animation_set_delay(h, delay); cl_assert(animation_get_delay(h) == delay); cl_assert(animation_get_duration(h, true, true) == (duration + delay)); // Play count cl_assert_equal_i(animation_get_play_count(h), 1); animation_set_play_count(h, 2); cl_assert_equal_i(animation...
prv_clear_handler_histories()
DialogCallback dialog_close_cb) { DialogCallbacks callbacks = { .unload = dialog_close_cb }; ExpandableDialog *first_use_dialog = expandable_dialog_create_with_params( "DNDFirstUse", RESOURCE_ID_QUIET_TIME, msg, GColorBlack, GColorMediumAquamarine, &callbacks, RESOURCE_ID_ACTION_B...
{ const time_t seconds_until_midnight = time_util_get_seconds_until_daily_time(&time, 0, 0); seconds_until_update = MIN(seconds_until_update, seconds_until_midnight); }
} if (s_data.is_in_schedule_period == is_enable_next) { // Coming out of scheduled DND with manual DND on, turning it off if (is_enable_next && do_not_disturb_is_manually_enabled()) { do_not_disturb_set_manually_enabled(false); } s_data.is_in_schedule_period = !is_enable_next; } PBL_LOG...
t) { circle_func(ctx, GPoint(rect->origin.x + rect->size.w - radius - 1, rect->origin.y + radius), radius, GCornerTopRight); top_rect_size_w -= radius; } if (corner_mask & GCornerBottomRight) { circle_func(ctx, GPoint(rect->origin.x + rect->size.w - radius - 1, ...
(ctx, bl, br, stroke_width)
; } #endif // PBL_COLOR T_STATIC void prv_draw_rect_stroked(GContext *ctx, const GRect *rect, uint8_t stroke_width) { const GPoint tl = GPoint(rect->origin.x, rect->origin.y); const GPoint tr = GPoint(rect->origin.x + rect->size.w - 1, rect->origin.y); const GPoint bl = GPoint(rect->origin.x, rect->origin.y + 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...
if (buffer_length < 11) { PBL_LOG(LOG_LEVEL_WARNING, "ito buffer too small"); return; }
GRect(0, 0, DISP_COLS, 200); unobstructed_area_service_will_change(from_area.size.h, to_area.size.h); fake_event_service_handle_last(); unobstructed_area_service_did_change(to_area.size.h); fake_event_service_handle_last(); cl_assert_equal_i(s_data.num_did_change_calls, 1); } void test_unobstructed_area_ser...
GRect(-150, -120, 10, 10)
, // The size of the parent layer has no affect }; Layer layer = { .bounds = GRect(-110, -130, 300, 290), }; layer_add_child(&root_layer, &layer); GRect unobstructed_bounds; layer_get_unobstructed_bounds(&layer, &unobstructed_bounds); cl_assert_equal_grect(unobstructed_bounds, GRect(150, 120, 40, 40))...
, NULL); state->unscheduled_head = list_insert_before(state->unscheduled_head, &animation->list_node); // Reschedule the timer if we're removing the head animation: if (was_old_head && state->scheduled_head != NULL) { prv_reschedule_timer(state, 0); } // Reset these fields, before calling .stopped(), so...
if (animation->play_count == 0) { // Play count of 0, no need to schedule it. return true; }
// Don't allow an animation to be rescheduled (like from the stopped handler) if it is // being destroyed if (animation->being_destroyed) { return false; } ANIMATION_LOG_DEBUG("scheduling %d (%p) to run in %d ms (%d)", (int)animation->handle, animation, (int)(animation->delay_ms + add_delay_ms)...
zeof(s_test_impl_data), dummy, NULL)); s_test_impl.reset = dummy; s_test_impl.cancel = NULL; cl_assert_passert(recognizer_create_with_data(&s_test_impl, &s_test_impl_data, sizeof(s_test_impl_data), dummy, ...
recognizer_transition_state(r, RecognizerState_Possible)
); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Started)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Updated)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Cancelled)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Completed)); ...
(uint8_t *)&app_glance, sizeof(app_glance)), S_SUCCESS); // Verify that trying to read the blob back fails due to it not existing SerializedAppGlanceHeader glance_out = {}; cl_assert_equal_i(app_glance_db_read((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, ...
cl_assert_equal_i(app_glance_db_insert_glance(&APP_GLANCE_TEST_UUID, NULL), E_INVALID_ARGUMENT)
; // Glance with too many slices fails const AppGlance glance_with_too_many_slices = (AppGlance) { .num_slices = 1337, }; cl_assert(glance_with_too_many_slices.num_slices > APP_GLANCE_DB_MAX_SLICES_PER_GLANCE); cl_assert_equal_i(app_glance_db_insert_glance(&APP_GLANCE_TEST_UUID, ...
/* * 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_click_subscribe(BUTTON_ID_SELECT, prv_select_click_handler); window_set_click_context(BUTTON_ID_SELECT, context); }
static void prv_window_appear(Window *window) { KinoLayerDemoData *data = window_get_user_data(window); kino_layer_play(&data->kino_layer); } static void prv_window_load(Window *window) { KinoLayerDemoData *data = window_get_user_data(window); Layer *root = window_get_root_layer(window); // init the kino l...
OFFSET_RECT_CLIP_XY GRect(20, 10, 20, 20) #define OFFSET_RECT_CLIP_NXNY GRect(20, 10, 144, 168) #define OFFSET_DRAW_RECT_NO_CLIP GRect(6, 6, RECT_WIDTH, RECT_HEIGHT) #define OFFSET_DRAW_RECT_CLIP_XY GRect(6, 6, RECT_WIDTH, RECT_HEIGHT) #define OFFSET_DRAW_RECT_CLIP_NXNY GRect(-16, -16, RECT_WIDTH, RECT_...
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // AA = true, SW = 5 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 5); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbit...
((Window*) anim_ctx->window); if (!data || !finished) { // We could have gotten cleaned up in the middle of an animation, bail applib_free(anim_ctx); return; } if (data->view_model.cur_level->parent_level == anim_ctx->next_level) { --data->view_model.num_dots; } else { ++data->view_model.nu...
(data->level_change_anim, animation_get_duration(data->level_change_anim, true, true))
; } ActionMenuLevel *parent_level = data->view_model.cur_level->parent_level; if (parent_level) { prv_set_level(data, parent_level); } else { prv_action_window_pop(true, &data->action_menu); } } static void prv_click_config_provider(void *context) { ActionMenuData *data = context; action_menu_la...
day_picker_handle_selection(MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) { AlarmEditorData *data = (AlarmEditorData *)callback_context; data->day_picker_was_completed = false; if (cell_index->row == DayPickerMenuItemsCustom) { prv_handle_cu...
gbitmap_deinit(&data->checkmark_icon)
bool success = activity_test_fill_minute_file(); prv_test_end(context, success); } // ------------------------------------------------------------------------------- static void select_click_handler(ClickRecognizerRef recognizer, void *context) { } // --------------------------------------------------------------...
{ ActivityTestAppData *data = window_get_user_data(window); Layer *window_layer = window_get_root_layer(window); GRect bounds = window_layer->bounds; uint32_t num_tests = ARRAY_LENGTH(s_test_entries); // Create the menu items SimpleMenuItem *menu_items = app_malloc_check(num_tests * sizeof(SimpleMenuItem)...
// ------------------------------------------------------------------------------- static void prv_window_unload(Window *window) { ActivityTestAppData *data = window_get_user_data(window); simple_menu_layer_destroy(data->menu_layer); app_free(data->menu_items); // Restore normal mode activity_stop_tracki...
stall_get_id_for_uuid(&made_up)); cl_assert_equal_i(INSTALL_ID_INVALID, app_install_get_id_for_uuid(&UUID_INVALID)); cl_assert_equal_i(INSTALL_ID_INVALID, app_install_get_id_for_uuid(&(const Uuid)UUID_SYSTEM)); } void test_app_install_manager__compare_app_entry_retrieve_methods(void) { AppInstallEntry id_entry; ...
(menu_layer_id)
); cl_assert_equal_b(false, app_install_is_hidden(CRAZY_ID)); } void test_app_install_manager__is_from_system(void) { cl_assert_equal_b(true, app_install_id_from_system(-1000000)); cl_assert_equal_b(true, app_install_id_from_system(-1)); cl_assert_equal_b(false, app_install_id_from_system(0)); cl_assert_equ...
n 'a' and run it to the end // We will then create a sequence out of 'a' + 'b' and verify that if we advance that 'b' runs // correctly. void test_animation__sequence_of_already_completed(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b = 500; const int delay_b = 20; const...
animation_set_delay(a, delay_a)
; Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_delay(b, delay_b); Animation *c = prv_create_test_animation(); animation_set_duration(c, duration_c); animation_set_delay(c, delay_c); Animation *d = prv_create_test_animation(); animation_set_duration(...
time_t last_updated, const void *key, int key_len, const void *val, int val_len) { BlobDBSyncSession *session = blob...
(dirty_list)
; } } void test_blob_db_sync__sync_all(void) { char *keys[] = { "key1", "key2", "key3", "key4", "key5" }; int key_len = strlen(keys[0]); char *values[] = { "val1", "val2", "val3", "val4", "val5" }; int value_len = strlen(values[0]); // insert all keys for (int i = 0; i < ARRAY_LENGTH(keys); ++i) { b...
ognizer); recognizer_destroy(recognizer); return true; } void layer_deinit(Layer *layer) { if (!layer) { return; } layer_remove_from_parent(layer); #if CAPABILITY_HAS_TOUCHSCREEN // Destroy all attached recognizers recognizer_list_iterate(&layer->recognizer_list, prv_destroy_recognizer, layer); #end...
{ const GRect levels_layer_frame_in_ctx_space = { .origin = { // drawing_box is expected to be setup as the bounds of the parent: .x = ctx->draw_state.drawing_box.origin.x + levels_layer->frame.origin.x, .y = ctx->draw_state.drawing_box.origin.y + leve...
// translate the drawing_box to the bounds of the layer: ctx->draw_state.drawing_box.origin.x += levels_layer->frame.origin.x + levels_layer->bounds.origin.x; ctx->draw_state.drawing_box.origin.y += levels_layer->frame.origin.y + levels_layer->bounds.origin.y; ctx->draw_sta...
-------------------- // Sample captured: 2015-10-19 10:32:54 local AccelRawData *activity_sample_walk_100_pbl_28386_4(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_28386_4 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 //...
{ -24, 504, -744}, { 48, 392, -872}, { 104, 312, -872}, { 240, 400, -1096}, // 5 seconds { 320, 336, -1120}, { 400, 536, -1064}, { 472, 352, -888}, { 512, 368, -816}, { 584, 376, -824}, { 592, 312, -784}, { 528, 248, -664}, { 488, 256, -600}, { 560, 216, -640}, ...
{ 1168, 296, -304}, { 1008, 320, -288}, { 896, 360, -296}, { 760, 456, -280}, { 632, 344, -312}, { 480, 376, -240}, { 360, 312, -272}, { 304, 648, -336}, { 248, 784, -416}, { 352, 944, -480}, { 368, 1136, -392}, { 232, 1072, -344}, // 8 seconds { 304, 1088, -584}...
/* * 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...
pfs_init(false)
; weather_db_init(); weather_shared_data_init(); } void test_weather_db__cleanup(void) { weather_shared_data_cleanup(); } // Tests //////////////////////////////////////////////////////////////// static void prv_db_iterator_cb(WeatherDBKey *key, WeatherDBEntry *entry, void *unused) { weather_shared_data_asser...
case E_INVALID_OPERATION: return BLOB_DB_DATA_STALE; default: PBL_LOG(LOG_LEVEL_WARNING, "BlobDB return value caught by default case"); return BLOB_DB_GENERAL_FAILURE; } } static const uint8_t *prv_read_ptr(const uint8_t *iter, const uint8_t *iter_end, co...
prv_send_response(session, prv_try_read_token(data, length), BLOB_DB_INVALID_DATA)
; return; } BlobDBToken token; BlobDBId db_id; // Read token and db_id endpoint_private_read_token_db_id(data, &token, &db_id); // perform action on database and return result status_t ret = blob_db_flush(db_id); prv_send_response(session, token, prv_interpret_db_ret_val(ret)); // Mark the dev...
ward X seconds prv_inc_time(30); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); // HR Reading has expired. Should return 0 cl_assert_equal_i(bpm, 0); cl_assert(workout_service_stop_workout()); } // ...
(workout_service_start_workout(ActivitySessionType_Run))
set properly after everything cl_assert_equal_b(app_message_is_accepting_outbound(), true); } void test_app_message__cancel_timer(void) { prv_set_remote_receive_handler(prv_ack_sent_callback); prv_send_test_data(); prv_call_outbox_sent(AppOutboxStatusSuccess); prv_process_sent_data(); // After the ACK has...
app_message_outbox_get_ack_nack_timer()
, NULL); cl_assert_equal_i(1, s_out_failed_call_count); cl_assert_equal_i(s_failure_result, APP_MSG_NOT_CONNECTED); cl_assert_equal_b(s_nack_sent_is_called, false); // Check the state is reset properly cl_assert_equal_b(app_message_is_accepting_outbound(), true); } void test_app_message__send_while_closing...
S_DEFAULT); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 11); graph...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 4); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // SW = 5 setup_test_aa_sw(&c...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (menu_layer->callbacks.select_click) { menu_layer->callbacks.select_click(menu_layer, &menu_layer->selection.index, menu_layer->callback_context); }
} static void prv_menu_select_long_click_handler(ClickRecognizerRef recognizer, MenuLayer *menu_layer) { if (menu_layer->callbacks.select_long_click) { menu_layer->callbacks.select_long_click(menu_layer, &menu_layer->selection.index, menu_layer->callback_context); } } void menu_up_click_handler(C...
rting did. In this case we need to generate an event that // the discovery process failed. The error from GATT_Start_Service_Discovery is expected to be // passed in the event. prv_assert_event(&device, BTErrnoWithBluetopiaError(BTGATT_ERROR_INVALID_PARAMETER)); } // ---------------------------------------------...
(connection, &range)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (prv_is_container_layer(layer)) { return layer; }
layer = layer->parent; } return NULL; } bool text_layer_calc_text_flow_paging_values(const TextLayer *text_layer, GPoint *content_origin_on_screen, GRect *page_rect_on_screen) { if (text_layer == NULL || text_layer->la...
l; dma_config.DMA_PeripheralBaseAddr = FLASH_DATA_REGISTER_ADDR; dma_config.DMA_PeripheralInc = DMA_PeripheralInc_Disable; dma_config.DMA_MemoryInc = DMA_MemoryInc_Enable; dma_config.DMA_Priority = DMA_Priority_High; dma_config.DMA_FIFOMode = DMA_FIFOMode_Disable; dma_config.DMA_MemoryBurst = DMA_MemoryBurs...
PBL_ASSERTN(!(flag_status_register & N25QFlagStatusBit_SectorLockStatus))
; } // This will clear the protection flag error from a previous error. // We call this because the error bits persist across reboots static void prv_clear_flag_status_register(void) { flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_CLEAR_FLAG_STATUS_REG); flash_end_cmd(); } /** * Write up to 1 page (...
ke_box_width = PBL_IF_ROUND_ELSE(54, background_width / 2); const int16_t stroke_box_height = PBL_IF_ROUND_ELSE(53, 50); const int16_t hole_box_x_offset = PBL_IF_ROUND_ELSE(73, 0); const int16_t hole_label_y_offset = STATUS_BAR_LAYER_HEIGHT + PBL_IF_ROUND_ELSE(18, 104); const int16_t hole_value_y_offset = hole_...
(initial_values)
include "system/logging.h" #include "system/passert.h" #include <bluetooth/bluetooth_types.h> #include <bluetooth/id.h> #include <btutil/bt_device.h> static uint32_t s_pra_cycling_pause_count; static BTDeviceAddress s_pinned_addr; static bool s_cycling_paused_due_to_dependent_bondings; static void prv_allow_cycling(...
{ #if RECOVERY_FW PBL_LOG(LOG_LEVEL_INFO, "Pausing address cycling because PRF!"); bt_local_addr_pause_cycling(); #elif BT_CONTROLLER_CC2564X && !RELEASE PBL_LOG(LOG_LEVEL_INFO, "Pausing address cycling because cc2564x and beta build!"); bt_local_addr_pause_cycling(); #else PBL_LOG(LOG_LEVEL_INFO, "...
}
)comp, &it.it); const bool up = (comp == -1); prv_apply_selection_change(menu_layer, scroll_align, up, it.did_change_selection, &before_state.prev_selection, before_state.was_animating, animated); } typedef struct MenuSelectNextIterator { MenuIterator it; uint8_t count; bool did...
(menu_layer, center_focused)
; menu_layer_update_caches(menu_layer); }
_i(steps, 20); cl_assert_equal_i(duration_s, 20); cl_assert_equal_i(bpm, 80); cl_assert(workout_service_pause_workout(true)); cl_assert(workout_service_pause_workout(true)); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, ...
workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)
r. s_saved_registers.extra_reg.primask = __get_PRIMASK(); s_saved_registers.extra_reg.basepri = __get_BASEPRI(); s_saved_registers.extra_reg.faultmask = __get_FAULTMASK(); s_saved_registers.extra_reg.control = __get_CONTROL(); // if we coredump after new fw has been installed but before we reboot, the // F...
prv_write_image_header(s_flash_addr, CORE_ID_MAIN_MCU, &TINTIN_BUILD_ID, s_time_stamp)
menu_cell_basic_horizontal_inset()
; const int vertical_margin = (bounds->size.h - full_height) / 2; int left_margin = 0; GRect box; const GAlign icon_align = (GAlign)config->icon_align; if (config->icon) { box = (GRect) { .size = config->icon->bounds.size, .origin = bounds->origin, }; if (is_legacy2) { static c...
description)) { dbgserial_putstr("Invalid firmware CRC in SPI flash!"); return UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED; } bool new_world = prv_check_firmware_world(flash_new_fw_addr + sizeof(FirmwareDescription)); prv_erase_old_firmware(new_world, firmware_description.firmware_length); prv_write_new_fi...
(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS)
required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #in...
layer_deinit(&action_bar_layer->layer)
.funcs.encode = protobuf_log_util_encode_uuid, .arg = &uuid, }, .time_utc = session->start_utc, .utc_to_local = time_util_utc_to_local_offset(), .types = { .funcs.encode = protobuf_log_util_encode_measurement_types, .arg = &types_encoder_arg, }, }; return pb_encode(&sess...
(LOG_LEVEL_ERROR, "Error encoding msg")
; prv_session_free(session); session = NULL; } return session; } // --------------------------------------------------------------------------------------- // Sets the stream to PB_OSTREAM_SIZING and calculates the size of the protobuf structs static uint32_t prv_get_encoded_struct_size(uint32_t field_nu...
/* * 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 false; }
framebuffer_init(&fb, &(GSize) {DISP_COLS, DISP_ROWS}); s_gcontext = (GContext) { .dest_bitmap = (GBitmap) { .addr = screen->pixels, .row_size_bytes = DISP_COLS, .info = (BitmapInfo) {.format = GBITMAP_NATIVE_FORMAT }, .bounds = (GRect) { { 0, 0 }, { DISP_COLS, DISP_ROWS } }, .da...
/* * 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...
{ bool msg_matches_expected = (memcmp(msg, expected_msg, tot_len) == 0); cl_assert(msg_matches_expected); }
else { // the first line should always end with the build id char build_id_string[64]; version_copy_current_build_id_hex_string(build_id_string, 64); int id_len = strlen(build_id_string); char *log_build_id = &buf[tot_len - id_len]; bool log_contains_build_id = (memcmp(log_build_id, bu...
R); // if the event is within 24 hours, then show the actual time instead of "X hours ago" const int MAX_RELATIVE_HRS = 13; clock_set_24h_style(false); // June 9th 2015, 17:00:00 (T+01:00:00) rtc_set_time(event_time + SECONDS_PER_HOUR); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELA...
("1 minute ago", time_buf)
/* * 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...
(sizeof(BlobDBDirtyItem) + info->key_len)
; if (!new_node) { PBL_LOG(LOG_LEVEL_WARNING, "Ran out of memory while building a dirty list"); return false; } new_node->last_updated = info->last_modified; new_node->key_len = info->key_len; info->get_key(file, new_node->key, new_node->key_len); *(BlobDBDirtyItem **)context = ...
itialized = false; return; } } shared_circular_buffer_init(&s_buffer, s_buffer_storage, sizeof(s_buffer_storage)); // Test out the peripheral real quick if (!lis3dh_sanity_check()) { s_initialized = false; return; } accel_stop(); prv_accel_configure_interrupts(); } void lis3dh_power_...
(accel_raw_data, num_samples)
; if (num_samples > 0) { s_latest_reading = accel_raw_data[num_samples-1]; } lis3dh_lock(); if (s_buffer.clients) { // Only buffer the data if we have clients that are subscribed. if (!shared_circular_buffer_write(&s_buffer, (uint8_t *)accel_raw_data, num_samples * sizeof(AccelRawData)...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(APP_LOG_LEVEL_ERROR, "Exception while %s", message)
; jerry_char_t buffer[100] = {}; const ssize_t written = jerry_object_to_string_to_utf8_char_buffer(exception, buffer, sizeof(buffer) - 1); if (written > 0) { APP_LOG(APP_LOG_LEVEL_ERROR, "%s", buffer); } else { APP_LOG(APP_LOG_LEVEL_...
->header.timestamp, rtc_get_time()); } void test_alarm__recurring_weekday_alarm_timeout_ahead(void) { AlarmId id; s_current_day = s_saturday; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_WEEKDAYS, s_weekday_sche...
(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_JUST_ONCE })
; // It's currently Thursday @ 00:00 bool just_once_schedule_thursday[7] = {false, false, false, false, true, false, false}; prv_assert_alarm_config(id1, 10, 30, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday); // Only 1 pin should be added cl_assert_equal_i(s_num_timeline_adds, 1); id2 = alarm_c...
ePath, .hidden = false, .stroke_color = GColorRed, .stroke_width = 1, .fill_color = GColorBlue, .path_open = false, .num_points = 2, }; GPoint points[] = {{ 3, 97 }, {5, 5} }; memcpy(command->points, points, sizeof(points)); gdraw_command_draw(NULL, command); cl_assert_equal_i(s_strok...
(s_path_fill_count, 1)
ruct { bool empty; } AnyInfo; // callback for settings_file_each that finds the first item by timestamp static bool prv_each_first_item(SettingsFile *file, SettingsRecordInfo *info, void *context) { if (info->val_len < (int)sizeof(SerializedTimelineItemHeader) || info->key_len != UUID_SIZE) { // deleted or...
{ mutex_lock(storage->mutex); FindChildrenInfo info = { .parent_id = *parent_id, .num_children = 0, .find_all = false, }; status_t rv = settings_file_each(&storage->file, prv_each_find_children, &info); if (rv) { goto cleanup; } if (info.num_children) { rv = S_SUCCESS; } else { ...
status_t timeline_item_storage_delete_with_parent( TimelineItemStorage *storage, const Uuid *parent_id, TimelineItemStorageChildDeleteCallback child_delete_cb) { mutex_lock(storage->mutex); FindChildrenInfo info = { .parent_id = *parent_id, .num_children = 0, .find_all = true, }; stat...
/* * 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...
stub_new_timer_callback_data(get_reminder_timer_id())
, sizeof(TimelineItemId)) == 0); stub_pebble_tasks_set_current(PebbleTask_NewTimers); cl_assert(stub_new_timer_fire(get_reminder_timer_id())); stub_pebble_tasks_set_current(PebbleTask_KernelBackground); fake_system_task_callbacks_invoke(1); cl_assert_equal_i(num_events_put, 1); // item 2 is now the top rem...
// Create 2 test animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); animation_set_delay(a, delay_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_delay(b, delay_b); // Create a sequence Animation *seq = ...
animation_set_duration(b, duration_b)
; animation_set_delay(b, delay_b); // Create a spawn Animation *spawn = animation_spawn_create(a, b, NULL); cl_assert(spawn != NULL); animation_set_delay(spawn, delay_spawn); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(spawn); // Test the elapsed int32_t...
create_action_menu_for_item(TimelineItem *item, NotificationWindowData *window_data, TimelineItemActionSource source) { // Determine action menu properties int num_timeline_actions = 0; TimelineItemActi...
iOSNotifPrefs *notif_prefs = ios_notif_pref_db_get_prefs((uint8_t *)app_id, strlen(app_id)); char *display_name = ""; if (notif_prefs) { display_name = (char *)attribute_get_string(&notif_prefs->attr_list, AttributeIdAppName, ""); } const char *mute_label = i18n_noop("Mute %s"); static ch...
/* * 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(s_pending_notified.active); cl_assert(s_pending_notified.attribute == attribute); s_pending_notified.active = false; }
// Setup void test_app_smartstrap__initialize(void) { smartstrap_attribute_init(); app_smartstrap_subscribe((SmartstrapHandlers) { .did_read = prv_did_read_handler, .did_write = prv_did_write_handler, .notified = prv_notified_handler }); } void test_app_smartstrap__cleanup(void) { } // Tests v...
prv_last_updated_update(const LayoutLayer *layout, const LayoutNodeTextDynamicConfig *config, char *buffer, bool render) { AttributeList *attributes = layout->attributes; const time_t last_updated_time = attribute_get_uint32(attributes, Attribu...
gpath_move_to(&s_page_break_arrow_path, origin)
; gpath_draw_filled(ctx, &s_page_break_arrow_path); } else { layout->page_break_height = height; layout->has_page_break = true; } if (size_out) { *size_out = (GSize) { bounds->size.w, height }; } } GTextNodeCustom *timeline_layout_create_page_break_node(const TimelineLayout *layout) { GTextNo...
the specific language governing permissions and * limitations under the License. */ #include "board/display.h" #include "drivers/periph_config.h" #include "drivers/gpio.h" #include "drivers/dbgserial.h" #include "util/attributes.h" #include "util/delay.h" #include "stm32f4xx_dma.h" #include "stm32f4xx_gpio.h" #incl...
GPIO_Init(DISP_GPIO, &s_disp_gpio_init)
; // Init CS s_disp_gpio_init.GPIO_Mode = GPIO_Mode_OUT; s_disp_gpio_init.GPIO_OType = GPIO_OType_PP; s_disp_gpio_init.GPIO_Pin = DISP_PIN_SCS; GPIO_Init(DISP_GPIO, &s_disp_gpio_init); // Init LCD Control s_disp_gpio_init.GPIO_Mode = GPIO_Mode_OUT; s_disp_gpio_init.GPIO_OType = GPIO_OType_PP; s_disp...
/ Create 3 animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); Animation *c = prv_create_test_animation(); animation_set_duration(c, duration_c); // Create a spawn out of b and c...
prv_now_ms()
; animation_schedule(seq); fake_rtc_auto_increment_ticks(0); // Let the first spawn finish prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a0), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped...
/* * 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...
((AppFocusHandlers) { .did_focus = prv_did_focus, .will_focus = prv_will_focus, })
; } static void prv_window_unload(Window *window) { LauncherAppWindowData *data = window_get_user_data(window); // Capture the vertical range of the selection rectangle for compositor transition animations GRangeVertical launcher_selection_vertical_range; launcher_menu_layer_get_selection_vertical_range(&data...
ning) { if (!do_not_disturb_is_active()) { vibes_short_pulse(); } battery_ui_display_warning(percent, s_warning_points_index); } } static void prv_dismiss_warning(void) { battery_ui_dismiss_modal(); s_warning_points_index = -1; } static void prv_enter_low_power(void *ignored) { #ifndef RECOVER...
prv_get_state(&charge_state)
; if (prv_is_valid_transition(next_state)) { prv_transition(next_state, &charge_state); } } void battery_ui_handle_shut_down(void) { if (s_state != BatteryCharging) { enter_standby(RebootReasonCode_ShutdownMenuItem); } else { prv_transition(BatteryShutdownCharging, NULL); } } void battery_ui_res...
40, 920, 240}, { -56, 920, 248}, { -48, 920, 248}, { -56, 920, 248}, { -48, 920, 240}, { -48, 920, 248}, { -48, 920, 240}, { -48, 920, 248}, { -48, 912, 248}, { -48, 920, 248}, { -56, 920, 248}, // 77 seconds { -48, 912, 248}, { -48, 920, 248}, { -48, 920, 248}, ...
{ -48, 920, 248}, { -48, 912, 248}, { -48, 920, 240}, { -48, 920, 248}, { -48, 920, 240}, { -48, 920, 232}, { -48, 920, 248}, { -40, 920, 248}, { -40, 920, 240}, { -48, 920, 248}, { -48, 920, 240}, { -48, 920, 248}, { -48, 920, 248}, { -48, 920, 248}, // 83 se...
{ -56, 912, 280}, { -48, 912, 264}, { -48, 912, 272}, { -56, 912, 280}, { -56, 912, 272}, { -48, 912, 256}, { -48, 904, 280}, { -56, 912, 264}, { -56, 912, 272}, { -64, 904, 280}, { -56, 904, 272}, { -56, 904, 272}, { -56, 912, 280}, { -56, 912, 280}, { -56, ...
att_version(void) { PPoGATTMetaV0 future_meta_non_compatible = s_meta_v0_system; future_meta_non_compatible.ppogatt_min_version = 0xaa; future_meta_non_compatible.ppogatt_max_version = 0xff; prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta...
(ppogatt_client_count(), 0)
; } void test_ppogatt__cleanup_client_when_data_subscription_cccd_write_failed(void) { fake_gatt_client_subscriptions_set_subscribe_return_value(BTErrnoInvalidParameter); prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], ...