prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
s_get_time() + (i * WAKEUP_EVENT_WINDOW)); } // Test that the 9th wakeup event fails to schedule (E_DOES_NOT_EXIST) wakeup_id = sys_wakeup_schedule(sys_get_time() + ((MAX_WAKEUP_EVENTS_PER_APP + 1) * WAKEUP_EVENT_WINDOW), 0, false); cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); } void test...
sys_get_time()
+ WAKEUP_EVENT_WINDOW * 4; WakeupId fourth_wakeup_id = sys_wakeup_schedule(fourth_event, 0, false); cl_assert_equal_i(sys_wakeup_query(fourth_wakeup_id), fourth_event); // Jump to the future right before the 3rd event rtc_set_time(sys_get_time() + 170); // Force wakeup to check for current wakeup event w...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(sizeof(Write))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ // Setup graphics context framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); framebuffer_clear(&s_fb); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); s_app_state_get_graphics_context = &s_ctx; // Setup resources fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */); ...
void test_health_activity_detail_card__cleanup(void) { } // Helpers ////////////////////// static Window* prv_create_card_and_render(HealthData *health_data) { Window *window = health_activity_detail_card_create(health_data); window_set_on_screen(window, true, true); window_render(window, &s_ctx); return wi...
(*num_logs * sizeof(char *))
; for (int i = 0; i < *num_logs; i++) { uint32_t uniq_msg_id = 0xDEADDEAD - i + (i << 16); char buf[20]; snprintf(buf, sizeof(buf), "%x", uniq_msg_id); for (int j = 0; j < log_len; j += strlen(buf)) { memcpy(&msg[j], buf, MIN(strlen(buf), log_len - j)); } msg[log_len] = '\0'; msg...
uplets, 3); cl_assert(size == sizeof(Dictionary) + (3 * sizeof(Tuple)) + sizeof(SOME_DATA) + strlen(SOME_STRING) + 1 + sizeof(uint32_t)); struct SerializeTestResult context = { .okay = false, .expected_size = size }; DictionaryResult result = dict_serialize_tuplets(serialize_callback, &context, tuplets, 3)...
(tuple->value->uint32 == 32)
; uint32_found = true; break; case SOME_INT8_KEY: cl_assert(tuple->length == sizeof(int8_t)); cl_assert(tuple->value->int8 == -8); int8_found = true; break; case SOME_INT16_KEY: cl_assert(tuple->length == sizeof(int16_t)); cl_assert(tuple->valu...
ntP_b->x.raw_value) && (pointP_a->y.raw_value == pointP_b->y.raw_value)); } GPointPrecise gpointprecise_midpoint(const GPointPrecise a, const GPointPrecise b) { return GPointPrecise( (int16_t)(((int32_t)a.x.raw_value + (int32_t)b.x.raw_value) / 2), (int16_t)(((i...
(rect->origin.x + (rect->size.w / 2), rect->origin.y + (rect->size.h / 2))
; } bool grect_contains_point(const GRect *rect, const GPoint *point) { int16_t min_x = rect->origin.x; int16_t max_x = rect->origin.x + rect->size.w; if (min_x > max_x) { // edge case for non-standardized rects: int16_t temp = max_x; max_x = min_x; min_x = temp; } int16_t min_y = rect->origi...
AccelRawData *buffer, uint32_t buffer_size, uint32_t samples_per_update) { int result = 0; if (samples_per_update > ACCEL_MAX_SAMPLES_PER_UPDATE) { return -1; } // The buffer must be big enough to hold at least 1 more item to support 2/5 subsampling if (buffer_size < samples_per_update + ...
{ // Remove previous subscription for this task, if there is one sys_accel_manager_data_unsubscribe(session); AccelSubscriberState *state = prv_subscriber_state(session); PBL_ASSERTN(state == NULL); state = kernel_malloc_check(sizeof(AccelSubscriberState)); *state = (AccelSubscriberState) { ...
fer *buffer = content_indicator_get_current_buffer(); content_indicator_init_buffer(buffer); } void test_timeline_layouts__cleanup(void) { free(fb); } // Helpers ////////////////////// void prv_handle_down_click(ClickRecognizerRef recognizer, void *context); static void prv_render_layout(LayoutId layout_id, con...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE_X(peek))
); prv_construct_and_render_layout(&config, 1); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE_X(details1))); // Round needs to scroll down one more time to see everything #if PBL_ROUND prv_construct_and_render_layout(&config, 2); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE_X(detail...
c) { *tloc = t; } return (t); } // Manually construct double to avoid requiring soft-fp static double prv_time_to_double(time_t time) { // time_t is 32bit signed int, convert it manually #ifndef UNITTEST _Static_assert(sizeof(time_t) == 4, "Conversion depends on 32bit time_t"); #endif if (time == 0) { ...
(tim_p, sizeof(struct tm))
; } return localized_strftime(s, maxsize, format, tim_p, locale); } void *pbl_memcpy(void *destination, const void *source, size_t num) { // In releases prior to FW 2.5 we used GCC 4.7 and newlib as our libc implementation. However, // in 2.5 we switched to GCC 4.8 and nano-newlib. We actually ran into bad a...
activated(); s_activity_state.should_be_started = true; if (!prv_activity_allowed_to_be_enabled() || s_activity_state.started) { return; } AccelSamplingRate sampling_rate; if (activity_algorithm_init(&sampling_rate)) { PBL_LOG(LOG_LEVEL_DEBUG, "Starting activity tracking..."); // Subscribe to t...
system_task_add_callback(prv_set_enable_cb, NULL)
; } static void prv_charger_event_cb(PebbleEvent *e, void *context) { #if !IS_BIGBOARD // Since bigboards are usually plugged in, don't react to a battery connection event const PebbleBatteryStateChangeEvent *evt = &e->battery_state; mutex_lock_recursive(s_activity_state.mutex); { s_activity_state.enabled_...
xParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, .box = (GRect) { GPointZero, (GSize) { 7 * HORIZ_ADVANCE_PX, 10 } } }; line.max_width_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; // Init mutable types word_iter_init(&word_iter, &word_iter_stat...
(iter_next(&word_iter))
; cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 1 * HORIZ_ADVANCE_PX); // reset line line = (Line) { 0 }; line.max_width_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; cl...
l_assert(fd >= 0); cl_assert(st.st_size == pfs_write(fd, buf, st.st_size)); pfs_close(fd); } /* Start of test */ static const AppInstallId CRAZY_ID = 171717; bool app_install_get_entry_for_uuid(const Uuid *uuid, AppInstallEntry *entry) { AppInstallId id = app_install_get_id_for_uuid(uuid); return app_instal...
{ fake_spi_flash_init(0, 0x1000000); pfs_init(false); app_install_manager_init(); app_db_init(); app_db_flush(); app_cache_init(); app_cache_flush(); tictoc_id = app_install_get_id_for_uuid(&tictoc_uuid); music_id = app_install_get_id_for_uuid(&music_uuid); sports_id = app_install_get_id_for_uuid...
app_db_insert((uint8_t *)&menu_layer.uuid, sizeof(Uuid), (uint8_t *)&menu_layer, sizeof(AppDBEntry)); menu_layer_id = app_db_get_install_id_for_uuid(&menu_layer.uuid); app_cache_add_entry(menu_layer_id, menu_layer_size /* size */); cl_assert_equal_i(2, menu_layer_id); // load second app app_storage_get_fi...
{ .id = AttributeIdBody, .cstring = "Body" }, { .id = AttributeIdMuteDayOfWeek, .uint8 = MuteBitfield_Always }, }, }, }; iOSNotifPrefs *existing_prefs = &prefs; AttributeList expected_attributes = { .num_attributes = 5, .attributes = (Attribute[]) { { .id = AttributeIdTitle, .cs...
ancs_filtering_is_muted(&mute_always)
compiled apps - no need to restore original since original 2.x did not do any restore ctx->draw_state.text_color = GColorBlack; } if (config->value && (icon_align != GAlignRight)) { value_box.size.w -= horizontal_margin; const GFont value_font = prv_get_cell_value_font(config); const GSize text_s...
(ctx, config->title, title_font, cell_layer_bounds_size.w, config->overflow_mode, text_alignment)
: title_font_height * intitial_title_text_lines; const int title_text_cap_offset = (config->title) ? fonts_get_font_cap_offset(title_font) : 0; int16_t container_height = title_text_frame_height + subtitle_text_frame_height; if (icon_align == GAlignTop) { // The icon is rendered above the others, add ...
/* * 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, GUARD_CHAR, NAME_LENGTH)
v_roll_back(PPoGATTClient *client, uint32_t sn) { if (++client->out.timeouts_counter >= PPOGATT_TIMEOUT_COUNT_MAX) { PBL_LOG(LOG_LEVEL_ERROR, "Resetting because max timeouts reached..."); prv_start_reset(client); return; } PBL_LOG(LOG_LEVEL_WARNING, "Rolling back from (%u, %u) to %"PRIu32, ...
{ gatt_client_subscriptions_subscribe(client->characteristics.data, BLESubscriptionNone, GAPLEClientKernel); }
if (client->state == StateConnectedOpen) { comm_session_close(client->session, (CommSessionCloseReason)reason); } list_remove(&client->node, (ListNode **) &s_ppogatt_head, NULL); new_timer_delete(client->rx_ack_timer); kernel_free(client); if (s_ppogatt_head == NULL) { regular_timer_remove_callb...
}; ProtobufLogRef ref = prv_test_encode_measurements(&input, false /*use_data_logging*/); prv_test_decode_payload(&input, false /*use_data_logging*/, ref); } } // --------------------------------------------------------------------------------------------- // Try doing multiple flushes from the same ses...
for (unsigned i = 0; i < num_samples * num_values_per_sample; i++) { values[i] = i * 3; }
// Create a session with an artifically small buffer size which will cause it to flush // automatically time_t start_time = rtc_get_time(); ProtobufLogConfig log_config = { .type = ProtobufLogType_Measurements, .measurements = { .num_types = num_values_per_sample, .types = types, } }...
_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_rect(ctx, &GRect(-10, 2, 18, 4)); } static void across_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_rect(ctx, &GRect(4, 5, 18, 10));...
layer_set_update_proc(&layer, &clear_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)); } #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 20, 20) #define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 144, 168) #define ORIGIN_DRAW_...
/* * 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; }
GBitmap region_sub_bitmap; gbitmap_init_as_sub_bitmap(&region_sub_bitmap, bitmap, *region); graphics_private_move_pixels_horizontally(&region_sub_bitmap, delta_x, true /* patch_garbage */); } static void prv_copy_app_fb_patching_garbage(int16_t dest_origin_x) { const GBitmap src_bitmap = compositor_get_app_fr...
"%"PRId32, current_calories); } static void prv_set_distance(char *buffer, size_t buffer_size, int32_t current_distance_meters) { if (current_distance_meters == 0) { strncpy(buffer, EN_DASH, buffer_size); return; } const int conversion_factor = health_util_get_distance_factor(); const char *units_str...
app_free(card_data->subtitles[i].label)
; } for (int i = 0; i < card_data->num_zones; i++) { app_free(card_data->zones[i].label); } i18n_free_all(card_data); app_free(card_data); health_detail_card_destroy(card); }
limitations under the License. */ #include "mfg_serials.h" #include "console/prompt.h" #include "util/size.h" static const uint8_t OTP_SERIAL_SLOT_INDICES[] = { OTP_SERIAL1, OTP_SERIAL2, OTP_SERIAL3, OTP_SERIAL4, OTP_SERIAL5 }; static const uint8_t OTP_PCBA_SLOT_INDICES[] = { OTP_PCBA_SERIAL1, OTP_PCBA_SERI...
mfg_get_serial_number()
); } void command_hwver_read(void) { prompt_send_response(mfg_get_hw_version()); } void command_pcba_serial_read(void) { prompt_send_response(mfg_get_pcba_serial_number()); } void command_serial_write(const char *serial) { MfgSerialsResult result; uint8_t index = 0; size_t serial_len = strlen(serial); 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...
(&image->command_list, image->size, to)
36, 440, -360}, { 1240, 488, -392}, { 1040, 440, -432}, { 952, 360, -392}, { 1056, 304, -336}, { 1328, 248, -288}, { 1256, 80, -136}, { 1096, -32, -88}, { 1136, -56, -200}, // 34 seconds { 1312, 120, -184}, { 1256, 80, -208}, { 1088, 16, -208}, { 1096, -56, -264}, ...
{ 1336, 272, -208}, { 1192, 160, -120}, { 1280, 96, -72}, { 1424, 112, -96}, { 1408, 128, -104}, { 1264, 120, -88}, { 1264, -24, -48}, { 1160, -160, -80}, { 1024, -280, 8}, { 1008, -256, 0}, { 1096, -144, -144}, { 1072, -64, -152}, { 1088, 0, -256}, { 960, 32, -24...
{ 848, 208, -152}, { 992, 216, -120}, { 1080, 272, -144}, { 1144, 304, -160}, { 1264, 392, -184}, { 1328, 560, -216}, // 42 seconds { 1056, 552, -248}, { 1088, 568, -264}, { 944, 440, -288}, { 1064, 368, -272}, { 1208, 312, -184}, { 1280, 248, -160}, { 1128, 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...
graphics_context_set_antialiased(ctx, false)
; graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_round_rect(ctx, &GRect(4, -5, 18, 10), 4, GCornersAll); } void corners_all_update_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_round_rect(c...
se"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITH...
cl_assert_equal_i(e.media.type, PebbleMediaEventTypeVolumeChanged)
; 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'...
) ^ ((y>>4 & 1) * xtime(xtime(xtime(xtime(x)))))); } #else #define Multiply(x, y) \ ( ((y & 1) * x) ^ \ ((y>>1 & 1) * xtime(x)) ^ \ ((y>>2 & 1) * xtime(xtime(x))) ^ \ ((y>>3 & 1) * xtime(xtime(xtime(x)))) ^ ...
BlockCopy(output, input)
; state = (state_t*)output; // The KeyExpansion routine must be called before encryption. Key = key; KeyExpansion(); InvCipher(); } #endif // #if defined(ECB) && ECB #if defined(CBC) && CBC static void XorWithIv(uint8_t* buf) { uint8_t i; for(i = 0; i < KEYLEN; ++i) { buf[i] ^= Iv[i]; }...
if (turn_sensor_on && !hrm_is_enabled(HRM)) { // Turn on the sensor now HRM_LOG("Turning on HR sensor"); s_manager_state.accel_state = sys_accel_manager_data_subscribe( ACCEL_SAMPLING_25HZ, prv_handle_accel_data, NULL, PebbleTask_NewTimers); accel_manager_set_jitterfree_sampling_rate...
circular_buffer_consume(&s_manager_state.system_task_event_buffer, sizeof(PebbleHRMEvent))
; ++s_manager_state.dropped_events; } circular_buffer_write(&s_manager_state.system_task_event_buffer, (const uint8_t *)event, sizeof(PebbleHRMEvent)); } static void prv_populate_hrm_event(PebbleHRMEvent *event, HRMFeature feature, const HRMData *data) { switch (feature) { case HR...
lots); regular_timer_fire_seconds(1); // Second term: cl_assert(gap_le_is_advertising_enabled()); assert_ad_data("yo"); gap_le_assert_advertising_interval(advert_terms[1].min_interval_slots, advert_terms[1].max_interval_slots); regular_timer_fire_seconds(1); // Sil...
gap_le_advert_schedule(ad_b, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0)
; cl_assert(infinite_job_b); assert_ad_data("B"); // Round-robin 10 times: for (int i = 0; i < 10; ++i) { regular_timer_fire_seconds(1); assert_ad_data("A"); regular_timer_fire_seconds(1); assert_ad_data("B"); } // Introduce non-infinite job "C" for 10 seconds: advert_term.duration_secs ...
callback); } void test_app_menu_data_source__change_order_watchfaces(void) { AppInstallId watchface_order[] = {BIG_TIME_APP_ID, APP_ID_TICTOC}; for (int i = 0; i < 10; i++) { uint8_t num_entries = ARRAY_LENGTH(watchface_order); prv_shuffle(watchface_order, num_entries); prv_test_new_order_with_filter_...
app_menu_data_source_init(&data_source, &(AppMenuDataSourceCallbacks) { .changed = prv_menu_layer_reload_data, .filter = app_filter_callback, }, &menu_layer)
; uint16_t num_apps = app_menu_data_source_get_count(&data_source); for (uint16_t i = 0; i < num_apps; i++) { AppMenuNode *node = app_menu_data_source_get_node_at_index(&data_source, i); cl_assert_equal_i(node->install_id, desired_order[i]); } app_menu_data_source_deinit(&data_source); } void test_ap...
int duration_total = play_count_seq * (total_duration_a + total_duration_b + delay_seq); // Create 2 test animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); animation_set_delay(a, delay_a); animation_set_play_count(a, play_count_a); Animation *b = prv_create_t...
cl_assert_equal_i(animation_get_duration(spawn, true, false), delay_spawn + MAX(total_duration_a, total_duration_b))
; cl_assert_equal_i(animation_get_duration(spawn, true, true), duration_total); animation_destroy(spawn); #endif } // -------------------------------------------------------------------------------------- // Test unschedule all when we have multiple animations, some complex void test_animation__unschedule_all(v...
selection_index; menu_layer->selection.h = prev_selection_height; } } typedef struct { MenuLayer *menu_layer; bool up; } CenterFocusSelectionAnimationState; static CenterFocusSelectionAnimationState prv_center_focus_animation_state(Animation *animation) { PropertyAnimation *prop_anim = (PropertyAnimation ...
prv_center_focus_animation_update_impl(animation, true, progress)
; } static void prv_center_focus_animation_teardown(Animation *animation) { // usually a "redundant" call. Just in case the animation gets cancelled before finish prv_center_focus_animation_update_in_and_out(animation, ANIMATION_NORMALIZED_MAX); } static void prv_schedule_center_focus_animation(MenuLayer *menu_la...
/* * 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...
(&datum, 1)
; } static const uint8_t HDLC_START = 0x7E; static const uint8_t HDLC_ESCAPE = 0x7D; static const uint8_t HDLC_ESCAPE_MASK = 0x20; static void prv_put_hdlc_frame_delimiter(void) { prv_put_byte(HDLC_START); } static void prv_put_byte_hdlc(uint8_t datum) { if ((datum == HDLC_ESCAPE) || (datum == HDLC_START)) { ...
_2, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&link_key_2, &link_key_out, sizeof(link_key_out)); cl_assert_equal_s(name_2, name_out); cl_assert_equal_i(platform_bits_2, platform_bits_out); // Update first pairing (with the same data) BTBondingID id_X = bt_persistent_storage_store_bt_classic_pairing(&ad...
(id_4 != BT_BONDING_ID_INVALID)
; } void test_bluetooth_persistent_storage__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 = {{0x11, 0x12, 0x13, 0x14, 0x15, 0x16}}; SM128BitKey link...
4, -448}, { 800, 544, -472}, { 584, 600, -264}, { 640, 760, -176}, { 720, 776, -80}, // 10 seconds { 776, 632, -88}, { 688, 504, -144}, { 1136, 600, -40}, { 1992, 616, -376}, { 2264, 304, -40}, { 2432, 256, -16}, { 2144, 216, -184}, { 1576, 64, -264}, { 1368, 16, ...
{ -728, 464, -1304}, { -208, 840, -1992}, { 152, 568, -1688}, { -128, 584, -1424}, { -120, 472, -1000}, { -160, 224, -672}, { -176, 128, -480}, { -176, 56, -384}, { -88, 224, -520}, { 32, 248, -592}, { 112, 104, -616}, { 216, -144, -624}, { 160, -88, -600}, { 16, ...
{ 2520, 232, -544}, // 18 seconds { 2176, 360, -448}, { 1560, 688, -264}, { 936, 728, -192}, { 752, 992, -16}, { 424, 1528, 272}, { 312, 1176, 288}, { 640, 1248, 352}, { 2008, 1144, -48}, { 2408, 776, 32}, { 3128, 424, 48}, { 2792, 280, -72}, { 2240, 168, -128}, ...
gErrorStatus_InvalidEscapeCharacter, 3, }, { "\\e", 1000000000, "e", 0, true, }, { "\\\\\\{}", 1000000000, "\\{}", 0, true, }, { "\\\\{end()}", 1000000000, "\\", 0, true, }, { "\\{end()}", 1000000000, "{end()}", 0, true, }, { "Harder test {} bazza"...
if (cond.eval_time != 0) { cl_assert_equal_b(cond.force_eval_on_time, true); } else { cl_assert_equal_b(cond.force_eval_on_time, false); }
if (!rv) { cl_assert_equal_i(err.status, s_full_tests[i].expect_status); cl_assert_equal_i(err.index_in_string, s_full_tests[i].expect_index); } } }
applib_free(state->aux); } } // ------------------------------------------------------------------------------------------- // Return true if the animation globals were instantiated using the legacy 2.x animation // manager bool animation_private_using_legacy_2(AnimationState *state) { if (state == NULL) { s...
if (animation->calling_end_handlers) { animation->defer_delete = true; return true; }
st bool region_animated = true; app_window_stack_remove(&option_menu->window, region_animated); } static void prv_region_menu_push(SettingsTimeData *data) { const char *title = prv_get_timezone_title(); const OptionMenuCallbacks callbacks = { .select = prv_region_menu_select, }; const int start_index = d...
(data->region_names_buffer)
; app_free(data); } static Window *prv_init(void) { SettingsTimeData *data = app_malloc_check(sizeof(*data)); *data = (SettingsTimeData){}; data->callbacks = (SettingsCallbacks) { .deinit = prv_deinit_cb, .draw_row = prv_draw_row_cb, .select_click = prv_select_click_cb, .num_rows = prv_num_row...
+ 1); cl_assert_equal_gtransform(value, start_value); // Halfway through prv_advance_to_ms_with_timers(start_ms + duration/2); cl_assert_close_gtransform(value, mid_value); // End prv_advance_to_ms_with_timers(start_ms + duration + MIN_FRAME_INTERVAL_MS*2); cl_assert_equal_gtransform(value, end_value); ...
(h, duration)
; prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(h); // Test the accessor functions uint32_t test_value; property_animation_get_from_uint32(prop_h, &test_value); cl_assert_equal_i(test_value, start_value); property_animation_get_to_uint32(prop_h, &test_value); ...
implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "dialog_analytics/analytics.h" #include "hc_protocol/hc_endpoint_analytics.h" #include "kernel/pbl_malloc.h" #include "kernel/util/freertos_utils.h" #include "system/passert.h" #include <ut...
{ prv_lock(); AnalyticsNode *node = prv_find_analytic(metric); if (node) { node->value = value; } prv_unlock(); }
void analytics_add(DialogAnalyticsMetric metric, uint32_t amount) { prv_lock(); AnalyticsNode *node = prv_find_analytic(metric); if (node) { node->value += amount; } prv_unlock(); } void analytics_inc(DialogAnalyticsMetric metric) { analytics_add(metric, 1); } void analytics_stopwatch_start_at_rat...
[4] = octet, [5] = octet, }, }; BTDevice device = bt_device_init_with_address(address, true /* is_random */); return *(BTDeviceInternal *)(&device); } static BTDeviceInternal prv_connected_dummy_device(uint8_t octet) { BTDeviceInternal device = prv_dummy_device(octet); gap_le_connection_add(&dev...
fake_gatt_is_service_discovery_running()
_state.bytes_remaining < read_length) || !s_flash_logging_enabled) { return (false); } uint32_t addr = s_curr_state.page_start_addr + s_curr_state.offset_in_log_page; flash_write_bytes(data_to_write, addr, read_length); s_curr_state.offset_in_log_page += read_length; s_curr_state.bytes_remaining -= read...
generation_to_log_file_id(generation)
; uint32_t log_start_addr; int num_log_pages = prv_get_start_of_log_file(log_file_id, &log_start_addr); PBL_LOG(LOG_LEVEL_DEBUG, "Dumping generation %d, %d pages", generation, num_log_pages); if (num_log_pages == 0) { completed_cb(false); return (false); // no match found } DumpLogState *state = ...
{ 944, -224, 16}, { 1072, -256, -56}, { 1016, -264, -160}, { 1264, -376, -16}, { 784, -376, 264}, { 1336, -184, 16}, { 1360, -16, -136}, { 1136, -40, 24}, { 888, -64, 96}, { 896, 32, 8}, { 936, 112, 16}, { 1080, 328, -96}, { 1152, 392, -48}, { 1416, 408, 96}, ...
{ 952, 0, 40}, { 1024, -128, 104}, { 1016, -256, 56}, { 1112, -336, -16}, { 1112, -472, -128}, { 1440, -640, 0}, { 1016, -432, 144}, { 1304, -112, -184}, { 1336, -176, -88}, { 1224, -200, 24}, { 856, -80, 24}, { 792, 8, 24}, { 848, 64, 16}, { 1200, 160, -32}, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ free(ctx->dest_bitmap.addr); ctx->dest_bitmap.addr = NULL; }
/* * 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_fill_radial(ctx, bounds, GOvalScaleModeFitCircle, radius, 0, TRIG_MAX_ANGLE / 2); }
__profiler_stop(); APP_LOG(APP_LOG_LEVEL_INFO, "180 filled"); __profiler_print_stats(); // 180 degrees, 1px inset __profiler_start(); for (int i = 0; i < ITERATIONS; ++i) { graphics_fill_radial(ctx, bounds, GOvalScaleModeFitCircle, inset_thickness, 0, TRIG_MAX_ANGLE / 2); } ...
#include "kernel/util/stop.h" #include "system/logging.h" #include "system/passert.h" // Parameters to a timer based PWM. // // ---------------- ---------- ---------- ---------- ---------- // | | | | | | | | // | | | ...
PWR_TRACK_BACKLIGHT("OFF", PWM_OUTPUT_FREQUENCY_HZ, 0)
; } else { if (!s_backlight_pwm_enabled) { prv_backlight_pwm_enable(true); } // By setting higher values in the TIM_Pulse register, we're causing the output waveform // to be low for a longer period of time, which causes the backlight to be brighter. // // The brightness...
((PebbleMutex *) s_callback_list_semaphore)
; s_callback_list_semaphore = NULL; new_timer_delete(s_timer_id); s_timer_id = TIMER_INVALID_ID; } static void prv_fire_callbacks(ListNode *list, uint16_t mod) { mutex_lock(s_callback_list_semaphore); ListNode* iter = list_get_next(list); while (iter) { RegularTimerInfo* reg_timer = (RegularTimerInfo*)...
/* * 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_fsm_state != expected_state) { return false; }
prv_check_fsm_transition(s_fsm_state, next_state); s_fsm_state = next_state; return true; } void smartstrap_fsm_state_set(SmartstrapState next_state) { prv_check_fsm_transition(s_fsm_state, next_state); s_fsm_state = next_state; } void smartstrap_state_lock(void) { cl_assert(!s_locked); s_locked = true...
NSOLE_STATE_LOGGING); } void pulse_prepare_to_crash(void) { } static void prv_process_received_frame(void *frame_ptr) { IncomingPulseFrame *frame = frame_ptr; uint32_t fcs; // Comply with strict aliasing rules. The memcpy is optimized away. memcpy(&fcs, &frame->data[frame->length - sizeof(fcs)], sizeof(fcs));...
(PULSE_MAX_SEND_SIZE)
, length); // TODO: DMA dbgserial_putchar_lazy(FRAME_DELIMITER); for (size_t i = 0; i < length; ++i) { dbgserial_putchar_lazy(frame[i]); } dbgserial_putchar_lazy(FRAME_DELIMITER); mutex_unlock(s_tx_buffer_mutex); } void pulse_best_effort_send_cancel(void *buf) { prv_assert_tx_buffer(buf); mutex_u...
2}, { 1184, -128, -192}, { 1136, -80, -296}, { 1280, -8, -328}, { 1352, 8, -264}, { 1200, -48, -224}, { 1016, -104, -208}, { 952, -88, -200}, { 936, -32, -216}, { 952, -32, -232}, { 992, -88, -216}, { 1008, -80, -240}, { 984, -72, -248}, { 1120, -72, -272}, { 1192...
{ 1016, -136, -288}, { 1120, -176, -248}, { 1176, -160, -232}, { 1128, -144, -200}, { 1360, -88, -152}, { 1416, -16, -200}, { 1248, -32, -144}, { 904, -40, -56}, { 1208, -32, -136}, { 1456, -88, -40}, { 1376, -120, 32}, { 1192, -168, 32}, { 1088, -200, 16}, { 984,...
/* * 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...
(canvas, ROCKY_CANVAS_CLIENTWIDTH, client_width)
/* * 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(result.test_results, 0, sizeof(result.test_results))
; result.als_result = 0; break; default: // No data present, just return an initialized struct with default values. return (MfgData) { .data_version = CURRENT_DATA_VERSION }; } return result; } WatchInfoColor mfg_info_get_watch_color(void) { return prv_fetch_struct().color; } void m...
, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi"))
{1191024000,"39","07"},{1191110400,"39","07"},{1191196800,"40","07"},{1191283200,"40","07"},{1191369600,"40","07"},{1191456000,"40","07"},{1191542400,"40","07"}, {1191628800,"40","07"},{1191715200,"40","07"},{1191801600,"41","07"},{1191888000,"41","07"},{1191974400,"41","07"},{1192060800,"41","07"},{1192147200,"41","...
(tmbuf, "+1000")
; jan_2_2015__13_00_00.tm_gmtoff = 39600; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%z", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "+1100"); jan_2_2015__13_00_00.tm_gmtoff = -60; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%z", &jan_2_2015__13_00_00); #if !OUR_STRFTIME_BUGS cl_asser...
weather_service_locations_list_create(&forecasts_count_out); WeatherAppData *data = app_state_get_user_data(); weather_service_locations_list_destroy(data->forecasts_list_head); WeatherAppLayout *layout = &data->layout; if (forecasts_count_out > 0) { weather_app_layout_set_data(layout, &forecasts_list_he...
{ return; }
const bool animated = true; app_window_stack_push(&data->window, animated); // Request the default forecast separately instead of using the forecast list in `data` to avoid // any potential race conditions WeatherLocationForecast *default_forecast = weather_service_create_default_forecast(); const bool i...
-992}, { 48, 24, -1000}, { 48, 24, -1008}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 32, -1000}, { 48, 24, -1000}, ...
{ 56, 16, -1000}, { 48, 24, -992}, { 56, 24, -992}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 56, 24, -1008}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 32, -1008}, { 48, 16, ...
, 336, -16}, { 712, 240, -24}, { 840, 288, 24}, { 888, 296, 8}, { 832, 344, -64}, { 840, 352, -112}, { 968, 464, -200}, { 1200, 328, -144}, { 1192, 216, -104}, { 1680, 240, -32}, { 1288, 312, 48}, { 1008, 168, 96}, { 1184, 136, 160}, // 39 seconds { 1184, 88, 240}...
{ 1088, 24, 208}, { 904, 48, 104}, { 816, 40, 48}, { 808, 8, 24}, { 760, -40, 24}, { 688, -72, 48}, { 768, -128, 40}, { 936, -48, -32}, { 1008, -120, -40}, { 1480, -152, 144}, { 1320, 72, 80}, { 1632, 200, -8}, { 1288, 520, -32}, { 704, 280, 40}, { 768, 176, 4...
{ 760, 232, -120}, { 888, 352, -232}, { 1016, 240, -176}, { 1136, 240, -248}, { 1328, 224, -144}, { 1584, 288, -80}, { 1256, 312, -40}, { 1080, 256, 0}, { 1200, 80, 104}, { 1112, 96, 184}, { 936, 88, 112}, { 864, 72, 80}, { 856, 56, 56}, { 792, 16, 64}, { 792...
/* * 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...
simple_dialog_get_dialog(new_simple_dialog)
-72}, { 872, 320, -184}, { 1144, 576, -16}, { 1280, 824, 88}, { 1208, 896, 136}, { 1000, 712, 104}, { 1032, 848, 40}, { 1040, 672, 104}, { 1096, 568, 56}, { 1256, 616, 104}, { 1296, 480, 64}, { 1120, 280, -96}, { 944, 96, -136}, { 920, 240, -96}, { 1112, 352, -40}...
{ 936, 0, -208}, { 936, 288, -240}, { 784, 320, -440}, // 159 seconds { 984, 248, -312}, { 816, 328, -216}, { 656, 304, -256}, { 720, 208, -144}, { 960, 384, -240}, { 1296, 488, -256}, { 1360, 832, -240}, { 1104, 608, -272}, { 992, 528, -304}, { 1184, 920, -312}, ...
{ 880, -8, -104}, { 864, 64, -168}, { 968, 312, -168}, { 1216, 200, -96}, { 1400, 136, -144}, { 1240, 88, -136}, { 856, -8, -304}, { 1096, -48, -32}, { 520, 208, -376}, { 968, 224, -368}, { 1168, 304, -224}, { 896, 304, -200}, // 162 seconds { 688, 376, -224}, ...
d_glance_size_out) { if (!glance || (glance->num_slices > APP_GLANCE_DB_MAX_SLICES_PER_GLANCE) || !serialized_glance_out || !serialized_glance_size_out) { return E_INVALID_ARGUMENT; } // Allocate a buffer for data about each slice's attribute list, but only if we have at least // one slice because al...
(attr_list, serialized_slice_header->data, glance_buffer_end)
; // Note that we'll destroy the attribute list's attributes below in the cleanup section // Advance the cursor by the serialized slice's total size glance_buffer_cursor += serialized_slice_total_size; } // Check that we fully populated the serialized glance buffer rv = (glance_buffer_cursor == gla...
ayer; int hour; bool is_morning; // Timezone data uint16_t region_count; uint16_t continent_selected; uint16_t continent_start[NUM_CONTINENTS + 1]; //!< First region id for the continent uint16_t continent_end[NUM_CONTINENTS]; //!< Last+1 region id for the continent const char **continent_names; co...
settings_option_menu_push( title, OptionMenuContentType_SingleLine, OPTION_MENU_CHOICE_NONE, &callbacks, end_index - start_index, true /* icons_enabled */, &data->region_names[start_index], data)
; } // Timezone Continent Menu ///////////////////////// static void prv_continent_menu_select(OptionMenu *option_menu, int selection, void *context) { SettingsTimeData *data = ((SettingsOptionMenuData *)context)->context; data->continent_selected = selection; prv_region_menu_push(data); } static void prv_cont...
>run_size == 0) { // Start a new run data->run_size = 1; data->prev_sample = encoded; } else if (data->prev_sample == encoded) { // Continue a previous run data->run_size++; // If we've maxed out this run, terminate this run and start a new one if (data->ru...
{ prv_collect_raw_samples(data, num_samples, false /*finish*/); }
// See if we have a stepping rate update from the algorithm. If so, accumulate the distance // covered. uint16_t rate_steps; uint32_t rate_elapsed_ms; time_t rate_update_time; activity_algorithm_get_step_rate(&rate_steps, &rate_elapsed_ms, &rate_update_time); if (rate_update_time != s_acti...
// Fire the ack timeout after receiving the nack app_timer_trigger(app_message_ack_timer_id()); cl_assert_equal_b(s_nack_sent_is_called, true); cl_assert_equal_i(s_out_sent_call_count, 0); cl_assert_equal_i(s_out_failed_call_count, 1); cl_assert_equal_i(s_failure_result, APP_MSG_SEND_REJECTED); // Check ...
app_message_is_closed_outbound()
; for (uint32_t i = 0; i < count; i++) { printf("%d, ", ((RecognizerHandled *)node)->idx); node = list_get_next(node); } printf("}"); } printf("\n"); cl_assert(!failed); prv_clear_recognizers_processed(list); } static void prv_sub_event_handler(const Recognizer *recognizer, RecognizerE...
prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)
); prv_compare_recognizers_processed((int[]) {0, 1}, 2, &s_recognizers_handled); // Recognizers attached to children of active layer will not be evaluated manager.active_layer = &layer_a; cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((...
/* * 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...
(wakeup_id)
; } void app_wakeup_cancel_all(void) { sys_wakeup_cancel_all_for_app(); } bool app_wakeup_get_launch_event(WakeupId *wakeup_id, int32_t *cookie) { WakeupInfo wakeup_info; sys_process_get_wakeup_info(&wakeup_info); //If the id is invalid, return false if (wakeup_info.wakeup_id <= 0) { return false; } ...
icense. */ #include "clar.h" #include "services/common/phone_pp.h" #include "services/normal/phone_call_util.h" #include "services/common/comm_session/session.h" #include "kernel/events.h" #include "fake_events.h" #include "fake_session.h" #include "fake_system_task.h" #include "stubs_bt_lock.h" #include "stubs_p...
(PhoneEventType_Start, true /* check_cookie */, false /* check_name_number */, NULL, NULL)
; } void test_phone_pp__end(void) { uint8_t pp_msg[] = {0x09, 0x1a, 0xd4, 0x77, 0x08}; phone_protocol_msg_callback(s_session, pp_msg, sizeof(pp_msg)); fake_system_task_callbacks_invoke_pending(); prv_assert_last_event(PhoneEventType_End, true /* check_cookie */, false /* check_name_number */, ...
ell_height_cb(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *context) { ActionMenuLayer *aml = (ActionMenuLayer *)context; const int16_t line_height = fonts_get_font_height(aml->layout_cache.font); // If we have short items, j...
{ int16_t item_height = aml->layout_cache.item_heights[idx]; total_h += MIN(max_visible_height, item_height); }
const int16_t header_padding = 6 * aml->num_items; const int16_t header_height = ((bounds->size.h - total_h) / 2) - padding; return MAX(header_height - header_padding, 0); } static void prv_draw_header_cb(GContext *ctx, const Layer *cell_layer, uint16_t section_index, void *callb...
BTDeviceAddress active_addr = {}; const bool is_connected = bt_driver_classic_copy_connected_address(&active_addr); // Create the new remote StoredRemote *remote = stored_remote_create(); remote->classic.bd_addr = *addr; prv_copy_device_name_with_fallback(remote, name); if (is_connected && (0 == memcmp(...
i18n_get("Pairing Instructions", data)
, HEADER_BUFFER_SIZE); } else { const unsigned int num_remotes = list_count(data->remote_list_head); sniprintf(data->header_buffer, HEADER_BUFFER_SIZE, (num_remotes != 1) ? i18n_get("%u Paired Phones", data) : i18n_get("%u Paired Phone", data), nu...
e_bits() & ~SELECT_BUTTON_MASK; while (1) { // See if we should restart uint8_t button_state = button_get_state_bits() & ~SELECT_BUTTON_MASK; if (button_state != prev_button_state) { system_reset(); } delay_ms(10); } } static void check_and_handle_resuming_from_standby(void) { periph_co...
check_update_fw()
; } if (check_and_increment_reset_loop_detection_bits()) { sad_watch(ERROR_RESET_LOOP); } if (boot_bit_test(BOOT_BIT_SHUTDOWN_REQUESTED)) { boot_bit_clear(BOOT_BIT_SHUTDOWN_REQUESTED); dbgserial_putstr("Shutdown requested."); // A full shutdown has been requested instead of booting. // Thi...
char recovery_version_string[sizeof(TINTIN_METADATA.version_tag)]; // Ensure that OTP values are null-terminated char serial_string[MFG_SERIAL_NUMBER_SIZE + 1]; char hw_version_string[MFG_HW_VERSION_SIZE + 1]; char uptime_string[16]; // "xxd xxh xxm xxs" char const * subtitle_text[SystemInformationItem_Cou...
PBL_ASSERTN(cell_index->row < SystemInformationItem_Count)
; SettingsSystemData *data = (SettingsSystemData *) context; SystemInformationData *info = &data->information_data; const char *title = i18n_get(s_information_titles[cell_index->row], data); menu_cell_basic_draw(ctx, cell_layer, title, info->subtitle_text[cell_index->row], NULL); } int16_t prv_information_ge...
og_set_background_color(dialog, GColorRajah); dialog_set_icon(dialog, data->resource_id_80); dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT); app_simple_dialog_push(simple_dialog); } /////////////////////////////// // Simple Dialog with vibration static void prv_show_simple_dialog_vibe(DialogsData *data) { ...
app_actionable_dialog_push(actionable_dialog)
/* * 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...
{ // Set the default prompt or result dialog timeout config->timeout_ms = prv_should_prompt(&ctx->config) ? 4500 : 1800; }
if (!config->text_color.argb) { config->text_color = GColorBlack; } if (!config->background_color.argb) { config->background_color = !ctx->enabled ? GColorMediumAquamarine : GColorMelon; } } static void prv_setup_dialog(Dialog *dialog, const ActionToggleDialogConfig *config, ...
ius_outer_x, Fixed_S16_3 radius_outer_y, Fixed_S16_3 radius_inner_x, Fixed_S16_3 radius_inner_y, int32_t angle_start, int32_t angle_end) { // Drawing config calculation const EllipsisDrawConfig config = prv_calc_draw_config_ellipsis(angle_start, a...
// Special case to make bottom edge to be on left side and keep masking algorithm happy prv_swap_precise_points(&start_top, &start_bottom); } if (end_top.y.raw_value > end_bottom.y.raw_value) { prv_swap_precise_points(&end_top, &end_bottom); } else if (end_top.y.raw_value == end_bottom.y.raw_value &&...
adjusted_bottom -= ctx->draw_state.drawing_box.origin.y; // Calculate distances from the middle of the circle (discard negative values) int draw_max_top = MAX(center.y.integer - adjusted_top, 0); int draw_max_bottom = MAX(adjusted_bottom - center.y.integer, 0); int draw_min_top = MAX(center.y.integer - adju...
, void *context) { // We only care if send text support changed right now if (!event->capabilities.flags_diff.send_text_support) { return; } const PebbleProcessMd *md = app_install_get_md(APP_ID_SEND_TEXT, false /* worker */); const InstallEventType event_type = (md ? APP_AVAILABLE : APP_REMOVED); app_...
(LOG_LEVEL_WARNING, "Stored app with resource id %d not found in resources", reg_entry->bin_resource_id)
/* * 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(info->fw_revision, (char*)TINTIN_METADATA.version_tag, FW_REVISION_LEN); }
static void prv_set_software_revision(DisInfo *info) { // Fmt: xx.xx\0 char sdk_version[SW_REVISION_LEN]; sniprintf(sdk_version, SW_REVISION_LEN, "%2u.%02u", PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR, PROCESS_INFO_CURRENT_SDK_VERSION_MINOR); strncpy(info->sw_revision, sdk_version, SW_REVI...
et_callback_context(ScrollLayer *scroll_layer) { return scroll_layer->context ? scroll_layer->context : scroll_layer; } void scroll_layer_draw_shadow_sublayer(Layer *shadow_sublayer, GContext* ctx) { ScrollLayer *scroll_layer = (ScrollLayer *)(((uint8_t*)shadow_sublayer) - offsetof(ScrollLayer, shadow_sublayer)); ...
(&scroll_layer->layer)
; } void scroll_layer_add_child(ScrollLayer *scroll_layer, Layer *child) { layer_add_child(&scroll_layer->content_sublayer, child); } GPoint scroll_layer_get_content_offset(ScrollLayer *scroll_layer) { return scroll_layer->content_sublayer.bounds.origin; } T_STATIC void prv_scroll_layer_set_content_offset_inter...
TimelineLayout *card_timeline_layout) { KinoReel *from_reel = kino_reel_create_with_resource_system( card_timeline_layout->icon_res_info.res_app_num, card_timeline_layout->icon_res_info.res_id); if (!from_reel) { return; } const uint32_t duration = TIMELINE_CARD_TRANSITION_MS; G...
(&layout->icon_layer.layer, true)
; } void timeline_layout_transition_card_to_pin(TimelineLayout *card_timeline_layout, TimelineLayout *pin_timeline_layout) { KinoReel *from_reel = kino_reel_create_with_resource_system( card_timeline_layout->icon_res_info.res_app_num, card_timeline_layout->icon...
------------------------------------------------------------------------------------- static void prv_fixed_s32_16_setter(Fixed_S32_16 *p, Fixed_S32_16 value) { *p = value; } static Fixed_S32_16 prv_fixed_s32_16_getter(Fixed_S32_16 *p) { return *p; } // ------------------------------------------------------------...
(s_started_handler_calls.num_calls, 1)
;; cl_assert(s_started_handler_calls.entries[0].fired_time_ms - start_ms <= 1); cl_assert(s_started_handler_calls.entries[0].context == context); cl_assert_equal_i(s_stopped_handler_calls.num_calls, 1);; cl_assert(s_stopped_handler_calls.entries[0].fired_time_ms - start_ms >= duration); cl_assert(s_stopped_h...
s >= desired_params->connection_interval_min_1_25ms); } return (is_interval_min_acceptable && actual_params->conn_interval_1_25ms <= desired_params->connection_interval_max_1_25ms && actual_params->slave_latency_events == desired_params->slave_latency_events); } static void prv_request_params_...
{ new_timer_delete(connection->param_update_info.watchdog_timer); }
// ------------------------------------------------------------------------------------------------- //! Extern'd for and used by bt_conn_mgr.c ResponseTimeState gap_le_connect_params_get_actual_state(GAPLEConnection *connection) { for (ResponseTimeState state = 0; state < NumResponseTimeState; ++state) { if (p...
_ms); // This is the text that is currently visible and animates out of view data->info_text_out_animation = property_animation_create_layer_frame(&data->info_text_layer.layer, &pair_text_area, &below_pair_text); PBL_ASSERTN(data->info_text_out_animation); ...
prv_cleanup_prf_animations(data)
; layer_set_hidden(&data->info_text_layer.layer, true); if (prv_has_device_name(data)) { layer_remove_from_parent(&data->device_name_text_layer.layer); } if (prv_has_confirmation_token(data)) { layer_remove_from_parent(&data->code_text_layer.layer); } // Disable all buttons in this screen: actio...
/* * 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...
(GColorBlackARGB8, fun(GColorFromHEX(0xaaaaaa)).argb)
; // // expectation as derived from Appfaces_generic_colors.psd cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0x0000aa)).argb); cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0x005500)).argb); cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0x550055)).argb); cl_assert_equal_i(GColorWhiteA...
lapsed_ms = interpolate_uint32(normalized, player->from_elapsed_ms, player->to_elapsed_ms); } else if ((is_animation_infinite || is_reel_infinite) && !is_animation_reversed) { // If either animation or reel is infinite and animation is not reversed animation_get_elapsed(animation, &animation_elapsed_ms); ...
prv_create_play_animation(player, from_value, to_value)
week = day_of_week; memcpy(averages, &s_sys_activity_get_step_averages_values_weekday.out.averages, sizeof(*averages)); return s_sys_activity_get_step_averages_values_weekday.out.result; } } typedef struct { HealthActivity activity; time_t time_start; time_t time_end; void *context; } Heal...
{ s_sys_activity_get_metric_values.out.result = false; s_sys_activity_get_metric_values.out.history[0] = 456; HealthValue result = health_service_sum_today(HealthMetricStepCount); cl_assert_equal_i(0, result); }
void test_health__sum_today(void) { s_sys_activity_get_metric_values.out.history[0] = 123; s_sys_activity_get_metric_values.out.history[1] = 456; HealthValue result = health_service_sum_today(HealthMetricStepCount); cl_assert_equal_i(123, result); cl_assert_equal_i(s_sys_activity_get_metric_values.in.metric...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r1_no_clip.${BIT_DEPTH_NAME}.pbi")
pp framebuffer should be released. No animation should be started. s_modal_window_present = true; compositor_transition(&s_transition_a); cl_assert_equal_i(s_render_pending, false); cl_assert_equal_i(s_count_animation_create, 0); // Start the animation s_display_update_in_progress = false; prv_handle_dis...
(s_count_display_update, 1)
; cl_assert_equal_i(s_count_animation_schedule, 0); // Have the app render once so the animation can start s_render_pending = true; compositor_app_render_ready(); cl_assert_equal_i(s_count_animation_schedule, 1); // Don't allow the app to render while we're animating to it cl_assert_equal_i(s_render_pend...
/* * 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...
(BT_RX_BOOTROM_UART)
; uart_init_tx_only(BT_TX_BOOTROM_UART); uart_set_baud_rate(BT_RX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE); uart_set_baud_rate(BT_TX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE); } else { uart_init(BT_RX_BOOTROM_UART); uart_set_baud_rate(BT_RX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE); } ...
r own. int region_id = clock_get_timezone_region_id(); prv_clock_get_timezone_info_from_region_id(region_id, tz_adjust_time, &tz_adjust_info); tz_info = &tz_adjust_info; // We need to set timezone info so point to the new info. } } // Note: update the timezone before setting the utc time. (If...
if (is_dst != was_dst) { PebbleEvent e = { .type = PEBBLE_SET_TIME_EVENT, .set_time_info = { .utc_time_delta = 0, .gmt_offset_delta = 0, .dst_changed = true, } }; event_put(&e); s_dst_checker.cb_data = (void*)is_dst; }
} void clock_init(void) { if (clock_is_timezone_set()) { TimezoneInfo tz_info; rtc_get_timezone(&tz_info); time_util_update_timezone(&tz_info); } // TODO: Using a regular timer is pretty gross... s_dst_checker = (RegularTimerInfo) { .cb = prv_watch_dst, .cb_data = (void*)time_get_isdst(rtc...
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 implied. * See the ...
{ frame.size.w = 72; frame.size.h = 60; }
data fragments on a */ /* specified memory boundary. */ typedef union _tagAlignmentStruct_t { Alignment_t AlignmentValue; unsigned char ByteValue; } AlignmentStruct_t; /* The following defines the size in bytes of a data fragment that is*/ /* considered a large value. ...
{ HEAP_ASSERT_SANE(heap, block->PrevSize != 0, block); return (HeapInfo_t *)(((Alignment_t *)block) - block->PrevSize); }
static void prv_calc_totals(Heap* const heap, unsigned int *used, unsigned int *free, unsigned int *max_free) { HeapInfo_t *heap_info_ptr; uint16_t free_segments; uint16_t alloc_segments; /* Initialize the return values. */ *used = 0; *free = ...
ssert_equal_i(s_stopped_handler_calls.num_calls, 1);; cl_assert(s_stopped_handler_calls.entries[0].fired_time_ms - start_ms < duration); cl_assert(ABSOLUTE_VALUE(s_stopped_handler_calls.entries[0].fired_time_ms - unschedule_time) < 1); cl_assert(!s_stopped_handler_calls.entries[0].finished); // Destroy it an...
prv_now_ms()
x = app_inbox_create_and_register(BUFFER_SIZE, 1, test_message_handler, test_dropped_handler); cl_assert(s_inbox != NULL); } void test_app_inbox__app_inbox_service_begin_null_writer(void) { prv_create_test_inbox(); cl_assert_equal_b(false, app_inbox_service_begin(AppInbo...
cl_assert_equal_i(1, app_inbox_service_num_failed_for_tag(AppInboxServiceTagUnitTest))
; cl_assert_equal_i(0, app_inbox_service_num_success_for_tag(AppInboxServiceTagUnitTest)); prv_process_callback_events(); assert_num_dropped_callbacks(1); assert_num_message_callbacks(0); } void test_app_inbox__app_inbox_service_write_happy_case(void) { prv_create_test_inbox_and_begin_write(); cl_assert_e...
c); return rv ? vmc : 0; #else return 0; #endif } // ---------------------------------------------------------------------------------------------- static bool prv_should_smart_alarm_trigger(const AlarmConfig *config) { if (s_smart_snooze_counter >= SMART_ALARM_MAX_SMART_SNOOZE) { // The smart alarm has reac...
{ Uuid *pinid = (Uuid *)&settings_file_buffer[num_pin_adds++ * UUID_SIZE]; prv_add_pin(alarm->id, &alarm->config, alarm_time, pinid); if (updated) { analytics_event_pin_updated(alarm_time, &entry->uuid); } else { analytics_event_pin_created(alarm_time, &entry->uuid);...
} alarm_time = prv_get_alarm_time( alarm, cron_job_get_execute_time_from_epoch(cron, current_time + (i * SECONDS_PER_DAY))); } AlarmStorageKey key = { .id = alarm->id, .type = ALARM_DATA_PINS }; settings_file_set(file, &key, sizeof(key), settings_file_buffer, UUID_SIZE * num_...
bt_persistent_storage_get_ble_pinned_address(&pinned_address)
) { shared_prf_storage_set_ble_pinned_address(&pinned_address); } } static void prv_load_local_data_from_prf(void) { char name[BT_DEVICE_NAME_BUFFER_SIZE]; if (shared_prf_storage_get_local_device_name(name, BT_DEVICE_NAME_BUFFER_SIZE)) { bt_persistent_storage_set_local_device_name(name, BT_DEVICE_NAME_BU...
ine DOT_COMPOSITOR_RADIUS 7 #define DOT_OFFSET 25 #define UPDATE_INTERVAL 200 #define UPDATE_AMOUNT 2 #define FAILURE_PERCENT 15 #define INITIAL_PERCENT 0 //! App data typedef struct { //! UI ProgressWindow window; //! App fetch result AppFetchResult result; //! Data AppInstallEntry install_entry; AppF...
if (success) { prv_app_fetch_launch_app(data); }
} //////////////////////////// // Internal Helper Functions //////////////////////////// //! Used to clean up the application's data before exiting static void prv_app_fetch_cleanup(AppFetchUIData *data) { PBL_LOG(LOG_LEVEL_DEBUG, "App Fetch: prv_app_fetch_cleanup"); event_service_client_unsubscribe(&data->fetch...
onst int duration = 1000; const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; // NOTE: We are not exposing the GTransform in the public SDK, so the setter and getter // must be typecast static const PropertyAnimationImplementation implementation = {...
(value, mid_value)
); // End prv_advance_to_ms_with_timers(start_ms + duration + MIN_FRAME_INTERVAL_MS*2); cl_assert(gcolor_equal(value, end_value)); #endif } // -------------------------------------------------------------------------------------- // Test that the schedule/unschedule calls work correctly. // We should be able ...
&s_alg_state->file_minute_data_client); shared_circular_buffer_add_client(&s_alg_state->minute_data_cbuf, &s_alg_state->dls_minute_data_client); // Init the algorithm state kalg_init(k_state, NULL); // Count # of records in minute file uint32_t num_records; ui...
{ bool still; kalg_minute_stats(s_alg_state->k_state, &m_rec->base.vmc, &m_rec->base.orientation, &still); m_rec->base.steps = MIN(s_alg_state->minute_steps, UINT8_MAX); // The light level readings we get are from 0 to 4095 (12 bits). We only have 8 bits of storage, // so divide it down ...
m_rec->heart_rate_bpm = (uint8_t)median; m_rec->heart_rate_total_weight_x100 = (uint16_t)heart_rate_total_weight_x100; m_rec->heart_rate_zone = activity_metrics_prv_get_hr_zone(); return minute_distance_mm; } static void NOINLINE prv_reset_state_minute_handler(const AlgMinuteDLSSample *m_rec) { s_alg_sta...
, uint32_t array_len) { PBL_ASSERTN(!animation_private_using_legacy_2(NULL)); Animation *spawn = prv_complex_create(animation_array, array_len, AnimationTypeSpawn); return spawn; } // ------------------------------------------------------------------------------------------- Animation *animation_spawn_create(An...
prv_dump_scheduler(buffer, sizeof(buffer), app_state_get_animation_state())
; } // ------------------------------------------------------------------------------------------- void command_pause_animations(void) { animation_private_pause(); } // ------------------------------------------------------------------------------------------- void command_resume_animations(void) { animation_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...
activity_get_step_averages(local_tm.tm_wday, &health_data->step_averages)
; // Get the average steps for the past month activity_get_metric_monthly_avg(ActivityMetricStepCount, &health_data->monthly_step_average); //! Sleep related data health_service_private_get_metric_history(HealthMetricSleepSeconds, DAYS_PER_WEEK, health_data->sleep_...
.text_attributes); task_free(str_buffer); return jerry_create_undefined(); } static bool prv_text_align_from_value(jerry_value_t value, GTextAlignment *result) { char str[10] = {0}; jerry_string_to_utf8_char_buffer(value, (jerry_char_t *)str, sizeof(str)); #define HANDLE_CASE(identifer, value) \ if (s...
{ s_rocky_text_state.font = fonts_get_system_font(font_definition->res_key); s_rocky_text_state.font_name = font_definition->js_name; }
return jerry_create_undefined(); } JERRY_FUNCTION(prv_get_font) { return jerry_create_string_utf8((const jerry_char_t *)s_rocky_text_state.font_name); } JERRY_FUNCTION(prv_measure_text) { char *str_buffer; ROCKY_ARGS_ASSIGN_OR_RETURN_ERROR( ROCKY_ARG(str_buffer), ); GContext *const ctx = rocky_ap...
* * 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 in...
(!system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL))
; cl_assert(flash_locked); } void error_in_middle_cb(uint32_t num, uint32_t den, void *context) { int *countdown = context; if ((*countdown)-- == 0) { return_status = FLASH_ERROR_OPERATION; } } void test_system_flash__handle_erase_error_mid_operation(void) { int countdown = 3; cl_assert(!system_flash_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
attribute_list_get_serialized_size(&attr_list)
; cl_assert_equal_i(serialized_size, 19); uint8_t serialized_buffer[serialized_size]; attribute_list_serialize(&attr_list, serialized_buffer, &serialized_buffer[serialized_size]); const size_t buffer_size = attribute_list_get_string_buffer_size(&attr_list); uint8_t deserialized_buffer[buffer_size]; Attrib...