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...
(PULSE_PROTOCOL_LLC)
; *response = (Response) { .type = LLC_OUTMSG_LINK_OPENED, .pulse_version = 1, .mtu = PULSE_MAX_SEND_SIZE + PULSE_MIN_FRAME_LENGTH, .mru = PULSE_MAX_RECEIVE_UNIT, .timeout = PULSE_KEEPALIVE_TIMEOUT_DECISECONDS }; pulse_best_effort_send(response, sizeof(Response)); } void pulse_llc_send_link_...
int duration_total = play_count_seq * duration_a; // Create 2 animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_play_count(b, 0); // Create a sequence Animation...
(prv_count_handler_entries(&s_stopped_handler_calls, a), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // Just before A completes prv_advance_to_ms_with_timers(start_ms + durati...
/* * 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_draw_pixel(ctx, GPoint(5, 5))
; } void clear_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorClear); graphics_draw_pixel(ctx, GPoint(5, 5)); } void outside_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(...
--------------- // Sample captured: 2015-10-05 16:03:43 local AccelRawData *activity_sample_walk_200_pbl_25656_8(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25656_8 //> TEST_EXPECTED 200 //> TEST_EXPECTED_MIN 165 //> TEST_EXPECTED_MAX 250 //> TE...
{ 1192, 120, -40}, { 1056, 144, -8}, { 1104, 144, -64}, { 1280, 168, -80}, { 1152, 232, -104}, { 832, 216, -120}, { 568, 192, -136}, // 5 seconds { 456, 208, -136}, { 464, 200, -120}, { 536, 192, -120}, { 744, 248, -176}, { 1040, 304, -248}, { 1128, 344, -304}, ...
{ 496, 176, -64}, { 640, 216, -88}, { 888, 240, -128}, { 1120, 296, -208}, { 1160, 304, -240}, { 1232, 312, -248}, { 1224, 368, -288}, { 1112, 400, -264}, { 984, 352, -240}, { 1104, 320, -216}, { 1136, 264, -168}, { 1008, 192, -88}, { 800, 168, -104}, { 672, 136,...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ASSERT(emx_resources_get_size(1, id_2) == 0)
; buf = 0; ASSERT(emx_resources_read(1, id_2, 0, (uint8_t *)&buf, 1) == 0); ASSERT(buf == 0); // verify 1 & 3 are OK buf = 0; ASSERT(emx_resources_read(1, id_3, 0, (uint8_t *)&buf, 1) == 4); ASSERT(buf == 3); ASSERT(s_read_3_called == 2); buf = 0; ASSERT(emx_resources_read(1, id_1, 0, (uint8_t *)&bu...
e e2", "TypeError", NULL, }; rocky_log_exception("e2", e2); cl_assert(*s_log_internal__expected == NULL); // number s_log_internal__expected = (const char *[]){ "Exception while e3", "ReferenceError", NULL, }; rocky_log_exception("e3", e3); cl_assert(*s_log_internal__expected == NULL); } /* * FIX...
(global_object, "Date")
/* * 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...
(subtitle, data)
, NULL); } static void prv_selection_changed_cb(SettingsCallbacks *context, uint16_t new_row, uint16_t old_row) { vibes_cancel(); VibeScore *score; switch (new_row) { case VibeSettingsRow_Notifications: { score = vibe_client_get_score(VibeClient_Notifications); ...
#include "stubs_task_watchdog.h" void app_storage_delete_app(AppInstallId id) { char buffer[30]; itoa_int(id, buffer, 10); pfs_remove(buffer); } bool app_storage_app_exists(AppInstallId id) { return true; } AppInstallId s_test_id_ql_up; AppInstallId s_test_id_ql_down; AppInstallId s_test_id_watchface; AppIns...
app_cache_remove_entry(app1.id)
); cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app2.id)); cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app3.id)); cl_assert_equal_i(fake_event_get_count(), 3); // ensure the one that is evicted is INVALID_ID cl_assert_equal_i(INSTALL_ID_INVALID, app_cache_get_next_eviction()); } /***********...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
kernel_free(cur)
; } }
eEaseOut); Animation *sequence = animation_sequence_create(cassette_left, cassette_right, cassette_bounceback, NULL); if (!prv_should_animate_casssette()) { animation_set_play_count(sequence, 0); } return sequence; } static void prv_trigger_track_change_ani...
{ action_bar_layer_set_click_config_provider(&data->action_bar, prv_skipping_click_config_provider); action_bar_layer_set_icon_animated(&data->action_bar, BUTTON_FORWARD, &data->icon_skip_forward, animated); action_bar_layer_set_ico...
static void prv_update_ui_state_volume(MusicAppData *data, bool animated) { if (data->action_bar_state == ActionBarStateVolume) { action_bar_layer_set_click_config_provider(&data->action_bar, prv_volume_click_config_provider); } action_bar_layer_set_icon_animat...
prv_assert_no_event(); // Verify there are no more intents: cl_assert_equal_i(gap_le_connect_connection_intents_count(), 0); cl_assert_equal_b(gap_le_connect_has_pending_create_connection(), false); } void test_gap_le_connect__slave_disconnection_event_upon_cancel_connect_by_bonding(void) { BTDeviceIntern...
{ BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk(); BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_device(); prv_fake_connect(&device, false /* is_master*/); fake_GAPAPI_set_encrypted_for_device(&device); fake_GAPAPI_put_encryption_change_event(true /* encrypted */, GAP...
// ----------------------------------------------------------------------------- // Handling Bonding Changes void test_gap_le_connect__removed_bonding_while_connected(void) { BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk(); BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_d...
32, 864, -384}, { -40, 864, -384}, { -40, 864, -384}, { -40, 864, -384}, { -32, 864, -384}, { -32, 864, -384}, // 117 seconds { -40, 864, -384}, { -32, 864, -384}, { -32, 856, -384}, { -32, 864, -384}, { -32, 856, -392}, { -40, 864, -384}, { -32, 864, -384}, { -32...
{ -32, 864, -384}, { -32, 856, -384}, { -32, 856, -392}, { -32, 872, -384}, { -32, 856, -384}, { -32, 864, -392}, { -32, 864, -384}, { -32, 864, -384}, { -32, 856, -384}, { -32, 864, -384}, { -32, 864, -384}, { -32, 864, -384}, { -32, 856, -384}, { -32, 864, -392}...
{ -24, 872, -384}, // 125 seconds { -24, 864, -392}, { -32, 856, -384}, { -32, 864, -392}, { -32, 864, -384}, { -32, 864, -392}, { -32, 864, -392}, { -24, 856, -384}, { -24, 864, -392}, { -32, 864, -392}, { -32, 856, -392}, { -32, 864, -392}, { -32, 864, -384}, ...
graphics_draw_bitmap_in_rect(ctx, mark, box); } static int16_t prv_draw_generic_mark(GContext *ctx, GBitmap *mark, GPoint origin, bool highlight) { GRect box = (GRect) { .origin = origin, .size = mark->bounds.size }; prv_draw_mark_with_inversion(ctx, mark, &box, highlight); return origin.x + box.siz...
grect_align(&container_rect, cell_layer_bounds, GAlignCenter, true /* clip */)
/* * 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...
(buffer, core_dump_connect_response, sizeof(core_dump_connect_response))
== 0) { PBL_LOG(LOG_LEVEL_INFO, "Core Dump connect response received"); return true; } } PBL_LOG(LOG_LEVEL_ERROR, "Failed to connect with BLE chip to collect coredump"); return false; } static void prv_int_exti_cb(bool *should_context_switch) { xSemaphoreGiveFromISR(s_spi_int_semph, NULL); } ...
ck_launch_select = *pref; return true; } static bool prv_set_s_quick_launch_back(QuickLaunchPreference *pref) { s_quick_launch_back = *pref; return true; } static bool prv_set_s_quick_launch_setup_opened(uint8_t *version) { s_quick_launch_setup_opened = *version; return true; } static bool prv_set_s_defaul...
(*before_time_m * SECONDS_PER_MINUTE)
; return true; } #endif // ------------------------------------------------------------------------------------ // Table of all prefs typedef bool (*PrefSetHandler)(const void *value, size_t val_len); typedef struct { const char *key; void *value; uint16_t value_len; PrefSetHandler handler; } PrefsTableEntry...
nd_color; bool show_notification_timestamp; bool is_reminder; struct { AttributeList attr_list; TimelineItem timeline_item; } statics; } NotificationWindowTestData; static NotificationWindowTestData s_test_data; void clock_get_since_time(char *buffer, int buf_size, time_t timestamp) { if (buffer && ...
(&s_frame_layer_implementation, layer, from_frame, to_frame)
n a callback, there's a chance it could be waiting for a mutex held by // the background worker and the worker won't be able to release it until we throttle the app // to give the worker some time. prv_app_task_throttle_start(); // throttle the app task for APP_THROTTLE_TIME_MS to give the system task s...
(TIM2, &tim_config)
; TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE); TIM_Cmd(TIM2, ENABLE); // Setup another unused interrupt vector to handle our low priority interrupts. When we need to do higher // level functions (like PBL_LOG), we trigger this lower-priority interrupt to fire. Since it runs at // configMAX_SYSCALL_INTERRUPT_P...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw1_clip_nxny.${BIT_DEPTH...
(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY)
= graphics_context_get_drawing_state(ctx); // Translate the drawing_box to the bounds of the layer: ctx->draw_state.drawing_box.origin.y += cursor->y; ctx->draw_state.drawing_box.size.h = cursor->h; const GRect *const rect_clipper = (const GRect *const)&ctx->draw_state.drawing_box; grect_clip((GRect *const)...
for (;;) { // sections const uint16_t num_rows_in_section = prv_menu_layer_get_num_rows(it->menu_layer, it->cursor.index.section); for (;;) { // rows if (it->cursor.index.row >= num_rows_in_section) { // Reached last row break; } if (it->row_callback_before_geometry) {...
/* * 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...
(img_1bit)
; }
* | * | * -------+-------- * | * | * x2 | x3 * | * * + center point * - x coordiante mirror line * | y coordinate mirror line * x given offset point * xn mirrored points */ for (unsigned int i=0; i < ARRAY_LENGTH(qua...
prv_plot8(framebuffer, &ctx->draw_state.clip_box, p, GPoint(edge.integer - 1, progress), weighting, stroke_color, quadrant)
rrent_bpm); break; } case WorkoutMetricType_Speed: case WorkoutMetricType_Pace: { strncpy(buffer, data->pace_string, buffer_size); break; } case WorkoutMetricType_Distance: { strncpy(buffer, data->distance_string, buffer_size); break; } case WorkoutMetri...
(84, 1234)
, .bpm = 71, .hr_zone = 0, }; WorkoutActiveWindow *active_window = workout_active_create_for_activity_type( ActivitySessionType_Walk, &s_workout_data, &s_workout_controller); prv_create_window_and_render(active_window, 0); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_...
(0, 0, DISP_COLS, 400)
; const GRect to_area = GRect(0, 0, DISP_COLS, 200); unobstructed_area_service_will_change(from_area.size.h, to_area.size.h); fake_event_service_handle_last(); const GRect area = GRect(0, 0, DISP_COLS, 200); const AnimationProgress progress = ANIMATION_NORMALIZED_MAX / 2; unobstructed_area_service_change(a...
SM128BitKey link_key_1 = {{0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}}; char name_1[BT_DEVICE_NAME_BUFFER_SIZE] = "Device 1"; uint8_t platform_bits_1 = 0x11; BTBondingID id_1 = bt_persistent_storage_store_bt_classic_pairing(&addr_...
{ #if UNITTEST_BT_PERSISTENT_STORAGE_VERSION == 1 //0000 01 00 69 50 68 6f 6e 65 20 4d 61 72 74 79 00 00 ..iPhone Marty.. //0010 00 00 00 00 00 00 3f f9 92 8a 00 00 00 00 75 36 ......?. ......u6 //0020 9c 6e 1a 1b eb 5f fb 89 db 0b ec a5 95 7a 44 f6 .n..._.. .....zD. //0030 1c 47 90 53 43 18 f3 e...
//0020 db 0b ec a5 95 ab 92 8a aa f6 1c 47 90 53 43 ff ...........G.SC. //0030 75 36 9c 6e 1a 1b eb 5f fb 89 db 0b ec a5 95 7a u6.n..._.......z //0040 f3 e7 44 f6 1c 47 90 53 43 18 d1 6d 89 95 83 aa ..D..G.SC..m.... //0050 5e 7f ff 39 b3 47 36 e4 37 7e 05 1b 85 e3 b8 98 ^..9.G6.7~...... //0060 00 00...
our the heap has configured using heap_set_lock_impl static void heap_lock(Heap* heap) { if (heap->lock_impl.lock_function) { heap->lock_impl.lock_function(heap->lock_impl.lock_context); } } //! Unlock the heap, using whatever behaviour the heap has configured using heap_set_lock_impl static void heap_unlock(H...
memset(start, 0, heap_size * ALIGNMENT_SIZE)
int translated_str_idx; #endif TextLayer device_name_text_layer; char device_name_layer_buffer[BT_DEVICE_NAME_BUFFER_SIZE]; TextLayer code_text_layer; char code_text_layer_buffer[CODE_BUF_SIZE]; TimerID timer; BTPairingUIState ui_state; const PairingUserConfirmationCtx *ctx; } BTPairingUIData; //! This ...
(0, -34, pair_text_area.size.w, 30)
; data->pair_text_area = pair_text_area; data->above_pair_text_area = above_pair_text; TextLayer *info_text_layer2 = &data->info_text_layer2; text_layer_init_with_parameters(info_text_layer2, &above_pair_text, data->info_text_layer2_buffer, ...
{ 1072, 88, -112}, { 1024, 40, -120}, { 1024, 16, -120}, { 992, 0, -152}, { 960, -16, -168}, { 968, -32, -128}, // 56 seconds { 976, -32, -128}, { 960, -16, -160}, { 1008, 24, -184}, { 1416, 48, -208}, { 1512, 80, -216}, { 1368, 144, -280}, { 960, 120, -256}, { 6...
{ 960, 8, -312}, { 976, 16, -296}, { 968, 40, -312}, { 936, 64, -328}, { 888, 48, -344}, { 904, 48, -344}, { 944, 40, -352}, { 912, 16, -376}, { 888, 0, -408}, { 928, -24, -424}, { 952, -32, -448}, { 912, -56, -448}, { 936, -88, -456}, { 1120, -64, -440}, { 11...
{ 1088, 96, 0}, { 1056, 96, -8}, { 1072, 104, -32}, { 1072, 88, -56}, { 1072, 64, -64}, { 1080, 24, -72}, { 1064, 24, -144}, { 1176, 0, -152}, { 1104, -8, -144}, { 976, -8, -216}, { 960, 0, -288}, { 848, 32, -360}, { 824, 32, -392}, { 1064, 24, -408}, { 1208,...
raw_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10))); setup_test(&context, true, 1, GColorBlack, GColorBlack, false); graphics_draw_circle(&context, GPoint(50, 50), 10); #if PBL_COLOR ASSERT_CALLED(graphics_circle_draw_1px_aa(&context, GPoint(50, 50), 10));...
graphics_draw_rect(&context, &GRect(10, 20, 40, 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...
(b, 1 * sizeof(uint8_t), sizeof(uint8_t))
); cl_assert_equal_i(b->bytes_written, 3); cl_assert_equal_i(b->data[0], b1); cl_assert_equal_i(b->data[1], b3); cl_assert_equal_i(b->data[2], b4); free(b); } void test_buffer__can_read_and_write_uint32(void) { uint32_t expected = 0x12345678; Buffer *b = buffer_create(4); buffer_add(b, (const uint8_...
ystem_task_callbacks_invoke_pending(); cl_assert(prv_get_subscriber_state_from_ref(session_ref) == NULL); cl_assert_equal_b(hrm_is_enabled(HRM), false); } // When we cleanup after an app process, its subscription, if any, should get an expriration time // placed on it void test_hrm_manager__app_cleanup(void) { s...
cl_assert_equal_i(s_num_cb_events_1, 3)
; cl_assert_equal_i(s_cb_events_1[1].event_type, HRMEvent_SubscriptionExpiring); cl_assert_equal_i(s_cb_events_1[2].event_type, HRMEvent_BPM); // Now advance time to past expiration time rtc_set_time(rtc_get_time() + expire_s + 1); // Send more data, the subscription should go away now prv_fake_send_new_...
og_len += 3) { test_flash_logging__cleanup(); test_flash_logging__initialize(); flash_logging_init(); int num_logs; char **logs = generate_unique_logs(space_avail, log_len, &num_logs); setup_and_test_expected_msg(logs, 0, 0, num_logs); free_logs(logs, num_logs); } } //! void test_flash_lo...
while (num_half_wraps < tot_half_wraps) { loop_count++; snprintf(log, 100, "Loop Counter %d", loop_count); addr = flash_logging_log_start(strlen(log)); cl_assert(addr != FLASH_LOG_INVALID_ADDR); rv = flash_logging_write((uint8_t *)log, addr, strlen(log)); cl_assert(rv); if (addr == start_ad...
// simulate a reboot flash_logging_init(); // check to see that the most recent messages (largest loop count numbers) // are left s_completed = false; rv = flash_dump_log_file(1, flash_log_line_dump_long_lived, prv_flash_log_dump_completed_cb); cl_assert(rv); while (!s_completed) { fake_system_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...
{ strncpy(lr_str, "???", sizeof(lr_str)); }
char pc_str[16]; if (crash_info->pc_known) { sniprintf(pc_str, sizeof(pc_str), "%p", (void*) crash_info->pc); } else { strncpy(pc_str, "???", sizeof(pc_str)); } char buffer[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&crash_info->app_uuid, buffer); char *process_string = (crash_info->task == Pe...
{ 416, -216, -1048}, { 200, -200, -1112}, { 152, -288, -1136}, { 200, -168, -944}, { 288, -192, -808}, { 376, -120, -696}, { 360, -232, -600}, { 376, -232, -496}, { 296, -192, -624}, // 29 seconds { 280, -256, -632}, { 168, -296, -664}, { 48, -336, -656}, { 80, -320,...
{ 944, -376, -192}, { 968, -400, -216}, { 984, -400, -224}, { 952, -360, -288}, { 952, -344, -320}, { 992, -320, -320}, { 1024, -288, -344}, { 968, -232, -344}, { 936, -168, -352}, { 944, -144, -352}, { 904, -112, -368}, { 880, -56, -384}, { 856, -56, -400}, { 856...
{ 1056, -96, -88}, { 888, -88, -120}, { 1016, -56, -88}, { 1176, -72, 8}, { 1136, -80, 64}, { 1072, -80, 0}, { 1040, -112, -8}, { 1024, -120, -24}, // 37 seconds { 1072, -56, -88}, { 1064, -88, -96}, { 1048, -48, -104}, { 1000, 8, -232}, { 952, -16, -272}, { ...
ata); } else if (event == HealthEventSignificantUpdate) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Got significant update event"); steps_update_text(data); } else if (event == HealthEventSleepUpdate) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Got sleep update event"); } else if (event == HealthEventHeartRateUpdate) { ...
(root_bounds)
; text_layer_set_text_alignment(data->steps_card.msg_layer, GTextAlignmentCenter); text_layer_set_font(data->steps_card.msg_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_background_color(data->steps_card.msg_layer, GColorClear); text_layer_set_text_color(data->step...
hics_draw_horizontal_line_dotted(&ctx, GPoint(0, 8), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 10), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); gra...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20), MAX_NUM_COLS - 1); graphics_draw_horizontal_line_dotted(&ctx,...
y_curr_task(s_attr_list_lock, true); SmartstrapAttributeInternal *attr; FOREACH_VALID_ATTR(attr) { if (attr->state == state) { return attr; } } return NULL; } // Attribute processing / request functions // NOTE: These all run on KernelBG which moves attributes from the RequestPending to the Idle...
(CONSUMER_TASK, &event)
; } else if (type == SmartstrapNotifyEvent) { process_manager_send_event_to_process(CONSUMER_TASK, &event); } } static void prv_do_deferred_delete_cb(void *context) { s_deferred_delete_queued = false; mutex_lock(s_attr_list_lock); SmartstrapAttributeInternal *attr = s_attr_head; while (attr) { Smar...
eturn status; } void voice_init(void) { s_lock = mutex_create(); } // This will kick off a dictation session. After the setup session message is sent via the // voice control endpoint, we wait for a session ready response via the // voice_handle_session_setup_result call or a session setup timeout occurs (timer cal...
prv_cancel_session()
; VoiceEventType event_type = (s_state <= SessionState_StartSession) ? VoiceEventTypeSessionSetup : VoiceEventTypeSessionResult; prv_send_event(event_type, VoiceStatusErrorGeneric, NULL); goto done; } if (session_type >= VoiceEndpointSessionTypeCount) { PBL_LOG(LOG_LEVEL_WARNING, "Session s...
m(); return s_time_selection_configs[runtime_platform_default_size]; } static int prv_cell_width(int i, int num_cells) { const TimeSelectionSizeConfig * const config = prv_selection_config(); if (!clock_is_24h_style() && (i == (num_cells - 1))) { return config->ampm_cell_width; } else { return config->...
PBL_IF_RECT_ELSE(2, 4)
; prv_vertical_align_text_layer(time_selection_window, top_layer, range_origin_y, 1, extra_line_offset_y); const GSize top_size = app_text_layer_get_content_size(top_layer); const int range_bottom_origin_y = range_origin_y + top_size.h; prv_vertical_align_text_layer(time_selectio...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ int message_length = vsniprintf(msg->message + msg->message_length, max_message_len - msg->message_length, fmt, fmt_args); msg->message_length += message_length; if (msg->message_length > max_message_len) { msg->message_length = max_message_len; } }
// ------------------------------------------------------------------------------------------- int pbl_log_binary_format(char* buffer, int buffer_len, const uint8_t log_level, const char* src_filename_path, int src_line_number, const char*...
rapAttributeInternal *attr = prv_find_by_ids(service_id, attribute_id); mutex_unlock(s_attr_list_lock); if (!attr) { // this attribute has likely since been destroyed return; } event.smartstrap.attribute = mbuf_get_data(&attr->mbuf); if (type == SmartstrapDataReceivedEvent) { PBL_ASSERTN(attr->sta...
if (!attr) { mutex_unlock(s_attr_list_lock); return; }
prv_queue_deferred_delete(attr, true /* do_free */); mutex_unlock(s_attr_list_lock); } void smartstrap_attribute_unregister_all(void) { mutex_lock(s_attr_list_lock); SmartstrapAttributeInternal *attr; FOREACH_VALID_ATTR(attr) { // At this point, the app is closing so there's no point in freeing the buff...
header = { .common.id = UUID_INVALID }; if (prv_find_next_notification(&header, prv_uuid_equal_func, (void *) uuid, fd)) { size = header.payload_length + sizeof(SerializedTimelineItemHeader); } else { PBL_LOG(LOG_LEVEL_DEBUG, "notification not found"); } prv_file_close(fd); return (size); } bool no...
if (prv_find_next_notification(&header, prv_uuid_equal_func, (void *) id, fd)) { prv_set_header_status(&header, status, fd); }
prv_file_close(fd); } void notification_storage_remove(const Uuid *id) { notification_storage_set_status(id, TimelineItemStatusDeleted); } bool notification_storage_find_ancs_notification_id(uint32_t ancs_uid, Uuid *uuid_out) { PBL_ASSERTN(s_notif_storage_mutex != NULL); int fd = prv_file_open(OP_FLAG_READ...
tLayoutExtended *)layout)->line_spacing_delta: 0); } //////////////////////////////////////////////////////////// // Iterator advance functions //! Advance the char iterator to the start of the next word. Used by word_init //! to find the start of the next word. //! @return is_success static bool prv_char_iter_next_s...
if (*current_word->end == NULL_CODEPOINT) { return false; }
return word_init(ctx, current_word, text_box_params, current_word->end); } //! @return is_advanced bool char_iter_next(IteratorState state) { CharIterState* char_iter_state = (CharIterState*) state; Codepoint codepoint; Iterator* utf8_iter = &char_iter_state->utf8_iter; Utf8IterState* utf8_iter_state = &c...
ionHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; static const AnimationImplementation implementation = { .setup = prv_setup_handler, .update = prv_update_handler, .teardown = prv_teardown_handler }; h = animation_create(); cl_assert(h != NULL); ...
cl_assert_equal_rect(to_r, r)
; property_animation_get_subject(prop_h, &subject); cl_assert(subject == &layer); GRect set_r = GRect(1, 2, 3, 4); property_animation_set_from_grect(prop_h, &set_r); r = GRect(0, 0, 0, 0); property_animation_get_from_grect(prop_h, &r); cl_assert_equal_rect(set_r, r); set_r = GRect(5, 6, 7, 8); 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...
ASSERT_JS_GLOBAL_EQUALS_S("size", "medium")
; } void test_rocky_api_preferences__large(void) { s_preferred_content_size = PreferredContentSizeLarge; rocky_global_init(s_preferences_api); EXECUTE_SCRIPT("var size = _rocky.userPreferences.contentSize"); ASSERT_JS_GLOBAL_EQUALS_S("size", "large"); } void test_rocky_api_preferences__extra_large(void) { ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR|FLASH_FLAG_PGSERR)
; const uint8_t *data_array = data; for (uint32_t i = 0; i < length; ++i) { if (FLASH_ProgramByte(address + i, data_array[i]) != FLASH_COMPLETE) { dbgserial_print("failed to write address "); dbgserial_print_hex(address); dbgserial_newline(); FLASH_Lock(); return false; } ...
/* * 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...
analytics_set(ANALYTICS_APP_METRIC_FLASH_WRITE_BYTES_COUNT, analytics_write_bytes_count, AnalyticsClient_Worker)
; } analytics_read_count = 0; analytics_read_bytes_count = 0; analytics_write_bytes_count = 0; } struct FlashState { bool enabled; bool sleep_when_idle; bool deep_sleep; PebbleMutex * mutex; SemaphoreHandle_t dma_semaphore; } s_flash_state; static void flash_deep_sleep_enter(void); static void flas...
elDisplayModeThin); for (size_t i = 0; i < ARRAY_LENGTH(thin_values); i++) { action_menu_level_add_action(root_level, thin_values[i], prv_noop_action_callback, NULL); } const unsigned int selected_index = 4; prv_prepare_canvas_and_render_action_menus_static(root_level, selected_index, 0); cl_check(gbitma...
(root_level, emoji_level, "I will call back")
; const unsigned int selected_index = 1; prv_prepare_canvas_and_render_action_menus_animated(root_level, selected_index); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_action_menu_window__wide_display_mode_with_chevron_and_long_labels_hyphenated(void) { ActionMenuLevel *root_level = acti...
/* * 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...
for (int i = 0; i < num_points; i++) { copied_points[i] = gpoint_add(points[i], offset); }
return copied_points; } static bool prv_compare_points(GPoint *a, GPoint *b, uint16_t num_points) { return (memcmp(a, b, sizeof(GPoint) * num_points) == 0); } // Stubs void graphics_context_set_stroke_color(GContext* ctx, GColor color) { s_stroke_color = color; } void graphics_context_set_fill_color(GContext*...
/* * 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...
{ memset(&s_last_bt_persist_pinned_addr, 0xff, sizeof(s_last_bt_persist_pinned_addr)); memset(&s_last_driver_addr, 0xff, sizeof(s_last_driver_addr)); s_last_bt_persist_pinned_addr_is_null = false; s_last_driver_allow_cycling = false; s_last_driver_addr_is_null = false; }
void test_local_addr__cleanup(void) { } void test_local_addr__init_generates_pinned_address_if_needed(void) { prv_init_no_pinnings_no_pinned_address(); cl_assert_equal_b(false, s_last_bt_persist_pinned_addr_is_null); cl_assert_equal_m(&s_last_bt_persist_pinned_addr, &TEST_PINNED_ADDR_1, siz...
/* * 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...
(&dest_bitmap, "test_bitblt__8bit_assign-expect.8bit.pbi")
); memset(dest_data, GColorGreen.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpClear, GColorWhite); cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_assign-expect.8bit.pbi")); memset(dest_data, GColorGreen.argb, sizeof(dest_data)); // Update source...
-------------------------------------- // Get accel timestamp value in ms static uint64_t prv_get_timestamp(void) { time_t s; uint16_t ms; rtc_get_time_ms(&s, &ms); return ((uint64_t)s) * 1000 + ms; } // --------------------------------------------------------------------------------------------- // Update th...
PBL_ASSERTN(success)
; } // ------------------------------------------------------------------------------------------- DEFINE_SYSCALL(int, sys_accel_manager_peek, AccelData *accel_data) { int result; if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(accel_data, sizeof(*accel_data)); } analytics_inc(ANALYTICS_...
alarm configuration separate from // bookkeeping data. typedef enum AlarmDataType { ALARM_DATA_CONFIG = 0, ALARM_DATA_PINS = 1, } AlarmDataType; // Stored alarm data is keyed off a binary (AlarmId, AlarmDataType) tuple // so that programmatic construction of a key is straightforward. typedef struct PACKED AlarmSt...
activity_get_metric(ActivityMetricSleepStateSeconds, 1, &sleep_seconds)
; return rv ? sleep_seconds : 0; #else return 0; #endif } // ---------------------------------------------------------------------------------------------- static int32_t prv_get_vmc(void) { #if CAPABILITY_HAS_HEALTH_TRACKING int32_t vmc; const bool rv = activity_get_metric(ActivityMetricLastVMC, 1, &vmc); r...
workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); } // --------------------------------------------------------------------------------------- void test_workout_service__takeover_activity_session(void) { int32_t steps, d...
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone))
; cl_assert_equal_i(steps, 10); cl_assert_equal_i(duration_s, 10); cl_assert_equal_i(bpm, 110); // Get some more new data and out stats still shouldn't change (except HR) prv_inc_time(10); prv_inc_steps_and_put_event(10); prv_put_bpm_event(190, HRMQuality_Good); cl_assert(workout_service_get_current_wo...
ARRAY_LENGTH(s_fake_app_info_dict)
, (uint8_t *)s_fake_app_info_dict); } else { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_message_app_info_dict), (uint8_t *)s_message_app_info_dict); } return BTErrnoOK; } // else: notif request uint32_t uid...
cpy(command_list->commands[0].points, points1, sizeof(points1)); GContext *ctx = (GContext *)123; // just a fake internal guard != NULL gdraw_command_list_draw(ctx, command_list); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_circle_stroke_count, 0);...
gdraw_command_image_clone(image)
/* * 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 (!rv) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to read OTP %p", (void *)otp_addr); }
return rv; } bool dialog_chip_id_copy(DialogChipID *chip_id_out) { hw_otpc_init(); #if dg_configEXT_CRYSTAL_FREQ == EXT_CRYSTAL_IS_16M HW_OTPC_SYS_CLK_FREQ freq = HW_OTPC_SYS_CLK_FREQ_16; #elif dg_configEXT_CRYSTAL_FREQ == EXT_CRYSTAL_IS_32M HW_OTPC_SYS_CLK_FREQ freq = HW_OTPC_SYS_CLK_FREQ_32; #else # erro...
te_get_app_message_ctx()->outbox.sent_callback = sent_callback; return retval; } AppMessageOutboxFailed app_message_register_outbox_failed(AppMessageOutboxFailed failed_callback) { AppMessageCtx *app_message_ctx = app_state_get_app_message_ctx(); AppMessageOutboxFailed retval = app_message_ctx->outbox.failed_cal...
app_state_get_app_message_ctx()
; return (app_message_ctx->outbox.phase == OUT_CLOSED); }
cbuf, (uint8_t *)minute_rec, sizeof(*minute_rec), false /*advance_slackers*/); if (!success) { // Although unlikely, we could get buffer overruns if we failed to open up the data logging // session after a number of retries. In that case, we will start dropping th...
if (session->ongoing) { ACTIVITY_LOG_DEBUG("Still ongoing"); continue; }
// Skip if already labeled as a nap session if ((session->type == ActivitySessionType_Nap) || (session->type == ActivitySessionType_RestfulNap)) { if (session->type == ActivitySessionType_Nap) { most_recent_nap_session = session; } ACTIVITY_LOG_DEBUG("Already labeled as a nap...
"mfg/snowy/mfg_private.h" #include "flash_region/flash_region_s29vs.h" #include "fake_spi_flash.c" #include "stubs_logging.h" #include "stubs_pbl_malloc.h" // This will come from overrides and will include a smaller boot fpga image #include "mfg/spalding/spalding_boot.fpga.auto.h" // Stubs for fake_crc.c #include "s...
cl_assert_equal_i(mfg_info_get_disp_offsets().x, 0)
; cl_assert_equal_i(mfg_info_get_disp_offsets().y, 0); // Set x and y offsets and make sure others don't change. mfg_info_set_disp_offsets((GPoint) {-2, 1}); cl_assert_equal_i(mfg_info_get_disp_offsets().x, -2); cl_assert_equal_i(mfg_info_get_disp_offsets().y, 1); cl_assert_equal_i(mfg_info_get_watch...
S_PER_MINUTE; if (exit_utc == deep_exit_utc) { results->in_deep_sleep.value = true; results->cur_state_elapsed.value = last_deep_session_len_m + unprocessed_m; } else { results->cur_state_elapsed.value = last_session_len_m + unprocessed_m; } } else { if (exit_utc != 0) { result...
time_t test_start_utc = now; for (int i = 0; i < entry->num_samples; i++) { uint16_t vmc = entry->samples[i].v5_fields.vmc; if (entry->version == 1) { // Convert from the old compressed VMC to the new uncompressed one vmc = vmc * vmc * 1850 / 1250; } const bool shutting_d...
test_results[num_tests] = result; num_tests++; if (num_tests >= k_max_tests) { printf("RAN INTO MAX NUMBER OF TESTS WE SUPPORT"); break; } } // Make sure we discovered at least 1 test cl_assert(num_tests > 0); // Let's sort the tests by name qsort(&test_entry[0], num_tests, size...
cognizer_transition_state(r, RecognizerState_Started)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Updated)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Cancelled)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Completed)); r->state = RecognizerSt...
cl_assert_equal_b(cancelled, false)
; reset = false; r->state = RecognizerState_Started; recognizer_reset(r); cl_assert_equal_i(r->state, RecognizerState_Possible); cl_assert_equal_b(reset, true); cl_assert_equal_b(cancelled, true); reset = false; cancelled = false; r->state = RecognizerState_Updated; recognizer_reset(r); cl_asser...
RADIUS_MEDIUM, GCornerBottomRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_r8_quad_bottom_right.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_circle_quadrant_draw_1px_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, GCo...
layer_set_update_proc(&layer, &inside_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &clear_layer_update_callback); layer_render_tree(&layer, &ctx); #if PBL_COLOR cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_clear.8bit....
layer = context; if (swap_layer->callbacks.click_config_provider) { swap_layer->callbacks.click_config_provider(swap_layer->context); } } /////////////////////// // MISC FUNCTIONS /////////////////////// static void prv_swap_layer_update_proc(Layer *layer, GContext* ctx) { SwapLayer *swap_layer = (SwapLayer...
(swap_layer)
; applib_free(swap_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...
(text_resources_init_font(SYSTEM_APP, RESOURCE_ID_FONT_FALLBACK_INTERNAL, 0, &s_system_fonts_info_table[NUM_SYSTEM_FONTS]))
; } return &s_system_fonts_info_table[NUM_SYSTEM_FONTS]; } for (int i = 0; i < (int) NUM_SYSTEM_FONTS; ++i) { if (0 == strcmp(font_key, s_font_resource_keys[i].key_name)) { FontInfo *fontinfo = &s_system_fonts_info_table[i]; uint32_t resource = s_font_resource_keys[i].resource_id; uin...
timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(4)); cl_assert(timeline_model_i...
timeline_model_iter_next(NULL, NULL)
); cl_assert(!timeline_model_iter_prev(NULL, NULL)); } void test_timeline_model__is_empty(void) { TimelineModel model = {0}; model.direction = TimelineIterDirectionFuture; time_t first_time = 1421178000; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 timeline_model_init(first_time, &model); cl_asser...
------------------------------------------------------------------------- DEFINE_SYSCALL(void, sys_get_pebble_event, PebbleEvent *event) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(event, sizeof(*event)); } xQueueReceive(prv_get_context()->to_process_event_queue, event, portMAX_DELAY); } ...
{ PebbleTask task = pebble_task_get_current(); if (task != PebbleTask_App && task != PebbleTask_Worker) { return PBL_PLATFORM_TYPE_CURRENT; } const PebbleProcessMd *const md = sys_process_manager_get_current_process_md(); return process_metadata_get_app_sdk_platform(md); }
ber((float)cosine / TRIG_MAX_RATIO); GTransformNumber num2 = (GTransformNumber) { .raw_value = (int32_t)(((int64_t)cosine * GTransformNumberOne.raw_value) / TRIG_MAX_RATIO) }; cl_assert(num.raw_value == num2.raw_value); } void test_graphics_gtransform_${BIT_D...
(&t2, &t1, &t2)
; cl_assert(gtransform_is_equal(&t2, &t_c)); // Test non-identity concatenation with identity t1 = GTransformIdentity(); t2 = GTransformFromNumbers(1, 2, 3, 4, 5, 6); t_c = GTransformFromNumbers(1, 2, 3, 4, 5, 6); gtransform_concat(&t_new, &t1, &t2); cl_assert(gtransform_is_equal(&t_new, &t_c)); // Te...
te_averaged(HealthMetricHeartRateBPM, now_utc - 60, now_utc - 60, HealthAggregationAvg, HealthServiceTimeScopeOnce); cl_assert_equal_i(123, result); // The function call is the equivalent to `peek_value` with HeartRateBPM exc...
if (day_in_week == Sunday || day_in_week == Saturday) { prv_update_stats(&weekend_stats, value); } else { prv_update_stats(&weekday_stats, value); }
///// // Description: // During the load handler of a window, we pop it. void test_window_stack__pop_during_window_load(void) { Window *window = window_create(); window_set_window_handlers(window, &(WindowHandlers){ .load = prv_pop_window_load, .unload = prv_window_unload }); WindowStack *stack = app_...
window_stack_count(stack)
/reboot_reason.h" #include "system/reset.h" #include "util/math.h" #include "util/net.h" #include "util/string.h" #define CMSIS_COMPATIBLE #include <mcu.h> #include <bluetooth/bt_test.h> #include <bluetooth/responsiveness.h> #include <bluetooth/gatt_discovery.h> #include <inttypes.h> #include <stdint.h> #include <st...
flash_read_bytes(buffer, address, read_length)
; // Output to serial for (uint32_t i = 0; i < read_length; i++) { dbgserial_putchar(buffer[i]); } address += read_length; length -= read_length; } kernel_free(buffer); } void command_flash_switch_mode (const char* mode_str) { int mode = atoi(mode_str); flash_switch_mode(mode); } ...
/* * 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 (timeout_us > 0) { if (gpio_input_read(&creset_input) == level) return true; delay_us(100); timeout_us -= 100; }
teps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(bpm, 100); cl_assert_equal_i(hr_zone, 0); // Get some more step info prv_inc_time(5 * SECONDS_PER_MINUTE); prv_inc_steps_and_put_event(900 /* 180 steps per min * 5 mins */); cl_assert(wo...
(stored_session->length_min)
, ACTIVITY_CALORIES_PER_KCAL)); cl_assert_equal_b(stored_session->manual, true); cl_assert(stored_session->step_data.distance_meters > 2000); } // --------------------------------------------------------------------------------------- void test_workout_service__pause_resume(void) { int3...
"kernel/ui/kernel_ui.h" #include "kernel/ui/modals/modal_manager.h" #include "process_management/app_manager.h" #include "resource/resource_ids.auto.h" #include "services/common/battery/battery_curve.h" #include "services/common/clock.h" #include "services/common/i18n/i18n.h" #include "services/common/light.h" #include...
text_layer_set_line_spacing_delta(text_layer, line_spacing_delta)
; } #endif if (old_dialog) { dialog_pop(old_dialog); } } // Public API //////////////////// void battery_ui_display_plugged(void) { // If we're plugged in for charging, we want to alert the user of this, // but we don't want to overlay ourselves over anything they may have // on the screen at the mom...
/* * 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...
(val, 0, UINT32_MAX)
; return; } case ANALYTICS_METRIC_ELEMENT_TYPE_INT8: { *((int8_t*)location) = (int8_t)CLIP(val, INT8_MIN, INT8_MAX); return; } case ANALYTICS_METRIC_ELEMENT_TYPE_INT16: { *((int16_t*)location) = (int16_t)CLIP(val, INT16_MIN, INT16_MAX); return; } case ANALYTICS_METRIC_E...
extOverflowModeFill or // GTextOverflowModeTrailingEllipsis), we can immediately cut the text off below the box height // if we're not rendering the first line. // - This, because the user does not expect to see more text drawn below, after the '...'. // - The first-line exception means that text, and the...
{ return is_utf8_advanced; }
PBL_ASSERTN(codepoint != 0); if (codepoint_is_formatting_indicator(codepoint)) { continue; } if (codepoint_should_skip(codepoint)) { continue; }; return true; } } //////////////////////////////////////////////////////////// // Helper functions //! Trim given codepoint from 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...
launcher_app_glance_structured_create_subtitle_text_node( structured_glance, prv_music_glance_subtitle_dynamic_text_node_update)
; } static void prv_destructor(LauncherAppGlanceStructured *structured_glance) { LauncherAppGlanceMusic *music_glance = launcher_app_glance_structured_get_data(structured_glance); if (music_glance) { event_service_client_unsubscribe(&music_glance->music_event_info); kino_reel_destroy(music_glance->ic...
/* * 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...
test_graphics_context_mask_set_value_for_coordinate(ctx, mask, mask_pixel_value, GPoint(x, y))
; } } return mask; } typedef void (*HorizontalClippingMaskRecordFunc)(GContext *ctx, int16_t y, int16_t x1, int16_t x2, GColor color); static void prv_mask_record_hline_test_pattern(HorizontalClippingMaskRecordFunc record_func) { GContext *ctx = s_ctx; pr...
/* * 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 0; }
bool s_performed_store = false; AttributeList *s_expected_attributes = NULL; TimelineItemActionGroup *s_expected_actions = NULL; static uint8_t app_id_data[] = { 0x00, // id 0x04, 0x00, // length 'P', 'h', 'i', 'l', // Value }; static ANCSAttribute *s_app_id_attr = (ANCSAttribute *)&ap...
_with_legacy2_sdk()) { prv_draw_background(menu_layer, ctx, &menu_layer->scroll_layer.layer, false); } MenuRenderIterator *render_iter = applib_type_malloc(MenuRenderIterator); PBL_ASSERTN(render_iter); if (menu_layer->center_focused) { // in this mode, the selected row is always the best candidate fo...
(menu_layer)
er_set_update_proc(&layer, &across_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_across_y_origin_layer"))); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_ny_layer_update_callback); lay...
GPoint(0, 2)
, 148); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 4), 0); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 6), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 8), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 10), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12),...
e_id(tz_info.timezone_id); if (clock_timezone_source_is_manual()) { prv_update_time_info_and_generate_event(&tz_data->utc_time, NULL); } else { prv_update_time_info_and_generate_event(&tz_data->utc_time, &tz_info); } } static void prv_handle_set_time_msg(time_t new_time) { PBL_LOG(LOG_LEVEL_WARNING, "M...
{ time_t t = sys_get_time(); clock_copy_time_string_timestamp(buffer, size, t); }
static size_t prv_format_time(char *buffer, int buf_size, const char *format, time_t timestamp) { struct tm time_tm; localtime_r(&timestamp, &time_tm); const size_t ret_val = strftime(buffer, buf_size, i18n_get(format, buffer), &time_tm); i18n_free(format, buffer); return ret_val; } size_t clock_get_time_n...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(app_data)
ForBTCAddrData *itr_data = (KeyForBTCAddrData*) context; BTBondingID key; BtPersistBondingData stored_data; info->get_key(file, (uint8_t*) &key, info->key_len); info->get_val(file, (uint8_t*) &stored_data, MIN((unsigned)info->val_len, sizeof(stored_data))); if (stored_data.type == BtPersistBondingTypeBTClas...
if (!bd_addr) { return; }
BTBondingID key = prv_get_key_for_bt_classic_addr(bd_addr); bt_persistent_storage_delete_bt_classic_pairing_by_id(key); } bool bt_persistent_storage_get_bt_classic_pairing_by_id(BTBondingID bonding, BTDeviceAddress *address_out, ...
num_alarms_fired, 1); s_current_day = s_tuesday; s_current_hour = 1; s_current_minute = 0; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 2); } void test_alarm__disable_upcoming_alarm(void) { AlarmId id1, id2; id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_E...
cl_assert_equal_b(alarm_is_scheduled, true)
; cl_assert_equal_i(next_alarm, rtc_get_time() + time_until_alarm); // Disable both alarms, now there is no next alarm alarm_set_enabled(id1, false); alarm_set_enabled(id2, false); at_least_one_alarm_enabled = alarm_get_next_enabled_alarm(&next_alarm); cl_assert_equal_b(at_least_one_alarm_enabled, false); ...
ve(window2, true); cl_assert_equal_i(window_stack_count(modal_stack), 0); cl_assert_equal_i(window2->on_screen, false); // Switch to app happens via the compositor compositor_transition(NULL); // Call the upkeep function so the change in state is handled modal_manager_event_loop_upkeep(); // The app is...
(window_is_focusable(window2), true)
; window_set_focusable(window2, false); cl_assert_equal_b(window_is_focusable(window2), false); WindowStack *app_stack = app_state_get_window_stack(); WindowStack *modal_stack = modal_manager_get_window_stack(ModalPriorityGeneric); cl_check(app_stack); cl_check(modal_stack); cl_check(!app_stack->list_h...
te(fd, buf, size); if (bytes_wrote < S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Err %d while writing", (int)bytes_wrote); return false; } else if (bytes_wrote < (int)size) { PBL_LOG(LOG_LEVEL_ERROR, "Wrote only %d bytes, expected %d", (int)bytes_wrote, (int)size); return false; } return true; } //...
prv_realloc_storage(session, new_size)
; } } else { prv_release_session_file(session); } return true; } // ----------------------------------------------------------------------------------------- // Make sure there is at least 'needed' bytes available in our file system space // allowed for data logging static bool prv_make_file_system_spac...
78, 404, 38}, { -1050, 408, 39}, { -930, 361, 30}, { -936, 345, 38}, { -810, 348, 23}, { -823, 330, 45}, { -912, 340, 62}, { -946, 360, 104}, { -857, 317, 103}, { -802, 286, 110}, { -802, 284, 102}, { -815, 276, 116}, { -853, 304, 126}, { -833, 307, 123}, { -840, ...
{ //> TEST_NAME walk_50_hands_in_pocket //> TEST_EXPECTED 50 //> TEST_EXPECTED_MIN 44 //> TEST_EXPECTED_MAX 55 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { { -708, 660, -818}, { -847, 540, -636}, { -780, 304, -539}, { -739, 374, -550}, { -727, 409, -588}, { -632, 382, -675},...
{ -1009, 383, -322}, { -1291, 301, 103}, { -939, 619, 19}, { -679, 616, -20}, { -424, 475, -56}, { -180, 209, 27}, { -129, 89, -109}, { -262, 248, -297}, { -564, 768, -568}, { -945, 1251, -682}, { -1131, 733, -353}, { -339, 439, -526}, { -1377, 873, -248}, { -899...
&content_indicator_config); content_indicator_config.layer = down_arrow_layer; content_indicator_configure_direction(content_indicator, ContentIndicatorDirectionDown, &content_indicator_config); #endif // Wait to add the menu layer until after we might have added ...
{ return; }
launcher_menu_layer->selection_animations_enabled = enabled; if (enabled) { const MenuIndex selected_index = menu_layer_get_selected_index(&launcher_menu_layer->menu_layer); prv_play_glance_for_row(launcher_menu_layer, selected_index.row); } else { launcher_app_glance_service_rewind_current_g...
irection); } // ----------------------------------------------------------------------------------------------- // Handle a chunk of data received for a data subscription. Called by prv_do_data_handle. static uint32_t prv_do_data_handle_chunk(AccelServiceState *state, uint16_t time_interval_ms) { uint32_t num_sampl...
((AccelServiceState *)state, samples_per_update)
; } // ---------------------------------------------------------------------------------------------- void accel_data_service_subscribe(uint32_t samples_per_update, AccelDataHandler handler) { AccelServiceState * session = accel_service_private_get_session(PebbleTask_Unknown); accel_session_data_subscribe(session...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ 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 - 1] = '\0'; } }
static GTextNode *prv_create_subtitle_node(LauncherAppGlanceStructured *structured_glance) { return launcher_app_glance_structured_create_subtitle_text_node( structured_glance, prv_workout_glance_subtitle_dynamic_text_node_update); } static void prv_destructor(LauncherAppGlanceStructured *structured_glance) ...
/* * 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(e.type, PEBBLE_APP_CACHE_EVENT)
; cl_assert_equal_i(e.app_cache_event.cache_event_type, PebbleAppCacheEvent_Removed); cl_assert_equal_i(e.app_cache_event.install_id, app3.id); cl_assert_equal_i(fake_event_get_count(), 2); // ensure the only one remaining is the one evicted cl_assert_equal_i(app2.id, app_cache_get_next_eviction()); cl_as...
extLayoutExtended layout = { 0 }; graphics_text_attributes_enable_screen_text_flow((GTextLayoutCacheRef) &layout, TEXT_FLOW_INSET_PX); return graphics_text_layout_get_max_used_size(ctx, text, ...
{ layer_add_child(&dialog->window.layer, &dialog->icon_layer.layer); }
dialog_load(dialog); } static void prv_simple_dialog_appear(Window *window) { SimpleDialog *simple_dialog = window_get_user_data(window); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); dialog_appear(dialog); } static void prv_simple_dialog_unload(Window *window) { SimpleDialog *simple_dialog = ...
art of D prv_advance_to_ms_with_timers(start_ms + 1080 + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, d), 1); // Run to the completion of D prv_advance_to_ms_with_timers(start_ms...
{ const int duration_a = 300; // This one will complete const int delay_a = 10; prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); const AnimationHandlers handlers = { .stopped = prv_stopped_unschedule_all_handler, }; void *context = NULL; Animation *a = prv_create_test_animatio...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
state->impl->filter(header, &state->context)
) { if (prv_should_use_item(state, header)) { *state->filter_header = *header; } filter = true; } } return filter; } static void prv_update_status(void) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); if (!s_mutex) { return; } mutex_lock(s_mutex); new_timer_stop(s_timer)...
NULL, false /* requires_address_pinning */, false /* auto_accept_re_pairing */); cl_assert(id_3 != BT_BONDING_ID_INVALID); cl_assert_e...
cl_assert_equal_i(fake_shared_prf_storage_get_ble_delete_count(), 1)
----------- // Start A and advance it prv_advance_to_ms_with_timers(start_ms + delay_a + MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); animation_set_elapsed(a, duration_a - lef...
prv_create_test_animation()
; animation_set_duration(a, duration_a); animation_set_delay(a, delay_a); uint64_t start_ms = prv_now_ms(); animation_schedule(a); // ------------------------------------------------------------------------------------- // Got partway through the delayof a prv_advance_to_ms_with_timers(start_ms + 100);...
ert(child_b.next_sibling == &child_c); layer_add_child(&child_a, &grand_child_a); cl_assert(grand_child_a.parent == &child_a); // Remove non-first-child (child_b): // // +-parent // | // '->child_a->child_c // | // '->grand_child_a // // +-child_b // layer_remove_f...
(GRectZero)
; Layer *b = layer_create(GRectZero); layer_add_child(a, aa); layer_add_child(aa, aaa); layer_add_child(aaa, aaaa); layer_add_child(a, ab); a->next_sibling = b; stack[0] = a; // go to child if possible Layer *actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_st...
/* * 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...
{ prompt_send_response("Invalid button"); return; }
if (button_is_pressed(button)) { prompt_send_response("down"); } else { prompt_send_response("up"); } }
odes - 1; i++) { midnight += SECONDS_PER_DAY; nodes[i]->timestamp = midnight; nodes[i]->duration = MINUTES_PER_DAY; nodes[i]->all_day = true; } } static void prv_set_nodes_all_day(TimelineNode *nodes[], CommonTimelineItemHeader *header, int num_nodes) { // Multiday events: // Each day is an all...
prv_show_event(&node, now, midnight, direction, false /* show_all_day */)
; } #ifdef TIMELINE_SERVICE_DEBUG static void prv_debug_print_pins(TimelineNode *node0) { TimelineNode *node = (TimelineNode *)list_get_head((ListNode *)node0); PBL_LOG(LOG_LEVEL_DEBUG, "= = = = = = = ="); while (node) { PBL_LOG(LOG_LEVEL_DEBUG, "======"); PBL_LOG(LOG_LEVEL_DEBUG, "Node with id %x%x...",...
red_prf_storage_get_ble_pairing_data(&pairing_info_out, name_out, &requires_address_pinning_out, &flags), true); cl_assert_equal_b(requires_address_pinning_out, false); cl_assert_equal_i(flags, 0)...
shared_prf_storage_get_valid_page_number()
, 0); shared_prf_storage_set_local_device_name(NULL); cl_assert_equal_b(shared_prf_storage_get_local_device_name(device_name_out, sizeof(device_name_out)), false); cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 1); shared_prf_storage_se...