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...
if (bus_mode != I2CBusMode_Standard && bus_mode != I2CBusMode_FastMode) { // This is FM+ (or higher) and is not currently supported. return I2C_TIMINGR_INVALID_VALUE; }
if (target_bus_frequency > s_timing_data[bus_mode].clock_speed_max) { return I2C_TIMINGR_INVALID_VALUE; } uint32_t min_scl_low_ps = s_timing_data[bus_mode].min_scl_low_ps; uint32_t min_scl_high_ps = s_timing_data[bus_mode].min_scl_high_ps; for (uint32_t prescaler = 1; prescaler <= TIMINGR_MAX_PRESC; ++...
turn analytics_metric_offset(last) + analytics_metric_size(last); } ///////////////////// // Private static bool prv_verify_kinds_match(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric) { AnalyticsMetricKind metric_kind = analytics_metric_kind(metric); if ((metric_kind == ANALYTICS_METRIC_KIND_DEVICE) && ...
memcpy(location, data, size)
; } ///////// // Get int64_t analytics_heartbeat_get(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric) { uint8_t *location = prv_heartbeat_get_location(heartbeat, metric); return prv_location_get_value(location, analytics_metric_element_type(metric)); } int64_t analytics_heartbeat_get_array(AnalyticsHeartbea...
/* * 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...
fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)
_reminder_timer_id()), sizeof(TimelineItemId)); cl_assert(stub_new_timer_timeout(get_reminder_timer_id()) == 0); stub_pebble_tasks_set_current(PebbleTask_NewTimers); cl_assert(stub_new_timer_fire(get_reminder_timer_id())); stub_pebble_tasks_set_current(PebbleTask_KernelBackground); fake_system_task_callbacks_...
uuid_equal(&s_reminder_before_all_day_reminder.header.id, (Uuid *)stub_new_timer_callback_data(get_reminder_timer_id()))
); // set time to 21:00 PST March 4 now = 1425531600; stub_pebble_tasks_set_current(PebbleTask_NewTimers); cl_assert(stub_new_timer_fire(get_reminder_timer_id())); stub_pebble_tasks_set_current(PebbleTask_KernelBackground); fake_system_task_callbacks_invoke(1); cl_assert_equal_i(stub_new_timer_timeout(ge...
l_i(last_update_utc, 0); // Simulate some HRM callbacks with no heart rate, should get 0 median prv_advance_time_hr(10 /*sec*/, 0 /*hr*/, HRMQuality_Good, true /*force_continuous*/); activity_metrics_prv_get_median_hr_bpm(&median, &total_weight); cl_assert_equal_i(median, 0); cl_assert_equal_i(total_weight, ...
(1 /*sec*/, 120 /*hr*/, HRMQuality_Excellent, true /*force_continuous*/)
; cl_assert_equal_i(s_num_hr_events, 4); cl_assert_equal_i(s_last_hr_event.data.heart_rate_update.current_bpm, 120); cl_assert_equal_i(s_last_hr_event.data.heart_rate_update.quality, HRMQuality_Excellent); // Should not fire off an event. Bad HR reading prv_advance_time_hr(1 /*sec*/, 20 /*hr*/, HRMQuality_Ex...
x00, 0x06, 0x42, 0x6F, 0x62, 0x62, 0x79, 0x00}; // "Bobby" phone_protocol_msg_callback(s_session, pp_msg, sizeof(pp_msg)); fake_system_task_callbacks_invoke_pending(); prv_assert_last_event(PhoneEventType_Incoming, true /* check_cookie */, true /* check_name_number */, ...
prv_assert_last_event(PhoneEventType_Start, true /* check_cookie */, false /* check_name_number */, NULL, NULL)
; } void test_phone_pp__get_phone_call_state_response_two_started_calls(void) { pp_get_phone_state_set_enabled(true); uint8_t pp_msg[] = {0x83, 0x05, 0x12, 0x34, 0x45, 0x67, 0x89, 0x05, 0x08, 0x1a, 0xd4, 0x77, 0x08}; phone_protocol_msg_callback(s_session, pp_msg, sizeo...
tx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_y.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_across_y_second_line); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_ajj22.${BIT_DEPTH_NAME}.pbi"))
; // Test when clipping/drawing and text bounds are all at (2, 0) - no negative offset setup_test_aa_sw(&ctx, fb, RECT_TEXT_2_0, RECT_TEXT_2_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "aaa", &s_font_info, RECT_TEXT_2_0, GTextOverflowModeTrail...
HEAVY_SNOW, .tomorrow_high = 2, .tomorrow_low = 1, .tomorrow_weather_type = WeatherType_Sun }, { .location_name = TEST_WEATHER_DB_LOCATION_RWC, .is_current_location = true, .current_temp = 60, .today_high = 70, .today_low = 50, .current_weather_type = WeatherType_HeavyRain, ....
cl_assert(forecast)
; prv_assert_forecast_equal(forecast, &s_forecasts[0]); weather_service_destroy_default_forecast(forecast); }
.orientation, m_rec->base.vmc, m_rec->base.light, (int) m_rec->base.plugged_in); // Pass the minute data onto the activity detection logic kalg_activities_update(s_alg_state->k_state, utc_sec, m_rec->base.steps, m_rec->base.vmc, m_rec->base.orientation, m_rec->base.plu...
if (dst_index < 0) { // This record older than the caller wanted. Return false to look for more return false; }
// If this is newer than the caller wanted, we are done if (dst_index >= (int32_t)context->array_size) { return true; } // Is this the first one we found? if (context->utc_start == 0) { context->utc_start = record_utc; } context->last_record_idx_written = dst_index; // Put it in uint32_t r...
t_buffer, sizeof(data->error_text_buffer)); dialog_set_text(dialog, data->error_text_buffer); dialog_set_icon(dialog, resource_id); dialog_set_background_color(dialog, color); dialog_set_timeout(dialog, has_timeout ? ERROR_DIALOG_TIMEOUT : DIALOG_TIMEOUT_INFINITE); dialog_set_destroy_on_pop(dialog, false /* f...
prv_get_time_ms()
- data->start_ms; data->num_sessions++; } static void prv_dictation_timeout_cb(void *context) { VoiceUiData *data = context; VOICE_LOG("Single session timeout"); prv_stop_dictation(data); } static void prv_handle_ready_error(VoiceUiData *data) { data->session_id = VOICE_SESSION_ID_INVALID; data->error_c...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
mfg_info_get_rtc_freq()
, 0xfefefefe); mfg_info_set_rtc_freq(1337); cl_assert_equal_i(mfg_info_get_rtc_freq(), 1337); } void test_snowy_mfg_info__model(void) { // Intentionally make the buffer too long so we can check for truncation. char buffer[MFG_INFO_MODEL_STRING_LENGTH + 1] = { 0 }; mfg_info_get_model(buffer); cl_assert_eq...
nt16_t x_offset = GRID_CELL_PADDING + (content_size * (GRID_CELL_PADDING + DISP_COLS)); s_ctx.draw_state.drawing_box.origin = GPoint(x_offset, 0); prv_render_action_menu_window(root_level, selected_index, ActionMenuLayerLongLabelScrollingAnimationState_Top, ...
(root_level, selected_index, 0)
; cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_action_menu_window__thin_display_mode_two_row(void) { static const char* thin_values[] = { "a", "b", "c", "d", "e" }; ActionMenuLevel *root_level = action_menu_level_create(ARRAY_LENGTH(thin_values)); action_menu_level_set_display_mode(root_...
ca/Casablanca] Rule Azer 1997 max - Mar lastSun 4:00 1:00 S Rule Azer 1997 max - Oct lastSun 5:00 0 - * TODO: * At least as insane as Egypt, without the possibility of parole. Mar 29th 2015 02:00 UTC ~ Oct 25th 2015 02:00 UTC, GMT+0 */ [23]={ 1427594400, 1445738400, 0 * S...
rtc_timezone_clear()
; clock_init(); static const time_t jan1st_noon_2015 = 1420113600; for (int dstid = 0; dstid < DST_ID_COUNT; dstid++) { TimezoneInfo tz_info = { .dst_id = dstid, .tm_gmtoff = s_dst_correct_values[dstid][2] }; prv_update_dstrule_timestamps_by_dstzone_id(&tz_info, jan1st_noon_2015); ...
(TIM2, ENABLE); // Setup another unused interrupt vector to handle our low priority interrupts. When we need to do higher // level functions (like PBL_LOG), we trigger this lower-priority interrupt to fire. Since it runs at // configMAX_SYSCALL_INTERRUPT_PRIORITY or lower, it can at least call FreeRTOS ISR funct...
NVIC_SetPendingIRQ(WATCHDOG_FREERTOS_IRQn)
; s_last_warning_message_tick_time = 0; } #if defined(TARGET_QEMU) // Investigating PBL-29422 extern volatile int g_qemu_num_skipped_ticks; g_qemu_num_skipped_ticks = 0; #endif // defined(TARGET_QEMU) } // If we haven't fed the watchdog in the last 5 seconds and we haven't // spammed the l...
include "applib/ui/layer.h" #include "applib/ui/text_layer.h" #include "applib/ui/window.h" #include "kernel/ui/kernel_ui.h" #include "resource/resource_ids.auto.h" #include "system/passert.h" #include <limits.h> #include <string.h> static void prv_actionable_dialog_load(Window *window) { ActionableDialog *actionab...
(x, y, w, h)
, dialog->buffer, dialog_text_font, dialog->text_color, GColorClear, text_alignment, GTextOverflowModeWordWrap); if (text_attributes) { text_layer->should_cache_layout = true; text_layer->layout_cache = text_...
// Pebble protocol message ID: INSERT 0x17, 0x00, // Token TEST_DB_ID, // BlobDBDatabaseId: 0x01 0x00, // Size primary key: sizeof(Uuid) = 16 = 0x10 // garbage data to put message above minimum 0x01, 0x02, 0x03, 0x04, 0x05, // no value size }; void...
(s_insert_cmd_size_value_wrong, sizeof(s_insert_cmd_size_value_wrong))
tted(&ctx, GPoint(10, 10), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(5, 15), 10); // cross - odd vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(41, 11), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(36, 16), 10); // T facing up graphics_draw_vertical_line_dotted(&ct...
graphics_draw_line(ctx, GPoint(70,70), GPoint(70,70))
ss_bar, PROGRESS_TYPICAL_COLOR, typical_end); #endif } } static void prv_render_progress_bar(GContext *ctx, Layer *base_layer) { HealthSleepSummaryCardData *data = layer_get_data(base_layer); // Renders the background health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_BACKGROUND_COLOR, ...
prv_render_icon(ctx, base_layer)
; prv_render_progress_bar(ctx, base_layer); if (!prv_has_sleep_data(data->health_data)) { prv_render_no_sleep_data_text(ctx, base_layer); return; } prv_render_current_sleep_text(ctx, base_layer); prv_render_typical_sleep_text(ctx, base_layer); } static void prv_sleep_detail_card_unload_callback(W...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(atoi("-21474836471"), -(int)4294967287)
; } // atol will actually behave _exactly_ the same as atoi, so these tests are just copy-pasted // Would probably be good to make these more DRY void test_atol__basic(void) { cl_assert_equal_i(atol("500"), 500); cl_assert_equal_i(atol("765"), 765); cl_assert_equal_i(atol("573888"), 573888); cl_assert_equal_i(...
al level. hr_time_left = WORKOUT_ENDED_HR_SUBSCRIPTION_TS_EXPIRE - time_since_workout; } #if CAPABILITY_HAS_BUILTIN_HRM if (hr_time_left > 0) { // Still some time left. Set a subscription with an expiration s_workout_data.hrm_session = sys_hrm_manager_app_subscribe(app_get_app_id(),...
prv_unlock()
; return true; } // --------------------------------------------------------------------------------------- bool workout_service_stop_workout(void) { bool rv = true; prv_lock(); { if (!workout_service_is_workout_ongoing()) { PBL_LOG(LOG_LEVEL_WARNING, "No workout in progress"); rv = false; ...
lock_recursive(s_activity_state.mutex); { cur_day_index = time_util_get_day(utc_sec); need_history_update_event = (cur_day_index != s_activity_state.cur_day_index); // Call the activity sessions minute handler activity_sessions_prv_minute_handler(utc_sec); // Update our backing store if necessar...
(s_activity_state.mutex)
; } // ------------------------------------------------------------------------------------------------ // Runs on the timer task. Simply register a callback for the KernelBG task from here. static void prv_minute_cb(CronJob *job, void *data) { system_task_add_callback(prv_minute_system_task_cb, data); cron_job_s...
ing", (int)bytes_read); return false; } else if (bytes_read < (int)size) { PBL_LOG(LOG_LEVEL_ERROR, "Read only %d bytes, expected %d", (int)bytes_read, (int)size); return false; } return true; } // ---------------------------------------------------------------------------------------- // Logs if an...
{ if (session->storage.write_offset == 0) { // The write offset is 0 if we've never created storage for this session. return true; } if (!prv_get_session_file(session, 0)) { // We couldn't open up this storage file. Since we are just compacting where we can, // just return true so that we go on t...
// ----------------------------------------------------------------------------------------- // Make sure there is at least 'needed' bytes available in our file system space // allowed for data logging static bool prv_make_file_system_space(uint32_t needed) { // Make sure we have at least 'needed' bytes free in th...
/* * 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(prv_convert_1bit_addr_to_8bit_x(bitmap, block_addr, dest_y), prv_get_8bit_x_from_1bit_x(dest_x))
; dest_x = 50; dest_y = 0; block_addr = (uint32_t *)(uintptr_t)(((dest_y * row_1bit_size_words) + (dest_x / 32)) * 4); cl_assert_equal_i(prv_convert_1bit_addr_to_8bit_x(bitmap, block_addr, dest_y), prv_get_8bit_x_from_1bit_x(dest_x)); dest_x = 0; dest_y = 50; block_addr = (uint32_t *...
rrentCompletionStatus; static FwUpdateCurrentCompletionStatus s_current_completion_status = { 0 }; // // Start handlers for legacy percentage status handling. Someday, we can hopefully // remove them outright and it should just involve deleting these routines // static bool prv_legacy_firmware_update_get_percent_pr...
prv_firmware_update_start(event)
; s_update_status = result; PBL_ASSERTN((result == FirmwareUpdateRunning) || (result == FirmwareUpdateStopped) || (result == FirmwareUpdateCancelled)); system_message_send_firmware_start_response(result); } static void prv_firmware_update_finish(bool failed) { if (xSemaphoreTake(s_f...
/ Main loop helpers uint16_t intensity_shift, error_adj, error_acc; uint16_t error_acc_temp, weighting, weighting_complement_mask; int16_t dx, dy, tmp, xi; // Grabbing framebuffer for drawing and stroke color to blend GBitmap *framebuffer = graphics_capture_frame_buffer(ctx); GColor stroke_color = ctx->dra...
{ // The error accumulator turned over, so advance the Y coord y1++; }
x1 += xi; weighting = error_acc >> intensity_shift; graphics_private_plot_pixel(framebuffer, &ctx->draw_state.clip_box, x1, y1, weighting, stroke_color); graphics_private_plot_pixel(framebuffer, &ctx->draw_state.clip_box, x1, y1 + 1, ...
um_apps; i++) { AppMenuNode *node = app_menu_data_source_get_node_at_index(&data_source, i); // MENU_LAYER_APP_ID isn't in file, but it should still be in the list at the end. if (i == (num_apps - 1)) { cl_assert_equal_i(node->install_id, MENU_LAYER_APP_ID); } else { cl_assert_equal_i(node-...
{ // Apps are sorted in the order of Quick Launch only, Override apps, Storage (smallest first), // Record (smallest first), and finally Install ID (smallest first). Verify that this is true. // This also tests that the Settings app (a special case) respects storage order if it exists // in the storage order li...
AppMenuNode *node = app_menu_data_source_get_node_at_index(&data_source, i); cl_assert_equal_i(node->install_id, desired_order[i]); } app_menu_data_source_deinit(&data_source); } void test_app_menu_data_source__settings_app_floats_to_top_if_absent_from_storage_order(void) { AppInstallId storage_order[]...
(advert_terms_b[1].min_interval_slots, advert_terms_b[1].max_interval_slots)
; // Expect A's second term. B's third term (silent) will "run" now too. regular_timer_fire_seconds(1); cl_assert_equal_b(gap_le_is_advertising_enabled(), true); assert_ad_data("A"); gap_le_assert_advertising_interval(advert_terms_a[1].min_interval_slots, advert_terms_a[1...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(app_glance_db_read_glance(&APP_GLANCE_TEST_UUID, &glance), S_SUCCESS)
; // Compare the glance read back with the expected glance below AppGlance expected_glance = (AppGlance) { .num_slices = 2, .slices = { { .expiration_time = rtc_get_time() + 10, .type = AppGlanceSliceType_IconAndSubtitle, .icon_and_subtitle.icon_resource_id = TIMELINE_RESOURCE...
/* * 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 Date.now().getMilliseconds; })
; const double wait_ms = 1000 - ms_into_s; const bool is_update_due_to_time_change = false; emscripten_async_call(prv_do_update, (void *)(uintptr_t)is_update_due_to_time_change, wait_ms); } void tick_timer_service_handle_time_change(void) { const bool is_update_due_to_time_change = true; prv_do_update((void ...
icense, 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 * distributed under the License is distribut...
{ int32_t dist = serial_distance(7, 0, 3); cl_assert_equal_i(dist, 1); }
{ int32_t dist = serial_distance(6, 0, 3); cl_assert_equal_i(dist, 2); } { int32_t dist = serial_distance(7, 1, 3); cl_assert_equal_i(dist, 2); } { int32_t dist = serial_distance(6, 1, 3); cl_assert_equal_i(dist, 3); } } void test_math__is_signed_macro(void) { cl_assert(IS_SIGNED...
mpOpAssign, GColorWhite); test_bmp.addr = test_blend_colors; bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, &test_bmp, upper_rect, GPointZero, GCompOpTint, upper_tint_color); // Lower row with destination colors from 31..63 const int16_t y_lower = y_upper + NUM_COLORS + OFFSET + LEGEND_HEIGHT; const...
bitblt_bitmap_into_bitmap_tiled_8bit_to_8bit( &dest_bitmap, src_bitmap, dest_rect, GPointZero, GCompOpAssign, GColorWhite)
; cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_wrap_y-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Test src_origin_offset, shouldn't see any red in dest_bitmap. // This covers src_origin_offset, y-axis and x-axis wraparound. // Setup: // - Source 25x25, 2 columns, 2 rows red, rest is blac...
/* * 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...
(filename)
tionIntent *intent, GAPLEClient c, bool should_send_disconnection_event, uint8_t hci_reason) { if (!intent->client[c].is_used) { // No intent that is owned by the given client return BTErrnoInvalidPa...
{ if (!device || client >= GAPLEClientNum) { return BTErrnoInvalidParameter; } bt_lock(); // Find the intent for the device: GAPLEConnectionIntent *intent = prv_get_intent_by_device(device); BTErrno ret_value; if (!intent) { // No intent for given device ret_value = BTErrnoInvalidParameter; ...
// ------------------------------------------------------------------------------------------------- BTErrno gap_le_connect_connect_by_bonding(BTBondingID bonding_id, bool auto_reconnect, bool is_pairing_required, GAPLEClient client) { if (bonding_id == BT_BONDING_ID_INVAL...
(next_alarm, rtc_get_time() + time_until_alarm)
; // Schedule another alarm before the previous alarm, it becomes the next alarm id2 = alarm_create(&(AlarmInfo) { .hour = 9, .minute = 30, .kind = ALARM_KIND_WEEKDAYS }); at_least_one_alarm_enabled = alarm_get_next_enabled_alarm(&next_alarm); cl_assert_equal_b(at_least_one_alarm_enabled, true); alarm_is_sch...
h" #include "kernel/pbl_malloc.h" #include "comm/bt_lock.h" #include "gap_le_scan.h" #include "kernel/events.h" #include "system/hexdump.h" #include "system/logging.h" #include "system/passert.h" #include "util/circular_buffer.h" #include "util/likely.h" #include <btutil/bt_device.h> #include <string.h> // ---------...
circular_buffer_get_read_space_remaining(&s_circular_buffer)
>protocol_number); *request = (struct LCPPacket) { .code = ControlCode_ConfigureRequest, .identifier = id, .length = hton16(LCP_HEADER_LEN), }; pulse_link_send(request, LCP_HEADER_LEN); } static void prv_send_configure_ack(PPPControlProtocol *this, struct LCPPacket ...
(this, LinkState_Closed)
; break; default: break; } } mutex_unlock(this->state->lock); } static bool prv_handle_configure_request(PPPControlProtocol *this, struct LCPPacket *packet) { if (ntoh16(packet->length) == LCP_HEADER_LEN) { // The request has no options prv_...
IGHT_DIFF * anim_percent_complete) / 100); } else { return 0; } } static int prv_get_font_top_padding(GFont font) { if (font == fonts_get_system_font(FONT_KEY_GOTHIC_36_BOLD)) { return 14; } else if (font == fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)) { return 10; } else if (font == fonts_get...
// If the slide animation is in progress, then don't set the background color. The slide // will be drawn over top of this later if (selection_layer->selected_cell_idx == i && !selection_layer->slide_amin_progress) { bg_color = selection_layer->active_background_color; } graphics_context_set_f...
} static void prv_draw_slider_slide(SelectionLayer *selection_layer, GContext *ctx) { // Find the active cell's x-offset int starting_x_offset = prv_centered_offset_x(selection_layer); for (unsigned i = 0; i < selection_layer->num_cells; i++) { if (selection_layer->selected_cell_idx == i) { break; ...
ntext *ctx, Layer *base_layer) { HealthSleepSummaryCardData *data = layer_get_data(base_layer); // Renders the background health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_BACKGROUND_COLOR, 0, HEALTH_PROGRESS_BAR_MAX_VALUE); prv_render_sleep_sessions(ctx, data); prv_ren...
{ HealthSleepSummaryCardData *data = layer_get_data(base_layer); prv_render_icon(ctx, base_layer); prv_render_progress_bar(ctx, base_layer); if (!prv_has_sleep_data(data->health_data)) { prv_render_no_sleep_data_text(ctx, base_layer); return; } prv_render_current_sleep_text(ctx, base_layer); ...
static void prv_sleep_detail_card_unload_callback(Window *window) { health_sleep_detail_card_destroy(window); } //////////////////////////////////////////////////////////////////////////////////////////////////// // API Functions // Layer *health_sleep_summary_card_create(HealthData *health_data) { // create ba...
(7 * SECONDS_PER_DAY)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Jun 12, 12:00 PM", time_buf); // June 5th 2015, 12:00:01 (T-7DAY+00:00:01) rtc_set_time(jun10th_noon_2015 - (7 * SECONDS_PER_DAY) + 1); clock_get_until_time_capitalized(time_...
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("IN 11 H", time_buf); // June 12th 2015, 01:00:00 (T-11:00:00) rtc_set_time(event_time - (11 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 11 H", time_buf); // June 12th 2015, 01:00:01 (T-10:59:59...
/* * 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...
(0, (int32_t)player->to_elapsed_ms - animation_elapsed_ms)
; } else { elapsed_ms = player->to_elapsed_ms; } bool frame_changed = kino_reel_set_elapsed(player->reel, elapsed_ms); prv_announce_frame_did_change(player, frame_changed); } static void prv_play_anim_stopped(Animation *anim, bool finished, void *context) { KinoPlayer *player = context; player->anima...
system_task_add_callback(prv_log_app_lr_and_pc_system_task, &s_current_app_crash_info)
; prv_kill_user_process(stashed_lr); for (;;) {} // Not Reached } static void hardware_fault_landing_zone(void) { prv_log_app_lr_and_pc_system_task(&s_current_app_crash_info); prv_kill_user_process(0); } static void prv_return_to_landing_zone(uintptr_t stacked_pc, uintptr_t stacked_lr, unsigned int* stacked...
ntialiased(ctx, false); graphics_context_set_stroke_width(ctx, 1); graphics_draw_line(ctx, GPoint(10,10), GPoint(10,10)); graphics_context_set_antialiased(ctx, true); graphics_context_set_stroke_width(ctx, 1); graphics_draw_line(ctx, GPoint(20,20), GPoint(20,20)); graphics_context_set_antialiased(ctx, fal...
test_graphics_context_init(&ctx, fb)
; setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, true, 1); graphics_context_set_stroke_color(&ctx, GColorBlack); // Draw lines around boundaries of clipping box - AA true, SW 1 prv_draw_lines(&ctx, 1, 0, 0); // Draw lines around boundaries of clipping box - AA true, SW 2 prv_draw_lines...
of any state change. Client tasks //! that have already been notified, will not be notified again. //! @note Upon disconnection, this function also removes and free's the intent //! if there are no more clients that want to auto-reconnect. The caller of this //! function should therefore not attempt to access the inte...
{ const BleRemoteVersionInfo *info = &e->remote_version_info; connection->remote_version_info = *info; PBL_LOG(LOG_LEVEL_DEBUG, "Remote Vers Info: VersNr: %d, CompId: 0x%x, SubVersNr: 0x%x", (int)info->version_number, (int)info->company_identifier, (int)info->subversion_number); }
/* * 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 config->title_font ?: system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle); }
ate, KAlgActivityType_Sleep); prv_unlock(); return rv; } // ------------------------------------------------------------------------------------ // Post-process the passed in sleep sessions. This function identifies which sleep sessions are // nap sessions and labels them as such // @param num_input_sessions numb...
(sizeof(AlgState))
; } if (!s_alg_state) { PBL_LOG(LOG_LEVEL_ERROR, "Not enough memory"); kernel_free(k_state); return false; } // Init globals *s_alg_state = (AlgState) { .mutex = mutex_create_recursive(), .k_state = k_state, }; shared_circular_buffer_init(&s_alg_state->minute_data_cbuf, ...
ns = true; gbitmap_deinit(&s_default_app_icon_bitmap); gbitmap_init_with_resource_system(&s_default_app_icon_bitmap, SYSTEM_APP, fallback_icon_id); source->default_icon = &s_default_app_icon_bitmap; } static GBitmap s_app_icon_bitmap; GBitmap *app_menu_data_source_get_node_icon(AppMenuDataSource *source, AppMenu...
resource_init()
; // Setup content indicators buffer ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); content_indicator_init_buffer(buffer); // Setup AppGlanceDB fake_settings_file_reset(); app_glance_db_init(); // Setup AppGlanceService app_glance_service_init(); // Default to showing bi...
(layer->bounds.size.w - offset - 1, layer->bounds.size.h - mask - 1)
); } } static void prv_draw_border(Layer *layer, GContext *ctx, uint8_t radial_padding_size) { if (radial_padding_size != 0) { prv_draw_round_border(layer, ctx, 0); } prv_draw_round_border(layer, ctx, radial_padding_size); // Draw letter to identify screen if (radial_padding_size >= 2) { GRect ide...
jerry_release_value(str_val)
; } } static void prv_malloc_and_assign_string_applier(const jerry_value_t str, const RockyArgBinding *binding) { *((char **)binding->ptr) = rocky_string_alloc_and_copy(str); } static bool prv_malloc_and_assign_string(const RockyArgBinding *binding, const jerry_val...
s or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" #include "clar.h" #include "util.h" #include <...
(&layer, &GRect(10, 10, 60, 60))
; layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_inside_offset_layer"))); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); l...
); if (out_ms) { *out_ms = t_ms; } if (tloc) { *tloc = t_s; } return (t_ms); } uint16_t pbl_override_time_ms_legacy(time_t *tloc, uint16_t *out_ms) { uint16_t t_ms; time_t t_s; sys_get_time_ms(&t_s, &t_ms); time_t legacy_time = sys_time_utc_to_local(t_s); if (out_ms) { *out_ms = t_ms; ...
while (*fmt != 0 && *fmt != '%') fmt++;
if (*fmt == 0) break; fmt++; // Skip flags, width, and precision until we find the format // specifier. If it's a floating point specifier, immediately bail. end_spec = false; while (!end_spec) { ch = *fmt++; switch (ch) { case 0: end_format = true; ...
/* * 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...
(fmt_args, fmt)
; handle_passert_failed_vargs(filename, line_number, lr, expr, fmt, fmt_args); va_end(fmt_args); } void passert_failed(const char* filename, int line_number, const char* message, ...) { va_list fmt_args; va_start(fmt_args, message); handle_passert_failed_vargs(filename, line_number, (uintptr_t)__built...
GRect(0, 0, DISP_COLS, 200); unobstructed_area_service_will_change(from_area.size.h, to_area.size.h); UnobstructedAreaHandlers handlers = { .will_change = prv_will_change, .change = prv_change, }; app_unobstructed_area_service_subscribe(handlers, s_data.context); cl_assert(fake_event_service_get_info...
(0, 0, 400, 400)
; Layer root_layer = { .bounds = GRect(100, 100, 200, 200), }; GRect unobstructed_bounds; layer_get_unobstructed_bounds(&root_layer, &unobstructed_bounds); cl_assert_equal_grect(unobstructed_bounds, root_layer.bounds); } void test_unobstructed_area_service__layer_clip_x_y(void) { app_state_get_unobstr...
handle_server_notification(s_connection, s_handle, value, 1 /* one byte */); // Data will be dropped, no event :( prv_assert_no_event(); // Receive another GATT notification. Won't fit until consumed. // Consuming is happening before the timeout hits (in t...
{ BLECharacteristic characteristic = prv_get_indicatable_characteristic(); uint16_t value_length; GATTBufferedNotificationHeader header = { .characteristic = BLE_CHARACTERISTIC_INVALID, .value_length = 0, }; bool has_more = gatt_client_subscriptions_get_notification_header(GAPLEClientKernel, ...
// ------------------------------------------------------------------------------------------------- // gatt_client_subscriptions_cleanup_by_client void test_gatt_client_subscriptions__cleanup_by_client(void) { fake_kernel_malloc_mark(); // Subscribe app: BLECharacteristic characteristic = prv_get_indicatable...
/* * 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...
handle_deinit()
; } const PebbleProcessMd* vibe_strength_demo_get_info() { static const PebbleProcessMdSystem s_vibe_strength_info = { .common.main_func = s_main, .name = "Vibe Strength" }; return (const PebbleProcessMd*) &s_vibe_strength_info; }
calEncryptionInfoValid), .is_remote_encryption_info_valid = SPRF_FLAG_IS_SET(data.fields, SprfValidFields_RemoteEncryptionInfoValid), .is_remote_identity_info_valid = SPRF_FLAG_IS_SET(data.fields, SprfValidFields_RemoteIdentityInfoValid), .is_remote_signing_info_valid = S...
{ SprfGettingStarted data; rv = SPRF_FETCH_FIELD(data, getting_started); if (!rv) { goto unlock; } rv = data.is_complete; }
unlock: prv_unlock(); return rv; } void shared_prf_storage_set_getting_started_complete(bool set) { prv_lock(); { SprfGettingStarted data = { .is_complete = set }; SPRF_PERSIST_FIELD(data, getting_started); } prv_unlock(); } //! //! Legacy Stubs for BT Classic - Should never be called s...
60, 0, true); } void test_touch__assert_null_pos_not_liftoff(void) { // NULL position not valid for touchdown event cl_assert_passert(touch_handle_update(0, TouchState_FingerDown, NULL, 5, 3686400)); touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 0, 0); // NULL position not valid for position upd...
(touch_event, NULL)
comm_session_event(false, is_system); if (is_system && (session->destination == TransportDestinationHybrid)) { prv_put_comm_session_event(true, false); } // Cleanup: comm_session_receive_router_cleanup(session); comm_session_send_queue_cleanup(session); list_remove(&session->node, (ListNode **) &s_ses...
comm_session_send_buffer_end_write(sb)
ctive_kcalories = ROUND(activity_private_compute_active_calories(distance_delta_m * MM_PER_METER, 600 * MS_PER_SECOND), ACTIVITY_CALORIES_PER_KCAL); // Make sure that the new_active_kcalories has increased workout_service_get_active_kcalories(&new_active_kcalories); cl_assert(active_kcalories...
cl_assert(workout_service_pause_workout(false))
; prv_inc_time(10); prv_inc_steps_and_put_event(10); prv_put_bpm_event(113, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(steps, 30); cl_assert_equal_i(duration...
LL != bmp); cl_assert(NULL == bmp->data_row_infos); bmp = gbitmap_create_blank(s10, GBitmapFormat8Bit); cl_assert(NULL == bmp); bmp = gbitmap_create_blank(s10, GBitmapFormat1BitPalette); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette ...
cl_assert(NULL == gbitmap_create_blank_with_palette(s10, GBitmapFormat8Bit, p, true))
; bmp = gbitmap_create_blank_with_palette(s10, GBitmapFormat1BitPalette, p, true); cl_assert(NULL != bmp); cl_assert(p == gbitmap_get_palette(bmp)); bmp = gbitmap_create_blank_with_palette(s10, GBitmapFormat2BitPalette, p, true); cl_assert(NULL != bmp); cl_assert(p == gbitmap_get_palette(bmp)); bmp = g...
. */ #include "applib/app.h" #include "applib/graphics/graphics.h" #include "applib/graphics/text.h" #include "applib/tick_timer_service.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/text_layer.h" #include "applib/ui/vibes.h" #include "applib/ui/window.h" #include "console/prompt.h" #include "kernel/...
graphics_fill_rect(ctx, &layer->bounds)
(&l, &GRect(10, 20, 200, 500))
; cl_assert_equal_grect(l.bounds, GRect(0, 0, 200, 500)); // act as 2.x once bounds.origin is different from (0, 0) layer_set_bounds(&l, &GRect(1, 1, 200, 500)); layer_set_frame(&l, &GRect(10, 20, 100, 600)); cl_assert_equal_grect(l.bounds, GRect(1, 1, 200, 599)); // act as 2.x once bounds.size isn't same...
/* * 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; }
DialogTaskList[index] = NULL; } void task_unregister_dialogtask(DialogTask task) { if (task >= DialogTask_Last) { return; } DialogTaskList[task] = NULL; }
(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_inside_origin_layer"))); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_l...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(6, 12), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(6, 23), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 13), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 24), 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_N...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */)
ice_get_current_workout_hr_zone_time(hr_zone_time_s)); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 0); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 0); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 0); prv_inc_time(10); prv_put_bpm_event(ZONE_2_...
prv_put_bpm_event(160, HRMQuality_Good)
-992, 184, 216}, { -960, -112, 176}, { -984, -592, -40}, { -1040, -424, -168}, { -1016, -176, -160}, { -896, -16, -152}, { -960, 24, -168}, { -912, -48, -248}, { -800, -112, -280}, { -936, 80, -328}, { -928, 192, -400}, { -832, 40, -400}, { -984, -136, -312}, { -896,...
{ -568, 888, -944}, { -576, 512, -768}, { -600, 288, -744}, { -496, 112, -832}, { -584, 112, -856}, { -504, -8, -904}, { -464, -88, -824}, // 57 seconds { -536, -168, -856}, { -464, -232, -736}, { -552, -208, -696}, { -600, -184, -672}, { -576, -184, -664}, { -704...
{ -632, 72, 504}, { -768, 136, 120}, { -1064, 144, 216}, { -960, 264, 296}, { -960, 232, 336}, { -1008, 104, 160}, { -992, 8, 216}, { -912, 240, -88}, { -888, 376, -208}, { -816, 104, -256}, { -896, -176, -176}, { -952, -248, -168}, { -856, -288, -224}, { -712, -...
(FONT_KEY_GOTHIC_24_BOLD)
; s_fonts[6] = fonts_get_system_font(FONT_KEY_GOTHIC_28); s_fonts[7] = fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD); s_system_font = s_fonts[0]; struct AppState* data = app_malloc_check(sizeof(struct AppState)); app_state_set_user_data(data); push_window(data); } static void handle_deinit(void) { stru...
EXPECTED_COMPOSITING_MODE_BEFORE_AND_AFTER_PRE_FUNCTION); cl_assert(gcolor_equal(s_ctx.draw_state.tint_color, EXPECTED_TINT_COLOR_BEFORE_AND_AFTER_PRE_FUNCTION)); // Note that additional checks are performed in the .pre and .post functions } typedef struct PostFunctionCalledEvenIfPr...
prv_post_function_called_even_if_pre_function_causes_nothing_to_be_drawn_test( post_function_called_even_if_pre_function_specifies_empty_rect__pre)
; };
lse /* auto_accept_re_pairing */); cl_assert(id != BT_BONDING_ID_INVALID); char device_name_out[BT_DEVICE_NAME_BUFFER_SIZE]; bt_persistent_storage_get_ble_pairing_by_id(id, NULL, NULL, device_name_out); cl_assert_equal_i(strcmp(device_name, device_name_out), 0); // Update: const char *new_device_name = ...
cl_assert_equal_m(&addr_1, &addr_out, sizeof(addr_out))
; cl_assert_equal_m(&link_key_1, &link_key_out, sizeof(link_key_out)); cl_assert_equal_s(name_1, name_out); cl_assert_equal_i(platform_bits_1, platform_bits_out); ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_2, &addr_out, &link_key_out, name_ou...
ent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_x_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_x_y_origin_layer", ctx.parent_framebuffer, GColorWhite)); } void test_graphics_draw_pixel_${BIT_DEPT...
graphics_draw_pixel(ctx, GPoint(p.x + 3, p.y))
; graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 6, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 0, p.y + 1)); graphics_draw_pixel(ctx, GPoint(p.x + 1, p.y + 1)); graphic...
aa.${BIT_DEPTH_NAME}.pbi")); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); graphics_context_set_antialiased(&ctx, true); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap...
prv_reset()
; s_current_path = s_house_path; gpath_move_to(s_house_path, GPoint(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)); s_path_angle = 105; test_graphics_context_init(&ctx, fb); graphics_context_set_antialiased(&ctx, true); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_hou...
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->conn_idx; } prv...
{ 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); } }
HealthActivityRun; } if (sys_activity_sessions_is_session_type_ongoing(ActivitySessionType_Open)) { result |= HealthActivityOpenWorkout; } return result; #endif } // ---------------------------------------------------------------------------------------------- // The number of session we choose to store ...
if (range.last_day_idx > 2) { return HealthServiceAccessibilityMaskNotAvailable; }
return HealthServiceAccessibilityMaskAvailable; #endif } // ---------------------------------------------------------------------------------------------- MeasurementSystem health_service_get_measurement_system_for_display(HealthMetric metric) { #if !CAPABILITY_HAS_HEALTH_TRACKING return MeasurementSystemUnknown...
2016, 608, -152}, { 1576, 424, -88}, { 1952, 776, -248}, { 1376, 832, -200}, { 1032, 912, -456}, { 1000, 808, -384}, { 928, 1048, -480}, { 856, 992, -344}, { 1112, 816, -304}, { 1584, 744, -216}, { 2192, 624, -168}, { 2040, 384, -16}, { 1712, 176, 104}, { 1664, 336, 8...
{ 1496, 240, -104}, { 1584, 232, -56}, { 1376, 176, 8}, { 1344, 144, -40}, { 1216, 144, 32}, { 1088, 160, -48}, { 736, -224, -24}, { 576, -264, 56}, { 632, -152, -272}, { 1088, -136, -120}, { 1392, 216, -216}, // 45 seconds { 1384, 112, -224}, { 1424, 152, -200}, ...
/* * 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...
jerry_create_error(JERRY_ERROR_TYPE, (jerry_char_t *)msg)
; } jerry_value_t rocky_error_argument_invalid_at_index(uint32_t arg_idx, const char *error_msg) { char buffer[100] = {0}; snprintf(buffer, sizeof(buffer), "Argument at index %"PRIu32" is invalid: %s", arg_idx, error_msg); return rocky_error_argument_invalid(buffer); } jerry_value_t rocky_error_unexp...
{ BtPersistBondingType type:8; union PACKED { BtPersistBondingBTClassicData bt_classic_data; BtPersistBondingBLEData ble_data; }; } BtPersistBondingData; /////////////////////////////////////////////////////////////////////////////////////////////////// //! Settings File #define BT_PERSISTENT_STORAGE_F...
{ unsigned int data_len = 0; prv_lock(); { SettingsFile fd; status_t rv = settings_file_open(&fd, BT_PERSISTENT_STORAGE_FILE_NAME, BT_PERSISTENT_STORAGE_FILE_SIZE); if (rv != S_SUCCESS) { goto cleanup; } data_len = settings_file_get_len(&fd, key, key...
//! @return the value that was read at that key or `default_value` if the key does not exist, //! or if the stored data has been corrupted. static bool prv_file_get_bool(const void *key, size_t key_len, bool default_value) { uint8_t bool_data; int read_size = prv_file_get(key, key_len, (void*)&bool_data, sizeof(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...
printf("PLF RST %"PRIx32"\n", error)
; reset_due_to_software_failure(); }
art); bool is_newline_first_codepoint = (*word->start == NEWLINE_CODEPOINT); line->height_px = line_height; if (is_newline_first_codepoint) { // This trims off leading \n's from word. If we reach the end of the text while doing this, it sets // word->start to NULL. word_trim_preceeding_codepoint(...
PBL_ASSERTN(layout)
; if (text_hash != layout->hash) { return false; } if (!grect_equal(&box, &layout->box)) { return false; } if (overflow_mode != layout->overflow_mode) { return false; } if (alignment != layout->alignment) { return false; } if (font != layout->font) { return false; } retur...
* * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language go...
RCC_AHB2PeriphResetCmd(ahb2_periphs, ENABLE)
; RCC_AHB2PeriphResetCmd(ahb2_periphs, DISABLE); RCC_AHB3PeriphResetCmd(ahb3_periphs, ENABLE); RCC_AHB3PeriphResetCmd(ahb3_periphs, DISABLE); RCC_APB1PeriphResetCmd(apb1_periphs, ENABLE); RCC_APB1PeriphResetCmd(apb1_periphs, DISABLE); RCC_APB2PeriphResetCmd(apb2_periphs, ENABLE); RCC_APB2PeriphResetCmd(ap...
; menu_layer_set_selected_next(&l, false, MenuRowAlignNone, true); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section); // these values are unchanged until the animation updates them cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(0 * basic_cell_height, l.selection....
menu_layer_set_selected_index(&l, MenuIndex(0, s_num_rows - 1), MenuRowAlignNone, false)
; cl_assert_equal_i(focused_height, l.selection.h); s_num_rows--; cl_assert_equal_i(2, s_num_rows); menu_layer_reload_data(&l); cl_assert_equal_i(s_num_rows - 1, l.selection.index.row); cl_assert_equal_i(focused_height, l.selection.h); s_num_rows--; cl_assert_equal_i(1, s_num_rows); menu_layer_reloa...
32, 1144, -784}, { -1296, 88, -480}, { -1472, -176, -328}, { -1224, -56, -272}, // 25 seconds { -1048, 448, -192}, { -1288, 2712, -1112}, { -408, 4000, -2112}, { 696, 3496, -1560}, { 800, 1896, -128}, { 1280, 856, -72}, { 1520, 264, 152}, { 1632, -232, 456}, { 1392, -...
{ -664, 1584, -832}, { -920, 576, -304}, { -856, -112, -288}, { -1496, -344, 232}, { -1328, -192, -48}, { -1080, 184, 280}, { -912, 384, 160}, { -1656, 4000, -1992}, { -568, 4000, -2440}, { 520, 2288, -1008}, { 584, 1000, -152}, { 1248, 376, -136}, { 1624, -160, -176}...
{ -1176, 1752, -1008}, { -1048, 4000, -1320}, { 392, 2824, -1144}, { 608, 2112, -792}, { 976, 720, -8}, { 1632, 232, 80}, { 1600, -384, 8}, { 1360, -504, 304}, { 288, 72, 336}, // 33 seconds { 664, -32, 192}, { 1176, 1952, -984}, { 1192, 4000, -2152}, { 376, 3952...
le_pairing_error(uint32_t error) { analytics_event_bt_error(AnalyticsEvent_BtLePairingError, error); } void bluetooth_analytics_handle_bt_classic_pairing_error(uint32_t error) { analytics_event_bt_error(AnalyticsEvent_BtClassicPairingError, error); } void bluetooth_analytics_ble_mic_error(uint32_t num_sequential_...
bt_driver_analytics_external_collect_chip_specific_parameters()
; bt_unlock(); } void analytics_external_collect_bt_chip_heartbeat(void) { // TODO: PBL-38365: Re-enable this once it is fixed :( #if 0 if (bt_ctl_is_bluetooth_running()) { // No need for lock bt_driver_analytics_external_collect_bt_chip_heartbeat(); } #endif }
ap_le_put_cancel_create_event(const BTDeviceInternal *device, bool is_master) { fake_gap_put_connection_event(HCI_ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, is_master, device); } int GAP_LE_Disconnect(unsigned int BluetoothStackID, ...
BDADDRToBTDeviceAddress(s_not_resolving_bd_addr)
, .is_random_address = true, }; return &s_not_resolving_device; } const BD_ADDR_t *fake_GAPAPI_get_bd_addr_resolving_to_fake_irk(void) { return &s_resolving_bd_addr; } const BTDeviceInternal *fake_GAPAPI_get_device_resolving_to_fake_irk(void) { static BTDeviceInternal s_resolving_device; s_resolving_dev...
/* * 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_event_loop()
ockCallRecordings){0}; s_graphics_fill_rect = (MockCallRecordings){0}; s_graphics_fill_rect__color = GColorClear; s_graphics_draw_rect_precise = (MockCallRecordings){0}; s_graphics_fill_radial_precise_internal = (MockCallRecordings){0}; s_layer_mark_dirty = (MockCallRecordings){0}; s_fonts_get_system_font =...
("uoh", 8)
; } static const jerry_value_t prv_global_init_and_set_ctx(void) { rocky_global_init(s_graphics_api); // make this easily testable by putting it int JS context as global Layer l = {.bounds = GRect(0, 0, 144, 168)}; const jerry_value_t ctx = prv_create_canvas_context_2d_for_layer(&l); cl_assert_equal_b(jerry...
/* * 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->caller_name, msg, MIN(caller_name_size, sizeof(info->caller_name)))
; msg_length += caller_name_size + 1; // Ensure that we haven't run off the end of our buffer if (msg_length > length) { return false; } info->caller_number[CALLER_BUFFER_LENGTH - 1] = '\0'; info->caller_name[CALLER_BUFFER_LENGTH - 1] = '\0'; return true; } // MJZ: This has been left here for futur...
lls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // Start A after delay prv_advance_to_ms_with_timers(start_ms + delay_seq + delay_a + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_star...
prv_advance_to_ms_with_timers(start_ms + delay_spawn + delay_a + 2 * MIN_FRAME_INTERVAL_MS)
/* * 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...
dbgserial_putstr("")
tx.att_hdl.gatt_mtu_cccd) { connection_set_subscribed_to_gatt_mtu_notifications(connection, is_subscribed); value_handle = s_pps_ctx.att_hdl.gatt_mtu; } else if (evt->handle == s_pps_ctx.att_hdl.conn_params_cccd) { connection_set_subscribed_to_conn_param_notifications(connection, is_subscribed); value...
{ rv = ATT_ERROR_INVALID_VALUE_LENGTH; goto finally; }
const PebblePairingServiceConnParamsWrite *conn_params = (const PebblePairingServiceConnParamsWrite *)evt->value; const size_t length = (evt->length - offsetof(PebblePairingServiceConnParamsWrite, remote_desired_state)); switch (conn_params->cmd) { case...
}, { 360, -96, -832}, { 384, -80, -984}, { 344, -72, -1024}, { 296, -112, -1024}, { 336, -112, -984}, { 320, -224, -992}, { 256, -296, -928}, { 328, -296, -912}, { 304, -272, -944}, { 312, -352, -904}, { 192, -376, -824}, { 200, -400, -800}, { 168, -400, -808}, { ...
*len = ARRAY_LENGTH(samples); return samples; }
// ---------------------------------------------------------------- // Sample captured: 2015-10-05 20:21:22 local AccelRawData *activity_sample_walk_200_pbl_25662_9(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25662_9 //> TEST_EXPECTED 200 //> T...
" uint16_t gaps_get_starting_att_handle(void) { return 4; } BLEService gatt_client_att_handle_get_service( GAPLEConnection *connection, uint16_t att_handle, const GATTServiceNode **service_node_out) { return 0; } uint8_t gatt_client_copy_service_refs_by_discovery_generation( ...
if (i < max_times) { prv_expect_service_changed_indication_api_call_count(i + 1); } else { prv_expect_service_changed_indication_api_call_count(max_times); }
gap_le_connection_remove(&s_device); s_connection = NULL; } } void test_gatt_service_changed_server__disconnect_during_delay(void) { gatt_service_changed_server_handle_fw_update(); prv_cccd_write(true /* is_subscribing */); // Grab the timer ID: TimerID t = s_connection->gatt_service_changed_indic...
oint) { 1, 2 }; command = gdraw_command_list_get_command(command_list, 2); *command = (GDrawCommand) { .type = GDrawCommandTypePath, .hidden = false, .stroke_color = GColorGreen, .stroke_width = 1, .fill_color = GColorPurple, .path_open = false, .num_points = 3, }; GPoint points2[] ...
(gdraw_command_image_validate(image, size))
; cl_assert(!gdraw_command_image_validate(image, size - 1)); cl_assert(!gdraw_command_image_validate(image, size + 1)); cl_assert_equal_i(size, gdraw_command_image_get_data_size(image)); image->version = 2; cl_assert(!gdraw_command_image_validate(image, size)); free(image); } void test_gdraw_command__cl...
ased) { return intent->bonding->id; } return BT_BONDING_ID_INVALID; } // ------------------------------------------------------------------------------------------------- static void prv_start_connecting_if_needed(void) { if (s_current_role == GAPLERoleSlave) { return; } if (prv_has_intents_for_disco...
(request->is_bonding_based ? sizeof(GAPLEConnectionIntentBonding) : 0); intent = (GAPLEConnectionIntent *) kernel_malloc(alloc_size); if (!intent) { return BTErrnoNotEnoughResources; } memset(intent, 0, alloc_size); s_intents = (GAPLEConnectionIntent *) list_prepen...
// Connection watchdog should take care of disconnecting after timeout in case pairing // does not happen in a timely manner // TODO: https://pebbletechnology.atlassian.net/browse/PBL-11236 } return BTErrnoOK; } // Notify client of the virtual connection: prv_update_clients(intent, Hci...
/* * 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...
{ battery_monitor_handle_state_change_event(event->battery_state.new_state); }
app queue is the PEBBLE_APP_KILL_EVENT // to expedite exiting the application event_reset_from_process_queue(task); event_put_from_process(task, &event); } // --------------------------------------------------------------------------------------------- //! Init the context variables for a task. void process_ma...
if (app_install_id_from_app_db(id)) { if (!process_manager_check_SDK_compatible(id)) { return; } // This is a third party flash 3.0 app install if (prv_needs_fetch(id, &md, is_worker)) { PBL_LOG(LOG_LEVEL_DEBUG, "Cache entry did not exist on launch attempt"); // Freed in app_fe...
#endif // we either came here if PRF or if we didn't start a fetch // md is either already initialized, or we took a code path that didn't try if (!md) { md = app_install_get_md(id, is_worker); } if (!md) { PBL_LOG(LOG_LEVEL_ERROR, "Tried to launch non-existant app!"); return; } #if !RECOVERY...
/* * 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 (!data_source) { return; }
Window *window = layer_get_window(launcher_menu_layer_get_layer(launcher_menu_layer)); if (!window) { return; } // Disable all clicking on the window so the user can't scroll anymore window_set_click_config_provider(window, NULL); // Capture what app we should launch - we'll actually launch it as par...
f(AccelServiceState)); *state = (AccelServiceState) { .sampling_rate = ACCEL_DEFAULT_SAMPLING_RATE, .accel_shake_info = { .type = PEBBLE_ACCEL_SHAKE_EVENT, .handler = &prv_session_do_shake_handle, .context = state, }, .accel_double_tap_info = { .type = PEBBLE_ACCEL_DOU...
if (!state->manager_state || (!state->data_handler && !state->raw_data_handler && !state->raw_data_handler_deprecated)) { return -1; }
const time_t now = rtc_get_time(); AttributeList list = {}; prv_set_timeline_icon(&list, TIMELINE_RESOURCE_NOTIFICATION_FLAG, 0); attribute_list_add_cstring(&list, AttributeIdTitle, "Delfina Pizza"); if (has_subtitle) { attribute_list_add_cstring(&list, AttributeIdSubtitle, "Open Table Reservation"); }...
(-3 * 60 * 60, 30)
; prv_add_weather_pin_with_params(-2 * 60 * 60, !has_timestamp, !has_short_title, !has_short_subtitle); prv_add_weather_pin_with_params(-60 * 60, has_timestamp, has_short_title, has_short_subtitle); // Peek pins prv_add_calendar_pin(5 * 60, 60, !is_all_day,...
nimation *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 = timeline_layer_create_up_down_animation( ...
(&data->timeline_layer, -1)
; } // If we interrupted a previous scroll, hasten this scroll const bool is_hasted = !was_stationary; const uint32_t duration = TIMELINE_UP_DOWN_ANIMATION_DURATION_MS; const InterpolateInt64Function interpolate = is_hasted ? timeline_animation_interpolate_moook_second_half : timeline_animation_i...
e 3333, // Wakeup Time 4444, // Active Time 5555, // Typical sleep duration 6666, // Typical deep sleep duration 7777, // Typical fall asleep time 8888, // Typical wakeup time }; static uint32_t s_old_sleep_data[] = { 1, // Version NOW - (7 * ...
(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_sleep_data, sizeof(s_sleep_data)), S_SUCCESS)
; cl_assert_equal_i(s_metric_updated_count, NUM_CURRENT_SLEEP_METRICS); // check typicals int32_t val_out; cl_assert(health_db_get_typical_value(ActivityMetricSleepTotalSeconds, Monday, &val_out)); cl_assert_equal_i(val_out, s_sleep_data[SD_TypicalSleepDuration]); cl_assert(health_db_get_typical_value(A...