prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
"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 "AS IS" BASIS, ...
(expected_commands)
; prv_assert_callback_called( s_command_list_index? S_SUCCESS : S_NO_ACTION_REQUIRED); } // Tests /////////////////////////////////////////////////////////// void test_flash_erase__initialize(void) { s_command_list_index = 0; s_callback_called_count = 0; s_callback_status = 42; s_simulate_work_queue_f...
/* * 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...
(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_transcription_example[0] = 1; s_test_transcription_example[2] = 3; // invalidate word count of the first sentence result = transcri...
d 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 License. */ #include "comm/ble/kernel_le_client/ams...
("1.654321", 33, true, 55)
; } void test_ams_util__float_string_negative_multiplier(void) { // "1.987622" * -33 is approx -65.591526, round to -66 assert_float_parse("1.987622", -33, true, -66); } void test_ams_util__float_string_parse_overflow_positive(void) { // fails: // "2147483648" * 1 assert_float_parse("2147483648", 1, false, ...
/* * 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_get_current_resource_num()
, (uint32_t)h, 0, buffer, max_length); } size_t applib_resource_load_byte_range( ResHandle h, uint32_t start_offset, uint8_t *buffer, size_t num_bytes) { return sys_resource_load_range(sys_get_current_resource_num(), (uint32_t)h, start_offset, buf...
tivityMetricStepCount, 1, &before); // Walk for about 30 minutes const int k_num_minutes = 30; // The sample we feed in feeds about 90 steps/min const int k_steps_per_minute = 90; // Feed in the data prv_feed_steps_min(k_num_minutes); // Check new step count int32_t steps; steps = health_service_s...
prv_test_end(context, passed)
; } // ------------------------------------------------------------------------------- // Test that we don't crash or get a weird sleep session if the UTC time changes while // sleeping static void prv_test_sleep_time_change(void *context) { bool passed = true; // Reset all stored data activity_test_reset(true...
, so the best we can do is to attribute to both of them if (worker_manager_get_current_worker_md() != NULL) { analytics_set(ANALYTICS_APP_METRIC_FLASH_READ_COUNT, analytics_read_count, AnalyticsClient_Worker); analytics_set(ANALYTICS_APP_METRIC_FLASH_READ_BYTES_COUNT, analytics_read_bytes_count, AnalyticsClie...
assert_usable_state()
; if (!s_flash_state.deep_sleep) { flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_DEEP_SLEEP); flash_end_cmd(); // guarantee we have actually transitioned to deep sleep delay_us(5); s_flash_state.deep_sleep = true; } } static void flash_deep_sleep_exit(void) { assert_usable_st...
{ 992, 240, -248}, { 1008, 328, -88}, { 1296, 296, -16}, { 1792, 360, 120}, { -1336, 368, 360}, { -256, 1016, 224}, { -1192, 1464, -776}, { 1576, 720, -456}, { -1568, -16, -88}, { 1760, 784, -440}, { 1264, 1896, -1112}, { 1080, 1120, -1144}, { 744, 528, -712}, { 1...
{ 1840, 712, 32}, { -2032, 544, 48}, { 1912, 368, 24}, { 1872, 240, 88}, { 1760, 160, 32}, { 1560, 192, -304}, { 1400, 136, -600}, { 1000, -496, -112}, { 544, -488, -72}, { 536, -128, -584}, { 1032, -40, -320}, { 1320, 160, -104}, { 1472, 288, -128}, { 1608, 312,...
fication); } static void prv_send_notification(const uint8_t *ancs_notification_dict) { prv_send_notification_with_event_flags(ancs_notification_dict, 0); } static uint8_t *prv_serialize_timeline_item(TimelineItem *item, size_t *size_out) { size_t payload_size = timeline_item_get_serialized_payload_size(item); ...
(s_message_app_info_dict)
, (uint8_t *)s_message_app_info_dict); } return BTErrnoOK; } // else: notif request uint32_t uid = ((GetNotificationAttributesMsg *)buffer)->notification_uid; s_num_requested_notif_attributes++; if (uid == comple_dict_uid) { prv_fake_receiving_ds_notifica...
/* * 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...
(sizeof(TextLayerLegacy2))
; if (layer) { text_layer_legacy2_init(layer, &frame); } return layer; } void text_layer_legacy2_destroy(TextLayerLegacy2* text_layer) { if (!text_layer) { return; } text_layer_legacy2_deinit(text_layer); task_free(text_layer); } void text_layer_legacy2_deinit(TextLayerLegacy2 *text_layer) { i...
peratureSensor const TEMPERATURE_SENSOR_DEVICE = { .voltage_monitor = &VOLTAGE_MONITOR_TEMPERATURE_DEVICE, .millivolts_ref = 760, .millidegrees_ref = 25000, .slope_numerator = 5, .slope_denominator = 2000, }; TemperatureSensor * const TEMPERATURE_SENSOR = &TEMPERATURE_SENSOR_DEVICE; // // SPI Bus configura...
voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY)
; qspi_init(QSPI, BOARD_NOR_FLASH_SIZE); }
{ return true; }
static void prv_handle_touch_event (Recognizer *recognizer, const TouchEvent *touch_event) { } static bool prv_cancel(Recognizer *recognizer) { return false; } static void prv_reset (Recognizer *recognizer) { } static RecognizerImpl s_dummy_impl; static void prv_clear_recognizers_processed(ListNode **list) { ...
* you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT W...
pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "Test")
e License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distri...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); }
/* * 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_b(ble_ibeacon_compose(&ibeacon, new_ibeacon_ad_data), true)
; const size_t ad_data_size = apple_ibeacon_ad_data->ad_data_length + apple_ibeacon_ad_data->scan_resp_data_length; cl_assert_equal_i(new_ibeacon_ad_data->ad_data_length, apple_ibeacon_ad_data->ad_data_length); cl_assert_equal_i(new_ibeacon_ad_data->scan_resp_dat...
ifications)) typedef struct SwapLayerDemoData { Window window; StatusBarLayer status_layer; SwapLayer swap_layer; LayoutLayer *layout_layers[NUM_NOTIFS]; uint32_t idx; } SwapLayerDemoData; static LayoutLayer *prv_get_layout_handler(SwapLayer *swap_layer, int8_t rel_position, ...
(window, WINDOW_NAME("Swap Layer"))
; window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); for (int i = 0; i < NUM_NOTIFS; i++) { TestNotification notif = notifications[i]; AttributeList attr_list = {0}; if (notif.bg_color != GColorClearARGB8) { attribute_...
/* * 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...
menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks){ .draw_row = prv_draw_row, .get_num_rows = prv_get_num_rows, })
; cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(0, l.selection.y); cl_assert_equal_i(0, scroll_layer_get_content_offset(&l.scroll_layer).y); menu_layer_set_selected_index(&l, MenuIndex(0, 1), MenuRowAlignTop, false); cl_assert_equal_i(1, menu_layer_get_selected_index(&l).row)...
{ TimelineAppData *data = context; // reset the timeline layer data->timeline_layer.layer.bounds.origin.x = 0; window_set_background_color(&data->timeline_window, GColorWhite); if (!finished) { return; } TimelineLayout *timeline_layout = timeline_layer_get_current_layout(&data->timeline_layer); i...
(data, false /* open */)
; data->current_animation = sidebar_slide; animation_schedule(sidebar_slide); } } static void prv_back_click_handler(ClickRecognizerRef recognizer, void *context) { TimelineAppData *data = context; prv_exit(data); } static void prv_up_down_stopped(Animation *animation, bool finished, void *context) { ...
orizontal_inset; int16_t title_subtitle_left_margin; } MenuCellDimensions; static const MenuCellDimensions s_menu_cell_dimensions[NumPreferredContentSizes] = { //! @note these are the same as Medium until Small is designed [PreferredContentSizeSmall] = { .basic_cell_height = 44, .small_cell_height = 34, ...
{ static const GSize s_icon_size = { 33, 44 }; if (icon_align == GAlignRight) { box.origin.x += bounds->size.w - (horizontal_margin + config->icon->bounds.size.w); } else { // icon on left box.origin.x += ((config->icon->bounds.size.w & 1) + // Nudge odd-width icons one right ...
ts; time_t frontend_last_opened_ts; HRMSessionRef hrm_session; CurrentWorkoutData *current_workout; } WorkoutServiceData; static WorkoutServiceData s_workout_data; static void prv_lock(void) { mutex_lock_recursive(s_workout_data.s_workout_mutex); } static void prv_unlock(void) { mutex_unlock_recursive(s_w...
workout_service_is_paused()
context */ static bool prv_shared_buffer_empty(void) { bool empty = true; mutex_lock_recursive(s_accel_manager_mutex); { AccelManagerState *state = (AccelManagerState *)s_data_subscribers; while (state) { int left = shared_circular_buffer_get_read_space_remaining( &s_buffer, &state->buf...
{ int num = atoi(num_samples); mutex_lock_recursive(s_accel_manager_mutex); accel_set_num_samples(num); mutex_unlock_recursive(s_accel_manager_mutex); }
#if UNITTEST /* * Helper routines strictly for unit tests */ void test_accel_manager_get_subsample_info(AccelManagerState *state, uint16_t *num, uint16_t *den, uint16_t *samps_per_update) { *num = state->buffer_client.numerator; *den = state->buffer_client.denominator...
andled; } uint8_t offset = att_hdl - EMULATED_PPOGATT_SERVICE_HDL; switch (offset) { case EMULATED_META_CHAR_OFFSET: return prv_handle_emulated_meta_read(msg); case EMULATED_DATA_CHAR_OFFSET: return prv_handle_emulated_write(conn_idx, msg); case EMULATED_DATA_CCCD_OFFSET: { PPoGATTW...
( PEBBLE_BT_PPOGATT_WATCH_SERVER_DATA_WR_CHARACTERISTIC_UUID_32BIT)
}, &uuid); PBL_ASSERTN(ble_gatts_add_characteristic(&uuid, GATT_PROP_WRITE_NO_RESP, ATT_PERM_WRITE, data_wr_size, enable_read_cb_flag, NULL, &ctx->att_hdl.data_wr) == BLE_STATUS_OK); PB...
#endif void process_manager_launch_process(const ProcessLaunchConfig *config) { PBL_ASSERT_TASK(PebbleTask_KernelMain); const AppInstallId id = config->id; const bool is_worker = config->worker; if (id == INSTALL_ID_INVALID) { PBL_LOG(LOG_LEVEL_DEBUG, "Invalid ID"); return; } const PebbleProces...
(ANALYTICS_DEVICE_METRIC_APP_CRASHED_COUNT, AnalyticsClient_System)
; } if (task == PebbleTask_App) { analytics_stopwatch_stop(ANALYTICS_APP_METRIC_FRONT_MOST_TIME); } analytics_external_collect_app_cpu_stats(); analytics_external_collect_app_flash_read_stats(); } // --------------------------------------------------------------------------------------------- //! This m...
imers); cl_assert(stub_new_timer_fire(get_reminder_timer_id())); stub_pebble_tasks_set_current(PebbleTask_KernelBackground); fake_system_task_callbacks_invoke(1); cl_assert_equal_i(num_events_put, 2); cl_assert_equal_m(&item2.header.id, stub_new_timer_callback_data(get_reminder_timer_id()), sizeof(TimelineIt...
(PebbleTask_NewTimers)
; cl_assert(stub_new_timer_fire(get_reminder_timer_id())); stub_pebble_tasks_set_current(PebbleTask_KernelBackground); fake_system_task_callbacks_invoke(1); cl_assert_equal_i(stub_new_timer_timeout(get_reminder_timer_id()), (2 * 60 + 30) * 60 * 1000); cl_assert(uuid_equal(&s_all_day_reminder.header.id, (...
}, { "'%R')", 3607, true, "1:00", 8, }, { "'%R')", -3666, true, "-1:01", 7, }, // Advanced %T tests { "'%0T')", 3666, true, "01:01:06", 1, }, { "'%uT')", 3666, true, "1 hour, 1 minute, and 6 seconds", 1, }, { "'%aT')", 3666, true, "1 hr 1 min 6 sec", 1, }, ...
{ printf("%s\n", s_error_strings[s_error.status]); }
#endif cl_assert_equal_i(s_error.status, test->expect_status); cl_assert_equal_i(err_index, test->expect_index); } cl_assert_equal_s(s_output, test->expect_str); cl_assert_equal_i(s_cond.eval_time, test->expect_eval_time); #if DEBUG_PRINTING printf("\n"); #endif } } ///////////////////...
/* * 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...
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE)
; RCC_RTCCLKCmd(ENABLE); RTC_WaitForSynchro(); return true; } // Before entering standby we set the RTC to it's default time (Jan 1, 2000) // here we calculate the seconds elapsed since then static int32_t prv_seconds_since_standby(void) { // This function assumes the RTC is running in slow mode RTC_TimeTyp...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
APP_LOG(APP_LOG_LEVEL_INFO, "worker: Got health event update. event_id: %"PRIu32"", (uint32_t) event)
; if (event == HealthEventMovementUpdate) { HealthValue steps = health_service_sum_today(HealthMetricStepCount); APP_LOG(APP_LOG_LEVEL_INFO, "worker: movement event, steps: %"PRIu32"", (uint32_t)steps); } else if (event == HealthEventSleepUpdate) { HealthValue total_sleep = health_service_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...
for (node = s_mock_list_head.next; node != &s_mock_list_head; node = next) { next = node->next; free(node); }
clar_mock_reset(); } // Who tests the test framework! #if 0 int gack(void) { return cl_mock_type(int); } int main(int argc, const char *argv[]) { cl_will_return(gack, 573); printf("gack() = %d\n", gack()); // 573 cl_will_return(gack, 123); cl_will_return(gack, 456); cl_will_return(gack, 789); printf(...
/* * 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 (failed) { node = *list; printf(" != { "); for (uint32_t i = 0; i < count; i++) { printf("%d, ", ((RecognizerHandled *)node)->idx); node = list_get_next(node); } printf("}"); }
printf("\n"); cl_assert(!failed); prv_clear_recognizers_processed(list); } static void prv_sub_event_handler(const Recognizer *recognizer, RecognizerEvent event) { } // setup and teardown void test_recognizer_manager__initialize(void) { s_test_impl_data = (TestImplData){}; s_app_list = NULL; s_active_l...
/* * 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...
text_layer_set_text(&data->text_layer, "Press Buttons")
user presses the up button. //! This animation has two parts: //! 1) The "text to cell edge" //! 2) The "background settle" //! The "text to cell edge" (bump_text) moves the text until it hits the top / bottom of the cell. //! The "background settle" (bump_settle) is a reaction to the "text to cell edge" animation. /...
(selection_layer->value_change_animation)
; #else prv_update_cell_value(selection_layer, selection_layer->bump_is_upwards); #endif } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Slide Animation //! This animation moves the "selection box" (active color) to the next cell to the right. //! This anima...
/* * 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...
(font_key, bitham_alias, bitham_alias_len)
) { char new_font_key[bitham_prefix_len - bitham_alias_len + strlen(font_key) + 1]; strncpy(new_font_key, bitham_prefix, bitham_prefix_len); strcpy(new_font_key+bitham_prefix_len, font_key+bitham_alias_len); // let's try again res = sys_font_get_system_font(new_font_key); } if (NULL == res) { ...
_event_queue != NULL); xQueueAddToSet(s_kernel_event_queue, s_system_event_queue_set); xQueueAddToSet(s_from_app_event_queue, s_system_event_queue_set); xQueueAddToSet(s_from_worker_event_queue, s_system_event_queue_set); } //! Get the from_process queue for a specific task QueueHandle_t event_get_to_kernel_que...
prv_event_put(queue, "from app", saved_lr, event)
; } bool event_try_put_from_process(PebbleTask task, PebbleEvent* event) { QueueHandle_t queue = event_get_to_kernel_queue(task); return prv_try_event_put(queue, event); } bool event_take_timeout(PebbleEvent* event, int timeout_ms) { PBL_ASSERTN(s_system_event_queue_set); s_current_event = 0; // We must 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...
{ CommSession *session = s_transport.session; PBL_ASSERTN(session); size_t bytes_remaining = comm_session_send_queue_get_length(session); if (bytes_remaining == 0) { return; } const size_t temp_buffer_size = MIN(bytes_remaining, QEMU_MAX_DATA_LEN); uint8_t *temp_buffer = kernel_malloc_check(temp_buff...
// ----------------------------------------------------------------------------------------- // bt_lock() is held by caller static void prv_reset(Transport *transport) { PBL_LOG(LOG_LEVEL_INFO, "Unimplemented"); } static void prv_granted_kernel_main_cb(void *ctx) { ResponsivenessGrantedHandler granted_handler = ...
(&data->track_pos, &data->track_length)
; #if CAPABILITY_HAS_VIBE_SCORES data->score = vibe_score_create_with_resource(RESOURCE_ID_VIBE_SCORE_HAPTIC_FEEDBACK); #endif prv_update_now_playing(data); prv_update_layout(data); prv_update_track_progress(data); prv_update_ui_state(data, false); } static void prv_push_window(MusicAppData *data) { Wind...
ent */ if (notif & BLE_APP_NOTIFY_MASK) { ble_evt_hdr_t *hdr; hdr = ble_get_event(false); if (!hdr) { goto no_event; } if (ble_service_handle_event(hdr)) { goto handled; } switch (hdr->evt_code) { // GAP Events: case BLE_EVT_GAP_CONNECTE...
OS_FREE(hdr)
; no_event: // notify again if there are more events to process in queue if (ble_has_event()) { xTaskNotify(OS_GET_CURRENT_TASK(), BLE_APP_NOTIFY_MASK, eSetBits); } } } } void ble_task_init(const BTDriverConfig *config) { const BleTaskInitInfo init_info = { .semph = xSemaphor...
/* * 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...
(&pin_attr_list)
; attribute_list_destroy_list(&edit_attr_list); task_free(action_group.actions); if (uuid_out) { *uuid_out = item->header.id; } timeline_item_destroy(item); } // ---------------------------------------------------------------------------------------------- void alarm_pin_remove(Uuid *alarm_id) { pin_...
// also see prv_blend_horizontal_line_raw const int16_t x1_rounded = (x1.raw_value + FIXED_S16_3_HALF.raw_value) / FIXED_S16_3_FACTOR; const int16_t x2_rounded = (x2.raw_value + FIXED_S16_3_HALF.raw_value) / FIXED_S16_3_FACTOR; prv_assign_row_with_pattern_1bit(framebuffer, y, x1_rounded, x2_rounded - x1_rounded ...
(framebuffer, i)
; if (!WITHIN(x, data_row_info.min_x, data_row_info.max_x)) { continue; } GColor *output = (GColor *)(data_row_info.data + x); const unsigned int data_row_offset = data_row_info.data - (uint8_t *)framebuffer->addr; prv_set_color(ctx, output, data_row_offset, x, 1, gcolor_alpha_blend(color, *ou...
/* * 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...
(pwm->timer.peripheral, pwm->timer.config_clock)
; } else { periph_config_disable(pwm->timer.peripheral, pwm->timer.config_clock); gpio_output_init(&pwm->output, GPIO_OType_PP, GPIO_Speed_100MHz); gpio_output_set(&pwm->output, false /* force low */); } const FunctionalState state = (enable) ? ENABLE : DISABLE; TIM_Cmd(pwm->timer.peripheral, state...
for (int idx = 0; idx < WEATHER_DATA_SHARED_WEATHER_DB_NUM_DB_ENTRIES; idx++) { prefs->locations[idx] = s_keys[idx]; } return prefs; } static WeatherDBEntry *prv_create_entry(const WeatherDBEntry *base_entry, char *location, char *phrase, size_t *size_out) { PascalS...
(to_check->tomorrow_high_temp, original->tomorrow_high_temp)
; cl_assert_equal_i(to_check->tomorrow_low_temp, original->tomorrow_low_temp); cl_assert_equal_i(to_check->last_update_time_utc, original->last_update_time_utc); PascalString16List pstring16_list; pstring_project_list_on_serialized_array(&pstring16_list, &to_check->pstring16s); cl_assert_equal_i(pstring16_li...
ct), dest_row_info.max_x + 1); if (dest_end_x < dest_begin_x) { continue; } const GBitmapDataRowInfo src_row_info = gbitmap_get_data_row_info(src_bitmap, src_y); const uint8_t *src = src_row_info.data; // This is the initial position that takes into account destination delta shift const i...
if (dest_end_x < dest_begin_x) { continue; }
const GBitmapDataRowInfo src_row_info = gbitmap_get_data_row_info(src_bitmap, src_y); const uint8_t *src = src_row_info.data; // This is the initial position that takes into account destination delta shift const int16_t src_initial_x = src_bitmap->bounds.origin.x + dest_delta_begin_x; ...
ndow_get_root_layer(window); GRect root_bounds = layer_get_bounds(window_layer); data->sleep_card.text_layer = text_layer_create(root_bounds); text_layer_set_text_alignment(data->sleep_card.text_layer, GTextAlignmentCenter); text_layer_set_background_color(data->sleep_card.text_layer, GColorClear); text_laye...
(data->steps_card.delta_step_text, sizeof(data->steps_card.delta_step_text), "%d", (int) (data->cur_steps - data->lap_steps))
; text_layer_set_text(data->steps_card.delta_step_layer, data->steps_card.delta_step_text); } } } // ------------------------------------------------------------------------------- static void prv_health_event_handler(HealthEventType event, void *context) { HealthAPI...
EVICE = { .state = &s_qemu_uart_state, // GPIO? Where we're going, we don't need GPIO. (connected to QEMU) .periph = USART2, .irq_channel = USART2_IRQn, .irq_priority = 13, .rcc_apb_periph = RCC_APB1Periph_USART2 }; UARTDevice * const QEMU_UART = &QEMU_UART_DEVICE; IRQ_MAP(USART2, uart_irq_handler, QEMU_UAR...
(VOLTAGE_MONITOR_BATTERY)
; }
timeline_item_find_dismiss_action(&item)
, &action_list[1]); action_list[1].type = TimelineItemActionTypeAncsNegative; cl_assert_equal_p(timeline_item_find_dismiss_action(&item), &action_list[1]); item.header.id = UUID_INVALID; cl_assert_equal_p(timeline_item_find_dismiss_action(&item), NULL); free(action_list); } void test_timeline_item__find_re...
{ register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; handle_passert_failed((const char*) file, line, saved_lr, "STM32", "STM32 peripheral library tripped an assert"); }
extern void command_dump_malloc_kernel(void); void croak_oom(const char *filename, int line_number, const char *fmt, ...) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; #ifdef MALLOC_INSTRUMENTATION command_dump_malloc_kernel(); #endif va_list fmt_args; va_start(fmt_args, fmt); handle_p...
{ prv_post_function_called_even_if_pre_function_causes_nothing_to_be_drawn_test( post_function_called_even_if_pre_function_specifies_null_bitmap__pre); }
; static void post_function_called_even_if_pre_function_specifies_empty_rect__pre( GBitmapProcessor *processor, GContext *ctx, const GBitmap **bitmap_to_use, GRect *global_grect_to_use) { PostFunctionCalledEvenIfPreFunctionCausesNothingToBeDrawnTestProcessor *processor_with_data = (PostFunctionCalledEvenIfPr...
ge_and_daily_history(state, metric, time_start, time_end, &time_range, &daily_history); if (accessible != HealthServiceAccessibilityMaskAvailable) { return accessible; } for (size_t i = 0; i < time_range.num_days; i++) { if (daily_history.totals[time_range.last_day_idx...
// We don't allow the user to gather data from raw HR samples. Only return the current and // return. If time_start and time_end were not for the current time, they are filtered out // by the function above `prv_metric_aggregation_implemented`. int32_t raw_bpm; sys_activity_get_metric(ActivityMetric...
error == ANCS_INVALID_PARAM) { if (s_ancs_client->state == ANCSClientStateAliveCheck) { // We got a response so cancel the response wait timer and setup another check. prv_ancs_is_alive(); } // We asked for a non-existent notification, go to the next one prv_reset_and_next(); return; ...
(s_ancs_client)
; s_ancs_client = NULL; prv_put_ancs_disconnected_event(); } // ------------------------------------------------------------------------------------------------- // Analytics void analytics_external_collect_ancs_info(void) { // Keep track of bits that are used by this version of ANCS, we log this to analytics 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...
{ // Allocate mutable types Iterator word_iter = (Iterator) { 0 }; WordIterState word_iter_state = (WordIterState) { 0 }; // Allocate immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, (char[]) { 0x10, 0x0 }); cl_assert(success); const TextBoxParams text_box...
void test_word_iterator__test_string_single_word(void) { // Allocate mutable types Iterator word_iter = (Iterator) { 0 }; WordIterState word_iter_state = (WordIterState) { 0 }; // Allocate immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "Animal\x02style");...
ivityGetMinuteHistoryContext *context = (ActivityGetMinuteHistoryContext *)context_param; // Get the minute history if (s_activity_state.started) { context->success = activity_algorithm_get_minute_history(context->minute_data, context->num_records, ...
{ if (enable && !s_activity_state.sample_collection_enabled) { ActivitySampleCollectionData *data = kernel_zalloc_check( sizeof(ActivitySampleCollectionData)); s_activity_state.sample_collection_data = data; data->first_record = true; s_activit...
mutex_unlock_recursive(s_activity_state.mutex); return success; } // ------------------------------------------------------------------------------------------------ // Get info on the sleep file typedef struct { bool success; bool completed; } ActivityDumpSleepLogContext; static void prv_dump_sleep_log_sys...
ert(active == true); // Both ON rtc_set_time(s_thursday_13_00); do_not_disturb_handle_clock_change(); // Out of scheduled period active = do_not_disturb_is_active(); cl_assert(active == false); // Both should be turned off cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == true); cl_assert(do...
do_not_disturb_handle_clock_change()
rgin(bool has_status_bar, int icon_height, int window_height) { const uint16_t status_layer_offset = has_status_bar ? 6 : 0; #if PLATFORM_ROBERT || PLATFORM_CALCULUS const uint16_t icon_top_default_margin_px = 42 + status_layer_offset; #else const uint16_t icon_top_default_margin_px = 18 + status_layer_offset; #e...
{ SimpleDialog *simple_dialog = context; if (!simple_dialog->buttons_disabled) { dialog_pop(&simple_dialog->dialog); } }
static void prv_config_provider(void *context) { // Simple dialogs are dimissed when any button is pushed. window_single_click_subscribe(BUTTON_ID_SELECT, prv_click_handler); window_single_click_subscribe(BUTTON_ID_UP, prv_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, prv_click_handler); } Di...
onst GPoint real_offset = GPoint( max_offset.x - ((normalized_distance * max_offset.x) / ANIMATION_NORMALIZED_MAX), max_offset.y - ((normalized_distance * max_offset.y) / ANIMATION_NORMALIZED_MAX)); return real_offset; } static GPoint prv_get_button_press_offset(ActionBarLayer *action_bar, uint8_t button...
graphics_context_set_compositing_mode(ctx, GCompOpAssign)
; } else { graphics_context_set_compositing_mode(ctx, GCompOpSet); } graphics_draw_bitmap_in_rect(ctx, (GBitmap*)icon, &icon_rect); } } } void action_bar_layer_init(ActionBarLayer *action_bar) { *action_bar = (ActionBarLayer){}; layer_set_clips(&action_bar->layer, true); action_ba...
/* * 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...
gpio_af_init(&rx_cfg, GPIO_OType_PP, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL)
; // configure the UART peripheral control registers and baud rate // - 8-bit word length // - no parity // - RX / TX enabled // - 1 stop bit // - no flow control const int k_div_precision = 100; RCC_ClocksTypeDef clocks; RCC_GetClocksFreq(&clocks); // calculate the baud rate value const uint6...
icateCondition_L; wait_time = state->filter_state - predicate_value; } if (!previously_matched && match && ((predicate_cond == cond_to_expire) || (predicate_cond == cond_to_expire + 1))) { // This predicate could expire over time. // If the conditional is equal, ...
{ state->position++; if (*state->position == ')') { state->error->status = TemplateStringErrorStatus_MissingArgument; return; } }
} if (!did_output) { // If no output was generated, it's an error. state->error->status = TemplateStringErrorStatus_CantResolve; } // format() must be the last filter, and ends the sequence. state->filters_complete = true; } static void prv_filter_time_until(TemplateStringState *state) { char *e...
cl_assert_equal_i(-53, sports_id)
; // load system resources load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, true); resource_init(); // simulate installing bg_counter on flash app_db_insert((uint8_t *)&bg_cou...
&s_font_cache, 0x4E50 /* 乐 */, &s_font_info); // the chinese pbpack contains the letter 你, it should succeed cl_assert(glyph != NULL); glyph_size_bytes = glyph_get_size_bytes(glyph); cl_assert_equal_m(chinese_glyph_data_bytes, glyph->data, glyph_size_bytes); glyph = text_resources_get_glyph(&s_font_cache, 0x...
(HAS_FEATURE(font_info_compressed.base.md.version, VERSION_FIELD_FEATURE_RLE4))
; // For each glyph in the font, get both the compressed and uncompressed bit field & header, and // assert that they are identical (ignoring any possible garbage after the bitmap). // Load the uncompressed glyph into this local glyph_buffer, and use the font cache for the // compressed glyph. uint8_t glyph_...
ivitySleepState s_sleep_state = ActivitySleepStateAwake; static uint16_t s_sleep_state_seconds = 0; static uint16_t s_last_vmc = 0; bool activity_tracking_on(void) { return true; } bool activity_get_metric(ActivityMetric metric, uint32_t history_len, int32_t *history) { cl_assert_equal_i(history_len, 1); if (me...
(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_EVERYDAY, .is_smart = true })
; prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule); cl_assert_equal_i(s_num_timeline_adds, 3); cl_assert_equal_i(s_num_timeline_removes, 0); s_sleep_state = ActivitySleepStateRestfulSleep; s_sleep_state_seconds = 0; s_last_vmc = 0; prv_set_time(s_current_day, 10, 0); ...
andlerOffsetMulti; break; case 'l': offset = ClickHandlerOffsetLong; break; case 'r': offset = ClickHandlerOffsetLongRelease; break; case 'u': offset = ClickHandlerOffsetRawUp; break; case 'd': offset = ClickHandlerOffsetRawDown; break; default: ...
(recognizer)
; } void click_manager_init(ClickManager* click_manager) { for (unsigned int button_id = 0; button_id < ARRAY_LENGTH(click_manager->recognizers); ++button_id) { ClickRecognizer *recognizer = &click_manager->recognizers[button_id]; recognizer->button = button_id; prv_click_reset(recognizer); } } ...
extern bool ppogatt_emulated_server_wa_enabled(uint16_t conn_idx); static void prv_get_connectivity_status(uint16_t conn_idx, PebblePairingServiceConnectivityStatus *status_out) { const bool is_encrypted = prv_is_encrypted(conn_idx); const bool is_bonded = prv_is_bonded(conn...
{ notifications_enabled = connection_is_subscribed_to_connection_status_notifications(connection); }
else if (handle == s_pps_ctx.att_hdl.gatt_mtu_cccd) { notifications_enabled = connection_is_subscribed_to_gatt_mtu_notifications(connection); } const uint16_t cccd_value = notifications_enabled ? GATT_CCC_NOTIFICATIONS : 0; memcpy(response_buffer, &cccd_value, sizeof(cccd_value)); return sizeof(cccd_value)...
= 30 * SECONDS_PER_MINUTE, \ .trigger_notif_activity = 20, \ .trigger_notif_active_minutes = 5 \ } \ } \ } #define ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD_DEFAULT { \ .version = ACTIVITY_INSIGHTS_SETTINGS_CURRENT_STRUCT_VERSION, \ .enabled = false, \ .reward = {\ .min_days_data = 6, \ ...
(&file, ACTIVITY_INSIGHTS_SETTINGS_VERSION_KEY, strlen(ACTIVITY_INSIGHTS_SETTINGS_VERSION_KEY), &version, sizeof(uint16_t))
; prv_close_settings_and_unlock(&file); } return version; } bool activity_insights_settings_read(const char *insight_name, ActivityInsightSettings *settings_out) { bool rv = false; *settings_out = (ActivityInsightSettings) {}; SettingsFile file; if (prv_open_settin...
LYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_DISCOVERED_COUNT, AnalyticsClient_System); // Pause while re-subscribing, it will be resumed when re-subscribed: prv_ancs_is_alive_stop_timer(); if (s_ancs_client->characteristics[0] != BLE_CHARACTERISTIC_INVALID) { PBL_LOG(LOG_LEVEL_WARNING, "Multiple ANCS services re...
prv_notif_queue_push_attr_request(nsnotification->uid, properties)
; break; case EventIDNotificationRemoved: BLE_LOG_DEBUG("Removed ANCS notification"); ancs_notifications_handle_notification_removed(nsnotification->uid, properties); break; } } static void prv_handle_ds_notification(uint32_t length, const uint8_t *data) { PBL_ASSERTN(data != NULL); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&data->logo_layer)
; // Execute conditional only if the user presses back while the splash screen is showing if (data->timer) { app_timer_cancel(data->timer); const bool animated = true; app_window_stack_pop_all(animated); } app_free(data); } static void prv_window_load(Window *window) { SplashScreenData *data = wi...
ayer); } static Animation *prv_create_swap_down_animation(SwapLayer *swap_layer) { // Compute the animation distance const GRect *prev_frame = &swap_layer->previous->layer.frame; int16_t dy = -(prev_frame->origin.y + prev_frame->size.h); ScrollAnimationCurve swap_down_scroll_curve = (ScrollAnimationCurve) { ...
(animation, (AnimationHandlers) { .started = (direction == ScrollDirectionDown) ? prv_swap_down_start : prv_swap_up_start, .stopped = (direction == ScrollDirectionDown) ? prv_swap_down_complete : prv_swap_up_complete, }, swap_layer)
PebbleProcessMdFlash*) md)->name; } else if (md->process_storage == ProcessStorageResource) { return ((const PebbleProcessMdResource*) md)->name; } return ((const PebbleProcessMdSystem*) md)->name; } uint32_t process_metadata_get_size_bytes(const PebbleProcessMd *md) { if (md->process_storage == ProcessSto...
{ *md = (PebbleProcessMdFlash){}; prv_init_from_info_common(&md->common, info, task, ProcessStorageFlash); // Flash app specific fields strncpy(md->name, info->name, sizeof(md->name)); md->name[sizeof(md->name) - 1] = 0; md->size_bytes = info->virtual_size; md->process_version = info->process_version;...
void process_metadata_init_with_resource_header(PebbleProcessMdResource *md, const PebbleProcessInfo *info, int bin_resource_id, PebbleTask task) { *md = (PebbleProcessMdResource){}; prv_init_from_info_common(&md->common, info, task, ProcessStorageResource); // Resource app specific fields strncpy(md->n...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
("gack() = %d\n", gack())
; return 0; } #endif
delta_time_s) { const time_t now = rtc_get_time(); AttributeList list = {}; TimelineResourceId icon_resources[] = { TIMELINE_RESOURCE_NOTIFICATION_FACEBOOK_MESSENGER, TIMELINE_RESOURCE_NOTIFICATION_FACEBOOK, TIMELINE_RESOURCE_NOTIFICATION_MAILBOX, TIMELINE_RESOURCE_NOTIFICATION_GENERIC, ...
{ const time_t now = rtc_get_time(); AttributeList list = {}; prv_set_timeline_icon(&list, TIMELINE_RESOURCE_TIMELINE_SPORTS, 0); attribute_list_add_uint8(&list, AttributeIdSecondaryColor, secondary_color.argb); attribute_list_add_cstring(&list, AttributeIdTitle, "Avalanche at Sharks"); attribute_list_add_...
static void prv_add_calendar_pin(int32_t delta_time_s, int32_t duration_m, bool is_all_day, bool recurring, TimelineResourceId icon, TimelineResourceId card_icon) { const time_t now = rtc_get_time(); time_t target = now + delta_time_s; if (is_all...
Verify that the connection intent is still there for the Kernel: cl_assert_equal_i(gap_le_connect_connection_intents_count(), 1); cl_assert_equal_b(gap_le_connect_has_connection_intent(&device, GAPLEClientKernel), true); cl_assert_equal_b(gap_le_connect_has_connection_intent(&device, GAPLEClientApp), false); cl...
prv_assert_client_event(&device, false /* connected */, (1 << PebbleTask_App), GAPLEConnectHCIReasonExtensionCancelConnect)
; // Verify there are no more intents: cl_assert_equal_i(gap_le_connect_connection_intents_count(), 0); } // ------------------------------------------------------------------------------------------------- // Pairing void __disabled_test_gap_le_connect__one_shot_intent_removed_when_disconnected_before_encrpt(vo...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gap_le_connection_deinit()
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 "fake_put_bytes_storage_mem.h" #include "clar_asserts.h" #include "kernel/pbl_malloc.h" #i...
{ cl_assert_equal_m(contents, s_storage_data.buffer + sizeof(FirmwareDescription), size); }
EGION_SYSTEM_RESOURCES_BANK_0_BEGIN, FLASH_REGION_SYSTEM_RESOURCES_BANK_0_END }, { "System Resources", FLASH_REGION_SYSTEM_RESOURCES_BANK_1_BEGIN, FLASH_REGION_SYSTEM_RESOURCES_BANK_1_END }, { "File System", FLASH_REGION_FILESYSTEM_BEGIN, FLASH_REGION_FILESYSTEM_END }, }; typedef ...
PBL_LOG(LOG_LEVEL_INFO, ">>>> Done!")
; } FlashStressWindow stress_data; static bool abort_stress_test; static void update_text(int iter, int tot, bool failed) { static char status[50]; snprintf(status, sizeof(status), "%d / %d %s", iter, tot, failed ? "Failed Out" : "Complete"); text_layer_set_text(stress_data.text_layer, (char *)status...
ts_get_font_height(fcc_title_font); const uint8_t fcc_number_subtitle_height = fonts_get_font_height(fcc_number_subtitle_font); const GTextOverflowMode text_overflow_mode = GTextOverflowModeFill; graphics_context_set_text_color(ctx, cell_is_highlighted ? GColorWhite : GColorBlack); // Calculate the container ...
menu_cell_layer_is_highlighted(cell_layer)
; for (uint32_t i = 0; i < num_marks; i++) { GBitmap *mark = cd->regulatory_marks[start_idx + i]; // Vertically center the icon in the cell mark_origin.y = (cell_layer_bounds->size.h - mark->bounds.size.h) / 2; // Draw the icon and advance the x coordinate for drawing the next icon mark_origin.x =...
); cl_assert_equal_i(s_cb_events_1[0].bpm.bpm, s_hrm_event_data.hrm_bpm); cl_assert_equal_i(s_cb_events_1[0].bpm.quality, s_hrm_event_data.hrm_quality); // Now advance time to just before the expiration time rtc_set_time(rtc_get_time() + expire_s - 1); // Send more data, the callback should get the expirin...
prv_fake_send_new_data()
; fake_system_task_callbacks_invoke_pending(); // Expect 4 events: 1 for BPM, 1 for LED, 2 for subscribing to all, none for no feature. cl_assert_equal_i(s_event_count, 4); sys_hrm_manager_unsubscribe(bpm_session); sys_hrm_manager_unsubscribe(led_session); sys_hrm_manager_unsubscribe(all_session); sys_h...
er.id, &s_long_items[0].header.id)); cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[1].header.id)); #if !CAPABILITY_HAS_CORE_NAVIGATION4 cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[2].header.id)); #endif cl_assert(!ite...
cl_assert(iter_prev(&iterator))
We're crossing far_left point, time to swap... lm_p0 = far_left; lm_p1 = far_bottom; } if (y > rm_p1.y.integer) { // We're crossing far_right point, time to swap... rm_p0 = far_right; rm_p1 = far_bottom; } // Starting and ending point of the line, initi...
if (left_margin.raw_value <= right_margin.raw_value) { graphics_private_plot_horizontal_line(ctx, y, left_margin, right_margin, (fraction_for_bottom >> 1)); }
} } else { // PBL-14798: refactor this. // Top and bottom most point helpers for main loop GPointPrecise tm_p0 = far_left; GPointPrecise tm_p1 = far_top; GPointPrecise bm_p0 = far_left; GPointPrecise bm_p1 = far_bottom; const int8_t fraction_for_left = (MIN(p0.x.raw_value, p1.x.raw_v...
_schedule_enabled(WeekdaySchedule, false); active = do_not_disturb_is_active(); cl_assert(active == true); // Manual && Scheduled && Smart do_not_disturb_set_manually_enabled(true); do_not_disturb_set_schedule_enabled(WeekdaySchedule, true); active = do_not_disturb_is_active(); cl_assert(active == true);...
do_not_disturb_set_schedule(WeekdaySchedule, &schedule_1)
; do_not_disturb_set_schedule_enabled(WeekdaySchedule, true); active = do_not_disturb_is_active(); cl_assert(active == true); // Scheduled ON DoNotDisturbSchedule schedule_2 = { .from_hour = 5, .from_minute = 0, .to_hour = 13, .to_minute = 0, }; do_not_disturb_set_schedule(WeekdaySchedule, ...
oid prv_draw_bitmap(const uint8_t *bitmap, unsigned x_offset, unsigned y_offset, unsigned width, unsigned height, uint8_t buffer[DISP_ROWS][DISP_LINE_BYTES]) { // Need to convert offsets to bytes for the horizontal dimensions x_offset = prv_round_to_byte(x_off...
for (unsigned y = 0; y < inner_bar_height; y++) { for (unsigned x = 0; x < num_pixels; x++) { // Add 1 to offsets so we don't write into outer box prv_set_bit(x + x_offset + 1, y_offset + y + 1, buffer); } }
prv_display_buffer(buffer); } void display_init(void) { prv_enable_display_spi_clock(); prv_display_start(); prv_disable_display_spi_clock(); }
/* * 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_root_layer, launcher_menu_layer_get_layer(launcher_menu_layer))
; // If we have a saved launcher selection state, restore it if (s_launcher_app_persisted_data.valid) { launcher_menu_layer_set_selection_state(launcher_menu_layer, &s_launcher_app_persisted_data.selection_state); } app_focus_service_subscribe_handlers((AppFocus...
dress_aligned < start_address_aligned) { dma_size = 0; leading_bytes = length; trailing_bytes = 0; } prv_set_num_data_bytes(length); prv_config_indirect_read(dev, instruction, start_addr, dummy_cycles, is_ddr); if (leading_bytes > 0) { prv_read_bytes(buffer, leading_bytes); } if (dma_siz...
((void *)(uintptr_t)(QSPI_MMAP_BASE_ADDRESS + addr), length)
; prv_set_ddr_enabled(is_ddr); uint32_t modes_bitset = 0; modes_bitset |= is_ddr ? QSPI_ComConfig_DDRMode_Enable : QSPI_ComConfig_DDRMode_Disable; modes_bitset |= is_ddr ? QSPI_ComConfig_DHHC_Enable : QSPI_ComConfig_DHHC_Disable; modes_bitset |= QSPI_ComConfig_FMode_Memory_Mapped; modes_bitset |= QSPI_Com...
nal_crumbs) { ActionMenuConfig config = { .root_level = root_level, .colors.background = GColorChromeYellow, .did_close = prv_action_menu_did_close_cb, }; ActionMenu *action_menu_window = app_action_menu_open(&config); // Set the window on screen so its window handlers will be called window_set_...
(x_offset, y_offset)
; prv_render_action_menu_window(root_level, selected_index, animation_state, additional_crumbs); } } void prv_prepare_canvas_and_render_action_menus_static(const ActionMenuLevel *root_level, unsigned int selected_index...
///////////////////////////////////////// //! Smart Alarm first use dialog typedef struct FirstUseDialog { ExpandableDialog dialog; AlarmsAppData *data; } FirstUseDialog; static void prv_alarms_app_opened_click_handler(ClickRecognizerRef recognizer, void *context) { ExpandableDialog *expandable_dialog = context...
if (prv_are_alarms_scheduled(data)) { app_window_stack_push(&data->window, true); menu_layer_set_selected_index(&data->menu_layer, MenuIndex(0, 1), PBL_IF_RECT_ELSE(MenuRowAlignNone, MenuRowAlignCenter), false); } else { Window *editor = alarm_editor_create_new_alarm(prv_...
#if CAPABILITY_HAS_HEALTH_TRACKING uint32_t version = alarm_prefs_get_alarms_app_opened(); if (version == 0) { prv_push_alarms_app_opened_dialog(data); } alarm_prefs_set_alarms_app_opened(CURRENT_ALARMS_APP_VERSION); #endif } static void prv_handle_deinit(void) { AlarmsAppData *data = app_state_get_use...
ror: PBL_LOG(LOG_LEVEL_ERROR, "Encryption change failed: %u", event->status); goto unlock; } // Bluetopia doesn't set the 'is_random_address' field in the encryption change event, so using // gap_le_connection_by_device() will fail. GAPLEConnection *connection = gap_le_connection_by_addr(&event->dev_ad...
BTDeviceAddressToBDADDR(device->address)
, &status); if (r) { PBL_LOG(LOG_LEVEL_ERROR, "HCI_LE_..._Device_To_White_List (is_adding=%u, r=%d, status=0x%x)", is_adding, r, status); } #endif } // ------------------------------------------------------------------------------------------------- //! Helpers to manage the s_intents l...
lProperty_CompositorTransitions | ModalProperty_RenderRequested | ModalProperty_Unfocused); cl_assert_equal_i(windows[3][1]->on_screen, true); cl_assert_equal_i(windows[3][1]->is_click_configured, false); cl_assert_equal_i(windows[3][0]->on_screen, false); cl_assert_equal_i(windows[3][0]->is...
window_destroy(window1)
; window_destroy(window2); } // Description: // This test ensures that we are able to work with both the modal window stacks // and the application stack at the same time. void test_window_stack__modal_and_app(void) { Window *window1 = window_create(); Window *window2 = window_create(); WindowStack *app_stack...
tion_seconds; } else { *seconds = s_activity_state.sample_collection_seconds; } } mutex_unlock_recursive(s_activity_state.mutex); return success; } // ------------------------------------------------------------------------------------------------ // Get info on the sleep file typedef struct { b...
activity_init()
uted 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 "clar.h" #include "process_management/app_install_manager.h" #inc...
uuid_equal(uuid, &data->install_entry.uuid)
) { return data; } } return NULL; } // Fakes ///////////////////////// bool prv_validate_lut(ResAppNum res_app_num) { // Just check if the .resource_lut pointer for the provided res_app_num is non-NULL const TimelineResourceTestAppData *data = prv_get_data_for_app_with_id(res_app_num); return data...
/* * 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...
("outside_y_origin_layer", ctx.parent_framebuffer, GColorWhite)
= (utf8_t *)dialog->buffer; while ((cursor = utf8_get_next(cursor))) { count++; if (cursor == (utf8_t *)transcription_dialog->zero) { begin = count; } } transcription_dialog->animation = property_animation_create(&animated_text_len, transcription_dialog, NULL, NULL); if (!transcription...
{ PBL_ASSERTN(transcription_dialog); app_expandable_dialog_push((ExpandableDialog *)transcription_dialog); }
void transcription_dialog_pop(TranscriptionDialog *transcription_dialog) { PBL_ASSERTN(transcription_dialog); expandable_dialog_pop((ExpandableDialog *)transcription_dialog); } void transcription_dialog_set_callback(TranscriptionDialog *transcription_dialog, TranscriptionC...
title); } static void prv_certification_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) { SettingsSystemData *data = (SettingsSystemData *) context; PBL_ASSERTN(cell_index->section == 0); SystemCertificationData *cd =...
(cd, &cd->aus_rcm_mark)
test_wakeup__basic_checks(void) { WakeupId wakeup_id = 0; cl_assert_equal_i(sys_get_time(), 1388563200); sys_wakeup_cancel_all_for_app(); // Schedule a wakeup in 10 seconds wakeup_id = sys_wakeup_schedule(sys_get_time() + 10, 0, false); cl_assert_equal_i(sys_wakeup_query(wakeup_id), sys_get_time() + 10);...
(sys_wakeup_query(late_wakeup_id), E_DOES_NOT_EXIST)
; } void test_wakeup__time_jump(void) { sys_wakeup_cancel_all_for_app(); // Schedule 1 event in a minute time_t first_event = sys_get_time() + WAKEUP_EVENT_WINDOW; WakeupId first_wakeup_id = sys_wakeup_schedule(first_event, 0, false); cl_assert_equal_i(sys_wakeup_query(first_wakeup_id), first_event); Tim...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(APP_LOG_LEVEL_ERROR, "Crash Demo Looping Log Spam! WarbleGarbleWarbleGarbleWarble")
32, -960}, { -208, -40, -976}, { -168, 0, -1024}, { -208, 16, -1008}, { -192, -32, -976}, { -168, -16, -960}, { -144, -32, -1024}, { -152, -32, -1016}, { -176, -8, -1032}, // 146 seconds { -168, 0, -952}, { -168, -40, -960}, { -176, -32, -1064}, { -200, -56, -976}, ...
{ -200, -24, -984}, { -192, -32, -992}, { -224, -48, -968}, { -224, -40, -976}, { -216, -24, -976}, { -200, -8, -984}, { -192, -24, -992}, { -184, -40, -1008}, { -192, -48, -992}, { -200, -32, -976}, { -200, -16, -1000}, { -192, -16, -992}, { -208, -16, -984}, { -...
{ -208, -24, -992}, { -208, -32, -976}, { -200, -32, -984}, { -200, -32, -992}, { -192, -32, -1000}, { -200, -40, -992}, { -200, -32, -984}, { -200, -32, -992}, { -208, -48, -992}, { -200, -40, -1000}, { -200, -48, -984}, // 154 seconds { -208, -32, -984}, { -208...
/* * 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...
flash_erase_subsector(addr, prv_async_erase_done_cb, NULL)
; } } void flash_erase_optimal_range( uint32_t min_start, uint32_t max_start, uint32_t min_end, uint32_t max_end, FlashOperationCompleteCb on_complete, void *context) { PBL_ASSERTN(((min_start & (~SUBSECTOR_ADDR_MASK)) == 0) && ((max_end & (~SUBSECTOR_ADDR_MASK)) == 0) && (min_s...
ubscribers == NULL) { // If the hrm manager should be disabled or we have no subscribers, this data is unwanted. goto unlock; } // See if the sensor signal is stable or not bool stable_sensor = prv_is_sensor_stable(data); HRM_LOG("HRM Data:"); HRM_LOG("Status %"PRIx8, data->hrm_status); HRM_LOG("HR...
battery_is_usb_connected()
, .charger_subscription = (EventServiceInfo) { .type = PEBBLE_BATTERY_STATE_CHANGE_EVENT, .handler = prv_charger_event_cb, }, }; circular_buffer_init(&s_manager_state.system_task_event_buffer, s_manager_state.system_task_event_storage, EVENT_STORAGE_...
/* * 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...
{ enter_standby(RebootReasonCode_DialogBootFault); }
} else if (dialog_spi_bootloader_load_image() && host_transport_init()) { hc_protocol_init(); bt_local_id_generate_address_from_serial(&config->identity_addr); bool result = hc_endpoint_ctl_init_sync(config); // Nothing good comes from a failure here. BT gets partially initialized and you won't even ...
ed resource_storage_init(); s_resource_mutex = mutex_create_recursive(); } uint32_t resource_get_and_cache(ResAppNum app_num, uint32_t resource_id) { PBL_ASSERTN(app_num == SYSTEM_APP); // get from resource store mutex_lock_recursive(s_resource_mutex); ResourceStoreEntry res; resource_storage_get_resour...
{ mutex_lock_recursive(s_resource_mutex); bool rv = resource_storage_check(app_num, resource_id, NULL /* No expected version */); if (rv) { ResourceStoreEntry entry; prv_get_resource(app_num, resource_id, &entry); rv = (entry.id != 0); } mutex_unlock_recursive(s_resource_mutex); return rv; }
bool resource_version_matches(const ResourceVersion *v1, const ResourceVersion *v2) { return (v1->crc == v2->crc); }
if (intent->is_bonding_based) { // Update connection address: intent->device = event->peer_address; // FIXME: // Find and assign bonding_id even if there is no intent. // https://pebbletechnology.atlassian.net/browse/PBL-20972 connection->bondin...
while (intent) { GAPLEConnectionIntent *next = (GAPLEConnectionIntent *) intent->node.next; if (prv_intent_matches_connection(intent, connection)) { // Notify clients: if (prv_update_clients(intent, event->reason, GAPLEConnectionEventDisconnected)) { ...
gap_le_connection_remove(&event->peer_address); break; } default: { PBL_LOG(LOG_LEVEL_ERROR, "Disconnection Complete Event status: 0x%x", event->status); break; } } bt_unlock(); } // -------------------------------------------------------------------------------...
_serialize_log( contents, LOG_LEVEL_ERROR, prv_get_timestamp_ms(), PebbleTask_Unknown, "", 0, "ISR Message Dropped!"); pulse_push_send(contents, payload_length); } else { BufferedLogInfo log_info; prv_isr_buffer_read_and_consume(&log_info, sizeof(log_info)); MessageCont...
(contents->message, message, sizeof(contents->message))
; } void pulse_logging_log_sync_send(void *ctx) { MessageContents *contents = ctx; size_t payload_length = MIN( sizeof(MessageContents), offsetof(MessageContents, message) + strlen(contents->message)); pulse_push_send(contents, payload_length); }
DEVICE_NAME, device_name_out); } // Test that setting a local_name to NULL will rewrite the field with 0xFF and allow it to // be rewritten without causing a new page to be written void test_shared_prf_storage_v3__local_device_name_NULL_new_erased_field(void) { shared_prf_storage_set_local_device_name(DEVICE_NAME); ...
shared_prf_storage_store_ble_pairing_data(&PAIRING_INFO, DEVICE_NAME, true /* requires_address_pinning */, 0xff /* flags */)
; shared_prf_storage_set_getting_started_complete(GETTING_STARTED_COMPLETE); shared_prf_storage_set_local_device_name(DEVICE_NAME); for (uint32_t i = 0; i < 50; i++) { GETTING_STARTED_COMPLETE = !GETTING_STARTED_COMPLETE; cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), i % SPRF_NUM_PAGES);...
{ 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(success); // See if we need to zero out steps in this record. We check that the start of the mi...
return true; } // ------------------------------------------------------------------------------------- // If we have enough minute data in our circular buffer, write it out to either the minute // file or to data logging static void prv_send_minute_data(uint16_t uncertain_m, time_t sleep_start_utc, ...
a)) == 0); // Expect one regular timer to be running for advertisements: cl_assert_equal_i(regular_timer_seconds_count(), 1); // Unschedule callback should not have been called: cl_assert_equal_i(s_unscheduled_cb_count, 0); // Unschedule and expect not to be advertising any more: gap_le_advert_unschedule(...
cl_assert(memcmp(&scan_resp_data_out, scan_resp_data, sizeof(scan_resp_data)) == 0)
; // Expect one regular timer to be running for adverts: cl_assert_equal_i(regular_timer_seconds_count(), 1); // Unschedule callback should not have been called: cl_assert_equal_i(s_unscheduled_cb_count, 0); // Make sure the all the terms in the job are run: for (int term = 0; term < ARRAY_LENGTH(advert_...
(&orig_id, &s_last_timeline_id)
); // Nap sessions shouldn't be added rtc_set_time(rtc_get_time() + 3 * SECONDS_PER_HOUR); prv_add_nap_session(2, 1); activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 2); } // --------------------------------------------------------------------------------------- //...