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...
i18n_noop("Timing")
; const int selected = prv_before_time_min_to_index(timeline_peek_prefs_get_before_time()); const OptionMenuCallbacks callbacks = { .select = prv_before_time_menu_select, }; settings_option_menu_push( title, OptionMenuContentType_SingleLine, selected, &callbacks, ARRAY_LENGTH(s_before_time_strin...
{ -192, -24, -976}, { -200, -16, -984}, { -192, -24, -984}, { -160, -48, -1000}, { -176, -40, -1000}, { -192, -24, -992}, { -184, -32, -992}, { -200, -24, -992}, { -200, -24, -1016}, { -184, -32, -984}, { -192, -16, -984}, { -192, -16, -976}, { -168, -32, -968}, { -1...
{ -200, -32, -984}, { -200, -32, -992}, { -200, -32, -992}, { -192, -16, -1000}, { -200, -16, -1000}, { -200, -40, -984}, { -200, -8, -984}, { -200, -8, -984}, { -200, -16, -992}, { -200, -16, -992}, { -200, -24, -992}, { -200, -16, -984}, { -208, -16, -960}, { -2...
{ -200, -24, -984}, { -192, -32, -992}, { -224, -48, -968}, { -224, -40, -976}, { -216, -24, -976}, { -200, -8, -984}, { -192, -24, -992}, { -184, -40, -1008}, { -192, -48, -992}, { -200, -32, -976}, { -200, -16, -1000}, { -192, -16, -992}, { -208, -16, -984}, { ...
ent/process_manager.h" #include "services/common/new_timer/new_timer.h" #include "services/common/system_task.h" #include "services/normal/accessory/smartstrap_attribute.h" #include "services/normal/accessory/smartstrap_comms.h" #include "services/normal/accessory/smartstrap_connection.h" #include "services/normal/acce...
if ((current_state == SmartstrapAttributeStateWritePending) && (new_state == SmartstrapAttributeStateRequestPending)) { return pebble_task_get_current() == CONSUMER_TASK; } else if ((current_state == SmartstrapAttributeStateWritePending) && (new_state == SmartstrapAttributeStateIdle)) { ...
} static void prv_set_attribute_state(SmartstrapAttributeInternal *attr, SmartstrapAttributeState new_state) { PBL_ASSERTN(prv_is_valid_fsm_transition(attr, new_state)); attr->state = new_state; } //! Note; This should only be called from the consumer task static bool prv_star...
ndif } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Click handlers void prv_up_down_click_handler(ClickRecognizerRef recognizer, void *context) { SelectionLayer *selection_layer = (SelectionLayer*) context; bool is_up = (click_recognizer_get_button_id(reco...
selection_layer_deinit(selection_layer)
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 "graphics.h" #include "bitblt.h" #include "bitblt_private.h" #include "framebuffer.h" #include "graphic...
{ if ((clipped_rect.origin.y == (rect.origin.y + rect.size.h) - radius) && (corner_mask & GCornersBottom)) { if (corner_mask & GCornerBottomLeft) { corner_insets_left = round_bottom_corner_lookup[radius]; } if (corner_mask & GCornerBottomRight) { corner_insets_right = round_bottom...
} //! Return the maximum rounded corner radius allowed for a given rectangle size T_STATIC uint16_t prv_clamp_corner_radius(GSize size, GCornerMask corner_mask, uint16_t radius) { if (corner_mask == GCornerNone) { return 0; } int16_t min_size = MIN(size.w, size.h); if (min_size >= 2 * radius) { retu...
* prv_find_node_with_install_id(const AppInstallId install_id, const AppMenuDataSource * const source); static void prv_unload_node(const AppMenuDataSource *source, AppMenuNode *node); //////////////////////////////// // List helper functions ////////////////////////////...
{ menu_node->storage_order = new_storage_order; if (!update_and_take_ownership) { break; } else { continue; } }
if (update_and_take_ownership) { AppMenuNode *other_node = prv_find_node_with_install_id(storage_app_id, source); if (other_node) { other_node->storage_order = new_storage_order; } } } if (update_and_take_ownership) { app_free(storage); } } static void prv_sorted_add(AppMe...
history_mutex); mutex_lock(s_vibe_history_mutex); VibeHistory *node = s_vibe_history; while (node) { if (node->time_end == END_NOT_SET && time_search >= node->time_start) { rc = true; break; } if (time_search >= node->time_start && time_search <= node->time_end) { rc = true; br...
(false /* on */)
x_y(&label_text_container) - (fade_height + VERTICAL_PADDING); graphics_draw_bitmap_in_rect(ctx, &aml->item_animation.fade_bottom, &bottom_bounds); } #endif } static void prv_draw_row(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *callba...
{ ActionMenuLayer *aml = (ActionMenuLayer *)context; const int16_t line_height = fonts_get_font_height(aml->layout_cache.font); // If we have short items, just return the line height. if (prv_aml_is_short(aml)) { return line_height; } #if PBL_ROUND return menu_layer_is_index_selected(menu_layer, cell_i...
static int16_t prv_get_separator_height_cb(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) { // We use the separator to pad the cells (insert spacing), so we compute the height // needed for each separator here. ActionMenuLayer *aml = callb...
it_utc) { deep_exit_utc = session_exit_utc; } } } // Fill in the rest of the sleep data metrics if (enter_utc != 0) { results->start_at.value = (enter_utc - test_start_utc) / SECONDS_PER_MINUTE; } if (exit_utc != 0) { results->end_at.value = (exit_utc - test_start_utc) / SECONDS_PER...
{ // Convert from the old compressed VMC to the new uncompressed one vmc = vmc * vmc * 1850 / 1250; }
; if (key_len > SETTINGS_KEY_MAX_LEN) { return E_RANGE; } if (val_len > SETTINGS_VAL_MAX_LEN) { return E_RANGE; } const bool is_delete = (val_len == 0); const int rec_size = sizeof(SettingsRecordHeader) + key_len + val_len; if (!is_delete && file->used_space + rec_size > file->max_used_space) { ...
{ continue; }
--------------------------------------------------------------------------------- // Return the index of the step averages slot that contains the given minute static uint16_t prv_step_avg_slot(int hour, int min) { int minutes = hour * MINUTES_PER_HOUR + min; return minutes / (MINUTES_PER_DAY / ACTIVITY_NUM_METRIC_A...
(180, 0, ActivitySleepStateLightSleep)
; // Wait long enough for our recompute sleep logic to run. prv_feed_cannned_accel_data(SECONDS_PER_MINUTE * ACTIVITY_SESSION_UPDATE_MIN, 0, ActivitySleepStateAwake); // Make sure they are what we expected prv_assert_known_settings(); // Extract activity settings file from PF...
ffer in case it's in the padding at the end of context // and there happens to be garbage there (which happens sometimes for clang in unit tests) ((char *)context->buffer)[0] = '\0'; text_node->text.text = context->buffer; } prv_set_text_node_text_parameters_from_config(&text_node->text, layou...
(config->paragraph_style_font, config->size)
, .line_spacing_delta = -2, .extent.margin.h = 17, }; GTextNodeVertical *vertical_node = graphics_text_node_create_vertical(num_headings * 2); for (unsigned int i = 0; i < num_headings; i++) { const char *heading = string_list_get_at(headings, i); const char *paragraph = string_list_get_at(parag...
/* * 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 (jerry_value_is_undefined(locale)) { return true; } // in the future, we could run a case-insenstive compare against app_get_system_locale() // but as we want apps to encourage to be i18n, there's no real point to // receive strings such as 'en-us'. We will ask them to always pass undefined instead ...
typedef enum { ToStringFormatUnsupported = 1 << 0, ToStringFormatLocaleTime = 1 << 1, ToStringFormatSecondNumeric = 1 << 2, ToStringFormatSecond2Digit = 1 << 3, ToStringFormatMinuteNumeric = 1 << 4, ToStringFormatMinute2Digit = 1 << 5, ToStringFormatHourNumeric = 1 << 6, ToStringFormatHour2Digit = 1 <...
e_register(AppOutboxServiceTagUnitTest, prv_message_handler, PebbleTask_KernelMain, s_consumer_data_length); } void test_app_outbox__register_twice_asserts(void) { prv_register(); cl_assert_passert(prv_register()); } void te...
fake_kernel_malloc_mark()
; prv_register(); app_outbox_send(s_test_data, s_test_data_length, test_app_outbox_sent_handler, s_expected_cb_ctx); cl_assert(s_last_message); app_outbox_service_unregister(AppOutboxServiceTagUnitTest); cl_assert_equal_i(s_num_app_outbox_events_sent, 1); assert_sent_cb_last_status(AppOu...
}; const Fixed_S16_3 y2_fixed = (Fixed_S16_3) { .integer = y2, .fraction = 4, }; prv_assign_vertical_line_raw(ctx, x, y1_fixed, y2_fixed, color); } void test_graphics_context_mask__apply_assign_vertical_line_raw(void) { prv_mask_apply_vline_test_pattern(prv_vline_pattern_apply_assign_vertical_line);...
(!graphics_context_mask_use(NULL, NULL))
; // Should start with default draw implementation cl_assert_equal_p(ctx->draw_state.draw_implementation, &g_default_draw_implementation); GDrawMask *mask1 = graphics_context_mask_create(ctx, true /* transparent */); cl_assert(mask1); cl_assert(graphics_context_mask_use(ctx, mask1)); // Should still be on...
ECUTE_SCRIPT(test_object); ASSERT_JS_GLOBAL_EQUALS_S("t", "object"); // ...which also has a method .on() EXECUTE_SCRIPT("var t = typeof _rocky.on"); ASSERT_JS_GLOBAL_EQUALS_S("t", "function"); /// ...which is an alias of .addEventListener() EXECUTE_SCRIPT("var a = (_rocky.on === _rocky.addEventListener);"...
{ static const RockyGlobalAPI *apis[] = {NULL}; rocky_global_init(apis); prv_add_event_listener_to_list("a", jerry_create_external_function(prv_listener_a1)); cl_assert_equal_b(true, rocky_global_has_event_handlers("a")); cl_assert_equal_b(false, rocky_global_has_event_handlers("b")); prv_add_event_liste...
void test_rocky_api_global__adds_listener_only_once(void) { static const RockyGlobalAPI *apis[] = {NULL}; rocky_global_init(apis); const jerry_value_t f = jerry_create_external_function(prv_listener_a1); prv_add_event_listener_to_list("a", f); prv_add_event_listener_to_list("a", f); cl_assert_equal_b(tru...
distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "util/trig.h" #include "util/math.h" #include <math.h> #in...
cl_assert_equal_i(dist, 3)
; } } void test_math__is_signed_macro(void) { cl_assert(IS_SIGNED((int)-1) == true); cl_assert(IS_SIGNED((unsigned int)1) == false); } void test_math__test_within_macro(void) { int16_t min; int16_t max; // Min and max are both positive //////////////////////////////// min = 5; max = 10; // Min a...
gpio_output_set(&BOARD_CONFIG_POWER.rail_6V6_ctrl, enabled)
; }
animation_h, false /*quiet*/); if (!animation) { return NULL; } return animation->context; } // ------------------------------------------------------------------------------------------- bool animation_set_delay(Animation *animation_h, uint32_t delay_ms) { AnimationState *state = prv_animation_state_get(P...
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_set_curve((AnimationLegacy2 *)animation_h, curve); return true; }
glance, set its service field if (glance) { glance->service = service; } return glance; } static LauncherAppGlanceCacheEntry *prv_find_glance_entry_in_cache( LauncherAppGlanceService *service, Uuid *uuid) { return (LauncherAppGlanceCacheEntry *)list_find(service->glance_cache, ...
(&service->glance_reel_player)
; } void launcher_app_glance_service_pause_current_glance(LauncherAppGlanceService *service) { if (!service) { return; } kino_player_pause(&service->glance_reel_player); } void launcher_app_glance_service_play_current_glance(LauncherAppGlanceService *service) { if (!service) { return; } kino_playe...
ffer.h" #include "util/list.h" #include "stubs_bt_lock.h" #include "stubs_hexdump.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "fake_session.h" #include "fake_system_task.h" #include "fake_new_timer.h" extern void audio_endpoint_protocol_msg_callback(CommSession *session, ...
malloc(sizeof(StopTransferMsg))
; msg->msg_id = MsgIdStopTransfer; msg->session_id = s_session_id; audio_endpoint_protocol_msg_callback(s_session, (uint8_t *)msg, sizeof(StopTransferMsg)); fake_system_task_callbacks_invoke_pending(); free(msg); } void test_audio_endpoint__cleanup(void) { fake_comm_session_cleanup(); fake_system_task_ca...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(bitmap, TEST_PBI_FILE_FMT(1bitpalette))
); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat1BitPalette); } // Tests 2-bit transparent palettized PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__color_2_bit_transparent(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(2bitpalette)); cl_as...
t_user_data((Window*) anim_ctx->window); if (!data || !finished) { // We could have gotten cleaned up in the middle of an animation, bail applib_free(anim_ctx); return; } if (data->view_model.cur_level->parent_level == anim_ctx->next_level) { --data->view_model.num_dots; } else { ++data->vi...
{ animation_set_elapsed(data->level_change_anim, animation_get_duration(data->level_change_anim, true, true)); }
ActionMenuLevel *parent_level = data->view_model.cur_level->parent_level; if (parent_level) { prv_set_level(data, parent_level); } else { prv_action_window_pop(true, &data->action_menu); } } static void prv_click_config_provider(void *context) { ActionMenuData *data = context; action_menu_layer_c...
dataPlatformPebbleTwoPointZero, #elif defined(BOARD_V1_5) .hw_platform = FirmwareMetadataPlatformPebbleOnePointFive, #elif defined(BOARD_EV2_4) .hw_platform = FirmwareMetadataPlatformPebbleOneEV2_4, #else .hw_platform = FirmwareMetadataPlatformUnknown, #endif .metadata_version = FW_METADATA_CURRENT_STRUCT_VERS...
version_copy_update_fw_metadata(&update_meta_data)
; int rv = prv_version_compare_fw_version_tags(update_meta_data.version_tag, running_meta_data.version_tag); // return true is the new firmware to be updated to is a version less than the old one. return (rv < 0); }
chunk(void) { uint32_t addr = get_current_address(s_current_chunk, 0); PBL_ASSERT((addr & (SUBSECTOR_SIZE_BYTES - 1)) == 0, "Sections must be subsector aligned! addr is 0x%" PRIx32, addr); PBL_ASSERT((CHUNK_SIZE_BYTES & (SUBSECTOR_SIZE_BYTES - 1)) == 0, "Sections divide into subsectors evenly, size is...
(generation, i, 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...
strncpy(data.model, model, sizeof(data.model))
; data.model[MFG_INFO_MODEL_STRING_LENGTH - 1] = '\0'; prv_update_struct(&data); } GPoint mfg_info_get_disp_offsets(void) { // Not implemented. Can just assume no offset return (GPoint) {}; } void mfg_info_set_disp_offsets(GPoint p) { // Not implemented. } void mfg_info_update_constant_data(void) { if (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...
{ AppFocusHandlers handlers = (AppFocusHandlers) { .will_focus = handler }; app_focus_service_subscribe_handlers(handlers); }
void app_focus_service_unsubscribe(void) { AppFocusState *state = app_state_get_app_focus_state(); if (state->handlers.will_focus) { event_service_client_unsubscribe(&state->will_focus_info); } if (state->handlers.did_focus) { event_service_client_unsubscribe(&state->did_focus_info); } state->hand...
-520}, { -392, 1280, -1216}, { 712, 2296, -1272}, { 840, 2112, -1184}, { 1048, 1584, -784}, { 472, 656, -184}, { 256, 368, -96}, { 280, 200, -32}, { 328, -128, 80}, { 280, -104, 184}, { 248, -208, 320}, { 504, 184, 360}, { 1640, 3792, 16}, { 800, 1912, 280}, { 10...
{ 496, 2264, 712}, { 464, 1376, 352}, { 304, 672, 200}, { 352, 112, 24}, { 416, -240, 88}, { 552, -560, 328}, { 712, -328, 160}, { 1096, 1768, 976}, { 688, 3016, 408}, { 160, 1936, 72}, // 8 seconds { -288, 1136, -80}, { -272, 480, -96}, { -408, 104, -168}, { ...
{ -200, 3032, 640}, { 296, 2288, 896}, { 488, 1648, 424}, { 456, 960, 256}, { 464, 328, 136}, { 376, -168, 168}, { 664, -368, 176}, { 504, -416, 192}, { 832, 680, 648}, { 400, 3384, 616}, { 224, 1968, 248}, { -144, 1568, -32}, { -296, 800, -16}, { -552, 120, 8}, ...
/* * 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...
("In DIS service discovery CB")
; PBL_ASSERTN(characteristics); ancs_handle_ios9_or_newer_detected(); }
KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "settings_activity_tracker.h" #include "settings_menu.h" #include "settings_window.h" #include "applib/app.h" #include "applib/app_timer.h" #include "applib/ui/kino/k...
if (worker_manager_get_task_context()->install_id != app_node->install_id) { // Undo the choice change that the OptionMenu does before we call select. We may decline // the change and therefore we don't want it to visually update yet. prv_worker_launch_handler // will update the choice if it fires. ...
} } static void prv_draw_no_activities_cell_rect(GContext *ctx, const Layer *cell_layer, const char *no_activities_string) { const GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD); GRect box = cell_layer->bounds; const GTextOverflowMode overflow = GText...
/* * 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...
host_transport_tx_enqueue((const uint8_t *)message, message->message_length)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ EventServiceInfo *info = app_state_get_app_outbox_subscription_info(); *info = (EventServiceInfo) { .type = PEBBLE_APP_OUTBOX_SENT_EVENT, .handler = prv_handle_event, }; event_service_client_subscribe(info); }
0}, { 1104, 304, 96}, { 1088, 176, 104}, { 1224, 104, 152}, { 1080, 72, 176}, // 52 seconds { 888, 112, 88}, { 824, 32, 128}, { 808, 56, 88}, { 760, 16, 96}, { 744, -8, 120}, { 848, 8, 48}, { 960, 40, -16}, { 1008, 96, -176}, { 1600, -144, 40}, { 1528, -72, 10...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-09-29 15:11:30 local AccelRawData *activity_sample_walk_100_pbl_25296_3(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25296_3 //> TEST...
/* * 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_cache_entry_exists(args->new_worker_id)
) { // If an app cache entry does not exist for the new worker, then we will have to // fetch the application. Since this will prompt the user to confirm activity tracking // for the worker because the previous worker is still running, we have to kill the // previous worker here. process_...
recover after reset bus_unlock(bus); return false; } } // Take binary semaphore so that next take will block PBL_ASSERT(semaphore_take(bus), "Could not acquire semaphore token"); // Set up transfer bus->transfer.device_address = device_address; bus->transfer.register_address = register_ad...
(LOG_LEVEL_ERROR, "Write failed on bus %" PRId8, BOARD_CONFIG.i2c_device_map[device_id])
lementation; } // ------------------------------------------------------------------------------------------- void *animation_get_context(Animation *animation_h) { if (animation_private_using_legacy_2(NULL)) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled...
if (!animation) { return 0; }
return prv_get_total_duration(state, animation, include_delay, include_play_count); } // ------------------------------------------------------------------------------------------- bool animation_set_curve(Animation *animation_h, AnimationCurve curve) { AnimationState *state = prv_animation_state_get(PebbleTask...
ssert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0); // Complete B prv_advance_to_ms_with_timers(start_ms + duration_total + 5 *...
(a, duration_a)
; Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_play_count(b, play_count_b); // Create a sequence out of them. Animation *seq = animation_sequence_create(a, b, NULL); cl_assert(seq != NULL); // Create a shorter animation to play in parallel Animatio...
metric_values.out.history[0] = 123; bool success = health_service_private_get_yesterdays_sleep_activity(&start_sec, &end_sec); cl_assert(success); cl_assert_equal_i(123, start_sec); cl_assert_equal_i(123, end_sec); cl_assert_equal_i(1, s_sys_activity_get_metric_values.in.history_len); cl_assert_equal_i(Acti...
(result, 2 *exp_weekly)
CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_color, GPointZero, DEG_TO_TRIGANGLE(0), GPoint(20, 20)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_color_0.Xbit.pbi")); // Top-left corner rotation point, Angle 45 ...
(&ctx->dest_bitmap, "draw_rotated_bitmap_stamp_45deg.Xbit.pbi")
); // Top-left corner rotation point, Angle 180 setup_test_rotate_bitmap(ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(ctx, test_image, GPoint(71, 71), DEG_TO_TRIGANGLE(180), center); cl_check(gbitmap_pbi_eq(&ctx->dest_bitmap, "dr...
RCC_AHB3PeriphResetCmd(ahb3_periphs, ENABLE); RCC_AHB3PeriphResetCmd(ahb3_periphs, DISABLE); RCC_APB1PeriphResetCmd(apb1_periphs, ENABLE); RCC_APB1PeriphResetCmd(apb1_periphs, DISABLE); RCC_APB2PeriphResetCmd(apb2_periphs, ENABLE); RCC_APB2PeriphResetCmd(apb2_periphs, DISABLE); } static void __attribute__((...
dbgserial_putstr("Failed to start firmware, strike three.")
errupts(bus); // Generate a stop condition bus->hal->i2c->CR2 |= I2C_CR2_STOP; } void i2c_hal_init_transfer(I2CBus *bus) { I2CTransfer *transfer = &bus->state->transfer; if (transfer->type == I2CTransferType_SendRegisterAddress) { transfer->state = I2CTransferState_WriteRegAddress; } else { if (tran...
prv_resume_transfer(bus, false /* !generate_start */)
; } if ((i2c->ISR & I2C_ISR_TC) != 0) { prv_end_transfer_irq(bus, I2CTransferEvent_TransferComplete); return; } break; case I2CTransferState_WriteData: if ((i2c->ISR & I2C_ISR_TXIS) != 0) { i2c->TXDR = transfer->data[transfer->idx++]; } if ((i2c->IS...
lude "services/common/i18n/i18n.h" #include "services/normal/blob_db/ios_notif_pref_db.h" #include "services/normal/blob_db/pin_db.h" #include "services/normal/blob_db/reminder_db.h" #include "services/normal/notifications/notification_storage.h" #include "services/normal/notifications/notifications.h" #include "servic...
(timestamp, reminder_title_buffer, prv_reminder_filter, &reminder)
) { ancs_item_update_dismiss_action(&reminder, uid, attr_action_neg); // Overwrite the existing item and notify system that reminder was updated reminder_db_insert_item(&reminder); timeline_item_free_allocated_buffer(&reminder); return true; } return false; } static bool prv_find_existing_noti...
(0xcafebabe)
; delay_us(200000); display_error_code(0xfeedface); delay_us(200000); display_error_code(0x8badf00d); delay_us(200000); display_error_code(0xbad1ce40); delay_us(200000); display_error_code(0xbeefcace); delay_us(200000); display_error_code(0x0defaced); delay_us(200000); di...
&bpm, &hr_zone)); cl_assert_equal_i(bpm, 100); // Put an OffWrist reading. Verify we received it. prv_put_bpm_event(50, HRMQuality_OffWrist); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_...
cl_assert(workout_service_start_workout(ActivitySessionType_Run))
emActionGroup *action_group) { s_performed_store = true; if (s_expected_attributes) { const int buf_size = 256; uint8_t expected_buf[buf_size]; uint8_t actual_buf[buf_size]; attributes_actions_serialize_payload(s_expected_attributes, s_expected_actions, expec...
cl_assert(s_performed_store)
gs_file, prv_enumerate_entries, &cb_data); prv_close_file_and_unlock_mutex(); kernel_free(db_entry); return; } ///////////////////////// // Blob DB API ///////////////////////// void app_db_init(void) { memset(&s_app_db, 0, sizeof(s_app_db)); s_app_db.mutex = mutex_create(); // set to zero to reset unit...
prv_close_file_and_unlock_mutex()
; if (rv == S_SUCCESS) { // uuid will be free'd by app_install_manager Uuid *uuid_copy = kernel_malloc_check(sizeof(Uuid)); memcpy(uuid_copy, key, sizeof(Uuid)); app_install_do_callbacks(APP_REMOVED, app_id, uuid_copy, NULL, NULL); } return rv; } status_t app_db_flush(void) { PBL_LOG(LOG_LEVE...
client_id_payload = (PPoGATTResetRequestClientIDPayload *) packet->payload; *client_id_payload = (const PPoGATTResetRequestClientIDPayload) { .ppogatt_version = client->version, }; memcpy(client_id_payload->serial_number, mfg_get_serial_number(), sizeof(client_id_payload->serial_n...
PBL_ASSERTN(read_space >= offset)
; payload_size = read_space - offset; if (payload_size == 0) { // No data to send return NULL; } // Cap to the size that the GATT MTU allows: payload_size = MIN(payload_size, max_payload_size); } PPoGATTPacket *packet = prv_lazily_allocate_packet_if_needed(client, heap_packet_in_o...
true); fake_app_timer_deinit(); kernel_free(s_sent_data); s_sent_data = NULL; } // Test OUTBOUND (watch->phone): //////////////////////////////////// static void prv_send_test_data_expecting_result(AppMessageResult result) { DictionaryIterator *iter; cl_assert_equal_i(app_message_outbox_begin(&iter), APP_M...
cl_assert_equal_b(app_message_is_accepting_outbound(), true)
; } void test_app_message__nack_then_outbox_sent(void) { // Sending ack on timeout, but reject the send prv_set_remote_receive_handler(prv_nack_sent_callback); prv_send_test_data(); prv_process_sent_data(); cl_assert_equal_b(app_message_is_accepting_outbound(), false); prv_call_outbox_sent(AppOutboxStatus...
(void) { prv_insert_extra_case_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast, s_feb_5_midnight + 8 * 60 * 60 + 16 * 60), 0); #if !CAPABILITY_HAS_...
uuid_equal(&state.pin.header.id, &s_items[5].header.id)
); cl_assert(iter_prev(&iterator)); cl_assert(!iter_prev(&iterator)); cl_assert(state.node); timeline_iter_deinit(&iterator, &state, &head); } void test_timeline__delete_last_items(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_as...
/* * 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 (!new_timer_stop(s_reminder_timer)) { PBL_LOG(LOG_LEVEL_DEBUG, "Updated timer while callback running."); return S_SUCCESS; }
TimelineItem item = {{{0}}}; status_t rv = reminder_db_next_item_header(&item); if (rv == S_NO_MORE_ITEMS) { PBL_LOG(LOG_LEVEL_DEBUG, "No more reminders to add to queue."); return S_SUCCESS; } else if (rv) { return rv; } rv = prv_set_timer(&item); if (rv) { return E_ERROR; } return ...
/* * 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...
(thumbsup_layer, &(GRect){{0, 1 * (size.h / 3)}, {size.w, 50}})
; text_layer_set_font(thumbsup_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28)); text_layer_set_text_alignment(thumbsup_layer, GTextAlignmentCenter); layer_add_child(&window->layer, (Layer *)thumbsup_layer); TextLayer *text_layer = &data->text_layer; text_layer_init(text_layer, &(GRect){{0, 2 * (size.h / 3)...
sh.h" #include "fake_system_task.h" #include "fake_kernel_services_notifications.h" // Stubs //////////////////////////////////////////////////////////////// #include "stubs_analytics.h" #include "stubs_hexdump.h" #include "stubs_layout_layer.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passe...
(WEATHER_KEY, WEATHER_KEY_LEN, weather_prefs_out, data_len)
imelineAppStyle s_style_large = { .peek_offset_y = -7, .peek_icon_offset_y = -16, }; static const TimelineAppStyle * const s_styles[NumPreferredContentSizes] = { [PreferredContentSizeSmall] = &s_style_medium, [PreferredContentSizeMedium] = &s_style_medium, [PreferredContentSizeLarge] = &s_style_large, [Pre...
compositor_dot_transition_timeline_get(is_future, to_timeline)
); #endif watchface_launch_default(transition); #endif } static void prv_cleanup_timer(EventedTimerID *timer) { if (evented_timer_exists(*timer)) { evented_timer_cancel(*timer); *timer = EVENTED_TIMER_INVALID_ID; } } static void prv_exit_timer_callback(void *context) { TimelineAppData *data = context...
(T-13:59:59) rtc_set_time(event_time - (14 * SECONDS_PER_HOUR) + 1); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s(" 2:00 PM", time_buf); // June 10th 2015, 12:59:59 (T-01:00:01) rtc_set_time(event_time - (1 * SECONDS_PER_HOUR) - 1); clock_ge...
{ char time_buf[64]; const int jun10th_noon_2015 = 1433937600; prv_clock_reset(0); rtc_set_time(jun10th_noon_2015); // Our test event is at June 12th 2015, 12:00 // Now + two days const int event_time = jun10th_noon_2015 + (2 * SECONDS_PER_DAY); // if the event is in 24 hours on the same day, then s...
rev_state == SmartstrapStateReadComplete) && (new_state == SmartstrapStateReadReady)) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); } else { // all other transitions are invalid WTF; } } bool smartstrap_fsm_state_test_and_set(SmartstrapState expected_state, SmartstrapState next_state) { ...
{ mutex_lock(s_state_lock); }
void smartstrap_state_unlock(void) { mutex_unlock(s_state_lock); } void smartstrap_state_assert_locked_by_current_task(void) { mutex_assert_held_by_curr_task(s_state_lock, true); }
_system_task_callbacks_invoke_pending(); HRMSessionRef session_ref_2 = hrm_manager_subscribe_with_callback(INSTALL_ID_INVALID, 1, expire_s, HRMFeature_BPM, prv_fake_hrm_2_cb, NULL); fa...
memcmp(&event[i], &out_event[i], sizeof(PebbleHRMEvent))
, false); } } { // Test reading back unaligned for (int i = 0; i < NUM_TEST_EVENTS; ++i) { circular_buffer_write(&cb, (const uint8_t *)&event[i], sizeof(PebbleHRMEvent)); } PebbleHRMEvent out_event[NUM_TEST_EVENTS]; for (int i = 0; i < NUM_TEST_EVENTS; ++i) { prv_read_event_from_buff...
out of sync"); goto exit; } // Invalidate the chunk, now that we have consumed it chunk_hdr.valid = false; if (!prv_pfs_seek(logging_session->storage.fd, logging_session->storage.read_offset, FSeekSet)) { consumed_bytes = -1; // error goto exit...
dls_storage_consume(session, 0)
//////// void test_simple_dialog__watchface_crashed(void) { SimpleDialog *simple_dialog = simple_dialog_create("Watchface crashed"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); dialog_set_text(dialog, "Watchface is not responding"); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_WARNING_LARGE); di...
(msg, DISP_FRAME.size, icon_size, use_status_bar)
; PBL_IF_RECT_ELSE(cl_assert(!text_fits), cl_assert(text_fits)); msg = "This error is too long to fit on any display shape :("; text_fits = simple_dialog_does_text_fit(msg, DISP_FRAME.size, icon_size, use_status_bar); cl_assert(!text_fits); }
>duration_ms; } if (include_play_count) { // Factor in the play count of this animation now if (animation->play_count == ANIMATION_PLAY_COUNT_INFINITE_STORED) { duration = PLAY_DURATION_INFINITE; } else { duration *= animation->play_count; } } return duration; } // --------------...
{ return (animation && !animation->immutable && !animation->parent && !prv_animation_is_scheduled(state, animation)); }
// ------------------------------------------------------------------------------------------- // Determine if any of an animation's descendents are scheduled static bool prv_animation_children_scheduled(AnimationState *state, AnimationPrivate *animation) { if (animation->type != AnimationTypePrimitive) { // F...
nutes = (upper_bounded_end - lower_bounded_start) / SECONDS_PER_MINUTE; num_records = MIN(num_records, needed_partial_minutes); } const bool success = sys_activity_get_minute_history(minute_data, &num_records, time_start); if (!success) { return 0; } if (time_end) { *time_end = *time_start...
{ // clients can interrupt the iteration at any time break; }
} } #endif } // ---------------------------------------------------------------------------------------------- bool health_service_private_get_yesterdays_sleep_activity(HealthValue *enter_sec, HealthValue *exit_sec) { return sys_activity_get_metric...
ol messages can be allocated. For example, //! the Audio endpoint likes to send out a stream of small Pebble Protocol messages. We don't want //! to accidentally cut the max number when sizeof(SendBuffer) would increase for whatever reason. //! //! @note We leave it up to the caller of the exported comm_session_send_* ...
{ bt_lock_assert_held(true /* assert_is_held */); s_default_kernel_sender_bytes_allocated -= (sizeof(PebbleProtocolHeader) + sb->payload_buffer_length); kernel_free(sb); xSemaphoreGive(s_default_kernel_sender_write_semaphore); }
// ------------------------------------------------------------------------------------------------- // Interfaces towards Send Queue: static size_t prv_get_remaining_length(const SendBuffer *sb) { return (sizeof(PebbleProtocolHeader) + sb->written_length - sb->consumed_length); } static const uint8_t *prv_get_re...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(GColorRedARGB8, gcolor_closest_opaque((GColor8){.a= 3, .r = 3}).argb)
terState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, s_feb_5_midnight + 8 * SECONDS_PER_HOUR + 16 * SECONDS_PER_MINUTE), 0); #if CAPABILITY_HAS_CORE_NAVIGATION4 cl_assert(uuid_equal(&state.pin.head...
(&state.pin.header.id, &s_items[4].header.id)
); cl_assert(!iter_prev(&iterator)); timeline_iter_deinit(&iterator, &state, &head); } void test_timeline__skip_deleted_item(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, Ti...
/* * 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...
(__packed__)
) { uint32_t state; volatile p_size_t *addr; uint32_t length; } Header; static uint8_t prv_crc8(const uint8_t *data, uint32_t data_len) { uint8_t crc = 0; // nibble lookup table for (x^8 + x^5 + x^3 + x^2 + x + 1) static const uint8_t lookup_table[] = { 0, 47, 94, 113, 188, 147, 226, 205, 87, 120, 9, ...
ff, s_dest_bitmap->row_size_bytes * s_dest_bitmap->bounds.size.h); } void prv_prepare_fb_steps(GSize size) { prv_prepare_fb_steps_xy(size, NUM_STEPS, NUM_STEPS); } void test_graphics_draw_text_flow__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); ctx...
render_steps(&layout, RenderMoveDrawBox, DELTA, DISP_ROWS, NULL)
; // should result in the very same output as if you did a placement via text box cl_check(gbitmap_pbi_eq(s_dest_bitmap, "test_graphics_draw_text_flow__flow_no_paging.pbi")); } void test_graphics_draw_text_flow__with_origin_zero(void) { TextLayoutExtended layout = { .flow_data = { .perimeter.impl = &(G...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(dialog, GColorCobaltBlue)
ll 1 drop callback (same as before): assert_num_message_callbacks(3); assert_message(2, s_test_data, BUFFER_SIZE); assert_num_dropped_callbacks(1); } void test_app_inbox__multiple_writes_consume_from_message_handler(void) { prv_create_test_inbox_and_begin_write(); // Message 1: cl_assert_equal_b(true, a...
cl_assert_equal_b(false, app_inbox_service_end(AppInboxServiceTagUnitTest))
d while the steps were taken // @param[out] distance covered (in millimeters) uint32_t activity_private_compute_distance_mm(uint32_t steps, uint32_t ms) { if ((steps == 0) || (ms == 0)) { return 0; } // For a rough ballpack figure, according to // http://livehealthy.chron.com/determine-stride-pedometer-...
{ if ((distance_mm == 0) || (ms == 0)) { return 0; } uint64_t distance_mm_64 = distance_mm; uint64_t ms_64 = ms; // Figure out the rate and see if it's walking or running. We set the walking threshold at // 120 m/min. This is 2m/s or 2 mm/ms const unsigned int k_max_walking_rate_mm_per_min = 120 * M...
ion_storage_get_status(const Uuid *id, uint8_t *status) { int fd = prv_file_open(OP_FLAG_READ); bool rv = false; if (fd < 0) { return rv; } SerializedTimelineItemHeader header = { .common.id = UUID_INVALID }; if (prv_find_next_notification(&header, prv_uuid_equal_func, (void *) id, fd)) { *status =...
kernel_free(payload)
//! It seems that if we start hammering the iOS device with more change requests, things don't get //! better. This timeout value is empirically established using the "ble mode_monkey" prompt //! command. After running the "ble mode_monkey" for a couple hours, no re-requests had happened. #define REQUEST_TIMEOUT_MS (40...
prv_do_actual_params_match_desired_state(connection, state, &actual_connection_interval_ms)
) { return; } if (connection->param_update_info.attempts++ >= MAX_UPDATE_REQUEST_ATTEMPTS) { // [MT]: I've hit this once now. When this happened the TI CC2564B became unresponsive. // From the iOS side, it appeared as a connection timeout. A little while after this happened, // the BT chip auto-rese...
{ -216, 952, 136}, { -192, 904, 128}, { -152, 920, 120}, { -168, 888, 120}, { -200, 888, 184}, { -216, 936, 112}, { -224, 952, 136}, { -192, 904, 104}, { -224, 976, 80}, { -376, 1256, -16}, { -376, 1248, -64}, { -312, 1184, 24}, { -376, 1064, 32}, { -264, 624, -8}...
{ 1376, 584, -24}, { 784, 880, -296}, { 704, 672, -120}, { 736, 888, -128}, { 944, 576, -40}, { 1080, 552, -120}, { 1312, 528, -152}, { 1368, 344, -144}, { 1360, 320, -16}, { 1224, 328, -192}, { 1184, 280, -112}, { 1032, 224, -176}, { 912, 208, -184}, { 856, 184, ...
{ 1192, 192, -336}, { 1024, 304, -152}, { 712, 224, -216}, { 616, 288, -192}, { 768, 384, -104}, { 976, 504, -128}, // 135 seconds { 1344, 536, -144}, { 1096, 760, -56}, { 960, 480, -256}, { 880, 752, -104}, { 1272, 1192, 0}, { 1344, 288, 0}, { 1104, 696, -128}, ...
st version supporting timeline resources .sdk_version = {TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MAJOR, TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MINOR - 1}, }, .resource_lut = s_app_lut, }, { .install_entry = { .install_id = TimelineResourceTestAppId_Vali...
(!timeline_resources_get_id_system( (TimelineResourceId)TimelineResourceTestTimelineId_AlarmClock, TimelineResourceSizeTiny, TimelineResourceTestAppId_AppWithInvalidLUT, &res_info))
; // Calling the function for an invalid resource (e.g. dimensions too large) should return false s_is_app_published_resource_invalid = true; cl_assert(!timeline_resources_get_id_system( (TimelineResourceId)TimelineResourceTestTimelineId_AlarmClock, TimelineResourceSizeTiny, TimelineResourceTestAppId...
/* * 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...
(&ctx, radial_container_rect, GOvalScaleModeFillCircle, inset_thickness, 0, TRIG_MAX_ANGLE / 2)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("off_screen_right_aa_clipping"))); };
) { fake_GAPAPI_init(); // Register slave connection event callback for tests involving Pebble as slave: // This normally happens in gap_le_advert.c. Taking a shortcut to avoid dragging in more code. GAP_LE_Advertising_Enable(1, TRUE, NULL, NULL, gap_le_connect_bluetopia_connection_callback, 0); fake_event_i...
(registered, true)
e_Closing: case LinkState_Stopping: // Do nothing break; case LinkState_RequestSent: this->state->restart_count = MAX_CONFIGURE; // fallthrough case LinkState_AckReceived: case LinkState_Opened: PBL_LOG(LOG_LEVEL_WARNING, "Unexpected Configure-Nak/Rej received...
prv_transition_to(this, LinkState_Initial)
; break; case LinkState_Stopped: prv_transition_to(this, LinkState_Closed); break; case LinkState_RequestSent: case LinkState_AckReceived: case LinkState_AckSent: case LinkState_Opened: this->state->restart_count = MAX_TERMINATE; prv_send_terminate_request(this); ...
/* * 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...
{ const time_t oldest_valid_time_utc = time_start_of_today() - SECONDS_PER_DAY; return (update_time_utc < oldest_valid_time_utc); }
static bool prv_fill_forecast_from_entry(WeatherDBEntry *entry, WeatherLocationForecast *forecast_out) { PascalString16List pstring16_list; pstring_project_list_on_serialized_array(&pstring16_list, &entry->pstring16s); PascalString16 *location_pstring = pstring_get...
back(ClickRecognizerRef recognizer, void *context) { app_window_stack_pop_all(true); } static void prv_no_music_window_click_config(void *context) { window_single_click_subscribe(BUTTON_ID_BACK, prv_handle_no_music_back); } static MusicNoMusicWindow *prv_create_no_music_window(void) { MusicNoMusicWindow *window...
if (hours > 0) { snprintf(buffer, n, "%"PRIu32":%02"PRIu32":%02"PRIu32, hours, minutes, seconds); } else { snprintf(buffer, n, "%"PRIu32":%02"PRIu32, minutes, seconds); }
} static void prv_update_track_progress(MusicAppData *data) { if (data->pause_track_pos_updates) { return; } if (!music_is_progress_reporting_supported()) { progress_layer_set_progress(&data->track_pos_bar, 0); } else { unsigned int percent = MIN((data->track_pos * 100) / data->track_length, 100);...
, we will close out the current partially formed record and log it. static void prv_collect_raw_samples(AccelRawData *accel_data, uint32_t num_samples, bool finish) { ActivitySampleCollectionData *data = s_activity_state.sample_collection_data; // Create the data logging session...
(data->base64_buf, sizeof(data->base64_buf), binary_data, chunk_size)
; PBL_ASSERTN(num_chars + 1 < (int)sizeof(data->base64_buf)); pbl_log(LOG_LEVEL_INFO, __FILE_NAME__, __LINE__, "RAW: %s", data->base64_buf); num_chars = base64_encode(data->base64_buf, sizeof(data->base64_buf), binary_data + chunk_size, sizeof(data->record) - chunk_size...
nd_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 1); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r1_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 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_rmax2_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); // AA = false, SW = 11 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false,...
bitmap); const GRect *drawing_box = use_screen ? &DISP_FRAME : box; const GSize bitmap_size = drawing_box->size; s_dest_bitmap = gbitmap_create_blank(bitmap_size, GBITMAP_NATIVE_FORMAT); s_ctx.dest_bitmap = *s_dest_bitmap; s_ctx.draw_state.clip_box.size = bitmap_size; s_ctx.draw_state.drawing_box = *drawi...
prv_render_timeline_peek(&(TimelinePeekItemConfig) { .title = "Stock for party 🍺", .subtitle = "Pebble Pad on Park", .icon = TIMELINE_RESOURCE_NOTIFICATION_REMINDER, .num_concurrent = 2, })
; cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_timeline_peek__peek_concurrent_2_max(void) { prv_render_timeline_peek(&(TimelinePeekItemConfig) { .title = ":parrot: :parrot:", .subtitle = ":parrot: :parrot: :parrot:", .icon = TIMELINE_RESOURCE_GENERIC_CONFIRMATION, .num_concur...
t_rocky_api_graphics_path2d__cleanup(void) { fake_app_timer_deinit(); // Frees the internal path steps array (): rocky_api_graphics_path2d_reset_state(); // some tests deinitialize the engine, avoid double de-init if (app_state_get_rocky_runtime_context() != NULL) { jerry_cleanup(); rocky_runtime_co...
cl_assert_equal_point(GPoint(4, 5), lc->path.points[2])
; s_gpath_draw_filled.call_count = 0; EXECUTE_SCRIPT( "ctx.lineTo(11.5, 12.7);\n" "ctx.fill();\n" ); // still only the first part (before the .moveTo()) as the second only has two points cl_assert_equal_i(2, s_gpath_draw_filled.call_count); cl_assert_equal_i(3, lc->path.num_points); cl_assert_equ...
/* * 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...
(&data->text_layer_1, inset)
; const GSize max_size_1 = text_layer_get_content_size(app_state_get_graphics_context(), &data->text_layer_1); text_layer_set_size(&data->text_layer_1, GSize(scroll_bounds.size.w, max_size_1.h + padding)); // Initialize the second text layer text_layer_init(&data->text_layer_2, &GRect(0, 20 + max_size_1....
848, -136}, { 1352, 784, -192}, { 1704, 728, -168}, { 1760, 568, 0}, { 1464, 472, -120}, { 1112, 368, -152}, { 920, 264, -64}, { 848, 200, -80}, { 776, 168, -80}, { 776, 144, -88}, { 744, 80, -72}, { 792, -8, -56}, { 736, -32, -8}, { 952, 80, -24}, // 24 seconds ...
{ 1296, 424, -96}, { 1064, 344, -104}, { 928, 288, -96}, { 856, 224, -80}, { 768, 184, -64}, { 664, 136, -64}, { 704, 112, -64}, { 872, 32, -72}, { 1136, -24, -40}, { 1512, 104, 8}, { 1368, 272, -176}, { 1504, 304, -240}, { 1512, 272, -80}, { 1272, 344, -168}, ...
/* * 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...
{ ReminderId *item_id = (ReminderId *)data; // Mark that we are about to display the reminder if (!reminders_mark_has_reminded(item_id)) { return; } prv_put_reminder_event(item_id, ReminderTriggered); reminders_update_timer(); }
/); // Here we reuse rect as the icon frame rect.size = icon_frame_size; // Align the icon frame (which might have zero height) at the top center of the container grect_align(&rect, &container_rect, icon_align, true /* clip */); // Save the title origin y before re-purposing container_rect int title_text_...
if (!cell_layer_bounds) { return; }
const GSize icon_size = config->icon ? config->icon->bounds.size : GSizeZero; // Calculate the size used by the value or icon on the right // NOTE: If a value and icon is provided we only draw the value so we can re-use this function for // drawing "icon on right" and "value" GSize right_element_size; co...
nst time_t tomorrow_midnight = today_midnight + SECONDS_PER_DAY; return health_service_sum(metric, today_midnight, tomorrow_midnight); #endif } // ---------------------------------------------------------------------------------------------- HealthValue health_service_sum(HealthMetric metric, time_t time_start, tim...
if (!prv_metric_aggregation_implemented(metric, time_start, time_end, aggregation, scope)) { return 0; }
er, size_t buffer_size, int duration_s, void *i18n_owner) { int hours; int minutes; prv_convert_duration_to_hours_and_minutes(duration_s, &hours, &minutes); int pos = 0; if (hours != INT_MIN) { pos += snprintf(buffer + pos, buffer_size - pos, i18n_get("%dH", i18n_o...
i18n_get("%d", i18n_owner)
, minutes); GTextNodeText *minutes_units_text_node = health_util_create_text_node_with_text( i18n_get("M", i18n_owner), units_font, color, container); minutes_units_text_node->node.offset.y = units_offset_y; } } void health_util_convert_fraction_to_whole_and_decimal_part(int numerator, int denominat...
rt; uint32_t length; bool word_reads_only; // Some peripherals can only be read 32 bits at a // time, or you BusFault (maybe). Set this to true // for memory regions where reads smaller than 32 // bits will fail. The start p...
(ctx, buffer)
; pulse_logging_log_sync_send(ctx); #else int max_length = 256; while (*msg && max_length--) { dbgserial_putchar(*msg); ++msg; } dbgserial_putstr(buffer); #endif } static NORETURN prv_reset(void) { dbgserial_flush(); system_hard_reset(); } // -----------------------------------------------------...
ata = (EnumerateData *)data; prv_app_install_entry_from_app_db_entry(install_id, db_entry, cb_data->entry_buf); cb_data->cb(cb_data->entry_buf, cb_data->data); } void app_install_enumerate_entries(AppInstallEnumerateCb cb, void *data) { // Keep this off of the stack. This function presses the limits of our stac...
app_manager_get_current_app_id()
; if (prv_ids_equal(cur_app_id, to_kill) || ((s_install_callback_data.install_type == APP_DB_CLEARED) && (app_install_id_from_app_db(cur_app_id)))) { PBL_LOG(LOG_LEVEL_DEBUG, "close and delay callbacks for app closing"); s_install_callback_data.callback_paused_for_app = t...
, app2.size)); cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app3.id, app3.size)); time_t now = rtc_get_time(); rtc_set_time(now + 2); // remove 2 cl_assert_equal_i(S_SUCCESS, app_cache_app_launched(app1.id)); cl_assert_equal_i(S_SUCCESS, app_cache_app_launched(app3.id)); // ensure the one that has ...
app_cache_entry_exists(app3.id)
); } static const uint32_t SIZE_SUM = 7210515; static const AppData t_data[] = { // higher rank = should keep around { .id = 1, .priority = 40, .size = 131798 }, // priority rank 28 { .id = 2, .priority = 60, .size = 194327 }, // priority rank 48 { .id = 3, .priority = 23, .size = 195131 }, // 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...
{ s_data.last_change_progress = progress; cl_assert_equal_p(context, s_data.context); s_data.num_change_calls++; }
static void prv_did_change(void *context) { cl_assert_equal_p(context, s_data.context); s_data.num_did_change_calls++; } // Test boilerplate ///////////////////// void test_unobstructed_area_service__initialize(void) { s_data = (UnobstructedAreaTestData) { .context = &s_context_target, .last_change_pr...
nvert from 8 bits in a byte, taking care to round up to the next whole byte. const uint32_t required_row_size_bytes = (required_row_size_bits + 7) / 8; if (data_size != required_total_size_bytes || required_row_size_bytes > bitmap->row_size_bytes) { PBL_LOG(LOG_LEVEL_WARNING, "Bitmap metadata is inconsis...
PBL_ASSERTN(!process_manager_compiled_with_legacy2_sdk())
prv_glance_cache_entry_find_cb, uuid); } static LauncherAppGlance *prv_find_glance_in_cache(LauncherAppGlanceService *service, Uuid *uuid) { const LauncherAppGlanceCacheEntry *entry = prv_find_glance_entry_in_cache(service, uuid); return NULL_SAFE_FIELD_ACCESS(entry, glance, NULL); }...
{ return; }
kino_player_play(&service->glance_reel_player); } void launcher_app_glance_service_play_glance_for_app_node(LauncherAppGlanceService *service, AppMenuNode *node) { if (!service || !node) { return; } KinoPlayer *glance_reel_player = &service->glanc...
tc_set_time(event_time - (1 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 1 H", time_buf); // June 9th 2015, 14:00:00 (T-02:00:00) rtc_set_time(event_time - (2 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time...
clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("In 2 minutes", time_buf); // June 10th 2015, 04:00:00 (T+12:00:00) rtc_set_time(event_time + (12 * SECONDS_PER_HOUR)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Yesterday, 4:00 PM", time_buf); // June 9th 2015, 02:00:00 (T-14: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...
cl_assert_equal_s(e.phone.caller->name, name)
-1008}, { -136, -64, -1008}, { -208, -40, -1024}, { -216, -32, -1024}, { -208, -24, -1016}, { -232, -32, -1024}, { -232, -24, -1024}, { -272, 8, -1032}, // 201 seconds { -160, -144, -992}, { -192, -80, -1008}, { 24, -176, -944}, { -80, 8, -992}, { -144, 40, -1040}, ...
{ -152, 88, -1024}, { -192, 96, -1016}, { -176, 80, -1016}, { -160, 72, -1016}, { -176, 88, -1016}, { -168, 72, -1016}, { -176, 80, -1016}, { -152, 80, -1024}, { -144, 88, -1024}, { -160, 96, -1016}, { -168, 80, -1016}, // 207 seconds { -160, 80, -1016}, { -160, 8...
_get_custom_function(animation_h, AnimationCurveCustomInterpolationFunction); } // ------------------------------------------------------------------------------------------- bool animation_set_immutable(Animation *animation_h) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); PBL_ASSERTN(!ani...
(state, parent_h, false /*quiet*/)
; if (!parent || !prv_animation_is_scheduled(state, parent) || parent->parent) { // Can only set the elapsed of a top-level animation, and then, only after it has // been scheduled. return false; } // First, we need to compute the absolute start time of this animation, backing it up by the // delay...
/* * 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_cache_buffer[0], &s_test_item[1], sizeof(TestCacheItem))
; cl_assert_equal_m(&s_cache_buffer[1], &s_test_item[2], sizeof(TestCacheItem)); cl_assert_equal_m(&s_cache_buffer[2], &s_test_item[1], sizeof(TestCacheItem)); cl_assert(*s_test_item[0].freed); circular_cache_push(&s_test_cache, &s_test_item[1]); cl_assert_equal_m(&s_cache_buffer[0], &s_test_item[1], sizeof(...
/* * 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...
("R12=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_R12])
; printf("LR=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_LR]); printf("PC=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_PC]); printf("xPSR=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_xPSR]); printf("SP=0x%08" PRIx32 "\n", (uint32_t) g_stacked_regs); // Stack Pointer reset_due_to_softwar...
*schedule_pref_key; const char *enabled_pref_key; } DoNotDisturbScheduleConfigKeys; static DoNotDisturbScheduleConfig s_dnd_schedule[NumDNDSchedules]; static const DoNotDisturbScheduleConfigKeys s_dnd_schedule_keys[NumDNDSchedules] = { [WeekdaySchedule] = { .schedule_pref_key = "dndWeekdaySchedule", .enab...
(s_vibe_score_notifications, DEFAULT_VIBE_SCORE_NOTIFS)
; s_vibe_score_incoming_calls = prv_return_default_if_invalid(s_vibe_score_incoming_calls, DEFAULT_VIBE_SCORE_INCOMING_CALLS); s_vibe_score_alarms = prv_return_default_if_invalid(s_vibe_score_alarms, ...