prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorClear); graphics_context_set_antialiased(ctx, false); graphics_draw_round_rect(ctx, &GRect(2, 2, 28, 20), 4); } void across_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context...
(0, 0, 32, 24)
); 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.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(fr...
IZE - AVAIL_BYTES_OFFSET)); space_needed += (PFS_PAGES_PER_ERASE_SECTOR * (sizeof(PageHeader) + 4)); space_needed += sizeof(GCData); // we rely on having 1 page to store some metadata so make sure // we always have enough space based on our block & erase size _Static_assert((PFS_PAGES_PER_ERASE_SECTOR * (siz...
prv_write_erased_header_on_page_range(0, s_pfs_page_count, 1)
; } mutex_unlock_recursive(s_pfs_mutex); PBL_LOG(LOG_LEVEL_INFO, "FS-Format Done"); } int pfs_sector_optimal_size(int min_size, int namelen) { min_size += sizeof(FileHeader); min_size += sizeof(FileMetaData); min_size += namelen; int bytes_per_sector = PFS_PAGE_SIZE - sizeof(PageHeader); int num_pag...
void *ctx) { // Expecting the stub to be called only once durning a test: 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;...
cl_assert_equal_b(s_ack_sent_is_called, true)
; // Since that callback schedules another callback, we have to invoke // system tasks again to get th actual callback to trigger. cl_assert_equal_i(s_out_sent_call_count, 1); // Check that the state is reset properly after everything cl_assert_equal_b(app_message_is_accepting_outbound(), true); } void tes...
_head; static BTErrno s_read_return_value; BTErrno gatt_client_op_read(BLECharacteristic characteristic, GAPLEClient client) { if (s_read_return_value != BTErrnoOK) { return s_read_return_value; } Read *read = malloc(sizeof(Read)); *read = (const Read) { .characteristic = c...
cl_assert_equal_i(characteristic, s_read_head->characteristic)
; cl_assert_equal_i(client, s_read_head->client); } else { cl_assert_(false, "No gatt_client_op_read() has happened at all"); } Read *old_head = s_read_head; s_read_head = (Read *) list_pop_head(&s_read_head->node); free(old_head); } void fake_gatt_client_op_set_write_return_value(BTErrno e) { s_wr...
s[] = { i18n_ctx_noop("NotifVibe", "Disabled"), i18n_ctx_noop("NotifVibe", "Low"), i18n_ctx_noop("NotifVibe", "Medium"), i18n_ctx_noop("NotifVibe", "High") }; static void prv_vibe_menu_select(OptionMenu *option_menu, int selection, void *context) { const bool enable_vibration = (selection != 0); const Vibe...
(s_window_timeouts_ms[selection])
; app_window_stack_remove(&option_menu->window, true /* animated */); } static void prv_window_timeout_menu_push(SettingsNotificationsData *data) { const int index = prv_window_timeout_get_selection_index(); const OptionMenuCallbacks callbacks = { .select = prv_window_timeout_menu_select, }; /// Status b...
bool connected, PebbleTaskBitset client_tasks, uint8_t hci_reason) { // Verify the Pebble event: PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_BLE_CONNECTION_EVENT); // Event should only go to app: cl...
gap_le_connect_connect_by_bonding(~0, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp)
; cl_assert_equal_i(e, BTErrnoInvalidParameter); } void test_gap_le_connect__unregister_invalid_bonding(void) { BTErrno e = gap_le_connect_cancel_by_bonding(BT_BONDING_ID_INVALID, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoInvalidParameter); } void test_gap_le_connect__unregister_non_existing_bonding(void) { ...
/* * 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...
{ // Allocate mutable types Iterator word_iter = (Iterator) { 0 }; WordIterState word_iter_state = (WordIterState) { 0 }; // Allocate immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "Animal\x02style"); cl_assert(success); const TextBoxParams text_box_para...
void test_word_iterator__test_string_consecutive_newlines(void) { // Allocate mutable types Iterator word_iter = (Iterator) { 0 }; WordIterState word_iter_state = (WordIterState) { 0 }; // Allocate immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "In\n\n\nN\n...
, -856}, { -112, 512, -864}, // 235 seconds { -112, 488, -864}, { -120, 512, -864}, { -120, 512, -872}, { -120, 504, -856}, { -120, 528, -856}, { -112, 496, -872}, { -112, 512, -872}, { -112, 496, -864}, { -112, 520, -872}, { -112, 512, -872}, { -112, 512, -864}, ...
{ -104, 512, -856}, { -104, 504, -856}, { -112, 520, -856}, { -112, 520, -864}, { -112, 520, -864}, { -104, 512, -856}, { -112, 504, -864}, { -112, 504, -864}, { -104, 512, -864}, { -104, 512, -864}, { -112, 512, -864}, { -112, 512, -864}, { -112, 504, -864}, { -1...
follows within N secs. } void test_rocky_api_app_message__awaiting_reset_complete_loc_init__(void) { prv_init_and_goto_awaiting_reset_complete_local_initiated(); } void test_rocky_api_app_message__awaiting_reset_complete_loc_init__rcv_reset_request(void) { prv_init_and_goto_awaiting_reset_complete_local_initiate...
ASSERT_JS_GLOBAL_EQUALS_I("d", 1)
; prv_postmessageconnected_postmessagedisconnected_negotiate_to_open_session(); ASSERT_JS_GLOBAL_EQUALS_I("c", 1); ASSERT_JS_GLOBAL_EQUALS_I("d", 1); // Get a ResetRequest: RCV_RESET_REQUEST(); ASSERT_JS_GLOBAL_EQUALS_I("d", 2); } void test_rocky_api_app_message__postmessageconnected_and_postmessagediscon...
assert_equal_rect((GRect(0, 2, large_int, large_int)), s_graphics_draw_text.last_call.draw_text.box); EXECUTE_SCRIPT("ctx.fillText('some text', -0.2, 1.2, 10.5);"); cl_assert_equal_rect((GRect(0, 1, 11, large_int)), s_graphics_draw_text.last_call.draw_text.box); EXE...
(2, s_fonts_get_system_font.call_count)
; cl_assert_equal_p(FONT_KEY_GOTHIC_14_BOLD, s_fonts_get_system_font.last_call.font_key); EXECUTE_SCRIPT("ctx.font = '28px Gothic';\nvar f = ctx.font;\n"); ASSERT_JS_GLOBAL_EQUALS_S("f", "28px Gothic"); } extern T_STATIC void prv_graphics_color_to_char_buffer(GColor8 color, char *buf_out); #define TEST_COLOR_S...
expandable_dialog_set_select_action(expandable_dialog, RESOURCE_ID_ACTION_BAR_ICON_CHECK, prv_my_select_click_handler); app_expandable_dialog_push(expandable_dialog); } //////////////////////////////// // Expandable Dialog with header static void prv_show_expandable_dialog_header(DialogsData *data) { Exp...
dialog_set_background_color(dialog, GColorRed)
; dialog_set_icon(dialog, data->resource_id_80); dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT); app_simple_dialog_push(simple_dialog); } static void prv_show_transcription_dialog(DialogsData *data) { TranscriptionDialog *transcription_dialog = transcription_dialog_create(); static char transcription[50...
-744, -200, 16}, { -1000, -24, 0}, { -1000, 176, -112}, { -928, -16, -320}, { -1296, 176, -184}, { -1544, -144, -160}, { -1712, 72, -152}, { -1544, 440, -40}, { -1272, 624, -192}, { -1048, 488, -216}, // 13 seconds { -1248, 424, -168}, { -1072, 248, -152}, { -1192, 4...
{ -1264, -248, 136}, // 18 seconds { -1688, -136, -176}, { -1536, -16, -208}, { -1464, -272, -88}, { -1208, -208, -208}, { -1040, -8, -280}, { -1000, 112, -168}, { -1104, 152, -88}, { -1216, 192, -152}, { -1312, 240, -224}, { -1352, 448, -320}, { -1336, 1136, -320}, ...
{ 472, -616, -680}, { 728, -480, -776}, { 792, -592, -928}, { 1064, -472, -920}, { 1064, -552, -568}, { 1072, -504, -408}, { 840, -400, -344}, { 680, -152, -488}, { 472, -96, -568}, { 336, -328, -584}, { 328, -288, -416}, { 384, -168, -488}, { 432, -344, -496}, /...
, sizeof(received_crc)); if (received_crc != expected_crc) { PBL_LOG(LOG_LEVEL_ERROR, "Load Data Crc. Expected: 0x%x Received CRC: 0x%x", (int)expected_crc, (int)received_crc); } return (received_crc == expected_crc); } static bool prv_send_vt(const uint8_t *vt, uint32_t vt_size_bytes) { uint8...
PBL_LOG(LOG_LEVEL_INFO, "Loading BT FW image to 0x%x. VT Size: %"PRIu32, (int)info.load_start_address, info.vector_table_size)
; if (!prv_load_and_transfer_vector_table(info.vector_table_size)) { return false; } if (!prv_transfer_main_image_code_and_data(image_size, &info)) { return false; } return true; } static void prv_issue_bt_reboot(void) { uint8_t reboot[] = {'R', 'T'}; dialog_spi_transmit_data(reboot, sizeof(re...
ture.I2S_AudioFreq = I2S_AudioFreq_32k; I2S_InitStructure.I2S_Standard = I2S_Standard_LSB; I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_16b; I2S_InitStructure.I2S_CPOL = I2S_CPOL_High; I2S_InitStructure.I2S_Mode = I2S_Mode_MasterRx; I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Disable; I2S_Init(BO...
{ return s_running; }
static void prv_dispatch_samples_common(void) { mutex_lock_recursive(s_mic_mutex); // if s_running is set to false (mic_stop is called) while the loop is running, the // remaining samples must be discarded. If mic_stop is called from the subscriber callback, // no more samples must be read into the subscribe...
/* * 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_LOG(LOG_LEVEL_WARNING, "Getting fallback font instead"); res = sys_font_get_system_font("RESOURCE_ID_GOTHIC_14"); }
ut_ticks = timeout_ms * RTC_TICKS_HZ / 1000; s_reliable_timer_expiry_time_tick = rtc_get_ticks() + timeout_ticks; s_reliable_timer_sequence_number = sequence_number; // Wake up the PULSE task to get it to notice the newly-started timer. xSemaphoreGive(s_pulse_task_service_semaphore); mutex_unlock(s_reliable_t...
if (timeout == 0) { pulse2_reliable_retransmit_timer_expired_handler(timer_sequence_number); }
prv_pulse_task_feed_watchdog(); } } static void prv_forge_terminate_ack(void) { // Send an LCP Terminate-Ack without invoking the control_protocol // API since we need to send these packets from precarious situations // when the OS and PULSE may not have been initialized yet. uint8_t *packet = pulse_li...
/* * 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[i] == ch) { return (char*)&s[i]; } }
*/, false /*resume*/, &system_uuid); cl_assert(logging_session); fake_system_task_callbacks_invoke_pending(); // We should be able to create a really large session. int num_bytes = DLS_MAX_DATA_BYTES/2; int num_items = num_bytes / item_size; cl_assert(num_bytes > 0); prv_log_consume_random(logging_sessio...
data_logging_finish(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...
{ cl_assert(!vibe_score_info_is_valid(VibeScoreId_Invalid)); }
ODomainHandler *domain_handler = prv_get_domain_handler(cmd->open.domain); if (!domain_handler) { prv_respond_malformed_command(cmd, length, "Unknown domain"); return; } PulseTransferFD *state = NULL; int fd = prv_get_fresh_fd(domain_handler, &state); if (FAILED(fd)) { prv_respond_internal_erro...
if (!pulse_fd) { // prv_get_fd has already sent an error response return; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
passert_failed_no_message(filename, line)
; } NORETURN os_assertion_failed_lr(const char *filename, int line, uint32_t lr) { passert_failed_no_message_with_lr(filename, line, lr); } void *os_malloc(size_t size) { return kernel_malloc(size); } void *os_malloc_check(size_t size) { return kernel_malloc_check(size); } void os_free(void *ptr) { kernel_f...
VEL_ERROR, "Not getting BT Classic id %d. Type mismatch", bonding); return false; } if (address_out) { *address_out = data.bt_classic_data.addr; } if (link_key_out) { *link_key_out = data.bt_classic_data.link_key; } if (name_out) { strncpy(name_out, data.bt_classic_data.name, BT_DEVICE_NAME...
if (bonding_out) { *bonding_out = active_gateway; }
if (type_out) { *type_out = prv_get_type_for_id(active_gateway); } return true; } bool bt_persistent_storage_is_unfaithful(void) { return prv_file_get_bool(&IS_UNFAITHFUL_KEY, sizeof(IS_UNFAITHFUL_KEY), true /* default */); } void bt_persistent_storage_set_unfaithful(bool is_unfaithful) { PBL_LOG(LOG_...
-48, -224}, { -296, 176, -320}, { -288, 208, -304}, { -408, 248, -208}, { -560, 112, -112}, { -728, 200, -216}, { -832, 352, -96}, { -872, 288, -104}, // 65 seconds { -1064, 344, -232}, { -1376, 424, -192}, { -1352, 456, -480}, { -1344, 400, -336}, { -1200, 448, -240}...
{ -712, 288, 16}, { -1024, 296, 64}, { -1056, 304, 64}, { -1312, 352, -40}, { -1360, 496, -208}, { -1056, 424, -264}, { -984, 256, -232}, { -784, 256, -312}, { -504, 192, -232}, { -320, 224, -216}, { -352, 312, -232}, { -480, 328, -184}, { -656, 320, -128}, { -784...
{ -544, 104, -112}, { -440, 240, -264}, { -496, 336, -240}, { -672, 336, -224}, { -776, 240, -96}, { -872, 328, -120}, { -960, 528, -248}, { -1208, 552, -272}, // 73 seconds { -1280, 464, -240}, { -1624, 480, -312}, { -1224, 336, -144}, { -1176, 368, -104}, { -13...
and determine if we have an SMS reply option iOSNotifPrefs *notif_prefs = ios_notif_pref_db_get_prefs((uint8_t *)app_id, strlen(app_id)); if (!notif_prefs) { return false; } // Add attributes to the timeline item for contact lookup AttributeList attributes = {}; attribute_list_add_cstring(&attributes,...
(s_phone_ui_data->action_bar_animation)
; animation_unschedule(s_phone_ui_data->call_status_animation); #endif s_phone_ui_data->current_icon = NULL; s_phone_ui_data->current_icon_id = 0; status_bar_layer_deinit(&s_phone_ui_data->status_bar); gbitmap_deinit(&s_phone_ui_data->up_bitmap); gbitmap_deinit(&s_phone_ui_data->select_bitmap); gbitmap_d...
(window2->on_screen, true)
; cl_assert_equal_p(s_last_click_configured_window, window1); // Switch to modal happens via the compositor compositor_transition(NULL); // Call the upkeep function so the change in state is handled modal_manager_event_loop_upkeep(); // The app is now obstructed by a unfocusable modal, it should remain ac...
ssion->len_minutes; result.start_at.value = start_idx; found_activity = true; } } result.weighted_err = 0.0; result.all_passed = true; ActualValue *actual = &result.activity_type; ExpectedValue *expected = &entry->activity_type; for (int j = 0; j < ARRAY_LENGTH(metrics); ...
ARRAY_LENGTH(exp_minutes)
); } // Run the not moving sample // The expected results were obtained empirically on a known good commit { int num_samples; AccelRawData *samples = activity_sample_not_moving(&num_samples); TestMinuteData exp_minutes[2] = { { .steps = 0, .orientation = 0x81, .vmc = 1...
return ((allocated_space >= tot_capacity) ? 0 : (tot_capacity - allocated_space)); } uint32_t pfs_crc_calculate_file(int fd, uint32_t offset, uint32_t num_bytes) { LegacyChecksum checksum; legacy_defective_checksum_init(&checksum); // grab the pfs lock to prevent lock inversion with crc lock mutex_...
kernel_free(bytes)
; } void pfs_command_cat(const char *filename, const char *num_chars) { int fd = pfs_open(filename, OP_FLAG_READ, 0, 0); char buf[16]; if (fd < 0) { prompt_send_response_fmt(buf, sizeof(buf), "fd open err: %d", fd); return; } int num_bytes = atoi(num_chars); pfs_debug_dump(fd, num_bytes); pfs_clo...
gstat == 0x03 || // Fast charge, CC chgstat == 0x04 || // Fast charge, CV chgstat == 0x05) { // Maintain charge return true; } else { return false; } } bool pmic_is_usb_connected(void) { uint8_t val; if (!prv_read_register(PmicRegisters_STATUSB, &val)) { #if defined (TARGET_QEMU) // ...
(PmicRegisters_INT_MASK_A, 0x08)
; prv_clear_any_pending_interrupts(); } static void register_dump(int start_reg, int stop_reg) { int reg; uint8_t val; char buffer[16]; for (reg = start_reg; reg <= stop_reg; reg ++) { prv_read_register(reg, &val); prompt_send_response_fmt(buffer, sizeof(buffer), "Reg 0x%02X: 0x%02X", reg, val); }...
t that animation_destroy can be called from the stopped handler void test_animation__destroy_from_stopped_handler_with_auto_destroy(void) { #ifdef TEST_INCLUDE_BASIC prv_test_destroy_from_stopped_handler(true); #endif } // -------------------------------------------------------------------------------------- // Tes...
cl_assert_equal_i(prv_last_update_distance(a), 0)
; // Destroy it animation_destroy(a); #endif } // -------------------------------------------------------------------------------------- // Test a simple sequence animation void test_animation__simple_sequence(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b = 500; cons...
) property_animation_update_grect, }, .accessors = { .setter = { .grect = (const GRectSetter) layer_set_frame_by_value, }, .getter = { .grect = (const GRectGetter) layer_get_frame_by_value, }, }, }; static const PropertyAnimationImplementation s_bounds_layer_implementation = { .base = { .update = (...
((PropertyAnimationImplementation*) property_animation->animation.implementation) ->accessors.setter.gpoint(property_animation->subject, result)
} else { prv_stop_test(data); } break; } } else if (data->current_test == BTLETestType_RX) { if (prv_test_is_running(data) && index->row != RXMenuIdx_RunStop) { // Can't change params while running return; } switch (index->row) { case RXMenuIdx_Channel...
(bounds, &data->main_menu_window, &data->main_menu_section, 1, data)
; layer_add_child(window_layer, simple_menu_layer_get_layer(data->main_menu_layer)); } static void prv_main(void) { AppData *data = app_malloc_check(sizeof(*data)); *data = (AppData) { .current_test = BTLETestType_None, .current_test_step = BTLETestStep_None, .btle_test_semaphore = xSemaphoreCreateBi...
/* * 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...
(state->unscheduled_head, prv_handle_list_filter, (void*)handle)
; if (!node) { node = list_find(state->scheduled_head, prv_handle_list_filter, (void*)handle); } if (!node) { if (!quiet) { APP_LOG(APP_LOG_LEVEL_ERROR, "Animation %d does not exist", (int)handle); } return NULL; } return (AnimationPrivate *)node; } // ---------------------------------...
menu_layer_init(menu_layer, &bounds)
; app_menu_data_source_init(&data->data_source, &(AppMenuDataSourceCallbacks) { .changed = prv_data_changed, .filter = prv_app_filter_callback, }, data); app_menu_data_source_enable_icons(&data->data_source, RESOURCE_ID_MENU_LAYER_GENERIC_WATCHAPP_ICON); menu_layer_...
| ModalProperty_RenderRequested | ModalProperty_Transparent); // Checks are listed from top to bottom cl_assert_equal_i(windows[2][1]->on_screen, true); cl_assert_equal_i(windows[2][1]->is_click_configured, true); cl_assert_equal_i(windows[2][0]->on_screen, false); cl_assert_equal_i(window...
for (int i = 0; i < num_windows_per_stack; i++) { windows[idx][i] = window_create(); }
} // The following checks use integer priorities to clearly indicate stack order // We check to make sure the first occurrence of integer values are less than NumModalPriorities // Test: No top window does not result in Exists // Test: No top window results in Transparent and Unfocused modal_manager_even...
, 208}, { -232, 536, -16}, // 285 seconds { -200, 624, 16}, { -152, 736, 64}, { -128, 856, 104}, { -136, 880, 192}, { -152, 896, 104}, { -272, 960, 112}, { -384, 960, 248}, { -472, 1176, 192}, { -384, 1200, 120}, { -328, 1072, 88}, { -248, 888, 48}, { -304, 688, -...
{ -112, -184, -1024}, { -120, -144, -1040}, { -128, -152, -1024}, { -120, -136, -1008}, { -128, -120, -1032}, { -136, -112, -1024}, { -136, -128, -1008}, { -136, -144, -1016}, { -136, -152, -1024}, { -120, -160, -1016}, { -112, -160, -1024}, { -112, -144, -1032}, { -9...
{ 208, 848, 336}, { 224, 904, 328}, { 232, 952, 280}, { 216, 872, 216}, { 208, 888, 224}, { 208, 904, 264}, { 216, 848, 224}, { 176, 888, 144}, { 144, 784, 88}, { 136, 816, 88}, { 152, 840, 112}, { 184, 800, 128}, { 208, 920, 160}, { 208, 896, 208}, { 224, 86...
/* * 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...
IRQ_MAP(I2C4_EV, i2c_hal_event_irq_handler, &I2C_PMIC_MAG_BUS)
; IRQ_MAP(I2C4_ER, i2c_hal_error_irq_handler, &I2C_PMIC_MAG_BUS); void board_init(void) { i2c_init(&I2C_PMIC_MAG_BUS); }
/* * 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 (info->key_len != UUID_SIZE) { PBL_LOG(LOG_LEVEL_WARNING, "Found reminder with invalid key size %d; ignoring.", info->key_len); }
return true; } SerializedTimelineItemHeader hdr; info->get_val(file, &hdr, sizeof(SerializedTimelineItemHeader)); // Restore flags & status hdr.common.flags = ~hdr.common.flags; hdr.common.status = ~hdr.common.status; NextInfo *next_info = (NextInfo *)context; time_t timestamp = timeline_item_get...
_data(); // Test that timer has been invalidated cl_assert_equal_b(!fake_app_timer_is_scheduled(app_message_ack_timer_id()), true); cl_assert_equal_b(s_ack_sent_is_called, false); cl_assert_equal_i(s_out_sent_call_count, 0); cl_assert_equal_i(s_out_failed_call_count, 0); cl_assert_equal_b(app_message_is_c...
app_message_is_closed_outbound()
, false); } void test_app_message__zero_outbox(void) { app_message_close(); cl_assert_equal_i(app_message_open(MAX_SIZE_INBOUND, 0), APP_MSG_OK); cl_assert_equal_b(app_message_is_closed_inbound(), false); cl_assert_equal_b(app_message_is_closed_outbound(), true); DictionaryIterator *iterator; cl_assert_eq...
handle = att_handle; PBL_LOG(LOG_LEVEL_ERROR, "No subscription found for ATT handle %u", att_handle); } goto unlock; } // Mask to mask out all tasks const PebbleTaskBitset task_mask_none = ~0; PebbleTaskBitset task_mask = task_mask_none; for (GAPLEClient c = 0; c < GAPLEClientNum; ++c) { i...
for (GAPLEClient c = 0; c < GAPLEClientNum; ++c) { if (subscription->pending_confirmation[c]) { subscription->pending_confirmation[c] = false; if (subscription->subscriptions[c] == BLESubscriptionNone) { // Client unsubscribed in the mean-time. Confirmation should already have been sent. ...
if (task_mask != task_mask_none) { prv_send_subscription_event(subscription->characteristic, task_mask, type, error); } // In the error case, clean up the subscription data structure, if no longer used: if (has_error && prv_prevailing_subscription_type(subscription) == BLESubscriptionNone) { prv_remo...
uint32_t miliseconds = seconds * 1000 + now_ms; uint32_t rotation = miliseconds * TRIG_MAX_ANGLE / (60 * 1000); GPointPrecise p0; GPointPrecise p1; p0.x.raw_value = (data->canvas_layer->bounds.size.w / 2) * FIXED_S16_3_ONE.raw_value; p0.y.raw_value = (data->canvas_layer->bounds.size.h / 2) * FIXED...
(data->debug_layer)
; } static void init(void) { AppData *data = task_zalloc(sizeof(AppData)); if (!data) { return; } s_window = window_create(); window_set_user_data(s_window, data); window_set_fullscreen(s_window, true); window_set_window_handlers(s_window, &(WindowHandlers) { .load = main_window_load, .unloa...
rn; } const AppFetchUIArgs *const fetch_args = evt->fetch_args; app_manager_launch_new_app(&(AppLaunchConfig) { .md = app_fetch_ui_get_app_info(), .common.args = fetch_args, .common.transition = fetch_args->common.transition, .forcefully = fetch_args->forcefully, }); } // ----------------------...
{ return; }
if (!s_app_task_context.app_md) { // No app has been started yet, so just use the default system size *size = GSize(DISP_COLS, DISP_ROWS); return; } // Platform matches current platform const PlatformType sdk_platform = process_metadata_get_app_sdk_platform(s_app_task_context.app_md); if (...
40, -80}, { 808, 320, -112}, { 1048, 376, -160}, { 1112, 456, -200}, { 1128, 480, -256}, { 1160, 448, -272}, { 1096, 448, -256}, { 968, 400, -208}, { 1000, 416, -136}, { 1136, 336, -120}, { 1136, 320, -56}, { 912, 248, -40}, { 760, 208, -88}, { 688, 216, -56}, { 6...
{ 1064, 240, -168}, { 1112, 216, -152}, { 1288, 304, -240}, { 1104, 312, -168}, { 784, 336, -144}, { 528, 256, -168}, { 432, 208, -144}, { 432, 240, -104}, { 584, 232, -80}, { 792, 288, -152}, // 21 seconds { 1040, 376, -184}, { 1048, 432, -232}, { 1064, 440, -240...
{ 424, 200, -192}, { 504, 248, -136}, { 712, 296, -216}, { 960, 336, -240}, { 1080, 376, -248}, { 1080, 400, -264}, { 1328, 424, -256}, { 1352, 424, -240}, { 992, 352, -128}, { 1016, 368, -136}, { 1120, 336, -112}, { 1024, 296, -48}, { 848, 240, -40}, { 680, 216,...
l prv_find_listener(jerry_value_t event_listeners, uint32_t idx, jerry_value_t listener, void *data) { ListenerQueryData *query_data = data; if (query_data->listener == listener) { query_data->found = true; return false; } return true; } static bool prv_listener_is_registered(con...
if ((*api_ref)->add_handler) { is_relevant = (*api_ref)->add_handler(event_name, func); if (is_relevant) { break; } }
} if (!is_relevant) { APP_LOG(LOG_LEVEL_WARNING, "Unknown event '%s'", event_name); return jerry_create_undefined(); } prv_add_event_listener_to_list((char *)event_name, func); return jerry_create_undefined(); } JERRY_FUNCTION(prv_remove_event_listener) { char event_name[32]; jerry_value_t fu...
y__health_events(void) { // Start activity tracking. This method assumes it can be called from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); // ----------------------------------- /...
fake_system_task_callbacks_invoke_pending()
; // Advance to 6pm EST prv_feed_cannned_accel_data(6 * SECONDS_PER_HOUR, 50, ActivitySleepStateAwake); // switch into PST (which would be 3pm) tz_info = (TimezoneInfo) { .tm_zone = "PST", .tm_gmtoff = -8 * SECONDS_PER_HOUR, }; time_util_update_timezone(&tz_info); // Walk some more until 11pm P...
; // Test to make sure drawing on all cols creates checkerboard pattern setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx...
for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); }
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_even_offset_checkerboard_no_clip"))); // Clipping on even boundaries - no offset setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_EVEN, OFFSET_RECT_EVEN, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { gr...
/* * 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_pbi_test(TEST_PBI_FILE)
; cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE)); } // Tests 2-bit palettized PBI loading into gbitmap // Result: // - gbitmap matches platform loaded PBI void test_pbi__color_2_bit(void) { GBitmap *bitmap = setup_pbi_test(TEST_PBI_FILE); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE)); } // Tests 4-bit pa...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
attribute_list_add_uint8(attribute_list_ref, AttributeIdAlarmKind, (uint8_t)ALARM_KIND_JUST_ONCE)
; prv_get_subtitle_from_attributes(attribute_list_ref, buffer, buffer_size, dummy_i18n_owner); cl_assert_equal_s(buffer, PBL_IF_RECT_ELSE("ONCE", "Once")); attribute_list_destroy_list(attribute_list_ref); }
irty(Layer *layer) {} static Window s_app_window_stack_get_top_window; Window *app_window_stack_get_top_window() { return &s_app_window_stack_get_top_window; } // no text rendering in this test void rocky_api_graphics_text_init(void) {} void rocky_api_graphics_text_deinit(void) {} void rocky_api_graphics_text_add_c...
(500, 150)
; // Update the IRK + Address (Dialog SDK swaps the connection address for the identity address, // even if the pairing process failed mid-way): BleAddressAndIRKChange e = {}; if (!prv_get_device_and_irk_by_conn_idx(evt->conn_idx, &e.is_resolved, &e.irk)) { // Disconnected in the mean time return; } ...
(LOG_LEVEL_ERROR, "ble_gap_per_pref_conn_params_set: %u", e)
; } } void ble_task_assert_is_executing_on_ble_task(void) { PBL_ASSERTN(xTaskGetCurrentTaskHandle() == DialogTaskList[DialogTask_Ble]); } static void prv_configure_irk(const BTDriverConfig *config) { // Use the Identity Root directly as the local Identity Resolving Key: PBL_LOG(LOG_LEVEL_DEBUG, "Setting local...
censes/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 * limitati...
if (s_data.info[0].logging_session) { close_sessions(); } else { start_logging(); }
} static void click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler); } static void handle_deinit(void) { comm_session_set_responsiveness(comm_session_get_system_session(), BtConsumerApp, ResponseTimeMax, MAX_PERIOD_RUN_FORE...
/* * 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, 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); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit();...
accessory_init()
; #endif flash_init(); flash_sleep_when_idle(true); flash_enable_write_protection(); flash_prf_set_protection(true); #if CAPABILITY_HAS_PMIC pmic_init(); #endif // CAPABILITY_HAS_PMIC #if CAPABILITY_HAS_MICROPHONE mic_init(MIC); #endif #if CAPABILITY_HAS_TOUCHSCREEN touch_sensor_init(); #endif imu_...
irmwareDescription), .firmware_length = VALID_OBJECT_SIZE, .checksum = EXPECTED_CRC, }; fake_pb_storage_mem_assert_fw_description_written(&fw_descr); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Abort Message void test_put_bytes__abort_message_t...
{ prv_receive_init_fw_object(); // Stop the timer, so we can easily detect it gets restarted again: TimerID timer_id = put_bytes_get_timer_id(); new_timer_stop(timer_id); const uint8_t chunk[] = { 0xaa, 0xbb, 0xcc }; prv_receive_put(s_last_response_cookie, chunk, sizeof(chunk)); fake_system_task_callbac...
void test_put_bytes__after_timeout_cleanup_and_allow_init_again(void) { prv_receive_init_fw_object(); assert_ack_count(1); assert_nack_count(0); stub_new_timer_fire(put_bytes_get_timer_id()); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_b(fake_pb_storage_mem_get_last_success(), false); ...
ntry to the DB rv = prv_save_serialized_prefs(&file, app_id, length, new_prefs, serialized_prefs_size); prv_file_close_and_unlock(&file); if (rv == S_SUCCESS) { char buffer[length + 1]; strncpy(buffer, (const char *)app_id, length); buffer[length] = '\0'; PBL_LOG(LOG_LEVEL_INFO, "Added <%s> to th...
prv_file_close_and_unlock(&file)
; return flags; } #endif // ---------------------------------------------------------------------------------------------- static bool prv_print_notif_pref_db(SettingsFile *file, SettingsRecordInfo *info, void *context) { char app_id[64]; info->get_key(file, app_id, info->key_len); app_id[info->key_len] = '\0'...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, cell_layer, title)
; (void)data; } static void detail_window_load(Window *window) { AppData *data = window_get_user_data(window); TextLayer *text_layer = &data->detail_text; text_layer_init(text_layer, &window->layer.bounds); text_layer_set_text(text_layer, data->detail_text_buffer); layer_add_child(&window->layer, &text_lay...
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 in writing, software * distr...
prv_fetch_struct()
; char buf[32]; prompt_send_response_fmt(buf, 32, "Vibe: %s", TEST_RESULT_TO_STR(MfgTest_Vibe)); prompt_send_response_fmt(buf, 32, "LCM: %s", TEST_RESULT_TO_STR(MfgTest_Display)); prompt_send_response_fmt(buf, 32, "ALS: %s", TEST_RESULT_TO_STR(MfgTest_ALS)); prompt_send_response_fmt(buf, 32, "Buttons: %s", TE...
/* * 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...
{ do_not_disturb_set_manually_enabled(!do_not_disturb_is_active()); }
/////////////////////////////////////////////////////////////////////////////////////////////////// //! Helper Functions static void prv_assert_settings_value(const void *key, size_t key_len, const void *expected_value, size_t value_len) { SettingsFile file; char buffer[valu...
/* * 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...
platform_type_get_name(platform)
; } static jerry_value_t prv_get_platform_name(void) { return jerry_create_string( (const jerry_char_t *)prv_get_platform_name_string()); } #if PLATFORM_TINTIN # define TINTIN_MODEL(model_str) model_str #else # define TINTIN_MODEL(model_str) NULL #endif // PLATFORM_TINTIN #if PLATFORM_SNOWY # define SNOWY...
/* * 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...
((i * ANIMATION_NORMALIZED_MAX) / num_frames, -20000, 20000)
, expected[i]); } cl_assert_equal_i(interpolate_moook_in_only(ANIMATION_NORMALIZED_MAX, -20000, 20000), 20000); } void test_animation_interpolate__moook_out(void) { const int expected[] = {20004, 20002, 20001, 20000}; const int num_frames = ARRAY_LENGTH(expected); ...
odalPriorityMin; idx < NumModalPriorities; idx++) { for (int i = 0; i < num_windows_per_stack; i++) { window_stack_remove(windows[idx][i], false); window_destroy(windows[idx][i]); } } } void test_window_stack__modal_properties_unfocused(void) { const int num_windows_per_stack = 2; Window *win...
cl_assert_equal_i(windows[2][1]->is_click_configured, false)
; cl_assert_equal_p(s_last_click_configured_window, windows[3][0]); // Add priority 1 opaque window 0 cl_assert(NumModalPriorities > 1); window_stack_push(window_stacks[1], windows[1][0], false); // An opaque top window is now below two unfocusable top windows // Test: An opaque top window below a unfocus...
---------------------------- // Close the settings file and free the file struct static void prv_minute_data_file_close(SettingsFile *file) { settings_file_close(file); kernel_free(file); } // -------------------------------------------------------------------------------------------- // Return the settings file ...
if (!prv_read_minute_file_record(file, info, context->oldest_key, context->newest_key, &chunk)) { return true; }
// if in the wrong time range, skip it if (chunk.hdr.time_utc < (uint32_t)context->oldest_valid_utc || chunk.hdr.time_utc > (uint32_t)context->newest_valid_utc) { ACTIVITY_LOG_DEBUG("Minute chunk time out of range, skipping it"); return true; } // We need to make it 33% bigger for base64 encodi...
n; } ChainingWindowCBData *cb_data = applib_malloc(sizeof(ChainingWindowCBData)); if (!cb_data) { timeline_item_destroy(item); prv_cleanup_action_result(data, false /* succeeded */); return; } *cb_data = (ChainingWindowCBData) { .item = item, // Claim the buffer so it doesn't get automati...
(data->chaining_data.notif)
&& notification_window_is_modal()) { // Only perform the dismiss if: // 1) The notification has a dismiss action // 2) The notification has not already been dismissed // 3) The notification window is modal (we are not in the app). We can get repeat // ANCS UIDs across ...
ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10))); setup_test(&context, false, 2, GColorBlack, GColorBlack, false); graphics_draw_circle(&context, GPoint(50, 50), 10); ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, 2)); setup_test(&context, false, 2, GColorBlac...
GPoint(45, 10)
); #if PBL_COLOR ASSERT_CALLED(graphics_line_draw_stroked_aa(&context, GPoint(5, 5), GPoint(45, 10), SW_EVEN)); #else ASSERT_CALLED(graphics_line_draw_stroked_non_aa(&context, GPoint(5, 5), GPoint(45, 10), SW_EVEN)); #endif setup_test(&context, true, SW_EVEN, GColorBlack, GColorBlack, false); graphics_draw_rec...
/* * 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 serial_distance(a, b, 32); }
prv_should_ignore_notification(uid, timestamp, notif_attributes, app_notif_prefs)) { goto cleanup; } // If this is an incoming call, let the phone service handle it // It would be nice to handle facetime calls with the phone service but it doesn't look like we // can: https://pebbletechnology.atlassian.net...
{ // notification_id is passed into an event if a matching notification was found, so it will // be freed by the system later kernel_free(notification_id); }
if (properties & ANCSProperty_IncomingCall) { ancs_phone_call_handle_removed(ancs_uid, ios_9); } }
ickConfig *cfg = &mgr->recognizers[button_id].config; cfg->context = context; } void window_single_click_subscribe(ButtonId button_id, ClickHandler handler) { Window *window = window_manager_get_top_window(); prv_check_is_in_click_config_provider(window, "subscribe"); ClickManager *mgr = prv_get_current_click...
{ return window->user_data; }
struct Layer* window_get_root_layer(const Window *window) { return &((Window *)window)->layer; } static void prv_window_load(Window *window) { if (window->is_loaded) { return; } window_call_handler(window, WindowHandlerOffsetLoad); window->is_loaded = true; } void window_unload(Window *window) { if ...
le(h); // Test the accessor functions GColor8 test_value; property_animation_get_from_gcolor8(prop_h, &test_value); cl_assert(gcolor_equal(test_value, start_value)); property_animation_get_to_gcolor8(prop_h, &test_value); cl_assert(gcolor_equal(test_value, end_value)); GColor8 set_value; set_value =...
property_animation_create_layer_frame(&layer, &from_r, &to_r)
; Animation *h = property_animation_get_animation(prop_h); void *context = &layer; animation_set_handlers(h, handlers, context); animation_set_duration(h, duration); animation_set_auto_destroy(h, false); prv_clear_handler_histories(); animation_schedule(h); int max_loops = 20; uint64_t start_ms = p...
rtical_line_dotted(&ctx, GPoint(14, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(16, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(18, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(20, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(22, 0), MAX_NUM_ROWS +...
GPoint(20, 0)
, MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(22, 0), MAX_NUM_ROWS + 1 ); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_odd_offset_even_cols_no_clip"))); // Odd cols of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_REC...
/ TRIG_MAX_RATIO; GTransformNumber a = (GTransformNumber) { .raw_value = cosine_val }; GTransformNumber b = (GTransformNumber) { .raw_value = -sine_val }; GTransformNumber c = (GTransformNumber) { .raw_value = sine_val }; GTransformNumber d = (GTransformNumber) { .raw_value = cosine_val }; return GT...
memcpy(t_new, t, sizeof(GTransform))
; } // t_new = tt*t Fixed_S32_16 tx_a = Fixed_S32_16_mul(tx, t->a); Fixed_S32_16 ty_c = Fixed_S32_16_mul(ty, t->c); Fixed_S32_16 tx_b = Fixed_S32_16_mul(tx, t->b); Fixed_S32_16 ty_d = Fixed_S32_16_mul(ty, t->d); t_new->tx = Fixed_S32_16_add3(tx_a, ty_c, t->tx); t_new->ty = Fixed_S32_16_add3(tx_b, ty_...
(*num_nap)++; } } PBL_LOG(LOG_LEVEL_DEBUG, "Done looking for sessions"); } // ------------------------------------------------------------------------------- static void prv_test_nap(void *context) { bool passed = true; activity_prefs_sleep_insights_set_enabled(true); const time_t now_utc = rtc_get...
{ // Change into awake state and capture the sleep before // Walk long enough to overlap with a periodic sleep recomputation prv_feed_steps_min(ACTIVITY_SESSION_UPDATE_MIN + 1); // Do some deep sleep prv_feed_deep_sleep_min(GOOD_SLEEP); // Walk long enough to be registered as "awake" for over ...
activity_prefs_sleep_insights_set_enabled(prev_insights_enabled); prv_test_end(context, passed); } // ------------------------------------------------------------------------------- static void prv_test_activity_reward(void *context) { bool passed = true; // TODO: is this needed here? // Hack to get aroun...
/* * 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...
{ // first, make sure that grect_max_y itself overflows cl_assert(grect_get_max_y(&(GRect){.origin.y = 1, .size.h = INT16_MAX}) < 0); text_layer.layer.frame.origin.y = 1; layer_add_child(&window.layer, &text_layer.layer); GPoint origin; GRect page; cl_assert(text_layer_calc_text_flow_paging_values(&text...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
weather_app_layout_set_down_arrow_visible(layout, multiple_forecasts_exist)
; data->forecasts_list_head = forecasts_list_head; // Only show the first forecast if the number of forecasts has differed between fetches. // i.e. assume that the same number of forecasts means the locations have remained the same. if (data->forecasts_count != forecasts_count_out) { data->foreca...
112}, { 512, 200, -144}, // 45 seconds { 480, 208, -96}, { 544, 184, -88}, { 736, 208, -168}, { 1008, 224, -176}, { 1160, 312, -264}, { 1200, 352, -320}, { 1416, 384, -288}, { 1168, 384, -256}, { 1128, 296, -160}, { 1128, 344, -112}, { 1160, 368, -80}, { 1080, 336...
{ 1040, 184, -16}, { 1064, 168, 0}, { 1088, 128, -32}, { 1232, 168, -72}, { 1112, 176, -104}, { 920, 152, -160}, { 1048, 168, -176}, { 1168, 208, -144}, { 1064, 248, -96}, { 880, 248, -88}, { 664, 232, -128}, { 552, 224, -136}, // 51 seconds { 520, 224, -88}, ...
{ 1080, 200, -136}, { 816, 232, -136}, { 584, 256, -112}, { 504, 160, -152}, { 528, 152, -120}, { 680, 176, -112}, { 816, 200, -208}, { 1024, 288, -232}, { 1160, 344, -312}, { 1184, 384, -344}, { 1272, 400, -296}, { 1080, 408, -280}, { 1160, 408, -216}, { 1216, 3...
rt(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((int[]) {6, 5, 4, 2, 3}, 5, &s_recognizers_handled); prv_destroy_recognizers(recognizers, k_rec_count); } bool prv_dispatch_touch_event(Recognizer *recognizer, void *context); void test_recognizer_man...
layer_init(&layer_a, &GRectZero)
/* * 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...
ARRAY_LENGTH(points2)
fcc_number_subtitle_font, box, text_overflow_mode, GTextAlignmentCenter, NULL); } // Align the FCC mark icon to be drawn in the top right of the container box.size = fcc_mark_icon->bounds.size; grect_align(&box, &container_rect, GAlignTopRight, true /* clip */); prv_draw_mark_with_inv...
app_realloc( cd->regulatory_marks, sizeof(GBitmap *) * ++cd->regulatory_marks_count)
; PBL_ASSERTN(cd->regulatory_marks); cd->regulatory_marks[cd->regulatory_marks_count - 1] = mark; cd->num_regulatory_marks_in_current_cell++; cd->current_regulatory_marks_cell_width += mark_width + MARK_PADDING; } static void prv_finished_appending_regulatory_compliance_marks( SystemCertificationData *cd) ...
ED_MIN); #endif } // -------------------------------------------------------------------------------------- // Test the get_duration call on a sequence animation void test_animation__sequence_get_duration(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int delay_a = 100; const int play_co...
(animation_get_duration(b, false, false), duration_b)
; cl_assert_equal_i(animation_get_duration(b, false, true), play_count_b * duration_b); cl_assert_equal_i(animation_get_duration(b, true, false), delay_b + duration_b); cl_assert_equal_i(animation_get_duration(b, true, true), total_duration_b); cl_assert_equal_i(animation_get_duration(spawn, false, false), ...
0x2F, // Attribute ID - AttributeIdSubtitleTemplateString 0x0D, 0x00, // Attribute Length // Slice subtitle: 'T', 'e', 's', 't', ' ', 's', 'u', 'b', 't', 'i', 't', 'l', 'e', }; // Note that `APP_GLANCE_DB_MAX_SLICES_PER_GLANCE` is reduced for the unit tests! static const uint8...
(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, (uint8_t *)&s_app_glance_basic, invalid_val_size), E_INVALID_ARGUMENT)
; } void test_app_glance_db__basic_glance_blob_insert_and_read(void) { const size_t glance_size = sizeof(s_app_glance_basic); cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, (uint8_t *)&s_app_glance_basic, glance_size), ...
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 express or ...
{ prv_test_get_miss(0); prv_test_get_miss(1); prv_test_get_miss(2); prv_test_get_miss(3); prv_push(0); prv_test_get_hit(0, 0); prv_test_get_miss(1); prv_test_get_miss(2); prv_test_get_miss(3); prv_push(1); prv_test_get_hit(0, 0); prv_test_get_hit(1, 1); prv_test_get_miss(2); prv_test_get_m...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
("end", GTextAlignmentRight)
; #undef HANDLE_CASE // unknown value return false; } JERRY_FUNCTION(prv_set_text_align) { GTextAlignment alignment; if (argc >= 1 && prv_text_align_from_value(argv[0], &alignment)) { s_rocky_text_state.alignment = alignment; } return jerry_create_undefined(); } JERRY_FUNCTION(prv_get_text_align) ...
(points2)); return command_list; } void test_gdraw_command__draw_command_list(void) { GDrawCommandList *command_list = malloc(sizeof(GDrawCommandList) + sizeof(GDrawCommand) + (sizeof(GPoint) * 2)); *command_list = (GDrawCommandList) { .num_commands = 1 }; command_list->commands[0] = (GDrawCommand...
gdraw_command_image_clone(NULL)
, NULL); size_t size = sizeof(GDrawCommandImage) + (3 * sizeof(GDrawCommand)) + (sizeof(GPoint) * 6); GDrawCommandImage *image = malloc(size); memset(image, 0, size); GDrawCommandList *command_list = prv_create_command_list_3(); memcpy(&image->command_list, command_list, sizeof(GDrawCommand...
on_update(animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 300 - 20); } void test_kino_player__finite_animation_infinite_reel_reverse(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number ...
cl_assert_equal_i(animation_is_scheduled(animation), false)
; animation = (Animation *)kino_player_create_play_animation(test_player); cl_assert_equal_i(animation_is_scheduled(animation), false); animation_schedule(animation); // Rewind unschedules the current animation cl_assert_equal_i(animation_is_scheduled(animation), true); kino_player_rewind(test_player); ...
evious ts: %lu, Now ts: %lu", s_last_minute_fire_ts, now_ts); } s_last_minute_fire_ts = now_ts; do_callbacks(&s_minutes_callbacks); } } // ------------------------------------------------------------------------------------------- //! Used only once when we first start up. This should be r...
{ PBL_ASSERTN(s_callback_list_semaphore); mutex_lock(s_callback_list_semaphore); bool rv = prv_regular_timer_is_scheduled(cb); mutex_unlock(s_callback_list_semaphore); return (rv); }
bool regular_timer_pending_deletion(RegularTimerInfo *cb) { return cb->pending_delete; } // ------------------------------------------------------------------------------------------ bool regular_timer_remove_callback(RegularTimerInfo* cb) { PBL_ASSERTN(s_callback_list_semaphore); bool timer_removed = false; ...
data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "Records: %d\nData bytes: %d\nMinutes: %d", (int)num_records, (int)data_bytes, (int)minutes); prv_display_alert(data->debug_card.dialog_text); } // ------------------------------------------------------------------------------...
{ case ActivitySessionType_Sleep: prefix = "s"; break; case ActivitySessionType_Nap: prefix = "n"; break; case ActivitySessionType_RestfulSleep: case ActivitySessionType_RestfulNap: prefix = "*"; deep_sleep = true; break; default: ...
safe_strcat(data->debug_card.dialog_text, prefix, sizeof(data->debug_card.dialog_text)); // Write start time struct tm local_tm; char temp[32]; localtime_r(&session->start_utc, &local_tm); strftime(temp, sizeof(temp), "%H:%M", &local_tm); safe_strcat(data->debug_card.dialog_text, temp, siz...
cl_assert_equal_i(s_unscheduled_cb_count, 0); } // Unschedule job "B", air job "A" regular_timer_fire_seconds(1); assert_ad_data("A"); cl_assert_equal_i(s_unscheduled_cb_count, 1); cl_assert_equal_p(s_unscheduled_job, job_b); cl_assert_equal_b(s_unscheduled_completed, true); // Unschedule job "A" r...
advert_term.min_interval_slots = 200; advert_term.max_interval_slots = 32; job = gap_le_advert_schedule(ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert_equal_p(job, NULL); // Loop-around in the fi...
unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert_equal_p(job, NULL); free(ad); free(ad_scannable); } void test_gap_le_advert__unschedule_non_existent(void) { // Unscheduling non-existent job should be fine, should not crash: gap_le_advert_unschedule((GAPLEAdvertisin...
* See the License for the specific language governing permissions and * limitations under the License. */ #include "app_storage.h" #include <inttypes.h> #include <stdio.h> #include <string.h> #include "util/uuid.h" #include "drivers/flash.h" #include "flash_region/flash_region.h" #include "process_management/pebbl...
pfs_close(fd)
torage_get_ble_pairing_data(&bonding.pairing_info, NULL, NULL, &flags)) { return; } bonding.is_gateway = true; bonding.flags = flags; bt_driver_handle_host_added_bonding(&bonding); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! BT Classic Pairing I...
{ return; }
t int16_t shadow_top_y_offset = -shadow_top_bitmap_h - CLIP(content_offset.y, -shadow_top_bitmap_h, 0); if (shadow_top_y_offset >= -shadow_top_bitmap_h) { graphics_draw_bitmap_in_rect(ctx, shadow_top, &GRect(0, shadow_top_y_offset, layer_w, shadow_top_bitma...
ROUND_TO_MOD_CEIL(min_y_offset, page_height)
; } } if (scroll_layer_get_clips_content_offset(scroll_layer)) { bounds.origin.x = CLIP(offset.x, MIN(min_x_offset, 0), 0); bounds.origin.y = CLIP(offset.y, MIN(min_y_offset, 0), 0); } else { bounds.origin = offset; } if (gpoint_equal(&old_offset, &bounds.origin)) { // Not changed. /...
{ 744, 168, 152}, { 832, 256, 112}, { 840, 296, 72}, { 920, 376, -96}, { 984, 360, -96}, { 1192, 344, -112}, { 1392, 216, 112}, { 1736, 352, 88}, { 1112, 400, 8}, { 1032, 328, 40}, { 1112, 216, 160}, { 1040, 160, 184}, { 816, 112, 160}, { 768, 128, 96}, // 53 s...
{ 744, 56, 104}, { 752, 88, 24}, { 744, 0, 72}, { 800, -16, 80}, { 952, -8, 48}, { 1128, 64, -40}, { 1168, -8, 8}, { 1688, 8, 88}, { 1512, 288, -144}, { 1048, 360, -176}, { 872, 112, 8}, { 720, 128, 64}, { 608, 184, 120}, { 712, 176, 192}, { 776, 256, 184}, ...
{ 1192, 328, -48}, { 1144, 232, -16}, { 1504, 280, 32}, { 1232, 408, -16}, { 1152, 240, 72}, { 1104, 40, 208}, { 1120, 24, 232}, { 1096, 120, 184}, { 912, 64, 176}, { 768, 48, 80}, { 704, 56, 40}, { 680, 8, 48}, { 720, -32, 16}, { 784, -64, 48}, { 976, -24, 1...
REQUESTDRAW "requestDraw" #define ROCKY_CONTEXT2D_CONSTRUCTOR "CanvasRenderingContext2D" #define ROCKY_CONTEXT2D_CANVAS "canvas" #define ROCKY_CONTEXT2D_CLEARRECT "clearRect" #define ROCKY_CONTEXT2D_FILLRECT "fillRect" #define ROCKY_CONTEXT2D_FILLRADIAL "rockyFillRadial" #define ROCKY_CONTEXT2D_STROKERECT "strokeRect" ...
(grect_precise_get_max_y(rect))
////// #include "stubs_accel_service.h" #include "stubs_app_state.h" #include "stubs_app_timer.h" #include "stubs_ble_app_support.h" #include "stubs_event_service_client.h" #include "stubs_fonts.h" #include "stubs_freertos.h" #include "stubs_gbitmap.h" #include "stubs_graphics.h" #include "stubs_graphics_context.h" #i...
window_transition_context_appear(context)
; return animation_create(); } const WindowTransitionImplementation g_window_transition_none_implementation = { .create_animation = window_transition_none_create_animation, }; void compositor_transition(const CompositorTransition *type) { Window *window = modal_manager_get_top_window(); if (window) { GCon...
"%"PRIu8" %"PRIu8, stats->total_days, stats->consecutive_days); return false; } // We want to look at the x days before today (which is always index 0), so add 1 uint32_t history_len = insight_settings->reward.target_qualifying_days + 1; if (history_len > ACTIVITY_HISTORY_DAYS) { PBL_LOG(LOG_LEVEL_ERRO...
("Dismiss", &notif_attr_list)
); AttributeList open_app_action_attr_list = {0}; prv_set_open_app_action(&open_app_action_attr_list, HealthCardType_Sleep, &notif_attr_list); const int num_actions = 2; TimelineItemActionGroup action_group = { .num_actions = num_actions, .actions = ...
* * 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 * limitations under the Lice...
{ // Storage order (smallest first) return prv_comparator_ascending_zero_last(app_node->storage_order, new_node->storage_order); }
else if (app_node->record_order != new_node->record_order) { // Record order (smallest first) return prv_comparator_ascending_zero_last(app_node->record_order, new_node->record_order); } else { // AppInstallId (smallest first) return new_node->install_id - app_node->install_id; } } static void prv...
/* * 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...
(4, 5, 18, 10)
); } static void across_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_rect(ctx, &GRect(4, -5, 18, 10)); } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__origin_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx,...
/* * 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_root_layer(window)
; GRect bounds = window_layer->bounds; // Parameters outer_size = 49; inner_size = 34; angle_start = (TRIG_MAX_ANGLE / 8) * 3; angle_end = TRIG_MAX_ANGLE + TRIG_MAX_ANGLE / 8; prv_setup_data(bounds); } static void prv_setup_even_inner(Window *window) { Layer *window_layer = window_get_root_layer(wind...
assert_equal_i(event_count, 1 * SECONDS_PER_MINUTE); PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_HEALTH_SERVICE_EVENT); cl_assert_equal_i(event.health_event.type, HealthEventMovementUpdate); // ----------------------------------- // Test that we receive sleep update event...
prv_feed_cannned_accel_data(15 * SECONDS_PER_MINUTE, 20, ActivitySleepStateAwake)
ion *) list_find((ListNode *) s_session_head, prv_find_session_by_app_uuid_comparator, &ctx); if (!session) { return ctx.fallback_session; } return session; } static bool prv_find_session_is_system_filter(ListNode *found_node, void *data) { CommSession *se...
bt_unlock()
; return type; } bool comm_session_is_system(CommSession* session) { return (comm_session_get_type(session) == CommSessionTypeSystem); } // ------------------------------------------------------------------------------------------------- //! Must (only) be called when going out of airplane mode (enabling Bluetoo...
_create("Decline Dialog"); Dialog *dialog = actionable_dialog_get_dialog(actionable_dialog); dialog_set_text(dialog, i18n_get("Decline dialog.", dialog)); dialog_set_background_color(dialog, GColorRed); dialog_set_icon(dialog, data->resource_id_80); actionable_dialog_set_action_bar_type(actionable_dialog, Di...
expandable_dialog_set_header(expandable_dialog, "A very long header")
; app_expandable_dialog_push(expandable_dialog); } //////////////////////////////////////// // Expandable Dialog no icon and header static void prv_show_expandable_dialog_header_no_icon(DialogsData *data) { ExpandableDialog *expandable_dialog = expandable_dialog_create("Expandable Dialog"); Dialog *dialog = exp...
CT_NO_CLIP, true, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); c...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 11); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw11_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, ...
data) { return (s_count++ != (int)data); } void test_transcription__validate(void) { bool result; Transcription * validate_test = (Transcription *) s_test_transcription_example; size_t test_size = sizeof(s_test_transcription_example); result = transcription_validate(validate_test, test_size); cl_assert_equ...
transcription_iterate_words((TranscriptionWord *)words_test, 2, (TranscriptionWordIterateCb)prv_cb_return_true, NULL)
; cl_assert_equal_p(result, &words_test[15]); s_count = 0; result = transcription_iterate_words((TranscriptionWord *)words_test, 3, (TranscriptionWordIterateCb)prv_cb_return_false, (void *) 0); cl_assert_equal_p(result, words_test); s_count = 0; result = transcription_iterate_words((TranscriptionWor...