prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
if (!token) { continue; } // If this is a pre-processor directive, skip it if (token[0] == '#') { continue; } // If this is a comment skip it if (strcmp(token, "//") == 0) { continue; } // If this is an AccelRawData line, get the name if (strcmp(token, "AccelRaw...
{ sscanf(token + strlen(token) + 1, "%d", &state->test_entry.version); }
else if (strcmp(token, "TEST_TOTAL") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.total.value); } else if (strcmp(token, "TEST_TOTAL_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.total.min); } else if (strcmp(token, "TEST_TOTAL_MAX") == 0) { ...
_heart_rate_is_enabled; } static bool s_bt_driver_hrm_service_is_enabled; static int s_bt_driver_hrm_service_enable_call_count; void bt_driver_hrm_service_enable(bool enable) { s_bt_driver_hrm_service_enable_call_count++; s_bt_driver_hrm_service_is_enabled = enable; } static BleHrmServiceMeasurement s_last_ble_hr...
cl_assert(info->handler)
; } else { cl_assert_equal_p(NULL, info->handler); } } void test_ble_hrm__cleanup(void) { ble_hrm_deinit(); prv_assert_event_service_subscribed(false); // hrm manager sub vs unsub calls should be the same, there should be no subscription any more // after de-initing: cl_assert_equal_i(s_sys_hrm_mana...
rv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(...
(b, duration_b)
; animation_set_delay(b, delay_b); animation_set_play_count(b, play_count_b); // Create a spawn Animation *spawn = animation_spawn_create(a, b, NULL); cl_assert(spawn != NULL); animation_set_delay(spawn, delay_spawn); animation_set_play_count(spawn, play_count_spawn); // Check durations cl_assert_e...
s // module its own Heap: SendBuffer *sb = (SendBuffer *)kernel_zalloc_check(allocation_size); *sb = (const SendBuffer) { .payload_buffer_length = payload_buffer_length, .consumed_length = 0, .session = session, .header = { .endpoint_id = htons(endpoint_id), .length = 0, }, }; ...
{ if (!session) { return NULL; } if (required_payload_length > DEFAULT_KERNEL_SENDER_MAX_PAYLOAD_SIZE) { PBL_LOG(LOG_LEVEL_WARNING, "Message for endpoint_id %u exceeds maximum length (length=%"PRIu32")", endpoint_id, (uint32_t)required_payload_length); return NULL; } RtcTi...
if (is_timeout) { analytics_inc(ANALYTICS_DEVICE_METRIC_BT_COMM_SESSION_SEND_DATA_FAIL_COUNT, AnalyticsClient_System); PBL_LOG(LOG_LEVEL_WARNING, "Failed to get send buffer (bytes=%"PRIu32", endpoint_id=%"PRIu16", to=%"PRIu32")", (uint32_t)required_paylo...
_count, 1); } void test_session_receive_router__unhandled_endpoint(void) { // Expect "Unhandled" meta message to be replied to a message for an unknown endpoint. // The message should get eaten and not interfere with whatever comes next. // Length: 1, Endpoint ID: NON_EXISTENT_ENDPOINT_ID, Payload: 0x55 RECEI...
(s_finish_count, 1)
; } void test_session_receive_router__cleanup_receiver_if_session_is_closed(void) { // Expect that when a partial message has been received, but then the session gets closed, // that "cleanup" is called. // Length: 1, Endpoint ID: PRIVATE_TEST_ENDPOINT_ID, Payload: not received yet RECEIVE(0x00, 0x01, PRIVATE...
onDirectionPast)); // b ends later cl_assert(0 < prv_session_compare( &(ActivitySession) {.start_utc = now, .length_min = 5}, &(ActivitySession) {.start_utc = now + (2 * SECONDS_PER_MINUTE), .length_min = 5}, HealthIterationDirectionPast)); } void test_health__get_minute_history_edge_case_args(void) {...
ARRAY_LENGTH(data)
, &time_start, &time_end); cl_assert_equal_i(0, s_sys_activity_get_minute_history_values.in[0].num_records); //////////// // start time almost on the next minute s_sys_activity_get_minute_history_values.stage = 0; const time_t time_almost_next_minute = time_on_boundary + 59; // respects time_end, 2.5 minut...
{ return s_activity_next_heart_rate_zone; } void activity_metrics_prv_get_median_hr_bpm(int32_t *median, int32_t *total_weight) { if (median) { *median = s_activity_next_heart_rate_bpm; } if (total_weight) { *total_weight = s_activity_next_heart_rate_heart_rate_total_weight_x100; } } void activity_...
{ minute_data[i] = (AlgMinuteDLSSample) { }; minute_data[i].base.steps = i; minute_data[i].base.vmc = next_vmc++; if (next_vmc == 65533) { // Make sure combinations of vmc/orient are mostly unique, so don't wrap at the same // module 256 boundary. next_vmc = 0; } minute_data[i]...
} // -------------------------------------------------------------------------------------------- // Feed in sleep data static void prv_feed_minute_data(uint32_t num_minutes, AlgMinuteDLSSample *minute_data, bool simulate_bg_delays) { // Call the minute handler, which computes the ...
c)); cl_assert(gtransform_is_only_translation(&t)); cl_assert(gtransform_is_only_translation(&t_c)); t_c = GTransformTranslationFromNumber(2, 5); cl_assert(gtransform_is_equal(&t, &t_c)); // Test Rotation Matrix int32_t angle = DEG_TO_TRIGANGLE(45); t = GTransformRotation(angle); int32_t cosine = cos...
GTransformFromNumbers(1, 2, 3, 4, 615, 826)
; gtransform_translate(&t_new, &t1, GTransformNumberFromNumber(10), GTransformNumberFromNumber(200)); cl_assert(gtransform_is_equal(&t_new, &t_c)); cl_assert(gtransform_is_equal(&t1, &t2)); // ensure t1 has not changed gtransform_translate_number(&t_new, &t1, 10, 200); cl_assert(gtra...
e "stubs_app_state.h" #include "stubs_applib_resource.h" #include "stubs_bootbits.h" #include "stubs_heap.h" #include "stubs_logging.h" #include "stubs_memory_layout.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "st...
{ graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(-80, 4, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); }
void draw_text_single_line_ellipsis_clip_outside_x(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(80, 4, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } // Word Wrap Tests vo...
lt); prv_send_event(VoiceEventTypeSessionResult, status, NULL); return false; } // Make sure that if this is an app initiated session, we're expecting a response for an app // initiated session and that if this is an app initiated session, the app UUID matches the // expected UUID if ((app_initiated ...
{ if (task != PebbleTask_App) { return; } mutex_lock(s_lock); if (s_from_app && (s_session_id != AUDIO_ENDPOINT_SESSION_INVALID_ID)) { prv_cancel_session(); } mutex_unlock(s_lock); }
data->to, index, -1); } static void prv_text_layer_init(Window *window, TextLayer *text_layer, GRect *rect, const char *i18n_str) { const GFont subtitle_font = system_theme_get_font_for_default_size(TextStyleFont_Subtitle); text_layer_init_with_parameters(text_layer, rect, i18n_get(...
(window, to_text_layer, &text_rect, i18n_noop("End"))
; } void time_range_selection_window_deinit(TimeRangeSelectionWindowData *time_range_selection_window) { if (time_range_selection_window) { selection_layer_deinit(&time_range_selection_window->from_selection_layer); selection_layer_deinit(&time_range_selection_window->to_selection_layer); } }
/* * 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...
health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, 0, typical_fill)
; } #endif if (data->current_steps) { health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_CURRENT_COLOR, 0, current_fill); } #if PBL_COLOR if (!behind_typical) { health_progress_bar_mark(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, typical_fill); } #else health_progress_bar_mark(ctx, ...
/* * 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...
{ *history = s_last_vmc; return true; }
cl_assert(false); return false; } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Helper Functions static void prv_set_time(time_t day, int hour, int minute) { s_current_day = day; s_current_hour = hour; s_current_minute = minute; rtc_set_time(day ...
/* * 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, &peek_layer->title.text_layer)
; const GSize subtitle_size = text_layer_get_content_size(ctx, &peek_layer->subtitle.text_layer); GPoint cursor = { (layer_bounds.size.w - subtitle_size.w) / 2, -(subtitle_size.h + MAX(number_size.h, title_size.h)) / 2 }; const int font_height_fuzz = 5; // Replace with font descenders layer...
/* * 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, &data->box_rect)
; } void prv_redraw_timer_cb(void *cb_data) { AppData *data = app_state_get_user_data(); prv_move_rect(data); layer_mark_dirty(&data->window.layer); app_timer_register(1000 / TARGET_FPS, prv_redraw_timer_cb, NULL); } static void s_main(void) { AppData *data = app_malloc_check(sizeof(AppData)); app_st...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_temp_94473_6 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { -136, -336, -944}, {...
{ -176, -320, -864}, { -192, -256, -904}, { -192, -216, -936}, { -216, -152, -984}, { -296, -96, -1096}, { -168, -168, -1144}, { -120, -224, -1080}, { -104, -304, -1000}, { -32, -360, -896}, { -16, -360, -888}, { 32, -384, -896}, { 112, -232, -960}, { 384, -136, -111...
_state(GContext *ctx) { return (GDrawState) { 0 }; } bool graphics_release_frame_buffer(GContext *ctx, GBitmap *buffer) { return false; } void graphics_context_set_drawing_state(GContext *ctx, GDrawState draw_state) { } void window_schedule_render(struct Window *window) { } void recognizer_destroy(Recognizer *r...
(&child_b, &child_a)
; cl_assert(child_b.parent == &parent); cl_assert(child_b.next_sibling == &child_a); cl_assert(child_a.next_sibling == NULL); // Insert child_c below child_a (next_sibling code path): // // +-parent // | // '->child_b->child_c->child_a // layer_insert_below_sibling(&child_c, &child_a); cl...
/* * 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...
{ accessory_send_data((const uint8_t*) response, strlen(response)); accessory_send_data((const uint8_t*) "\r\n", sizeof(char) * 2); }
static void prv_display_prompt(void) { accessory_send_data((const uint8_t*) ">", sizeof(char)); } static PromptContext s_prompt_context = { .response_callback = prv_command_response_callback, .command_complete_callback = prv_display_prompt, }; static void prv_execute_command(void *data) { PromptContext *pro...
->test_entry.name, token + 1, sizeof(state->test_entry.name)); printf("\nParsing function samples: %s", state->test_entry.name); continue; } // Look for and parse the expected values if (strcmp(token, "//>") == 0) { token = strtok(NULL, " \t\n"); if (strcmp(token, "TEST_EXPECTED") =...
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.deep.value)
; } else if (strcmp(token, "TEST_DEEP_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.deep.min); } else if (strcmp(token, "TEST_DEEP_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.deep.max); } else if (strcmp(token, "TEST_START_AT...
----------------------------------------------------------------- // 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 number of entries in the sessions array // @param sessions array of activity sessions voi...
{ 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, (uint8_t *)s_alg_state->minute_data_storage, sizeof(s_alg_state->minute_data_sto...
1 H", time_buf); // June 10th 2015, 13:00:59 (T-00:59:01) rtc_set_time(event_time - (1 * SECONDS_PER_HOUR) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 1 H", time_buf); // June 10th 2015, 13:01:00 (T-00:59:00) rtc_set_time(event_...
rtc_set_time(event_time - SECONDS_PER_DAY)
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Fri, 12:00 PM", time_buf); // June 11th 2015, 12:00:01 (T-23:59:59) rtc_set_time(event_time - SECONDS_PER_DAY + 1); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_REL...
case MusicPlayStateInvalid: return false; } WTF; } static void prv_update_glance_for_music_state(LauncherAppGlanceStructured *structured_glance) { LauncherAppGlanceMusic *music_glance = launcher_app_glance_structured_get_data(structured_glance); PBL_ASSERTN(music_glance); // Zero out the glance...
event_service_client_subscribe(&music_glance->music_event_info)
; return &structured_glance->glance; }
num_animations); return animation; } void timeline_layer_set_layouts_hidden(TimelineLayer *layer, bool hidden) { for (int i = 0; i < TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER; i++) { TimelineLayout *layout = layer->layouts[i]; if (layout) { prv_set_layout_hidden(layout, hidden); } } layer_set_hi...
peek_layer_deinit(&layer->day_separator)
; kino_layer_deinit(&layer->end_of_timeline); // TODO: PBL-21982: Only support rectangular screen for now #if PBL_RECT timeline_relbar_layer_deinit(layer); #endif }
* 25mV = 1.825V sd1_vsel |= (0x51 & sd1_vsel_mask); prv_write_register(PmicRegisters_SD1_VOLTAGE, sd1_vsel); } } static uint8_t s_last_reset_reason = 0; static void prv_stash_last_reset_reason(void) { uint8_t reset_cntl; if (!prv_read_register(PmicRegisters_RESET_CNTL, &reset_cntl)) { PBL_LOG(LOG_LEV...
if (!prv_read_register(PmicRegisters_CHARGE_STATUS_2, &status)) { #if TARGET_QEMU // NOTE: When running on QEMU, i2c reads return false. For now, just assume a failed // i2c read means we are connected to a USB cable return true; #endif PBL_LOG(LOG_LEVEL_WARNING, "Failed to read charging status 2 regist...
// ChargerStatus2 (Fig. 98) // Bit 2: Charger detected return status & (1 << 2); } void pmic_read_chip_info(uint8_t *chip_id, uint8_t *chip_revision, uint8_t *buck1_vset) { prv_read_register(PmicRegisters_CHIP_ID, chip_id); prv_read_register(PmicRegisters_CHIP_REV, chip_revision); prv_read_register(PmicRe...
ld zero out steps that occur while sleeping prv_feed_minute_data(60, &minute_data[0], false /*simulate_bg_delays*/); activity_algorithm_get_steps(&steps_awake_60m); prv_feed_minute_data(40, &minute_data[60], false /*simulate_bg_delays*/); activity_algorithm_get_steps(&steps_awake_100m); prv_feed_minute_data...
cl_assert_equal_i(retrieve[i].light, ambient_light_level_to_enum( minute_data[i].base.light * ALG_RAW_LIGHT_SENSOR_DIVIDE_BY))
; cl_assert_equal_i(retrieve[i].heart_rate_bpm, minute_data[i].heart_rate_bpm); } }
+) { snprintf(file_small, sizeof(file_small), "file%d", i); snprintf(buf, sizeof(buf), "This is small buf %d!", i); int len = strlen(buf); int fd = pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, len); cl_assert(fd >= 0); cl_assert(pfs_write(fd, (uint8_t *)buf, len) == len); cl_assert(...
{ st_val = st_val + i; rv = pfs_write(fd, (uint8_t *)&st_val, sizeof(st_val)); cl_assert_equal_i(rv, sizeof(st_val)); }
pfs_close(fd); idx++; } cl_assert_equal_i((status_t)fd, E_OUT_OF_STORAGE); // read back files to make sure they are all correct st_val = 0; for (int i = 0; i < idx; i++) { snprintf(name, sizeof(name), "file%d", i); if ((fd = pfs_open(name, OP_FLAG_READ, FILE_TYPE_STATIC, f_size)) < 0) { ...
s hack to avoid centering the title / subtitle labels in the entire cell: ((Layer *)cell_layer)->bounds.size.h -= SHARING_HEART_RATE_EXTRA_HEIGHT_PX; } menu_cell_basic_draw(ctx, cell_layer, remote_name, connected_string, NULL); if (is_sharing_heart_rate_string) { // Restore original height: ((Layer ...
if (settings_bluetooth_is_sharing_heart_rate_for_stored_remote(remote)) { heart_rate_sharing_text_height = SHARING_HEART_RATE_EXTRA_HEIGHT_PX; }
tware * 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 governing permissions and * limitations under the License. */ #include "services/normal/notifications/notification_storag...
( string_list_get_at(list_a, idx), string_list_get_at(list_b, idx) )
v != S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to open settings file"); mutex_unlock(s_mutex); } return rv; } static void prv_file_close_and_unlock(SettingsFile *file) { settings_file_close(file); mutex_unlock(s_mutex); } static bool prv_key_is_valid(const uint8_t *key, int key_len) { return ke...
activity_metrics_prv_set_metric(ActivityMetricHeartRateZone3Minutes, wday, data->minutes_in_zone[2])
; } } ///////////////////////// // Public API ///////////////////////// bool health_db_get_typical_value(ActivityMetric metric, DayInWeek day, int32_t *value_out) { char key[HEALTH_DB_MAX_KEY_LEN]; snprintf(key, HEALTH_DB_MAX_KEY_LEN, "%s%s", WE...
- title_text_frame_height - subtitle_text_frame_height - 1) / 2); if (subtitle_text_frame_height) { title_text_frame_origin_y -= icon_on_left_title_subtitle_vertical_spacing_offset; } } } // Draw the subtitle (if one was provided and we have room), taking into account the...
(&rect.size, &icon_size)
) { // round has never worked with legacy2 apps static const bool is_legacy2 = false; if (config->icon_box_model) { rect.origin = gpoint_add(rect.origin, config->icon_box_model->offset); } prv_draw_icon(ctx, config->icon, &rect, is_legacy2); } } } static ALWAYS_INLINE void 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...
(ctx, GPoint(5, -30), GPoint(45, 30))
; } void across_screen_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(25, 25), GPoint(119, 143)); } void same_start_stop_layer_update...
s_state.state == PostMessageStateAwaitingResetCompleteLocalInitiated || s_state.state == PostMessageStateAwaitingResetCompleteRemoteInitiated); s_state.state = PostMessageStateAwaitingResetRequest; } static void prv_awaiting_reset_request__inbox_received(DictionaryIterator *it, void *cont...
PBL_ASSERTN(json_buffer)
ine BITS_PER_CORRECTION_VAL 16 #define CORRECTION_VAL_MASK ((1 << BITS_PER_CORRECTION_VAL) - 1) static CompassStatus s_current_cal_status = CompassStatusDataInvalid; static int16_t s_active_corr[3] = { 0 }; static bool s_service_init = false; static bool s_saved_corr_present = false; static int16_t s_s...
if (accel_data->z < 0) { // the watch has been flipped over. If someone is viewing the watch // at a pitch > 90 degrees, this means the heading will rotate around // on them (since technically, the 'front' of the watch is pointing // at them.) Flip the heading back around in this case. corr = TRIG_M...
mx_rot = (mx * cos_lookup(pitch)) / TRIG_MAX_RATIO; mx_rot += (((my * sin_lookup(pitch)) / TRIG_MAX_RATIO) * sin_lookup(roll)) / TRIG_MAX_RATIO; mx_rot += (((mz * sin_lookup(pitch)) / TRIG_MAX_RATIO) * cos_lookup(roll)) / TRIG_MAX_RATIO; my_rot = mz * sin_lookup(roll) - my * cos_lookup(roll); m...
l_malloc.h" #include "stubs_pebble_process_info.h" #include "stubs_pebble_tasks.h" #include "stubs_process_manager.h" #include "stubs_prompt.h" #include "stubs_property_animation.h" #include "stubs_serial.h" #include "stubs_shell_prefs.h" #include "stubs_sleep.h" #include "stubs_syscalls.h" #include "stubs_task_watchdo...
prv_render_layout(config->layout_id, &attr_list, num_down_clicks)
; attribute_list_destroy_list(&attr_list); } // Tests ////////////////////// void test_timeline_layouts__generic(void) { const TimelineLayoutTestConfig config = (TimelineLayoutTestConfig) { .layout_id = LayoutIdGeneric, .title = "Delfina Pizza", .subtitle = "Open Table Reservation", .location_nam...
TECT_ONE); break; case 2: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; case 3: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 4: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DET...
("Brown out reset")
; } } // SystemInit does this for the firmware, but since the bootloader isn't using // the vendor SystemInit, initialize the flash cache here static void prv_configure_system_flash(void) { // Enable flash instruction and data caches FLASH->ACR = FLASH_ACR_ICEN | FLASH_ACR_DCEN; } // RTC and bootbit assume acce...
ov12_123456_gmt; time_t advance = s_cron_test_info[i].dest_time - base; // DST off prv_basic_test(&s_timezone_gmt, &test_cron, base, advance, advance, 0); // DST on base -= SECONDS_PER_HOUR; prv_basic_test(&s_timezone_gmt, &test_cron, base, advance, advance, 2); } } void test_cron__dst_simple...
(25, CRON_HOUR_ANY, CRON_MDAY_ANY, CRON_MONTH_ANY, prv_cron_callback)
CRON_JOB(55, 1, CRON_MDAY_ANY, CRON_MONTH_ANY, prv_cron_callback) CRON_JOB(CRON_MINUTE_ANY, CRON_HOUR_ANY, 1, CRON_MONTH_ANY, prv_cron_callback) }; CronJob new_job = { .cb = prv_counting_cb, .cb_data = (void*)0, }; prv_set_rtc(s_2015_nov12_123456_gmt, &s_timezone_gmt); cron_clear_all_jobs(...
const time_t now_ts = time_get_uptime_seconds(); s_workout_data.current_workout->current_bpm = 0; s_workout_data.current_workout->current_hr_zone = HRZone_Zone0; s_workout_data.current_workout->current_bpm_timestamp_ts = now_ts; } // ------------------------------------------------------------------------------...
{ // Update the duration prv_update_duration(); // Check to make sure our HR sample is still valid const time_t now_ts = time_get_uptime_seconds(); const time_t age_hr_s = now_ts - s_workout_data.current_workout->current_bpm_timestamp_ts; if (s_workout_data.current_workout->current_bpm != 0 && ...
prv_unlock(); } // --------------------------------------------------------------------------------------- void workout_service_health_event_handler(PebbleHealthEvent *event) { if (!workout_service_is_workout_ongoing()) { return; } prv_lock(); { if (event->type == HealthEventMovementUpdate) { ...
/* * 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 (node == NULL) { return 0; } uint32_t count = 1; while ((node = node->next) != NULL) { ++count; } return count; }
"test_bitblt__1bit_to_8bit_src_origin_offset_wrap2-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Setup: // - Source has 2 lines of white and the rest black. // - Destination all blue. // - Use gbitmap_init_as_sub_bitmap to get a sub-bitmap that starts at y = 2 // Result: // - A 48 x 50 bla...
(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorWhite)
; cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_white_on_white-expect.1bit.pbi")); memset(dest_data, 0b11111111, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorBlack); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_t...
ired_handler(timer_sequence_number); } prv_pulse_task_feed_watchdog(); } } static void prv_forge_terminate_ack(void) { // Send an LCP Terminate-Ack without invoking the control_protocol // API since we need to send these packets from precarious situations // when the OS and PULSE may not have been ini...
dbgserial_putchar_lazy(FRAME_DELIMITER)
; for (size_t i = 0; i < length; ++i) { if (frame[i] == FRAME_DELIMITER) { dbgserial_putchar_lazy('\0'); } else { dbgserial_putchar_lazy(frame[i]); } } dbgserial_putchar_lazy(FRAME_DELIMITER); if (prv_safe_to_touch_mutex()) { mutex_unlock(s_tx_buffer_mutex); } } void pulse_link_s...
in progress. return; } if ((s_state == CompositorState_AppTransitionPending) && (modal_manager_get_properties() & ModalProperty_Transparent)) { // Don't render if modals are transparent while the app is not ready yet return; } if (s_state == CompositorState_Modal) { compositor_render_mod...
prv_should_render()
// List should start off with Monday uint16_t day_index = cell_index->row % DAYS_PER_WEEK; const struct lc_time_T *time_locale = time_locale_get(); cell_text = i18n_get(time_locale->weekday[day_index], &data->custom_day_picker_window); if (data->scheduled_days[(cell_index->row) % DAYS_PER_WEEK]) { ...
layer_add_child(&data->custom_day_picker_window.layer, menu_layer_get_layer(&data->custom_day_picker_menu_layer))
; gbitmap_init_with_resource(&data->selected_icon, RESOURCE_ID_CHECKBOX_ICON_CHECKED); gbitmap_init_with_resource(&data->deselected_icon, RESOURCE_ID_CHECKBOX_ICON_UNCHECKED); gbitmap_init_with_resource(&data->checkmark_icon, RESOURCE_ID_CHECKMARK_ICON_BLACK); data->current_checkmark_icon_resource_id = RESOURCE...
0) { return; } #if SCREEN_COLOR_DEPTH_BITS == 8 // NOTE: Since all calculations are based on 1-bit calculation - use the row size from // the 1-bit frame buffer const int row_size_bytes = 4 * ((dest_bitmap->bounds.size.w / 32) + ((dest_bitmap->bounds.size.w % 32) ? 1 : 0))...
(dest_block >= (uint32_t*) base_addr)
; PBL_ASSERTN(dest_block < (uint32_t*) base_addr + row_size_bytes * (dest_bitmap->bounds.origin.y + dest_bitmap->bounds.size.h)); // bitblt part of glyph_block: const uint8_t number_of_bits = MIN(32 - dest_shift, MIN(glyph_line_bits_left, glyph_block_bits_left)); const uint32_...
w_value); } bool gvector_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 ((...
if (rect->size.w > inside_rect->size.w) { 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->...
g.h> static uint16_t get_write_length_available(CircularBuffer* buffer) { return buffer->buffer_size - buffer->data_length; } static uint16_t get_write_index(CircularBuffer* buffer) { return (buffer->read_index + buffer->data_length) % buffer->buffer_size; } void circular_buffer_init(CircularBuffer* buffer, uint...
{ memcpy(data_out + total_length_to_end, buffer->buffer, wrapped_length); }
return length_to_copy; } bool circular_buffer_read_or_copy(const CircularBuffer* buffer, uint8_t **data_out, size_t length, void *(*malloc_imp)(size_t), bool *caller_should_free) { UTIL_ASSERT(buffer && malloc_imp && data_out && caller_should_free); if (buffer->data_length < l...
te_index -= bytes_consumed; } unlock: prv_unlock(); } static bool prv_get_consumer_info(AppInboxServiceTag tag, AppInboxConsumerInfo *info_out) { if (!info_out) { return false; } bool success = false; prv_lock(); { AppInboxNode *inbox = prv_find_inbox_by_tag_and_log_if_not_found(tag); if (!in...
if (has_error) { kernel_free(new_node); new_node = NULL; } else { new_node->tag = tag; new_node->message_handler = message_handler; new_node->dropped_handler = dropped_handler; new_node->event_handler_task = pebble_task_get_current(); new_node->buffer.storage = storage; ...
equal_i(state.pin.header.timestamp, 1421136000); // back to the first cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&first_all_day_event, &state.pin.header.id)); cl_assert(state.node->all_day); // correct end of line behaviour cl_assert(!iter_prev(&iterator)); } void test_timeline__all_day_future...
iter_next(&iterator)
); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check all day events cl_assert(iter_next(&iterator)); Uuid first_all_day_event = state.pin.header.id; cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[1].header.id) || uuid_equal(&state.pin.header.id, &s_all_day_items[2]....
aging.paging_disabled); cl_assert_equal_b(false, scroll_layer->paging.shadow_hidden); scroll_layer->shadow_sublayer.clips = false; cl_assert_equal_b(false, scroll_layer->paging.paging_disabled); cl_assert_equal_b(false, scroll_layer->paging.shadow_hidden); // Validate that shadow_hidden is same position as ...
scroll_layer_set_paging(scroll_layer, true)
; cl_assert_equal_i(page_height, prv_scroll_layer_get_paging_height(scroll_layer)); int pages = 22; int offset = 0; // setup content size to be slightly more than the pages GSize content_size = GSize(scroll_bounds.size.w, page_height * pages + 24); scroll_layer_set_content_size(scroll_layer, content_size);...
cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(has_next); cl_assert_equal_i(new_idx, 2); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[0]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s...
cl_assert_equal_i(timeline_model_get_num_items(), 2)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
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_system_font(FONT_KEY_GOTHIC_24_BOLD)) { return 10; } else { return 0; } } // Assumes numbers / capital letters static int prv_get_y_offset_which_vertically_centers_font(GFo...
llId app_id, uint32_t update_interval_s, uint16_t expire_s, HRMFeature features, HRMSubscriberCallback callback, void *context) { if (!s_hrm_present) { return HRM_INVALID_SESSION_REF; } const PebbleTask curren...
{ expire_in_s = MAX(0, state->expire_utc - rtc_get_time()); }
*expire_s = MAX(0, expire_in_s); } if (features) { *features = state->features; } } mutex_unlock_recursive(s_manager_state.lock); return (state != NULL); } DEFINE_SYSCALL(bool, sys_hrm_manager_set_features, HRMSessionRef session, HRMFeature features) { bool success = false; mutex_lo...
ircle_center.x, 0, TRIG_MAX_ANGLE); } } static void prv_update_proc(struct Layer *layer, GContext* ctx) { TimelineLayer *timeline_layer = (TimelineLayer *)layer; const GRect *bounds = &layer->bounds; graphics_context_set_fill_color(ctx, GColorWhite); graphics_fill_rect(ctx,...
if (iter_state->current_day != layer->current_day) { // we moved back to an item from the previous day, display the day separator // by first hiding the pin of the "last" day that is about to come in and placing it there if (layer->layouts[0]) { prv_set_layout_hidden(layer->layouts[0], true); } ...
} bool timeline_layer_should_animate_day_separator(TimelineLayer *layer) { return !layer_get_hidden((Layer *)&layer->day_separator); } void timeline_layer_move_data(TimelineLayer *layer, int delta) { PBL_ASSERTN(delta == 1 || delta == -1); if (delta == 1) { if (layer->layouts[s_nonvisible_items[0]]) { ...
er); } return layer; } void status_bar_layer_destroy(StatusBarLayer *status_bar_layer) { if (!status_bar_layer) { return; } status_bar_layer_deinit(status_bar_layer); applib_free(status_bar_layer); } void status_bar_layer_deinit(StatusBarLayer *status_bar_layer) { layer_deinit(&status_bar_layer->lay...
layer_mark_dirty(&(status_bar_layer->layer))
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b3), 0); // Let it finish completely prv_advance_to_ms_with_timers(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b0), 1); cl_assert_equal_i(prv_count_handler_e...
(&s_stopped_handler_calls, a)
, 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); // 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_han...
nceStructured *structured_glance) { LauncherAppGlanceSettings *settings_glance = launcher_app_glance_structured_get_data(structured_glance); return NULL_SAFE_FIELD_ACCESS(settings_glance, title, NULL); } static void prv_charging_icon_node_draw_cb(GContext *ctx, const GRect *rect, ...
{ *size_out = GSize(battery_silhouette_icon_size.w, settings_glance->subtitle_font_height); }
an update handler static uint32_t prv_last_update_distance(Animation *animation) { AnimTestHandlerEntry *entry = prv_last_handler_entry(&s_update_handler_calls, animation); if (entry) { return (uint32_t)entry->context; } else { return 0; } } // ========================================================...
{ // Input is a value from 0 to 65535 (ANIMATION_NORMALIZED_MAX) // Output is a value from 0 to 65535 s_custom_curve_call_count++; return distance; }
CircularBufferClient client = (SharedCircularBufferClient) {}; shared_circular_buffer_add_client(&buffer, &client); // We should start out empty cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 0); // Write 2 cl_assert(shared_circular_buffer_write(&buffer, storage, 2, fal...
(items_read, 3)
; cl_assert_equal_m(out_buffer, "9j0k1m", 6); } void test_shared_circular_buffer__subsampling_variable_ratio(void) { SharedCircularBuffer buffer; uint16_t item_size = 2; uint8_t storage[12*item_size]; uint8_t out_buffer[12*item_size]; shared_circular_buffer_init(&buffer, storage, sizeof(storage)); Subs...
/* * 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...
interpolate_uint32(normalized, player->from_elapsed_ms, player->to_elapsed_ms)
; } else if ((is_animation_infinite || is_reel_infinite) && !is_animation_reversed) { // If either animation or reel is infinite and animation is not reversed animation_get_elapsed(animation, &animation_elapsed_ms); elapsed_ms = (int32_t)player->from_elapsed_ms + animation_elapsed_ms; } else if (is_an...
/* * 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 NULL; }
memset(result, 0, required_size); result->max_points = max_points; return result; } void gpath_builder_destroy(GPathBuilder *builder) { applib_free(builder); } GPath *gpath_builder_create_path(GPathBuilder *builder) { if (builder->num_points <= 1) { return NULL; } uint32_t num_points = builder->n...
w = spinner_ui_window_get(PBL_IF_COLOR_ELSE(GColorRed, GColorDarkGray)); app_window_stack_push(spinner_window, false /* animated */); } data->spinner_is_visible = true; data->spinner_should_close = false; } static void prv_hide_spinner(RecoveryFUAppData *data) { data->spinner_should_close = true; data->s...
kino_layer_set_reel(&data->kino_layer, icon_reel, /* take_ownership */ true)
; // Configure the url text layer data->url_text_layer.layer.frame.origin.y = text_y_offset; text_layer_set_text(&data->url_text_layer, url_string); } static void prv_update_name_text(RecoveryFUAppData *data) { const GAPLEConnection *gap_conn = gap_le_connection_any(); // Set the name text if (data->is_s...
CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_color, GPointZero, DEG_TO_TRIGANGLE(0), GPoint(20, 20)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_color_0.Xbit.pbi")); // Top-left corner rotation point, Angle 45 ...
(&ctx->dest_bitmap, "draw_rotated_bitmap_stamp_45deg.Xbit.pbi")
/* * 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...
(secs_to_wait, 100)
; cl_assert_equal_i(fake_gap_le_connect_params_get_last_requested(), ResponseTimeInvalid); // removing the fastest consumer should result in the next fastest being scheduled, but only // after an "inactivity timeout": conn_mgr_set_ble_conn_response_time( &s_hdl, BtConsumerLeServiceDiscovery, ResponseTime...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
sys_wakeup_query(wakeup_id)
, sys_get_time() + 10); // Cancel all wakeup events sys_wakeup_cancel_all_for_app(); cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); } void test_wakeup__max_events(void) { WakeupId wakeup_id = 0; sys_wakeup_cancel_all_for_app(); // Schedule 8 (max), at 1 minute offsets, then fail on 9th...
tal_line_dotted(&ctx, GPoint(7, 24), 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_origin_no_clip"))); // Even rows of different lengths setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_horizontal_line_dotted(&ctx...
(&ctx, GPoint(7, 13), 10)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 24), 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_even_offset_no_clip"))); // Even rows of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1); graphics_draw_hor...
te list's attributes below in the cleanup section // Advance the cursor by the serialized slice's total size glance_buffer_cursor += serialized_slice_total_size; } // Check that we fully populated the serialized glance buffer rv = (glance_buffer_cursor == glance_buffer_end) ? S_SUCCESS : E_ERROR; if (...
if (serialized_glance_size < 0) { WTF; }
uint8_t *serialized_glance = kernel_zalloc((size_t)serialized_glance_size); if (!serialized_glance) { return E_OUT_OF_MEMORY; } status_t rv = app_glance_db_read(key, key_size, serialized_glance, serialized_glance_size); if (rv != S_SUCCESS) { goto cleanup; } rv = prv_deserialize_glance((Serial...
e from //! 10x slower to 10x faster than they were recorded (100 Hz recording //! with 10 Hz replay, or vice versa). //! //! The driver was exceptionally braindead before, buffering up all of //! the samples it could and replaying them from a 256-sample deep //! buffer. With a typical replay rate of 25 Hz and samples b...
("Accel sample to manager: %d, %d, %d", sample.x, sample.y, sample.z)
; accel_cb_new_sample(&sample); } if (s_num_fifo_samples == 0 && s_current_rcv_sample >= s_num_rcv_samples) { prv_stop_timer(); } mutex_unlock(s_accel_mutex); } // Start/reschedule the timer that feeds the FIFO/s_latest_reading out of the // samples received from the host static void prv_reschedule_...
} } static void select_click_handler(ClickRecognizerRef recognizer, NumberWindow *nf) { if (nf->callbacks.selected != NULL) { nf->callbacks.selected(nf, nf->callback_context); } } static void click_config_provider(NumberWindow *nf) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 50, (ClickHandler) u...
(action_bar, BUTTON_ID_DOWN, &s_bar_icon_down_bitmap)
; action_bar_layer_set_icon(action_bar, BUTTON_ID_SELECT, &s_bar_icon_check_bitmap); action_bar_layer_add_to_window(action_bar, &nw->window); action_bar_layer_set_click_config_provider(action_bar, (ClickConfigProvider) click_config_provider); } void number_window_init(NumberWindow *nw, const char *label, NumberW...
/* * 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...
{ (void)test_count; (void)suite_names; (void)suite_count; printf("TAP version 13\n"); }
static void clar_print_shutdown(int test_count, int suite_count, int error_count) { (void)test_count; (void)suite_count; (void)error_count; if (!error_count) printf("# passed all %d test(s)\n", test_count); else printf("# failed %d among %d test(s)\n", error_count, test_count); printf("1..%d\n", test_co...
sage BTDriverConfig *config = kernel_zalloc_check(sizeof(BTDriverConfig)); ble_root_keys_get_and_generate_if_needed(config->root_keys); dis_get_info(&config->dis_info); #if CAPABILITY_HAS_BUILTIN_HRM config->is_hrm_supported_and_enabled = ble_hrm_is_supported_and_enabled(); PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sh...
(LOG_LEVEL_ERROR, "Error: Bluetooth isn't initialized yet")
; return; } mutex_lock(s_comm_state_change_mutex); prv_track_quick_airplane_mode_toggles(!enabled); bt_persistent_storage_set_airplane_mode_enabled(enabled); s_comm_airplane_mode_on = enabled; bool should_schedule_eval = false; if (!s_comm_state_change_eval_is_scheduled) { should_schedule_eval = t...
s(void) { #if CAPABILITY_HAS_HEALTH_TRACKING int32_t sleep_seconds; const bool rv = activity_get_metric(ActivityMetricSleepStateSeconds, 1, &sleep_seconds); return rv ? sleep_seconds : 0; #else return 0; #endif } // ---------------------------------------------------------------------------------------------- ...
cron_job_get_execute_time(cron)
); time_t last_alarm = 0; for (int i = 0; alarm_time <= current_time + SECONDS_PER_DAY * 3; i++) { if (last_alarm != alarm_time) { last_alarm = alarm_time; localtime_r(&alarm_time, local_alarm_time); if (alarm->config.scheduled_days[local_alarm_time->tm_wday]) { Uuid *pinid = (Uuid *)...
list_remove(&timer->list_node, &manager->running_timers /* &head */, NULL /* &tail */)
; manager->idle_timers = list_insert_before(manager->idle_timers, &timer->list_node); } // Clear the repeating flag so that if they call this method from a callback it won't get // rescheduled. timer->repeating = false; timer->expire_time = 0; mutex_unlock(manager->mutex); return (!timer->executing)...
tall_id(id, &entry)) { return false; } if (app_install_entry_is_SDK_compatible(&entry)) { return true; } PBL_LOG(LOG_LEVEL_WARNING, "App requires support for SDK version (%"PRIu8".%"PRIu8"), " "we only support version (%"PRIu8".%"PRIu8").", entry.sdk_version.majo...
PBL_LOG(LOG_LEVEL_ERROR, "Failed to get entry for id %"PRId32, id)
; } else if (app_install_entry_is_watchface(&entry)) { // If the watchface is for an unsupported SDK version, we need to switch the default // watchface back to tictoc. Otherwise, we will be stuck in the launcher forever. watchface_set_default_install_id(INSTALL_ID_INVALID); watchf...
rogress progress = ANIMATION_NORMALIZED_MAX / 2; unobstructed_area_service_change(area.size.h, to_area.size.h, progress); fake_event_service_handle_last(); cl_assert_equal_i(s_data.num_change_calls, 1); cl_assert_equal_i(s_data.last_change_progress, progress); } void test_unobstructed_area_service__change_afte...
(app_state_get_unobstructed_area_state()->handlers.did_change, prv_did_change)
atic void prv_exit_critical(void); static void prv_display_plugged(void *data); static void prv_dismiss_plugged(void); static void prv_display_fully_charged(void *data); static void prv_dismiss_fully_charged(void); // TODO PBL-39883: Replace w/ QUIRK_RESET_ON_SHUTDOWN_WHILE_CHARGING once arbitrary prefixes land #if PLA...
app_manager_close_current_app(true)
PBL_HEXDUMP(LOG_LEVEL_ERROR, (const uint8_t *) update->value_str, value_length)
; prv_analytics_log_event_with_info(AMSAnalyticsEventErrorPlayerPlaybackInfoUpdate, num_results); } } static bool prv_float_string_parse(const char *value, const uint16_t value_length, int32_t multiplier, int32_t *value_in_out) { if (value_length && !ams_util_float_stri...
/* * 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...
abs(last_pos->z - cur_pos->z)
encoded_event_payload(void *buffer) { static TestPLParsedMsg s_parsed_msg; static pebble_pipeline_Event events[10]; static Uuid event_uuids[10]; static ActivitySession event_sessions[10]; s_parsed_msg = (TestPLParsedMsg) { .events = { .num_events = ARRAY_LENGTH(events), .events = events, ...
cl_assert_equal_m(a->msrmt.values, b->msrmt.values, b->msrmt.num_values * sizeof(uint32_t))
; } else if (a->type == ProtobufLogType_Events) { cl_assert_equal_i(a->events.num_events, b->events.num_events); cl_assert_equal_i(a->events.num_sessions, b->events.num_sessions); for (int i = 0; i < a->events.num_events; i++) { const pebble_pipeline_Event *a_event = &a->events.events[i]; cons...
_stack_remove(&data->window, true); } else if (result == DELETED) { prv_update_alarm_list(data); if (!prv_are_alarms_scheduled(data)) { // The user deleted their last alarm, show a dialog and setup the create new alarm screen. // We don't want to show an empty alarm list prv_show_deleted_dia...
gbitmap_deinit(&data->plus_icon)
; gbitmap_init_with_resource(&data->plus_icon, data->current_plus_icon_resource_id); } box.origin = GPoint((cell_layer->bounds.size.w - data->plus_icon.bounds.size.w) / 2, (cell_layer->bounds.size.h - data->plus_icon.bounds.size.h) / 2); box.size = data->plus_icon.bounds.size...
SettingsRecordInfo *info, void *context) { // check entry is valid if (info->val_len == 0 || info->key_len != sizeof(BTBondingID)) { return true; // continue iterating } KeyForSMPairingItrData *itr_data = (KeyForSMPairingItrData*) context; BTBondingID key; BtPersistBo...
prv_update_bondings(key, BtPersistBondingTypeBLE)
; } prv_call_ble_bonding_change_handlers(key, op); return key; } bool bt_persistent_storage_update_ble_device_name(BTBondingID bonding, const char *device_name) { BtPersistBondingData data; if (!prv_file_get(&bonding, sizeof(bonding), &data, sizeof(data))) { return false; } if (data.type != BtPersi...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite)
hone_ui_data->caller_id_text_layer, GTextOverflowModeWordWrap); } else { phone_format_caller_name(caller_text, s_phone_ui_data->caller_id_text_buf, NAME_BUFFER_LENGTH); } if (s_phone_ui_data->style->large_caller_id) { caller_id_font = s_phone_ui_data->name_font; lines++; } else if (prv_has_long_nam...
animation_set_duration(upward, DURATION_APPEAR_ANIMATION_FRAMES * ANIMATION_FRAME_MS)
; Animation *bounceback = property_animation_get_animation( property_animation_create_bounds_origin(&s_phone_ui_data->call_status_text_layer.layer, &GPoint(0, -BOUNCEBACK_DISTANCE), &GPointZero)); animation_set_curve(...
/* * 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...
(data, num_items * session->item_size)
; } return dls_log(session, data, num_items); }
* * 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 governing permissions and * limitations under the Lice...
app_state_get_user_data()
; data->is_showing_version = !data->is_showing_version; prv_update_name_text(data); } static void prv_raw_down_handler(ClickRecognizerRef recognizer, void *context) { RecoveryFUAppData *data = app_state_get_user_data(); getting_started_button_combo_button_pressed(&data->button_combo_state, ...
define VOICE_LOG(fmt, args...) PBL_LOG_D(LOG_DOMAIN_VOICE, LOG_LEVEL_DEBUG, fmt, ## args) typedef enum { SessionState_Idle = 0, SessionState_StartSession, SessionState_VoiceEndpointSetupReceived, SessionState_AudioEndpointSetupReceived, SessionState_Recording, SessionState_WaitForSessionResult, } Session...
(LOG_LEVEL_INFO, "Session setup successfully")
inder_db_init, .insert = reminder_db_insert, .get_len = reminder_db_get_len, .read = reminder_db_read, .del = reminder_db_delete, .flush = reminder_db_flush, .is_dirty = reminder_db_is_dirty, .get_dirty_list = reminder_db_get_dirty_list, .mark_synced = reminder_db_mark_synced, }, [Bl...
(BlobDBEventTypeInsert, db_id, key, key_len)
; } return rv; } return E_INVALID_OPERATION; } int blob_db_get_len(BlobDBId db_id, const uint8_t *key, int key_len) { if (!prv_db_valid(db_id)) { return E_RANGE; } const BlobDB *db = &s_blob_dbs[db_id]; if (db->get_len) { return db->get_len(key, key_len); } return E_INVALID_OPER...
case_addr, 0xFF, FLASH_TEST_ERR_ERASE, 0, true); VERIFY_TEST_STATUS(status); // Write test pattern to the test address // Data should be set to test_pattern since existing data should be 0xFF and we are writing // test_pattern status = prv_write_read_verify_byte(test_addr, test_pattern, test_pattern, true); ...
VERIFY_TEST_STATUS(status)
/* * 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...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25661_7 //> TEST_EXPECTED 200 //> TEST_EXPECTED_MIN 165 //> TEST_EXPECTED_MAX 230 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { 392, 280, -920}, { 3...
{ 928, 352, -704}, { 1112, 584, -680}, { 888, 696, -584}, { 752, 520, -480}, { 696, 608, -456}, { 496, 576, -304}, { 536, 728, -320}, { 672, 848, -392}, { 656, 672, -392}, { 544, 568, -400}, { 464, 528, -360}, { 392, 576, -392}, { 528, 696, -512}, { 688, 696, -57...
h" #include "services/normal/timeline/timeline.h" // Fixture //////////////////////////////////////////////////////////////// // Fakes //////////////////////////////////////////////////////////////// #include "fake_rtc.h" // Stubs //////////////////////////////////////////////////////////////// #include "stubs_analy...
(&item->attr_list, AttributeIdSubtitle, "none")
, "subtitle"); timeline_item_destroy(item); } void test_timeline_api__item_pin_to_timeline(void) { TimelineItem *item = timeline_item_create_with_attributes(0, 0, TimelineItemTypePin, LayoutIdTest, NULL, NULL); Uuid id = item->header.id; cl_assert(!timeline_exists(&id)); cl_assert(timeline_add(item)...
= prv_get_attribute_length(src); if (*buffer + attribute_length > buffer_end) { return false; } switch (prv_attribute_type(src->id)) { case AttributeTypeString: { dest->cstring = (char *)*buffer; strncpy(dest->cstring, src->cstring, attribute_length); break; } case AttributeTyp...
prv_attribute_type(id)
== AttributeTypeUint32List); prv_add_attribute(list, id)->uint32_list = uint32_list; } void attribute_list_add_attribute(AttributeList *list, const Attribute *new_attribute) { Attribute *attribute = prv_add_attribute(list, new_attribute->id); *attribute = *new_attribute; } void attribute_list_init_list(uint8_t...
minute file", s_alg_state->num_minute_records); // Reset all metrics activity_algorithm_metrics_changed_notification(); // Return desired sampling rate *sampling_rate = KALG_SAMPLE_HZ; return true; } static void prv_activity_update_states(time_t utc_sec, AlgMinuteRecord *record_out, ...
ROUND(minute_distance_mm, k_mm_per_cm)
; // Fill in heart rate, heart rate sample weight, then reset it int32_t median, heart_rate_total_weight_x100; activity_metrics_prv_get_median_hr_bpm(&median, &heart_rate_total_weight_x100); m_rec->heart_rate_bpm = (uint8_t)median; m_rec->heart_rate_total_weight_x100 = (uint16_t)heart_rate_total_weight_x100;...
raw_command_set_hidden(command, true); cl_assert_equal_i(s_stroke_color.argb, GColorClearARGB8); cl_assert_equal_i(s_fill_color.argb, GColorClearARGB8); cl_assert_equal_i(s_stroke_width, 0); cl_assert_equal_i(s_path_num_points, 0); cl_assert_equal_b(s_path_open, false); cl_assert_equal_i(s_path_fill_count, ...
// make fill color transparent (nothing should be drawn because the stroke width is zero and the // fill is transparent GColor color = gdraw_command_get_fill_color(command); color.a = 0; gdraw_command_set_fill_color(command, color); gdraw_command_draw(NULL, command); cl_assert_equal_i(s_stroke_color.argb,...
et_metric(ActivityMetricRestingKCalories, 2, metric_values); cl_assert_equal_i(metric_values[0], 2000); cl_assert_equal_i(metric_values[1], 44); cl_assert_equal_i(activity_metrics_prv_get_resting_calories(), 2000 * ACTIVITY_CALORIES_PER_KCAL); activity_metrics_prv_set_metric(ActivityMetricSleepTotalSeconds, Th...
(&start_tm)
terp); cl_assert_equal_i(y, 255 + 255); } void test_gdraw_command_transforms__int_scale_to_translate_overflow_neg(void) { InterpolateInt64Function interp = prv_default_interpolate; int y = prv_int_scale_and_translate_to(-255, 10, 10, 10, 0, -255, ANIMATION_NORMALIZED_MAX, ...
tests_write_gbitmap_to_pbi(&ctx.dest_bitmap, fn)
; t += dt; } }
/* * 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...
resource_storage_flash_bytes_are_readonly(bytes)
two more additional logs which should cause the first erase // region to get erased logs = realloc(logs, sizeof(char *) * (num_logs + 2)); logs[num_logs] = task_strdup("Let's test if wrap around is working!"); logs[num_logs + 1] = task_strdup("This should be on an early page"); int start_log = num_logs / (t...
(start_addr != FLASH_LOG_INVALID_ADDR)
; bool rv = flash_logging_write((uint8_t *)msg, start_addr, strlen(msg)); cl_assert(rv); rv = flash_logging_write((uint8_t *)msg, start_addr, strlen(msg)); cl_assert(!rv); setup_and_test_expected_msg(&msg, 0, 1, 1); } //! Make sure that when we chunk up our writes for a log message, the lines //! are saved...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(index < NUM_OTP_SLOTS)
; return (char * const) (s_otp_buffer + (32 * index)); } uint8_t * otp_get_lock(const uint8_t index) { PBL_ASSERTN(index < NUM_OTP_SLOTS); return (uint8_t * const) (s_otp_locks + index); } bool otp_is_locked(const uint8_t index) { return (*otp_get_lock(index) == 0); } OtpWriteResult otp_write_slot(const uint...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_hw_and_sw_supports_hrm()
/* * 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 (hw_version_size > MFG_HW_VERSION_SIZE) { // same assumption as in mfg_info_get_pcba_serialnumber hw_version[MFG_HW_VERSION_SIZE] = '\0'; }
{ const bool enable_vibration = (selection != 0); const VibeIntensity new_vibe_intensity = enable_vibration ? (selection - INTENSITY_ROW_OFFSET) : DEFAULT_VIBE_INTENSITY; alerts_set_vibrate(enable_vibration); alerts_preferences_set_vibe_intensity(new_vibe_intensity); ...
static void prv_vibe_menu_push(SettingsNotificationsData *data) { const OptionMenuCallbacks callbacks = { .select = prv_vibe_menu_select, }; /// The option in the Settings app for choosing a vibration intensity for notifications. const char *title = i18n_noop("Vibration"); uint32_t selected = vibe_inten...
GPoint pt = CENTER_OF_ORIGIN_RECT; // draw multiple quads with different radiuses for (int r = 0; r <= 15; r++) { graphics_circle_quadrant_draw_1px_aa(&ctx, pt, r, c.mask); // center point follows a grid pt.x += 30; if (pt.x > 120) { pt.x = CENTER_OF_ORIGIN_RECT.x; ...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_aa_swX_color.8bit.pbi"))