prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_ERROR, "No connection found for pairing complete")
; return; } const bool success = (status == HciStatusCode_Success); if (!success) { bluetooth_analytics_handle_ble_pairing_error(status); PBL_LOG(LOG_LEVEL_ERROR, "Pairing failed w/ status: 0x%x", status); } bt_driver_cb_pairing_confirm_handle_completed(ctx, success); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
bitblt_bitmap_into_bitmap(&dest_bitmap, &src_bitmap, GPoint(dest_origin_x, 0), GCompOpAssign, GColorWhite)
; } static void prv_manipulate_launcher_in_system_framebuffer(GContext *ctx, const GRect *selection_rect, int16_t delta, GColor selection_color) { if (!ctx || !selection_rect || (delta == 0)) { ret...
all // the ones that the task_watchdog service watches over. const PebbleTask tasks_in_reverse_priority[] = { PebbleTask_KernelBackground, PebbleTask_KernelMain, PebbleTask_PULSE, PebbleTask_NewTimers }; for (unsigned int i = 0; i < ARRAY_LENGTH(tasks_in_reverse_priority); ++i) { const uint...
{ // Check if system task is the one triggering the watchdog PebbleTaskBitset new_mask = s_watchdog_mask & ~(1 << PebbleTask_KernelBackground); if ((new_mask & s_watchdog_bits) == new_mask) { // Put system task callback using from ISR variant PebbleEvent event = { .type = PEBBLE_...
else if (reason.code == 0) { PBL_LOG_SYNC(LOG_LEVEL_WARNING, "Recovered from task watchdog stall."); } } // ============================================================================================================ // Public functions // -----------------------------------------------------------------------...
; cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); cl_assert(!line...
utf8_get_bounds(&success, "Foo b\n\n\nar \nanimalstyle")
; cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, .box = (GRect) { GPointZero, (GSize) { 4 * HORIZ_ADVANCE_PX, 90 } } }; line.max_width_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; // Init mutable types wor...
/* * 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...
(-current_offset_px, 0)
; // the framebuffer is already wiped at the beginning, so we can use GColorWhite as a fill color // without filling it ourselves bitblt_bitmap_into_bitmap(&sys_bitmap, &app_bitmap, point, GCompOpAssign, GColorWhite); } else { // First half of the transition const int16_t diff = s_data.animation_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...
_Static_assert(sizeof(RoundFlipTransitionAnimationConfiguration) == sizeof(void *), "")
; void compositor_round_flip_transitions_flip_animation_update(GContext *ctx, uint32_t distance_normalized, CompositorTransitionDirection dir, ...
rcular_buffer_consume(SharedCircularBuffer* buffer, SharedCircularBufferClient *client, uint16_t length) { PBL_ASSERTN(list_contains(buffer->clients, &client->list_node)); uint32_t data_length = prv_get_data_length(buffer, client); if (data_length < length) { return false; } client->read_index = (client-...
( buffer, &client->buffer_client, num_items * item_size, (uint8_t *)data, &bytes_out)
; PBL_ASSERTN(bytes_out == num_items * item_size); return num_items; } // An interesting property of the subsampling algorithm used is that // the subsampling ratio does not need to be in reduced form. It will // give the exact same results if the numerator and denominator have a // common divisor. ...
ut when a new sample // becomes available from the driver, we will retry anyway return xQueueSendToBack(queue, &event, 0); } case PebbleTask_KernelBackground: return system_task_add_callback(state->data_cb_handler, state->data_cb_context); case PebbleTask_NewTimers: return new_timer_...
prv_subscriber_state(session)
; if (!state) { PBL_LOG(LOG_LEVEL_WARNING, "not subscribed"); goto unlock; } if (samples != state->num_samples) { PBL_LOG(LOG_LEVEL_WARNING, "Wrong number of samples"); success = false; } else { // Default timestamp for next chunk state->timestamp_ms += samples * 1000...
Copy up to the next '%' char *ptr = strchr(fmt, '%'); if (ptr == NULL) { // Get the ending \0 of the string // Equivalent to ptr = fmt + strlen(fmt), but a bit faster/smaller ptr = strchr(fmt, '\0'); } size_t length = (ptrdiff_t)(ptr - fmt); // Verify we have enough space for the...
(t->tm_mday, 2, INTFMT_PADZERO)
8, 264, -184}, { 1312, 344, -240}, { 1016, 360, -184}, { 1376, 448, -288}, { 1216, 496, -240}, { 736, 352, -264}, // 29 seconds { 896, 368, -272}, { 1208, 368, -224}, { 1352, 192, -144}, { 1240, 16, -72}, { 1152, 32, -104}, { 1096, 40, -104}, { 1088, 56, -144}, { ...
{ 1352, 416, -232}, { 1136, 472, -152}, { 1072, 488, -160}, { 1216, 464, -272}, { 920, 360, -176}, { 1048, 384, -184}, { 1184, 376, -152}, { 1304, 192, -88}, { 1128, 16, -32}, { 1016, 40, -56}, { 1024, 104, -72}, { 1080, 120, -64}, { 1064, 120, -16}, { 976, 96, -6...
{ 1208, 104, -16}, { 1136, 96, 24}, { 1000, 72, 16}, { 1032, 80, -32}, { 944, 96, -184}, { 960, -40, -208}, { 1112, -120, -168}, { 944, 0, -232}, { 888, -88, -240}, { 1016, -40, -248}, { 992, 48, -200}, { 840, 72, -176}, { 856, 96, -176}, { 1016, 160, -128}, ...
_db/api.h" #include "services/normal/blob_db/util.h" #include "services/normal/blob_db/sync.h" #include "util/size.h" // Writebacks counter //////////////////////// static int s_num_writebacks; static int s_num_until_timeout; void blob_db_endpoint_send_sync_done(BlobDBId db_id) { return; } static void prv_handle...
ARRAY_LENGTH(keys)
; ++i) { cl_assert(list_find(&dirty_list->node, prv_list_key_comparator, keys[i]) != NULL); } blob_db_util_free_dirty_list(dirty_list); // mark one as synced and re-check for (int synced_idx = 1; synced_idx < ARRAY_LENGTH(keys); ++synced_idx) { blob_db_mark_synced(BlobDBIdTest, (uint8_t *)keys[synced_...
ad); app_window_stack_push(window1, true); cl_assert_equal_i(app_window_stack_count(), 1); cl_assert_equal_i(window1->on_screen, true); app_window_stack_push(window2, true); cl_assert_equal_i(app_window_stack_count(), 2); cl_assert_equal_i(window1->on_screen, false); cl_assert_equal_i(window2->on_scre...
(prv_get_appear_disappear_count(), 0)
; } // Description: // This test ensures that when we push windows onto modal window stacks, that // only the appropriate window is visible at a given time. void test_window_stack__modal_priority(void) { Window *windows[NumModalPriorities]; WindowStack *window_stacks[NumModalPriorities]; ModalPriority idx = Moda...
qual_i(0, menu_layer_get_selected_index(&l).section); cl_assert_equal_i(5, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(5 * basic_cell_height, l.selection.y); menu_layer_set_selected_next(&l, true, MenuRowAlignNone, false); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section); cl_asse...
menu_layer_init(&s_menu_layer_hierarchy, &GRect(10, 10, 100, 180))
ision 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_duration(test_player->animation, ANIMATION_DURATION_INFINITE); prv_play_animation_update(test_player->...
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_animation_infinite_reel_reverse(void) { // Choose duration and elapsed to have clean division for // ANIM...
#include <inttypes.h> // We use this as an argument to indicate a lookup of the current task #define PEBBLE_TASK_CURRENT PebbleTask_Unknown #define US_PER_SECOND (1000 * 1000) typedef void (*ProcessDataHandler)(CallbackEventCallback *cb, void *data); // We create one of these for each data service subscriber typede...
mutex_lock_recursive(s_accel_manager_mutex)
(bitmap, size, format)
) { applib_free(bitmap); return NULL; } #ifdef PLATFORM_SPALDING if (BITMAP_FORMAT_IS_CIRCULAR_FULL_SCREEN(size, format)) { bitmap->data_row_infos = g_gbitmap_spalding_data_row_infos; } #endif } return bitmap; } static bool prv_platform_supports_format(GSize size, GBitmapFormat form...
te.enabled) { flash_unlock(); return; } analytics_inc(ANALYTICS_APP_METRIC_FLASH_SUBSECTOR_ERASE_COUNT, AnalyticsClient_CurrentTask); power_tracking_start(PowerSystemFlashErase); enable_flash_spi_clock(); handle_sleep_when_idle_begin(); flash_write_enable(); flash_start_cmd(); flash_send_and...
flash_whoami()
; if (!check_whoami(spi_flash_id)) { // Zero bytes is the best size to report if the flash is corrupted return 0; } // capcity_megabytes = 2^(capacity in whoami) uint32_t capacity = spi_flash_id & 0x000000FF; // get the capacity of the flash in bytes return 1 << capacity; } void flash_prf_set_prot...
{ 0, 0x42, 5251, 187, 0}, { 0, 0x44, 4134, 188, 0}, { 0, 0x31, 4710, 190, 0}, { 13, 0x43, 6077, 154, 0}, { 17, 0x42, 7089, 165, 0}, { 0, 0x34, 2517, 161, 0}, { 76, 0x44, 8780, 165, 0}, { 20, 0x64, 11094, 183, 0}, { 12, 0x65, 7077, 199, 0}, { 0, 0x56, 2881, 209, 0}, ...
ARRAY_LENGTH(samples)
; return samples; }
/* * 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...
{ kernel_free(send_job); ++s_free_count; }
static const SessionSendJobImpl s_test_job_impl = { .get_length = prv_send_job_impl_get_length, .copy = prv_send_job_impl_copy, .get_read_pointer = prv_send_job_impl_get_read_pointer, .consume = prv_send_job_impl_consume, .free = prv_send_job_impl_free, }; SessionSendQueueJob *prv_create_test_job(const uin...
ed = interpolate_int64(normalized, from, to); return (uint32_t)CLIP(interpolated, 0, UINT32_MAX); } Fixed_S32_16 interpolate_fixed32(int32_t normalized, Fixed_S32_16 from, Fixed_S32_16 to) { const int64_t interpolated = interpolate_int64(normalized, from.raw_value, to.raw_value); const int32_t raw_value = ...
{ return prv_interpolate_moook(normalized, from, to, s_delta_moook_in, ARRAY_LENGTH(s_delta_moook_in), NULL, num_frames_to, 0, true); }
int64_t interpolate_moook_in_only(int32_t normalized, int64_t from, int64_t to) { return prv_interpolate_moook(normalized, from, to, s_delta_moook_in, ARRAY_LENGTH(s_delta_moook_in), NULL, 0, 0, true); } int64_t interpolate_moook_out(int32_t normalized, int64_t from, int64_t to, ...
TIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "timeline.h" #include "util/uuid.h" #include "applib/ui/status_bar_layer.h" #include "apps/system_app_ids.h" #include "apps/system_apps/timeline/timeline....
{ return (node->timestamp >= timestamp - fudge_time); }
else { // direction == TimelineIterDirectionPast return (node->timestamp < timestamp - fudge_time); } } // All day events show up in future if no timed events have passed today, // i.e. no events exist between midnight today and now // iterate and figure out if we had a timed event pass today static bool prv_sh...
ntry.version == 1) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d", &steps, &orientation, &vmc); } else if (state->test_entry.version == 2) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d", &steps, &orientation, &vmc, &light); } else if (state->test_entry.version == 3) { ssc...
if (strcmp(token, "TEST_START_AT") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.value); } else if (strcmp(token, "TEST_START_AT_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.min); } else if (strcmp(token, "TEST_START_AT_MAX")...
C_SetTime(RTC_Format_BIN, &rtc_time_struct); RTC_SetDate(RTC_Format_BIN, &rtc_date_struct); } void rtc_get_time_ms(time_t* out_seconds, uint16_t* out_ms) { uint32_t sub_seconds = 0; RTC_DateTypeDef rtc_date; RTC_TimeTypeDef rtc_time; // NOTE: There is a tricky rollover situation that can occur here if the d...
exti_enable_other(ExtiLineOther_RTCWakeup)
; s_rtc_wakeup_initialized = true; } static uint64_t prv_get_time_milliseconds_since_epoch(void) { time_t seconds; uint16_t milliseconds; rtc_get_time_ms(&seconds, &milliseconds); return ((uint64_t)seconds * 1000) + milliseconds; } void rtc_alarm_set(RtcTicks num_ticks) { PBL_ASSERTN(s_rtc_wakeup_initia...
_le_gateway_response_latency_watchdog_handler, data); } static bool prv_find_source(ListNode *found_node, void *data) { return (((ConnectionStateRequest *)found_node)->consumer == (BtConsumer)data); } /* * Exported APIs */ void conn_mgr_set_ble_conn_response_time( GAPLEConnection *hdl, BtConsumer consumer, R...
gap_le_connection_any()
uadrant, &starting_edge, &ending_edge, start_top, start_bottom); prv_get_angles_mask_edge(y_middle, center, config.end_quadrant.quadrant, &ending_edge, &starting_edge, end_top, end_bottom); // Now we use only one with valuable data - same starti...
{ prv_draw_scanline_collision_points(ctx, center.y.integer - i - special_line_offset_top, left, inner_left, top_starting_edge, top_ending_edge, ignore_close_angles); prv_draw_scanline_collision_points(ctx, center.y.int...
if (draw_bottom) { prv_draw_scanline_collision_points(ctx, center.y.integer + i + special_line_offset_bottom, left, inner_left, bottom_starting_edge, bottom_ending_edge, ignore_close_angles); prv_draw_scanline_...
" "Don't worry, tomorrow is just around the corner 😀"), i18n_noop("You walked %d steps which is %d%% below your typical, " "but don't stress. You'll crush it tomorrow 😉"), }, }, [PercentTier_Fail] = { .num_variants = 3, .variants = { i18n_n...
i18n_noop("Feelin' good? You slept for %dH %dM. Nothing can stop you now 👊")
, }, }, [PercentTier_BelowAverage] = { .num_variants = 4, .variants = { /// Sleep notification on wake up, slept below their typical sleep duration i18n_noop("Hey sleepy head. You slept for %dH %dM which " "is %d%% below your typical. Try to get more tonight!"...
ith 2.0 apps. return (Animation *)animation_legacy2_create(); } AnimationPrivate *animation = applib_type_malloc(AnimationPrivate); if (!animation) { return NULL; } return animation_private_animation_init(animation); } // -----------------------------------------------------------------------------...
if (animation_private_using_legacy_2(state)) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. animation_legacy2_unschedule((AnimationLegacy2 *)animation_h); return true; }
AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, true /*quiet*/); if (!animation || animation->parent) { return false; } prv_unschedule_animation(state, animation, false /*finished=false*/, true /*allow_auto_destroy*/, false /*force_destroy*/, true...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return layout->impl->size_getter(ctx, layout); }
const LayoutColors *layout_get_colors(const LayoutLayer *layout) { #if PBL_COLOR if (layout->impl->color_getter) { return layout->impl->color_getter(layout); } #endif return &s_default_colors; } const LayoutColors *layout_get_notification_colors(const LayoutLayer *layout) { return PBL_IF_COLOR_ELSE(layou...
-------------------------------------------------------- static bool prv_parse_activity_samples_file(ActivitySampleDiscoveryState *state) { // Init for next set of samples state->test_entry = (ActivityFileTestEntry) { .samples = state->samples, .version = 1, .activity_type = {-1, -1, -1}, .len = {-1...
if (state->test_entry.version == 3) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d, %d", &steps, &orientation, &vmc, &light, &plugged_in); } else { cl_assert(false); }
fflush(stdout); PBL_ASSERTN(state->test_entry.num_samples < SLEEP_SAMPLES_DISCOVERY_MAX_SAMPLES); state->samples[state->test_entry.num_samples++] = (AlgMinuteFileSample) { .v5_fields = { .steps = steps, .orientation = orientation, .vmc = vmc, .light = ...
d)); cl_assert_equal_b(false, prv_app_install_is_watchface(CRAZY_ID)); } void test_app_install_manager__get_uuid_for_install_id(void) { Uuid uuid = {}; cl_assert_equal_b(false, app_install_get_uuid_for_install_id(INSTALL_ID_INVALID, &uuid)); cl_assert_equal_uuid(uuid, UUID_INVALID); cl_assert_equal_b(true, ...
cl_assert_equal_i(ProcessStorageFlash, bg_counter_md_worker->process_storage)
; app_install_release_md(bg_counter_md_worker); const PebbleProcessMd *menu_layer_md = app_install_get_md(menu_layer_id, false); cl_assert(menu_layer_md != NULL); cl_assert_equal_b(false, menu_layer_md->has_worker); cl_assert_equal_i(ProcessTypeApp, menu_layer_md->process_type); cl_assert_equal_i(ProcessSt...
/* * 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_cstring(&list, AttributeIdTitle, ARRAY_RAND(titles))
0, -288}, { 512, 840, -328}, { 400, 816, -360}, { 392, 872, -336}, { 320, 872, -392}, { 264, 760, -312}, { 240, 672, -192}, { 272, 624, -80}, { 272, 584, -104}, { 312, 680, 40}, // 53 seconds { 464, 856, 56}, { 400, 1088, -112}, { 224, 648, 8}, { 216, 712, -40}, ...
{ 536, 1360, -32}, { 472, 1112, 8}, { 480, 1048, -56}, { 400, 1184, -32}, { 336, 1112, -160}, { 256, 728, -240}, { 120, 304, -112}, { 40, -96, -472}, { 56, 128, -704}, { 48, 16, -776}, { 0, -8, -816}, { 8, 16, -904}, { 8, -16, -968}, { 0, -48, -928}, { 32, 80,...
{ 944, 432, 264}, { 1072, 456, 176}, { 1224, 392, 376}, { 1424, 488, 344}, { 1416, 640, 368}, { 896, 360, 16}, { 872, 368, 0}, { 672, -144, -8}, { 920, 216, 224}, { 920, 216, 328}, { 856, 392, 144}, { 712, 232, 176}, { 648, 184, 184}, { 640, 192, 160}, { 704,...
activity_private_state(); mutex_lock_recursive(state->mutex); switch (metric) { case ActivityMetricActiveSeconds: case ActivityMetricSleepTotalSeconds: case ActivityMetricSleepRestfulSeconds: case ActivityMetricSleepEnterAtSeconds: case ActivityMetricSleepExitAtSeconds: // We only store m...
(file, &m_info.settings_key, sizeof(m_info.settings_key), &history, sizeof(history))
; } } activity_private_settings_close(file); } unlock: mutex_unlock_recursive(state->mutex); } // -------------------------------------------------------------------------------------------- // Called from activity_get_metric() every time a client asks for a metric. Also called // periodically from ...
se this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR COND...
while (i < NUM_CONVERSIONS) { ADC_SoftwareStartConv(ADC1); // Restart the conversion group if (!prv_wait_for_conversion()) { continue; } const uint16_t vref = ADC_GetConversionValue(ADC1); if (!prv_wait_for_conversion()) { continue; } const uint16_t vmon = ADC_GetConversionValue...
ADC_Cmd(ADC1, DISABLE); ADC_TempSensorVrefintCmd(DISABLE); periph_config_disable(ADC1, RCC_APB2Periph_ADC1); mutex_unlock(s_adc_mutex); }
allbacks->selection_changed(callbacks, new_row, old_row); } } static void prv_selection_will_change_callback(MenuLayer *menu_layer, MenuIndex *new_index, MenuIndex old_index, void *context) { SettingsData *data = context; const uint16_t old_row = old_index.row; ...
callbacks->get_initial_selection(data->callbacks)
; menu_layer_set_selected_index(menu_layer, MenuIndex(0, selected_row), MenuRowAlignCenter, false /* animated */); } if (callbacks->expand) { callbacks->expand(data->callbacks); } } static void prv_settings_window_appear(Window *window) { SettingsData *data = window_g...
KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/data_logging.h" #include "applib/health_service.h" #include "drivers/battery.h" #include "drivers/vibe.h" #include "kernel/events.h" #include "kernel/pbl_mallo...
(LOG_LEVEL_INFO, "Not subscribing to HRM: watch is flat(ish)")
PP_LOG_LEVEL_ERROR, GPATH_ERROR); return; } int min_x, max_x, min_y, max_y; GPoint rot_start, rot_end; bool found_start_direction = false; bool start_is_down = false; int16_t *intersections_up = NULL; int16_t *intersections_down = NULL; rot_points[0] = rot_end = rotate_offset_point(&path->points[0...
(intersection_up_count, intersection_down_count)
ble == color_table_hsv) { s_color_table = color_table_hvs; } else if (s_color_table == color_table_hvs) { s_color_table = color_table_hsv; } } layer_mark_dirty(s_canvas_layer); } static void select_handler(ClickRecognizerRef recognizer, void *context) { AppData *data = window_get_user_data(s_...
text_layer_get_layer(data->bg_text)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
WINDOW_NAME("Quick Launch First Use")
, RESOURCE_ID_SUNNY_DAY_TINY, text, GColorBlack, GColorWhite, NULL, RESOURCE_ID_ACTION_BAR_ICON_CHECK, prv_handle_quick_launch_confirm); expandable_dialog_set_header(expandable_dialog, header); #if PBL_ROUND expandable_dialog_set_header_font(expandable_dialog, fonts_get_sys...
HealthAPITestAppData *data = context; strcpy(data->debug_card.dialog_text, "HR stats"); // Get various stats time_t end_time = time(NULL); // List of time ranges typedef struct { uint32_t seconds; char *desc; } TimeRange; TimeRange ranges[] = { {1 * SECONDS_PER_HOUR, "1 hour"}, {30 * S...
(data->steps_window, GColorBlack)
; window_set_user_data(data->steps_window, data); window_set_click_config_provider_with_context(data->steps_window, steps_click_config_provider, data); window_set_window_handlers(data->steps_window, (WindowHandlers) { .load = steps_window_load, .unload = ste...
ius) { s_last_args_for_mock = (ArgsForMock){ .ctx = *ctx, .r0 = *rect, .radius = radius, .corner_mask = GCornersAll }; strncpy(s_last_args_for_mock.func, __func__, sizeof(s_last_args_for_mock.func)); } void prv_draw_round_rect_aa(GContext* ctx, const GRect *rect, uint16_t radius) { s_last_args_...
{ fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_graphics_context_init(&context, fb); }
// Teardown void test_graphics_context_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } ///////////////////////////////////// /// TESTS ///////////////////////////////////// void test_graphics_context_${BIT_DEPTH_NAME}__set(void) { GDrawState draw_state; GColor color; // Stroke Color graphics_context_set_st...
"system/passert.h" #include "system/reboot_reason.h" #include "system/version.h" #include "util/attributes.h" #include "util/build_id.h" #include <inttypes.h> static const uint16_t ENDPOINT_ID = 2002; typedef struct PACKED { uint8_t command; uint32_t cookie; } BluetoothHeader; typedef struct BluetoothDumpLineC...
PBL_LOG(LOG_LEVEL_ERROR, "Invalid dump log message received -- length %u", length)
; return; } generation = data[1]; cookie = *((uint32_t*) (data + 2)); } else { if (length != 5) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid dump log message received -- length %u", length); return; } cookie = *((uint32_t*) (data + 1)); } switch (*data) { case 0x00: prv_f...
/* * 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...
toggle_color(window)
; } static void select_single_click_handler(ClickRecognizerRef recognizer, Window *window) { ClickAppData *data = window_get_user_data(window); const uint16_t count = click_number_of_clicks_counted(recognizer); sniprintf(data->text_buffer, TEXT_BUFFER_SIZE, "Single Click! (%u)", count); PBL_LOG(LOG_LEVEL_DEBUG...
s_update_handler_calls, a) >= test_duration/MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 0); // The distance should always be at 0 cl_assert_equal_i(prv_last_update_distance(a), 0); // Destroy it animation_destroy(a); #endif } // ---------...
(&s_stopped_handler_calls, seq)
, 0); // Complete B prv_advance_to_ms_with_timers(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entrie...
nd override it so we clip the icon to the max icon size const GRect saved_clip_box = ctx->draw_state.clip_box; ctx->draw_state.clip_box.origin = gpoint_add(ctx->draw_state.drawing_box.origin, rect->origin); ctx->draw_state.clip_box.size = rect->size; // ...
if (scroll_visible_text_width <= draw_box->size.w) { // No need to scroll because text fits completely in the provided draw_box return false; }
// This is the amount we'll scroll the text from start to end to show all of the // scroll_visible_text_width in the provided draw_box const int16_t total_px_to_scroll = scroll_visible_text_width - draw_box->size.w; vars_out->total_px_to_scroll = total_px_to_scroll; // These values were tuned with feedback...
urce, &(AppMenuDataSourceCallbacks) { .changed = prv_menu_layer_reload_data, .filter = watchface_filter_callback, }, &menu_layer); uint16_t num_apps = app_menu_data_source_get_count(&data_source); cl_assert_equal_i(num_apps, ARRAY_LENGTH(watchface_default_order)); for (uint16_t i = 0; i < num_apps; i++...
{ cl_assert_equal_i(node->install_id, app_order[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...
(rtr->header_buffer + rtr->bytes_received, *data_p, header_bytes_to_copy)
; *data_size_p -= header_bytes_to_copy; *data_p += header_bytes_to_copy; rtr->bytes_received += header_bytes_to_copy; if (rtr->bytes_received < sizeof(PebbleProtocolHeader)) { // Incomplete header, wait for more data to come. return true; } return false; } static bool prv_handle_endpoint_error_an...
f (direction == TimelineIterDirectionPast) { return prv_find_first_past(head, timestamp, today_midnight, show_all_day_events); } else { return prv_find_first_future(head, timestamp, today_midnight, show_all_day_events); } } static void prv_remove_node(TimelineNode **head, TimelineNode *node) { list_remov...
((ListNode *)*list_head, (ListNode *)nodes[i], prv_time_comparator, true)
; } } static bool prv_each(SettingsFile *file, SettingsRecordInfo *info, void *context) { // check entry is valid if (info->key_len != UUID_SIZE || info->val_len == 0) { return true; // continue iteration } TimelineNode **list_head = context; CommonTimelineItemHeader header; // we don't care about ...
N(x,y) (BITS(y) & ~BITS(x-1)) // Yo dawg, I heard you like tests so I put tests in your tests so you can test // your tests while you test! void test_system_flash__bit_range_macros(void) { cl_assert_equal_i(0b1, BITS(0)); cl_assert_equal_i(0b00011111, BITS(4)); cl_assert_equal_i(0b00111111, BITS_BETWEEN(0,5)); ...
(countdown <= 0, "Callback not called enough times")
hared_prf_reschedule_writeback_timer(); } prv_unlock_pending_bonding(); #endif } void shared_prf_storage_erase_ble_pairing_data(void) { BLEPairingData empty_data = {}; // Call the version that doesn't do a flash erase because we are only writing zeros. prv_update_and_cleanup_struct_no_erase(&empty_data, siz...
{ BTClassicPairingData empty_data = {}; // Call the version that doesn't do a flash erase because we are only writing zeros. prv_update_and_cleanup_struct_no_erase(&empty_data, sizeof(empty_data), offsetof(SharedPRFData, bt_classic_data)); }
/////////////////////////////////////////////////////////////////////////////////////////////////// //! Getting Started Is Complete bool shared_prf_storage_get_getting_started_complete(void) { SharedPRFData data; prv_fetch_struct(&data); const bool is_complete = data.getting_started_is_complete; prv_cleanup_...
else if (animation->type == AnimationTypeSpawn) { // For a spawn animation, get the max of each component uint32_t max_child_duration = 0; for (child_idx = 0; child_idx < ANIMATION_MAX_CHILDREN; child_idx++) { AnimationPrivate *child = prv_find_animation_by_parent_child_idx(state, animation, child_id...
{ AnimationPrivate *animation = (AnimationPrivate *)state->scheduled_head; if (animation == NULL) { return; } const uint32_t now = prv_get_ms_since_system_start(); const int32_t delta_ms = serial_distance32(now, animation->abs_start_time_ms); const uint32_t interval_ms = MAX(delta_ms, 0) + rate_control_...
// ------------------------------------------------------------------------------------------- bool prv_animation_is_scheduled(AnimationState* state, AnimationPrivate *animation) { return (animation->abs_start_time_ms != 0); } // ------------------------------------------------------------------------------------...
t dest_rect = GRect(10, 25, src_bitmap->bounds.size.w*2, src_bitmap->bounds.size.h*2); GPoint src_origin_offset = { .x = 4, .y = 2 }; // Offset past the black bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, src_bitmap, dest_rect, src_origin_offset, GCompOpAssign, GColorWhite); cl...
{ GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__bounds_and_origin_offset.8bit.pbi"); src_bitmap->bounds = (GRect) { { 5, 5}, { 10, 10 } }; uint8_t dest_data[50*50]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = 50, .info.format = GBitmapFormat8Bit, .info.version = GBIT...
// Setup: // - Source is a 1bit image of a white cross with a black background // Result: // - The image names describe the expected result of each destination color / tint color // combination void test_bitblt__1bit_to_1bit_comptint(void) { GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__1bit_to_1...
APP_ID_NOTIFICATIONS, APP_ID_ALARMS, APP_ID_WATCHFACES, APP_ID_WORKOUT, BG_COUNTER_APP_ID, MENU_LAYER_APP_ID}; app_menu_data_source_init(&data_source, &(AppMenuDataSourceCallbacks) { .changed = prv_menu_...
app_menu_data_source_deinit(&data_source)
; } void prv_shuffle(AppInstallId *array, uint8_t n) { for (uint8_t i = 0; i < n - 1; i++) { uint8_t j = i + rand() / (RAND_MAX / (n - i) + 1); int t = array[j]; array[j] = array[i]; array[i] = t; } } void test_app_menu_data_source__change_order_apps(void) { // settings has to be at the beginnin...
License. */ #include "clar.h" #include "services/normal/timezone_database.h" #include "services/common/clock.h" #include "../timezone_fixture.auto.h" #include "stubs_logging.h" #include "stubs_passert.h" #include <string.h> //! Find a region ID for the given region name. //! @return a valid, matching region ID,...
cl_assert_equal_i(tz_info.dst_id, 0)
; // No DST cl_assert_equal_i(tz_info.tm_gmtoff, 6 * 60 * 60); // +6 hours } }
re(&e4); cl_assert(notification_storage_find_ancs_notification_id(84, &u)); cl_assert(uuid_equal(&u, &e4.header.id)); } void test_notification_storage__find_by_timestamp(void) { Uuid i1; uuid_generate(&i1); TimelineItem e1 = { .header = { .id = i1, .type = TimelineItemTypeNotification, ...
(notification_storage_get(&i4, &r), false)
; }
MSP = VECTOR_TABLE[0] (main stack pointer) // PSP = Unknown (process stack pointer) // LR = 0xFFFFFFFF // PC = VECTOR_TABLE[1] // PRIMASK = 0x0 // FAULTMASK = 0x0 // BASEPRI = 0x0 // CONTROL = 0x0 // // Attempt to put the processor into as close to the reset state as p...
dbgserial_putstr("Hold down UP + BACK for 5 secs. to force-boot PRF")
; for (int i = 0; i < 5000; ++i) { if (!(button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK))) { // stop waiting if not held down any longer return false; } delay_ms(1); } return true; } void *reset_vector, *initial_sp; prv_get_fw_reset_vector(&rese...
ents_2[s_num_cb_events_2++] = *event; } static void prv_put_battery_state_change_event(bool is_plugged_in) { PebbleEvent e = { .type = PEBBLE_BATTERY_STATE_CHANGE_EVENT, .battery_state.new_state.is_plugged = is_plugged_in, }; event_put(&e); } // ----------------------------------------------------------...
cl_assert(sys_hrm_manager_get_app_subscription(app_id) == session_ref)
; prv_fake_send_new_data(); // We should get the BPM event cl_assert_equal_i(s_event_count, 1); cl_assert_equal_i(s_events_received[0].type, PEBBLE_HRM_EVENT); cl_assert_equal_i(s_events_received[0].hrm.event_type, HRMEvent_BPM); // Subscribe again before we expire, should get the same session ref back ...
id)); cl_assert_equal_uuid(uuid, UUID_INVALID); cl_assert_equal_b(true, app_install_get_uuid_for_install_id(tictoc_id, &uuid)); cl_assert_equal_uuid(uuid, tictoc_uuid); cl_assert_equal_b(true, app_install_get_uuid_for_install_id(music_id, &uuid)); cl_assert_equal_uuid(uuid, music_uuid); cl_assert_equal_b(...
(false, menu_layer_md->has_worker)
; cl_assert_equal_i(ProcessTypeApp, menu_layer_md->process_type); cl_assert_equal_i(ProcessStorageFlash, menu_layer_md->process_storage); app_install_release_md(menu_layer_md); } static bool prv_each(AppInstallEntry *entry, void *data) { uint8_t *num_entries = (uint8_t *)data; *num_entries = *num_entries + 1...
op_right_rect_color.a = 2; const GRect top_left_rect = (GRect) { .origin = GPoint(right_rects_x, right_rects_y_offset), .size = right_rects_size }; prv_draw_vlines_in_rect(ctx, draw_func, &top_left_rect, top_right_rect_color); GColor bottom_right_rect_color = GColorYellow; bottom_right_rect_color.a = ...
(&ctx, fb)
; setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1); prv_draw_hline_test_pattern(&ctx, prv_hline_pattern_assign_horizontal_line_delta_raw); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_core_assign_horizontal_line_delta_raw"))); }; // V...
/* * 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...
analytics_heartbeat_set(heartbeat, ANALYTICS_APP_METRIC_LAUNCH_COUNT, 300)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ graphics_context_set_compositing_mode(ctx, GCompOpAssign); graphics_draw_rotated_bitmap(ctx, (GBitmap*)&s_gfx_rotated_bitmap_bitmap, GPointZero, 0, GPointZero); }
should be running on the HRM. //! //! This commands the HRM to start or continue running any apps whose //! flags are set, and to stop all apps whose flags are unset. Depending //! on the firmware loaded onto the HRM, multiple apps can be run //! concurrently by setting the logical OR of the App IDs. static bool prv_s...
analytics_inc(ANALYTICS_DEVICE_METRIC_HRM_WATCHDOG_TIMEOUT, AnalyticsClient_System)
; prv_disable(dev); psleep(SHUT_DOWN_DELAY_MS); prv_enable(dev); } exit: mutex_unlock(dev->state->lock); } // This regular timer callback executes once a second. It is part of the watchdog logic used to // detect if the sensor becomes unresponsive. static void prv_watchdog_timer_cb(void *data) { HRMD...
r truncation. char buffer[MFG_INFO_MODEL_STRING_LENGTH + 1] = { 0 }; mfg_info_get_model(buffer); cl_assert_equal_s(buffer, ""); mfg_info_set_model("test_model"); mfg_info_get_model(buffer); cl_assert_equal_s(buffer, "test_model"); { char long_string[] = "01234567890123456789"; mfg_info...
cl_assert_equal_i(mfg_info_get_watch_color(), 3)
; cl_assert_equal_i(mfg_info_get_rtc_freq(), 4); char buffer[MFG_INFO_MODEL_STRING_LENGTH] = { 0 }; mfg_info_get_model(buffer); cl_assert_equal_s(buffer, ""); cl_assert_equal_i(mfg_info_get_disp_offsets().x, 0); cl_assert_equal_i(mfg_info_get_disp_offsets().y, 0); // Set x and y offsets and make ...
/////////// #include "stubs_action_menu.h" #include "stubs_analytics.h" #include "stubs_animation_timing.h" #include "stubs_app_install_manager.h" #include "stubs_app_timer.h" #include "stubs_app_window_stack.h" #include "stubs_bootbits.h" #include "stubs_click.h" #include "stubs_event_service_client.h" #include "stub...
{ attribute_list_add_cstring(&attr_list, AttributeIdBody, config->body); }
if (config->icon_timeline_res_id != TIMELINE_RESOURCE_INVALID) { attribute_list_add_resource_id(&attr_list, AttributeIdIconPin, config->icon_timeline_res_id); } attribute_list_add_uint8(&attr_list, AttributeIdDisplayTime, config->weather_time_type); // Just need to put something here so our mocked clock_ge...
ion_dialog_create(title); Dialog *dialog = confirmation_dialog_get_dialog(confirmation_dialog); dialog_set_text(dialog, i18n_get(text, confirmation_dialog)); dialog_set_background_color(dialog, GColorRed); dialog_set_text_color(dialog, GColorWhite); dialog_set_icon(dialog, resource_id); i18n_free_all(conf...
confirmation_dialog_set_click_config_provider(confirmation_dialog, prv_coredump_click_config)
; app_confirmation_dialog_push(confirmation_dialog); confirmation_dialog_pop((ConfirmationDialog *)context); } static void prv_information_click_config(void *context) { window_single_click_subscribe(BUTTON_ID_UP, prv_coredump_reset_confirm_cb); window_single_click_subscribe(BUTTON_ID_DOWN, prv_coredump_reset_d...
s(&data->kcc_window, &(WindowHandlers) { .load = prv_kcc_window_load, .unload = prv_kcc_window_unload, }); app_window_stack_push(&data->kcc_window, true); } // Callbacks for the main settings filter list menu. //////////////////////////////////////////////////// #define SHUTDOWN_MIN_BOOT_VERSION 135464795...
(SettingsMenuItemSystem, &data->callbacks)
; } const SettingsModuleMetadata *settings_system_get_info(void) { static const SettingsModuleMetadata s_module_info = { .name = i18n_noop("System"), .init = prv_init, }; return &s_module_info; }
hEventType type) { PebbleEvent event = { .type = PEBBLE_APP_FETCH_EVENT, .app_fetch = { .type = type, .id = s_fetch_state.app_id, } }; event_put(&event); } //! Recomputes and saves the progress percent for the current application fetch session static uint8_t prv_compute_progress_percent(...
(LOG_LEVEL_ERROR, "Received app contains invalid JS bytecode")
; prv_put_event_error(AppFetchResultIncompatibleJSFailure); } else { // Set prev_error as a Success. s_fetch_state.prev_error = AppFetchResultSuccess; prv_put_event_simple(AppFetchEventTypeFinish); } app_install_release_md(md); } else { PBL_LOG(LOG_LEVEL_ERROR...
es & ModalProperty_Transparent) ? CompositorState_AppAndModal : CompositorState_Modal; compositor_modal_render_ready(); // Force the app framebuffer to be released. We hold it during transitions to keep the app // framebuffer from changing while it's...
(&s_framebuffer, &s_framebuffer.size)
; } GBitmap compositor_get_app_framebuffer_as_bitmap(void) { // Get the app framebuffer state based on the size it should be to prevent a malicious app from // changing it and causing issues. GSize app_framebuffer_size; app_manager_get_framebuffer_size(&app_framebuffer_size); return framebuffer_get_as_bitmap...
/* * 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...
(w_cursor, r_cursor, len)
; w_cursor += c_len; } r_cursor = next; } *w_cursor = '\0'; } void ancs_phone_call_handle_incoming(uint32_t uid, ANCSProperty properties, ANCSAttribute **notif_attributes) { // This field holds the caller's name if the phone number belongs to a contact, // or...
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. * See the License for the specific language governing ...
cl_assert(kino_reel_get_type(kino_reel) == KinoReelTypePDCS)
; cl_assert_equal_i(kino_reel_get_data_size(kino_reel), 356); } void test_kino_reel__verify_pdci_get_list(void) { // Test loading PDCI Kino Reel uint32_t resource_id = sys_resource_load_file_as_resource( TEST_IMAGES_PATH, "test_kino_reel__resource_pdci.pdc"); cl_assert(resource_id != UINT32_MAX); Kino...
include "screenshot_pp.h" #include "compositor.h" #include "applib/graphics/framebuffer.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "services/common/comm_session/session_send_buffer.h" #include "services/common/system_task.h" #include "system/logging.h" #include "util/attributes.h" #incl...
{ state->col = remaining_chunk_bytes * cols_per_byte; }
else { state->col = 0; state->row++; } remaining_chunk_bytes -= remaining_framebuffer_row_bytes; output_buffer_with_offset += remaining_framebuffer_row_bytes; } return max_chunk_bytes - remaining_chunk_bytes; } void screenshot_send_next_chunk(void* raw_state) { ScreenshotState* state =...
((float)-3 * (1 << FIXED_S16_3_PRECISION)) }; sum = Fixed_S16_3_add(num1, num2); sum_c = (Fixed_S16_3){ .raw_value = (int16_t)((float)-5 * (1 << FIXED_S16_3_PRECISION)) }; cl_assert(sum.raw_value == sum_c.raw_value); // sum = -2 + 5 = 3 num1 = (Fixed_S16_3){ .raw_value = (int16_t)((float)-2 * (1 << FIXED_S16...
(num1, num2)
; sum_c = (Fixed_S32_16){ .raw_value = (int32_t)((float)4.5 * (1 << FIXED_S32_16_PRECISION)) }; cl_assert(sum.raw_value == sum_c.raw_value); // sum = -2 + -3 = -5 num1 = (Fixed_S32_16){ .raw_value = (int32_t)((float)-2 * (1 << FIXED_S32_16_PRECISION)) }; num2 = (Fixed_S32_16){ .raw_value = (int32_t)((float)-...
/* * 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...
callback(context)
) { cl_assert(s_did_send_byte); } } void fake_accessory_get_buffer(uint8_t **buffer, int *length) { *buffer = s_buffer; *length = s_buffer_index; }
0}, { -168, 912, 160}, { -160, 912, 160}, { -160, 912, 152}, { -160, 920, 152}, { -160, 904, 144}, { -160, 912, 152}, { -160, 920, 152}, { -160, 912, 144}, { -152, 904, 120}, { -160, 912, 144}, { -168, 928, 152}, { -160, 912, 128}, { -160, 912, 136}, { -160, 920, ...
{ -184, 528, -808}, { -256, 576, -720}, { -280, 424, -712}, { -272, 136, -856}, { -232, 224, -960}, { -216, 256, -1088}, { -264, 232, -1016}, { -256, 368, -968}, { -224, 464, -920}, { -248, 408, -856}, // 187 seconds { -248, 424, -824}, { -264, 464, -864}, { -248,...
{ -200, 720, -616}, { -200, 712, -616}, { -200, 720, -616}, { -200, 720, -616}, { -200, 720, -616}, { -200, 712, -624}, { -200, 712, -616}, { -200, 720, -616}, { -200, 712, -616}, { -200, 704, -624}, { -208, 712, -624}, { -200, 712, -616}, { -208, 704, -624}, { -...
/* * 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...
{ LauncherAppGlanceStructured *structured_glance = user_data; LauncherAppGlanceAlarms *alarms_glance = launcher_app_glance_structured_get_data(structured_glance); if (alarms_glance) { strncpy(buffer, alarms_glance->subtitle, buffer_size); buffer[buffer_size - 1] = '\0'; } }
/* * 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_ibeacon)
; uint8_t uuid_bytes[] = "\x97\x6e\xbb\x18\xd3\xe9\x43\xc0\x8a\x63\x8d\x2b" \ "\x60\xd9\x04\x2a"; Uuid uuid = UuidMakeFromBEBytes(uuid_bytes); cl_assert(uuid_equal(&ibeacon.uuid, &uuid)); cl_assert_equal_i(ibeacon.major, 12); cl_assert_equal_i(ibeacon.minor, 34); cl_assert_equal_i...
slide) { prv_clock_reset(0); tzinfo.tm_gmtoff = gmtoff; rtc_set_timezone(&tzinfo); clock_init(); clock_set_time(jan1st_noon_2005); cl_assert_equal_i(rtc_get_time(), jan1st_noon_2005); time_t t = rtc_get_time(); struct tm now; localtime_r(&t, &now); time_t timestamp = clock_to_t...
rtc_set_time(event_time - (14 * SECONDS_PER_HOUR) - 1)
/* * 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_release()
time(time_t day, int hour, int minute) { s_current_day = day; s_current_hour = hour; s_current_minute = minute; rtc_set_time(day + prv_hours_and_minutes_to_seconds(hour, minute)); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Setup void test_alarm_sm...
(s_num_timeline_adds, 3)
; cl_assert_equal_i(s_num_timeline_removes, 0); // Begin light sleep s_sleep_state = ActivitySleepStateLightSleep; s_sleep_state_seconds = SMART_ALARM_MAX_LIGHT_SLEEP_S - 15 * SECONDS_PER_MINUTE; // Smart alarms are first triggered by cron at T-30min prv_set_time(s_current_day, 10, 0); cron_service_wake...
gap_le_advert_handle_connect_as_slave(); prv_put_legacy_connection_event(&event->peer_address, true /* connected */); } if (gap_le_connection_is_connected(&event->peer_address)) { // We have seen this crop up for cases where the phone has disconnected due to a timeout // but t...
ble_hrm_handle_disconnection(connection)
; #endif const bool local_is_master = connection->local_is_master; PBL_LOG(LOG_LEVEL_INFO, "LE Disconn: addr="BT_DEVICE_ADDRESS_FMT", is_random_addr=%u,", BT_DEVICE_ADDRESS_XPLODE(event->peer_address.address), event->peer_address.is_random_address); PBL_LOG(LOG_LEVEL_INFO,...
/* * 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...
(isnan(log(-1.0)))
Task_App), GAPLEConnectHCIReasonExtensionAirPlaneMode); } // ----------------------------------------------------------------------------- // Auto-reconnect Tests void __disabled_test_gap_le_connect__single_client_no_autoreconnect(void) { BTDeviceInternal device = prv_dummy_device(1); /...
cl_assert_equal_i(e, BTErrnoOK)
; // The LE Cancel Create Connection command is always followed by an event that // is sent by the BT Controller. Simulate this event: fake_gap_le_put_cancel_create_event(&device, true /* is_master */); // Verify the app task got a (virtual) disconnection event: prv_assert_client_event(&device, false /* con...
case ObjectWatchApp: case ObjectWatchWorker: { PebbleTask task = (request->type == ObjectWatchApp) ? PebbleTask_App : PebbleTask_Worker; char filename[APP_FILENAME_MAX_LENGTH + 1]; app_storage_get_file_name(filename, sizeof(filename), index, task); storage_info = kernel_malloc_check(size...
new_timer_start(s_pb_state.timer_id, PUT_TIMEOUT_MS, prv_timer_callback, &s_pb_state, 0 /*flags*/)
; exit: prv_mark_pb_jobs_complete(1); prv_send_response(success ? ResponseAck : ResponseNack, success ? s_pb_state.token : 0); if (!success) { prv_cleanup(); } } static bool prv_check_putrequest_for_errors(const PutRequest *request_hdr, uint...
/* * 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...
{ // We received the acknowledgment LLD_EVT_FLAG_RESET(evt, WAITING_ACK); }
#endif //(BLE_PERIPHERAL) // Go to the next descriptor hdl = co_buf_rx_next(hdl); }; // Move the current RX buffer co_buf_rx_current_set(hdl); } #if IS_AE_CHIP static void prv_llm_util_get_supp_features(struct le_features *feats) { memcpy(&feats->feats[0], &llm_local_le_feats.feats[0], LE_FEATS_LE...
/* * 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...
GEdgeInsets(-2)
); // get content size adds 5 to the height, and the y offset is too high by a px (+ the 5px) const int height_correction = 5; text_fill_box.size.h -= height_correction; text_fill_box.origin.y += height_correction + 1; if (!gcolor_equal(box_color, GColorClear)) { graphics_context_set_fill_color(ctx, box...
ILE_TYPE_STATIC, 10); name[0]++; if (fds[i] < 0) { break; } } cl_assert(fds[i] == E_OUT_OF_RESOURCES); for (int j = 0; j < i; j++) { cl_assert(pfs_close(fds[j]) == S_SUCCESS); } fd = pfs_open("newfile", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); pfs_close(fd); int ...
(rv, strlen(string))
; int tmp_fd = pfs_open(file, OP_FLAG_OVERWRITE, FILE_TYPE_STATIC, strlen(overwrite_string)); cl_assert(fd >= 0); pfs_init(false); // simulate a reboot uint8_t read_buf[strlen(string)]; fd = pfs_open(file, OP_FLAG_READ, 0, 0); cl_assert(fd >= 0); rv = pfs_read(fd, &read_buf[0], strlen(string)); cl_ass...
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. * See the Lice...
while (gpio_input_read(&EWD1000->int_gpio)) { if (rtc_get_ticks() > timeout) { PBL_CROAK("Touch controller didn't respond!"); } }
} // Status Register Operations //////////////////////////////////////////////////////////////////////////////// #if 0 // TODO: this will be used to get FW information from the controller static void prv_status_register_read(uint8_t address, void *result, StatusReadType type) { const StatusRegisterRequest request...
{ 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 144, 0}, { 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 144, 0}, // 345: Local time: 2016-03-02 01:50:00 AM { 0, 0x74, 0, 148, 0}, { 0, 0x74, 0, 148, 0}, ...
{ 0, 0x78, 258, 148, 0}, { 0, 0x69, 0, 144, 0}, // 450: Local time: 2016-03-02 03:35:00 AM { 0, 0x6a, 0, 148, 0}, { 0, 0x78, 302, 148, 0}, { 0, 0x78, 73, 148, 0}, { 0, 0x78, 0, 148, 0}, { 0, 0x78, 1155, 149, 0}, { 0, 0x77, 0, 148, 0}, { 0, 0x68, 1171, 148, 0}, { 0, 0x69, 0, 1...
{ 0, 0x55, 402, 146, 0}, { 0, 0x55, 28, 146, 0}, { 16, 0x53, 5328, 160, 0}, { 13, 0x53, 5607, 146, 0}, { 15, 0x54, 1394, 146, 0}, { 0, 0x34, 0, 146, 0}, { 0, 0x34, 0, 147, 0}, { 0, 0x34, 200, 143, 0}, { 0, 0x34, 0, 147, 0}, { 0, 0x34, 1, 147, 0}, { 0, 0x34, 0, 147, 0}, {...
if (prv_activity_sessions_equal(session, stored_session, true /*any_sleep*/)) { state->activity_sessions[i] = *session; goto unlock; } } // If no more room, fail if (state->activity_sessions_count >= ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT) { PBL_LOG(LOG_LEVEL_WARNING, "No mor...
if (activity_sessions_prv_is_sleep_activity(session->type)) { dls_record.sleep_data = session->sleep_data; } else { dls_record.step_data = session->step_data; }
if (state->activity_dls_session == NULL) { // We don't need to be buffered since we are logging from the KernelBG task and this // saves having to allocate another buffer from the kernel heap. const bool buffered = false; const bool resume = false; Uuid system_uuid = UUID_SYSTEM; state->acti...
ctures typedef struct { Window window; TextLayer percent_done_text_layer; char percent_done_text_buffer[5]; //<! Text for progress percentage label, format %02d%% SimpleDialog finished_dialog; ProgressLayer progress_layer; AppTimer *timer; unsigned int percent_complete; ProgressUISource progress_source...
{ i18n_free_all(data); app_timer_cancel(data->timer); app_free(data); }
} static void prv_window_load_handler(Window* window) { ProgressUIData *data = window_get_user_data(window); const ProgressUIAppArgs* app_args = app_manager_get_task_context()->args; data->progress_source = app_args->progress_source; simple_dialog_init(&data->finished_dialog, "Update Completed Dialog"); d...
// PBL-24741 as an example DiscoveryJobQueue *new_job = connection->discovery_jobs; if (!new_job) { return; // nothing to do } if ((new_job->hdl.start == MIN_ATT_HANDLE) && (new_job->hdl.end == MAX_ATT_HANDLE)) { // we are rediscovering all services so flush everything prv_free_service_nodes(conne...
conn_mgr_set_ble_conn_response_time(connection, BtConsumerLeServiceDiscovery, ResponseTimeMin, 30)
; prv_add_discovery_job(connection, NULL); // if we get here there is no discovery in progress so dispatch the job ret_val = prv_run_next_job(connection); } unlock: bt_unlock(); return ret_val; } //! extern for gap_le_connnection.c //! Cleans up any state and frees the associated memory of all the th...
w_data, new_positive, new_negative); } return true; } bool bma255_selftest(void) { // calling selftest_axis resets the device bool pass = true; pass &= prv_selftest_axis(BMA255Axis_X); pass &= prv_selftest_axis(BMA255Axis_Y); pass &= prv_selftest_axis(BMA255Axis_Z); // g-range should be 4g to copy th...
accel_run_selftest()
; char *response = (success) ? "Pass" : "Fail"; prompt_send_response(response); } void command_accel_softreset(void) { prv_soft_reset(); }
/* Animated */); } // ------------------------------------------------------------------------------- static void steps_down_long_click_handler(ClickRecognizerRef recognizer, void *context) { HealthAPITestAppData *data = (HealthAPITestAppData *)context; window_stack_push(data->debug_window, true /* Animated */);...
graphics_context_set_stroke_color(ctx, GColorJaegerGreen)
; graphics_context_set_fill_color(ctx, GColorJaegerGreen); graphics_fill_radial(ctx, bounds, GOvalScaleModeFitCircle, 15, 0, TRIG_MAX_ANGLE * percent / 100); } // ------------------------------------------------------------------------------- static void handle_battery(BatteryChargeState charge_state) { layer_m...
/* * 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...
applib_free(gpath)
; } static GPoint rotate_offset_point(const GPoint *orig, int32_t rotation, const GPoint *offset) { int32_t cosine = cos_lookup(rotation); int32_t sine = sin_lookup(rotation); GPoint result; result.x = (int32_t)orig->x * cosine / TRIG_MAX_RATIO - (int32_t)orig->y * sine / TRIG_MAX_RATIO + offset->x; result.y...
t8_t stroke_width) {} // mocks static MockCallRecordings s_graphics_line_draw_precise_stroked; void graphics_line_draw_precise_stroked(GContext* ctx, GPointPrecise p0, GPointPrecise p1) { record_mock_call(s_graphics_line_draw_precise_stroked) { .ctx = ctx, .pp0 = p0, .pp1 = p1, }; } void graphics_draw_line(...
(s_graphics_api)
; prv_create_global_ctx(); EXECUTE_SCRIPT( "ctx.beginPath();\n" "ctx.moveTo(1, 2);\n" "ctx.lineTo(3.5, -4.5);\n" "ctx.stroke();\n" ); cl_assert_equal_i(1, s_graphics_line_draw_precise_stroked.call_count); cl_assert_equal_point_precise(PP(0.5, 1.5), s_graphics_line_draw_precise_stroked.last_...
/* * 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_prev_send_data, data, data_length)
u_state_is_thread_privileged()) { // We're hosed! We can't recover so just reboot everything. RebootReason reason = { .code = RebootReasonCode_StackOverflow, .data8[0] = task }; reboot_reason_set(&reason); reset_due_to_software_failure(); return; } // We got this! Let's redirect this task to a ...
{ // Grab the stack pointer, shove it into a register and call // the c function above. __asm("tst lr, #4\n" "ite eq\n" "mrseq r0, msp\n" "mrsne r0, psp\n" "mov r1, lr\n" "b %0\n" :: "i" (mem_manage_handler_c)); }
bscriptions_handle_server_notification(s_connection, s_handle, value, fill_entirely_size); prv_assert_notification_event_ext(characteristic, value, fill_entirely_size, false /* kernel */, true /* app */, false /* should_consume...
cl_assert_equal_i(next_length, 0)
; cl_assert_equal_b(has_more, false); } void test_gatt_client_subscriptions__notification_consume_without_notification(void) { BLECharacteristic characteristic = prv_get_indicatable_characteristic(); uint16_t value_length; GATTBufferedNotificationHeader header = { .characteristic = BLE_CHARACTERISTIC_INVA...
mestamp, end_time); } else if (time_util_get_midnight_of(end_time) == current_day) { // last day of multiday event prv_copy_relative_time_string(number_buffer, number_buffer_size, word_buffer, word_buffer_size, end_time, end_time); } else { // middle day of non-all day multiday event prv_get...
{ const time_t now = rtc_get_time(); const time_t midnight = time_util_get_midnight_of(timestamp); const time_t today_midnight = time_util_get_midnight_of(now); if (midnight == today_midnight) { i18n_get_with_buffer("Today", buffer, buf_size); } else if (midnight == (today_midnight - SECONDS_PER_DAY)) {...
e accessory in ms before trying again static const uint32_t ACCESSORY_ACQUIRE_INTERVAL = 5000; //! The backoff before trying to detect a smartstrap again in ms static const uint32_t DETECTION_BACKOFF = 200; //! The maximum interval between detection attempts in ms static const uint32_t DETECTION_MAX_INTERVAL = 10000; /...
bool did_send = false; if (smartstrap_profiles_send_control()) { did_send = true; } else if (smartstrap_attribute_send_pending()) { did_send = true; } if (did_send && smartstrap_fsm_state_get() == SmartstrapStateReadReady) { if (accessory_bus_contention_detected()) { // The...
static void prv_monitor_timer_cb(void *context) { // we need to run from KernelBG so schedule a callback system_task_add_callback(prv_monitor_system_task_cb, NULL); } void smartstrap_connection_kick_monitor(void) { // queue up the system task immediately prv_monitor_timer_cb(NULL); } void smartstrap_connect...