prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
NULL_MBUF ((MBuf *)1) #define assert_result_ok(result) cl_assert(result == SmartstrapResultOk) #define assert_result_invalid(result) cl_assert(result == SmartstrapResultInvalidArgs) #define assert_result_busy(result) cl_assert(result == SmartstrapResultBusy) typedef void (*EventServiceEventHandler)(PebbleEvent *e, voi...
assert_result_invalid(app_smartstrap_attribute_begin_write(attr, NULL, NULL))
*path) { record_mock_call(s_gpath_draw_filled) { .path.num_points = path->num_points, }; memcpy(s_gpath_draw_filled.last_call.path.points, path->points, sizeof(path->points[0]) * path->num_points); } void graphics_fill_rect(GContext *ctx, const GRect *rect) {} void graphics_fill_round_rect_by_valu...
PP(8.5, 9.5)
, s_graphics_line_draw_precise_stroked.last_call.pp0); cl_assert_equal_point_precise(PP(10.5, 11.5), s_graphics_line_draw_precise_stroked.last_call.pp1); EXECUTE_SCRIPT( "ctx.fill();\n" ); // only first shape has at least 3 points cl_assert_equal_i(1, s_gpath_draw_filled.call_count); MockCallRecording ...
CALLBACK_EVENT, .callback = { .callback = prv_free_storage_buffer_cb, .data = session->data->buffer_storage } }; PebbleTask task = pebble_task_get_current(); process_manager_send_event_to_process(task, &e); } } // --------------------------------------------------------------...
for (int i = 0; i < logging_session->comm.session_id; i++) { if (*iter == NULL) { break; } PBL_ASSERTN(logging_session->comm.session_id != (*iter)->comm.session_id); if ((*iter)->comm.session_id > logging_session->comm.session_id) { break; } iter = &((*iter)->next); }
logging_session->next = *iter; *iter = logging_session; PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Created session: %p id %"PRIu8 " tag %"PRIu32, logging_session, logging_session->comm.session_id, logging_session->tag); mutex_unlock_recursive(s_list_mutex); } // The newlib headers do not ex...
/* * 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_buffer, &s_buffer_client, read_length)
; } // We should still be holding the buffer lock here... } static void handle_buffer_sync(void *data) { const bool is_async = (uintptr_t) data; mutex_lock(s_flash_write_mutex); mutex_lock(s_buffer_mutex); while (shared_circular_buffer_get_read_space_remaining(&s_buffer, &s_buffer_client) > 0) { wri...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(menu_layer, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite), PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack))
; menu_layer_set_highlight_colors(menu_layer, PBL_IF_COLOR_ELSE(SETTINGS_MENU_HIGHLIGHT_COLOR, GColorBlack), GColorWhite); menu_layer_set_click_config_onto_window(menu_layer, &data->window); layer_add_child(&data->window.layer, menu_layer_get_la...
*entry_point = process_loader_load(app_md, PebbleTask_Worker, &worker_segment); s_worker_task_context.load_end = worker_segment.start; if (!entry_point) { PBL_LOG(LOG_LEVEL_WARNING, "Tried to launch an invalid worker in bank %u!", process_metadata_get_code_...
if (!s_worker_task_context.app_md) { return; }
// Make sure the process is safe to kill. If this method returns false, it will have set a timer // to post another KILL event in a few seconds, thus giving the process a chance to clean up. if (!process_manager_make_process_safe_to_kill(PebbleTask_Worker, gracefully)) { // Maybe next time... PBL_LOG(LO...
qual_s("bc", string_list_get_at(list, 1)); } static TimelineItemAction s_basic_action_list[] = { { .id = 0, .type = TimelineItemActionTypeGeneric }, { .id = 1, .type = TimelineItemActionTypeHttp }, { .id = 2, .type = TimelineItemActionTypeOpenPin }, }; void test_timeline_item__find_action_with_id(void) { /...
malloc(sizeof(s_basic_action_list))
; memcpy(action_list, s_basic_action_list, sizeof(s_basic_action_list)); item.action_group.num_actions = ARRAY_LENGTH(s_basic_action_list); item.action_group.actions = action_list; // Make sure we don't return anything if the action doesn't exist cl_assert_equal_p(timeline_item_find_reply_action(&item), NULL...
ager_subscribe_with_callback( INSTALL_ID_INVALID, ACTIVITY_HRM_SUBSCRIPTION_OFF_PERIOD_SEC, 0 /*expire_s*/, HRMFeature_BPM, prv_hrm_subscription_cb, NULL); PBL_ASSERTN(s_activity_state.hr.hrm_session != HRM_INVALID_SESSION_REF); s_activity_state.hr.log_session = protobuf_log_hr_create(NULL); PBL_ASSE...
(LOG_LEVEL_ERROR, "Unknown settings file verison %"PRIu16"", version)
; } if (result != S_SUCCESS) { // Delete the old file and create a new one if migration failed activity_private_settings_close(file); pfs_remove(ACTIVITY_SETTINGS_FILE_NAME); file = activity_private_settings_open(); *written_version = ACTIVITY_SETTINGS_CURRENT_VERSION; } return file; } //...
g->value, value_font, rect, config->overflow_mode, GTextAlignmentRight, NULL); } else { // Only draw the icon if it fits within the cell after aligning it center right grect_clip(&rect, cell_layer_bounds); grect_align(&rect, cell_layer_bounds, GAlignRight, true); if (gsize_equal...
prv_draw_basic(ctx, cell_layer, NULL, title, NULL, NULL, NULL, subtitle, icon, true, GTextOverflowModeFill)
; } void menu_cell_basic_draw(GContext* ctx, const Layer *cell_layer, const char *title, const char *subtitle, GBitmap *icon) { prv_draw_basic(ctx, cell_layer, NULL, title, NULL, NULL, NULL, subtitle, icon, false, GTextOverflowModeFill); } ////////////////////// // Title m...
fg_info_get_disp_offsets().y, 1); cl_assert_equal_i(mfg_info_get_watch_color(), 3); cl_assert_equal_i(mfg_info_get_rtc_freq(), 4); mfg_info_get_model(buffer); cl_assert_equal_s(buffer, "test_model"); } void test_spalding_mfg_info__2_to_3_conversion(void) { // Force in an old data version. typedef str...
(fpga_buffer + HEADER_SIZE, s_boot_fpga, sizeof(s_boot_fpga))
== 0); }
le_dialog_get_dialog(simple_dialog); const char *snooze_text = i18n_noop("Snooze for %d minutes"); char snooze_buf[32]; snprintf(snooze_buf, sizeof(snooze_buf), i18n_get(snooze_text, dialog), alarm_get_snooze_delay()); i18n_free(snooze_text, dialog); dialog_set_text(dialog, snooze_buf); dialog_set_icon(dial...
if (!s_alarm_popup_data->vibe_score) { return; }
vibe_repeat_interval_ms = vibe_score_get_duration_ms(s_alarm_popup_data->vibe_score) + vibe_score_get_repeat_delay_ms(s_alarm_popup_data->vibe_score); s_alarm_popup_data->max_vibes = DIVIDE_CEIL(VIBE_DURATION, vibe_repeat_interval_ms); #else s_alarm_popup_data->max_vibes = TINTIN_MAX_VIBES; #endif s_alar...
if ((min_size % bytes_per_sector) > 0) { num_pages++; } int optimal_size = num_pages * bytes_per_sector; optimal_size -= sizeof(FileHeader); optimal_size -= sizeof(FileMetaData); optimal_size -= namelen; return optimal_size; } uint32_t get_available_pfs_space(void) { uint32_t allocated_space = 0; ...
(display_buf, sizeof(display_buf), "%3d:\t%8s%s\t%5d\t\t0x%x\t%15d", pg, file_name, is_tmp_file(pg) ? "(tmp)" : "", (int)file_hdr.file_size, file_hdr.file_type, (int)pg_hdr.erase_count)
PeriphResetCmd(ahb3_periphs, ENABLE); RCC_AHB3PeriphResetCmd(ahb3_periphs, DISABLE); const uint32_t apb1_periphs = 0 | RCC_APB1Periph_TIM2 | RCC_APB1Periph_TIM3 | RCC_APB1Periph_TIM4 | RCC_APB1Periph_TIM5 | RCC_APB1Periph_TIM6 | RCC_APB1Periph_TIM7 | RCC_APB1Periph_TIM12 | RCC_APB1P...
("Booting normally")
; boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); return false; } // We failed to start our firmware successfully! if (watchdog_check_reset_flag()) { dbgserial_putstr("Watchdog caused a reset"); } if (boot_bit_test(BOOT_BIT_SOFTWARE_FAILU...
om it again // This causes time to go backwards once a day unless we unlock it after reading from RTC_TR RTC_GetDate(RTC_Format_BIN, &rtc_date); if (rtc_time.RTC_Seconds == rtc_time_before.RTC_Seconds) { break; } } PBL_ASSERTN(max_loops > 0); struct tm current_time = { .tm_sec = rtc_tim...
if (RTC_GetITStatus(RTC_IT_WUT) != RESET) { RTC_WakeUpCmd(DISABLE); RTC_ClearITPendingBit(RTC_IT_WUT); exti_clear_pending_other(ExtiLineOther_RTCWakeup); }
}
{ 736, -72, -600}, { 736, -72, -600}, { 728, -88, -592}, { 736, -80, -584}, { 744, -64, -592}, { 728, -104, -608}, { 728, -80, -616}, { 728, -88, -616}, { 728, -96, -608}, { 712, -120, -600}, { 728, -104, -600}, { 760, 56, -560}, { 752, 24, -600}, { 712, -144, -616}, ...
ARRAY_LENGTH(samples)
; return samples; }
service_info) {} void sys_send_pebble_event_to_kernel(PebbleEvent* event) {} static UnitsDistance s_units_distance_result; UnitsDistance sys_shell_prefs_get_units_distance(void) { return s_units_distance_result; } int32_t vibes_get_vibe_strength(void) { return VIBE_STRENGTH_OFF; } HRMSessionRef s_hrm_next_ses...
cl_assert(s_num_dls_accel_records < ARRAY_LENGTH(s_dls_accel_records))
43 61 y.q.Ok.Y es.No.Ca //! 6c 6c 20 6d 65 00 43 61 6c 6c 20 79 6f 75 20 6c ll me.Ca ll you l //! 61 74 65 72 00 54 68 61 6e 6b 20 79 6f 75 00 53 ater.Tha nk you.S //! 65 65 20 79 6f 75 20 73 6f 6f 6e 00 52 75 6e 6e ee you s oon.Runn //! 69 6e 67 20 6c 61 74 65 00 4f 6e 20 6d 79 20 77 ing late .On my w //...
(&attr_list, AttributeIdLastUpdated, 123456)
; ios_notif_pref_db_store_prefs((uint8_t *)key, key_len, &attr_list, &action_group); // Make sure we can get all the data back notif_prefs = ios_notif_pref_db_get_prefs((uint8_t *)key, key_len); cl_assert(notif_prefs); title = attribute_find(&notif_prefs->attr_list, AttributeIdShortTitle); cl_assert(title)...
writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "fake_app_manager.h...
for (int i = 0; i < num_items; i++) { if (fastest_rate < sample_arr[i]) { fastest_rate = sample_arr[i]; } sessions[i] = sys_accel_manager_data_subscribe( sample_arr[i], prv_noop_sample_handler, NULL, tasks[i]); // buffer size of 1 sys_accel_manager_set_sample_buffer(sessions[i], fake...
// make sure all sampling rates are what they should be for (int i = 0; i < num_items; i++) { stub_pebble_tasks_set_current(tasks[i]); uint16_t num, den, samps_per_update; test_accel_manager_get_subsample_info(sessions[i], &num, &den, &samps_per_update); if ((fastest_rate % sample_arr[i]) == 0)...
WindowStack *window_stack) { PBL_ASSERTN(base_config); TimelineActionMenu *timeline_action_menu = applib_zalloc(sizeof(TimelineActionMenu)); if (!timeline_action_menu) { return NULL; } ActionMenuConfig config = *base_config; config.context = timeline_action_menu; if (gcolor_equal(conf...
(data, success)
uled(state, child) || prv_animation_children_scheduled(state, child)) { return true; } } } return false; } // ------------------------------------------------------------------------------------------- // Unschedule of an animation and optional destroy, recurses into children of ...
(list_contains(state->unscheduled_head, &animation->list_node) || list_contains(state->scheduled_head, &animation->list_node))
/* * 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_ASSERT_TASK(PebbleTask_KernelBackground); }
else if ((prev_state == SmartstrapStateNotifyInProgress) && (new_state == SmartstrapStateReadComplete)) { PBL_ASSERTN(mcu_state_is_isr() || (pebble_task_get_current() == PebbleTask_NewTimers)); } else if ((prev_state == SmartstrapStateReadDisabled) && (new_state == SmartstrapStateReadIn...
ncpy(tz_info.tm_zone, "N/A", TZ_LEN - 1); return tz_info; #else return (TimezoneInfo) {}; #endif } // This routine is solely responsible for setting the time and/or timezone for // the system RTC. After the time is changed, it generates an event for // consumers interested in time changes T_STATIC void prv_update_...
(new_time)
; break; } // Set timezone: case 0x03: { // Verify that the message length is correct const size_t header_size = offsetof(TimezoneCBData, region_name); const uint8_t *timezone_length_ptr = data + offsetof(TimezoneCBData, region_name_len); if (length != (sizeof(uint8_t) + header...
ted mfg_info_get_serialnumber(info->serial_string, MFG_SERIAL_NUMBER_SIZE + 1); mfg_info_get_hw_version(info->hw_version_string, MFG_HW_VERSION_SIZE + 1); prv_populate_uptime_string(info); sniprintf(info->language_string, sizeof(info->language_string), "%s, v%u", i18n_get_locale(), i18n_get_version...
(ctx, mark, mark_rect.origin, highlight)
; // Only draw the text if the cell is selected if (is_selected) { const GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_18); GRect text_rect = rt_rect; text_rect.size.h = fonts_get_font_height(font); grect_align(&text_rect, &rt_rect, GAlignBottom, true /* clip */); graphics_draw_text(ctx, t...
(slave->slave_state->dma_state == SPISlavePortDMAState_Idle); slave->slave_state->dma_state = SPISlavePortDMAState_Write; slave->slave_state->dma_complete_handler = handler; slave->slave_state->dma_complete_context = context; prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqTx, true); dma_request_start_direct(sla...
gpio_output_init(&clk_as_gpio, GPIO_OType_PP, GPIO_Speed_50MHz)
; gpio_output_set(&clk_as_gpio, false); } else { prv_configure_spi_sclk(spi_sclk, slave->spi_bus->spi_sclk_speed); } } void spi_ll_slave_clear_errors(const SPISlavePort *slave) { // First, empty the RX FIFO by reading the data. If in TX-only mode, it's possible that // received data (0x00s) will be lef...
ert_equal_p(result, false); result = transcription_validate(validate_test, 0); cl_assert_equal_p(result, false); result = transcription_validate(validate_test, sizeof(Transcription)); cl_assert_equal_p(result, false); result = transcription_validate(validate_test, sizeof(Transcription) - 1); cl_assert_eq...
transcription_iterate_words((TranscriptionWord *)words_test, 3, (TranscriptionWordIterateCb)prv_cb_return_false, (void *) 2)
; cl_assert_equal_p(result, &words_test[15]); result = transcription_iterate_words((TranscriptionWord *)words_test, 3, NULL, NULL); cl_assert_equal_p(result, end); } void test_transcription__iterate_sentences(void) { uint8_t sentence_test[] = { // Sentence #1 0x02, 0x00, // Word count // Word #...
(LOG_LEVEL_ERROR, "Tried to store device name, but pairing no longer around.")
; return false; } // In PRF, only the gateway should get paired, so default to "true": return (BT_BONDING_ID_INVALID != prv_bt_persistent_storage_store_ble_pairing(&data, true /* is_gateway */, requires_address_pinning, flags, ...
rue /* call handlers */); } while (true); window_stack_pop(window_stack, animated); } bool window_stack_remove(Window *window, bool animated) { if (window == NULL) { return false; } WindowStackItem *item = prv_find_window_stack_item_for_window(window->parent_window_stack, window); if (item == N...
if (count > 0) { *dump = kernel_calloc(count, sizeof(WindowStackDump)); if (*dump) { WindowStackItem *item = (WindowStackItem *)stack->list_head; while (item) { (*dump)[idx++] = (WindowStackDump) { .addr = item->window, .name = window_get_debug_name(item->window), ...
return count; }
/* * 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_set_manufacturer_name(info)
; prv_set_serial_number(info); prv_set_firmware_revision(info); prv_set_software_revision(info); }
/* * 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...
(list, AttributeIdIconPin, is_smart ? TIMELINE_RESOURCE_SMART_ALARM : TIMELINE_RESOURCE_ALARM_CLOCK)
; attribute_list_add_resource_id(list, AttributeIdIconTiny, TIMELINE_RESOURCE_ALARM_CLOCK); const bool all_caps = false; const char *alarm_string = i18n_get(alarm_get_string_for_kind(kind, all_caps), list); attribute_list_add_cstring(list, AttributeIdSubtitle, alarm_string); attribute_list_add_uint8(list, Att...
callback should not have been called: cl_assert_equal_i(s_unscheduled_cb_count, 0); // Unschedule and expect not to be advertising any more: gap_le_advert_unschedule(job); cl_assert(!gap_le_is_advertising_enabled()); // Unschedule callback should have been called once: cl_assert_equal_i(s_unscheduled_cb_...
regular_timer_seconds_count()
, 1); // Unschedule callback should not have been called: cl_assert_equal_i(s_unscheduled_cb_count, 0); // Make sure the all the terms in the job are run: for (int term = 0; term < ARRAY_LENGTH(advert_terms); ++term) { for (int second_tick = 0; second_tick < 4; ++second_tick) { cl_assert_equal_i(s_u...
nd key is the key itself. for(i = 0; i < Nk; ++i) { RoundKey[(i * 4) + 0] = Key[(i * 4) + 0]; RoundKey[(i * 4) + 1] = Key[(i * 4) + 1]; RoundKey[(i * 4) + 2] = Key[(i * 4) + 2]; RoundKey[(i * 4) + 3] = Key[(i * 4) + 3]; } // All other round keys are found from the previous round keys. for(; (...
(xtime(xtime(x)))
) ^ ((y>>4 & 1) * xtime(xtime(xtime(xtime(x)))))); } #else #define Multiply(x, y) \ ( ((y & 1) * x) ^ \ ((y>>1 & 1) * xtime(x)) ^ \ ((y>>2 & 1) * xtime(xtime(x))) ^ \ ((y>>3 & 1) * xtime(xtime(xtime(x)))) ^ ...
prv_notification_list_filter_cb, id); } static LoadedNotificationNode *prv_find_loaded_notification(LoadedNotificationNode *list, Uuid *id) { return (LoadedNotificationNode *)list_find((ListNode *...
timeline_resources_get_id(&timeline_res, TimelineResourceSizeTiny, &icon_res_info)
; loaded_node->icon = gdraw_command_image_create_with_resource_system(icon_res_info.res_app_num, icon_res_info.res_id); loaded_node->icon_is_default = (timeline_res_id == NOTIF_FALLBACK_ICON) || (timeline_res_id =...
" 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 <bluetooth/gatt.h> #include "comm/ble/gatt_client_subscriptions.h" #include "comm/ble/gap_le_connection.h" #include...
fake_event_get_last()
; cl_assert_equal_i(event.type, PEBBLE_BLE_GATT_CLIENT_EVENT); cl_assert_equal_i(event.bluetooth.le.gatt_client.subtype, PebbleBLEGATTClientEventTypeCharacteristicSubscribe); cl_assert_equal_i(event.bluetooth.le.gatt_client.subscription_type, subscription_type); cl_assert_equal_i(event.bluet...
/* * 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(!pstring_equal_cstring(ps1, NULL))
; cl_assert(!pstring_equal_cstring(NULL, NULL)); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (buffer_size < header_length || memcmp(ROCKY_EXPECTED_SNAPSHOT_HEADER.signature, buffer, sizeof(ROCKY_EXPECTED_SNAPSHOT_HEADER.signature)) != 0) { return false; }
const uint8_t actual_version = buffer[offsetof(RockySnapshotHeader, version)]; const uint8_t expected_version = ROCKY_EXPECTED_SNAPSHOT_HEADER.version; if (expected_version != actual_version) { PBL_LOG(LOG_LEVEL_WARNING, "incompatible JS snapshot version %"PRIu8" (expected: %"PRIu8")", actual_ve...
ze.w; PropertyAnimation *prop_anim = property_animation_create_layer_frame((Layer *)&data->action_menu_layer, start, &stop); Animation *content_out = property_animation_get_animation(prop_anim); animation_set_duration(content_out, IN_OUT_ANIMATION_DURATION); AnimationHandlers anim_handlers = { .starte...
action_menu_layer_deinit(&data->action_menu_layer)
; crumbs_layer_deinit(&data->crumbs_layer); applib_free(data); } static void prv_dummy_click_config(void *data) { } ActionMenuLevel *action_menu_get_root_level(ActionMenu *action_menu) { if (!action_menu) return NULL; ActionMenuData *data = window_get_user_data(&action_menu->window); return (ActionMenuLevel...
_heartbeat_session) return; } // Tell the watchdog timer that we are still awake. dls_create() could take up to 4 seconds if // we can't get the ispp send buffer system_task_watchdog_feed(); if (!s_app_heartbeat_session) { uint32_t size = analytics_heartbeat_kind_data_size(ANALYTICS_HEARTBEAT_KIND_APP);...
memcpy(event_blob_copy, event_blob, sizeof(*event_blob_copy))
; system_task_add_callback(prv_handle_async_event_logging, event_blob_copy); } else { prv_handle_log_event(event_blob); } } void analytics_logging_init(void) { s_heartbeat_timer = new_timer_create(); s_previous_send_ticks = rtc_get_ticks(); new_timer_start(s_heartbeat_timer, HEARTBEAT_INTERVAL, prv_t...
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. */ #define FILE_LOG_COLOR LOG...
(LOG_LEVEL_DEBUG, "----> Sending a BT state event")
; PebbleEvent event = { .type = PEBBLE_BT_STATE_EVENT, .bluetooth = { .state = { .airplane = s_comm_airplane_mode_on, .enabled = s_comm_enabled, .override = s_comm_override, }, }, }; event_put(&event); } static void prv_comm_state_change(void *context) { static b...
rator function that finds the entry with the lowest calculated priority static bool prv_each_free_up_space(SettingsFile *file, SettingsRecordInfo *info, void *context) { // check entry is valid if ((info->key_len != sizeof(AppInstallId)) || (info->val_len != sizeof(AppCacheEntry))) { PBL_LOG(LOG_LEVEL_WARNING, ...
while (node) { EvictListNode *temp = node; PBL_LOG(LOG_LEVEL_DEBUG, "Deleting application binaries for app id: %"PRIu32", size: %"PRIu32, node->id, node->size); app_cache_remove_entry(node->id); node = (EvictListNode *)list_pop_head((ListNode *)node); kernel_free(temp); }
} unlock: mutex_unlock_recursive(s_app_cache_mutex); return rv; } ////////////////////// // AppCache Helpers ////////////////////// // Remove the filename entry in the PFSFileList (via context) that corresponds to the // app install id passed in via info static bool prv_remove_matching_resource_file_callback(S...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
tolower(c)
for an existing session KAlgTestSleepSession *session = s_captured_sleep_sessions; for (int i = 0; i < s_num_captured_sleep_sessions; i++, session++) { if (session->start_utc == start_utc && session->activity == activity_type) { entry_idx = i; break; } } cl_assert(entry_idx < MAX_CAPTURED_S...
if (exit_utc >= last_processed_utc - SECONDS_PER_MINUTE) { // We are sleeping results->in_sleep.value = true; int unprocessed_m = (test_end_utc - last_processed_utc) / SECONDS_PER_MINUTE; if (exit_utc == deep_exit_utc) { results->in_deep_sleep.value = true; results->cur_state_elapsed.value =...
} // -------------------------------------------------------------------------------------- // Run a set of samples through and verify that we got the right minute data static void prv_test_minute_data(AccelRawData *samples, int num_samples, TestMinuteData *exp_minutes, int exp_num_m...
or (int16_t x = dst_x1; x <= dst_x2; x++) { bitblt_bitmap_into_bitmap(framebuffer, &column_to_replicate_sub_bitmap, GPoint(x, 0), GCompOpAssign, GColorWhite); } } void graphics_patch_trace_of_moving_rect(GContext *ctx, int16_t *prev_x, GRect current) { const int16_t new_x = curren...
{ const int lshift = delta_bits; const int rshift = 8 - lshift; for (int i = bytes - 1; i >= 1; i--) { buf[i] = (buf[i] << lshift) | (buf[i-1] >> rshift); } if (patch_garbage) { buf[0] <<= lshift; buf[0] |= fill_byte >...
} break; } case 8: { uint8_t *const left_pixel = row_info.data + min_x; uint8_t *const right_pixel = left_pixel + abs_delta; if (pixels_to_move <= 0) { // on this row, the delta is wider than the available pixels if (patch_garbage) { ...
/* * 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...
pfs_init(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...
for (int i = 0; i < TimelineResourceTestAppIdCount; i++) { const TimelineResourceTestAppData *data = &s_test_apps[i]; if (data->install_entry.install_id == install_id) { return data; } }
return NULL; } static const TimelineResourceTestAppData *prv_get_data_for_app_with_uuid(const Uuid *uuid) { for (int i = 0; i < TimelineResourceTestAppIdCount; i++) { const TimelineResourceTestAppData *data = &s_test_apps[i]; if (uuid_equal(uuid, &data->install_entry.uuid)) { return data; } } ...
ck); //! Sends an ANCS attribute fetch (to the Control Point). The notification UID is invalid, ANCS //! will reply with 0xA2 (invalid param) const GetNotificationAttributesMsg dummy_cmd = { .command_id = CommandIDGetNotificationAttributes, .notification_uid = INVALID_NOTIFICATION_UID, }; ...
(data, length, out_error)
; default: *out_error = false; break; } return false; } static void prv_reassembly_handle_complete_response(const uint8_t* data, const size_t length) { analytics_inc(ANALYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_COUNT, AnalyticsClient_System); switch (prv_current_command_id(data)) { case Comm...
r; size_t bytes_written = 0; for (size_t i = 0; i < CONTENT_INDICATOR_BUFFER_SIZE; i++) { content_indicator_init(&content_indicator); bytes_written += sizeof(ContentIndicator *); cl_assert_equal_i(buffer->bytes_written, bytes_written); } for (size_t i = 0; i < CONTENT_INDICATOR_BUFFER_SIZE; i++) { ...
(content_indicator)
; // Should save a reference to the scroll layer cl_assert_equal_p(content_indicator->scroll_layer, &scroll_layer); // Should retrieve the same content indicator with the same scroll layer ContentIndicator *content_indicator2 = content_indicator_get_or_create_for_scroll_layer( &scroll_layer); cl_assert(c...
r state structure gb_storage_cleanup(&state->storage, true /* successful */); kernel_free(state); s_get_bytes_in_progress = false; prv_put_status_event(DebugInfoStateFinished); comm_session_set_responsiveness(state->session, BtConsumerPpGetBytes, ResponseTimeMax, 0); return; } else { com...
if (!prv_setup_state_for_command(hdr->cmd_id, state, msg_data, msg_len)) { kernel_free(state); prv_protocol_send_err_response(session, hdr->transaction_id, GET_BYTES_MALFORMED_COMMAND); return; }
s_get_bytes_in_progress = true; prv_put_status_event(DebugInfoStateStarted); state->start_ticks = rtc_get_ticks(); bt_driver_analytics_get_conn_event_stats(&state->conn_event_stats); prv_protocol_send_next_chunk(state); }
} } } if (closest_match != -1) { FilePageCache *close_pg = &f->pg_cache[closest_match]; pages_to_seek -= f->pg_cache[closest_match].virtual_pg; next_page = f->pg_cache[closest_match].physical_pg; // if we still are not on the page we are looking for, see how // ma...
get_next_page(file->curr_page, &file->curr_page)
!= S_SUCCESS) { PBL_LOG(LOG_LEVEL_WARNING, "R:Couldn't find next page for %d", file->curr_page); res = E_INTERNAL; goto cleanup; } } res = bytes_read; cleanup: mutex_unlock_recursive(s_pfs_mutex); return (res); } int pfs_seek(int fd, int offset, FSeekType seek_type) { mutex_...
// ------------------------------------------------------------------------------------------------- // Helper data structure for prv_register_intent struct RegisterIntentRequest { bool is_bonding_based; union { const BTDeviceInternal *device; GAPLEConnectionIntentBonding bonding; }; }; // -----------...
// Connection watchdog should take care of disconnecting after timeout in case pairing // does not happen in a timely manner // TODO: https://pebbletechnology.atlassian.net/browse/PBL-11236 } return BTErrnoOK; } // Notify client of the virtual connection: prv_update_clients(intent, HciS...
// ------------------------------------------------------------------------------------------------- //! Unregisters a connection intent for a client task //! bt_lock() is expected to be taken by the caller static BTErrno prv_unregister_intent(GAPLEConnectionIntent *intent, GAPLEC...
{ min_y = rot_points[i].y; } if (max_y < rot_points[i].y) { max_y = rot_points[i].y; } if (found_start_direction) { continue; } // use the first non-horizontal path segment's direction as the start direction if (rot_end.y != rot_start.y) { start_is_down = rot_end.y > rot_start.y; ...
if (!imprecise_points) { APP_LOG(APP_LOG_LEVEL_ERROR, GPATH_ERROR); return; }
for (size_t i = 0; i < num_points; i++) { imprecise_points[i] = GPointFromGPointPrecise(points[i]); } GPath path = { .num_points = (uint32_t)num_points, .points = imprecise_points }; gpath_draw_filled(ctx, &path); applib_free(imprecise_points); } void gpath_draw_outline_precise_internal(GCon...
ual_i(i1.right, i2.right); \ cl_assert_equal_i(i1.bottom, i2.bottom); \ cl_assert_equal_i(i1.left, i2.left); \ } while(0) void test_gtypes__gedge_insets(void) { GEdgeInsets g4 = (GEdgeInsets){.top = 1, .right = 2, .bottom = 3, .left = 4}; cl_assert_equal_insets(GEdgeInsets(1, 2, 3, 4), g4); GEdgeInsets ...
cl_assert_equal_i(1, COLOR_FALLBACK(1,2))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ fake_event_clear_last(); s_last_pebble_event = *event; ++s_fake_event_count; if (s_fake_event_cb) { s_fake_event_cb(event); } }
bool event_put_isr(PebbleEvent* event) { return false; } QueueHandle_t event_kernel_to_kernel_event_queue(void) { return (NULL); } BaseType_t event_queue_cleanup_and_reset(QueueHandle_t queue) { return pdPASS; } void fake_event_init(void) { fake_event_reset_count(); fake_event_clear_last(); } PebbleEven...
I_FILE("draw_vert_dotted_line_origin_no_clip"))); // Even cols of different lengths setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_ROWS); graphics_draw_vertical_line_dotted(&ctx, GPoint(2, 0), MAX_NUM_ROWS + 4); g...
(&ctx, GPoint(0, 0), MAX_NUM_ROWS)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(2, 0), MAX_NUM_ROWS + 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(4, 0), 0); graphics_draw_vertical_line_dotted(&ctx, GPoint(6, 0), 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(8, 0), 2); graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 0), 3...
) { ref = state->session_ref; } mutex_unlock_recursive(s_manager_state.lock); return ref; } DEFINE_SYSCALL(bool, sys_hrm_manager_get_subscription_info, HRMSessionRef session, AppInstallId *app_id, uint32_t *update_interval_s, uint16_t *expire_s, HRMFeature *features) { mutex_...
PBL_LOG(LOG_LEVEL_DEBUG, "Setting expiration time on session for app_id %d", (int)app_id)
; sys_hrm_manager_set_update_interval(state->session_ref, state->update_interval_s, HRM_MANAGER_APP_EXIT_EXPIRATION_SEC); }
fer[buf_size - 1] = '\0'; } } void clock_get_since_time(char *buffer, int buf_size, time_t timestamp) { if (buffer) { strncpy(buffer, "15 minutes ago", buf_size); buffer[buf_size - 1] = '\0'; } } // Stubs ///////////////////// #include "stubs_action_menu.h" #include "stubs_analytics.h" #include "stubs_...
attribute_list_add_cstring(&attr_list, AttributeIdSubtitle, config->subtitle)
; } if (config->location_name) { attribute_list_add_cstring(&attr_list, AttributeIdLocationName, config->location_name); } if (config->body) { attribute_list_add_cstring(&attr_list, AttributeIdBody, config->body); } if (config->icon_timeline_res_id != TIMELINE_RESOURCE_INVALID) { attribute_list_...
{ 1064, 8, 120}, { 1008, -48, 152}, { 1016, -56, 120}, { 1024, -104, 96}, { 1080, -104, 72}, // 10 seconds { 1112, -136, 72}, { 1200, -192, 64}, { 1288, -216, 72}, { 1272, -168, 96}, { 1016, -176, 16}, { 848, -192, -136}, { 1088, -184, -72}, { 1184, -264, 80}, ...
{ 1224, -80, -152}, { 912, -24, -296}, { 1064, 40, -432}, { 1240, 16, -248}, { 1200, -56, -152}, { 1032, -40, -192}, { 936, -24, -224}, { 872, 8, -240}, { 896, 40, -288}, { 976, -24, -256}, { 1040, -40, -208}, { 1024, -32, -184}, { 1080, -8, -200}, { 1112, 0, -192...
{ 1192, -8, -256}, { 1184, -48, -160}, { 1040, -16, -184}, { 984, 16, -184}, { 936, 24, -192}, { 976, 24, -208}, { 1000, -16, -200}, { 1000, -16, -216}, { 1008, 0, -248}, { 1088, -8, -232}, { 1112, -16, -192}, { 1280, -16, -160}, { 1464, 8, -280}, { 1224, 24, -20...
de "applib/fonts/fonts.h" #include "kernel/pbl_malloc.h" #include "system/logging.h" #include "system/passert.h" #include <string.h> #include <stddef.h> static GTextLayoutCacheRef prv_text_layer_legacy2_get_cache_handle(TextLayerLegacy2 *text_layer) { if (text_layer == NULL) { return NULL; } return text_lay...
gcolor_equal(native_color, text_color)
) { return; } text_layer->text_color = get_closest_gcolor2(native_color); layer_mark_dirty(&(text_layer->layer)); } void text_layer_legacy2_set_text_alignment(TextLayerLegacy2 *text_layer, GTextAlignment text_alignment) { if (text_layer == NULL || text_alignment =...
prv_init()
; app_event_loop(); } const PebbleProcessMd* sdk_app_get_info(void) { static const PebbleProcessMdSystem s_app_md = { .common = { .main_func = s_main, // UUID: 1197fc39-47e7-439b-82be-f56d9ba1dbd8 .uuid = { 0x11, 0x97, 0xfc, 0x39, 0x47, 0xe7, 0x43, 0x9b, 0x82, 0xbe, 0xf5, 0x6...
delay_us(200000)
; display_error_code(0x0defaced); delay_us(200000); display_error_code(0xd15ea5e5); delay_us(200000); display_error_code(0xdeadbeef); delay_us(200000); display_boot_splash(); delay_us(1000000); } #endif if (is_button_stuck()) { sad_watch(ERROR_STUCK_BUTTON); } if (is_flash_...
{ 904, -16, -128}, { 912, -32, -280}, { 960, -64, -328}, { 1024, -96, -368}, { 1056, -104, -416}, { 1112, -96, -440}, { 1112, -88, -432}, { 1464, -112, -392}, { 1448, -160, -320}, { 1160, -232, -152}, // 40 seconds { 888, -240, -88}, { 944, -280, 40}, { 1272, -256, ...
{ 1024, -136, -128}, { 960, -64, -176}, { 960, -56, -168}, { 968, -104, -128}, { 1016, -136, -136}, { 1032, -120, -168}, { 1056, -120, -176}, { 1104, -88, -208}, { 1168, -120, -168}, { 1312, -152, -160}, { 1424, -144, -280}, { 1272, -136, -240}, { 896, -80, -184}, ...
{ 936, -80, -160}, { 960, -24, -216}, { 968, -56, -208}, { 1032, -128, -216}, { 1080, -144, -224}, { 1064, -128, -256}, { 1128, -104, -288}, { 1160, -120, -280}, { 1176, -160, -232}, // 48 seconds { 1464, -144, -312}, { 1312, -136, -240}, { 1016, -80, -200}, { 10...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
dialog_spi_receive_data_no_wait(buffer, sizeof(buffer))
; if (memcmp(buffer, core_dump_connect_response, sizeof(core_dump_connect_response)) == 0) { PBL_LOG(LOG_LEVEL_INFO, "Core Dump connect response received"); return true; } } PBL_LOG(LOG_LEVEL_ERROR, "Failed to connect with BLE chip to collect coredump"); return false; } static void prv_int_ex...
/* * 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(*data, 0x00 /* Command ID 'Request' */)
; s_data_sent = true; return true; } CommSessionCapability s_capability_flags; void comm_session_set_capabilities(CommSession *session, CommSessionCapability capability_flags) { cl_assert_equal_p(session, &s_session); s_capability_flags = capability_flags; } BTBondingID bt_persistent_storage_store_bt_classic_...
_device(1); // Register connection intent for app: gap_le_connect_connect(&device, false /* no auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp); prv_fake_connect(&device, false /* is_master*/); BTErrno e = gap_le_conne...
gap_le_connect_connect_by_bonding(bonding_id, true /* no auto_reconnect */, true /* is_pairing_required */, GAPLEClientApp)
; prv_fake_connect(&device, false /* is_master*/); // Verify the app task got NO (virtual) connection event, the link is not encrypted yet: // TODO: legacy PEBBLE_BT_CONNECTION_EVENT is still emitted, see gap_le_connect.c // prv_put_legacy_connection_event. // // prv_assert_no_event(); fake_event_clear...
------------------------------------ void alarm_set_enabled(AlarmId id, bool enable) { SettingsFile file; if (!prv_file_open_and_lock(&file)) { return; } AlarmConfig config; bool rv = prv_alarm_get_config(&file, id, &config); if (!rv) { goto cleanup; } if (id == s_most_recent_alarm_id && !enab...
if (!rv) { goto cleanup; }
if (kind_out) { *kind_out = config.kind; } cleanup: prv_file_close_and_unlock(&file); return rv; } static void prv_snooze_alarm(int snooze_delay_s) { prv_clear_snooze_timer(); PBL_LOG(LOG_LEVEL_INFO, "Snoozing for %d minutes", snooze_delay_s / SECONDS_PER_MINUTE); bool success = new_timer_start(s_...
(bus); if (bus->state->transfer.state == I2CTransferState_WriteRegAddress) { // For writes, we'll reload with the payload once we send the address. Otherwise, we'd need to // send a repeated start, which we don't want to do. const bool reload = bus->state->transfer.direction == I2CTransferDirection_Write;...
{ I2C_TypeDef *i2c = bus->hal->i2c; if ((i2c->ISR & I2C_ISR_BERR) != 0) { i2c->ICR |= I2C_ICR_BERRCF; } if ((i2c->ISR & I2C_ISR_OVR) != 0) { i2c->ICR |= I2C_ICR_OVRCF; } if ((i2c->ISR & I2C_ISR_ARLO) != 0) { i2c->ICR |= I2C_ICR_ARLOCF; } return prv_end_transfer_irq(bus, I2CTransferEvent_Erro...
void i2c_hal_event_irq_handler(I2CBus *bus) { portEND_SWITCHING_ISR(prv_event_irq_handler(bus)); } void i2c_hal_error_irq_handler(I2CBus *bus) { portEND_SWITCHING_ISR(prv_error_irq_handler(bus)); }
ow in current section break; } --(it->cursor.index.row); if (it->row_callback_before_geometry) { it->row_callback_before_geometry(it); } // when walking upwards, selected_index isn't set yet here // hence, the heights are the sizes as they were before the selection ...
{ MenuLayer *menu_layer = (MenuLayer*)(((uint8_t*)scroll_content_layer) - offsetof(MenuLayer, scroll_layer.content_sublayer)); const GSize frame_size = menu_layer->scroll_layer.layer.frame.size; const int16_t content_top_y = -scroll_layer_get_content_offset(&menu_layer->scroll_layer).y; const int16_t cont...
40, 392, 232}, { 344, 624, 232}, // 16 seconds { 408, 680, 432}, { 352, 896, 344}, { 368, 928, 392}, { 400, 1064, 464}, { 344, 1088, 280}, { 288, 1264, 272}, { 176, 1040, 360}, { 176, 1208, 24}, { 184, 952, 136}, { 168, 792, 48}, { 240, 712, -16}, { 272, 560, 24},...
{ 280, 504, 192}, { 336, 608, 216}, { 240, 528, 344}, { 264, 1056, 376}, { 272, 1224, 432}, { 112, 1224, 384}, { 248, 1512, 184}, { 208, 1000, 384}, // 22 seconds { 216, 1032, -96}, { 280, 944, 8}, { 232, 840, 104}, { 288, 736, -112}, { 264, 544, -224}, { 200,...
{ 144, 1624, 432}, { 304, 1320, 384}, { 264, 976, 264}, { 208, 896, 256}, { 192, 568, 352}, { 128, 480, 16}, { 192, 600, 224}, { 232, 664, 288}, { 344, 896, 240}, { 408, 816, 296}, { 440, 944, 168}, { 344, 1000, 208}, { 328, 1120, 184}, { 200, 1256, 168}, // ...
+ bytes - delta_bytes : left_pixel; if (delta_bytes) { memmove(to, from, bytes - delta_bytes); if (patch_garbage) { memset(garbage_start, fill_byte, delta_bytes); } } if (delta_neg) { if (delta_bits) { const int rshift = delta_bi...
(src_row_info.max_x, max_x)
; const int16_t src_pixels = src_max_x - src_min_x + 1; const int16_t x_offset = src_min_x - dst_min_x; const int16_t copy_pixels = MIN(src_pixels, dst_pixels); memmove(dst_row_info.data + dst_min_x + x_offset, src_row_info.data + src_min_x, (size_t)copy_pixels); ...
D, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "comm/ble/gap_le_connect.h" #include "comm/ble/gap_le_slave_reconnect.h" #include "comm/bt_lock.h" #...
prv_bt_persistent_storage_store_ble_pairing(new_pairing_info, is_gateway, requires_address_pinning, flags, device_name, pairing_op)
); } bool bt_persistent_storage_update_ble_device_name(BTBondingID bonding, const char *device_name) { // A device name has come in, update the name of our currently paired device SMPairingInfo data = {}; bool requires_address_pinning = false; uint8_t flags = 0; if (!shared_prf_storage_get_ble_pairing_data(&...
ailed); // A touchdown occurs where no layers are touched while a window recognizer is active e.type = TouchEvent_Touchdown; s_active_layer = NULL; recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed((int[]) { 0 }, 1, &s_recognizers_handled); prv_compare_recognizers_proce...
(manager.state, RecognizerManagerState_RecognizersActive)
; cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Failed); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible); prv_destroy_recognizers(recognizers, ...
#include "stubs_prompt.h" #include "stubs_serial.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 ///////////////////// #inc...
{ const bool is_current_location = true; prv_render_long_strings_test(is_current_location); 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 = -99, ...
/* * 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...
((PebbleMutex *) handle, is_held, saved_lr)
; } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_draw_pixel(ctx, GPoint(5, 5)); } void clear_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorClear); graphics_draw_pixel(ctx, GPoint(5, 5...
cl_check(framebuffer_is_empty("outside_ny_offset_layer", ctx.parent_framebuffer, GColorWhite))
; test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_x_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_x_y_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer,...
ryState s_last_battery_state; static TimerID s_periodic_timer_id = TIMER_INVALID_ID; static int s_analytics_previous_mv = 0; static void prv_schedule_update(uint32_t delay, bool force_update); PreciseBatteryChargeState prv_get_precise_charge_state(const BatteryState *state); static void prv_transition(BatteryState *s...
if (s_last_battery_state.skip_count == MAX_SAMPLE_SKIPS) { analytics_inc(ANALYTICS_DEVICE_METRIC_BATTERY_SAMPLE_SKIP_COUNT_EXCEEDED, AnalyticsClient_System); }
s_last_battery_state.skip_count = 0; // Driver communication bool state_changed = false; ConnectionStateID next_state = prv_get_connection_state(); if (s_last_battery_state.connection != next_state) { // Do not allow DischargingPlugged -> ChargingPlugged state if ((s_last_battery_state.connection !...
et_ms_since_system_start(); while (animation) { const int32_t rel_ms_running = serial_distance32(animation->abs_start_time_ms, now); if (rel_ms_running < 0) { // AnimationLegacy2s are ordered by abs_start_time_ms. // We've reached an animation that should not start yet, so // everything af...
{ PBL_ASSERTN(animation->abs_start_time_ms == 0); // can't set after animation has been added animation->duration_ms = duration_ms; }
void animation_legacy2_set_curve(AnimationLegacy2 *animation, AnimationCurve curve) { PBL_ASSERTN(animation->abs_start_time_ms == 0); // can't set after animation has been added PBL_ASSERTN(curve < AnimationCurveCustomFunction); animation->curve = curve; } void animation_legacy2_set_custom_curve(AnimationLegac...
/* * 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_comm_session_event_put = 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...
(BITS_BETWEEN(0, 0), erased_sector)
; cl_assert(flash_locked); } void test_system_flash__erase_one_byte_in_middle_of_sector(void) { cl_assert(system_flash_erase(FLASH_BASE + 12345, 1, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_some_sectors_from_beginning(void) { ...
/* * 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...
printf(" ---\n")
; printf(" message : %s\n", error->error_msg); printf(" severity: fail\n"); printf(" suite : %s\n", error->suite); printf(" test : %s\n", error->test); printf(" file : %s\n", error->file); printf(" line : %d\n", error->line_number); if (error->description != NULL) printf(" description: %s\n"...
-384, -320, -960}, { -256, -344, -936}, { -224, -360, -744}, { -176, -360, -688}, { -216, -408, -664}, { -152, -400, -584}, { -64, -408, -552}, { 64, -376, -568}, { 152, -400, -600}, { 384, -304, -448}, { 728, -48, -416}, { 1040, 136, -344}, { 1736, 200, -248}, { 2248...
{ 744, -344, -88}, { 904, -40, -88}, { 528, -160, -264}, { 1016, 104, -352}, { 1192, 208, -232}, { 1240, 336, -224}, // 79 seconds { 1144, 320, -216}, { 1216, 408, -184}, { 1432, 576, -80}, { 1632, 832, -72}, { 1584, 616, -56}, { 1256, 832, -168}, { 1088, 1144, -7...
{ 1304, 808, -120}, { 1504, 752, -80}, { 1632, 664, -40}, { 1392, 392, -8}, { 1024, 80, -32}, { 952, 152, -96}, { 1104, 248, -112}, { 1264, 320, -80}, { 1264, 200, -48}, { 1104, 120, -64}, { 1040, 200, -256}, { 976, -224, -208}, { 416, -48, -144}, { 936, 96, -664...
; data->timeline_layer.animating_intro_or_exit = false; if (!finished || (!prv_set_state(s_app_data, TimelineAppStateStationary) && !prv_set_state(s_app_data, TimelineAppStateDaySeparator))) { return; } data->current_animation = NULL; prv_update_timeline_layer(data); if (data->sta...
peek_layer_set_duration(peek_layer, duration)
; peek_layer_play(peek_layer); } static void prv_intro_timer_callback(void *context) { TimelineAppData *data = context; data->intro_timer_id = EVENTED_TIMER_INVALID_ID; // if we are already hiding the peek, we were in a mini peek const bool was_mini_peek = (data->state == TimelineAppStateHidePeek); prv_s...
{ continue; }
// Found the CCCD! // ... and finally subscribe to indications: const uint16_t cccd_value = GATT_CCC_INDICATIONS; ble_error_t result = gatt_wrapper_write(evt->conn_idx, descriptor_info->handle, sizeof(cccd_value), (const uint8_t *)&cccd_value, ...
/* * 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...
(SEND_TEXT_NOTIF_PREF_KEY)
); if (!notif_prefs) { return false; } bool has_reply_action = (timeline_item_action_group_find_reply_action(&notif_prefs->action_group) != NULL); ios_notif_pref_db_free_prefs(notif_prefs); return has_reply_action; } static void prv_blobdb_event_handler(PebbleEvent *event, void *context) { cons...
)); // Even rows of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_COLS); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 2), MAX_NUM_COLS + 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0...
(&ctx, GPoint(0, 0), MAX_NUM_ROWS)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(2, 0), MAX_NUM_ROWS + 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(4, 0), 0); graphics_draw_vertical_line_dotted(&ctx, GPoint(6, 0), 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(8, 0), 2); graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 0), 3...
addr + (is_subsector ? SUBSECTOR_SIZE_BYTES : SECTOR_SIZE_BYTES); for (uint32_t i_addr = addr; i_addr < end_addr; i_addr += sizeof(buffer)) { flash_read_bytes((uint8_t *)buffer, i_addr, sizeof(buffer)); for (uint32_t j = 0; j < sizeof(buffer); j++) { if (buffer[j] != 0xFF) { erased = f...
prompt_command_finish()
; KaboomCallback kaboom = 0; kaboom(); } void command_boot_bit_set(const char* bit, const char* value) { int len = strlen(bit); int bit_number = 0; for (int i = 0; i < len; ++i) { bit_number *= 10; int next_digit = bit[i] - '0'; if (next_digit < 0 || next_digit > 9) { prompt_send_response...
, STROKE_BIG); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r16_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, STROKE_BIG); graphics_draw_circle(&ctx, CENTER_OF_ORI...
gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r16_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, STROKE_BIG); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r16_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, O...
nd_enabled()) { do_not_disturb_toggle_smart_dnd(); } alerts_preferences_check_and_set_first_use_complete(FirstUseSourceSmartDND); s_event_ongoing = false; s_num_dnd_events_put = 0; } void test_do_not_disturb__cleanup(void) { // Make sure we start in a common state: everything off do_not_disturb_set_m...
(do_not_disturb_is_smart_dnd_enabled() == true)
; active = do_not_disturb_is_active(); cl_assert(active == false); s_event_ongoing = true; // Manual && !Scheduled && Smart do_not_disturb_set_manually_enabled(true); do_not_disturb_set_schedule_enabled(WeekdaySchedule, false); active = do_not_disturb_is_active(); cl_assert(active == true); // Manua...
eek->layout_layer; // Normally it is animated, but for this unit test, we don't request `animated` cl_assert(layer->frame.origin.y >= DISP_ROWS); // Peek service shows the peek UI. Not animated for this unit test. TimelineItem *item = prv_set_timeline_item(&(TimelinePeekItemConfig) { .title = "CoreUX Desig...
cl_assert(layer->frame.origin.y < DISP_ROWS)
, 896, 296}, { -32, 904, 304}, { -24, 896, 304}, { -32, 904, 304}, { -24, 904, 288}, { -40, 904, 296}, { -32, 904, 304}, // 291 seconds { -24, 904, 296}, { -32, 904, 304}, { -32, 904, 304}, { -32, 904, 296}, { -32, 904, 312}, { -24, 920, 296}, { -40, 904, 320}, ...
{ -32, 904, 288}, { -32, 904, 296}, { -40, 904, 296}, { -40, 896, 296}, { -32, 904, 288}, { -32, 904, 304}, { -32, 896, 288}, { -32, 896, 312}, { -32, 904, 296}, { -32, 904, 296}, { -24, 904, 280}, // 297 seconds { -40, 912, 312}, { -24, 904, 296}, { -32, 896,...
/* * 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...
{ UTIL_ASSERT(c); UTIL_ASSERT(buffer); UTIL_ASSERT(item_size); UTIL_ASSERT(compare_cb); *c = (CircularCache) { .cache = buffer, .next_erased_item_idx = 0, .item_size = item_size, .total_items = total_items, .compare_cb = compare_cb }; }
void circular_cache_set_item_destructor(CircularCache *c, CircularCacheItemDestructor destructor) { c->item_destructor = destructor; } static uint8_t* prv_get_item_at_index(CircularCache* c, int index) { return c->cache + index * c->item_size; } bool circular_cache_contains(CircularCache* c, void* theirs) { r...
uint32_t CACHE_ASSOCCFG_REG; uint32_t CACHE_CTRL2_REG; uint32_t CACHE_CTRL3_REG; uint32_t CACHE_MRM_HITS_REG; uint32_t CACHE_MRM_MISSES_REG; uint32_t CACHE_MRM_CTRL_REG; uint32_t CACHE_MRM_TINT_REG; uint32_t CACHE_MRM_THRES_REG; uint32_t SWD_RESET_REG; } AllRegisters; static AllRegisters ALL_R...
(DCDC, DCDC_V18_1_REG, DCDC_V18_IDLE_MIN, 0x10)
; REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_FAST_RAMPING, 0x1); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_VOLTAGE, 0x10); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_CUR_LIM_MAX_HV, 0x18); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_CUR_LIM_MIN, 0x4); REG_SETF(DCDC, DCDC_VDD_1_REG, DCDC_VDD_ENABLE_HV, 0x1); REG_SETF(...
ormed_payload[sizeof(PostMessageResetCompletePayload) - 1] = {}; RCV_APP_MESSAGE(TupletBytes(PostMessageKeyResetComplete, malformed_payload, sizeof(malformed_payload))); // Expect Error: const PostMessageUnsupportedErrorPayload expected_error = { .error_code = PostMessageErrorMa...
EXECUTE_SCRIPT("var isCalled = false;" "_rocky.on('postmessagedisconnected', function() { isCalled = true; });")
; ASSERT_JS_GLOBAL_EQUALS_B("isCalled", false); RCV_RESET_COMPLETE(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaitingResetCompleteLocalInitiated); EXPECT_OUTBOX_RESET_REQUEST(); ASSERT_JS_GLOBAL_EQUALS_B("isCalled", true); // TODO: assert: // - flushe...
s); } cl_assert_equal_i(num_samples, 0); } // --------------------------------------------------------------------------------------- // Init and enable the activity service static void prv_activity_init_and_set_enabled(bool enable) { activity_init(); activity_set_enabled(enable); fake_system_task_callbacks...
(sessions[i].length_min, health_sessions[i].length_min)
; } } // ============================================================================================= // Start of unit tests void test_activity__initialize(void) { TimezoneInfo tz_info = { .tm_zone = "UTC", .tm_gmtoff = 0, }; time_util_update_timezone(&tz_info); struct tm time_tm = s_init_time_tm...
BEntry bg_counter_app = { .name = BG_COUNTER_APP_NAME, .uuid = {0x1e, 0xb1, 0xd3, 0x9b, 0x56, 0x98, 0x48, 0x44, 0xb3, 0x94, 0x1f, 0x87, 0xb6, 0xbe, 0xae, 0x67}, .info_flags = PROCESS_INFO_HAS_WORKER | PROCESS_INFO_STANDARD_APP, .icon_resource_id = 0, .app_version = { .major = 1, .minor = 0,...
(data, &menu_layer)
; menu_layer_reload_data(&menu_layer); } void test_app_menu_data_source__pass_init(void) { app_menu_data_source_init(&data_source, &(AppMenuDataSourceCallbacks) { .changed = prv_menu_layer_reload_data, .filter = everything_filter_callback, }, &menu_layer); uint16_t num_apps = app_menu_data_source_get_c...
G; uint32_t QSPIC_UCODE_START; // GPREG uint16_t PLL_SYS_CTRL1_REG; uint16_t PLL_SYS_CTRL2_REG; uint16_t PLL_SYS_CTRL3_REG; uint16_t PLL_SYS_TEST_REG; // CACHE uint32_t CACHE_CTRL1_REG; uint32_t CACHE_LNSIZECFG_REG; uint32_t CACHE_ASSOCCFG_REG; uint32_t CACHE_CTRL2_REG; uint32_t CACH...
REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_ENABLE_HV, 0x1)
; REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_ENABLE_LV, 0x0); REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_CUR_LIM_MAX_LV, 0xF); REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_IDLE_HYST, 0x4); REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_IDLE_MIN, 0x10); REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_FAST_RAMPING, 0x1); REG_SETF(DCD...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_context_set_antialiased(ctx, true)
; // Setup the draw state graphics_context_set_fill_color(ctx, GColorElectricBlue); graphics_fill_rect(ctx, &(GRect){.size = bounds}); } static void prv_teardown_context(GContext *ctx) { free(ctx->dest_bitmap.addr); ctx->dest_bitmap.addr = NULL; } // Read PDC sequence file an write to a sequence of PNGs vo...
essage *message = consumer->head; consumer->head = NULL; while (message) { if (should_call_sent_handler) { prv_schedule_sent_handler(message->sent_handler, message->cb_ctx, AppOutboxStatusConsumerDoesNotExist); } AppOutboxMessage *next = (AppOutboxMessage *...
(consumer, false /* should_call_sent_handler */)
; } prv_unlock(); } void app_outbox_service_cleanup_event(PebbleEvent *event) { if (event->type != PEBBLE_APP_OUTBOX_MSG_EVENT) { return; } // Call consume directly to clean up the message, it's not valid anyway: app_outbox_service_consume_message((AppOutboxMessage *)event->app_outbox_msg.data, ...
ks static void select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, LauncherMenuData *data) { AppMenuNode *node = app_menu_data_source_get_node_at_index(&data->data_source, cell_index->row); app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = node->install_id, ...
(&data->connectivity_icon)
; kino_layer_deinit(&data->battery_icon); // Save the current state of the menu so we can restore it later. s_launcher_menu_persisted_data = (LauncherMenuPersistedData) { .valid = true, .scroll_offset_y = scroll_layer_get_content_offset(&data->menu_layer.scroll_layer).y, .menu_index_row = menu_layer_...
if (new_bitmap_resource != data->current_plus_icon_resource_id) { // Change the icon to the dotted one data->current_plus_icon_resource_id = new_bitmap_resource; gbitmap_deinit(&data->plus_icon); gbitmap_init_with_resource(&data->plus_icon, data->current_plus_icon_resource_id); } bo...
i18n_get("Smart Alarm", data)
e.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 governing permissions and * ...
(LOG_LEVEL_INFO, "Entering infinite loop in non-FreeRTOS ISR.")
{ 840, 256, 120}, { 880, 288, 120}, { 856, 328, 8}, { 928, 368, -120}, { 1032, 368, -208}, { 1184, 336, -192}, { 1648, 160, 16}, { 1784, 320, 8}, { 960, 344, 0}, { 1080, 200, 48}, { 1200, 120, 160}, { 976, 56, 208}, { 808, 104, 144}, { 744, 88, 104}, { 688, 24...
{ 888, -88, 48}, { 1008, -40, -24}, { 1416, -184, 96}, { 1648, -48, 160}, { 1392, 272, -120}, { 1280, 376, -224}, { 976, 360, 16}, { 744, 104, 40}, { 792, 80, 168}, { 824, 192, 96}, { 792, 224, 96}, { 832, 304, -8}, { 960, 336, -112}, { 1120, 304, -128}, { 12...