prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
00) #define I2C_TIMEOUT_ATTEMPTS_MAX (2 * 1000 * 1000) // MFI NACKs while busy. We delay ~1ms between retries so this is approximately a 1000ms timeout. // The longest operation of the MFi chip is "start signature generation", which seems to take // 223-224 NACKs, but sometimes for unknown reasons it can take much lon...
prv_bus_rail_power_down(bus)
; } else { prv_bus_pins_cfg_input(bus); } } //! Perform a soft reset of the bus //! Always lock the bus before reset static void prv_bus_reset(I2CBus *bus) { prv_bus_disable(bus); prv_bus_enable(bus); } /*---------------INIT/USE/RELEASE/RESET FUNCTIONS----------------------*/ void i2c_init(I2CBus *bus) {...
(animation->first_child) { prv_each(animation->first_child, callback, context); } if (animation->sibling) { prv_each(animation->sibling, callback, context); } callback(animation, context); } static void prv_free(AnimationPrivate *animation, uintptr_t context) { list_remove(&animation->list_node, NUL...
(animation, prv_call_stopped, animation->is_completed)
/* * 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 false; }
_ui_data->icon_layer, new_image, true); s_phone_ui_data->current_icon = new_image; s_phone_ui_data->current_icon_id = resource; #endif } // This will do the wrong thing if called after the action bar is removed, due to the absolute // coordinate scheme being offset. static void prv_unfold_icon_resource(TimelineRes...
(&s_phone_ui_data->window.layer)
; #endif } // Names can sometimes actually be phone numbers. We're assuming that phone numbers will always // match /^[() +0-9-]+$/ static bool prv_is_string_a_phone_number(const char *name) { size_t length = strlen(name); // Blocked/unknown numbers on Android start with a '-' if ((name[0] == '-') || (length ==...
/* * 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...
(circular_buffer_write(&buffer, (uint8_t*) "789", 3))
; cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 3); cl_assert(circular_buffer_write(&buffer, (uint8_t*) "abc", 3)); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 0); cl_assert(!circular_buffer_write(&buffer, (uint8_t*) "d", 1)); // too full cl_assert_equal_i(cir...
last_reset_counter_ticks = rtc_get_ticks(); } if (num_events_logged > 100) { // don't log a ridiculous amount of tightly looped disconnects return; } // It's okay to log to analytics directly from the BT02 callback thread // because flash writes are dispatched to KernelBG if the datalogging session ...
(orig_stats->num_type_errors, stats_buf->num_type_errors)
; stats_buf->num_len_errors = serial_distance32(orig_stats->num_len_errors, stats_buf->num_len_errors); stats_buf->num_crc_errors = serial_distance32(orig_stats->num_crc_errors, stats_buf->num_crc_errors); stats_buf->num_mic_errors = serial_distance32(orig_stats->num_mic_errors, stat...
Wraps the .update function of the current CompositorTransition. static void prv_animation_update(Animation *animation, const AnimationProgress distance_normalized); //! Call this function whenever a transition completes to change the state to one of the stable //! states (CompositorState_App or CompositorState_Modal)...
PBL_ASSERTN((bezel_width > 0) && (bezel_height > 0))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_get_8bit_x_from_1bit_x(dest_x)
); dest_x = 50; dest_y = 0; block_addr = (uint32_t *)(uintptr_t)(((dest_y * row_1bit_size_words) + (dest_x / 32)) * 4); cl_assert_equal_i(prv_convert_1bit_addr_to_8bit_x(bitmap, block_addr, dest_y), prv_get_8bit_x_from_1bit_x(dest_x)); dest_x = 0; dest_y = 50; block_addr = (uint32_t ...
false; s_session = (const CommSession) {}; fake_kernel_malloc_init(); fake_kernel_malloc_enable_stats(true); fake_kernel_malloc_mark(); s_send_next_count = 0; comm_default_kernel_sender_init(); } void test_session_send_buffer__cleanup(void) { comm_default_kernel_sender_deinit(); // Check for leaks: ...
comm_session_send_buffer_begin_write(&s_session, ENDPOINT_ID, 1 /* length */, TIMEOUT_MS)
); for (int i = 0; i < ARRAY_LENGTH(write_sb); ++i) { if (!write_sb[i]) { break; } prv_cleanup_send_buffer(write_sb[i]); } } void test_session_send_buffer__not_enough_space_kernel_bg(void) { s_valid_session = &s_session; // Fill the send buffer completely: const size_t max_length = comm_s...
rs_from_config(&text_node->text, layout, &config->text); } return text_node; } static GTextNodeText *prv_create_text_node_from_config( const LayoutLayer *layout, const LayoutNodeTextConfig *config) { GTextNodeText *text_node = prv_create_text_node_buffer(NULL); prv_set_text_node_text_parameters_from_config...
(headings, i)
; const char *paragraph = string_list_get_at(paragraphs, i); if (!heading || !paragraph) { break; } GTextNodeText *heading_node = (GTextNodeText *)layout_create_text_node_from_config( layout, &s_heading_config.extent.node); GTextNodeText *paragraph_node = (GTextNod...
corner_45.Xbit.pbi")); // Top-left center rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_bw, GPoint(27, 40), DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_p...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_assign_center_45.Xbit.pbi"))
; // Test transparency setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_context_set_fill_color(&ctx, GColorBlue); graphics_fill_rect(&ctx, &GRect(0, 0, 20, 10)); graphics_draw_rotated_bitmap(&ctx, test_image_color, GPoint(30...
return true; } bool attribute_group_deserialize(AttributeGroupType type, AttributeList *attr_list, void *group_ptr, uint8_t *buffer, uint8_t *buf_end, ...
for (int i = 0; i < num_group_type_elements; i++) { AttributeList *group_type_element_attribtue_list; if (type == AttributeGroupType_Action) { group_type_element_attribtue_list = prv_serialize_action( &((TimelineItemActionGroup *)group_ptr)->actions[i], &buffer); } else { group_type_el...
return buffer; } size_t attribute_group_serialize_payload(AttributeGroupType type, AttributeList *attr_list, void *group_ptr, uint8_t *buffer, size_t b...
tooth_ctl.h" #include "system/logging.h" #include "util/attributes.h" #include "util/build_id.h" #include "util/crc32.h" #include "util/math.h" #include <os/tick.h> #if PLATFORM_ROBERT #define CORE_DUMP_RX_BUFFER_SIZE (16 * 1024) // Place in DTCM on Robert static unsigned char DMA_BSS DMA_READ_BSS s_rx_buffer[CORE_DU...
if (!prv_spi_transaction(&cmd, s_rx_buffer, sizeof(text_crc_matches))) { PBL_LOG(LOG_LEVEL_ERROR, "Unable to get Text CRC"); goto spi_failed; }
memcpy(&text_crc_matches, s_rx_buffer, sizeof(text_crc_matches)); // Get the Build ID cmd = (CoreDumpSPICmd) { .cmd = CoreDumpCmd_GetBuildID }; if (!prv_spi_transaction(&cmd, s_rx_buffer, sizeof(build_id))) { PBL_LOG(LOG_LEVEL_ERROR, "Unable to get Build ID"); goto spi_failed; } memcpy(build_id, s...
&string_alloc_size, attributes_per_action); if (!r) { char buffer[key_len + 1]; strncpy(buffer, (const char *)app_id, key_len); buffer[key_len] = '\0'; PBL_LOG(LOG_LEVEL_ERROR, "Could not parse serial data for <%s>", buffer); prv_free_serialzed...
(&file, key, key_len)
; } prv_file_close_and_unlock(&file); return rv; } int ios_notif_pref_db_get_len(const uint8_t *key, int key_len) { if (key_len == 0) { return 0; } SettingsFile file; status_t rv = prv_file_open_and_lock(&file); if (rv != S_SUCCESS) { return 0; } int length = settings_file_get_len(&file...
on) { // If no parent at all, can't be if (!animation->parent) { return false; } if (animation->parent == parent) { // Direct descendent return true; } // Get parent's parent animation = animation->parent; } return false; } // ---------------------------------------...
{ if (animation->type != AnimationTypePrimitive) { // For a complex animation, check each component for (int child_idx = 0; child_idx < ANIMATION_MAX_CHILDREN; child_idx++) { AnimationPrivate *child = prv_find_animation_by_parent_child_idx(state, animation, child_idx); if (!child) { break;...
// ------------------------------------------------------------------------------------------- // Unschedule of an animation and optional destroy, recurses into children of sequence or spawn // animations. When this method is called on children of an animation, allow_auto_destroy is // false unless the top-level anim...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
GPIO_Init(BOARD_CONFIG_BUTTON.button_com.gpio, &GPIO_InitStructure)
; GPIO_WriteBit(BOARD_CONFIG_BUTTON.button_com.gpio, BOARD_CONFIG_BUTTON.button_com.gpio_pin, 0); gpio_release(BOARD_CONFIG_BUTTON.button_com.gpio); } static void initialize_button(const ButtonConfig* config) { // Configure the pin itself gpio_use(config->gpio); GPIO_InitTypeDef GPIO_InitStructure; GPIO_...
session); exit: // If success, double-check that we have enough space. if (success && space_needed > 0) { file_size = prv_pfs_get_file_size(session->storage.fd); PBL_ASSERTN(session->storage.write_offset + space_needed <= file_size); } return success; } // -----------------------------------...
{ uint32_t new_read_offset; int32_t bytes_read = dls_storage_read(session, tmp_buf, MIN(max_chunk_size, bytes_to_copy), &new_read_offset); if (bytes_read <= 0) { goto exit; } // Write to new file if (!prv_write_data(&new_storage, tmp_buf, bytes_re...
// We successfully transferred the unread data to the new storage, place it into the session // info pfs_close(session->storage.fd); // Close the new file now. That will finish up the swap for us pfs_close(new_storage.fd); new_storage.fd = DLS_INVALID_FILE; // Plug in the new storage info into the ses...
ock.h" #include "services/common/i18n/i18n.h" #include "services/normal/music.h" #include "services/normal/vibes/vibe_score.h" #include "shell/system_theme.h" #include "process_management/app_manager.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "system/logging.h" #i...
prv_content_width()
, config->time_field.size_h); } static GRect prv_cassette_rect(void) { const MusicAppSizeConfig *config = prv_config(); const int16_t cassette_x = config->horizontal_margin + PBL_IF_RECT_ELSE(0, prv_content_width() - config->cassette_rect.size.w); return GRect(cassette_x, config->cassette_rect.origin.y, ...
sion++) { // Get info on this session stats->last_session_len_sec = session->length_min * SECONDS_PER_MINUTE; time_t session_exit_utc = session->start_utc + stats->last_session_len_sec; // Skip if it ended too early if (session_exit_utc < min_end_utc) { continue; } if ((session->type...
if (delta_min > 1) { // We are awake sleep_data->cur_state = ActivitySleepStateAwake; if (stats.last_exit_utc != 0) { sleep_data->cur_state_elapsed_minutes = (now_utc - stats.last_exit_utc) / SECONDS_PER_MINUTE; } else { sleep_data-...
governing permissions and * limitations under the License. */ #include "shell/system_app_state_machine.h" #include "apps/core_apps/panic_window_app.h" #include "apps/system_apps/battery_critical_app.h" #include "apps/system_app_ids.h" #include "apps/system_apps/launcher/launcher_app.h" #include "apps/watch/low_pow...
prv_current_app_is_watchface()
) || (app_manager_get_current_app_md() == launcher_menu_app_get_app_info())) { return watchface_get_default_install_id(); } return APP_ID_LAUNCHER_MENU; } const PebbleProcessMd* system_app_state_machine_get_default_app(void) { return launcher_menu_app_get_app_info(); } void system_app_state_machine_r...
arted_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); // ------------------------------------------------------------------------------------- // Build up a sequence out of a + b An...
prv_count_handler_entries(&s_stopped_handler_calls, a)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); animation_schedule(c); // Create the spawn using a, b, c, and d prv_advance_to_ms_with_timers(start_ms + 680); Animation *spawn = animation_spawn_create(a, b, c, d, NULL); animation_set_delay(spawn, delay_spawn); animatio...
ng string without any special characters to be escaped.\x7e"; int len = strlen(str); HdlcStreamingContext ctx; hdlc_streaming_decode_reset(&ctx); for (int i = 0; i < len; i++) { char c = str[i]; bool should_store, is_invalid; bool is_complete = hdlc_streaming_decode(&ctx, (uint8_t *)&c, &should_stor...
(write_idx == strlen(str) + 7 /* 6 special characters to escape + 1 flag at end */)
; HdlcStreamingContext ctx; hdlc_streaming_decode_reset(&ctx); int read_idx = 0; int i = 0; while (true) { char c = buffer[i++]; bool should_store, is_invalid; bool is_complete = hdlc_streaming_decode(&ctx, (uint8_t *)&c, &should_store, &is_invalid); cl_assert(is_invalid == false); if (sh...
/* * 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...
(heap, bytes, saved_lr)
; if (!mem && bytes != 0) { PBL_CROAK_OOM(bytes, saved_lr, heap); } return mem; } #if defined(MALLOC_INSTRUMENTATION) void task_free_with_pc(void *ptr, uintptr_t client_pc) { heap_free(task_heap_get_for_current_task(), ptr, client_pc); } #endif void task_free(void* ptr) { register uintptr_t lr __asm("l...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ *checksum = (LegacyChecksum) { .reg = 0xffffffff, }; }
void legacy_defective_checksum_update( LegacyChecksum * restrict checksum, const void * restrict data, size_t length) { const char * restrict data_bytes = data; uint32_t * restrict reg = &checksum->reg; uint8_t * restrict accumulator = checksum->accumulator; uint8_t * restrict accumulated_length = &ch...
ndicating the HRM app is ready if (!prv_wait_int_low(dev)) { PBL_LOG(LOG_LEVEL_ERROR, "Timed-out waiting for the HRM app to be ready"); goto failed; } // get the running apps (also triggers the app to start) prv_log_running_apps(dev); // HRM app is ready, enable handshake interrupts prv_interrupts...
(&dev->en_gpio, true)
; psleep(LOADER_REBOOT_DELAY_MS); if (!prv_get_and_log_device_info(dev, &hrm_info, true /* log_version */)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to read AS7000 version info after flashing!"); goto cleanup; } } else { PBL_LOG(LOG_LEVEL_DEBUG, "AS7000 firmware is up to date."); ...
ertyAnimation *prop_h; Layer layer; GRect from_r; GRect to_r; GRect stopped_at_r; const int duration = 500; const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; memset(&layer, 0, sizeof(layer)); from_r = GRect(0, 0, 100, 200); // x, y, wi...
DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", time_ms - start_ms, layer.frame.origin.x, layer.frame.origin.y, layer.frame.size.w, layer.frame.size.h)
; cl_assert(max_loops > 0); max_loops--; } // Make sure our started and stopped handlers got called cl_assert_equal_i(s_started_handler_calls.num_calls, 1);; cl_assert(s_started_handler_calls.entries[0].fired_time_ms - start_ms <= 1); cl_assert_equal_i(s_stopped_handler_calls.num_calls, 1);; cl_...
on repeating click handler). #define MESSAGE_SWAP_DELAY 3 typedef enum { ScrollAnimationCurveKind_Interpolator, ScrollAnimationCurveKind_Curve } ScrollAnimationCurveKind; typedef struct { ScrollAnimationCurveKind swap_curve_kind; union { struct { InterpolateInt64Function interpolator; }; struct { Anim...
{ const GRect *current_frame = &swap_layer->current->layer.frame; GRect next_frame = swap_layer->next->layer.frame; next_frame.origin.y = current_frame->origin.y + current_frame->size.h; prv_layout_set_frame(swap_layer->next, &next_frame); layer_add_child(&swap_layer->layer, (Layer *)swap_layer->ne...
} ////////////////////////// // STATUS LAYER FUNCTIONS ////////////////////////// static void prv_update_status_bar_color(SwapLayer *swap_layer) { // Set initial values to assume failure bool color_status_bar = false; GColor bg_color = GColorClear; // If there is a current layout, then fetch the color and w...
_is_handled) { uint8_t msg[] = { 0x13, 17, 'c', 'o', 'm', '.', 's', 'p', 'o', 't', 'i', 'f', 'y', '.', 'm', 'u', 's', 'i', 'c', 7, 'S', 'p', 'o', 't', 'i', 'f', 'y' }; prv_receive_pp_data(msg, sizeof(msg)); PebbleEvent e = fake_event_get_last(); if (expect_is_handled) { cl_assert_equal_...
(false /* connected */)
/* * 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...
{ init(); app_event_loop(); deinit(); }
ll draw stroked circle with vairable width (only odd numbers for now) const uint8_t half_stroke_width = stroke_width / 2; const int16_t inner_radius = radius - half_stroke_width; const uint8_t outer_radius = radius + half_stroke_width; if (inner_radius < 1) { // Hack for filling circles: filling is done by...
GPoint(p.x + radius, p.y)
Message. int msg_buffer_size = MAX((msg_size + sizeof(HcProtocolMessage)), 130); uint8_t msg_buffer[msg_buffer_size]; memset(msg_buffer, 0, msg_buffer_size); HcProtocolMessage *hc_msg = (HcProtocolMessage *)&msg_buffer[0]; BinLogMessage_Param_v1 *msg = (BinLogMessage_Param_v1 *)&msg_buffer[sizeof(HcProtocolM...
task_get_dialogtask()
; msg->body.level = log_level; // Temporarily reserve space for a NULL terminator // TODO: remove NULL termination uint8_t max_str_len = msg_buffer_size - sizeof(BinLogMessage_Unhashed_v1) - 1; va_list args; va_start(args, fmt); msg->body.length = vsnprintf((char *)msg->body.string, max_str_len, fmt, ar...
graphics_draw_rotated_bitmap(&ctx, test_image_color, GPointZero, DEG_TO_TRIGANGLE(0), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_set_0.Xbit.pbi")); // Top-left corner rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN...
setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign)
; graphics_draw_rotated_bitmap(&ctx, test_image_color, GPoint(59, 30), DEG_TO_TRIGANGLE(2), GPoint(72, 84)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_rightedge_2.Xbit.pbi")); } void test_graphics_draw_rotated_bitmap__data_row_handling(void) { // Enable ...
&ctx, GPoint(0, 19), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 21), MAX_NUM_COLS - 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 23), MAX_NUM_COLS + 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_even_offset_odd_rows_no_clip"))); // ...
GPoint(0, 23)
, MAX_NUM_COLS + 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_odd_rows_no_clip"))); // Test to make sure drawing on all rows creates checkerboard pattern setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); for (int16_t row = 0;...
gate_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 e...
prv_update_stats(&weekend_stats, value)
; } else { prv_update_stats(&weekday_stats, value); } prv_update_stats(&daily_stats, value); } // ---------------------------------------- // Compute each combination of agg/stat and compare to expected for (HealthAggregation agg = HealthAggregationSum; agg <= HealthAggregationMax; agg++) { ...
se)); // Read different amounts from each client cl_assert(shared_circular_buffer_read(&buffer, &client1, 4, &out_buffer, &out_length)); cl_assert(shared_circular_buffer_consume(&buffer, &client1, 4)); cl_assert(memcmp(out_buffer, "1234", 4) == 0); cl_assert_equal_i(shared_circular_buffer_get_write_space_re...
prv_read_and_consume(&buffer, &client, storage, 2)
; cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 0); } void test_shared_circular_buffer__subsampling_2of5(void) { SharedCircularBuffer buffer; uint16_t item_size = 2; uint8_t storage[12*item_size]; uint8_t out_buffer[12*item_size]; uint16_t items_read; shared_circu...
do { --y; yleap = YEAR_IS_LEAP(y); days += s_year_lengths[yleap]; } while (days < 0); } res->tm_year = y - TM_YEAR_ORIGIN; res->tm_yday = days; const uint8_t *ip = s_mon_lengths[yleap]; for (res->tm_mon = 0; days >= ip[res->tm_mon]; ++res->tm_mon) { days -= ip[res->tm_mon]; } r...
{ minute -= MINUTES_PER_DAY; }
return minute; } // --------------------------------------------------------------------------------------- time_t time_start_of_today(void) { time_t now = rtc_get_time(); return time_util_get_midnight_of(now); } DEFINE_SYSCALL(time_t, sys_time_start_of_today, void) { return time_start_of_today(); } // --...
--------------------------------------------------------------------------- T_STATIC AnimationPrivate *prv_animation_get_current(void) { AnimationState *state = prv_animation_state_get(PebbleTask_Unknown); return state->aux->current_animation; } InterpolateInt64Function animation_private_current_interpolate_overri...
("destroying %d (%p) ", (int)animation->handle, animation)
; applib_free(animation); } // ------------------------------------------------------------------------------------------- static int prv_scheduler_comparator(void *a, void *b) { AnimationPrivate *animation_a = (AnimationPrivate *)a; AnimationPrivate *animation_b = (AnimationPrivate *)b; return serial_distanc...
/* * 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...
("21474836481")
, 1); // ((2147483647 * 10) + 1) & 0xFFFFFFFF cl_assert_equal_i(atol("21474836471"), (int)4294967287); // -1 * (((2147483647 * 10) + 1) & 0xFFFFFFFF) cl_assert_equal_i(atol("-21474836471"), -(int)4294967287); }
&& !isdigit(chr)) { return false; } } return true; } static bool prv_has_long_name(GFont font) { // Figure out if it's a "long name" // (i.e. one that won't fit a single line at the default font size). const int16_t fudge_some_pixels = 30; const bool line_contains_newline = (strchr(s_phone_u...
vibe_client_get_score(VibeClient_PhoneCalls)
/* * 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 (dev) { dev->is_gateway = is_gateway; }
/* * 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...
{ snprintf(g_text, sizeof(g_text), "BAT: %d, %d, %d", (int)data->data0, (int)data->data1, (int)data->data2); text_layer_set_text(text_layer, g_text); }
} static void up_click_handler(ClickRecognizerRef recognizer, void *context) { AppWorkerResult result = app_worker_launch(); APP_LOG(APP_LOG_LEVEL_INFO, "launch result: %d", result); } static void select_click_handler(ClickRecognizerRef recognizer, void *context) { AppWorkerMessage m; app_worker_send_messag...
draw_state.clip_box, y, x1, x2, ctx->draw_state.stroke_color); graphics_release_frame_buffer(ctx, framebuffer); return; } #endif // PBL_COLOR // since x1 is beginning of the line, rounding should work in favor of flooring the value // therefore we subs...
ctx->draw_state.draw_implementation->blend_horizontal_line(ctx, y, x_min, x_max, color)
; } void graphics_private_plot_vertical_line_prepared(GContext *ctx, GBitmap *framebuffer, GRect *clip_box, int x, int y0, int y1, uint16_t opacity, GColor color) { // Plots pixel directly to framebuffer // Pixel po...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_flash_send_and_receive_byte(FLASH_CMD_WRITE_ENABLE)
_i(s_num_timeline_removes, 9); AlarmId invalid_id = 7; alarm_set_enabled(invalid_id, false); cl_assert_equal_i(s_num_timeline_adds, 12); cl_assert_equal_i(s_num_timeline_removes, 9); } void test_alarm__alarm_delete(void) { AlarmId id1, id2, id3, id4, id5, id6, id7; id1 = alarm_create(&(AlarmInfo) { .hour ...
cl_assert_equal_s(pin_title, "Alarm")
/dialogs/actionable_dialog.h" #include "applib/ui/dialogs/simple_dialog.h" #include "kernel/pbl_malloc.h" #include "popups/health_tracking_ui.h" #include "resource/resource_ids.auto.h" #include "services/common/i18n/i18n.h" #include "services/normal/activity/activity.h" #include "services/normal/alarms/alarm.h" #includ...
{ AlarmDetailData *data = (AlarmDetailData *) context; alarm_delete(data->alarm_id); if (data->alarm_editor_callback) { data->alarm_editor_callback(DELETED, data->alarm_id, data->callback_context); } }
static ActionMenuLevel *prv_create_main_menu(void) { ActionMenuLevel *level = task_malloc(sizeof(ActionMenuLevel) + DetailMenuItemIndexNum * sizeof(ActionMenuItem)); if (!level) return NULL; *level = (ActionMenuLevel) { .num_items = DetailMenuItemIndexNum, .parent_level = NULL, .display_mode =...
sizeof(advert_terms_b)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert(job_b); cl_assert_equal_b(gap_le_is_advertising_enabled(), false); regular_timer_fire_seconds(1); cl_assert_equal_b(gap_le_is_ad...
cl_assert_equal_b(s_unscheduled_completed, true)
; // Expect A's fourth term: assert_ad_data("A"); cl_assert_equal_b(gap_le_is_advertising_enabled(), true); gap_le_assert_advertising_interval(advert_terms_a[3].min_interval_slots, advert_terms_a[3].max_interval_slots); regular_timer_fire_seconds(1); // Expect A to be...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(prv_send_ping_kernel_bg_cb, NULL)
; s_is_ping_kernel_bg_callback_scheduled = true; } static void prv_push_window(void *data) { SimpleDialog *s_dialog = simple_dialog_create("Ping"); Dialog *dialog = simple_dialog_get_dialog(s_dialog); dialog_set_background_color(dialog, GColorCobaltBlue); dialog_set_text_color(dialog, GColorWhite); 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...
core_dump_get_slot_address(index)
update; GTextNode *node = prv_structured_glance_create_text_node( structured_glance, structured_glance->subtitle_font, subtitle_buffer_size, prv_structured_glance_subtitle_dynamic_text_node_update); // Clip subtitle text nodes to their draw box since we scroll them if they're too long node->clip = tru...
(structured_glance, glance_frame)
; graphics_text_node_container_add_child(&horizontal_node->container, title_subtitle_node); return &horizontal_node->container.node; } static void prv_draw_processed(KinoReel *reel, GContext *ctx, GPoint offset, UNUSED KinoReelProcessor *proc...
----------------------------------- // Make sure we don't push a pin when we have no history to compare against void test_activity_insights__sleep_summary_no_history(void) { // Tests init with zero history activity_insights_init(rtc_get_time()); // Make sure we don't trigger as soon as we're awake s_data.metr...
(rtc_get_time() + 2 * SECONDS_PER_HOUR)
; prv_add_nap_session(0.5, 1.5); activity_insights_process_minute_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 2); #endif } // Make sure that when the watch resets, we retain state properly void test_activity_insights__walk_session_power_cycle(void) { activity_insights_init(rtc_get_time()); // ...
ack(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorClear); graphics_fill_round_rect(ctx, &GRect(2, 2, 28, 20), 4, GCornersAll); } void corners_clipped_update_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); ...
{ GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 32, 24)); layer_set_update_proc(&layer, &corners_all_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_corners_all.${BIT_DEPTH_NAME}.pbi")); layer_set_...
#define RECT_WIDTH 30 #define RECT_HEIGHT 40 #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_RECT_NO_CLIP GRect(6, 6, RECT_WIDTH, RECT_HEIGHT) #...
#include "services/common/system_task.h" static SharedCircularBuffer s_buffer; static SharedCircularBufferClient s_buffer_client; // 526 bytes is enough to buffer up the worst case bunch of reboot messages - a watchdog reset with a timer // callback. During normal operation, since log messages are hashed, most are onl...
(s_buffer_mutex)
; // If we failed to buffer this message, flush the buffer to cache to make room. // Otherwise, if this is a sync message, flush this message to flash. if (!success || !async) { handle_buffer_sync((void *)(uintptr_t) false /* !is_async */); } } while (!success); // Loop until the buffer copy su...
est_end_utc, time_t last_processed_utc) { *results = (SleepTestResults) { }; // Iterate through the sleep sessions KAlgTestSleepSession *session = s_captured_sleep_sessions; time_t enter_utc = 0; time_t exit_utc = 0; time_t deep_exit_utc = 0; uint16_t last_session_len_m = 0; uint16_t last_deep_session_...
cl_assert_equal_i(minute_data[j].orientation, exp_minutes[j].orientation)
ts(tuplets, 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...
cl_assert(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...
VoiceStatusSuccess: VOICE_LOG("Session setup successfully"); data->start_ms = prv_get_time_ms(); data->speech_detected = false; data->dictation_timeout = app_timer_register(DICTATION_TIMEOUT, prv_dictation_timeout_cb, data); // Update UI prv_set_mic_window_state(data, Stat...
prv_handle_dictation_error(data, event->status)
; break; case VoiceStatusRecognizerResponseError: VOICE_LOG("Result: speech not recognized"); prv_handle_dictation_error(data, event->status); break; case VoiceStatusTimeout: VOICE_LOG("Result: timeout"); if (!connection_service_peek_pebble_app_connection()) { data-...
uccess; } // ------------------------------------------------------------------------------------------- DEFINE_SYSCALL(int, sys_accel_manager_set_sampling_rate, AccelSessionRef session, AccelSamplingRate rate) { if (rate != ACCEL_SAMPLING_10HZ && rate != ACCEL_SAMPLING_25HZ && rate != ACCEL_SAMPLING...
sys_vibe_history_stop_collecting()
); timeline_item_destroy(item); attribute_list_destroy_list(&list); } static void prv_add_generic_pin(int32_t delta_time_s, bool has_subtitle) { const time_t now = rtc_get_time(); AttributeList list = {}; prv_set_timeline_icon(&list, TIMELINE_RESOURCE_NOTIFICATION_FLAG, 0); attribute_list_add_cstring(&lis...
prv_add_generic_pin(-5 * 60 * 60, has_subtitle)
; prv_add_sports_pin(-4 * 60 * 60, GColorBlack, is_ingame, !has_broadcaster); prv_add_activity_session_pin(-3 * 60 * 60, 30); prv_add_weather_pin_with_params(-2 * 60 * 60, !has_timestamp, !has_short_title, !has_short_subtitle); prv_add_weather_pin_with_param...
.today_low = entry->today_low_temp, .current_weather_type = entry->current_weather_type, .tomorrow_high = entry->tomorrow_high_temp, .tomorrow_low = entry->tomorrow_low_temp, .tomorrow_weather_type = entry->tomorrow_weather_type, .time_updated_utc = entry->last_update_time_utc, }; // add 1...
task_free(forecast_out)
; } free_entry: task_free(entry); cleanup: mutex_unlock(s_mutex); } WeatherLocationForecast *weather_service_create_default_forecast(void) { mutex_lock(s_mutex); WeatherLocationForecast *forecast = NULL; if (s_default_forecast) { forecast = task_zalloc_check(sizeof(WeatherLocationForecast)); *fore...
os = &g_gbitmap_spalding_data_row_infos; void test_gbitmap_formats__create_blank(void) { const GSize s10 = GSize(10, 10); const GSize s180 = GSize(180, 180); GBitmap *bmp = NULL; cl_assert((void*)&bmp->palette == (void*)&bmp->data_row_infos); // union with .palette cl_assert(NULL != g_gbitmap_spalding_data_...
(NULL != bmp)
; cl_assert(p == gbitmap_get_palette(bmp)); bmp = gbitmap_create_blank_with_palette(s10, GBitmapFormat4BitPalette, p, true); cl_assert(NULL == bmp); cl_assert(NULL == gbitmap_create_blank_with_palette(s10, GBitmapFormat8BitCircular, p, true)); cl_assert(NULL == gbitmap_create_blank_with_palette(s180, GBitma...
me_enabled) { return RESOURCE_ID_CONNECTIVITY_BLUETOOTH_DND; } else if (prv_mute_notifications_allow_calls_only()) { return RESOURCE_ID_CONNECTIVITY_BLUETOOTH_CALLS_ONLY; } else if (settings_glance->glance_state.is_pebble_app_connected) { return RESOURCE_ID_CONNECTIVITY_BLUETOOTH_CONNECTED; } else { ...
(LAUNCHER_MENU_LAYER_SUBTITLE_FONT)
); const bool should_consider_slices = false; LauncherAppGlanceStructured *structured_glance = launcher_app_glance_structured_create(&node->uuid, &s_settings_structured_glance_impl, should_consider_slices, settings_glance); PBL_ASSERTN(structured_glance); // Di...
, 16}, { -1520, 112, -80}, { -1464, 216, 88}, { -1288, 112, 48}, { -1136, 80, 48}, { -1000, -232, 192}, { -624, -480, -8}, { -888, -248, -96}, { -1288, -56, -112}, { -1552, 152, -272}, { -1600, -16, -184}, { -1616, -120, -136}, { -1656, 112, -136}, { -1552, 232, -128}...
{ -1552, 424, 48}, { -1488, 304, 80}, { -1448, 232, 88}, { -1504, 208, 72}, // 23 seconds { -1464, 200, 64}, { -1312, 184, 104}, { -1240, 152, 72}, { -1208, -56, 64}, { -960, -424, 40}, { -904, -240, -128}, { -1008, 32, -256}, { -1248, 160, -296}, { -1392, 88, -18...
{ -1152, 0, -136}, { -1216, 184, -240}, { -1344, 192, -216}, { -1488, -16, -40}, { -1584, 152, -176}, { -1440, 224, -136}, { -1288, 280, -24}, { -1240, 304, -32}, { -1256, 312, 0}, { -1240, 392, 16}, { -1040, 376, 24}, { -1160, 528, 24}, { -1088, 672, 88}, { -127...
reminders.h" #include "stubs_sleep.h" #include "stubs_task_watchdog.h" void reminders_handle_reminder_removed(const Uuid *reminder_id) { } static TimelineItem item1 = { .header = { .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4}, .parent_id...
reminder_db_delete((uint8_t*)&item1.header.id, sizeof(Uuid))
); cl_assert(reminder_db_get_len((uint8_t *)&item1.header.id, sizeof(Uuid)) == 0); // add 1 back so it's clean cl_assert(S_SUCCESS == reminder_db_insert_item(&item1)); TimelineItem temp = {{{0}}}; cl_assert(S_SUCCESS == reminder_db_read((uint8_t*)&item1.header.id, sizeof(Uuid), (uint8_t*)&temp, sizeof(...
= activity_sessions_prv_is_sleep_activity(session_b->type); if (any_sleep && a_is_sleep && b_is_sleep) { type_matches = true; } else { type_matches = (session_a->type == session_b->type); } return type_matches && (session_a->start_utc == session_b->start_utc); } // ---------------------------------...
if ((session->type != ActivitySessionType_RestfulSleep) && (session->type != ActivitySessionType_RestfulNap)) { continue; }
if ((session->start_utc >= start_utc) && ((time_t)(session->start_utc + (session->length_min * SECONDS_PER_MINUTE)) <= end_utc)) { restful_sec += session->length_min * SECONDS_PER_MINUTE; } } return restful_sec; } // --------------------------------------------------------------------------...
); fake_pbl_malloc_clear_tracking(); fake_comm_session_cleanup(); free(s_client_reset_request); free(s_client_reset_complete); } void prv_notify_services_discovered(int num_services_to_register) { for (int i = 0; i < s_num_service_instances && i < num_services_to_register; i++) { ppogatt_handle_service_...
cl_assert_equal_i(ppogatt_client_count(), 0)
; cl_assert_equal_b(ppogatt_has_client_for_uuid(&future_meta_non_compatible.app_uuid), false); } void test_ppogatt__handles_invalid_uuid_meta(void) { PPoGATTMetaV0 meta_invalid_uuid = s_meta_v0_system; meta_invalid_uuid.app_uuid = UUID_INVALID; prv_notify_services_discovered(1); ppogatt_handle_read_or_noti...
("%d", data), hundreds); } layer_mark_dirty(&data->base_layer); } static void prv_update_current_steps(KickstartData *data) { data->current_steps = health_service_sum_today(HealthMetricStepCount); prv_update_steps_buffer(data); } static void prv_update_typical_steps(KickstartData *data) { data-...
(FONT_KEY_AGENCY_FB_36_NUMBERS_AM_PM)
; data->time_font = fonts_get_system_font(FONT_KEY_AGENCY_FB_60_NUMBERS_AM_PM); data->am_pm_font = fonts_get_system_font(FONT_KEY_AGENCY_FB_60_THIN_NUMBERS_AM_PM); #else #error "Undefined screen size" #endif // ROBERT_SCREEN_RES #endif // PBL_BW Layer *window_layer = window_get_root_layer(window); // set wind...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(sys_timer_id)
== false); cl_assert_equal_i(s_last_event.type, PEBBLE_NULL_EVENT); } void test_evented_timer__repeating(void) { EventedTimerID e_timer = evented_timer_register(100, true, stub_evented_timer_callback, 0); // NOTE: We are leveraging the fact that we know the system timer ID is the same as the // EventedTimer ...
ouch touch_event = touch_event_queue_get_event(1, 0); cl_assert_equal_p(touch_event, NULL); // Test second touch touch_set_touch_state(1, TouchState_FingerDown, GPointZero, 0, 0); touch_handle_update(1, TouchState_FingerUp, &GPoint(1, 13), 0, 3686401); event = fake_event_get_last(); cl_assert_equal_i(eve...
touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400)
tificationNode *node = notification_list; notification_list = (NotificationNode*) list_pop_head((ListNode*) notification_list); app_free(node); } } static void prv_unload_loaded_notification(LoadedNotificationNode *loaded_notif) { timeline_item_free_allocated_buffer(&loaded_notif->notification); gdraw_co...
prv_loaded_notification_list_deinit(data->loaded_notification_list)
; data->loaded_notification_list = NULL; prv_notification_list_deinit(data->notification_list); data->notification_list = NULL; prv_load_notification_storage(data); actionable_dialog_pop(data->actionable_dialog); // Create and display DONE dialog SimpleDialog *confirmation_dialog = simple_dialog_create("...
cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); // rtc_set_time(rtc_get_time() + 1 * SECONDS_PER_DAY); // activity_insights_recalculate_stats(); // prv_minute_update(ACTIVE_MINUTES); // cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); } void ...
rtc_set_time(rtc_get_time() + 7 * SECONDS_PER_HOUR + 5 * SECONDS_PER_MINUTE); // Puts us at 7:05 prv_add_sleep_session(0, 7); // Make sure we update the existing pin as soon as we are awake. We shouldn't add another pin // because the sleep includes all sleep since ACTIVITY_LAST_SLEEP_MINUTE_OF_DAY (9pm) the ...
// --------------------------------------------------------------------------------------- // This makes sure the sleep summary properly handles the midnight rollover for non-UTC timezones // since when there's no sleep, the enter/exit times will be set to midnight UTC and the metrics // will return that time in loca...
/* * 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...
mfg_get_pcba_serial_number()
; cl_assert_equal_s(pcba_serial, "XXXXXXXXXXXX"); // Test writing & reading back: const char* written_pcba_serial1 = "01234567901"; command_pcba_serial_write(written_pcba_serial1); pcba_serial = mfg_get_pcba_serial_number(); cl_assert_equal_s(written_pcba_serial1, pcba_serial); // Write second time, but...
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_health_activity_summary_card__render_current_above_typical1(void) { HealthData health_data = { .step_data = 340, .step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, ...
extStyleFont_Header, TextStyleFont_Title)); s_phone_ui_data->status_font = PBL_IF_RECT_ELSE(system_theme_get_font(TextStyleFont_Header), fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD)); Window *window = &s_phone_ui_data->window; window_init(window, WINDOW_NAME("Phone")); window_se...
(window, ModalPriorityCritical, true /* animated */)
; } static bool prv_check_popups_are_blocked(void) { if (launcher_popups_are_blocked()) { PBL_LOG(LOG_LEVEL_INFO, "Ignoring call event. Popups are blocked"); return true; } return false; } //! //! API for updating / creating the phone UI //! void phone_ui_handle_incoming_call(PebblePhoneCaller *caller, ...
/* * 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...
(0b1, BITS(0))
Rect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); setup_test(&context, false, SW_ODD, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(...
framebuffer_init(&fb, &(GSize) {DISP_COLS, DISP_ROWS})
; GContext ctx = {.dest_bitmap.info = { .format = GBITMAP_NATIVE_FORMAT, .version = GBITMAP_VERSION_CURRENT, }, .parent_framebuffer=&fb}; GBitmap *framebuffer = graphics_capture_frame_buffer(&ctx); cl_assert(ctx.lock == true); cl_assert_equal_p(framebuffer, &ctx.dest_bitmap); // Test releasing on a...
) + indicator_text_margin; label_text_container.size.h -= bottom_inset; } #endif GRect label_text_frame = label_text_container; bool draw_top_shading = false; bool draw_bottom_shading = false; // If we are the selected index, check to see if we have started scrolling. // If we have, use our internal bo...
(aml->item_animation.animation)
; } if (new_selected_index >= aml->num_items) { // For short columns, aml->selected_index needs to be updated here, because the column index // will be lost in the menu layer selection changed callback. Otherwise, it will be updated // in prv_selection_changed_cb() to ensure the correct index is used b...
_size); cl_assert(result); } static int s_cleanup_calls; static void prv_cleanup_cb(const uintptr_t native_p) { ++s_cleanup_calls; } void test_js__js_value_cleanup(void) { s_cleanup_calls = 0; { // Sanity check: // we don't clean up when a bare jerry_value_t goes out of scope. jerry_value_t value...
cl_assert_equal_i(s_app_heap_analytics_log_rocky_heap_oom_fault_call_count, 1)
; }
/* * 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(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_health_hr_summary_card__render_timestamp(void) { rtc_set_time(SECONDS_PER_DAY + (SECONDS_PER_HOUR * 12)); HealthData health_data = { .current_hr_bpm = 110, .hr_last_updated = rtc_get_time() - (SECONDS_PER_MINUTE * 5), }; prv_create_card_and_render(&health_data); cl_check(gbitmap_pbi_...
, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id1, 10, 30, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule); // 2 pins should be added (for Thursday / Friday) cl_assert_equal_i(s_num_timeline_adds, 2); id2 = alarm_create(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_WEEKDAYS }); prv_...
cl_assert_equal_i(s_num_timeline_adds, 4)
; cl_assert_equal_i(s_num_timeline_removes, 2); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. No alarms should be up s_current_hour = 11; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 2); prv_assert_alarm...
cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // Start A after delay prv_advance_to_ms_with_timers(start_ms + delay_seq + delay_a + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_ca...
(start_ms + delay_spawn + delay_a + 2 * MIN_FRAME_INTERVAL_MS)
; cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_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)...
prv_display_alert(data->debug_card.dialog_text)
; } // ----------------------------------------------------------------------------------------- static void debug_window_load(Window *window) { HealthAPITestAppData *data = window_get_user_data(window); Layer *window_layer = window_get_root_layer(window); GRect bounds = layer_get_bounds(window_layer); stati...
t value) { JS_VAR prop_name = jerry_create_string((jerry_char_t *)field); JS_UNUSED_VAL = jerry_set_property(object, prop_name, value); } jerry_value_t jerry_get_object_field(jerry_value_t object, const char* field) { JS_VAR prop_name = jerry_create_string((jerry_char_t *) field); const bool has_property = jer...
(global, ROCKY_SINGLETON, v)
/* * 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_state_get_unobstructed_area_state()
but instead let the compositor animate. transition_insert = &g_window_transition_none_implementation; transition_pop = &g_window_transition_none_implementation; } // This is a backwards compatibility hack for legacy2 applications. By default, watchface // windows are not fullscreen until they're pushed...
{ prv_transition_to(window_from, window_to, transition); }
else { // We don't fire a transition in this case, but to ensure that all window-callbacks // will still be called and the click handler is managed correctly, we call the // appropriate helper functions manually with a fake transitioning context. WindowTransitioningContext ctx = { .window_from = ...
_sessions, sessions); if (!success) { snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "Error getting activity sessions"); goto exit; } snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "Step activities\n"); // Print info on...
rtc_get_time()
------------------------------------------------------ static struct { bool enabled; } s_hrm_state; void hrm_enable(HRMDevice *dev) { s_hrm_state.enabled = true; } void hrm_disable(HRMDevice *dev) { s_hrm_state.enabled = false; } bool hrm_is_enabled(HRMDevice *dev) { return s_hrm_state.enabled; } // --------------...
(session_ref)
16bit(0x1810); BLEService service; uint8_t num_copied = gatt_client_copy_service_refs_matching_uuid(&s_device, &service, 1, &service_uuid); cl_assert_equal_i(num_copied, 1); // UUID for indicatable Pressure Measurement characteristic: Uuid ch...
(characteristic, BLESubscriptionNotifications, GAPLEClientKernel)
} case SPORTS_CUSTOM_VALUE_KEY: { if (strncmp(new_tuple->value->cstring, data->custom_value_string, sizeof(data->custom_value_string)) != 0) { strncpy(data->custom_value_string, new_tuple->value->cstring, sizeof(data->custom_va...
(SPORTS_CUSTOM_VALUE_KEY, "")
}; app_sync_init(&data->sync, data->sync_buffer, sizeof(data->sync_buffer), initial_values, ARRAY_LENGTH(initial_values), prv_sync_tuple_changed_callback, prv_sync_error_callback, data); data->workout_controller = (WorkoutController) { .is_paused = prv_is_paused, .pause ...
millivolts = battery_convert_reading_to_millivolts(reading, mon_config->ratio, 1); prv_set_mon_config_register(0); prv_mon_config_unlock(); return (uint16_t)millivolts; } bool pmic_set_charger_state(bool enable) { // Defaults to ON // LSB is enable bit uint8_t register_value; if (!prv_read_register(Pmi...
prv_read_register(0x00, &val)
to the sleep PFS file. prv_feed_minute_data(ALG_MINUTES_PER_FILE_RECORD, minute_data, false /*simulate_bg_delays*/); uint32_t next_write_minute_idx = ALG_MINUTES_PER_FILE_RECORD; // Once a minute, retrieve the last ALG_MINUTES_PER_RECORD minutes of data. We should // get ALG_MINUTES_PER_RECORD records each tim...
cl_assert_equal_i(sessions[1].type, ActivitySessionType_RestfulNap)
; } { // Create a 4 hour session at 1pm ==> should be regular sleep ActivitySession sessions[] = { { .start_utc = start_of_today + (13 * (SECONDS_PER_HOUR)), // 1pm .length_min = 4 * MINUTES_PER_HOUR, .type = ActivitySessionType_Sleep, }, }; uint16_t session_entrie...
552, -192, 152}, { 424, -400, 368}, { 744, 200, 296}, { 664, 2368, 816}, { 704, 2200, 368}, { 184, 1832, 288}, { -160, 1424, -16}, { -416, 816, -56}, { -704, 224, -80}, { -616, 80, -184}, { -376, -24, -88}, { -280, 584, 32}, { -408, 2680, 560}, { -88, 2312, 872}, ...
// 40 seconds { 480, 824, 224}, { 448, 360, 88}, { 488, -112, 48}, { 576, -328, 152}, { 464, -288, 296}, { 920, 648, 480}, { 288, 2696, 840}, { 344, 2336, 384}, { -48, 1736, 280}, { -320, 1248, 72}, { -424, 632, 32}, { -632, 184, -184}, { -416, 112, -288}, { -...
HIN(start_minute, ALG_PRIMARY_MORNING_MINUTE, ALG_PRIMARY_EVENING_MINUTE) || !WITHIN(end_minute, ALG_PRIMARY_MORNING_MINUTE, ALG_PRIMARY_EVENING_MINUTE)) { // If too long, or not within the primary sleep range, can't be a nap ACTIVITY_LOG_DEBUG("Not within nap time bounds or duration"); contin...
prv_activity_update_states(utc_sec, &record_out, true /* shutting_down */)
; prv_unlock(); } // ------------------------------------------------------------------------------------ bool activity_algorithm_deinit(void) { PBL_ASSERTN(s_alg_state); PBL_ASSERTN(s_alg_state->k_state); mutex_destroy((PebbleMutex *)s_alg_state->mutex); kernel_free(s_alg_state->k_state); kernel_free(s...
ionUUID static uint32_t s_call_identifier; // If the mobile app is closed we won't receive PP messages and thus might miss a call end event // which puts us in a bad state until BT disconnects static bool s_mobile_app_is_connected; // We can't expect iOS to reliably send us phone call events, so we must poll for the ...
if (!s_call_in_progress && s_mobile_app_is_connected) { phone_ui_handle_outgoing_call(event->caller); analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_OUTGOING_COUNT, AnalyticsClient_System); } else { // PBL_LOG(LOG_LEVEL_DEBUG, "Ignoring outgoing call. A call is already in progress: %d, " // "the...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
memcpy(key_copy, key, key_len)
*text_layer = &data->mic_window.text_layer; text_layer_init_with_parameters(text_layer, &GRect(0, dot_frame.origin.y + TEXT_LAYER_Y_OFFSET, root_frame->size.w, font_height * 2), NULL, font, ...
(&data->mic_window.status_bar)
; event_service_client_unsubscribe(&data->voice_event_sub); } static void prv_mic_window_disappear(Window *window) { VoiceUiData *data = window_get_user_data(window); if (data->state != StateError) { // Do not indicate that an error occurred when a session is interrupted by a window transition if (data->...
_animation(); animation_set_duration(c, duration_c); // Create a spawn out of b and c Animation *spawn = animation_spawn_create(b, c, NULL); cl_assert(spawn != NULL); // Create a sequence by putting a in front and repeat it 5 times // We now have a -> (b | c) Animation *seq = animation_sequence_create(a...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a0), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a0), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a1), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a1), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a2)...
ds] = { .u8 = 0.0, .u16 = 0.0, .u32 = 0.0, .u64 = 0.0, .s8 = -128.0, .s16 = -32768.0, .s32 = -2147483648.0, .s64 = -9223372036854775808.0, .d = 2.2250738585072014e-308, .expected_error_msg = NULL, }, [WithinUpperBounds] = { .u8 = 255.0, .u1...
ROCKY_ARG_MAKE(buffer_untouched, type, {})
, ); ASSERT_JS_ERROR(error_value, "TypeError: Argument at index 0 is not a Number"); } jerry_release_value(arg); mismatch_args[i] = 0; } } static jerry_value_t prv_dummy(const jerry_value_t function_obj_p, const jerry_value_t this_val, ...
, { -432, 720, 248}, { -448, 728, 272}, { -440, 728, 248}, { -448, 728, 256}, { -448, 744, 264}, { -440, 728, 264}, { -448, 736, 264}, { -448, 736, 264}, { -456, 744, 272}, { -448, 728, 264}, { -448, 736, 256}, { -448, 736, 256}, { -464, 736, 256}, { -456, 736, 25...
{ -432, 752, 248}, { -432, 744, 248}, { -432, 744, 248}, { -440, 744, 256}, { -432, 752, 248}, { -432, 744, 248}, { -424, 752, 248}, { -440, 744, 248}, { -432, 744, 256}, { -432, 752, 248}, // 123 seconds { -432, 744, 256}, { -424, 752, 240}, { -432, 744, 248}, ...
ata2, FLASH_TEST_ERR_DATA_WRITE, false); VERIFY_TEST_STATUS(status); halfwordcount++; if (halfwordcount*2 % (256*1024) == 0) { // Reading flash words (which are 16 bits) hence double if (iterations) { PBL_LOG(LOG_LEVEL_DEBUG, ">> Read 256KB, iteration: %d of %"PRId32, it...
prv_run_perf_data_test()
UTC static const int s_sunday_10_00 = 1427018400; // Sunday, March 22, 2015, 23:30 UTC static const int s_sunday_23_30 = 1427067000; // Monday, March 23, 2015, 10:30 UTC static const int s_monday_10_30 = 1427106600; static TimerID s_timer = TIMER_INVALID_ID; static bool s_event_ongoing = false; void calendar_init() ...
do_not_disturb_is_smart_dnd_enabled()
== false); active = do_not_disturb_is_active(); cl_assert(active == false); // Manual && !Scheduled && !Smart do_not_disturb_set_manually_enabled(true); cl_assert(do_not_disturb_is_manually_enabled() == true); cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == false); cl_assert(do_not_dist...
andler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 0); cl_assert_equal_i(prv_count_h...
(&s_teardown_handler_calls, c)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, d), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, d), 1); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, d), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, d)...