prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
_0, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_jja00.${BIT_DEPTH_NAME}.pbi")); // Test when clipping/drawing are at (2, 0) and text bounds is at (0, 0) setup_test_aa_sw(&ctx, fb, RECT_TEXT_2_0, RECT_TEXT_2_0, false, 1); ...
(&ctx, "jja", &s_font_info, RECT_NEG_W, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ if (((TaskTimer*)b)->expire_time < ((TaskTimer*)a)->expire_time) { return -1; } else if (((TaskTimer*)b)->expire_time > ((TaskTimer*)a)->expire_time) { return 1; } else { return 0; } }
// ------------------------------------------------------------------------------------ // Find timer by id static bool prv_id_list_filter(ListNode* node, void* data) { TaskTimer* timer = (TaskTimer*)node; return timer->id == (uint32_t) data; } static TaskTimer* prv_find_timer(TaskTimerManager *manager, TaskTim...
e eu capicola, ea culpa irure " "meatball proident laboris ut reprehenderit ex incididunt.\" };\n"); } } //////////////////////////////////////////////////////////////////////////////// // .postMessage() Tests //////////////////////////////////////////////////////////////////////////////// #define SIMPLE_TE...
cl_assert_equal_i(sizeof(raw_bytes_v1), expected_size)
; cl_assert_equal_m(raw_bytes_v1, buffer, expected_size); prv_rcv_app_message_ack(APP_MSG_OK); json_bytes_remaining -= json_bytes_size; } // Chunk 2: { const size_t json_bytes_size = MIN(TINY_CHUNK_SIZE, json_bytes_remaining); const size_t expected_size = sizeof(PostMessageChunkPayload) + js...
/* * 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...
{ uint8_t uuid_bytes[UUID_SIZE]; uint32_t *uuid_words = (uint32_t*)uuid_bytes; for (size_t i = 0; i < UUID_SIZE / sizeof(uint32_t); i++) { uuid_words[i] = rand32(); } // set the version bits uuid_bytes[6] = (uuid_bytes[6] & ~0xF0) | 0x40; // set the reserved bits uuid_bytes[8] = (uuid_bytes[8] & ~0x...
bool uuid_equal(const Uuid *uu1, const Uuid *uu2) { if (uu1 == NULL || uu2 == NULL) { return false; } return memcmp(uu1, uu2, sizeof(Uuid)) == 0; } bool uuid_is_system(const Uuid *uuid) { return uuid_equal(uuid, &system_uuid); } bool uuid_is_invalid(const Uuid *uuid) { return !uuid || uuid_equal(uuid,...
ACTIVITY_LOG_DEBUG("Minute chunk time out of range, skipping it"); return true;; } // Insert each of the minutes from this chunk into the caller's array time_t minute_utc = chunk.hdr.time_utc; for (uint32_t i = 0; i < ALG_MINUTES_PER_FILE_RECORD; i++, minute_utc += SECONDS_PER_MINUTE) { bool done = pr...
prv_minute_file_get_settings_key(utc_now)
+ 1, .utc_start = 0, .oldest_requested_utc = oldest_requested_utc, .last_record_idx_written = -1, }; // Read the minute data from flash status_t status = settings_file_each(file, prv_read_minute_history_file_cb, &context); if (status != S_SUCCESS) { success = false; goto exit; } // Fi...
/* * 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...
gpath_destroy(path)
; } void health_progress_bar_fill(GContext *ctx, HealthProgressBar *progress_bar, GColor color, HealthProgressBarValue start, HealthProgressBarValue end) { if (start < 0) { // This ensures we don't deal with negative values start += HEALTH_PROGRESS_BAR_MAX_VALUE; } if (start...
app_uuid) { if (s_state == SessionState_Idle) { return false; } // stop timer before changing state variable new_timer_stop(s_timeout); if (s_state != SessionState_WaitForSessionResult) { // This handles erroneous replies from the phone app (sometimes the phone app sends a session // result imme...
mutex_lock(s_lock)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ uint32_t 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 0x%" PRIx16...
static void make_space_for_log(int length) { if (s_current_offset + sizeof(LogHeader) + length + sizeof(LogHeader) < CHUNK_SIZE_BYTES) { // We got space, nothing to do here return; } // Need to roll over to the next chunk // Seal off the current chunk with a 0 length log message. LogHeader log_hea...
/* * 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...
dbgserial_newline()
; FLASH_Lock(); return false; } } // disable programming of flash FLASH_Lock(); return true; }
required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #in...
(s_before_time_strings)
orage_file_init(void) { // Make sure the files we have are valid for (unsigned int i = 0; i < g_num_file_resource_stores; ++i) { // The only way we can check this file is valid is by making sure each resource in each file // is valid. // Get the length of the file to see if we're checking a large file ...
prv_app_file_open(entry, op_flags)
, num_bytes, entry_offset); } static uint32_t resource_storage_app_file_read(ResourceStoreEntry *entry, uint32_t offset, void *data, size_t num_bytes) { const uint8_t op_flags = OP_FLAG_READ | OP_FLAG_SKIP_HDR_CRC_CHECK | OP_FLAG_USE_PAGE_CACHE; return prv_file_common...
ccessful hal->i2c->CR1 &= ~I2C_CR1_PE; hal->i2c->CR1 &= ~CR1_CLEAR_MASK; // Set the timing register RCC_ClocksTypeDef rcc_clocks; RCC_GetClocksFreq(&rcc_clocks); const uint32_t timingr = i2c_timingr_calculate( rcc_clocks.PCLK1_Frequency, hal->bus_mode, hal->clock_speed, hal->rise_time_ns, hal-...
(bus, event)
; } //! Handle an IRQ event on the specified \a bus static portBASE_TYPE prv_event_irq_handler(I2CBus *bus) { I2C_TypeDef *i2c = bus->hal->i2c; I2CTransfer *transfer = &bus->state->transfer; switch (transfer->state) { case I2CTransferState_WriteRegAddress: if ((i2c->ISR & I2C_ISR_TXIS) != 0) { ...
ist); cl_assert_equal_i(size_list, (5 + 1) + (8 + 1) + (4 + 1) + 3 * sizeof(Attribute)); uint8_t *buffer = kernel_malloc_check(size_list); uint8_t *buffer_orig = buffer; AttributeList list2 = {0}; cl_assert(attribute_list_copy(&list2, &list, buffer, buffer + size_list)); // check that we haven't modified bu...
{ Attribute app_glance_subtitle_attributes[] = { { .id = AttributeIdSubtitleTemplateString, .cstring = "Your app at a glance!" }, }; AttributeList app_glance_subtitle_attribute_list = { .num_attributes = ARRAY_LENGTH(app_glance_subtitle_attributes), .attributes = app_glance_subtitl...
kernel/pbl_malloc.h" #include "kernel/ui/modals/modal_manager.h" #include "os/mutex.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "services/common/analytics/analytics.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/com...
graphics_draw_bitmap_in_rect(ctx, &data->dnd_icon, &data->dnd_icon.bounds)
; } static void prv_update_status_layer(NotificationWindowData *data) { const int notif_count = notifications_presented_list_count(); if (notif_count <= 1) { // if less than one notification, clear the status bar info status_bar_layer_reset_info(&data->status_layer); } else { // if more than one, the...
_i(state.node->duration, MINUTES_PER_DAY); cl_assert_equal_i(state.current_day, midnight_march_2_pst); // day 2 cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &multiday_item.header.id)); cl_assert(uuid_equal(&state.node->id, &multiday_item.header.id)); cl_assert(state.node->all...
{ const time_t midnight_march_3_utc = 1425340800; TimelineItem all_day_item = { .header = { .id = { 0x29, 0xac, 0xd8, 0xb5, 0x09, 0xc7, 0x4c, 0x31, 0xbf, 0x6f, 0x03, 0x64, 0xd0, 0x5b, 0x9b, 0xc2 }, .timestamp = midnight_march_3_utc, .duration = 0, .type = TimelineItemTypePi...
void test_timeline__0_duration(void) { const time_t midnight_march_3_utc = 1425340800; TimelineItem all_day_item = { .header = { .id = { 0x29, 0xac, 0xd8, 0xb5, 0x09, 0xc7, 0x4c, 0x31, 0xbf, 0x6f, 0x03, 0x64, 0xd0, 0x5b, 0x9b, 0xc2 }, .timestamp = midnight_march_3_utc, .duratio...
/* * 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...
factory_registry_protocol_msg_callback(NULL, message, sizeof(message))
; cl_assert_equal_i(s_send_data_count, 1); } void test_registry_endpoint__fail_read_other(void) { uint8_t message[] = { 0x0, 0x7, 'm', 'f', 'g', '_', 'x', 'x', 'x', }; uint8_t expected_response[] = { 0xff }; s_expected_response = expected_response; s_expected_response_length = sizeof(expected_response); ...
yer canvas; Layer layer; prv_setup_resources(); uint32_t gothic_24_handle = RESOURCE_ID_GOTHIC_24_BOLD; cl_assert(text_resources_init_font(0, gothic_24_handle, 0, &s_font_info)); test_graphics_context_init(&ctx, fb); layer_init(&canvas, &GRect(0, 0, 144, 168)); layer_set_update_proc(&canvas, &canvas_l...
(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_y.${BIT_DEPTH_NAME}.pbi")
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_across_y_second_line); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_y_second_line.${BIT_DEPTH_NAME}.pbi")); test_graphics_co...
_inbox(); cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest, BUFFER_SIZE, s_writer)); cl_assert_equal_b(true, app_inbox_service_is_being_written_for_tag(AppInboxServiceTagUnitTest)); } ///////////////////////////////////////////////////////...
cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1))
; cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); // Message 2: cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest, 1, s_writer)); cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1)); cl_assert_equal_b(true, app_inbo...
4, 288, -304}, { 1448, 216, -200}, { 1176, 368, -464}, { 936, 512, -360}, { 768, 536, -360}, { 752, 568, -328}, { 880, 576, -384}, { 944, 592, -320}, { 984, 664, -376}, { 888, 688, -312}, { 1000, 664, -256}, { 1160, 656, -152}, // 29 seconds { 1048, 736, -320}, { ...
{ 1448, 216, -224}, { 1208, 256, -232}, { 904, 384, -352}, { 744, 480, -336}, { 688, 400, -256}, { 768, 424, -272}, { 872, 472, -368}, { 856, 520, -376}, { 984, 576, -440}, { 952, 624, -336}, { 1272, 640, -288}, { 1256, 656, -344}, { 1168, 704, -400}, { 1432, 632,...
{ 1176, 616, -392}, { 1464, 528, -264}, { 1568, 440, -112}, { 1408, 352, -104}, { 1096, 304, -120}, { 904, 272, -72}, { 880, 248, -80}, // 37 seconds { 904, 216, -96}, { 832, 168, -80}, { 800, 120, -80}, { 912, 120, -144}, { 928, 16, -152}, { 1096, -40, -144}, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_ASSERTN(ctx); if (ctx->lock) { return; } point.x += ctx->draw_state.drawing_box.origin.x; point.y += ctx->draw_state.drawing_box.origin.y; graphics_private_set_pixel(ctx, point); }
T_STATIC void prv_fill_rect_legacy2(GContext *ctx, GRect rect, uint16_t radius, GCornerMask corner_mask, GColor fill_color) { if (gcolor_is_transparent(fill_color)) { fill_color = GColorWhite; } // as this function will only be called with radius 0 to or // to support the legacy2 behavior (where the ...
; i < num_regions; i++) { cl_assert_equal_i(pfs_seek(fd, i * sizeof(buf), FSeekSet), i * sizeof(buf)); uint8_t read_byte; for (int j = 0; j < 16; j++) { cl_assert_equal_i(pfs_read(fd, &read_byte, sizeof(read_byte)), sizeof(read_byte)); cl_assert_equal_i(read_byte, 0xff - i); } } pfs_clo...
(fd, buf, 1)
; cl_assert(rv == E_RANGE); rv = pfs_seek(fd, 0, FSeekSet); cl_assert(rv == 0); rv = pfs_read(fd, NULL, rd_len); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_read(fd, buf, rd_len + 1); cl_assert(rv == E_RANGE); } void test_pfs__close(void) { // shouldn't be able to close fds that are not open int rv...
/* * 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...
(0x9400d3)
}, {"deeppink", GColorARGB8FromHEX(0xff1493)}, {"deepskyblue", GColorARGB8FromHEX(0x00bfff)}, {"dimgray", GColorARGB8FromHEX(0x696969)}, {"dimgrey", GColorARGB8FromHEX(0x696969)}, {"dodgerblue", GColorARGB8FromHEX(0x1e90ff)}, {"firebrick", GColorARGB8FromHEX(0xb22222)}, {"floralwhite", GColorARGB8FromHEX(...
t = ClickHandlerOffsetRawUp; break; case 'd': offset = ClickHandlerOffsetRawDown; break; default: return; } prv_dispatch_event(&(app_state_get_click_manager()->recognizers[button]), offset, needs_reset); } void click_recognizer_handle_button_down(ClickRecognizer *recognizer) { re...
for (unsigned int button_id = 0; button_id < ARRAY_LENGTH(click_manager->recognizers); ++button_id) { ClickRecognizer *recognizer = &click_manager->recognizers[button_id]; recognizer->button = button_id; prv_click_reset(recognizer); }
} void click_manager_clear(ClickManager* click_manager) { for (unsigned int button_id = 0; button_id < ARRAY_LENGTH(click_manager->recognizers); ++button_id) { prv_click_reset(&click_manager->recognizers[button_id]); click_manager->recognizers[button_id].config = (ClickConfig){}; } } void click_ma...
s), .attributes = attributes, }, .action_group = { .num_actions = ARRAY_LENGTH(actions), .actions = actions, } }; notification_storage_store(&e); TimelineItem r; cl_assert(notification_storage_get(&id, &r)); compare_notifications(&e, &r); free(r.allocated_buffer); cl_asser...
(notification_storage_get(&i, &r))
; cl_assert(uuid_equal(&e.header.id, &r.header.id)); cl_assert_equal_i(e.header.ancs_uid, r.header.ancs_uid); cl_assert_equal_i(TimelineItemStatusActioned, r.header.status); cl_assert_equal_i(e.header.timestamp, r.header.timestamp); cl_assert_equal_i(e.header.layout, r.header.layout); compare_attr_list(e.at...
static IncomingPulseFrame *s_receive_buffers[FRAME_POOL_SIZE]; static IncomingPulseFrame *s_current_receive_buffer; static CobsDecodeContext s_frame_decode_ctx; static bool s_drop_rest_of_frame; static PebbleMutex *s_tx_buffer_mutex; static char s_tx_buffer[MAX_SIZE_AFTER_COBS_ENCODING( PULSE_MAX_SEND_SIZE ...
{ IncomingPulseFrame *frame = frame_ptr; uint32_t fcs; // Comply with strict aliasing rules. The memcpy is optimized away. memcpy(&fcs, &frame->data[frame->length - sizeof(fcs)], sizeof(fcs)); uint32_t crc = legacy_defective_checksum_memory( &frame->data, frame->length - sizeof(fcs)); if (fcs == crc)...
static void prv_assert_tx_buffer(void *buf) { // Ensure the buffer is actually a PULSE transmit buffer bool buf_valid = false; if (buf == s_tx_buffer + COBS_OVERHEAD(PULSE_MAX_SEND_SIZE) + LINK_HEADER_LEN) { buf_valid = true; } PBL_ASSERT(buf_valid, "Buffer is not from the PULSE transmit buffer pool"); ...
{{0x22, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}}; char name_2[BT_DEVICE_NAME_BUFFER_SIZE] = "Device 2"; uint8_t platform_bits_2 = 0x22; BTBondingID id_2 = bt_persistent_storage_store_bt_classic_pairing(&addr_2, &link_key_2, ...
(id_1 != BT_BONDING_ID_INVALID)
_store); // Make sure the our existing prefs got updated iOSNotifPrefs expected_prefs = { .attr_list = expected_attributes, }; prv_compare_notif_prefs(existing_prefs, &expected_prefs); } void test_ancs_filtering__record_app_existing_display_name(void) { // We got a new app name, make sure it gets update...
(&mute_weekdays)
); } void test_ancs_filtering__record_app_no_display_name(void) { iOSNotifPrefs *existing_prefs = NULL; // No display name so we expect the app name to be the title AttributeList expected_attributes = { .num_attributes = 3, .attributes = (Attribute[]) { { .id = AttributeIdAppName, .cstring = "Appl...
; } else { dbgserial_putstr(response); } } static void prv_dbgserial_command_complete_callback(void) { SerialConsoleState state = serial_console_get_state(); if (state == SERIAL_CONSOLE_STATE_PULSE) { prv_pulse_done_command(); } else if (state == SERIAL_CONSOLE_STATE_PROMPT) { start_prompt(); }...
{ prompt_command_finish(); }
} static void prv_find_and_execute_command(char* cmd, size_t cmd_len, PromptContext *context) { if (!cmd_len) { // Empty command. s_executing_command = ExecutingCommandNone; return; } s_current_context = context; bool command_found = false; for (unsigned int i = 0; i < NUM_PROMPT_COMMANDS; ++i...
empty uint8_t dummy_data = 0x55; flash_write_bytes(&dummy_data, FLASH_REGION_FIRMWARE_SCRATCH_BEGIN, sizeof(dummy_data)); profiler_start(); status_t result = flash_impl_erase_sector_begin(FLASH_REGION_FIRMWARE_SCRATCH_BEGIN); flash_impl_get_erase_status(); if (result == S_SUCCESS) { while (flash_impl_g...
{ prompt_send_response("Done!"); s_signal_test_initialized = true; }
else { prompt_send_response("ERROR: Data read (SDR mode) did not match data written!"); } } void command_flash_signal_test_run(void) { if (!s_signal_test_initialized) { prompt_send_response("ERROR: 'flash signal test init' must be run first!"); return; } QSPIFlash *dev = QSPI_FLASH; qspi_use(QS...
{ s_scheduled_jobs = list_sorted_add(s_scheduled_jobs, &job->list_node, prv_sort, true); } PBL_LOG(LOG_LEVEL_DEBUG, "Cron job scheduled for %ld (%+ld)", job->cached_execute_time, (job->cached_execute_time - now)); mutex_unlock(s_list_mutex); return job->cached_execute_time; } // --------------...
{ return 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...
gatt_client_subscriptions_get_notification_header(GAPLEClientApp, &header)
/* * 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 (s_can_send_event) { EventNode *node = (EventNode *)malloc(sizeof(EventNode)); *node = (const EventNode) { .event = *e, }; s_event_head = (EventNode *)list_prepend((ListNode *)s_event_head, (ListNode *)node); }
on #define LAYOUT_MAX_HEIGHT 2500 #define CARD_MARGIN PBL_IF_ROUND_ELSE(12, 10) // All paddings relate to padding above the object unless othersize noted #define CARD_BOTTOM_PADDING 18 // The y-position of a layout frame when its banner is peeking #define BANNER_PEEK_STATIC_Y (DISP_ROWS - STATUS_BAR_LAYER_HEIGHT) #def...
(buffer, config->buffer_size, layout->info.item->header.timestamp)
; } #if !PLATFORM_TINTIN static const EmojiEntry s_emoji_table[] = JUMBOJI_TABLE(EMOJI_ENTRY); static bool prv_each_emoji_codepoint(int index, Codepoint codepoint, void *context) { Codepoint *emoji_codepoint = context; if (codepoint_is_end_of_word(codepoint) || codepoint_is_formatting_indicator(codepoint) |...
/* * 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...
{ kino_layer->alignment = alignment; layer_mark_dirty(&kino_layer->layer); }
_bytes); } } memset(dest_bitmap_data, GColorWhite.argb, sizeof(dest_bitmap_data)); #if SCREEN_COLOR_DEPTH_BITS == 8 char print_buf[20]; for (int y = 0; y < HEIGHT; ++y) { for (int x = 0; x < WIDTH; ++x) { snprintf(print_buf, sizeof(print_buf), "Failed index = %d, %d", x, y); cl_check_(gcolo...
if (s_palette[idx].a == 3) { s_palette[idx] = GColorWhite; }
} break; } default: break; } cl_assert(prv_check_source_stripe_blit(dest_bitmap_data, &s_bmp, GColorWhite)); } static void prv_4bit_simple(GCompOp compositing_mode, GColor color, bool transparent) { const int BITS_PER_PIXEL = 4; const int PIXELS_PER_BYTE = (8 / BITS_PER_PIXEL); co...
e stack is only 8192 bytes static uint8_t buffer[MAX_CHUNK_SIZE]; uint32_t chunk_size; for (uint32_t i = 0; i < firmware_length; i += chunk_size) { chunk_size = MIN(MAX_CHUNK_SIZE, firmware_length - i); flash_read_bytes(buffer, flash_new_fw_start + i, chunk_size); if (!system_flash_write(FIRMWARE_BASE...
(BOOT_BIT_NEW_FW_INSTALLED)
; } bool switch_to_recovery_fw() { dbgserial_putstr("Loading recovery firmware"); UpdateFirmwareResult result = update_fw(FLASH_REGION_SAFE_FIRMWARE_BEGIN); bool recovery_fw_ok = true; switch (result) { case UPDATE_FW_SUCCESS: boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE); boot_bit_clear(BO...
/* * 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(log_contains_build_id)
/* * 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...
(animation)
quick_launch_get_app(BUTTON_ID_BACK)
, #endif watchface_get_default_install_id(), worker_preferences_get_default_worker(), }, }; settings_file_each(&file, prv_each_free_up_space, &evict_data); settings_file_close(&file); // remove all nodes found EvictListNode *node = evict_data.list; while (node) { Ev...
ght of the current line in next_line_y_extent, so text will stop // being layed out immediately after it exceeds the height of the container. next_line_y_extent = line_iter_state->current->origin.y + prv_get_line_height(text_box_params); } else { // We're either in a non-truncating mode, or on the first l...
(&char_iter, &char_iter_state, text_box_params, word->start)
; Utf8IterState* utf8_iter_state = &char_iter_state.utf8_iter_state; if (utf8_iter_state->codepoint != codepoint) { return false; } bool is_advanced = iter_next(&char_iter); if (!is_advanced) { PBL_ASSERTN(*word->end == NULL_CODEPOINT); word->start = NULL; return false; } if (word->en...
rdays"); bool schedule_9[7] = {true, false, false, false, false, false, false}; char alarm_day_text_9[32] = {0}; alarm_get_string_for_custom(schedule_9, alarm_day_text_9); cl_assert_equal_s(alarm_day_text_9, "Sundays"); } void test_alarm__alarm_set_get_enabled(void) { AlarmId id1, id2; id1 = alarm_create(...
(alarm_get_string_for_kind(ALARM_KIND_CUSTOM, all_caps), "CUSTOM")
; } void test_alarm__handle_clock_change(void) { AlarmId id1, id2; id1 = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_WEEKENDS }); id2 = alarm_create(&(AlarmInfo) { .hour = 13, .minute = 14, .kind = ALARM_KIND_WEEKDAYS }); s_current_hour = 12; s_current_minute = 14; alarm_handle...
"draw_circle_offset_r8_quad_bottom_left.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_circle_quadrant_draw_1px_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, GCornerBottomRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset...
(&layer, &white_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_c...
/* * 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 int32_t data[] = { 10, 40, 6, 32, 73, 80, 34, 25, 62 }; const size_t num_data = ARRAY_LENGTH(data); const StatsBasicOp op = StatsBasicOp_Sum; int32_t result; stats_calculate_basic(op, data, num_data, NULL, NULL, &result); cl_assert_equal_i(result, 362); }
static void *s_context = NULL; static bool prv_filter(int index, int32_t value, void *context) { cl_assert_equal_p(context, &s_context); return (value > 0); } void test_stats__filtered_count(void) { const int32_t data[] = { 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0 }; const size_t num_da...
(count == 2)
; break; } if (!iter_next(&line_iter)) { // Should not get here cl_assert(false); break; } } }
/* * 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...
(b, 1*sizeof(uint8_t), 2*sizeof(uint8_t))
); cl_assert_equal_i(2, b->bytes_written); cl_assert_equal_i(b->data[0], b1); cl_assert_equal_i(b->data[1], b4); free(b); } void test_buffer__can_remove_interior_data(void) { uint8_t b1 = 1; uint8_t b2 = 2; uint8_t b3 = 3; uint8_t b4 = 4; Buffer *b = buffer_create(4); buffer_add(b, &b1, sizeof(ui...
line2.origin.y = line.origin.y; line2.size.w = REL_BAR_LINE_CHECK_LENGTH + REL_BAR_LINE_WIDTH; line2.size.h = REL_BAR_LINE_WIDTH; graphics_fill_rect(ctx, &line2); } #define REL_BAR_DOT_SIZE 2 static void prv_draw_rel_bar_dotted(TimelineLayer *timeline_layer, GContext* ctx, ...
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_length) * timeline_layer->move_delta; } if (((line_length <= 0) && current) || ((!...
/* * 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; // Cache for this app has been deleted, don't rewrite it }
/* * 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...
mutex_unlock(s_mutex)
, true); // All windows below the current priority should now not be on the screen // as the modal has subverted them. ModalPriority sub_idx = idx; do { sub_idx--; if (sub_idx == ModalPriorityInvalid) { break; } cl_assert_equal_i(window_stack_count(window_stacks[sub_idx]...
(modal_manager_get_properties(), ModalProperty_Exists | ModalProperty_CompositorTransitions | ModalProperty_RenderRequested)
; cl_assert_equal_i(windows[3][0]->on_screen, true); cl_assert_equal_i(windows[3][0]->is_click_configured, true); cl_assert_equal_i(windows[2][1]->on_screen, false); cl_assert_equal_i(windows[2][1]->is_click_configured, false); cl_assert_equal_p(s_last_click_configured_window, windows[3][0]); // Add priori...
bt_test.h" #include "board/board.h" #if CAPABILITY_HAS_MICROPHONE #include "drivers/mic.h" #endif #include "services/common/bluetooth/bt_compliance_tests.h" #if CAPABILITY_HAS_BUILTIN_HRM #include "services/common/hrm/hrm_manager.h" #endif #include "kernel/pbl_malloc.h" #include "process_management/app_manager.h" #incl...
{ // RX Test, need to keep track of received packets // Payload is as follows: // | 1 byte | 2 bytes | // | success | recieved packets | // So we want grab a uint16_t from 1 byte into the payload const uint16_t *received_packets = (uint16_t *)(payload + 1); data->rx_test_received_p...
data->last_test_step_result = success; xSemaphoreGive(data->btle_test_semaphore); } #if CAPABILITY_HAS_MICROPHONE static void prv_mic_cb(int16_t *samples, size_t sample_count, void *context) { // Just throw away the recorded samples. } #endif static bool prv_run_test_step(BTLETestStep step, AppData *data) { ...
License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific ...
(&success, "In\n\n\nN\nout")
; cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .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 == 'I'); cl_assert(*word...
/* * 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...
delay_ms(200)
; display_error_code(0xdeadbeef); delay_ms(200); display_boot_splash(); delay_ms(1000); } } #endif void display_init(void) { display_start(); if (!prv_reset_fpga()) { dbgserial_putstr("FPGA configuration failed."); return; } // enable the power rails display_power_enable(); // s...
dialog_get_dialog(expandable_dialog); dialog_set_background_color(dialog, GColorRed); } static void prv_show_expandable_dialog(DialogsData *data) { ExpandableDialog *expandable_dialog = expandable_dialog_create("Expandable Dialog"); Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog); dialog_set_t...
(dialog, GColorLightGray)
; dialog_show_status_bar_layer(dialog, true); expandable_dialog_show_action_bar(expandable_dialog, true); app_expandable_dialog_push(expandable_dialog); } //////////////////////////////// // Voice Dialog static void prv_transcription_dialog_cb(void *context) { DialogsData *data = context; SimpleDialog *simp...
type) || (start_size == 0)) { return (E_INVALID_ARGUMENT); } File *file = &PFS_FD(fd).file; file->file_size = start_size; file->file_type = file_type; // temporarily mark the file as in use so no one tries to use the fd once we // release the lock if (fd != GC_FD_HANDLE_ID) { FileDesc *file_desc...
if (create) { file->op_flags |= OP_FLAG_WRITE; }
file->offset = 0; // (re)set seek position file->is_tmp = false; if (s_gc_block.block_valid && create) { prv_flash_erase_sector(s_gc_block.gc_start_page); } int res = file_found_or_added_to_pfs(fd, GC_FILE_NAME, file->op_flags, FILE_TYPE_STATIC, space_needed); PBL_ASSERTN(!create || res >= 0);...
Z mode // when the mic is asleep, so the signal could float around and waste // power if the pin is configured as a digital input. gpio_af_configure_low_power(&this->sd_gpio); } static void prv_dfsdm_configure(MicDevice *this) { const uint32_t k_max_sinc4_osr = 255; PBL_ASSERTN(this->pdm_frequency > 0); P...
mutex_lock_recursive(this->state->mic_mutex)
; bool success = false; if (this->state->running) { goto unlock; } circular_buffer_init(&this->state->circ_buffer, this->state->circ_buf_store, DFSDM_CIRC_BUFFER_SIZE); this->state->subscriber = (struct MicSubscriber) { .callback = data_handler, .b...
cases test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_nx_zero_y_offset); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_nx_zero_y_offset.${BIT_DEPTH_NAME}.pbi")); test_gr...
(&layer, &draw_text_single_line_wordwrap_clip_across_nx)
; layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_nx.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_across_x); layer_render_tree(&canvas, &ctx); cl_ch...
ncher_task_add_callback(void (*callback)(void *data), void *data) { callback(data); } // Tests /////////////////////////////////////////////////////////// void test_bluetooth_persistent_storage__initialize(void) { bonding_sync_init(); fake_spi_flash_init(0, 0x1000000); pfs_init(false); s_ble_bonding_change...
cl_assert_equal_b(bt_persistent_storage_has_pinned_ble_pairings(), false)
; // Read it back ret = bt_persistent_storage_get_ble_pairing_by_id(id_1, &irk_out, &device_out, NULL /* name */); cl_assert(ret); cl_assert_equal_m(&irk_out, &pairing_1.irk, sizeof(irk_out)); cl_assert_equal_m(&device_out, &pairing_1.identity, sizeof(device_out)); // Store another pairing SMPairingInfo...
http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing pe...
prv_exti_line_to_bit(exti_line)
}, { 0, 0x66, 922, 0x0}, { 0, 0x69, 2359, 0x0}, { 0, 0x67, 1869, 0x0}, { 0, 0x66, 874, 0x0}, // 555: Local time: 04:46:00 AM { 0, 0x76, 125, 0x0}, { 0, 0x75, 3099, 0x0}, { 0, 0x6f, 32, 0x0}, { 0, 0x6f, 0, 0x0}, { 0, 0x6f, 0, 0x0}, { 0, 0x6f, 0, 0x0}, { 0, 0x6f,...
{ 11, 0x52, 3692, 0x0}, { 16, 0x53, 4885, 0x0}, { 6, 0x52, 4215, 0x0}, // 30: Local time: 08:00:00 PM { 0, 0x42, 2813, 0x0}, { 0, 0x54, 4750, 0x0}, { 0, 0x54, 3097, 0x0}, { 23, 0x53, 5092, 0x0}, { 18, 0x64, 5601, 0x0}, { 0, 0x55, 3364, 0x0}, { 0, 0x24, 1850, 0x0}, ...
{ 0, 0x78, 486, 0x0}, { 0, 0x6a, 2502, 0x0}, { 0, 0x78, 486, 0x0}, { 0, 0x6a, 2502, 0x0}, { 0, 0x78, 486, 0x0}, { 0, 0x6a, 2502, 0x0}, { 0, 0x78, 486, 0x0}, { 0, 0x75, 0, 0x0}, { 0, 0x75, 13, 0x0}, { 0, 0x75, 0, 0x0}, // 90: Local time: 09:00:00 PM { 0, 0x75, ...
L_DEBUG, "Ignoring outgoing call. A call is already in progress: %d, " // "the mobile app is connected: %d", s_call_in_progress, s_mobile_app_is_connected); } } static void prv_handle_missed_call(PebblePhoneEvent *event) { if (s_call_in_progress) { prv_call_end_common(); phone_ui_handle_missed_call...
{ if (!e->bluetooth.comm_session_event.is_system) { return; } s_mobile_app_is_connected = e->bluetooth.comm_session_event.is_open; if (!s_mobile_app_is_connected && (s_call_source != PhoneCallSource_ANCS)) { prv_handle_call_end(true /* disconnected */); } }
T_STATIC void prv_handle_ancs_disconnected_event(PebbleEvent *e, void *context) { if (s_call_source == PhoneCallSource_ANCS) { prv_handle_call_end(true /* disconnected */); } } //! //! Phone Call API //! void phone_call_service_init() { static EventServiceInfo phone_event_info; phone_event_info = (EventS...
sole/prompt.h" #include "kernel/pbl_malloc.h" #include "os/mutex.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/settings/settings_file.h" #include "services/normal/timeline/attributes_actions.h" #include "system/logging.h" #include "system/passert.h" #include "util/attributes.h" #include "util...
strncpy(buffer, (const char *)app_id, key_len)
; buffer[key_len] = '\0'; PBL_LOG(LOG_LEVEL_ERROR, "Could not parse serial data for <%s>", buffer); prv_free_serialzed_prefs(serialized_prefs); return NULL; } const size_t alloc_size = attributes_actions_get_required_buffer_size(serialized_prefs->num_attributes, ...
/* * 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->num, "Some Number", (NumberWindowCallbacks) { .selected = selected }, data)
; number_window_set_min(&data->num, 10); number_window_set_max(&data->num, 100); number_window_set_step_size(&data->num, 5); const bool animated = true; app_window_stack_push(&data->num.window, animated); } static void handle_deinit(void) { AppData *data = app_state_get_user_data(); app_free(data); } ...
der 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 in writing, software * distributed under the Lice...
(" bytes")
; void *system_flash_base = (void*)FIRMWARE_OLDWORLD_BASE; if (firmware_is_new_world(NULL)) { dbgserial_putstr("New World firmware system_flash_base"); system_flash_base = (void*)FIRMWARE_NEWWORLD_BASE; } else { dbgserial_putstr("Old World firmware system_flash_base"); } uint32_t calculated_crc ...
onst rect_clipper) { int16_t overflow; if (rect_to_clip->origin.x < rect_clipper->origin.x) { overflow = rect_clipper->origin.x - rect_to_clip->origin.x; if (overflow > rect_to_clip->size.w) { rect_to_clip->size.w = 0; } else { rect_to_clip->size.w -= overflow; } rect_to_clip->origin...
{ rect->origin.x = ((inside_rect->size.w - rect->size.w) / 2) + inside_rect->origin.x; rect->origin.y = (inside_rect->size.h - rect->size.h) + inside_rect->origin.y; return; }
case GAlignRight: { rect->origin.x = (inside_rect->size.w - rect->size.w) + inside_rect->origin.x; rect->origin.y = ((inside_rect->size.h - rect->size.h) / 2) + inside_rect->origin.y; return; } case GAlignBottomRight: { rect->origin.x = (inside_rect->size.w - rect->size.w) + inside_...
ayer(swap_layer); } static Animation *prv_create_swap_down_animation(SwapLayer *swap_layer) { // Compute the animation distance const GRect *prev_frame = &swap_layer->previous->layer.frame; int16_t dy = -(prev_frame->origin.y + prev_frame->size.h); ScrollAnimationCurve swap_down_scroll_curve = (ScrollAnimatio...
animation_set_handlers(animation, (AnimationHandlers) { .started = (direction == ScrollDirectionDown) ? prv_swap_down_start : prv_swap_up_start, .stopped = (direction == ScrollDirectionDown) ? prv_swap_down_complete : prv_swap_up_complete, }, swap_layer)
; swap_layer->animation = animation; animation_schedule(animation); #if PBL_ROUND // Skip the animation on round, because it looks bad if (full_swap) { animation_set_elapsed(animation, animation_get_duration(animation, true, true)); } #endif return true; } //! Computes the amount the current layer fram...
/* * 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...
{ update("1111", 4); assert_checksum(0x13cbc447); }
d clar_run_single(const struct clar_func *test, const struct clar_suite *suite) { _clar.suite_errors = 0; _clar.active_suite = suite->name; _clar.active_test = test->name; clar_run_test(test, &suite->initialize, &suite->cleanup); } #endif static void clar_usage(const char *arg) { printf("Usage: %s [option...
for (j = 0; j < _clar_suite_count; ++j) { const struct clar_suite *suite = &_clar_suites[j]; for (int i = 0; i < suite->test_count; i++) { printf(" %s\n", suite->tests[i].name); } } printf("\n"); exit(0); } default: clar_usage(argv[0]); } ...
ineItemTypeReminder, .layout_id = LayoutIdReminder, .icon_id = TIMELINE_RESOURCE_NOTIFICATION_REMINDER, .title = "Implementation Design Review", .location = "High (Room 12)\nPebble PA Office", .body = "with Liron Damir and 10 other people", .time_offset = MINUTES(10), } }; #define NUM_NOTIFS ...
layer_add_child(root, (Layer *)status_layer)
; swap_layer_set_click_config_onto_window(swap_layer, window); } static void handle_init(void) { SwapLayerDemoData *data = app_malloc_check(sizeof(SwapLayerDemoData)); memset(data, 0, sizeof(SwapLayerDemoData)); app_state_set_user_data(data); Window *window = &data->window; window_init(window, WINDOW_NA...
ORKER_RAM__; ram_end = __WORKER_RAM_end__; } else { WTF; } // check for vulnerability: lower_bound outside of task's region PBL_ASSERTN(lower_bound >= ram_start); return (address >= lower_bound && address < ram_end); } // -----------------------------------------------------------------------------...
{ return process_metadata_get_sdk_version(sys_process_manager_get_current_process_md()); }
DEFINE_SYSCALL(PlatformType, process_manager_current_platform, void) { PebbleTask task = pebble_task_get_current(); if (task != PebbleTask_App && task != PebbleTask_Worker) { return PBL_PLATFORM_TYPE_CURRENT; } const PebbleProcessMd *const md = sys_process_manager_get_current_process_md(); return proce...
ck(void (*callback)(void *data), void *data) { } // Tests /////////////////////////////////////////////////////////// void test_compositor__initialize(void) { s_animation_implementation = NULL; s_last_event = (PebbleEvent) { .type = 0 }; s_modal_window_present = false; s_count_animation_create = 0; s_co...
cl_assert_equal_i(s_count_animation_create, 0)
; // Start the animation s_display_update_in_progress = false; prv_handle_display_update_complete(); cl_assert_equal_i(s_count_animation_create, 1); cl_assert_equal_i(s_count_animation_schedule, 1); } void test_compositor__app_no_animation(void) { // Start a transition. We shouldn't update the screen beca...
}, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, }, { .header = { // [3] .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4}, .parent_id = {0}, .timestamp ...
(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...
/* * 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_cancel_recording()
; prv_reset(); } static void prv_start_result_timeout(void) { new_timer_start(s_timeout, TIMEOUT_SESSION_RESULT, prv_session_result_timeout, NULL, 0); } static void prv_audio_transfer_stopped_handler(AudioEndpointSessionId session_id) { if (s_session_id != session_id) { PBL_LOG(LOG_LEVEL_WARNING, "Received ...
TextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } // Word Wrap Tests void draw_text_single_line_wordwrap_clip_across_ny(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, -18, 72, 32), GTex...
layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_ny_descender)
; layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_ny_descender.${BIT_DEPTH_NAME}.pbi")); // Ellipsis tests test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_ny); layer_rend...
ngth / 1000); } } static void prv_update_pos(void) { MusicAppData *data = app_state_get_user_data(); music_get_pos(&data->track_pos, &data->track_length); prv_update_track_progress(data); } static void prv_handle_tick_time(struct tm *time, TimeUnits units_changed) { if (music_get_playback_state() == MusicPl...
(GAlignTopLeft, GAlignTopRight)
; bitmap_layer_set_alignment(&data->cassette_layer, CASSETTE_LAYER_ALIGNMENT); bitmap_layer_set_compositing_mode(&data->cassette_layer, GCompOpSet); layer_add_child(&data->cassette_container, &data->cassette_layer.layer); progress_layer_init(&data->track_pos_bar, &track_rect); progress_layer_set_background_c...
/* * 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...
setup_png_test(TEST_PNG_FILE_FMT(2bitpalette))
; cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(2bitpalette))); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat2BitPalette); } // Tests 4-bit palettized PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__color_4_bit(void) { GBitmap *bitmap = setup_png_t...
ngth); } else { attr_length = attribute->length; } *buffer += attr_length + 1; PBL_ASSERTN(*buffer <= buf_end); memcpy(notif_attr->cstring, *cursor, attr_length); notif_attr->cstring[attr_length] = '\0'; break; } case AttributeTypeUint8: if (attribute->len...
(attr_list->attributes[i].id)
//////////////// //! Helpers static KinoReel* prv_get_icon_for_activity(ActivitySessionType type) { switch (type) { case ActivitySessionType_Open: return kino_reel_create_with_resource(RESOURCE_ID_WORKOUT_APP_WORKOUT); case ActivitySessionType_Walk: return kino_reel_create_with_resource(RESOURCE_...
window_init(window, WINDOW_NAME("Workout Summary"))
; window_set_user_data(window, summary_window); window_set_background_color(window, BACKGROUND_COLOR); window_set_window_handlers(window, &(WindowHandlers){ .unload = prv_window_unload_handler, }); GRect layer_bounds = window->layer.bounds; layer_bounds.size.w -= ACTION_BAR_WIDTH; layer_init(&summar...
, 104, -88}, { 928, 112, -96}, { 920, 136, -96}, { 936, 160, -96}, { 936, 176, -96}, { 928, 160, -96}, { 912, 184, -88}, { 920, 168, -96}, { 936, 176, -88}, { 936, 176, -96}, { 936, 176, -88}, { 912, 176, -88}, { 888, 176, -80}, { 904, 184, -80}, { 912, 184, -72},...
{ 984, 192, -80}, { 744, 208, -120}, // 124 seconds { 544, 184, -128}, { 432, 176, -136}, { 464, 136, -112}, { 616, 136, -128}, { 928, 192, -192}, { 1216, 256, -280}, { 1192, 280, -296}, { 1208, 264, -264}, { 1336, 312, -248}, { 1088, 288, -264}, { 928, 256, -208}...
{ 1080, 320, -304}, { 1088, 280, -280}, { 1392, 288, -216}, { 1208, 304, -232}, { 1184, 296, -152}, { 1248, 304, -88}, { 1208, 264, -72}, { 1040, 248, -32}, { 784, 200, -48}, { 656, 160, -40}, // 127 seconds { 624, 32, 24}, { 688, 136, 0}, { 760, 120, -16}, {...
ntionally relies on some state that the // bootloader leaves behind. This includes disabling the PLL. // GPIOs are not reset here: resetting them would change their output values, // which could unintentionally turn of e.g. PMIC power rails. // The backup domain is not reset; that would be foolish. const uint...
(BOOT_BIT_RESET_LOOP_DETECT_TWO)
; boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_THREE); return true; } switch (++counter) { case 1: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 2: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; case 3: boot_bit_se...
ero); layer_add_child(root, &layer_a); layer_add_child(root, &layer_b); layer_add_child(&layer_a, &layer_c); recognizer_add_to_list(recognizers[0], window_get_recognizer_list(&window)); recognizer_add_to_list(recognizers[1], &layer_a.recognizer_list); recognizer_add_to_list(recognizers[2], &layer_b.recogni...
recognizer_add_to_list(recognizers[3], &layer_c.recognizer_list)
; recognizer_add_to_list(recognizers[4], s_app_list); s_active_layer = &layer_c; TouchEvent e = { .type = TouchEvent_PositionUpdate }; // No active recognizers because manager is waiting for a touchdown event recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed(NULL, 0, &...
g_reset_complete_remote_initiated(); RCV_RESET_COMPLETE(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateSessionOpen); } void test_rocky_api_app_message__session_open__rcv_reset_request(void) { prv_init_and_goto_session_open(); EXECUTE_SCRIPT("var isCalled = false;" "_r...
prv_postmessageconnected_postmessagedisconnected_negotiate_to_open_session()
; ASSERT_JS_GLOBAL_EQUALS_I("c", 1); ASSERT_JS_GLOBAL_EQUALS_I("d", 1); } // TODO: test various min/max version combos // TODO: test RX/TX buffer size combos //////////////////////////////////////////////////////////////////////////////// // Generic Tests /////////////////////////////////////////////////////////...
cl_assert_equal_m(&item2.header.id, stub_new_timer_callback_data(get_reminder_timer_id()), sizeof(TimelineItemId)); cl_assert(stub_new_timer_timeout(get_reminder_timer_id()) == 100 * 1000); // ...until we insert item 1 back cl_assert(S_SUCCESS == reminders_insert(&item1)); cl_assert_equal_m(&item1.header.id, s...
(&s_all_day_reminder)
, S_SUCCESS); cl_assert_equal_i(reminders_insert(&s_reminder_before_all_day_reminder), S_SUCCESS); // set time to 16:00 PST March 4 now = 1425513600; reminders_init(); cl_assert_equal_i(stub_new_timer_timeout(get_reminder_timer_id()), 5 * 60 * 60 * 1000); cl_assert(uuid_equal(&s_reminder_before_all_day_rem...
prv_receive_put(s_last_response_cookie, chunk, sizeof(chunk))
; prv_process_and_reset_test_counters(); prv_receive_commit(s_last_response_cookie, EXPECTED_CRC); prv_process_and_reset_test_counters(); prv_receive_install(s_last_response_cookie); } // Tests /////////////////////////////////////////////////////////// static void prv_system_msg_sent_callback(uint16_t endp...
/* * 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->angle = rand() % TRIG_MAX_ANGLE; }
KinoReel *reel = kino_reel_scale_segmented_create(from_reel, take_ownership, screen_frame); if (reel) { const bool take_ownership = true; kino_reel_scale_segmented_set_delay_lookup_creator(reel, prv_create_lookup_by_angle, ctx, take_ownership); ki...
isplay_write_byte(arg); } static void prv_end_command(void) { while (SPI_I2S_GetFlagStatus(DISP_SPI, SPI_I2S_FLAG_BSY)) continue; GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET); } static bool prv_wait_busy(void) { // The display should come out of busy within 35 milliseconds; // it is a waste of time to wait...
for (int retries = 0; retries <= 20; ++retries) { prv_draw_scene(SCENE_SPLASH); if (prv_wait_busy()) { prv_screen_on(); dbgserial_print("Display initialized after "); dbgserial_print_hex(retries); dbgserial_putstr(" retries."); return; } prv_reset_fpga(); }
// It's taken too many attempts and the FPGA still isn't behaving. Give up on // showing the splash screen and keep the screen off so that the user doesn't // see a broken-looking staticky screen on boot. dbgserial_putstr("Display initialization failed."); prv_screen_off(); } void display_boot_splash(void)...
ll_layer)) { draw_func = prv_draw_pdc_bw_inverted; } #endif // Inset the draw box from the left to leave some margin on the icon's left side GRect box = cell_layer_bounds; box.origin.x += icon_left_margin; // Align the icon to the left of the draw box, centered vertically GRect icon_rect...
(TextStyleFont_MenuCellSubtitle)
; prv_draw_notification_cell_round(ctx, cell_layer, &frame, title_font, title, subtitle_font, subtitle, icon); } static void prv_draw_notification_cell_round_unselected(GContext *ctx, const Layer *cell_layer, const char *title...
ox(void); /* From clar_mock.c */ static void clar_mock_reset(void); static void clar_mock_cleanup(void); /* From clar_categorize.c */ static int clar_category_is_suite_enabled(const struct clar_suite *); static void clar_category_enable(const char *category); static void clar_category_enable_all(size_t, const struct ...
{ is_num = 0; if (*argument == ':') has_colon = 1; }
to touch the weather data we're about to // update animation_unschedule_all(); size_t forecasts_count_out = 0; WeatherDataListNode *forecasts_list_head = weather_service_locations_list_create(&forecasts_count_out); WeatherAppData *data = app_state_get_user_data(); weather_service_locations_list_dest...
weather_app_layout_init(layout, layout_frame)
; window_set_user_data(window, layout); // Fetch initial data prv_handle_weather(NULL, NULL); if (data->forecasts_count == 0) { return; } const bool animated = true; app_window_stack_push(&data->window, animated); // Request the default forecast separately instead of using the forecast list in `...
plStringSing", ""), /// Plural suffix for years with no units i18n_ctx_noop("TmplStringPlur", "")}, /// Singular suffix for years with abbreviated units { i18n_ctx_noop("TmplStringSing", " yr"), /// Plural suffix for years with abbreviated units i18n_ctx_noop("TmplStringPlur", " yr")}, /// Singular su...
prv_do_conversion(state, value, 1, SECONDS_PER_MINUTE, s_second_strings, add_units, zero_pad, modulus)
; break; case 'R': // H:M // R is mostly the same as T, just without seconds. macro_end--; // fall-thru case 'T': { // H:M:S char macro_spec[16]; // Always show the last unit, even if it's 0. macro_units = MIN(macro_units, macro_end - 1); for (int i = macro_units...
/* * 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_timer_register(100, log_data, 0)
; app_event_loop(); }
raw_horizontal_line_dotted(&ctx, GPoint(6, 12), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(6, 23), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 13), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 24), 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE(...
(&ctx, GPoint(13, 7), 10)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(24, 7), 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_no_clip"))); // Even cols of different lengths setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_verti...
bool prv_is_app_published_resource_valid(const AppResourceInfo *res_info) { return !s_is_app_published_resource_invalid; } AppInstallId app_install_get_id_for_uuid(const Uuid *uuid) { const TimelineResourceTestAppData *data = prv_get_data_for_app_with_uuid(uuid); return NULL_SAFE_FIELD_ACCESS(data, install_entry...
prv_get_data_for_app_with_id(TimelineResourceTestAppId_ValidApp)
; PBL_ASSERTN(valid_app_data); // Calling the function with an invalid TimelineResourceId should set res_info to the fallback timeline_res_info = (TimelineResourceInfo) { .app_id = &valid_app_data->install_entry.uuid, .res_id = TIMELINE_RESOURCE_INVALID, .fallback_id = TIMELINE_RESOURCE_BIRTHDAY_EVEN...
/* * 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...
{ dev->is_gateway = is_gateway; }
storage_release(); BTDeviceInternal device; connection_get_address(connection, &device); hc_endpoint_pebble_pairing_service_found_gateway(&device); } static bool prv_is_bonded(uint16_t conn_idx) { storage_acquire(); device_t *dev = find_device_by_conn_idx(conn_idx); const bool is_bonded = dev ? dev->bo...
/* * 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, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_BIG)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r16_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Medium circles setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&c...
len < (int)sizeof(SerializedTimelineItemHeader)) { return E_INVALID_ARGUMENT; } // Check that the layout has the correct items if (!timeline_item_verify_layout_serialized(val, val_len)) { PBL_LOG(LOG_LEVEL_WARNING, "Timeline item does not have the correct attributes"); return E_INVALID_ARGUMENT; } ...
mutex_unlock(storage->mutex)
; return rv; } static void prv_flush_rewrite_cb(SettingsFile *old, SettingsFile *new, SettingsRecordInfo *info, void *context) { if ((unsigned)info->key_len != sizeof(Uuid) || (unsigned)info->val_len < sizeof(S...
, app_cache_remove_entry(app1.id)); PebbleEvent e = fake_event_get_last(); cl_assert_equal_i(e.type, PEBBLE_APP_CACHE_EVENT); cl_assert_equal_i(e.app_cache_event.cache_event_type, PebbleAppCacheEvent_Removed); cl_assert_equal_i(e.app_cache_event.install_id, app1.id); cl_assert_equal_i(S_SUCCESS, app_cache_rem...
cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app1.id, app1.size))
; cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app2.id, app2.size)); cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app3.id, app3.size)); // add one with a key value of length 3 // Raw SettingsFile calls SettingsFile file; status_t rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SI...
/* * 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_fake_event_count = 0; }
uint32_t fake_event_get_count(void) { return s_fake_event_count; } void fake_event_set_callback(FakeEventCallback cb) { s_fake_event_cb = cb; }
_early(void) { printf("\nTesting if we can use each and stop early at %d iterations...\n", STOPPING_NUM); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_each", 4096)); uint8_t key[5]; int key_len = 4; uint8_t val[5]; int val_len = 4; for (int i = 0; i < 255; i++) { snprintf((...
(key_len, settings_file_get_len(&file, key, key_len))
; int after_count = settings_raw_iter_prv_get_num_record_searches(); cl_assert_equal_i(before_count, after_count); // Check that we can do a get and we don't search past the current record before_count = settings_raw_iter_prv_get_num_record_searches(); cl_must_pass(settings_file_get(&file, key, key_len, val,...
in_state.uuid)) { s_activity_pin_state.removed = true; } else if (uuid_equal(id, &s_sleep_pin_state.uuid)) { s_sleep_pin_state.removed = true; } } } // ------------------------------------------------------------------------------------------------ void activity_insights_init(time_t now_utc) { ...
prv_push_activity_summary_notification(now_utc, 1234, 800, i)
; // Way below average, but more than 10,000 steps were taken so these should be neutral prv_push_activity_summary_notification(now_utc, 12345, 100000, i); } } time_t midnight = time_util_get_midnight_of(now_utc); int32_t enter_seconds = (23 * SECONDS_PER_HOUR); // 11 pm the day before int32_t...
tx); cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_inside_origin_layer.${...
(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 4 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 4); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_b...