prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
_entry(&s_stopped_handler_calls, animation, finished, context); DPRINTF("%"PRIu64" ms: Executing stopped handler for %d\n", prv_now_ms(), (int)animation); animation_unschedule_all(); } // -------------------------------------------------------------------------------------- // Test unscheduling animations arbitrar...
animation_set_custom_interpolation(a, interpolation)
; cl_assert_equal_p(animation_private_current_interpolate_override(), interpolation); animation_set_custom_curve(a, curve); cl_assert_equal_p(animation_private_current_interpolate_override(), NULL); animation_destroy(a); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
atoi("713713 4 job fiesta111")
, 713713); } void test_atoi__sign(void) { cl_assert_equal_i(atoi("+500"), 500); cl_assert_equal_i(atoi("-765"), -765); cl_assert_equal_i(atoi(" -573888"), -573888); cl_assert_equal_i(atoi(" +713713"), +713713); } void test_atoi__error(void) { cl_assert_equal_i(atoi("2147483647"), 2147483647); // last val...
) { return false; } switch (metric) { case HealthMetricHeartRateBPM: state->cache->alert_threshold_heart_rate = (HealthServiceMetricAlertInfo) {}; return true; default: return false; } #endif } // -------------------------------------------------------------------------------------...
sys_activity_sessions_is_session_type_ongoing(ActivitySessionType_Run)
) { result |= HealthActivityRun; } if (sys_activity_sessions_is_session_type_ongoing(ActivitySessionType_Open)) { result |= HealthActivityOpenWorkout; } return result; #endif } // ---------------------------------------------------------------------------------------------- // The number of session w...
ces/common/bluetooth/ble_root_keys.h" #include "services/common/bluetooth/bluetooth_ctl.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/bluetooth/dis.h" #include "services/common/bluetooth/local_addr.h" #include "services/common/bluetooth/local_id.h" #include "services/c...
{ static bool s_first_run = true; mutex_lock(s_comm_state_change_mutex); s_comm_state_change_eval_is_scheduled = false; bool is_active_mode = bt_ctl_is_bluetooth_active(); if (is_active_mode != s_comm_is_running) { if (is_active_mode) { prv_comm_start(); } else { prv_comm_stop(); } ...
void bt_ctl_set_enabled(bool enabled) { if (!s_comm_initialized) { PBL_LOG(LOG_LEVEL_ERROR, "Error: Bluetooth isn't initialized yet"); return; } mutex_lock(s_comm_state_change_mutex); s_comm_enabled = enabled; mutex_unlock(s_comm_state_change_mutex); prv_comm_state_change(NULL); } void bt_ctl_set...
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 "mcu/interrupts.h" #include "os/assert.h" #include "os/malloc.h" #include "os/mutex.h" #include "os/tick...
OS_ASSERT(!mcu_state_is_isr())
; TickType_t timeout_ticks = milliseconds_to_ticks(timeout_ms); LightMutexHandle_t mutex = handle->common.freertos_mutex; if (xLightMutexLockRecursive(mutex, timeout_ticks) == pdTRUE) { LOG_LOCKED(handle->common.lr, myLR); return (true); } return (false); } bool mutex_lock_recursive_with_timeout(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...
GRect(0, 0, 10, 20)
}, { 0, 0x60, 0}, { 0, 0x60, 0}, { 0, 0x60, 0}, { 0, 0x60, 0}, { 0, 0x60, 0}, { 0, 0x60, 0}, { 0, 0x60, 0}, { 0, 0x60, 0}, { 0, 0x60, 0}, { 11, 0x60, 50}, { 0, 0x12, 30}, { 0, 0x21, 64}, { 0, 0x1b, 0}, // 330: Local time: 11:06:00 PM { 0, 0x1b, 0}, { 0, 0x...
{ 0, 0x35, 0}, { 0, 0x35, 0}, { 0, 0x35, 0}, { 0, 0x35, 0}, { 0, 0x35, 0}, { 0, 0x35, 0}, { 0, 0x35, 0}, { 0, 0x35, 0}, { 0, 0x35, 17}, // 480: Local time: 01:36:00 AM { 0, 0x3b, 0}, { 0, 0x3b, 0}, { 0, 0x3b, 0}, { 0, 0x21, 42}, { 0, 0x42, 73}, { 0, 0x63, ...
{ 0, 0x7f, 0}, { 0, 0x7f, 0}, { 0, 0x8f, 0}, { 0, 0x8f, 0}, { 9, 0x70, 22}, { 0, 0x71, 0}, { 0, 0x71, 2}, { 0, 0x71, 0}, { 0, 0x71, 0}, { 0, 0x71, 0}, { 0, 0x71, 0}, { 0, 0x71, 6}, { 0, 0x71, 2}, { 0, 0x71, 0}, // 555: Local time: 02:51:00 AM { 0, 0x71, 0...
m_128bit_uuid_service(TEST_GATT_CONNECTION_ID); fake_gatt_put_discovery_complete_event(GATT_SERVICE_DISCOVERY_STATUS_SUCCESS, TEST_GATT_CONNECTION_ID); } // Tests /////////////////////////////////////////////////////////// void test_gatt_client_accessors__initialize(void) { ...
gatt_client_descriptor_get_uuid(descriptor_ref)
; cl_assert(uuid_equal(&uuid, &expected_descriptor->uuid)); // Test gatt_client_descriptor_get_characteristic(): cl_assert_equal_i(gatt_client_descriptor_get_characteristic(descriptor_ref), characteristic_ref); } } // Test gatt_client_service_get_included_services(): const ui...
/* * 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...
i18n_noop("PERFORMANCE")
; default: /// Default/Zone 0 HR Label return i18n_noop("HEART RATE"); } } static const char* prv_get_label_for_metric(WorkoutMetricType metric_type, WorkoutActiveWindow *active_window) { switch (metric_type) { case WorkoutMetricType_Hr: { i...
ctionResultTypeSuccess)) { const bool success = false; prv_cleanup_action_result(data, success); return; } char uuid_string[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&action_result->id, uuid_string); PBL_LOG(LOG_LEVEL_INFO, "Received action result: Item ID - %s; type - %" PRIu8, uuid_str...
prv_set_action_result(timeline_action_menu, data)
; action_menu_freeze(action_menu); } // perform the action switch (action->type) { case TimelineItemActionTypeAncsGeneric: case TimelineItemActionTypeAncsResponse: { // To give the iOS app some context (let it do lookups), give it all the // info about the notification // Copy eve...
(success && evt->bond) { // Sync the new bonding: bonding_sync_handle_pairing_completed(conn, conn_idx); } BTDeviceInternal device = {}; connection_get_address(conn, &device); hc_endpoint_pairing_send_pairing_complete(&device, evt->status); } // Convert to BT Spec error codes and updat...
PBL_LOG(LOG_LEVEL_DEBUG, "hope for the best")
; connection_module_init(); prv_configure_irk(init_info->config); ble_error_t e = ble_enable(); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_enable: %u", e); } PBL_LOG(LOG_LEVEL_DEBUG, "go go go"); ble_register_app(); advert_init(); local_addr_init(); // Do all the things that cl...
n_r2_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif 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, 3); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pb...
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, 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r1_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); 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, ...
\t\n"); if (!token) { continue; } // If this is a pre-processor directive, skip it if (token[0] == '#') { continue; } // If this is a comment skip it if (strcmp(token, "//") == 0) { continue; } // If this is an AccelRawData line, get the name if (strcmp(toke...
strlen(token)
+ 1, "%d", &state->test_entry.version); } else if (strcmp(token, "TEST_TOTAL") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.total.value); } else if (strcmp(token, "TEST_TOTAL_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.total.min); } ...
bool result; HealthServiceTimeRange range; // some time yesterday + today - as if UTC == localtime result = prv_calculate_time_range(now - SECONDS_PER_DAY, now, &range); cl_assert(result); cl_assert_equal_range(range, ((HealthServiceTimeRange){ .last_day_idx = 0, .num_days = 2, .seconds_first_day...
(HealthMetricStepCount, time_util_get_midnight_of(now) - SECONDS_PER_DAY, now)
; cl_assert_equal_i(result, 1000 + 2000); } void test_health__process_range(void) { HealthValue values[4] = {1000, 1000, 1000, 1000}; HealthServiceTimeRange range = { .num_days = 3, .seconds_first_day = SECONDS_PER_DAY / 10, .seconds_last_day = SECONDS_PER_DAY / 5, .seconds_total_last_day = SECON...
return; // location not found in ordering list, skip over } WeatherDataListNode *node = task_zalloc_check(sizeof(WeatherDataListNode)); node->id = location_index; WeatherLocationForecast *forecast = &node->forecast; if (!prv_fill_forecast_from_entry(entry, forecast)) { uuid_to_string(key, key_strin...
memcmp(blobdb_event->key, PREF_KEY_WEATHER_APP, strlen(PREF_KEY_WEATHER_APP))
== 0); if (blobdb_id == BlobDBIdWatchAppPrefs && ((blobdb_event->type == BlobDBEventTypeFlush) || is_key_weather_app_pref)) { type = WeatherEventType_WeatherOrderChanged; } else if (blobdb_id == BlobDBIdWeather) { type = blobdb_event->type == BlobDBEventTypeInsert ? WeatherEventType_WeatherDataAdded ...
/* * 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(vibe_score_info_get_resource_id(VibeScoreId_Invalid), RESOURCE_ID_INVALID)
; } void test_vibe_score_info__get_name_returns_correct_name(void) { cl_assert(strcmp(vibe_score_info_get_name(VibeScoreId_Reveille), "Reveille") == 0); } void test_vibe_score_info__get_name_returns_empty_string_for_invalid_score(void) { cl_assert(strcmp(vibe_score_info_get_name(VibeScoreId_Invalid), "") == 0); }...
tive of // an outside observer. That is, either the new value will be completely // written and returned for all future queries, or, if we reboot/loose power/ // run into an error, then we will continue to return the previous value. // We should never run into a case where neither value exists. status_t settings_file_s...
settings_raw_iter_set_current_record_pos(&file->iter, file->cur_record_pos)
; settings_raw_iter_read_val(&file->iter, val, val_len); } status_t settings_file_each(SettingsFile *file, SettingsFileEachCallback cb, void *context) { // Cannot set keys while iterating PBL_ASSERTN(file->cur_record_pos == 0); SettingsRecordInfo info; for (settings_raw_iter_begin(...
dications, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoOK); // Simulate getting confirmation from remote: prv_confirm_cccd_write(BLEGATTErrorSuccess); fake_event_clear_last(); // We had a bug at some point where the header size was not taken into account co...
(e, BTErrnoOK)
; // Simulate getting confirmation from remote: prv_confirm_cccd_write(BLEGATTErrorSuccess); fake_event_clear_last(); BLECharacteristic handle_out = ~0; uint8_t out[1]; uint16_t value_length = sizeof(out); bool has_more = true; const uint16_t next_length = gatt_client_subscriptions_consume_not...
/* * 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...
(1bitpalette)
/* * 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_timer_register(1000 / TARGET_FPS, prv_redraw_timer_cb, NULL)
; } static void s_main(void) { AppData *data = app_malloc_check(sizeof(AppData)); app_state_set_user_data(data); Window *window = &data->window; window_init(window, WINDOW_NAME("Bouncing Box")); window_set_user_data(window, data); window_set_fullscreen(window, true); layer_set_update_proc(&window->laye...
graphics_line_draw_precise_stroked = (MockCallRecordings){}; s_graphics_draw_line = (MockCallRecordings){}; s_graphics_fill_rect = (MockCallRecordings){}; s_app_event_loop_callback = NULL; s_log_internal__expected = NULL; s_app_heap_analytics_log_stats_to_app_heartbeat_call_count = 0; s_app_heap_analytics_...
{ prv_deinit(); // engine will be re-initialized in rocky_event_loop~ char *script = prv_load_js("color"); s_tictoc_callback_is_color = true; s_app_event_loop_callback = prv_rocky_tictoc_callback; bool result = rocky_event_loop_with_string_or_snapshot(script, strlen(script)); cl_assert(result); }
}, .dummy_cycles = { .fast_read = 4, }, .block_lock = { .has_lock_data = false, .locked_check = 0xff, .protection_enabled_mask = (1 << 7), }, .reset_latency_ms = 13, .suspend_to_read_latency_us = 20, .standby_to_low_power_latency_us = 10, .low_power_to_standby_latency_us = 30, .sup...
(QSPI_FLASH)
; } status_t flash_impl_enter_low_power_mode(void) { qspi_flash_set_lower_power_mode(QSPI_FLASH, true); return S_SUCCESS; } status_t flash_impl_exit_low_power_mode(void) { qspi_flash_set_lower_power_mode(QSPI_FLASH, false); return S_SUCCESS; } status_t flash_impl_set_burst_mode(bool burst_mode) { // NYI r...
"I will call back", prv_noop_action_callback, NULL); const unsigned int selected_index = 1; prv_prepare_canvas_and_render_action_menus_animated(root_level, selected_index); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))...
{ ActionMenuLevel *root_level = action_menu_level_create(3); ActionMenuLevel *voice_level = action_menu_level_create(1); action_menu_level_add_action(voice_level, "This won't be seen", prv_noop_action_callback, NULL); a...
void test_action_menu_window__wide_display_mode_with_chevron_and_long_labels(void) { ActionMenuLevel *root_level = action_menu_level_create(3); ActionMenuLevel *voice_level = action_menu_level_create(1); action_menu_level_add_action(voice_level, "This won't be seen", ...
de "stubs_task_watchdog.h" #include "stubs_compiled_with_legacy2_sdk.h" #include "stubs_memory_layout.h" #define TEST_UUID UuidMake(0xF9, 0xC6, 0xEB, 0xE4, 0x06, 0xCD, 0x46, 0xF1, 0xB1, 0x51, 0x24, 0x08, 0x74, 0xD2, 0x07, 0x73) // Stubs //////////////////////////////////// //int g_pbl_log_level = 0; //void pbl_log(u...
sys_wakeup_schedule(late_event, 0, false)
; cl_assert_equal_i(sys_wakeup_query(late_wakeup_id), late_event); // Schedule a wakeup for 5 windows into the future time_t early_event = start_time + WAKEUP_EVENT_WINDOW * 5; WakeupId early_wakeup_id = sys_wakeup_schedule(early_event, 0, false); cl_assert_equal_i(sys_wakeup_query(early_wakeup_id), early_ev...
ffffffff || (uintptr_t)initial_sp == 0xffffffff) { dbgserial_putstr("Firmware is erased"); return true; } return false; } static void prv_sad_watch(uint32_t error_code) { dbgserial_putstr("SAD WATCH"); char error_code_buffer[12]; itoa_hex(error_code, error_code_buffer, sizeof(error_code_buffer...
(ERROR_RESET_LOOP)
; } #if !NO_WATCHDOG dbgserial_putstr("Enabling watchdog"); watchdog_init(); watchdog_start(); #endif gpio_disable_all(); prv_jump_to_fw(); } // Stubs for libg_s.a, which is our libc implementation from nano-newlib void _exit(int status) { }
2, -64}, { 1024, 656, -16}, { 1112, 720, 72}, { 1448, 600, 136}, { 1528, 384, 144}, { 1352, 224, 160}, { 1328, 136, 120}, { 1352, 152, 72}, { 1248, 256, 16}, { 1032, 272, -8}, { 1008, 248, 8}, { 1040, 232, -16}, { 848, 200, -64}, { 920, 168, -40}, { 944, 200, -88}...
{ 1304, 640, 144}, { 1232, 792, 64}, { 960, 768, -128}, { 904, 464, -96}, { 792, 536, -40}, { 1024, 688, 16}, { 1240, 584, 56}, { 1296, 376, 88}, { 1344, 224, 128}, { 1488, 136, 104}, { 1448, 128, 80}, { 1232, 176, 48}, { 1056, 208, 48}, { 1192, 280, 8}, { 103...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_private_get_1bit_grayscale_pattern(color, row_number)
; (*look_up)[row_number].transparent_mask[palette_index] = gcolor_is_transparent(color) ? false : true; } } } void bitblt_bitmap_into_bitmap_tiled_palette_to_1bit(GBitmap* dest_bitmap, const GBitmap* src_bitmap, GRect dest_rect, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (c->compare_cb(ours, theirs) == 0) { return ours; }
} return NULL; } void circular_cache_push(CircularCache* c, void* new_item) { uint8_t* old_item = prv_get_item_at_index(c, c->next_erased_item_idx); if (c->item_destructor) { c->item_destructor(old_item); } memcpy(old_item, new_item, c->item_size); ++c->next_erased_item_idx; UTIL_ASSERT(c->next_er...
1104, 536, 0}, { 1272, 528, 56}, { 1752, 496, 128}, { 1736, 472, 136}, { 1248, 328, 80}, { 1392, 208, 160}, { 1680, 72, 320}, { 1512, -40, 344}, { 1216, 32, 168}, { 976, -8, 184}, { 800, -32, 192}, { 680, -16, 104}, { 616, -56, 88}, { 552, -64, 24}, { 608, -80, 0}...
{ 1208, 544, 112}, { 1296, 368, 16}, { 1552, 272, 96}, { 1472, 112, 192}, { 1232, 56, 184}, { 1088, 32, 160}, { 952, 32, 144}, { 832, 40, 120}, { 744, -8, 112}, { 664, -56, 88}, { 656, -112, 48}, { 784, 8, -48}, { 1240, -24, -72}, { 1592, -56, 104}, { 1568, 17...
{ 1832, -184, 344}, { 1808, 464, 104}, { 1344, 800, -416}, { 992, 72, 120}, // 91 seconds { 1432, 336, 472}, { 1208, 288, 392}, { 1016, 344, 288}, { 840, 384, 208}, { 744, 352, 192}, { 728, 304, 152}, { 808, 312, 120}, { 944, 400, 88}, { 1152, 456, 32}, { 143...
profiler_stop(); uint32_t mmap_time = profiler_get_total_duration(true); profiler_start(); uint8_t instruction; uint8_t dummy_cycles; bool is_ddr; prv_get_fast_read_params(dev, &instruction, &dummy_cycles, &is_ddr); qspi_indirect_read_dma(dev->qspi, instruction, 0, dummy_cycles, buffer_dma, size, is_ddr)...
(buf, buf_size, "FAILURE: erase did not report success %"PRIi32, result)
; } else if (was_busy == false) { ++failures; prompt_send_response("FAILURE: Flash never became busy, but we should be busy for 300ms."); prompt_send_response("FAILURE: Flash probably never did an erase."); } else if (duration < min_erase_time) { ++failures; prompt_send_response("FAILURE: Flash ...
/* * 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...
fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */)
; pfs_init(false /* run filesystem check */); pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); // Setup content indicator ContentIndicatorsBuffer *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...
{ return BLE_ERROR_NOT_CONNECTED; }
it(VoiceUiData *data) { data->error_count = MAX_ERROR_COUNT; // exit UI after the dialog is shown if (data->show_error_dialog) { const GColor dialog_bg_color = PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite); prv_push_error_dialog(data, i18n_noop("No internet connection"), RESOUR...
{ data->last_session_successful = false; }
G_LEVEL_DEBUG, "Opening session %u with tag %"PRIu32", type %u, size %hu", msg->session_id, msg->logging_session_tag, msg->data_item_type, msg->data_item_size); break; } case DataLoggingEndpointCmdData: { DataLoggingSendDataMessage *msg = (DataLoggingSendDataMessage *)message; PB...
logging_session->comm.num_bytes_pending = num_bytes; update_session_state(logging_session, DataLoggingSessionCommStateSending, true /*reschedule*/); mutex_unlock(s_endpoint_data.mutex); unsigned int data_buffer_length = sizeof(DataLoggingSendDataMessage) + num_bytes; if (!uuid_is_system(&logging_session->a...
static void prv_dls_endpoint_handle_ack(uint8_t session_id) { DataLoggingSession *session = dls_list_find_by_session_id(session_id); if (session == NULL) { PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_WARNING, "Received ack for non-existent session id: %"PRIu8, session_id); return; } mutex_lock(s_end...
gs_buf_size, i18n_get("Active Calories", headings), headings_buf_size); string_list_add_string(values, values_buf_size, calories_str, values_buf_size); } static void prv_add_hr_metric_info(StringList *headings, int headings_buf_size, StringList *values, int...
(headings, headings_buf_size, values, values_buf_size, session)
; prv_add_distance_metric_info(headings, headings_buf_size, values, values_buf_size, session); prv_add_step_metric_info(headings, headings_buf_size, values, values_buf_size, session); prv_add_active_calories_metric_info(headings, headings_buf_size, values, values_buf_...
dentityResolvingKey *) fake_GAPAPI_get_fake_irk(); BleBonding bonding = { .pairing_info = { .identity = identity_device, .irk = *irk, .is_remote_identity_info_valid = true, }, .is_gateway = true, }; bt_driver_handle_host_added_bonding(&bonding); return fake_bt_persistent_storage_ad...
cl_assert_equal_i(e, BTErrnoOK)
PBL_ASSERTN(structured_glance)
; prv_weather_event_handler(NULL, structured_glance); weather_glance->weather_event_info = (EventServiceInfo) { .type = PEBBLE_WEATHER_EVENT, .handler = prv_weather_event_handler, .context = structured_glance, }; event_service_client_subscribe(&weather_glance->weather_event_info); return &struc...
0x98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05}, .parent_id = {0xff, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0x02}, .timestamp = 4, .duration = 0, .type = TimelineItemTypeReminder, .layout = LayoutIdTest, } }; static TimelineItem item4 =...
(uuid_equal(&item2.header.id, &temp.header.id))
; temp.attr_list.attributes = NULL; cl_assert(memcmp(&item2, &temp, sizeof(TimelineItem)) == 0); cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */)); cl_assert(reminder_db_get_len((uint8_t *)&item2.header.id, sizeof(Uuid)) == 0); // check item 3 or 4 memset(&temp, 0, siz...
04 lights, -4"); // Space padded minimum character output snprintf(dstbuf, 256, "There are %2d lights, %2d", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, -4"); // Left-align, Space padded minimum character output snprintf(dstbuf, 256, "There are %-2d lights, %-2d", 4, -4); cl_assert_equal_s(dst...
(dstbuf, 256, "%.izero%.i", 0, 1)
; cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.-3izero%.-3i", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (non-zero digits outputting zero) snprintf(dstbuf, 256, "%.1izero%.1i", 0, 1); cl_assert_equal_s(dstb...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
GRect(0, shadow_top_y_offset, layer_w, shadow_top_bitmap_h)
, 920, -176}, { -120, 912, -176}, { -120, 912, -176}, { -120, 920, -176}, { -120, 920, -176}, { -120, 920, -176}, { -120, 920, -184}, { -120, 920, -176}, { -120, 920, -176}, { -120, 912, -184}, { -120, 920, -176}, { -120, 912, -184}, { -120, 920, -176}, { -120, 912, -...
{ -112, 920, -176}, { -120, 912, -176}, { -112, 912, -176}, { -112, 912, -176}, { -120, 912, -184}, { -112, 920, -176}, { -112, 912, -184}, { -112, 920, -176}, { -120, 912, -184}, { -120, 920, -176}, { -112, 912, -184}, { -120, 920, -176}, { -112, 920, -184}, { -1...
{ -112, 912, -184}, { -112, 912, -176}, { -112, 912, -184}, { -112, 936, -176}, { -112, 912, -184}, { -112, 912, -184}, { -112, 920, -184}, { -112, 920, -184}, { -112, 920, -184}, { -112, 904, -176}, // 65 seconds { -112, 904, -192}, { -104, 912, -176}, { -112, 9...
ess_layer_set_foreground_color(&data->track_pos_bar, PBL_IF_COLOR_ELSE(GColorRed, GColorBlack)); progress_layer_set_corner_radius(&data->track_pos_bar, config->track_corner_radius); layer_add_child(&window->layer, (Layer *)&data->track_pos_bar); ActionBarLayer *action_bar = ...
event_service_client_subscribe(&data->event_info)
; prv_push_window(data); // Overall reduce the latency at the expense of some power... music_request_reduced_latency(true); // Give us a super responsive initial period: music_request_low_latency_for_period(5000); prv_set_pos_update_timer(data, music_get_playback_state()); } static void prv_handle_deini...
he right value after closing & reopening the file...\n"); verify(&file, key, key_len, val, val_len); } static bool prv_each_check_all_values(SettingsFile *file, SettingsRecordInfo *info, void *context) { uint32_t desired_value = *(uint32_t *)context; uint32_t key; uint32_t value; info->get_key(file, (uint8_...
snprintf((char *)val, sizeof(val), "v%03d", i)
; printf("Iteration %d key %s val %s\n", i, key, val); set_and_verify(&file, key, key_len, val, val_len); } prv_print_stats(&file); printf("Making sure we handle running out of storage gracefully...\n"); memcpy(key, "k255", 5); memcpy(val, "v255", 5); cl_assert_equal_i(settings_file_set(&file, key, ...
0, -456}, { 648, 592, -384}, { 656, 672, -384}, { 536, 664, -416}, { 432, 560, -576}, { 360, 456, -824}, { 416, 320, -968}, { 352, 320, -808}, { 400, 256, -968}, { 448, 400, -920}, { 424, 400, -936}, { 488, 432, -824}, { 400, 320, -808}, { 368, 304, -808}, { 440, ...
{ 296, 408, -752}, // 58 seconds { 408, 336, -696}, { 400, 568, -680}, { 424, 728, -656}, { 392, 640, -672}, { 384, 624, -680}, { 400, 416, -696}, { 408, 568, -672}, { 400, 664, -664}, { 384, 560, -680}, { 408, 568, -672}, { 392, 592, -664}, { 384, 552, -680}, ...
{ 376, 496, -736}, { 360, 528, -736}, { 376, 512, -728}, { 376, 480, -736}, { 384, 496, -736}, { 384, 496, -736}, { 384, 536, -720}, { 368, 536, -736}, { 376, 496, -736}, { 392, 472, -728}, // 61 seconds { 360, 560, -736}, { 368, 544, -736}, { 376, 464, -736}, ...
efine BMA255_FIFO_SIZE_BYTES (BMA255_FIFO_MAX_FRAMES * BMA255_FIFO_FRAME_SIZE_BYTES) // Driver state static BMA255PowerMode s_accel_power_mode = BMA255PowerMode_Normal; static bool s_fifo_is_enabled = false; static bool s_shake_detection_enabled = false; static bool s_accel_outstanding_motion_work = false; sta...
{ int16_t reading = ((registers[0] >> 4) & 0x0F) | ((int16_t)registers[1] << 4); if (reading & 0x0800) { reading |= 0xF000; } return reading; }
static void prv_convert_accel_raw_data_to_mgs(const uint8_t *buf, AccelDriverSample *data) { int16_t readings[3]; for (int i = 0; i < 3; ++i) { readings[i] = prv_conv_raw_to_12bit(&buf[i*2]); } const AccelConfig *cfg = &BOARD_CONFIG_ACCEL.accel_config; *data = (AccelDriverSample) { .x = (cfg->axes...
sions and * limitations under the License. */ #include "gdraw_command_transforms.h" #include "applib/applib_malloc.auto.h" #include "applib/graphics/gdraw_command_private.h" #include "util/trig.h" #include "applib/ui/animation.h" #include "applib/ui/animation_interpolate.h" #include "applib/ui/animation_timing.h" #...
for (uint16_t j = 0; j < lookup_length; j++) { if (gpoint_equal(&point, &lookup->values.points[j])) { lookup->iter.lookup->index_lookup[lookup->iter.current_index] = j; break; } }
lookup->iter.current_index++; } return true; } GPointIndexLookup *gdraw_command_list_create_index_lookup(GDrawCommandList *list, GPointComparator comparator, void *context, bool reverse) { uint16_t num_points = 0; const bool is_precise = false; GPoint * const points = gdraw_command_list_collect_poin...
/* * 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...
{ // On a leap year and past February so add a leap day. days++; }
// Add in previous days of the current month days += rtc_date.RTC_Date - 1; return rtc_time.RTC_Seconds + 60 * (rtc_time.RTC_Minutes + 60 * (rtc_time.RTC_Hours + 24 * days)); } void rtc_initialize_fast_mode(void) { // We configure the RTC to run in "fast time". This means that the calendar will /...
cl_assert_equal_i(num_stats, s_stats_num_columns); // Create a new row of stats StatsRow *stats = malloc(sizeof(StatsRow)); memset(stats, 0, sizeof(*stats)); // Collect the stats and also print them out for (int i = 0; i < num_stats; i++) { printf("%s: %d, ", names[i], values[i]); stats->values[...
{ // Capture the minute data for each minute TestMinuteData minute_data = { .steps = minute_steps, }; bool still; kalg_minute_stats(s_kalg_state, &minute_data.vmc, &minute_data.orientation, &still); PBL_ASSERTN(num_minutes_captured < *minute_data_len); minute_data_arra...
num_samples_left -= chunk_size; data += chunk_size; } // ------------------------------------------------------- // Leftover data in epoch, if any total_steps += kalg_analyze_finish_epoch(s_kalg_state); TestMinuteData minute_data = { .steps = minute_steps, }; bool still; kalg_minute_stats...
otted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_even_offset_even_clip"))); // Clipping on odd boundaries - no offset setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_ODD, OFFSET_RECT_EVEN, false, 1); for (int16_t col = 0; co...
for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_odd_offset_even_clip"))); // Clipping on odd boundaries - no offset setup_test_aa_sw(&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...
(result == DICT_OK)
; cl_assert(context.okay == true); cl_assert(context.expected_size == size); } void test_dict__write_read(void) { // Stack allocated buffer: const uint8_t key_count = 10; const uint32_t size = dict_calc_buffer_size(key_count, sizeof(SOME_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...
(s_free_list_lock)
{ 136, -376, -848}, { 112, -440, -840}, // 2 seconds { 120, -400, -864}, { 112, -320, -856}, { 96, -360, -896}, { 72, -376, -744}, { 112, -248, -888}, { 64, -296, -760}, { 56, -64, -752}, { 120, 272, -808}, { 296, 456, -712}, { 384, 600, -664}, { 448, 616, -632}, ...
{ 296, 456, -872}, { 312, 592, -1048}, { 216, 352, -672}, { 240, 440, -688}, { 208, 464, -672}, { 248, 448, -688}, { 288, 600, -800}, { 352, 424, -720}, { 376, 400, -704}, { 336, 512, -744}, { 312, 392, -656}, { 304, 456, -720}, { 296, 432, -720}, // 8 seconds ...
EG; uint16_t DCDC_IRQ_CLEAR_REG; uint16_t DCDC_IRQ_MASK_REG; // CRG_TOP uint16_t BANDGAP_REG; uint16_t BOD_STATUS_REG; uint16_t FORCE_SLEEP_REG; uint16_t LDOS_DISABLE_REG; uint16_t AON_SPARE_REG; // QSPIC uint32_t QSPIC_CTRLMODE_REG; uint32_t QSPIC_BURSTCMDA_REG; uint32_t QSPIC_BURSTCMDB_RE...
REG_SETF(DCDC, DCDC_V14_0_REG, DCDC_V14_CUR_LIM_MIN, 0x4)
; REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_ENABLE_HV, 0x1); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_ENABLE_LV, 0x1); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_CUR_LIM_MAX_LV, 0x6); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_IDLE_HYST, 0x4); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_IDLE_MIN, 0x10); REG_SETF(DCDC,...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r16_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, STROKE_BIG); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_cir...
ceiving the response: ams_handle_write_response(remote_command, BLEGATTErrorSuccess); } // Invalid/Unsupported command: music_command_send(NumMusicCommand); fake_gatt_client_op_assert_no_write(); } void test_ams__send_remote_command_non_kernel_main_task(void) { prv_connect_ams(); // Simulate Music ap...
prv_connect_ams()
; // Receive: playing, 200% playback rate, elapsed time 184.755s // 0000 00 01 00 31 2c 32 2e 30 2c 31 38 34 2e 37 35 35 ...1,2.0 ,184.755 uint8_t playback_info_update[] = { 0x00, 0x01, 0x00, 0x31, 0x2c, 0x32, 0x2e, 0x30, 0x2c, 0x31, 0x38, 0x34, 0x2e, 0x37, 0x35, 0x35, }; prv_receive_entity_updat...
set_text_element(data->bg_color_text, data->bg_color_text_buffer, true); } else { set_text_element(data->bg_color_text, data->bg_color_text_buffer, false); } layer_mark_dirty(text_layer_get_layer(data->alpha_text)); layer_mark_dirty(text_layer_get_layer(data->fg_text)); layer_mark_dirty(text_layer_ge...
for (uint8_t row = 0; row < 2; row++) { for (uint8_t color_index = row * ROW_LENGTH; color_index < (row + 1) * ROW_LENGTH; color_index++) { GColor color = (GColor){.argb = (s_color_table[color_index] | ALPHA_100)}; if (compare && gcolor_equal(color, compare_color)) { color_index_match...
// Draw border if (compare) { const GRect box = GRect(origin.x + 4*color_index_match - 1, origin.y - 1 + height_offset, COLOR_BAR_WIDTH + 2, COLOR_BAR_HEIGHT + 2); graphics_context_set_stroke_color(ctx, GColorWhite); graphics_draw_rect(ctx, &box); } } static void up_hand...
{ -928, 576, -80}, { -1200, 512, 24}, { -1456, 312, 176}, { -1376, 232, 152}, { -1136, 184, 144}, { -1072, 176, 128}, { -1104, 136, 152}, { -1088, 136, 112}, { -1008, 120, 88}, { -1128, 120, -8}, { -1144, 64, 40}, { -1064, -40, -64}, { -1232, -56, -120}, // 39 sec...
{ -1488, 360, 160}, { -1424, 272, 136}, // 44 seconds { -1208, 208, 168}, { -1128, 112, 208}, { -1144, 24, 208}, { -1128, 64, 184}, { -1080, 64, 208}, { -1152, -80, 272}, { -1128, -304, 184}, { -928, -72, 8}, { -1200, 64, -32}, { -1168, 296, -352}, { -1152, 248, -...
{ -1128, 192, -376}, { -1280, 232, -360}, { -1384, -96, 16}, { -1336, -200, -24}, { -1184, 264, -120}, { -968, 368, -88}, { -912, 216, -72}, { -952, 384, -48}, { -928, 328, -24}, { -904, 392, -64}, { -1016, 376, -56}, { -1024, 432, 0}, // 47 seconds { -1608, 584,...
/* * 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...
getenv(env_vars[i])
; if (!env) continue; if (is_valid_tmp_path(env)) { strncpy(buffer, env, length); return 0; } } /* If the environment doesn't say anything, try to use /tmp */ if (is_valid_tmp_path("/tmp")) { strncpy(buffer, "/tmp", length); return 0; } #else if (GetTempPath((DWORD)length, buffer)) return 0...
e 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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific languag...
bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpSet, GColorWhite)
; cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_set-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Test GCompOpTint, from same size to size. // Setup: // - Source is a 10x10 square, white. // - Destination is either a black or white square. // Result: // - When source is transparent or ti...
ta_cstring) + 1; \ cl_assert_equal_i(gap_le_get_advertising_data(&ad_data_out), data_length); \ cl_assert_equal_s((const char *) &ad_data_out, ad_data_cstring); \ } //! Helper to create BLEAdData from C strings. //! In reality, people will use ble_ad_create() and the ble_ad_set_* functions, //! but that's part of ...
cl_assert(gap_le_is_advertising_enabled())
; assert_ad_data("yo"); gap_le_assert_advertising_interval(advert_terms[0].min_interval_slots, advert_terms[0].max_interval_slots); regular_timer_fire_seconds(1); // Second term: cl_assert(gap_le_is_advertising_enabled()); assert_ad_data("yo"); gap_le_assert_advertis...
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 WARRANTIES OR CONDITIONS OF ANY...
MIN(remaining_length, job_length)
; job->impl->consume(job, consume_length); SessionSendQueueJob *next = (SessionSendQueueJob *)job->node.next; if (job_length == consume_length) { // job's done list_remove((ListNode *)job, (ListNode **)&session->send_queue_head, NULL); job->impl->free(job); } remaining_length -= co...
/* * 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...
{ int region_length = phone_number_length - local_number_length; const char *local_number = &phone_number[region_length]; // Remove dash, dot or space from region line if ((phone_number[region_length - 1] == '-') || (phone_number[region_length - 1] == '.') || (phone_number[region_lengt...
} // copy original to the output buffer for non-covered cases strncpy(formatted_phone_number, phone_number, length); }
-96}, { 1456, 368, -232}, { 1560, 288, -160}, { 1400, 312, -176}, { 1144, 456, -288}, { 952, 568, -344}, // 21 seconds { 808, 520, -152}, { 840, 664, -336}, { 880, 736, -424}, { 864, 736, -448}, { 928, 768, -464}, { 920, 728, -360}, { 1128, 688, -272}, { 1296, 64...
{ 960, 576, -296}, { 784, 504, -176}, { 784, 568, -320}, { 864, 608, -400}, { 904, 632, -432}, { 896, 672, -464}, { 880, 688, -360}, { 1136, 664, -216}, { 1312, 736, -304}, { 1432, 720, -224}, { 1600, 616, -72}, { 1752, 600, -64}, { 1560, 464, -120}, { 1216, 344, ...
{ 1296, 424, -96}, { 1064, 344, -104}, { 928, 288, -96}, { 856, 224, -80}, { 768, 184, -64}, { 664, 136, -64}, { 704, 112, -64}, { 872, 32, -72}, { 1136, -24, -40}, { 1512, 104, 8}, { 1368, 272, -176}, { 1504, 304, -240}, { 1512, 272, -80}, { 1272, 344, -168}, ...
nt8_t *key, int key_len, const uint8_t *val, int val_len); void test_app_glance_db__read_stale_glance_blob(void) { // Force the insertion of a stale glance blob (outdated version) const SerializedAppGlanceHeader app_glance = (SerializedAppGlanceHeader) { .version = APP_GLANC...
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), E_INVALID_ARGUMENT); } void test_app_glance_db__inserting_glance_with_invalid_arguments_fails(void) { // NULL UUID fails const AppGlance glance = {}; cl_assert_equal_i(app_glance_db_inse...
/* * 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_s(dstbuf, "zero1")
extra_size); if (!session) { kernel_free(msg_buffer); kernel_free(data_buffer); return NULL; } *session = (PLogSession) { .config = *config, .msg_buffer = msg_buffer, .data_buffer = data_buffer, .max_msg_size = max_msg_size, .max_data_size = max_data_size, .transport = transp...
rtc_get_time()
; event->has_created_time_utc = true; event->utc_to_local = time_util_utc_to_local_offset(); event->uuid = (pb_callback_t) { .funcs.encode = protobuf_log_util_encode_uuid, .arg = &uuid, }; PROTOBUF_LOG_DEBUG("Session: 0x%x - Adding event with type: %d", (int)session_ref, event->type); bool success...
new_state == ANCSClientStateIdle); case ANCSClientStatePerformingAction: return (new_state == ANCSClientStateIdle); case ANCSClientStateRequestedApp: return (new_state == ANCSClientStateIdle); case ANCSClientStateAliveCheck: return (new_state == ANCSClientStateIdle); cas...
if (s_ancs_client == NULL) { return; }
prv_reset_reassembly_context(); prv_notif_queue_next(); } static void prv_reset_and_next(void) { prv_reset_and_idle(); prv_notif_queue_pop(); prv_notif_queue_next(); } static void prv_reset_and_flush(void) { prv_reset_and_idle(); prv_notif_queue_reset(); } static void prv_reset_due_to_parse_error(voi...
EPTH_NAME}__radial_precise(void){ GContext ctx; test_graphics_context_init(&ctx, fb); uint32_t angle_start = TRIG_MAX_ANGLE / 8; uint32_t angle_end = angle_start + (TRIG_MAX_ANGLE / 4); GPointPrecise center = GPointPrecise(CENTER_OF_ORIGIN_RECT.x * 8, CENTER_OF_ORIGIN_RECT.y * 8); Fixed_S16_3 radius = (Fix...
TO_TRIG(270)
r, &GPoint(config->cassette_animation_x, 0), &GPoint(-4, 0))); Animation *cassette_bounceback = property_animation_get_animation( property_animation_create_bounds_origin(&data->cassette_container, &GPoint(-4, 0), &GPointZero)); animation_set_duration(cas...
music_get_playback_state()
== MusicPlayStatePaused) { prv_trigger_cassette_icon_switch(&data->image_pause, animated); } else { prv_trigger_cassette_icon_switch(&data->image_cassette, animated); } } static void prv_update_ui_state_skipping(MusicAppData *data, bool animated) { action_bar_layer_set_click_config_provider(&data->actio...
/* * 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...
{ // Event loop: while (1) { PebbleEvent event; sys_get_pebble_event(&event); if (event.type == PEBBLE_PROCESS_DEINIT_EVENT) { // We're done here. Return the app's main function. event_cleanup(&event); return; } event_service_client_handle_event(&event); prv_handle_even...
// ------------------------------------------------------------------------------------------------- void worker_launch_app(void) { sys_launch_app_for_worker(); }
oints. #include "text.h" #include "text_layout_private.h" #include "graphics.h" #include "graphics_private.h" #include "gtypes.h" #include "text_render.h" #include "text_resources.h" #include "utf8.h" #include "applib/fonts/codepoint.h" #include "applib/fonts/fonts.h" #include "kernel/ui/kernel_ui.h" #include "proce...
(&char_iter, &char_iter_state, text_box_params, start)
; Utf8IterState* utf8_iter_state = (Utf8IterState*) &char_iter_state.utf8_iter_state; bool success = prv_char_iter_next_start_of_word(&char_iter); if (!success) { // We couldn't find the next start of the word, just initialize to nothing word->start = start; word->end = start; return false; } ...
2); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_bottom_clipped.${BIT_DEPTH_NAME}.pbi")); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); prv_fi...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_top_clipped_aa.${BIT_DEPTH_NAME}.pbi"))
; prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT / 2); graphics_context_set_antialiased(&ctx, true); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_bot...
/* * 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...
DEFINE_SYSCALL(PreferredContentSize, preferred_content_size, void)
{ return system_theme_get_content_size(); }
///////////////////////////////////////////////////// //! Detected Workout static void prv_detected_workout_up_click_handler(ClickRecognizerRef recognizer, void *context) { WorkoutAppData *data = context; if (workout_service_takeover_activity_session(&data->ongoing_session)) { prv_prep_and_open_active_window(...
if (!activity_prefs_tracking_is_enabled()) { /// Health disabled text static const char *msg = i18n_noop("Enable Pebble Health in the mobile app to track workouts"); health_tracking_ui_show_message(RESOURCE_ID_HEART_TINY, msg, true); return; }
if (activity_prefs_get_workout_app_opened_version() != CURRENT_WORKOUT_APP_VERSION) { /// Workout app first use text static const char *msg = i18n_noop("Wear your watch snug and 2 fingers' width above " "your wrist bone for best results."); health_tracking_ui_show_...
DITIONS 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 "util/hdlc.h" #include <string.h> #include "stubs_passert.h" // Setup void test_hdlc__initialize(void) { } void test_hdlc__cleanu...
(data == HDLC_FLAG)
; } void test_hdlc__encode_decode(void) { const char *str = "this is a string with the special \x7e \x7d \x7e\x7d \x7d\x7e characters"; char buffer[100]; int write_idx = 0; for (int i = 0; i < strlen(str); i++) { char c = str[i]; if (hdlc_encode((uint8_t *)&c)) { buffer[write_idx++] = HDLC_ESCAPE...
ext, buffer_size, i18n_owner, active_window->workout_data); break; } case WorkoutMetricType_Distance: { GTextNodeText *number_text_node = health_util_create_text_node( HEALTH...
( i18n_get(units_string, i18n_owner), units_font, TEXT_COLOR, container)
no // files will be written on then flash. We could also try to force apps to // be flushed out of the FS in an attempt to free up space since they are // only being cached on the FS pfs_format(true); } // get us off to a good start by ensuring there is some pre-erased space on // the filesystem....
(true /* write erase headers */)
; } else { pfs_format(false /* write erase headers */); } } void pfs_command_dump_hdr(const char *page) { uint16_t pg = (uint16_t) atoi(page); if (pg > s_pfs_page_count) { prompt_send_response("ERROR"); return; } uint8_t hdr[FILE_NAME_OFFSET + 10]; prv_flash_read((uint8_t *)&hdr, sizeof(hdr)...
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; alarm_time <= current_time + SECONDS_PER_DAY * 3; i++) { if (last_alarm != alarm_time) { last_alarm = alarm_time; localtime_r(&alarm_time, local_alarm_time); ...
if (!s_alarms_enabled) { return; }
/* * 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...
(codepoint, ZERO_WIDTH_CODEPOINTS, ARRAY_LENGTH(ZERO_WIDTH_CODEPOINTS))
; } bool codepoint_is_latin(const Codepoint codepoint) { return (codepoint <= MAX_LATIN_CODEPOINT || (codepoint >= MIN_SYMBOLS_CODEPOINT && codepoint <= MAX_SYMBOLS_CODEPOINT)); } bool codepoint_is_emoji(const Codepoint codepoint) { // search for the codepoint in the list of nonstandard emoji c...
, "Rebooting to apply new firmware!"); boot_bit_set(BOOT_BIT_NEW_FW_AVAILABLE); services_set_runlevel(RunLevel_BareMinimum); system_reset(); } static void erase_fw(const uint32_t start_address) { // Erase flash flash_erase_sector_blocking(start_address); // Set everything high // Set up the firmware des...
app_state_set_user_data(data)
; push_window(data); } static void handle_deinit(void) { AppData *data = app_state_get_user_data(); app_free(data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* grenade_launcher_app_get_info() { static const PebbleProcessMdSystem s_app_info =...
down_handler_calls, h), 1); // Make sure the frame reached the "to" state cl_assert_equal_i(prv_last_update_distance(h), ANIMATION_NORMALIZED_MAX); // This should return NULL now if the animation got destroyed cl_assert(animation_private_animation_find(h) == NULL); // Make sure no animations exist cl_ass...
prv_count_handler_entries(&s_setup_handler_calls, a)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert(prv_count_handler_entries(&s_update_handler_calls, a) >= test_duration/MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handl...
/* * 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...
dialog_set_timeout(&data->finished_dialog.dialog, end_screen_timeout)
; simple_dialog_push(&data->finished_dialog, app_state_get_window_stack()); app_timer_cancel(data->timer); } static void prv_update_progress_text(ProgressUIData *data) { sniprintf(data->percent_done_text_buffer, sizeof(data->percent_done_text_buffer), "%u%%", data->percent_complete); layer_mark_d...
pdate_proc(&layer, &draw_text_single_line_wordwrap_clip_across_ny); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_ny.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wo...
setup_test_aa_sw(&ctx, fb, RECT_TEXT_2_0, RECT_TEXT_2_0, false, 1)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(DICT_OK == dict_serialize_tuplets_to_buffer( &tuplet, 1, (uint8_t *)&push_message->dictionary, &size))
; comm_session_send_data(comm_session_get_system_session(), LAUNCHER_MESSAGE_ENDPOINT_ID, (const uint8_t *)buffer, sizeof(buffer), COMM_SESSION_DEFAULT_TIMEOUT); } static bool prv_has_invalid_length(size_t expected, size_t actual) { if (actual < expected) { PBL_LOG(LOG_LEVEL_ERROR, "T...
uint8_t dest_data[bounds.size.w * bounds.size.h]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = src_bitmap->row_size_bytes, .info.format = GBitmapFormat1Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = src_bitmap->bounds }; // Image name descriptions // comptint_<cros...
(4, 4, 140, 55)
; const GPoint src_origin_offset = GPoint(39, 11); src_bitmap->bounds = (GRect) { { 37, 3}, { 63, 23 } }; bitblt_bitmap_into_bitmap_tiled_1bit_to_1bit(&dest_bitmap, src_bitmap, dest_rect, src_origin_offset, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(&d...
/* * 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 (behind_typical) { health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, 0, typical_fill); }
#endif if (data->current_steps) { health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_CURRENT_COLOR, 0, current_fill); } #if PBL_COLOR if (!behind_typical) { health_progress_bar_mark(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, typical_fill); } #else health_progress_bar_mark(ctx, &data...
-- // Sample captured: 2015-10-05 16:04:19 local AccelRawData *activity_sample_walk_100_pbl_25663_8(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25663_8 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 //> TEST_WEIGHT 1.0 ...
{ 1120, 160, -168}, { 1168, 424, -176}, { 1352, 352, -208}, { 1352, 272, -104}, { 1288, 376, -136}, { 872, 520, -200}, // 5 seconds { 816, 824, -72}, { 192, 656, -96}, { -32, 920, -200}, { 112, 792, -112}, { 40, 672, -56}, { -144, 608, -32}, { -232, 600, 8}, {...
{ 1144, 904, -192}, { 1144, 800, -144}, { 1248, 616, -112}, { 1352, 440, -120}, { 1096, 336, -96}, { 1080, 264, -112}, { 1256, 288, -136}, { 1480, 264, -112}, { 1272, 176, -48}, { 1168, 152, -136}, { 1112, 176, -208}, { 760, -328, -96}, { 808, -152, -56}, { 728, ...
/* * 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...
(!alerts_should_notify_for_type(AlertMobile))
; cl_assert(!alerts_should_notify_for_type(AlertReminder)); } void test_alerts__migration(void) { cl_assert(alerts_get_mask() == AlertMaskAllOn); alerts_set_mask(AlertMaskAllOnLegacy); cl_assert(alerts_get_mask() == AlertMaskAllOn); } void test_alerts__dnd_interruptions(void) { s_dnd_active = true; aler...
h_api_reset_for_test(void); TimerID flash_api_get_erase_poll_timer_for_test(void); status_t return_success(void) { return S_SUCCESS; } status_t return_error(void) { return E_ERROR; } status_t flash_impl_init(bool coredump_mode) { return S_SUCCESS; } void flash_impl_use(void) {} void flash_impl_release_many(u...
cl_assert_equal_i(erase_sector_begin_calls, 0)
; } void test_flash_api__erase_sector_calls_right_impl_func(void) { flash_erase_sector(0, callback, NULL); cl_assert_equal_i(erase_sector_begin_calls, 1); cl_assert_equal_i(erase_subsector_begin_calls, 0); } /////////////////////////////////////////////////////////////////////// status_t erase_status_return_er...
lImpl)); *test_reel_impl = (KinoReelImpl) { .destructor = prv_destructor, .set_elapsed = prv_elapsed_setter, .get_elapsed = prv_elapsed_getter, .get_duration = prv_duration_getter }; test_reel = kino_reel_custom_create(test_reel_impl, test_reel_data); cl_assert(test_reel != NULL); test_playe...
cl_assert_equal_i(animation_is_scheduled(animation), false)
32, -264}, { 1016, 24, -288}, { 1136, 48, -304}, { 1000, 88, -328}, { 848, 112, -280}, { 832, 96, -216}, { 960, 152, -192}, { 1088, 208, -112}, { 1104, 288, -96}, { 1232, 344, -96}, { 1408, 456, -104}, { 1144, 592, -48}, { 1352, 464, -160}, { 872, 400, -216}, // ...
{ 960, 192, -184}, { 1080, 240, -176}, { 1216, 232, -208}, { 1192, 312, -240}, { 1176, 424, -176}, { 1480, 568, -184}, { 1072, 488, -64}, { 1128, 552, -64}, { 1200, 688, -48}, { 960, 392, -48}, { 1104, 408, -88}, { 1312, 416, -48}, { 1336, 192, 24}, { 1224, 72, 48...
{ 1056, 56, 32}, { 1016, 24, 8}, { 1200, 48, -80}, { 1296, 96, -24}, { 1056, 56, -32}, { 1192, -72, -48}, { 1040, -224, 16}, // 40 seconds { 888, -256, -72}, { 1184, -208, 32}, { 1072, -32, -104}, { 1192, -24, -112}, { 1216, 16, -144}, { 1040, 96, -168}, { 88...
cked_lock); } static void prv_unlock(void) { if (mcu_state_is_isr()) { // assume we're in an ISR for the UART and don't need to worry about being blocked return; } mutex_unlock_recursive(s_blocked_lock); } static void prv_enable_dma(void) { PBL_ASSERTN(!s_dma_enabled); s_dma_enabled = true; uart_s...
(DEFAULT_BAUD)
; periph_config_release_lock(); prv_initialize_exti(); } static void prv_set_baudrate(uint32_t baudrate, bool force_update) { if ((baudrate != s_baudrate) || force_update) { PBL_LOG(LOG_LEVEL_DEBUG, "Changing accessory connector baud rate to %"PRIu32, baudrate); prv_initialize_uart(baudrate); if (s...
HealthAggregationAvg, HealthServiceTimeScopeOnce); char temp[64]; snprintf(temp, sizeof(temp), "%s: min: %"PRIi32", max: %"PRIi32", avg: %"PRIi32" \n", ranges[i].desc, min, max, avg); APP_LOG(APP_LOG_LEVEL_DEBUG, "%s", temp); prv_safe_strcat(data->debug_card.dialog_text, temp, sizeo...
(data->debug_window, data)
; window_set_window_handlers(data->debug_window, (WindowHandlers) { .load = debug_window_load, .unload = debug_window_unload, }); // Results window data->results_window = window_create(); window_set_background_color(data->results_window, GColorBlack); window_set_user_data(data->results_window, data...
trlen(", ") #define BUFFER_LEN_DATETIME (BUFFER_LEN_DATE + BUFFER_LEN_TIME + 2) static void prv_tm_from_js_date(jerry_value_t date, struct tm *tm) { JS_VAR js_seconds = jerry_get_object_getter_result(date, "getSeconds"); JS_VAR js_minutes = jerry_get_object_getter_result(date, "getMinutes"); JS_VAR js_hours = j...
{ JS_VAR second = jerry_get_object_field(options, "second"); JS_VAR minute = jerry_get_object_field(options, "minute"); JS_VAR hour = jerry_get_object_field(options, "hour"); JS_VAR day = jerry_get_object_field(options, "day"); JS_VAR month = jerry_get_object_field(options, "month"); JS_VAR year = jerry_get...
{.field = month, .value = ROCKY_DATE_FORMAT_NUMERIC, .format = ToStringFormatMonthNumeric}, {.field = month, .value = ROCKY_DATE_FORMAT_2DIGIT, .format = ToStringFormatMonth2Digit}, {.field = month, .value = ROCKY_DATE_FORMAT_SHORT, .format = ToStringFormatMonthShort}, {.field = month, .value = ROCKY_D...
/* * 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...
BITS_BETWEEN(0, 7)
, erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_sector_0(void) { cl_assert(system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_16KB_sectors(void) { cl_assert(system_flas...
rv_num_rows_cb(SettingsCallbacks *context) { SettingsBluetoothData *data = (SettingsBluetoothData *) context; return list_count(data->remote_list_head) + 1; } static int16_t prv_row_height_cb(SettingsCallbacks *context, uint16_t row, bool is_selected) { #if PBL_RECT # if CAPABILITY_HAS_BUILTIN_HRM int heart_rat...
settings_remote_menu_push(data, remote)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return NULL; }
BTDeviceInternal gatt_client_characteristic_get_device(BLECharacteristic characteristic_ref) { return (BTDeviceInternal) { .address.octets = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, }, }; } static void (*s_launcher_task_callback)(void *data); static void *s_launcher_task_callback_data; void launcher_...
x + 3, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 6, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 0, p.y + 1)); graphics_draw_pixel(ctx, GPoint(p.x + 1, p.y + 1)...
(&ctx, false, 1)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_clip_rect.${BIT_DEPTH_NAME}.pbi")); }
-------------------------------------------------------------------------------------- // Test a spawn animation with a component that has a play count of 0 void test_animation__spawn_with_0_component(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b = 500; const int play_count...
animation_schedule(seq)
; // Start prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
snprintf(data->ambient_reading, AMBIENT_READING_STR_LEN, "%"PRIu32, level)
; data->latest_als_value = level; } static void prv_timer_callback(void *cb_data) { AmbientLightAppData *data = app_state_get_user_data(); prv_update_reading(data); layer_mark_dirty(window_get_root_layer(data->window)); app_timer_register(500, prv_timer_callback, NULL); } static void prv_record_als_readin...