prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
lection.y); cl_assert_equal_i(NORMAL, l.selection.h); cl_assert_equal_b(false, s_content_available[ContentIndicatorDirectionUp]); cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]); // WTF?! menu_layer_set_selected_index(&l, MenuIndex(0, 1), MenuRowAlignNone, false); cl_assert_equa...
menu_layer_reload_data(&l)
; cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(0, l.selection.y); menu_layer_set_selected_next(&l, false, MenuRowAlignNone, false); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section); cl_assert_e...
n_get_value(location, analytics_metric_element_type(metric)); } int64_t analytics_heartbeat_get_array(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric, uint32_t index) { uint8_t *location = prv_heartbeat_get_array_location(heartbeat, metric, index); return prv_location_get_value(location, analytics_metric_ele...
(LOG_LEVEL_DEBUG, "%3" PRIu32 ": %s: %s", analytics_metric_offset(metric), name, buf)
; } } void analytics_heartbeat_print(AnalyticsHeartbeat *heartbeat) { switch (heartbeat->kind) { case ANALYTICS_HEARTBEAT_KIND_DEVICE: PBL_LOG(LOG_LEVEL_DEBUG, "Device heartbeat:"); prv_print_heartbeat(heartbeat, ANALYTICS_DEVICE_METRIC_START, ANALYTICS_DEVICE_METRIC_END); break; case ANALYTICS_HEA...
) { return (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK) && button_is_pressed(BUTTON_ID_SELECT) && !button_is_pressed(BUTTON_ID_DOWN)); } static bool prv_check_force_boot_recovery(void) { if (boot_bit_test(BOOT_BIT_FORCE_PRF)) { boot_bit_clear(BOOT_BIT_FORCE_PRF); return true;...
prv_sad_watch(ERROR_BAD_SPI_FLASH)
; } boot_bit_dump(); // If the recovery firmware crashed at start-up, the watch is now a $199 brick. That's life! if (prv_check_for_recovery_start_failure()) { boot_bit_clear(BOOT_BIT_RECOVERY_START_IN_PROGRESS); prv_sad_watch(ERROR_CANT_LOAD_FW); } bool force_boot_recovery_mode = prv_check_force...
/* * 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(!nexmo_is_reauth_sms(bad_app_id, expected_message))
-152, -160}, { 960, -192, -168}, { 944, -256, -200}, { 944, -384, -264}, { 1000, -352, -320}, { 816, -488, -320}, { 968, -568, -328}, { 664, -248, -264}, { 848, -128, -336}, { 1288, -120, -424}, { 1368, -360, -384}, { 1080, -264, -352}, { 936, -128, -328}, { 912, -8,...
{ 928, -520, -112}, { 928, -448, -280}, { 1176, -480, -296}, { 1560, -464, -416}, { 1592, -360, -280}, { 1320, -264, -216}, // 47 seconds { 976, 56, -200}, { 808, 40, -144}, { 792, -32, -88}, { 920, -48, -88}, { 1072, 80, -56}, { 1320, 280, -64}, { 1400, 544, -56}...
{ 1384, 336, -288}, { 1568, 344, -304}, { 968, 184, -376}, { 1344, 8, -248}, { 1544, -112, -104}, { 1496, -176, -80}, { 1288, -240, -64}, { 1072, -200, -80}, { 936, -144, -104}, { 840, -168, -56}, { 792, -192, -168}, { 808, -192, -176}, { 752, -224, -232}, { 760,...
the beginning of the storage: const FirmwareDescription fw_descr = { .description_length = sizeof(FirmwareDescription), .firmware_length = VALID_OBJECT_SIZE, .checksum = EXPECTED_CRC, }; fake_pb_storage_mem_assert_fw_description_written(&fw_descr); } //////////////////////////////////////////////////...
put_bytes_get_timer_id()
t_src_origin_offset_wrap-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Setup: // - Source width is not a multiple of 8 (ie. not byte aligned in source) // - Source starts with 2 rows and 4 columns of black pixels. // - Dest is all blue. // - Src origin is set to (4, 2) // - dest origin is set to 2...
gbitmap_destroy(src_bitmap)
; } // Setup: // - Source is a 1bit image of a white cross with a black background // Result: // - The image names describe the expected result of each destination color / tint color // combination void test_bitblt__1bit_to_1bit_comptint(void) { GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__1bit_t...
t($0); var name = __jerryRefs.get($1); return obj.hasOwnProperty(name); }, obj_val, prop_name_val); } bool jerry_delete_property(const jerry_value_t obj_val, const jerry_value_t prop_name_val) { if (!jerry_value_is_object(obj_val) || !jerry_value_is_string(prop_name_val)) { return false; } re...
if ($5 /* is_enumerable_defined */) { desc.enumerable = Boolean($6 /* is_enumerable */); }
if ($7 /* is_configurable */) { desc.configurable = Boolean($8 /* is_configurable */); } Object.defineProperty(obj, name, desc); return __jerryRefs.ref(Boolean(true)); }, pdp->is_value_defined, /* $0 */ pdp->is_get_defined, /* $1 */ pdp->is_set_defined, /...
/* * 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...
is_app_file_name("12345678/abc")
== false); } void test_app_file__is_app_file_name_tricky_false_3(void) { cl_assert(is_app_file_name("@12345678\\foo") == false); } void test_app_file__is_app_file_name_tricky_false_4(void) { cl_assert(is_app_file_name("@abcdefg1/def") == false); } void test_app_file__is_app_file_name_tricky_false_5(void) { cl...
/* * 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...
(LOG_LEVEL_WARNING, "Insufficient memory for a large CRC buffer, going slow")
; chunk_size = 128; *buffer = kernel_malloc_check(chunk_size); } return chunk_size; } uint32_t flash_crc32(uint32_t flash_addr, uint32_t num_bytes) { void *buffer; unsigned int chunk_size = prv_allocate_crc_buffer(&buffer); uint32_t crc = CRC32_INIT; while (num_bytes > chunk_size) { flash_rea...
n true; } } return false; } void gap_le_connection_for_each(GAPLEConnectionForEachCallback cb, void *data) { for (int i = 0; i < ARRAY_LENGTH(s_connections); ++i) { cb(s_connections[i], data); } } void launcher_task_add_callback(CallbackEventCallback callback, void *data) { callback(data); } bool s...
(false, ble_hrm_is_sharing_to_connection(&s_conn_a))
ystem/reboot_reason.h" #include "system/version.h" #include "util/attributes.h" #include "util/build_id.h" #include <inttypes.h> static const uint16_t ENDPOINT_ID = 2002; typedef struct PACKED { uint8_t command; uint32_t cookie; } BluetoothHeader; typedef struct BluetoothDumpLineCallbackData { bool in_progres...
{ if (length != 6) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid dump log message received -- length %u", length); return; } generation = data[1]; cookie = *((uint32_t*) (data + 2)); }
else { if (length != 5) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid dump log message received -- length %u", length); return; } cookie = *((uint32_t*) (data + 1)); } switch (*data) { case 0x00: prv_flash_logging_bluetooth_dump(session, 0, cookie); break; case 0x01: prv_flash_loggi...
_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NULL, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_null", fb, GColorWhite)); setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1); grap...
cl_check(framebuffer_is_empty("draw_text_null_null", fb, GColorWhite))
; } void test_graphics_draw_text_8bit__color(void) { GContext ctx; prv_setup_resources(); uint32_t gothic_18_handle = RESOURCE_ID_GOTHIC_18_BOLD; cl_assert(text_resources_init_font(0, gothic_18_handle, 0, &s_font_info)); test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, GRect(0, 0, 144, ...
est = first_short_value; // Now for the rest of the function let's pretend this never happened. ++flash_write_dest; ++buffer; --bytes_remaining; } // Handle body words for (; bytes_remaining >= 2; bytes_remaining -= 2, buffer += 2) { uint16_t buffer_word; memcpy(&buffer_word, buffer, siz...
{ // wait_cycle table based on frequency (table 7.1) // NOTE: 27MHZ frequency skipped due to data latency being 4 smaller than the wait_cycle uint32_t wait_cycle[] = { 40000000 , 54000000 , 66000000 , 80000000 , 95000000 , 104000000 , 120000000 }; // find number wait states ba...
status_t flash_impl_set_burst_mode(bool burst_mode) { const uint32_t MAX_FREQ = MHZ_TO_HZ(108); // max frequency of the flash 108MHZ const uint32_t TAVDP_MIN = 60; // min addr setup time in tenths of ns const uint32_t TADVO_MIN = 40; // min addr hold time in tenths const uint32_t SET...
ting over all possible keys. //! All of the local device attributes can be accessed directly with the following keys: //! This key is used to access the BTBondingID of the current active gateway static const char ACTIVE_GATEWAY_KEY[] = "ACTIVE_GATEWAY"; //! This key is used to access a bool which stores if we have re...
if (!read_size || ((bool_data != (uint8_t)true) && (bool_data != (uint8_t)false))) { return default_value; }
6, 360, 0}, { 1192, 408, 80}, { 1400, 320, 72}, { 1224, 208, 48}, { 1200, 104, 112}, { 1312, -32, 112}, { 1280, -80, 48}, { 1168, 0, -8}, { 1064, 8, 0}, { 1184, -8, -16}, { 968, -112, 64}, { 856, -224, 136}, { 1056, -208, 168}, { 1152, 160, -120}, { 1200, 192, -16...
// 71 seconds { 624, -264, -24}, { 912, -144, -128}, { 1184, -88, 16}, { 1336, 64, -112}, { 1512, 88, -120}, { 1664, 56, -160}, { 1328, 152, -88}, { 952, 128, -112}, { 976, 152, -72}, { 1072, 224, -56}, { 1144, 232, -48}, { 1032, 296, 8}, { 1240, 392, 96}, { 1...
{ 1104, 400, -104}, { 1168, 296, -24}, { 1400, 432, 128}, { 1736, 376, 112}, { 1448, 200, 112}, { 1424, -32, 192}, // 74 seconds { 1384, -144, 104}, { 1296, -48, -16}, { 1112, 24, -48}, { 960, -24, -8}, { 984, -160, -16}, { 632, -296, -48}, { 888, -184, -104}, ...
tries(&s_setup_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 1); #endif } // --------------------------...
(h, prv_custom_curve)
; cl_assert(animation_get_custom_curve(h) == prv_custom_curve); // Reverse cl_assert(animation_get_reverse(h) == false); animation_set_reverse(h, true); cl_assert(animation_get_reverse(h) == true); animation_set_reverse(h, false); // Position int32_t elapsed_ms = 0; AnimationProgress progress = 0;...
equal_range(range, ((HealthServiceTimeRange){ .last_day_idx = 1, .num_days = 1, .seconds_first_day = 86400, .seconds_last_day = 86400, .seconds_total_last_day = 86400, })); // some time yesterday + today result = prv_calculate_time_range(now - SECONDS_PER_DAY, now, &range); cl_assert(result...
cl_assert_equal_i(s_sys_activity_get_metric_values.in.history_len, ACTIVITY_HISTORY_DAYS)
ecursive(s_music_ctx.mutex); return has_now_playing; } uint32_t music_get_ms_since_pos_last_updated(void) { mutex_lock_recursive(s_music_ctx.mutex); const RtcTicks time_elapsed_ticks = rtc_get_ticks() - s_music_ctx.track_pos_updated_at; const uint32_t time_elapsed_ms = ticks_to_milliseconds(time_elapsed_ticks)...
{ const off_t o = offsetof(__typeof__(*s_music_ctx.implementation), request_low_latency_for_period); void (*request_low_latency_for_period)(uint32_t) = prv_implementation_function_for_offset(o); if (request_low_latency_for_period) { request_low_latency_for_period(period_ms); } }
bool music_is_command_supported(MusicCommand command) { const off_t o = offsetof(__typeof__(*s_music_ctx.implementation), is_command_supported); bool (*func_ptr)(MusicCommand) = prv_implementation_function_for_offset(o); if (!func_ptr) { return false; } return func_ptr(command...
_size(from_reel); GRect icon_to = { .origin.x = layer_frame.origin.x + (layer_frame.size.w - size.w) / 2, .origin.y = layer_frame.origin.y + (layer_frame.size.h - size.h) / 2, .size = size, }; const bool take_ownership = true; KinoReel *kino_reel = kino_reel_unfold_create( from_reel, take_own...
(kino_reel, icon_from)
prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); // Start A prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); ...
DPRINTF("%"PRIu64" ms: Executing prv_unschedule_parent handler for %d\n", prv_now_ms(), (int)animation)
; animation_unschedule(s_parent_for_sequence_unschedule_from_child); } // -------------------------------------------------------------------------------------- // Test calling unschedule on the sequence from the stopped handler of one of its children void test_animation__sequence_unschedule_from_child(void) { #ifde...
er->animation), false); } Animation *animation = property_animation_get_animation(item_layer->animation); if (is_first_scroll) { animation_set_duration(animation, interpolate_moook_duration()); animation_set_custom_interpolation(animation, interpolate_moook); } else { animation_set_curve(animation, ...
window_set_click_context(BUTTON_ID_UP, context)
; window_set_click_context(BUTTON_ID_DOWN, context); window_set_click_context(BUTTON_ID_SELECT, context); window_set_click_context(BUTTON_ID_BACK, context); if (pebble_task_get_current() == PebbleTask_App) { // only override the back button when we're in the app window_single_click_subscribe(BUTTON_ID_...
cl_assert(fd >= 0)
; cl_assert(st.st_size == pfs_write(fd, buf, st.st_size)); pfs_close(fd); } /* Start of test */ static const AppInstallId CRAZY_ID = 171717; bool app_install_get_entry_for_uuid(const Uuid *uuid, AppInstallEntry *entry) { AppInstallId id = app_install_get_id_for_uuid(uuid); return app_install_get_entry_for_i...
cmd_value, cmd_length, GAPLEClientKernel); if (e != BTErrnoOK) { if (e == BTErrnoNotEnoughResources) { // Need to wait for space to become available launcher_task_add_callback(&prv_register_next_entity, NULL); } else { // Most likely the LE conn...
music_update_player_playback_state(&state)
; } else { PBL_LOG(LOG_LEVEL_ERROR, "Expected CSV with 3 values:"); PBL_HEXDUMP(LOG_LEVEL_ERROR, (const uint8_t *) update->value_str, value_length); prv_analytics_log_event_with_info(AMSAnalyticsEventErrorPlayerPlaybackInfoUpdate, num_results); } } static bool prv_float_string_parse(const char *value, ...
/* * 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(ours == theirs)
; } void test_math__initialize(void) { } void test_math__cleanup(void) { } void test_math__atan2(void) { check_atan2(10, 14); check_atan2(3, 5); check_atan2(5, 3); check_atan2(10, 10); check_atan2(-153, 217); check_atan2(-28, -133); check_atan2(323, -229); check_atan2(245, 196); check_atan2(65, -3)...
bounds.start == 2); cl_assert(success); // Init mutable types utf8_iter_init(&utf8_iter, &utf8_iter_state, &utf8_bounds, utf8_bounds.start); // Tests cl_assert(!iter_next(&utf8_iter)); cl_assert(!iter_next(&utf8_iter)); cl_assert(!iter_next(&utf8_iter)); } void test_utf8_iterator__decode_valid_string(v...
cl_assert_equal_i(s_each_count, 0)
; }
teps_total, int32_t steps_average, int variant) { static InsightCopyVariants s_tier_config[PercentTierCount] = { [PercentTier_AboveAverage] = { .num_variants = 5, .variants = { i18n_noop("Killer job! You've walked %d steps today which is %d%% above your typical. " "Do it agai...
(notif_time, ActivityInsightType_ActivitySummary, tier)
; prv_create_and_push_notification(&config); kernel_free(body); } // ------------------------------------------------------------------------------------------------ // Creates a notification to notify the user of the sleep summary static void prv_push_sleep_summary_notification(time_t notif_time, int32_t sleep_t...
o *play_state_info = (MusicEndpointPlayStateInfo*) msg; MusicPlayerStateUpdate player_state_update; switch (play_state_info->play_state) { case MusicEndpointPlaybackStatePaused: player_state_update.playback_state = MusicPlayStatePaused; break; case MusicEndpointPlaybackStatePlaying: playe...
prv_pp_command_for_music_command(command)
!= MusicEndpointCmdIDInvalid); } static void prv_music_command_send(MusicCommand command) { const MusicEndpointCmdID pp_command = prv_pp_command_for_music_command(command); if (pp_command == MusicEndpointCmdIDInvalid) { return; } prv_send_music_command_to_handset(pp_command); } static MusicServerCapabil...
Iu32", utc_to_local: %"PRIu32" ", (int)s_dls_activity_records[i].activity, (uint32_t)s_dls_activity_records[i].start_utc, s_dls_activity_records[i].elapsed_sec, s_dls_activity_records[i].utc_to_local); } printf("\nLooking for: type: %d, start_utc: %"PRIu32", elapsed: %"PRIu32", " "u...
printf("\nLooking for: type: %d, start_utc: %d, len: %"PRIu16" ", (int)exp_session->type, (int)exp_session->start_utc, exp_session->length_min)
(&iterator)
); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); // check sixth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].header.id)); // check rollover behaviour cl_assert(!iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].h...
/* * 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...
sys_send_pebble_event_to_kernel(&event)
; return; } // Check to see if handling the previous event requires us to rerender ourselves. if (prv_app_is_render_scheduled() && !*app_state_get_framebuffer_render_pending()) { prv_render_app(); } } static void prv_app_will_focus_handler(PebbleEvent *e, void *context) { Window *window = app_...
/* * 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 ((app_id == INSTALL_ID_INVALID) || shell_sdk_last_installed_app_is_watchface()) { text = "Install an app to continue"; } else if ((rtc_get_time() / tip_delay_s) & 1) { // Show the launcher help on every odd set of five seconds since the epoch text = "Press Select to access Launcher"; } else { tex...
#else GColor color; if (app_id == INSTALL_ID_INVALID) { text = "Install an app to continue or press up / down to browse the timeline"; color = GColorChromeYellow; } else { text = "Press select to launch your app or press up / down to browse the timeline"; color = GColorPictonBlue; } window_se...
n of infinite duration void test_animation__basic_infinite_duration(void) { #ifdef TEST_INCLUDE_BASIC // A long time, but not so long as to use up our 500 capacity callback history limit const uint32_t test_duration = 10000; const uint32_t duration_a = ANIMATION_DURATION_INFINITE; Animation *a = prv_create_test...
(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0)
; // The stopped handler for A should fire before the started handler for B cl_assert(prv_last_handler_entry(&s_stopped_handler_calls, a)->fire_order < prv_last_handler_entry(&s_started_handler_calls, b)->fire_order); // Just before B completes the 2nd play prv_advance_to_ms_with_timers(start_ms ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ s_last_status_code = status; ++s_consumed_count; kernel_free(message); }
static AppOutboxMessageHandler s_outbox_message_handler; static size_t s_service_data_size; void app_outbox_service_register(AppOutboxServiceTag service_tag, AppOutboxMessageHandler message_handler, PebbleTask consumer_task, ...
// 101 seconds { 1088, -8, 8}, { 1072, 32, 8}, { 1128, 0, 32}, { 1000, -8, 32}, { 984, 16, 8}, { 1016, 16, 40}, { 1032, 0, 40}, { 1040, -24, 72}, { 1056, -24, 72}, { 1024, -16, 40}, { 1024, 8, 0}, { 1056, -48, -16}, { 1016, -32, -32}, { 1328, -80, -80}, { 13...
{ 968, -136, -152}, { 1040, -56, -144}, { 1096, 24, -144}, { 1224, 56, -112}, { 1624, 80, -104}, { 1384, 96, -144}, { 1152, 80, -200}, { 792, 72, -176}, { 672, 64, -128}, // 107 seconds { 1016, 64, -88}, { 1208, 40, 32}, { 1136, 48, 72}, { 880, 48, 72}, { 784,...
{ 1160, -168, -96}, { 1168, -160, -72}, { 1088, -144, -32}, { 1024, -96, -40}, { 984, -24, -56}, { 984, -24, -32}, { 1040, -32, -40}, { 1064, -48, -48}, { 1024, -72, -88}, { 984, -112, -96}, { 960, -128, -96}, { 1016, -104, -120}, { 1080, -104, -128}, { 1096, -12...
/ StateStopWaitForReady StateRecording, StateWaitForResponse, // StateStopRecording StateWaitForResponse, StateTransitionToText, // StateStopWaitForResponse StateTransitionToText, StateError, StateFinished, StateExiting, }; _Static_assert(StateExiting < ARRAY_LENGTH(state_map), "T...
(&layer->bounds)
, data->mic_window.mic_dot_radius); } static void prv_set_dot_width(void *subject, int16_t radius) { VoiceUiData *data = subject; data->mic_window.mic_dot_radius = radius; layer_mark_dirty(&data->mic_window.mic_dot_layer); } static PropertyAnimation *prv_create_int16_prop_anim(int16_t from, int16_t to, ...
/* * 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...
kernel_malloc(sizeof(contact))
; cl_assert_equal_i(contacts_db_read((uint8_t *)&contact, UUID_SIZE, contact_out, sizeof(contact)), 0); cl_assert_equal_m((uint8_t *)s_contact_1, contact_out, sizeof(contact)); kernel_free(contact_out); } void test_contacts_db__insert_remove(void) { uint8_t contact[sizeof(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...
framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS})
{ SettingsFile file; if (!prv_file_open_and_lock(&file)) { return false; } bool alarm_is_scheduled = false; AlarmConfig config; bool rv = prv_alarm_get_config(&file, id, &config); if (!rv) { goto cleanup; } if (time_out) { CronJob cron; *time_out = prv_build_cron(&config, &cron) - r...
(&file, alarm_for_each_itr, &itr_data)
; prv_file_close_and_unlock(&file); } // ---------------------------------------------------------------------------------------------- bool alarm_can_schedule(void) { SettingsFile file; if (!prv_file_open_and_lock(&file)) { return false; } bool rv = false; for (int i = 0; i < MAX_CONFIGURED_ALARMS; ...
prv_get_connectivity_status(conn_idx, &status)
; memcpy(response_buf, &status, sizeof(status)); return sizeof(status); } static uint8_t prv_handle_gatt_mtu_read(uint16_t conn_idx, uint8_t response_buffer[READ_RESPONSE_BUFFER_SIZE]) { uint16_t mtu = ATT_DEFAULT_MTU; ble_error_t e = ble_gattc_get_mtu(conn_idx, &mtu); ...
/* * 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(s_num_alarm_events_put, 1)
; cl_assert_equal_i(s_num_timeline_adds, 6); cl_assert_equal_i(s_num_timeline_removes, 3); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); } void test_alarm_smart__trigger_30_min_early_vmc(void) { AlarmId id; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ...
ampling_interval_us(); uint64_t start_time = last_frame_time - curr_num_samples * curr_sampling_interval_us; for (int i = 0; i < len; i += fifo_frame_len) { uint8_t burst_buf[fifo_frame_len]; spi_ll_slave_burst_read(BMI160_SPI, &burst_buf[0], fifo_frame_len); AccelDriverSample data; prv_process_fi...
(BMI160_SCALE_4G)
; } bool bmi160_query_whoami(void) { uint8_t whoami = bmi160_read_reg(BMI160_REG_CHIP_ID); PBL_LOG(LOG_LEVEL_DEBUG, "Read BMI160 whoami byte 0x%"PRIx8", expecting 0x%"PRIx8, whoami, BMI160_CHIP_ID); return (whoami == BMI160_CHIP_ID); } // TODO/NOTE: The accel & gyro self test routines changes some of ...
_handled); prv_receive_and_assert_play_state(expect_is_handled); prv_receive_and_assert_volume_info(expect_is_handled); prv_receive_and_assert_player_info(expect_is_handled); } static const MusicServerImplementation s_dummy_server_implementation = {}; static void prv_set_dummy_server_connected(bool connected) {...
{ // Android app connects: prv_receive_app_info_event(true /* is_android */); prv_receive_and_assert_all(true /* expect_is_handled*/); }
void test_music_endpoint__ignore_unknown_message(void) { // Android app connects: prv_receive_app_info_event(true /* is_android */); uint8_t unknown_msg[] = { 0xff }; prv_receive_pp_data(unknown_msg, sizeof(unknown_msg)); PebbleEvent e = fake_event_get_last(); cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT);...
Fixed_S16_3 radius = {}; const GRect r = GRect(0, 0, 3, 5); const GOvalScaleMode mode = GOvalScaleModeFitCircle; grect_polar_calc_values(&r, mode, NULL, NULL); grect_polar_calc_values(&r, mode, &center, NULL); grect_polar_calc_values(&r, mode, NULL, &radius); cl_assert_gpoint_precise(center, 1, 2); cl_a...
cl_assert_fixedS16_3(s_radius_outer, 0)
; cl_assert_equal_i(s_angle_start, 0); cl_assert_equal_i(s_angle_end, 0); graphics_fill_oval(NULL, GRect(0, 0, 10, 12), GOvalScaleModeFitCircle); cl_assert_gpoint_precise(s_center, 4.5, 5.5); cl_assert_fixedS16_3(s_radius_outer, 4.5); cl_assert(s_radius_inner.integer <= 0); cl_assert_equal_i(s_angle_sta...
l_rect_origin_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_ori...
(prv_clamp_corner_radius(GSize(2, 10), GCornersAll, 4), 1)
; cl_assert_equal_i(prv_clamp_corner_radius(GSize(3, 10), GCornersAll, 4), 1); cl_assert_equal_i(prv_clamp_corner_radius(GSize(4, 10), GCornersAll, 4), 2); cl_assert_equal_i(prv_clamp_corner_radius(GSize(5, 10), GCornersAll, 4), 2); cl_assert_equal_i(prv_clamp_corner_radius(GSize(6, 10), GCornersAll, 4), 3); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ASSERT_JS_GLOBAL_EQUALS_S("size", "medium")
; } void test_rocky_api_preferences__always_valid(void) { s_preferred_content_size = NumPreferredContentSizes; rocky_global_init(s_preferences_api); EXECUTE_SCRIPT("var size = _rocky.userPreferences.contentSize"); ASSERT_JS_GLOBAL_EQUALS_S("size", "medium"); } void test_rocky_api_preferences__small(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...
realloc(ptr, bytes)
; } void task_free(void *ptr) { free(ptr); } void app_log(uint8_t log_level, const char* src_filename, int src_line_number, const char* fmt, ...) { printf("%s:%d", src_filename, src_line_number); va_list args; va_start(args, fmt); vprintf(fmt, args); va_end(args); printf("\n"); } GContext*...
d_buffer[serialized_size], attr_list_out); other = attribute_get_uint32_list(&attr_list_out, AttributeIdMetricIcons); for (int i = 0; i < metric_values->num_values; i++) { cl_assert_equal_i(metric_values->values[i], other->values[i]); } } static void prv_check_attribute_list_seri...
(attribute_get_string(&list, AttributeIdTitle, ""), "Title1")
_circle_stroke_count, 1); cl_assert(prv_compare_points(&center, s_stroke_points, s_path_num_points)); cl_assert(prv_compare_points(&center, s_fill_points, s_path_num_points)); prv_reset(); // set stroke width to zero - fill should be drawn, but not outline gdraw_command_set_stroke_width(command, 0); gdraw_...
cl_assert_equal_i(s_path_num_points, 0); cl_assert_equal_b(s_radius, 0); cl_assert_equal_i(s_circle_fill_count, 0); cl_assert_equal_i(s_circle_stroke_count, 0); cl_assert_equal_p(s_stroke_points, NULL); cl_assert_equal_p(s_fill_points, NULL); free(command); }
/* * 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...
{ int val_len_out = settings_file_get_len(file, key, key_len); cl_must_pass(val_len_out); cl_assert_equal_i(val_len, val_len_out); const bool is_immediate_delete = (val_len == 0 && DELETED_LIFETIME <= 0); uint8_t *val_out = malloc(val_len_out); cl_assert_equal_i(settings_file_get(file, key, key_len, val_ou...
static void set_and_verify(SettingsFile *file, uint8_t *key, int key_len, uint8_t *val, int val_len) { cl_must_pass(settings_file_set(file, key, key_len, val, val_len)); verify(file, key, key_len, val, val_len); } void test_settings_file__set_get_one(void) { printf("\nTesting setting...
M); cl_assert(sys_hrm_manager_get_app_subscription(app_id) == session_ref); prv_fake_send_new_data(); // We should get the BPM event cl_assert_equal_i(s_event_count, 1); cl_assert_equal_i(s_events_received[0].type, PEBBLE_HRM_EVENT); cl_assert_equal_i(s_events_received[0].hrm.event_type, HRMEvent_BPM); ...
hrm_is_enabled(HRM)
, false); } void test_hrm_manager__feature_callbacks(void) { const int num_refs = 2; HRMSessionRef session_refs[num_refs]; AppInstallId app_id = 1; for (int i = 0; i < num_refs; ++i, app_id++) { const uint16_t expire_s = SECONDS_PER_MINUTE; session_refs[i] = sys_hrm_manager_app_subscribe(app_id, 1, e...
cType_Speed; if (metric_type != data->pace_speed_metric) { data->pace_speed_metric = metric_type; prv_update_scrollable_metrics(data); } break; } case SPORTS_UNITS_KEY: break; case SPORTS_HRM_KEY: { // This returns if the SPORTS_HRM_KEY value has not changed...
(&data->sync, SPORTS_UNITS_KEY)
; uint8_t is_metric = 1; if (metric_tuple != NULL) { is_metric = MIN(metric_tuple->value->uint8, 1); } if (is_metric) { return km_string; } else { return miles_string; } } static char *prv_get_custom_metric_label_string(void) { SportsAppData *data = app_state_get_user_data(); return data->...
/* * 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...
system_task_add_callback(callback, data)
; } void ppogatt_create(void) { } void ppogatt_destroy(void) { } void ppogatt_handle_buffer_empty(void) { } void bt_driver_reconnect_try_now(bool ignore_paused) { } void gatt_client_op_cleanup(GAPLEClient client) { } void ppogatt_reset_disconnect_counter(void) { } // Fakes & Helpers /////////////////////////////...
i++) { const CompositeTest *test_data = &s_composite_tests[i]; // Skip invalid GBitmapFormat and GCompOp combinations if (!prv_gbitmap_format_and_compositing_mode_combo_is_valid( test_data->expected_test_image_bitmap_format, compositing_mode)) { break; } framebuffer_clear(s_fb); c...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_graphics_draw_bitmap__offset_layer_across_nx(void) { prv_offset_layer_test(GPoint(-25, 0)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__offset_layer_across_y(void) { prv_offset_layer_test(GPoint(0, 40)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitma...
LOG(APP_LOG_LEVEL_DEBUG, "Error with \"c\": %s", buf); } r = strftime(buf, buf_size, "%d", &good_data); if (r == 0 || strncmp(buf, "05", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"d\": %s", buf); } r = strftime(buf, buf_size, "%D", &good_data); if (r == 0 || strncmp(buf, "05/05/15", ...
(buf, "11:04:49", buf_size)
!= 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"X\": %s", buf); } r = strftime(buf, buf_size, "%y", &good_data); if (r == 0 || strncmp(buf, "15", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"y\": %s", buf); } r = strftime(buf, buf_size, "%Y", &good_data); if (r == 0 || strncmp(...
t(data); prv_fly_dot(data, false /* fly out */); break; case StateError: case StateFinished: case StateExiting: // hide all elements prv_disable_select_click(data); prv_hide_unfold_animation(data); prv_hide_mic_text(data); prv_hide_progress_bar(data); prv_hi...
(image, take_ownership, icon_frame, 0, UNFOLD_DEFAULT_NUM_DELAY_GROUPS, UNFOLD_DEFAULT_GROUP_DELAY)
; if (icon_reel) { kino_reel_transform_set_from_frame(icon_reel, icon_from); kino_reel_transform_set_transform_duration(icon_reel, UNFOLD_DURATION); kino_reel_scale_segmented_set_deflate_effect(icon_reel, UNFOLD_EXPAND_AMOUNT); kino_reel_scale_segmented_set_bounce_effect(icon_reel, UNFOLD_BOUNCE_AMOU...
rase_region(s_gc_block.block_valid); if (free_region_start >= 0) { s_gc_block = (GCBlock) { .block_valid = true, .block_writes = 0, .gc_start_page = free_region_start }; PBL_LOG(LOG_LEVEL_DEBUG, "New Erase Region: %d", s_gc_block.gc_start_page); return (true); } ...
if (f->op_flags & (OP_FLAG_WRITE | OP_FLAG_OVERWRITE)) { // IMPORTANT: prv_invoke_watch_file_callbacks assumes that we already have s_pfs_mutex prv_invoke_watch_file_callbacks(f->name, FILE_CHANGED_EVENT_CLOSED); }
s_buffer; char *last_cursor = cursor; const char **continent_names = app_zalloc_check(NUM_CONTINENTS * sizeof(char *)); const char **region_names = app_zalloc_check(region_count * sizeof(char *)); uint16_t continent_index = 0; // Iterate through the region IDs to sort out the region IDs into continents. // ...
clock_set_timezone_by_region_id(shell_prefs_get_automatic_timezone_id())
} } // If we haven't loaded a glance yet, try loading a generic glance for the node if (!glance) { glance = launcher_app_glance_generic_create(node, service->generic_glance_icon, service->generic_glance_icon_resource_id); } // If we successfully loaded a...
(ctx, frame, glance, is_highlighted)
ION_DURATION_MS, prv_get_button_press_offset(action_bar, index)); } const int64_t icon_change_time = action_bar->icon_change_times[index]; offset = gpoint_add(offset, prv_offset_since_time(icon_change_time, ...
(button_id, context)
; } // If back button is overridden, set context of BACK click recognizer as well: if (action_bar->window && action_bar->window->overrides_back_button) { window_set_click_context(BUTTON_ID_BACK, context); } if (action_bar->click_config_provider) { action_bar->click_config_provider(context); } } inl...
/* * 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...
{ char addr_hex_str[BT_ADDR_FMT_BUFFER_SIZE_BYTES]; bt_local_id_copy_address_hex_string(addr_hex_str); prompt_send_response(addr_hex_str); }
//! Overrides the BD ADDR of the Bluetooth controller for test automation purposes //! @param bd_addr String of 12 hex characters (6 bytes) of the Bluetooth device address //! @note To undo the change, call this with all zeroes. //! @note The change will take effect when the Bluetooth is (re)enabled. void command_bt_...
s->weekday.sum); stats_calculate_basic(op, daily_totals.totals, ARRAY_LENGTH(daily_totals.totals), health_service_private_weekend_filter, (void *)(uintptr_t)local_tm->tm_wday, &stats->weekend.sum); // We want to sum only the days that are this far from index 0 (which ...
HealthValue value_per_day = stats.weekly.avg; default_value = value_per_day / ACTIVITY_NUM_METRIC_AVERAGES; } // Plug in the default value for any entries which are unknown. for (int i = 0; i < ACTIVITY_NUM_METRIC_AVERAGES; i++) { if (averages->average[i] == ACTIVITY_METRIC_AVERAGES_UNKNOWN) { ...
// ---------------------------------------------------------------------------------------------- // Compute the sum of the chunks in the averages array that comprise the given time range from // time_start to time_end. The averages array represents all the chunks for a day, and time_start // to time_end is always <=...
if (got_session_file) { prv_release_session_file(logging_session); } if (consumed_bytes < 0) { PBL_LOG(LOG_LEVEL_ERROR, "Nuking storage for session %d", logging_session->comm.session_id); dls_storage_delete_logging_storage(logging_session); } return consumed_bytes; } // ----------------------...
// can take 2-4 seconds to do. The KernelMain task_watchdog isn't a problem at this time // because we haven't started monitoring it yet, but if we starve KernelBG we'll hit false // watchdog reboots. Sleep a bit here so the background task has a chance to run. See // PBL-24560 for a long term f...
// ------------------------------------------------------------------------------------------------- // Analytics static bool prv_max_numbytes_cb(DataLoggingSession* session, void *data) { uint32_t *max_bytes = (uint32_t *)data; *max_bytes = MAX(*max_bytes, session->storage.num_bytes); return true; } void ana...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_reminder_timer, timeout_ms, prv_new_timer_callback, &s_next_reminder_id, 0)
) { PBL_LOG(LOG_LEVEL_DEBUG, "Set timer for %"PRIu32, timeout_ms); return S_SUCCESS; } else { PBL_LOG(LOG_LEVEL_DEBUG, "Could not set timer."); return E_ERROR; } } status_t reminders_update_timer(void) { PBL_LOG(LOG_LEVEL_DEBUG, "Attempting to update timer."); if (!new_timer_stop(s_reminder_tim...
est_settings_file__automatic_compaction_increment(void) { printf("\nTesting automatic file compaction...\n"); const bool manual_compaction = false; prv_test_settings_file_compaction(manual_compaction); } static void prv_print_stats(SettingsFile *file) { printf("file max used space = %d\n", file->max_used_space...
settings_file_get(&file, key, key_len, val_out, val_len_out)
, E_DOES_NOT_EXIST); free(val_out); } void test_settings_file__used_space_tracking(void) { printf("\nTesting used space tracking...\n"); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_used_space_tracking", 4096)); uint8_t key[5]; int key_len = 4; uint8_t val[5]; int val_len = 4; ...
; } HealthSleepDetailCardData; static void prv_set_sleep_session(char *buffer, size_t buffer_size, int32_t sleep_start, int32_t sleep_end) { // We don't have a sleep session if either start or end time is not greater than 0. // Sometimes if there's no sleep, sleep session rendered...
(heading->primary_value, buffer_len, health_data_current_deep_sleep_get(health_data), card_data)
; HealthDetailSubtitle *subtitle = &card_data->subtitles[card_data->num_subtitles++]; *subtitle = (HealthDetailSubtitle) { .label = app_zalloc_check(buffer_len), .fill_color = PBL_IF_COLOR_ELSE(GColorYellow, GColorBlack), }; prv_set_avg(subtitle->label, buffer_len, card_data->daily_avg, card_data); ...
/* * 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...
memcpy(&s_scan_resp_data, Scan_Response_Data, Length)
; s_scan_resp_data_length = Length; return 0; } unsigned int gap_le_get_scan_response_data(Scan_Response_Data_t *scan_resp_data_out) { *scan_resp_data_out = s_scan_resp_data; return s_scan_resp_data_length; } static GAP_LE_Event_Callback_t s_le_create_connection_event_callback; static unsigned long s_le_creat...
imer_is_scheduled(timer_id)); for (int i=0; i<count; ++i) { stub_new_timer_fire(timer_id); fake_system_task_callbacks_invoke_pending(); } } static void standby_timer_trigger(int count) { TimerID timer_id = battery_monitor_get_standby_timer_id(); cl_assert(timer_id != TIMER_INVALID_ID); cl_assert(stu...
cl_assert(delta < high_percent - low_percent)
; // But, it should approach that value over time int last_delta = delta; while(battery_get_charge_state().charge_percent > low_percent) { periodic_timer_trigger(1); delta = high_percent - battery_get_charge_state().charge_percent; cl_assert(delta >= last_delta); last_delta = delta; } cl_ass...
/* * 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...
(health_data)
; } void health_data_update_quick(HealthData *health_data) { const time_t now = rtc_get_time(); struct tm local_tm; localtime_r(&now, &local_tm); // Get the current steps health_service_private_get_metric_history(HealthMetricStepCount, 1, health_data->step_data); // Get the typical step averages for ever...
referredContentSizeExtraLarge] = menu_cell_basic_cell_height(), })[runtime_platform_content_size]; } static void prv_draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) { NotificationsData *notifications_data = data; void (*draw_cell)(GC...
(s_data, id)
; // NOTE: To avoid having two flash reads, we only read and validate the notification once. // We do it here, instead of in the function call below. If the above // notification_storage validation above is removed, then we should at least validate // it in the function call below. app_noti...
e(); } void test_ams__receive_incomplete_csv_list_player_playback_info_update(void) { prv_connect_ams(); // Receive: playing, 200% playback rate // 0000 00 01 00 31 2c 32 2e 30 ...1,2.0 uint8_t incomplete_playback_info_update[] = { 0x00, 0x01, 0x00, 0x31, 0x2c, 0x32, 0x2e, 0x30, }; prv_receive_ent...
prv_discover_ams(1 /* num_instances */)
; // Simulate successful subscription: BLECharacteristic entity_update = s_characteristics[0][AMSCharacteristicEntityUpdate]; ams_handle_subscribe(entity_update, BLESubscriptionNotifications, BLEGATTErrorSuccess); ams_destroy(); cl_assert_equal_s(music_get_connected_server_debug_name(), NULL); } // Test se...
callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *context) { #if PBL_RECT return 56; #else return menu_layer_is_index_selected(menu_layer, cell_index) ? 84 : 38; #endif } static void prv_draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell...
prv_get_icon_resource_id(i)
); } MenuLayer *menu_layer = &selection_window->menu_layer; menu_layer_init(menu_layer, &window->layer.bounds); menu_layer_pad_bottom_enable(menu_layer, false); menu_layer_set_callbacks(menu_layer, selection_window, &(MenuLayerCallbacks){ .get_num_rows = prv_get_num_rows_callback, .get_cell_height = ...
return; } prv_send_frame(OPCODE_DISCONNECT, NULL, 0); prv_stop(NULL); } static void prv_handle_reset_request(const void *payload, uint32_t length) { if (length) { // should be 0 PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length); return; } PBL_LOG(LOG_LEVEL_WARNING, "Got reset req...
( request->address, request->address, end_address, (end_address + SECTOR_SIZE_BYTES - 1) & SECTOR_ADDR_MASK, prv_erase_complete, NULL)
; } } static void prv_handle_flash_write_request(const void *payload, uint32_t length) { if (length < sizeof(FlashWriteRequest)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length); return; } const FlashWriteRequest *request = payload; length -= offsetof(FlashWriteRequest, data); fla...
(&inverter->layer, true)
; layer_mark_dirty(&(inverter->layer)); } InverterLayer* inverter_layer_create(GRect frame) { InverterLayer* layer = applib_type_malloc(InverterLayer); if (layer) { inverter_layer_init(layer, &frame); } return layer; } void inverter_layer_deinit(InverterLayer *inverter_layer) { if (inverter_layer == N...
(&temp_job.list_node)
; temp_job.cb = new_job->cb; temp_job.cb_data = new_job->cb_data; *new_job = temp_job; // insert after in the list, which guarantees it gets executed after list_insert_after(&job->list_node, &new_job->list_node); PBL_LOG(LOG_LEVEL_DEBUG, "Cron job scheduled for %ld", job->cached_execute_time); mutex_unl...
plex_init(Animation *parent_h, Animation **animation_array, uint32_t array_len, AnimationType type) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); if (array_len > ANIMATION_MAX_CHILDREN) { // Exceed max # of children allowed? return NULL; } boo...
{ for (int i = 0; i < num_children; i++) { animation_destroy(children[i]); } return NULL; }
} else { if (from->is_property_animation) { PropertyAnimationPrivate *prop = property_animation_private_clone( (PropertyAnimationPrivate *)from); if (prop) { clone = &prop->animation; clone->is_property_animation = true;...
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 implied. * See the License for the spe...
actionable_dialog_set_action_bar_type(actionable_dialog, DialogActionBarDecline, NULL)
; actionable_dialog_set_click_config_provider(actionable_dialog, prv_decline_config_provider); app_actionable_dialog_push(actionable_dialog); } ////////////////////////////////////////// // ActionableDialog with custom action bar static void prv_custom_action_bar_click_up(ClickRecognizerRef recognizer, void...
(title, s_music_ctx.title)
; } if (artist) { strcpy(artist, s_music_ctx.artist); } if (album) { strcpy(album, s_music_ctx.album); } mutex_unlock_recursive(s_music_ctx.mutex); } bool music_get_player_name(char *player_name_out) { mutex_lock_recursive(s_music_ctx.mutex); const bool has_player_name = (s_music_ctx.player_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...
{ periph_config_disable(pwm->timer.peripheral, pwm->timer.config_clock); gpio_output_init(&pwm->output, GPIO_OType_PP, GPIO_Speed_100MHz); // The ".active_high" attribute determines the idle state of the PWM output gpio_output_set(&pwm->output, false /* force low */); }
const FunctionalState state = (enable) ? ENABLE : DISABLE; if (IS_LPTIM(pwm->timer.peripheral)) { LPTIM_Cmd(pwm->timer.lp_peripheral, state); } else { TIM_Cmd(pwm->timer.peripheral, state); } }
ush_implementation; } Animation *window_transition_none_create_animation(WindowTransitioningContext *context) { window_transition_context_disappear(context); window_transition_context_appear(context); return animation_create(); } const WindowTransitionImplementation g_window_transition_none_implementation = { ...
app_window_stack_count()
, 1); app_window_stack_pop(true); cl_assert_equal_i(app_window_stack_count(), 0); window_destroy(window); } void test_window_stack__basic_modal_push(void) { Window *window = window_create(); WindowStack *window_stack = modal_manager_get_window_stack(ModalPriorityGeneric); cl_check(window_stack); ...
onds { -152, 920, 128}, { -160, 912, 136}, { -160, 912, 136}, { -160, 912, 136}, { -160, 912, 136}, { -160, 912, 136}, { -152, 920, 128}, { -160, 912, 136}, { -160, 920, 136}, { -160, 912, 136}, { -168, 912, 128}, { -160, 912, 128}, { -160, 912, 136}, { -160, 920,...
{ -160, 912, 136}, { -152, 920, 128}, { -160, 912, 136}, { -152, 920, 136}, { -160, 912, 136}, { -152, 912, 128}, { -160, 920, 128}, { -160, 912, 136}, { -152, 920, 136}, { -160, 912, 136}, { -160, 912, 136}, // 163 seconds { -160, 920, 128}, { -160, 912, 136}, ...
{ -168, 912, 144}, { -160, 912, 136}, { -160, 912, 144}, { -160, 920, 152}, { -160, 920, 136}, { -168, 920, 136}, { -168, 904, 144}, { -160, 904, 152}, { -168, 904, 152}, { -168, 912, 160}, { -176, 912, 168}, { -168, 912, 160}, { -168, 912, 160}, { -160, 920, 160...
n.x) { detected_reset_of_elapsed = true; } cl_assert(max_loops > 0); max_loops--; } // Make sure we detected a reset of the elapsed after rescheduling cl_assert(s_stopped_handler_calls.num_calls == 2); cl_assert(detected_reset_of_elapsed); // Make sure the frame reached the "to" state c...
(a, handlers, a)
; prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(a); prv_advance_to_ms_with_timers(start_ms + duration + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_ha...
tNode *found_node, void *data) { AnalyticsStopwatchNode *stopwatch = (AnalyticsStopwatchNode *)found_node; return (stopwatch->metric == (DialogAnalyticsMetric)data); } static AnalyticsStopwatchNode *prv_find_stopwatch_node(DialogAnalyticsMetric metric) { return (AnalyticsStopwatchNode *)list_find( s_stopwatc...
if (node) { return node->value; }
return 0; } void analytics_deinit(void) { while (s_stopwatch_list) { ListNode *head = s_stopwatch_list; list_remove(head, &s_stopwatch_list, NULL); kernel_free(head); } s_stopwatch_list = NULL; while (s_analytics_list) { ListNode *head = s_analytics_list; list_remove(head, &s_analytics_...
/* * 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...
(syscall_internal_check_return_address, true)
; s_user_start = 0x00; s_user_size = 0x20; memory_cache_flush((void*)0x0F, 0x2); cl_assert_equal_i(s_flush_addr, 0x00); cl_assert_equal_i(s_flush_size, 0x20); cl_assert_equal_i(s_invalidate_addr, 0x00); cl_assert_equal_i(s_invalidate_size, 0x20); cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Valid...
/* * 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...
alarm_set_enabled(data->alarm_id, !data->alarm_info.enabled)
; if (data->alarm_editor_callback) { data->alarm_editor_callback(EDITED, data->alarm_id, data->callback_context); } } static void prv_toggle_smart_alarm_handler(ActionMenu *action_menu, const ActionMenuItem *item, void *context) { AlarmDetailData *data = context; #...
_MICROPHONE TXMenuIdx_Microphone, #endif TXMenuIdx_RunStop, TXMenuIdx_Count, }; enum { RXMenuIdx_Channel = 0, #if CAPABILITY_HAS_BUILTIN_HRM RXMenuIdx_HRM, #endif #if CAPABILITY_HAS_MICROPHONE RXMenuIdx_Microphone, #endif RXMenuIdx_RunStop, RXMenuIdx_Count, }; static void prv_txrx_menu_update(AppData ...
menu_layer_reload_data(menu_layer)
; break; case TXMenuIdx_PayloadLength: prv_txrx_number_window(255, &data->payload_length, "Payload Length", data); break; case TXMenuIdx_PayloadType: prv_payload_type_window(data); break; #if CAPABILITY_HAS_BUILTIN_HRM case TXMenuIdx_HRM: data->is_hrm_en...
/* * 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...
{ hw_gpio_set_active(gpio->port, gpio->pin); }
else { hw_gpio_set_inactive(gpio->port, gpio->pin); } gpio->is_active = active; } void debug_gpio_init(void) { for (int i = 0; i < DEBUG_GPIOS->num_debug_gpios; i++) { prv_config_gpio_as_output_and_set_state(&DEBUG_GPIOS->debug_gpio[i], false); } } void debug_gpio_toggle(int debug_gpio_num) { if (...
{ 1320, 560, -440}, { 1184, 728, -384}, { 1064, 664, -480}, // 15 seconds { 904, 784, -464}, { 1232, 928, -448}, { 1280, 736, -256}, { 1336, 616, -352}, { 1152, 576, -312}, { 1128, 464, -272}, { 1008, 320, -176}, { 976, 272, -184}, { 1016, 224, -200}, { 1136, 272, -...
{ 976, 352, -136}, { 1064, 392, -136}, { 1200, 400, -184}, { 1208, 264, -208}, { 1144, 240, -192}, { 952, 96, -168}, { 784, 48, -200}, { 768, 8, -120}, { 376, -72, -368}, { 800, 72, -352}, { 1216, 88, -352}, { 1104, 112, -416}, { 992, 240, -480}, { 968, 168, -376}...
{ 1144, 528, -472}, // 23 seconds { 1016, 640, -568}, { 1072, 848, -664}, { 1024, 752, -520}, { 1152, 928, -504}, { 1024, 616, -392}, { 1136, 624, -344}, { 1400, 576, -304}, { 1448, 432, -264}, { 1248, 272, -232}, { 1104, 224, -192}, { 1040, 144, -200}, { 1008, 1...
0}, { 136, -312, -1008}, // 2 seconds { 136, -312, -1000}, { 128, -320, -992}, { 136, -304, -984}, { 144, -304, -984}, { 144, -312, -992}, { 144, -312, -992}, { 136, -320, -984}, { 136, -312, -984}, { 128, -312, -976}, { 136, -304, -968}, { 128, -312, -984}, { 136...
{ 392, -256, -976}, { 376, -264, -952}, { 416, -256, -912}, { 384, -272, -896}, { 360, -264, -912}, { 320, -264, -896}, { 304, -264, -912}, { 248, -272, -880}, { 216, -312, -864}, { 208, -296, -872}, { 200, -312, -872}, { 216, -288, -904}, { 192, -320, -936}, { 17...
GLYPH_SIZE]); *dst++ = (buf & 0xFF); buf >>= 8; buf_num_bits -= 8; } // Fix-up the height to reflect the bit pattern instead of the number of RLE units. if (g->header.width_px) { g->header.height_px = total_pixels_decoded / g->header.width_px; } return g; } static bool prv_load_glyph_bitmap...
{ const uint32_t cache_key = prv_get_cache_key(font_res, codepoint); LineCacheData *cached = NULL; // If we don't have bitmap caching, we have a single glyph_buffer that contains the last used // glyph. If this matches the glyph we're looking for right now, that's what we want to use. // Potentially this als...
!prv_load_glyph_bitmap(codepoint, font_res, cached)) { return NULL; } return &cached->glyph_data; } // We missed the cache, so we need to build a new cache entry. LineCacheData *data = &font_cache->cache_data_scratch; data->is_bitmap_loaded = false; data->resource_offset = prv_get_glyp...
ributeIdTitle, config->title); if (config->subtitle) { attribute_list_add_cstring(&list, AttributeIdSubtitle, config->subtitle); } attribute_list_add_uint32(&list, AttributeIdIconPin, config->icon); item = timeline_item_create_with_attributes(timestamp, MINUTES_PER_HOUR, ...
(s_dest_bitmap, TEST_PBI_FILE)
ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(-5, -5)); } void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__origin_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 10, 10)); layer_set_update_proc(&...
cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite))
; test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &clear_layer_update_callback); layer_rend...
); window_stack_remove(window1, true); cl_assert_equal_i(window1->on_screen, false); window_destroy(window1); window_destroy(window2); } // Description: // This test ensures that we are able to work with both the modal window stacks // and the application stack at the same time. void test_window_stack__moda...
(window_stack_count(modal_stack), 1)
; cl_assert_equal_i(window2->on_screen, true); cl_assert_equal_p(s_last_click_configured_window, window2); // 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 obstruc...
/* * 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, color)
; graphics_draw_text(ctx, text, font, (GRect) { .origin = text_center, .size = text_size }, GTextOverflowModeFill, GTextAlignmentCenter, NULL); } static void prv_draw_watch_hand_rounded(GContext *ctx, ClockHand *hand, GPointPrecise center) { GPointPrecise watch_hand_end = prv_gpoint_from_polar...
{ -1168, 184, -416}, { -1128, 296, -440}, { -1472, 272, -232}, { -1560, 176, -96}, { -1232, 128, -120}, { -992, 120, -88}, { -992, 104, -16}, { -1040, 56, 32}, { -1088, 72, 8}, { -1112, 112, 0}, { -1184, 112, 8}, { -984, -64, 8}, { -1024, -128, -80}, { -1064, 40, -...
{ -1336, 616, -176}, { -1624, 384, 24}, { -1672, 272, 40}, { -1272, 192, 48}, { -1080, 128, 32}, { -1088, 152, 88}, { -1104, 104, 80}, { -1032, 72, 96}, { -1056, 48, 104}, { -1120, -72, 96}, { -816, -200, -40}, { -1072, -64, -104}, { -1328, 264, -384}, { -1168, 13...
{ -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}, ...
/* * 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...
periph_config_release_lock()
; } bool button_selftest(void) { return button_get_state_bits() == 0; }
periodic_timer_trigger(20); cl_assert_equal_i(battery_get_charge_state().charge_percent, 50); PBL_LOG(LOG_LEVEL_DEBUG, "β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²β–²"); // Should still update if it goes lower fake_battery_set_millivolts(lower_mv); periodic_timer_trigger(20); cl_assert_equal_i(battery_get_charge_state().charge...
cl_assert(!result.is_plugged)
; last_discharge_percent = result.charge_percent; } }
false); modal_manager_event_loop_upkeep(); cl_assert_equal_i(window1->on_screen, false); cl_assert_equal_i(window2->on_screen, true); window_stack_remove(window2, false); modal_manager_event_loop_upkeep(); cl_assert_equal_i(window2->on_screen, false); cl_assert_equal_i(window1->on_screen, true); ...
(app_stack)
, 1); cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_p(s_last_click_configured_window, window1); // Switch to the kernel to push a modal window stub_pebble_tasks_set_current(PebbleTask_KernelMain); window_stack_push(modal_stack, window2, true); cl_assert_equal_i(window_stack_count(modal_sta...
TRIG(180), TO_TRIG(270)), ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(180),GCornerBottomLeft}, .full_quadrants = GCornerBottomLeft, .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(270),GCornerTopLeft} })); cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(270), TO...
TO_TRIG(90 + 45)
,GCornerBottomRight}, .full_quadrants = GCornersLeft, .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(45),GCornerTopRight} })); // ## Section with regular angles but over 360Β° // Within same quadrant cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(360 + 30), TO_TRIG(360 + 60)), ((EllipsisDra...
10th_noon_2015); // Our test event is at June 9th 2015, 12:00:00 // Now - one day const int event_time = jun10th_noon_2015 - SECONDS_PER_DAY; // if the event is within 2 hours, then show the actual time instead of "X hours ago" const int MAX_RELATIVE_HRS = 2; // June 9th 2015, 12:00:00 (T+00:00:00) rtc...
cl_assert_equal_s("2 H AGO", time_buf)
; // June 9th 2015, 13:59:59 (T+01:59:59) rtc_set_time(event_time + SECONDS_PER_HOUR + (59 * SECONDS_PER_MINUTE) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 H AGO", time_buf); // June 9th 2015, 14:00:00 (T+02:00:00) rtc_set_time(e...