prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
, -456, -224}, { 1360, -448, -264}, { 1656, -288, -296}, { 1856, -152, -232}, { 1760, -80, -256}, { 1392, -40, -224}, { 1176, 24, -160}, { 1088, 88, -96}, { 952, 48, -88}, { 864, 16, -104}, { 872, 48, -144}, { 856, 80, -184}, { 824, 88, -392}, { 872, 120, -504}, {...
{ 1104, -184, 16}, { 1056, -168, -32}, // 109 seconds { 848, -128, -104}, { 1072, -136, -120}, { 1184, -128, -136}, { 1032, -216, -64}, { 960, -208, -56}, { 976, -184, -80}, { 944, -152, -96}, { 912, -216, -88}, { 904, -216, -112}, { 936, -192, -160}, { 936, -184,...
{ 1080, -128, -40}, { 1448, -176, 16}, { 1464, -144, -24}, { 1104, -88, -152}, { 840, -96, -224}, { 1040, -40, -256}, { 1224, -48, -128}, { 1200, -72, -56}, { 1016, -96, -96}, { 904, -64, -136}, { 872, -48, -152}, // 112 seconds { 952, -24, -184}, { 1024, -80, -1...
{ timeline_pin_window_set_item(&data->pin_window, &state->pin, state->current_day); } } ///////////////////////////////////// // Timeline Controller ///////////////////////////////////// T_STATIC void prv_setup_no_events_peek(TimelineAppData *data); static void prv_update_timeline_layer(TimelineAppData *data)...
(&data->timeline_layer, true)
; prv_set_day_sep_timer(data); } static void prv_up_down_click_handler(ClickRecognizerRef recognizer, void *context) { TimelineAppData *data = context; prv_inactive_timer_refresh(data); ButtonId button = click_recognizer_get_button_id(recognizer); const bool next = (button == BUTTON_ID_UP) ^ (data->ti...
StateRecording) { // Transition to unfold state (StateStopRecording) before pending a transition to the text // window prv_set_mic_window_state(data, StateTransitionToText); } prv_set_mic_window_state(data, StateTransitionToText); } else { prv_handle_dictatio...
(data, DictationSessionStatusFailureInternalError)
; return; } if (data->state != StateStartWaitForReady) { // This is a bit of a hack to prevent jumps in the fly in animation when a session fail comes // back quickly prv_set_mic_window_state(data, StateWaitForReady); } } static void prv_stop_dictation(VoiceUiData *data) { VOICE_LOG("Stop dicta...
/* * 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...
sleep_mode_enable(!low_power_debug_on)
; #endif if (low_power_debug_on) { enable_mcu_debugging(); } else { disable_mcu_debugging(); } }
, { 456, 400, -760}, { 512, 392, -752}, { 480, 408, -768}, { 480, 392, -752}, { 496, 400, -752}, { 488, 400, -768}, { 480, 360, -752}, { 496, 416, -744}, { 480, 424, -760}, { 488, 392, -744}, { 488, 376, -752}, // 94 seconds { 480, 400, -768}, { 504, 392, -768}, ...
{ 480, 400, -760}, { 472, 376, -760}, { 488, 384, -760}, { 472, 376, -776}, { 464, 376, -776}, { 488, 392, -776}, { 464, 376, -760}, { 488, 384, -760}, { 472, 392, -776}, { 464, 384, -768}, { 472, 376, -768}, { 472, 384, -768}, { 464, 368, -776}, { 480, 384, -768}...
{ 480, 400, -768}, { 472, 384, -760}, { 480, 392, -760}, { 480, 384, -768}, { 472, 376, -768}, // 102 seconds { 496, 384, -760}, { 472, 376, -776}, { 456, 432, -744}, { 496, 336, -784}, { 456, 368, -760}, { 472, 376, -736}, { 488, 416, -776}, { 472, 384, -752}, ...
/////////////////////////// #include "test_graphics.h" #include "../graphics/util.h" #if (SCREEN_COLOR_DEPTH_BITS == 1) #include "1bit/test_framebuffer.h" #elif (SCREEN_COLOR_DEPTH_BITS == 8) #include "8bit/test_framebuffer.h" #else #error "Unrecognized SCREEN_COLOR_DEPTH_BITS" #endif // Stubs /////////////////////...
gbitmap_create_from_png_data(png_data, file_size)
; if (result) { free(png_data); } } cleanup: fclose(fp); return result; } static GBitmap *prv_create_bitmap_from_pbi_file(const char *pbi_filename_without_extension) { // Create a static GBitmap to avoid modifying the read_pbi() function to return a GBitmap static GBitmap result; char pb...
escription descriptions[] = { // this first set of files match some I found on my snowy bb2 {"gap_bonding_db", 8102}, {"pmap", 5632}, {"pindb", 57095}, {"appdb", 32603}, {"reminderdb", 57090}, {"appcache", 8108}, {"alarms", 8110}, {"notifpref", 8107}, {"activity", 24436}, {"insights", 8108}, {"s...
(descriptions[i].name)
; } }
up_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet); graphics_draw_rotated_bitmap(&ctx, test_image_color, GPoint(30, 30), DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_set_ce...
test_graphics_context_init(ctx, fb)
; framebuffer_clear(fb); GBitmap *test_image = get_gbitmap_from_pbi("stamp.Xbit.pbi"); cl_assert(test_image != NULL); // PBL-24705 grect_center_point is off by 1 GPoint center = GPoint(DISP_COLS / 2 - 1, DISP_ROWS / 2 - 1); // No Clip, Angle 0 setup_test_rotate_bitmap(ctx, fb, ORIGIN_RECT_NO_CLIP, ORIG...
/* * 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(task == PebbleTask_Worker); return worker_manager_get_task_context(); }
} // ------------------------------------------------------------------------------------------- static ProcessContext *prv_get_context(void) { return prv_get_context_for_task(pebble_task_get_current()); } // -------------------------------------------------------------------------------------------------- // Th...
add_units, zero_pad, modulus); #endif break; case 'H': // hour prv_do_conversion(state, value, SECONDS_PER_HOUR, HOURS_PER_DAY, s_hour_strings, add_units, zero_pad, modulus); break; case 'M': // minute prv_do_conversion(state, value, SECONDS_PER_MINUTE, MINUTES_PE...
{ state->position++; }
return match; } static void prv_format_process_format_string(TemplateStringState *state, char delimiter) { // Predicate matched (or is default case), so let's parse the string. while ((*state->position != delimiter) && (*state->position != '\0')) { if (*state->position != '%') { // Not a format character ...
= { { malformatted_artist, sizeof(malformatted_artist) }, { malformatted_album, sizeof(malformatted_album) }, { malformatted_title, sizeof(malformatted_title) }, { malformatted_player, sizeof(malformatted_player) } }; for (int i = 0; i < ARRAY_LENGTH(test_vectors); ++i) { prv_receive_pp_data(te...
cl_assert_equal_b(music_get_player_name(NULL), false)
; }
ng16_list; pstring_project_list_on_serialized_array(&pstring16_list, &entry->pstring16s); PascalString16 *location_pstring = pstring_get_pstring16_from_list(&pstring16_list, WeatherDbStringIndex_LocationName); PascalString16 *phrase_pstring = pstring_get_pstring16_from_list(&pstring16_list, WeatherDb...
{ watch_app_prefs_destroy_weather(prefs); return false; }
const size_t default_location_index = 0; *key_out = prefs->locations[default_location_index]; watch_app_prefs_destroy_weather(prefs); return true; } static void prv_update_default_location_cache(void) { mutex_lock(s_mutex); weather_service_destroy_default_forecast(s_default_forecast); s_default_foreca...
tributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "services/normal/notifications/alerts.h" #include "services/normal/notifications/alerts_private...
(AlertMaskAllOn)
; cl_assert(alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_vibrate_for_type(AlertMobile)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile)); cl_assert(ale...
lude "graphics_common_stubs.h" #include "stubs_applib_resource.h" static FrameBuffer *fb = NULL; // Setup void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); } // Teardown void test_graphics_draw_round_r...
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.dest_bitmap, "draw_round_rect_across_nx_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_y_layer_update_callback)...
/* * 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 (md != NULL) { return &md->uuid; } else { return NULL; }
} AnalyticsHeartbeat *analytics_storage_find(AnalyticsMetric metric, const Uuid *uuid, AnalyticsClient client) { PBL_ASSERTN(analytics_storage_has_lock()); switch (analytics_metric_kind(metric)) { case ANALYTICS_METRIC_KIND_DEVICE: PBL_ASSERTN(client == Analytics...
nterrupt_handler(ACCESSORY_UART, prv_tx_irq_handler); uart_set_baud_rate(ACCESSORY_UART, s_baudrate); uart_set_rx_interrupt_enabled(ACCESSORY_UART, true); } static void prv_initialize_hardware(void) { periph_config_acquire_lock(); gpio_output_init(&BOARD_CONFIG_ACCESSORY.power_en, GPIO_OType_PP, GPIO_Speed_2M...
{ if (!s_has_sent_byte) { // we haven't sent a byte in the last timeout period, so time out the whole send s_stream_cb = NULL; s_stream_context = NULL; success = false; PBL_LOG(LOG_LEVEL_ERROR, "Timed-out while sending"); break; } s_has_sent_byte = false; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_expected_attributes, s_expected_actions)
); s_performed_store = true; return S_SUCCESS; } static uint32_t s_expected_uid = 0; static bool s_performed_dismiss = false; void ancs_perform_action(uint32_t notification_uid, uint8_t action_id) { cl_assert_equal_i(notification_uid, s_expected_uid); cl_assert_equal_i(action_id, ActionIDNegative); s_perf...
ilingEllipsis, .text_alignment = GTextAlignmentCenter, .font = fonts_get_system_font(font_key), }; } static int prv_height(void) { const PlatformType platform = process_manager_current_platform(); return _STATUS_BAR_LAYER_HEIGHT(platform); } // Function prototypes static void prv_status_bar_layer_update...
(status_bar_layer->config.foreground_color, foreground)
) { return; } status_bar_layer->config.background_color = background; status_bar_layer->config.foreground_color = foreground; layer_mark_dirty(&(status_bar_layer->layer)); } GColor status_bar_layer_get_background_color(const StatusBarLayer *status_bar_layer) { PBL_ASSERTN(status_bar_layer); return sta...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(structured_glance)
; return NULL_SAFE_FIELD_ACCESS(settings_glance, icon, NULL); } static const char *prv_get_title(LauncherAppGlanceStructured *structured_glance) { LauncherAppGlanceSettings *settings_glance = launcher_app_glance_structured_get_data(structured_glance); return NULL_SAFE_FIELD_ACCESS(settings_glance, title, N...
transition_state(r, RecognizerState_Updated)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Cancelled)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Completed)); r->state = RecognizerState_Updated; recognizer_transition_state(r, RecognizerState_Cancelled); cl_assert_e...
recognizer_reset(r)
"Trying to set local address: allow_cycling=%d, pinned_address="BT_DEVICE_ADDRESS_FMT, s_local_addr_desired_policy.allow_cycling, BT_DEVICE_ADDRESS_XPLODE(s_local_addr_desired_policy.pinned_address)); // Note: the pinned address is actually resolvable, but we need to lie to the SDK her...
if (s_local_addr_state == LocalAddressState_AwaitingAdvertisementsPaused) { PBL_LOG(LOG_LEVEL_DEBUG, "Adverts paused, trying to update own address"); prv_try_updating_own_address(); }
layer, &bmp_frame); bitmap_layer_set_bitmap(&data->bmp_layer, bmp); bitmap_layer_set_compositing_mode(&data->bmp_layer, GCompOpAssign); layer_add_child(window_layer, bitmap_layer_get_layer(&data->bmp_layer)); GRect title_text_frame = (GRect) { .size = title_text_size }; const int16_t title_text_internal_padd...
("On", data)
: i18n_get("Off", data); break; case SystemMenuItemShutDown: if (!prv_shutdown_enabled()) { // XXX: For now, gray out the Shut Down item if unusable. graphics_context_set_text_color(ctx, GColorDarkGray); } break; case SystemMenuItemInformation: case SystemMenuItemCer...
ars for elections if (tz_info->dst_id == DSTID_BRAZIL && (((TM_YEAR_ORIGIN + year) % 3) == 2) && is_end) { time_tm.tm_mday += DAYS_PER_WEEK; } time_t uxtime = mktime(&time_tm); gmtime_r(&uxtime, &time_tm); for (int i = 0; i < DAYS_PER_WEEK; i++) { // max is DAYS_PER_WEEK to find a day_of_week // we a...
{ int region_id = -1; if (tz_data->region_name_len) { region_id = timezone_database_find_region_by_name(tz_data->region_name, tz_data->region_name_len); } if (region_id != -1) { // We have a valid region! TimezoneInfo tz_info; prv_clock_get...
// This routine is solely responsible for setting the time and/or timezone for // the system RTC. After the time is changed, it generates an event for // consumers interested in time changes T_STATIC void prv_update_time_info_and_generate_event(time_t *t, TimezoneInfo *tz_info) { int orig_gmt_offset = time_get_gmto...
enter_standby(RebootReasonCode_MfgShutdown); } void command_color_read(void) { char buffer[10]; prompt_send_response_fmt(buffer, sizeof(buffer), "%d", mfg_info_get_watch_color()); } void command_color_write(const char* color_num) { char *end; int color = strtol(color_num, &end, 10); if (*end) { prompt_...
("STAGE 1 -- Copying STAGE 2 to scratch")
; prv_bootloader_test_copy(FLASH_REGION_FIRMWARE_SCRATCH_BEGIN, FLASH_REGION_FIRMWARE_SCRATCH_END); BLTEST_LOG("STAGE 1 -- Marking new FW boot bit"); boot_bit_set(BOOT_BIT_NEW_FW_AVAILABLE); } else { BLTEST_LOG("STAGE 1 -- Copying STAGE 2 to PRF"); flash_prf_set_prote...
/* * 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(APP_LOG_LEVEL_ERROR, "Timer %u does not exist", (unsigned)timer); return; }
if (!evented_timer_is_current_task((EventedTimerID)timer)) { APP_LOG(APP_LOG_LEVEL_ERROR, "Invalid timer %u used in app_timer_reschedule", (unsigned)timer); syscall_failed(); } } evented_timer_cancel((EventedTimerID)timer); } DEFINE_SYSCALL(void *, app_timer_get_data, AppTimer *timer) { if (...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_handle_shutdown(request)
er translated to the destination bitmap // address - so do all calculations so everything is offset from 0 uint32_t * base_addr = 0; #else uint32_t * base_addr = ((uint32_t*)dest_bitmap->addr); #endif const uint32_t * const dest_block_x_begin = base_addr + (left_cl...
{ const int left_clip_shift = left_clip % 32; const int clipped_blocks = left_clip / 32; dest_shift = (dest_shift + left_clip_shift) % 32; glyph_block_bits_left -= left_clip_shift; glyph_block += clipped_blocks; if (glyph_block_bits_left <= 0) { src = *(++glyph_block); ...
while (dest_block != dest_block_end && glyph_line_bits_left) { PBL_ASSERT(dest_block < dest_block_end, "DB=<%p> DBE=<%p>", dest_block, dest_block_end); PBL_ASSERTN(dest_block >= (uint32_t*) base_addr); PBL_ASSERTN(dest_block < (uint32_t*) base_addr + row_size_bytes * (dest_bitm...
r, NULL, s_spi_transport.bytes_sendable_count, prv_handle_sending_complete_isr); } static void prv_handle_circular_buffer_write_complete(void) { prv_lock(); circular_buffer_write_finish(&s_spi_transport.rx, s_spi_transport.bytes_receivable_count);...
if (s_spi_transport.bytes_sendable_count) { prv_watchdog_start(); s_spi_transport.state = SPITransportState_WaitingForSending; } else { // Nothing to send nor receive, back to idle: s_spi_transport.state = SPITransportState_Idle; }
} static void prv_update_local_status_msg(void) { prv_lock(); circular_buffer_read(&s_spi_transport.tx, s_spi_transport.tx.data_length, &s_spi_transport.tx_read_ptr, &s_spi_transport.status_local->bytes_sendable_count); s_spi_transport.status_local->bytes_receivable...
ngs/settings_file.h" #include "shell/prefs.h" #include "shell/prefs_private.h" static PebbleMutex *s_mutex; #define PREF_KEY_CLOCK_24H "clock24h" static bool s_is_24h_style; #define PREF_KEY_DEFAULT_WATCHFACE "watchface" static Uuid s_default_watchface = UUID_INVALID_INIT; #define PREF_KEY_CONTENT_SIZE "contentSize...
app_install_get_entry_for_install_id(app_id, &entry)
e now subscribed with no end in sight workout_service_frontend_opened(); cl_assert_equal_b(s_hrm_subscribed, true); cl_assert_equal_i(s_hrm_expiration, 0); prv_inc_time(1 * SECONDS_PER_MINUTE); cl_assert(workout_service_start_workout(ActivitySessionType_Run)); // Workout of 30 seconds duration. Should be i...
(hr_zone_time_s[HRZone_Zone3], 0)
; prv_inc_time(10); prv_put_bpm_event(ZONE_3_HR, HRMQuality_Good); cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s)); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 0); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 10); 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...
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...
GSize(text_layer.layer.frame.size.w, TEXT_LAYER_FLOW_DEFAULT_PAGING_HEIGHT)
); } void test_text_layer_flow__paging_container(void) { Layer container; layer_init(&container, &GRect(30, 40, 100, 10)); layer_add_child(&window.layer, &container); layer_add_child(&container, &text_layer.layer); GPoint origin; GRect page; scroll_layer_is_instance_value = NULL; cl_assert(true == tex...
tationary); case TimelineAppStateShowDaySeparator: return (next_state == TimelineAppStateDaySeparator); case TimelineAppStateDaySeparator: return (next_state == TimelineAppStateHideDaySeparator); case TimelineAppStateHideDaySeparator: return (next_state == TimelineAppStateStationary); ...
timeline_layer_get_layout_frame(&data->timeline_layer, TIMELINE_LAYER_FIRST_VISIBLE_LAYOUT, &frame)
; timeline_layout_get_icon_frame(&frame, data->timeline_layer.scroll_direction, &icon_frame); } else { // Since there is no pin, we need the peek size, which is the large size icon_frame = (GRect) { .size = TIMELINE_LARGE_RESOURCE_SIZE }; grect_align(&icon_frame, &data->peek_layer.layer.frame, GAlignC...
; cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[3].header.id)); #if CAPABILITY_HAS_CORE_NAVIGATION4 cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[2].header.id)); #endif cl_assert(!iter_prev(&iterator)); } static int prv_num_items(Iterator iterator) { i...
(&state.pin.header.id, &s_all_day_items[1].header.id)
|| uuid_equal(&state.pin.header.id, &s_all_day_items[2].header.id)); cl_assert(!uuid_equal(&first_all_day_event, &state.pin.header.id)); cl_assert(state.node->all_day); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check second cl_assert(iter_n...
mm(void) { return 1900; } uint8_t activity_prefs_heart_get_elevated_hr(void) { return 100; } uint8_t activity_prefs_heart_get_zone1_threshold(void) { return 130; } uint8_t activity_prefs_heart_get_zone2_threshold(void) { return 154; } uint8_t activity_prefs_heart_get_zone3_threshold(void) { return 172; } ...
{ cl_assert(workout_service_start_workout(ActivitySessionType_Run)); int32_t steps, duration_s, distance_m, bpm; HRZone hr_zone; cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(steps...
cl_assert_equal_i(6800, s_total_step_count); cl_assert_equal_i(distance_m, 2402 /* 2.4km in 10 mins is reasonable */); cl_assert_equal_i(duration_s, 10 * SECONDS_PER_MINUTE); // Get some more HR info prv_inc_time(10); prv_put_bpm_event(180, HRMQuality_Good); cl_assert(workout_service_get_current_workout...
_next_frame(GDrawCommandFrame *frame) { // Iterate to the end of the command list (next frame starts immediately afterwards) return gdraw_command_list_iterate_private(&frame->command_list, NULL, NULL); } GDrawCommandSequence *gdraw_command_sequence_create_with_resource(uint32_t resource_id) { ResAppNum app_num =...
for (uint32_t i = 0; i < index; i++) { frame = prv_next_frame(frame); }
length_ptr = data + offsetof(TimezoneCBData, region_name_len); if (length != (sizeof(uint8_t) + header_size + *timezone_length_ptr)) { PBL_LOG(LOG_LEVEL_WARNING, "Set timezone message invalid length"); return; } TimezoneCBData *timezone_data = (TimezoneCBData *)data; prv_handle_...
if (time_util_get_midnight_of(timestamp) == today) { i18n_get_with_buffer("Today", buffer, buffer_size); } else { i18n_get_with_buffer("All day", buffer, buffer_size); }
} static void prv_copy_relative_time_string(char *number_buffer, uint8_t number_buffer_size, char *word_buffer, uint8_t word_buffer_size, time_t timestamp, time_t end_time) { time_t now = rtc_get_time(); // average without overflows since time_t might be signed and now ~1.4 billion, so 2*now > INT_MAX time_...
/* * 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...
backlight_set_timeout_ms(s_timeout_values[selection])
; app_window_stack_remove(&option_menu->window, true /* animated */); } static void prv_timeout_menu_push(SettingsDisplayData *data) { int index = prv_timeout_get_selection_index(); const OptionMenuCallbacks callbacks = { .select = prv_timeout_menu_select, }; const char *title = PBL_IF_RECT_ELSE(i18n_noo...
/* * 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 (AnalyticsStopwatchNode *)list_find( s_stopwatch_list, prv_compare_stopwatch, (void *)(uintptr_t)metric); }
static void prv_add_stopwatch(DialogAnalyticsMetric metric, uint32_t count_per_sec) { AnalyticsStopwatchNode *stopwatch = kernel_malloc_check(sizeof(AnalyticsStopwatchNode)); *stopwatch = (AnalyticsStopwatchNode) { .metric = metric, .count_per_sec = count_per_sec, .starting_ticks = rtc_get(), }; s...
ion 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS...
smartstrap_send(SmartstrapProfileGenericService, &send_header_mbuf, s_read_header_mbuf, timeout_ms)
; if (result != SmartstrapResultOk) { mbuf_free(s_read_header_mbuf); s_read_header_mbuf = NULL; } mutex_unlock(s_read_lock); return result; } static void prv_send_service_discovery(void *context) { const uint16_t service_id = ReservedServiceManagement; const uint16_t attribute_id = ManagementServic...
tion_by_handle(NULL, animation_h, false /*quiet*/); if (!animation) { return 0; } return animation->abs_start_time_ms; } // ------------------------------------------------------------------------------------------- bool animation_set_duration(Animation *animation_h, uint32_t duration_ms) { AnimationState...
if (!prv_is_mutable(state, animation)) { return false; }
animation->custom_function = function; if (function) { animation->curve = curve; } else { animation->curve = AnimationCurveDefault; } return true; } // ------------------------------------------------------------------------------------------- bool animation_set_custom_curve(Animation *animation_h,...
ate; BtConsumer responsible_consumer; #ifdef RECOVERY_FW // We don't care if we burn up some power from PRF and we want FW to update quickly secs_til_max_latency = MAX_PERIOD_RUN_FOREVER; state = ResponseTimeMin; responsible_consumer = 0; #else state = prv_determine_latency_for_connection(hdl->conn_mgr_info...
PBL_LOG(LOG_LEVEL_ERROR, "GAP Handle not properly intialized")
; return; } bt_lock(); // remove the watchdog timer if it was already scheduled since we are // going to recompute RegularTimerInfo *watchdog_cb_info = &hdl->conn_mgr_info->watchdog_cb_info; if (regular_timer_is_scheduled(watchdog_cb_info)) { regular_timer_remove_callback(watchdog_cb_info); } ...
4, 16}, { 0, 0x64, 0}, { 0, 0x54, 13}, { 0, 0x44, 0}, // 105: Local time: 12:00:00 AM { 0, 0x44, 0}, { 0, 0x44, 0}, { 0, 0x44, 8}, { 0, 0x44, 0}, { 0, 0x44, 0}, { 0, 0x44, 0}, { 0, 0x44, 0}, { 0, 0x44, 0}, { 0, 0x44, 0}, { 0, 0x44, 0}, { 0, 0x44, 6}, { 0, ...
// 255: Local time: 02:30:00 AM { 0, 0x65, 0}, { 0, 0x65, 0}, { 0, 0x65, 0}, { 0, 0x65, 0}, { 0, 0x65, 0}, { 0, 0x65, 0}, { 0, 0x65, 0}, { 0, 0x65, 0}, { 0, 0x65, 0}, { 0, 0x55, 18}, { 0, 0x15, 0}, { 0, 0x15, 0}, { 0, 0x15, 0}, { 0, 0x15, 0}, { 0, 0x15, 5}...
&state.node->id, &all_day_item.header.id)); cl_assert(!state.node->all_day); cl_assert_equal_i(state.node->timestamp, midnight_march_3_utc + SECONDS_PER_DAY); cl_assert_equal_i(state.node->duration, 0); cl_assert_equal_i(state.current_day, midnight_march_2_pst + SECONDS_PER_DAY); // no more cl_assert(!iter...
cl_assert_equal_i(state.node->timestamp, midnight_march_2_pst + SECONDS_PER_DAY); cl_assert_equal_i(state.node->duration, MINUTES_PER_DAY); cl_assert_equal_i(state.current_day, midnight_march_2_pst + SECONDS_PER_DAY); // no more cl_assert(!iter_next(&iterator)); // 4 deletes cl_assert(timeline_iter_remo...
void test_timeline__all_day_ios_bug(void) { TimelineItem item = { .header = { .id = {0x29, 0xac, 0xd8, 0xb5, 0x9, 0xc7, 0x4c, 0x31, 0xbf, 0x6f, 0x3, 0x64, 0xd0, 0x5b, 0x9b, 0xc2}, .parent_id = {0}, .timestamp = 1430236800, // 9am Apr 28, 2015 PDT .duration = MINUTES_PE...
*/); resource_init(); ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); content_indicator_init_buffer(buffer); } void test_timeline_layouts__cleanup(void) { free(fb); } // Helpers ////////////////////// void prv_handle_down_click(ClickRecognizerRef recognizer, void *context); stati...
(&config, 0)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE_X(peek))); prv_construct_and_render_layout(&config, 1); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE_X(details1))); // Round needs to scroll down one more time to see everything #if PBL_ROUND prv_construct_and_render_layout(&config, 2)...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_missing_last_attribute, sizeof(s_missing_last_attribute), &error)
mation_set_play_count(item_animation->animation, PLAY_COUNT_INFINITE); animation_set_delay(item_animation->animation, DELAY_PER_LINE /* ms */); animation_schedule(item_animation->animation); } *draw_top_shading = (item_animation->current_offset_y != item_animation->bottom_offset_y); *draw_bottom...
(*content_box, GEdgeInsets(0, horizontal_inset))
; // Use a smaller font for the unfocused cells to achieve a fish-eye effect const GFont font = selected ? aml->layout_cache.font : prv_get_unfocused_item_font(); const GTextOverflowMode overflow_mode = selected ? GTextOverflowModeWordWrap : GTextOverflowModeT...
lipping.h" #include "applib/app.h" #include "applib/fonts/fonts.h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "process_management/app_manager.h" #include "process_state/app_state/app_state.h" #include "system/logging.h" typedef enum { SelectIndexPixels, SelectIndexDirection, SelectIndexOv...
(&data->text_layer, GTextOverflowModeTrailingEllipsis)
; } } static void config_provider(Window *window) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, (ClickHandler)click_handler); window_single_repeating_click_subscribe(BUTTON_ID_SELECT, 100, (ClickHandler)click_handler); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, (ClickHandler)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...
{ GFont res = fonts_load_custom_font_system(sys_get_current_resource_num(), (uint32_t)handle); if (res == NULL) { PBL_LOG(LOG_LEVEL_WARNING, "Getting fallback font instead"); res = sys_font_get_system_font("RESOURCE_ID_GOTHIC_14"); } return res; }
GFont fonts_load_custom_font_system(ResAppNum app_num, uint32_t resource_id) { if (resource_id == 0) { PBL_LOG(LOG_LEVEL_ERROR, "Tried to load a font from a NULL resource"); return NULL; } FontInfo *font_info = applib_type_malloc(FontInfo); if (font_info == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "Could...
does not enforce this. However, Sriram Hariharan of Apple confirmed we // do not need to do this with Apple devices: "As long as your stack ensures that connection // update requests are sent only after the previous request is completed, you can ignore the // 30 second Tgap timeout." const GAPLEConnectRequest...
{ const ResponseTimeState desired_state = conn_mgr_get_latency_for_le_connection(connection, NULL); prv_evaluate(connection, desired_state); }
// ------------------------------------------------------------------------------------------------- //! Extern'd for and used by gap_le_connect.c //! Handles Bluetopia's Connection Parameter Updated event. //! This event is sent by our BT controller when the updated parameters have actually been applied //! and take...
/* * 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...
storage_acquire()
; bd_address_t addr; dialog_utils_bt_device_to_bd_address(&bonding->pairing_info.identity, &addr); device_t *dev = find_device_by_addr(&addr, false /* create */); if (dev) { conn_idx = dev->conn_idx; device_remove_pairing(dev); } storage_release(); // set is_gateway to false within the Connection...
/* * 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 0; }
void sys_timeline_resources_get_id(const TimelineResourceInfo *timeline_res, TimelineResourceSize size, AppResourceInfo *res_info) { if (!res_info) { return; } // Just fill the output resource ID with some number so it's considered "valid" res_info->res_id = s_test_state...
/* * 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)
; dbgserial_print("*** WTF "); dbgserial_print_hex(saved_lr); dbgserial_putstr(""); reset_due_to_software_failure(); } //! Assert function called by the STM peripheral library's //! 'assert_param' method. See stm32f2xx_conf.h for more information. void assert_failed(uint8_t* file, uint32_t line) { register u...
alog_spi_receive_data_no_wait(buffer, sizeof(buffer)); if (memcmp(buffer, core_dump_connect_response, sizeof(core_dump_connect_response)) == 0) { PBL_LOG(LOG_LEVEL_INFO, "Core Dump connect response received"); return true; } } PBL_LOG(LOG_LEVEL_ERROR, "Failed to connect with BLE chip to collect ...
PBL_LOG(LOG_LEVEL_ERROR, "Can't reserve slot for BLE core dump")
; goto powerdown; } uint32_t flash_addr_max = flash_addr + max_size; PBL_LOG(LOG_LEVEL_DEBUG, "Using flash slot %lx %lx", flash_addr, flash_addr_max); // Read every region from the region table in blocks of 16k. cmd.cmd = CoreDumpCmd_ReadMemory; for (int region = 0; region < MemoryRegionTagCount; ++reg...
const BTDeviceAddress *pinned_address) { s_last_driver_allow_cycling = allow_cycling; if (pinned_address) { s_last_driver_addr_is_null = false; s_last_driver_addr = *pinned_address; } else { s_last_driver_addr_is_null = true; memset(&s_last_driver_addr, 0x00, sizeof(s_last_driver_add...
cl_will_return(bt_driver_set_local_address, 0)
; bt_local_addr_pause_cycling(); cl_assert_equal_b(false, s_last_driver_allow_cycling); // Check that it's using the pinned address that was generated upon initialization: prv_assert_driver_addr_is_addr1(); bt_local_addr_pause_cycling(); // Already paused, shouldn't result in a bt_driver_set_local_address(...
vice->add_subscriber_callback(subscription->task); } service->subscribers[subscription->task] = subscription->event_queue; ++service->num_subscribers; } void event_service_subscribe_from_kernel_main(PebbleSubscriptionEvent *subscription) { PBL_ASSERT_TASK(PebbleTask_KernelMain); prv_event_service_subscribe(...
{ if (!prv_event_service_send_event(service->subscribers[i], e)) { PBL_LOG(LOG_LEVEL_INFO, "Queue full! %d not delivered to task %d!", (int)e->type, (int)i); #if !RELEASE // For 3rd party apps, just close them. For a 1st party app or other task, reboot // the watc...
} } if (!prv_task_is_masked_out(e, cur_task) && service->subscribers[cur_task]) { // we are on the current task, so we just tell the client to handle it inline event_service_client_handle_event(e); } if (stolen) { // we stole the buffer from the event, NULL it out *buf_ptr = NULL; } } ...
(); animation_schedule(clone); // Start A prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, NULL), 0); // Execute to the start of B and C prv_advance_to_ms_wi...
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a3), 1)
; // None of the b's should finish yet cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b0), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b1), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b2), 0); cl_assert_equal_i(prv_count_handl...
lse, &(GBoxModel){ .offset = { 0, 5 }, .margin = { 6, 0 }}, PBL_IF_ROUND_ELSE(-6, 0), true}, {"The Lord of the Rings", NULL, NULL, &s_tictoc_icon_bitmap, DEFAULT_ICON_ALIGN, true}, {"The Matrix", "Revolutions", NULL, &s_tictoc_icon_bitmap, DEFAULT_ICON_ALIGN, true}, }; // We render all of the row data's for each o...
(column_data->value_font)
: NULL, .title = row_data->title, .subtitle = row_data->subtitle, .value = row_data->value, .icon = row_data->icon, .icon_align = row_data->icon_align, .icon_box_model = row_data->icon_box_model, .icon_form_fit = row_data->icon_form_fit, .horizontal_inset = row_data->horizontal_inset, ...
/* * 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...
("secondchange")
); cl_assert_equal_b(false, rocky_global_has_event_handlers("minutechange")); cl_assert_equal_b(false, rocky_global_has_event_handlers("hourchange")); cl_assert_equal_b(true, rocky_global_has_event_handlers("daychange")); cl_assert_equal_i(1, s_tick_timer_service_subscribe.call_count); cl_assert_equal_i(DAY_U...
r(const char *name) { size_t length = strlen(name); // Blocked/unknown numbers on Android start with a '-' if ((name[0] == '-') || (length == 0)) { return false; } for (size_t i = 0; i < length; ++i) { unsigned char chr = name[i]; if ((chr != '(') && (chr != ')') && (chr != '+') && (chr != ' ') ...
alerts_should_enable_backlight_for_type(AlertPhoneCall)
) { light_enable_interaction(); } } static void prv_start_ringing(void) { alerts_incoming_alert_analytics(); s_phone_ui_data->ring_timer = (const RegularTimerInfo) { .cb = prv_ring, }; unsigned int vibe_repeat_interval_sec; #if CAPABILITY_HAS_VIBE_SCORES s_phone_ui_data->vibe_score = vibe_client_ge...
rage.fd); if (file_size == 0) { prv_release_session_file(session); return false; } // Add a minium buffer to needed. This gives us a little insurance and also allows for the // extra space needed for the chunk header byte that occurs at least once evvery // DLS_MAX_CHUNK_SIZE_BYTES bytes. space_nee...
prv_pfs_write(storage->fd, &data_hdr, sizeof(DLSChunkHeader))
) { return false; } // Bump pointer and count storage->write_offset += data_chunk_length + sizeof(DLSChunkHeader); storage->num_bytes += data_chunk_length; remaining_bytes -= data_chunk_length; data_ptr += data_chunk_length; } return true; } // -------------------------------------...
{ 72, 760, 72}, // 169 seconds { 0, 864, 88}, { 16, 960, 8}, { 40, 864, 72}, { 48, 1032, 144}, { 120, 984, 32}, { 120, 800, -56}, { 160, 736, -344}, { 88, 880, -216}, { 112, 976, -256}, { 256, 768, -384}, { 192, 784, -360}, { 120, 792, -288}, { 128, 816, -304}, ...
{ 8, 912, 312}, { 8, 912, 336}, { 32, 864, 368}, { 40, 896, 312}, { 24, 848, 352}, { 40, 896, 312}, // 175 seconds { 0, 888, 392}, { 16, 696, 312}, { 32, 936, 400}, { 16, 872, 400}, { 48, 832, 408}, { 72, 984, 352}, { -16, 704, 352}, { 64, 904, 368}, { 32,...
{ 40, 816, 264}, { 56, 920, 208}, { 40, 872, 288}, { 48, 952, 296}, { 48, 872, 216}, { 64, 888, 264}, { 16, 896, 328}, { 16, 840, 304}, // 178 seconds { 40, 904, 232}, { 40, 864, 288}, { 8, 896, 296}, { 64, 896, 240}, { 24, 848, 272}, { 48, 872, 264}, { 8...
amin_progress = 0; selection_layer->selected_cell_idx++; } static void prv_slide_settle_impl(struct Animation *animation, const AnimationProgress distance_normalized) { SelectionLayer *selection_layer = (SelectionLayer*) animation_get_context(animation); // Update the completio...
(selection_layer->callback_context)
const size_t buffer_size = sizeof("00:00:00"); GTextNodeText *number_text_node = health_util_create_text_node(buffer_size, number_font, TEXT_COLOR, container); active_window->workout_controller->metric_to_string(metric_type, (...
(action_bar, active_window->pause_button, active_window->action_bar_pause)
; } if (active_window->num_scrollable_metrics > 1) { action_bar_layer_set_icon(action_bar, BUTTON_ID_DOWN, active_window->action_bar_next); } } static void prv_update_ui(WorkoutActiveWindow *active_window) { if (window_manager_is_window_visible(&active_window->window)) { layer_mark_dirty(&active_windo...
-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_equal_b(false, app_install_id_from_system(1)); cl_assert_equal_b(false, app_install_id_from_system(1000000)); } void test_app_install_manager__is_from_app_db(void) { cl_asse...
(sports_id, true /* can_expire */)
; cl_assert(false == app_install_entry_is_hidden(&entry)); } // wait 10 minutes and ensure hidden fake_rtc_init(0, INIT_TIME + (10 * SECONDS_PER_MINUTE)); cl_assert(true == app_install_entry_is_hidden(&entry)); } void test_app_install_manager__recently_communicated(void) { static const uint32_t INIT_TIM...
/* * 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...
{ uint32_t seed; if (!rng_rand(&seed)) { // Fallback, time XOR'd with an approximation of the current stack pointer: seed = rtc_get_time() ^ (uintptr_t) &seed; } srand(seed); }
uffer_size, void *i18n_owner, void *unused) { SportsAppData *data = app_state_get_user_data(); switch (type) { case WorkoutMetricType_Hr: { snprintf(buffer, buffer_size, "%d", data->current_bpm); break; } case WorkoutMetricType_Speed: case WorkoutMet...
health_service_set_heart_rate_sample_period(1 /* interval_s */)
; health_service_events_subscribe(prv_health_service_event_handler, data); activity_algorithm_enable_activity_tracking(false /* disable */); } static void prv_deinit(void) { SportsAppData *data = app_state_get_user_data(); health_service_set_heart_rate_sample_period(0 /* interval_s */); app_sync_deinit(&dat...
ile); } // The overwrite completed, we just rebooted before getting a chance // to flip the completion bit on the previous record. Flip it now so // that we don't have to keep checking on every boot. settings_raw_iter_set_current_record_pos(&file->iter, parti...
(&new_hdr, 0xff, sizeof(new_hdr))
; new_hdr.last_modified = utc_time(); new_hdr.key_hash = crc8_calculate_bytes(key, key_len, true /* big_endian */); new_hdr.key_len = key_len; new_hdr.val_len = val_len; settings_raw_iter_write_header(&file->iter, &new_hdr); settings_raw_iter_write_key(&file->iter, key); settings_raw_iter_write_val(&file...
/* * 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, "Long Click!")
; text_layer_set_text(&data->text, data->text_buffer); toggle_color(window); (void)recognizer; } static void select_long_click_release_handler(ClickRecognizerRef recognizer, Window *window) { ClickAppData *data = window_get_user_data(window); sniprintf(data->text_buffer, TEXT_BUFFER_SIZE, "Long Click Release...
_events; resp->current_supervision_timeout_10ms = params.supervision_timeout_10ms; return sizeof(PebblePairingServiceConnParamsReadNotif); } static void prv_handle_trigger_pairing(uint16_t conn_idx, const PairingTriggerRequestData *req) { PBL_LOG(LOG_LEVEL_DEBUG, "Trigger pairing! should_pin_address=%d...
{ PBL_LOG(LOG_LEVEL_ERROR, "ble_gatts_read_cfm: %u", e); }
} static void prv_send_notification(uint16_t conn_idx, uint16_t value_handle) { uint8_t data[READ_RESPONSE_BUFFER_SIZE] = {}; size_t length = 0; if (!prv_get_value(conn_idx, value_handle, data, &length)) { PBL_LOG(LOG_LEVEL_ERROR, "Unexpected handle! %u", value_handle); return; } ble_error_t e = b...
_select_click_handler(ClickRecognizerRef recognizer, MenuLayer *menu_layer) { // If the selection animation is running, complete it. Note that 2.x apps don't have a selection // animation. if (menu_layer->animation.animation) { animation_set_elapsed(menu_layer->animation.animation, a...
{ if (menu_layer->callbacks.get_header_height) { return menu_layer->callbacks.get_header_height(menu_layer, section_index, menu_layer->callback_context); } else { return 0; // default } }
static inline int16_t prv_menu_layer_get_cell_height(MenuLayer *menu_layer, MenuIndex *cell_index, bool provide_correct_selection_index) { if (menu_layer->callbacks.get_cell_height) { const MenuIndex prev_selection_index = menu_layer->selection.index; if (!provide_correct_selection_index) { menu_l...
/* * 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 (pebble_task_get_current() == PebbleTask_KernelMain); }
//! Return true if event could cause pop-up //! Used in getting started and during firmware update static bool launcher_is_popup_event(PebbleEvent* e) { switch (e->type) { case PEBBLE_SYS_NOTIFICATION_EVENT: case PEBBLE_ALARM_CLOCK_EVENT: case PEBBLE_BATTERY_CONNECTION_EVENT: case PEBBLE_BATTERY_STA...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
getter(array, index)
/* * 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 ((*compositing_mode == GCompOpTint) || (*compositing_mode == GCompOpTintLuminance)) { // Force our interpretation of the tint color to be black, white, or clear tint_color = gcolor_get_bw(tint_color); if (gcolor_equal(tint_color, GColorBlack)) { *compositing_mode = GCompOpAnd; } else if (gc...
void bitblt_bitmap_into_bitmap_tiled_1bit_to_1bit(GBitmap* dest_bitmap, const GBitmap* src_bitmap, GRect dest_rect, GPoint src_origin_offset, GCompOp compositing_mode, ...
yout_layer.h" #include "stubs_logging.h" #include "stubs_modal_manager.h" #include "stubs_mutex.h" #include "stubs_notification_storage.h" #include "stubs_notifications.h" #include "stubs_passert.h" #include "stubs_phone_call_util.h" #include "stubs_prompt.h" #include "stubs_rand_ptr.h" #include "stubs_regular_timer.h"...
rtc_set_time(0)
; fake_event_init(); pin_db_init(); } void test_calendar__cleanup(void) { timeline_event_deinit(); stub_new_timer_cleanup(); fake_settings_file_reset(); } // Tests //////////////////////////////////////////////////////////////// void test_calendar__no_events(void) { timeline_event_init(); cl_assert_equ...
con attribute item->attr_list.attributes[attr_idx].id = AttributeIdIconTiny; item->attr_list.attributes[attr_idx].uint32 = app_metadata->icon_id; attr_idx++; #if PBL_COLOR if (app_metadata->app_color != 0) { item->attr_list.attributes[attr_idx].id = AttributeIdBgColor; item->attr_list.attributes[attr_i...
{ negative_action = NULL; }
// See if we support any additional actions (beyond what ANCS supports) for this type of notif if (app_id && app_id->length == 0) { app_id = NULL; } // At this point we know that the attributes we have extracted are valid and the sizes thereof // can be trusted (no error from ancs_util_attr_ptrs). If t...
a.link_key; } if (name_out) { strncpy(name_out, data.bt_classic_data.name, BT_DEVICE_NAME_BUFFER_SIZE); name_out[BT_DEVICE_NAME_BUFFER_SIZE - 1] = 0; } if (platform_bits_out) { *platform_bits_out = data.bt_classic_data.platform_bits; } return true; } BTBondingID bt_persistent_storage_get_bt_cl...
prv_file_get_bool(&IS_UNFAITHFUL_KEY, sizeof(IS_UNFAITHFUL_KEY), true /* default */)
; } void bt_persistent_storage_set_unfaithful(bool is_unfaithful) { PBL_LOG(LOG_LEVEL_INFO, "Marking the watch as %s", is_unfaithful ? "unfaithful" : "faithful"); prv_file_set(&IS_UNFAITHFUL_KEY, sizeof(IS_UNFAITHFUL_KEY), &is_unfaithful, sizeof(is_unfaithful)); } bool bt_persistent_storage_get_roo...
rue; } //! @param empty_all_data A bool that indicates if the session should be force emptied static void prv_send_all_sessions_system_task_cb(void *empty_all_data) { dls_list_for_each_session(prv_send_session, (void*) empty_all_data); } // --------------------------------------------------------------------------...
PBL_ASSERTN((uint32_t)read_bytes <= DLS_ENDPOINT_MAX_PAYLOAD)
; unsigned int leftover_bytes = read_bytes % logging_session->item_size; if (leftover_bytes) { PBL_LOG(LOG_LEVEL_ERROR, "leftover bytes in the session. Flushing..."); // remove the number of leftover bytes so we fall back on our feet read_bytes -= leftover_bytes; dls_storage_consume(logging_session...
.seconds_last_day = 33142 + utc_to_local_delta, .seconds_total_last_day = 33142 + utc_to_local_delta, })); } void test_health__range_to_day_id_rejects_invalid_values(void) { const time_t now = rtc_get_time(); bool result; // check that we *can* return success result = prv_calculate_time_range(now - 10,...
ARRAY_LENGTH(values)
, &range); cl_assert_equal_i(values[0], 4 * 1000 / 5); cl_assert_equal_i(values[1], 1000); cl_assert_equal_i(values[2], 1000 / 10); // ensure we don't calculate a single day multiple times values[0] = 1000; values[2] = 1000; range.num_days = 1; prv_adjust_value_boundaries(values, ARRAY_LENGTH(values), ...
{ left_margin = horizontal_margin; box.size.w -= config->icon->bounds.size.w; }
else { left_margin = !config->icon ? horizontal_margin : config->icon_form_fit ? (left_margin + config->icon->bounds.size.w + (config->icon_box_model ? config->icon_box_model->margin.w : 0)) : prv_title_subtitle_left_margin() + horizontal_margi...
animation_set_custom_function(Animation *animation_h, AnimationCurve curve, void *function) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); if (animation_private_using_legacy_2(state)) { if (curve != AnimationCurveCustomFunction) { // 2....
(state, animation_h, false /*quiet*/)
; if (!animation) { return false; } return animation->immutable; } // ------------------------------------------------------------------------------------------- bool animation_set_reverse(Animation *animation_h, bool reverse) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); if (an...
oolean(true), .expected_output = true, }, { .input = jerry_create_number(1.0), .expected_output = true, }, { .input = jerry_create_string((const jerry_char_t *)" "), .expected_output = true, }, { .input = jerry_create_array(0), .expected_output = true, ...
(-4, -2, 2, 4)
, }, { .argv = { [0] = jerry_create_number(-4096.0), [1] = jerry_create_number(-4096.0), [2] = jerry_create_number(4095.875), [3] = jerry_create_number(4095.875), }, .argc = 4, .expected_output = PP(-32768, -32768, 32767, 32767), }, { .argv =...
t_bitmap, "draw_round_rect_origin_r4_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 3); 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_sw3_clip...
(&ctx.dest_bitmap, "draw_round_rect_origin_r3_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should not d...
#if CAPABILITY_HAS_CORE_NAVIGATION4 cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[2].header.id)); cl_assert(iter_next(&iterator)); #endif cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[3].header.id)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_it...
cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[1].header.id) || uuid_equal(&state.pin.header.id, &s_all_day_items[2].header.id))
; cl_assert(state.node->all_day); // check that the item we see is timestamped at local midnight rather than utc midnight // 1421136000 is midnight Jan 13, PST cl_assert_equal_i(state.pin.header.timestamp, 1421136000); // second all day event cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.p...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
abs(p1.x - p0.x)
/* * 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...
(health_data)
; layer_set_frame(card_layer, &window_layer->bounds); layer_add_child(window_layer, card_layer); window_set_background_color(&window, health_hr_summary_card_get_bg_color(card_layer)); window_set_on_screen(&window, true, true); window_render(&window, &s_ctx); } // Tests ////////////////////// void test_healt...
Data *data, bool success) { size_t response_size = 0; uint16_t response_len_chars = 0; if (data->message) { // If an error occurred and the owner of the voice window did not specify a buffer, // data->message might be NULL response_size = strlen(data->message); utf8_t *cursor = (utf8_t *) data->me...
(GColorLightGray, GColorWhite)
; prv_init_dialog(data, dialog, text, resource_id, false, dialog_bg_color); expandable_dialog_set_header(long_error_dialog, header); expandable_dialog_push(long_error_dialog, prv_get_window_stack()); } static void prv_push_final_error_dialog(VoiceUiData *data) { prv_push_error_dialog(data, i18n_noop("Dictation...
/* * 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...
(RCC_FLAG_LSERDY)
== RESET) { PBL_LOG(LOG_LEVEL_ERROR, "LSE oscillator did not start"); } } } bool clocksource_is_lse_started(void) { return (RCC_GetFlagStatus(RCC_FLAG_LSERDY) != RESET); } void clocksource_MCO1_enable(bool on) { static int8_t s_refcount = 0; portENTER_CRITICAL(); PBL_ASSERTN(BOARD_CONFIG_MCO1.o...
/* * 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...
BETWEEN(h_range.size_w, (width - 1) * 2, (width + 1) * 2)
); } } #define cl_assert_equal_rangehorizontal(r1, r2) \ do { \ cl_assert_equal_i((r1).origin_x, (r2).origin_x); \ cl_assert_equal_i((r1).size_w, (r2).size_w); \ } while(0) void test_perimeter__perimeter_for_display_rect(void) { GPerimeter p = { .callback = perimeter_for_display_rect, }; const G...
rv_on_configure_nak_or_reject(PPPControlProtocol *this, struct LCPPacket *packet) { if (packet->identifier != this->state->last_configure_request_id) { // Invalid packet; silently discard return; } switch (this->state->link_state) { case LinkState_Closed: ...
prv_transition_to(this, LinkState_RequestSent)
; } else if (this->state->link_state == LinkState_Stopping) { prv_transition_to(this, LinkState_Closing); } mutex_unlock(this->state->lock); } void ppp_control_protocol_close(PPPControlProtocol *this, PPPCPCloseWait wait) { mutex_lock(this->state->lock); switch (this->stat...
792}, { -464, -192, -784}, { -472, -144, -832}, { -488, -184, -800}, { -536, -184, -848}, { -520, -192, -824}, { -544, -248, -864}, { -504, -232, -808}, { -600, -184, -776}, { -560, -176, -848}, { -472, -216, -760}, { -552, -216, -832}, { -472, -128, -784}, { -536, -1...
{ -408, -208, -816}, { -496, -216, -792}, { -608, -208, -864}, { -544, -88, -808}, { -480, -88, -832}, { -440, -176, -768}, { -424, -136, -776}, { -520, -136, -792}, { -552, -104, -864}, { -536, -88, -840}, { -552, -144, -872}, { -464, -184, -784}, { -400, -168, -720}...
{ -424, -208, -856}, { -400, -168, -856}, { -480, -136, -880}, { -464, -80, -912}, { -424, -120, -840}, { -464, -80, -856}, { -424, -128, -824}, { -392, -176, -864}, { -360, -192, -864}, { -448, -104, -872}, { -464, -192, -880}, { -504, -112, -912}, { -432, -176, -90...
atic uint32_t s_health_sessions_max; static ActivitySession *s_health_sessions; static time_t s_health_sessions_sleep_time; static time_t s_health_sessions_awake_time; static bool prv_activity_iterate_cb(HealthActivity activity, time_t time_start, time_t time_end, void *context) { ...
{ TimezoneInfo tz_info = { .tm_zone = "UTC", .tm_gmtoff = 0, }; time_util_update_timezone(&tz_info); struct tm time_tm = s_init_time_tm; time_t utc_sec = mktime(&time_tm); fake_rtc_init(100 /*initial_ticks*/, utc_sec); fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(false); ...
// --------------------------------------------------------------------------------------- void test_activity__cleanup(void) { activity_stop_tracking(); fake_system_task_callbacks_invoke_pending(); } // --------------------------------------------------------------------------------------- // Test that we corr...
igin_aa_r16_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r16_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&c...
layer_set_update_proc(&layer, &across_y_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_y_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.des...
return true; } static void prv_serial_dump_completed_callback(bool success) { prompt_command_finish(); } void command_log_dump_current(void) { flash_dump_log_file(0, prv_serial_dump_chunk_callback, prv_serial_dump_completed_callback); prompt_command_continues_after_returning(); } void command_log_dump_last(voi...
{ prompt_send_response("OK"); }
else { prompt_send_response("ERROR"); } } #ifndef RELEASE #include "system/profiler.h" void command_audit_delay_us(void) { profiler_init(); // don't let context switches skew our results __disable_irq(); char buf[80]; // test short delays because we should really be using psleep() for longer stalls...
_name, buffer_size, "UTC%+d%s", hour_offset, min_buf); } } else { strncpy(region_name, "---", buffer_size); } } int16_t clock_get_timezone_region_id(void) { return rtc_get_timezone_id(); } void clock_set_timezone_by_region_id(uint16_t region_id) { TimezoneInfo tz_info; prv_clock_get_timezone_info_fr...
{ switch (style) { case FullStyleLower12h: case FullStyleCapital12h: if (with_fulltime) { time_fmt = i18n_noop("%b %e, %l:%M %p"); } else { time_fmt = i18n_noop("%B %e"); } break; case FullStyleLower24h: case FullStyleCapital24h: if...
else { switch (style) { case FullStyleLower12h: case FullStyleCapital12h: if (with_fulltime) { time_fmt = i18n_noop("%a, %l:%M %p"); } else { time_fmt = i18n_noop("%A"); } break; case FullStyleLower24h: case FullStyleCapital24h: if...
(13 * SECONDS_PER_HOUR), // 1pm .length_min = 2 * MINUTES_PER_HOUR, .type = ActivitySessionType_Sleep, }, { .start_utc = start_of_today + (13 * SECONDS_PER_HOUR) + (15 * SECONDS_PER_MINUTE), // 1:15pm .length_min = 20, .type = ActivitySessionType_RestfulSleep, ...
activity_algorithm_post_process_sleep_sessions(session_entries, sessions)
; cl_assert_equal_i(sessions[0].type, ActivitySessionType_Sleep); } } // --------------------------------------------------------------------------------------- // Test to make sure we don't get steps counted while sleeping void test_activity_algorithm_kraepelin__steps_during_sleep(void) { const int num_minut...
t_bitmap, "fill_rect_origin_r7_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, 8, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r8_no_clip.${BIT_DEPTH_NAME}.pbi"...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2), GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax1_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should draw s...
Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; cl_assert_equal_i(timeline_init(&head), S_SUCCESS); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1430236800 - 60 * 60), S_SUCCESS); const time_t midnight_apr_28_pst = 14...
cl_assert(uuid_equal(&state.node->id, &all_day_item.header.id))
; cl_assert(!state.node->all_day); cl_assert_equal_i(state.node->timestamp, midnight_march_3_utc); cl_assert_equal_i(state.node->duration, 0); cl_assert_equal_i(state.current_day, midnight_march_2_pst); // no more cl_assert(!iter_next(&iterator)); // 1 delete cl_assert(timeline_iter_remove_node_with_i...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
((region->cache_policy != MpuCachePolicy_Invalid) && (region->cache_policy < MpuCachePolicyNum))
; // MPU Region Base Address Register // | Addr (27 bits) | Region Valid Bit | Region Num (4 bits) | // The address is unshifted, we take the top bits of the address and assume everything below // is zero, since the address must be power of 2 size aligned. *base_address_reg = region->base_address | ...
*id) { prv_notification_window_add_notification(id, NotificationMobile); } //! The animate mode slides the notificaiton in from the top as if it was a new notification. void notification_window_focus_notification(Uuid *id, bool animated) { NotificationWindowData *data = &s_notification_window_data; if (animated...
notifications_presented_list_current()
!= notifications_presented_list_first()) { const bool should_animate = !do_not_disturb_is_active(); notification_window_focus_notification(id, should_animate); } else { // If we are inserting into the middle of this list, just reaload the swap layer so the // number of notificatio...