prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
now_utc, now_utc, HealthAggregationAvg, HealthServiceTimeScopeOnce); cl_assert_equal_i(123, result); // This is the equivalent to `peek_value` with HeartRateBPM. Make sure it is equal. result = health_service_aggregate_averaged(HealthMetricHeartRateBPM, ...
(&weekly_stats, value)
; PBL_LOG(LOG_LEVEL_DEBUG, "Updating weekly stats with %"PRIi32": sum: %"PRIi32", " "avg: %"PRIi32" ", value, weekly_stats.sum, weekly_stats.avg); } if (day_in_week == Sunday || day_in_week == Saturday) { prv_update_stats(&weekend_stats, value); } else { prv_update_stats(&we...
imer in either the running or idle list ListNode* node = list_find(manager->running_timers, prv_id_list_filter, (void*)timer_id); if (!node) { node = list_find(manager->idle_timers, prv_id_list_filter, (void*)timer_id); } PBL_ASSERTN(node); return (TaskTimer *)node; } // ================================...
{ *expire_ms_p = 0; }
} mutex_unlock(manager->mutex); return retval; } // -------------------------------------------------------------------------------- // Stop a timer. If the timer callback is currently executing, return false, else return true. bool task_timer_stop(TaskTimerManager *manager, TaskTimerID timer_id) { mutex_lo...
// Tests //////////////////////////////////////////////////////////////////////////////////////////////////// static const uint8_t TEST_DATA[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; void test_session_send_queue__initialize(void) { s_valid_session = &s_session; s_free_count = 0; fake_kernel_malloc_init(); f...
for (int consumed = 0; consumed < sizeof(TEST_DATA); ++consumed) { cl_assert_equal_i(comm_session_send_queue_get_read_pointer(s_valid_session, &data_out), sizeof(TEST_DATA) - consumed); cl_assert_equal_m(data_out, TEST_DATA + consumed, sizeof(TEST_DATA) - consumed); comm_session_send_...
status; } T_STATIC status_t settings_file_compact(SettingsFile *file) { return settings_file_rewrite_filtered(file, NULL, NULL); } static bool key_matches(SettingsRawIter *iter, const uint8_t *key, int key_len) { SettingsRecordHeader *hdr = &iter->hdr; if (key_len != hdr->key_len) { return false; } if (...
memset(val_out, 0, val_out_len)
ion(&firmware_description)) { dbgserial_print("Desclen "); dbgserial_print_hex(firmware_description.description_length); dbgserial_print("\nFirmlen "); dbgserial_print_hex(firmware_description.firmware_length); dbgserial_print("\nXsum "); dbgserial_print_hex(firmware_description.checksum); d...
{ dbgserial_putstr("Failed to load recovery firmware, strike two. Try again."); boot_bit_set(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO); boot_bit_set(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED); system_reset(); }
de "kernel/pbl_malloc.h" #include "services/common/new_timer/new_timer.h" #include "services/common/regular_timer.h" #include "services/common/system_task.h" #include "system/logging.h" #include "system/passert.h" #include "util/list.h" #include "util/math.h" #include "util/rand.h" #include <stdlib.h> //! The Bluetoo...
{ bt_lock_assert_held(true); ConnectionStateRequest *curr_request = hdl->conn_mgr_info->requests; while (curr_request != NULL) { if (curr_request->granted_handler && curr_request->req_state <= granted_state) { prv_schedule_granted_handler(curr_request->granted_handler); curr_request->gran...
static void prv_handle_response_latency_for_le_conn(GAPLEConnection *hdl) { uint16_t secs_til_max_latency; ResponseTimeState state; BtConsumer responsible_consumer; #ifdef RECOVERY_FW // We don't care if we burn up some power from PRF and we want FW to update quickly secs_til_max_latency = MAX_PERIOD_RUN_FO...
ics_context_set_stroke_color(ctx, GColorClear); graphics_draw_rect(ctx, &GRect(4, 2, 16, 8)); } static void across_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_rect(ctx, &GRect(10, 2, 18, 4)); } static void across_nx_layer_update_callback...
{ GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 20, 10)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); l...
#define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 20, 20) #define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 144, 168) #define ORIGIN_DRAW_RECT_NO_CLIP GRect(6, 6, 30, 40) #define ORIGIN_DRAW_RECT_CLIP_XY GRect(6, 6, 30, 40) #define ORIGIN_DRAW_RECT_CLIP_NXNY GRec...
check_atan2(-158, 299); check_atan2(120, 102); check_atan2(0, 0); check_atan2(0, 10); check_atan2(10, 0); check_atan2(-32768, 1); // <- causes overflow for int16 check_atan2(1, -32768); // <- causes overflow for int16 check_atan2(20001, 20000); // <- causes overflow if numbers are added in an int16 ch...
(WITHIN(-21, min, max), false)
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_transparent.8bit.pbi"))
(advert_terms_a[1].min_interval_slots, advert_terms_a[1].max_interval_slots)
; // Expect silence. B's third (silent) is 2 secs, so one more to go and A's third term is silent. regular_timer_fire_seconds(1); cl_assert_equal_b(gap_le_is_advertising_enabled(), false); // Expect B's fourth term now. regular_timer_fire_seconds(1); cl_assert_equal_b(gap_le_is_advertising_enabled(), 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...
cl_assert(!alerts_should_notify_for_type(AlertMobile))
; cl_assert(!alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_should_notify_for_type(AlertPhoneCall)); } void test_alerts__phone_calls_only(void) { cl_assert(alerts_get_mask() == AlertMaskAllOn); alerts_set_mask(AlertMaskPhoneCalls); // Should allow a phone call notification cl_assert(ale...
/* * 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 (cmd == RCC_APB2PeriphClockCmd) { return "APB2"; } else if (cmd == RCC_AHB1PeriphClockCmd) { return "AHB1"; } else if (cmd == RCC_AHB2PeriphClockCmd) { return "AHB2"; } else { return NULL; }
} #endif // F(S)MC is the only AHB3 peripheral #ifdef FMC_R_BASE #define AHB3_BASE FMC_R_BASE #else #define AHB3_BASE FSMC_R_BASE #endif _Static_assert(APB1PERIPH_BASE < APB2PERIPH_BASE, "Clock mapping assumptions don't hold"); _Static_assert(APB2PERIPH_BASE < AHB1PERIPH_BASE, "Clock mapping assumptions don't hold")...
/* * 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...
music_get_pos(&track_position, &track_duration)
; cl_assert_equal_i(track_position, 0xAA); cl_assert_equal_i(music_get_playback_rate_percent(), 0xAA); } else { cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT); } } static void prv_receive_and_assert_volume_info(bool expect_is_handled) { uint8_t msg[] = { 0x12, 0x33 }; prv_receive_pp_data(msg, sizeof...
// shallow copy the attributes for (int i = 0; i < in->num_attributes; i++) { if (write_ptr + sizeof(Attribute) > buffer_end) { return false; } memcpy(&out->attributes[i], &in->attributes[i], sizeof(Attribute)); write_ptr += sizeof(Attribute); } for (int i = 0; i < in->num_attributes; i++...
if (cursor > val_end) { return false; } else { has_attribute[attrib_hdr->id] = true; }
} return true; } void attribute_init_string(Attribute *attribute, char *buffer, AttributeId attribute_id) { PBL_ASSERTN(attribute != NULL); PBL_ASSERTN(buffer != NULL); attribute->cstring = buffer; attribute->id = attribute_id; } Attribute *attribute_find(const AttributeList *attr_list, AttributeId id) ...
Compositing Mode graphics_context_set_compositing_mode(&context, GCompOpOr); cl_assert(context.draw_state.compositing_mode == GCompOpOr); // Text Color graphics_context_set_text_color(&context, GColorClear); cl_assert_equal_i(context.draw_state.text_color.argb, GColorClear.argb); color = GColorYellow; ...
(prv_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4))
; } void test_graphics_context_${BIT_DEPTH_NAME}__draw_stroke_width_2(void) { // Stroke width 2, non-antialiased setup_test(&context, false, 2, GColorBlack, GColorBlack, false); graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)); ASSERT_CALLED(graphics_line_draw_stroked_non_aa(&context, GPoint(5, 5), G...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(key_type < SMRootKeyTypeNum)
FlashTestErrorType err_code, bool disp_logs) { uint16_t read_buffer = 0; flash_read_bytes((uint8_t *)&read_buffer, read_addr, sizeof(read_buffer)); if (disp_logs) { PBL_LOG(LOG_LEVEL_DEBUG, ">> Reading Addr 0x...
flash_read_bytes((uint8_t*) &read_buffer, addr_region, sizeof(read_buffer))
SessionState_StartSession; // check if we're being started from an app so we know to send the UUID when setting up a session s_from_app = ((pebble_task_get_current() == PebbleTask_App) && !app_install_id_from_system(app_manager_get_current_app_id())); if (s_from_app) { s_app_uuid = app_manager_get_curr...
PBL_LOG(LOG_LEVEL_WARNING, "Error occurred setting up session: %d", result)
t * * 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 language g...
memcmp(out_buffer, (uint8_t*) "c", 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...
{ for (unsigned int i = 0; i < length; i++) { for (unsigned int j = i+1; j < length; j++) { if (values[i].x.raw_value > values[j].x.raw_value) { swapIntersections(&values[i], &values[j]); } } } }
static inline bool prv_is_in_range(int16_t min_a, int16_t max_a, int16_t min_b, int16_t max_b) { return (max_a >= min_b) && (min_a <= max_b); } static void prv_gpath_draw_filled_cb(GContext *ctx, int16_t y, Fixed_S16_3 x_range_begin, Fixed_S16_3 x_range_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...
if (bt_device_equal(&result->device, device)) { // Match! if (prev) { // Unlink from previous node: prev->next = result->next; } else { // Unlink from head: s_head = result->next; } // Return found result: return result; }
/* * 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 (app_install_entry_is_hidden(entry) && !app_install_entry_is_quick_launch_visible_only(entry)) { return false; // Skip hidden apps unless they are quick launch visible }
return true; } static uint16_t prv_menu_get_num_rows(OptionMenu *option_menu, void *context) { QuickLaunchAppMenuData *data = context; return app_menu_data_source_get_count(&data->data_source) + NUM_CUSTOM_CELLS; } static void prv_menu_draw_row(OptionMenu *option_menu, GContext* ctx, const Layer *cell_layer, ...
title = body; } else if (IS_EMPTY_STRING(subtitle)) { // no subtitle, but yes title subtitle = body; } else { WTF; } draw_cell(ctx, cell_layer, title, subtitle, loaded_node->icon); } // Display the appropriate layer static void prv_update_text_layer_visibility(NotificationsData *data) { Notifica...
GRect(horizontal_margin, window->layer.bounds.size.h / 2 - 15, window->layer.bounds.size.w - horizontal_margin, window->layer.bounds.size.h / 2)
, i18n_get("No notifications", data), font, GColorBlack, GColorWhite, GTextAlignmentCenter, GTextOverflowModeTrailingEllipsis); layer_add_child(&window->layer, text_layer_get_layer(text_layer)); #if PBL_ROUND GCol...
(timeline_res_id == TIMELINE_RESOURCE_NOTIFICATION_GENERIC); *loaded_list = (LoadedNotificationNode*) list_prepend((ListNode*) *loaded_list, (ListNode*)loaded_node); return loaded_node; } static void prv_loaded_notification_list_deinit(LoadedNotificationNode *loaded_list) { while (loaded_list)...
{ return GColorBlack; }
return color; } static void prv_invert_pdc_colors(GDrawCommandProcessor *processor, GDrawCommand *processed_command, size_t processed_command_max_size, const GDrawCommandList* list, ...
l create one of the preset // types. if (actionable_dialog->action_bar_type != DialogActionBarCustom) { actionable_dialog->action_bar = action_bar_layer_create(); action_bar_layer_set_click_config_provider(actionable_dialog->action_bar, actionable_dialog->confi...
(actionable_dialog)
_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_print.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_task_watchdog.h" #include "system/logging.h" #include "system/passert.h" #include <stdbool.h> #include <stdio.h> #include <string.h> #define FLASH_SIZE (4 * 1024 * 1024) void test_fl...
(s_completed_success)
; cl_assert_equal_i(s_msg.num_processed, s_msg.num_items); } static char **generate_unique_logs(size_t space_avail, size_t log_len, int *num_logs) { *num_logs = space_avail / (log_len + 2); // add 2 for overhead per log char msg[log_len + 1]; char **msg_arr = malloc(*num_logs * sizeof(char *)); for ...
may be called from an ISR prv_lock(); PBL_ASSERTN(s_input_enabled); s_input_enabled = false; s_send_history.has_data = false; s_bus_contention_detected = false; prv_unlock(); } void accessory_enable_input(void) { // NOTE: This function may be called from an ISR if (s_input_enabled) { return; } ...
(s_stream_context)
) { // the callback MUST send a byte in order for this interrupt to trigger again PBL_ASSERTN(s_did_send_byte); } else { // we're done sending portBASE_TYPE was_higher_task_woken = pdFALSE; xSemaphoreGiveFromISR(s_send_semaphore, &was_higher_task_woken); should_context_switch = (...
st_loaded == false) { return; } AppMenuNode *node = app_malloc_check(sizeof(AppMenuNode)); *node = (AppMenuNode) { .install_id = entry->install_id, .app_num = app_install_get_app_icon_bank(entry), .icon_resource_id = app_install_entry_get_icon_resource_id(entry), .uuid = entry->uuid, .col...
prv_transform_index(source, row_index)
); } uint16_t app_menu_data_source_get_count(AppMenuDataSource *source) { prv_load_list_if_needed(source); return list_count((ListNode*)source->list); } uint16_t app_menu_data_source_get_index_of_app_with_install_id(AppMenuDataSource *source, AppInsta...
GColorDarkGray; const GColor inactive_thin_color = graph_card->inactive_color; return (is_active ? active_color : (is_wide ? inactive_wide_color : inactive_thin_color)); } static void prv_draw_day_bars(HealthGraphCard *graph_card, GContext *ctx) { // With values from prv_setup_day_bar_box and prv_draw_day_bar, ...
prv_get_day_point(graph_card, graph_card->selection)
; if (graph_card->selection == graph_card->current_day && day_point == 0) { // If today has no progress, use the info from last week day_point = graph_card->day_data[DAYS_PER_WEEK]; } return day_point; } static void prv_draw_avg_line_legend(HealthGraphCard *graph_card, GContext *ctx, int offset_x, ...
d = &word_iter_state->current; const TextBoxParams* const text_box_params = word_iter_state->text_box_params; GContext* ctx = word_iter_state->ctx; if (*current_word->end == NULL_CODEPOINT) { return false; } return word_init(ctx, current_word, text_box_params, current_word->end); } //! @return is_advan...
(codepoint)
zer) { if (false == prv_is_multi_click_enabled(recognizer)) { return 0; } if (recognizer->config.multi_click.timeout == 0) { return MULTI_CLICK_DEFAULT_TIMEOUT_MS; } return recognizer->config.multi_click.timeout; } static uint32_t prv_long_click_get_delay(ClickRecognizer *recognizer) { if (false ==...
(recognizer, ClickHandlerOffsetRawDown, needs_reset)
; if (prv_is_long_click_enabled(recognizer)) { const uint32_t long_click_delay = prv_long_click_get_delay(recognizer); recognizer->hold_timer = app_timer_register( long_click_delay, prv_long_click_callback, recognizer); } else { const bool local_is_hold_to_repeat_enabled = prv_is_hold_to_repeat...
version = (Version) { .major = PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR, .minor = PROCESS_INFO_CURRENT_SDK_VERSION_MINOR - 10 } }, .should_pass = true }, { .entry = (AppInstallEntry) { .install_id = 5, .sdk_version = (Version) { .major = PROCESS_INFO_CURRENT_SDK_VER...
cl_assert_equal_p(s_app_install_get_md__result, s_app_manager_launch_new_app__config.md)
; cl_assert(s_event_put__event == NULL); } void test_process_manager__launch_invalid_rocky_app(void) { s_app_install_get_md__result = &(PebbleProcessMd){.is_rocky_app = true}; s_rocky_app_validate_resources__result = RockyResourceValidation_Invalid; process_manager_launch_process(&(ProcessLaunchConfig){.id=1})...
+= 1; time_t utc_sec = mktime(&time_tm); rtc_set_time(utc_sec); fake_system_task_callbacks_invoke_pending(); int act_distance[ARRAY_LENGTH(tests)]; const int k_elapsed_sec = 2 * SECONDS_PER_MINUTE; // Evaluate each test case for (int i = 0; i < ARRAY_LENGTH(tests); i++) { DistanceTestParams *params...
if ((s_hrm_manager_update_interval == 1) || force_continuous) { PebbleHRMEvent hrm_event = { .event_type = HRMEvent_BPM, .bpm.bpm = bpm, .bpm.quality = quality, }; prv_hrm_subscription_cb(&hrm_event, NULL); s_num_hrm_callbacks++; }
if ((rtc_get_time() % SECONDS_PER_MINUTE) == 0) { prv_minute_system_task_cb(NULL); } } } // --------------------------------------------------------------------------------------- // Test that we subscribe to the HR events at the expected times void test_activity__hrm_sampling_period(void) { // Sta...
alse); } } if (!i2c_read_register_block(I2C_LIS3DH, register_address, read_size, buffer)) { prv_reset(); return (false); } if (!running) { accel_stop(); } return (true); } bool lis3dh_write(uint8_t address, uint8_t write_size, const uint8_t *buffer) { bool running = accel_running(); ...
{ axis = AXIS_Y; }
else if (click_src & (1 << BOARD_CONFIG_ACCEL.accel_config.axes_offsets[AXIS_Z])) { axis = AXIS_Z; } else { // something has reset the register, ignore return; } // sign bit is zero if positive, 1 if negative direction = (click_src & Sign) ? -1 : 1; } else { // when no-one has s...
s_valid_page_idx = i; break; } } } // Keep a write offset, this won't work when we try to roll over to the other 25% of the sectors if (s_valid_page_idx == SPRF_PAGE_IDX_INVALID) { prv_erase_region_and_save(NULL); } else if (s_valid_page_idx > (SPRF_MAX_NUM_PAGES...
if (name_out) { SprfBlePairingName name_data = {}; const bool name_rv = SPRF_FETCH_FIELD(name_data, ble_pairing_name); // Should we return a failure on a failed name get? if (name_rv) { strncpy(name_out, name_data.name, BT_DEVICE_NAME_BUFFER_SIZE); } else { name_out[0] = '\...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_set_user_data(window, data)
et_text_color(msg_text_layer, GColorWhite); text_layer_set_font(msg_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)); layer_add_child(&window->layer, &msg_text_layer->layer); msg_text_layer = &data->msg_text_layer[2]; text_layer_init(msg_text_layer, &GRect(0, 64, window->layer.bounds.size.w, 40)); ...
window_set_window_handlers(test_window, &(WindowHandlers) { .load = test_window_load, })
; window_set_user_data(test_window, data); window_set_click_config_provider(test_window, click_config_provider); const bool animated = true; app_window_stack_push(test_window, animated); } static void flash_test_window_load(Window *window) { struct FlashTestData *data = (struct FlashTestData*) window_get_us...
/* * 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...
(source_buf)
; } if (!timer_data->is_repeating) { prv_timer_cleanup(timer_data); } } static jerry_value_t prv_create_timer(const jerry_value_t *argv, const jerry_length_t argc, bool is_repeating) { if (argc < 1) { return rocky_error_argume...
); cl_assert_equal_i(windows[0]->on_screen, false); cl_assert_equal_i(windows[1]->on_screen, false); cl_assert_equal_i(windows[2]->on_screen, false); for (uint8_t idx = 0; idx < 3; idx++) { window_destroy(windows[idx]); } } void test_window_stack__insert_next(void) { Window *window1 = window_create();...
{ window_stacks[idx] = modal_manager_get_window_stack(idx); for (int i = 0; i < num_windows_per_stack; i++) { windows[idx][i] = window_create(); } }
// The following checks use integer priorities to clearly indicate stack order // We check to make sure the first occurrence of integer values are less than NumModalPriorities // Test: No top window does not result in Exists // Test: No top window results in Transparent and Unfocused modal_manager_event_lo...
_context_set_stroke_color(ctx, bg_color); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y)); graphics_draw_pixel(ctx, GPoint(point.x, point.y + 1)); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1)); } else if (alpha == ALPHA_0) { graphics_context_set_stroke_color(ctx, bg_color); gra...
if (data->property == PROPERTY_COLOR_TABLE) { if (s_color_table == color_table_hsv) { s_color_table = color_table_hvs; } else if (s_color_table == color_table_hvs) { s_color_table = color_table_hsv; } }
layer_mark_dirty(s_canvas_layer); } static void select_handler(ClickRecognizerRef recognizer, void *context) { AppData *data = window_get_user_data(s_window); data->property = (data->property + 1) % PROPERTY_MAX; layer_mark_dirty(s_canvas_layer); } static void down_handler(ClickRecognizerRef recognizer, void...
_deinit(&data->check_icon); gbitmap_deinit(&data->x_icon); kernel_free(data); } static WindowStack *prv_get_window_stack(void) { return modal_manager_get_window_stack(ModalPriorityAlert); } static void prv_worker_crash_button_up_handler(ClickRecognizerRef recognizer, void *context) { WorkerCrashDialogData *da...
{ // Just return and don't show any crash UI if we failed to create the actionable dialog return; }
Dialog *dialog = actionable_dialog_get_dialog(data->actionable_dialog); prv_configure_crash_dialog(dialog, crash_reason); kernel_free(crash_reason); actionable_dialog_set_action_bar_type(data->actionable_dialog, DialogActionBarCustom, ...
-protect on RTC_BKP_x registers } void boot_main(void) { prv_configure_system_flash(); prv_enable_backup_access(); dbgserial_init(); prv_print_reset_reason(); boot_bit_init(); if (!rtc_init()) { // Need to initialize the display in this // case so we can see the sad watch display_init(); ...
{ prv_sad_watch(ERROR_RESET_LOOP); }
watchdog_init(); #ifndef NO_WATCHDOG watchdog_start(); #endif prv_jump_to_fw(); }
ng_delta; if (config->alignment) { text_node->alignment = ToGTextAlignment(config->alignment); } #if PBL_COLOR const LayoutColors *colors = layout_get_colors(layout); switch (config->color) { case LayoutColor_None: break; case LayoutColor_Primary: text_node->color = colors->primary_color...
{ GTextNode *node = layout_create_text_node_from_config(layout, config->nodes[i]); graphics_text_node_container_add_child(container_node, node); }
prv_set_text_node_extent(&container_node->node, &config->extent); } static GTextNodeHorizontal *prv_create_horizontal_container_node_from_config( const LayoutLayer *layout, const LayoutNodeHorizontalConfig *config) { const int capacity = config->container.num_nodes + config->container.extra_capacity; GTextN...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_check_free_list()
s function doesn't get called for 49 days we'll miss a rollover but that's // extremely unlikely. TickType_t rollover_amount = -1; s_coarse_ticks += rollover_amount; } s_last_freertos_tick_count = freertos_tick_count; RtcTicks ret_value = freertos_tick_count + s_coarse_ticks; if (ints_enabled) { ...
rtc_get_time_ms(&seconds, &ms)
; return seconds; } //! Tracks whether we've successfully initialized the wakeup functionality static bool s_rtc_wakeup_initialized = false; static const int RTC_WAKEUP_HZ = LSE_FREQUENCY_HZ / 2; void rtc_alarm_init(void) { RTC_ITConfig(RTC_IT_WUT, DISABLE); RTC_WakeUpCmd(DISABLE); // Make sure this in in ...
{ -88, 480, -760}, { -120, 520, -944}, { -136, 664, -904}, { -120, 336, -736}, { -128, 728, -952}, { -64, 384, -784}, { -136, 648, -1056}, { -88, 568, -976}, { -152, 456, -848}, { -72, 608, -1064}, { -88, 536, -816}, { -136, 584, -936}, { -48, 688, -928}, { -152, ...
{ -96, 440, -928}, { -88, 416, -904}, { -72, 328, -792}, { -104, 440, -784}, { -48, 400, -696}, { -96, 368, -808}, { -112, 416, -912}, // 26 seconds { -168, 512, -896}, { -112, 456, -864}, { -104, 480, -952}, { -104, 448, -1016}, { -80, 448, -1056}, { -120, 440, -...
{ -128, 408, -952}, { -104, 424, -912}, { -72, 424, -992}, { -96, 480, -968}, { -104, 360, -880}, { -64, 416, -1064}, { -104, 376, -856}, { -112, 472, -984}, { -96, 400, -952}, { -88, 408, -824}, { -96, 528, -1064}, { -136, 352, -752}, { -96, 448, -1024}, { -128,...
ffer_read(buffer, client, num_bytes, &read_ptr, &chunk)); memcpy(data, read_ptr, chunk); cl_assert(shared_circular_buffer_consume(buffer, client, chunk)); buffer += chunk; num_bytes -= chunk; } } void test_shared_circular_buffer__one_client(void) { SharedCircularBuffer buffer; uint8_t storage[9]...
shared_circular_buffer_write(&buffer, (uint8_t*) "123456", 6, false)
); // Read different amounts from each client cl_assert(shared_circular_buffer_read(&buffer, &client1, 4, &out_buffer, &out_length)); cl_assert(shared_circular_buffer_consume(&buffer, &client1, 4)); cl_assert(memcmp(out_buffer, "1234", 4) == 0); cl_assert_equal_i(shared_circular_buffer_get_write_space_remai...
og.h" #include "stubs_tick.h" extern SemaphoreHandle_t put_bytes_get_semaphore(void); extern TimerID put_bytes_get_timer_id(void); extern uint32_t put_bytes_get_index(void); extern uint8_t prv_put_bytes_get_max_batched_pb_ops(void); extern const ReceiverImplementation g_put_bytes_receiver_impl; static const PebblePr...
htonl(total_size)
, .type = ObjectFile, }; memcpy(&init_msg->filename[0], fn, fn_len); prv_receive_data(s_session, buffer, sizeof(buffer)); } static void prv_receive_put(uint32_t cookie, const uint8_t *payload, uint32_t payload_size) { uint8_t buffer[sizeof(PutRequest) + payload_size]; PutRequest *put_msg = (PutRequest *...
p_line_length(TimelineLayer *layer, GRect *first_icon_frame_out, GRect *second_icon_frame_out) { const int full_line_length = prv_get_line_length(layer, first_icon_frame_out, second_icon_frame_out); return (3 * full_line_length) / 5; } #define REL_BAR_BACK_TO_BACK_OFFSE...
(duration)
); animation_set_duration(curr_rel_bar_anim, REL_BAR_CURR_ANIM_DURATION(duration)); animation_set_custom_interpolation(curr_rel_bar_anim, interpolate); } return curr_rel_bar_anim; } #define REL_BAR_LINE_CHECK_LENGTH 6 #define REL_BAR_LINE_WIDTH 2 #define REL_BAR_LINE_HORIZ_OFFSET ((SIDEBAR_WIDTH / 2) + (...
util/hdlc.h" #include "util/math.h" #include "util/mbuf_iterator.h" //! The timeout for receiving the context frame after the break characters in ms static const uint32_t NOTIFY_TIMEOUT = 100; static const uint16_t SMARTSTRAP_MAX_TIMEOUT = 1000; //! The header contains the version (1 byte), flags (4 bytes), and profi...
if (context.success) { if (context.is_notify) { // get the profile from the frame FrameHeader *header = mbuf_get_data(&s_header_mbuf); read_profile = header->profile; } PBL_ASSERTN(s_read_info.length >= FRAME_MIN_LENGTH); read_length = s_read_info.length - FRAME_MIN_LENGTH; // don'...
accessory_use_dma(false); mbuf_clear_next(&s_header_mbuf); prv_reset_read_info(); prv_reset_read_consumer(); smartstrap_fsm_state_set(SmartstrapStateReadReady); smartstrap_state_unlock(); if (context.is_notify) { smartstrap_profiles_handle_notification(context.success, read_profile); } else { ...
/* * 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...
ARRAY_LENGTH(array)
, sizeof(int32_t), prv_int32_cmp); int32_t sorted[] = {-9, -6, 1, 2, 3, 4, 5, 5, 6, 7, 8}; cl_assert_equal_m(array, sorted, sizeof(array)); } void test_sort__int32_array_desc(void) { int32_t array[] = {-9, 1, 8, 2, 7, 3, -6, 4, 6, 5, 5}; sort_bubble(array, ARRAY_LENGTH(array), sizeof(int32_t), prv_int32_cmp_...
{ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, }, }, .identity = (BTDeviceInternal) { .address = (BTDeviceAddress) { .octets = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, }, }, .is_classic = false, ...
(&addr_1, &link_key_1, name_1, &platform_bits_1)
; cl_assert(id_1 != BT_BONDING_ID_INVALID); cl_assert_equal_i(fake_shared_prf_storage_get_bt_classic_store_count(), 1); // Read it back ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_1, &addr_out, &link_key_out, name_out, &platform_bits_out); c...
*entry_a = (SleepFileTestEntry *)a; SleepFileTestEntry *entry_b = (SleepFileTestEntry *)b; return strcmp(entry_a->name, entry_b->name); } // -------------------------------------------------------------------------------------- // Callback provided to the qsort() routine for sorting activity tests by name int prv...
cl_assert(success)
= 30; for (int i = 0; i < num_iters; i++) { int files_written = run_full_flash_region_test(); if ((i % 2) == 0) { pfs_init(true); // simulate a reboot } // delete all files for (int i = (files_written - 1); i >= 0; i--) { char name[128]; snprintf(name, sizeof(name), "file%d", i...
num_pages()
; i++) { char name[10]; snprintf(name, sizeof(name), "test%d", i); int fd = pfs_open(name, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); if (((i % 2) == 0) || i > ((num_pages() * 2) / 10)) { cl_assert(pfs_close_and_remove(fd) >= 0); } else { pfs_close(fd); } cl_...
NEW_SYSTEM_RESOURCES_AVAILABLE); ResourceStoreEntry entry = { .id = 0, // resource id 0 means the store itself .impl = &g_system_bank_impl, .length = ENTRY_LENGTH_UNSET }; // Increment s_active_bank and call resource_storage_generic_check for each value to find // a bank that's valid. for (s_act...
{ return NULL; }
return (uint8_t *)(uintptr_t)(FLASH_MEMORY_MAPPABLE_ADDRESS + BANK.begin + entry->offset); } #else bool resource_storage_flash_bytes_are_readonly(const void *bytes) { return false; } static const uint8_t *resource_storage_system_bank_readonly_bytes(ResourceStoreEntry *entry, ...
te->test_entry.total.value); } else if (strcmp(token, "TEST_TOTAL_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.total.min); } else if (strcmp(token, "TEST_TOTAL_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.total.max); } else if (s...
(token + strlen(token) + 1, "%d, 0x%x, %d, %d, %d", &steps, &orientation, &vmc, &light, &plugged_in)
; } else { cl_assert(false); } fflush(stdout); PBL_ASSERTN(state->test_entry.num_samples < SLEEP_SAMPLES_DISCOVERY_MAX_SAMPLES); state->samples[state->test_entry.num_samples++] = (AlgMinuteFileSample) { .v5_fields = { .steps = steps, .orientation = orie...
pogatt_enabled); gap_sec_level_t level = GAP_SEC_LEVEL_3; if (prv_is_encrypted(conn_idx)) { PBL_LOG(LOG_LEVEL_INFO, "Link already encrypted!"); if (!req->should_force_slave_security_request) { return; } // Make sure to request the same security level when sending a request to refresh encryptio...
PBL_LOG(LOG_LEVEL_ERROR, "ble_gatts_send_event: %u", e)
; } } static att_error_t prv_handle_cccd_write(const ble_evt_gatts_write_req_t *evt) { if (evt->length < sizeof(uint16_t)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid CCCD value length %u!", evt->length); return ATT_ERROR_INVALID_VALUE_LENGTH; } uint16_t cccd_value = 0; memcpy(&cccd_value, evt->value, sizeof...
gth = 0, .Maximum_Connection_Length = 40950, }; const int r = GAP_LE_Create_Connection(stack_id, 10240, 10240, fpWhiteList, 0 /* fpWhiteList ignores remote addr type */, NULL /* fpWhiteList ignores remote addr */, ...
if (intent->is_bonding_based) { return false; }
return bt_device_equal(&target_device->opaque, &intent->device.opaque); } static GAPLEConnectionIntent * prv_get_intent_by_device(const BTDeviceInternal *device) { return (GAPLEConnectionIntent *) list_find(&s_intents->node, prv_intent_filter_by_device, ...
prv_num_rows(context)
== 0) { // When we have no background apps, we want a double height row to display the // 'No background apps' line, so that translations can fit and we stop wasting so much screen // space. return 2 * cell_height; } #endif return cell_height; } static void prv_worker_launch_handler(PebbleEvent *e...
nabled; } bool battery_is_usb_connected(void) { return false; } // ----------------------------------------------------------------------------- // Test Helpers // ----------------------------------------------------------------------------- #define TO_SESSION_REF(x) ((HRMSessionRef)(long)(x)) static const HRMData...
(app_id, update_interval_s, expire_s, features)
; cl_assert(sys_hrm_manager_get_app_subscription(app_id) == session_ref); uint16_t ret_expire_s; sys_hrm_manager_get_subscription_info(session_ref, NULL, NULL, &ret_expire_s, NULL); cl_assert_equal_i(ret_expire_s, 0); // Now, call the process cleanup. This should place an expiration time on the subscription ...
name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_1, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&link_key_1, &link_key_out, sizeof(link_key_out)); cl_assert_equal_s(name_1, name_out); cl_assert_equal_i(platform_bits_1, platform_bits_out); ret = bt_persist...
(&addr_in, &link_key_in, name_in, &platform_bits_in)
; cl_assert(id != BT_BONDING_ID_INVALID); // Read it back BTBondingID id_out = bt_persistent_storage_get_bt_classic_pairing_by_addr(&addr_in, &link_key_out, name_out, &platform_bits_out); cl_assert_equal_i(id, id_out); cl_assert_equal_m(&li...
(slave->slave_state->initialized)
; PBL_ASSERTN(slave->slave_state->acquired); prv_spi_cmd(slave->spi_bus, SpiEnable); } void spi_ll_slave_spi_disable(const SPISlavePort *slave) { PBL_ASSERTN(slave->slave_state->initialized); PBL_ASSERTN(slave->slave_state->acquired); prv_spi_cmd(slave->spi_bus, SpiDisable); } void spi_ll_slave_scs_assert(c...
st update frequency. uint32_t lowest_us_per_update = UINT32_MAX; AccelManagerState *state = (AccelManagerState *)s_data_subscribers; while (state) { *lowest_interval_us = MIN(state->sampling_interval_us, *lowest_interval_us); *max_n_samples = MAX(state->samples_per_update, *max_n_samples); if (state...
if (!state->raw_buffer) { state = (AccelManagerState *)state->list_node.next; continue; }
hStep) { .type = RockyAPIPathStepType_Arc, .arc = (RockyAPIPathStepArc) { .center = center, .radius = radius, // TODO: PBL-40555 consolidate angle handling here and in rocky_api_graphics.c .angle_start = jerry_get_angle_value(argv[3]), .angle_end = jerry_get_angle_value(argv[4]), ...
TRY_ALLOCATE_STEPS_OR_RETURN_ERROR(inc_steps)
; return jerry_create_undefined(); } size_t rocky_api_graphics_path2d_min_array_len(void) { return MINIMUM_ARRAY_LEN; } size_t rocky_api_graphics_path2d_array_len(void) { return s_rocky_path_steps_array_len; } jerry_value_t rocky_api_graphics_path2d_call_fill(void) { // Args aren't correct, but it doesn't ma...
may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTI...
(&text_layer->layout_cache)
/* * 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...
periph_config_release_lock()
; return true; } //! Interrupt masks for InterruptStatus1 and InterruptMask1 registers enum PmicInt1 { PmicInt1_Trickle = (1 << 0), //!< Trickle charge PmicInt1_NoBat = (1 << 1), //!< Battery detached PmicInt1_Resume = (1 << 2), //!< Resuming charge on drop after full PmicInt1_EOC = (1 << 3), //!< End...
); } void draw_text_single_line_wordwrap_clip_across_ny_second_line(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, -46, 72, 50), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_te...
layer_render_tree(&canvas, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_ny.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_y); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,...
ealth__sum_today(void) { s_sys_activity_get_metric_values.out.history[0] = 123; s_sys_activity_get_metric_values.out.history[1] = 456; HealthValue result = health_service_sum_today(HealthMetricStepCount); cl_assert_equal_i(123, result); cl_assert_equal_i(s_sys_activity_get_metric_values.in.metric, ActivityMet...
(now + 10, now + 20, NULL)
; cl_assert_equal_b(result, false); // too far in the past result = prv_calculate_time_range( now - (ACTIVITY_HISTORY_DAYS + 10) * SECONDS_PER_DAY, now - (ACTIVITY_HISTORY_DAYS + 2) * SECONDS_PER_DAY, NULL); cl_assert_equal_b(result, false); // start after end result = prv_calculate_time_range(no...
/* * 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...
{ // Force alpha to be opaque since that represents how framebuffer discards it in display. // Also needed for unit tests since PNG tests interpret alpha color.a = 3; line[point.x] = color.argb; }
} #endif #if PBL_BW static inline void set_pixel_raw_2bit(GContext* ctx, GPoint point) { if (!grect_contains_point(&ctx->dest_bitmap.bounds, &point)) { return; } bool black = (gcolor_equal(ctx->draw_state.stroke_color, GColorBlack)); uint8_t *line = ((uint8_t *)ctx->dest_bitmap.addr) + (ctx->dest_bitmap....
assert_alarm_config(id2, 4, 14, true, ALARM_KIND_EVERYDAY, s_every_day_schedule); cl_assert_equal_i(s_num_timeline_adds, 12); cl_assert_equal_i(s_num_timeline_removes, 9); AlarmId invalid_id = 7; alarm_set_enabled(invalid_id, false); cl_assert_equal_i(s_num_timeline_adds, 12); cl_assert_equal_i(s_num_timel...
cl_assert_equal_i((int)pin_icon_tiny, TIMELINE_RESOURCE_ALARM_CLOCK)
, 352}, { 88, 1920, 744}, { -248, 1544, 872}, { 104, 1328, 432}, { 8, 880, 472}, { 88, 624, 320}, { 160, 584, 320}, { 160, 608, 304}, { 144, 704, 392}, { 136, 888, 408}, { 136, 944, 344}, { 112, 1048, 336}, { 16, 1240, 400}, { -32, 1616, 280}, { -128, 1344, 232}, ...
{ 312, 584, 160}, { 368, 744, 104}, { 312, 800, 120}, { 248, 912, 40}, { 272, 904, 40}, { 384, 1040, 200}, { 320, 1208, 232}, { 176, 1144, 344}, { 336, 1544, 608}, { 24, 1224, 640}, { 288, 1128, 528}, { 200, 832, 592}, { 240, 672, 400}, { 168, 632, 368}, { 152...
{ -112, 1440, 336}, { -88, 1288, 16}, { 96, 1064, 48}, // 33 seconds { 160, 800, 8}, { 240, 752, 32}, { 256, 560, 72}, { 272, 632, 40}, { 232, 808, 96}, { 224, 1000, -64}, { 304, 1192, 216}, { 304, 1192, 144}, { 304, 1008, 136}, { 288, 1320, 352}, { -64, 1272...
ster_EXTENDED_MEMORY_MAP, BMA255_EXTENDED_MEMORY_MAP_OPEN); bma255_write_register(BMA255Register_TEMPERATURE_SENSOR_CTRL, BMA255_TEMPERATURE_SENSOR_DISABLE); bma255_write_register(BMA255Register_EXTENDED_MEMORY_MAP, BMA255_EXTENDED_MEMORY_MAP_CLOSE); exti_configure_pin(BOARD_CONFIG_ACCEL.accel_ints[0], ExtiTrigg...
bma255_send_and_receive_byte(0)
; } prv_convert_accel_raw_data_to_mgs(buf, &data[i]); } bma255_end_txn(); // Timestamp & Dispatch data for (int i = 0; i < num_samples_available; ++i) { // Make a timestamp approximation based on the current time, the sample // being processed and the sampling interval. data[i].timestamp_us...
ake sure this is an animation in the scheduled list PBL_ASSERTN(list_contains(state->scheduled_head, &animation->list_node)); #endif const int32_t rel_ms_running = serial_distance32(animation->abs_start_time_ms, now); if (rel_ms_running < 0) { // Animations are ordered by abs_start_time_ms....
(state, animation_array[i], false /*quiet*/)
; if (!component) { // It is OK to pass in already destroyed children. continue; } // The 2nd and subsequent children of a sequence must NOT be already scheduled. Also fail if // child already has a parent if (component->parent || ((type == AnimationTypeSequence) && (i > 0) && (...
mmon/system_task.h" #include "services/normal/blob_db/pin_db.h" #include "system/logging.h" #include "system/passert.h" #include "system/status_codes.h" #include "util/time/time.h" typedef struct TimelineEventState { const TimelineEventImpl *impl; SerializedTimelineItemHeader *filter_header; void *context; } Tim...
if ((rv != S_SUCCESS) && (rv != S_NO_MORE_ITEMS)) { // A failure occurred. Call the update functions with a NULL item PBL_LOG(LOG_LEVEL_ERROR, "Failed to find next event."); } else if (rv != S_NO_MORE_ITEMS) { // Calculate the timeout before the item buffer is re-used timeout_ms = prv_calc_timeout(&it...
/* * 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...
{ LauncherAppGlanceWeather *weather_glance = launcher_app_glance_structured_get_data(structured_glance); if (weather_glance) { event_service_client_unsubscribe(&weather_glance->weather_event_info); kino_reel_destroy(weather_glance->icon); } app_free(weather_glance); }
static uint32_t prv_get_weather_icon_resource_id_for_type(WeatherType type) { AppResourceInfo res_info; const bool lookup_success = timeline_resources_get_id_system(weather_type_get_timeline_resource_id(type), TimelineResourceSizeTiny, SYSTEM_APP, &res_info); return ...
/////////////////// //! Common Helper Functions BtPersistBondingType prv_get_type_for_id(BTBondingID id) { BtPersistBondingData data; prv_file_get(&id, sizeof(id), &data, sizeof(data)); return data.type; } bool prv_delete_pairing_with_type_by_id(BTBondingID bonding, BtPersistBondingType type, ...
{ return true; // continue iterating }
KeyForSMPairingItrData *itr_data = (KeyForSMPairingItrData*) context; BTBondingID key; BtPersistBondingData stored_data; info->get_key(file, (uint8_t*) &key, info->key_len); info->get_val(file, (uint8_t*) &stored_data, MIN((unsigned)info->val_len, sizeof(stored_data))); if (stored_data.type == BtPersist...
ead == &bar2.list_node); cl_assert(list_get_tail(head) == &bar3.list_node); head = list_sorted_add(head, &bar1.list_node, (Comparator) sorting_comparator, true); cl_assert(head == &bar1.list_node); cl_assert(list_get_next(head) == &bar2.list_node); cl_assert(list_get_tail(head) == &bar3.list_node); } void t...
cl_assert_equal_p(list_get_tail(&b), &f)
clude "fake_pbl_malloc.h" // Stubs #include "stubs_bluetopia_interface.h" #include "stubs_bt_lock.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" extern void conn_mgr_handle_desired_state_granted(GAPLEConnection *hdl, ResponseTimeStat...
cl_assert_equal_i(fake_gap_le_connect_params_get_last_requested(), ResponseTimeMiddle)
; // higher rate should take over lower rate already scheduled conn_mgr_set_ble_conn_response_time( &s_hdl, BtConsumerLeServiceDiscovery, ResponseTimeMin, 25); state = conn_mgr_get_latency_for_le_connection(&s_hdl, &secs_to_wait); cl_assert_equal_i(state, ResponseTimeMin); cl_assert_equal_i(secs_to_wai...
const uint32_t delta) { AnimationPrivate *next; if (delta == 0) { return; } AnimationPrivate *animation = (AnimationPrivate *) state->scheduled_head; while (animation) { // Since we are reducing the start times, each of the animations we operate on will be // moved earlier in th...
if (animation->type != AnimationTypePrimitive) { // For a complex animation, unschedule each of the components for (int child_idx = 0; child_idx < ANIMATION_MAX_CHILDREN; child_idx++) { AnimationPrivate *child = prv_find_animation_by_parent_child_idx(state, animation, child_idx); if (!child) { ...
if (!prv_animation_is_scheduled(state, animation)) { // When we unschedule a top-level animation, we call prv_unschedule_animation() on each of // the children, which gives us a chance to destroy them. Children are not allowed to destroy // themselves. if (animation->calling_end_handlers) { //...
e, true, false}; alarm_set_custom(id, custom_schedule2); prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_CUSTOM, custom_schedule2); } void test_alarm__alarm_get_custom_days(void) { AlarmId id1, id2; bool schedule_1[7] = {true, false, false, false, false, false, true}; bool verify_schedule_1[7] = {false...
cl_assert_equal_i(s_num_timeline_removes, 3)
; alarm_set_enabled(id2, false); prv_assert_alarm_config(id2, 4, 14, true, ALARM_KIND_EVERYDAY, s_every_day_schedule); cl_assert_equal_i(s_num_timeline_adds, 12); cl_assert_equal_i(s_num_timeline_removes, 9); AlarmId invalid_id = 7; alarm_set_enabled(invalid_id, false); cl_assert_equal_i(s_num_timeline_...
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 KIND, either expres...
(out_buf, out_buf_len, "%02x", *byte_stream)
; out_buf += 2; out_buf_len -= 2; byte_stream += (print_backward) ? -1 : 1; bytes_left -= 1; } } // ------------------------------------------------------------------------------- void safe_strcat(char* dst, const char* src, int dst_space) { int remaining = dst_space - strlen(dst); if (dst_spac...
/* * 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...
memcmp(entry->key, info->key, entry->key_len)
== 0); } return false; } static RamStorageEntry *prv_get_entry(RamStorageEntry *entries, const uint8_t *key, int key_len) { KeyInfo info = { .key = key, .key_len = key_len, }; return (RamStorageEntry *)list_find((ListNode *)entries, prv_filter_callback, &info); } static void prv_delete(RamStorageEn...
nection already has IRK!?"); } gap_le_connection_set_irk(connection, remote_irk); } unlock: bt_unlock(); } void bt_driver_handle_peer_version_info_event(const BleRemoteVersionInfoReceivedEvent *e) { bt_lock(); GAPLEConnection *connection = gap_le_connection_by_device(&e->peer_address); if (connectio...
if (local_is_master && prv_is_intent_requiring_encryption(intent)) { // TODO: kick off pairing }
} intent = next; } if (!local_is_master) { // At the moment we don't grab analytics for connections we generate bluetooth_analytics_handle_connect(&event->peer_address, &event->conn_params); } if (!found_match) { // There is no connection intent from our 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...
{ FakeBonding *bonding = (FakeBonding *) list_find(&s_head->node, prv_find_by_id, (void *) (uintptr_t) id); if (!bonding) { return false; } if (IRK_out) { *IRK_out = bonding->irk; } if (device_out) { *device_out = bonding->device; } if (name...
BTBondingID fake_bt_persistent_storage_add(const SMIdentityResolvingKey *irk, const BTDeviceInternal *device, const char name[BT_DEVICE_NAME_BUFFER_SIZE], bool is_gateway) { FakeBonding *bonding = (FakeBonding *) malloc(sizeof(FakeBo...
PBL_LOG(LOG_LEVEL_DEBUG, "other callback: %d", index)
; } static void poll_callback(int index, void *ctx) { poll_remote_send_request(POLL_REMOTE_SERVICE_MAIL); } static const SimpleMenuItem s_menu_items[] = { { "Poll Mail", "", NULL, poll_callback }, { "Title A", "Callback A", NULL, callback_a }, { "Another Title", NULL, NULL, other_callback }, { "Last Title",...
struct LCPPacket *packet) { switch (this->state->link_state) { case LinkState_Closing: case LinkState_Stopping: // Do nothing break; case LinkState_Closed: prv_send_terminate_ack(this, -1); break; case LinkState_Stopped: this->state->restart_count = MAX_CONFIGURE; ...
{ this->state->restart_count = 0; prv_start_timer(this); prv_transition_to(this, LinkState_Stopping); }
prv_send_terminate_ack(this, packet->identifier); } static void prv_on_terminate_ack(PPPControlProtocol *this, struct LCPPacket *packet) { if (this->state->link_state == LinkState_Closing) { prv_transition_to(this, LinkState_Closed); } else if (this->state->link_state == Lin...
/* * 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...
(shared_circular_buffer_get_write_space_remaining(&buffer), 0)
; // Try a wrapped read cl_assert(shared_circular_buffer_read(&buffer, &client, 6, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 5); cl_assert(memcmp(out_buffer, (uint8_t*) "56789", 5) == 0); cl_assert(shared_circular_buffer_consume(&buffer, &client, 5)); // Get the rest of the wrapped read ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, grect_inset(layer->bounds, GEdgeInsets(-overdraw)), GOvalScaleModeFillCircle, crumbs_layer_width(), 0, TRIG_MAX_ANGLE)
; } void crumbs_layer_set_level(CrumbsLayer *crumbs_layer, int level) { const int max_crumbs = prv_crumb_maximum_count(); if (level > max_crumbs) { PBL_LOG(LOG_LEVEL_WARNING, "exceeded max number of crumbs"); level = max_crumbs; } crumbs_layer->level = level; layer_mark_dirty((Layer *)crumbs_layer); ...
for (; sn < s_tx_window_size; ++sn) { cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, sizeof(s_short_data_fragment) - sn), true); ppogatt_se...
{ 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 for. That would only happen if we timed // out! fake_gatt_client_op_assert_no_write(); } void test_ppogatt__mtu_zero_due_to_disconnection(void) { test_ppogatt__open_session_when_found_pebble_app(); Transport *transport = ppogatt_client_for_uuid(&s_met...
alog_set_fullscreen(dialog, true); dialog_set_text(dialog, i18n_get("End Workout?", workout_dialog)); dialog_set_background_color(dialog, BACKGROUND_COLOR); dialog_set_text_color(dialog, TEXT_COLOR); dialog_set_icon(dialog, RESOURCE_ID_WORKOUT_APP_END); dialog_set_icon_animate_direction(dialog, DialogIconAnim...
(&active_window->window)
_test_impl_data, sizeof(s_test_impl_data), NULL, NULL)); s_test_impl.handle_touch_event = NULL; cl_assert_passert(recognizer_create_with_data(&s_test_impl, &s_test_impl_data, sizeof(s_test_impl_data), dummy, ...
recognizer_transition_state(r, RecognizerState_Updated)
); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Cancelled)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Completed)); r->state = RecognizerState_Updated; recognizer_transition_state(r, RecognizerState_Cancelled); cl_assert_equal_i(event_type, RecognizerEvent_Cancelled...
ribute_list_destroy_list(&pin_attr_list); attribute_list_destroy_list(&completed_attr_list); attribute_list_destroy_list(&postpone_attr_list); attribute_list_destroy_list(&remove_attr_list); timeline_item_destroy(item); } static void prv_push_success_dialog(void) { SimpleDialog *simple_dialog = simple_dialog...
if (data->timestamp == 0) { // If the user didn't specify a time set it to be 1 hour from the current time, // rounded up to the nearest 15 min. // Ex: a reminder created at 10:08 AM with no specified time is due at 11:15 AM time_t utc_sec = rtc_get_time() + SECONDS_PER_HOUR + (15 * SECONDS_PER_...
// If the user doesn't accept the transcription, try again. data->ui_state = ReminderAppUIState_Start; prv_build_transcription_dialog_text(data); prv_push_transcription_dialog(data); } else { // Exit immediately because this event may or may not be handled before the main window appears. d...
40, 208, 48}, { 848, 160, 80}, { 824, 96, 96}, { 752, 80, 64}, { 680, 56, 32}, { 720, 40, 32}, { 856, 72, 0}, { 1096, 40, -8}, { 1632, 240, -120}, { 1336, 408, -320}, { 1440, 440, -320}, { 1688, 592, -328}, { 1336, 544, -112}, { 888, 352, -8}, { 752, 296, 8}, ...
{ 928, 120, 80}, { 848, 88, 88}, // 19 seconds { 760, 96, 80}, { 808, 96, 48}, { 888, 96, 24}, { 1064, -32, 64}, { 1448, 128, -16}, { 1280, 208, -344}, { 1320, 160, -304}, { 1560, 304, -272}, { 1464, 320, -248}, { 1088, 272, -112}, { 856, 288, -120}, { 760, 27...
{ 1288, 232, -40}, { 976, 224, -40}, { 808, 280, -72}, { 736, 312, -64}, { 760, 352, -88}, { 856, 352, -96}, { 952, 344, -88}, { 1096, 352, -104}, { 1368, 384, -136}, // 22 seconds { 1576, 304, 16}, { 1776, 352, 8}, { 1240, 432, -16}, { 1224, 272, 104}, { 127...
/* * 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(num_intervals, 1)
; cl_assert_equal_i(average_ms, 1000); // valid interval fake_rtc_increment_time_ms(1020); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 2); cl_assert_equal_i(average_ms, 1010); // invalid interval, too high fake_rtc_in...
; ///////////////////////// // Pin DB specific API ///////////////////////// status_t pin_db_delete_with_parent(const TimelineItemId *parent_id) { return (timeline_item_storage_delete_with_parent(&s_pin_db_storage, parent_id, NULL)); } //! Caution: CommonTimelineItemHeader .flags & .status are stored inverted and ...
prv_insert_item(item, true /* emit_event */)
; } status_t pin_db_insert_item_without_event(TimelineItem *item) { return prv_insert_item(item, false /* emit_event */); } status_t pin_db_set_status_bits(const TimelineItemId *id, uint8_t status) { return timeline_item_storage_set_status_bits(&s_pin_db_storage, (uint8_t *)id, sizeof(*id), ...
"TmplStringSing", ""), /// Plural suffix for seconds with no units i18n_ctx_noop("TmplStringPlur", "")}, /// Singular suffix for seconds with abbreviated units { i18n_ctx_noop("TmplStringSing", " sec"), /// Plural suffix for seconds with abbreviated units i18n_ctx_noop("TmplStringPlur", " sec")}, /// ...
{ // Add 1 because the next eval time is how long until the result changes. remain++; }
if (state->eval_cond) { if (remain < state->eval_cond->eval_time) { state->eval_cond->eval_time = remain; } } value /= divide; if (should_mod && (mod != 0)) { value %= mod; } prv_append_number(state, zero_pad ? "%02d" : "%d", value); prv_append_string_i18n(state, suffix_strings[add_un...
/* * 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 (!session) { // timed out because of lost connection return; }
DataLoggingSession *logging_session = dls_list_find_by_session_id(session_id); struct PACKED { uint8_t command; uint8_t session_id; } msg = { .command = DataLoggingEndpointCmdTimeout, .session_id = logging_session->comm.session_id, }; comm_session_send_data(session, ENDPOINT_ID_DATA_LOGGIN...
window_stack_remove(&s_data_ptr->window, true /* animated */); } BTPairingUIData *data = kernel_malloc_check(sizeof(BTPairingUIData)); *data = (BTPairingUIData){}; data->ui_state = BTPairingUIStateAwaitingUserConfirmation; s_data_ptr = data; } static void prv_handle_confirmation_request(const PairingUserCon...
kernel_zalloc_check(info_len)
; PebbleBluetoothPairingConfirmationInfo *confirmation_info = (PebbleBluetoothPairingConfirmationInfo *)cursor; cursor += sizeof(PebbleBluetoothPairingConfirmationInfo); char *device_name_copy = NULL; prv_copy_string_and_move_cursor(device_name, &device_name_copy, &cursor); char *confirmation_token_c...
ze = right_rects_size }; prv_draw_vlines_in_rect(ctx, draw_func, &top_left_rect, top_right_rect_color); GColor bottom_right_rect_color = GColorYellow; bottom_right_rect_color.a = 2; const GRect top_right_rect = (GRect) { .origin = GPoint(right_rects_x, (bitmap_bounds_size->h / 2) + right_rects_y_offset), ...
prv_draw_hline_test_pattern(&ctx, prv_hline_pattern_assign_horizontal_line_delta_raw)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_core_assign_horizontal_line_delta_raw"))); }; // VERTICAL LINE TESTS // These tests use a pattern of two skinny 66% opacity rectangles drawn at the right of the // screen (green on top and yellow on bottom) and one tall ...
{ for (int i = 0; i < ARRAY_LENGTH(s_connections); ++i) { cb(s_connections[i], data); } }
void launcher_task_add_callback(CallbackEventCallback callback, void *data) { callback(data); } bool sys_hrm_manager_is_hrm_present(void) { return true; } static int s_sys_hrm_manager_unsubscribe_call_count; bool sys_hrm_manager_unsubscribe(HRMSessionRef session) { ++s_sys_hrm_manager_unsubscribe_call_count; ...