prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(native_framebuffer->info.format == GBitmapFormat8BitCircular)
; cl_assert(DISPLAY_FRAMEBUFFER_BYTES == 25944); bitblt_bitmap_into_bitmap(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE)); } // Tests 2-bit palettized PBI loading into gbitmap // Result: // - gbitmap matches platform loaded PBI ...
strlen(s_entry_names[index])
); char loc[WEATHER_SERVICE_MAX_WEATHER_LOCATION_BUFFER_SIZE]; pstring_pstring16_to_string(pstring, loc); cl_assert_equal_s(loc, s_entry_names[index]); pstring = pstring_get_pstring16_from_list(&pstring16_list, 1); cl_assert_equal_i(pstring->str_length, strlen(s_entry_phrases[index])); char phrase[WEATHER_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ int i; for (i = 0; i < CACHE_BUFFER_SIZE / (sizeof(CacheEntry) + sizeof(uint32_t)); ++i) { uint32_t input = i; lru_cache_put(&s_cache, i, &input); } // use entry 0 to keep it around uint32_t *output = lru_cache_get(&s_cache, 0); cl_assert(output); cl_assert(*output == 0); // add one more entr...
resolving_to_fake_irk(); BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_device(); // Register connection intent for kernel: e = gap_le_connect_connect_by_bonding(bonding_id, true /* auto_reconnect */, false /* is_pairin...
(&device, false /* connected */, (1 << PebbleTask_App) | (1 << PebbleTask_KernelMain), HCI_ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST)
; // Verify that the connection intent is still there for the Kernel: cl_assert_equal_i(gap_le_connect_connection_intents_count(), 1); cl_assert_equal_b(gap_le_connect_has_connection_intent(&device, GAPLEClientKernel), true); cl_assert_equal_b(gap_le_connect_has_connection_intent(&device, GAPLEClientApp), fals...
} } done: return erased; } // ARG: // 0 - Only show sectors // 1 - Show subsectors too if sector is not erased void command_flash_show_erased_sectors(const char *arg) { const bool show_subsectors = (atoi(arg) == 1); char buffer[64]; uint32_t addr = 0; while (addr < BOARD_NOR_FLASH_SIZE) { bool eras...
boot_bit_set(bit_mask)
; } else { prompt_send_response("invalid bit value, pick 1 or 0"); return; } prompt_send_response("OK bit assigned"); } typedef struct { ButtonId button_id; bool button_is_held_down; uint32_t num_presses_remaining; uint32_t hold_down_time_ms; uint32_t delay_between_presses_ms; } ButtonPressNewT...
_origin_rmax_bottomright.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_aa_corners(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Remove these #ifdefs in PBL-15916 when support for non-antialiased rounded rect #if SCREEN_COLOR_DEPTH_BITS == 8 setup_test_...
(prv_clamp_corner_radius(GSize(6, 10), GCornersAll, 4), 3)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
activity_private_compute_distance_mm(steps, time_ms)
/ MM_PER_METER; cl_assert_within(long_walk_distance_m, 48000, 52000); // A typical cadence is roughly 165 steps per minute const int running_cadence_spm = 165; // Running for 25 minutes should come out to roughly 5km const int run_time = 25; steps = running_cadence_spm * run_time; time_ms = run_time *...
bool disp_logs) { uint16_t write_buffer = write_val; uint16_t read_buffer = 0; // Write test pattern if (disp_logs) { PBL_LOG(LOG_LEVEL_DEBUG, ">> Writing Addr 0x%"PRIx32" to value 0x%"PRIx16, write_addr, write_val); } flash_write_bytes((uint8_t *)&write_buffer, write_addr, sizeof(write_bu...
if (display_logs) { PBL_LOG(LOG_LEVEL_DEBUG, ">>> Erasing sectors..."); }
if (erase_addr) { // only erase the specific erase address if (display_logs) { PBL_LOG(LOG_LEVEL_DEBUG, ">> Erasing Addr 0x%"PRIx32, *erase_addr); } flash_erase_sector_blocking(*erase_addr); } else { // Erase the addresses within test range that we will touch. These are addresses with ...
GColorBlack, GColorClear, GTextAlignmentCenter, GTextOverflowModeTrailingEllipsis); layer_add_child(window_layer, text_layer_get_layer(&data->info_text)); } static void prv_kcc_window_unload(Window *window) { SystemCertificationData *data = (SystemCertificationData *) ...
prv_shutdown_enabled()
) { launcher_task_add_callback(prv_shutdown_cb, 0); } break; case SystemMenuItemFactoryReset: settings_factory_reset_window_push(); break; default: WTF; } settings_menu_reload_data(SettingsMenuItemSystem); } static uint16_t prv_num_rows_cb(SettingsCallbacks *context) {...
iased(ctx, true); graphics_context_set_stroke_width(ctx, data->stroke_width); if (data->stroke_width >= 2) { graphics_line_draw_precise_stroked_aa(ctx, p0, p1, data->stroke_width); } else { graphics_draw_line(ctx, GPoint(p0.x.integer, p0.y.integer), GPoint(p1.x.integer, ...
app_timer_register(30, timer_callback, NULL)
; } static void deinit(void) { AppData *data = window_get_user_data(s_window); task_free(data); window_destroy(s_window); } static void s_main(void) { init(); app_event_loop(); deinit(); } const PebbleProcessMd* stroke_width_get_app_info(void) { static const PebbleProcessMdSystem s_app_info = { .co...
} char key[HEALTH_DB_MAX_KEY_LEN]; snprintf(key, HEALTH_DB_MAX_KEY_LEN, "average%s", (metric == ActivityMetricStepCount) ? STEP_AVERAGE_KEY_SUFFIX : SLEEP_AVERAGE_KEY_SUFFIX); const int key_len = strlen(key); status_t s = settings_file_get(&file, key, key_len, value_out, sizeof(uint32_t)); prv_f...
(key, key_len)
) { return E_INVALID_ARGUMENT; } SettingsFile file; status_t rv = prv_file_open_and_lock(&file); if (rv != S_SUCCESS) { return rv; } rv = settings_file_delete(&file, key, key_len); prv_file_close_and_unlock(&file); return rv; } status_t health_db_flush(void) { mutex_lock(s_mutex); statu...
///////////////////////// void test_scroll_layer__enable_paging(void) { GRect scroll_bounds = GRect(0,0,180,180); ScrollLayer *scroll_layer = scroll_layer_create(scroll_bounds); // Verify paging is disabled by default cl_assert_equal_b(false, prv_scroll_layer_is_paging_enabled(scroll_layer)); // Verify shad...
(180, page_height * pages + 10)
; scroll_layer_set_content_size(scroll_layer, content_size); // paging should force full contents of last page to show // so content size rounded up to the next modulo of page_height cl_assert_equal_i(offset, -scroll_layer_get_content_offset(scroll_layer).y); scroll_layer_scroll(scroll_layer, ScrollDirectio...
(data->view_model.cur_level->parent_level == anim_ctx->next_level) { --data->view_model.num_dots; } else { ++data->view_model.num_dots; } data->view_model.cur_level = anim_ctx->next_level; // update the view prv_view_model_did_change(data); applib_free(anim_ctx); } static GEdgeInsets prv_action_me...
prv_set_level(data, parent_level)
; } else { prv_action_window_pop(true, &data->action_menu); } } static void prv_click_config_provider(void *context) { ActionMenuData *data = context; action_menu_layer_click_config_provider(&data->action_menu_layer); window_single_click_subscribe(BUTTON_ID_BACK, prv_back_click_handler); window_set_cli...
TimelineIterDirectionFuture) < 0)); } static bool prv_peek_filter(SerializedTimelineItemHeader *header, void **context) { PeekUpdateContext *update = *(PeekUpdateContext **)context; const time_t now = rtc_get_time(); const time_t start = header->common.timestamp; const time_t end = start + (header->com...
(new_header, old_header, context)
eHdr *hdr = (PLogMessageHdr *)buffer; bool success = protobuf_log_private_mset_decode( &s_parsed_msg.type, (uint8_t *)buffer + sizeof(*hdr), hdr->msg_size, s_parsed_msg.payload_sender_type, s_parsed_msg.payload_sender_id, s_parsed_msg.payload_sender_version_patch, &s_parsed_m...
("payload_sender_version: major: %"PRIu32", minor: %"PRIu32", patch: %s", s_parsed_msg.payload_sender_v_major, s_parsed_msg.payload_sender_v_minor, s_parsed_msg.payload_sender_version_patch)
104}, { 1632, 80, 232}, { 1744, -72, 384}, // 18 seconds { 1776, -160, 248}, { 1504, -80, 216}, { 1280, -64, 160}, { 1080, -88, 72}, { 960, -136, 96}, { 832, -200, -8}, { 768, -224, -40}, { 848, -272, -16}, { 984, -400, 8}, { 992, -240, 32}, { 1040, -200, 0}, ...
{ 976, 248, 128}, { 1192, 168, 208}, { 1440, 352, -16}, { 1496, 576, 32}, { 1472, 640, -8}, { 1400, 328, 16}, { 1296, 448, 48}, { 1608, 264, 64}, { 1760, 8, 304}, { 1816, -240, 280}, { 1584, -256, 72}, // 24 seconds { 1368, -48, 208}, { 1000, -224, 144}, { 880...
{ 1448, -192, -8}, { 1576, -56, -144}, { 1456, -104, -8}, { 1168, -120, 48}, { 1000, -16, 184}, { 992, 96, 208}, { 1144, 144, 96}, { 1440, 264, 0}, { 1400, 176, 16}, { 1488, 520, -16}, { 1728, 656, 72}, { 936, 296, -16}, { 1568, 224, 136}, { 1848, 80, 336}, {...
head = NULL; // free the currently allocated item in the iterator timeline_item_free_allocated_buffer(&iter_state->pin); iter_init(iter, prv_iter_dummy, prv_iter_dummy, iter_state); } void timeline_iter_refresh_pin(TimelineIterState *iter_state) { // no-op if the item doesn't exist if (timeline_exists(&iter...
("Dismissed", &i18n_key)
, TIMELINE_RESOURCE_RESULT_DISMISSED, ActionResultTypeSuccess); } static void prv_perform_ancs_negative_action(const TimelineItem *item, const TimelineItemAction *action) { uint8_t action_id = attribute_get_uint8(&action->attr_list, At...
put_msg, sizeof(incomplete_put_msg)); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__commit_message_sent_while_previous_put_was_not_acked_yet(void) { uint8_t max_put_ops = prv_put_bytes_get_max_batched_pb_ops(); prv_receive_init(VALID_OBJECT_SIZE * max_put_o...
{ prv_receive_init_put_and_commit_fw_object(); prv_receive_install(~s_last_response_cookie); assert_ack_count(0); assert_nack_count(1); }
void test_put_bytes__install_message_prf_boot_bit_set(void) { prv_receive_init_put_commit_and_install(ObjectRecovery); assert_ack_count(1); assert_nack_count(0); cl_assert_equal_i((s_boot_bits_orred & BOOT_BIT_NEW_PRF_AVAILABLE), BOOT_BIT_NEW_PRF_AVAILABLE); } void test_put_bytes__install_message_fw_and_sys_...
{ title = NULL; } } if (title && title->length > 0) { *buffer = prv_add_pstring_to_attribute(*buffer, title, TITLE_MAX_LENGTH, &item->attr_list.attributes[attr_idx], AttributeIdTitle); attr_idx++; } if (dis...
prv_should_hide_reply_because_group_sms(pbl_action, app_id, subtitle)
) { continue; } *buffer = prv_fill_pebble_ancs_action(buffer, buf_end, action, pbl_action); action++; } } } TimelineItem *ancs_item_create_and_populate(ANCSAttribute *notif_attributes[], ANCSAttribute *app_attributes[], ...
represents how framebuffer discards it in display. // Also needed for unit tests since PNG tests interpret alpha color.a = 3; line[point.x] = color.argb; } } #endif #if PBL_BW static inline void set_pixel_raw_2bit(GContext* ctx, GPoint point) { if (!grect_contains_point(&ctx->dest_bitmap.bounds, &point...
(clip_box)
- 1)) { return; } const int16_t min_valid_x = clip_box->origin.x; if (x1.integer < min_valid_x) { x1 = (Fixed_S16_3){.integer = min_valid_x, .fraction = 0}; } const int16_t max_valid_x = grect_get_max_x(clip_box) - 1; if (x2.integer > max_valid_x) { x2 = (Fixed_S16_3){.integer = max_valid_x};...
ore_dump_from_isr(); return; } // We now know how many bytes to receive / send: s_spi_transport.bytes_receivable_count = MIN(s_spi_transport.status_local->bytes_receivable_count, s_spi_transport.status_remote.bytes_sendable_count); s_spi_transport.bytes_sendab...
prv_handle_int_waiting_for_sending()
; break; case SPITransportState_WaitingForSending_Footer: prv_handle_int_waiting_for_sending_footer(); break; case SPITransportState_StatusExchange: case SPITransportState_Receiving: case SPITransportState_Sending: case SPITransportState_Receiving_Footer: case SPITransportSta...
ssionType_Walk: case ActivitySessionType_Run: case ActivitySessionType_Open: return false; case ActivitySessionType_None: case ActivitySessionTypeCount: break; } WTF; } // ------------------------------------------------------------------------------------ uint16_t s_activity_sessions_c...
{ return true; }
uint32_t kalg_analyze_samples(KAlgState *state, AccelRawData *data, uint32_t num_samples, uint32_t *consumed_samples) { *consumed_samples = 0; return s_alg_next_steps; } void kalg_minute_stats(KAlgState *state, uint16_t *vmc, uint8_t *orientation, bool *still) { *vmc = s_alg_next_...
/* * 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...
(false, s_get_called)
; cl_assert_equal_b(false, s_close_called); } void test_app_session_capabilities__cache_file_and_not_connected(void) { s_has_cache = true; s_get_value = CommSessionInfiniteLogDumping; bool has_cap = comm_session_current_app_session_cache_has_capability(CommSessionInfiniteLogDumping); cl_assert_equal_b(...
/* * 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...
dls_create(DlsSystemTagProtobufLogSession, DATA_LOGGING_BYTE_ARRAY, PLOG_DLS_RECORD_SIZE, buffered, resume, &system_uuid)
r_state->pin); timeline_iter_state->current_day = time_util_get_midnight_of( timeline_iter_state->node->timestamp); timeline_iter_state->index = timeline_iter_state->node->index; #ifdef TIMELINE_SERVICE_DEBUG prv_debug_print_pins(timeline_iter_state->node); #endif return (rv == S_SUCCESS); } static bool pr...
if (a == NULL || b == NULL) { return (a == b); }
4 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 writing, software...
string_list_get_at(list, 0)
ss or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "pebble.h" #include <stdlib.h> static Window *window; static TextLayer *s_text_layer_a; static TextLayer *s_text_layer_b; static Animation *s_animation; static int toggle; #define D...
animation_set_curve((Animation*) a_rev, AnimationCurveEaseOut)
/* * 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_fill_color(ctx, GColorWhite)
faithful" : "faithful"); prv_file_set(&IS_UNFAITHFUL_KEY, sizeof(IS_UNFAITHFUL_KEY), &is_unfaithful, sizeof(is_unfaithful)); } bool bt_persistent_storage_get_root_key(SMRootKeyType key_type, SM128BitKey *key_out) { SM128BitKey keys[SMRootKeyTypeNum]; int read_size = prv_file_get(&ROOT_KEYS_KEY, si...
prv_load_cached_system_capabilities(&s_cached_system_capabilities)
/* * 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...
emx_resources_remove_custom(id_2)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(s_bitblt_bitmap_into_bitmap_tiled_calls.call_count, 1)
; // Passing a processor with NULL functions shouldn't cause any problems GBitmapProcessor processor = {0}; graphics_draw_bitmap_in_rect_processed(&s_ctx, &bitmap, &rect, &processor); // And it should once again try to draw the bitmap cl_assert_equal_i(s_bitblt_bitmap_into_bitmap_tiled_calls.call_count, 2); ...
GTextOverflowModeTrailingEllipsis); layer_add_child(&window->window.layer, &window->bitmap_layer.layer); layer_add_child(&window->window.layer, &window->text_layer.layer); window_set_click_config_provider(&window->window, prv_no_music_window_click_config); return window; } static void prv_p...
(text_layer, rect, text_buffer, font, GColorBlack, GColorClear, align, GTextOverflowModeFill)
; layer_set_bounds(&text_layer->layer, &GRect(0, -y_offset, rect->size.w, rect->size.h + y_offset)); } static void prv_init_ui(Window *window) { MusicAppData *data = window_get_user_data(window); window_set_background_color(window, PBL_IF_COLOR_ELSE(GColorLightGray,...
indicate a lookup of the current task #define PEBBLE_TASK_CURRENT PebbleTask_Unknown #define US_PER_SECOND (1000 * 1000) typedef void (*ProcessDataHandler)(CallbackEventCallback *cb, void *data); // We create one of these for each data service subscriber typedef struct AccelManagerState { ListNode list_node; ...
(s_double_tap_subscribers_count > 0)
; if (--s_double_tap_subscribers_count == 0) { PBL_LOG(LOG_LEVEL_DEBUG, "Stopping accel double tap service"); accel_enable_double_tap_detection(false); prv_setup_subsampling(accel_get_sampling_interval()); } mutex_unlock_recursive(s_accel_manager_mutex); } //! Out of all accel subscribers, figures ...
onal fields don't get overwritten bt_persistent_storage_get_bt_classic_pairing_by_addr(address, &new_data.bt_classic_data.link_key, new_data.bt_classic_data.name, ...
prv_get_key_for_bt_classic_addr(addr_in)
; if (!bt_persistent_storage_get_bt_classic_pairing_by_id(key, NULL, link_key_out, name_out, platform_bits_out)) { return BT_BONDING_ID_INVALID; } return key; } bool bt_persistent_storage_has_active_bt_classic_gateway_bonding(void) { return prv_has_active...
c bool s_sent_data; //! The callback for a stream being sent via accessory_send_stream() static volatile AccessoryDataStreamCallback s_stream_cb; //! Context passed to accessory_send_stream() static void *s_stream_context; //! Semaphore used for accessory_send_stream() static SemaphoreHandle_t s_send_semaphore; //! Mut...
{ // First time seeing data, let's go active s_stop_mode_monitor.active = true; s_stop_mode_monitor.intervals_without_data = 0; s_stop_mode_monitor.max_intervals_without_data = ACCESSORY_INITIAL_STOP_INTERVALS; stop_mode_disable(InhibitorAccessory); // Need to flip tasks because we can't star...
s_stop_mode_monitor.data_seen_this_interval = true; } //! The UART peripheral only runs if the accessory is not in stop mode. We listen to the txrx //! pin on the accessory connector and if we see anything we'll disable stop mode for a few //! seconds to see if anyone has something to say. static void prv_initiali...
, size_t length, uint32_t timeout_ms) { SendBuffer *sb = comm_session_send_buffer_begin_write(session, endpoint_id, length, timeout_ms); if (!sb) { return false; } comm_session_send_buffer_write(sb, data, length); comm_session_send_buffer_end_write(sb); return true; } CommSession * comm_session_open(Tr...
{ // Already writing, fake doesn't support multiple tasks trying to write at the same time return NULL; }
session->temp_write_buffer = (uint8_t *) kernel_malloc(session->max_out_payload_length); session->bytes_written = 0; session->endpoint_id = endpoint_id; return (SendBuffer *) session; } bool comm_session_send_buffer_write(SendBuffer *sb, const uint8_t *data, size_t length) { CommSession *session = (CommSess...
); if (strlen(number_text_node->text) > 5) { number_text_node->font = prv_get_number_font(false); } break; } case WorkoutMetricType_Duration: { const size_t buffer_size = sizeof("00:00:00"); GTextNodeText *number_text_node = health_util_create_text_node(buffer_size, num...
if (is_paused) { action_bar_layer_set_icon(action_bar, active_window->pause_button, active_window->action_bar_start); if (can_stop) { action_bar_layer_set_icon(action_bar, BUTTON_ID_SELECT, active_window->action_bar_stop); } } else { action_bar_layer_clear_icon(acti...
if (active_window->num_scrollable_metrics > 1) { action_bar_layer_set_icon(action_bar, BUTTON_ID_DOWN, active_window->action_bar_next); } } static void prv_update_ui(WorkoutActiveWindow *active_window) { if (window_manager_is_window_visible(&active_window->window)) { layer_mark_dirty(&active_window->ba...
HealthMetricSleepRestfulSeconds: case HealthMetricRestingKCalories: case HealthMetricActiveKCalories: return HealthAggregationSum; case HealthMetricHeartRateBPM: case HealthMetricHeartRateRawBPM: return HealthAggregationAvg; } WTF; return 0; } // -------------------------------------...
prv_interval_within_last_minute(now_utc, time_start, time_end)
; return ((agg == HealthAggregationAvg) && query_cur_minute); } case HealthMetricHeartRateBPM: // For heart rate, we can only support avg, min, max with constraints on time switch (agg) { case HealthAggregationSum: return false; case HealthAggregationAvg: { ...
/* * 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 (radial_padding_size != 0) { prv_draw_round_border(layer, ctx, 0); }
-976}, { -256, -88, -1088}, { -16, -8, -1232}, { 32, 0, -1072}, { -8, 56, -928}, { 24, -144, -808}, { 104, -24, -696}, { 136, 456, -448}, { -40, 768, -432}, { -120, 968, -200}, { -104, 904, 8}, { -112, 872, 16}, { -208, 912, 312}, { -400, 1000, 624}, // 24 seconds...
{ 944, -112, -248}, { 888, -8, -208}, { 1152, 112, -264}, { 1224, 176, -216}, { 1016, 168, -80}, { 936, 176, -72}, { 984, 224, -64}, { 1096, 296, -40}, { 1168, 336, -24}, { 1008, 400, -64}, { 1272, 520, -104}, { 1240, 720, 24}, { 1216, 680, 56}, { 1264, 648, -16},...
{ 888, 528, 88}, { 936, 440, 16}, { 1104, 424, 0}, // 32 seconds { 1184, 392, -16}, { 1144, 288, -96}, { 1200, 64, 32}, { 1232, 120, 72}, { 1272, 120, -16}, { 1144, 144, -104}, { 928, 88, -56}, { 1136, 128, -152}, { 856, 8, -208}, { 1000, -64, -168}, { 1120, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_s(dstbuf, "What is the %d")
; } void test_sprintf__truncate(void) { char dstbuf[256]; memset(dstbuf, 0xFF, 256); cl_assert_equal_i(snprintf(dstbuf, 17, "Hello!\nI am error"), 17); cl_assert_equal_m(dstbuf, "Hello!\nI am erro\0\xFF", 18); memset(dstbuf, 0xFF, 256); cl_assert_equal_i(snprintf(dstbuf, 15, "Hello!\nI am error"), 17); ...
RNER, }, }, // We don't have one for Left or Down because the shutter will not be drawn on those. [CompositorTransitionDirectionRight] = { .wedge_verts = { // TL: 0,0 -> 50,0 (0.35) { { 0, 0 }, { DISP_COLS * 0.35, 0 }, }, // ML: 0,50 (0.3) -> 0,117 (0.7) { { ...
(&ctx->draw_state.drawing_box.origin, point)
PACKED { uint32_t init_req_magic; uint32_t append_offset; } InitRequestExtraInfo; typedef struct PACKED { PutBytesCommand cmd:8; uint32_t total_size; PutBytesObjectType type:7; bool has_cookie:1; union { struct { const uint8_t index; ///< The 0-indexed position for 'banked' objects. char ...
{ taskENTER_CRITICAL(); }
static void prv_unlock_pb_job_state(void) { taskEXIT_CRITICAL(); } //! Simply returns the next free buffer from the PB jobs array. Returns NULL if none are available static uint8_t *prv_get_next_pb_job_buffer(void) { PutBytesPendingJobs *put_jobs = &s_pb_state.pb_pending_jobs; uint8_t write_idx, jobs_pending;...
/* * 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...
{ *kino_layer = (KinoLayer){}; // init layer layer_init(&kino_layer->layer, frame); layer_set_update_proc(&kino_layer->layer, prv_update_proc); // init kino layer kino_layer->background_color = GColorClear; // init kino player kino_player_set_callbacks(&kino_layer->player, (KinoPlayerCallbacks){ .fr...
void kino_layer_deinit(KinoLayer *kino_layer) { kino_player_deinit(&kino_layer->player); layer_deinit(&kino_layer->layer); } KinoLayer *kino_layer_create(GRect frame) { KinoLayer *layer = applib_type_malloc(KinoLayer); if (layer) { kino_layer_init(layer, &frame); } return layer; } void kino_layer_d...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if ((num_data == 0) || (num_values == 0)) { return 0; }
uint32_t less; uint32_t greater; uint32_t equal; int32_t guess; int32_t max_lt_guess; int32_t min_gt_guess; while (1) { guess = (min + max) / 2; less = 0; greater = 0; equal = 0; max_lt_guess = min; min_gt_guess = max; for (uint32_t i = 0; i < num_data; ++i) { const in...
axis) int draw_min = 0; int draw_max = radius_outer_y.integer; // Adjust to drawing_box offset int adjusted_center = center.y.integer + ctx->draw_state.drawing_box.origin.y; // We add one to compenaste in case of odd line needs to be drawn int adjusted_top = adjusted_center - radius_outer_y.integer - 1; ...
(y_middle, center, config.end_quadrant.quadrant, &ending_edge, &starting_edge, end_top, end_bottom)
; } } int16_t outer_edge = prv_get_ellipsis_border(y, radius_outer_y_sq, radius_outer_x_sq).raw_value; int16_t left = center.x.raw_value - outer_edge; int16_t right = center.x.raw_value + outer_edge; if (!no_innner_ellipsis && radius_inner_y.integer != 0) { // This complicates the situ...
20, -240}, { 120, 944, -336}, { 112, 976, -312}, { 88, 1080, -288}, { 128, 1080, -312}, { 168, 1064, -288}, { 152, 1008, -320}, { 168, 912, -336}, { 184, 952, -392}, // 68 seconds { 200, 960, -384}, { 200, 928, -352}, { 144, 936, -320}, { 120, 952, -328}, { 112, 8...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_28386_5 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { 328, -128, -936}, { 3...
{ 904, 168, -536}, { 984, 288, -560}, { 864, 264, -520}, { 840, 248, -536}, { 832, 248, -536}, { 824, 216, -544}, { 872, 392, -624}, { 912, -88, -496}, { 880, -64, -576}, { 768, -24, -600}, { 672, -8, -528}, { 600, 64, -408}, { 624, 224, -384}, { 688, 528, -416},...
ption_info_valid); cl_assert_equal_b(pairing_info->is_local_encryption_info_valid, pairing_info_out.is_local_encryption_info_valid); cl_assert_equal_i(pairing_info->local_encryption_info.ediv, pairing_info_out.local_encryption_info.ediv); cl_assert_equal_i(pairing_info->loc...
(&out_addr, device_name_out, &link_key_out, &platform_bits_out)
, true); cl_assert_equal_i(strcmp(device_name_out, device_name), 0); cl_assert_equal_i(memcmp(&out_addr, &addr, sizeof(addr)), 0); cl_assert_equal_i(memcmp(&link_key_out, &link_key_out, sizeof(link_key)), 0); cl_assert_equal_i(platform_bits_out, 0xaa); shared_prf_storage_erase_bt_classic_pairing_data(); cl...
prv_run_next_job(connection)
; } unlock: bt_unlock(); return ret_val; } //! extern for gap_le_connnection.c //! Cleans up any state and frees the associated memory of all the things this module might have //! created for a given connection. //! bt_lock() is assumed to be taken by the caller void gatt_client_discovery_cleanup_by_connection(G...
um_alarm_events_put = 0; s_num_alarms_fired = 0; s_last_vmc = 0; s_rand = 0; // Setup time TimezoneInfo tz_info = { .tm_zone = "UTC", }; time_util_update_timezone(&tz_info); rtc_set_timezone(&tz_info); // Default to Thursday prv_set_time(s_thursday, 0, 0); timeline_item_destroy(s_last_timel...
cl_assert_equal_i(s_num_alarm_events_put, 0)
; // Afterwards, the alarm snooze timer triggers every 5min const int num_checks = 3; for (int i = 0; i < num_checks; i++) { // Step forward time and increase light sleep duration s_sleep_state_seconds += 5 * SECONDS_PER_MINUTE; s_last_vmc = i == 2 ? 1 : 0; prv_set_time(s_current_day, 10, (i + 1)...
{1}, 1, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible); ...
cl_assert_equal_i(r2->state, RecognizerState_Started)
; cl_assert(!recognizer_get_manager(r1)); recognizer_set_manager(r1, &manager); recognizer_set_simultaneous_with(r2, prv_simultaneous_with_cb); r1->state = RecognizerState_Started; r2->state = RecognizerState_Started; manager.triggered = r1; manager.state = RecognizerManagerState_RecognizersTriggered; ...
}, { -936, 358, -128}, { -833, 497, -102}, { -782, 576, -113}, { -774, 534, -104}, { -798, 395, -78}, { -801, 330, -25}, { -849, 397, -49}, { -879, 440, -35}, { -875, 421, 0}, { -841, 395, 46}, { -983, 424, 95}, { -1097, 478, 126}, { -983, 499, 146}, { -854, 450, ...
if ((minute % 10) == 0) { activity_test_feed_samples(s_walk_30_steps, 10 * SAMPLES_PER_SECOND); prv_feed_idle_movement_sec(50); } else { prv_feed_idle_movement_sec(60); }
activity_test_run_minute_callback(); rtc_set_time(rtc_get_time() + SECONDS_PER_MINUTE); prv_clear_event_queue(); } } // ------------------------------------------------------------------------------- // Feed in N minutes of deep sleep static void prv_feed_deep_sleep_min(uint32_t minutes) { // Deep sle...
ived: %"PRIu8"; state:%"PRIu8, event->type, simple_state); switch (simple_state) { case StateWaitForReady: if (event->type == VoiceEventTypeSessionSetup) { prv_handle_ready_event(data, event); } break; case StateWaitForResponse: if (event->type == VoiceEventTypeSessionResult) ...
property_animation_set_to_int16(anim, &to)
/* * 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...
(x, y, w, h)
); } x = left_margin_px; w = bounds->size.w - left_margin_px - right_margin_px; GTextAttributes *text_attributes = NULL; #if PBL_ROUND // Create a GTextAttributes for the TextLayer. Note that the matching // graphics_text_attributes_destroy() will not need to be called here, as the ownership // of text_...
04}, { 968, 312, 48}, { 936, 368, -24}, { 1104, 424, -56}, { 1256, 488, 8}, { 1784, 608, 48}, { 1424, 448, 104}, { 1064, 232, 80}, { 1328, 200, 120}, { 1480, 72, 248}, { 1424, 64, 256}, { 1232, -8, 296}, { 1088, -8, 232}, { 984, 0, 216}, // 22 seconds { 856, 8...
{ 1408, 408, -8}, { 1704, 480, 24}, { 1384, 520, 40}, { 904, 312, 32}, { 1160, 216, 72}, { 1360, 136, 200}, { 1232, 48, 320}, { 1056, 64, 232}, { 960, 48, 168}, { 896, -16, 248}, { 800, -8, 208}, { 752, 16, 96}, { 704, 0, 16}, { 816, 56, -112}, { 1016, 64, -18...
{ 936, 88, -192}, { 1336, -152, -56}, { 1680, -296, 264}, { 1552, 96, 160}, { 1296, 432, -208}, { 1264, 232, -40}, { 1280, 152, 312}, { 1208, 304, 328}, { 1080, 376, 328}, { 856, 384, 184}, { 760, 304, 88}, { 792, 400, -96}, { 992, 440, -128}, { 1144, 328, -56}, ...
DECIMAL_LENGTH, i18n_owner, active_window->workout_data); #if PBL_RECT /// MI/KM units string const char *units_string = active_window->workout_controller->get_distance_string( i18n...
{ const size_t buffer_size = sizeof("00:00:00"); GTextNodeText *number_text_node = health_util_create_text_node(buffer_size, number_font, TEXT_COLOR, container); active_window->workout_controller->metric_to_string(metric_type, ...
// don't have default here so when we have a new type, we don't forget to add it here case WorkoutMetricType_None: case WorkoutMetricTypeCount: break; } return &container->node; } static void prv_set_action_bar_icons(WorkoutActiveWindow *active_window) { ActionBarLayer *action_bar = &active_w...
icense"); * 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, * ...
comm_session_is_valid(session)
) { session->protocol_capabilities = capability_flags; } bt_unlock(); if (comm_session_is_system(session)) { const PebbleProtocolCapabilities capabilities = { .flags = capability_flags }; bt_persistent_storage_set_cached_system_capabilities(&capabilities); } } //! Resets the session (close and at...
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 wri...
window_set_on_screen(&s_data.window, true, true)
; window_render(&s_data.window, &s_ctx); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); #endif } void test_kickstart__render_steps_above_typical(void) { prv_set_data(&s_data, 3528, 2500, 8000, 0); window_set_on_screen(&s_data.window, true, true); window_render(&s_data.window, &s_ctx); cl_che...
save_state(ActivitySettingsKeyInsightActivitySessionTime, &s_session_pin_state.start_utc, sizeof(s_session_pin_state.start_utc)); if (s_activity_session_settings.session.show_notification) { activity_insights_push_activity_session_notification(now_utc, session, 0, NULL); } } ...
(prv_settings_file_changed_cb)
; } static void prv_settings_file_changed_cb(void *data) { system_task_add_callback(prv_reload_settings, data); } static void prv_blobdb_event_handler(PebbleEvent *event, void *context) { PebbleBlobDBEvent *blobdb_event = &event->blob_db; if (blobdb_event->db_id != BlobDBIdPins) { // we only care about pins...
{ if (service) { list_foreach(service->glance_cache, prv_glance_cache_deinit_foreach_cb, service); service->glance_cache = NULL; } }
//! Don't call this directly; it's used by prv_get_glance_for_node() below static void prv_glance_cache_put(LauncherAppGlanceService *service, const Uuid *uuid, LauncherAppGlance *glance) { if (!service || !uuid || !glance) { return; } // If necessary, evict the LRU cache e...
s, size_t num_slots, const char *data, size_t data_size, uint8_t *out_index) { for (unsigned int i = 0; i < num_slots; ++i) { const uint8_t index = slot_indices[i]; const OtpWriteResult result = otp_write_slo...
{ prompt_send_response("Incorrect length"); break; }
case MfgSerialsResultFailNoMoreSpace: { prompt_send_response("No more space!"); break; } case MfgSerialsResultSuccess: prompt_send_response("OK"); break; default: break; } } #if defined(IS_BIGBOARD) #include <stdio.h> #include "drivers/rtc.h" #include "system/logging.h...
336, 64}, { 1016, 304, 136}, { 928, 216, 208}, { 872, 208, 136}, { 872, 168, 176}, { 864, 136, 176}, { 936, 112, 176}, { 960, 64, 232}, { 1056, 88, 224}, { 1008, 120, 168}, { 1096, 120, 200}, { 912, 152, 72}, { 760, 240, -80}, { 768, 224, -80}, { 872, 208, 0}, ...
{ 824, 272, 88}, { 792, 288, 56}, { 848, 288, 56}, { 912, 264, 24}, { 1008, 288, 8}, { 1032, 328, -24}, { 1056, 320, -32}, { 1176, 352, -56}, { 1056, 328, -16}, { 920, 288, -48}, { 896, 304, -80}, { 1024, 288, -48}, { 1128, 200, 48}, { 1016, 144, 80}, { 928, 1...
{ 856, 128, 72}, { 872, 112, 72}, { 1016, 112, 88}, { 1040, 104, 104}, { 1144, 112, 120}, { 976, 136, 88}, { 920, 224, -8}, { 768, 264, -80}, { 848, 248, -56}, { 904, 144, 72}, { 920, 184, 72}, { 840, 224, 56}, { 784, 248, 32}, { 768, 224, 8}, { 816, 192, -8}...
resource(&s_app_icon_bitmap, node->icon_resource_id); return &s_app_icon_bitmap; } //! We use this function in the app glance service to create a key (the install ID) for an app //! glance cache entry; just fake it by constructing a 32-bit number from the first 4 bytes of the //! app's UUID AppInstallId app_install_...
{ app_glance_db_deinit(); gbitmap_deinit(&s_app_icon_bitmap); gbitmap_deinit(&s_default_app_icon_bitmap); free(fb); }
/* * 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...
{ mutex_lock_recursive(s_connection_lock); }
static void prv_unlock(void) { mutex_unlock_recursive(s_connection_lock); } Connection *connection_create(uint16_t conn_idx, const BTDeviceInternal *initial_addr, const BTDeviceAddress *local_addr, const BleConnectionParams *params) { ble_task_assert_is...
S" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "gdraw_command_sequence.h" #include "gdraw_command_private.h" #include "applib/applib_malloc.auto.h" #include "app...
prv_next_frame(frame)
}, .allocated_buffer = NULL, }, { .header = { // [2] .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb3}, .parent_id = {0}, .timestamp = 1421183642, // Tue Jan 13 13:14:02 2015 PST .duration = 2, .t...
(&s_items[s_correct_order[1]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)
); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(1)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx...
/* * 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...
(window_layer, text_layer_get_layer(text_layer))
; text_layer = text_layer_create((GRect) {{ 0, window_bounds.size.h / 2 }, window_bounds.size} ); static char buffer[80]; snprintf(buffer, sizeof(buffer), "FPS: %u", FPS); text_layer_set_text(text_layer, buffer); layer_add_child(window_layer, text_layer_get_layer(text_layer)); window_stack_push(window, tr...
lytics_logging_log_event() method will fill // in the common fields AnalyticsEventBlob event_blob = { .event = event_enum, .pin_open_create_update.time_utc = timestamp, .pin_open_create_update.parent_id = *parent_id, }; #if LOG_DOMAIN_ANALYTICS char uuid_string[UUID_STRING_BUFFER_LENGTH]; uuid_to...
ANALYTICS_LOG_DEBUG("canned response sent event: response_size_bytes:%d", event_blob.canned_response.response_size_bytes)
; } else { ANALYTICS_LOG_DEBUG("canned response failed event: response_size_bytes:%d", event_blob.canned_response.response_size_bytes); } analytics_logging_log_event(&event_blob); } // ------------------------------------------------------------------------------------------ // Log a...
void prv_cell_animation_stopped_handler(Animation *animation, bool finished, void *context) { ActionMenuLayer *aml = context; if (finished) { prv_set_cell_offset(aml, aml->item_animation.bottom_offset_y); } } static const PropertyAnimationImplementation s_item_animation_implementation = { .base = { .u...
((Animation *)r_animation, (AnimationHandlers){0}, aml)
; item_animation->animation = animation_sequence_create((Animation *)animation, (Animation *)s_animation, (Animation *)r_animation); animation_set_handlers(item_animation->animation, (AnimationHandlers){ .stopped = prv_cell_animation_stopped_handler }, ...
uint32_t key = 0; const int size = sizeof(test_uuid_a); Uuid uuid_buffer; cl_assert_equal_i(persist_read_data(key, &uuid_buffer, sizeof(uuid_buffer)), E_DOES_NOT_EXIST); cl_assert_equal_i(persist_write_data(key, &test_uuid_a, sizeof(test_uuid_a)), size); cl_assert_equal_i(persist_get_size(key), size); c...
persist_write_string(0, buffer)
, sizeof(buffer)); // Clear the cache (which has the entire string right now) persist_service_client_close(&test_uuid_a); persist_service_client_open(&test_uuid_a); // Reset out buffer so we can check the read's honesty. memset(buffer, 0, strlen(buffer)); // Read part of the data we wrote cl_assert_equal_...
ID_MUSIC, APP_ID_NOTIFICATIONS, APP_ID_ALARMS, APP_ID_WATCHFACES, APP_ID_WORKOUT, BG_COUNTER_APP_ID, MENU_LAYER_APP_ID}; app_menu_data_source_init(&data_source, &(Ap...
cl_assert_equal_i(node->install_id, order[i])
; } app_menu_data_source_deinit(&data_source); } void prv_shuffle(AppInstallId *array, uint8_t n) { for (uint8_t i = 0; i < n - 1; i++) { uint8_t j = i + rand() / (RAND_MAX / (n - i) + 1); int t = array[j]; array[j] = array[i]; array[i] = t; } } void test_app_menu_data_source__change_order_ap...
{ 840, 112, -136}, { 1048, 112, -112}, // 26 seconds { 1360, 160, -96}, { 1232, 232, -296}, { 1352, 240, -296}, { 1344, 240, -208}, { 1048, 296, -272}, { 824, 368, -368}, { 704, 400, -296}, { 688, 432, -256}, { 760, 448, -264}, { 936, 504, -368}, { 920, 480, -320}, ...
{ 144, -72, -840}, { 144, 0, -952}, { 224, 0, -952}, { 256, 8, -1040}, { 464, 40, -1088}, { 536, 264, -1160}, { 632, 176, -1192}, { 584, 160, -1040}, { 456, 88, -896}, { 280, -56, -656}, { 208, -40, -584}, { 176, -80, -472}, { 168, -40, -552}, { 240, -72, -768}, ...
{ 752, 360, -280}, { 648, 424, -296}, { 688, 392, -264}, { 800, 424, -312}, { 864, 456, -344}, { 920, 504, -368}, { 1016, 568, -448}, { 968, 528, -392}, { 1280, 504, -368}, { 1336, 528, -416}, { 1320, 520, -432}, { 1528, 416, -224}, { 1520, 344, -128}, { 1168, 31...
"process_state/app_state/app_state.h" #include "services/common/clock.h" #include "shell/sdk/shell_sdk.h" #include "shell/sdk/watchface.h" #include "system/logging.h" typedef struct SdkAppData { Window window; TextLayer info_text_layer; #if CAPABILITY_HAS_SDK_SHELL4 TextLayer time_text_layer; char time_buffer...
(&window->layer, prv_sdk_home_update_proc)
; GRect frame = data->window.layer.frame; #if CAPABILITY_HAS_SDK_SHELL4 const int top_margin = PBL_IF_RECT_ELSE(19, 25); const int time_height = 46; frame.origin.y = top_margin; frame.size.h = time_height; TextLayer *time_text_layer = &data->time_text_layer; text_layer_init(time_text_layer, &frame); ...
/* * 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...
MIN((int)sizeof(line_buffer), (unsigned int)len)
); va_end(args); return 0; } static void prv_lock(void) { OS_ENTER_CRITICAL_SECTION(); } static void prv_unlock(void) { OS_LEAVE_CRITICAL_SECTION(); } static bool prv_pm_prepare_for_sleep(void) { /* Do not sleep when there is transmission in progress */ return !hw_uart_tx_in_progress(CONFIG_LOG_UART); } ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_ASSERT(index < NUM_ACTION_BAR_LEGACY2_ITEMS, "Index: %"PRIu8, index); const uint8_t bit = (1 << index); if (highlighted) { action_bar->is_highlighted |= bit; } else { action_bar->is_highlighted &= ~bit; } }
static void action_bar_legacy2_changed_proc(ActionBarLayerLegacy2 *action_bar, GContext* ctx) { if (action_bar->layer.window && action_bar->layer.window->on_screen == false) { // clear first, fixes issue of returning from other page while highlighted for (int i = 0; i < NUM_ACTION_BAR_LEGACY2_ITEMS; i++) { ...
t *elem, const BLEAdParseCallbacks *callbacks, void *cb_data) { // Length of the raw string: const uint8_t raw_length = elem->header.length - 1 /* -1 Type byte */; if (!raw_length) { return true; // continue parsing } // Call back to client with p...
parse_func(elem, callbacks, cb_data)
) { // The callback indicated we should not continue parsing return; } } // The Length byte itself is not counted, so +1: cursor += elem->header.length + 1; } } // ----------------------------------------------------------------------------- //! ble_ad_includes_service() wrapper an...
dex, void *ctx) { uint32_t expire_ms; int timer_idx_0 = 0; bool scheduled = false; menu_callback_prefix(index, ctx); // Repeating timer s_app_data->timer[timer_idx_0] = new_timer_create(); bool success = new_timer_start(s_app_data->timer[timer_idx_0], 500, timer_callback, (void*)timer_idx_0, ...
(s_app_data->app_timer)
prv_free_storage_buffer_cb(void *p) { PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Freeing buffer storage ptr: %p", p); task_free(p); } // --------------------------------------------------------------------------------------- static void prv_free_storage_buffer(DataLoggingSession *session) { if (!sessi...
(logging_session)
; return; } iter = &((*iter)->next); } mutex_unlock_recursive(s_list_mutex); } void dls_list_remove_all(void) { mutex_lock_recursive(s_list_mutex); DataLoggingSession *cur = s_logging_sessions; DataLoggingSession *next; while (cur != NULL) { next = cur->next; if (cur->data) { m...
/* * 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...
{ WeatherDBEntry *to_check = task_zalloc_check(weather_shared_data_get_entry_size(index)); const WeatherDBKey *key = weather_shared_data_get_key(index); cl_assert_equal_i(S_SUCCESS, weather_db_read((uint8_t*)key, sizeof(WeatherDBKey), ...
} void test_weather_db__check_small_record_not_inserted(void) { const size_t entry_size = MIN_ENTRY_SIZE - 1; void *entry = task_zalloc_check(entry_size); WeatherDBKey key = (WeatherDBKey) { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5 }; cl_assert_equal_i(E_INVALID_ARGUMENT, weather_db_insert((uint8...
/* * 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...
click_recognizer_get_config(recognizer)
; config->click.repeat_interval_ms = MAX((config->click.repeat_interval_ms / 2), 100); } static void select_long_click_handler(ClickRecognizerRef recognizer, Window *window) { ClickAppData *data = window_get_user_data(window); sniprintf(data->text_buffer, TEXT_BUFFER_SIZE, "Long Click!"); PBL_LOG(LOG_LEVEL_DEB...
, 0, 148, 0}, { 0, 0x69, 0, 145, 0}, { 0, 0x69, 0, 148, 0}, { 0, 0x69, 0, 148, 0}, { 0, 0x69, 0, 148, 0}, { 0, 0x69, 0, 147, 0}, { 0, 0x69, 0, 144, 0}, // 135: Local time: 2016-03-01 10:20:00 PM { 0, 0x69, 0, 147, 0}, { 0, 0x69, 0, 148, 0}, { 0, 0x69, 0, 148, 0}, { 0, 0x69, 0...
{ 0, 0x18, 0, 150, 0}, { 0, 0x18, 0, 147, 0}, // 240: Local time: 2016-03-02 12:05:00 AM { 0, 0x18, 0, 150, 0}, { 0, 0x18, 0, 150, 0}, { 0, 0x18, 34, 150, 0}, { 0, 0x18, 0, 149, 0}, { 0, 0x18, 0, 147, 0}, { 0, 0x18, 0, 150, 0}, { 0, 0x18, 0, 150, 0}, { 0, 0x18, 0, 150, 0}, ...
urrent_stack, true); cl_assert_equal_p(aaaa, actual); cl_assert_equal_i(3, current_stack); cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(aa, stack[1]); cl_assert_equal_p(aaa, stack[2]); cl_assert_equal_p(aaaa, stack[3]); // go back two levels and then to sibling actual = __layer_tree_traverse_next_...
(&child_a, &child_f)
// Register connection intent: BTErrno e = gap_le_connect_connect(&device, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoOK); prv_fake_connect(...
cl_assert_equal_b(gap_le_connect_has_pending_create_connection(), false)
; } void __disabled_test_gap_le_connect__disconnection_event_upon_cancel_connect(void) { BTDeviceInternal device = prv_dummy_device(1); // Register connection intent for app: gap_le_connect_connect(&device, false /* no auto_reconnect */, false /* is_pairing_requir...
ationName, "145 Williams John\n" "Palo Alto"); static StringList headings = StringListLiteral("Attendees\0Organizer"); static StringList paragraphs = StringListLiteral("Ryan Case\nBrad Murray\0Sarah Otten"); attribute_list_add_string_list(&list, AttributeI...
prv_add_weather_pin(10 * 60 + 15)
; prv_add_sports_pin(10 * 60 + 17, GColorWhite, !is_ingame, has_broadcaster); // Future pins prv_add_calendar_pin(30 * 60, 3 * 24 * 60, is_all_day, !recurring, TIMELINE_RESOURCE_SCHEDULED_EVENT, 0); prv_add_calendar_pin(60 * 60, 3 * 24 * 60, is_all_day, recurring, ...
/* * 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_LOG(APP_LOG_LEVEL_ERROR, "Failed to allocated memory for transcription"); result = 99; }
else { snprintf(app_data->result, size, "You said:\n%s", transcription); text_layer_set_text(app_data->result_text, app_data->result); return; } } app_data->result = malloc(100); snprintf(app_data->result, 100, "Welp, that didn't work (Error: %u).\n Try again.", result); text_layer_set_te...
/* * 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...
(conn_idx)
; if (dev) { dev->is_gateway = is_gateway; } storage_release(); BTDeviceInternal device; connection_get_address(connection, &device); hc_endpoint_pebble_pairing_service_found_gateway(&device); } static bool prv_is_bonded(uint16_t conn_idx) { storage_acquire(); device_t *dev = find_device_by_conn_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...
{ window_single_click_subscribe(BUTTON_ID_UP, prv_up_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, prv_down_click_handler); }
{ 664, 96, -160}, { 632, 112, -160}, { 672, 152, -144}, { 856, 176, -184}, { 1056, 232, -232}, { 1400, 248, -176}, // 69 seconds { 1456, 296, -248}, { 1200, 224, -440}, { 1312, -72, -64}, { 1192, -136, -88}, { 912, 88, -336}, { 656, 88, -272}, { 560, 80, -312}, ...
{ 1224, 328, -64}, { 976, 296, -72}, { 800, 320, -104}, { 728, 288, -80}, { 712, 200, -56}, { 704, 208, -80}, { 808, 240, -104}, { 976, 264, -152}, { 1088, 176, -88}, { 1176, 88, -128}, { 1192, 144, -208}, { 1104, 208, -344}, { 1256, 184, -264}, { 1160, 160, -168}...
{ 1344, 184, -240}, // 77 seconds { 1384, 80, -168}, { 1216, 136, -256}, { 880, 216, -304}, { 704, 296, -312}, { 616, 320, -256}, { 680, 360, -240}, { 784, 400, -208}, { 776, 512, -128}, { 880, 720, -472}, { 1120, 112, -176}, { 1144, 104, -304}, { 1272, 304, -368...
y, x1, x2, delta1, delta2, ctx->draw_state.stroke_color); graphics_release_frame_buffer(ctx, framebuffer); } #endif // PBL_COLOR void graphics_private_draw_horizontal_line_delta_non_aa(GContext *ctx, int16_t y, Fixed_S16_3 x1, ...
if (pixels_to_move <= 0) { // on this row, the delta is wider than the available pixels if (patch_garbage) { memset(left_pixel, fill_byte, bytes); } break; }
uint8_t *const from = delta_neg ? right_pixel : left_pixel; uint8_t *const to = delta_neg ? left_pixel : right_pixel; uint8_t *const garbage_start = delta_neg ? left_pixel + bytes - delta_bytes : left_pixel; if (delta_bytes) { memmove(to, from, bytes - delta_bytes); ...
ss_manager.h" // TODO: PBL-22271 Complete timeline text node unit tests // Fakes ///////////////////// typedef struct GTextNodeTestData { GContext gcontext; GRect clip_box; GTextNode *text_node; GSize max_used_size; } GTextNodeTestData; GTextNodeTestData s_data; #define TEST_TEXT "DUMMY TEXT" #define TEST_...
graphics_text_node_get_size(&custom_node.node, ctx, &TEST_TEXT_BOX, NULL, &size)
; return animation; } static Animation *prv_create_bounce_back_animation(Layer *layer, const GRect *to_orig, GPoint direction) { GRect from = *to_orig; GRect to = *to_orig; gpoint_add_eq(&from.origin, GPoint(direction.x * INTERPOLATE_MOOOK_BOUNCE_BACK, ...
((Layer *)layer, (Layer *)&layer->layouts_layer)
; // day separator GRect frame; prv_get_day_sep_show_frame(layer, &frame); peek_layer_init(&layer->day_separator, &frame); const GFont title_font = system_theme_get_font_for_size(PreferredContentSizeDefault, TextStyleFont_Title); peek_layer_set_title_font(&layer->day_separator, title_font); const G...
{ bus->busy = false; } static void prv_semaphore_give_from_isr(I2CBusState *bus) { bus->busy = false; return; } /*-------------------BUS/PIN CONFIG FUNCTIONS--------------------------*/ static void prv_rail_ctl(I2CBus *bus, bool enable) { bus->rail_ctl_fn(bus, enable); if (enable) { // wait for the bus...
(slave->bus)
/* * 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_local_addr_pin(&bonding->pinned_address)
; } const uint8_t flags = bonding->flags; if (flags) { PBL_LOG(LOG_LEVEL_INFO, "flags: 0x02%x", flags); } BTBondingID bonding_id = bt_persistent_storage_store_ble_pairing(&bonding->pairing_info, bonding->is_gateway, 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...
alerts_should_notify_for_type(AlertMobile)
); cl_assert(!alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_should_notify_for_type(AlertPhoneCall)); } void test_alerts__phone_calls_only(void) { cl_assert(alerts_get_mask() == AlertMaskAllOn); alerts_set_mask(AlertMaskPhoneCalls); // Should allow a phone call notification cl_assert(al...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(!uuid_equal(&test_uuid_1, &test_uuid_2))
; cl_assert(!uuid_equal(&test_uuid_1, &test_uuid_3)); } void test_uuid__invalid(void) { const Uuid system = UUID_SYSTEM; const Uuid invalid = UUID_INVALID; const Uuid test_uuid_1 = (Uuid) { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; cl_assert(uuid_is_invalid(&invalid)); cl_assert(!uuid_is_in...
---------------- // Sample captured: 2015-08-07 02:21:25 GMT AccelRawData *activity_sample_walk_slow_30(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_30_slow //> TEST_EXPECTED 30 //> TEST_EXPECTED_MIN 24 //> TEST_EXPECTED_MAX 33 //> TEST_WEIGHT 1.0 stat...
{ -801, 316, 93}, { -769, 316, 111}, { -782, 331, 113}, { -842, 358, 65}, { -859, 384, 5}, { -1077, 423, 21}, { -1268, 416, 70}, { -971, 396, -51}, { -931, 438, -183}, { -790, 477, -203}, { -795, 250, -257}, { -829, 490, -431}, { -952, 362, -172}, { -891, 357, -11...
/* * 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...
({ abort(); })
cky_text_state.text_attributes = (GTextAttributes *)123; rocky_global_deinit(); cl_assert_equal_i(1, s_fonts_get_system_font.call_count); cl_assert_equal_i(1, s_graphics_text_attributes_destroy.call_count); } void test_rocky_api_graphics__request_draw(void) { rocky_global_init(s_graphics_api); cl_assert_equ...
cl_assert_equal_rect_precise(expected_rect, s_graphics_draw_rect_precise.last_call.prect)
; } #define PP(x, y) (GPointPrecise( \ (int16_t)((x) * FIXED_S16_3_FACTOR), \ (int16_t)((y) * FIXED_S16_3_FACTOR))) void test_rocky_api_graphics__fill_radial(void) { prv_global_init_and_set_ctx(); EXECUTE_SCRIPT( "ctx.rockyFillRadial(30, 40, 10, 20, 0, Math.PI);\n" ); cl_assert_equal_i(1, s_graphics...
time_t start_utc, uint32_t len_sec, bool ongoing, bool delete, uint32_t steps, uint32_t resting_calories, uint32_t active_calories, uint32_t distance_mm) { int entry_idx = s_num_captured_sleep_sessions; // If not a sleep session, ignore it if ...
if (exit_utc != 0) { results->end_at.value = (exit_utc - test_start_utc) / SECONDS_PER_MINUTE; }
// Figure out our current state if (exit_utc >= last_processed_utc - SECONDS_PER_MINUTE) { // We are sleeping results->in_sleep.value = true; int unprocessed_m = (test_end_utc - last_processed_utc) / SECONDS_PER_MINUTE; if (exit_utc == deep_exit_utc) { results->in_deep_sleep.value = true; ...
DEFAULT_VIBE_INTENSITY; alerts_set_vibrate(enable_vibration); alerts_preferences_set_vibe_intensity(new_vibe_intensity); vibe_intensity_set(new_vibe_intensity); if (enable_vibration) { vibes_short_pulse(); } app_window_stack_remove(&option_menu->window, true...
{ const int index = prv_window_timeout_get_selection_index(); const OptionMenuCallbacks callbacks = { .select = prv_window_timeout_menu_select, }; /// Status bar title for the Notification Window Timeout settings screen const char *title = i18n_noop("Timeout"); settings_option_menu_push( title, Op...
// Menu Layer Callbacks //////////////////////// static uint16_t prv_num_rows_cb(SettingsCallbacks *context) { return NotificationsItem_Count; } static void prv_draw_row_cb(SettingsCallbacks *context, GContext *ctx, const Layer *cell_layer, uint16_t row, bool selected) { SettingsNoti...