prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ootbits.h" #include "stubs_click.h" #include "stubs_event_service_client.h" #include "stubs_health_service.h" #include "stubs_layer.h" #include "stubs_logging.h" #include "stubs_memory_layout.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_process_info.h" #inc...
(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; #endif } void test_kickstart__render_steps_above_daily_avg_24h(void) { s_clock_is_24h_style = true; prv_set_data(&s_data, 10323, 7500, 8000, 0); window_set_on_screen(&s_data.window, true, true); window_render(&s_data.window, &s_ctx); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void tes...
_RECORD_LENGTH(MAX_HEX_DATA_BYTES) <= 256, "The value of MAX_HEX_DATA_BYTES will result in HEX records " "which are longer than the AS7000 loader can handle."); // The sw_version_major field is actually a bitfield encoding both the // major and minor components of the SDK version number....
(ppg_reading.tia)
; success = true; break; } PPG_DBG_VERBOSE("FAIL: got %"PRIu16" expected %u tia %"PRIu16, ppg_reading.idx, i + 1, ntohs(ppg_reading.tia)); // Keep trying... } if (!success) { // We didn't find a sample, just give up on reading PPG for this handsha...
iodic_timer_trigger(20); cl_assert_equal_i(battery_get_charge_state().charge_percent, 50); PBL_LOG(LOG_LEVEL_DEBUG, "▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲"); // Should still update if it goes lower fake_battery_set_millivolts(lower_mv); periodic_timer_trigger(20); cl_assert_equal_i(battery_get_charge_state().charge_per...
(!result.is_plugged)
; last_discharge_percent = result.charge_percent; } }
s 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 under the License. */ #i...
_Static_assert(offsetof(NumberWindow, window) == 0, "")
; NumberWindow *nw = (NumberWindow*) layer; graphics_context_set_text_color(ctx, GColorBlack); GRect frame = prv_get_text_frame(layer); frame.size.h = 54; TextLayoutExtended cached_label_layout = {}; graphics_draw_text(ctx, nw->label, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD), f...
ypedef struct PACKED InternalErrorResponse { uint8_t opcode; int32_t status_code; uint8_t bad_command[0]; } InternalErrorResponse; #define REGISTER_BULKIO_HANDLER(domain_type, domain_id, vtable) \ extern PulseBulkIODomainHandler vtable; #include "pulse_bulkio_handler.def" #undef REGISTER_BULKIO_HANDLER stat...
{ read_len = ret; pulse_fd->transfer_state.bytes_left -= read_len; pulse_fd->transfer_state.offset += read_len; pulse_reliable_send(resp, read_len + sizeof(ReadResponse)); if (pulse_fd->transfer_state.bytes_left > 0) { system_task_add_callback(prv_domain_read_cb, (void*)(uintptr_t)fd_num); ...
else { pulse_reliable_send_cancel(resp); Command cmd = { .opcode = BULKIO_CMD_DOMAIN_READ, .read = { .fd = fd_num } }; prv_respond_internal_error(&cmd, sizeof(cmd), ret); } } static void prv_handle_open(Command *cmd, size_t length) { PulseBulkIODomainHandler *domain_han...
/* * 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...
layer_mark_dirty(window_get_root_layer(data->window))
; } // ------------------------------------------------------------------------------- static void handle_second_tick(struct tm* tick_time, TimeUnits units_changed) { int32_t reading = temperature_read(); memcpy(s_temp_readings, s_temp_readings + 1, (READ_HISTORY_ENTRIES - 1) * sizeof(int32_t)); s_temp_readings[...
/* * 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...
(0b1, BITS(0))
; cl_assert_equal_i(0b00011111, BITS(4)); cl_assert_equal_i(0b00111111, BITS_BETWEEN(0, 5)); cl_assert_equal_i(0b00111000, BITS_BETWEEN(3, 5)); cl_assert_equal_i(0b00010000, BITS_BETWEEN(4, 4)); } // Flash memory is organized into twelve sectors of unequal sizes. // Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB. ...
ware of our running rate. actual_interval = BMA255SampleInterval_125HZ; prv_enable_operating_mode(AccelOperatingMode_Data, actual_interval); return accel_get_sampling_interval(); } static void prv_configure_operating_mode(void) { BMA255SampleInterval interval_us = accel_get_sampling_interval(); const uint8...
(BMA255PowerMode_Standby)
/* * 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 new_node; }
if (new_node == NULL) { return node; } ListNode * const head = node; for(;;) { int order = comparator(node, new_node); if (!ascending) { order = -order; } if (order < 0) { list_insert_before(node, new_node); if (node == head) { return new_node; } else { ...
; } // Check if the AttributeList has the attributes required for the slice const bool is_attr_list_valid = prv_is_slice_attribute_list_valid(serialized_slice->type, &attr_list); if (!is_attr_list_valid) { PBL_LOG(LOG_LEVEL_WARNING, "Seria...
{ mutex_lock(s_app_glance_db.mutex); const status_t rv = settings_file_open(&s_app_glance_db.settings_file, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE); if (rv != S_SUCCESS) { mutex_unlock(s_app_glance_db.mutex); } return rv; }
static void prv_close_file_and_unlock_mutex(void) { settings_file_close(&s_app_glance_db.settings_file); mutex_unlock(s_app_glance_db.mutex); } ///////////////////////// // Blob DB API ///////////////////////// void app_glance_db_init(void) { s_app_glance_db.mutex = mutex_create(); } status_t app_glance_db_f...
kernel/pebble_tasks.h" #include "os/mutex.h" #include "process_management/app_install_manager.h" #include "process_management/app_manager.h" #include "services/normal/accessory/smartstrap_attribute.h" #include "services/normal/accessory/smartstrap_comms.h" #include "services/normal/accessory/smartstrap_link_control.h" ...
{ const uint16_t service_id = ReservedServiceManagement; const uint16_t attribute_id = ManagementServiceAttributeServiceDiscovery; if (s_reserved_read_mbuf) { // already a read in progress return; } s_reserved_read_mbuf = mbuf_get(s_read_buffer, sizeof(s_read_buffer), MBufPoolSmartstrap); Smartstrap...
ribute_register, uint16_t service_id, uint16_t attribute_id, uint8_t *buffer, size_t buffer_length) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(buffer, buffer_length); } if (buffer_length > SMARTSTRAP_ATTRIBUTE_LENGTH_MAXIMUM) { PBL_LOG(LOG_LEVEL_ERROR, "Attribute length...
mutex_unlock(s_attr_list_lock)
; if (!attr) { return SmartstrapResultInvalidArgs; } else if (!sys_smartstrap_is_service_connected(attr->service_id)) { // go back to idle if we had begun a write prv_cancel_transaction(attr); return SmartstrapResultServiceUnavailable; } if (type == SmartstrapRequestTypeBeginWrite) { if (at...
(&l, &GRect(10, 10, 180, 180))
; menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks){ .draw_row = prv_draw_row, .get_num_rows = prv_get_num_rows, }); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(0, l.selection.y); cl_assert_equal_i(0, scroll_layer_get_content_offset(&l.scroll_layer).y); ...
/* * 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...
{ // No worker currently running, launch this one and make it the default worker_manager_put_launch_worker_event(app_node->install_id); worker_manager_set_default_install_id(app_node->install_id); }
else if (worker_manager_get_task_context()->install_id != app_node->install_id) { // Undo the choice change that the OptionMenu does before we call select. We may decline // the change and therefore we don't want it to visually update yet. prv_worker_launch_handler // will update the choice if it fir...
alarm.h" #include "services/normal/timeline/timeline.h" #include "shell/system_theme.h" #include "system/logging.h" #include "system/passert.h" #include "util/string.h" #include "util/time/time.h" #include "util/trig.h" #include <stdio.h> #include <string.h> // Alarms app versions // 0: Initial version or never opene...
{ MenuIndex selected_menu_index = {0, prv_get_list_idx_of_alarm_id(data, select_alarm)}; menu_layer_reload_data(&data->menu_layer); menu_layer_set_selected_index(&data->menu_layer, selected_menu_index, MenuRowAlignCenter, false); }
static void prv_handle_alarm_editor_complete(AlarmEditorResult result, AlarmId id, void *callback_context) { AlarmsAppData *data = (AlarmsAppData *)callback_context; if (result == CANCELLED && !prv_are_alarms_scheduled(data)) { // In the case the user had no alarms...
annedResponses, .string_list = &string_list,}, }; static TimelineItemAction actions[] = { { .id = 0, .type = TimelineItemActionTypeResponse, .attr_list = { .num_attributes = ARRAY_LENGTH(action1_attributes), .attributes = action1_attributes } }, { .id = 1, .type = TimelineItemActi...
(notification_storage_get(&id, &r))
offset = 39; y_offset = 85; #else x_offset = PBL_IF_RECT_ELSE(10, 31); y_offset = PBL_IF_RECT_ELSE(44, 46); #endif width = config_width; break; case BTPairingUIStateAwaitingResult: alignment = GAlignLeft; #if PLATFORM_ROBERT || PLATFORM_CALCULUS x_offset = 76; y_offse...
(&window->layer, &kino_layer->layer)
; #if PLATFORM_ROBERT || PLATFORM_CALCULUS GRect pair_text_area = GRect(0, -2, width, 44); #else GRect pair_text_area = GRect(0, -2, width, 30); #endif #if PLATFORM_ROBERT || PLATFORM_CALCULUS layer_set_frame(&data->info_text_mask_layer, &GRect(x_offset, info_text_y_offset, width, 30)); #else layer_set_frame(...
/attributes.h" typedef enum { CommandInvokeAction = 0x02, CommandInvokeActionANCSNotif = 0x03, CommandPhoneResponse = 0x11, CommandPhoneActionResponse = 0x12, } Command; typedef enum { ResponseACK = 0x00, ResponseNACK = 0x01, ResponseACKANCSDismiss = 0x0F, ResponseNACKContactAmbiguity = 0x10, Respon...
kernel_zalloc_check(sizeof(InvokeActionMsgCbData) + attr_data_size)
; invoke_action_data->length = sizeof(invoke_action_data->msg) + attr_data_size; if (type == TimelineItemActionTypeAncsResponse || type == TimelineItemActionTypeAncsGeneric) { invoke_action_data->msg.command = CommandInvokeActionANCSNotif; } else { invoke_action_data->msg.command = CommandInvokeAction; ...
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 "launcher_app_glance_structured.h" #include "launcher_app_glance_private.h" #include "launcher_menu_layer.h" #i...
(GColorBlack, structured_glance->glance.is_highlighted ? GColorWhite : GColorBlack)
; } void launcher_app_glance_structured_draw_icon(LauncherAppGlanceStructured *structured_glance, GContext *ctx, KinoReel *icon, GPoint origin) { const GColor desired_tint_color = launcher_app_glance_structured_get_highlight_color(structured_glance); GenericGlan...
RM_KIND_WEEKENDS, &pin_uuid); alarm_pin_remove(&pin_uuid); cl_assert(uuid_equal(&pin_uuid, &s_last_timeline_item_removed_uuid)); } //////////////////////////////////////////////////////////////////////////////////////////////////// //! More Advanced Tests void test_alarm__recurring_daily_alarm_timeout_ahead(void)...
cl_assert_equal_i(s_num_alarm_events_put, 5)
; cl_assert_equal_i(s_num_timeline_adds, 41); cl_assert_equal_i(s_num_timeline_removes, 30); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. First one should be up again s_current_hour = 11; s_current_minute = 30; cron_service_wakeup(); cl_asse...
notifications_presented_list_init(); fail: mutex_unlock(s_notification_window_mutex); } void notification_window_init(bool is_modal) { prv_init_notification_window(is_modal); if (is_modal && notification_window_is_modal()) { // If we didn't ask for a modal window, it means some other task already created ...
prv_init_notification_window(true /*is_modal*/)
; if (data->is_modal) { WindowStack *window_stack = modal_manager_get_window_stack(NOTIFICATION_PRIORITY); bool is_new = !window_stack_contains_window(window_stack, &data->window); bool in_view = window_is_on_screen(&data->window); prv_notification_window_add_notification(id, type); if (is_new)...
0x30, }; prv_receive_entity_update(incomplete_playback_info_update, sizeof(incomplete_playback_info_update)); prv_assert_initial_playback_state(); } void test_ams__receive_malformed_player_volume_update(void) { prv_connect_ams(); cl_assert_equal_i(music_get_volume_percent(), 0);...
cl_assert_equal_s(music_get_connected_server_debug_name(), NULL)
; } // Test setup /////////////////////////////////////////////////////////// void test_ams__initialize(void) { s_launcher_task_callback = NULL; memset(s_conn_mgr_states, 0, sizeof(s_conn_mgr_states)); fake_rtc_init(1234, 5678); fake_event_init(); fake_gatt_client_subscriptions_init(); fake_gatt_client_op...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_INFO, "Starting LSE oscillator"); RCC_LSEConfig(BOARD_LSE_MODE); for (int i = 0; i < LSE_READY_TIMEOUT_MS; ++i) { if (RCC_GetFlagStatus(RCC_FLAG_LSERDY) != RESET) { PBL_LOG(LOG_LEVEL_INFO, "LSE oscillator started after %d ms", i); break; } delay_us(1000...
} bool clocksource_is_lse_started(void) { return (RCC_GetFlagStatus(RCC_FLAG_LSERDY) != RESET); } void clocksource_MCO1_enable(bool on) { static int8_t s_refcount = 0; portENTER_CRITICAL(); PBL_ASSERTN(BOARD_CONFIG_MCO1.output_enabled); if (on) { gpio_af_init( &BOARD_CONFIG_MCO1.af_cfg, GPIO_...
(window_stack_count(modal_stack), 1)
; cl_assert_equal_i(window2->on_screen, true); cl_assert_equal_p(s_last_click_configured_window, window2); // Switch to modal happens via the compositor compositor_transition(NULL); // Call the upkeep function so the change in state is handled modal_manager_event_loop_upkeep(); // The app is now obstruc...
ow window; SimpleMenuLayer simple_menu_layer; SimpleMenuSection menu_sections[1]; SimpleMenuItem menu_items[FLASH_TEST_CASE_NUM_MENU_ITEMS]; Window test_window; TextLayer msg_text_layer[3]; TextLayer status_text_layer; char status_text[STATUS_TEXT_SIZE]; FlashTestCaseType test_case; uint8_t test_case_...
if (data->test_case >= FLASH_TEST_CASE_RUN_SWITCH_MODE_ASYNC) { text_layer_set_text(msg_text_layer, "Press Back To Exit"); } else { text_layer_set_text(msg_text_layer, "Press Up to Exit, Down to Stop Test"); }
text_layer_set_text_alignment(msg_text_layer, GTextAlignmentCenter); text_layer_set_background_color(msg_text_layer, GColorBlack); text_layer_set_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_...
ast_whole_items_read_bytes = -1; goto exit; } read_bytes += chunk_hdr.num_bytes; buffer += chunk_hdr.num_bytes; } else { // Just scanning for the last written byte read_bytes += chunk_hdr.num_bytes; } } read_offset += sizeof(chunk_hdr) + chunk_hdr.n...
PBL_LOG(LOG_LEVEL_ERROR, "Nuking storage for session %d", logging_session->comm.session_id)
; dls_storage_delete_logging_storage(logging_session); } return consumed_bytes; } // ----------------------------------------------------------------------------------------- // Called from dls_init() during boot time to scan for existing DLS storage files in the file // system and recreate sessions from them...
if (success) { // We enabled the rail! *ref_count = 1; // We need to wait a bit for the rail to stabilize before continuing to use the device. // It takes 2.6ms for the LDO rails to ramp. delay_ms(3); return true; }
return false; } } else { if (*ref_count <= 1) { // Set the register byte to XXXXX00X to disable the rail, just mask register_value = (register_value & ~0x06); success = prv_write_register(rail_control_reg, register_value); if (success) { // We disabled the rail! ...
/* * 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(s_mfg_mode_entered)
; } void test_getting_started_button_combo__push_and_release_other_button(void) { // Up (nothing) -> Up+Select (mfg) -> Up+Select+Down (nothing) -> Up+Select (mfg) prv_press_button(BUTTON_ID_UP); prv_press_button(BUTTON_ID_SELECT); prv_press_button(BUTTON_ID_DOWN); // We should have cancelled the timer ...
/* * 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...
while (stream->bytes_left) { uint64_t value; if (!pb_decode_varint(stream, &value)) { return false; } if (*decoder_info->num_values < decoder_info->max_num_values) { decoder_info->values[(*decoder_info->num_values)++] = value; } }
return true; } // ----------------------------------------------------------------------------------------- // Callback used to decode measurements. Called once for each measurement static bool prv_decode_measurements(pb_istream_t *stream, const pb_field_t *field, void **arg) { PLogMeasurementsDecoderArg *decode...
/* * 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 false; }
bool bt_driver_classic_copy_connected_address(BTDeviceAddress* address) { return false; } bool bt_driver_classic_copy_connected_device_name(char nm[BT_DEVICE_NAME_BUFFER_SIZE]) { return false; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (exti_line <= 9) { return EXTI9_5_IRQn; }
if (exti_line <= 15) { return EXTI15_10_IRQn; } if (exti_line == ExtiLineOther_RTCAlarm) { return RTC_Alarm_IRQn; } if (exti_line == ExtiLineOther_RTCWakeup) { return RTC_WKUP_IRQn; } WTF; } static void prv_configure_nvic_channel(IRQn_Type irqn) { NVIC_SetPriority(irqn, EXTI_PRIORITY); N...
periodic_timer_trigger(1)
; cl_assert_equal_i(battery_get_charge_state().charge_percent, 100); } void test_battery_monitor__curve_doesnt_shift_too_far(void) { int charge_mv = battery_curve_lookup_voltage_by_percent(0, true); int charge_terminate_mv = battery_curve_lookup_voltage_by_percent(80, false); fake_battery_init(charge_mv, tru...
34}, {0, 34}} }; static const GPathInfo s_duplicates_path_info = { 6, (GPoint[]) { {40, 0}, {40, 0}, {0, 40}, {0, 40}, {80, 40}, {80, 40} } }; static const GPathInfo s_single_duplicate_path_info = { 2, (GPoint[]) { {40, 0}, {40, 0} } }; static const GPathInfo s_crossing_p...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_bottom_clipped.${BIT_DEPTH_NAME}.pbi"))
; prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_left_clipped.${BIT_DEPTH_NAME}.pbi")); prv_reset...
* 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 * distributed...
grect_align(&title_frame, &text_container_frame, GAlignTop, clips)
; grect_align(&instruction_frame, &text_container_frame, GAlignBottom, clips); const int16_t title_vertical_adjust_px = -fonts_get_font_cap_offset(title_font); title_frame.origin.y += title_vertical_adjust_px; graphics_draw_text(ctx, title_text, title_font, title_frame, overflow_mode, tex...
innedFat: view_node = prv_create_pin_view_node(layout); break; case LayoutLayerModeNone: case NumLayoutLayerModes: break; } layout->view_node = view_node; timeline_layout_get_size(layout, graphics_context_get_current_context(), &layout->view_size); } void timeline_layout_deinit_view(Tim...
return &horizontal_node->container.node; }
static GTextNode *prv_create_time_text_node(const TimelineLayout *layout) { if (layout->info->all_day) { return prv_create_all_day_text_node(layout); } else { return prv_create_hour_text_node(layout); } } static const char *prv_get_secondary_text(const TimelineLayout *layout) { const AttributeList *a...
rv = settings_file_each(&storage->file, prv_each_first_item, &next_info); if (rv) { goto cleanup; } if (!next_info.found) { rv = S_NO_MORE_ITEMS; goto cleanup; } *id_out = next_info.id; rv = S_SUCCESS; cleanup: mutex_unlock(storage->mutex); return rv; } bool timeline_item_storage_exists...
(&storage->file, key, key_len)
; } mutex_unlock(storage->mutex); return rv; } int timeline_item_storage_get_len(TimelineItemStorage *storage, const uint8_t *key, int key_len) { mutex_lock(storage->mutex); status_t rv = settings_file_get_len(&storage->file, key, key_len); mutex_unlock(storage->mutex); return rv; } status_t time...
ppTimer *app_msg_retry_timer; } out; struct { uint8_t *reassembly_buffer; size_t received_size_bytes; size_t total_size_bytes; } in; } s_state; //////////////////////////////////////////////////////////////////////////////// // Forward Declarations //////////////////////////////////////////////////...
if (!it) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to outbox_begin"); return; }
size_t bytes_remaining; size_t payload_size; prv_calc_current_chunk_size(&bytes_remaining, &payload_size); OutgoingObject *obj = s_state.out.object_queue; // There is no dict_write_... API that lets us write a Tuple's byte array in multiple calls, // so we're just going to poke in the data "manually" he...
(FLASH_BASE, 16 KiB, callback_is_called_cb, (void *)8675309)
); cl_assert(callback_called); cl_assert(flash_locked); } void test_system_flash__handle_erase_error(void) { return_status = FLASH_ERROR_OPERATION; cl_assert(!system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL)); cl_assert(flash_locked); } void error_in_middle_cb(uint32_t num, uint32_t den, void *context) { ...
ring.h> #if CAPABILITY_HAS_VIBE_SCORES #include "services/normal/vibes/vibe_client.h" #include "services/normal/vibes/vibe_score.h" #endif #define DECLINE_DELAY_MS 2000 #define SMS_REPLY_DELAY_MS 1200 #define SMS_REPLY_IOS_DELAY_MS 600 #define ACCEPT_DELAY_MS 3000 #define CALL_END_DELAY_MS 5000 #define OUTGOING_CALL_...
PBL_IF_RECT_ELSE(11, 22)
, "TEST_TOTAL") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.total.value); } else if (strcmp(token, "TEST_TOTAL_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.total.min); } else if (strcmp(token, "TEST_TOTAL_MAX") == 0) { sscanf(token +...
if (state->test_entry.version == 2) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d", &steps, &orientation, &vmc, &light); } else if (state->test_entry.version == 3) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d, %d", &steps, &orientation, &vmc, &light, &plugged_in); ...
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 = orientation, .vmc = vmc, .light = ...
timeline_model_get_iter_state(i - 1); if (layout && state->current_day != layer->current_day) { prv_set_layout_hidden(layout, true); } } } static void prv_reset_layouts(TimelineLayer *layer) { int num_items = timeline_model_get_num_items(); for (int i = 0; i < (int)ARRAY_LENGTH(s_visible_items); i+...
(anim, timeline_animation_interpolate_moook_soft)
; peek_layer_clear_fields(&timeline_layer->day_separator); peek_layer_play(&timeline_layer->day_separator); return anim; } void timeline_layer_set_day_sep_frame(TimelineLayer *timeline_layer, const GRect *frame) { layer_set_hidden((Layer *)&timeline_layer->day_separator, false); peek_layer_set_frame(&timel...
announce_layout_did_appear(swap_layer, swap_layer->current, +1); // refresh the layer down below in case we have jumped around in our data model prv_refresh_next_layer(swap_layer); } static Animation *prv_create_swap_down_animation(SwapLayer *swap_layer) { // Compute the animation distance const GRect *prev_f...
prv_create_swap_up_animation(swap_layer, full_swap)
; } animation_set_handlers(animation, (AnimationHandlers) { .started = (direction == ScrollDirectionDown) ? prv_swap_down_start : prv_swap_up_start, .stopped = (direction == ScrollDirectionDown) ? prv_swap_down_complete : prv_swap_up_complete, }, swap_layer); swap_layer->animation = animation; ani...
me(prev_reel); } kino_layer_set_reel(&peek_layer->kino_layer, NULL, false); KinoReel *from_reel = kino_reel_create_with_resource_system(peek_layer->res_info.res_app_num, peek_layer->res_info.res_id); if (!from_reel) { return; } KinoReel *to...
prv_set_visible(peek_layer)
; kino_layer_play(&peek_layer->kino_layer); } GSize peek_layer_get_size(PeekLayer *peek_layer) { return kino_reel_get_size(kino_layer_get_reel(&peek_layer->kino_layer)); } static void prv_set_text(PeekTextLayer *peek_text_layer, const char *text) { memset(peek_text_layer->text_buffer, 0, MAX_PEEK_LAYER_TEXT_LEN...
layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_outside_y); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_y.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_...
graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NULL, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL)
; cl_check(framebuffer_is_empty("draw_text_null", fb, GColorWhite)); setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NULL_W, GTextOverflowModeTrailingEllipsis, GTextAl...
4, 464}, { 808, 648, 448}, { 832, 776, 616}, { 1064, 824, 576}, { 1080, 536, 616}, { 968, 376, 520}, { 880, 280, 264}, { 792, 24, 352}, { 944, -8, 464}, { 952, 280, 440}, { 984, 464, 384}, { 880, 560, 240}, { 720, 464, 80}, { 656, 288, 8}, { 600, 168, 32}, { 7...
{ 760, 576, 352}, { 768, 520, 376}, { 800, 520, 352}, { 808, 496, 464}, { 848, 576, 432}, { 808, 600, 432}, { 800, 712, 496}, { 864, 808, 608}, { 1128, 600, 544}, { 960, 408, 552}, { 840, 296, 344}, { 768, 48, 328}, { 944, 48, 440}, { 1000, 320, 456}, { 1000, ...
{ 760, 480, 400}, { 816, 424, 440}, { 808, 448, 416}, { 784, 472, 368}, { 768, 480, 312}, { 744, 528, 320}, { 736, 512, 384}, { 800, 536, 384}, { 800, 496, 384}, { 792, 456, 432}, { 800, 520, 432}, { 808, 528, 400}, { 760, 552, 392}, { 848, 704, 488}, { 872, ...
return false; } // check if attr_list_size is correct if (score->attr_list_size != (data_size - (sizeof(VibeScore) - sizeof(GenericAttributeList)))) { return false; } // check exact file size to contain all flexible-sized data for (unsigned int i = 0; i < score->attr_list.num_attributes; i++) { ...
{ VibeNote *note = &note_list[pattern_list[i]]; duration_ms += (note->vibe_duration_ms + note->brake_duration_ms); }
/* * 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(stub_new_timer_is_scheduled(sys_timer_id))
/* * 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...
{ // When the SPI peripheral is disabled, the CLK line floats. Let's // reconfigure the CLK GPIO to be active low so the Dialog BT controller // doesn't see a false clock edge spi_ll_slave_drive_clock(DIALOG_SPI, true); spi_ll_slave_release(DIALOG_SPI); }
static void prv_init_spi(void) { spi_slave_port_init(DIALOG_SPI); } // // DMA // static void prv_cleanup_after_dma_transfer(void) { dialog_spi_assert_chip_select(false); // FIXME: PBL-32865: The "OVR" (overrun) status flag gets set at some point, not sure why because // the data arrives OK. Need to reset i...
it(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000), 0); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check second cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id)); ...
cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id))
MSB enables address auto-increment int num_bytes = 6 * num_samples; // Overflow bit doesn't get cleared until number of samples in fifo goes below // the watermark. Read an extra item from the fifo and just throw it away. int read_num_bytes = num_bytes + 6; uint8_t start_addr = 1 << 7 | LIS3DH_OUT_X_L; u...
{ PebbleEvent e = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_handle_tap, .data = NULL } }; *should_context_switch = event_put_isr(&e); }
} void accel_set_running(bool running) { s_running = running; } void accel_set_num_samples(uint8_t num_samples) { if (num_samples == 0) { // peek mode, no FIFO lis3dh_set_fifo_mode(MODE_BYPASS); lis3dh_disable_fifo(); } else { lis3dh_set_fifo_wtm(num_samples - 1); // clear fifo lis3dh_s...
.h" #include "stubs_sleep.h" #include "stubs_status_bar_layer.h" #include "stubs_syscalls.h" #include "stubs_system_theme.h" #include "stubs_task_watchdog.h" #include "stubs_window_manager.h" #include "stubs_window_stack.h" // Helper Functions ///////////////////// #include "fw/graphics/test_graphics.h" #include "fw/...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_weather_app_layout__render_large_numbers(void) { const WeatherLocationForecast forecast = { .location_name = "PALO ALTO", .current_temp = -88, .today_high = -88, .today_low = -88, .current_weather_type = WeatherType_Sun, .current_weather_phrase = "Sunny", .tomorrow_high = -9...
, max_used_space); } } compute_stats(file); return S_SUCCESS; } status_t settings_file_open(SettingsFile *file, const char *name, int max_used_space) { return prv_open(file, name, OP_FLAG_READ | OP_FLAG_WRITE, max_used_space); } void settings_file_close(SettingsFile *file) { ...
{ // This should only happen if we reboot in the middle of writing a new // record, and it should always be the most recently written record, so // we shouldn't lose any data here (except for the partially written // record, but we should ignore it's garbage data anyway). break; }
if (overwritten(hdr) || deleted_and_expired(hdr)) { continue; } if (partially_overwritten(hdr)) { // The only case where we should hit this is if we are compacting a file // which has a record which was in the middle of being overwritten, but // the write of the new record didn't fi...
lib's output. // Newlib just treats it as %#x char dstbuf[256]; snprintf(dstbuf, 256, "What's a cool number? %p", (void*)(uintptr_t)0x02468ACE); cl_assert_equal_s(dstbuf, "What's a cool number? 0x2468ace"); snprintf(dstbuf, 256, "What's a cool number? %p", (void*)(uintptr_t)0); cl_assert_equal_s(dstbuf, "...
cl_assert_equal_i(lntest[1], 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...
(msg_text_layer, "Perf Data Test")
; break; case FLASH_TEST_CASE_RUN_SWITCH_MODE_ASYNC: case FLASH_TEST_CASE_RUN_SWITCH_MODE_SYNC_BURST: text_layer_set_text(msg_text_layer, "Switch Mode"); break; default: text_layer_set_text(msg_text_layer, "Unknown Test"); break; } text_layer_set_text_alignment(msg_text_la...
64_t val) { uint8_t *location = prv_heartbeat_get_location(heartbeat, metric); prv_location_set_value(location, val, analytics_metric_element_type(metric)); } void analytics_heartbeat_set_array(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric, uint32_t index, int64_t val) { uint8_t *location = prv_heartbeat...
analytics_metric_offset(metric)
, name, (int32_t)val, (int32_t)val); } continue; } const size_t BUF_LENGTH = 256; char buf[BUF_LENGTH]; uint32_t written = 0; for (uint32_t i = 0; i < analytics_metric_num_elements(metric); i++) { if (written > BUF_LENGTH) { PBL_LOG(LOG_LEVEL_DEBUG, "print buffer overflow b...
culators__cleanup(void) { } // --------------------------------------------------------------------------------------- void test_activity_calculators__distance(void) { uint32_t steps; uint32_t time_ms; prv_set_user(Human_TallMale); const int walking_cadence_spm = 100; // Do an normal walk for 12 mins. An ...
(run_calories, walk_calories)
; // Run 5km in 25 minutes distance_mm = 5 * M_PER_KM * MM_PER_METER; time_ms = 25 * SECONDS_PER_MINUTE * MS_PER_SECOND; int five_k_calories = activity_private_compute_active_calories(distance_mm, time_ms) / ACTIVITY_CALORIES_PER_KCAL; cl_assert_within(five_k_calories, 220, 250); cl_assert_gt(five_k_calori...
/* * 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...
system_theme_get_font(TextStyleFont_MenuCellTitle)
; } //! Only used on round displays to achieve a fish-eye effect static GFont prv_get_unfocused_item_font(void) { return system_theme_get_font(TextStyleFont_Header); } static uint16_t prv_get_num_rows(MenuLayer *menu_layer, uint16_t section_index, void *callback_context) { ActionM...
28, -80, -416}, { 944, -40, -432}, { 952, -88, -408}, { 944, -88, -400}, { 896, -72, -368}, { 936, -64, -360}, { 1016, -80, -328}, { 1440, -56, -352}, { 1304, -104, -264}, { 1120, -56, -224}, { 1064, -48, -240}, { 1104, -24, -168}, { 1160, -32, -136}, { 1088, -16, -12...
{ 1528, -16, -16}, { 1536, 32, -144}, { 1056, 40, -184}, { 712, -8, -296}, { 680, 8, -320}, { 1048, 56, -184}, { 1200, -16, -112}, { 1024, -64, -112}, { 1016, 16, -168}, { 944, 64, -208}, { 952, 88, -168}, { 1016, 72, -128}, { 1072, 80, -144}, { 1032, 104, -136}, ...
{ 1048, -40, -56}, { 1104, -40, -56}, { 1120, -56, -16}, { 1488, -16, -72}, { 1376, 8, -48}, // 124 seconds { 1040, 24, -96}, { 720, -32, -200}, { 824, -72, -80}, { 1192, -56, -104}, { 1072, -112, -80}, { 936, -96, -112}, { 912, -24, -176}, { 896, 48, -232}, ...
/* * 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 (result < 0) { PBL_LOG(LOG_LEVEL_ERROR, "Error writing notification payload %d", result); kernel_free(write_buffer); return result; }
olorBlack.argb); #endif color.a = 2; graphics_context_set_stroke_color(&context, color); #if PBL_COLOR cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorBlue.argb); #else cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorBlack.argb); #endif color.a = 1; graphics_context_set_stroke_...
(graphics_line_draw_1px_aa(&context, GPoint(5, 5), GPoint(45, 10)))
; #else ASSERT_CALLED(graphics_line_draw_1px_non_aa(&context, GPoint(5, 5), GPoint(45, 10))); #endif setup_test(&context, true, 1, GColorBlack, GColorBlack, false); graphics_draw_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10))); setup_test(&context, true...
mplied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "bitblt_private.h" #include "graphics.h" #include "graphics_private.h" #include "graphics_private_raw.h" #include "graphics_private_raw_mask.h" #include "gtypes.h" #include "system/passert.h" #...
{ return; }
#if PBL_COLOR GColor8 *output = (GColor8 *)(data_row_info.data + x1.integer); // first pixel with blending if fraction is different than 0 const unsigned int data_row_offset = data_row_info.data - (uint8_t *)framebuffer->addr; if (x1.fraction != 0) { graphics_private_raw_blend_color_factor(ctx, output, d...
t_metric(ActivityMetricSleepTotalSeconds, wday, data->sleep_duration); activity_metrics_prv_set_metric(ActivityMetricSleepRestfulSeconds, wday, data->deep_sleep_duration); activity_metrics_prv_set_metric(ActivityMetricSleepEnterAtSeconds, wday, ...
settings_file_get(&file, key, key_len, value_out, sizeof(uint32_t))
; prv_file_close_and_unlock(&file); return (s == S_SUCCESS); } bool health_db_get_typical_step_averages(DayInWeek day, ActivityMetricAverages *averages) { if (!averages) { return false; } // Default results _Static_assert(((ACTIVITY_METRIC_AVERAGES_UNKNOWN >> 8) & 0xFF) == (ACTIV...
node)->transport == data); } CommSession * prv_find_session_by_transport(Transport *transport) { return (CommSession *) list_find((ListNode *) s_session_head, prv_filter_by_transport_callback, transport); } /////////////////////////////////////////////////////////////////////////...
{ CommSession *session = s_session_head; while (session) { CommSession *next = (CommSession *) session->node.next; comm_session_send_next(session); session = next; } fake_system_task_callbacks_invoke_pending(); }
uint32_t fake_comm_session_get_responsiveness_max_period(void) { return s_responsiveness_max_period_s; } uint32_t fake_comm_session_is_latency_reduced(void) { return s_responsiveness_latency_is_reduced; } //////////////////////////////////////////////////////////////////////////////////////////////////// // Tra...
value_len); } } } // ======================================================================================== // Exported functions used by the firmware to read/change a preference. // IMPORTANT: When implementing the *set* call, be sure to call prv_pref_set(). This does // two things: // 1.) It validates that...
{ switch (button) { case BUTTON_ID_UP: return s_quick_launch_up.enabled; case BUTTON_ID_DOWN: return s_quick_launch_down.enabled; case BUTTON_ID_SELECT: return s_quick_launch_select.enabled; case BUTTON_ID_BACK: return s_quick_launch_back.enabled; case NUM_BUTTONS: br...
AppInstallId quick_launch_get_app(ButtonId button) { Uuid *uuid = NULL; switch (button) { case BUTTON_ID_UP: uuid = &s_quick_launch_up.uuid; break; case BUTTON_ID_DOWN: uuid = &s_quick_launch_down.uuid; break; case BUTTON_ID_SELECT: uuid = &s_quick_launch_select.uuid; ...
/* * 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...
attribute_list_add_cstring(&stop_action_attr_list, AttributeIdTitle, i18n_get("Stop Sharing Heart Rate", &attr_list))
->multi_click.max = (max_clicks == 0) ? min_clicks : max_clicks; cfg->multi_click.timeout = (timeout == 0) ? 300 : timeout; cfg->multi_click.last_click_only = last_click_only; cfg->multi_click.handler = handler; if (button_id == BUTTON_ID_BACK) { window_set_overrides_back_button(window, true); } } void ...
{ PBL_ASSERTN(window != NULL); // This tripped me up for about a day if (new_on_screen == window->on_screen) { return; } // Window went from offscreen to onscreen (or vice versa) // Provides internal signaling to ui elements of appear/disappear layer_property_changed_tree(&window->layer); window->...
// happens if we unload ourselves in our load handler), so we have to double check. window_call_handler(window, WindowHandlerOffsetDisappear); } } } void window_set_background_color(Window *window, GColor background_color) { const GColor window_bg_color = window->background_color; if (gcolor_equ...
ual_i(1, s_fonts_get_system_font.call_count); EXECUTE_SCRIPT("ctx.font = '14px bold Gothic';\n"); cl_assert_equal_i(2, s_fonts_get_system_font.call_count); cl_assert_equal_p(FONT_KEY_GOTHIC_14_BOLD, s_fonts_get_system_font.last_call.font_key); EXECUTE_SCRIPT("ctx.font = '28px Gothic';\nvar f = ctx.font;\n"); ...
(1, s_graphics_fill_rect.call_count)
; cl_assert_equal_rect(GRect(5, 6, 7 * 2, 8 * 2), s_graphics_fill_rect.last_call.rect); }
NY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 11 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); gr...
(&ctx.dest_bitmap, "draw_rect_origin_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); #endif // SW = 5 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 5); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_R...
_len + 1); uint8_t *val = malloc(info->val_len + 1); info->get_key(file, key, info->key_len); info->get_val(file, val, info->val_len); key[info->key_len] = '\0'; val[info->val_len] = '\0'; printf("Read key of %s %d and val of %s %d\n", key, info->key_len, val, info->val_len); int key_i = atoi((char*)key ...
for (int i = 0; i < NUM_RECORDS; i++) { snprintf((char *)key, sizeof(key), "k%03d", i); snprintf((char *)val, sizeof(val), "v%03d", i); set_and_verify(&file, key, key_len, val, val_len); }
cache_invalidate(dst, length); // since the dst address is cachable, it needs to be aligned to a cache line and // the length must be an even multiple of cache lines const uint32_t dst_alignment_mask = dcache_alignment_mask_minimum(alignment_mask); PBL_ASSERTN(((length & dst_alignment_mask) == 0) && ...
(!this->stream->state->current_request)
if (data) { KinoReel *reel = prv_get_current_reel(data); return kino_reel_get_gdraw_command_list(reel); }
return NULL; } static const KinoReelImpl s_kino_reel_impl_transform = { .destructor = prv_destructor, .get_elapsed = prv_elapsed_getter, .set_elapsed = prv_elapsed_setter, .get_duration = prv_duration_getter, .get_size = prv_size_getter, .draw_processed = prv_draw_processed_func, .get_gdraw_command_li...
/* * 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...
free(source)
tic uint16_t s_last_vmc = 0; bool activity_tracking_on(void) { return true; } bool activity_get_metric(ActivityMetric metric, uint32_t history_len, int32_t *history) { cl_assert_equal_i(history_len, 1); if (metric == ActivityMetricSleepState) { *history = s_sleep_state; return true; } else if (metric ...
(id, 10, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule)
am->controller->periph->LIFCR = ALL_INTERRUPT_FLAGS_L(2); break; case (uintptr_t)DMA1_Stream3: case (uintptr_t)DMA2_Stream3: this->stream->controller->periph->LIFCR = ALL_INTERRUPT_FLAGS_L(3); break; case (uintptr_t)DMA1_Stream4: case (uintptr_t)DMA2_Stream4: this->stream->contro...
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->priority; // set the data size PBL_ASSERTN((this->data_size & (DMA_SxCR_MSIZE | DMA_SxCR_PSIZE)) == this->data_size); cr_value |= this->data_size; // set t...
{ 824, -240, 56}, { 1120, -240, 88}, { 1456, -8, 40}, { 1464, 192, -128}, { 1368, 112, -32}, { 1288, 16, -88}, { 1024, 72, -176}, { 896, 104, -128}, { 904, 160, -8}, { 992, 208, 48}, { 1080, 272, 8}, { 1008, 312, -48}, { 1224, 312, 32}, { 1232, 504, 144}, // 107...
{ 736, -24, -72}, { 872, -40, -128}, { 1072, -104, 88}, { 1240, 88, -88}, { 1304, 168, -144}, { 1504, 168, -160}, { 1376, 200, -120}, { 1032, 168, -64}, { 992, 144, -8}, { 1080, 192, 96}, { 1208, 224, 96}, { 1136, 312, 56}, { 880, 368, -24}, { 928, 368, -48}, ...
{ -128, 96, -1088}, { -160, 152, -1056}, { -168, 160, -1024}, { -216, 216, -984}, { -216, 272, -936}, { -232, 384, -864}, // 115 seconds { -200, 520, -880}, { -200, 480, -904}, { -216, 520, -880}, { -168, 576, -824}, { -208, 568, -800}, { -200, 584, -736}, { -224...
/* * 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...
{ const HcAdvertEnableResponseData *data = (const HcAdvertEnableResponseData *)resp->payload; error = data->error; if (data->current_state != AdvertState_Running) { PBL_LOG(LOG_LEVEL_INFO, "State was 0x%x after advert enable", data->current_state); } }
ific language governing permissions and * limitations under the License. */ #include "drivers/flash.h" #include "flash_region/flash_region.h" #include "services/common/legacy/registry_private.h" #include "system/logging.h" #include "system/passert.h" #include <string.h> #include <stdbool.h> // Header patterns must...
(r->key, key, key_length)
true /* kernel */, true /* app */); // Send the 3rd notification: gatt_client_subscriptions_handle_server_notification(s_connection, s_handle, value, sizeof(value)); cl_assert_equal_i(fake_event_get_count(), 2); prv_assert_...
gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, GAPLEClientApp)
; cl_assert_equal_i(e, BTErrnoOK); // Simulate getting confirmation from remote: prv_confirm_cccd_write(BLEGATTErrorSuccess); fake_event_clear_last(); const uint8_t value[] = {0xAA, 0xBB, 0xCC}; gatt_client_subscriptions_handle_server_notification(s_connection, s_handle, ...
/* * 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 (dev->is_gateway) { *has_bonded_gateway = true; }
} static bool prv_has_bonded_gateway(void) { bool has_bonded_gateway = false; storage_acquire(); device_foreach(prv_device_foreach_search_gateway, &has_bonded_gateway); storage_release(); return has_bonded_gateway; } extern bool ppogatt_emulated_server_wa_enabled(uint16_t conn_idx); static void prv_get_c...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
( s_sectors[sector], VoltageRange_1)
against // Test Identity Matrix t = GTransformIdentity(); t_c = GTransformFromNumbers(1, 0, 0, 1, 0, 0); cl_assert(gtransform_is_equal(&t, &t_c)); cl_assert(gtransform_is_identity(&t)); cl_assert(gtransform_is_identity(&t_c)); // Test Scale Matrix t = GTransformScale(GTransformNumberFromNumber(2), G...
gtransform_scale(&t_new, &t1, GTransformNumberFromNumber(10), GTransformNumberFromNumber(200))
; cl_assert(gtransform_is_equal(&t_new, &t_c)); cl_assert(gtransform_is_equal(&t1, &t2)); // ensure t1 has not changed gtransform_scale_number(&t_new, &t1, 10, 200); cl_assert(gtransform_is_equal(&t_new, &t_c)); cl_assert(gtransform_is_equal(&t1, &t2)); // ensure t1 has not changed // Test pointer re-use ...
der.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert...
uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(2)->pin.header.id)
); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(1)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(t...
prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday); id = alarm_create(&(AlarmInfo) { .hour = 5, .minute = 14, .kind = ALARM_KIND_JUST_ONCE }); prv_assert_alarm_config(id, 5, 14, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday); id = alarm_create(&(AlarmInfo) { .h...
(id, ALARM_KIND_WEEKENDS)
; prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule); } void test_alarm__alarm_set_recurring_weekdays(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_ev...
_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("NOW", time_buf); // June 9th 2015, 12:00:59 (T+00:00:59) rtc_set_time(event_time + (1 * SECONDS_PER_MINUTE) - 1); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);...
rtc_set_time(event_time + (2 * SECONDS_PER_HOUR))
cl_assert_equal_p(ab, actual); cl_assert_equal_i(1, current_stack); cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(ab, stack[1]); // not necessary to free memory on unit tests } void test_layer__is_ancestor(void) { Layer parent, child_a, child_b, child_c; Layer *layers[] = {&parent, &child_a, &child_b,...
(0, 0, 10, 10)
); layer_set_frame(&child_b, &GRect(2, 2, 6, 6)); layer_add_child(&parent, &child_a); layer_add_child(&child_a, &child_b); layer_set_contains_point_override(&child_b, prv_override_layer_contains_point); cl_assert_equal_p(layer_find_layer_containing_point(&child_b, &GPoint(9, 9)), &child_b); cl_assert_equal...
/* * 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...
layer_set_frame(s_nudge_layer, &frame)
; layer_set_bounds(s_nudge_layer, &bounds); PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_flush_kernel_main_cb, .data = NULL, }, }; *should_context_switch = event_put_isr(&event); } void command_layer_nudge(const char *address_str) { intptr_t addr...
/* * 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(kino_reel)
T_NO_CLIP, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_odd_clip"))); } void test_graphics_draw_line___even_offset_ver...
gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_even_offset_odd_clip"))
); } void test_graphics_draw_line___odd_offset_vertical_dotted(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Test odd and even cols draw appropriately setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(12, 6), 10); graph...
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 * distributed un...
(NULL, (AppRunStateCommand)cmd, app_uuid)
_s, expire_s, features); fake_system_task_callbacks_invoke_pending(); HRMSubscriberState *subscriber = prv_get_subscriber_state_from_ref(session_ref); cl_assert(subscriber); cl_assert(subscriber->session_ref == session_ref); cl_assert(subscriber->ex...
cl_assert(sys_hrm_manager_get_app_subscription(app_id) == HRM_INVALID_SESSION_REF)
; } // Test that system subscriptions expire correctly void test_hrm_manager__kernel_expiration(void) { stub_pebble_tasks_set_current(PebbleTask_KernelBackground); const uint16_t expire_s = SECONDS_PER_MINUTE; HRMSessionRef session_ref = hrm_manager_subscribe_with_callback(INSTALL_ID_INVALID, 1, ...
GPoint(13, 13)
, 40, 6, true); } void test_touch__handle_update_position_stationary(void) { touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 3686380, 0); touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400); TouchEvent *touch_event = touch_event_queue_get_event(0, 0); prv_test_touch_event(to...
en, false); modal_window_push(window1, base_priority - 2, false); modal_manager_event_loop_upkeep(); cl_assert_equal_i(window1->on_screen, false); cl_assert_equal_i(window2->on_screen, true); window_stack_remove(window2, false); modal_manager_event_loop_upkeep(); cl_assert_equal_i(window2->on_screen...
(app_stack, window1, true)
; cl_assert_equal_i(window_stack_count(app_stack), 1); cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_p(s_last_click_configured_window, window1); // Switch to the kernel to push a modal window stub_pebble_tasks_set_current(PebbleTask_KernelMain); window_stack_push(modal_stack, window2, true...
s_content_indicator_dummy_layer_update_proc); } void test_content_indicator__creating_for_scroll_layer(void) { ScrollLayer scroll_layer; ContentIndicator *content_indicator = content_indicator_get_or_create_for_scroll_layer( &scroll_layer); cl_assert(content_indicator); // Should save ...
(&content_indicator, direction, NULL)
); cl_assert_equal_p(dummy_config.layer->update_proc, s_content_indicator_dummy_layer_update_proc); cl_assert(!direction_data[direction].config.layer); // Setting content available should not change layer update proc without reconfiguring. content_indicator_set_content_available(&content_indicator, direction, ...
/* * 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, GPoint(offset, layer->bounds.size.h - mask - 1))
; // Bottom-right quadrant graphics_draw_pixel(ctx, GPoint(layer->bounds.size.w - mask - 1, layer->bounds.size.h - offset - 1)); graphics_draw_pixel(ctx, GPoint(layer->bounds.size.w - offset - 1, layer->bounds.size.h - mask - 1)); } }...
.is_paused = prv_is_sports_paused, .pause = prv_sports_pause, .stop = NULL, .update_data = NULL, .metric_to_string = prv_metric_to_string, .get_metric_value = prv_sports_get_value, .get_distance_string = health_util_get_distance_string, .get_custom_metric_label_string = prv_get_custom_metric_label_strin...
{ s_hrm_is_present = false; s_workout_data = (WorkoutData) { .steps = 567, .duration_s = 84, .distance_m = 1234, .avg_pace = health_util_get_pace(84, 1234), .bpm = 71, .hr_zone = 0, }; WorkoutActiveWindow *active_window = workout_active_create_for_activity_type( ActivitySessionTy...
void test_workout_active__workout_render_open_workout(void) { s_workout_data = (WorkoutData) { .steps = 0, .duration_s = 84, .distance_m = 0, .avg_pace = health_util_get_pace(84, 0), .bpm = 92, .hr_zone = 0, }; WorkoutActiveWindow *active_window = workout_active_create_for_activity_type...
/* * 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...
{ *loading_layer = (LoadingLayer) { .full_frame = *frame }; ProgressLayer *progress_layer = &loading_layer->progress_layer; progress_layer_init(progress_layer, frame); progress_layer_set_corner_radius(progress_layer, PROGRESS_SUGGESTED_CORNER_RADIUS); }
default index to overwrite if nothing better is found optimal_idx = MAX_PAGE_CACHE_ENTRIES - 1; uint8_t contiguous_pgs = fpc[0].contiguous_pgs; // find the entry with the smallest number of sequential pages as this // will be the best page to remove from the cache for (int i = 0; i < MAX_PAGE_CAC...
(file_type)
or_tag(AppInboxServiceTagUnitTest)); prv_process_callback_events(); assert_num_dropped_callbacks(1); assert_num_message_callbacks(0); } void test_app_inbox__app_inbox_service_write_happy_case(void) { prv_create_test_inbox_and_begin_write(); cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagU...
assert_num_dropped_callbacks(1)
str2_len) >= MAX_MSG_STR_LEN) { str1_len = MIN(str1_len, MAX_MSG_STR_LEN_HALF); str2_len = MIN(str2_len, MAX_MSG_STR_LEN_HALF); } if (str1_len) { // length + strlen(string) + padding (round up to nearest uint32_t). msg_size += 1 + str1_len + (3 - (1 + str1_len + 3) % 4); } if (...
(msg_buffer, 0, msg_buffer_size)
; HcProtocolMessage *hc_msg = (HcProtocolMessage *)&msg_buffer[0]; BinLogMessage_Unhashed_v1 *msg = (BinLogMessage_Unhashed_v1 *) &msg_buffer[sizeof(HcProtocolMessage)]; msg->header.version = BINLOGMSG_VERSION_UNHASHED_V1; // HACK: store the log level in time.millisecond ...
"Change Time") : is_smart ? i18n_noop("New Smart Alarm") : i18n_noop("New Alarm")); /// Displays as "Wake up between" then "8:00 AM - 8:30 AM" below on a separate line const char *range_text = PBL_IF_RECT_ELSE(i18n_noop("Wake up between"), /// Displays as "8:00 AM - 8:30 AM" then "Wake up i...
(option_menu, ALARMS_APP_HIGHLIGHT_COLOR, GColorWhite)
; } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Public API Window* alarm_editor_create_new_alarm(AlarmEditorCompleteCallback complete_callback, void *callback_context) { AlarmEditorData* data = task_malloc_check(sizeof...