prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * 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...
(HISTORY_CLEAR_ALL)
; mutex_unlock(s_vibe_history_mutex); } static void prv_vibe_history_start_event(void) { if (!s_vibe_history_enabled) { return; } VibeHistory *vibe = kernel_malloc(sizeof(VibeHistory)); if (vibe == NULL) { s_vibe_history_enabled = false; return; } list_init((ListNode*)vibe); time_t s; uin...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_assign_0.Xbit.pbi")); // Top-left corner rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_color, G...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign)
; graphics_draw_rotated_bitmap(&ctx, test_image_color, GPoint(30, 30), DEG_TO_TRIGANGLE(45), GPoint(20, 20)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_color_center_45.Xbit.pbi")); } void test_graphics_draw_rotated_bitmap__offset_edge(void) { GContext c...
if ((smartstrap_fsm_state_get() != SmartstrapStateReadInProgress) && (smartstrap_fsm_state_get() != SmartstrapStateNotifyInProgress)) { return false; } bool should_context_switch = false; bool hdlc_err; bool should_store; bool is_complete = hdlc_streaming_decode(&s_read_info.hdlc_ctx, &data, &sho...
{ accessory_enable_input(); }
return result; } SmartstrapResult smartstrap_send(SmartstrapProfile profile, MBuf *write_mbuf, MBuf *read_mbuf, uint16_t timeout_ms) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); smartstrap_state_assert_locked_by_current_task(); // we expect the arguments to be valid cons...
/* * 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...
blob_db_protocol_msg_callback(s_session, command, length)
; fake_system_task_callbacks_invoke_pending(); fake_comm_session_process_send_next(); cl_assert(BLOB_DB_ENDPOINT_ID == s_sending_endpoint_id); return s_data; } /* Start of test */ extern void blob_db_set_accepting_messages(bool enabled); void test_blob_db_endpoint__initialize(void) { blob_db_set_accepting_m...
; uintptr_t pc; bool lr_known; bool pc_known; bool is_rocky_app; } CrashInfo; CrashInfo make_crash_info_pc(uintptr_t pc) { return (CrashInfo) { .pc = pc, .pc_known = true }; } CrashInfo make_crash_info_pc_lr(uintptr_t pc, uintptr_t lr) { return (CrashInfo) { .pc = pc, .pc_known = true, ...
{ // Just sit here and look pretty. The purpose of this function is to give app developers a symbol // that they can set a breakpoint on to debug app crashes. We need to make sure this function is // not going to get optimized away and that it's globally visible. __asm volatile(""); }
static void prv_kill_user_process(uint32_t stashed_lr) { PebbleTask task = pebble_task_get_current(); if (task == PebbleTask_App) { app_crashed(); app_manager_get_task_context()->safe_to_kill = true; } else if (task == PebbleTask_Worker) { app_crashed(); worker_manager_get_task_context()->safe_t...
{ return (false == hw_gpio_get_pin_status(HOST_SPI->spi.cs.port, HOST_SPI->spi.cs.pin)); }
// TODO: Can we avoid re-configuring every time? We might be missing a trigger if it happens // before this reconfiguring is completed... :( // Dialog Aart: "Unfortunately it is not possible to program an I/O pin with both functions as // Wake-up and SPI (or other). Either toggle between the 2 functions or define a d...
/* * 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...
(test2, 3, 0, 4, 8)
== 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...
(crc, CRC32_RESIDUE)
/* * 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...
{ SmartstrapConnectionState *state = app_state_get_smartstrap_state(); if (!state->is_initialized) { return; } state->is_initialized = false; event_service_client_unsubscribe(&state->event_info); sys_smartstrap_unsubscribe(); }
#endif // Internal APIs //////////////////////////////////////////////////////////////////////////////// void app_smartstrap_cleanup(void) { #if USE_SMARTSTRAP prv_state_deinit(); #endif } // Exported APIs //////////////////////////////////////////////////////////////////////////////// SmartstrapResult app_sma...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (!s_block_event_callback) { callback(callback_data); }
animation, 300); animation_set_elapsed(animation, 20); prv_play_animation_update(animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), ANIMATION_DURATION_INFINITE); } void test_kino_player__infinite_animation_infinite_reel_reverse(void) { // Choose duration and elapsed...
cl_assert_equal_p(test_player->reel, NULL)
; cl_assert_equal_i(s_num_destructor_calls, 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...
PBL_LOG(LOG_LEVEL_INFO, "Quarantine Board: %s", quarantine_reason)
; boot_bit_set(BOOT_BIT_FORCE_PRF); core_dump_reset(true /* is_forced */); } #endif /* IS_BIGBOARD */
/* * 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...
NULL_SAFE_FIELD_ACCESS(settings_glance, title, NULL)
; } static void prv_charging_icon_node_draw_cb(GContext *ctx, const GRect *rect, UNUSED const GTextNodeDrawConfig *config, bool render, GSize *size_out, void *user_data) { LauncherAppGlanceStructured *structured_glance = user_data;...
ystem/pfs.h" #include "services/normal/settings/settings_file.h" #include "process_management/app_install_manager.h" #include "util/attributes.h" #include "clar.h" // Fakes ////////////////////////////////////////////////////////// #include "fake_app_manager.h" #include "fake_new_timer.h" #include "fake_pbl_malloc.h"...
{ SettingsFile file; WakeupId wakeup_id = TIMESTAMP; WakeupEntryV1 wakeup_entry_v1; open_settings_file(&file); cl_must_pass(settings_file_get(&file, (uint8_t*)&wakeup_id, sizeof(wakeup_id), (uint8_t*)&wakeup_entry_v1, sizeof(wakeup_entry_v1))); cl_assert_equal_i(wakeup_entry_v1.reason, WAKEUP_REASON...
close_settings_file(&file); }
6_t height = rect->size.h; // Subtract out twice the respective radius values to get the actual width and height of the // rectangle lines const int16_t width_actual = width - (2 * radius); const int16_t height_actual = height - (2 * radius); // Take into account the radius values to determine the eight poi...
(ctx, rect, radius)
jerry_init(JERRY_INIT_EMPTY)
; s_log_internal__expected = NULL; } void test_rocky_api_console__cleanup(void) { jerry_cleanup(); rocky_runtime_context_deinit(); } void test_rocky_api_console__functions_exist(void) { rocky_global_init(s_api); EXECUTE_SCRIPT( "var c = typeof console;\n" "var cl = typeof console.log;\n" "var c...
mestamp_ms / MS_PER_SECOND; } prv_unlock(); } // ------------------------------------------------------------------------------------ // We use NOINLINE to reduce the stack requirements during the minute handler (see PBL-38130) // Returns distance we traveled in the last minute, in mm. static uint32_t NOINLINE pr...
(utc_sec, record_out, false /* shutting_down */)
; // Handle storage and logging of the minute data prv_log_minute_data(utc_sec, record_out); // Reset the minute stats s_alg_state->minute_steps = 0; prv_unlock(); } // ------------------------------------------------------------------------------------ bool activity_algorithm_get_steps(uint16_t *steps) {...
)0xf0a7f0a7) #define TEST_TEXT_SIZE GSize(50, 18) #define TEST_TEXT_BOX GRect(10, 10, 140, 200) void graphics_draw_text(GContext *ctx, const char *text, GFont const font, const GRect box, const GTextOverflowMode overflow_mode, const GTextAlignment alignment, const GTextL...
cl_assert_equal_i(s_num_draw_custom_calls, 1)
= prv_find_animation_by_handle(state, animation_h, false /*quiet*/); if (!prv_is_mutable(state, animation)) { return false; } animation->auto_destroy = auto_destroy; return true; } // ------------------------------------------------------------------------------------------- bool animation_schedule(Anim...
prv_find_animation_by_handle(state, animation_h, true /*quiet*/)
; if (!animation) { return false; } return prv_animation_is_scheduled(state, animation); } // ------------------------------------------------------------------------------------------- bool animation_set_handlers(Animation *animation_h, AnimationHandlers handlers, void *context...
a[i].base.plugged_in = next_plugged_in; next_plugged_in = !next_plugged_in; minute_data[i].active_calories = next_active_calories++; minute_data[i].resting_calories = next_resting_calories++; minute_data[i].distance_cm = next_distance_cm++; minute_data[i].base.active = (minute_data[i].base.steps >=...
{ const int k_num_records = 2; const int num_minutes = k_num_records * ALG_MINUTES_PER_DLS_RECORD; // The test data AlgMinuteDLSSample minute_data[num_minutes]; prv_create_test_data(num_minutes, minute_data); // Call the minute handler, which computes the minute stats and saves them to data logging // a...
// ------------------------------------------------------------------------------------ static void prv_assert_minute_data(HealthMinuteData *actual, AlgMinuteDLSSample *expected) { cl_assert_equal_i(actual->steps, expected->base.steps); cl_assert_equal_i(actual->orientation, expected->base.orientation); cl_ass...
gin, but we want to ignore them. // This is because orginally we just serialized GBitmap to disk, // but these fields don't really make sense for static images. // These origin fields are only used when reusing a byte buffer in a sub bitmap. // This allows us to have a shallow copy of a portion of a parent bitm...
{ bitmap->data_row_infos = g_gbitmap_spalding_data_row_infos; }
#endif } return bitmap; } static bool prv_platform_supports_format(GSize size, GBitmapFormat format) { switch (format) { #if PBL_BW case GBitmapFormat1Bit: case GBitmapFormat1BitPalette: case GBitmapFormat2BitPalette: return true; #elif PBL_COLOR && PBL_RECT case GBitmapFormat1Bit: ca...
tmap_from_pbi("test_bitblt_palette_1bit__2bit_palette_to_1bit.pbi"); bitblt_bitmap_into_bitmap(&s_dest_bitmap, src_bitmap, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(&s_dest_bitmap, "test_bitblt_palette_1bit__2bit_palette_to_1bit-expect.pbi")); gbitmap_destroy(src_bitmap...
cl_assert_equal_i(graphics_private_get_1bit_grayscale_pattern(GColorBlack, 0), 0x00000000)
; cl_assert_equal_i(graphics_private_get_1bit_grayscale_pattern(GColorBlack, 1), 0x00000000); } void test_bitblt_palette_1bit__prv_apply_tint_color(void) { GColor color = GColorBlack; GColor tinted_color = GColorBlack; prv_apply_tint_color(&color, GColorClear); cl_assert_equal_i(color.argb, tinted_color.argb...
tems in the phone ui typedef enum { PhoneCallActions_None = 0, PhoneCallActions_Decline = 1 << 0, PhoneCallActions_Answer = 1 << 1, PhoneCallActions_Reply = 1 << 2, } PhoneCallActions; typedef struct { TimelineResourceSize icon_size; GPoint icon_pos; int16_t caller_id_pos_y; int16_t caller_id_height; ...
(icon_reel, new_image, false)
; kino_reel_transform_set_transform_duration(icon_reel, SQUARE_ANIMATION_FRAMES * ANIMATION_FRAME_MS); kino_layer_set_reel(&s_phone_ui_data->icon_layer, icon_reel, true); kino_layer_play(&s_phone_ui_data->icon_layer); s_phone_ui_data->current_icon = new_image; s_ph...
32}, { -48, 568, 832}, { -48, 584, 800}, { -24, 592, 808}, { -48, 616, 792}, { -40, 624, 832}, { 32, 592, 912}, { 216, 512, 1064}, { 152, 456, 936}, { -24, 424, 552}, { -128, 504, 824}, // 135 seconds { -176, 544, 912}, { -176, 600, 968}, { -88, 576, 1000}, { ...
{ 400, 1312, -440}, { 296, 792, -320}, { 408, 920, -248}, { 384, 904, -168}, { 376, 968, -120}, { 320, 1000, -72}, { 264, 1056, -40}, { 224, 1104, -24}, { 208, 1048, -32}, { 192, 1024, -48}, { 224, 1056, -32}, { 256, 1032, -32}, { 272, 992, -40}, { 264, 992, -80},...
/* * 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...
pwm->timer.preload(pwm->timer.peripheral, TIM_OCPreload_Enable)
; TIM_ARRPreloadConfig(pwm->timer.peripheral, ENABLE); } periph_config_disable(pwm->timer.peripheral, pwm->timer.config_clock); } void pwm_set_duty_cycle(const PwmConfig *pwm, uint32_t duty_cycle) { if (IS_LPTIM(pwm->timer.peripheral)) { LPTIM_SetCompareValue(pwm->timer.lp_peripheral, duty_cycle); L...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
printf("PC=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_PC])
; printf("xPSR=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_xPSR]); printf("SP=0x%08" PRIx32 "\n", (uint32_t) g_stacked_regs); // Stack Pointer reset_due_to_software_failure(); } static bool prv_handle_hardfault_due_to_bkpt(void) { // Note: assumes Thumb2! const uint16_t instr = *(const uint16_t *)g_...
er; --bytes_remaining; } // Handle body words for (; bytes_remaining >= 2; bytes_remaining -= 2, buffer += 2) { uint16_t buffer_word; memcpy(&buffer_word, buffer, sizeof buffer_word); *flash_write_dest++ = buffer_word; } // Handle trailing byte if present. This will be present if we started ...
ARRAY_LENGTH(wait_cycle)
+ 4); wait_state++) { if (flash_clock_freq < wait_cycle[wait_state-4]) { break; } } return wait_state; } 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 se...
e_seconds, int variant) { static InsightCopyVariants s_tier_config[PercentTierCount] = { [PercentTier_AboveAverage] = { .num_variants = 5, .variants = { /// Sleep notification on wake up, slept above their typical sleep duration i18n_noop("Refreshed? You slept for %dH %dM which is %d%%...
kernel_malloc_check(max_notif_length)
; snprintf(body, max_notif_length, i18n_get(fmt, body), hours, minutes, ABS(percentage)); i18n_free_all(body); const NotificationConfig config = { .notif_time = notif_time, .insight_type = ActivityInsightType_SleepSummary, .icon_id = TIMELINE_RESOURCE_SLEEP, .body = body, .open_app = { ...
1000); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 1); cl_assert_equal_i(average_ms, 1000); // valid interval fake_rtc_increment_time_ms(1020); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&tim...
(&timer, &average_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...
cl_assert(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE))
w_stack_count(app_stack), 0); window_destroy(window1); window_destroy(window2); } // Description: // This test ensures that the flow of adding a window to the window stack is followed // correctly. That is, we add the window to the window stack, its load handler is // called, it calls to set the click config, an...
(window, &(WindowHandlers){ .load = prv_pop_window_load, .unload = prv_window_unload })
; WindowStack *stack = app_state_get_window_stack(); // Switch to the app state to push a window stub_pebble_tasks_set_current(PebbleTask_App); cl_check(stack); cl_assert_equal_i(window_stack_count(stack), 0); window_stack_push(stack, window, true); cl_assert_equal_i(window_stack_count(stack), 0); ...
WDAY_ANY, 1449100800}, // month // 2015 Month13 1, 00:00:00 = 2016 Jan 1, 00:00:00 { 12,-1,-1,-1, WDAY_ANY, 1451606400}, // Sentinel { 0,0,0,0, 0, 0}, }; void test_cron__simples(void) { CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = CRON_MINUTE_ANY, .hour =...
{ static int s_counter = 0; job->cb_data = (void*)((uintptr_t)++s_counter); }
#define CRON_JOB(min, hr, day, mo, callback) \ { \ .cb = callback, \ .cb_data = (void*)0, \ .minute = min, \ .hour = hr, \ .mday = day, \ .month = mo, \ .may_be_instant = true, \ }, void test_cron__scheduled_after(void) { CronJob jobs[] = { CRON_JOB(CRON_MINUTE_ANY, CRON_HOUR_AN...
nt(), 0); now += 8 * SECONDS_PER_HOUR; // Jan 2 @ 6:00pm rtc_set_time(now); activity_insights_process_minute_data(now); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1); now += (3 * SECONDS_PER_DAY) + (2 * SECONDS_PER_HOUR); // Jan 5 @ 8:00pm rtc_set_time(now); activit...
rtc_get_time()
+ 2 * SECONDS_PER_HOUR); activity_insights_process_minute_data(rtc_get_time()); cl_assert_equal_i(s_data.notifs_shown, 2); }
pedef void (*CallbackEventCallback)(void *data); void launcher_task_add_callback(CallbackEventCallback callback, void *data) { callback(data); } void event_put(PebbleEvent* event) { num_events_put++; } // Stubs //////////////////////////////////////////////////////////////// #include "stubs_analytics.h" #include...
cl_assert(stub_new_timer_timeout(get_reminder_timer_id()) == 200 * 1000)
; now += 200; stub_pebble_tasks_set_current(PebbleTask_NewTimers); cl_assert(stub_new_timer_fire(get_reminder_timer_id())); stub_pebble_tasks_set_current(PebbleTask_KernelBackground); fake_system_task_callbacks_invoke(1); cl_assert_equal_i(num_events_put, 4); cl_assert_equal_m(&item4.header.id, stub_new_...
p* graphics_capture_frame_buffer(GContext *ctx) { PBL_ASSERTN(ctx); return 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 (se...
(&data->action_menu_layer, selected_index, false /* animated */)
; // Render the window so that we set the state of the cells again now that we've scrolled window_render(&action_menu_window->window, &s_ctx); // Update the animation state of the selected cell prv_update_cell_for_long_label_scrolling_animation_state(&data->action_menu_layer, state); // Render the window (...
bscription expiring event"); // Subscribe again if our subscription is expiring const uint32_t update_time_s = 1; app_data->session = sys_hrm_manager_app_subscribe(APP_ID_HRM_DEMO, update_time_s, SECONDS_PER_HOUR, HRMFeature_BPM); } } } st...
prv_enable_hrm()
; } app_message_register_inbox_received(prv_message_received_cb); app_message_register_outbox_sent(prv_message_sent_cb); app_message_register_outbox_failed(prv_message_failed_cb); app_timer_register(1000, prv_remote_notify_timer_cb, NULL); app_window_stack_push(window, true); } static void prv_deinit(vo...
t_handler_entry(&s_started_handler_calls, b0)->fire_order; first_fire_b = MIN(first_fire_b, prv_last_handler_entry(&s_started_handler_calls, b1)->fire_order); first_fire_b = MIN(first_fire_b, prv_last_handler_entry(&s_started_handler_calls, b2)->fire_order); first_fire_b = ...
(start_ms + duration_a + delay_seq + delay_a + delay_b + 2 * MIN_FRAME_INTERVAL_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_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 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...
{ framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); }
void line_reset(Line* line, utf8_t* start) { line->start = start; line->origin = GPoint(0, 0); line->height_px = 0; line->width_px = 0; line->suffix_codepoint = 0; } void test_line_layout__test_line_add_word_no_overflow(void) { // Allocate mutable types Iterator word_iter = ITERATOR_EMPTY; WordIterSt...
, 1304, 24}, { -40, 896, 256}, { -40, 1112, 184}, { 16, 960, 88}, // 69 seconds { 64, 640, 112}, { 80, 608, 80}, { 128, 688, 120}, { 176, 792, 184}, { 240, 1032, -184}, { 344, 912, 296}, { 136, 1016, 248}, { 248, 1512, 448}, { -104, 1720, 552}, { 8, 1272, 552}, ...
{ -16, 1072, 216}, { 32, 944, 312}, { 40, 712, 248}, { 128, 632, 168}, { 224, 576, 200}, { 216, 680, 232}, { 224, 824, 232}, { 240, 928, 256}, // 75 seconds { 200, 1024, 320}, { 64, 984, 224}, { 64, 1208, 144}, { -96, 1248, 320}, { -216, 1216, 232}, { -80, 110...
{ 32, 856, 72}, { 128, 696, 32}, { 136, 704, 32}, { 152, 712, 48}, { 216, 992, 72}, { 184, 968, 80}, { 256, 1008, 160}, { 160, 1256, 128}, { 80, 1184, 296}, { 48, 1584, 232}, { -176, 1240, 384}, { -8, 1200, 240}, { 0, 912, 272}, // 78 seconds { 32, 752, 168},...
/* * 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...
gpio_use(button_config->gpio)
; uint8_t bit = GPIO_ReadInputDataBit(button_config->gpio, button_config->gpio_pin); gpio_release(button_config->gpio); return !bit; } uint8_t button_get_state_bits(void) { uint8_t button_state = 0x00; for (int i = 0; i < NUM_BUTTONS; ++i) { button_state |= (button_is_pressed(i) ? 0x01 : 0x00) << i; } ...
C_APB2Periph_TIM11 | RCC_APB2Periph_SPI5 | RCC_APB2Periph_SPI6 | RCC_APB2Periph_SAI1 | RCC_APB2Periph_LTDC; RCC_DeInit(); RCC_AHB1PeriphResetCmd(ahb1_periphs, ENABLE); RCC_AHB1PeriphResetCmd(ahb1_periphs, DISABLE); RCC_AHB2PeriphResetCmd(ahb2_periphs, ENABLE); RCC_AHB2PeriphResetCmd(ahb2_periphs, DISA...
("Failed to start firmware, strike three.")
; boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); return true; } else if (boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_ONE)) { dbgserial_putstr("Failed to start firmware, strike two."); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); } else {...
ssert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1); cl_assert_equal_i(fake_notification_storage_get_store_count(), 1); cl_assert_equal_i(fake_notification_storage_get_remove_count(), 0); // We should reject any notification that matches and has the exact same uid uint32_t uid = ((G...
(s_num_ds_notifications_received, 5)
; } extern ANCSClientState prv_get_state(void); extern void prv_check_ancs_alive(void); void test_ancs__alive_check_disconnection(void) { prv_check_ancs_alive(); // check we're in the alive check state and we sent a single request cl_assert_equal_i(prv_get_state(), ANCSClientStateAliveCheck); cl_assert_equal...
TIMELINE_RESOURCE_ACTIVITY, .text_body = i18n_noop("Congratulations - you're having a super active day! Activity " "makes you more focused and creative. How do you feel?"), .text_positive_action = i18n_noop("I feel great!"), .text_neutral_action = i18n_noop("About the same"), .text_neg...
if (variant == VARIANT_RANDOM) { variant = rand() % set->num_variants; return set->variants[variant]; } else if (variant < set->num_variants) { return set->variants[variant]; } else { return NULL; }
} // ------------------------------------------------------------------------------------------------ // Helper functions for saving insight state to settings file static bool prv_restore_state(SettingsFile *file, ActivitySettingsKey key, void *val_out, size_t val_out_len) { return set...
cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); cl_assert_equal_i(s_num_alarm_events_put, 1); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); } void test_alarm_smart__dont_trigger_30_min_early_deep_sleep(void) { AlarmId id; id = alarm_create(&(AlarmInfo) { ....
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__across_midnight_boundary(void) { prv_set_time(s_sunday, 22, 0); AlarmId id; bool monday_only[7] = {false, true, false, false, false, false, false}; id = alarm_create(&(AlarmInfo) { .hour = 0, .minute ...
/* * 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(RCC_APB2PeriphClockCmd, RCC_APB2Periph_SYSCFG)
; }
, 5);"; for (int i = 0; i < 30; ++i) { prv_init(); TIMER_APIS.init(); EXECUTE_SCRIPT(script); prv_deinit(); } prv_init(); } static char *prv_load_js(char *suffix) { char path[512] = {0}; snprintf(path, sizeof(path), "%s/js/tictoc~rect~%s.js", CLAR_FIXTURE_PATH, suffix); FILE *f = fopen(pa...
(prv_js_global_get_value("c2"))
); cl_assert_equal_i(100, jerry_get_int32_value(prv_js_global_get_value("s1"))); cl_assert_equal_i(100, jerry_get_int32_value(prv_js_global_get_value("s2"))); cl_assert_equal_i(150, jerry_get_int32_value(prv_js_global_get_value("c1"))); cl_assert_equal_i(150, jerry_get_int32_value(prv_js_global_get_value("c2")...
/*quiet*/); if (!animation) { return false; } if (animation->play_count == ANIMATION_PLAY_COUNT_INFINITE_STORED) { return ANIMATION_PLAY_COUNT_INFINITE; } else { return animation->play_count; } } // ------------------------------------------------------------------------------------------- bool...
prv_complex_create(animation_array, array_len, AnimationTypeSpawn)
(response)
); accessory_send_data((const uint8_t*) "\r\n", sizeof(char) * 2); } static void prv_display_prompt(void) { accessory_send_data((const uint8_t*) ">", sizeof(char)); } static PromptContext s_prompt_context = { .response_callback = prv_command_response_callback, .command_complete_callback = prv_display_prompt, ...
ibed, true); cl_assert_equal_i(s_hrm_expiration, SECONDS_PER_HOUR); } // --------------------------------------------------------------------------------------- // Open the app, start a workout, 30s, stop the workout. Make sure the HR turns off instantly // since workout wasn't valid (too short) void test_workout_se...
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 10)
icense. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implie...
cl_assert_equal_i(music_get_volume_percent(), 0x33)
; } else { cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT); } } static void prv_receive_and_assert_player_info(bool expect_is_handled) { uint8_t msg[] = { 0x13, 17, 'c', 'o', 'm', '.', 's', 'p', 'o', 't', 'i', 'f', 'y', '.', 'm', 'u', 's', 'i', 'c', 7, 'S', 'p', 'o', 't', 'i', 'f', 'y' }; ...
/////////////////// #if SCREEN_COLOR_DEPTH_BITS == 8 extern GColor get_bitmap_color(GBitmap *bmp, int x, int y); #endif // @param color_index the color index (the value) to put into the bitmap at (x, y). // @param bpp Bits per pixel. // @para line_stride how many bytes per line in the bitmap data. void packed_pixel_se...
{ packed_pixel_set(s_data, x /* color_index */, x, y, BITS_PER_PIXEL, s_bmp.row_size_bytes); }
} memset(dest_bitmap_data, GColorWhite.argb, sizeof(dest_bitmap_data)); #if SCREEN_COLOR_DEPTH_BITS == 8 char print_buf[20]; for (int y = 0; y < HEIGHT; ++y) { for (int x = 0; x < WIDTH; ++x) { snprintf(print_buf, sizeof(print_buf), "Failed index = %d, %d", x, y); cl_check_(gcolor_equal(get_bi...
/* * 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...
(true /* complete */)
; } void shell_event_loop_handle_event(PebbleEvent *e) { switch (e->type) { case PEBBLE_APP_FETCH_REQUEST_EVENT: app_manager_handle_app_fetch_request_event(&e->app_fetch_request); return; case PEBBLE_ALARM_CLOCK_EVENT: analytics_inc(ANALYTICS_DEVICE_METRIC_ALARM_SOUNDED_COUNT, AnalyticsCli...
TEM_END)) { PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Invalid range"); return FLASH_TEST_ERR_ADDR_RANGE; } // Erase sectors flash_erase_sector_blocking(stress_addr1); status = prv_read_verify_halfword(stress_addr1, 0xFFFF, FLASH_TEST_ERR_ERASE, false); VERIFY_TEST_STATUS(status); flash_erase_sector_blocking...
PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Not enough memory to run test")
; return FLASH_TEST_ERR_OOM; } uint32_t addr = FLASH_TEST_ADDR_START; volatile uint32_t *ptr = (uint32_t *) DWT_CTRL_ADDR; for (uint32_t num_bytes = 1; num_bytes <= MAX_READ_BUFF_SIZE; num_bytes<<=1) { // Run test three times and print out the median throughput uint32_t ticks[3] = {0, 0, 0}; fo...
no_layer_set_reel(&peek_layer->kino_layer, NULL, false); AppResourceInfo icon_res_info; timeline_resources_get_id(timeline_res, res_size, &icon_res_info); KinoReel *from_reel = kino_reel_create_with_resource_system(icon_res_info.res_app_num, icon_res_...
grect_equal(&icon_from, &GRectZero)
) { icon_from = (GRect) { .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, }; } if (to_reel && align_in_frame) { GRect rect_to_align = { icon_to.origin, kino_reel_get_size(to_reel)...
stem_font(FONT_KEY_GOTHIC_24_BOLD)); layer_add_child(window_layer, text_layer_get_layer(&data->status_text)); } //-------------------------------------------------------------------------------- // TX/RX Menus & Windows //-------------------------------------------------------------------------------- // The same me...
menu_cell_basic_draw(ctx, cell, title, subtitle, NULL)
g_by_id(id); // Try to read it back ret = bt_persistent_storage_get_ble_pairing_by_id(id, &irk_out, &device_out, NULL); cl_assert(!ret); // Add the pairing again id = bt_persistent_storage_store_ble_pairing(&pairing, true /* is_gateway */, NULL, false /* requir...
(name_3, name_out)
; cl_assert_equal_i(platform_bits_3, platform_bits_out); } void test_bluetooth_persistent_storage_prf__get_bt_classic_pairing_by_addr(void) { // Output variables SM128BitKey link_key_out; char name_out[BT_DEVICE_NAME_BUFFER_SIZE]; uint8_t platform_bits_out; // Store a new pairing BTDeviceAddress addr_in...
xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf...
getSBoxValue(tempa[0])
; tempa[1] = getSBoxValue(tempa[1]); tempa[2] = getSBoxValue(tempa[2]); tempa[3] = getSBoxValue(tempa[3]); } tempa[0] = tempa[0] ^ Rcon[i/Nk]; } else if (Nk > 6 && i % Nk == 4) { // Function Subword() { tempa[0] = getSBoxValue(tempa[0]); temp...
fake_malloc_set_largest_free_block(0)
; // Call implementation directly instead of executing a script, to avoid mallocs by the VM itself: extern jerry_value_t rocky_api_graphics_path2d_call_fill(void); const jerry_value_t error_value = rocky_api_graphics_path2d_call_fill(); ASSERT_JS_ERROR(error_value, "RangeError: Out of memory: too many points t...
oto cleanup; } for (BTBondingID id = 0; id < BT_BONDING_ID_INVALID; id++) { if (!settings_file_exists(&fd, &id, sizeof(id))) { free_key = id; break; } } settings_file_close(&fd); } cleanup: prv_unlock(); return free_key; } static bool prv_any_pinned_ble_pairings_itr(SettingsFile *f...
{ return; }
if (bonding_id != BT_BONDING_ID_INVALID) { prv_update_bondings(bonding_id, type); } } static void prv_load_bt_classic_data_from_prf(void) { BTDeviceAddress bd_addr; char name[BT_DEVICE_NAME_BUFFER_SIZE]; SM128BitKey link_key; uint8_t platform_bits; if (!shared_prf_storage_get_bt_classic_pairing_dat...
{ return false; }
AlarmConfig config; bool rv = prv_alarm_get_config(&file, id, &config); if (!rv) { goto cleanup; } if (hour_out) { *hour_out = config.hour; } if (minute_out) { *minute_out = config.minute; } cleanup: prv_file_close_and_unlock(&file); return rv; } // ---------------------------------...
) { if (animation_private_using_legacy_2(NULL)) { // We need to enable other applib modules like sroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. property_animation_legacy2_init_layer_frame((PropertyAnimationLegacy2 *)animation_h, layer, ...
animation_private_using_legacy_2(NULL)
) { // We need to enable other applib modules like sroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. PropertyAnimationLegacy2 *legacy = (PropertyAnimationLegacy2 *)property_animation_h; if (set) { memcpy(&legacy->values.from, value, size); ...
T_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); return false; } // We failed to start our firmware successfully! if (watchdog_check_reset_flag()) { dbgserial_putstr("Watchdog caused a reset"); } if (boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { dbgserial...
itoa_hex(boot_version_read(), bootloader_version_str, 12)
/* * 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...
pfs_init(false)
; pfs_format(true /* write erase headers */); load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, FRENCH_FIXTURE_NAME, "lang"); shell_prefs_set_language_english(false); i18n_set_resource(RESOURCE_ID_STRINGS); } void test_i18n__cleanup(void) { } extern I18nString *prv_list_find_string(const char *string, void...
(); cl_assert_equal_s(written_serial1, serial); } void test_mfg_serials__pcba_serial_number(void) { const char* pcba_serial; // Initially, bunch of XXs: pcba_serial = mfg_get_pcba_serial_number(); cl_assert_equal_s(pcba_serial, "XXXXXXXXXXXX"); // Test writing & reading back: const char* written_pcba_s...
mfg_write_serial_number(sixth_sn, strlen(sixth_sn), &index)
; cl_assert(r == MfgSerialsResultFailNoMoreSpace); }
0xff, /* bytes 3040 - 3056 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* bytes 3056 - 3072 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3072 - 3088 */ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x...
(resource_bank, no_litter_res_id)
; cl_assert_equal_i(image_size, sizeof(no_litter)); uint8_t image_buf[image_size]; cl_assert_equal_i( resource_load_byte_range_system(resource_bank, no_litter_res_id, 0, image_buf, image_size), image_size); for (unsigned int i = 0; i < sizeof(no_litter); i++) { cl_assert(no_litter[i] == image_buf[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...
(msg->session_id == s_session_id)
; } static int s_setup_complete_call_count; static void prv_test_setup_complete_callback(AudioEndpointSessionId session_id) { cl_assert(session_id == s_session_id); ++s_setup_complete_call_count; } static void prv_test_stop_transfer_callback(AudioEndpointSessionId session_id) { cl_assert(session_id == s_session...
if (node && node->free_on_destroy) { task_free(node); } } static bool prv_destroy_container_iter(GTextNode *node, void *context) { graphics_text_node_destroy(node); return true; } static void prv_destroy_text_node_container(GTextNode *node) { if (!node) { return; } GTextNodeContainer *container...
graphics_text_node_get_size(ctx->node, ctx->gcontext, ctx->draw_box, ctx->config, &max_used_size)
; const int16_t excess_length = ToGValue(&ctx->box.size)[axis] - ToGValue(&max_used_size)[axis]; if (align == GAxisAlign_Center) { ToGValue(&ctx->box.origin)[axis] += excess_length / 2; } else if (align == GAxisAlign_Max) { ToGValue(&ctx->box.origin)[axis] += excess_length; } } static void prv_will_dra...
.gpio_pin; GPIO_Init(BOARD_CONFIG.mfi_reset_pin.gpio, &gpio_cfg); GPIO_WriteBit(BOARD_CONFIG.mfi_reset_pin.gpio, BOARD_CONFIG.mfi_reset_pin.gpio_pin, Bit_RESET); gpio_release(BOARD_CONFIG.mfi_reset_pin.gpio); } return true; } static bool prv_update_rail_state(PmicRail rail, bool enable) { static i...
prv_read_register(PmicRegisters_STATUSA, &val)
TDeviceInternal *device, bool is_adding) { #if !BLE_MASTER_CONNECT_SUPPORT // PBL-32761 PBL_LOG(LOG_LEVEL_WARNING, "BLE whitelist mutation unimplemented"); #else unsigned int stack_id = bt_stack_id(); BLE_GAP_LOG_DEBUG("Mutating white-list (adding=%u): " BD_ADDR_FMT, is_adding, BT_DEVICE_ADDRE...
list_count(&s_intents->node)
; } static bool prv_is_intent_used(const GAPLEConnectionIntent *intent) { return (intent->client[GAPLEClientKernel].is_used | intent->client[GAPLEClientApp].is_used); } // ------------------------------------------------------------------------------------------------- static bool prv_is_intent_requiring_...
/* * 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...
process_manager_compiled_with_legacy2_sdk()
rd_wrap_layer; SelectIndex select_index; bool up_down_direction; // True = move up or down; False = move left or right bool word_wrap; // True = word wrap; False = don't word wrap } AppState; static const char* text_buffer = "Text Clipping"; static void init_text_layer(AppState *data, GRect frame) { t...
graphics_fill_rect(ctx, &GRect(39, 39, 82, 42))
; // Draw box just outside the clipping area graphics_draw_rect(ctx, &GRect(39, 39, 82, 42)); } static void prv_window_load(Window *window) { AppState *data = window_get_user_data(window); data->select_index = SelectIndexPixels; data->up_down_direction = true; data->word_wrap = false; // Init canvas (...
s_graphics_draw_arc_precise = (MockCallRecordings){0}; s_gpath_draw_filled = (MockCallRecordings){0}; } void test_rocky_api_graphics_path2d__cleanup(void) { fake_app_timer_deinit(); // Frees the internal path steps array (): rocky_api_graphics_path2d_reset_state(); // some tests deinitialize the engine,...
cl_assert_equal_point(GPoint(0, 1), lc->path.points[0])
}, { 2147483646LL, 16, "7FFFFFFE", }, { 2147483646LL, 16, "7ffffffe", }, { -2147483647LL, 16, "-7FFFFFFF", }, { -2147483647LL, 16, "-7fffffff", }, { 2147483646LL, 17, "53G7F547", }, { 2147483646LL, 17, "53g7f547", }, { -2147483647LL, 17, "-53G7F548", }, { -2147483647LL, 17, "-53g7f548", }, { 214748364...
(strtol("-", NULL, 10), 0)
ListNode *found_node, void *data) { return uuid_equal(&((NotifList*)found_node)->notif.id, (Uuid *)data); } static NotifList *prv_find_listnode_for_notif(Uuid *id) { return (NotifList*) list_find((ListNode *) s_presented_notifs, prv_filter_presented_notification_by_id, id); } Uuid ...
callback(&head->notif.id, head->notif.type, cb_data)
; } task_free(head); } } void notifications_presented_list_each(NotificationListEachCallback callback, void *cb_data) { if (!callback) { return; } NotifList *itr = s_presented_notifs; while (itr) { NotifList *next = (NotifList *)itr->list_node.next; callback(&itr->notif.id, itr->notif.t...
include "util/math.h" #include "util/units.h" // // SPI bootloader protocol // static bool prv_load_data(uint32_t address, const uint8_t *data, size_t data_len) { // PBL_LOG(LOG_LEVEL_DEBUG, "Loading %d bytes start at 0x%x", (int)data_len, (int)address); uint8_t mem_write[] = {'L', 'D'}; dialog_spi_transmit_da...
PBL_LOG(LOG_LEVEL_WARNING, "Failed to read fw image 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...
prv_add_session(&(ActivitySession){ .type = ActivitySessionType_Walk, .ongoing = false, })
es_key = FONT_KEY_BITHAM_34_MEDIUM_NUMBERS}, {.js_name = "21px Roboto", .res_key = FONT_KEY_ROBOTO_CONDENSED_21}, {.js_name = "49px Roboto-subset", .res_key = FONT_KEY_ROBOTO_BOLD_SUBSET_49}, {.js_name = "28px bold Droid-serif", .res_key = FONT_KEY_DROID_SERIF_28_BOLD}, {.js_name = "20px bold Leco-numbers", .re...
{ s_default_font = fonts_get_system_font(DEFAULT_FONT_DEFINITION.res_key); rocky_api_graphics_text_reset_state(); }
void rocky_api_graphics_text_deinit(void) { prv_text_state_deinit(); }
/* * 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...
pfs_format(true /* write erase headers */)
; load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); // Setup content indicator ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); content_indicator_init_buffer(buffer); } void t...
/* * 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 (pebble_task_get_current() == PebbleTask_App) { return app_state_get_heap(); } else if (pebble_task_get_current() == PebbleTask_Worker) { return worker_state_get_heap(); }
return kernel_heap_get(); } static char* prv_strdup(Heap *heap, const char* s, uintptr_t lr) { char *dup = heap_zalloc(heap, strlen(s) + 1, lr); if (dup) { strcpy(dup, s); } return dup; } // task_* functions that map to other heaps depending on the current task /////////////////////////////////////////...
s 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 "alarm_detail.h" #include "alarm_editor.h" #include "applib/ui/action_menu_window.h" #inc...
{ AlarmDetailData *data = (AlarmDetailData *) context; alarm_editor_update_alarm_days(data->alarm_id, data->alarm_editor_callback, data->callback_context); }
static void prv_delete_alarm_handler(ActionMenu *action_menu, const ActionMenuItem *item, void *context) { AlarmDetailData *data = (AlarmDetailData *) context; alarm_delete(data->alarm_id); if (data->alarm_editor_callback) { data->ala...
/* * 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...
while (index > 0 && ptr < max_ptr) { ptr += strlen(ptr) + 1; index--; }
if (index > 0) { return NULL; } else { return ptr; } } int string_list_add_string(StringList *list, size_t max_list_size, const char *buffer, size_t max_str_size) { if (!list) { return 0; } const size_t str_length = strnlen(buffer, max_str_size); const int size_r...
u_changed_t *event) { Connection *connection = connection_by_idx_check(event->conn_idx); if (!connection) { PBL_LOG(LOG_LEVEL_WARNING, "No connection for idx %d", event->conn_idx); return; } PBL_LOG(LOG_LEVEL_INFO, "MTU updated: %"PRIu16, event->mtu); pebble_pairing_service_handle_gatt_mtu_change(con...
test_hci_passthrough()
; #endif // Signal to the initing task that the BLE stack is up and running now! xSemaphoreGive(init_info->semph); for (;;) { BaseType_t ret; uint32_t notif; sys_watchdog_notify(s_ble_perip_wdog_id); sys_watchdog_suspend(s_ble_perip_wdog_id); ret = xTaskNotifyWait(0, (uint32_t) -1, &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...
graphics_text_attributes_create()
; const uint8_t inset = 4; graphics_text_attributes_enable_screen_text_flow(text_attributes, inset); graphics_draw_text(ctx, text, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD), *layer_bounds, GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, text_attributes); graphics_text_attribut...
ew_worker_with_args(const PebbleProcessMd *app_md, const void *args) { PBL_ASSERT_TASK(PebbleTask_KernelMain); // Don't launch workers in recovery mode to reduce the chance of crashes #ifdef RECOVERY_FW return false; #endif // If workers are disabled, don't launch if (!s_workers_enabled) { PBL_LOG(LOG_L...
process_heap_set_exception_handlers(worker_heap, app_md)
; // Init services required for this process before it starts to execute process_manager_process_setup(PebbleTask_Worker); char task_name[configMAX_TASK_NAME_LEN]; snprintf(task_name, sizeof(task_name), "Worker <%s>", process_metadata_get_name(s_worker_task_context.app_md)); TaskParameters_t task_params = ...
RASED_PAGE); } else { write_pg_header(&pg_hdr, curr_page); break; // we are done } } // we have succesfully allocated space for the file, so add file specific info f->start_page = f->curr_page = start_page; FileHeader file_hdr; memset(&file_hdr, 0xff, sizeof(file_hdr)); file_hdr.file_n...
{ *fdp = fd; return (FDAvail); }
if (PFS_FD(fd).fd_status == FD_STATUS_UNREFERENCED) { if ((unref == -1) || (PFS_FD(fd).time_closed < curr_time_closed)) { unref = fd; curr_time_closed = PFS_FD(fd).time_closed; } } } *fdp = unref; if (unref != -1) { mark_fd_free(unref); // clean up previous file state }...
-224}, { -568, -8, -288}, { -1200, -384, 0}, { -1544, -432, -88}, { -984, -184, 136}, { -1136, 400, 160}, { -2352, 4000, -824}, { -760, 4000, -1696}, { 136, 2248, -304}, { 800, 888, 80}, { 1560, 256, -160}, { 1200, -568, -408}, { 1480, 88, -16}, { 880, -272, 48}, ...
{ 1008, 4000, -1712}, { -456, 2192, -864}, { -832, 1480, -368}, { -880, 528, -208}, { -1416, -32, -32}, { -2128, 40, 160}, { -1488, 176, 200}, { -1184, 472, 272}, { -1176, 1312, -96}, { -1520, 4000, -1920}, { 304, 4000, -2400}, // 33 seconds { 1288, 2032, -744}, {...
{ -1264, -240, -128}, { -904, -80, 120}, { -704, 496, -288}, { -2072, 3968, -1592}, { -440, 4000, -1496}, { 192, 2600, -440}, { 712, 1232, 144}, { 1312, 712, 112}, { 2080, 32, -344}, { 1496, -568, -40}, { 1480, -432, 296}, { 1264, 112, 176}, { 2048, 2936, -632}, ...
/* * 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 (HealthData *)app_zalloc_check(sizeof(HealthData)); }
void health_data_destroy(HealthData *health_data) { app_free(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(HealthMetricStepCo...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(s_flash_state.mutex != 0)
0x21, 0x22, 0x13, 0x14, 0x15, 0x26 }, }, .is_classic = false, .is_random_address = false, }, .is_remote_identity_info_valid = true, }; prv_reset_change_op_tracking(); BTBondingID id_2 = bt_persistent_storage_store_ble_pairing(&pairing_2, true /* is_...
(&irk_out, &pairing.irk, sizeof(irk_out))
; } void test_bluetooth_persistent_storage_prf__delete_ble_pairing_by_id(void) { bool ret; // Output variables SMIdentityResolvingKey irk_out; BTDeviceInternal device_out; // Store a pairing SMPairingInfo pairing = (SMPairingInfo) { .irk = (SMIdentityResolvingKey) { .data = { 0x01, 0x0...
/www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissio...
Fixed_S32_16_mul(t1->tx, t2->a)
; Fixed_S32_16 ty_c = Fixed_S32_16_mul(t1->ty, t2->c); Fixed_S32_16 tx_b = Fixed_S32_16_mul(t1->tx, t2->b); Fixed_S32_16 ty_d = Fixed_S32_16_mul(t1->ty, t2->d); t_new->a = Fixed_S32_16_add(a_a, b_c); t_new->b = Fixed_S32_16_add(a_b, b_d); t_new->c = Fixed_S32_16_add(c_a, d_c); t_new->d = Fixed_S32_16_ad...
tten + calc_size; // If it fits, add it. If it doesn't, flush first. if (size_if_added > session->max_data_size) { // We would be over capacity if we added this message. Let's flush first. PROTOBUF_LOG_DEBUG("Session: 0x%x - Would have been over limit at size %"PRIu32", flushing", (i...
(LOG_LEVEL_ERROR, "Failure when sending encoded message, resetting session")
; } // TODO: Call a success callback so the clients know exactly which data has been sent. // If we don't do this an we crash without pushing to datalogging, we'll lose data exit: encode_success = prv_session_encode_start(session); return (success && encode_success); } bool protobuf_log_session_delete(Pro...
/* * 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 (session) { comm_session_send_data(session, APP_LOGGING_ENDPOINT, (uint8_t*)log_buffer, length, COMM_SESSION_DEFAULT_TIMEOUT); }
} } void app_log_protocol_msg_callback(CommSession *session, const uint8_t *data, const size_t length) { typedef struct PACKED AppLogCommand { uint8_t commandType; } AppLogCommand; enum AppLogCommandType { APP_LOG_COMMAND_DISABLE_LOGGING = 0, APP_LOG_COMMAND_ENABLE_LOGGING = 1, }; AppLogComm...
/* * 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 uuid_buffer[UUID_STRING_BUFFER_LENGTH]; bool success = comm_session_send_data(session, PB_APP_STATE_ENDPOINT_ID, (uint8_t*)app_run_state, sizeof(*app_run_state), COMM_SESSION_DEFAULT_TIMEOUT); uuid_to_strin...
/* * 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_house_path, GPoint(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2))
; s_outline_mode = false; s_path_angle = 0; } // setup and teardown void test_graphics_gpath_${BIT_DEPTH_NAME}__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); s_house_path = gpath_create(&s_house_path_info); s_bolt_path = gpath_create(&s_bolt_pat...
/* * 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...
(&image->layer, &r)
; image->dest_ic = GPoint(new_dist / 2, new_dist / 2); layer_mark_dirty(&image->layer); } void rot_bitmap_set_compositing_mode(RotBitmapLayer *image, GCompOp mode) { if (mode == image->compositing_mode) { return; } image->compositing_mode = mode; layer_mark_dirty(&image->layer); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
health_sleep_detail_card_create(health_data)
; window_set_on_screen(window, true, true); window_render(window, &s_ctx); return window; } // Tests ////////////////////// void test_health_sleep_detail_card__render_no_data(void) { prv_create_card_and_render(&(HealthData) {}); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_healt...
session__basic_open_close(void) { Transport *transport = (Transport *) TransportID1; CommSession *session = comm_session_open(transport, &s_transport_imp, TransportDestinationSystem); cl_assert(session); cl_assert_equal_b(comm_session_is_valid(session), true); comm_s...
(comm_session_get_current_app_session(), legacy_app_session)
; stub_app_set_uuid(modern_app_uuid); cl_assert_equal_p(comm_session_get_current_app_session(), modern_app_session); stub_app_set_uuid((Uuid)UUID_INVALID); cl_assert_equal_p(comm_session_get_current_app_session(), NULL); stub_app_set_uuid((Uuid)UUID_SYSTEM); cl_assert_equal_p(comm_session_get_current_app...
e = dls_test_get_num_bytes(logging_sessions[i]); PBL_LOG(LOG_LEVEL_INFO, "Size of session %d: %d", i, size); total_bytes += size; } PBL_LOG(LOG_LEVEL_INFO, "total bytes: %d", total_bytes); cl_assert(total_bytes < DLS_TOTAL_STORAGE_BYTES); // We should still be able to create more sessions up to the ma...
(logging_session)
; cl_assert(logging_session != NULL); uint32_t tag = dls_test_get_tag(logging_session); prv_check_session_data(logging_session, crcs[tag], num_bytes[tag]); } logging_session = dls_list_get_next(logging_session); cl_assert(logging_session == NULL); } void test_data_logging__recover_one(void) { prv_...
me((Layer *)&timeline_layer->day_separator, &frame); const GRect icon_from = { grect_center_point(&frame), GSizeZero }; prv_get_day_sep_show_frame(timeline_layer, &frame); peek_layer_set_frame(&timeline_layer->day_separator, &frame); TimelineResourceInfo timeline_res = { .res_id = TIMELINE_RESOURCE_DAY_SEPA...
{ if (!layer_get_hidden((Layer *)&layer->day_separator)) { // already on screen return; } GRect day_sep_frame = ((Layer *)&layer->day_separator)->frame; // substitute the day separator for the hidden pin TimelineLayout *prev = layer->layouts[s_nonvisible_items[0]]; TimelineLayout *next = layer->lay...
static void prv_place_end_of_timeline(TimelineLayer *timeline_layer) { const bool was_hidden = layer_get_hidden((Layer *)&timeline_layer->end_of_timeline); const bool is_hidden = (timeline_layer_should_animate_day_separator(timeline_layer) || timeline_layer->layouts[2]); layer_set_hidd...
/* * 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...
task_free(*contact_out)
; return 0; } SerializedContact *serialized_contact = (SerializedContact *)*contact_out; return (contact_len - sizeof(SerializedContact)); } void contacts_db_free_serialized_contact(SerializedContact *contact) { task_free(contact); } ///////////////////////// // Blob DB API ///////////////////////// vo...