prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ation_create(&s_color_slide_animation_impl, NULL, &zero, &width)); s_phone_ui_data->bg_color.boundary = 0; } else { s_phone_ui_data->bg_color.right = color; color_animation = property_animation_get_animation( property_animation_create(&s_color_slide_animation_impl, NULL, &width, &zero)); s_pho...
graphics_fill_rect(ctx, &GRect(s_phone_ui_data->bg_color.boundary, 0, layer->bounds.size.w, layer->bounds.size.h))
; #else graphics_context_set_fill_color(ctx, DEFAULT_COLOR); graphics_fill_rect(ctx, &layer->bounds); #endif } //! Ring functionality static void prv_ring(void *unused) { PBL_LOG(LOG_LEVEL_DEBUG, "RING"); if (alerts_should_vibrate_for_type(AlertPhoneCall)) { #if CAPABILITY_HAS_VIBE_SCORES if (!s_phone_ui_d...
break; } continue; } hw_spi_fifo_write8(s_spi->bus_id, core_dump_connect_response[tx_index++]); if (tx_index == sizeof(core_dump_connect_response)) { return true; } } } // Pulse the INT line to wake the host host_transport_set_mcu_in...
printf("low power mode\n"); prv_low_power_mode(); break; default: break; } }
} NORETURN core_dump(bool user_requested) { // Feed the watchdog before we continue hw_watchdog_set_pos_val(0xFF); // Disable interrupts, should we not have been called from fault context portDISABLE_INTERRUPTS(); // Reconfig debug serial debug_uart_init(); printf("\n\nStarting Core Dump\n"); // B...
rigin_layer.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__offset_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(10, 15, 20, 10)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &...
(&ctx.dest_bitmap, "draw_rect_origin_aa_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 2); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // AA = true, SW = 3 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_C...
ULL)); cl_assert_equal_i(0, erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_one_byte(void) { cl_assert(system_flash_erase(FLASH_BASE, 1, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_one_byte_in_middle_of...
IS_VOLTAGERANGE(voltage_range)
); cl_check_(flash_flags_set == false, "Forgot to clear flags before erasing"); cl_check_((erased_sector & (1 << sector/8)) == 0, "Re-erasing an already erased sector"); flash_flags_set = true; if (return_status == FLASH_COMPLETE) { erased_sector |= (1 << sector/8); } return return_status; }...
, IN_OUT_ANIMATION_DURATION); #if !defined(PLATFORM_TINTIN) // animate the dots Animation *crumbs_anim = crumbs_layer_get_animation(&data->crumbs_layer); animation_set_duration(crumbs_anim, IN_OUT_ANIMATION_DURATION); // combine the two Animation *spawn_anim = animation_spawn_create(content_in, crumbs_anim, ...
window_get_root_layer(window)
ogle 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 * ...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_x_origin_layer.${BIT_DEPTH_NAME}.pbi"))
t_align(&arrow_rect, aml_bounds, GAlignTop, true /* clip */); content_indicator_draw_arrow(ctx, &arrow_rect, ContentIndicatorDirectionUp, fg_color, bg_color, GAlignTop); } if (num_rows - row >= SHORT_ITEM_MAX_ROWS_SPALDING) { grect_align(&arrow_rect, aml_bounds, GA...
{ applib_free(aml->layout_cache.item_heights); }
< prv_vibe_score_get_pattern_length(pattern_attribute); i++) { if (pattern_list[i] >= num_note_types) { return false; } } GenericAttribute *repeat_delay_attribute = generic_attribute_find_attribute(&score->attr_list, VibeAttributeId_RepeatDelay, score->at...
{ sys_vibe_pattern_enqueue_step_raw(note->vibe_duration_ms, note->strength); }
if (note->brake_duration_ms > 0) { sys_vibe_pattern_enqueue_step_raw(note->brake_duration_ms, vibe_get_braking_strength()); } } sys_vibe_pattern_trigger_start(); } VibeScore *vibe_score_create_with_resource(uint32_t resource_id) { ResAppNum app_num = sys_get_current_resource_num(); return vibe_s...
ERTY_ALPHA) { set_text_element(data->alpha_text, data->alpha_text_buffer, true); } else { set_text_element(data->alpha_text, data->alpha_text_buffer, false); } // Set FG Text strncpy(data->fg_text_buffer, "FG =", sizeof(data->fg_text_buffer)); if (data->property == PROPERTY_FG_COLOR) { set_text_e...
(36, 2, 30, 20)
, 4, GCornersAll); // Draw border if (gcolor_equal(data->bg_color, GColorBlack)) { graphics_context_set_fill_color(ctx, GColorWhite); graphics_fill_round_rect(ctx, &GRect(35, 47, 32, 22), 4, GCornersAll); } // Draw background color GColor bg_color = (GColor){ .argb = (data->bg_color.argb | ALPHA_100)...
al_i(recognizers[0]->state, RecognizerState_Started); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Cancelled); // was already cancelled cl_assert_equal_i(recognizers[4]->state, RecognizerState_Failed); // A child layer of the active layer becomes active when a window recognizer is triggered e.type ...
((int[]) {4, 0, 3, 1}, 4, &s_recognizers_handled)
; prv_compare_recognizers_processed((int[]) {3}, 1, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possible); cl_assert_equal_i(recog...
gnizer_handle_touch_event(r, &(TouchEvent) {})); // Should not pass null touch events r->state = RecognizerState_Possible; cl_assert_passert(recognizer_handle_touch_event(r, NULL)); } void test_recognizer__handle_touch_events_fail_after(void) { RecognizerEvent rec_event = -1; RecognizerState new_state; bo...
(list.node, &r2->node)
); cl_assert(r1->is_owned); cl_assert(r2->is_owned); recognizer_remove_from_list(r1, &list); cl_assert(!list_contains(list.node, &r1->node)); cl_assert(!r1->is_owned); recognizer_remove_from_list(r1, &list); cl_assert(!r1->is_owned); } static int s_list_idx = 0; static bool prv_list_iterator(Recognizer...
NCATE,fmt,a,b) # else # define snprint_eq snprintf # endif typedef struct _stat STAT_T; #else # ifdef UNITTEST_DEBUG # include <signal.h> # endif # include <sys/wait.h> /* waitpid(2) */ # include <unistd.h> # define _MAIN_CC # define snprint_eq snprintf typedef struct stat STAT_T; #endif #include "clar.h" #de...
( test->name, _clar.test_count, (_clar.suite_errors > error_st) )
016}, { 216, 176, -1008}, { 248, 184, -1000}, { 224, 184, -1024}, { 224, 192, -1016}, { 224, 184, -1032}, { 216, 192, -1016}, { 216, 192, -1008}, { 232, 208, -1016}, { 216, 200, -1000}, { 248, 176, -1016}, // 5 seconds { 208, 216, -1024}, { 200, 192, -1016}, { 248...
{ 64, 168, -1016}, { 88, 152, -1032}, { 88, 168, -1024}, { 80, 152, -1032}, { 96, 144, -1048}, { 80, 168, -1008}, { 96, 144, -1040}, { 104, 168, -1040}, { 88, 168, -1008}, { 112, 152, -1056}, { 88, 168, -1024}, { 88, 160, -1024}, { 104, 152, -1032}, { 96, 152, -10...
/* * 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...
(timer_data->callback)
header.id, &s_all_day_items[1].header.id) || uuid_equal(&state.pin.header.id, &s_all_day_items[2].header.id)); cl_assert(state.node->all_day); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[1].header.id) || uuid_equal(&state.pin.header.id, &s_all_day_items[2]...
prv_insert_extra_case_items()
; Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, s_feb_5_midnight + 11 * 60 * 60), 2); } void test_timeline__two_iterators(void) { uint8_t init_net_all...
prv_coredump_flash_base(data->only_get_new_coredump)
; PBL_LOG(LOG_LEVEL_DEBUG, "GET_BYTES: checking image %p", (void *)flash_base); if (flash_base != CORE_DUMP_FLASH_INVALID_ADDR) { flash_read_bytes((uint8_t *)&image_hdr, flash_base + sizeof(CoreDumpFlashRegionHeader), sizeof(image_hdr)); } if (flash_base == CORE_DUMP_FLASH_INVALID_ADDR ...
r" (initial_stack_pointer), [reset_handler] "r" (reset_handler) ); __builtin_unreachable(); } static bool prv_check_and_increment_reset_loop_detection_bits(void) { uint8_t counter = (boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_THREE) << 2) | (boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_TWO) << 1) | ...
{ dbgserial_putstr("Firmware is erased"); return true; }
return false; } static void prv_sad_watch(uint32_t error_code) { dbgserial_putstr("SAD WATCH"); char error_code_buffer[12]; itoa_hex(error_code, error_code_buffer, sizeof(error_code_buffer)); dbgserial_putstr(error_code_buffer); display_error_code(error_code); bool prev_select_state = button_is_press...
n(ActionMenuLayer *aml) { animation_unschedule(aml->item_animation.animation); aml->item_animation.animation = NULL; } static void prv_animate_cell(ActionMenuLayer *aml, GRect *label_text_frame, bool *draw_top_shading, bool *draw_bottom_shading) { // Check to see if this item spans m...
animation_schedule(item_animation->animation)
; } *draw_top_shading = (item_animation->current_offset_y != item_animation->bottom_offset_y); *draw_bottom_shading = (item_animation->current_offset_y != item_animation->top_offset_y); // update the rect height and offset based on the current animation state label_text_frame->origin.y += item_anim...
inimum. size_t header_bytes_remaining; //! Pointer to the default system receiver context, to which we want to forward the header data. Receiver *kernel_receiver; } AppMessageReceiver; static bool prv_fwd_prepare(AppMessageReceiver *rcv, CommSession *session, size_t header_bytes_rema...
(rcv->header_bytes_remaining, length)
; g_default_kernel_receiver_implementation.write(rcv->kernel_receiver, data, header_bytes_to_write); rcv->header_bytes_remaining -= header_bytes_to_write; } if (rcv->is_writing_to_app_inbox) { prv_write(data, length); } } static void prv_finally(App...
turn *(BTDeviceInternal *)(&device); } static BTDeviceInternal prv_connected_dummy_device(uint8_t octet) { BTDeviceInternal device = prv_dummy_device(octet); gap_le_connection_add(&device, NULL, true /* local_is_master */); s_connection = gap_le_connection_by_device(&device); s_connection->gatt_connection_id =...
{ prv_assert_notification_event_ext(characteristic, value, assert_value_length, kernel, app, true /* should_consume */); }
ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT); activity_get_sessions(&num_sessions, sessions); for (unsigned i = 0; i < num_sessions; i++) { // End and save any automatically detected ongoing sessions if (sessions[i].ongoing) { sessions[i].ongoing = false; ...
activity_private_compute_resting_calories(len_min)
, ACTIVITY_CALORIES_PER_KCAL), }; activity_sessions_prv_add_activity_session(&session); activity_insights_push_activity_session_notification(rtc_get_time(), &session, prv_get_avg_hr(), s_workout_data.current_workout->hr_zone_time_s); s_wor...
icky when we're also using INT toggles to // detect a spontaneous reset of the Dialog chip. // For now, let's try to collect a core dump and then cleanly restart BLE. The root cause // will be determined later. // Also, collect an analytic to see how frequently this happens. bool should_c...
PBL_ASSERTN(s_spi_transport.semph)
; prv_watchdog_init(); hc_protocol_cb_dispatcher_init(); s_spi_transport.task_is_running = false; s_spi_transport.task_should_deinit = false; TaskParameters_t task_params = { .pvTaskCode = prv_host_transport_main, .pcName = "BTTrans", .usStackDepth = configMINIMAL_STACK_SIZE * 2, .uxPriori...
clock_reset(0); rtc_set_time(jun10th_noon_2015); // Our test event is at June 12th 2015, 12:00 // Now + two days const int event_time = jun10th_noon_2015 + (2 * SECONDS_PER_DAY); // if the event is in 24 hours on the same day, then show it. const int MAX_RELATIVE_HRS = 24; // June 10th 2015, 12:00:00 (...
rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) + (30 * SECONDS_PER_MINUTE))
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 11 H", time_buf); // June 12th 2015, 00:30:01 (T-11:29:59) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) + (30 * SECONDS_PER_MINUTE) + 1); clock_get_until_time_capitalized(time_buf, sizeof(...
{ -1488, 48, -160}, { -728, 136, -256}, { -984, 200, -304}, { -704, 96, -152}, { -312, 80, -120}, { -280, 224, -160}, { -568, 312, -248}, { -840, 456, -184}, { -1008, 264, -544}, { -1128, 200, -280}, { -1264, 304, -248}, { -1488, 248, -216}, { -1784, 224, -296}, { -1...
{ -792, 112, 440}, { -480, -104, 328}, { -456, 96, 88}, { -600, -256, 32}, { -832, 312, -136}, { -904, 520, -128}, // 18 seconds { -1104, 400, 48}, { -1208, -64, 296}, { -1192, 120, 360}, { -1528, 184, 208}, { -792, -264, 328}, { -984, -32, 8}, { -912, 104, 56}, ...
{ -408, 744, -608}, { -824, 392, -168}, { -880, 288, -312}, { -1184, 336, -432}, { -1056, 136, 48}, { -1712, 288, -392}, { -1104, 0, 24}, { -1144, 112, -184}, { -1032, 264, -136}, { -736, -8, 40}, { -560, 216, -72}, { -544, 192, -80}, { -832, 240, -216}, { -960, ...
alue); set_value = GPoint(44, 45); property_animation_set_to_gpoint(prop_h, &set_value); property_animation_get_to_gpoint(prop_h, &test_value); cl_assert_equal_point(test_value, set_value); // Destroy it animation_destroy(h); #endif } // -----------------------------------------------------------------...
animation_set_handlers(h, handlers, context)
; animation_set_duration(h, duration); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(h); // Test the accessor functions Fixed_S32_16 test_value; property_animation_get_from_fixed_s32_16(prop_h, &test_value); cl_assert_equal_fixed_s32_16(test_value, start_value);...
// Frame 2 has delay 1000 ms, so at time 1000 ms, we expect frame 3 gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 1 * 1000); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(3))); // Frame 3 has delay 1000 ms, frame 4 and 5 have zero delay, so at time 2000 ms == frame 5 gbitmap_sequence_u...
(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(4)))
; gbitmap_set_bounds(bitmap, shift_bounds); gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); gbitmap_set_bounds(bitmap, orig_bounds); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5))); #endif } // Tests APNG file with 8-bit color, originally broke the updated upng+tinflate code // R...
nce with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either exp...
{ // Configure SCS to generate a wake up interrupt when the line is pulled down: hw_gpio_set_pin_function(HOST_SPI->spi.cs.port, HOST_SPI->spi.cs.pin, HW_GPIO_MODE_INPUT, HW_GPIO_FUNC_GPIO); }
else { // Configure the SCS pin as "SPI Enable" alternate function: hw_gpio_set_pin_function(HOST_SPI->spi.cs.port, HOST_SPI->spi.cs.pin, HW_GPIO_MODE_INPUT, HOST_SPI->spi.cs.function); } } static void prv_spi_chip_select_interrupt_handler(void) { // Interrupt handler should a...
e "popups/timeline/peek.h" #include "process_management/app_install_manager.h" #include "process_management/app_manager.h" #include "process_management/process_manager.h" #include "services/common/analytics/analytics.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/shared...
(&e->reminder)
; return; case PEBBLE_BATTERY_STATE_CHANGE_EVENT: battery_ui_handle_state_change_event(e->battery_state.new_state); return; case PEBBLE_COMM_SESSION_EVENT: music_endpoint_handle_mobile_app_event(&e->bluetooth.comm_session_event); return; // Sent by the comm layer once we get...
ime(); const time_t difference = timestamp - now; size_t starts_len = 0; if (difference <= SECONDS_PER_HOUR * max_relative_hrs && time_util_get_midnight_of(now) == time_util_get_midnight_of(timestamp)) { const char *starts = i18n_get("STARTS ", layout); // Freed by `timeline_layout_deinit` starts_le...
layout_create_text_node_from_config( layout_ref, &s_broadcaster_header_config.text.extent.node)
; } static GTextNode *prv_card_view_constructor(TimelineLayout *timeline_layout) { SportsLayout *layout = (SportsLayout *)timeline_layout; AttributeList *attributes = layout->timeline_layout.layout_layer.attributes; layout->state = attribute_get_uint8(attributes, AttributeIdSportsGameState, GameStatePreGame); ...
PBL_LOG(LOG_LEVEL_ERROR, "No CommSession for phone command, ending call"); prv_put_call_disconnect_event(); } else { comm_session_send_data(session, PHONE_CTRL_ENDPOINT, buffer, length + sizeof(cmd), COMM_SESSION_DEFAULT_TIMEOUT); } } void pp_answer_call(uint32_t cookie) { prv_send_phone_command_...
prv_parse_msg_and_emit_event(iter, item_length, true /* is_state_response */)
; iter += item_length; length -= item_length; } if (num_items == 0) { // Generate fake call stop if there are no calls, to hide the phone UI in case it's showing prv_put_call_end_event(); } } else { prv_parse_msg_and_emit_event(iter, length, false /* is_state_response */); } ...
info->has_history = true; info->converter = prv_convert_minutes_to_seconds; break; case ActivityMetricSleepExitAtSeconds: info->value_p = &state->sleep_data.exit_at_minute; info->settings_key = ActivitySettingsKeySleepExitAtHistory; info->has_history = true; info->converter...
(file, &m_info.settings_key, sizeof(m_info.settings_key), &history, sizeof(history))
4989}, {63, ActivityGenderFemale, 4799, 1860, 5134}, {63, ActivityGenderFemale, 2896, 1500, 2334}, {71, ActivityGenderMale, 7529, 4020, 5568}, {67, ActivityGenderMale, 6592, 3960, 6067}, {73, ActivityGenderMale, 4467, 1740, 5118}, {73, ActivityGenderMale, 4080, 1800, 5102}, {73, ActivityGen...
(avg_pct_err < 10)
; } // -------------------------------------------------------------------------------------------- // Advance through time simulating the heart rate manager calls static int s_num_hrm_callbacks; static void prv_advance_time_hr(uint32_t num_sec, uint8_t bpm, HRMQuality quality, bool fo...
d under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "ad_ble.h" #include "ble_common.h" #include "ble_mgr.h" #include "ble...
{ PBL_LOG(LOG_LEVEL_DEBUG, "===LE Receiver Test==="); uint8_t params[] = { 0x00 }; hci_rom_passthrough_send_cmd(0x8, 0x1d, &params[0], sizeof(params)); break; }
case 4: PBL_LOG(LOG_LEVEL_DEBUG, "===LE Stop Rx Test==="); hci_rom_passthrough_send_cmd(0x8, 0x1f, NULL, 0); break; default: return; } i++; }
ref); // Starts off with BPM enabled cl_assert_equal_i(state->features, HRMFeature_BPM); // Change to only LED Current sys_hrm_manager_set_features(session_ref, HRMFeature_LEDCurrent); cl_assert_equal_i(state->features, HRMFeature_LEDCurrent); // Change to LEDCurrent + BPM sys_hrm_manager_set_features(...
hrm_is_enabled(HRM)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(gbitmap_get_format(bitmap), GBitmapFormat8Bit)
; } // Tests 1-bit transparent palettized PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__color_1_bit_transparent(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(1bitpalette)); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(1bitpalette))); cl_assert_eq...
er.layer, false); // Clip for the static icon layer_set_clips(&layout->icon_layer.layer, true); } void timeline_layout_transition_card_to_pin(TimelineLayout *card_timeline_layout, TimelineLayout *pin_timeline_layout) { KinoReel *from_reel = kino_reel_create_with_resour...
kino_reel_transform_set_layer_frame(new_reel, layout->icon_layer.layer.frame)
; kino_reel_transform_set_transform_duration(new_reel, duration); kino_reel_scale_segmented_set_delay_by_distance(new_reel, target); const Fixed_S32_16 POINT_DURATION = Fixed_S32_16(5 * FIXED_S32_16_ONE.raw_value / 6); kino_reel_scale_segmented_set_point_duration(new_reel, POINT_DURATION); kino_ree...
/* * 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 c->cache + index * c->item_size; }
bool circular_cache_contains(CircularCache* c, void* theirs) { return (circular_cache_get(c, theirs) != NULL); } void *circular_cache_get(CircularCache* c, void* theirs) { for (int i = 0; i < c->total_items; ++i) { uint8_t* ours = prv_get_item_at_index(c, i); if (c->compare_cb(ours, theirs) == 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...
("blendtest_33_66_backdrop.pbi")
// We're crossing far_top point, time to swap... tm_p0 = far_top; tm_p1 = far_right; } if (x > bm_p1.x.integer) { // We're crossing far_bottom point, time to swap... bm_p0 = far_bottom; bm_p1 = far_right; } // Starting and ending point of the li...
(&stroke_width)
; prv_draw_stroked_line_override_aa(ctx, GPointPreciseFromGPoint(p0), GPointPreciseFromGPoint(p1), stroke_width, false); } #if PBL_COLOR MOCKABLE void graphics_line_draw_precise_stroked_aa(GContext* ctx, GPointPrecise p0, GPointP...
gister(s_inbox); cl_assert_equal_b(false, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, BUFFER_SIZE)); } void test_app_inbox__app_inbox_service_write_not_enough_space(void) { prv_create_test_inbox_and_begin_write(); cl_assert_equal_b(false, a...
prv_process_callback_events()
; assert_num_callback_events(0); // Expect 2 message callbacks and 1 drop callback: assert_num_message_callbacks(2); assert_message(0, s_test_data, 1); assert_message(1, s_test_data, 1); assert_num_dropped_callbacks(1); assert_dropped(0, 1); // Finish message 3, should be able to write (BUFFER_SIZE -...
(Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == 1); cl_assert(num.fraction == 0); test_num = (int16_t)((float)1.125 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == 1); cl_assert(num.fraction == 1); } void test_math_fixed__S16_3_rang...
cl_assert(sum.raw_value == sum_c.raw_value)
; // sum = 3.5 + 1 = 4.5 num1 = (Fixed_S16_3){ .raw_value = (int16_t)((float)3.5 * (1 << FIXED_S16_3_PRECISION)) }; num2 = FIXED_S16_3_ONE; sum = Fixed_S16_3_add(num1, num2); sum_c = (Fixed_S16_3){ .raw_value = (int16_t)((float)4.5 * (1 << FIXED_S16_3_PRECISION)) }; cl_assert(sum.raw_value == sum_c.raw_val...
magic signature, version, time stamp, serial number // // and build id. // // uint32_t chunk_key // CORE_DUMP_CHUNK_KEY_MEMORY, CORE_DUMP_CHUNK_KEY_THREAD, etc. // uint32_t chunk_size // # of bytes of data that follow // uint8_...
if (chunk_hdr.key == CORE_DUMP_CHUNK_KEY_TERMINATOR) { current_offset += sizeof(chunk_hdr); break; } else if (chunk_hdr.key == CORE_DUMP_CHUNK_KEY_RAM || chunk_hdr.key == CORE_DUMP_CHUNK_KEY_THREAD || chunk_hdr.key == CORE_DUMP_CHUNK_KEY_EXTRA_REG || chunk_hdr.key == COR...
/* * 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...
notif_db_flush()
, 0); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_i(notif_db_get_len((uint8_t *)&hdr1, UUID_SIZE), 0); cl_assert_equal_i(notif_db_get_len((uint8_t *)&hdr2, UUID_SIZE), 0); cl_assert_equal_i(notif_db_get_len((uint8_t *)&hdr3, UUID_SIZE), 0); }
info->val_len == 0) || (info->key_len != sizeof(AppInstallId))) { return true; // continue iterating } struct UuidFilterData *uuid_data = (struct UuidFilterData *)context; AppInstallId app_id; AppDBEntry entry; info->get_key(file, (uint8_t *)&app_id, info->key_len); info->get_val(file, (uint8_t *)&ent...
if (rv != S_SUCCESS) { WTF; }
ource/resource_ids.auto.h" #include "shell/normal/app_idle_timeout.h" #include "services/normal/notifications/do_not_disturb.h" #include "services/normal/notifications/alerts_private.h" #include "applib/ui/kino/kino_layer.h" #include "system/passert.h" #include <inttypes.h> #include <stdint.h> #include <stdio.h> #incl...
app_install_entry_is_watchface(entry)
|| app_install_entry_is_hidden((entry))) { return false; // Skip watchfaces and hidden apps } return true; } static void prv_data_changed(void *context) { LauncherMenuData *data = context; menu_layer_reload_data(&data->menu_layer); } ////////////// // MenuLayer callbacks static void select_callbac...
n_state_messages = 0; static uint8_t s_free_count = 0; static uint8_t s_malloc_count = 0; static void *s_ptr = NULL; static uint8_t s_app_state; static uint64_t s_flags = 0; static const Uuid s_app_uuid = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; // Helpers /////////////////////////////////////// sta...
(CommSessionRunState)
; stub_app_set_uuid(s_app_uuid); stub_app_set_install_id(1337); CommSession session; AppStateMessage msg; msg.command = APP_RUN_STATE_INVALID_COMMAND; memcpy(&msg.uuid, &s_app_uuid, sizeof(s_app_uuid)); app_run_state_protocol_msg_callback(&session, (uint8_t*)&msg, sizeof(msg)); // This should be a n...
does not clear bus_reset(bus_idx); } bus_unlock(bus); return result; } bool i2c_read_register(I2cDevice device_id, uint8_t i2c_device_address, uint8_t register_address, uint8_t *result) { return i2c_read_register_block(device_id, i2c_device_address, register_address, 1, result); } bool i2c_read_register...
{ // Last byte, we want to NACK this one to tell the slave to stop sending us bytes. bus->i2c->CR1 &= ~I2C_CR1_ACK; }
bus->transfer.state = TRANSFER_STATE_WAIT_FOR_DATA; break; case TRANSFER_STATE_WAIT_FOR_DATA: //This state just ensures that the transition to receive mode event happened // Enable RXNE interrupt for writing bus->i2c->CR2 |= I2C_CR2_ITBUFEN; bus->transfer.state = TRANSFER_STAT...
ia doesn't set the 'is_random_address' field in the encryption change event, so using // gap_le_connection_by_device() will fail. GAPLEConnection *connection = gap_le_connection_by_addr(&event->dev_address); if (connection->is_encrypted) { PBL_LOG(LOG_LEVEL_INFO, "Encryption refreshed!"); goto unlock; }...
{ PBL_LOG(LOG_LEVEL_ERROR, "HCI_LE_..._Device_To_White_List (is_adding=%u, r=%d, status=0x%x)", is_adding, r, status); }
#endif } // ------------------------------------------------------------------------------------------------- //! Helpers to manage the s_intents list. //! bt_lock() is expected to be taken by the caller for each of these. static bool prv_intent_matches_connection(const GAPLEConnectionIntent *intent, ...
< num_sessions; i++) { for (uint32_t j = i + 1; j < num_sessions; j++) { if (prv_session_compare(&sessions[i], &sessions[j], direction) > 0) { ActivitySession temp = sessions[i]; sessions[i] = sessions[j]; sessions[j] = temp; } } } } // ------------------------------------...
sys_activity_prefs_heart_rate_is_enabled()
) { return HealthServiceAccessibilityMaskNoPermission; } if (!prv_metric_aggregation_implemented(metric, time_start, time_end, aggregation, scope)) { return HealthServiceAccessibilityMaskNotSupported; } // Get our state HealthServiceState *state = prv_get_state(false); HealthServiceTimeRange time...
// ----------------------------------------------------------------------------------------- void property_animation_update_int16(PropertyAnimation *property_animation_h, const uint32_t distance_normalized) { if (animation_private_using_legacy_2(NULL)) { // We need to enable o...
{ return; }
GRect result; result.origin.x = interpolate_int16( distance_normalized, property_animation->values.from.grect.origin.x, property_animation->values.to.grect.origin.x); result.origin.y = interpolate_int16( distance_normalized, property_animation->values.from.grect.origin.y, pro...
nly supports odd numbers for stroke_width - even numbers will be rounded up. //! Minimal supported stroke_width is 3 T_STATIC void graphics_circle_draw_stroked_non_aa(GContext* ctx, GPoint p, uint16_t radius, uint8_t stroke_width) { graphics_circle_quadrant_draw_strok...
GPoint(x0 - x, y0 + y)
, 2 * x + 1); prv_fill_horizontal_line(ctx, GPoint(x0 - y, y0 + x), 2 * y + 1); } // top if (section & GCornersTop) { prv_fill_horizontal_line(ctx, GPoint(x0 - x, y0 - y), 2 * x + 1); prv_fill_horizontal_line(ctx, GPoint(x0 - y, y0 - x), 2 * y + 1); } } } MOCKABLE void graphics_cir...
&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, s_feb_5_midnight + 11 * 60 * 60), 2); } void test_timeline__two_iterators(void) { uint8_t init_net_allocs = fake_pbl_malloc_num_net_allocs(); Iterator iterator1 = {0}; Iterator iterator2 = {0}; TimelineIte...
(uuid_equal(&state.node->id, &s_items[3].header.id))
; cl_assert(state.node); cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); timeline_iter_deinit(&iterator, &state, &head); } void test_timeline__multiday(void) { TimelineItem multiday_item = { .header = { .id = {0x29, 0xac, 0xd8, 0xb5, 0x9, 0xc7...
cel_recording(); } VoiceEventType event_type = (s_state <= SessionState_StartSession) ? VoiceEventTypeSessionSetup : VoiceEventTypeSessionResult; prv_send_event(event_type, VoiceStatusErrorGeneric, NULL); return false; } if (s_session_id != session_id) { PBL_LOG(LOG_LEVEL_WARNING, "Rece...
prv_send_event(VoiceEventTypeSessionResult, VoiceStatusSuccess, event_data)
; unlock: prv_reset(); mutex_unlock(s_lock); } DEFINE_SYSCALL(VoiceSessionId, sys_voice_start_dictation, VoiceEndpointSessionType session_type) { if (session_type >= VoiceEndpointSessionTypeCount) { return AUDIO_ENDPOINT_SESSION_INVALID_ID; } return voice_start_dictation(session_type); } DEFINE_SYSCALL...
snprintf(dstbuf, 256, "%n", &val)
; cl_assert_equal_i(val, 0); snprintf(dstbuf, 256, "Incredible mechanical monster%n comming soon%n!!", &val, &val2); cl_assert_equal_i(val, 29); cl_assert_equal_i(val2, 42); // Note: Newlib actually doesn't support %hhn, breaking standard. hhntest[0] = hhntest[1] = hhntest[2] = hhntest[3] = 0; snprintf(...
/* * 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_ALWAYS, "Rebooting to install firmware...")
; RebootReason reason = { RebootReasonCode_SoftwareUpdate, 0 }; reboot_reason_set(&reason); system_reset(); } static void prv_ui_update_reset_delay_timer_callback(void *unused) { system_task_add_callback(prv_reset_kernel_bg_cb, NULL); } static void prv_handle_firmware_complete_msg(void) { uint32_t timeout =...
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_sc...
{ return DictationSessionStatusFailureConnectivityError; }
} voice_window->state = StateStart; prv_voice_window_push(voice_window); return DictationSessionStatusSuccess; } void voice_window_pop(VoiceWindow *voice_window) { sys_light_reset_to_timed_mode(); prv_cancel_dictation(voice_window); // This relies on all dialogs having a dialog object as their first me...
2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS...
{ PBL_ASSERTN((unsigned int) buffer_len > sizeof(LogBinaryMessage)); LogBinaryMessage* msg = (LogBinaryMessage*) buffer; time_t time_seconds = sys_get_time(); msg->timestamp = htonl(time_seconds); msg->log_level = log_level; msg->line_number = htons(src_line_number & 0xffff); msg->message_length = 0; ...
int pbl_log_get_bin_format(char* buffer, int buffer_len, const uint8_t log_level, const char* src_filename_path, int src_line_number, const char* fmt, ...) { va_list args; va_start(args, fmt); int len = pbl_log_binary_format(buffer, buffer_len, log_level, src_filename_path, src_line_number, fmt, args...
e_t buffer_size, void *user_data) { LauncherAppGlanceStructured *structured_glance = user_data; LauncherAppGlanceWorkout *workout_glance = launcher_app_glance_structured_get_data(structured_glance); if (workout_glance) { strncpy(buffer, workout_glance->subtitle, buffer_size); buffer[buffer_size ...
health_util_format_hours_minutes_seconds(workout_glance->subtitle, sizeof(workout_glance->subtitle), workout_duration_s, true, workout_glance)
; i18n_free_all(workout_glance); // Broadcast to the service that we changed the glance launcher_app_glance_structured_notify_service_glance_changed(structured_glance); } static const LauncherAppGlanceStructuredImpl s_workout_structured_glance_impl = { .get_icon = prv_get_icon, .get_title = prv_get_title, ...
" #include "fake_rtc.h" #include "stubs_analytics.h" #include "stubs_hexdump.h" #include "stubs_layout_layer.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_prompt.h" #include "stubs_rand_ptr.h" #include "stu...
(a->action_group.num_actions, b->action_group.num_actions)
; for (int i = 0; i < a->action_group.num_actions; i++) { cl_assert_equal_i(a->action_group.actions[i].id, b->action_group.actions[i].id); cl_assert_equal_i(a->action_group.actions[i].type, b->action_group.actions[i].type); compare_attr_list(a->action_group.actions[i].attr_list, b->action_group.actions[i]...
/* * 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...
(title, "three")
; uint32_t track_position, track_duration; music_get_pos(&track_position, &track_duration); cl_assert_equal_i(track_duration, 0xAA); } else { cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT); } } static void prv_receive_and_assert_play_state(bool expect_is_handled) { uint8_t msg[] = { 0x11, 0x01, 0x...
/ *used = 0; *free = 0; *max_free = 0; free_segments = 0; alloc_segments = 0; heap_info_ptr = heap->begin; do { /* Check to see if the current fragment is marked as free. */ if(heap_info_ptr->is_allocated) { alloc_segments++; *used += heap_info_ptr->Size *...
if (heap->current_size > heap->high_water_mark) { heap->high_water_mark = heap->current_size; }
} } heap_unlock(heap); if (allocated_block) { return &allocated_block->Data; } return NULL; } void heap_free(Heap* const heap, void *ptr, uintptr_t client_pc) { UTIL_ASSERT(heap->begin); if (!ptr) { // free(0) is a no-op, just bail return; } UTIL_ASSERT(heap_contains_address(heap,...
ription_cleanup_by_att_handle_range(connection, range); ListNode **head = (ListNode **) &connection->gatt_remote_services; list_remove((ListNode *)service_node, head, NULL); kernel_free(service_node->service); service_node->service = NULL; kernel_free(service_node); prv_send_event(info); } static void prv...
{ if (errno == BTErrnoServiceDiscoveryTimeout) { if (prv_discovery_handle_timeout(connection, &errno)) { // if a retry started, don't generate any events yet finalize_discovery = false; goto unlock; } // it's possible the discovery completed before we handled the timeout, i...
unlock: bt_unlock(); return finalize_discovery; } BTErrno gatt_client_discovery_discover_all(const BTDeviceInternal *device) { BTErrno ret_val = BTErrnoOK; bt_lock(); { GAPLEConnection *connection = gap_le_connection_by_device(device); if (!connection) { ret_val = BTErrnoInvalidParameter; ...
42 = 53258 seconds remaining this day fake_rtc_init(100 /*initial_ticks*/, utc_sec); s_sys_activity_get_metric_values = (sys_activity_get_metric_values) { .out.result = true, .in.metric = (ActivityMetric)-1, }; memset(s_prv_activity_cb__args, 0, sizeof(s_prv_activity_cb__args)); memset(s_metric_over...
cl_assert_equal_range(range, ((HealthServiceTimeRange){ .last_day_idx = 0, .num_days = 2, .seconds_first_day = 53258, .seconds_last_day = 33142, .seconds_total_last_day = 33142, }))
; // shifted one hour time_t utc_to_local_delta = SECONDS_PER_HOUR; TimezoneInfo tz_info = { .tm_zone = "FOO", .tm_gmtoff = utc_to_local_delta, }; time_util_update_timezone(&tz_info); result = prv_calculate_time_range(now - SECONDS_PER_DAY, now, &range); cl_assert(result); cl_assert_equal_rang...
pinid)) { continue; } alarm_pin_remove(pinid); settings_file_delete(fd, &key, sizeof(key)); success = true; } } } return success; } // ---------------------------------------------------------------------------------------------- //! Converts an alarm's cron time...
(&s_next_alarm_cron)
; PBL_LOG(LOG_LEVEL_INFO, "Scheduling alarm %u to go off at %d:%d (%ld) (smart:%d)", alarm->id, alarm->config.hour, alarm->config.minute, s_next_alarm_time, alarm->config.is_smart); } // ---------------------------------------------------------------------------------------------- //! Checks to s...
us); break; case 'R': // H:M // R is mostly the same as T, just without seconds. macro_end--; // fall-thru case 'T': { // H:M:S char macro_spec[16]; // Always show the last unit, even if it's 0. macro_units = MIN(macro_units, macro_end - 1); for (int i = macro_un...
if (*state->position != '%') { // Not a format character prv_handle_escape_character(state); if (state->error->status != TemplateStringErrorStatus_Success) { return; } prv_append_char(state, *state->position); state->position++; } else { // Skip over the % state->po...
} if (*state->position == '\0') { state->error->status = TemplateStringErrorStatus_MissingClosingQuote; return; } // Skip the delimiter state->position++; } static void prv_format_skip_format_string(TemplateStringState *state, char delimiter) { // No match, so let's move along to the next one. w...
/* * 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...
DEFINE_SYSCALL(bool, persist_read_bool, const uint32_t key)
{ bool value = false; LOCK_AND_GET_STORE(store); settings_file_get(store, &key, sizeof(key), &value, sizeof(value)); return value; } DEFINE_SYSCALL(int32_t, persist_read_int, const uint32_t key) { int32_t value = 0; LOCK_AND_GET_STORE(store); settings_file_get(store, &key, sizeof(key), &value, sizeof(va...
imation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_delay(b, delay_b); // Create a spawn Animation *spawn = animation_spawn_create(a, b, NULL); cl_assert(spawn != NULL); animation_set_delay(spawn, delay_spawn); prv_clear_handler_histories(); uint64_t start_...
animation_get_duration(seq, true, true)
, play_count_seq * duration_a); 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...
.is_attr_list_valid = prv_is_icon_and_subtitle_slice_attribute_list_valid, .init_slice_from_attr_list = prv_init_icon_and_subtitle_slice_from_attr_list, .init_attr_list_from_slice = prv_init_attribute_list_from_icon_and_subtitle_slice, }, }; ////////////////////////////////// // Serialized Slice Iteratio...
{ *attr_list_out = (AttributeList) {}; *attr_list_data_buffer_out = NULL; return true; }
iph_TIM5 | RCC_APB1Periph_TIM6 | RCC_APB1Periph_TIM7 | RCC_APB1Periph_TIM12 | RCC_APB1Periph_TIM13 | RCC_APB1Periph_TIM14 | RCC_APB1Periph_WWDG | RCC_APB1Periph_SPI2 | RCC_APB1Periph_SPI3 | RCC_APB1Periph_USART2 | RCC_APB1Periph_USART3 | RCC_APB1Periph_UART4 | RCC_APB1Per...
watchdog_check_reset_flag()
plementation; return window_stack_pop_with_transition(window_stack, transition); } Window *window_stack_pop_with_transition(WindowStack *window_stack, const WindowTransitionImplementation *transition) { if (window_stack->list_head == NULL) { PBL_LOG(LOG_LEVEL_DEBUG, "No...
window_manager_is_window_visible(window_from)
) { PBL_LOG(LOG_LEVEL_DEBUG, "No windows to unload from stack."); context->window_from = NULL; return; } // Remove window reference from context to prevent future calls to it (e.g. "is dirty?") context->window_from = NULL; if (!window_manager_is_window_visible(window_from)) { window_set_on_scr...
t)EM_ASM_INT({ return Module.lengthBytesUTF8(__jerryRefs.get($0)); }, value); } jerry_size_t jerry_string_to_utf8_char_buffer(const jerry_value_t value, jerry_char_t *buffer_p, jerry_size_t buffer_size) { const jerr...
JERRY_CREATE_VALUE(Infinity)
; } } jerry_value_t jerry_create_number_nan(void) { return JERRY_CREATE_VALUE(NaN); } jerry_value_t jerry_create_null(void) { return JERRY_CREATE_VALUE(null); } jerry_value_t jerry_create_object(void) { return JERRY_CREATE_VALUE(new Object()); } jerry_value_t jerry_create_string(const jerry_char_t *str_p) {...
/* * 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...
graphics_capture_frame_buffer_format(ctx, CANVAS_GBITMAP_FORMAT)
; } // Overrides same function in graphics.c; we need to do this so we can release the framebuffer we're // using even though its format doesn't match GBITMAP_NATIVE_FORMAT (see comment for mocked // graphics_capture_frame_buffer() above) bool graphics_release_frame_buffer(GContext *ctx, GBitmap *buffer) { PBL_ASSER...
st DictionaryKeyUpdatedCallback update_key_callback, void* context) { DictionaryResult result = DICT_OK; // First, write the updated keys. for (Tuple* new = dict_read_first(new_iter); new; new = dict_read_next(new_iter)) { uint32_t key = new->key; const Tuple* orig =...
(&iter_copy)
/* * 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...
(-half, f(-half, 0, ANIMATION_NORMALIZED_MAX))
; cl_assert_equal_i(0, f(0, 0, ANIMATION_NORMALIZED_MAX)); cl_assert_equal_i(third, f(third, 0, ANIMATION_NORMALIZED_MAX)); cl_assert_equal_i(two_third, f(two_third, 0, ANIMATION_NORMALIZED_MAX)); cl_assert_equal_i(four_third, f(four_third, 0, ANIMATION_NORMALIZED_MAX)); cl_assert_equal_i(-655...
t_bitmap); const unsigned int num_row_heights = ARRAY_LENGTH(s_menu_system_cell_test_row_heights); const unsigned int num_rows = ARRAY_LENGTH(s_menu_system_cell_test_row_data); // Multiply num_columns * 2 to account for drawing both focused and unfocused side-by-side const int num_columns_accounting_for_focus...
(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))
; #endif } void test_menu_layer_system_cells__cell_width_100(void) { const int16_t cell_width = 100; prv_prepare_canvas_and_render_cells( MenuCellType_CellLayer, cell_width, s_menu_system_cell_layer_test_column_data, ARRAY_LENGTH(s_menu_system_cell_layer_test_column_data), /* is_legacy2 */ ...
n_get("Certification", data)); SystemCertificationData *cd = &data->certification_data; *cd = (SystemCertificationData) {}; // Load up the assets gbitmap_init_with_resource(&cd->fcc_mark, RESOURCE_ID_SYSTEM_FCC_MARK); gbitmap_init_with_resource(&cd->kcc_mark, RESOURCE_ID_SYSTEM_KCC_MARK); gbitmap_init_wit...
window_get_user_data(window)
; menu_layer_deinit(&data->menu_layer); gbitmap_deinit(&data->certification_data.fcc_mark); gbitmap_deinit(&data->certification_data.kcc_mark); gbitmap_deinit(&data->certification_data.ce_mark); gbitmap_deinit(&data->certification_data.weee_mark); gbitmap_deinit(&data->certification_data.r_mark); gbitma...
v_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq...
cl_assert_equal_i(update_a_after, ANIMATION_NORMALIZED_MAX)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
free(node)
; } return value; } void clar__will_return(const char *const func, const char *const file, const size_t line, const uintmax_t value, const ssize_t count) { MockListNode *node = calloc(1, sizeof(MockListNode)); cl_assert_(func != NULL, "cl_will_return with invalid function name"); node-...
/* * 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(a.tx.raw_value, b.tx.raw_value)
logic parameters. if (reminders_snooze((Reminder *) item) == S_SUCCESS) { prv_push_snooze_dialog(); } // Dismiss reminder const TimelineItemAction *action = timeline_item_find_dismiss_action(item); if (action) { timeline_invoke_action(item, action, NULL); } } static void prv_push_muted_dialog(voi...
timeline_item_action_is_dismiss(action)
AttributeIdLocationName, s_test_data.location_name); } if (s_test_data.body) { attribute_list_add_cstring(attr_list, AttributeIdBody, s_test_data.body); } if (!gcolor_is_invisible(s_test_data.primary_color)) { attribute_list_add_uint8(attr_list, AttributeIdPrimaryColor, s_test_data.primary_color.argb);...
{ fake_app_state_init(); load_system_resources_fixture(); attribute_list_destroy_list(&s_test_data.statics.attr_list); s_test_data = (NotificationWindowTestData) {}; }
void test_notification_window__cleanup(void) { } // Helpers ////////////////////// extern NotificationWindowData s_notification_window_data; //! Static function in swap_layer.c used to scroll void prv_attempt_scroll(SwapLayer *swap_layer, ScrollDirection direction, bool is_repeating); static void prv_render_notif...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
jerry_value_is_undefined(locale)
) { return true; } // in the future, we could run a case-insenstive compare against app_get_system_locale() // but as we want apps to encourage to be i18n, there's no real point to // receive strings such as 'en-us'. We will ask them to always pass undefined instead return false; } typedef enum { ToSt...
/* * 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...
launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_vibe_app_get_info())
; } static void prv_select_als(int index, void *context) { launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_als_app_get_info()); } static void prv_select_bt_sig_rf(int index, void *context) { launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_bt_sig_rf_app_get_info()); } static void prv_select_hr...
, -192}, { 1336, 288, -104}, { 1784, 328, -168}, { 1488, 376, -200}, { 808, 288, -120}, { 992, 232, -16}, { 1080, 216, 72}, { 904, 184, 104}, { 824, 120, 120}, { 800, 88, 72}, // 22 seconds { 800, 40, 120}, { 816, 56, 24}, { 888, -16, 56}, { 1016, -64, 56}, { ...
{ 1056, 8, -32}, { 1080, -104, 24}, { 1504, -160, 192}, { 1088, 208, -24}, { 1064, 264, -120}, { 1240, 240, -16}, { 856, 304, 96}, { 680, 264, 48}, { 840, 296, 96}, { 880, 312, 64}, { 832, 344, 0}, { 912, 424, -168}, { 1048, 328, -208}, { 1224, 264, -112}, { 1...
{ 984, 248, 88}, { 1040, 160, 160}, { 920, 136, 160}, { 784, 136, 80}, { 744, 88, 48}, { 752, 32, 24}, { 808, 16, 40}, { 960, -32, 96}, { 1032, -72, 64}, { 1056, 16, 16}, { 1616, -152, 136}, { 1440, 96, 120}, { 944, 440, -168}, { 976, 144, -24}, { 904, 160, 8...
ze_attr_list(void) { AttributeList attr_list1 = { .num_attributes = ARRAY_LENGTH(action1_attributes), .attributes = action1_attributes }; AttributeList attr_list2 = { .num_attributes = ARRAY_LENGTH(action2_attributes), .attributes = action2_attributes }; AttributeList attr_list3 = { ...
(&list, AttributeIdSubtitle, "Subtitle")
; attribute_list_add_cstring(&list, AttributeIdBody, "Body"); // title + subtitle + body + 3 * (attributeid + pointer) size_t size_list = attribute_list_get_buffer_size(&list); cl_assert_equal_i(size_list, (5 + 1) + (8 + 1) + (4 + 1) + 3 * sizeof(Attribute)); uint8_t *buffer = kernel_malloc_check(size_list);...
length"); return; } uint32_t crc = flash_calculate_legacy_defective_checksum(address, length); char buffer[32]; prompt_send_response_fmt(buffer, sizeof(buffer), "CRC: %"PRIx32, crc); } #define MAX_READ_FLASH_SIZE 1024 // 1KB void command_flash_read(const char* address_str, const char* length_str) { // R...
for (uint32_t i = 0; i < BUFFER_SIZE; i++) { buffer[i] = i; }
for (uint32_t offset = 0; offset < TEST_LENGTH; offset += BUFFER_SIZE) { const uint32_t addr = TEST_ADDR + offset; flash_write_bytes(buffer, addr, BUFFER_SIZE); } // read it back for (uint32_t offset = 0; offset < TEST_LENGTH; offset += BUFFER_SIZE) { memset(buffer, 0, BUFFER_SIZE); const uint...
izontal_inset; } static int16_t prv_title_subtitle_left_margin(void) { return prv_get_dimensions_for_runtime_platform_default_size()->title_subtitle_left_margin; } static ALWAYS_INLINE GFont prv_get_cell_title_font(const MenuCellLayerConfig *config) { return config->title_font ?: system_theme_get_font_for_default...
if (config->overflow_mode != GTextOverflowModeWordWrap) { box.origin.y += vertical_margin; box.size.h = title_height + 4; value_box.origin.y = box.origin.y; } else { // Value box is centered when drawing with GTextOverflowModeWordWrap. value_box.origin.y = MIN(box.size.h - full_height, title_heigh...
if (is_legacy2) { // Update the text color to Black for legacy apps - this is to maintain existing behavior for // 2.x compiled apps - no need to restore original since original 2.x did not do any restore ctx->draw_state.text_color = GColorBlack; } if (config->value && (icon_align != GAlignRight)) ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ if (recognizer) { ClickHandler handler = prv_get_handler(recognizer, handler_offset); if (handler) { void *context; if ((handler_offset == ClickHandlerOffsetRawUp || handler_offset == ClickHandlerOffsetRawDown) && recognizer->config.raw.context != NULL) { // The context for raw...
inline static bool prv_is_hold_to_repeat_enabled(ClickRecognizer *recognizer) { return (recognizer->config.click.repeat_interval_ms >= 30); } inline static bool prv_is_multi_click_enabled(ClickRecognizer *recognizer) { return (recognizer->config.multi_click.handler != NULL); } inline static bool prv_is_long_cli...
w_event(old_node, now, midnight, direction, show_all_day); if (show_new != show_old) { return (show_old ? 1 : 0) - (show_new ? 1 : 0); } else { return prv_time_comparator(old_node, new_node); } } static void prv_set_node_from_header(CommonTimelineItemHeader *header, TimelineNode *node_out) { prv_set_no...
(&timeline_iter_state->node->id)
); timeline_item_free_allocated_buffer(&timeline_iter_state->pin); timeline_iter_state->pin = (TimelineItem){}; status_t rv = pin_db_get(&timeline_iter_state->node->id, &timeline_iter_state->pin); timeline_iter_state->current_day = time_util_get_midnight_of( timeline_iter_state->node->timestamp); timeli...
case TimelineAppStateShowDaySeparator: return (next_state == TimelineAppStateDaySeparator); case TimelineAppStateDaySeparator: return (next_state == TimelineAppStateHideDaySeparator); case TimelineAppStateHideDaySeparator: return (next_state == TimelineAppStateStationary); case TimelineAp...
(&data->timeline_layer, TIMELINE_LAYER_FIRST_VISIBLE_LAYOUT, &frame)
; timeline_layout_get_icon_frame(&frame, data->timeline_layer.scroll_direction, &icon_frame); } else { // Since there is no pin, we need the peek size, which is the large size icon_frame = (GRect) { .size = TIMELINE_LARGE_RESOURCE_SIZE }; grect_align(&icon_frame, &data->peek_layer.layer.frame, GAlignC...
tate *state, intmax_t value, int divide, int mod, const char * const suffix_strings[3][2], FormatUnits add_units, bool zero_pad, bool should_mod) { int remain = (value % divide); if (!state->time_was_until) { // We want to go in reverse for 'since' ...
{ *macro_ptr++ = '0'; }
if (!modulus && (i == macro_units)) { *macro_ptr++ = 'f'; } strcpy(macro_ptr, s_Tstrings[add_units][i]); macro_ptr += strlen(s_Tstrings[add_units][i]); *macro_ptr = '\0'; prv_template_format_specifier(state, macro_spec, value); if (i != macro_end - 1) {...
(uuid_equal(&a->header.id, &b->header.id)); cl_assert_equal_i(a->header.ancs_uid, b->header.ancs_uid); cl_assert_equal_i(a->header.status, b->header.status); cl_assert_equal_i(a->header.timestamp, b->header.timestamp); cl_assert_equal_i(a->header.layout, b->header.layout); compare_attr_list(a->attr_list, b->a...
ARRAY_LENGTH(attributes)
, .attributes = attributes, }, .action_group = { .num_actions = ARRAY_LENGTH(actions), .actions = actions, } }; notification_storage_store(&e); TimelineItem r; cl_assert(notification_storage_get(&i, &r)); compare_notifications(&e, &r); free(r.allocated_buffer); notificatio...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_event_loop()
; deinit(); }
uest = NULL; } prv_unlock(); if (response) { s_num_consec_request_failures = 0; } else { s_num_consec_request_failures++; PBL_LOG(LOG_LEVEL_ERROR, "HC request timed out (endpoint:%d, command:%"PRIu8")", end_id, cmd_id); if (prv_check_initialized() && (s_num_consec_request_failures >...
prv_lock()
; HcExpectation *expectation = prv_expectation_for_message(message); if (!expectation) { prv_unlock(); return false; } // Make a heap copy if needed, or transfer ownership if the message is already heap-allocated: HcProtocolMessage *response_heap_copy; if (*should_free) { *should_free = false; ...
elDriverSample *data) { int16_t readings[3]; for (unsigned int i = 0; i < ARRAY_LENGTH(readings); i++) { int base = i * 2; readings[i] = raw_buf[base] | (raw_buf[base + 1] << 8); } const AccelConfig *cfg = &BOARD_CONFIG_ACCEL.accel_config; data->x = (cfg->axes_inverts[AXIS_X] ? -1 : 1) * prv_r...
{ axis = AXIS_X; invert = cfg->axes_inverts[AXIS_X]; }
else if ((int2_status & (shift << cfg->axes_offsets[AXIS_Y])) != 0) { axis = AXIS_Y; invert = cfg->axes_inverts[AXIS_Y]; } else if ((int2_status & (shift << cfg->axes_offsets[AXIS_Z])) != 0) { axis = AXIS_Z; invert = cfg->axes_inverts[AXIS_Z]; } else { BMI160_DBG("No Axis?: 0x%"PRIx8" 0x%"PRIx8...
prv_update_analytics_metrics(data)
; app_timer_cancel(data->dictation_timeout); prv_handle_dictation_result(data, event); } break; case StateTransitionToText: case StateError: case StateFinished: case StateExiting: // Discard event VOICE_LOG("Ignoring event"); break; default: WTF;...
n the box ("Jr\nWho-") graphics_text_layout_get_max_used_size(&gcontext, "JR Whopper", font, box, GTextOverflowModeWordWrap, GTextAlignmentLeft, (void*)&layout); cl_assert(layout.box.size.w == box.size.w); cl_assert_equal_i(layout.max_used_size.w, 4 * HORIZ_ADVANCE_PX); cl_assert_equal_i(layout.max_used_size...
(layout.max_used_size.w, 2 * HORIZ_ADVANCE_PX)
; // Back to only JR - as the line being layed out from y=20-30px is empty (and the line from 30-40, Whop, is truncated as it can never appear) cl_assert_equal_i(layout.max_used_size.h, 3 * FONT_HEIGHT); // Same as above - the blank line is still layed out graphics_text_layout_get_max_used_size(&gcontext, "JR\n\n...
864, 280}, { 0, 864, 304}, { 16, 896, 272}, { 24, 864, 288}, { 24, 936, 264}, { 24, 872, 296}, { 24, 928, 304}, { -8, 920, 256}, { 40, 800, 216}, { 24, 848, 288}, { -8, 952, 240}, { 48, 832, 280}, { 8, 944, 352}, { 8, 872, 320}, { 32, 824, 272}, { 16, 856, 24...
{ 24, 896, 224}, { 16, 816, 304}, { 16, 896, 296}, { -16, 912, 296}, { 16, 856, 280}, { -8, 848, 296}, { 8, 872, 352}, { -16, 904, 264}, { 16, 952, 320}, { 8, 872, 296}, { -16, 840, 272}, { 40, 1096, 144}, { 16, 1256, -32}, { 40, 1056, -200}, { 152, 976, -440}...
{ 152, 0, -1024}, { 152, -24, -1024}, { 112, -56, -960}, { 88, 40, -1032}, { 128, -8, -1064}, { 112, 144, -1168}, { 296, 328, -1592}, { 144, 168, -1496}, { 72, -136, -1224}, { 8, -368, -968}, { -72, -528, -736}, { -200, -712, -584}, { -424, -704, -544}, { -552, -...
// The 1/4 progress frame is ANIMATION_NORMALIZED_MAX * 3/4 because the right flip animation is // actually played backwards compositor_round_flip_transitions_flip_animation_update(ctx, ANIMATION_NORMALIZED_MAX * 3 / 4, CompositorTransitionDirectionRight, ...
gbitmap_pbi_eq(bitmap, TEST_NAMED_PBI_FILE("move_horizontal_left"))
); graphics_private_move_pixels_horizontally(bitmap, 400, false); cl_check(gbitmap_pbi_eq(bitmap, TEST_NAMED_PBI_FILE("move_horizontal_right_too_far"))); graphics_private_move_pixels_horizontally(bitmap, -400, true); cl_check(gbitmap_pbi_eq(bitmap, TEST_NAMED_PBI_FILE("move_horizontal_left_filled"))); free...
/* * 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...
(reel, elapsed)