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...
if (recognizer_get_state(recognizer->fail_after) != RecognizerState_Failed) { return false; }
if (!recognizer->subscriber.filter) { return true; } return recognizer->subscriber.filter(recognizer, touch_event); } static void prv_send_subscriber_event(Recognizer *recognizer) { RecognizerEvent event; switch (recognizer->state) { case RecognizerState_Started: event = RecognizerEvent_Start...
k_minute_data_bytes); s_num_captured_activity_sessions = 0; time_t now = rtc_get_time(); int len = 5; KAlgTestActivitySession exp_session = { .activity = KAlgActivityType_Walk, .start_utc = now + 10 * SECONDS_PER_MINUTE, .steps = len * 80, // 80 steps/min .len_minutes = len, ...
cl_assert_equal_i(stats.uncertain_start_utc, 0)
date: %d", repeat_mode); // TODO: Do something with this info } // ------------------------------------------------------------------------------------------------- // Track entity update handlers static void prv_handle_track_artist_update(const AMSEntityUpdateNotification *update, ...
PBL_ASSERTN(!s_ams_client)
; s_ams_client = (AMSClient *) kernel_zalloc_check(sizeof(AMSClient)); } void ams_invalidate_all_references(void) { // We've gotten new characteristic references, // this means the old ones will have been unsubscribed, so we're disconnected from AMS: prv_set_connected(false); // We also need to register for...
S, 0x5); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V18_CUR_LIM_RET, 0xA); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V14_RET_CYCLES, 0x2); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V14_CUR_LIM_RET, 0x6); REG_SETF(DCDC, DCDC_TRIM_REG, DCDC_P_COMP_MAN_TRIM, 0x0); REG_SETF(DCDC, DCDC_TRIM_REG, DCDC_P_COMP_TRIM, 0x0); REG_SETF(D...
(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_EXT_TX_MD, 0x0)
; REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_ADR_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_EXT_BYTE, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST_WB, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST, 0x0); REG_SETF(QSP...
mand->type = GDrawCommandTypeCircle; cl_assert(!gdraw_command_list_validate(command_list, size)); command->type = GDrawCommandTypePrecisePath; cl_assert(gdraw_command_list_validate(command_list, size)); free(command_list); } void test_gdraw_command__validate_image(void) { size_t size = sizeof(GDrawCommandIm...
cl_assert_equal_i(s_path_num_points, 2)
; cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points)); cl_assert(prv_compare_points(points, s_fill_points, s_path_num_points)); prv_reset(); gdraw_command_frame_draw(ctx, NULL, frame, GPoint(-1, 1)); cl_assert_equal_i(s_path_num_points, 2); points[0] = GPoint(0, 2); points[1] = GPoi...
/* * 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 RockyResourceValidation_Valid; }
else { return RockyResourceValidation_Invalid; } }
/* * 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...
uuid_is_invalid(&state->filter_header->common.id)
) || // There is no old item (state->impl->comparator && // Or the comparator chooses the new item (state->impl->comparator(header, state->filter_header, &state->context) < 0)) || (header->common.timestamp < state->filter_header->common.timestamp)); // Or it's earlier } static bool prv_i...
we have reached the end of the file or the header ID is invalid (erased flash) return false; } else if (result < 0) { PBL_LOG(LOG_LEVEL_ERROR, "Error reading notification header while iterating %d", result); return false; } return true; } static bool prv_rewrite_iter_next(NotificationIterState *ite...
kernel_malloc_check(payload_size)
; int result = pfs_read(fd, read_buffer, payload_size); if (result < 0) { kernel_free(read_buffer); return false; } //Seek back to the end of the header so that the next iterator seek finds the next record pfs_seek(fd, -payload_size, FSeekCur); found = (memcmp(payload, read_buffer...
_subscribe(BUTTON_ID_DOWN, prv_down_click_handler); } static void prv_window_unload_handler(Window *window) { WorkoutActiveWindow *active_window = window_get_user_data(window); if (active_window) { app_timer_cancel(active_window->update_timer); app_timer_cancel(active_window->hr_measuring_timer); gbitm...
layer_add_child(&active_window->base_layer, &active_window->top_metric_layer)
; GRect middle_metric_bounds = top_metric_bounds; middle_metric_bounds.origin.y = top_metric_bounds.size.h; middle_metric_bounds.size.h = layer_height - 2; layer_init(&active_window->middle_metric_layer, &middle_metric_bounds); layer_set_update_proc(&active_window->middle_metric_layer, prv_static_l...
t remaining = serial_distance32(virtual_now, target_now); if (remaining == 0) { break; } virtual_now += MIN(ANIMATION_TARGET_FRAME_INTERVAL_MS, remaining); } // Now, go and backup the abs_start_time_ms of the animations we skipped ahead on prv_backup_start_time(state, parent, virtual_now - now)...
{ AnimationPrivate *animation = (AnimationPrivate *)node; dbgserial_putstr_fmt(buffer, buffer_size, "<%p> { sch: %s, handle = %p, abs_start_time_ms = %"PRIu32", delay = %"PRIu32", " "duration = %"PRIu32", curve = %i, run = %p }", animation, is_scheduled ? "yes" : "no", animation->handle...
} static void prv_dump_legacy_animations(ListNode *head, char *buffer, int buffer_size) { AnimationLegacy2 *animation = (AnimationLegacy2 *)head; while (animation) { dbgserial_putstr_fmt(buffer, buffer_size, "<%p> { sch: yes, start handle = %p, stop handle = %p," "abs_start_time_ms = %"PRIu32...
ttle) decreases the selection box's width back by the extra width that was //! added in the "move and expand" step. static void prv_slide_impl(struct Animation *animation, const AnimationProgress distance_normalized) { SelectionLayer *selection_layer = (SelectionLayer*) animation_get_conte...
func(selection_layer->selected_cell_idx, selection_layer->callback_context)
; } layer_mark_dirty(&selection_layer->layer); } else { // Run the animation. The decrement callback will be run halfway through selection_layer->bump_is_upwards = is_up; prv_run_value_change_animation(selection_layer); } } } void prv_select_click_handler(ClickRecognizerRef reco...
lush them out when the ISR is completed. static CircularBuffer s_isr_log_buffer; //! Underlying storage for s_isr_log_buffer static uint8_t s_isr_log_buffer_storage[256]; static uint64_t prv_get_timestamp_ms(void) { time_t time_s; uint16_t time_ms; rtc_get_time_ms(&time_s, &time_ms); return ((uint64_t) time_...
pulse_push_send(contents, header_length + message_length)
; } } } static void prv_enqueue_log_message(uint8_t log_level, const char *message) { const bool buffer_was_empty = (circular_buffer_get_read_space_remaining(&s_isr_log_buffer) == 0); // Need to prevent other interrupts from corrupting the log buffer while we're writing to it portENTER_CRITICAL(); if (...
void *context) { WorkoutSelectionWindow *selection_window = (WorkoutSelectionWindow *)context; ActivitySessionType activity_type = prv_get_activity_type(cell_index->row); const char *title = workout_utils_get_name_for_activity(activity_type); const GBitmap *icon = &selection_...
(menu_layer, selection_window, &(MenuLayerCallbacks){ .get_num_rows = prv_get_num_rows_callback, .get_cell_height = prv_get_cell_height_callback, .draw_row = prv_draw_row_callback, .select_click = prv_select_callback, })
_system_session_wins(void) { Transport *system_transport = (Transport *) TransportID1; CommSession *system_session = comm_session_open(system_transport, &s_transport_imp, TransportDestinationSystem); cl_assert_equal_i(s_close_count, 0); Transport *system_trans...
cl_assert_equal_i(fake_system_task_count_callbacks(), 1)
; comm_session_send_next(session); cl_assert_equal_i(fake_system_task_count_callbacks(), 1); cl_assert_equal_i(s_send_next_count, 0); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_i(fake_system_task_count_callbacks(), 0); cl_assert_equal_i(s_send_next_count, 1); comm_session_send_next(ses...
(root_layer, (Layer *)&data->mic_window.icon_layer)
; layer_set_hidden((Layer *)&data->mic_window.icon_layer, true); } else { kino_reel_destroy(image); } data->voice_event_sub = (EventServiceInfo) { .type = PEBBLE_VOICE_SERVICE_EVENT, .handler = prv_voice_event_handler, .context = data }; event_service_client_subscribe(&data->voice_event_s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_single_click_subscribe(BUTTON_ID_UP, prv_click_confirm_decline_callback)
; window_single_click_subscribe(BUTTON_ID_DOWN, prv_click_confirm_decline_callback); window_single_click_subscribe(BUTTON_ID_BACK, prv_click_confirm_decline_callback); } void switch_worker_confirm(AppInstallId new_worker_id, bool set_as_default, WindowStack *window_stack) { AppInstallI...
t(ctx); graphics_context_set_antialiased(ctx, true); GDrawMask *mask = prv_create_mask_for_vline_recording_test(ctx); cl_assert(graphics_context_mask_record(ctx, mask)); for (int16_t x = 0; x < num_src_colors; x++) { GColor src_color = (GColor) { .argb = (uint8_t)x }; for (int mask_value_index = 0; ...
(num_src_colors, num_dest_colors * hline_applying_test_column_width)
; prv_prepare_canvas(ctx, bitmap_size); // Fill the canvas so each row (of width vline_applying_test_row_height) is set to one of the // different possible dest_colors for (int16_t x = 0; x < bitmap_size.w; x++) { for (int16_t row_index = 0; row_index < num_dest_colors; row_index++) { const int16_t s...
#include "stm32f2xx_gpio.h" #include "stm32f2xx_usart.h" #elif defined(MICRO_FAMILY_STM32F4) #include "stm32f4xx_rcc.h" #include "stm32f4xx_gpio.h" #include "stm32f4xx_usart.h" #endif #include "util/attributes.h" #include "util/cobs.h" #include "util/crc32.h" #include "util/net.h" #include "util/misc.h" #include <stdb...
prv_putchar(FRAME_DELIMITER)
; for (size_t i = 0; i < cooked_length; ++i) { if (cooked_packet[i] == FRAME_DELIMITER) { prv_putchar('\0'); } else { prv_putchar(cooked_packet[i]); } } prv_putchar(FRAME_DELIMITER); s_message_length = 0; } void dbgserial_putstr(const char* str) { if (!s_initialized) { return; ...
29vs.h" #include "fake_spi_flash.c" #include "stubs_logging.h" #include "stubs_pbl_malloc.h" // This will come from overrides and will include a smaller boot fpga image #include "mfg/spalding/spalding_boot.fpga.auto.h" // Stubs for fake_crc.c #include "services/normal/filesystem/pfs.h" int pfs_read(int fd, void *buf...
(mfg_info_get_disp_offsets().y, 0)
ays, get the notification below the one we want to focus, // set it as the current notification, then swap up. This allows us // to accomplish the animation effect, while still pleasing the SwapLayer // when it wants to retrieve the layouts it wants to. notifications_presented_list_set_current(s...
alerts_should_vibrate_for_type(prv_alert_type_for_notification_type(type))
) { #if CAPABILITY_HAS_VIBE_SCORES VibeScore *score = vibe_client_get_score(VibeClient_Notifications); if (score) { vibe_score_do_vibe(score); vibe_score_destroy(score); } #else vibes_short_pulse(); #endif // Timestamp set after call to vibrate since if something fails, // its better...
t(15, 40)); } void across_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(40, 50), GPoint(35, 70)); } void across_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_...
layer_set_update_proc(&layer, &clear_layer_update_callback)
; layer_render_tree(&layer, &ctx); #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_clear"))); #else cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)); #endif } #define MAX_NUM_ROWS 168 #define MAX_NUM_COLS 144 #defin...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ case HcMessageID_Discovery_Start: prv_handle_discovery_start((HcProtocolDiscoveryStartPayload *)msg->payload); break; case HcMessageID_Discovery_Stop: prv_handle_discovery_stop((BTDeviceInternal *)msg->payload); break; default: PBL_LOG(LOG_LEVEL_WARNING, "Unexpected command: ...
}
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 "stroke_width.h" #include <inttypes.h> #include <stdbool.h> #include "applib/app.h" #include "applib/pbl_std/pbl_st...
(LOG_LEVEL_DEBUG, "current operation type: %d", data->operation)
; } static void click_config_provider(void *context) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, up_handler); window_single_repeating_click_subscribe(BUTTON_ID_SELECT, 100, select_handler); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, down_handler); } static void debug_layer_upd...
ESSORY_STOP_INTERVAL_PERIOD_MS (250) //! How many intervals we should wait outside of stop mode when we first see any noise on the //! serial port. #define ACCESSORY_INITIAL_STOP_INTERVALS (500 / ACCESSORY_STOP_INTERVAL_PERIOD_MS) //! How many intervals we should wait outside of stop mode when we first see valid data o...
if (!s_dma_enabled) { return; }
s_dma_enabled = false; uart_stop_rx_dma(ACCESSORY_UART); } //! The interval timer callback. static void prv_timer_interval_expired_cb(void *data) { if (!s_stop_mode_monitor.data_seen_this_interval) { // The accessory connector didn't have any data since the last time this callback fired. ++s_stop_mode_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...
app_glance_db_read_glance(&APP_GLANCE_TEST_UUID, &glance)
, S_SUCCESS); // Compare the glance read back with the expected glance below AppGlance expected_glance = (AppGlance) { .num_slices = 2, .slices = { { .expiration_time = rtc_get_time() + 10, .type = AppGlanceSliceType_IconAndSubtitle, .icon_and_subtitle.icon_resource_id = TIMEL...
840, 96, -480}, { 1000, 96, -616}, { 1120, 8, -528}, { 1472, 40, -536}, { 1112, 216, -400}, { 1216, 40, -400}, // 5 seconds { 1344, 0, -320}, { 1120, -24, -304}, { 752, -48, -312}, { 560, -32, -256}, { 520, 8, -216}, { 568, -16, -192}, { 736, -32, -232}, { 936, -1...
{ 1208, 48, -288}, { 1008, -96, -352}, { 1056, 136, -472}, { 960, 72, -360}, { 632, 8, -280}, { 424, 8, -224}, { 400, 40, -168}, { 552, 96, -192}, { 704, 200, -312}, { 896, 224, -392}, { 1048, 256, -464}, { 1152, 240, -384}, { 1264, 248, -488}, { 1160, 200, -312},...
{ 816, 96, -288}, { 632, 80, -248}, { 520, 48, -248}, { 592, 24, -208}, { 704, 88, -272}, { 840, 80, -288}, { 1072, 32, -352}, { 1136, 32, -456}, { 1480, -192, -376}, { 832, 240, -400}, { 1088, 0, -392}, { 1056, 88, -392}, { 968, 16, -368}, { 696, -16, -232}, ...
l_i(GTextAlignmentCenter, s_rocky_text_state.alignment); ASSERT_JS_GLOBAL_EQUALS_S("a", "center"); // we only support LTR EXECUTE_SCRIPT("ctx.textAlign = 'start';\nvar a = ctx.textAlign;\n"); cl_assert_equal_i(GTextAlignmentLeft, s_rocky_text_state.alignment); ASSERT_JS_GLOBAL_EQUALS_S("a", "left"); EXECU...
(s_rocky_text_state.alignment, lc->max_used_size.alignment)
; } void test_rocky_api_graphics__state_initialized_between_renders(void) { prv_global_init_and_set_ctx(); // fill text_state with unique values we can test against s_rocky_text_state = (RockyAPITextState) { .font = (GFont)-1, .overflow_mode = (GTextOverflowMode)-2, .alignment = (GTextAlignment)-3, ...
/* * 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...
rotl32(src, src_dest_shift)
; uint8_t src_bits_left = src_bits_left_at_line_begin; const uint32_t *dest_block_end = dest_block + num_dest_blocks_per_row; const uint32_t *src_block_end = src_block + src_row_length_words; while (dest_block != dest_block_end) { const uint8_t number_of_bits = MIN(32 - dest_shift, MIN(row_bits...
/* * 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...
{ (void)num; printf(" ---\n"); printf(" message : %s\n", error->error_msg); printf(" severity: fail\n"); printf(" suite : %s\n", error->suite); printf(" test : %s\n", error->test); printf(" file : %s\n", error->file); printf(" line : %d\n", error->line_number); if (error->description != NUL...
static void clar_print_ontest(const char *test_name, int test_number, int failed) { printf("%s %d - %s\n", failed ? "not ok" : "ok", test_number, test_name ); clar_report_errors(); } static void clar_print_onsuite(const char *suite_name, int suite_index) { printf("# *** %s (#%d) ***\n", suite_name, suite_...
:%0S %S %uT = %uH, %uM, and %uS %uM, and %uS %uS %aT = %aH %aM %aS %aM %aS %aS %0T = %0H:%0M:%0S %0M:%0S %0S %fT = %fH:%0M:%0S %fM:%0S %fS %0uT = %0uH, %0uM, and %0uS %0uM, and %0uS ...
("TmplStringPlur", "")
}, /// Singular suffix for days with abbreviated units { i18n_ctx_noop("TmplStringSing", " d"), /// Plural suffix for days with abbreviated units i18n_ctx_noop("TmplStringPlur", " d")}, /// Singular suffix for days with full units { i18n_ctx_noop("TmplStringSing", " day"), /// Plural suffix for days wit...
GE_PADDING (0xFFFFFFFF) // addresses in RAM of interesting settings #define RAM_ADDR_UNLOCK (0xFFF1) #define RAM_ADDR_LOCK (0xFFF0) #define RAM_ADDR_PALM_DETECTION (0x04F1) #define RAM_ADDR_TOUCHDOWN_RETRIES (0x0474) #define RAM_ADDR_LIFTOFF_RETRIES (0x04D3) // magic number for enabling palm detection + reporting #de...
((response.data[2] & 0x0F) == PACKET_FOOTER)
; *(uint16_t *)result = response.data[1] | ((uint16_t)(response.data[2] & 0xF0) << 4); } else if (type == StatusReadType_16bit) { // The 3 data bytes are SP QR S1 (in hex) with S being the first 4-bits of the address and PQRS // being the value. PBL_ASSERTN((response.data[0] & 0xF0) == (address & 0xF0...
/* * 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...
(inverter_layer)
; } Layer* inverter_layer_get_layer(InverterLayer *inverter_layer) { if (inverter_layer == NULL) { return NULL; } return &inverter_layer->layer; }
AND_WRITEBACK_RESPONSE: PBL_LOG(LOG_LEVEL_DEBUG, "WRITEBACK Response"); prv_handle_wb_response(session, data, data_length); break; case BLOB_DB_COMMAND_SYNC_DONE_RESPONSE: PBL_LOG(LOG_LEVEL_DEBUG, "SYNC DONE Response"); prv_handle_sync_done_response(session, data, data_length); b...
analytics_inc(ANALYTICS_DEVICE_METRIC_BLOB_DB_EVENT_COUNT, AnalyticsClient_System)
; // Each BlobDB message is required to have at least a Command and a Token static const uint8_t MIN_RAW_DATA_LEN = sizeof(BlobDBCommand) + sizeof(BlobDBToken); if (length < MIN_RAW_DATA_LEN) { // We don't send failure responses for too short messages in endpoint2 PBL_LOG(LOG_LEVEL_ERROR, "Got a blob_db2...
ename_part = "quads_top", .mask = GCornersTop, }, { .filename_part = "quads_bottom", .mask = GCornersBottom, }, { .filename_part = "quads_right", .mask = GCornersRight, }, { .filename_part = "quads_left", .mask = G...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 0)
he processor core to enter deepsleep mode when we // execute a WFI or WFE instruction. SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; // Go stop now. __DSB(); // Drain any pending memory writes before entering sleep. do_wfi(); // Wait for Interrupt (enter sleep mode). Work around F2/F4 errata. __ISB(); // Let the pipe...
prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_I2C1_TIME, InhibitorI2C1, now_ticks)
; prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_ACCESSORY, InhibitorAccessory, now_ticks); prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_MIC, InhibitorMic, now_ticks); // TODO PBL-37941: Add analytics for InhibitorDMA } void command_scheduler_force_active(void) { sleep_mode_enable(false); } void command_sch...
l_layer); // Setup //////////////////////////////////// void test_scroll_layer__initialize(void) {} void test_scroll_layer__cleanup(void) {} // Tests //////////////////////////////////// void test_scroll_layer__enable_paging(void) { GRect scroll_bounds = GRect(0,0,180,180); ScrollLayer *scroll_layer = scroll_la...
prv_scroll_layer_get_paging_height(scroll_layer)
); int pages = 2; int offset = 0; // setup content size to be slightly more than 2 pages GSize content_size = GSize(180, page_height * pages + 10); scroll_layer_set_content_size(scroll_layer, content_size); // paging should force full contents of last page to show // so content size rounded up to the ne...
phics_path2d.h> #include "clar.h" #include "test_jerry_port_common.h" #include "test_rocky_common.h" #include "applib/graphics/gpath.h" #include "applib/graphics/gtypes.h" #include "applib/rockyjs/api/rocky_api_global.h" #include "applib/rockyjs/api/rocky_api_graphics.h" #include "applib/rockyjs/api/rocky_api_graphics...
cl_assert_equal_b(jerry_value_is_object(ctx), true)
; jerry_set_object_field(jerry_get_global_object(), "ctx", ctx); } void test_rocky_api_graphics_path2d__initialize(void) { fake_malloc_set_largest_free_block(~0); s_log_internal__expected = NULL; rocky_runtime_context_init(); fake_app_timer_init(); jerry_init(JERRY_INIT_EMPTY); s_app_window_stack_get_t...
); static ActionToggleState prv_get_toggled_state_index(ActionToggleContext *ctx) { return ctx->enabled ? ActionToggleState_Disabled : ActionToggleState_Enabled; } static void prv_setup_state_config(ActionToggleContext *ctx, ActionToggleDialogConfig *config, ActionToggleDialogType...
actionable_dialog_set_action_bar_type(actionable_dialog, DialogActionBarConfirm, NULL)
; actionable_dialog_set_click_config_provider(actionable_dialog, prv_prompt_click_config_provider); prv_setup_dialog(actionable_dialog_get_dialog(actionable_dialog), &config, (void *)ctx); actionable_dialog_push(actionable_dialog, prv_get_window_stack()); } static bool prv_should_prompt(const ActionToggleConfig ...
/normal/timeline/event.h" #include "services/normal/timeline/health_layout.h" #include "services/normal/timeline/weather_layout.h" #include "util/size.h" #include <sys/cdefs.h> #define StringListLiteral(str) { \ .serialized_byte_length = ARRAY_LENGTH(str) - 1, \ .data = str, \ } \ const char *timeline_demo_strin...
timeline_item_destroy(item)
; attribute_list_destroy_list(&list); } static void prv_add_weather_pin(int32_t delta_time_s) { prv_add_weather_pin_with_params(delta_time_s, true, false, false); } static void prv_add_sports_pin(int32_t delta_time_s, GColor secondary_color, bool is_ingame, bool has_broadcaster) { ...
ompOpAssignInverted: for (int i = src_start_idx; i < src_end_idx; ++i, ++dest_x) { const uint32_t bit = (1 << i); const bool set = src & bit; dest[dest_x] = (set) ? GColorBlack.argb : GColorWhite.argb; } break; case GCompOpTint: case GCo...
(LOG_LEVEL_DEBUG, "Only blitting to 8-bit supported.")
; } } }
/* * 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, GColorBlack)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_mfg_write_data_to_slot(OTP_PCBA_SLOT_INDICES, ARRAY_LENGTH(OTP_PCBA_SLOT_INDICES), serial, serial_size, out_index)
; } static MfgSerialsResult prv_mfg_write_hw_version(const char* hwver, size_t hwver_size, uint8_t *out_index) { if ((hwver_size > MFG_HW_VERSION_SIZE) || hwver[hwver_size] != '\0') { return MfgSerialsResultFailIncorrectLength; } return prv_mfg_write_data_to_s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ if (PRIVILEGE_WAS_ELEVATED) { syscall_failed(); } return; }
>common, config->id); PebbleEvent e = { .type = PEBBLE_APP_LAUNCH_EVENT, .launch_app = { .id = config->id, .data = data }, }; event_put(&e); } // --------------------------------------------------------------------------------------------- bool app_manager_launch_new_app(const AppLaunch...
system_app_state_machine_get_last_registered_app()
; } else { // If we get here, s_next_app is already setup and so we can call prv_app_switch() directly // and return prv_app_switch(gracefully); return; } } app_manager_set_minimum_run_level(ProcessAppRunLevelNormal); process_manager_launch_process(&(ProcessLaunchConfig) { .id...
, GapBondingFileSetNoUpdateNeeded, } GapBondingFileSetStatus; static GapBondingFileSetStatus prv_file_set( const void *key, size_t key_len, const void *data_in, size_t data_len) { status_t rv; bool do_perform_update = true; prv_lock(); { SettingsFile fd; rv = settings_file_open(&fd, BT_PERSISTENT...
{ bt_persistent_storage_set_ble_pinned_address(&pinned_address); }
// if we get here there is no pinned address in PRF, let's load the address fw has been // using. This shouldn't ever really happen unless we reboot while saving new information to // shared PRF if (bt_persistent_storage_get_ble_pinned_address(&pinned_address)) { shared_prf_storage_set_ble_pinned_address(...
(data->view_model.cur_level->parent_level == anim_ctx->next_level) { --data->view_model.num_dots; } else { ++data->view_model.num_dots; } data->view_model.cur_level = anim_ctx->next_level; // update the view prv_view_model_did_change(data); applib_free(anim_ctx); } static GEdgeInsets prv_action_me...
prv_set_level(data, parent_level)
utf8_bounds = &utf8_bounds, }; // Init mutable types word_iter_init(&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start); // Tests cl_assert(word_iter_state.current.start == word_iter_state.current.end); cl_assert(!iter_next(&word_iter)); cl_assert(word_iter_state.current.width_px ...
(*word_iter_state.current.end == '\0')
; cl_assert(!iter_next(&word_iter)); }
ssage *message) { return s_is_message_cancelled; } void app_outbox_service_cleanup_all_pending_messages(void) { s_is_message_cancelled = true; } void comm_session_analytics_inc_bytes_sent(CommSession *session, uint16_t length) { } static CommSession s_system_session; static CommSession *s_system_session_ptr; Com...
(ALLOWED_ENDPOINT_ID)
; memcpy(TEST_EXPECTED_PP_MSG + sizeof(*header), TEST_PAYLOAD, sizeof(TEST_PAYLOAD)); app_message_sender_init(); cl_assert(s_outbox_message_handler); } void test_app_message_sender__cleanup(void) { // Flush out to avoid other tests failing: if (s_system_session_ptr) { prv_process_send_queue(s_system_ses...
ucture.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(pin_config.gpio, &GPIO_InitStructure); gpio_release(pin_config.gpio); } //! Configure bus pins for use by I2C peripheral //! Lock bus and peripheral config access before configuring pins static void bus_pin_cfg_i2c(AfC...
if (i2c_buses[bus_idx].user_count == 0) { bus_rail_power_up(bus_idx); }
irst_frame_clipping"); }; // This test records a clipping mask of the 1/4 progress frame of the right "round flip" compositor // transition animation and then clips a full-screen red rectangle to the resulting mask static void prv_right_flip_first_quarter_frame_clipping(GContext *ctx) { // The 1/4 progress frame is...
graphics_private_move_pixels_horizontally(bitmap, 0, false)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(NULL, callback)
; // we're using the event service cl_assert_equal_i(features, HRMFeature_BPM); ++s_hrm_manager_subscribe_with_callback_call_count; s_last_session_ref = ++s_next_session_ref; return s_last_session_ref; } static GAPLEConnection *s_connections[2]; GAPLEConnection *gap_le_connection_by_device(const BTDeviceInter...
, 448, -112}, { -944, 552, -384}, { -904, 416, -256}, { -792, 360, -272}, { -624, 264, -224}, { -448, 272, -152}, { -448, 320, -176}, { -520, 344, -152}, { -576, 304, -88}, { -632, 312, -80}, { -600, 320, -64}, { -712, 328, -64}, { -976, 400, -128}, { -1248, 376, -8},...
// 68 seconds { -400, 248, 72}, { -432, 256, 40}, { -488, 248, 40}, { -504, 256, 40}, { -632, 280, 40}, { -944, 328, 24}, { -928, 416, -104}, { -1248, 272, 72}, { -2000, 408, -8}, { -1272, 544, -160}, { -1136, 376, -208}, { -760, 720, -560}, { -552, 392, -376}, ...
// ---------------------------------------------------------------- // Sample captured: 2015-10-05 15:52:37 local AccelRawData *activity_sample_walk_100_pbl_25655_7(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25655_7 //> TEST_EXPECTED 100 //> T...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__origin_bitmap_layer_inside(void) { prv_origin_bitmap_layer_test(GPointZero); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__origin_bitmap_layer_across_x(void) { prv_o...
(__func__, GCompOpTintLuminance)
; } void test_graphics_draw_bitmap__composite_tint_luminance_blue_opaque(void) { graphics_context_set_tint_color(&s_ctx, GColorBlue); prv_composite_test(__func__, GCompOpTintLuminance); }
sizeof(s_short_data_fragment) - sn), true); ppogatt_send_next(transport); prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment) - sn); } // Simulate the regular timer firing a bunch of times to...
prv_receive_ack(s_characteristics[0][PPoGATTCharacteristicData], (sn - 1) % PPOGATT_SN_MOD_DIV)
; // Some new data has been queued up in the mean time: cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, sizeof(s_short_data_fragment) - sn), tru...
cle_func(ctx, GPoint(rect->origin.x + rect->size.w - radius - 1, rect->origin.y + rect->size.h - radius - 1), radius, GCornerBottomRight); bottom_rect_size_w -= radius; } // Top Rect prv_fill_rect_legacy2(ctx, GRect(top_rect_origin_x, rect->origin.y, to...
GPoint(rect->origin.x + rect->size.w - 1, rect->origin.y)
; const GPoint bl = GPoint(rect->origin.x, rect->origin.y + rect->size.h - 1); const GPoint br = GPoint(rect->origin.x + rect->size.w - 1, rect->origin.y + rect->size.h - 1); graphics_line_draw_stroked_non_aa(ctx, tl, tr, stroke_width); graphics_line_draw_stroked_non_aa(ctx, tl, bl, stroke_width); graphics_l...
or_file_creation(uint32_t file_size, uint32_t max_elapsed_ticks) { uint16_t pages_to_find = (file_size + PFS_PAGE_SIZE) / PFS_PAGE_SIZE; uint16_t free_page = 0; uint32_t start_ticks = rtc_get_ticks(); uint16_t last_written_page = s_last_page_written; while ((pages_t...
{ // flag the page as in use prv_flash_write((uint8_t *)&pg_hdr.page_flags, sizeof(pg_hdr.page_flags), prv_page_to_flash_offset(curr_page) + offsetof(PageHeader, page_flags)); if (pgs_needed > 0) { // do we need to find a free page if ((rv = find_free_page(&next_page, use_gc_allocator, true))...
// we have succesfully allocated space for the file, so add file specific info f->start_page = f->curr_page = start_page; FileHeader file_hdr; memset(&file_hdr, 0xff, sizeof(file_hdr)); file_hdr.file_namelen = strlen(f->name); file_hdr.file_size = f->file_size; file_hdr.file_type = f->file_type; writ...
while(((iterations == 0) && enable_flash_test) || ((iterations > 0) && (iteration_count < iterations))) { // Confirm write took place - data should now be set to stress_data1 status = prv_read_verify_halfword(stress_addr1, stress_data1, FLASH_TEST_ERR_DATA_WRITE, false); VERIFY_TEST_STATUS(statu...
task_watchdog_mask_clear(pebble_task_get_current())
; } enable_flash_test = true; // Schedule test to run switch (test_case_num) { case FLASH_TEST_CASE_RUN_DATA_TEST: status = prv_run_data_test(); break; case FLASH_TEST_CASE_RUN_ADDR_TEST: status = prv_run_addr_test(); break; case FLASH_TEST_CASE_RUN_STRESS_ADDR_TEST: ...
rv_get_cell_height_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *context) { #if PBL_RECT return 56; #else return menu_layer_is_index_selected(menu_layer, cell_index) ? 84 : 38; #endif } static void prv_draw_row_callback(GContext *ctx, const Layer *cell_lay...
(&selection_window->workout_icons[i], prv_get_icon_resource_id(i))
tamp of the end of the last record we would have available uint32_t last_minute_avail = minute_idx - (minute_idx % ALG_MINUTES_PER_FILE_RECORD); time_t last_second_available = last_minute_avail * SECONDS_PER_MINUTE; // Return the data now uint32_t num_records_requested = *num_records; // Start on next minut...
if ((utc_secs % 60) == 0) { fake_cron_job_fire(); fake_system_task_callbacks_invoke_pending(); }
} } // -------------------------------------------------------------------------------- // Fast forward time, one minute at a time, calling all minute callbacks along the way. // This does not feed in any accel data static void prv_advance_by_days(uint32_t num_days) { for (int i = 0; i < num_days; i++) { //...
izeof(NSNotification)); // Handle the CategoryID if (nsnotification->category_id == CategoryIDMissedCall) { properties |= ANCSProperty_MissedCall; } else if (nsnotification->category_id == CategoryIDIncomingCall) { properties |= ANCSProperty_IncomingCall; } else if (nsnotification->category_id == Categ...
prv_reset_due_to_bt_error()
; return; } BLE_LOG_DEBUG("Got ACK for Control Point write"); if (s_ancs_client->queue && (s_ancs_client->queue->op == NotificationQueueOpPerformAction)) { // The action was successful prv_reset_and_next(); } } static bool prv_write_control_point_request(const CPDSMessage *cmd, size_t size) { c...
queue(PebbleTask task) { return NULL; } // fake accel.h impl static int s_sampling_interval_us = 1000000 / ACCEL_SAMPLING_25HZ; static int s_num_samples = 0; //! If true, ignore attempts to change the sampling interval static bool s_force_sampling_interval; uint32_t accel_set_sampling_interval(uint32_t interval_us...
(sample_rates, ARRAY_LENGTH(sample_rates))
; int poss_rates = ARRAY_LENGTH(sample_rates); int max_permutations = 0x1 << poss_rates; for (int mask = 0; mask < max_permutations; mask++) { int count = __builtin_popcount(mask); if (count == 0) { continue; // we don't care about the empty set } int test_rates[count]; int idx = 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...
({ var child_process = require('child_process'); try { var args = []; for (var i = 0;; i++) { var argStrPtr = getValue($0 + i*4, '*'); if (argStrPtr === 0) { break; } var arg = Pointer_stringify(argStrPtr); args.push(arg); } // FIXME: nee...
; } #else // #ifdef EMSCRIPTEN static int shell_out(char * const argv[]) { int status; pid_t pid; pid = fork(); if (pid < 0) { fprintf(stderr, "System error: `fork()` call failed.\n"); exit(-1); } if (pid == 0) { execv(argv[0], argv); } waitpid(pid, &status, 0); return WEXITSTATUS(status); } #end...
tIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); content_indicator_init_buffer(buffer); } void test_workout_active__cleanup(void) { } // Helpers ////////////////////// static void prv_create_window_and_render(WorkoutActiveWindow *active_window, int second...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_workout_active__workout_render_hr_zone_1(void) { s_workout_data = (WorkoutData) { .steps = 567, .duration_s = 789, .distance_m = 234, .avg_pace = health_util_get_pace(789, 234), .bpm = 148, .hr_zone = 1, }; WorkoutActiveWindow *active_window = workout_active_create_for_act...
/* * 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_focus)
x = NULL; //! Cache of the last connected system session capabilities. Updated in flash when we get new flags //! @note prv_lock() must be held when accessing this variable. static PebbleProtocolCapabilities s_cached_system_capabilities; static void prv_lock(void) { mutex_lock(s_db_mutex); } static void prv_unlock...
if (memcmp(&curr_val, data_in, data_len) == 0) { do_perform_update = false; }
} if (do_perform_update) { s_bt_persistent_storage_updates++; PBL_LOG_D(LOG_DOMAIN_BT_PAIRING_INFO, LOG_LEVEL_DEBUG, "Updating GAP Bonding DB Value <key, val>!"); PBL_HEXDUMP_D(LOG_DOMAIN_BT_PAIRING_INFO, LOG_LEVEL_DEBUG, (uint8_t *)key, key_len); PBL_HEXD...
onable_dialog->select_icon); } else if (actionable_dialog->action_bar_type == DialogActionBarConfirmDecline) { #if !defined(RECOVERY_FW) actionable_dialog->up_icon = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_CHECK); actionable_dialog->down_icon = gbitmap_create_with_resource(RESOURCE_ID_ACTION_...
if (action_bar_type == DialogActionBarCustom) { PBL_ASSERTN(action_bar); // Action bar must not be NULL if it is a custom type. actionable_dialog->action_bar = action_bar; } else { actionable_dialog->action_bar = NULL; }
_r1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT_NXNY, RADIUS_SMALL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r1_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #end...
graphics_circle_quadrant_draw_stroked_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerTopRight)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_quad_top_right.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL); graphics_circle_quadrant_draw_stroked_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerBotto...
compositor_app_render_ready will also release the framebuffer. prv_release_app_framebuffer(); } else { s_state = CompositorState_App; compositor_app_render_ready(); } prv_send_did_focus_event(properties & ModalProperty_Unfocused); } static void prv_animation_teardown(Animation *animation) { if (s_...
{ return s_state == CompositorState_AppTransitionPending || s_state == CompositorState_Transitioning; }
void compositor_transition_cancel(void) { if (animation_is_scheduled(s_animation_state.animation)) { animation_unschedule(s_animation_state.animation); } } void compositor_freeze(void) { s_framebuffer_frozen = true; } static void prv_compositor_unfreeze_cb(void *ignored) { // Run deferred draws prv_ha...
= prv_get_overlap_line_length(timeline_layer, &first_icon_frame, &second_icon_frame); int16_t line_length = rel_bar_value; int16_t y_offset = 0; if (!current) { line_length = full_line_length; y_offset = (((full_line_length - rel_bar_value) * REL_BAR_PREV_ANIM_OFFSET) / full_line_len...
layer_set_hidden(&layer->relbar_layer.layer, true)
}, .app_face_bg_color = {0}, .template_id = 0, .icon_resource_id = 0, }; static const Uuid tictoc_uuid = { 0x8f, 0x3c, 0x86, 0x86, 0x31, 0xa1, 0x4f, 0x5f, 0x91, 0xf5, 0x01, 0x60, 0x0c, 0x9b, 0xdc, 0x59 }; static const Uuid music_uuid = {0x1f, 0x03, 0x29, 0x3d, 0x47, 0xaf, 0...
app_install_get_entry_for_uuid(&music_uuid, &uuid_entry)
); cl_assert_equal_b(true, app_install_entries_equal(&id_entry, &uuid_entry)); cl_assert_equal_b(true, app_install_get_entry_for_install_id(sports_id, &id_entry)); cl_assert_equal_b(true, app_install_get_entry_for_uuid(&sports_uuid, &uuid_entry)); cl_assert_equal_b(true, app_install_entries_equal(&id_entry, &u...
---------- // Unschedule of an animation and optional destroy, recurses into children of sequence or spawn // animations. When this method is called on children of an animation, allow_auto_destroy is // false unless the top-level animation has already been unscheduled. void prv_unschedule_animation(AnimationState *stat...
if (force_destroy || animation->defer_delete || ((allow_auto_destroy && animation->auto_destroy) && !prv_animation_is_scheduled(state, animation))) { // It's possible the stopped handler rescheduled, so check before we destroy it prv_unlink_and_free(state, animation); }
} // ------------------------------------------------------------------------------------------- // Low level schedule of an animation, no recursion static void prv_schedule_low_level_animation(AnimationState* state, const uint32_t now, AnimationPrivate *animation, int32_...
68}, { -1320, -72, -344}, { -1528, -200, -272}, { -1560, -32, -80}, { -1360, -32, 64}, { -1176, 224, -136}, { -1056, 248, -40}, { -992, 264, 0}, // 16 seconds { -1000, 160, 24}, { -912, 336, -104}, { -872, 376, -256}, { -1224, 352, -32}, { -1696, 512, 168}, { -128...
{ -1120, 176, 120}, { -936, -72, 96}, { -840, -256, 24}, { -952, -8, -320}, { -1144, 128, -264}, { -1320, 168, -344}, { -1352, -128, -168}, { -1424, -264, -24}, { -1440, 240, -160}, { -1584, 664, -600}, { -1296, 296, -248}, { -1296, 408, -96}, { -1224, 392, -32}, ...
{ -1752, 408, -64}, { -1280, 688, 400}, { -1344, 424, -96}, { -1296, 392, 8}, { -1304, 312, 88}, { -1080, 376, 64}, { -944, 368, 104}, { -1064, 560, 120}, { -1000, 608, 160}, { -1120, 584, 40}, // 24 seconds { -912, 680, 8}, { -920, 568, -64}, { -1280, 552, -16},...
ate/app_state/app_state.h" #include "services/common/new_timer/new_timer.h" #include "services/common/system_task.h" #include "system/logging.h" #include "system/passert.h" #include "FreeRTOSConfig.h" #define NUM_MENU_ITEMS 13 static bool s_call_core_dump_from_isr = false; // ======================================...
NVIC_SetPendingIRQ(OTG_FS_WKUP_IRQn)
; } else if (index == 6) { PBL_LOG(LOG_LEVEL_INFO, "Forcing bus fault during core dump"); core_dump_test_force_bus_fault(); core_dump_reset(false /* don't force overwrite */); } else if (index == 7) { PBL_LOG(LOG_LEVEL_INFO, "Forcing inf loop during core dump"); core_dump_test_force_inf_loop...
ese identifiers should be all lower case and case-insensitive. char pebble_task_get_char(PebbleTask task) { switch (task) { case PebbleTask_KernelMain: return 'm'; case PebbleTask_KernelBackground: return 's'; case PebbleTask_Worker: return 'w'; case PebbleTask_App: return 'a'; case PebbleT...
(&app_region, memory_layout_get_app_region(), false /* allow_user_access */)
; mpu_init_region_from_region(&worker_region, memory_layout_get_worker_region(), false /* allow_user_access */); break; default: WTF; } const MpuRegion *stack_guard_region = NULL; switch (pebble_task) { case PebbleTask_App: stack_guard_region = me...
else { // prevent writing to the attribute until the app handles the event, at which point applib // code will call sys_smartstrap_attribute_event_processed() to clear this flag attr->write_blocked = true; } process_manager_send_event_to_process(CONSUMER_TASK, &event); } else if (type == Sm...
(void, sys_smartstrap_attribute_get_info, SmartstrapAttribute *app_attr, uint16_t *service_id, uint16_t *attribute_id, size_t *length)
l_assert(logging_session == NULL); } void test_data_logging__recover_one(void) { prv_do_recovery_test(1); } void test_data_logging__recover_five(void) { prv_do_recovery_test(5); } // ---------------------------------------------------------------------------------------- //! Try passing garbage pointers to sessi...
(logging_session, true /*empty*/)
; const int items_per_send = (COMM_MAX_OUTBOUND_PAYLOAD_SIZE - sizeof(DataLoggingSendDataMessage)) / item_size; const int num_sends = num_items / items_per_send; for (int i = 0; i < num_sends + 5; i++) { // This sends a chunk out and it should show up in our prv_transport_sent_data...
nvas_layer->bounds; const GRect *frame = &data->canvas_layer->frame; graphics_context_set_stroke_color(ctx, GColorGreen); graphics_draw_rect(ctx, &GRect(bounds->origin.x + frame->origin.x, bounds->origin.y + frame->origin.y, bounds->size.w, bounds...
GPoint(p0.x.integer, p0.y.integer)
EDIUM, STROKE_SMALL,GCornerBottomRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_bottom_right.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL); graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RE...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL)
; graphics_circle_quadrant_draw_stroked_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornersLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_quads_left.${BIT_DEPTH_NAME}.pbi")); #endif // SCREEN_COLOR_DEPTH_BITS == 8 }
(text_node->line_spacing_delta, layout->line_spacing_delta); layout->max_used_size = s_data.max_used_size; return layout->max_used_size; } // Setup and Teardown //////////////////////////////////// void test_graphics_text_node__initialize(void) { s_data = (GTextNodeTestData) {}; } void test_graphics_text_node...
cl_assert(text_b->node.free_on_destroy)
; text_b->text = (char *)str_b; const char *str_c = "C"; GTextNodeText text_c = { .text = (char *)str_c, }; cl_assert(!text_c.node.free_on_destroy); GTextNodeCustom *custom_a = graphics_text_node_create_custom(NULL, NULL); cl_assert(custom_a->node.free_on_destroy); GTextNodeHorizontal *horizontal...
ar_layer, StatusBarLayerSeparatorMode mode) { PBL_ASSERTN(status_bar_layer); status_bar_layer->config.separator.mode = mode; layer_mark_dirty(&(status_bar_layer->layer)); } void status_bar_layer_set_separator_load_percentage(StatusBarLayer *status_bar_layer, ...
(ctx, config->background_color)
ationImplementation implementation = { .base = { .update = (AnimationUpdateImplementation) property_animation_update_gpoint, }, .accessors = { .setter = { .grect = (const GRectSetter) prv_scroll_layer_set_content_offset_internal, }, .getter = { .grect = (const GRectGetter) scro...
(get_callback_context(scroll_layer))
; } } void scroll_layer_set_click_config_onto_window(ScrollLayer *scroll_layer, struct Window *window) { window_set_click_config_provider_with_context(window, (ClickConfigProvider) scroll_layer_click_config_provider, scroll_layer); } void scroll_layer_set_callbacks(ScrollLayer *scroll_layer, ScrollLayerCallbacks ...
id *fb_data = memory_segment_split(app_state_ram, NULL, row_size * LEGACY_2X_DISP_ROWS); if (!fb_data) { return false; } *s_app_state_ptr->legacy2_framebuffer = (GBitmap) { .addr = fb_data, .row_size_bytes = row_size, .info.is_bitmap_heap_all...
{ return &s_app_state_ptr->graphics_context; }
EventServiceInfo* app_state_get_event_service_state(void) { return &s_app_state_ptr->event_service_state; } void app_state_set_user_data(void *data) { s_app_state_ptr->user_data = data; } void* app_state_get_user_data(void) { return s_app_state_ptr->user_data; } AccelServiceState* app_state_get_accel_state(v...
] = {0}; snprintf(unit_test_result_image_file_base_name, PATH_STRING_LENGTH, "%s_%s", unit_test_name, test_data->test_name); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, namecat(unit_test_result_image_file_base_name, ".pbi"))); if (test_data->need_to_destroy_bitmap) { gbitm...
{ prv_composite_test(__func__, GCompOpAssignInverted); }
void test_graphics_draw_bitmap__composite_or(void) { prv_composite_test(__func__, GCompOpOr); } void test_graphics_draw_bitmap__composite_and(void) { prv_composite_test(__func__, GCompOpAnd); } void test_graphics_draw_bitmap__composite_clear(void) { prv_composite_test(__func__, GCompOpClear); } void test_gra...
// ////// uint32_t sector_start_page = gcdata->gc_start_page; uint32_t sectors_active = gcdata->page_mask; // copy the entire block to file (could use bss?) const size_t copy_buf_size = 256; uint8_t *buf = kernel_malloc_check(copy_buf_size); for (uint16_t pg = 0; pg < PFS_PAGES_PER_ERASE_SECTOR; pg++) ...
{ *free_page = pg + sector_start_page; return (S_SUCCESS); }
} return (E_INTERNAL); } status_t pfs_init(bool run_filesystem_check) { if (s_pfs_mutex == NULL) { s_pfs_mutex = mutex_create_recursive(); } for (int fd = FD_INDEX_OFFSET; fd < FD_INDEX_OFFSET+MAX_FD_HANDLES; fd++) { PFS_FD(fd) = (FileDesc) { .fd_status = FD_STATUS_FREE }; } ftl_populate_regi...
a); // Incrementing open_count insures that no one else can do a dls_unlock_session(inactivate=true) // on it and cause it to be freed before we grab the session->data->mutex below. session->data->open_count++; mutex_unlock_recursive(s_list_mutex); mutex_lock(session->data->mutex); return true; } // ---...
if (uuid_is_system(&logging_session->app_uuid)) { PBL_LOG(LOG_LEVEL_WARNING, "Deleting the system data logging session with tag %"PRIu32, logging_session->tag); }
mutex_lock_recursive(s_list_mutex); DataLoggingSession **iter = &s_logging_sessions; while (*iter != NULL) { if (*iter == logging_session) { *iter = (*iter)->next; mutex_unlock_recursive(s_list_mutex); if (logging_session->data) { mutex_destroy(logging_session->data->mutex); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(job->cached_execute_time, UINT32_MAX)
; job->cached_execute_time = UINT32_MAX; prv_clock_change(0, 0, true); cl_assert_equal_i(job->cached_execute_time, target); job->cached_execute_time = UINT32_MAX; prv_clock_change(0, 1, false); target--; // adjust for GMT offset change cl_assert_equal_i(job->cached_execute_time, target); job->cached_exe...
/* * 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...
Fixed_S64_32_mul(ca[i], state_y[i])
); } // shift the y output elements for (int k = num_output_coefficients - 1; k > 0; k--) { state_y[k] = state_y[k-1]; } state_y[0] = ytmp; return ytmp; }
en calling health_service_activities_iterate() if (sleep_state == ActivitySleepStateRestfulSleep) { result |= (HealthActivitySleep | HealthActivityRestfulSleep); } if (sys_activity_sessions_is_session_type_ongoing(ActivitySessionType_Walk)) { result |= HealthActivityWalk; } if (sys_activity_sessions...
{ return HealthServiceAccessibilityMaskNotAvailable; }
// TODO: PBL-31630 provide more accurate value for available time frame // for now, we say that there's only 1 day worth of data for sleep sessions HealthServiceTimeRange range; if (!prv_calculate_time_range(start_time, end_time, &range)) { return HealthServiceAccessibilityMaskNotAvailable; } if (ran...
_RequestSent: this->state->restart_count = MAX_CONFIGURE; // fallthrough case LinkState_AckReceived: case LinkState_Opened: PBL_LOG(LOG_LEVEL_WARNING, "Unexpected Configure-Nak/Rej received after Ack"); prv_handle_nak_or_reject(this, packet); prv_transition_to(this, L...
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); // fallthrough case LinkState_Stopping: prv_transition_to(this, LinkState_Closin...
, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorClear); graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(14, 14), 12); } void across_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_anti...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1)
e"); cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_CUSTOM, all_caps), "Custom"); all_caps = true; cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_EVERYDAY, all_caps), "EVERY DAY"); cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_WEEKDAYS, all_caps), "WEEKDAYS"); cl_assert_equal_s(alarm...
cl_assert_equal_i(s_num_alarms_fired, 1)
; } void test_alarm__recurring_daily_alarm(void) { time_t next_alarm_time = 0; alarm_get_next_enabled_alarm(&next_alarm_time); cl_assert_equal_i(next_alarm_time, 0); AlarmId id1, id2; id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id1, 1...
ineNode *old_node, TimelineIterDirection direction) { const time_t now = rtc_get_time(); const time_t midnight = time_util_get_midnight_of(now); const bool show_all_day = false; const bool show_new = prv_show_event(new_node, now, midnight, direction, show_all_day); const ...
{ timeline_iter_state->node = (TimelineNode *)timeline_iter_state->node->node.prev; if (timeline_iter_state->node == NULL) { timeline_iter_state->node = orig; return false; } }
while (!prv_show_event(timeline_iter_state->node, timeline_iter_state->start_time, timeline_iter_state->midnight, timeline_iter_state->direction, timeline_iter_state->show_all_day_events) || !timeline_exists(&timeline_iter_state->node->id)); timeline_item_free_allocated_buffer(&timeline_iter_state...
t) { // deep copy our attribute list / action group const size_t data_size = attributes_actions_get_buffer_size(attr_list, action_group); if (data_size) { item_out->allocated_buffer = task_malloc_check(data_size); uint8_t *buf_end = item_out->allocated_buffer + data_size; bool rv = attributes_action...
{ // If the creation / deserialization fails we need to clean up, and if the item contains garbage // data we will try to free a garbage allocated buffer field and crash. memset(item_out, 0, sizeof(TimelineItem)); size_t string_alloc_size; char *buffer; if (!timeline_item_create_from_serial_data(item_out, ...
void timeline_item_serialize_header(TimelineItem *item, SerializedTimelineItemHeader *header) { PBL_ASSERTN(item != NULL); PBL_ASSERTN(header != NULL); size_t payload_length = timeline_item_get_serialized_payload_size(item); header->common = item->header; header->payload_length = payload_length; he...
r 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 "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #inc...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_origin_layer_non_aa.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 10); graphics_line_draw_precise_stroked_non_aa(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_same_point_origin_layer_non_aa.${BIT_DEPTH_NAME}.pbi")); } #define OFFSET...
cl_assert_equal_i(new_idx, 3)
; cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_eq...
har *local_device_name_out, size_t max_size) { int read_size = prv_file_get(&DEVICE_NAME_KEY, sizeof(DEVICE_NAME_KEY), local_device_name_out, max_size); if (!read_size) { return false; } return true; } void bt_persistent_storage_set_local_device_name(char *local_device_name, ...
(&fd, prv_delete_all_pairings_itr, NULL)
; settings_file_close(&fd); } prv_unlock(); shared_prf_storage_erase_ble_pairing_data(); if (bt_driver_supports_bt_classic()) { shared_prf_storage_erase_bt_classic_pairing_data(); } } static void prv_dump_bonding_db_data(char display_buf[DISPLAY_BUF_LEN], BTBondi...
/* * 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 (!animation) { return false; } ((AnimationPrivate*)animation)->immutable = true; return true; }
bool WEAK animation_is_immutable(Animation *animation) { if (!animation) { return false; } return ((AnimationPrivate*)animation)->immutable; } bool WEAK animation_set_reverse(Animation *animation, bool reverse) { if (!animation) { return false; } ((AnimationPrivate*)animation)->reverse = reverse;...
/* * 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 (tloc) { *tloc = t; }
224, -56}, { 1056, 256, -88}, { 936, 224, -56}, { 1072, 248, -64}, { 888, 248, -152}, { 920, 176, -120}, { 1256, 240, -24}, { 1208, 240, -56}, { 1344, 336, -176}, { 1432, 320, -112}, // 72 seconds { 1240, 360, -96}, { 952, 288, -160}, { 920, 344, -136}, { 1008, 36...
{ 1088, 320, 8}, { 1080, 232, -32}, { 1224, 232, -16}, { 928, 216, -144}, { 1160, 168, -136}, { 1000, 160, 0}, { 1128, 264, -112}, { 1264, 320, -280}, { 1416, 352, -192}, { 1216, 288, -80}, { 1008, 208, -160}, { 1008, 424, -208}, { 984, 408, -80}, { 1072, 432, -56...
{ 1184, 416, -40}, { 1224, 512, -64}, // 80 seconds { 1160, 528, -16}, { 1560, 600, -8}, { 1312, 704, 56}, { 1048, 968, 8}, { 968, 792, -200}, { 1024, 576, -112}, { 1024, 632, -72}, { 1328, 728, -16}, { 1528, 520, -8}, { 1400, 232, 64}, { 1280, 96, 128}, { 14...
/* * 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...
{ CommSession *session = s_bt_dump_chunk_callback_data.comm_session; // keep us sending data quickly comm_session_set_responsiveness( s_bt_dump_chunk_callback_data.comm_session, BtConsumerPpLogDump, ResponseTimeMin, 5); const uint16_t required_length = total_length + 1 + 4; SendBuffer *sb = comm_sessi...
// Called by flash_dump_log_file() when the log has been completely dumped static void prv_bt_log_dump_completed_cb(bool success) { BluetoothHeader header = { .cookie = s_bt_dump_chunk_callback_data.cookie }; // Send a "no logs" message if the generation did not exist and the remote supports // "infinite ...