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...
jerry_cleanup()
; rocky_runtime_context_deinit(); } } void test_rocky_api_watchinfo__model(void) { rocky_global_init(s_watchinfo_api); EXECUTE_SCRIPT("var model = _rocky.watchInfo.model"); ASSERT_JS_GLOBAL_EQUALS_S("model", "pebble_time_steel_gold"); } void test_rocky_api_watchinfo__qemu_model(void) { s_watch_info_col...
EL_INFO, "Recovering flash region from GC file"); recover_region_from_file(fd); } // find a free region if (!prv_update_gc_reserved_region()) { PBL_LOG(LOG_LEVEL_ERROR, "No free flash erase units!"); // Note: It should not be possible for this to happen since start of day no // files will be writ...
memcpy(diagnostic_buf, &PFS_FD(fd), MIN(diagnostic_buf_len, sizeof(FileDesc)))
; mutex_unlock_recursive(s_pfs_mutex); } // pass in either 0 or 1 to as argument void pfs_command_fs_format(const char *erase_headers) { int write_erase_headers = atoi(erase_headers); if (write_erase_headers == 1) { pfs_format(true /* write erase headers */); } else { pfs_format(false /* write erase he...
eepState, 1, &sleep_state); return rv ? sleep_state : ActivitySleepStateUnknown; #else return ActivitySleepStateUnknown; #endif } // ---------------------------------------------------------------------------------------------- static int prv_get_sleep_seconds(void) { #if CAPABILITY_HAS_HEALTH_TRACKING int32_t s...
(ALARM_ENTRY_SIZE)
; AppInstallEntry *entry = kernel_malloc_check(sizeof(AppInstallEntry)); if (!app_install_get_entry_for_install_id(APP_ID_ALARMS, entry)) { goto cleanup; } int num_pin_adds = 0; time_t alarm_time = prv_get_alarm_time(alarm, cron_job_get_execute_time(cron)); time_t last_alarm = 0; for (int i = 0; ala...
ne_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(ctx, word, NEWLINE_CODEPOINT, text_box_params); if (text_box_params->overflow_mode != GTextOverflow...
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; } return true; } static inline void prv_text_walk_lines(GContext* ctx, TextLayout* const layout, ...
================================================================== // Tests // --------------------------------------------------------------------------------------- // Feed in X seconds of data with the given statistics. // The fake algorithm we plug in assumes that each accel sample contains the following: // .x : ...
(record->flags & ACTIVITY_RAW_SAMPLE_FLAG_FIRST_RECORD)
; } else { cl_assert(!(record->flags & ACTIVITY_RAW_SAMPLE_FLAG_FIRST_RECORD)); } if (i == s_num_dls_accel_records - 1) { cl_assert(record->flags & ACTIVITY_RAW_SAMPLE_FLAG_LAST_RECORD); } else { cl_assert(!(record->flags & ACTIVITY_RAW_SAMPLE_FLAG_LAST_RECORD)); } // Uncompr...
byte, delta_bytes); } } if (delta_neg) { if (delta_bits) { const int rshift = delta_bits; const int lshift = 8 - rshift; for (int i = 0; i < bytes - 1; i++) { buf[i] = (buf[i] >> rshift) | (buf[i+1] << lshift); } ...
(src_pixels, dst_pixels)
; memmove(dst_row_info.data + dst_min_x + x_offset, src_row_info.data + src_min_x, (size_t)copy_pixels); break; } default: WTF; } } } GColor graphics_private_sample_line_color(const GBitmap *bitmap, GColorSampleEdge edge, ...
andable_dialog_get_dialog(expandable_dialog); dialog_set_text(dialog, data->lorem_ipsum); dialog_set_background_color(dialog, GColorLightGray); dialog_set_icon(dialog, data->resource_id_25); dialog_show_status_bar_layer(dialog, true); expandable_dialog_set_header(expandable_dialog, "Header"); app_expandabl...
strncpy(transcription, data->long_message, len)
; transcription_dialog_update_text(transcription_dialog, transcription, len); app_transcription_dialog_push(transcription_dialog); transcription_dialog_set_callback(transcription_dialog, prv_transcription_dialog_cb, data); } ///////////////////////////////////// // Set up dialog labels and callbacks typedef str...
4, 112}, // 2 seconds { 856, 496, 168}, { 792, 424, 144}, { 816, 408, 56}, { 832, 368, 96}, { 840, 360, 40}, { 856, 328, 56}, { 864, 312, 64}, { 864, 312, 32}, { 904, 272, 72}, { 960, 280, 112}, { 1080, 312, 80}, { 1304, 144, 296}, { 1240, 192, 336}, { 1080, 3...
{ 1120, 432, 144}, { 848, 352, -224}, { 904, -192, 264}, { 1016, 16, 264}, { 944, 144, 128}, // 8 seconds { 840, 128, 80}, { 712, 96, 56}, { 624, 48, 80}, { 608, 16, 104}, { 672, -16, 96}, { 784, 32, 72}, { 1056, 96, 64}, { 1408, -72, 312}, { 1880, 16, 384}, ...
e(); } s_workout_data.current_workout->paused = should_be_paused; // Update the global duration since we have changed the pause state prv_update_duration(); PBL_LOG(LOG_LEVEL_INFO, "Paused a workout with type: %d", wrkt_data->type); prv_put_event(PebbleWorkoutEvent_Paused); } prv_unlock();...
workout_service_is_workout_ongoing()
&& s_workout_data.current_workout->paused); prv_unlock(); return rv; } // --------------------------------------------------------------------------------------- bool workout_service_get_current_workout_type(ActivitySessionType *type_out) { bool rv = true; prv_lock(); if (!type_out || !workout_service_is_w...
nt8_t s_read_data[MAX_FRAME_LENGTH]; //! The type of the most recent link control message which was sent static LinkControlType s_type; //! Number of consecutive bad status message responses received from the smartstrap static int s_strikes; static void prv_do_send(LinkControlType type) { FrameHeader header = (Fram...
if (header->type == LinkControlTypeBaud) { // new baud rate const uint8_t requested_baud = header->data[0]; if (requested_baud >= ARRAY_LENGTH(BAUDS)) { PBL_LOG(LOG_LEVEL_DEBUG, "Invalid baud rate (%"PRIu8")", requested_baud); smartstrap_link_control_disconnect(); success = false; } el...
return success; } void smartstrap_link_control_connect(void) { prv_do_send(LinkControlTypeProfiles); accessory_set_baudrate(AccessoryBaud9600); } void smartstrap_link_control_disconnect(void) { s_strikes = 0; s_profiles = 0; accessory_set_baudrate(AccessoryBaud9600); smartstrap_connection_state_set(fal...
ranscription)); cl_assert_equal_p(result, false); result = transcription_validate(validate_test, sizeof(Transcription) - 1); cl_assert_equal_p(result, false); s_test_transcription_example[0] = 0; result = transcription_validate(validate_test, test_size); cl_assert_equal_p(result, false); s_test_transcri...
((TranscriptionWord *)words_test, 3, NULL, NULL)
; cl_assert_equal_p(result, end); } void test_transcription__iterate_sentences(void) { uint8_t sentence_test[] = { // Sentence #1 0x02, 0x00, // Word count // Word #1 85, // Confidence 0x05, 0x00, // Word length 'H', 'e', 'l', 'l', 'o', // Word #2 74, // Co...
void test_app_glance_db__reading_glance_with_invalid_arguments_fails(void) { // NULL UUID fails AppGlance glance_out = {}; cl_assert_equal_i(app_glance_db_read_glance(NULL, &glance_out), E_INVALID_ARGUMENT); // NULL glance_out fails cl_assert_equal_i(app_glance_db_read_glance(&APP_GLANCE_TEST_UUID, NULL), ...
cl_assert_equal_i(e.type, PEBBLE_APP_FETCH_REQUEST_EVENT)
; cl_assert(!e.app_fetch_request.with_ui); cl_assert_equal_i(e.app_fetch_request.id, 10); } void test_app_glance_db__insert_app_in_cache(void) { cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, s_app_glance_basic, sizeof(s_app_glance_basic)), S_SUCCESS); cl_assert_equal...
uint16_t*) (FMC_BANK_1_BASE_ADDRESS + end_sector))[0] = S29VSCommand_SectorLockRangeArg; flash_impl_release(); } void flash_s29vs_hw_init(void) { // Configure the reset pin (D2) GPIO_InitTypeDef gpio_init = { .GPIO_Pin = GPIO_Pin_2, .GPIO_Mode = GPIO_Mode_OUT, .GPIO_Speed = GPIO_Speed_100MHz, .GP...
{ status_t error = S_SUCCESS; const uint8_t sr = prv_read_status_register(sector_addr); if ((sr & S29VSStatusBit_DeviceReady) == 0) { // Another operation is already in progress. error = E_BUSY; } else if (sr & S29VSStatusBit_EraseSuspended) { // Cannot program while another program op...
prv_allow_write_if_sector_is_not_protected(false, sector_addr); prv_issue_command(sector_addr, S29VSCommand_EraseSetup); prv_issue_command_argument(sector_addr, S29VSCommandEraseAguments_SectorErase); prv_allow_write_if_sector_is_not_protected(true, sector_addr); // Check the ...
//! Tick timer service callback //! @param tick_time Pointer to time structure //! @param units_changed The time units changed static void prv_tick_timer_handler(struct tm *tick_time, TimeUnits units_changed) { HealthAppData *health_app_data = app_state_get_user_data(); health_data_update_step_derived_metrics(hea...
i18n_noop("Health")
, }; return (const PebbleProcessMd*) &s_health_app_info; }
which are // compiled to use the 3.0 animation API to work with 2.0 apps. return ((AnimationLegacy2 *)animation_h)->abs_start_time_ms; } AnimationPrivate *animation = prv_find_animation_by_handle(NULL, animation_h, false /*quiet*/); if (!animation) { return 0; } return animation->abs_start_time_...
animation_legacy2_set_custom_curve((AnimationLegacy2 *)animation_h, function)
; return true; } AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, false /*quiet*/); if (!prv_is_mutable(state, animation)) { return false; } animation->custom_function = function; if (function) { animation->curve = curve; } else { animation->curve = Animatio...
ed_activity, sizeof(disabled_activity)); pfs_watch_cb(NULL); // Update the settings cache prv_minute_update(ACTIVE_MINUTES); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); } // ------------------------------------------------------------------------------...
rtc_get_time()
) + tz.tm_gmtoff); prv_set_sleep_history_avg(); activity_insights_init(rtc_get_time()); // At midnight, enter/exit get set to midnight UTC (for PST, this is 4PM), total sleep is 0 uint32_t midnight_local = ((24 + tz.tm_gmtoff) % 24) * SECONDS_PER_HOUR; s_data.metric_history[ActivityMetricSleepState][0] = ...
onn_idx, rv); return rv; } ble_error_t gatt_wrapper_write(uint16_t conn_idx, uint16_t handle, uint16_t length, const uint8_t *value, uintptr_t context_ref, GattReqSource source) { GATT_LOG_DEBUG("gatt_wrapper_write: handle: %d, context_ref: %d, source: %d", handle, ...
((gatt_wrapper_write_cb) context_ref)(evt)
; break; default: break; } } void gatt_wrapper_handle_notification(const ble_evt_gattc_notification_t *evt) { BTDeviceInternal addr; Connection *conn = connection_by_idx_check(evt->conn_idx); connection_get_address(conn, &addr); hc_endpoint_gatt_send_notification(&addr, evt->handle, evt->leng...
.health_event = { .type = HealthEventSignificantUpdate, .data.significant_update = { .day_id = 0, }, }, }; sys_send_pebble_event_to_kernel(&event); return true; #endif } // ---------------------------------------------------------------------------------------------- bool health_s...
{ return HRM_MANAGER_APP_EXIT_EXPIRATION_SEC; }
#endif } // ---------------------------------------------------------------------------------------------- uint32_t health_service_get_minute_history(HealthMinuteData *minute_data, uint32_t max_records, time_t *time_start, time_t *time_end) { #if !CAPABILITY_HAS_HEALTH_TRACK...
/* * 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...
(send_bluetooth, NULL)
; } PBL_LOG(LOG_LEVEL_INFO, "Bluetooth disconnected"); } else if (index == 1) { PBL_LOG(LOG_LEVEL_DEBUG, "Not implemented"); } } // ================================================================================= static void prv_window_load(Window *window) { TestBTAppData *data = s_app_data; ...
che.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 governing permissions and ...
(t1->tx, t2->a)
; Fixed_S32_16 ty_c = Fixed_S32_16_mul(t1->ty, t2->c); Fixed_S32_16 tx_b = Fixed_S32_16_mul(t1->tx, t2->b); Fixed_S32_16 ty_d = Fixed_S32_16_mul(t1->ty, t2->d); t_new->a = Fixed_S32_16_add(a_a, b_c); t_new->b = Fixed_S32_16_add(a_b, b_d); t_new->c = Fixed_S32_16_add(c_a, d_c); t_new->d = Fixed_S32_16_ad...
the caller's minute buffer while (avail_minutes--) { // Read the next minute out of the buffer uint16_t length_out; bool success = shared_circular_buffer_read_consume( &s_alg_state->minute_data_cbuf, cbuf_client, sizeof(*cbuf_record), (uint8_t *)cbuf_record, &length_out); PBL_ASSERTN(...
if (file && compact_first) { file = prv_validate_and_trim_minute_file(file, ALG_MINUTE_FILE_MAX_ENTRIES); }
if (!file) { goto exit; } // Count # of records in minute file AlgMinuteFileInfoContext context = (AlgMinuteFileInfoContext) {}; status_t status = settings_file_each(file, prv_read_minute_file_info_cb, &context); if (status != S_SUCCESS) { goto exit; } success = true; exit: if (file) { ...
(health_card_view->card_layers[i], true); } } if (!finished) { prv_set_window_background_color(health_card_view); } else { prv_refresh_select_indicator(health_card_view); prv_refresh_content_indicators(health_card_view); } } static const AnimationImplementation prv_bg_animation_implementation ...
(BUTTON_ID_DOWN, prv_up_down_click_handler)
; } /////////////////////////////////////////////////////////////////////////////////////////////////// // API Functions // HealthCardView *health_card_view_create(HealthData *health_data) { HealthCardView *health_card_view = app_malloc_check(sizeof(HealthCardView)); *health_card_view = (HealthCardView) { .h...
/* * 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_verify_kinds_match(heartbeat, metric); if (analytics_metric_is_array(metric)) { PBL_CROAK("Attempt to use integer value for array metric."); } return heartbeat->data + analytics_metric_offset(metric); }
static uint8_t *prv_heartbeat_get_array_location(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric, uint32_t index) { prv_verify_kinds_match(heartbeat, metric); if (!analytics_metric_is_array(metric)) { PBL_CROAK("Attempt to use array value for integer metric."); } uint32_t len = analytics_me...
. * See the License for the specific language governing permissions and * limitations under the License. */ #include "test_alarm_common.h" // Fakes #include "fake_rtc.h" #include "fake_new_timer.h" #include "stubs_blob_db_sync.h" #include "stubs_blob_db_sync_util.h" static int s_rand = 0; int rand(void) { // ...
prv_set_time(s_current_day, 10, 0)
; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); cl_assert_equal_i(s_num_alarm_events_put, 1); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); } void test_alarm_smart__dont_trigger_30_min_early_deep_sleep(void) { AlarmId id; id = alarm_create(&(AlarmInfo) ...
8}, { 952, -168, -352}, { 872, -296, -248}, { 1120, -224, -104}, { 1224, -64, -496}, { 1120, -96, -344}, { 1336, -40, -296}, { 1400, 64, -368}, { 1296, 136, -320}, { 1152, 320, -256}, { 1128, 288, -272}, { 1104, 336, -272}, { 1064, 440, -296}, { 1008, 608, -232}, ...
{ 1288, 128, -176}, { 1120, 24, -144}, { 1000, -16, -168}, { 1048, 8, -224}, { 1120, 32, -264}, { 1040, -56, -376}, // 53 seconds { 976, -80, -376}, { 1168, -112, -200}, { 1312, -56, -352}, { 1192, -16, -304}, { 1256, 48, -312}, { 1248, 64, -368}, { 1192, 184, -36...
{ 1320, 144, -320}, { 1184, 0, -368}, { 1192, -8, -408}, { 1088, -8, -352}, { 968, 80, -240}, { 1008, 168, -240}, { 1040, 208, -192}, { 1128, 368, -248}, { 1240, 456, -248}, { 1032, 496, -216}, { 728, 520, -96}, { 760, 624, -264}, { 848, 712, -152}, { 1032, 568, ...
, { 0, 0x55, 13, 144, 0}, { 0, 0x55, 0, 148, 0}, { 0, 0x55, 0, 147, 0}, { 0, 0x55, 0, 147, 0}, { 0, 0x78, 1282, 148, 0}, { 0, 0x69, 356, 144, 0}, // 525: Local time: 2016-03-02 04:50:00 AM { 0, 0x69, 0, 148, 0}, { 0, 0x69, 498, 148, 0}, { 0, 0x69, 7, 148, 0}, { 0, 0x69, 0, 14...
ARRAY_LENGTH(samples)
; return samples; }
w->on_screen, true); cl_assert_equal_i(window->is_loaded, false); window_stack_pop(window->parent_window_stack, true); } static void prv_push_window_unload(Window *window) { WindowStack *stack = window->parent_window_stack; prv_window_unload(window); Window *new_window = window_create(); window_set_wind...
app_window_stack_remove(window2, false)
; cl_assert_equal_i(app_window_stack_count(), 0); cl_assert_equal_i(window2->on_screen, false); cl_assert_equal_i(window1->on_screen, false); window_destroy(window1); window_destroy(window2); } void test_window_stack__pop_all(void) { WindowStack *stack = modal_manager_get_window_stack(ModalPriorityGeneri...
/* * 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...
launcher_menu_app_get_app_info()
)) { return watchface_get_default_install_id(); } return APP_ID_LAUNCHER_MENU; } const PebbleProcessMd* system_app_state_machine_get_default_app(void) { return launcher_menu_app_get_app_info(); } #else AppInstallId system_app_state_machine_get_last_registered_app(void) { return APP_ID_SDK; } const Pebbl...
ine_origin_odd_rows_no_clip"))); // Test to make sure drawing on all rows creates checkerboard pattern setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); ...
(&ctx, GPoint(0, 23), MAX_NUM_COLS + 1)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_even_offset_odd_rows_no_clip"))); // Test to make sure drawing on all rows creates checkerboard pattern setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1); for (int16_t row = 0; row < MAX_NUM_R...
== 0) || ((graph_card->current_day == Sunday) ? false : ((int)graph_card->selection == Sunday || (int)graph_card->selection > graph_card->current_day))); } size_t health_graph_format_weekday_prefix(HealthGraphCard *graph_card, char *buffer, siz...
(sizeof(HealthGraphCard))
; if (graph_card) { layer_init(&graph_card->layer, &GRectZero); layer_set_update_proc(&graph_card->layer, prv_health_graph_layer_update_proc); health_graph_card_configure(graph_card, config); graph_card->title_font = fonts_get_system_font(PBL_IF_RECT_ELSE(FONT_KEY_GOTHIC_24_BOLD, ...
/* * 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...
progress_callback(sector - first_sector + 1, count, progress_context)
; } } FLASH_Lock(); return true; } bool system_flash_write( uint32_t address, const void *data, size_t length, SystemFlashProgressCb progress_callback, void *progress_context) { FLASH_Unlock(); FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLA...
f8_t *)"hello", 5); cl_assert_equal_i(copied, 1); cl_assert_equal_s((char *)dest, "h"); } void test_utf8__copy_multibyte_char(void) { utf8_t dest[5]; memset(dest, 0, 5); size_t copied = utf8_copy_character(dest, (utf8_t *)NIHAO, 5); cl_assert_equal_i(copied, NIHAO_FIRST_CHARACTER_BYTES); cl_assert_equa...
("Hello", output_buffer, 6)
); free(output_buffer); }
/* * 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...
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */)
; resource_init(); ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); content_indicator_init_buffer(buffer); } void test_timeline_layouts__cleanup(void) { free(fb); } // Helpers ////////////////////// void prv_handle_down_click(ClickRecognizerRef recognizer, void *context); static v...
/ 2) * FIXED_S16_3_ONE.raw_value; p1.x.raw_value = (sin_lookup(rotation) * (line_length * FIXED_S16_3_ONE.raw_value) / TRIG_MAX_RATIO) + p0.x.raw_value; p1.y.raw_value = (-cos_lookup(rotation) * (line_length * FIXED_S16_3_ONE.raw_value) / TRIG_MAX_RATIO) + p0.y.raw_va...
(s_window, &(WindowHandlers) { .load = main_window_load, .unload = main_window_unload, })
sion 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 distributed on an "A...
{ if (is_remote_connected(remote) != is_remote_connected(other)) { return is_remote_connected(remote) ? -1 : 1; } else { return strncmp(remote->name, other->name, sizeof(remote->name)); } }
static void add_remote(SettingsBluetoothData* data, StoredRemote* remote) { const bool ascending = false; data->remote_list_head = list_sorted_add(data->remote_list_head, &remote->list_node, (Comparator) remote_comparator, ascending); } static StoredRemote* stored_remote_create(void) { StoredRemote* remo...
/* * 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...
for (size_t i = 0; i < num_points; i++) { for (size_t j = i + 1; j < num_points; j++) { int cmp = comparator(&points[i], &points[j], context); if (reverse ? cmp < 0 : cmp > 0) { prv_swap_gpoint(&points[i], &points[j]); } } }
} bool gpointprecise_equal(const GPointPrecise * const pointP_a, const GPointPrecise * const pointP_b) { return ((pointP_a->x.raw_value == pointP_b->x.raw_value) && (pointP_a->y.raw_value == pointP_b->y.raw_value)); } GPointPrecise gpointprecise_midpoint(const GPointPrecise a, ...
OG(LOG_LEVEL_ERROR, "Error fetching metric data"); return false; } // Store in cache if we have space for it. if (state->cache && (metric == HealthMetricStepCount)) { memcpy(&state->cache->steps_daily, daily, sizeof(*daily)); state->cache->step_daily_valid = true; } return true; } // -----------...
{ memcpy(averages, &state->cache->step_averages, sizeof(*averages)); return true; }
// Fetch the intraday averages, if available if (state->cache && (metric == HealthMetricStepCount)) { // Fill the cache if this is step count sys_activity_get_step_averages(day_in_week, &state->cache->step_averages); state->cache->step_averages_day = day_in_week; state->cache->step_averages_valid ...
(s_resource_mutex)
; return bytes_read; } size_t resource_size(ResAppNum app_num, uint32_t resource_id) { mutex_lock_recursive(s_resource_mutex); ResourceStoreEntry resource; prv_get_resource(app_num, resource_id, &resource); mutex_unlock_recursive(s_resource_mutex); return resource.length; } bool resource_bytes_are_readonl...
/* * 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, (GBitmap*)icon, &icon_rect)
; } rect.origin.y += rect.size.h; } } void action_bar_layer_legacy2_init(ActionBarLayerLegacy2 *action_bar) { *action_bar = (ActionBarLayerLegacy2){}; layer_init(&action_bar->layer, &GRectZero); action_bar->layer.update_proc = (LayerUpdateProc) action_bar_legacy2_update_proc; action_bar->layer.proper...
stubs_app_manager.h" #include "stubs_app_install_manager.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_bt_lock.h" #include "stubs_hexdump.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_serial.h" #include "stubs_tick.h" extern void music_protocol_msg_callback(CommSe...
prv_receive_and_assert_play_state(expect_is_handled)
; prv_receive_and_assert_volume_info(expect_is_handled); prv_receive_and_assert_player_info(expect_is_handled); } static const MusicServerImplementation s_dummy_server_implementation = {}; static void prv_set_dummy_server_connected(bool connected) { music_set_connected_server(&s_dummy_server_implementation, ...
S_PER_DAY, HealthServiceTimeScopeWeekly); cl_assert_equal_i(result, exp_weekly); // Average weekly 48hr avg result = health_service_sum_averaged(HealthMetricStepCount, time_util_get_midnight_of(now), ...
cl_assert_equal_i(value, exp_value)
; // --- // Compute weekend step average from 4am to 9am. This should use the 15-minute // step averages that we stuffed in. exp_value = prv_averages_sum(4 * MINUTES_PER_HOUR, 9 * MINUTES_PER_HOUR, &s_sys_activity_get_step_averages_values_weekend.out.averages); // Since "today" is Mo...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_num_sessions, 1)
; // Find the session we just added ActivitySession walk_session = {}; found_session = workout_utils_find_ongoing_activity_session(&walk_session); // Made sure non-ongoing sessions are not returned cl_assert_equal_b(found_session, false); // Add an ongoing run session prv_add_session(&(ActivitySession)...
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE)
; boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO); recovery_fw_ok = false; } break; } boot_bit_clear(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS); return recovery_fw_ok; }
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax2_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif } void te...
MIN(RECT_WIDTH, RECT_HEIGHT)
) / 2)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should not draw anything setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_H...
ime_t sys_time_utc_to_local(time_t t) { return t; } const char *get_timezone_abbr(void) { static const char s_timezone_abbr[] = "A"; return s_timezone_abbr; } void sys_copy_timezone_abbr(char* timezone_abbr, time_t time) { const char* sys_tz = get_timezone_abbr(); strncpy(timezone_abbr, sys_tz, TZ_LEN); } ...
strftime(tmbuf, sizeof(tmbuf), "%F", &jan_2_2015__13_00_00)
; cl_assert_equal_s(tmbuf, "2015-01-02"); #endif #if EXTENSION_TZ tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%G %g", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "2015 15"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%k %l", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "13 1"); #end...
CT_ONE); break; case 6: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; case 7: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; default: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETE...
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE)
; PWR_BackupAccessCmd(ENABLE); // Disable write-protect on RTC_BKP_x registers } void boot_main(void) { prv_configure_system_flash(); prv_enable_backup_access(); dbgserial_init(); prv_print_reset_reason(); boot_bit_init(); if (!rtc_init()) { // Need to initialize the display in this // case s...
/* * 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...
(uu1, uu2, sizeof(Uuid))
== 0; } bool uuid_is_system(const Uuid *uuid) { return uuid_equal(uuid, &system_uuid); } bool uuid_is_invalid(const Uuid *uuid) { return !uuid || uuid_equal(uuid, &invalid_uuid); } void uuid_to_string(const Uuid *uuid, char *buffer) { if (!uuid) { strcpy(buffer, "{NULL UUID}"); return; } // For r...
_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 PostFunctionCalledEvenIfPreFunctionCausesNothingToBeDrawnTestPro...
( post_function_called_even_if_pre_function_specifies_empty_rect__pre)
; };
*free = 0; *max_free = 0; free_segments = 0; alloc_segments = 0; heap_info_ptr = heap->begin; do { /* Check to see if the current fragment is marked as free. */ if(heap_info_ptr->is_allocated) { alloc_segments++; *used += heap_info_ptr->Size * ALIGNMENT_SIZE; } e...
{ heap->high_water_mark = heap->current_size; }
} } heap_unlock(heap); if (allocated_block) { return &allocated_block->Data; } return NULL; } void heap_free(Heap* const heap, void *ptr, uintptr_t client_pc) { UTIL_ASSERT(heap->begin); if (!ptr) { // free(0) is a no-op, just bail return; } UTIL_ASSERT(heap_contains_address(heap,...
ersion. PBL_LOG(LOG_LEVEL_DEBUG, "Booting AS7000..."); gpio_output_init(&dev->en_gpio, GPIO_OType_PP, GPIO_Speed_2MHz); #if HRM_FORCE_FLASH // Force the HRM into loader mode which will cause the firmware to be // reflashed on every boot. If the HRM is loaded with a broken // firmware which doesn't enter sta...
(NORMAL_BOOT_DELAY_MS)
; bool success = prv_start_loader(HRM) && prv_wait_for_loader_ready(HRM) && prv_write_register_block(HRM, ADDR_LOADER_STATUS, erase_magic_record, strlen(erase_magic_record)) && prv_w...
, { 24, 328, -616}, { 16, 368, -656}, { 16, 456, -728}, { 24, 552, -808}, { 40, 560, -808}, { 24, 632, -864}, { 32, 688, -896}, { 24, 680, -864}, { -16, 832, -928}, { 120, 992, -952}, { 144, 920, -784}, { 128, 984, -856}, { 184, 888, -824}, { 200, 616, -648}, ...
{ 216, 744, -896}, { 400, 824, -960}, { 592, 680, -848}, // 56 seconds { 496, 552, -728}, { 352, 528, -680}, { 176, 488, -576}, { 56, 464, -536}, { -8, 464, -528}, { -56, 488, -544}, { -56, 512, -608}, { -56, 600, -712}, { -56, 624, -752}, { -80, 664, -792}, {...
or gained focus, resume. prv_handle_modal_to_app_transition_hidden_and_unfocused(); } // We have modal windows and we should render them, either because they asked to or because // they recently became the top window in their respective modal stacks and haven't noticed yet. // See the handling for off scr...
if (!window->is_transparent) { // There is a visible opaque window, remove the transparent property ctx->properties &= ~ModalProperty_Transparent; }
s_call_identifier, event->call_identifier); return; } prv_call_end_common(); phone_ui_handle_call_hide(); analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_END_COUNT, AnalyticsClient_System); } static void prv_handle_call_end(bool disconnected) { if (!disconnected) { analytics_inc(ANALYTICS_DEVI...
ancs_perform_action(s_call_identifier, ActionIDPositive)
name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_3, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&link_key_3, &link_key_out, sizeof(link_key_out)); cl_assert_equal_s(name_3, name_out); cl_assert_equal_i(platform_bits_3, platform_bits_out); } void test_bluetooth_persistent_storage...
cl_assert(id != BT_BONDING_ID_INVALID)
; // Delete the Pairing bt_persistent_storage_delete_bt_classic_pairing_by_addr(&addr_in); // Try to read it back ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(!ret); // A...
aw_state.drawing_box = GRect(-SCREEN_WIDTH / 2, 0, SCREEN_WIDTH, SCREEN_HEIGHT); ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled.${BIT_DEPTH_NAME}.pbi")); } // AA section void test_graphics_gpath_${BIT...
(&ctx, true)
; prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_crossing_aa.8bit.pbi")); // Infinite path - shows an example where path seems to be crossing itself but // in fact it does not prv_reset(); s_current_path = s_infinite_path; gpath_move_to(s_infinite_path, GPoi...
itialize, &suite->cleanup); break; } case 'q': _clar.report_errors_only = 1; break; case 'Q': _clar.exit_on_error = 1; break; case 'i': { int offset = (argument[2] == '=') ? 3 : 2; if (strcasecmp("all", argument + offset) == 0) clar_category_enable_a...
(buf, 256, "%d not within [%d, %d]", n, min, max)
; clar__assert(0, file, line, err, buf, should_abort); } } void clar__assert_near( int i1, int i2, int abs_err, const char *file, int line, const char *err, int should_abort) { if (abs(i1 - i2) > abs_err) { char buf[256]; snprint_eq(buf, 256, "Difference between %d and %d exceeds %d", i1,...
mutex_lock(s_mag_mutex)
; if (s_use_refcount == 0) { mutex_unlock(s_mag_mutex); return (true); } bool success = false; // Enter standby state since we can only change sample rate in this mode. if (!prv_enter_standby_mode()) { goto done; } // See Table 25 in the data sheet for these values for the CTRL_REG1 regist...
ND if (render) { // restore original clip box ctx->draw_state.clip_box.size.h = orig_clip_height; } #endif layout->view_size.h += LAYOUT_TOP_BANNER_HEIGHT; #if PBL_ROUND // Notification text is paged by LAYOUT_HEIGHT, so make full page height layout->view_size.h = ROUND_TO_MOD_CEIL(layout->view_size...
(&layout->layout.layer, config->frame)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&success, "\xc3\xb0")
/* * 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...
kernel_free(entry)
; } status_t ram_storage_insert(RamStorage *storage, const uint8_t *key, int key_len, const uint8_t *val, int val_len) { // delete entry if it already exists RamStorageEntry *entry = prv_get_entry(storage->entries, key, key_len); if (entry) { prv_delete(&storage->entries, entry); } // Allocate the e...
.h" #include "process_management/app_manager.h" #include "process_management/worker_manager.h" #include "services/common/analytics/analytics.h" #include "services/common/analytics/analytics_metric.h" #include "services/common/analytics/analytics_storage.h" #include "system/logging.h" #include "system/passert.h" stati...
{ PBL_ASSERTN(analytics_storage_has_lock()); switch (analytics_metric_kind(metric)) { case ANALYTICS_METRIC_KIND_DEVICE: PBL_ASSERTN(client == AnalyticsClient_Ignore || client == AnalyticsClient_System); return s_device_heartbeat; case ANALYTICS_METRIC_KIND_APP: { PBL_ASSERTN(client == AnalyticsCli...
alerts_get_mask()
== AlertMaskAllOn); alerts_set_mask(AlertMaskAllOnLegacy); cl_assert(alerts_get_mask() == AlertMaskAllOn); } void test_alerts__dnd_interruptions(void) { s_dnd_active = true; alerts_set_dnd_mask(AlertMaskAllOff); alerts_set_mask(AlertMaskAllOn); cl_assert(alerts_should_notify_for_type(AlertMobile)); 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...
RTC_WriteBackupRegister(RTC_TIMEZONE_ABBR_END_TZID_DSTID, raw[1])
; RTC_WriteBackupRegister(RTC_TIMEZONE_GMTOFFSET, raw[2]); RTC_WriteBackupRegister(RTC_TIMEZONE_DST_START, raw[3]); RTC_WriteBackupRegister(RTC_TIMEZONE_DST_END, raw[4]); } void rtc_get_timezone(TimezoneInfo *tzinfo) { uint32_t *raw = (uint32_t*)tzinfo; raw[0] = RTC_ReadBackupRegister(RTC_TIMEZONE_ABBR_STA...
} } else if (shape == RECTANGLE_ROUND) { // Move rounded line X per 4*Y data->rectr.origin.x += (data->rectr_velocity_x * PIXEL_SPEED_PER_FRAME); if (data->rectr.origin.x < 0 || data->rectr.origin.x + data->rectr.size.w > data->window.layer.bounds.size.w) { data->rectr_velocity...
graphics_draw_line(ctx, data->line_p0, data->line_p1)
/* * 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 (!pb_encode_tag_for_field(stream, field)) { return false; } Uuid *uuid_p = *(Uuid **)arg; return pb_encode_string(stream, (uint8_t *)uuid_p, sizeof(Uuid)); }
bool protobuf_log_util_encode_string(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) { if (!pb_encode_tag_for_field(stream, field)) { return false; } const char *str = *(char **)arg; return pb_encode_string(stream, (uint8_t *)str, strlen(str));...
Rect *cell_layer_bounds, bool is_chosen) { const int32_t left_icon_spacing = PBL_IF_RECT_ELSE(0, 14); const GSize not_chosen_icon_bounds = gbitmap_get_bounds(&option_menu->not_chosen_image).size; const GSize chosen_icon_bounds = gbitmap_get_bounds(&option_menu->chosen_image).size; PBL_ASSERTN(gsize_equal(&not_c...
{ option_menu->callbacks.unload(option_menu, option_menu->context); }
/* * 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...
(PreferredContentSizeDefault, //! @note this is the same as Medium until Small is designed /* small */ PBL_IF_ROUND_ELSE(1, 8), /* medium */ PBL_IF_ROUND_ELSE(1, 8), /* large */ 4, //! @note this is the same as Large until ExtraLarge is designed /* extralarge */ 4)
; graphics_context_set_fill_color(ctx, fill_color); graphics_fill_oval(ctx, rect, GOvalScaleModeFitCircle); } void action_button_update_proc(Layer *action_button_layer, GContext *ctx) { action_button_draw(ctx, action_button_layer, GColorBlack); }
(BUTTON_ID_SELECT)
, quick_launch_get_app(BUTTON_ID_DOWN), quick_launch_get_app(BUTTON_ID_BACK), #endif watchface_get_default_install_id(), worker_preferences_get_default_worker(), }, }; settings_file_each(&file, prv_each_free_up_space, &evict_data); settings_file_close(&file); // r...
ows that nothing was drawn rect = GRectZero; goto call_processor_post_function_and_return; } // TODO PBL-35694: what if src_bitmap == dest_bitmap.... // This currently works only if the regions are equal, or the dest region is // to the bottom/right of it, since we scan from left to right, top to botto...
{ return; }
GRect dest_clip = ctx->draw_state.clip_box; dest_ic.x += ctx->draw_state.drawing_box.origin.x; dest_ic.y += ctx->draw_state.drawing_box.origin.y; GCompOp compositing_mode = ctx->draw_state.compositing_mode; #if PBL_BW GColor foreground, background; switch (compositing_mode) { case GCompOpAssign: ...
O_TIMEOUT); } static bool prv_check_whoami(QSPIFlash *dev) { // The WHOAMI is 3 bytes const uint32_t whoami_length = 3; uint32_t read_whoami = 0; prv_read_register(dev, dev->state->part->instructions.qspi_id, (uint8_t *)&read_whoami, whoami_length); if (read_whoami == dev->state->part->q...
{ qspi_use(dev->qspi); uint8_t status_reg; prv_read_register(dev, dev->state->part->instructions.read_status, &status_reg, 1); if (!(status_reg & dev->state->part->status_bit_masks.busy)) { // no erase in progress qspi_release(QSPI); return S_NO_ACTION_REQUIRED; } prv_write_cmd_no_addr(dev, de...
void qspi_flash_erase_resume(QSPIFlash *dev, uint32_t addr) { qspi_use(dev->qspi); prv_write_cmd_no_addr(dev, dev->state->part->instructions.erase_resume); // wait for the erase_suspend bit to be cleared qspi_poll_bit(dev->qspi, dev->state->part->instructions.read_flag_status, dev->state->part...
eed_steps_min((2.5 * MINUTES_PER_HOUR) + ACTIVITY_SESSION_UPDATE_MIN); // Fast forward time rtc_set_time(time_util_get_midnight_of(rtc_get_time()) + 4 * SECONDS_PER_DAY); } activity_prefs_sleep_insights_set_enabled(prev_insights_enabled); prv_test_end(context, passed); } // ----------------------------...
activity_test_set_steps_history()
; prv_feed_steps_min(4); // Trigger insights activity_insights_recalculate_stats(); prv_feed_steps_min(1); prv_test_end(context, passed); } // ------------------------------------------------------------------------------- static void prv_test_fill_sleep(void *context) { // Fill the sleep file bool suc...
/* * 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...
strlen(s1)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ s_addr_result = UserSpaceBuffer_Unchecked; return cl_mock_type(bool); }
void syscall_assert_userspace_buffer(const void* buf, size_t num_bytes) { uintptr_t addr = (uintptr_t)buf; uintptr_t end = addr + num_bytes - 1; if ((addr >= s_user_start) && (addr < (s_user_start + s_user_size)) && (end >= s_user_start) && (end < (s_user_start + s_user_size))) { s_addr_result = UserS...
ine(GContext *ctx, int16_t x, int16_t y1, int16_t y2, GColor color) { // y1 and y2 here will be the integer start/end of the line, so we need to adjust them so we see // the same blending on the first and last pixel y2--; const Fixed_S16_3 y1_fixed = (Fix...
cl_assert_equal_p(ctx->draw_state.draw_implementation, &g_default_draw_implementation)
; cl_assert_equal_p(ctx->draw_state.draw_mask, NULL); graphics_context_mask_destroy(ctx, mask1); graphics_context_mask_destroy(ctx, mask2); } void test_graphics_context_mask__basic_use(void) { GContext *ctx = s_ctx; // Should be safe to call use with NULL values, will return false cl_assert(!graphics_con...
/* * 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...
(characteristic)
; uuid_to_string(&characteristic_uuid, uuid_buffer); APP_LOG(APP_LOG_LEVEL_INFO, "Write response for Characteristic %s (error=%u)", uuid_buffer, error); } static void subscribe_handler(BLECharacteristic characteristic, BLESubscription subscription_type, ...
case HRMEvent_LEDCurrent: if (!(state->features & HRMFeature_LEDCurrent)) { continue; } break; case HRMEvent_HRV: if (!(state->features & HRMFeature_HRV)) { continue; } break; case HRMEvent_Diagnostics: if (!(state->features & ...
("Accel samples: %"PRIu32, data->accel_data.num_samples)
; HRM_LOG("LED %"PRIu16"uA, TIA: %"PRIu16, data->led_current_ua, data->tia); time_t utc_now = rtc_get_time(); RtcTicks cur_ticks = rtc_get_ticks(); HRMFeature kernel_bg_features_sent = 0; HRMSubscriberState *state = (HRMSubscriberState *)s_manager_state.subscribers; while (state) { HRMSubscriberState ...
440}, { -192, 832, -280}, { -160, 832, -424}, { -192, 848, -304}, { -104, 784, -200}, { 16, 936, -336}, { 48, 760, -368}, { 168, 824, -464}, { 136, 904, -520}, { 192, 832, -528}, { 144, 672, -424}, { 184, 912, -496}, { 184, 1024, -520}, { 152, 752, -360}, { 248, 6...
{ -40, 760, -616}, { -64, 792, -616}, { -40, 728, -656}, { -72, 768, -600}, { -88, 792, -600}, { -80, 776, -592}, { -72, 784, -592}, { -56, 768, -632}, { -64, 768, -624}, // 183 seconds { -56, 760, -624}, { -64, 768, -616}, { -56, 768, -608}, { -56, 760, -632}, ...
/* * 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, cell_layer, "Beer Counter")
"accel_service_private.h" #include "applib/applib_malloc.auto.h" #include "applib/pbl_std/pbl_std.h" #include "event_service_client.h" #include "kernel/kernel_applib_state.h" #include "kernel/pbl_malloc.h" #include "process_state/app_state/app_state.h" #include "process_state/worker_state/worker_state.h" #include "ser...
{ uint32_t num_samples = 0; uint64_t timestamp_ms; num_samples = sys_accel_manager_get_num_samples(state->manager_state, &timestamp_ms); if (num_samples < state->samples_per_update) { return 0; } #if LOG_DOMAIN_ACCEL uint32_t time_since_last_sample = (state->prev_timestamp_ms != 0) ? timestamp_m...
PBL_ASSERTN(success); return num_samples; } // --------------------------------------------------------------------------------------------- // Called by sys_accel_manager when we have data available for this subscriber static void prv_do_data_handle(void *context) { AccelServiceState *state = (AccelServiceSta...
"kernel/util/segment.h" #include "process_management/pebble_process_md.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/process_management/app_storage.h" #include "system/logging.h" #include "system/passert.h" #include "util/legacy_checksum.h" #include <string.h> //! This comes from the genera...
(process_name, sizeof(process_name), app_id, task)
; if ((fd = pfs_open(process_name, OP_FLAG_READ, 0, 0)) < S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Process open failed for process %s, fd = %d", process_name, fd); return (false); } if (pfs_read(fd, destination->start, load_size) != (int)load_size) { PBL_LOG(LOG_LEVEL_ERROR, "Process read failed for 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...
(list, AttributeIdTitle, i18n_get("Edit", list))
; } // ---------------------------------------------------------------------------------------------- void alarm_pin_add(time_t alarm_time, AlarmId id, AlarmType type, AlarmKind kind, Uuid *uuid_out) { const unsigned num_actions = 1; // We are just supporting "edit" for now TimelineItemActionGroup action_group = {...
/* * 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(type, PBL_PLATFORM_TYPE_CURRENT)
; } void test_pebble_process_md__uninitialized_unprivileged(void) { PebbleProcessMdFlash md = { .common.is_unprivileged = true, }; const PlatformType type = process_metadata_get_app_sdk_platform(&md.common); cl_assert_equal_i(type, PBL_PLATFORM_TYPE_CURRENT); } #if PBL_ROUND #define LEGACY_PLATFORM_PRIO...
/* * 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...
(&file, key, sizeof(key), prefs_out, prefs_len)
; settings_file_close(&file); uint32_t flags = *((uint32_t *) prefs_out); cl_assert_equal_i(flags, ~0); kernel_free(prefs_out); } void test_ios_notif_pref_db__read_flags(void) { // Make a local copy of dict since ios_notif_pref_db_insert() modifies val uint8_t val[sizeof(s_ios_pref_db_insert_dict)]; me...
gment_header); // Write all the data bytes in the segment to the HRM. uint16_t write_address = segment_header.address; uint32_t bytes_remaining = segment_header.len_minus_1 + 1; while (bytes_remaining) { uint8_t chunk[MAX_HEX_DATA_BYTES]; const size_t load_length = MIN(MAX_HEX_DATA_BYTES, by...
(LOG_LEVEL_ERROR, "Failed to set accel frequency")
; goto failed; } // Set the presence detection threshold uint8_t pres_detect_thrsh; WatchInfoColor model_color = mfg_info_get_watch_color(); switch (model_color) { case WATCH_INFO_COLOR_PEBBLE_2_HR_BLACK: case WATCH_INFO_COLOR_PEBBLE_2_HR_FLAME: pres_detect_thrsh = PRES_DETECT_THRSH_BLACK; ...
ze) { // Ensure that we're not trying to write more data than a single page (256 bytes) PBL_ASSERTN(buffer_size <= FLASH_PAGE_SIZE); PBL_ASSERTN(buffer_size); mutex_assert_held_by_curr_task(s_flash_state.mutex, true /* is_held */); // Writing a zero-length buffer is a no-op. if (buffer_size < 1) { retu...
PBL_LOG_VERBOSE("Address is not page-aligned; first write will be %"PRId32"B at address 0x%"PRIX32, first_page_available_bytes, start_addr)
; } while (bytes_to_write) { flash_write_page(buffer, start_addr, bytes_to_write); start_addr += bytes_to_write; buffer += bytes_to_write; buffer_size -= bytes_to_write; bytes_to_write = MIN(buffer_size, FLASH_PAGE_SIZE); } disable_flash_spi_clock(); power_tracking_stop(PowerSystemFlas...
, GColorBlack, false); graphics_draw_rect(&context, &GRect(10, 20, 40, 10)); #if PBL_COLOR ASSERT_CALLED(prv_draw_rect_aa_stroked(&context, &GRect(10, 20, 40, 10), SW_ODD)); #else ASSERT_CALLED(prv_draw_rect_stroked(&context, &GRect(10, 20, 40, 10), SW_ODD)); #endif setup_test(&context, true, SW_ODD, GColorBla...
(graphics_draw_circle(&context, GPoint(50, 50), 10))
; ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); setup_test(&context, false, SW_ODD, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_...
/* * 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...
(LOG_LEVEL_INFO, (const uint8_t *)keys_out, 2 * sizeof(SM128BitKey))
; #endif if (!is_existing) { bt_persistent_storage_set_root_keys(keys_out); } }
nd again cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "abc", 3, false)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 0); cl_assert(shared_circular_buffer_read(&buffer, &client1, 3, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 3); cl_assert(memcmp(ou...
(items_read, 4)
; cl_assert_equal_m(out_buffer, "0a3d6g9j", 8); cl_assert(shared_circular_buffer_write( &buffer, (uint8_t*)"0k1m2n", 3*item_size, false)); items_read = shared_circular_buffer_read_subsampled( &buffer, &client, item_size, out_buffer, 100); cl_assert_equal_i(items_read, 1); cl_assert_equal_m(out_bu...
qual_point(GPoint(2, 3), lc->path.points[1]); cl_assert_equal_point(GPoint(4, 5), lc->path.points[2]); cl_assert_equal_point(GPoint(6, 7), lc->path.points[3]); } void test_rocky_api_graphics_path2d__fill(void) { rocky_global_init(s_graphics_api); prv_create_global_ctx(); EXECUTE_SCRIPT( "ctx.moveTo(1, ...
(TRIG_MAX_ANGLE * 5 / 4, lc->draw_arc.angle_end)
; } void test_rocky_api_graphics_path2d__unsupported(void) { rocky_global_init(s_graphics_api); prv_create_global_ctx(); EXECUTE_SCRIPT_EXPECT_UNDEFINED("ctx.arcTo"); EXECUTE_SCRIPT_EXPECT_UNDEFINED("ctx.bezierCurveTo"); EXECUTE_SCRIPT_EXPECT_UNDEFINED("ctx.quadraticCurveTo"); } extern size_t s_rocky_path...
161 seconds { 1176, -96, -248}, { 1312, -104, -192}, { 1160, -112, -216}, { 1048, -128, -248}, { 960, -96, -264}, { 960, -48, -200}, { 1048, -104, -112}, { 1000, -144, -64}, { 1016, -120, -32}, { 1000, -64, -8}, { 992, -64, 0}, { 1056, -88, 48}, { 1128, -112, 56}, ...
{ 992, -8, 8}, { 1008, -24, -40}, { 1016, -40, -88}, { 1080, -72, -152}, { 1312, -136, -112}, { 1136, -128, -104}, { 976, -136, -104}, { 896, -64, -328}, // 167 seconds { 1136, 0, -360}, { 1120, -16, -304}, { 968, -88, -216}, { 968, -144, -200}, { 1024, -72, -152}...
{ 1376, 128, 0}, { 1192, 96, 24}, { 1112, 80, -24}, { 1088, 160, -64}, { 1080, 152, -64}, { 1016, 96, -80}, { 944, 64, -176}, { 872, 80, -272}, { 768, 40, -384}, { 720, 24, -408}, { 688, -16, -528}, { 728, -32, -544}, { 752, -72, -560}, { 864, -56, -472}, { 1...
* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_rect(ctx, &GRect(4, 2, 16, 8)); } static void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_draw_rect(ctx, &GRect(4, 2, 16, 8)); } static void clear_layer_update_...
GRect(0, 0, 20, 10)
); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuf...
// we are rediscovering all services so flush everything prv_free_service_nodes(connection); prv_send_services_invalidate_all_event( connection, BTErrnoServiceDiscoveryDatabaseChanged); } else { // we are rediscovering one service gatt_client_discovery_handle_service_range_change(connection, &n...
(connection)
; } unlock: bt_unlock(); return ret_val; } //! extern for gap_le_connnection.c //! Cleans up any state and frees the associated memory of all the things this module might have //! created for a given connection. //! bt_lock() is assumed to be taken by the caller void gatt_client_discovery_cleanup_by_connection(G...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_set_window_handlers(&window->window, &(WindowHandlers){ .unload = prv_window_unload, })
; return result; } static void prv_handle_init(void) { Window *window = prv_window_create(); app_window_stack_push(window, true); } static void prv_main(void) { prv_handle_init(); app_event_loop(); } const PebbleProcessMd* statusbar_demo_get_app_info(void) { static const PebbleProcessMdSystem s_app_info...
// SW = 4 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 4); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 2)
; graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // AA = true, SW = 3 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 3); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLI...
(prv_get_state(), ANCSClientStateAliveCheck)
; cl_assert_equal_i(s_num_requested_notif_attributes, 1); // simulate a disconnection/reconnection ancs_handle_service_removed(s_characteristics, NumANCSCharacteristic); ancs_handle_service_discovered(s_characteristics); // we should be back in the Idle state cl_assert_equal_i(prv_get_state(), ANCSClientSta...
AnimationUpdateImplementation) property_animation_update_gtransform, }, .accessors = { .setter = { .int16 = (const Int16Setter) prv_gtransform_setter, }, .getter = { .int16 = (const Int16Getter) prv_gtransform_getter }, }, }; start_value = GTransformFromNumbers(1, 2, 3, 4, 5, 6); end_valu...
(value, start_value)
; // Halfway through prv_advance_to_ms_with_timers(start_ms + duration/2); cl_assert_close_fixed_s32_16(value, mid_value); // End prv_advance_to_ms_with_timers(start_ms + duration + MIN_FRAME_INTERVAL_MS*2); cl_assert_equal_fixed_s32_16(value, end_value); #endif } // -----------------------------------...
, TimelineItemTypePin, LayoutIdSports, &list, NULL); pin_db_insert_item_without_event(item); timeline_item_destroy(item); attribute_list_destroy_list(&list); } static void prv_add_calendar_pin...
attribute_list_add_uint8(&list, AttributeIdHealthInsightType, ActivityInsightType_ActivitySessionRun)
; attribute_list_add_cstring(&list, AttributeIdTitle, "3.3 Mile run"); attribute_list_add_cstring(&list, AttributeIdSubtitle, "30M of activity"); attribute_list_add_uint32(&list, AttributeIdLastUpdated, now); uint8_t buffer[Uint32ListSize(ActivitySessionMetricCount)]; Uint32List *icons = (Uint32List *)buffer...
pin) { PeekLayer *peek_layer = &data->peek_layer; #if ANIMATION_DOT peek_layer_set_icon(peek_layer, timeline_res); #elif ANIMATION_SLIDE GRect icon_from; GRect icon_to; const bool shift_offscreen_from = true; const bool shift_offscreen_to = false; prv_get_icon_animation_frame(data, &icon_from, use_pin, sh...
((Layer *)&data->peek_layer, true)
; #if ANIMATION_DOT timeline_layer_set_day_sep_frame(&data->timeline_layer, &data->timeline_layer.layer.frame); #elif ANIMATION_SLIDE GRect frame; layer_get_frame(&data->timeline_layer.day_separator.layer, &frame); const bool is_future = (s_app_data->timeline_model.direction == TimelineIterDirectionFutu...
data; PebbleEvent e = { .type = PEBBLE_BUTTON_DOWN_EVENT, .button.button_id = button }; event_put(&e); e = (PebbleEvent) { .type = PEBBLE_BUTTON_UP_EVENT, .button.button_id = button }; event_put(&e); } void command_button_press_short(const char* button_index) { uintptr_t button = (uintptr...
{ prompt_send_response_fmt(status, sizeof(status), "Validated: 0x%lx", addr); flash_erase_sector_blocking(addr); flash_erase_sector_blocking(addr); // exercise already erased check }
flash_write_bytes(&buf[0], addr, sizeof(buf)); flash_expect_program_failure(false); watchdog_feed(); } } task_watchdog_bit_set(pebble_task_get_current()); __enable_irq(); } #endif static TimerID s_abusive_timer = TIMER_INVALID_ID; struct WasteTimerData { uint16_t count; uint16_t de...
at exercise the sanity checking of the input from the app //////////////////////////////////////////////////////////////////////////////////////////////////// void test_app_message_sender__outbox_data_too_short(void) { // This is one byte too small, because the PP payload has to be at least one in length: AppMessa...
assert_consumed(AppMessageSenderErrorDisconnected, 1)