prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
comm_session_has_capability(session, CommSessionExtendedMusicService)
) { if (read_iter + sizeof(uint32_t) <= msg + length) { uint32_t track_duration_ms = *(uint32_t *)read_iter; music_update_track_duration(track_duration_ms); } // TODO: Do something with this info // read_iter += 4; // if (read_iter + sizeof(uint16_t) <= msg + length) { // uint16_t ...
/* * 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(buffer, buffer_size, "%s%s", distance_buffer, units_string)
; } static void prv_set_avg(char *buffer, size_t buffer_size, int32_t daily_avg, void *i18n_owner) { int pos = 0; pos += snprintf(buffer, buffer_size, PBL_IF_ROUND_ELSE("%s\n", "%s"), i18n_get("30 DAY AVG", i18n_owner)); if (daily_avg > 0) { snprintf(buffer + pos, buffer_size - pos, " %"P...
andjaeger, kevin tongue minim tri-tip " "ground round dolore. Ham hock tongue swine, cillum jowl pancetta fugiat " "deserunt sirloin fatback tenderloin culpa andouille. Incididunt qui bacon " "nostrud ham hock adipisicing et ham. Ullamco esse eu capicola, ea culpa irure " "meatball proid...
(PostMessageKeyChunk, (const uint8_t *) chunk, expected_size)
); // Compare with hard-coded byte array, to catch accidental changes to the ABI: const uint8_t raw_bytes_v1[] = { 0x0a, 0x00, 0x00, 0x80, '{', '"', 'x', '"', }; cl_assert_equal_i(sizeof(raw_bytes_v1), expected_size); cl_assert_equal_m(raw_bytes_v1, buffer, expected_size); prv_rcv_app_me...
(animation_state * (GRID_CELL_PADDING + DISP_ROWS)); s_ctx.draw_state.drawing_box.origin = GPoint(x_offset, y_offset); prv_render_action_menu_window(root_level, selected_index, animation_state, additional_crumbs); } } void prv_prepare_canvas_and_render_acti...
(thin_values)
); action_menu_level_set_display_mode(root_level, ActionMenuLevelDisplayModeThin); for (size_t i = 0; i < ARRAY_LENGTH(thin_values); i++) { action_menu_level_add_action(root_level, thin_values[i], prv_noop_action_callback, NULL); } const unsigned int selected_index = 1; prv_prepare_canvas_and_render_acti...
{ Layer parent, child_a, child_b; Layer *layers[] = {&parent, &child_a, &child_b}; for (int i = 0; i < ARRAY_LENGTH(layers); ++i) { layer_init(layers[i], &GRectZero); } layer_set_frame(&parent, &GRect(0, 0, 20, 20)); layer_set_frame(&child_a, &GRect(0, 0, 10, 10)); layer_set_frame(&child_b, &GRect(2, ...
_INT_MAP_1_INT2_FIFO_WATERMARK; uint8_t int_en_mask = BMI160_INT_EN_1_DRDY_EN | BMI160_INT_EN_1_FWM_EN; uint8_t map_val; uint8_t int_en_val; if (!enable_int) { map_val = int_en_val = 0; } else if (!use_fifo) { map_val = BMI160_INT_MAP_1_INT2_DATA_READY; int_en_val = BMI160_INT_EN_1_DRDY_EN;...
BMI160_DBG("ACC_CONF = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_ACC_CONF))
; } static void prv_disable_shake_detection(void) { // don't worry about the configuration registers but disable interrupts // generated for taps from the accel uint8_t dis_mask = BMI160_INT_MAP_ANYMOTION_EN_MASK; prv_read_modify_write(BMI160_REG_INT_MAP_0, 0, dis_mask); dis_mask = (BMI160_INT_EN_0_ANYMOTI...
/* * 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->impl->destructor(data->context)
in, BTDeviceInternal *device_in, char *name_in, SMIdentityResolvingKey *irk_out, BTDeviceInternal *device_out, char *name_out) { if (irk_out && irk_in) { *irk_out =...
if (address_out) { *address_out = address; }
return true; } static bool prv_get_first_ancs_bonding_itr(SettingsFile *file, SettingsRecordInfo *info, void *context) { // check entry is valid if (info->val_len == 0 || info->key_len != sizeof(BTBondingID)) { return true; // continue iterating } BTBondingID ...
) { return false; } layer = layer->parent; } return true; } typedef struct ProcessTouchCtx { Recognizer *triggered; const TouchEvent *touch_event; } ProcessTouchCtx; T_STATIC bool prv_dispatch_touch_event(Recognizer *recognizer, void *context) { ProcessTouchCtx *ctx = context; // Skip recogn...
(manager, prv_cancel_or_fail_recognizer, NULL)
; } T_STATIC void prv_cancel_layer_tree_recognizers(RecognizerManager *manager, Layer *top_layer, Layer *bottom_layer) { prv_process_layer_tree_recognizers(manager, top_layer, bottom_layer, prv_cancel_or_fail_recognizer); } static ...
stable if (s_manager_state.sensor_stable) { // If we just went on-wrist or off-wrist, reset the stable state bool off_wrist_now = (data->hrm_quality == HRMQuality_OffWrist); if (off_wrist_now != s_manager_state.off_wrist_when_stable) { s_manager_state.sensor_stable = false; s_manager_state.se...
("Need sensor on again in %"PRIu32" sec", remaining_ms / MS_PER_SECOND)
; turn_sensor_on = (remaining_ms <= 0); } if (turn_sensor_on && !hrm_is_enabled(HRM)) { // Turn on the sensor now HRM_LOG("Turning on HR sensor"); s_manager_state.accel_state = sys_accel_manager_data_subscribe( ACCEL_SAMPLING_25HZ, prv_handle_accel_data, NULL, PebbleTask_NewT...
/* * 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 USE_SMARTSTRAP prv_state_deinit(); #endif }
ess_event_queue; break; case PebbleTask_App: queue = app_manager_get_task_context()->to_process_event_queue; break; case PebbleTask_KernelBackground: queue = NULL; break; default: WTF; } return queue; } void pebble_task_create(PebbleTask pebble_task, TaskParameters_t...
(region_config, region_ptrs)
; vTaskAllocateMPURegions(xTaskGetIdleTaskHandle(), region_config); }
p_size_for_data(size, format); bitmap->addr = applib_zalloc(data_size); if (bitmap->addr) { bitmap->info.is_bitmap_heap_allocated = true; return true; } return false; } static GBitmap* prv_gbitmap_create_blank(GSize size, GBitmapFormat format) { GBitmap *bitmap = prv_allocate_gbitmap(); if (bitmap...
if (src_bitmap && gbitmap_get_format(src_bitmap) == GBitmapFormat1Bit) { // Allocate the full size of the image up until the end of the bounds. // This eliminates edge cases where the bounds may start within a byte, // and not enough space would be allocated. This allows us to do all copying // from { 0...
return bitmap; } bool gbitmap_init_with_resource(GBitmap* bitmap, uint32_t resource_id) { ResAppNum app_resource_bank = sys_get_current_resource_num(); return gbitmap_init_with_resource_system(bitmap, app_resource_bank, resource_id); } GBitmap *gbitmap_create_with_resource(uint32_t resource_id) { ResAppNum a...
get_next_cursor_position(temp_address, registry); } while (temp_address != registry->cursor->begin); } //////////////////////////////////////////////////////////// // Registry data structure //////////////////////////////////////////////////////////// static int registry_get_next_available_index(Registry* registry)...
{ bool uuid_match = memcmp(r->uuid, uuid, UUID_SIZE_BYTES) == 0; if (uuid_match) { r->active = false; registry->is_different_from_flash = true; } }
} } int registry_private_remove(const char* key, const uint8_t key_length, const uint8_t* uuid, Registry* registry) { const int idx = record_get_index(key, key_length, uuid, registry); PBL_ASSERTN(idx < registry->num_records); if (idx >= 0) { Record* r = registry->records + i...
ecentApp *app = circular_cache_get(&s_recent_apps.cache, &install_id); if (app) { const int32_t time_since_activity = time_get_uptime_seconds() - app->last_activity; if (app->can_expire && (time_since_activity < VISIBILITY_ON_ACTIVITY_TIMEOUT_SECONDS)) { // The recent app should eventually expir...
list_remove((ListNode *)&iter->node, &s_head_callback_node_list, NULL)
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 <inttypes.h> #include <stdio.h> #include <string.h> #include "applib/app.h" #include "applib/app_timer.h"...
window_set_click_config_provider(&dialog->window, prv_config_provider)
; // The assumption is that this app is launched when the charger is connected // and the shutdown menu item is selected. data->was_plugged = true; data->last_dialog_state = DialogState_Uninitialized; battery_state_service_subscribe(prv_battery_state_handler); // Handle the edge-case where the charger is d...
MIN(dst_row_info.max_x, max_x)
; const int16_t dst_pixels = dst_max_x - dst_min_x + 1; const int16_t src_min_x = MAX(src_row_info.min_x, bitmap->bounds.origin.x); const int16_t src_max_x = MIN(src_row_info.max_x, max_x); const int16_t src_pixels = src_max_x - src_min_x + 1; const int16_t x_offset = src_min_x...
port for non-antialiased rounded rect #if SCREEN_COLOR_DEPTH_BITS == 8 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersBottom); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill...
prv_clamp_corner_radius(GSize(9, 10), GCornersAll, 4)
, 4); cl_assert_equal_i(prv_clamp_corner_radius(GSize(10, 10), GCornersAll, 4), 4); } #define BOX_SIZE 10 #define CLIP_RECT_DRAW_BOX GRect(10, 10, 140, 30) #define CLIP_RECT_CLIP_BOX GRect(10, 10, 120, 2*BOX_SIZE + 4) #define CLIP_RECT_RECT_BOX GRect(0, 0, BOX_SIZE, BOX_SIZE) #define CLIP_OFFSET 40 // yoffset if use...
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 in writing, software ...
{ #if !defined(TARGET_QEMU) // TODO: reenable // PBL_ASSERTN(mic_start(MIC, &prv_audio_data_handler, NULL, s_frame_buffer, s_frame_size)); #endif PBL_LOG(LOG_LEVEL_INFO, "Recording"); }
static void prv_send_event(VoiceEventType event_type, VoiceStatus status, PebbleVoiceServiceEventData *data) { PebbleEvent event = { .type = PEBBLE_VOICE_SERVICE_EVENT, .voice_service = { .type = event_type, .status = status, .data = data, } }; event_put(...
v_fixed_s32_16_getter(Fixed_S32_16 *p) { return *p; } // -------------------------------------------------------------------------------------- static void prv_uint32_setter(int32_t *p, uint32_t value) { *p = value; } static uint32_t prv_uint32_getter(uint32_t *p) { return *p; } // --------------------------...
cl_assert_equal_i(s_stopped_handler_calls.num_calls, 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...
{ uint8_t testbuf[8] = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, }; uint8_t destbuf[8]; memcpy(destbuf+0, testbuf, 4); memmove(destbuf+2, destbuf+0, 4); cl_assert_equal_m(testbuf, destbuf+2, 4); cl_assert_equal_m(testbuf, destbuf+0, 2); }
valid); cl_assert_equal_i(pairing_info->local_encryption_info.ediv, pairing_info_out.local_encryption_info.ediv); cl_assert_equal_i(pairing_info->local_encryption_info.div, pairing_info_out.local_encryption_info.div); cl_assert_equal_i(pairing_info->identity.opaque.opaque_6...
(strcmp(device_name_out, device_name), 0)
; cl_assert_equal_i(memcmp(&out_addr, &addr, sizeof(addr)), 0); cl_assert_equal_i(memcmp(&link_key_out, &link_key_out, sizeof(link_key)), 0); cl_assert_equal_i(platform_bits_out, 0xaa); shared_prf_storage_erase_bt_classic_pairing_data(); cl_assert_equal_b(shared_prf_storage_get_bt_classic_pairing_data(NULL, ...
{ callback_context = context; callback_status = status; }
void test_flash_api__initialize(void) { callback_context = NULL; callback_status = -12345; get_sector_base_calls = 0; get_subsector_base_calls = 0; erase_subsector_begin_calls = 0; erase_sector_begin_calls = 0; get_erase_status_calls = 0; get_erase_status_fn = return_success; blank_check_subsector_...
void) { BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk(); BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_device(); // Register connection intent: BTErrno e = gap_le_connect_connect_by_bonding(bonding_id, true /* auto_reconne...
gap_le_connect_connect(&device, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp)
; cl_assert_equal_i(e, BTErrnoOK); prv_fake_connect(&device, true /* is_master*/); // Air-plane mode: gap_le_connect_deinit(); // Verify (only) the app task got a (virtual) connection event: prv_assert_client_event(&device, false /* connected */, (1 << PebbleTask_App), GAPLEConn...
return s_hr_quality_weights_x100[i].weight_x100; } } return 0; } // -------------------------------------------------------------------------------------------- HRZone activity_metrics_prv_get_hr_zone(void) { ActivityState *state = activity_private_state(); return state->hr.metrics.current_hr_zone; ...
(old_history.utc_sec)
; int old_age = state->cur_day_index - day; // If this is resting kcalories, the default for each day is not 0 if (metric == ActivityMetricRestingKCalories) { uint32_t full_day_resting_calories = activity_private_compute_resting_calories(MINUTES_PER_DAY); for (int i = 0; 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...
rocky_runtime_context_deinit()
; rocky_global_deinit(); } void test_rocky_api_global__global(void) { char test_object[] = "var t = typeof _rocky"; // global doesn't exist in plain Jerry context EXECUTE_SCRIPT(test_object); ASSERT_JS_GLOBAL_EQUALS_S("t", "undefined"); // rocky_global_init() injects global... static const RockyGlobalA...
cribe(BUTTON_ID_SELECT, 1000, prv_select_long_click_handler, NULL); window_set_click_context(BUTTON_ID_SELECT, data); window_single_click_subscribe(BUTTON_ID_BACK, prv_back_button_single_click_handler); window_set_click_context(BUTTON_ID_BACK, data); if (s_notification_window_data.is_modal) { Window *wind...
{ // nothing to do here return; }
const GRect icon_rect = gbitmap_get_bounds(&data->dnd_icon); #if PBL_ROUND GRect new_status_frame = data->status_layer.layer.frame; const int16_t icon_text_horizontal_spacing = 4; const int16_t window_bounds_width = window_get_root_layer(&data->window)->bounds.size.w; const int16_t title_width = status_lay...
/* * 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...
{ *device_out = (BTDeviceInternal) {}; device_out->is_random_address = dialog_utils_dialog_is_addr_type_random(addr->addr_type); memcpy(&device_out->address, &addr->addr, sizeof(device_out->address)); }
eDLSSample minute_data[num_minutes]; prv_create_test_data(num_minutes, minute_data); // Call the minute handler, which computes the minute stats and saves them to data logging // as well as to the sleep PFS file. prv_feed_minute_data(num_minutes, minute_data, false /*simulate_bg_delays*/); // Retrieve all o...
{ // Ask for the last ALG_MINUTES_PER_RECORD minutes of data uint32_t num_records = ALG_MINUTES_PER_FILE_RECORD; time_t start = oldest_to_fetch; HealthMinuteData received_records[ALG_MINUTES_PER_FILE_RECORD]; activity_algorithm_get_minute_history(received_records, &num_records, &start); cl_ass...
test_alarm__alarm_create_recurring_daily(void) { AlarmId id; id = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule); id = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KI...
(&(AlarmInfo) { .hour = 5, .minute = 14, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &custom_schedule3 })
; prv_assert_alarm_config(id, 5, 14, false, ALARM_KIND_CUSTOM, custom_schedule3); // FIXME: bool custom_schedule4[7] = {false, false, false, false, false, false, false}; id = alarm_create(&(AlarmInfo) { .hour = 6, .minute = 14, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &custom_schedule4 }); prv_assert_ala...
menu_layer_id)); cl_assert_equal_b(false, app_install_is_hidden(CRAZY_ID)); } void test_app_install_manager__is_from_system(void) { cl_assert_equal_b(true, app_install_id_from_system(-1000000)); cl_assert_equal_b(true, app_install_id_from_system(-1)); cl_assert_equal_b(false, app_install_id_from_system(0)); ...
cl_assert(true == app_install_entry_is_hidden(&entry))
; // simulates multiple messages from app for (int i = 0; i < 10; i++) { // visible after communication app_install_mark_prioritized(sports_id, true /* can_expire */); cl_assert(false == app_install_entry_is_hidden(&entry)); } // wait 10 minutes and ensure hidden fake_rtc_init(0, INIT_TIME + (10...
(current_offset - offset + marker.length + CHUNK_META_SIZE); } } else { // Seeking for data up to but not including FCTL or IDAT chunk (ie. image metadata) if (marker.chunk_type == CHUNK_IDAT || marker.chunk_type == CHUNK_FCTL) { if (found_actl) { *found_actl = actl_chunk_found; ...
for (uint16_t i = 0; i < palette_entries; i ++) { // If the color value matches transparent_gray, color is transparent if (transparent_gray >= 0 && i == transparent_gray) { palette[i] = GColorClear; } else { // Only have 2 bits per channel, but attempt to make grayscale 4-bit work // whi...
// Return the converted palette and number of entries *palette_out = palette; return palette_entries; } static uint16_t prv_gbitmap_png_create_palette_for_color(upng_t *upng, GColor8 **palette_out) { if (!palette_out) { return 0; } rgb *rgb_palette = NULL; uint16_t palette_entries = upng_get_palet...
.input = { .gpio = GPIOA, .gpio_pin = GPIO_Pin_1, }, }; static const VoltageMonitorDevice VOLTAGE_MONITOR_TEMPERATURE_DEVICE = { .adc = ADC1, .adc_channel = ADC_Channel_TempSensor, .clock_ctrl = RCC_APB2Periph_ADC1, // .input not applicable }; VoltageMonitorDevice * const VOLTAGE_MONITOR_ALS = &VO...
voltage_monitor_device_init(VOLTAGE_MONITOR_ALS)
; voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY); }
*buf_end) { PBL_ASSERTN(attr_list != NULL); PBL_ASSERTN(buffer != NULL); PBL_ASSERTN(buf_end != NULL); uint8_t *buf_start = buffer; for (int i = 0; i < attr_list->num_attributes; i++) { SerializedAttributeHeader *attribute = (SerializedAttributeHeader *)buffer; buffer += sizeof(SerializedAttributeH...
{ // shallow copy the attribute memcpy(dest, src, sizeof(Attribute)); // deep copy strings into the buffer return prv_deep_copy_attribute(dest, src, buffer, buffer_end); }
/* * 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_Pulse), RESOURCE_ID_VIBE_SCORE_PULSE); }
void test_vibe_score_info__get_resource_id_returns_invalid_for_invalid_score(void) { 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(VibeS...
rm_id, data->callback_context); app_window_stack_remove(&data->day_picker_window, true); } else { alarm_set_kind(data->alarm_id, data->alarm_kind); data->complete_callback(EDITED, data->alarm_id, data->callback_context); app_window_stack_pop(true); } } //////////////////////////////////////////////...
menu_layer_get_layer(&data->day_picker_menu_layer)
); if (!alarm_get_kind(data->alarm_id, &data->alarm_kind)) { data->alarm_kind = ALARM_KIND_JUST_ONCE; } menu_layer_set_selected_index(&data->day_picker_menu_layer, (MenuIndex) { 0, prv_alarm_kind_to_index(data->alarm_kind) }, MenuRowAlignCenter, ...
/* * 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_APB1Periph_PWR, ENABLE)
; PWR_BackupAccessCmd(ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, DISABLE); if (!boot_bit_test(BOOT_BIT_INITIALIZED)) { RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, BOOT_BIT_INITIALIZED); } } void boot_bit_set(BootBitValue bit) { uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR)...
width_px, 5); cl_assert_equal_i(glyph->header.height_px, 12); uint8_t glyph_size_bytes = glyph_get_size_bytes(glyph); cl_assert_equal_m(wildcard_bytes, glyph->data, glyph_size_bytes); } void test_text_resources__test_gothic_wildcard(void) { uint8_t wildcard_bytes[] = {0xff, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x83, ...
(0, gothic_18_handle, 0, &s_font_info)
k, // we only check it once every HRM_CHECK_SENSOR_DISABLE_COUNT times if (++s_manager_state.check_disable_counter >= HRM_CHECK_SENSOR_DISABLE_COUNT) { s_manager_state.check_disable_counter = 0; system_task_add_callback(prv_update_hrm_enable_system_cb, NULL); } unlock: mutex_unlock_recursive(s_manager_s...
{ prv_remove_and_free_subscription(state); system_task_add_callback(prv_update_hrm_enable_system_cb, NULL); success = true; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ WorkoutCountdownWindow *countdown_window = app_zalloc_check(sizeof(WorkoutCountdownWindow)); countdown_window->start_workout_cb = start_workout_cb; countdown_window->activity_type = type; Window *window = &countdown_window->window; window_init(window, WINDOW_NAME("Workout Countdown")); window_set_user_d...
ytes_sent(CommSession *session, uint16_t length) { } bool comm_session_is_valid(const CommSession *session) { if (!session) { return false; } return (s_valid_session == session); } void comm_session_send_next(CommSession *session) { } // Helpers ////////////////////////////////////////////////////////////...
cl_assert_equal_i(0, comm_session_send_queue_copy(s_valid_session, 0, sizeof(data_out), data_out))
; } void test_session_send_queue__copy_less_than_head_job_zero_offset(void) { int num_jobs = 3; prv_add_jobs(num_jobs); uint8_t data_out[2]; memset(data_out, 0, sizeof(data_out)); cl_assert_equal_i(sizeof(data_out), comm_session_send_queue_copy(s_valid_session, 0, sizeof(data_out), data_...
h_db_get_typical_value(ActivityMetricActiveKCalories, Monday, &val_out)); cl_assert(!health_db_get_typical_value(ActivityMetricDistanceMeters, Monday, &val_out)); } void test_health_db__sleep_data(void) { const char *key = "monday_sleepData"; cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), ...
health_db_insert((uint8_t *)entries[i].key, strlen(entries[i].key), (uint8_t *)entries[i].val, strlen(entries[i].val))
, S_SUCCESS); ActivityMetricAverages averages; health_db_get_typical_step_averages(i, &averages); int idx = i * 10; uint16_t val_expected = ((uint16_t *)entries[i].val)[idx]; cl_assert_equal_i(averages.average[idx], val_expected); } } void test_health_db__monthly_averages(...
dow_get_user_data(layer_get_window(layer)); WorkoutMetricType metric_type = WorkoutMetricType_None; if (layer == &active_window->top_metric_layer) { metric_type = active_window->top_metric; } else if (layer == &active_window->middle_metric_layer) { metric_type = active_window->middle_metric; } GColo...
active_window->workout_controller->is_paused()
; } if (active_window->workout_controller) { active_window->workout_controller->pause(!is_paused); } prv_update_ui(active_window); } static void prv_handle_stop_button(WorkoutActiveWindow *active_window) { bool is_paused = false; bool can_stop = false; if (active_window->workout_controller) { ...
r(GContext *ctx, GBitmap *buffer) { PBL_ASSERTN(ctx); ctx->lock = false; framebuffer_dirty_all(ctx->parent_framebuffer); return true; } void test_simple_dialog__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_graphics_context_init(&s_ctx, f...
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))
_sec = mktime(&start_tm); rtc_set_time(utc_sec); // Add a Sleep session const time_t time_elapsed = (120 * SECONDS_PER_MINUTE); ActivitySession sleep_session = { .start_utc = utc_sec - time_elapsed, .length_min = time_elapsed, .type = ActivitySessionType_Sleep, .ongoing = true, }; activity_...
(activity_private_state()->hr.weights, 100, num_samples)
; for (int i = 0; i < num_minutes; i++) { prv_minute_system_task_cb(NULL); } } static bool prv_is_hr_elevated(void) { return activity_private_state()->hr.metrics.is_hr_elevated; } void test_activity__update_time_in_hr_zones(void) { int32_t zone1_minutes, zone2_minutes, zone3_minutes; activity_start_tr...
gattc_read_by_uuid(conn_idx, start_h, end_h, uuid); prv_pop_if_failing_rv(conn_idx, rv); return rv; } ble_error_t gatt_wrapper_write(uint16_t conn_idx, uint16_t handle, uint16_t length, const uint8_t *value, uintptr_t context_ref, GattReqSource source) { GATT_LOG_DEBUG("gatt_wrapp...
{ case GattRespDestHost: hc_endpoint_gatt_send_write_complete(&addr, evt->handle, status, context_ref); break; case GattRespDestController: PBL_ASSERTN(context_ref); ((gatt_wrapper_write_cb) context_ref)(evt); break; default: break; }
} void gatt_wrapper_handle_notification(const ble_evt_gattc_notification_t *evt) { BTDeviceInternal addr; Connection *conn = connection_by_idx_check(evt->conn_idx); connection_get_address(conn, &addr); hc_endpoint_gatt_send_notification(&addr, evt->handle, evt->length, evt->value); } void gatt_wrapper_handle...
ses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations...
return false; } unsigned int num_note_types = prv_vibe_score_get_num_note_types(notes_attribute); if (notes_attribute->length != num_note_types * sizeof(VibeNote)) { return false; } VibeNoteIndex *pattern_list = prv_vibe_score_get_pattern_list(pattern_attribute); for (unsigned int i = 0; i < prv_v...
VibeScore *vibe_score_create_with_resource_system(ResAppNum app_num, uint32_t resource_id) { uint32_t data_size; if (!prv_vibe_score_resource_is_valid(app_num, resource_id, VIBE_SIGNATURE, &data_size)) { return NULL; } VibeScore *vibe_score = applib_zallo...
, 72, 176}, { 728, 104, 80}, { 712, 48, 136}, { 704, 56, 80}, { 784, 8, 48}, { 1032, 80, -8}, { 1320, -104, 136}, { 2016, -48, 304}, { 1336, 496, -208}, // 5 seconds { 856, 384, -296}, { 848, 136, 88}, { 768, 160, 120}, { 720, 176, 96}, { 760, 184, 216}, { 824...
{ 840, 272, 64}, { 816, 264, 136}, { 800, 336, 88}, { 744, 328, 64}, { 704, 328, -8}, { 880, 352, -24}, { 1096, 328, 8}, { 1176, 304, -8}, { 1656, 208, 128}, { 1664, 288, 200}, { 1080, 320, 96}, { 952, 280, 80}, // 11 seconds { 1128, 128, 200}, { 1048, 80, 208...
{ 680, 16, 24}, { 624, 24, 24}, { 640, 8, 8}, { 856, -16, 32}, { 1064, 24, -88}, { 1704, -176, 216}, { 1832, 32, 272}, { 1264, 552, -312}, { 1048, 424, -224}, { 872, 328, -120}, { 792, 208, 24}, { 848, 208, 40}, { 848, 288, 56}, { 824, 384, -32}, { 776, 328, ...
GAPLEConnection * prv_find_connection_by_gatt_id(uintptr_t connection_id) { return (GAPLEConnection *) list_find(&s_connections->node, prv_list_filter_by_gatt_id, (void *) connection_id); } static bool prv_list_filter_for_addr(ListNode *fo...
gatt_client_cleanup_discovery_jobs(connection)
; list_remove(&connection->node, (ListNode **) &s_connections, NULL); bt_conn_mgr_info_deinit(&connection->conn_mgr_info); kernel_free(connection->connection_parameter_sets); kernel_free(connection->pairing_state); kernel_free(connection->device_name); kernel_free(connection->irk); kernel_free(connection...
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 KIND, either express or implied. * See the License for the spe...
if ((*countdown)-- == 0) { return_status = FLASH_ERROR_OPERATION; }
} void test_system_flash__handle_erase_error_mid_operation(void) { int countdown = 3; cl_assert(!system_flash_erase(FLASH_BASE, 512 KiB, error_in_middle_cb, &countdown)); cl_assert(flash_locked); cl_assert_(countdown <= 0, "Callback not called enough times"); } void malloc_flash_data(uint32_t si...
; ppogatt_close(client); cl_assert_equal_p(NULL, ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid)); } void test_ppogatt__missing_inbound_packet(void) { test_ppogatt__open_session_when_found_pebble_app(); // Receive data: prv_receive_short_data_fragment(s_characteristics[0][PPoGATTCharacteristicData], ...
(transport, s_short_data_fragment, sizeof(s_short_data_fragment))
, true); ppogatt_send_next(transport); prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment)); } } void test_ppogatt__handle_client_disappearing_for_send_callback(void) { // ppogatt_send_next() is called from ...
AnimationLegacy2 *animation_legacy2_b) { return serial_distance32(animation_legacy2_a->abs_start_time_ms, animation_legacy2_b->abs_start_time_ms); } static AnimationLegacy2Scheduler* animation_legacy2_scheduler_data_for_app_ctx_idx( AppTaskC...
(&animation->list_node, &animation_legacy2_scheduler->head, 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...
{ fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); const GContextInitializationMode context_init_mode = GContextInitializationMode_System; graphics_context_init(&s_ctx, fb, context_init_mode); framebuffer_clear(fb); // Setup resources fake_spi_flash_init(0, 0x100...
void test_weather_app_layout__cleanup(void) { free(fb); } // Helpers ////////////////////// static void prv_create_layout_for_forecast(const WeatherLocationForecast *forecast, WeatherAppLayout *layout, Window *window) { window_init(window, WINDOW_NAME("Weather")); we...
/* * 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((ReliablePacket){0}.i) == 6, "sizeof ReliablePacket.i is wrong")
ute = config.minute, .is_disabled = config.is_disabled, .kind = config.kind, .is_smart = config.is_smart, }; memcpy(&config_out->scheduled_days, config.scheduled_days, sizeof(config.scheduled_days)); return true; } return false; } // --------------------------------------------------...
prv_file_open_and_lock(&file)
) { return; } AlarmConfig config; bool rv = prv_alarm_get_config(&file, id, &config); if (!rv) { goto cleanup; } if (!callback(id, &config, context)) { goto cleanup; } prv_enable_alarm_config(&config, true /* enabled */); prv_alarm_set_config(&file, id, &config); cleanup: prv_file_cl...
prv_offset_table_get_offset(font_cache, &font_res->md, mid_idx); break; } } return offset; } static uint32_t prv_get_glyph_data_offset(Codepoint codepoint, FontCache *font_cache, const FontResource *font_res) { const uint32_t offset = prv_get_glyph_table_offse...
{ g->header.height_px = total_pixels_decoded / g->header.width_px; }
return g; } static bool prv_load_glyph_bitmap(Codepoint codepoint, const FontResource *font_res, LineCacheData *data) { GlyphData *g = &data->glyph_data; const size_t bitmap_offset = (FONT_VERSION(font_res->md.version) == FONT_VERSION_1) ? sizeo...
t *this) { uint32_t cr_value = 0; uint32_t fcr_value = 0; // set the channel PBL_ASSERTN((this->channel & (DMA_SxCR_CHSEL >> CHSEL_OFFSET)) == this->channel); cr_value |= this->channel << CHSEL_OFFSET; // set the priority PBL_ASSERTN((this->priority & DMA_SxCR_PL) == this->priority); cr_value |= this-...
(alignment_mask)
; PBL_ASSERTN(((length & dst_alignment_mask) == 0) && (((uintptr_t)dst & dst_alignment_mask) == 0) && (((uintptr_t)src & alignment_mask) == 0)); } else { PBL_ASSERTN(((length & alignment_mask) == 0) && (((uintptr_t)dst & alignment_mask) == 0) && ...
horeGive(s_pb_semaphore); // (re)start timer for next event PBL_ASSERTN(new_timer_start(s_pb_state.timer_id, PUT_TIMEOUT_MS, prv_timer_callback, &s_pb_state, 0 /*flags*/)); prv_mark_pb_jobs_complete(num_put_jobs); // At this point we have updated the outstanding jobs. Check to s...
if (s_pb_state.current_command != PutBytesIdle) { PBL_LOG(LOG_LEVEL_ERROR, "Called put_bytes_expect while put_bytes is not idle"); xSemaphoreGive(s_pb_semaphore); return; }
// Just in case this is called more than once prv_create_timer_if_needed(); bool success = new_timer_start(s_pb_state.timer_id, timeout_ms, prv_expect_init_timeout_cb, NULL, 0 /*flags*/); PBL_ASSERTN(success); xSemaphoreGive(s_pb_semaphore); } void put_bytes_handle_comm_ses...
eTimerData data = { count, delay }; uintptr_t data_pack; memcpy(&data_pack, &data, sizeof data_pack); if (s_abusive_timer == TIMER_INVALID_ID) { s_abusive_timer = new_timer_create(); } if (new_timer_start(s_abusive_timer, 100, prv_waste_time_cb, (void *)data_pack, 0)) { prompt_s...
gatt_client_discovery_discover_range(conn, &range)
; } } bt_unlock(); } void command_bt_disc_stop(void) { bt_lock(); { GAPLEConnection *conn = prv_get_le_connection_and_print_info(); if (conn) { bt_driver_gatt_stop_discovery(conn); } } bt_unlock(); } #if BT_CONTROLLER_DA14681 static TimerID s_sleep_test_timer = TIMER_INVALID_ID; stat...
ics_context_set_stroke_width(ctx, data->stroke_width); graphics_draw_line(ctx, p0, p1); graphics_draw_line(ctx, p1, p2); graphics_draw_line(ctx, p2, p3); graphics_draw_line(ctx, p3, p0); return; } if (data->operation == OP_TEST2) { int x1 = 50, x2 = 100, y1 = 40, y2 = 120; ...
(ctx, false)
absolute volume + volume indicator, when that information is available. bool is_volume_up = (click_recognizer_get_button_id(recognizer) == BUTTON_ID_UP); prv_change_volume(is_volume_up); // Trigger haptic feedback only on repeat if (click_number_of_clicks_counted(recognizer) >= 2) { prv_do_haptic_feedback_...
(&data->track_pos_bar.layer, hide_layer)
; layer_set_hidden(&data->position_text_layer.layer, hide_layer); layer_set_hidden(&data->length_text_layer.layer, hide_layer); } static void prv_unload_no_music_window(Window *window) { MusicNoMusicWindow *music_window = (MusicNoMusicWindow *)window; gbitmap_deinit(&music_window->bitmap); bitmap_layer_deini...
_protection(void) { return; } void flash_lock(void) { mutex_lock(s_flash_state.mutex); } void flash_unlock(void) { mutex_unlock(s_flash_state.mutex); } bool flash_is_enabled(void) { return (s_flash_state.enabled); } void flash_init(void) { if (s_flash_state.mutex != 0) { return; // Already initialized...
flash_unlock()
; return; } analytics_inc(ANALYTICS_APP_METRIC_FLASH_SUBSECTOR_ERASE_COUNT, AnalyticsClient_CurrentTask); power_tracking_start(PowerSystemFlashErase); enable_flash_spi_clock(); handle_sleep_when_idle_begin(); flash_write_enable(); flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_ERASE_SU...
tptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_malloc(task_heap_get_for_current_task(), bytes, saved_lr); } void *task_malloc_check(size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; Heap *heap = task_heap_get_for_current_task(); void *mem = heap_malloc(heap, bytes, ...
app_state_get_heap()
, s, saved_lr); } // kernel_* functions that allocate on the kernel heap /////////////////////////////////////////////////////////// void *kernel_malloc(size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_malloc(kernel_heap_get(), bytes, saved_lr); } void *kernel_malloc_chec...
(AnimationPrivate *)animation_array[i + 1]; } } return (Animation *)parent; } static Animation *prv_create_from_vararg(Animation *animation_a, Animation *animation_b, Animation *animation_c, va_list args) { Animation *animation_array[ANIMATION_MAX_CREATE_VARGS]; siz...
prv_each(animation, prv_call_started, (uintptr_t)NULL)
; } return true; } bool animation_set_elapsed(Animation *animation_h, uint32_t elapsed_ms) { AnimationPrivate *animation = (AnimationPrivate *)animation_h; if (!animation) { return false; } if (animation->duration_ms <= elapsed_ms) { animation->is_completed = true; animation_unschedule(animatio...
*child = (AnimationPrivate *)animation_array[i]; child->parent = parent; if (i + 1 < (int)array_len) { child->sibling = (AnimationPrivate *)animation_array[i + 1]; } } return (Animation *)parent; } static Animation *prv_create_from_vararg(Animation *animation_a, Animation *animation_b, ...
(animation, prv_call_scheduled, true)
; // If your test is failing, build out this fake so that this is an async start prv_each(animation, prv_call_started, (uintptr_t)NULL); } return true; } bool animation_set_elapsed(Animation *animation_h, uint32_t elapsed_ms) { AnimationPrivate *animation = (AnimationPrivate *)animation_h; if (!animati...
_at_once(void) { test_ppogatt__open_session_when_found_pebble_app(); Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); // Get s_tx_window_size packets in flight: uint8_t sn = 0; for (; sn < s_tx_window_size; ++sn) { cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_tr...
prv_receive_ack(s_characteristics[0][PPoGATTCharacteristicData], sn /* sn */)
; } fake_comm_session_process_send_next(); for (int sn = 0; sn < num_packets; sn++) { prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment) - sn); } // There should be no writes we haven't already checked ...
unsigned int ScanWindow, GAP_LE_Filter_Policy_t InitatorFilterPolicy, GAP_LE_Address_Type_t RemoteAddressType, BD_ADDR_t *RemoteDevice, GAP_LE_Address_Type_t LocalAddressType, ...
{ fake_gap_put_connection_event(HCI_ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER, is_master, device); }
int GAP_LE_Disconnect(unsigned int BluetoothStackID, BD_ADDR_t BD_ADDR) { return 0; } int GAP_LE_Pair_Remote_Device(unsigned int BluetoothStackID, BD_ADDR_t BD_ADDR, GAP_LE_Pairing_Capabilities_t *Capabilities, ...
/* * 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...
Fixed_S64_32_mul(cb[i], state_x[i])
); } // Factor in the y * a coeficients for (int i = 0; i < num_output_coefficients; i++) { ytmp = Fixed_S64_32_sub(ytmp, Fixed_S64_32_mul(ca[i], state_y[i])); } // shift the y output elements for (int k = num_output_coefficients - 1; k > 0; k--) { state_y[k] = state_y[k-1]; } state_y[0] = ytm...
->resource_id, PNG_HEADER_SIZE, false, NULL); if (metadata_bytes <= 0) { return false; } metadata_bytes += PNG_HEADER_SIZE; bitmap_sequence->png_decoder_data.read_cursor = metadata_bytes; bitmap_sequence->current_frame = 0; bitmap_sequence->current_...
(frame_data_buffer)
; // Free compressed image buffer if (!bitmap_sequence || !bitmap_sequence->header_loaded) { APP_LOG(APP_LOG_LEVEL_ERROR, APNG_LOAD_ERROR); gbitmap_sequence_destroy(bitmap_sequence); } return bitmap_sequence; } bool gbitmap_sequence_restart(GBitmapSequence *bitmap_sequence) { return prv_gbitmap_sequ...
SS, weather_db_for_each(prv_db_iterator_cb, NULL)); } void test_weather_db__check_records_in_db(void) { for (int index = 0; index < WEATHER_DATA_SHARED_WEATHER_DB_NUM_DB_ENTRIES; index++) { WeatherDBEntry *to_check = task_zalloc_check(weather_shared_data_get_entry_size(index)); const WeatherDBKey *key = weat...
(E_DOES_NOT_EXIST, weather_db_read((uint8_t*)&key, sizeof(WeatherDBKey), buf, entry_size))
; }
/* * 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; }
return &text_layer->layer; } void text_layer_legacy2_set_size(TextLayerLegacy2 *text_layer, const GSize max_size) { if (text_layer == NULL) { return; } layer_set_frame(&text_layer->layer, &(GRect) { text_layer->layer.frame.origin, max_size }); layer_mark_dirty(&text_layer->layer); } GSize text_layer_l...
hnology.atlassian.net/browse/PBL-28582 .day_lag = 10, .hour = 20, .minute = 30, .trigger = prv_create_day_10_insight, .insight_type = ActivityInsightType_Day10, }, }; // ------------------------------------------------------------------------------------------------ static void prv_trigger_activa...
INSIGHTS_LOG_DEBUG("Not triggering activity reward - too soon to trigger")
; return false; } // Make sure we're not still sleeping if (prv_get_sleep_state() != ActivitySleepStateAwake) { INSIGHTS_LOG_DEBUG("Not triggering reward - asleep"); return false; } // Finally, make sure the current metric value is over the target ActivityScalarStore target = ((uint32_t)(metri...
/* * 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(abs(ours - (int) theirs) < 3)
erflowModeTrailingEllipsis); layer_add_child(root_layer, (Layer *)text_layer); layer_set_hidden((Layer *)text_layer, true); static const int16_t LOADING_FRAME_OFFSET_Y = 27; GRect loading_frame = (GRect) { .size = LOADING_LAYER_DEFAULT_SIZE }; grect_align(&loading_frame, root_frame, GAlignCenter, false); l...
prv_cancel_dictation(data)
; } } static void prv_mic_window_appear(Window *window) { VoiceUiData *data = window_get_user_data(window); if ((data->state == StateStart) || (data->state == StateFinished)) { sys_light_enable_respect_settings(true); prv_start_dictation(data); } } static void prv_voice_window_push(VoiceUiData *data) ...
ic uint32_t s_movement_data[] = { 1, // Version NOW, // Timestamp 1234, // Steps 1111, // Active K Calories 2222, // Resting K Calories 3333, // Distance 4444, // Active Time }; static uint32_t s_old_movement_data[] = { 1, // Versio...
cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_invalid_sleep_data, sizeof(s_sleep_data)), S_SUCCESS)
ular_buffer_consume(&buffer, 4)); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 6); // Now there's just 56 in the buffer. Fill it to the brim cl_assert(circular_buffer_write(&buffer, (uint8_t*) "789", 3)); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 3); cl_as...
(&buffer, 2 /* start_offset */, data_out, data_out_size)
, 6); cl_assert(memcmp("456789", data_out, 6) == 0); } void test_circular_buffer__direct_write(void) { CircularBuffer buffer; uint8_t storage[8]; circular_buffer_init(&buffer, storage, sizeof(storage)); circular_buffer_write(&buffer, (uint8_t *)"0123", 4); uint8_t *data_out; uint16_t contiguous_num_byt...
4}, { 1432, 600, 120}, { 1008, 616, -200}, { 952, 272, -232}, { 776, 128, -176}, { 1224, -88, 128}, { 1280, -40, 232}, { 1048, -8, 232}, { 880, 64, 160}, { 872, 128, 40}, // 99 seconds { 888, 96, -16}, { 920, 128, -32}, { 936, 216, -48}, { 928, 248, -16}, { 90...
{ 904, 8, 208}, { 984, 96, 88}, { 1024, 152, 72}, { 1016, 88, 112}, { 1008, 88, 96}, { 1040, 80, 136}, { 1064, 96, 184}, { 1136, 112, 192}, { 1160, 152, 144}, { 1120, 168, 64}, { 1440, 280, 80}, { 1424, 296, 112}, { 864, 248, 16}, { 792, -40, 40}, { 1280, -232...
{ 1000, 40, 96}, { 1024, 56, 48}, { 1088, 48, 88}, { 1080, 128, 72}, { 1088, 160, 144}, { 1144, 208, 176}, { 1176, 280, 184}, { 1520, 288, 200}, { 1528, 216, 184}, { 1000, 160, -16}, { 752, -88, -40}, { 928, -408, 168}, { 1176, -200, 360}, { 1152, -160, 328}, ...
/* * 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...
(dci_reel->image)
; } static size_t prv_get_data_size(const KinoReel *reel) { KinoReelImplPDCI *dci_reel = (KinoReelImplPDCI *)reel; return gdraw_command_image_get_data_size(dci_reel->image); } static GDrawCommandImage *prv_get_gdraw_command_image(KinoReel *reel) { if (reel) { return ((KinoReelImplPDCI*)reel)->image; } r...
going // to use. uint32_t interval_us = accel_set_sampling_interval(lowest_interval_us); prv_setup_subsampling(interval_us); PBL_LOG(LOG_LEVEL_DEBUG, "setting accel rate:%"PRIu32", num_samples:%"PRIu32, US_PER_SECOND / interval_us, max_batch); accel_set_num_samples(max_batch); } static bool prv_...
mutex_unlock_recursive(s_accel_manager_mutex)
; } #ifdef TEST_KERNEL_SUBSCRIPTION static void prv_kernel_data_subscription_handler(AccelData *accel_data, uint32_t num_samples) { PBL_LOG(LOG_LEVEL_INFO, "Received %" PRIu32 " accel samples for KernelMain.", num_samples); } static void prv_kernel_tap_subscription_handler(AccelAxisType axis, int32_t direct...
reason_string = "%s%sLowBattery"; break; case RebootReasonCode_SoftwareUpdate: gatt_service_changed_server_handle_fw_update(); reason_string = "%s%sSoftwareUpdate"; break; case RebootReasonCode_ResetButtonsHeld: // Since we forced the reset, it isn't unexpected show_reset_alert = false; ...
(LOG_LEVEL_INFO, "Unread coredump file is present!")
; } DEBUG_LOG(LOG_LEVEL_INFO, "MCU reset reason mask: 0x%x", (int)mcu_reboot_reason.reset_mask); #if CAPABILITY_HAS_PMIC uint32_t pmic_reset_reason = pmic_get_last_reset_reason(); if (pmic_reset_reason != 0) { DEBUG_LOG(LOG_LEVEL_INFO, "PMIC reset reason mask: 0x%x", (int)pmic_reset_reason); } #endif #i...
+ 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(4, 0), 0); graphics_draw_vertical_line_dotted(&ctx, GPoint(6, 0), 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(8, 0), 2); graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 0), 3); graphics_draw_vertical_line_dotted(&ctx, GPoint(12, 0), 4); grap...
graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 0), 3)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(12, 0), 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(14, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(16, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(18, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(20, 0), MAX_NUM_R...
dict_part_two); s_num_ds_notifications_received += 2; } else if (uid == message_size_attr_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_message_size_attr_dict), (uint8_t*) s_message_size_attr_dict); s_num_ds_notifications_received++; } else if (uid == attribute_at_end_uid) { prv_fake...
fake_kernel_services_notifications_reset()
d at 2nd loop correctly status = gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 88 * 100 + (49 - 1) * 100); cl_assert_equal_b(status, true); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(49))); // Since loop only equals 2, make sure that h...
sys_resource_load_file_as_resource(TEST_IMAGES_PATH, GET_APNG_NAME)
tion and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // SW = 11 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"))...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 4); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // AA = true, SW = 5 setup_test_aa_sw(&ctx, fb, OFFSET_RE...
/* * 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(e->type, PEBBLE_CALLBACK_EVENT); ++s_num_event_puts; s_last_event = *e; return true; }
char pbl_log_get_level_char(const uint8_t log_level) { return 'L'; } char pebble_task_get_char(PebbleTask task) { return 'T'; } PebbleTask pebble_task_get_current(void) { return PebbleTask_Unknown; } void *pulse_best_effort_send_begin(uint16_t protocol) { static char buffer[1024]; return buffer; // tod...
/* * 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 (uint32_t i = 0; i < data_len * 2; i++) { uint8_t nibble; if (big_endian) { nibble = data[data_len - (i / 2) - 1]; } else { nibble = data[i / 2]; } if (i % 2 == 0) { nibble >>= 4; } int index = nibble ^ (*crc >> 4); *crc = lookup_table[index & 0xf] ^ ((*crc << 4) & ...
}
/* * 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, &hdr->common.parent_id)
; if (uuid_equal(&pin.header.parent_id, &uuid_reminders_data_source)) { return true; } return false; } static bool prv_should_ignore_because_time_reminder(const ANCSAttribute *app_id, time_t timestamp, con...
ayer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_nx_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(...
(p.x + 3, p.y + 2)
48, 104, -912}, { 48, 112, -920}, { 56, 128, -928}, { 48, 128, -912}, { 48, 120, -928}, { 48, 120, -912}, { 48, 128, -912}, { 48, 104, -920}, { 48, 104, -912}, { 48, 120, -920}, { 48, 120, -920}, { 48, 144, -928}, { 40, 120, -912}, { 48, 120, -920}, { 40, 128, -92...
{ 64, 120, -920}, { 64, 136, -920}, { 56, 136, -928}, { 64, 112, -928}, { 64, 120, -912}, { 56, 144, -920}, { 56, 152, -920}, { 48, 144, -920}, { 64, 136, -920}, { 64, 152, -912}, { 56, 136, -912}, { 56, 152, -912}, { 56, 144, -920}, { 56, 144, -920}, { 56, 14...
{ 56, 160, -936}, { 64, 152, -912}, // 169 seconds { 56, 152, -920}, { 48, 160, -928}, { 48, 136, -912}, { 48, 136, -920}, { 56, 152, -920}, { 48, 128, -912}, { 40, 152, -912}, { 48, 136, -912}, { 48, 168, -920}, { 48, 160, -912}, { 48, 144, -920}, { 48, 152,...
/* * 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; }
void compositor_modal_render_ready(void) { } void compositor_transition_cancel(void) { } bool sys_app_is_watchface(void) { return false; } void click_manager_init(ClickManager *click_manager) { return; } void click_manager_clear(ClickManager *click_manager) { return; } void click_manager_reset(ClickManager...
(comm_session_send_data(NULL, endpoint_id, data, sizeof(data), COMM_SESSION_DEFAULT_TIMEOUT), false)
; } void test_session__basic_open_close(void) { Transport *transport = (Transport *) TransportID1; CommSession *session = comm_session_open(transport, &s_transport_imp, TransportDestinationSystem); cl_assert(session); cl_assert_equal_b(comm_session_is_valid(session), ...
) + nudge_down; GPoint separator_start_point = gpoint_add(cell_layer_bounds->origin, GPoint(offset_x, offset_y)); graphics_context_set_stroke_color(ctx, PBL_IF_COLOR_ELSE(GColorDarkGray, GColorWhite)); separator_start_point.y += config->separator.h; for (in...
if (row >= SHORT_ITEM_MAX_ROWS_SPALDING - 1) { grect_align(&arrow_rect, aml_bounds, GAlignTop, true /* clip */); content_indicator_draw_arrow(ctx, &arrow_rect, ContentIndicatorDirectionUp, fg_color, bg_color, GAlignTop); }
if (num_rows - row >= SHORT_ITEM_MAX_ROWS_SPALDING) { grect_align(&arrow_rect, aml_bounds, GAlignBottom, true /* clip */); content_indicator_draw_arrow(ctx, &arrow_rect, ContentIndicatorDirectionDown, fg_color, bg_color, GAlignBottom); } } #endif } static void ...
C * * 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 in writing, software * distrib...
i18n_get("Decline dialog.", dialog)
); dialog_set_background_color(dialog, GColorRed); dialog_set_icon(dialog, data->resource_id_80); actionable_dialog_set_action_bar_type(actionable_dialog, DialogActionBarDecline, NULL); actionable_dialog_set_click_config_provider(actionable_dialog, prv_decline_config_provider); app_actionable_dialog_pu...
/* * 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...
crc_calculate_bytes( (const uint8_t*) FIRMWARE_BASE, firmware_description->firmware_length)
; dbgserial_print("Checksum - wanted "); dbgserial_print_hex(firmware_description->checksum); dbgserial_print(" got "); dbgserial_print_hex(calculated_crc); dbgserial_putstr(""); return calculated_crc == firmware_description->checksum; } typedef enum UpdateFirmwareResult { UPDATE_FW_SUCCESS = 0, UPDA...
sole/prompt.h" #include "kernel/pbl_malloc.h" #include "os/mutex.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/settings/settings_file.h" #include "services/normal/timeline/attributes_actions.h" #include "system/logging.h" #include "system/passert.h" #include "util/attributes.h" #include "util...
strncpy(buffer, (const char *)app_id, key_len)
valid_gothic_codepoints_utf8 = (utf8_t*) s_valid_gothic_codepoints_string; for (int i = 0; i < NUM_GOTHIC_CODEPOINTS; i++) { uint32_t decoded_codepoint = utf8_peek_codepoint(valid_gothic_codepoints_utf8, NULL); uint32_t actual_codepoint = s_valid_gothic_codepoints[i]; cl_assert_equal_i(decoded_codepoint,...
realloc(output_buffer, 12)
; trunc_size = utf8_truncate_with_ellipsis("Hello there", output_buffer, 12); cl_assert_equal_s(output_buffer, "Hello there"); cl_assert_equal_i(trunc_size, 12); // test that our utf8 support works properly and doesn't split multibyte characters output_buffer = realloc(output_buffer, 19); trunc_size = utf8...
p_running_firmware_metadata(FirmwareMetadata *fw_metadata) { prv_fixup_firmware_metadata(fw_metadata); #ifdef MANUFACTURING_FW // Lie to the phone and force this to say we're not a MFG firmware. If we tell the phone app // that we're a MFG firmware it will get mad at us and try to update us out of this mode. We ...
bt_persistent_storage_is_unfaithful()
; #if CAPABILITY_HAS_HEALTH_TRACKING && !RECOVERY_FW versions_msg.activity_insights_version = hton16(activity_insights_settings_get_version()); #endif comm_session_send_data(session, s_endpoint_id, (uint8_t*) &versions_msg, sizeof(versions_msg), COMM_SESSION_DEFAULT_TIMEOUT); } void syste...
208, 984, 384}, { -320, 1464, 480}, { -240, 1128, 424}, { -272, 1256, 120}, { -144, 920, 160}, { -48, 768, 128}, { 104, 680, 160}, { 152, 672, 128}, { 96, 736, 224}, { 56, 872, 160}, { 8, 976, 312}, { -8, 1424, 112}, { 176, 968, 480}, { -24, 1224, 264}, { -72, 142...
{ -200, 1120, 464}, { -136, 472, 232}, { 32, 512, 320}, { 48, 640, 136}, { 96, 616, 360}, // 79 seconds { 24, 712, 304}, { 24, 1088, 256}, { 64, 872, 424}, { 8, 1024, 296}, { -112, 984, 328}, { -168, 1112, 280}, { -208, 1184, 456}, { -352, 1200, 176}, { -200, ...
{ 72, 536, -32}, { 136, 432, -56}, { 192, 584, -32}, { 216, 672, 24}, { 184, 1232, 72}, { 168, 1224, -112}, { 288, 1112, -216}, { 120, 1304, 200}, { 80, 1616, -24}, { -56, 1192, 184}, { -56, 928, 144}, // 82 seconds { 40, 936, 0}, { -8, 752, 384}, { -96, 648,...
mp_settle_impl(struct Animation *animation, const AnimationProgress distance_normalized) { SelectionLayer *selection_layer = (SelectionLayer*) animation_get_context(animation); // Update the completion percent of the animation selection_layer->bump_settle_anim_progress = (1...
{ SelectionLayer *selection_layer = (SelectionLayer*) animation_get_context(animation); // Update the completion percent of the animation. This is a reverse animation. It starts // fully drawn, then the amount drawn decreases selection_layer->slide_settle_anim_progress = 100 - (100 * distance_normalized)...
static void prv_slide_settle_stopped(Animation *animation, bool finished, void *context) { SelectionLayer *selection_layer = (SelectionLayer*) animation_get_context(animation); selection_layer->slide_settle_anim_progress = 0; } static Animation* prv_create_slide_animation(SelectionLayer *selection_layer) { Ani...
DrawMask *mask = graphics_context_mask_create(ctx, transparent); cl_assert(mask); const GSize mask_size = ctx->dest_bitmap.bounds.size; for (int16_t x = 0; x < mask_size.w; x++) { const uint8_t mask_pixel_value = (uint8_t)(x / num_pixels_per_mask_value); for (int16_t y = 0; y < mask_size.h; y++) { ...
prv_prepare_canvas(ctx, bitmap_size)
; // Fill the canvas so each column (of width hline_applying_test_column_width) is set to one of the // different possible dest_colors for (int16_t y = 0; y < bitmap_size.h; y++) { for (int16_t column_index = 0; column_index < num_dest_colors; column_index++) { const int16_t starting_x = column_index *...