prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
back); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_x_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx....
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, 1, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r1_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,...
Enable the preload register and put us in PWM mode 2 TIM3->CCMR2 = TIM_CCMR2_OC4PE | (TIM_OCMode_PWM2 << 8); // The timer forces the pin high when the counter is greater than // or equal to this value. Since ARR is 63999, this means the // pin will be high for exactly one tick of the timer (~16 us) TIM3->CCR...
prv_round_to_byte(width)
; for (unsigned i = 0; i < height; i++) { memcpy(buffer[i + y_offset] + x_offset, bitmap + i * width, width); } } static void prv_display_buffer(uint8_t buffer[DISP_ROWS][DISP_LINE_BYTES]) { prv_display_start_write(); for (int i = 0; i < DISP_ROWS; i++) { prv_display_write_line(i, buffer[i]); } pr...
60}, { 1304, 288, -384}, { 1576, 328, -432}, { 1264, 360, -440}, { 1344, 456, -392}, { 928, 432, -464}, { 1216, 352, -360}, { 1232, 328, -216}, { 1392, 224, -112}, { 1392, 120, -56}, { 1176, 160, -104}, { 1120, 128, -184}, { 1112, 136, -160}, { 1128, 104, -192}, {...
{ 1536, 368, -200}, { 1360, 152, -24}, { 1288, -8, 24}, // 18 seconds { 1336, 24, -80}, { 1320, 160, -80}, { 1200, 136, -88}, { 1328, -24, -104}, { 1072, -32, -128}, { 912, 8, -168}, { 1120, 40, -168}, { 848, 8, -160}, { 992, 32, -176}, { 1344, 32, -256}, { 12...
{ 832, 88, -240}, { 888, 128, -232}, { 1112, 200, -200}, { 1312, 240, -216}, { 1392, 280, -240}, { 1696, 336, -232}, { 1320, 544, -432}, { 1312, 528, -360}, { 968, 472, -440}, { 1192, 376, -376}, { 1256, 344, -280}, // 21 seconds { 1432, 320, -208}, { 1320, 104, ...
l_manager__is_watchface_via_entry(void) { cl_assert_equal_b(true, prv_app_install_is_watchface(tictoc_id)); cl_assert_equal_b(false, prv_app_install_is_watchface(music_id)); cl_assert_equal_b(false, prv_app_install_is_watchface(sports_id)); cl_assert_equal_b(false, prv_app_install_is_watchface(bg_counter_id));...
cl_assert_equal_i(ProcessStorageFlash, bg_counter_md->process_storage)
tp://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permi...
cl_assert(horiz_advance != 0)
; cl_assert_equal_i(horiz_advance, text_resources_get_glyph_horiz_advance(&s_font_cache, 'c', &s_font_info)); } void test_text_resources__get_glyph_multiple(void) { const uint8_t a_glyph_data_bytes[] = {0x2e, 0x42, 0x2e, 0x63, 0xb6}; const uint8_t b_glyph_data_bytes[] = {0x21, 0x84, 0x36, 0x63, 0x8c, 0x71, ...
---------------------------- // Launch the next worker, if there is one void worker_manager_launch_next_worker(AppInstallId previous_worker_install_id) { // Is there another worker set to switch to? if (s_next_worker.md != NULL) { worker_manager_launch_new_worker_with_args(s_next_worker.md, s_next_worker.args);...
{ return s_worker_task_context.install_id; }
// ------------------------------------------------------------------------------------------------ ProcessContext* worker_manager_get_task_context(void) { return &s_worker_task_context; } // ------------------------------------------------------------------------------------------------ void worker_manager_put_...
/* * 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...
{ is_existing = true; goto finally; }
prv_generate_root_keys(keys_out); finally: #ifndef RELEASE PBL_LOG(LOG_LEVEL_INFO, "BLE Root Keys (existing=%u):", is_existing); PBL_HEXDUMP(LOG_LEVEL_INFO, (const uint8_t *)keys_out, 2 * sizeof(SM128BitKey)); #endif if (!is_existing) { bt_persistent_storage_set_root_keys(keys_out); } }
/* * 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 (rv == S_SUCCESS) { TimelineItemId parent_id = ((CommonTimelineItemHeader *)val)->parent_id; if (timeline_get_private_data_source(&parent_id)) { goto done; } // Not a private data source, must be a PBW AppInstallId install_id = app_install_get_id_for_uuid(&parent_id); // can't add a pin...
done: return rv; } static status_t prv_insert_item(TimelineItem *item, bool emit_event) { if (item->header.type != TimelineItemTypePin) { return E_INVALID_ARGUMENT; } // allocate a buffer big enough for serialized item size_t payload_size = timeline_item_get_serialized_payload_size(item); uint8_t *b...
/* * 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...
{ // clz stands for Count Leading Zeroes. We use it to find the MSB int msb = 31 - __builtin_clz(n); // popcount counts the number of set bits in a word (1's) bool power_of_two = __builtin_popcount(n) == 1; // if not exact power of two, use the next power of two // we want to err on the side of ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_DEBUG, "AppRunState(0x34) %s sending status: %s - %u", (success ? "success" : "failed"), uuid_buffer, app_run_state->state)
; } else { PBL_LOG(LOG_LEVEL_DEBUG, "Using deprecated launcher_app_message"); const bool is_running = ((app_run_state->state == RUNNING) ? true : false); launcher_app_message_send_app_state_deprecated(&app_run_state->uuid, is_running); } } kernel_free(app_run_state); } void app_run_state...
_for_null(void) { const uint16_t radius = 5; const GPoint result = gpoint_from_polar_internal(NULL, radius, 0); cl_assert_equal_gpoint(result, GPointZero); } void test_graphics_circle__gpoint_from_polar_returns_correct_points(void) { const uint16_t radius = 5; GPoint result; const GPoint origin_center = G...
(0, -1, 2, 2)
, grect_centered_internal(&p1, GSize(2, 2))); // Repeat for an offset center point GPointPrecise p2 = GPointPreciseFromGPoint(GPoint(5, 5)); // GRectZero + standardize cl_assert_equal_grect(GRect(5, 5, 0, 0), grect_centered_internal(&p2, GSize(0, 0))); cl_assert_equal_grect(GRect(5, 4, 1, 2), grect_centered...
.scs_pin); gpio_cfg.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(FLASH_CONFIG.spi_gpio, &gpio_cfg); // Set up a SPI bus on SPI1 SPI_InitTypeDef spi_cfg; SPI_I2S_DeInit(FLASH_CONFIG.spi); spi_cfg.SPI_Direction = SPI_Direction_2Lines_FullDuplex; spi_cfg.SPI_Mode = SPI_Mode_Master; spi_cfg.SPI_DataSize = SPI_DataS...
prv_disable_flash_spi_clock()
read_count; static uint32_t s_analytics_read_bytes_count; static uint32_t s_analytics_write_bytes_count; static uint32_t s_system_analytics_read_bytes_count = 0; static uint32_t s_system_analytics_write_bytes_count = 0; static uint8_t s_system_analytics_erase_count = 0; void analytics_external_collect_system_flash_st...
PBL_LOG(LOG_LEVEL_ERROR, "Flash erase failed, status %"PRIi32, status)
; if (attempt++ >= MAX_ERASE_RETRIES) { // We've tried all we can. No point in croaking; it's not like a reboot // is going to fix anything. Best we can do is pretend like nothing is // wrong and hope for the best. PBL_LOG(LOG_LEVEL_ERROR, "Giving up on restarting the flash erase."...
.device, info.status); break; case PebbleServicesRemoved: // TODO (PBL-22087): This is suboptimal. Before we release the BLE API, we should // either communicate to the App all the handles which have changed or // allow the getters for removed services to still work for the duration //...
if (handler) { handler(e->object_ref, e->gatt_error); }
} static void prv_handle_characteristic_subscribe(const PebbleBLEGATTClientEvent *e) { PBL_LOG(LOG_LEVEL_DEBUG, "TODO: GATT Client Event, subtype=%u", e->subtype); } static void prv_handle_descriptor_read(const PebbleBLEGATTClientEvent *e) { BLEAppState *ble_app_state = app_state_get_ble_app_state(); prv_consu...
e boundary so check for that if ((f->curr_page == INVALID_PAGE) || ((data_offset % free_bytes_in_page(f->curr_page)) == 0)) { uint16_t next_page = f->start_page; int pages_to_seek = (data_offset / free_bytes_in_page(f->start_page)); int closest_match = -1; if (((f->op_flags & OP_FLAG_USE_PAGE_C...
{ res = E_INVALID_ARGUMENT; goto cleanup; }
if ((file->offset + size) > file->file_size) { PBL_LOG(LOG_LEVEL_DEBUG, "Out of bound read at %d", (int)(file->offset + size)); res = E_RANGE; goto cleanup; } uint32_t pg_offset; if (scan_to_offset(file, &pg_offset) != S_SUCCESS) { res = E_INTERNAL; goto cleanup; } // we have...
void test_app_inbox__app_inbox_create_and_register_zero_buffer_size(void) { void *result = app_inbox_create_and_register(0, 1, test_message_handler, test_dropped_handler); cl_assert_equal_p(result, NULL); } void test_app_inbox__app_inbox_create_and_register_zero_min_num_messages(void) { void *result = app_inbox...
{ bool success; uint8_t storage[BUFFER_SIZE]; success = app_inbox_service_register(storage, sizeof(storage), test_message_handler, test_dropped_handler, AppInboxServiceTagUnitTest); cl_assert_equal_b(success, true); fake_kernel_ma...
//////////////////////////////////////////////////////////////////////////////////////////////////// // app_inbox_service_begin static void *s_writer = (void *) 0xaabbccdd; static void *s_inbox; static void prv_create_test_inbox(void) { s_inbox = app_inbox_create_and_register(BUFFER_SIZE, 1, ...
y); } bool app_install_has_worker(AppInstallId id) { AppInstallEntry entry; bool exists = app_install_get_entry_for_install_id(id, &entry); if (!exists) { return false; } return app_install_entry_has_worker(&entry); } bool app_install_is_hidden(AppInstallId id) { AppInstallEntry entry; bool exists =...
(APP1_WORKER_FIXTURE_NAME, filename_buf)
; resource_storage_get_file_name(filename_buf, sizeof(filename_buf), 1); load_fixture_on_pfs(APP1_RESOURCES_FIXTURE_NAME, filename_buf); // simulate installing app2 on flash app_db_insert((uint8_t *)&menu_layer.uuid, sizeof(Uuid), (uint8_t *)&menu_layer, sizeof(AppDBEntry)); menu_layer_id = app_db_get_instal...
og); #if PBL_ROUND scroll_layer_set_paging(scroll_layer, true); #endif if (show_action_bar) { // Icons for up and down on the action bar. #ifndef RECOVERY_FW expandable_dialog->up_icon = gbitmap_create_with_resource_system(SYSTEM_APP, RESOURCE_ID_ACTION_BAR_ICON_UP); expandable_dialog->down_ic...
(expandable_dialog->up_icon)
; gbitmap_destroy(expandable_dialog->down_icon); if (*expandable_dialog->header) { text_layer_deinit(&expandable_dialog->header_layer); } scroll_layer_deinit(&expandable_dialog->scroll_layer); if (expandable_dialog->dialog.destroy_on_pop) { applib_free(expandable_dialog); } } Dialog *expandable_dia...
N(buffer_size, first_page_available_bytes); if (first_page_available_bytes < FLASH_PAGE_SIZE) { PBL_LOG_VERBOSE("Address is not page-aligned; first write will be %"PRId32"B at address 0x%"PRIX32, first_page_available_bytes, start_addr); } while (bytes_to_write) { flash_write_page(buffer, start_add...
prv_flash_get_register(FLASH_CMD_READ_LOCK_REGISTER)
; uint8_t flag_status_register = prv_flash_get_register(FLASH_CMD_READ_FLAG_STATUS_REG); uint8_t nonvolatile_config_register = prv_flash_get_register(FLASH_CMD_READ_NONVOLATILE_CONFIG_REGISTER); uint8_t volatile_config_register = prv_flash_get_register(FLASH_CMD_READ_VOLATILE_CONFIG_REGISTER); disa...
onst ANCSAttribute *app_id, const ANCSAttribute *display_name, const ANCSAttribute *title) { // When we receive a notification, information about the app that sent us the notification // is recorded in the notif_pref_db. We sync this DB with the phone wh...
(app_name_buff)
; attribute_list_destroy_list(&new_attr_list); } uint8_t ancs_filtering_get_mute_type(const iOSNotifPrefs *app_notif_prefs) { if (app_notif_prefs) { return attribute_get_uint8(&app_notif_prefs->attr_list, AttributeIdMuteDayOfWeek, MuteBitfield_None)...
256, -136}, { 1040, 280, -152}, { 712, 224, -136}, { 512, 200, -136}, { 456, 216, -120}, { 528, 200, -160}, { 600, 192, -88}, { 832, 264, -160}, { 992, 296, -192}, { 1160, 360, -256}, { 1344, 360, -216}, { 1296, 416, -224}, { 1048, 368, -192}, { 1104, 368, -176}, ...
{ 1144, 368, -192}, { 1080, 328, -168}, { 1112, 328, -120}, { 1224, 312, -96}, { 1152, 240, -32}, { 864, 208, -16}, { 680, 184, -56}, { 696, 176, -56}, { 792, 152, -24}, { 840, 104, -16}, { 872, 48, -32}, { 1040, 48, -72}, { 1088, 40, -56}, { 1216, 96, -120}, ...
{ 960, 64, 88}, { 968, 56, 32}, { 1064, 72, -72}, { 1144, 56, -96}, { 1264, 232, -88}, { 1144, 48, -136}, { 1240, 88, -136}, // 94 seconds { 1280, 56, -200}, { 1048, 200, -312}, { 736, 128, -248}, { 544, 64, -240}, { 512, 144, -288}, { 536, 200, -216}, { 584,...
try.num_samples > 0) { return true; } else { return false; } } // --------------------------------------------------------------------------------------- static bool prv_parse_sleep_samples_file(SleepSampleDiscoveryState *state) { // Init for next set of samples state->test_entry = (SleepFileTestEntry...
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_sleep.value)
; } else if (strcmp(token, "TEST_IN_SLEEP_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_sleep.min); } else if (strcmp(token, "TEST_IN_SLEEP_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_sleep.max); } else if (strcmp(token, "...
_alarm_get_config(&file, id, &config); if (!rv) { goto cleanup; } if (kind_out) { *kind_out = config.kind; } cleanup: prv_file_close_and_unlock(&file); return rv; } static void prv_snooze_alarm(int snooze_delay_s) { prv_clear_snooze_timer(); PBL_LOG(LOG_LEVEL_INFO, "Snoozing for %d minutes", ...
{ return; }
// Update the day for any just once alarms for (int i = 0; i < MAX_CONFIGURED_ALARMS; ++i) { AlarmConfig config; if (prv_alarm_get_config(&file, i, &config)) { if (config.kind == ALARM_KIND_JUST_ONCE) { prv_set_day_for_just_once_alarm(&config, config.hour, config.minute); Alarm alarm...
/* * 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...
(USART2, uart_irq_handler, QEMU_UART)
; #endif static UARTDeviceState s_dbg_uart_state; static UARTDevice DBG_UART_DEVICE = { .state = &s_dbg_uart_state, .tx_gpio = { .gpio = GPIOC, .gpio_pin = GPIO_Pin_10, .gpio_pin_source = GPIO_PinSource10, .gpio_af = GPIO_AF_USART3 }, .rx_gpio = { .gpio = GPIOC, .gpio_pin = GPIO_Pin_11,...
in_rect_processed(ctx, src_bitmap, &rect, NULL); } typedef struct DivResult { int32_t quot; int32_t rem; } DivResult; //! a div and mod operation where any remainder will always be the same direction as the numerator static DivResult polar_div(int32_t numer, int32_t denom) { DivResult res; res.quot = numer / ...
if (grect_contains_point(&src->bounds, &src_ic)) { // TODO: Optimize further (PBL-15657) // If src_ic is within the bounds of the source image, do the following performance // optimization: // Create a clipping rectangle based on the max distance away from the pivot point // that the destination ima...
for (int y = dest_clip.origin.y; y < dest_clip.origin.y + dest_clip.size.h; ++y) { for (int x = dest_clip.origin.x; x < dest_clip.origin.x + dest_clip.size.w; ++x) { // only draw if within the dest range const GBitmapDataRowInfo dest_info = gbitmap_get_data_row_info(dest_bitmap, y); if (!WITHI...
al_s(dstbuf, "0zero1"); // Variable length character output snprintf(dstbuf, 256, "There are %*x lights", 3, 16); cl_assert_equal_s(dstbuf, "There are 10 lights"); // Variable length digits output snprintf(dstbuf, 256, "There are %.*x lights", 3, 16); cl_assert_equal_s(dstbuf, "There are 010 lights"); ...
cl_assert_equal_s(dstbuf, "Hurf")
; // Plus for positive signed // No signed conversion occurs, so this is a no-op snprintf(dstbuf, 256, "Hur%+c", 'f'); cl_assert_equal_s(dstbuf, "Hurf"); // Variable length character output snprintf(dstbuf, 256, "Hur%*c", 2, 'f'); cl_assert_equal_s(dstbuf, "Hur f"); } void test_sprintf__percent_s(void)...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_ASSERTN(!gsize_equal(&f->size, &GSizeZero)); PBL_ASSERTN(y < f->size.h); #if PLATFORM_SPALDING const GBitmapDataRowInfoInternal *row_infos = g_gbitmap_spalding_data_row_infos; const size_t offset = row_infos[y].offset; #else const size_t offset = y * f->size.w; #endif return f->buffer + offset; }
HistoryStats *stats); // ========================================================================================= // Activity stubs / fakes typedef struct StaticData { ActivityScalarStore steps_per_minute; int32_t metric_history[ActivityMetricNumMetrics][ACTIVITY_HISTORY_DAYS]; // Enough room for 3 days worth ...
{ printf("now_utc: %ld, end_utc: %ld\n", rtc_get_time(), start_utc + length_sec); }
/* * 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...
memset(&ctx, 0xdd, sizeof(ctx))
10:01) rtc_set_time(event_time + (10 * SECONDS_PER_MINUTE) + 1); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("10 MIN AGO", time_buf); // June 9th 2015, 12:10:30 (T+00:10:30) rtc_set_time(event_time + (10 * SECONDS_PER_MINUTE) + 30); clock_ge...
(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("Yesterday, 12:00 PM", time_buf); // June 11th 2015, 13:00:00 (T+2DAY+01:00:00) rtc_set_time(event_time + (2 * SECONDS_PER_DAY) + (1 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Tue, 12:00 PM", time_bu...
/* * 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...
SPI_Init(DISP_SPI, &spi_cfg)
; SPI_Cmd(DISP_SPI, ENABLE); } void display_start(void) { // Enable the GPIOG clock; this is required before configuring the pins gpio_use(DISP_GPIO); GPIO_PinAFConfig(DISP_GPIO, GPIO_PINSOURCE_SCK, GPIO_AF_SPI6); // SCK GPIO_PinAFConfig(DISP_GPIO, GPIO_PINSOURCE_MOSI, GPIO_AF_SPI6); // MOSI GPIO_PinAFCo...
ationWindowData *data) { if (!data->is_modal || regular_timer_is_scheduled(&data->reminder_watchdog_timer_id) || !do_not_disturb_is_active()) { return; } data->reminder_watchdog_timer_id = (const RegularTimerInfo) { .cb = prv_clear_stale_reminders_timer_cb, .cb_data = data, }; regular_time...
prv_get_window_stack()
); } static void prv_mute_notification(const ActionMenuItem *action_menu_item, uint8_t muted_bitfield) { NotificationWindowData *window_data = action_menu_item->action_data; TimelineItem *item = prv_get_current_notification(window_data); const char *app_id = attribute_get_strin...
= time_util_get_day_in_week(rtc_get_time()); bool current_value_updated = false; if (cur_wday == wday) { // Update our cached copy of the value if it is larger than what we currently have if (m_info.value_p && value > *m_info.value_p) { *m_info.value_p = value; current_value_updated = true; ...
mutex_lock_recursive(state->mutex)
; { state->step_data.distance_meters = ROUND(state->distance_mm, MM_PER_METER); ACTIVITY_LOG_DEBUG("new distance: %"PRIu16"", state->step_data.distance_meters); state->step_data.active_kcalories = ROUND(state->active_calories, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(buffer, buffer_size, "%s ", i18n_get("30 DAY", i18n_owner))
; #endif if (daily_avg <= 0) { strncpy(buffer + avg_len, EN_DASH, buffer_size - avg_len); } else { health_util_format_hours_and_minutes(buffer + avg_len, buffer_size - avg_len, daily_avg, i18n_owner); } } Window *health_sleep_detail_card_create(HealthData *health...
/* * 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...
ceil_log_two(divisor)
; } // Prescalers only exists for values in [2 - 256] range PBL_ASSERTN(lg > 0); PBL_ASSERTN(lg < 9); // return prescaler return (SPI_FREQ_LOG_TO_PRESCALER(lg)); }
ayer *layer) { // reset the animation animation_unschedule(layer->animation); layer->animation = NULL; // reset the day separator layer_set_hidden((Layer *)&layer->day_separator, true); TimelineResourceInfo timeline_res = { .res_id = TIMELINE_RESOURCE_DAY_SEPARATOR, }; peek_layer_set_icon(&layer->...
{ TimelineLayout *layout = layer->layouts[s_visible_items[i]]; if (layout) { GRect frame; prv_get_frame(layer, i + 1, &frame); animations[num_animations++] = prv_create_bounce_back_animation((Layer *)layout, &frame, directio...
const GRect *day_sep_from = &((Layer *)&layer->day_separator)->frame; animations[num_animations++] = prv_create_bounce_back_animation((Layer *)&layer->day_separator, day_sep_from, direction); const GRect *fin_from = &layer->end_of_timeline.layer...
count_handler_entries(&s_started_handler_calls, spawn), 1); // Run to the completion of C, start of D prv_advance_to_ms_with_timers(start_ms + 1080 + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started...
(a, auto_destroy)
; animation_schedule(a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_a); animation_set_delay(b, delay_a); animation_set_handlers(b, handlers, context); animation_set_auto_destroy(b, auto_destroy); animation_schedule(b); Animation *c = prv_create_test_animation(); 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...
{ attribute_list_add_uint32(list, AttributeIdIconTiny, timeline_res); attribute_list_add_uint32(list, AttributeIdIconSmall, card_res ?: timeline_res); attribute_list_add_uint32(list, AttributeIdIconLarge, card_res ?: timeline_res); }
#define ARRAY_RAND(arr) arr[rand() % ARRAY_LENGTH(arr)] static void prv_add_notification(int32_t delta_time_s) { const time_t now = rtc_get_time(); AttributeList list = {}; TimelineResourceId icon_resources[] = { TIMELINE_RESOURCE_NOTIFICATION_FACEBOOK_MESSENGER, TIMELINE_RESOURCE_NOTIFICATION_FA...
e) { if (state->cache) { state->cache->steps_daily.totals[0] = e->health_event.data.movement_update.steps; } } state->event_handler(e->health_event.type, state->context); // If we crossed an alert threshold, generate a metric alert event if (state->cache) { prv_check_and_generate_metric_aler...
health_service_private_non_zero_filter(index, value, NULL)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ static const RockyGlobalAPI *s_api[] = { NULL, }; rocky_global_init(s_api); JS_VAR prototype = rocky_add_constructor("test", test_func_imp); cl_assert_equal_b(jerry_value_is_object(prototype), true); EXECUTE_SCRIPT("_rocky.test();"); cl_assert_equal_i(1, s_test_func_imp_call_count); rocky_add_fu...
void test_rocky_api_util__error_print(void) { s_log_internal__expected = (const char *[]){ "Unhandled Error", " "ERROR_STRING, NULL }; jerry_value_t error_val = jerry_create_error(JERRY_ERROR_COMMON, (const jerry_char_t *)ERROR_STRING); cl_assert(jerry_value_has_error_flag(error_val)); ...
/* * 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 sys_app_worker_is_running(); }
// --------------------------------------------------------------------------------------------------------------- // Launch the worker for the current app AppWorkerResult app_worker_launch(void) { return sys_app_worker_launch(); } // ------------------------------------------------------------------------------...
/* * 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...
__builtin_return_address(0)
, "ASSERT", message, fmt_args); va_end(fmt_args); } NORETURN passert_failed_hashed(uint32_t packed_loghash, ...) { uintptr_t saved_lr = (uintptr_t) __builtin_return_address(0); PBL_LOG(LOG_LEVEL_ALWAYS, "ASSERTION at LR 0x%x", saved_lr); va_list fmt_args; va_start(fmt_args, packed_loghash); pbl_log_hash...
mmon/bluetooth/local_id.h" #include "services/common/bluetooth/pairability.h" #include "services/common/i18n/i18n.h" #include "services/common/system_task.h" #include "services/normal/bluetooth/ble_hrm.h" #include "system/logging.h" #include "system/passert.h" #include "util/string.h" #include <bluetooth/bluetooth_typ...
{ SettingsBluetoothData *data = (SettingsBluetoothData*) context; if (!data) { return; } // Determine the address of our active remote, if we have one. BTDeviceAddress active_addr = {}; const bool is_connected = bt_driver_classic_copy_connected_address(&active_addr); // Create the new remote Store...
static void prv_add_bt_classic_remotes(SettingsBluetoothData *data) { bt_persistent_storage_for_each_bt_classic_pairing(prv_add_bt_classic_remote, data); } static bool dual_remote_filter(ListNode *node, void *data) { StoredRemote *classic_remote = (StoredRemote *) node; BTDeviceInternal *device = (BTDeviceInt...
; s_connection = (GAPLEConnection) { .gatt_connection_id = TEST_GATT_CONNECTION_ID, .gatt_service_changed_att_handle = 0, }; GATT_Start_Service_Discovery_Handle_Range(TEST_BT_STACK_ID, TEST_GATT_CONNECTION_ID, NULL, 0, NULL, prv_bluetopia_service_discovery_cb, 0); } void te...
gatt_service_changed_client_handle_indication(&s_connection, att_handle, (const uint8_t *) handle_range, sizeof(uint16_t) * 1)
; cl_assert_equal_b(handled, true); }
stored_remote_create()
; remote->classic.bd_addr = *addr; prv_copy_device_name_with_fallback(remote, name); if (is_connected && (0 == memcmp(addr, &active_addr, sizeof(*addr)))) { remote->classic.connected = true; } else { remote->classic.connected = false; } add_remote(data, remote); } static void prv_add_bt_classic_...
= true; intent->client[c].auto_reconnect = auto_reconnect; intent->client[c].is_pairing_required = is_pairing_required; intent->client[c].connected = false; // starting state if (!is_already_connected) { return BTErrnoOK; } if (is_pairing_required && !is_already_encrypted) { if (local_is_master)...
{ case BtPersistBondingOpDidAdd: // FIXME: break; case BtPersistBondingOpDidChange: *intent->bonding = updated_bonding; break; case BtPersistBondingOpWillDelete: for (GAPLEClient c = GAPLEClientKernel; c < GAPLEClientNum; ++c) { if (!intent->client[c].is_used) { ...
unlock: bt_unlock(); } // ------------------------------------------------------------------------------------------------- BTErrno gap_le_connect_connect(const BTDeviceInternal *device, bool auto_reconnect, bool is_pairing_required, GAPLEClient client) { if (!device || client >= GAPLEClie...
GAPLEConnection **connection_out); extern BLECharacteristic gatt_client_descriptor_get_characteristic_and_connection( BLEDescriptor descriptor_ref, ...
prv_unlock()
; if (LIKELY(write_space >= required_length)) { if (UNLIKELY(did_stall)) { PBL_LOG(LOG_LEVEL_DEBUG, "GATT notification stalled for %d ms...", (int)(timeout_ms - ticks_to_milliseconds(timeout_end_ticks - rtc_get_ticks()))); analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_GATT_STALLED_...
prv_hide_action_bar(); } action_bar_layer_set_click_config_provider(&s_phone_ui_data->action_bar, prv_click_config_provider); } //! Put the correct data in the 3 text fields static void prv_display_caller_info(PebblePhoneCaller *caller) { prv_set_caller_id_text(calle...
(&window->layer, prv_window_update_proc)
1202, 1602, 2002, 2403, 2803, 3203, 3603, 4003, 4403, 4802, 5202, 5601, 6000, 6399, 6797, 7195, 7593, 7991, 8389, 8786, 9182, 9579, 9975, 10371, 10766, 11161, 11555, 11949, 12343, 12736, 13129, 13521, 13913, 14304, 14694, 15085, 15474, 15863, 16251, 16639, 17026, 17413, 17798, 18184, 18568, 18952, 19335, 19717, 20099,...
{ int32_t mult = 1; // modify the input angle and output multiplier for use in a first quadrent sine lookup if (angle < 0) { angle = -angle; mult = -mult; } if (angle >= TRIG_MAX_ANGLE) { angle %= TRIG_MAX_ANGLE; } if (angle >= TRIG_MAX_ANGLE / 2) { mult = -mult; angle -= TRIG_MAX_ANG...
int32_t cos_lookup(int32_t angle) { return sin_lookup(angle + TRIG_MAX_ANGLE / 4); } #define ATAN_LUT_STRIDE 0xff int32_t atan2_lookup(int16_t y, int16_t x) { // inspired by http://www.coranac.com/documents/arctangent/ if (y == 0) { return (x >= 0 ? 0 : TRIG_PI); } // moving x and y values into bigge...
__infinite_animation_finite_reel_forward(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = 300; kino_player_play(test_player); animation_set_elapsed(test_player->animation, 20); animation_set_durat...
(test_player->animation, true)
; animation_set_duration(test_player->animation, 300); 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_player__create_finite_a...
sessions_connected(void) { s_system_session_ptr = NULL; s_app_session_ptr = NULL; AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbox_message(NULL /* auto-select */, ALLOWED_ENDPOINT_ID, TEST_PAYLOAD, sizeof(TEST_PAYLOAD)); assert_consumed(AppMessageS...
cl_assert_equal_i(TEST_EXPECTED_PP_MSG[i], byte_out)
; comm_session_send_queue_consume(s_app_session_ptr, 1 /* length */); } assert_consumed(AppMessageSenderErrorSuccess, 1); cl_assert_equal_i(s_app_install_timestamp_update_count, 1); app_free(outbox_data); } void test_app_message_sender__byte_by_byte_copy_with_offset(void) { AppMessageAppOutboxData *out...
app_install_get_id_for_uuid(app_uuid)
; if (app_id == INSTALL_ID_INVALID) { PBL_LOG(LOG_LEVEL_DEBUG, "Attempting to launch an invalid app"); return false; } app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = app_id, .common.reason = APP_LAUNCH_SMARTSTRAP, }); } else if (attr == ControlServiceAttribute...
rt(i >= TransportID1 && i <= TransportID3); return s_transport_uuid[i]; } static CommSessionTransportType prv_get_type(struct Transport *transport) { return CommSessionTransportType_QEMU; } static const TransportImplementation s_transport_imp = { .send_next = prv_send_next, .close = prv_close, .reset = prv_...
cl_assert_equal_p(comm_session_get_by_type(CommSessionTypeApp), session)
, event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 1 MIN", time_buf); // June 10th 2015, 13:59:59 (T-00:00:01) rtc_set_time(event_time - 1); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 1 MIN", time_buf); // June 10th 2015, 14:00:00 ...
("IN 12 H", time_buf)
; // June 12th 2015, 00:29:30 (T-11:30:30) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) + (29 * SECONDS_PER_MINUTE) + 30); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 12 H", time_buf); // June 12th 2015, 00:29:59 (T-11:30:01) rtc_s...
var to_set = __jerryRefs.get($2); obj[$1] = to_set; return __jerryRefs.ref(true); }, obj_val, index, value_to_set); } void jerry_init_property_descriptor_fields(jerry_property_descriptor_t *prop_desc_p) { *prop_desc_p = (jerry_property_descriptor_t) { .value = jerry_create_undefined(), .gett...
if (!jerry_value_is_constructor(func_obj_val)) { return TYPE_ERROR_ARG; }
/* * 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...
(measure_types)
, }, }; return protobuf_log_create(&log_config, transport, 0 /*max_encoded_msg_size*/); } bool protobuf_log_hr_add_sample(ProtobufLogRef ref, time_t sample_utc, uint8_t bpm, HRMQuality quality) { uint32_t values[] = {bpm, prv_hr_quality_int(quality)}; return protobuf_log_se...
&child_a); cl_assert(layer_is_descendant(&child_a, &parent)); cl_assert(!layer_is_descendant(&parent, &child_a)); cl_assert(!layer_is_descendant(&child_b, &parent)); layer_add_child(&parent, &child_b); cl_assert(layer_is_descendant(&child_b, &parent)); cl_assert(!layer_is_descendant(&child_b, &child_a)); ...
(layer_find_layer_containing_point(&parent, &GPoint(0, 0)), &child_b)
; // outside the bounds of child a, so child b is not found cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(15, 15)), &parent); }
/* * 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...
(bus->event_semaphore, timeout_ticks)
== pdPASS); } static void prv_semaphore_give(I2CBusState *bus) { // If this fails, something is very wrong (void)xSemaphoreGive(bus->event_semaphore); } static portBASE_TYPE prv_semaphore_give_from_isr(I2CBusState *bus) { portBASE_TYPE should_context_switch = pdFALSE; (void)xSemaphoreGiveFromISR(bus->event_s...
t_equal_i(e.type, PEBBLE_APP_CACHE_EVENT); cl_assert_equal_i(e.app_cache_event.cache_event_type, PebbleAppCacheEvent_Removed); cl_assert_equal_i(e.app_cache_event.install_id, app1.id); cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app3.id)); e = fake_event_get_last(); cl_assert_equal_i(e.type, PEBBLE_AP...
app_cache_add_entry(app2.id, app2.size)
); cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app3.id, app3.size)); // add one with a key value of length 3 // Raw SettingsFile calls SettingsFile file; status_t rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE); cl_assert_equal_i(S_SUCCESS, rv); AppCacheEntry entry = { ...
_raw_by_transport(transport, s_short_data_fragment, sizeof(s_short_data_fragment)); printf("SEND %d %d\n", sn, success); cl_assert_equal_b(success, true); ppogatt_send_next...
prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], 0 /* sn */, s_short_data_fragment, sizeof(s_short_data_fragment))
ib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "resource/resource_ids.auto.h" #include "services/common/clock.h" #include "services/common/i18n/i18n.h" #include "services/normal/activity/health_util.h" #include "services/normal/activity/workout_service.h" #include "system/logging.h" #include <stdio.h> #define BA...
(&summary_window->action_bar)
; status_bar_layer_deinit(&summary_window->status_layer); layer_deinit(&summary_window->base_layer); window_deinit(&summary_window->window); i18n_free_all(summary_window); app_free(summary_window); } } ///////////////////////////////////////////////////////////////////////////////////////////////...
viceControl && notification_info->attribute_id == ControlServiceAttributeLaunchApp) { s_reserved_read_mbuf = mbuf_get(s_read_buffer, sizeof(s_read_buffer), MBufPoolSmartstrap); SmartstrapResult result = prv_do_send(GenericServiceTypeRead, notification_info->service_id, ...
(s_reserved_read_mbuf)
; s_reserved_read_mbuf = NULL; if (service_id == ReservedServiceManagement) { success = prv_handle_management_attribute_read(success, attribute_id, data, length); } else if (service_id == ReservedServiceControl) { success = prv_handle_control_attribute_read(success, attribute_id, data, 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...
list_get_tail(&b)
== &b); } void test_list__append(void) { ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LIST_NODE_NULL; ListNode *tail; tail = list_append(&a, &b); cl_assert(tail == &b); tail = list_append(&a, &c); cl_assert(tail == &c); cl_assert(list_get_prev(&a) == NULL); cl_assert(list_get_next(&a) == &b); ...
/* * 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 (item == NULL || !item->is_leaf) { return NULL; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
tick_timer_service_subscribe(SECOND_UNIT, prv_handle_second_tick)
; } static void s_main(void) { prv_handle_init(); app_event_loop(); } const PebbleProcessMd* mfg_certification_app_get_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = &s_main, // UUID: 266135d1-827f-4f64-9752-fffe604e1dbe .common.uuid = { 0x26, 0x61, 0x35, 0xd1, 0...
6, 56}, { 824, 312, 40}, // 16 seconds { 792, 296, -40}, { 816, 272, -80}, { 944, 320, -152}, { 1120, 240, -96}, { 1272, 224, -112}, { 1752, 216, 16}, { 1656, 376, 24}, { 936, 368, -72}, { 904, 280, -48}, { 1112, 160, 128}, { 1008, 136, 152}, { 904, 88, 128}, ...
{ 1016, 256, -88}, { 1112, 208, -24}, { 1144, 88, 176}, { 1008, 40, 176}, { 856, 88, 144}, { 752, 72, 80}, { 736, 48, 112}, // 22 seconds { 744, 0, 112}, { 704, -40, 40}, { 824, -64, 8}, { 960, -80, 56}, { 1152, 24, -96}, { 1680, -168, 224}, { 1584, 136, 128},...
{ 896, 168, 8}, { 792, 72, -8}, { 856, 104, 64}, { 920, 280, 8}, { 856, 336, -40}, { 832, 312, -192}, { 968, 296, -192}, { 1144, 248, -224}, { 1312, 232, -192}, { 1696, 184, -72}, { 1696, 296, -72}, { 1080, 264, -64}, // 25 seconds { 1112, 168, 56}, { 1328, 7...
void unobstructed_area_service_init(UnobstructedAreaState *state, int16_t current_y) { PBL_ASSERTN(state); *state = (UnobstructedAreaState) {}; prv_origin_y_to_area(current_y, &state->area); state->event_info = (EventServiceInfo) { .type = PEBBLE_UNOBSTRUCTED_AREA_EVENT, .handler = prv_handle_unobstruc...
{ UnobstructedAreaState *state = context; GRect previous_area = state->area; prv_save_event_area(state, event); if (!grect_equal(&previous_area, &state->area)) { app_request_render(); } switch (event->unobstructed_area.type) { case UnobstructedAreaEventType_WillChange: prv_handle_will_change_e...
void unobstructed_area_service_subscribe(UnobstructedAreaState *state, const UnobstructedAreaHandlers *handlers, void *context) { PBL_ASSERTN(state && handlers); state->handlers = *handlers; state->context = context; } void unobs...
ed, false); window_stack_pop(window->parent_window_stack, true); } static void prv_push_window_unload(Window *window) { WindowStack *stack = window->parent_window_stack; prv_window_unload(window); Window *new_window = window_create(); window_set_window_handlers(new_window, &(WindowHandlers){ .load = p...
(app_window_stack_count(), 0)
; cl_assert_equal_i(window2->on_screen, false); cl_assert_equal_i(window1->on_screen, false); window_destroy(window1); window_destroy(window2); } void test_window_stack__pop_all(void) { WindowStack *stack = modal_manager_get_window_stack(ModalPriorityGeneric); Window *windows[3]; for (uint8_t idx = 0; ...
UFFER_SIZE; i++) { content_indicator = content_indicator_create(); cl_assert(content_indicator); helper_check_buffer_for_content_indicator(i, content_indicator); } // Creating more content indicators than the buffer can hold should return NULL cl_assert_equal_p(content_indicator_create(), NULL); } v...
(dummy_config.layer->update_proc, direction_data->original_update_proc)
; cl_assert_equal_p(direction_data->original_update_proc, s_content_indicator_dummy_layer_update_proc); // Setting content available should switch the layer's update proc to draw an arrow content_indicator_set_content_available(&content_indicator, direction, true); cl_assert_equal_p(dummy_c...
task.h" #include <inttypes.h> #include <stdint.h> #include <stdio.h> // These variables are assigned values when the watch faults // TODO PBL-PBL-36253: We should probably save these in CrashInfo in the future. Saved here because // they are easier to pull out through GDB and because we can keep the Bluetooth FW and ...
reboot_reason_set(&reason)
; reset_due_to_software_failure(); } // TODO: Can we tell if it was the worker and not the app? extern void sys_app_fault(uint32_t lr); NORETURN trigger_fault(RebootReasonCode reason_code, uint32_t lr) { if (mcu_state_is_privileged()) { kernel_fault(reason_code, lr); } else { sys_app_fault(lr); } } N...
rents) { break; } } // We are done iterating state->aux->iter_next = NULL; } // ------------------------------------------------------------------------------------------- typedef Animation *(*CreateFromArrayFunc)(Animation **animation_array, uint32_t array_len); static Animati...
{ return NULL; }
Animation *parent_h = animation_private_animation_init(parent); parent->implementation = &s_complex_implementation; return prv_complex_init(parent_h, animation_array, array_len, type); } // ------------------------------------------------------------------------------------------- sta...
{ activity_stop_tracking(); fake_system_task_callbacks_invoke_pending(); }
// --------------------------------------------------------------------------------------- // Test that we correctly initialize the history upon startup based on stored settings void test_activity__init_history(void) { uint32_t exp_resting_kcalories[ACTIVITY_HISTORY_DAYS]; for (int i = 0; i < ACTIVITY_HISTORY_DA...
ually //! have to be locked because they're the sole property of the process and no //! other tasks should be touching it. All this function does is verify that //! this condition is met before continuing without locking. static void prv_heap_lock(void* unused) { PBL_ASSERT_TASK(PebbleTask_Worker); } static size_t p...
if (!worker_state_configure(&worker_ram)) { PBL_LOG(LOG_LEVEL_ERROR, "Worker state configuration failed"); return false; }
// The remaining space in worker_segment is assigned to the worker's // heap. Worker state needs to be configured before initializing the // heap as the WorkerState struct holds the worker heap's Heap object. Heap *worker_heap = worker_state_get_heap(); PBL_LOG(LOG_LEVEL_DEBUG, "Worker heap init %p %p", ...
rect_origin_aa_sw2_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 2); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, f...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, fal...
/* * 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...
(color, image_color)
) { return; } image->background_color = color; layer_mark_dirty(&(image->layer)); } void bitmap_layer_set_background_color_2bit(BitmapLayer *bitmap_layer, GColor2 color) { bitmap_layer_set_background_color(bitmap_layer, get_native_color(color)); } void bitmap_layer_set_compositing_mode(BitmapLayer *image,...
MAX_PAYLOAD_SIZE, 0x55); Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); for (uint8_t sn = 0; sn < s_tx_window_size; ++sn) { cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport, data, ...
ppogatt_send_next((struct Transport *) &fake_client)
; // No crashes, no writes, etc. fake_gatt_client_op_assert_no_write(); } void test_ppogatt__handle_bluetooth_stack_queue_full_and_empty_events(void) { test_ppogatt__open_session_when_found_pebble_app(); fake_gatt_client_op_set_write_return_value(BTErrnoNotEnoughResources); Transport *transport = ppogatt_cl...
/* * 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...
(node, indentation_level, buffer, buffer_size)
; node = node->next_sibling; } } static void layer_dump_tree_node(Layer* node, uint8_t indentation_level, char *buffer, uint8_t buffer_size) { const bool hidden = node->hidden; const bool clips = node->clips; const char *layer_type_string = layer_debug_guess_type(node); dbgserial_putstr_fmt(buffer, buffe...
((uint8_t *)&hdr, sizeof(hdr), base_addr)
; } } // Write Page Header + DataLen if (do_copy) { pfs_write(fd, &hdr, sizeof(hdr)); pfs_write(fd, &data_len, sizeof(data_len)); } else { // recover pfs_read(fd, &hdr, sizeof(hdr)); pfs_read(fd, &data_len, sizeof(data_len)); prv_flash_write(&hdr, sizeof(hdr), base_a...
nt_App); } analytics_inc(ANALYTICS_APP_METRIC_CRASHED_COUNT, AnalyticsClient_App); } else if (task == PebbleTask_Worker) { analytics_inc(ANALYTICS_APP_METRIC_BG_CRASHED_COUNT, AnalyticsClient_Worker); } if (context->app_md->is_rocky_app) { analytics_inc(ANALYTICS_DEVICE_METRIC_APP_RO...
(LOG_LEVEL_DEBUG, "Got it")
; prv_handle_app_stop_analytics(context, task, gracefully); return true; } // Non-graceful close if (context->closing_state == ProcessRunState_Running || context->closing_state == ProcessRunState_GracefullyClosing) { // Right before a syscall drops privilege, it calls // pro...
vity_exit_at_utc, false}, {ActivitySettingsKeyLastRestfulSleepActivityUTC, &state->logged_restful_sleep_activity_exit_at_utc, false}, {ActivitySettingsKeyLastStepActivityUTC, &state->logged_step_activity_exit_at_utc, false}, }; bool logged_event = false; ActivitySession *session = state->acti...
prv_is_valid_activity_session(session)
) { // NOTE: We check for full validity as well as we can (rather than just checking for a // non-null activity start time for example) because there have been cases where // flash got corrupted, as in PBL-37848 PBL_HEXDUMP(LOG_LEVEL_INFO, (void *)state->activity_sessions, size...
type]), true); // It's a byte array inside, so memcmp should be OK to use: cl_assert_equal_i(memcmp(&keys[key_type], &keys_out[key_type], sizeof(keys[0])), 0); } } void test_shared_prf_storage_v3__local_device_name(void) { cl_assert_equal_b(shared_prf_storage_get_local_device_name(NULL, 0), false); shar...
(device_name_out, DEVICE_NAME)
; // Check getting started cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), GETTING_STARTED_COMPLETE); // Check local_name cl_assert_equal_b(shared_prf_storage_get_local_device_name(device_name_out, sizeof(device_name_out)), true...
; static void prv_set_expected_data(void *data, size_t len) { s_expected_data.buf = data; s_expected_data.len = len; } static void prv_assert_data_matches_expected(const void *data, size_t len) { cl_assert_equal_i(len, s_expected_data.len); cl_assert(memcmp(s_expected_data.buf, data, len) == 0); } static voi...
cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0)
; } //! It's possible the same session can receiver multiple messages before any //! are processed on kernel BG. Make sure they do not interfere with one //! another void test_default_kernel_receiver__same_session_batched(void) { const int batch_num = 10; char data = 'a'; for (int i = 0; i < batch_num; i++) { ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
layer_add_child(root_layer, bitmap_layer_get_layer(&data->bitmap_layer))
; } static void push_window(FSResourceAppData *data) { Window *window = &data->window; window_init(window, WINDOW_NAME("FS Resource Demo")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); const bool animated = true; app_window_s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
circular_buffer_get_write_space_remaining(&buffer)
{ // swap frames so that we shrink to a dot during reverse kino_reel_transform_set_from_frame(reel, to); kino_reel_transform_set_to_frame(reel, from); } kino_reel_scale_segmented_set_end_as_dot(reel, data->mic_window.mic_dot_radius); kino_layer_play_section(&data->mic_window.icon_layer, 0...
(data->mic_window.fly_anim, &to)
; animation_unschedule((Animation *)data->mic_window.fly_anim); layer_set_frame(&data->mic_window.mic_dot_layer, &to); } } static void prv_set_percent(void *subject, int16_t percent) { VoiceUiData *data = subject; progress_layer_set_progress((ProgressLayer *)&data->mic_window.progress_bar, percent); } s...
rn BTErrnoOK; } // Notify client of the virtual connection: prv_update_clients(intent, HciStatusCode_Success, is_already_encrypted ? GAPLEConnectionEventConnectedAndEncrypted : GAPLEConnectionEventConnectedNotEncrypted); return BTErrnoOK; } // --------...
(&request, auto_reconnect, is_pairing_required, client)
; bt_unlock(); return ret_value; } // ------------------------------------------------------------------------------------------------- BTErrno gap_le_connect_cancel(const BTDeviceInternal *device, GAPLEClient client) { if (!device || client >= GAPLEClientNum) { return B...
fer_size, number_font, TEXT_COLOR, container); active_window->workout_controller->metric_to_string(metric_type, (char *) number_text_node->text, ...
(number_text_node->text)
> 5) { // text is long so use smaller font number_text_node->font = prv_get_number_font(false); } break; } case WorkoutMetricType_Pace: case WorkoutMetricType_AvgPace: { if (active_window->workout_controller->get_metric_value( metric_type, active_window->work...
urn (s_count++ != (int)data); } void test_transcription__validate(void) { bool result; Transcription * validate_test = (Transcription *) s_test_transcription_example; size_t test_size = sizeof(s_test_transcription_example); result = transcription_validate(validate_test, test_size); cl_assert_equal_p(result, ...
((TranscriptionWord *)words_test, 2, (TranscriptionWordIterateCb)prv_cb_return_true, NULL)
; cl_assert_equal_p(result, &words_test[15]); s_count = 0; result = transcription_iterate_words((TranscriptionWord *)words_test, 3, (TranscriptionWordIterateCb)prv_cb_return_false, (void *) 0); cl_assert_equal_p(result, words_test); s_count = 0; result = transcription_iterate_words((TranscriptionWor...
fs(void) { // Create an attribute list and action group AttributeList attr_list; attribute_list_init_list(0, &attr_list); attribute_list_add_cstring(&attr_list, AttributeIdShortTitle, "Title"); attribute_list_add_uint8(&attr_list, AttributeIdMuteDayOfWeek, 0x1F); attribute_list_add_cstring(&attr_list, Attri...
ARRAY_LENGTH(keys)
); // Mark some items as synced ios_notif_pref_db_mark_synced((uint8_t *)keys[0], key_len); ios_notif_pref_db_mark_synced((uint8_t *)keys[1], key_len); ios_notif_pref_db_mark_synced((uint8_t *)keys[2], key_len); // We should now only have 2 dirty items cl_assert_equal_i(ios_notif_pref_db_is_dirty(&is_dirt...
/////////// void uart_write_byte(UARTDevice *dev, uint8_t data) { PBL_ASSERTN(dev->state->initialized); // wait for us to be ready to send while (!uart_is_tx_ready(dev)) continue; dev->periph->TDR = data; } uint8_t uart_read_byte(UARTDevice *dev) { // explicitly clear the error flags to match up with F4 b...
{ dev->state->rx_dma_index = 0; }
} // explicitly clear error flags since we're not reading from the data register uart_clear_all_interrupt_flags(dev); } else { const bool has_byte = uart_is_rx_ready(dev); // read the data register regardless to clear the error flags const uint8_t data = uart_read_byte(dev); ...
{ return (conn != NULL); } GAPLEConnection *gap_le_connection_any(void) { return NULL; } void prv_regular_timer_spend_seconds(uint32_t seconds) { for (uint32_t i = 0; i < seconds; ++i) { fake_rtc_increment_ticks(RTC_TICKS_HZ); regular_timer_fire_seconds(1); // bt_conn_mgr offloads the callback to K...
fake_gap_le_connect_params_get_last_requested()
, ResponseTimeMin); // two requests at same high rate, longest time should be selected as timeout fake_gap_le_connect_params_reset_last_requested(); conn_mgr_set_ble_conn_response_time( &s_hdl, BtConsumerUnitTests, ResponseTimeMin, 250); state = conn_mgr_get_latency_for_le_connection(&s_hdl, &secs_to_wai...
h the sequence prv_advance_to_ms_with_timers(prv_now_ms() + delay_b + duration_b + delay_seq + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1); ...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1)
se. * 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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...
{ // Draw rectangle behind text, invert text color graphics_context_set_fill_color(ctx, GColorWhite); graphics_fill_round_rect(ctx, &bounds, 2, GCornersAll); graphics_context_set_text_color(ctx, GColorBlack); }
else { graphics_context_set_text_color(ctx, GColorWhite); } graphics_draw_text(ctx, text, font, bounds, GTextOverflowModeFill, GTextAlignmentCenter, NULL); } static void canvas_update_proc(Layer *layer, GContext* ctx) { AppData *data = window_get_user_data(s_window); GRect bounds = la...
68, -888}, { 200, 888, -800}, { 152, 672, -624}, { 96, 520, -504}, { 112, 504, -520}, { 176, 592, -560}, { 176, 600, -512}, { 168, 624, -520}, { 112, 600, -536}, { 32, 568, -528}, { 0, 576, -544}, { -16, 616, -576}, { 8, 624, -576}, { 8, 648, -576}, { -32, 648, -5...
{ 320, 616, -488}, { 360, 496, -496}, { 456, 544, -528}, { 536, 584, -456}, { 496, 592, -448}, { 432, 656, -520}, { 392, 648, -576}, { 352, 632, -544}, { 312, 616, -520}, { 288, 680, -528}, { 240, 696, -552}, { 208, 712, -552}, { 208, 696, -544}, { 216, 704, -536}...
{ 112, 552, -568}, { 88, 560, -584}, { 64, 568, -592}, { 24, 608, -632}, { -16, 624, -648}, { -48, 656, -640}, { -56, 688, -632}, // 53 seconds { -40, 752, -648}, { 8, 864, -648}, { 96, 1016, -672}, { 256, 1064, -664}, { 248, 824, -496}, { 88, 568, -296}, { 0...
(FindByAppUUIDContext) { .app_uuid = app_uuid, }; // Try most specific first: CommSession *session = (CommSession *) list_find((ListNode *) s_session_head, prv_find_session_by_app_uuid_comparator, &ctx); if (!session) { return ctx.fallback_session; }...
if (comm_session_is_valid(session)) { type = (session->destination == TransportDestinationApp) ? CommSessionTypeApp : CommSessionTypeSystem; }
} bt_unlock(); return type; } bool comm_session_is_system(CommSession* session) { return (comm_session_get_type(session) == CommSessionTypeSystem); } // ------------------------------------------------------------------------------------------------- //! Must (only) be called when going out of airplane mode...
NSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under t...
{ prompt_send_response_fmt(buffer, sizeof(buffer), "Device: %s", name); }
} #endif // RECOVERY_FW
et*/); if (!prv_is_mutable(state, animation)) { return false; } // NOTE: We still need to implement reverse for sequence and spawn animations. // tracked in this JIRA: https://pebbletechnology.atlassian.net/browse/PBL-14838 animation->reverse = reverse; return true; } // -----------------------------...
animation_private_using_legacy_2(state)
); AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, false /*quiet*/); if (!animation || !prv_animation_is_scheduled(state, animation) || !elapsed_ms) { return false; } *elapsed_ms = prv_get_elapsed(animation, prv_get_ms_since_system_start()); return true; } // -----------...
culation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 4 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 4); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw4_no_clip.${BIT_DEPT...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 3)
; graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 3); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq...
.major = PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR + 1, .minor = PROCESS_INFO_CURRENT_SDK_VERSION_MINOR } }, .should_pass = false }, { .entry = (AppInstallEntry) { .install_id = 4, .sdk_version = (Version) { .major = PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR, .mino...
process_manager_launch_process(&(ProcessLaunchConfig){.id=1})
; // app was launched, no events (especially no fetch event) on the queue cl_assert_equal_b(1, s_app_manager_launch_new_app__callcount); cl_assert_equal_p(s_app_install_get_md__result, s_app_manager_launch_new_app__config.md); cl_assert(s_event_put__event == NULL); } void test_process_mana...
13, 13), 60, 0, true); } void test_touch__assert_null_pos_not_liftoff(void) { // NULL position not valid for touchdown event cl_assert_passert(touch_handle_update(0, TouchState_FingerDown, NULL, 5, 3686400)); touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 0, 0); // NULL position not valid for pos...
cl_assert_equal_p(touch_event, NULL)
; } void test_touch__cancel_touches(void) { touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420); touch_handle_update(0, TouchState_FingerDown, &GPoint(15, 15), 6, 3686440); touch_handle_update(1, TouchState_FingerDown, &GPoint(55, 55), 2, 3686480); touch_handle_update(1, TouchState_Finge...