prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
4*color_index_match - 1, origin.y - 1 + height_offset, COLOR_BAR_WIDTH + 2, COLOR_BAR_HEIGHT + 2); graphics_context_set_stroke_color(ctx, GColorWhite); graphics_draw_rect(ctx, &box); } } static void up_handler(ClickRecognizerRef recognizer, void *context) { AppData *data = wind...
draw_color_wheel_box(ctx, data)
; } static void main_window_load(Window *window) { AppData *data = window_get_user_data(s_window); Layer *window_layer = window_get_root_layer(window); GRect window_bounds = window_layer->bounds; // Create Layer s_canvas_layer = layer_create(GRect(0, 0, window_bounds.size.w, window_bounds.size.h)); layer_...
////////////////////////////////////////////////////////////////////////////////// // Calibration state variables static void prv_calibration_time_expired_cb(void* data); static bool s_high_freq_calib_active = false; static bool s_calib_run = false; static RegularTimerInfo s_cb_info = { .cb = prv_calibration_time_ex...
cos_lookup(roll)
; my_rot /= TRIG_MAX_RATIO; int32_t heading = (atan2_lookup(-my_rot, mx_rot) + corr) % TRIG_MAX_ANGLE; return (heading); } ////////////////////////////////////////////////////////////////////////////////// // Private handlers for compass service static void prv_calibration_time_expired_cb(void* data) { PBL_...
sert(rv == E_INVALID_ARGUMENT); uint8_t buf[10]; int fd = pfs_open("newfile", OP_FLAG_WRITE | OP_FLAG_READ, FILE_TYPE_STATIC, sizeof(buf)); for (int i = 0; i < sizeof(buf); i++) { buf[i] = i; } rv = pfs_write(fd, NULL, sizeof(buf)); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_write(fd, buf, s...
pfs_open("file", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10)
; cl_assert(fd >= 0); rv = pfs_close(fd); cl_assert(rv == S_SUCCESS); rv = pfs_close(fd); // should not be able to double close an fd cl_assert(rv == E_INVALID_ARGUMENT); } void test_pfs__remove(void) { cl_assert(pfs_remove(NULL) == E_INVALID_ARGUMENT); char *fname = "abc"; int fd = pfs_open(fname, OP...
a, sizeof(data)), 0); // Test ble_ad_copy_local_name, destination buffer large enough: char local_name[64]; size = ble_ad_copy_local_name(s_ad_data, local_name, 64); cl_assert_equal_s(local_name, "LightBlue"); cl_assert_equal_i(size, strlen("LightBlue") + 1); // Test ble_ad_copy_local_name, destination bu...
(memcmp(expected_ad_data, ad->data, sizeof(expected_ad_data)), 0)
; cl_assert_equal_i(ad->ad_data_length, sizeof(expected_ad_data)); cl_assert_equal_i(ad->scan_resp_data_length, 0); ble_ad_destroy(ad); } void test_ble_ad_parse__set_service_uuids_32_bit(void) { BLEAdData *ad; Uuid uuid[8]; for (int i = 0; i < 8; ++i) { uuid[i] = bt_uuid_expand_32bit(0x12346700 + i);...
); printf("{ "); for (uint32_t i = 0; i < count; i++) { printf("%d, ", indices[i]); } printf("}"); ListNode *node = *list; int list_num = list_count(node); bool failed = list_num != count; if (failed) { count = list_num; } if (!failed) { for (uint32_t i = 0; (i < count) && !failed; i++...
prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)
); prv_compare_recognizers_processed((int[]) {0, 1}, 2, &s_recognizers_handled); // Recognizers that attached to layers other than the active layer and its ancestors will not be // processed recognizer_add_to_list(recognizers[2], &layer_a.recognizer_list); recognizer_add_to_list(recognizers[3], &layer_a.reco...
/* * 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...
uart_deinit(BT_RX_BOOTROM_UART)
; uart_deinit(BT_TX_BOOTROM_UART); } else { uart_deinit(BT_RX_BOOTROM_UART); } periph_config_release_lock(); } static void prv_setup_dialog_reset_gpio(void) { periph_config_acquire_lock(); // configure the GPIO for RST: gpio_output_init(&BOARD_CONFIG_BT_COMMON.reset, GPIO_OType_PP, GPIO_Speed_25MH...
///////////////////////////////////////////// // Misc static TickType_t prv_taking_too_long_yield_cb(QueueHandle_t queue) { return milliseconds_to_ticks(1000); } void test_put_bytes__lock_contention_upon_prepare_message(void) { // When the PutBytes lock is taken for a long time when a PutBytes message is prepare...
prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware)
; assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__init_recovery_object_while_not_in_fw_update_mode(void) { s_firmware_update_is_in_progress = false; prv_receive_init(VALID_OBJECT_SIZE, ObjectRecovery); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__init_sys_resources_o...
GContext ctx; test_graphics_context_init(&ctx, fb); // Draw red circles with different alpha values in the stroke color with antialiasing enabled setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 0); graphics_context_set_stroke_color(&ctx, GColorRed); prv_draw_circles(&ctx); cl_c...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1)
; GPoint pt = CENTER_OF_ORIGIN_RECT; uint16_t radius = 10; uint16_t stroke_width = 1; for (int r = 1; r <= 7; r++) { graphics_context_set_stroke_width(&ctx, stroke_width); graphics_draw_arc_internal(&ctx, pt, radius, 0, test_angles[i].angle); stroke_width += 1; radius += 3; ...
int8_t *key = malloc(info->key_len + 1); uint8_t *val = malloc(info->val_len + 1); info->get_key(file, key, info->key_len); info->get_val(file, val, info->val_len); key[info->key_len] = '\0'; val[info->val_len] = '\0'; printf("Read key of %s %d and val of %s %d\n", key, info->key_len, val, info->val_len); ...
((char *)key, sizeof(key), "k%03d", i)
; snprintf((char *)val, sizeof(val), "v%03d", i); set_and_verify(&file, key, key_len, val, val_len); } const int search_for_idx = 57; snprintf((char *)key, sizeof(key), "k%03d", search_for_idx); // Move iter to the beginning to bring to a known state settings_raw_iter_begin(&file.iter); // Get th...
(of width hline_applying_test_column_width) is set to one of the // different possible dest_colors for (int16_t y = 0; y < bitmap_size.h; y++) { for (int16_t column_index = 0; column_index < num_dest_colors; column_index++) { const int16_t starting_x = column_index * hline_applying_test_column_width; ...
{ const uint8_t mask_pixel_value = (uint8_t)((y % vline_applying_test_row_height) / num_pixels_per_mask_value); for (int16_t x = 0; x < mask_size.w; x++) { test_graphics_context_mask_set_value_for_coordinate(ctx, mask, mask_pixel_value, GPoin...
return mask; } typedef void (*VerticalClippingMaskApplyFunc)(GContext *ctx, int16_t x, int16_t y1, int16_t y2, GColor color); static void prv_mask_apply_vline_test_pattern(VerticalClippingMaskApplyFunc apply_func) { GContext *ctx = s_ctx; prv_prepare_canvas_for_v...
x, true); graphics_fill_rect(&ctx, &ctx.dest_bitmap.bounds); GDrawCommandImage *l = weather_app_resource_create_sun(); gdraw_command_image_draw(&ctx, l, GPoint(0, 0)); int32_t dt = ANIMATION_NORMALIZED_MAX / 5; int32_t t = 0; l = weather_app_resource_create_sun(); gdraw_command_image_attract_to_square(...
gdraw_command_list_create_index_lookup_by_distance( gdraw_command_image_get_command_list(l), GPoint(s, s / 2))
; Fixed_S32_16 f = Fixed_S32_16(FIXED_S32_16_ONE.raw_value / 2); l = weather_app_resource_create_sun(); gdraw_command_image_scale_segmented_to(l, from, to, t += dt, interp, index_lookup, f, false); gdraw_command_image_draw(&ctx, l, GPoint(0, 0)); l = weather_app_resource_create_sun(); gdraw_command_image...
percent_intensity) { PBL_ASSERTN(percent_intensity > 0 && percent_intensity <= 100); uint16_t intensity = prv_convert_backlight_percent_to_intensity(percent_intensity); PBL_ASSERTN(intensity > BACKLIGHT_BRIGHTNESS_OFF); prv_pref_set(PREF_KEY_BACKLIGHT_INTENSITY, &intensity, sizeof(intensity)); } bool backligh...
(PREF_KEY_WELCOME_VERSION, &version, sizeof(version))
; } } uint8_t welcome_get_welcome_version(void) { return s_welcome_version; } static bool prv_set_default_any_watchface_enumerate_callback(AppInstallEntry *entry, void *data) { if (!app_install_entry_is_watchface(entry) || app_install_entry_is_hidden(entry)) { return true; // continue search } wa...
ounding errors uint64_t new_ticks = rtc_get_ticks() + (ms_delta * RTC_TICKS_HZ + 500 ) / 1000; uint64_t new_ms = (new_ticks * 1000 + RTC_TICKS_HZ / 2) / RTC_TICKS_HZ; if (new_ms == target_ms - 1) { new_ticks++; } else if (new_ms == target_ms + 1) { new_ticks--; } new_ms = (new_ticks * 1000 + RTC_TIC...
(history->num_calls < MAX_HANDLER_CALLS)
; history->entries[history->num_calls++] = (AnimTestHandlerEntry) { .fired_time_ms = prv_now_ms(), .fire_order = s_fire_order_index++, .finished = finished, .context = context, .animation = animation }; } // ------------------------------------------------------------------------- // Count how ...
min(ACTIVITY_SESSION_UPDATE_MIN + 1); // Do some deep sleep prv_feed_deep_sleep_min(2 * MINUTES_PER_HOUR); // Walk long enough to be registered as "awake" prv_feed_steps_min(ACTIVITY_SESSION_UPDATE_MIN + 1); // Trigger the insight notif prv_feed_steps_min(2 * MINUTES_PER_HOUR); prv_test_end(context, p...
app_timer_register(0, s_test_entries[index].callback, context)
es, 1, &zone1_minutes); cl_assert_equal_i(zone1_minutes, 2); activity_get_metric(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes); cl_assert_equal_i(zone2_minutes, 2); activity_get_metric(ActivityMetricHeartRateZone3Minutes, 1, &zone3_minutes); cl_assert_equal_i(zone3_minutes, 2); // Add a "blip" wh...
(&activity_private_state()->activity_sessions[0], &next_activity, sizeof(ActivitySession))
; } } cl_assert_equal_m(&activity_private_state()->activity_sessions[0], &empty_session, sizeof(ActivitySession)); // Add lots of sessions then delete from the back for (int i = 0; i < ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT; i++) { ActivitySession activity = walk_activity; activi...
s we read are either set on creation or atomic operations. We do // run the risk that the connection handle is no longer valid and could add // some extra checks in the future to protect against that I suppose uint16_t connection_get_idx(Connection *connection) { uint16_t idx; prv_lock(); { idx = connection-...
{ prv_lock(); { if (connection_is_valid(connection)) { PBL_LOG(LOG_LEVEL_DEBUG, "Changing connection flag: %c=%u", prv_debug_char_for_flag(flag), enabled); if (enabled) { connection->flags |= (1 << flag); } else { connection->flags &= ~(1 << flag); } } ...
} static bool prv_register_clear_bit(uint8_t register_address, uint8_t bit) { uint8_t val; if (!prv_read_register(register_address, &val)) { return false; } val &= ~(1 << bit); return prv_write_register(register_address, val); } // Read the interrupt status registers to clear pending bits. static void ...
prv_register_set_bit(PmicRegisters_REFERENCE_CNTL, 4)
bool music_get_player_name(char *player_name_out) { mutex_lock_recursive(s_music_ctx.mutex); const bool has_player_name = (s_music_ctx.player_name[0] != 0); if (player_name_out) { strcpy(player_name_out, s_music_ctx.player_name); } mutex_unlock_recursive(s_music_ctx.mutex); return has_player_name; }...
command_send(command)
mutex_unlock(s_endpoint_data.mutex)
; } static bool find_soonest_ack_timeout_cb(DataLoggingSession *session, void *data) { RtcTicks *soonest_ack_timeout = (RtcTicks*) data; if (session->comm.ack_timeout != 0 && (session->comm.ack_timeout < *soonest_ack_timeout || *soonest_ack_timeout == 0)) { *soonest_ack_timeout = session->comm.ack_timeou...
_is_running(AppData *data) { return (data->current_test_step != BTLETestStep_None); } //-------------------------------------------------------------------------------- // Number Windows //-------------------------------------------------------------------------------- // Number window is used / reused for getting c...
text_layer_get_layer(&data->status_text)
); } //-------------------------------------------------------------------------------- // TX/RX Menus & Windows //-------------------------------------------------------------------------------- // The same menu layer is reused for TX / RX, we just handle it differentely // based on whether we are currently executing...
iddle of a garbage collection PBL_LOG(LOG_LEVEL_INFO, "Recovering flash region from GC file"); recover_region_from_file(fd); } // find a free region if (!prv_update_gc_reserved_region()) { PBL_LOG(LOG_LEVEL_ERROR, "No free flash erase units!"); // Note: It should not be possible for this to happe...
(s_pfs_mutex)
; memcpy(diagnostic_buf, &PFS_FD(fd), MIN(diagnostic_buf_len, sizeof(FileDesc))); mutex_unlock_recursive(s_pfs_mutex); } // pass in either 0 or 1 to as argument void pfs_command_fs_format(const char *erase_headers) { int write_erase_headers = atoi(erase_headers); if (write_erase_headers == 1) { pfs_format(...
lyWeekdayOrWeekend) { if (is_weekend) { which_stats = &stats.weekend; } else { which_stats = &stats.weekday; } } else if (scope == HealthServiceTimeScopeWeekly) { which_stats = &stats.weekly; } else { APP_LOG(APP_LOG_LEVEL_ERROR, "Unsupported scope: %d", (int) scope); result = 0;...
{ if (num_samples > 0) { value = ROUND(value, num_samples); } }
if (num_samples == 0) { // Error case: no samples value = 0; } return value; } // --------------------------------------------------------------------------------------------- // Init a metric alert info structure static void prv_init_metric_alert(HealthServiceState *state, HealthMetric metric, ...
device_name, SM128BitKey *link_key, uint8_t platform_bits) { if (link_key) { // New pairing BTClassicPairingData data; prv_load_bt_classic_pairing_data(&data, addr, device_name, link_key, platform_bits); prv_update_and_cleanup_struct_async(&data, sizeof(BTC...
(&s_pending_bondings, 0x00, sizeof(s_pending_bondings))
(&data->pin_window.window, false); prv_set_state(data, TimelineAppStateCard); TimelineIterState *state = timeline_model_get_current_state(); Uuid app_uuid; timeline_get_originator_id(&state->pin, &app_uuid); analytics_event_pin_open(state->pin.header.timestamp, &app_uuid); } static Animation *prv_animate_to...
prv_set_state(data, TimelineAppStateStationary)
; } } static void prv_hide_day_sep_stopped(Animation *animation, bool finished, void *context) { TimelineAppData *data = context; if (!finished || !prv_set_state(data, TimelineAppStateStationary)) { return; } data->current_animation = NULL; prv_update_timeline_layer(data); Animation *move_animation...
BlobDBResponse result; } response = { .token = token, .result = result, }; comm_session_send_data(session, BLOB_DB_ENDPOINT_ID, (uint8_t*)&response, sizeof(response), COMM_SESSION_DEFAULT_TIMEOUT); } static BlobDBResponse prv_interpret_db_ret_val(status_t ret_val) { switch (r...
{ if (length < MIN_DELETE_LENGTH) { prv_send_response(session, prv_try_read_token(data, length), BLOB_DB_INVALID_DATA); return; } const uint8_t *iter = data; BlobDBToken token; BlobDBId db_id; // Read token and db_id iter = endpoint_private_read_token_db_id(iter, &token, &db_id); // Read key ...
static void prv_handle_database_clear(CommSession *session, const uint8_t *data, uint32_t length) { if (length < MIN_CLEAR_LENGTH) { prv_send_response(session, prv_try_read_token(data, length), BLOB_DB_INVALID_DATA); return; } BlobDBToken token; BlobDBId db_id; // Read token and db_id endpoint_...
ct.size.w, config->cassette_rect.size.h); } static GRect prv_track_rect(void) { const MusicAppSizeConfig *config = prv_config(); return GRect(config->horizontal_margin, config->track_field.origin_y, prv_content_width(), config->track_field.size_h); } static const ButtonId BUTTON_FORWARD = BUTTON_ID...
(animation, AnimationCurveEaseIn)
; return animation; } static Animation* prv_create_upwards_animation(MusicAppData *data) { return animation_spawn_create( prv_create_layer_upwards_animation(&data->artist_text_layer.layer, ARTIST_BOUNDS_OFFSET), prv_create_layer_upwards_animation(&data->title_text_layer.layer, TITLE_BOUNDS_OFFSET), ...
ender_line_cb, .layout_update_cb = update_all_layout_update_cb, .stop_condition_cb = is_clip_box_overflow_bottom_stop_condition_cb }; int16_t line_spacing_delta = prv_layout_get_line_spacing_delta(layout); ctx->text_draw_state.text_box = (TextBoxParams) { .utf8_bounds = &utf8_bounds, .box = globa...
{ TextLayoutExtended *extended = prv_get_writable_extended_layout(layout); if (extended) { extended->flow_data.paging = (TextLayoutFlowDataPaging) { .origin_on_screen = content_origin_on_screen, .page_on_screen.origin_y = paging_on_screen.origin.y, .page_on_screen.size_h = paging_on_screen.siz...
const TextLayoutFlowData *graphics_text_layout_get_flow_data(GTextLayoutCacheRef layout) { TextLayoutExtended *extended_layout = prv_get_readable_extended_layout(layout); if (extended_layout) { return &extended_layout->flow_data; } else { static const TextLayoutFlowData s_default_data = { // yes, ...
er; static const ProtocolHandler s_supported_protocols[] = { #define REGISTER_PROTOCOL(n, f1, f2) { \ .number = (n), \ .handler = (f1), \ .link_state_handler = (f2) \ }, #include "console/pulse_protocol_registry.def" #undef REGISTER_PROTOCOL }; static TimerID s_keepalive_timer = TIMER_INVALID_ID; stat...
COBS_OVERHEAD(PULSE_MAX_SEND_SIZE)
+ LINK_HEADER_LEN) { buf_valid = true; } PBL_ASSERT(buf_valid, "Buffer is not from the PULSE transmit buffer pool"); } void pulse_handle_character(char c, bool *should_context_switch) { // TODO: discard a frame outright if a framing error occurs if (s_current_receive_buffer == NULL) { s_current_receiv...
/* * 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...
(connection)
/* * 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...
gap_le_advert_deinit()
; gap_le_scan_deinit(); gap_le_connection_deinit(); } bt_unlock(); }
/* * 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_window_stack()
); } // Commands //////////////////////////////////// typedef struct WindowStackInfoContext { SemaphoreHandle_t interlock; WindowStackDump *dump; size_t count; } WindowStackInfoContext; static void prv_window_stack_info_cb(void *ctx) { // Note: Because of the nature of modal windows that has us re-using 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...
window_set_background_color(&data->window, PBL_IF_COLOR_ELSE(color, GColorWhite))
in steps and milliseconds, this becomes: // stride_len = (a * steps * 1000 * 60 / milliseconds + b) * height // Compute the "(a * steps * 1000 * 60 / milliseconds + b)" component: uint64_t stride_len_component = ROUND(k_a_x10000 * steps_64 * MS_PER_SECOND * SECONDS_PER_MINUTE, ...
{ // This computes resting metabolic rate in calories based on the MD Mifflin and ST St jeor // formula. This formula gives the number of kcalories expended per day uint32_t calories_per_day; ActivityGender gender = activity_prefs_get_gender(); uint64_t weight_dag = activity_prefs_get_weight_dag(); uint64_t...
// June 10th 2015, 13:00:00 (T+1DAY+01:00:00) rtc_set_time(event_time + SECONDS_PER_DAY + (1 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Yesterday, 12:00 PM", time_buf); // June 11th 2015, 13:00:00 (T+2DAY+01:00:00) r...
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
se_dma) { prv_lock(); s_use_dma = use_dma; if (s_use_dma) { prv_enable_dma(); } else { prv_disable_dma(); } prv_unlock(); } bool accessory_bus_contention_detected(void) { return s_bus_contention_detected; } static uint32_t prv_get_baudrate(AccessoryBaud baud_select) { const uint32_t BAUDS[] = ...
strcmp(on, "off")
) { accessory_set_power(false); } else { prompt_send_response("Usage: accessory power (on|off)"); } } static volatile int32_t s_num_test_bytes; static bool prv_test_send_stream(void *context) { accessory_send_byte((uint8_t)s_num_test_bytes); if (accessory_bus_contention_detected()) { return false; ...
// The state is only set to StateExiting in this function, so check that teardown has not already // been performed before carrying on if (data->state == StateExiting) { return; } prv_set_mic_window_state(data, StateExiting); if (window_is_loaded(&data->mic_window.window)) { prv_window_pop(&data->m...
(data, i18n_noop("Error occurred. Try again."))
; } static void prv_show_connectivity_error_and_exit(VoiceUiData *data) { data->error_count = MAX_ERROR_COUNT; // exit UI after the dialog is shown if (data->show_error_dialog) { const GColor dialog_bg_color = PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite); prv_push_error_dialog(data, i18n_noop("No inte...
croll_layer_set_context(scroll_layer, expandable_dialog); #if PBL_ROUND scroll_layer_set_paging(scroll_layer, true); #endif if (show_action_bar) { // Icons for up and down on the action bar. #ifndef RECOVERY_FW expandable_dialog->up_icon = gbitmap_create_with_resource_system(SYSTEM_APP, RESOURCE_I...
(&expandable_dialog->action_bar)
in.header.id, &all_day_item.header.id)); cl_assert(uuid_equal(&state.node->id, &all_day_item.header.id)); cl_assert(!state.node->all_day); cl_assert_equal_i(state.node->timestamp, midnight_march_3_utc); cl_assert_equal_i(state.node->duration, 8 * MINUTES_PER_HOUR); cl_assert_equal_i(state.current_day, midnigh...
(&state.pin.header.id, &multiday_item.header.id)
); cl_assert(uuid_equal(&state.node->id, &multiday_item.header.id)); cl_assert(state.node->all_day); cl_assert_equal_i(state.node->timestamp, midnight_march_2_pst + SECONDS_PER_DAY); cl_assert_equal_i(state.node->duration, MINUTES_PER_DAY); cl_assert_equal_i(state.current_day, midnight_march_2_pst + SECONDS_P...
/* * 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_stroke_color(ctx, GColorBlack); gpath_draw_outline(ctx, s_current_path); }
else { graphics_context_set_fill_color(ctx, GColorBlack); gpath_draw_filled(ctx, s_current_path); } } static void prv_reset(void) { gpath_move_to(s_house_path, GPoint(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)); s_outline_mode = false; s_path_angle = 0; } // setup and teardown void test_graphics_gpath_${BI...
layer_add_child(container_layer, down_arrow_layer); ContentIndicator *content_indicator = scroll_layer_get_content_indicator(&menu_layer->scroll_layer); ContentIndicatorConfig content_indicator_config = (ContentIndicatorConfig) { .layer = up_arrow_layer, .colors.background = GColorWhite, .colors....
{ if (!launcher_menu_layer || !launcher_menu_layer->data_source || !state_out) { return; } const MenuLayer *menu_layer = &launcher_menu_layer->menu_layer; const ScrollLayer *scroll_layer = &menu_layer->scroll_layer; *state_out = (LauncherMenuLayerSelectionState) { .row_index = menu_layer_get_selecte...
void launcher_menu_layer_set_selection_animations_enabled(LauncherMenuLayer *launcher_menu_layer, bool enabled) { if (!launcher_menu_layer) { return; } launcher_menu_layer->selection_animations_enabled = enabled; if (enabled) { const MenuIndex ...
/* * 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_p(result, false)
; s_test_transcription_example[0] = 1; s_test_transcription_example[2] = 3; // invalidate word count of the first sentence result = transcription_validate(validate_test, test_size); cl_assert_equal_p(result, false); s_test_transcription_example[2] = 2; // restore word count of the first sentence s_test_...
v_do_eval("throw new Error('"ERROR_STRING"');"); cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_util__create_date_now(void) { const time_t cur_time = 1458250851; // Thu Mar 17 21:40:51 2016 UTC // Thu Mar 17 14:40:51 2016 PDT const uint16_t cur_millis ...
jerry_call_function(getMonth, now, NULL, 0)
; jerry_value_t result_year = jerry_call_function(getYear, now, NULL, 0); cl_assert_equal_d(jerry_get_number_value(result_seconds), 28.0); cl_assert_equal_d(jerry_get_number_value(result_minutes), 38.0); cl_assert_equal_d(jerry_get_number_value(result_hours), 18.0); cl_assert_equal_d(jerry_get_number_value(r...
(msg, (uint8_t *)&rv, sizeof(rv)); // ack the write prv_build_write_complete_payload(hdr, ((HcGattWriteData *)hdr)->att_handle, state); prv_enqueue_write_complete_if_ready(state); return true; } static bool prv_handle_emulated_write(uint16_t conn_idx, const HcProtocolMessage *msg) { PBL_ASSERTN(msg->command_...
PEBBLE_BT_UUID_EXPAND( PEBBLE_BT_PPOGATT_WATCH_SERVER_DATA_CHARACTERISTIC_UUID_32BIT)
/* * 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...
check_atan2(-32768, 1)
; // <- causes overflow for int16 check_atan2(1, -32768); // <- causes overflow for int16 check_atan2(20001, 20000); // <- causes overflow if numbers are added in an int16 check_atan2(32767, 1); check_atan2(1, 32767); check_atan2(32767, 0); check_atan2(0, 32767); check_atan2(23400, -25300); check_atan2(...
sert(child_b.next_sibling == &child_c); cl_assert(child_c.parent == &parent); cl_assert(child_c.next_sibling == &child_a); cl_assert(child_a.next_sibling == NULL); } void test_layer__traverse(void) { Layer *stack[5]; uint8_t current_stack = 0; Layer *a = layer_create(GRectZero); Layer *aa = layer_create...
layer_is_descendant(&child_c, &parent)
); cl_assert(!layer_is_descendant(&child_c, &child_b)); } void test_layer__find_layer_contains_point(void) { Layer parent, child_a, child_b, child_c, child_d, child_e, child_f; Layer *layers[] = {&parent, &child_a, &child_b, &child_c, &child_d, &child_e, &child_f}; for (int i = 0; i < ARRAY_LENGTH(layers); ++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...
(info.interlock)
; if (info.count > 0 && !info.dump) { prompt_send_response("Couldn't allocate buffers for window stack data"); goto cleanup; } char buffer[128]; prompt_send_response_fmt( buffer, sizeof(buffer), "Window Stack, top to bottom: (%zu)", info.count); for (size_t i = 0; i < info.count; ++i) { ...
the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include <inttypes.h> #include <stdio.h> #include <string.h> #inc...
(app_file_get_app_id("@ffffffe9/asdf"), -23)
; }
consume(session, length); } } #define assert_consumed(expected_last_status, expected_consumed_count) \ { \ cl_assert_equal_i(expected_last_status, s_last_status_code); \ cl_assert_equal_i(expected_consumed_count, s_consumed_count); \ } #define assert_not_consumed() \ cl_assert_equal_i(0, s_consumed_count); /...
(AppMessageSenderErrorSuccess, 1)
; app_free(outbox_data); } void test_app_message_sender__auto_select_js_app(void) { s_process_md.allow_js = true; AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbox_message(NULL /* auto-select */, ALLOWED_ENDPOINT_ID, TEST_PAYLOAD, sizeof(TEST_PAYLOA...
/* * 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...
case AttributeIdMetricNames: case AttributeIdMetricValues: return AttributeTypeStringList; case AttributeIdMetricIcons: return AttributeTypeUint32List; default: return AttributeTypeUnknown; }
} static bool prv_deserialize_attribute(char **buffer, char *const buf_end, const uint8_t **cursor, const uint8_t *payload_end, Attribute *notif_attr) { SerializedAttributeHeader *attribute = (SerializedAttributeHeader *)*cursor; *cursor += sizeof(SerializedAttributeHeader);...
/* * 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...
(ctx, s_text_buffer, &s_font_info, GRect(4, -18, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL)
; } void draw_text_single_line_ellipsis_clip_across_y(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, 20, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } void draw_text_sing...
/* * 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...
(button_id)
; dbgserial_putstr("is stuck!"); result = true; } } if (button_counter_register != 0) { dbgserial_print("Button was pushed on boot. Button counter: "); dbgserial_print_hex(button_counter_register); dbgserial_newline(); } RTC_WriteBackupRegister(STUCK_BUTTON_REGISTER, button_counter...
_NO_SW, APP_STATE_DRAW_AA_NO_SW, APP_STATE_DRAW_NON_AA_SW, APP_STATE_DRAW_AA_SW, // Add more above APP_STATE_NUM_STATES } AppStateIndex; typedef struct AppData { Window window; // Point properties GPoint point_p0; int16_t point_velocity_x; int16_t point_velocity_y; // Line properties GPoint ...
window_single_click_subscribe(BUTTON_ID_BACK, back_handler)
; window_single_click_subscribe(BUTTON_ID_UP, up_handler); window_single_click_subscribe(BUTTON_ID_SELECT, select_handler); window_single_click_subscribe(BUTTON_ID_DOWN, down_handler); } static void prv_move_shape(AppData *data) { for (uint8_t shape = POINT; shape < MAX_SHAPES; shape++) { if (shape == POIN...
mark const bool highlight = menu_cell_layer_is_highlighted(cell_layer); prv_draw_generic_mark(ctx, mark, mark_rect.origin, highlight); // Only draw the text if the cell is selected if (is_selected) { const GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_18); GRect text_rect = rt_rect; text_rect...
{ const char *title = arg1; const char *subtitle = arg2; const bool highlight = menu_cell_layer_is_highlighted(cell_layer); GBitmap *mark = &cd->fcc_mark; #if PBL_RECT menu_cell_basic_draw(ctx, cell_layer, title, subtitle, NULL); // FCC has a mark in the top right of its cell const GPoint mark_origin = GP...
ting_ack_up_to(client, next_sn); comm_session_send_queue_consume(client->session, num_bytes_acked); // If next_data_sn is before the Ack'd sn, the packet pending retransmission has just been // Ack'd. We can determine whether or not a packet is pending retransmission by checking if the // payload size ...
LIKELY(packet->type == PPoGATTPacketTypeResetComplete)
/* * 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...
{ // Middle of flash has 64k lock units block_addr = flash_impl_get_sector_base_address(block_addr); block_size = SECTOR_SIZE_BYTES; }
else { // Start and end of flash have 1 sector of 4k lock units block_addr = flash_impl_get_subsector_base_address(block_addr); block_size = SUBSECTOR_SIZE_BYTES; } const status_t sc = qspi_flash_lock_sector(QSPI_FLASH, block_addr); if (FAILED(sc)) { return sc; } block_addr ...
if (rv) { goto cleanup; } for (int i = 0; i < info.num_children; ++i) { const void *key = &info.children_ids[i]; rv = settings_file_delete(&storage->file, key, sizeof(Uuid)); if (rv != S_SUCCESS) { goto cleanup; } if (child_delete_cb) { child_delete_cb((Uuid *)key); } ...
info->get_val(file, read_buf, info->val_len)
; SerializedTimelineItemHeader *header = (SerializedTimelineItemHeader *)read_buf; // Restore flags & status header->common.flags = ~header->common.flags; header->common.status = ~header->common.status; uint8_t *payload = read_buf + sizeof(SerializedTimelineItemHeader); status_t rv = timeline_item_deserial...
ate.reload_callback_was_called = true; s_test_state.resource_is_valid = true; AppGlanceSlice slice = (AppGlanceSlice) { .expiration_time = rtc_get_time() + 10, .layout.icon = TIMELINE_RESOURCE_HOTEL_RESERVATION, .layout.subtitle_template_string = "Test subtitle", }; cl_assert_equal_i(app_glance_add...
.layout.icon = RESOURCE_ID_SETTINGS_ICON_AIRPLANE, .layout.subtitle_template_string = "Test subtitle", }; cl_assert(app_glance_add_slice(session, slice) & APP_GLANCE_RESULT_INVALID_ICON); // Check that adding a slice with a subtitle that's too long fails const char *really_long_subtitle = "This is a re...
.expiration_time = rtc_get_time() - 10, .layout.icon = APP_GLANCE_SLICE_DEFAULT_ICON, .layout.subtitle_template_string = "Test subtitle", }; cl_assert(app_glance_add_slice(session, slice) & APP_GLANCE_RESULT_EXPIRES_IN_THE_PAST); // At this point we've actually filled up the glance to the capacity ...
(bounds.origin, offset)
; // Save compositing mode GCompOp prev_compositing_mode = ctx->draw_state.compositing_mode; graphics_context_set_compositing_mode(ctx, GCompOpSet); // Enable compositing graphics_draw_bitmap_in_rect_processed(ctx, sequence_reel->render_bitmap, &bounds, NULL_SAFE_FIEL...
} switch (op) { case BtPersistBondingOpDidAdd: // FIXME: break; case BtPersistBondingOpDidChange: *intent->bonding = updated_bonding; break; case BtPersistBondingOpWillDelete: for (GAPLEClient c = GAPLEClientKernel; c < GAPLEClientNum; ++c) { if (!intent->client[c].is...
{ BLE_GAP_LOG_DEBUG("Cancel connecting all for client %u...", client); GAPLEConnectionIntent *intent = s_intents; while (intent) { GAPLEConnectionIntent *next = (GAPLEConnectionIntent *) intent->node.next; prv_unregister_intent(intent, client, false /* should_send_disconnection_event */, ...
bt_unlock(); } // ------------------------------------------------------------------------------------------------- bool gap_le_connect_is_connected_as_slave(void) { bool connected; bt_lock(); { connected = s_is_connected_as_slave; } bt_unlock(); return connected; } // ---------------------------...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1)
; graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerTopRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_topright.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fi...
vector_equal(const GVector * const vector_a, const GVector * const vector_b) { return (vector_a->dx == vector_b->dx && vector_a->dy == vector_b->dy); } bool gvectorprecise_equal(const GVectorPrecise * const vectorP_a, const GVectorPrecise * const vectorP_b) { return ((vectorP_a->dx.raw_va...
{ rect->size.w = inside_rect->size.w; }
if (rect->size.h > inside_rect->size.h) { rect->size.h = inside_rect->size.h; } } switch (alignment) { case GAlignCenter: { rect->origin.x = ((inside_rect->size.w - rect->size.w) / 2) + inside_rect->origin.x; rect->origin.y = ((inside_rect->size.h - rect->size.h) / 2) + inside_rect->...
/* * 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 (result > 0) { ++result; } else { --result; }
} } if (is_negative) { result *= -1; } if (result > INT32_MAX || result < INT32_MIN) { return false; // overflow } if (number_started && number_out) { *number_out = result; } return number_started; } // ------------------------------------------------------------------------------...
calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 1); #endif } static Animation *s_parent_for_sequence_unschedu...
(&s_stopped_handler_calls, a)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c),...
0, 0x6e, 0, 191}, { 0, 0x6e, 0, 192}, { 0, 0x6e, 0, 191}, { 0, 0x6e, 0, 191}, { 0, 0x6e, 0, 192}, { 0, 0x6e, 0, 191}, { 0, 0x6e, 0, 191}, // 195: Local time: 07:54:01 PM { 0, 0x6e, 0, 190}, { 0, 0x6e, 0, 191}, { 0, 0x6e, 0, 191}, { 0, 0x6e, 0, 191}, { 0, 0x6e, 0, 191}, ...
{ 0, 0x3f, 0, 144}, { 0, 0x3f, 0, 144}, { 0, 0x3f, 0, 145}, { 0, 0x3f, 0, 145}, { 0, 0x3f, 0, 144}, { 0, 0x3f, 0, 144}, // 315: Local time: 09:54:00 PM { 0, 0x3f, 0, 145}, { 0, 0x3f, 0, 144}, { 0, 0x3f, 0, 145}, { 0, 0x3f, 0, 144}, { 0, 0x3f, 0, 145}, { 0, 0x3f, 0, 14...
{ 0, 0x3f, 0, 140}, { 0, 0x3f, 0, 140}, { 0, 0x3f, 0, 139}, { 0, 0x3f, 0, 139}, { 0, 0x3f, 0, 139}, { 0, 0x3f, 0, 139}, // 375: Local time: 10:54:00 PM { 0, 0x3f, 0, 139}, { 0, 0x3f, 0, 139}, { 0, 0x3f, 0, 139}, { 0, 0x3f, 0, 140}, { 0, 0x3f, 0, 139}, { 0, 0x3f, 0, 1...
ivities_string, NULL, NULL); } static uint16_t prv_get_num_rows_cb(OptionMenu *option_menu, void *context) { SettingsActivityTrackerData *data = context; const uint16_t count = prv_num_rows(data); return count + 1; } static void prv_draw_row_cb(OptionMenu *option_menu, GContext *ctx, const Layer *cell_layer, ...
("Background App")
s_app_list = &app_list; Window window = {}; layer_init(&window.layer, &GRectZero); manager.window = &window; Layer layer_a, layer_b, layer_c; layer_init(&layer_a, &GRectZero); layer_init(&layer_b, &GRectZero); layer_init(&layer_c, &GRectZero); layer_add_child(&window.layer, &layer_a); layer_add_child...
(prv_dispatch_touch_event(r, &ctx))
; cl_assert(handled); cl_assert_equal_p(ctx.triggered, r); ctx.triggered = NULL; handled = false; r->state = RecognizerState_Updated; cl_assert(prv_dispatch_touch_event(r, &ctx)); cl_assert(handled); cl_assert_equal_p(ctx.triggered, r); handled = false; ctx.triggered = NULL; NEW_RECOGNIZER(s) = ...
t_disturb_set_manually_enabled(!do_not_disturb_is_active()); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Helper Functions static void prv_assert_settings_value(const void *key, size_t key_len, const void *expected_valu...
do_not_disturb_set_schedule_enabled(WeekdaySchedule, true)
; DoNotDisturbSchedule schedule = { .from_hour = 0, .from_minute = 0, .to_hour = 11, .to_minute = 30, }; do_not_disturb_set_schedule(WeekdaySchedule, &schedule); cl_assert(do_not_disturb_is_manually_enabled() == true); cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == true); c...
, 4); cl_assert(memcmp(out_buffer, "1234", 4) == 0); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 2); cl_assert(shared_circular_buffer_consume(&buffer, &client, 4)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 6); // Now there's just 56 in the...
(&buffer, &client1, 2)
); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 0); // Should fail, not enough room because client 2 is full cl_assert(!shared_circular_buffer_write(&buffer, (uint8_t*) "gh", 2, false)); // This should pass and reset client 2's read index cl_assert(shared_circular_buffer_wr...
e, prv_weather_glance_subtitle_dynamic_text_node_update); } static void prv_destructor(LauncherAppGlanceStructured *structured_glance) { LauncherAppGlanceWeather *weather_glance = launcher_app_glance_structured_get_data(structured_glance); if (weather_glance) { event_service_client_unsubscribe(&weather_g...
launcher_app_glance_structured_notify_service_glance_changed(structured_glance)
; } static const LauncherAppGlanceStructuredImpl s_weather_structured_glance_impl = { .get_icon = prv_get_icon, .get_title = prv_get_title, .create_subtitle_node = prv_create_subtitle_node, .destructor = prv_destructor, }; LauncherAppGlance *launcher_app_glance_weather_create(const AppMenuNode *node) { if (...
text.text)); } static MockCallRecordings s_graphics_text_attributes_destroy; void graphics_text_attributes_destroy(GTextAttributes *text_attributes) { record_mock_call(s_graphics_text_attributes_destroy){}; } static MockCallRecordings s_graphics_text_layout_get_max_used_size; static GSize s_graphics_text_layout_get...
rocky_global_init(s_graphics_api)
; EXECUTE_SCRIPT( "var event = null;\n" "_rocky.on('draw', function(e) {event = e;});" ); const jerry_value_t event_null = prv_js_global_get_value("event"); cl_assert_equal_b(true, jerry_value_is_null(event_null)); jerry_release_value(event_null); Layer *l = &app_window_stack_get_top_window()->la...
se, app_cache_entry_exists(app3.id)); } static const uint32_t SIZE_SUM = 7210515; static const AppData t_data[] = { // higher rank = should keep around { .id = 1, .priority = 40, .size = 131798 }, // priority rank 28 { .id = 2, .priority = 60, .size = 194327 }, // priority rank 48 { .id = 3, .pr...
(true, app_cache_entry_exists(t_data[i].id))
; } cl_assert_equal_i(SIZE_SUM, app_cache_get_size()); } void prv_cleanup(void) { app_cache_flush(); prv_load_lotta_apps(); } void test_app_cache__free_up_space_lots_apps(void) { uint32_t to_free; uint32_t before_size; uint32_t after_size; // test random number prv_cleanup(); to_free = 150000; ...
, custom_node.node.cached_size.w); cl_assert_equal_i(size.h, custom_node.node.cached_size.h); cl_assert_equal_i(s_num_draw_custom_calls, 1); graphics_text_node_get_size(&custom_node.node, ctx, &TEST_TEXT_BOX, NULL, &size); cl_assert(size.w > 0); cl_assert(size.h > 0); cl_assert_equal_i(size.w, TEST_TEXT_SI...
graphics_text_node_draw(&custom_node.node, ctx, &TEST_CLIP_BOX, NULL, NULL)
848, 120, -104}, { 888, 64, -160}, { 984, 48, -136}, { 1096, 152, -120}, { 1312, 232, -368}, { 1536, 200, -264}, { 1376, 152, -288}, { 1072, 200, -384}, { 872, 272, -344}, { 752, 328, -248}, { 736, 504, -184}, { 752, 664, -232}, { 800, 744, -328}, { 816, 704, -272}, ...
{ 416, 0, -568}, { 368, -64, -576}, { 472, -176, -640}, { 424, -144, -744}, // 29 seconds { 536, -128, -888}, { 544, -168, -880}, { 480, -264, -888}, { 224, -264, -848}, { 96, -264, -768}, { 128, -328, -656}, { 184, -360, -656}, { 208, -384, -648}, { 240, -416, -7...
ic PebbleMutex *s_free_list_lock; //! This array should be initialized with the maximum number of MBufs which may be allocated for //! each pool. static int s_mbuf_pool_space[] = { [MBufPoolSmartstrap] = 2, #if UNITTEST [MBufPoolUnitTest] = 100, #endif }; _Static_assert(ARRAY_LENGTH(s_mbuf_pool_space) == NumMBufPo...
dbgserial_putstr_fmt(buffer, sizeof(buffer), "MBuf <%p>: length=%"PRIu32", data=%p, " "flags=0x%"PRIx32, m, m->length, m->data, m->flags)
; m = m->next; } }
{ -112, 456, 280}, { 8, 576, 64}, { -16, 768, 24}, { -216, 1128, 104}, { -152, 768, 264}, { -288, 936, 264}, { -344, 896, 408}, { -360, 744, 472}, { -352, 832, 448}, { -320, 816, 472}, { -304, 688, 504}, { -296, 792, 528}, { -296, 704, 504}, { -304, 704, 568}, ...
{ 40, 1032, 24}, { 40, 1048, 0}, { 48, 1048, 64}, { 56, 1000, 72}, // 216 seconds { -24, 864, 80}, { -168, 648, 104}, { -288, 808, 88}, { -56, 912, 16}, { 128, 960, 56}, { 48, 960, 56}, { -32, 952, 32}, { -48, 864, 0}, { -96, 888, -16}, { 16, 960, 32}, { 8...
{ -360, 984, 1000}, { -352, 1104, 928}, { -224, 1248, 1152}, { -272, 608, 1008}, { -296, 736, 608}, { -464, 704, 320}, { -496, 600, -32}, { -424, 456, -216}, // 219 seconds { -504, 688, -376}, { -544, 848, 184}, { -568, 1568, 376}, { -576, 376, 568}, { -784, 616,...
buf, "0zero1"); // Variable length character output snprintf(dstbuf, 256, "There are %*x lights", 3, 16); cl_assert_equal_s(dstbuf, "There are 10 lights"); // Variable length digits output snprintf(dstbuf, 256, "There are %.*x lights", 3, 16); cl_assert_equal_s(dstbuf, "There are 010 lights"); // Vari...
(dstbuf, "Hurf")
; // Plus for positive signed // No signed conversion occurs, so this is a no-op snprintf(dstbuf, 256, "Hur%+c", 'f'); cl_assert_equal_s(dstbuf, "Hurf"); // Variable length character output snprintf(dstbuf, 256, "Hur%*c", 2, 'f'); cl_assert_equal_s(dstbuf, "Hur f"); } void test_sprintf__percent_s(void)...
ain minutes"); uncertain_m = KALG_MAX_UNCERTAIN_SLEEP_M; } // Send whatever complete DLS records we have prv_send_minute_data(uncertain_m, sleep_stats.sleep_start_utc, sleep_stats.sleep_len_m, false /*to_file*/, false /*force_send*/); // Send whatever complete minute file records we...
if (session->type == ActivitySessionType_RestfulSleep) { if (most_recent_nap_session == NULL) { continue; } if ((session->start_utc < most_recent_nap_session->start_utc) || (session->start_utc > (most_recent_nap_session->start_utc + (most_recent_nap_session->length_min ...
the removed items list // as we want to add it back to the window stack. if (window_stack_from) { ListNode *node = list_find(window_stack_from->removed_list_head, prv_filter_window_item_for_window, window); if (node != NULL) { list_remove(node, &window_stack_from->removed_list_head, NULL); ...
(window_stack, list_head, 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...
{ return; }
GenericAttribute *transcription_attr = generic_attribute_find_attribute(&msg->attr_list, VEAttributeIdTranscription, attr_list_size); if (!transcription_attr || transcription_attr->length == 0) { PBL_LOG(LOG_LEVEL_WARNING, "No transcription attribute found"); voice_handle_dictation_result(VoiceEndp...
/* * 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...
GRect(84, 92, 60, 60)
; GRect from_rect_b = GRect(84, 0, 60, 60); GRect to_rect_b = GRect(0, 92, 60, 60); GRect tmp; if (toggle) { tmp = to_rect_b; to_rect_b = from_rect_b; from_rect_b = tmp; } toggle = !toggle; animation_destroy(s_animation); s_animation = NULL; PropertyAnimation *a = property_animation_cr...
/* * 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...
(third, f(third, 0, ANIMATION_NORMALIZED_MAX))
; cl_assert_equal_i(two_third, f(two_third, 0, ANIMATION_NORMALIZED_MAX)); cl_assert_equal_i(four_third, f(four_third, 0, ANIMATION_NORMALIZED_MAX)); cl_assert_equal_i(-65535, f(-half, 0, half)); cl_assert_equal_i(0, f(0, 0, half)); cl_assert_equal_i(43690, f(third, 0, half)); cl_assert_equal_i(8738...
<stdlib.h> // Stubs /////////////////////////////////////// #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_rand_ptr.h" // Fakes /////////////////////////////////////// #include "fake_app_manager.h" #include "fake_pebble_tasks.h" // Structures ////////////////////...
(&s_app_uuid, NOT_RUNNING)
; cl_assert_equal_i(s_launcher_deprecated_messages, 1); cl_assert_equal_i(s_app_run_state_messages, 1); // Changing the remote should change the flags and use launcher_app_message // if app_run_state not supported prv_set_remote_active(); app_run_state_send_update(&s_app_uuid, NOT_RUNNING); cl_assert_equ...
ool busy; }I2cBus; static I2cBus i2c_buses[BOARD_I2C_BUS_COUNT]; static uint32_t s_guard_events[] = { I2C_EVENT_MASTER_MODE_SELECT, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED, I2C_EVENT_MASTER_BYTE_TRANSMITTED, I2C_EVENT_MASTER_MODE_SELECT, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED, I2C_EVENT_MASTER_B...
(MIN_STOP_TIME_MS)
; bus_pin_cfg_input(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_scl); bus_pin_cfg_input(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_sda); BOARD_CONFIG.i2c_bus_configs[bus_idx].rail_ctl_fn(true); } //! Initialize the I2C peripheral //! Lock the bus and peripheral config access before initialization static void bus_...
; if (!s_app_state_ptr) { return false; } s_app_state_ptr->sdk_type = sdk_type; s_app_state_ptr->initial_obstruction_origin_y = obstruction_origin_y; if (GBITMAP_NATIVE_FORMAT != GBitmapFormat1Bit && sdk_type == ProcessAppSDKType_Legacy2x) { // When running legacy2 aplite apps on basalt we act...
{ return s_app_state_ptr->localtime_zone; }
void *app_state_get_rand_ptr(void) { return &s_app_state_ptr->rand_seed; } AppInbox **app_state_get_app_message_inbox(void) { return &s_app_state_ptr->app_message_inbox; } EventServiceInfo *app_state_get_app_outbox_subscription_info(void) { return &s_app_state_ptr->app_outbox_subscription_info; } AnimationSta...
ime_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 MIN AGO", time_buf); // June 9th 2015, 15:00:00 (T-01:00:00) rtc_set_time(event_time - (1 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert...
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("IN 1 MIN", time_buf); // June 9th 2015, 15:58:00 (T-00:02:00) rtc_set_time(event_time - (2 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 2 MIN", time_buf); // June 10th 2015, 04:00:00 (T+12:00:...
t(RebootReasonCode_HardFault, stacked_lr); return; } // We got this! Let's redirect this task to a spin function and tell the app manager to kill us. prv_return_to_landing_zone(stacked_pc, stacked_lr, stacked_args); // We can't get LR or PC, so just set to 0's. } // Hardware Fault Handlers //////////////...
(stacked_args)
; char buffer[80]; fault_handler_dump(buffer, stacked_args); PBL_LOG_FROM_FAULT_HANDLER(""); attempt_handle_generic_fault(stacked_args); } void UsageFault_Handler(void) { __asm("tst lr, #4\n" "ite eq\n" "mrseq r0, msp\n" "mrsne r0, psp\n" "b %0\n" :: "i" (usagefault_handler...
ders(void) { // add all four explicitly out of order cl_assert_equal_i(S_SUCCESS, reminder_db_insert_item(&item4)); cl_assert_equal_i(S_SUCCESS, reminder_db_insert_item(&item2)); cl_assert_equal_i(S_SUCCESS, reminder_db_insert_item(&item1)); cl_assert_equal_i(S_SUCCESS, reminder_db_insert_item(&item3)); } ...
reminder_db_next_item_header(&temp)
); } void test_reminder_db__size_test(void) { prv_insert_default_reminders(); cl_assert(sizeof(SerializedTimelineItemHeader) == reminder_db_get_len((uint8_t*) &item1.header.id, sizeof(TimelineItemId))); cl_assert(sizeof(SerializedTimelineItemHeader) == reminder_db_get_len((uint8_t*) &item2.header.id, sizeof(Ti...
------------------------------ // Globals void *s_kalg_state; // ================================================================================== // Assertion utilities // Assert that a particular activity session is present in the sessions list static void prv_assert_activity_present(KAlgTestActivitySession *sessi...
if (s_stat_rows) { list_append(&s_stat_rows->node, &stats->node); } else { s_stat_rows = stats; }
} // --------------------------------------------------------------------------------------- // Set a specific column in the last row by name static void prv_stats_set_last_row_value(const char* name, uint32_t value) { if (s_stat_rows == NULL) { return; } StatsRow *stats = (StatsRow *)list_get_tail(&s_stat...
t storage too data->lap_steps = data->cur_steps; persist_write_int(AppPersistKeyLapSteps, data->lap_steps); } if (data->steps_card.delta_step_layer) { if (data->lap_steps) { snprintf(data->steps_card.delta_step_text, sizeof(data->steps_card.delta_step_text), "%d", (int) (data->cur_s...
(data->steps_card.time_layer, GTextAlignmentCenter)
e number of the expired timer, and 0 is returned. static TickType_t prv_poll_timer(uint8_t *const sequence_number) { mutex_lock(s_reliable_timer_state_lock); RtcTicks timer_expiry_tick = s_reliable_timer_expiry_time_tick; TickType_t timeout = portMAX_DELAY; if (timer_expiry_tick) { // A timer is pending Rt...
mutex_create()
ack_artist(const char *artist, size_t artist_length) { off_t o = offsetof(__typeof__(s_music_ctx), artist); prv_update_string_and_put_event(artist, artist_length, o); } void music_update_track_album(const char *album, size_t album_length) { off_t o = offsetof(__typeof__(s_music_ctx), album); prv_update_string_...
prv_put_state_changed_event(state->playback_state)
; prv_put_pos_changed_event(); } void music_update_player_volume_percent(uint8_t volume_percent) { mutex_lock_recursive(s_music_ctx.mutex); s_music_ctx.player_volume_percent = volume_percent; mutex_unlock_recursive(s_music_ctx.mutex); PebbleEvent event = { .type = PEBBLE_MEDIA_EVENT, .media = { ...
tations under the License. */ #include "os/mutex.h" #include "kernel/pbl_malloc.h" #include "process_management/app_manager.h" #include "process_management/worker_manager.h" #include "services/common/analytics/analytics.h" #include "services/common/analytics/analytics_metric.h" #include "services/common/analytics/an...
{ // There is a brief period of time where no app is running, which we // attribute to the system UUID. For now, this lets us track how // much time we are missing, although we probably want to try and // tighten this up as much as possible going forward. uuid = &uuid_system; ...
} ListNode *node = list_find((ListNode*)s_app_heartbeat_list, prv_is_app_node_with_uuid, (void*)uuid); AnalyticsHeartbeatList *app_node = (AnalyticsHeartbeatList*)node; if (!app_node) { if (list_count((ListNode *)s_app_heartbeat_list) >= MAX_APP_HEARTBEATS) { ...
/* * 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 (enable) { bus->spi->CR2 |= (uint16_t)dma_bits; } else { bus->spi->CR2 &= (uint16_t)~dma_bits; }
} static void prv_spi_cmd(const SPIBus *bus, SpiFunctionalState state) { if (state != SpiDisable) { /* Enable the selected SPI peripheral */ bus->spi->CR1 |= SPI_CR1_SPE; } else { /* Disable the selected SPI peripheral */ bus->spi->CR1 &= (uint16_t)~((uint16_t)SPI_CR1_SPE); } } void prv_spi_pic...
elay_a + duration_a); const int duration_b = 500; const int delay_b = 200; const int play_count_b = 3; const int total_duration_b = play_count_b * (delay_b + duration_b); const int delay_spawn = 150; const int play_count_spawn = 2; int duration_total = play_count_spawn * (MAX(total_duration_a, total_du...
{ #ifdef TEST_INCLUDE_COMPLEX // Create animations // Create a sequence out of a and b Animation *a = prv_create_test_animation(); Animation *b = prv_create_test_animation(); Animation *seq = animation_sequence_create(a, b, NULL); cl_assert(seq != NULL); // Try to create a spawn out of b and c Animat...
GS, APP_ID_NOTIFICATIONS, APP_ID_ALARMS, APP_ID_WATCHFACES, BG_COUNTER_APP_ID, MENU_LAYER_APP_ID}; uint8_t num_entries = ARRAY_LENGTH(written_order); prv_write_order_to_file(written_order, num_entries); app_install_mark_prioritized(APP_ID_MUSIC, true /* can expire */); app_in...
cl_assert_equal_i(node->install_id, desired_order[i])
e { #if PBL_RECT uint16_t cell_heights[OptionMenuContentTypeCount]; #endif int16_t top_inset; int16_t right_icon_spacing; int16_t text_inset_single; int16_t text_inset_multi; int16_t right_text_inset_with_icon; } OptionMenuStyle; static const OptionMenuStyle s_style_medium = { #if PBL_RECT .cell_heights[...
PBL_IF_RECT_ELSE(0, 14)
d to >= 0 EXECUTE_SCRIPT( "ctx.rockyFillRadial(30, 40, -10, -20, 0, Math.PI);\n" ); cl_assert_equal_i(3, s_graphics_fill_radial_precise_internal.call_count); cl_assert_equal_point_precise((PP(29.5, 39.5)), lc->fill_radial_precise.center); cl_assert_equal_i(0, lc->fill_radial_precise.radius_inner.raw_value...
( "ctx.fillText('more text', -10.5, 5000, 60);\n" )
n); } kernel_free(data); s_activity_state.sample_collection_data = NULL; s_activity_state.sample_collection_seconds = rtc_get_time() - s_activity_state.sample_collection_seconds; } *enabled = s_activity_state.sample_collection_enabled; ...
activity_stop_tracking()
; while (s_activity_state.started) { // Wait for stop_tracking KernelBG callback to run sys_psleep(1); } cron_job_unschedule(&s_activity_job); mutex_destroy((PebbleMutex *)s_activity_state.mutex); if (reset_settings) { pfs_remove(ACTIVITY_SETTINGS_FILE_NAME); } if (sleep_history) { prv_wr...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&s_kernel_content_indicators_buffer)
; s_kernel_current_timeline_item_action_source = TimelineItemActionSourceModalNotification; } GContext* kernel_ui_get_graphics_context(void) { PBL_ASSERT_TASK(PebbleTask_KernelMain); return &s_kernel_grahics_context; } GContext *graphics_context_get_current_context(void) { if (pebble_task_get_current() == Pe...
time + QEMU_RECV_PACKET_TIMEOUT_SEC) { state->recv_state = QemuRecvState_WaitingHdrSignatureMSB; PBL_LOG(LOG_LEVEL_WARNING, "Resetting receive state - max packet time expired"); } state->callback_pending = false; uint16_t bytes_avail = shared_circular_buffer_get_read_space_remaining(&state->isr_buffer, ...
if (footer.signature != QEMU_FOOTER_SIGNATURE) { PBL_LOG(LOG_LEVEL_WARNING, "Invalid footer signature"); }
state->recv_state = QemuRecvState_WaitingHdrSignatureMSB; } } break; } // switch() } // while (!exit && bytes_avail) // Return pointer if we got a complete message if (got_msg) { *msg_bytes= state->msg_buffer_bytes; *protocol = state->hdr.protocol; return state->msg...