prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ayer_reload_data(&aml->menu_layer); prv_set_selected_index(aml, selected_index, false /* animated */); } // Public API ///////////////////// void action_menu_layer_click_config_provider(ActionMenuLayer *aml) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, prv_scroll_handler); window_set_click_conte...
prv_update_aml_cache(aml, default_selected_item)
in.y = interpolate_int16( distance_normalized, property_animation->values.from.grect.origin.y, property_animation->values.to.grect.origin.y); result.size.w = interpolate_int16( distance_normalized, property_animation->values.from.grect.size.w, property_animation->values.to.grect.si...
(!animation_private_using_legacy_2(NULL))
; PropertyAnimationPrivate *property_animation = prv_find_property_animation(property_animation_h); if (!property_animation) { return; } Fixed_S32_16 result = interpolate_fixed32(distance_normalized, property_animation->values.from.fixed_s32_16, ...
acteristic *characteristics, uint8_t num_characteristics) { // There should only be one ancs client ancs_invalidate_all_references(); } void ancs_handle_service_discovered(BLECharacteristic *characteristics) { BLE_LOG_DEBUG("In ANCS service discovery CB"); PBL_ASSERTN(characteristics); // should only be called...
BLE_LOG_DEBUG("Added ANCS notification!")
License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *...
PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, " BFARVALID = yes 0x%"PRIx32, SCB->BFAR)
; } print_set_indexes(buffer, &bfsr, bfsr_mappings, ARRAY_LENGTH(bfsr_mappings)); } // Memory Management Fault Status Register const uint8_t mmfsr = cfsr & 0xff; static const IndexToName mmfsr_mappings[] = { { 4, "MSTKERR" }, { 3, "MUNSTKERR" }, { 1, "DACCVIOL" }, { 0, "IACCVIOL" } }...
_messages_to_consume_from_handler = 1; prv_process_callback_events(); assert_num_callback_events(0); // Expect 2 message callbacks and 1 drop callback: assert_num_message_callbacks(2); assert_message(0, s_test_data, 1); assert_message(1, s_test_data, 1); // Should be able to write (BUFFER_SIZE) again, ...
(2, app_inbox_destroy_and_deregister(s_inbox))
; cl_assert_equal_b(false, app_inbox_service_end(AppInboxServiceTagUnitTest)); } void test_app_inbox__app_inbox_service_unregister_by_storage_unknown_storage(void) { uint8_t storage[BUFFER_SIZE]; cl_assert_equal_i(app_inbox_service_unregister_by_storage(storage), 0); }
xit_low_power_mode(void) { } // Return true if we are "idle", defined as seeing no movement in the last hour. bool accel_is_idle(void) { // It was idle recently, see if it's still idle. Note we avoid reading the accel hardware // again here to keep this call as lightweight as possible. Instead we are just comparin...
mutex_unlock_recursive(s_accel_manager_mutex)
; return rv; } #if !defined(PLATFORM_SILK) // Note: This selftest is only used for MFG today. When we start to build out a // gyro API, we will need to come up with a more generic way to handle locking // for a gyro only part vs gyro + accel part extern bool gyro_run_selftest(void); bool gyro_manager_run_selftest(vo...
static FrameBuffer *fb; static GContext s_ctx; static GBitmap *s_dest_bitmap; static GBitmap s_tictoc_icon_bitmap; static GBitmap s_smart_alarm_icon_bitmap; static void prv_initialize_icons(void) { gbitmap_init_with_resource(&s_tictoc_icon_bitmap, RESOURCE_ID_MENU_ICON_TICTOC_WATCH); gbitmap_init_with_resource(...
{ int16_t sum = 0; const unsigned int num_distinct_rows = ARRAY_LENGTH(s_menu_system_cell_test_row_data); const unsigned int num_row_heights = ARRAY_LENGTH(s_menu_system_cell_test_row_heights); for (int i = 0; i < num_row_heights; i++) { sum += GRID_CELL_PADDING + prv_get_row_height_for_index(i); } retu...
typedef enum MenuCellType { MenuCellType_Basic, MenuCellType_BasicCustom, MenuCellType_CellLayer, } MenuCellType; //! Allows testing other cell drawing functions using MenuCellLayerConfig static void prv_menu_cell_draw_dispatch(GContext *ctx, Layer *cell_layer, MenuCellType cell_type, ...
/* * 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...
(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_assign-expect.8bit.pbi"))
; memset(dest_data, GColorGreen.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpAssignInverted, GColorWhite); cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_assign-expect.8bit.pbi")); memset(dest_data, GColorGreen.argb, sizeof(dest_data)); bitblt_b...
nt(1); assert_nack_count(0); cl_assert_equal_i(EXPECTED_COOKIE, put_bytes_get_index()); } void test_put_bytes__init_watch_app_okay_while_not_in_fw_update_mode(void) { s_firmware_update_is_in_progress = false; prv_receive_init_cookie(VALID_OBJECT_SIZE, ObjectWatchApp, EXPECTED_COOKIE); assert_ack_count(1); ...
(s_last_response_cookie, chunk, sizeof(chunk))
ion.y); menu_layer_set_selected_next(&l, true, MenuRowAlignNone, false); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section); cl_assert_equal_i(4, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(4 * basic_cell_height, l.selection.y); } void test_menu_layer__center_focused_handles_skipped...
cl_assert_equal_i(2, prv_num_sublayers(layer))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_s(written_serial1, serial)
IC_WRITEDATA_REG, QSPIC_WRITEDATA, 0x0); REG_SETF(QSPIC, QSPIC_DUMMYDATA_REG, QSPIC_DUMMYDATA, 0x0); REG_SETF(QSPIC, QSPIC_ERASECTRL_REG, QSPIC_ERASE_EN, 0x0); REG_SETF(QSPIC, QSPIC_ERASECTRL_REG, QSPIC_ERS_ADDR, 0x0); REG_SETF(QSPIC, QSPIC_ERASECMDA_REG, QSPIC_RES_INST, 0x0); REG_SETF(QSPIC, QSPIC_ERASECM...
(CACHE, CACHE_MRM_CTRL_REG, MRM_START, 0x0)
/* * 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...
rocky_global_init(s_watchinfo_api)
; EXECUTE_SCRIPT("var platform = _rocky.watchInfo.platform"); ASSERT_JS_GLOBAL_EQUALS_S("platform", "unknown"); } void test_rocky_api_watchinfo__fw_version(void) { rocky_global_init(s_watchinfo_api); EXECUTE_SCRIPT("var major = _rocky.watchInfo.firmware.major"); ASSERT_JS_GLOBAL_EQUALS_I("major", VERSION_M...
EClientKernel); cl_assert_equal_i(e, BTErrnoOK); // Simulate getting a Connection Complete event for the device from Bluetopia: prv_fake_connect(&device, false /* is_master*/); // Verify the kernel task got a (virtual) connection event: prv_assert_client_event(&device, true /* connected */, (1 << PebbleTask...
gap_le_connect_has_connection_intent(&device, GAPLEClientApp)
, false); cl_assert_equal_b(gap_le_connect_has_pending_create_connection(), true); } // ----------------------------------------------------------------------------- // Cancel Connect (as Master) void __disabled_test_gap_le_connect__cancel_connect(void) { BTDeviceInternal device = prv_dummy_device(1); // Regis...
? strlen(ad_data) + 1 : 0; const size_t scan_resp_data_length = scan_resp_data ? strlen(scan_resp_data) + 1 : 0; BLEAdData *ad = (BLEAdData *) malloc(sizeof(BLEAdData) + ad_data_length + scan_resp_data_length); ad->ad_data_lengt...
regular_timer_fire_seconds(1)
; // Silent term: cl_assert(!gap_le_is_advertising_enabled()); regular_timer_fire_seconds(1); // Looped around to second term (index==1): cl_assert(gap_le_is_advertising_enabled()); assert_ad_data("yo"); gap_le_assert_advertising_interval(advert_terms[1].min_interval_slots, ...
/* * 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...
(menu_layer, cell_index)
; OptionMenu *option_menu = context; if (option_menu->callbacks.get_cell_height) { return option_menu->callbacks.get_cell_height(option_menu, cell_index->row, is_selected, option_menu->context); } else { return option_menu_default_cell_height(option_menu->...
imation; Layer *subject; if (property_animation_get_subject(prop_anim, (void**)&subject) && subject) { layer_mark_dirty(subject); } } static const PropertyAnimationImplementation s_dirty_layer_implementation = { .base = { .update = property_animation_update_mark_dirty, }, }; PropertyAnimatio...
memcpy(&legacy->values.to, value, size)
; } else { memcpy(value, &legacy->values.to, size); } return true; } PropertyAnimationPrivate *property_animation = prv_find_property_animation(property_animation_h); if (!property_animation) { return false; } if (size > MEMBER_SIZE(PropertyAnimationPrivate, values.to)) { APP_LOG(AP...
ypted(void) { BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk(); BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_device(); prv_fake_connect(&device, false /* is_master*/); fake_GAPAPI_set_encrypted_for_device(&device); fake_GAPAPI_put_encryption_change_event(true /* encry...
fake_HCIAPI_whitelist_contains(&device)
, false); } void __disabled_test_gap_le_connect__whitelist_remove_when_connected(void) { BTDeviceInternal device = prv_dummy_device(1); // Register connection intent for app: gap_le_connect_connect(&device, false /* no auto_reconnect */, false /* is_pairing_requir...
/* * 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...
spi_find_prescaler(MHZ_TO_HZ(54), FLASH_SPI_CLOCK_PERIPH)
; // max read freq for the flash spi_cfg.SPI_FirstBit = SPI_FirstBit_MSB; spi_cfg.SPI_CRCPolynomial = 7; SPI_Init(FLASH_SPI, &spi_cfg); SPI_Cmd(FLASH_SPI, ENABLE); } void flash_start(void) { periph_config_acquire_lock(); gpio_use(FLASH_GPIO); // Init the hardware flash_hw_init(); gpio_release(FLAS...
S" 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. */ #define FILE_LOG_COLOR LOG_COLOR_BLUE #include "system/logging.h" #include "system/passert.h" #include "comm/ble/gap_le_sla...
bt_driver_supports_bt_classic()
dialog, resource_id); i18n_free_all(confirmation_dialog); return confirmation_dialog; } // Information Window ////////////////////// static const char* s_information_titles[SystemInformationItem_Count] = { [SystemInformationItemBtAddress] = i18n_noop("BT Address"), [SystemInformationItemFirmware] = i18n_noo...
(BUTTON_ID_UP, prv_coredump_reset_confirm_cb)
; window_single_click_subscribe(BUTTON_ID_DOWN, prv_coredump_reset_decline_cb); } static void prv_information_long_click_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) { if (cell_index->r...
, alignment, NULL); } uint16_t graphics_text_layout_get_text_height(GContext *ctx, const char *text, GFont const font, uint16_t bounds_width, const GTextOverflowMode overflow_mode, ...
{ return NULL; }
return (TextLayoutExtended*)layout; } void graphics_text_layout_set_line_spacing_delta(GTextLayoutCacheRef layout, int16_t delta) { TextLayoutExtended *extended = prv_get_writable_extended_layout(layout); if (extended) { extended->line_spacing_delta = delta; } } int16_t graphics_text_layout_get_line_spa...
nsed 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 in writing, software * distributed under t...
if (data->install_entry.install_id == install_id) { return data; }
"stubs_print.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_syscall_internal.h" #include "stubs_system_reset.h" #include "stubs_task_watchdog.h" #include "stubs_app_state.h" #include "stubs_worker_state.h" // Overrides ///////////////////////////////////////////////////...
strftime(tmbuf, sizeof(tmbuf), "%u %V", &jan_2_2015__13_00_00)
; cl_assert_equal_s(tmbuf, "5 01"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%z", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "+0000"); #endif tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%d", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "02"); #if EXTENSION_C99 tmbuf[0] = '\0'; ...
WINDOW_NAME(test->name)
); window_set_user_data(window, app_data); window_set_fullscreen(window, true); layer_set_update_proc((Layer *) window, prv_test_update_proc); app_window_stack_push(window, false); } static uint16_t prv_get_num_rows(struct MenuLayer *menu_layer, uint16_t section, void *callback...
tx, cell_layer, aml, item, selected); } else { const int base_idx = (cell_index->row - aml->num_items) * SHORT_COL_COUNT; const int sel_idx = aml->selected_index - (base_idx + aml->num_items); const int num_items = CLIP(aml->num_short_items - base_idx, 0, SHORT_COL_COUNT); prv_cell_column_draw(ctx, ce...
{ // We use the separator to pad the cells (insert spacing), so we compute the height // needed for each separator here. ActionMenuLayer *aml = callback_context; return prv_get_cell_padding(aml); }
typedef struct ActionMenuSeparatorConfig { GSize separator; } ActionMenuSeparatorConfig; static const ActionMenuSeparatorConfig s_separator_configs[NumPreferredContentSizes] = { [PreferredContentSizeSmall] = { .separator = {100, 1}, }, [PreferredContentSizeMedium] = { .separator = {100, 1}, }, [P...
_handlers("secondchange")); cl_assert_equal_b(true, rocky_global_has_event_handlers("minutechange")); cl_assert_equal_b(true, rocky_global_has_event_handlers("hourchange")); cl_assert_equal_b(true, rocky_global_has_event_handlers("daychange")); cl_assert_equal_i(5, s_tick_timer_service_subscribe.call_count); ...
("m", 40.0)
; ASSERT_JS_GLOBAL_EQUALS_D("h", 21.0); ASSERT_JS_GLOBAL_EQUALS_D("d", 17.0); EXECUTE_SCRIPT( "s = null;\n" "m = null;\n" "h = null;\n" "d = null;\n" ); struct tm tm = { .tm_sec = 1, .tm_min = 2, .tm_hour = 3, .tm_mday = 4, .tm_mon = 5, .tm_year = 116, // 2016 }; ...
context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_ny_origin_layer.${BIT_DEPTH_NAME}.pbi")); } #define RADIUS_BIG 15 #define RADIUS_MEDIUM 8 #define RADIUS_MIN_CALCULATED 3 #defin...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r0_no_clip.${BIT_DEPTH_NAME}.pbi"))
enses/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 permissions and * limitatio...
("s", "5")
; EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {second: '2-digit'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "05"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {minute: 'numeric'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "4"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {minute: '2-digit'});"); ...
pMessage *message = (AppMessage*)data; cl_assert(length == sizeof(AppMessage)); PBL_LOG(LOG_LEVEL_DEBUG, "message %"PRIu32", id1 %"PRIu32", id2 %"PRIu32, message->transaction_id, TEST_TRANSACTION_ID_1, TEST_TRANSACTION_ID_2); if (message->transaction_id == TEST_TRANSACTION_ID_1) { cl_assert_equal_b(s_ac...
cl_assert_equal_p(s_process_manager_callback, NULL)
; cl_assert_equal_p(s_process_manager_callback_data, NULL); s_process_manager_callback = async_cb; s_process_manager_callback_data = ctx; } static int s_app_inbox_consume_call_count; void app_inbox_consume(AppInboxConsumerInfo *consumer_info) { ++s_app_inbox_consume_call_count; } // Setup ///////////////////...
buteStateIdle)) { return pebble_task_get_current() == CONSUMER_TASK; } else if ((current_state == SmartstrapAttributeStateRequestPending) && (new_state == SmartstrapAttributeStateIdle)) { return pebble_task_get_current() == PebbleTask_KernelBackground; } else if ((current_state == SmartstrapAtt...
(&attr->mbuf)
); MBuf write_mbuf = MBUF_EMPTY; mbuf_set_data(&write_mbuf, mbuf_get_data(&attr->mbuf), attr->write_length); SmartstrapRequest request = (SmartstrapRequest) { .service_id = attr->service_id, .attribute_id = attr->attribute_id, .write_mbuf = (attr->request_type == SmartstrapRequestTypeRead) ? NULL : &w...
if (phase == OUT_CLOSED) { PBL_LOG(LOG_LEVEL_ERROR, "Must call app_message_open() before calling app_message_outbox_begin()!"); return APP_MSG_INVALID_STATE; }
// Reset the send state (dictionary, counters, etc.) // We do this here, as this function is only called when we begin a new outbox, // so the state should always be clean when we return successfully. prv_outbox_prepare(outbox); *iterator = &outbox->iterator; outbox->phase = OUT_WRITING; outbox->result ...
/* * 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...
(&handler->list_node, NULL, NULL)
; if (list_find(&state->list_node, event_service_filter, (void *) handler->type)) { // there are other handlers for this task, don't unsubscribe it return; } // Get info PebbleTask task = pebble_task_get_current(); // Unsubscribe from the service! PebbleEvent event = { .type = PEBBLE_SUBSCRIPTI...
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_action_menu_window__thin_display_mode_with_emoji(void) { // Copied from prv_create_emoji_level_from_action() in timeline_actions.c; it wouldn't work that // well to just make the array T_STATIC in that function because we need to know its lengt...
action_menu_level_add_action(emoji_level, "This won't be seen", prv_noop_action_callback, NULL)
; action_menu_level_add_child(root_level, emoji_level, "Emoji"); const unsigned int selected_index = 1; prv_prepare_canvas_and_render_action_menus_static(root_level, selected_index, 0); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_action_menu_window__wide_display_mode_with_chevron_and_l...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
fake_event_get_last()
oid) { UnobstructedAreaHandlers handlers = { .did_change = prv_did_change, }; app_unobstructed_area_service_subscribe(handlers, s_data.context); cl_assert(fake_event_service_get_info(PEBBLE_UNOBSTRUCTED_AREA_EVENT)->handler); cl_assert_equal_p(app_state_get_unobstructed_area_state()->handlers.did_change, ...
(110, 130, 300, 200)
, }; layer_add_child(&root_layer, &layer); GRect unobstructed_bounds; layer_get_unobstructed_bounds(&layer, &unobstructed_bounds); cl_assert_equal_grect(unobstructed_bounds, GRect(110, 130, 140, 150)); } void test_unobstructed_area_service__nested_layer_clip_nx_ny(void) { app_state_get_unobstructed_area_st...
rev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[1].header.id)); #if !CAPABILITY_HAS_CORE_NAVIGATION4 cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[2].header.id)); #endif cl_assert(!iter_prev(&iterator)); } void test_timeline__long_middle_f...
uuid_equal(&first_all_day_event, &state.pin.header.id)
); cl_assert(state.node->all_day); // correct end of line behaviour cl_assert(!iter_prev(&iterator)); } void test_timeline__all_day_future_with_others(void) { prv_insert_all_day_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // start 11:40 AM, earlier tha...
(400000) #define I2C_FAST_MODE_PLUS_CLOCK_SPEED_MAX (1000000) #define TIMINGR_MASK_PRESC (0x0F) #define TIMINGR_MASK_SCLH (0xFF) #define TIMINGR_MASK_SCLL (0xFF) #define CR1_CLEAR_MASK (0x00CFE0FF) #define CR2_CLEAR_MASK (0x07FF7FFF) #define CR2_NBYTES_OFFSET (16) #define CR2_TRANSFER_SETUP_MASK (I2C_CR2_SADD...
prv_i2c_deinit(bus)
; } bool i2c_hal_is_busy(I2CBus *bus) { return ((bus->hal->i2c->ISR & I2C_ISR_BUSY) != 0); } static void prv_disable_all_interrupts(I2CBus *bus) { bus->hal->i2c->CR1 &= ~(I2C_CR1_TXIE | I2C_CR1_RXIE | I2C_CR1_TCIE | I2C_CR1_NACKIE | ...
ts 4-bit bitblt palettized to circular display buffer // Result: // - gbitmap matches platform loaded PBI void test_bitblt_circular__color_4_bit(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE); GBitmap *native_framebuffer = graphics_context_get_bitmap(ctx); cl_assert(native_framebuffer->info.format == G...
(native_framebuffer->info.format == GBitmapFormat8BitCircular)
; cl_assert(DISPLAY_FRAMEBUFFER_BYTES == 25944); // Set screen to black to match empty region with test image graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_rect(ctx, &framebuffer_bounds); // Shift the output by non-power-of-2 values for testing bitblt_bitmap_into_bitmap(native_framebuff...
er, status_bar_layer_get_layer(status_layer)); #if PBL_RECT GRect status_layer_bounds = window->layer.bounds; status_layer_bounds.size.w -= ACTION_BAR_WIDTH; layer_set_frame(&status_layer->layer, &status_layer_bounds); #endif ActionBarLayer *action_bar = &active_window->action_bar; action_bar_layer_init(act...
{ if (top_metric == WorkoutMetricType_None || middle_metric == WorkoutMetricType_None || (num_scrollable_metrics != 0 && !scrollable_metrics)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid argument(s)"); return NULL; } WorkoutActiveWindow *active_window = app_zalloc_check(sizeof(WorkoutActiveWindow)); acti...
WorkoutActiveWindow *workout_active_create_for_activity_type(ActivitySessionType type, void *workout_data, WorkoutController *workout_controller) { const bool hrm_is_available = activity_is_hrm_present() && activity_prefs_heart_rate_is_enabled(); switch (type) { case ActivitySessionType_Open: { ...
ession); } return success; } // ----------------------------------------------------------------------------------------- void dls_storage_invalidate_all(void) { // Iterate through all files in the file system, looking for all DLS storage files and // deleting them. pfs_remove_files(prv_filename_filter_cb);...
dls_storage_delete_logging_storage(session)
; } return success; } // ----------------------------------------------------------------------------------------- // Special case: if buffer is NULL, just doesn't perform any reads, it just returns the # of bytes // of data available for reading. Returns -1 on error. // On exit, *new_read_offset contains the new...
(&char_iter)
); cl_assert(!iter_next(&char_iter)); } void test_char_iterator__decode_test_string_with_initial_formatting_char(void) { Iterator char_iter; CharIterState char_iter_state; Utf8IterState* utf8_iter_state = (Utf8IterState*) &char_iter_state.utf8_iter_state; // Skip over codepoints that aren't newline and < 0x...
_set_time_msg(time_t new_time) { PBL_LOG(LOG_LEVEL_WARNING, "Mobile app calling deprecated API, time = %d", (int)new_time); if (clock_is_timezone_set()) { new_time = prv_migrate_local_time_to_UTC(new_time); } prv_update_time_info_and_generate_event(&new_time, NULL); } void clock_protocol_msg_cal...
strftime(buffer, buf_size, i18n_get(format, buffer), &time_tm)
/* * 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 false; }
static Window s_app_window_stack_get_top_window; Window *app_window_stack_get_top_window() { return &s_app_window_stack_get_top_window; } GPointPrecise gpoint_from_polar_precise(const GPointPrecise *precise_center, uint16_t precise_radius, int32_t angle) { return GPointPre...
llipsis, GTextAlignmentCenter, NULL); } void draw_text_single_line_ellipsis_clip_outside_nx(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(-80, 4, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignme...
GRect(0, 0, 144, 168)
); layer_set_update_proc(&canvas, &canvas_layer_update_callback); layer_init(&layer, &GRect(40, 40, 80, 40)); layer_add_child(&canvas, &layer); // Corner 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...
{ -1472, 168, 8}, { -1216, 120, -32}, { -1112, 120, -104}, { -952, 8, -120}, { -768, -128, -256}, { -976, 0, -296}, { -936, -88, -136}, { -952, -64, -128}, { -1184, 56, -80}, { -1568, 192, -200}, { -1760, 200, -120}, { -1816, 192, 0}, { -1632, 368, -40}, { -1312,...
{ -1384, 24, 24}, { -1224, 112, -16}, { -1168, 160, -88}, { -976, 152, -136}, { -920, -16, -120}, { -944, -160, -224}, { -888, -160, -344}, { -1184, 24, -312}, { -1120, -16, -152}, { -1392, 24, -8}, { -1720, 168, -8}, { -1832, 312, 16}, { -1672, 456, -8}, { -1352,...
{ -1800, 288, 48}, { -1840, 464, 56}, { -1440, 368, 224}, { -1192, 424, 8}, { -1064, 272, 32}, { -1184, 232, 120}, { -1208, 232, 184}, { -1416, 272, 288}, { -1392, 448, 328}, { -1320, 704, 296}, { -1032, 640, 368}, { -656, 632, 160}, { -688, 544, -48}, { -1296, 5...
/* * 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...
fake_transport_set_connected(s_transport, true)
; } void test_meta_endpoint__cleanup(void) { // Check for leaks: fake_kernel_malloc_mark_assert_equal(); fake_kernel_malloc_deinit(); fake_comm_session_cleanup(); } void test_meta_endpoint__send_meta_corrupted_message(void) { const MetaResponseInfo meta_response_info = { .session = s_session, .payl...
/* * 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...
jerry_cleanup()
; rocky_runtime_context_deinit(); } void test_rocky_api_console__functions_exist(void) { rocky_global_init(s_api); EXECUTE_SCRIPT( "var c = typeof console;\n" "var cl = typeof console.log;\n" "var cw = typeof console.warn;\n" "var ce = typeof console.error;\n" ); ASSERT_JS_GLOBAL_EQUALS_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...
cl_assert(0 == strcmp(buf, "0"))
; itoa_int(-0, buf, 10); cl_assert(0 == strcmp(buf, "0")); itoa_int(1, buf, 10); cl_assert(0 == strcmp(buf, "1")); itoa_int(-1, buf, 10); cl_assert(0 == strcmp(buf, "-1")); itoa_int(365, buf, 10); cl_assert(0 == strcmp(buf, "365")); itoa_int(-365, buf, 10); cl_assert(0 == strcmp(buf, "-365")); ...
s(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entri...
animation_set_duration(a, duration_a)
; Animation *b = animation_clone(a); animation_set_reverse(b, true); // Create a sequence Animation *seq = animation_sequence_create(a, b, NULL); animation_set_play_count(seq, repeat_count); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); // Start A prv...
, "There are %o lights, %o", 8, -4); cl_assert_equal_s(dstbuf, "There are 10 lights, 37777777774"); // Alternate form (adds 0 prefix) snprintf(dstbuf, 256, "There are %#o lights, %#o", 8, -4); cl_assert_equal_s(dstbuf, "There are 010 lights, 037777777774"); // Zero padded minimum character output snprintf...
(dstbuf, 256, "There are %.3x lights, %.3x", 16, -4)
; cl_assert_equal_s(dstbuf, "There are 010 lights, fffffffc"); // Minimum digits output (zero digits) snprintf(dstbuf, 256, "%.0xzero%.0x", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (unspecified digits, acts as zero) snprintf(dstbuf, 256, "%.xzero%.x", 0, 1); cl_assert_equal_s(...
include "util/bitset.h" #include "util/math.h" #define APNG_DECODE_ERROR "APNG decoding failed" #define APNG_MEMORY_ERROR "APNG memory allocation failed" #define APNG_FORMAT_ERROR "Unsupported APNG format, only APNG8 is supported!" #define APNG_LOAD_ERROR "Failed to load APNG" #define APNG_UPDATE_ERROR "gbitmap_sequen...
upng_apng_num_frames(upng)
izontal_container_node = graphics_text_node_create_horizontal(max_horizontal_nodes); horizontal_container_node->horizontal_alignment = GTextAlignmentLeft; if (!settings_glance->glance_state.battery_charge_state.is_plugged) { GTextNode *battery_percent_text_node = launcher_app_glance_structured_cr...
{ return RESOURCE_ID_CONNECTIVITY_SHARING_HRM; }
#endif if (settings_glance->glance_state.is_airplane_mode_enabled) { return RESOURCE_ID_CONNECTIVITY_BLUETOOTH_AIRPLANE_MODE; } else if (!settings_glance->glance_state.is_pebble_app_connected) { return RESOURCE_ID_CONNECTIVITY_BLUETOOTH_DISCONNECTED; } else if (settings_glance->glance_state.is_quiet_time...
FlashGeometryRequest)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length); return; } const FlashGeometryRequest *request = payload; FlashGeometryResponse response = { .region = request->region }; if (request->region == REGION_PRF) { // assume we're about to write to this region...
(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length)
; return; } const FlashCRCRequest *request = payload; const uint32_t num_entries = length / sizeof(FlashCRCRequest); // this is just static cause it's potentially too big to put on the stack static FlashCRCResponse response[MAX_DATA_LENGTH / sizeof(FlashCRCResponse)]; for (uint32_t i = 0; i < num_entr...
s_last_processed_timestamp_valid(data->last_processed_timestamp)) { return; } if (data->num_zones != HRZone_Max) { return; } PBL_LOG(LOG_LEVEL_INFO, "Got HeartRateZoneData for wday: %d, cur_wday: %d, zone1: %"PRIu32"", wday, cur_wday, data->minutes_in_zone[0]); activity_metri...
if (prv_file_open_and_lock(&file) != S_SUCCESS) { return false; }
char key[HEALTH_DB_MAX_KEY_LEN]; snprintf(key, HEALTH_DB_MAX_KEY_LEN, "%s%s", WEEKDAY_NAMES[day], STEP_TYPICALS_KEY_SUFFIX); const int key_len = strlen(key); status_t s = settings_file_get(&file, key, key_len, averages->average, sizeof(averages->average)); prv_file_close_and_unlock(&file); return (s == ...
_logging__initialize(void) { s_num_event_puts = 0; s_last_event = (PebbleEvent) { 0 }; s_num_packets_sent = 0; s_num_bytes_sent = 0; s_log_message_buffer[0] = '\0'; s_in_critical_section = false; pulse_logging_init(); } void test_pulse_logging__simple(void) { pulse_logging_log(LOG_LEVEL_DEBUG, "", 0...
{ s_in_critical_section = true; pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTestA"); cl_assert_equal_i(s_num_event_puts, 1); cl_assert_equal_i(s_num_packets_sent, 0); pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTestB"); cl_assert_equal_...
10); cl_assert_equal_i(bpm, 100); cl_assert(workout_service_pause_workout(true)); // Get some new data but out stats shouldn't change (except HR) prv_inc_time(10); prv_inc_steps_and_put_event(10); prv_put_bpm_event(110, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &durat...
(100, HRMQuality_Good)
; cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(bpm, 100); // Put an OffWrist reading. Verify we received it. prv_put_bpm_event(50, HRMQuality_OffWrist); cl_assert(workout_service_g...
lose(tmp_fd), S_SUCCESS); uint8_t new_buf[strlen(overwrite_string)]; fd = pfs_open(file, OP_FLAG_READ, 0, 0); cl_assert(fd >= 0); rv = pfs_read(fd, &new_buf[0], strlen(overwrite_string)); cl_assert_equal_i(rv, strlen(overwrite_string)); cl_assert(memcmp(overwrite_string, new_buf, strlen(overwrite_string)) ...
cl_assert(pfs_close(fd) == S_SUCCESS)
; if ((i % 2) == 0) { cl_assert(pfs_remove(file_small) == S_SUCCESS); } } // now write two large files that are interleaved between sectors // was negative int bytes_available = (num_pages() / 2) * 4000; int large_file_size = bytes_available / 2; printf("Space Avail = %d\n", bytes_available)...
uuid, sizeof(Uuid)); bool name = !strcmp(one->name,two->name); bool icon = (one->icon_resource_id == two->icon_resource_id); return (id && type && visibility && process_type && uuid && name && icon); } // background counter static const uint32_t bg_counter_size = (1132 + 276 + 4092); static const AppDBEntry bg_...
(APP2_RESOURCES_FIXTURE_NAME, filename_buf)
; } void test_app_install_manager__cleanup(void) { } /************************************* *************************************/ void test_app_install_manager__get_id_invalid_uuid(void) { const Uuid made_up = {0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17...
animation_set_auto_destroy(a, auto_destroy); animation_schedule(a); Animation *b = prv_create_test_animation(); animation_set_implementation(b, &implementation); animation_set_duration(b, duration_a); animation_set_delay(b, delay_a); animation_set_auto_destroy(b, auto_destroy); animation_schedule(b); ...
(a, curve)
; cl_assert_equal_p(animation_get_custom_curve(a), curve); cl_assert_equal_p(animation_get_custom_interpolation(a), NULL); cl_assert_equal_i(animation_get_curve(a), AnimationCurveCustomFunction); animation_set_custom_interpolation(a, interpolation); cl_assert_equal_p(animation_get_custom_curve(a), NULL); c...
F(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_IO2_OEN, 0x0); REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_CLK_MD, 0x0); REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_AUTO_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_DMY_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_EXT_TX_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURS...
REG_SETF(GPREG, PLL_SYS_TEST_REG, PLL_MIN_CURRENT, 0x38)
; REG_SETF(GPREG, PLL_SYS_TEST_REG, PLL_DIS_LOOPFILT, 0x0); // CACHE REG_SETF(CACHE, CACHE_CTRL1_REG, CACHE_RES1, 0x0); REG_SETF(CACHE, CACHE_CTRL1_REG, CACHE_FLUSH, 0x0); REG_SETF(CACHE, CACHE_LNSIZECFG_REG, CACHE_LINE, 0x0); REG_SETF(CACHE, CACHE_ASSOCCFG_REG, CACHE_ASSOC, 0x2); REG_SETF(CACHE, CAC...
rt_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid), true); cl_assert_equal_i(fake_comm_session_close_call_count(), 0); } void test_ppogatt__ignore_data_during_reset(void) { prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], ...
fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, sizeof(s_short_data_fragment))
graphics_release_frame_buffer(ctx, framebuffer)
; } // ## Line blending wrappers: void graphics_private_draw_horizontal_line_prepared(GContext *ctx, GBitmap *framebuffer, GRect *clip_box, int16_t y, Fixed_S16_3 x1, Fixed_S16_3 x2, GColor color) { if (gcolor_is...
pliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either...
comm_session_get_system_session()
/* * 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...
gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE)
); } // Tests 2-bit palettized PBI loading into gbitmap // Result: // - gbitmap matches platform loaded PBI void test_bitblt_circular__color_2_bit(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE); GBitmap *native_framebuffer = graphics_context_get_bitmap(ctx); cl_assert(native_framebuffer->info.format =...
/* * 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...
itoa_int(src_line_number, line_number_buffer, 10)
; serial_console_write_log_message(":"); serial_console_write_log_message(line_number_buffer); serial_console_write_log_message("> "); } // Write the actual log message. serial_console_write_log_message(message); // Append our newlines and our trailing null serial_console_write_log_message("\r\n...
/* * 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_get_user_data(window)
; gbitmap_init_with_resource(&data->checked_icon, RESOURCE_ID_CHECKBOX_ICON_CHECKED); MenuLayer *menu_layer = &data->menu_layer; menu_layer_init(menu_layer, &window->layer.bounds); menu_layer_set_callbacks(menu_layer, data, &(MenuLayerCallbacks) { .get_num_sections = (MenuLayerGetNumberOfSectionsCallback) ...
cts/ecma-builtin-helpers.h" #include "applib/rockyjs/api/rocky_api_global.h" #include <clar.h> #include <math.h> // Fakes #include "fake_logging.h" #include "fake_pbl_malloc.h" #if EMSCRIPTEN #include "fake_time_timeshift_js.h" #else #include "fake_time.h" #endif // Stubs #include "stubs_app_manager.h" #include "st...
cl_assert(*s_log_internal__expected == NULL)
; } void test_rocky_api_util__call_throw_number(void) { s_log_internal__expected = (const char *[]){ "Unhandled exception", " 1", NULL }; const char *script = "var "FUNC_NAME" = function() { throw 1; };"; prv_do_call_user_function(script); cl_assert(*s_log_internal__expected == NULL); } void t...
-------------------------------------------- // Test creating a sequence where the first argument is already scheduled and started // // Here's a graph of what we are doing // // 0 60 310 360 380 880 // | | | | | | // --------------------------------...
prv_count_handler_entries(&s_stopped_handler_calls, b)
, 1); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 1); #endif } // -------------------------------------------------------------------------------------- // Test creating a sequence where the first argument i...
st_shift_at_line_begin; // Number of bits to render on this line. uint8_t glyph_line_bits_left = clipped_glyph_target.size.w; uint32_t *dest_block = (uint32_t *)dest_block_x_begin + (dest_y * dest_row_length); const uint32_t *dest_block_end = dest_block + num_dest_blocks_per_row + 1; if (left_cli...
{ continue; }
} ++dest_block; } dest_shift += right_clip % 32; // emulate having drawn the right clip if (glyph_block_bits_left <= right_clip) { int jump_words = (right_clip - glyph_block_bits_left) / 32 + 1; glyph_block += jump_words; src = *glyph_block; rotl32(src, src_rotate...
_reel_create_with_resource_system(res_info->res_app_num, res_info->res_id); } static void prv_init_icon(TimelineLayout *timeline_layout, const GRect *icon_frame, TimelineResourceSize icon_res_size, TimelineResourceId resource, TimelineResourceId fallback_resource, co...
{ GTextNode *view_node = NULL; switch (mode) { case LayoutLayerModeCard: view_node = layout->impl->card_view_constructor(layout); break; case LayoutLayerModePeek: case LayoutLayerModePinnedThin: case LayoutLayerModePinnedFat: view_node = prv_create_pin_view_node(layout); brea...
void timeline_layout_deinit_view(TimelineLayout *layout) { if (layout->layout_layer.mode == LayoutLayerModeCard && layout->impl->card_view_deinitializer) { layout->impl->card_view_deinitializer(layout); } graphics_text_node_destroy(layout->view_node); layout->view_node = NULL; } static GTextNode *prv_cre...
/* * 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 (dialog->vibe_on_show) { vibes_short_pulse(); } if (dialog->timeout != DIALOG_TIMEOUT_INFINITE) { dialog->timer = app_timer_register(dialog->timeout, prv_app_timer_callback, dialog); } // Calls the user-given load callback, if it exists. If the user gave a non-null context, // the function w...
// Unloads the core dialog. Should be called from each dialog window's unload callback. void dialog_unload(Dialog *dialog) { app_timer_cancel(dialog->timer); if (dialog->show_status_layer) { status_bar_layer_deinit(&dialog->status_layer); } dialog_set_icon(dialog, INVALID_RESOURCE); text_layer_deinit(...
e_state_change(&manager, r[1]); cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown); cl_assert_equal_p(manager.active_layer, NULL); prv_compare_recognizers_processed((int []) { 0, 1 }, 2, &s_recognizers_reset); manager.active_layer = &layer_a; manager.state = RecognizerManagerState_Reco...
(r[0]->state, RecognizerState_Started)
; cl_assert_equal_i(r[1]->state, RecognizerState_Completed); }
/* * 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, bg_color)
; graphics_fill_rect(ctx, &image->layer.bounds); } graphics_context_set_compositing_mode(ctx, image->compositing_mode); if (image->bitmap != NULL) { const GSize size = image->bitmap->bounds.size; const bool clips = true; // bitmap layer not allowed to draw outside of its frame GRect rect = (GRect...
void); static void prv_log_stuck_timer_task(RebootReason *reboot_reason) { void* current_cb = new_timer_debug_get_current_callback(); if (!current_cb) { PBL_LOG_SYNC(LOG_LEVEL_WARNING, "No timer in progress."); return; } PBL_LOG_SYNC(LOG_LEVEL_WARNING, "Timer callback %p", current_cb); reboot_reaso...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Starting App Throttling for %s", curr_task); }
analytics_inc(ANALYTICS_DEVICE_METRIC_APP_THROTTLED_COUNT, AnalyticsClient_System); vTaskPrioritySet(pebble_task_get_handle_for_task(PebbleTask_App), tskIDLE_PRIORITY | portPRIVILEGE_BIT); } static void prv_system_task_starved_callback(void *data) { if (system_task_is_ready_to_run() || (system_task_get_c...
12}, { -40, 1320, -640}, { -8, 1152, -584}, { -128, 1184, -496}, { -144, 840, -352}, { -264, 512, -208}, { -352, 224, -136}, { -440, 48, -168}, { -528, 32, -176}, { -648, 248, -264}, { -776, 880, -440}, { -840, 928, -520}, { -1040, 760, -192}, { -920, 448, -8}, //...
{ -928, 152, -88}, { -960, 160, -48}, { -960, 160, -72}, { -968, 128, -40}, { -960, 168, -88}, // 521 seconds { -960, 176, -176}, { -936, 40, -104}, { -928, 128, -136}, { -928, 216, -168}, { -928, 184, -184}, { -912, 64, -152}, { -936, 112, -152}, { -944, 144, -15...
{ -944, 144, 136}, { -952, 160, 128}, { -952, 184, 80}, { -960, 184, 56}, { -896, 152, 64}, { -936, 160, 32}, { -944, 192, 56}, { -968, 224, 48}, { -968, 208, 32}, { -944, 184, 8}, { -920, 176, 32}, { -912, 168, 48}, { -912, 168, 40}, { -928, 176, 24}, // 524...
/* * 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(calculated, 0)
; }
gin_rmax_bottomleft.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerBottomRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_b...
(GSize(2, 10), GCornersAll, 4)
&dest_bitmap, src_bitmap, dest_rect, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_wrap_y-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Test src_origin_offset, shouldn't see any red in dest_bitmap. // This covers src_origin_offset, y-axis and x-a...
get_gbitmap_from_pbi("test_bitblt__1bit_to_8bit_compor.1bit.pbi")
; GRect bounds = gbitmap_get_bounds(src_bitmap); cl_assert_equal_i(src_bitmap->info.format, GBitmapFormat1Bit); uint8_t dest_data[bounds.size.w * bounds.size.h]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = bounds.size.w, .info.format = GBitmapFormat8Bit, .info.version = GBITMA...
return; case PEBBLE_CALLBACK_EVENT: e->callback.callback(e->callback.data); return; case PEBBLE_PROCESS_KILL_EVENT: process_manager_close_process(e->kill.task, e->kill.gracefully); return; case PEBBLE_SUBSCRIPTION_EVENT: // App button events depend on this, so this needs to...
prv_extended_event_handler(e)
; } shell_event_loop_handle_event(e); } static NOINLINE void prv_launcher_main_loop_init(void) { s_back_hold_timer = new_timer_create(); process_manager_init(); app_manager_init(); worker_manager_init(); vibes_init(); battery_monitor_init(); evented_timer_init(); #if CAPABILITY_HAS_MAGNETOMETER e...
/* * 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...
(filename, line_number, lr, expr, fmt, fmt_args)
; va_end(fmt_args); } NORETURN passert_failed(const char* filename, int line_number, const char* message, ...) { va_list fmt_args; va_start(fmt_args, message); handle_passert_failed_vargs(filename, line_number, (uintptr_t)__builtin_return_address(0), "ASSERT", message, fmt_args); va_end(fmt_args); } ...
te: 1421178000 = Tue Jan 13 11:40:00 PST 2015 // check first timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000), 0); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check second cl_assert(iter_next(&iterator...
(&iterator, &state, &head, TimelineIterDirectionFuture, 1421183640)
, 0); cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id)); cl_assert(iter_next(&iterator)); // check second cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id)); // check third cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.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...
free(test_image_bw->addr)
; } free(test_image_bw); } if (test_image_color) { if (test_image_color->addr) { free(test_image_color->addr); } free(test_image_color); } } static void setup_test_rotate_bitmap(GContext *ctx, FrameBuffer *fb, GRect clip_box, GRect drawing_box, ...
T_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, GCornerBottomLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_r8_quad_bottom_left.${BIT_DEPTH_NAME}.pbi"))...
GRect(0, 0, 60, 60)
); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(frameb...
hile (iter) { PBL_LOG(LOG_LEVEL_INFO, "Orphaned resource file removed: %s", iter->name); pfs_remove(iter->name); iter = (PFSFileListEntry *)iter->list_node.next; } } // The bug addressed in PBL-34010 caused resource files to remain in the filesystem even // after the associated application had been delet...
pfs_remove(APP_CACHE_FILE_NAME)
alth_db_insert((uint8_t *)entries[i].key, strlen(entries[i].key), (uint8_t *)entries[i].val, strlen(entries[i].val)), S_SUCCESS); ActivityMetricAverages averages; health_db...
(s_metric_updated_count, NUM_CURRENT_SLEEP_METRICS)
; // Test inserting something which is more than a week old. // We shouldn't update our internal storage s_metric_updated_count = 0; key = "monday_movementData"; cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_old_movement_data, sizeof(s_old_...
PBL_ASSERTN(state->test_entry.num_samples < SLEEP_SAMPLES_DISCOVERY_MAX_SAMPLES); state->samples[state->test_entry.num_samples++] = (AlgMinuteFileSample) { .v5_fields = { .steps = steps, .orientation = orientation, .vmc = vmc, .light = light, .plugged_in...
strcmp(token, "static")
== 0) { continue; } // Grab a sample if (strcmp(token, "{") == 0) { PBL_ASSERTN(state->test_entry.name[0] != 0); int steps = 0; int orientation = 0; int vmc = 0; int light = 0; int plugged_in = 0; if (state->test_entry.version == 1) { sscanf(token + ...
/* * 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_update_rail_state(PmicRail_LDO2, true)
; return true; } static bool prv_update_rail_state(PmicRail rail, bool enable) { static int8_t s_ldo2_ref_count = 0; static int8_t s_ldo3_ref_count = 0; int8_t *ref_count; uint8_t rail_control_reg = 0; if (rail == PmicRail_LDO2) { rail_control_reg = PmicRegisters_LDO2_CONFIG; ref_count = &s_ldo2...
(); cl_assert_equal_i(s_num_alarms_fired, 4); s_current_day = s_tuesday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 5); s_current_day = s_wednesday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 6); } void test_alarm__custom_alarm_weekends_and_weekday(void) { AlarmId ...
cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time())
; // Second alarm goes off. First one should be up again, but not until Saturday s_current_hour = 11; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 4); cl_assert_equal_i(s_num_alarm_events_put, 4); cl_assert_equal_i(s_num_timeline_adds, 12); cl_assert_equal_i(s_num...
break; } // Only call the subscriber when the buffer is full. This takes away the // overhead of handling this in the subscriber module this->state->subscriber.idx += (size / sizeof(int16_t)); if (this->state->subscriber.idx == this->state->subscriber.size) { this->state->subscriber.callb...
if (!circular_buffer_write(&this->state->circ_buffer, (const uint8_t *) &sample, sizeof(int16_t))) { this->state->overflow_cnt++; break; }
} } // Post a callback to KernelBG and KernelMain for faster servicing (check out PBL-40943 for more // details) bool main_switch_context = false; bool system_task_switch_context = false; if (!this->state->main_pending) { this->state->main_pending = true; PebbleEvent e = { .type = PEBBLE...
app_cache_remove_entry(id); } } static void prv_delete_pending_id(AppInstallId *app_id) { if (*app_id != INSTALL_ID_INVALID) { // app cache will delete the app binaries even if the entry for the app_id does not exist app_cache_remove_entry(*app_id); *app_id = INSTALL_ID_INVALID; } } static void pr...
(s_install_callback_data.install_id, s_install_callback_data.uuid, app_upgrade, true /* delete cache entry */)
ache 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 License is dis...
(ANALYTICS_DEVICE_METRIC_BT_OFF_TIME, AnalyticsClient_System)
; s_comm_is_running = false; // This is a legacy event used to update the Settings app. prv_put_disconnection_event(); } static void prv_send_state_change_event(void) { PBL_LOG(LOG_LEVEL_DEBUG, "----> Sending a BT state event"); PebbleEvent event = { .type = PEBBLE_BT_STATE_EVENT, .bluetooth = { ...
actually still there ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); // And delete is again bt_persistent_storage_delete_bt_classic_pairing_by_id(id); cl_assert_equal_i(fa...
bt_persistent_storage_has_active_bt_classic_gateway_bonding()
/* * 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...
layer_render_tree(&layer, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_x_origin...
/* * 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...
comm_session_send_data(comm_session_get_system_session(), HEALTH_SYNC_ENDPOINT_ID, (uint8_t*)&msg, sizeof(HealthSyncEndpointAckMsg), COMM_SESSION_DEFAULT_TIMEOUT)
; } #if CAPABILITY_HAS_HEALTH_TRACKING #include "services/normal/activity/activity_algorithm.h" static void prv_sync_health_system_task_cb(void *unused) { if (activity_tracking_on()) { // tell the activity service to pool the minutes it's got so far activity_algorithm_send_minutes(); } // send all data...
eate_global_ctx(void) { // make this easily testable by putting it int JS context as global Layer l = {.bounds = GRect(0, 0, 144, 168)}; const jerry_value_t ctx = prv_create_canvas_context_2d_for_layer(&l); cl_assert_equal_b(jerry_value_is_object(ctx), true); jerry_set_object_field(jerry_get_global_object(), ...
cl_assert_equal_i(0, s_gpath_draw_filled.call_count)
; EXECUTE_SCRIPT( "ctx.lineTo(5, 6);\n" "ctx.fill();\n" ); cl_assert_equal_i(1, s_gpath_draw_filled.call_count); MockCallRecording *lc = &s_gpath_draw_filled.last_call; cl_assert_equal_i(3, lc->path.num_points); cl_assert_equal_point(GPoint(0, 1), lc->path.points[0]); cl_assert_equal_point(GPoint...
rotl32(src, dest_shift)
; src_rotated = dest_shift; // Continue with this dest_block if there is still space left: if (dest_shift) { continue; } } ++dest_block; } dest_shift += right_clip % 32; // emulate having drawn the right clip if (glyph_block_bits_left <= right_cli...
mag_data.y = mag_data.x; mag_data.x = my_orig; mag_data.z = -mag_data.z; samples_collected++; // don't perform any calibration if the charger is plugged in if (!s_charger_plugged && (s_current_cal_status != CompassStatusCalibrated)) { // if we haven't tried to calibrate yet, run at a higher sampling ...
mag_release()
; } //! Serial command for reading a single value from the compass. void command_compass_peek(void) { int32_t prev_heading = s_last_heading; launcher_task_add_callback(prv_ecompass_start_callback, NULL); // wait for last heading to be updated int retries = 50; // 5 seconds should be ample time while ((prev...
return; } } PBL_LOG(LOG_LEVEL_WARNING, "get_store_entry(%"PRIu32",%"PRIu32") failed to find appropriate store", app_num, resource_id); entry->impl = NULL; } static bool prv_validate_entry(ResourceStoreEntry *entry, ResourceManifest *manifest, uint32_t...
(cb_handle)
; #endif } void resource_storage_get_file_name(char *name, size_t buf_length, ResAppNum resource_bank) { app_file_name_make(name, buf_length, resource_bank, APP_RESOURCES_FILENAME_SUFFIX, strlen(APP_RESOURCES_FILENAME_SUFFIX)); } void resource_storage_generic_init(void) { } void resource_stor...
{ 1088, 248, 136}, { 1280, 112, 248}, { 1296, 32, 328}, { 1056, 80, 224}, // 101 seconds { 896, 88, 152}, { 792, 48, 120}, { 712, 8, 88}, { 696, -56, 96}, { 776, -88, 80}, { 920, -104, 32}, { 1008, -40, 0}, { 1528, -192, 152}, { 1592, 8, 232}, { 1440, 368, 16},...
ARRAY_LENGTH(samples)
; return samples; }