prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
age hc_header; BinLogMessage_Header_v1 header; uint8_t string[8]; } OVERRUN = { .hc_header = { .message_length = sizeof(OVERRUN), }, .header = { .version = BINLOGMSG_VERSION_STRING_V1, .length = 8, }, .string = "OVERRUN\0", }; void pbl_log_set_level(uint8_t level) { s_log_buffer.level = level;...
(&s_log_buffer.circular_buffer, buffer, length)
) { // Out of memory! Attempt to print an overrun message circular_buffer_write(&s_log_buffer.circular_buffer, (uint8_t *)&OVERRUN.header, sizeof(OVERRUN) - sizeof(HcProtocolMessage)); } prv_start_tx(); prv_unlock(); } #ifdef PBL_LOGS_HASHED void pbl_log_hashed(const uint32_t p...
CT_ELSE(10, 0); ///////////////////////////////////////// // Click Config ///////////////////////////////////////// T_STATIC void prv_handle_down_click(ClickRecognizerRef recognizer, void *context) { TimelineItemLayer *item_layer = (TimelineItemLayer *)context; int16_t max_scroll = prv_get_max_scroll_offset(item_...
window_set_click_config_provider_with_context(window, timeline_item_layer_click_config_provider, item_layer)
; } ///////////////////////////////////////// // Public functions ///////////////////////////////////////// void timeline_item_layer_update_proc(Layer* layer, GContext* ctx) { //! Fill background with white to hide layers below TimelineItemLayer* item_layer = (TimelineItemLayer *)layer; const LayoutColors *colo...
for doing the top corners. uint32_t corner_insets_left = (corner_mask & GCornerTopLeft) ? round_top_corner_lookup[radius] : 0; uint32_t corner_insets_right = (corner_mask & GCornerTopRight) ? round_top_corner_lookup[radius] : 0; const unsigned int top_cropped_rows_count = clipped_rect.origin.y - rect.origin.y; ...
{ // These are used to optimize the rectangles that are drawn such that only three rectangles // are drawn always int16_t top_rect_origin_x = rect->origin.x; int16_t top_rect_size_w = rect->size.w; int16_t bottom_rect_origin_x = rect->origin.x; int16_t bottom_rect_size_w = rect->size.w; // ...
prv_fill_rect_legacy2(ctx, GRect(rect->origin.x, rect->origin.y + radius, rect->size.w, rect->size.h - 2 * radius), 0, GCornerNone, fill_color); // Bottom Rect prv_fill_rect_legacy2(ctx, GRect(bottom_rect_origin_x, rect->origin.y + rect->size....
a spawn out of b and c Animation *c = prv_create_test_animation(); Animation *spawn = animation_spawn_create(c, b, NULL); cl_assert(spawn == NULL); // We should be able to create one out of c and d Animation *d = prv_create_test_animation(); spawn = animation_spawn_create(c, d, NULL); cl_assert(spawn !=...
(animation_get_elapsed(h, &elapsed_ms))
; cl_assert_equal_i(elapsed_ms, duration / 2); cl_must_pass(animation_get_progress(h, &progress)); cl_assert_equal_i(progress, 32768); // Rounding occurs within, this is close to MAX / 2 animation_destroy(h); #endif } void test_animation__completed(void) { #ifdef TEST_INCLUDE_BASIC const int duration_a = 3...
/* * 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...
{ connection_service_unsubscribe(); }
/* * 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...
analytics_heartbeat_set(heartbeat, ANALYTICS_APP_METRIC_SDK_MAJOR_VERSION, sdk_major_version)
; // Verify that things were set as expected, and adjacent metrics were not // overwritten. int64_t got_time_interval = analytics_heartbeat_get(heartbeat, ANALYTICS_APP_METRIC_TIME_INTERVAL); cl_assert(time_interval == got_time_interval); int64_t got_sdk_major_version = analytics_heartbeat_get(heartbeat, ANA...
&offset); animation = property_animation_get_animation(scroll_layer->animation); if (scroll_layer_get_paging(scroll_layer)) { animation_set_custom_interpolation(animation, interpolate_moook); animation_set_duration(animation, interpolate_mo...
{ PBL_ASSERTN(scroll_layer); // paging and shadow_sublayer are mutually exclusive // so init shadow_sublayer if it was paging data if (prv_scroll_layer_is_paging_enabled(scroll_layer) && hidden == false) { prv_setup_shadow_layer(scroll_layer); } scroll_layer_property_changed_proc((Layer*)scroll_layer)...
bool scroll_layer_get_shadow_hidden(const ScrollLayer *scroll_layer) { return layer_get_hidden(&scroll_layer->shadow_sublayer); } void scroll_layer_set_paging(ScrollLayer *scroll_layer, bool paging_enabled) { PBL_ASSERTN(scroll_layer); if (paging_enabled) { // Deinit shadow_sublayer to enable paging if...
lient_characteristic_get_connection(characteristic); bt_unlock(); if (connection != NULL) { bt_driver_gap_le_disconnect(&connection->device); } else { PBL_LOG(LOG_LEVEL_ERROR, "PPoGatt: disconnect attempt failed, no connection for char 0x%x", (int)characteristic); #if ...
prv_next_sn(sn)
; const uint16_t num_bytes_acked = prv_total_num_bytes_awaiting_ack_up_to(client, next_sn); comm_session_send_queue_consume(client->session, num_bytes_acked); // If next_data_sn is before the Ack'd sn, the packet pending retransmission has just been // Ack'd. We can determine whether or not a packet is...
/* * 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...
(address_str)
; if (address == -1) { prompt_send_response("Invalid address"); return; } uint32_t word = *(uint32_t*) address; char buffer[32]; prompt_send_response_fmt(buffer, sizeof(buffer), "0x%"PRIx32" = 0x%"PRIx32, address, word); } void command_format_flash(void) { flash_erase_bulk(); } void command_eras...
W_FW_UPDATE_IN_PROGRESS); FirmwareDescription firmware_description = firmware_storage_read_firmware_description(flash_address); if (!firmware_storage_check_valid_firmware_description(&firmware_description)) { dbgserial_putstr("Invalid firmware description!"); return UPDATE_FW_ERROR_MICRO_FLASH_UNTOU...
(BOOT_BIT_FW_START_FAIL_STRIKE_ONE)
; boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO); recovery_fw_ok = false; } break; } boot_bit_clear(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS); return recovery_fw_ok; }
lags & PROCESS_INFO_VISIBILITY_HIDDEN) { return ProcessVisibilityHidden; } else if (flags & PROCESS_INFO_VISIBILITY_SHOWN_ON_COMMUNICATION) { return ProcessVisibilityShownOnCommunication; } else { return ProcessVisibilityShown; } } ProcessType process_metadata_flags_process_type(PebbleProcessInfoFlag...
if (!md->is_unprivileged) { return ProcessAppSDKType_System; } else { const Version app_sdk_version = process_metadata_get_sdk_version(md); if (version_compare(app_sdk_version, first_3x_version) < 0) { return ProcessAppSDKType_Legacy2x; } else if (version_compare(app_sdk_version, first_4x_versi...
}
////////////////// void test_math_fixed__S16_3_create(void) { Fixed_S16_3 num; int16_t test_num; cl_assert(FIXED_S16_3_PRECISION == 3); int Fixed_S16_3_size = sizeof(Fixed_S16_3); cl_assert(Fixed_S16_3_size == sizeof(int16_t)); test_num = 1 << FIXED_S16_3_PRECISION; num = (Fixed_S16_3){ .integer = 1, ....
(num.integer == 0)
; cl_assert(num.fraction == 3); test_num = (int32_t)((float)0.500 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == 0); cl_assert(num.fraction == 4); test_num = (int32_t)((float)0.625 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value...
set Request" sent by FW: prv_assert_sent_reset_request(s_characteristics[0][PPoGATTCharacteristicData]); } void test_ppogatt__server_reset_request_while_pending_ack(void) { test_ppogatt__open_session_when_found_pebble_app(); // Simulate outbound queue full, so ack will have to wait until there's buffer space: ...
test_ppogatt__open_session_when_found_pebble_app()
; // Receive data: for (uint8_t i = 0; i < PPOGATT_SN_MOD_DIV + 1; ++i) { const uint8_t sn = i % PPOGATT_SN_MOD_DIV; ppogatt_trigger_rx_ack_send_timeout(); prv_receive_short_data_fragment(s_characteristics[0][PPoGATTCharacteristicData], sn); prv_assert_sent_ack(s_characteristics[0][PPoGATTCharacter...
/* * 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...
{ // delete entry if it already exists RamStorageEntry *entry = prv_get_entry(storage->entries, key, key_len); if (entry) { prv_delete(&storage->entries, entry); } // Allocate the entry struct entry = kernel_malloc_check(sizeof(RamStorageEntry)); *entry = (RamStorageEntry){}; // Allocate key & valu...
int ram_storage_get_len(RamStorage *storage, const uint8_t *key, int key_len) { RamStorageEntry *entry = prv_get_entry(storage->entries, key, key_len); if (entry) { return entry->val_len; } return E_DOES_NOT_EXIST; } status_t ram_storage_read(RamStorage *storage, const uint8_t *key, int key_len, uin...
/* * 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...
(line_number)
; if (fmt) { dbgserial_print(" "); dbgserial_print(fmt); } dbgserial_putstr(""); reset_due_to_software_failure(); } static __attribute__((noreturn)) void handle_passert_failed(const char* filename, int line_number, uintptr_t lr, const char *expr, const char* fmt, ...) { va_list fmt_args; va_st...
/* * 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...
toupper_theirs(int c)
{ if (islower(c)) { return toupper(c); } else { return c; } } int tolower_theirs(int c) { if (isupper(c)) { return tolower(c); } else { return c; } } // "Define" libc functions we're testing #include "pblibc_private.h" #include "include/ctype.h" ///////////////////////////////////////////...
/* * 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(isinf(log(INFINITY)))
; }
DRAW_RECT_CLIP_XY, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2), GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax1_aa_clip_xy.${BIT_DEPTH_NAME}.pbi")); // Should draw same as rmax1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_fill_round_rect(&ctx...
MIN(RECT_WIDTH, RECT_HEIGHT)
_info.h" #include "stubs_pebble_tasks.h" #include "stubs_process_manager.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_shell_prefs.h" #include "stubs_sleep.h" #include "stubs_syscalls.h" #include "stubs_task_watchdog.h" #include "stubs_text_layer_flow.h" #include "stubs_vibes.h" #include "stubs...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_kickstart__render_hr_bpm_24h(void) { #if (PLATFORM_SILK || PLATFORM_ROBERT) s_clock_is_24h_style = true; prv_set_data(&s_data, 10323, 7500, 13000, 82); 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...
ead)) != (int)bytes_to_read) { rv = (rv > 0) ? E_INTERNAL : rv; break; } curr_file_len -= bytes_to_read; } pfs_close(*fd); pfs_close(new_fd); *fd = prv_pmap_open_debug_wrapper(s_map_filename, OP_FLAG_READ | OP_FLAG_WRITE, 0, 0); if (*fd < 0) { PBL_LOG(LOG_LEVEL_WARNING, "pmap enlarge...
{ PBL_LOG(LOG_LEVEL_WARNING, "pmap create failed: %d", fd); return (fd); }
PersistMapHeader header = { .version = PERSIST_MAP_VERSION, }; status = pfs_write(fd, (uint8_t *)&header, sizeof(header)); } else { prv_pmap_grab_debug_fd_data(fd); // if the file exists, grab diagnostic data } pfs_close(fd); return (status); }
ut_timer_callback(void *unused) { workout_service_stop_workout(); } // --------------------------------------------------------------------------------------- T_STATIC void prv_abandoned_notification_timer_callback(void *unused) { workout_utils_send_abandoned_workout_notification(); s_workout_data.current_worko...
{ // The workout app can be closed without stopping the workout. In this scenario keep // collecting HR data until so much time has passed that it is assumed the user has forgotten // about the workout hr_time_left = WORKOUT_ACTIVE_HR_SUBSCRIPTION_TS_EXPIRE; }
else if (s_workout_data.frontend_last_opened_ts >= s_workout_data.last_workout_end_ts) { // If the app was opened and closed without starting a workout, turn the HR sensor off hr_time_left = 0; } else { // We have ended a workout while the app was open. Make sure to keep the HR sensor on for at ...
/* * 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...
{ cron_service_deinit(); }
//////////////////////////////////////////////////////////////////////////////////////////////////// //! Smart alarms #define SMART_ALARM_UPDATE_MIN (SMART_ALARM_SNOOZE_DELAY_S / SECONDS_PER_MINUTE) void test_alarm_smart__trigger_30_min_early_awake(void) { AlarmId id; id = alarm_create(&(AlarmInfo) { .hour = 10...
rue); } free(ad_a); free(ad_b); free(ad_c); free(ad_d); } // Tests that the adv data is set when a job goes from a silent term to a non-silent one, and // another job's data was previously advertised. void test_gap_le_advert__data_set_after_silent_term(void) { GAPLEAdvertisingJobTerm advert_terms_a[] = ...
(advert_terms_a[0].min_interval_slots, advert_terms_a[0].max_interval_slots)
; // After A's first term, expect that B's second term will follow. B's first term was silent, so // this "ran" at the same time as A's first term. regular_timer_fire_seconds(1); cl_assert_equal_b(gap_le_is_advertising_enabled(), true); assert_ad_data("B"); gap_le_assert_advertising_interval(advert_terms_...
NS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "spi_definitions.h" #include "drivers/spi.h" #include "drivers/spi_dma.h" #include "drivers/dma.h" #include "drivers/gpio.h" #include "drivers/periph_config....
if (bus->spi == SPI2) { bus->state->spi_clock_periph = RCC_APB1Periph_SPI2; bus->state->spi_clock_periph_speed = clocks.PCLK1_Frequency; bus->state->spi_apb = SpiAPB_1; } else if (bus->spi == SPI3) { bus->state->spi_clock_periph = RCC_APB1Periph_SPI3; bus->state->spi_clock_periph_speed = clocks.PC...
} static uint16_t prv_spi_find_prescaler(const SPIBus *bus) { int lg; if (bus->state->spi_clock_speed_hz > (bus->state->spi_clock_periph_speed / 2)) { lg = 1; // Underclock to the highest possible frequency } else { uint32_t divisor = bus->state->spi_clock_periph_speed / bus->state->spi_clock_speed_hz; ...
_for_tag(AppInboxServiceTagUnitTest)); cl_assert_equal_i(0, app_inbox_service_num_failed_for_tag(AppInboxServiceTagUnitTest)); prv_process_callback_events(); assert_message(0, s_test_data, BUFFER_SIZE); assert_num_message_callbacks(1); assert_num_dropped_callbacks(0); } /////////////////////////////////////...
app_inbox_service_end(AppInboxServiceTagUnitTest)
); // Only one callback event scheduled: assert_num_callback_events(1); s_num_messages_to_consume_from_handler = 1; prv_process_callback_events(); assert_num_callback_events(0); // Expect 2 message callbacks and 1 drop callback: assert_num_message_callbacks(2); assert_message(0, s_test_data, 1); a...
T_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 2); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // AA = true, SW = 3 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 3); ...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 1)
ast_event_put = *event; if (event->type == PEBBLE_BATTERY_STATE_CHANGE_EVENT) { battery_monitor_handle_state_change_event(event->battery_state.new_state); } else if (event->type == PEBBLE_BATTERY_CONNECTION_EVENT) { battery_state_handle_connection_event(event->battery_connection.is_connected); periodic...
cl_assert_equal_i(battery_get_charge_state().charge_percent, percent)
b_set_schedule_enabled(WeekdaySchedule, false); do_not_disturb_set_schedule_enabled(WeekendSchedule, false); if (do_not_disturb_is_smart_dnd_enabled()) { do_not_disturb_toggle_smart_dnd(); } alerts_preferences_check_and_set_first_use_complete(FirstUseSourceSmartDND); s_event_ongoing = false; s_num_dnd...
calendar_init()
GAPLEClientApp); cl_assert_equal_b(registered, true); } } } void test_gap_le_connect__register_null_device(void) { BTErrno e = gap_le_connect_connect(NULL, true /* auto_reconnect */, false /* is_pairing_required */, ...
(e, BTErrnoOK)
; registered = gap_le_connect_has_connection_intent_for_bonding(bonding_id, GAPLEClientApp); cl_assert_equal_b(registered, true); } void test_gap_le_connect__register_two_clients_same_device(void) { BTErrno e; bool registered; BTDeviceInternal device = prv_dummy_device(1); // Register connection intent: ...
(timeline_iter_remove_node_with_id(&head, &all_day_item.header.id))
; cl_assert(!timeline_iter_remove_node_with_id(&head, &all_day_item.header.id)); } void test_timeline__24h_non_all_day_starting_mid_day(void) { const time_t midnight_march_3_utc = 1425340800; TimelineItem all_day_item = { .header = { .id = { 0x29, 0xac, 0xd8, 0xb5, 0x09, 0xc7, 0x4c, 0x31, ...
rratum in the STM32F7xx MCUs in which causes DMA transfers // that read from the DTCM to read corrupted data if the MCU enters sleep mode // during the transfer. Note that writes to DTCM will not be corrupted. extern const char __DTCM_RAM_size__[]; PBL_ASSERT((uintptr_t)src >= (RAMDTCM_BASE + (uintptr_t)__DTCM_...
{ return; }
this->stream->periph->CR &= ~(DMA_SxCR_HTIE | DMA_SxCR_TCIE); // disable the stream this->stream->periph->CR &= ~DMA_SxCR_EN; while ((this->stream->periph->CR & DMA_SxCR_EN) != 0) {} prv_release_controller(this->stream->controller); // clean up our state this->state->transfer_dst = NULL; this->state...
left >>= 4 * MIN(top_cropped_rows_count, 8); corner_insets_right >>= 4 * MIN(top_cropped_rows_count, 8); } // Mark the destination dirty before clipped_rect is modified. graphics_context_mark_dirty_rect(ctx, clipped_rect); // bit-block fiddling: const int16_t max_y = clipped_rect.origin.y + clipped_rect...
(ctx, GRect(top_rect_origin_x, rect->origin.y, top_rect_size_w, radius), 0, GCornerNone, fill_color)
; // Middle Rect prv_fill_rect_legacy2(ctx, GRect(rect->origin.x, rect->origin.y + radius, rect->size.w, rect->size.h - 2 * radius), 0, GCornerNone, fill_color); // Bottom Rect prv_fill_rect_legacy2(ctx, GRect(bottom_rect_origin_x, rect->o...
curr_page = next_page; virtual_pg++; } // see if the last set should be added to the cache update_page_cache(&fpc[0], &cur_idx, &curr); // The cache is likely to be around for a while and there is no reason to // burn up more memory than necessary for a long duration f->pg_cache = kernel_malloc(siz...
if ((is_read_only || is_tmp) && (res == E_DOES_NOT_EXIST)) { goto cleanup; }
// Prepare the new FD FileDesc *file_desc = &PFS_FD(fd); File *file = &PFS_FD(fd).file; file_desc->fd_status = FD_STATUS_UNREFERENCED; // set to IN_USE on success if ((file->name = kernel_strdup(name)) == NULL) { res = E_OUT_OF_MEMORY; goto cleanup; } file->namelen = strlen(name); file->start...
eally // know if the notification is still in the notification center or not, so we play it safe // and only show non ACNS actions. Once iOS9 is more widespread we can look at updating this return !timeline_item_action_is_ancs(action); } } else { // Android // Show all actions unless the ite...
{ timeline_invoke_action(item, dismiss, NULL); }
prv_push_muted_dialog(); analytics_inc(ANALYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_MUTED_COUNT, AnalyticsClient_System); } else { // This is a very unlikely case. We store some default prefs which includes the mute // attribute when we receive the notification so either someone deleted the entry //...
minute_of_day, s_activity_summary_settings.summary.activity.trigger_minute, s_activity_pin_state.removed); return; } // Make sure we actually have a step count const int32_t steps = prv_get_step_count(); if (steps <= 0) { INSIGHTS_LOG_DEBUG("Not adding activity pin -...
("KM", i18n_owner)
); } static void prv_add_metric_duration_info(StringList *headings, int headings_buf_size, StringList *values, int values_buf_size, ActivitySession *session) { const size_t duration_buffer_size = sizeof("00:00:00"); char duration_str...
/* * 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...
(settings_glance, icon, NULL)
; } static const char *prv_get_title(LauncherAppGlanceStructured *structured_glance) { LauncherAppGlanceSettings *settings_glance = launcher_app_glance_structured_get_data(structured_glance); return NULL_SAFE_FIELD_ACCESS(settings_glance, title, NULL); } static void prv_charging_icon_node_draw_cb(GContext *...
all(); cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), false); shared_prf_storage_set_getting_started_complete(true); cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), true); shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_get_getting_started_complet...
memcmp(&out_addr, &addr, sizeof(addr))
_out, value_length_in_out, GAPLEClientApp, has_more_out); } DEFINE_SYSCALL(BTErrno, sys_ble_client_write, BLECharacteristic characteristic, const uint8_t *value, size_t va...
(characteristic)
; } DEFINE_SYSCALL(BLEService, sys_ble_characteristic_get_service, BLECharacteristic characteristic) { return gatt_client_characteristic_get_service(characteristic); } DEFINE_SYSCALL(void, sys_ble_characteristic_get_device, BTDevice *device, BLECharacteristic characteristic) { if (PRIVILEGE_WAS_ELE...
+ 1); } prv_fill_horizontal_line(ctx, GPoint(x0 - x, y0 + y), x + 1); prv_fill_horizontal_line(ctx, GPoint(x0 - y, y0 + x), y + 1); } if (quadrant & GCornerBottomRight) { if (x == 1) { prv_fill_horizontal_line(ctx, GPoint(x0, y0), radius + 1); } prv_fill_horizontal_l...
(ctx, y, (Fixed_S16_3){.raw_value = starting_edge}, (Fixed_S16_3){.raw_value = right - FIXED_S16_3_ONE.raw_value})
; } } else { starting_edge = (MAX(left, starting_edge)); ending_edge = (MIN(right, ending_edge)); if (starting_edge <= ending_edge) { graphics_private_draw_horizontal_line(ctx, y, (Fixed_S16_3){.raw_value = starting_edge}, ...
sizeof(fcs)); uint32_t crc = legacy_defective_checksum_memory( &frame->data, frame->length - sizeof(fcs)); if (fcs == crc) { prv_reset_keepalive_timer(); uint8_t protocol = (uint8_t)frame->data[0]; bool protocol_found = false; for (unsigned int i = 0; i < ARRAY_LENGTH(s_supported_protocols); ...
prv_assert_tx_buffer(buf)
; mutex_unlock(s_tx_buffer_mutex); } void pulse_change_baud_rate(uint32_t new_baud) { dbgserial_change_baud_rate(new_baud); } #endif
ense at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific lang...
gpoint_from_polar(GRect(0, 0, 10, 10), GOvalScaleModeFillCircle, 0)
; cl_assert_equal_gpoint(result, GPoint(4, 0)); } void test_graphics_circle__grect_centered_from_polar(void) { GOvalScaleMode mode = GOvalScaleModeFillCircle; // Basic container rect with GPointZero origin const GRect container_rect1 = GRect(0, 0, 10, 10); const GRect resulting_rect1 = grect_centered_from_p...
clude "drivers/stm32f2/dma_definitions.h" #include "drivers/stm32f2/i2c_hal_definitions.h" #include "drivers/stm32f2/spi_definitions.h" #include "drivers/stm32f2/uart_definitions.h" #include "drivers/temperature.h" #include "drivers/voltage_monitor.h" #include "util/units.h" // DMA Controllers static DMAControllerSta...
IRQ_MAP(USART3, uart_irq_handler, DBG_UART)
et_complete(client, true /* self_initiated */); } // ------------------------------------------------------------------------------------------------- static void prv_handle_reset_request(PPoGATTClient *client) { if (client->state == StateConnectedClosedAwaitingResetCompleteSelfInitiatedReset) { // Already in s...
if (prv_is_packet_with_sn_awaiting_ack(client, sn)) { client->out.timeouts_counter = 0; client->out.ack_timeout_state = AckTimeoutState_Inactive; // Ack'd one of the packets in flight const uint32_t next_sn = prv_next_sn(sn); const uint16_t num_bytes_acked = prv_total_num_bytes_awaiting_ack_up_to(c...
// We'll rely on the ACK timeout for the next data packet to fire and roll back. PBL_LOG(LOG_LEVEL_WARNING, "Received retransmitted Ack for sn:%"PRIu32". Ignoring it.", sn); } else { PBL_LOG(LOG_LEVEL_ERROR, "Ack'd packet out of range %"PRIu32", [%u-%u].", sn, client->out.next_expected_ack_sn...
n *property_animation_h, const uint32_t distance_normalized) { if (animation_private_using_legacy_2(NULL)) { // We need to enable other applib modules like sroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. property_...
( distance_normalized, property_animation->values.from.gcolor8.r, property_animation->values.to.gcolor8.r)
; result.g = interpolate_int16( distance_normalized, property_animation->values.from.gcolor8.g, property_animation->values.to.gcolor8.g); result.b = interpolate_int16( distance_normalized, property_animation->values.from.gcolor8.b, property_animation->values.to.gcolor8.b); ((P...
ng - save for the first line - will be rendered below the box graphics_text_layout_get_max_used_size(&gcontext, "JR\n\nWhop", font, box, GTextOverflowModeWordWrap, GTextAlignmentLeft, (void*)&layout); cl_assert_equal_i(layout.box.size.w, box.size.w); cl_assert_equal_i(layout.max_used_size.w, 4 * HORIZ_ADVANCE_P...
cl_assert_equal_i(layout.max_used_size.h, 0)
; cl_assert_equal_i(layout.max_used_size.w, 0); graphics_text_layout_get_max_used_size(&gcontext, doubleton, font, box, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, (void*)&layout); cl_assert_equal_i(layout.box.size.w, box.size.w); cl_assert_equal_i(layout.max_used_size.w, 2 * HORIZ_ADVANCE_PX...
/* * 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 s_is_current_task_send_next_task; }
// Tests /////////////////////////////////////////////////////////// static const uint16_t ENDPOINT_ID = 1234; static const uint32_t TIMEOUT_MS = 500; void test_session_send_buffer__initialize(void) { s_is_current_task_send_next_task = false; s_session = (const CommSession) {}; fake_kernel_malloc_init(); fa...
o res_info; timeline_resources_get_id(timeline_res, res_size, &res_info); to_reel = kino_reel_create_with_resource_system(res_info.res_app_num, res_info.res_id); } GSize size; if (peek_layer->show_dot) { size = UNFOLD_DOT_SIZE; } else { size =...
strncpy(peek_text_layer->text_buffer, text, MAX_PEEK_LAYER_TEXT_LEN - 1)
; text_layer_set_text(&peek_text_layer->text_layer, peek_text_layer->text_buffer); } void peek_layer_set_fields(PeekLayer *peek_layer, const char *number, const char *title, const char *subtitle) { if (number) { prv_set_text(&peek_layer->number, number); } if (title) { prv_se...
{ return prv_get_length((AppMessageSendJob *)send_job); } static size_t prv_send_job_impl_copy(const SessionSendQueueJob *send_job, int start_offset, size_t length, uint8_t *data_out) { AppMessageSendJob *app_message_send_job = (AppMessageSendJob *)send_job; prv_request_fast_connect...
(endpoint_id)
, .length = htons(pp_payload_length), }; return AppMessageSenderErrorSuccess; } static void prv_handle_outbox_message(AppOutboxMessage *message) { AppMessageSendJob *app_message_send_job = (AppMessageSendJob *)message->consumer_data; *app_message_send_job = (const AppMessageSendJob) { .send_queue_job ...
window.layer, &(GRect) { gpoint_neg(layer->frame.origin), layer->frame.size }, use_screen); timeline_item_destroy(item); } // Visual Layout Tests ////////////////////// void test_timeline_peek__peek(void) { prv_render_timeline_peek(&(TimelinePeekItemConfig) { .title = "C...
(layer->frame.origin.y < DISP_ROWS)
; // Peek service hides the peek UI. Not animated for this unit test. prv_set_timeline_item(NULL, false /* animated */); // Peek should now be off-screen. cl_assert(layer->frame.origin.y >= DISP_ROWS); } void test_timeline_peek__peek_visible_to_hidden_outside_of_watchface(void) { TimelineItem *item = prv_se...
greed 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. */ #include "services/common/analytics...
for (AnalyticsMetric metric = ANALYTICS_METRIC_START; metric < ANALYTICS_METRIC_END; metric++) { switch (analytics_metric_kind(metric)) { case ANALYTICS_METRIC_KIND_DEVICE: s_metric_heartbeat_offset[metric] = device_offset; device_offset += analytics_metric_size(metric); PBL_ASSERTN(dev...
} uint32_t analytics_metric_offset(AnalyticsMetric metric) { AnalyticsMetricKind kind = analytics_metric_kind(metric); PBL_ASSERTN((kind == ANALYTICS_METRIC_KIND_DEVICE) || (kind == ANALYTICS_METRIC_KIND_APP)); return s_metric_heartbeat_offset[metric]; } AnalyticsMetricKind analytics_metric_kind(AnalyticsMetri...
, 272, -288}, { 1224, 504, -456}, { 1208, 576, -456}, { 1256, 520, -256}, { 1224, 320, -48}, { 968, 248, -48}, { 784, 184, 24}, { 720, 248, 8}, { 760, 304, 8}, { 872, 376, 0}, { 904, 368, -8}, { 992, 336, -8}, { 1216, 336, -40}, { 1240, 352, -24}, { 1456, 288, 64}...
// 77 seconds { 792, 176, 104}, { 720, 144, 88}, { 736, 120, 72}, { 800, 104, 40}, { 896, 120, -24}, { 1072, 16, -40}, { 1872, 128, 0}, { 1832, 416, -328}, { 1136, 416, -272}, { 1280, 528, -344}, { 1224, 448, -56}, { 1136, 304, 48}, { 880, 256, 40}, { 696, 304...
{ 1200, 408, -224}, { 1128, 272, -120}, { 928, 192, -32}, { 744, 248, -48}, { 648, 240, -48}, { 696, 248, -80}, // 80 seconds { 792, 232, -112}, { 856, 216, -112}, { 1064, 256, -176}, { 1336, 320, -224}, { 1648, 240, -104}, { 1680, 352, -168}, { 1360, 472, -240},...
_t prv_get_sample_time_us(uint8_t sensor_time[3]) { uint64_t curr_time_us = prv_get_curr_system_time_ms() * 1000; uint32_t time_since_data_collection_us = prv_get_time_since_sample(sensor_time); BMI160_DBG("%"PRIu32" us delay since sample was collected", time_since_data_collection_us); return (curr_time...
(BMI160_REG_ERR)
); BMI160_DBG("INT_MAP[0] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_MAP_0)); BMI160_DBG("INT_MAP[1] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_MAP_1)); BMI160_DBG("INT_EN[0] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_EN_0)); BMI160_DBG("INT_EN[1] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_EN_1)); } // sho...
{ sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.min); }
else if (strcmp(token, "TEST_START_AT_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.max); } else if (strcmp(token, "TEST_FORCE_SHUT_DOWN_AT") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.force_shut_down_at); } else if (strcmp(token,...
reset.h" #include "stubs_task_watchdog.h" #include "stubs_memory_layout.h" // Fakes ///////////////////////// static bool s_is_english = false; bool shell_prefs_get_language_english(void) { return s_is_english; } void shell_prefs_set_language_english(bool english) { s_is_english = english; } void launcher_task_ad...
("Quiet Time", "Disabled", __FILE__)
; cl_assert(strcmp(second, "Désactivé") == 0); i18n_ctx_free("badctxt", "Disabled", __FILE__); i18n_ctx_free("Quiet Time", "Disabled", __FILE__); } void test_i18n__ctxt_get_with_buffer(void) { const uint32_t LEN = 20; char buffer[LEN]; i18n_ctx_get_with_buffer("Notifications", "Enabled", buffer, sizeof(bu...
/* * 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...
strlen(data)
); prv_assert_no_handler_calls(); g_default_kernel_receiver_implementation.finish(receiver); // CBs shouldn't immediately execute since they are pended on KernelBG prv_assert_no_handler_calls(); prv_set_expected_data(data, strlen(data)); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_i(s_...
; cl_assert(!s_manager_state_change); r->state = RecognizerState_Possible; recognizer_transition_state(r, RecognizerState_Completed); cl_assert_equal_i(r->state, RecognizerState_Completed); cl_assert(!s_manager_state_change); } void test_recognizer__set_failed(void) { bool failed = false; s_test_impl_da...
cl_assert_equal_i(r->state, RecognizerState_Cancelled)
; cl_assert_equal_b(cancelled, true); cl_assert_equal_i(rec_event, RecognizerEvent_Cancelled); cancelled = false; r->state = RecognizerState_Updated; rec_event = -1; recognizer_cancel(r); cl_assert_equal_i(r->state, RecognizerState_Cancelled); cl_assert_equal_b(cancelled, true); cl_assert_equal_i(rec...
nction(jerry_create_undefined(), name, handler); } jerry_value_t rocky_add_constructor(char *name, jerry_external_handler_t handler) { JS_VAR prototype = jerry_create_object(); JS_VAR rocky_object = rocky_get_rocky_singleton(); JS_VAR constructor = rocky_get_or_create_object(rocky_object, name, ...
(date_constructor, args, ARRAY_LENGTH(args))
; for (unsigned i = 0; i < ARRAY_LENGTH(args); ++i) { jerry_release_value(args[i]); } } else { date_obj = jerry_construct_object(date_constructor, NULL, 0); } return date_obj; } void rocky_cleanup_js_var(const jerry_value_t *var) { jerry_release_value(*var); }
eps = -1, .exp_steps_min = -1, .exp_steps_max = -1, .weight = 1.0, }; char line_buf[256]; while (true) { char *line = fgets(line_buf, sizeof(line_buf), state->common.file); if (!line) { // EOF break; } //printf("\nGot line: %s", line); // Find first token char *to...
{ char *line = fgets(line_buf, sizeof(line_buf), state->common.file); if (!line) { // EOF break; } //printf("\nGot line: %s", line); // Find first token char *token = strtok(line, " \t\n"); if (!token) { continue; } // If this is a pre-processor directive, skip it...
} else if (strcmp(token, "TEST_DEEP") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.deep.value); } else if (strcmp(token, "TEST_DEEP_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.deep.min); } else if (strcmp(token, "TEST_DEEP_MAX") =...
ctx->draw_state.stroke_color; if (!gcolor_is_transparent(color)) { // Force alpha to be opaque since that represents how framebuffer discards it in display. // Also needed for unit tests since PNG tests interpret alpha color.a = 3; line[point.x] = color.argb; } } #endif #if PBL_BW static inline vo...
gcolor_is_invisible(color)
) { return; } // look for clipbox if (!WITHIN(y, clip_box->origin.y, grect_get_max_y(clip_box) - 1)) { return; } const int16_t min_valid_x = clip_box->origin.x; if (x1.integer < min_valid_x) { x1 = (Fixed_S16_3){.integer = min_valid_x, .fraction = 0}; } const int16_t max_valid_x = grect_g...
not overlap at any time. This is checked by fontgen.py and confirmed // by the code below. // // RLE4 data is encoded as a stream of RLE Units. // 0 1 2 3 // +-+-+-+-+ // |*| Len | Where * is the encoded symbol [0,1] and 'Len + 1' is the number of symbols // +-+-+-+-+ in the run [1,8]. For ex...
{ // Load the glyph data at the end of the buffer target = &((uint8_t *)g->data)[CACHE_GLYPH_SIZE - glyph_size_bytes]; }
else { target = (uint8_t *)g->data; } SYS_PROFILER_NODE_START(text_render_flash); size_t num_bytes_loaded = sys_resource_load_range(font_res->app_num, font_res->resource_id, bitmap_addr, target, glyph_size_bytes); SYS_PROFILER_NODE_STOP(text_r...
592, -808}, { 16, 584, -808}, { 16, 592, -808}, { 16, 592, -808}, { 24, 592, -808}, { 8, 600, -808}, { 16, 600, -800}, { 16, 592, -800}, { 8, 584, -800}, { 24, 552, -824}, { 24, 544, -840}, // 100 seconds { 16, 600, -808}, { 16, 600, -800}, { 24, 584, -816}, {...
{ 24, 600, -800}, { 16, 608, -800}, { 24, 600, -792}, { 32, 592, -800}, { 40, 568, -808}, { 24, 592, -808}, { 24, 584, -800}, { 24, 568, -824}, { 24, 584, -816}, { 24, 584, -800}, { 24, 584, -808}, { 32, 576, -808}, { 24, 576, -816}, { 24, 584, -824}, { 32, 57...
heart_rate_is_enabled = true; s_bt_driver_hrm_service_is_enabled = true; s_last_num_permitted_devices = 0; memset(s_last_permitted_devices, 0, sizeof(s_last_permitted_devices)); s_bt_driver_hrm_service_enable_call_count = 0; s_hrm_manager_subscribe_with_callback_call_count = 0; s_sys_hrm_manager_unsubscribe...
cl_assert_equal_b(false, ble_hrm_is_sharing_to_connection(&s_conn_a))
timer_trigger(1); cl_assert(s_entered_standby); } void test_battery_monitor__critical(void) { int good_mv = battery_curve_lookup_voltage_by_percent(10, false); int critical_mv = battery_curve_lookup_voltage_by_percent(0, false); fake_battery_init(good_mv, false, false); battery_monitor_init(); periodic_t...
(charge_mv)
; fake_battery_set_connected(true); periodic_timer_trigger(1); cl_assert(!s_in_low_power && battery_get_charge_state().charge_percent == 60); // Discharging but connected - The charge should update so 60% is 100% fake_battery_set_charging(false); periodic_timer_trigger(1); cl_assert_equal_i(battery_get_c...
DataLoggingReopenEntry *entry = kernel_malloc_check(sizeof(DataLoggingReopenEntry)); *entry = (DataLoggingReopenEntry) { .session = session, .app_uuid = session->app_uuid, .timestamp = session->session_created_timestamp, .tag = session->tag, }; PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG,...
(s_endpoint_data.mutex)
; }
cb(HealthActivity activity, time_t time_start, time_t time_end, void *context) { uint32_t *num_activities_found = (uint32_t *)context; *num_activities_found += 1; char *activity_name = "unknown"; switch (activity) { case HealthActivityNone: activity_name = "none"; ...
(APP_LOG_LEVEL_DEBUG, "No more data")
; } num_records += num_minutes; utc_start = utc_end; if (num_minutes == 0) { break; } } // Print summary APP_LOG(APP_LOG_LEVEL_DEBUG, "Retrieved %d minute data records", (int)num_records); // Print detail on the last few minutes const int k_print_batch_size = 30; APP_LOG(APP_LO...
cture); I2C_DeInit(i2c_buses[i].i2c); } s_initialized = true; for (uint32_t i = 0; i < ARRAY_LENGTH(i2c_buses); i++) { if (BOARD_CONFIG.i2c_bus_configs[i].rail_cfg_fn) { BOARD_CONFIG.i2c_bus_configs[i].rail_cfg_fn(); } if (BOARD_CONFIG.i2c_bus_configs[i].rail_ctl_fn) { bus_rail_powe...
PBL_ASSERT(semaphore_take(bus), "Could not acquire semaphore token")
; // Set up transfer bus->transfer.device_address = device_address; bus->transfer.register_address = register_address; bus->transfer.read_not_write = read_not_write; bus->transfer.size = size; bus->transfer.idx = 0; bus->transfer.state = TRANSFER_STATE_WRITE_ADDRESS_TX; bus->transfer.data = data; bus...
---- // Handle incoming time format data (QemuProtocol_TimeFormat) static void prv_time_format_msg_callback(const uint8_t *data, uint32_t len) { QemuProtocolTimeFormatHeader *hdr = (QemuProtocolTimeFormatHeader *)data; if (len != sizeof(*hdr)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid packet length"); return; }...
uart_set_rx_interrupt_enabled(QEMU_UART, false)
; uint8_t *msg_ptr = qemu_serial_private_assemble_message(&s_qemu_state, &msg_bytes, &protocol); uart_set_rx_interrupt_enabled(QEMU_UART, true); if (!msg_ptr) { break; } // Dispatch the received message PBL_LOG(LOG_LEVEL_DEBUG, "Dispatching msg of len %"PRIu32" for protocol %d", msg_bytes...
uint8_t AXIS_REGISTERS[] = { [BMA255Axis_X] = BMA255Register_ACCD_X_LSB, [BMA255Axis_Y] = BMA255Register_ACCD_Y_LSB, [BMA255Axis_Z] = BMA255Register_ACCD_Z_LSB, }; static int16_t prv_read_axis(BMA255Axis axis, uint8_t *new_data) { uint8_t raw_buf[2]; bma255_burst_read(AXIS_REGISTERS[axis], raw_buf, sizeof(ra...
prompt_send_response_fmt(buf, 64, "(0x10) Bandwidth: 0x%"PRIx8, bw)
LK_SMALL; case WorkoutType_OpenWorkout: return RESOURCE_ID_WORKOUT_APP_WORKOUT_SMALL; default: return 0; } } static ActivitySessionType prv_get_activity_type(WorkoutType workout_type) { switch (workout_type) { case WorkoutType_Run: return ActivitySessionType_Run; case WorkoutType_...
(&selection_window->window)
{ 1424, 584, 96}, { 1720, 424, 344}, { 1696, 576, 328}, { 1176, 472, 256}, // 19 seconds { 1264, 352, 104}, { 1344, 304, 248}, { 1152, 320, 240}, { 856, 240, 264}, { 768, 224, 216}, { 720, 184, 232}, { 744, 144, 240}, { 728, 128, 248}, { 760, 112, 256}, { 856,...
{ 840, 96, 224}, { 1096, 128, 312}, { 1960, 368, 400}, { 1808, 1104, 32}, { 1400, 1288, -144}, { 1320, 424, 312}, { 1264, -120, 200}, { 1040, 192, 152}, { 800, 368, 104}, { 664, 504, 16}, // 22 seconds { 648, 544, -24}, { 752, 560, -40}, { 824, 392, 80}, { 10...
{ ActionToggleDialogConfig config = { .message = ctx->config.impl->prompt_messages[prv_get_toggled_state_index(ctx)], }; prv_setup_state_config(ctx, &config, ActionToggleDialogType_Prompt); ActionableDialog *actionable_dialog = actionable_dialog_create(config.window_name); actionable_dialog_set_action_bar...
static bool prv_should_prompt(const ActionToggleConfig *config) { switch (config->prompt) { case ActionTogglePrompt_Auto: #if PLATFORM_SPALDING return ((pebble_task_get_current() == PebbleTask_App) && (app_launch_reason() == APP_LAUNCH_QUICK_LAUNCH) && (app_launch_button() == B...
ributed 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 "layout_node.h" #include "timeline_layout.h" #include "kernel/pbl_malloc.h" #include "services/...
{ GTextNodeText *text_node = NULL; const char *str = config->use_i18n ? i18n_get(config->str, layout) : config->str; if (!IS_EMPTY_STRING(str)) { text_node = prv_create_text_node_buffer(str); prv_set_text_node_text_parameters_from_config(text_node, layout, &config->text); } if (config->use_i18n) { ...
typedef struct { const LayoutLayer *layout; LayoutNodeTextDynamicConfig config; char buffer[]; } TextDynamicContext; static void prv_text_dynamic_node_callback(GContext *ctx, GTextNode *node, const GRect *box, const GTextNodeDrawConfig *config, bool render, ...
("This feature requires Pebble Health to work. Enable Health in the Pebble" " mobile app to continue.")
; health_tracking_ui_show_message(RESOURCE_ID_GENERIC_WARNING_TINY, msg, false); } // --------------------------------------------------------------------------- void health_tracking_ui_register_app_launch(AppInstallId app_id) { s_last_app_id = 0; } #endif // CAPABILITY_HAS_HEALTH_TRACKING
top_metric_bounds; scrollable_metric_bounds.origin.y = scrollable_metric_bounds.size.h; scrollable_metric_bounds.size.h = window->layer.bounds.size.h - scrollable_metric_bounds.origin.y; layer_init(&active_window->scrollable_metric_layer, &scrollable_metric_bounds); ...
(LOG_LEVEL_ERROR, "Invalid argument")
; return NULL; } WorkoutActiveWindow *active_window = app_zalloc_check(sizeof(WorkoutActiveWindow)); active_window->layout = WorkoutLayout_SingleMetric; active_window->top_metric = metric; prv_create_window_common(active_window, workout_data, workout_controller); return active_window; } WorkoutActi...
nce; // Create animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); Animation *b = animation_clone(a); animation_set_reverse(b, true); // Create a sequence Animation *seq = animation_sequence_create(a, b, NULL); animation_set_play_count(seq, repeat_count); ...
animation_spawn_create(b, c, NULL)
; cl_assert(spawn != NULL); // Create a sequence by putting a in front and repeat it 5 times // We now have a -> (b | c) Animation *seq = animation_sequence_create(a, spawn, NULL); animation_set_play_count(seq, repeat_count); // Now, clone it Animation *clone = animation_clone(seq); // Destroy the o...
d prv_auto_repeat_single_click(ClickRecognizer *recognizer) { if (!recognizer->is_button_down) { // If this button isn't being held down anymore, don't re-register the timer. return; } ++(recognizer->number_of_clicks_counted); // Start the repetition timer: // Note: We're not using the timer_register_...
prv_click_reset(recognizer)
; } static void prv_multi_click_timeout_callback(void *data) { ClickRecognizer *recognizer = (ClickRecognizer *) data; recognizer->multi_click_timer = NULL; if (recognizer->config.multi_click.last_click_only && (recognizer->number_of_clicks_counted >= prv_multi_click_get_min(recognizer)) && (recogni...
/* * 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...
(GColorWhiteARGB8, fun(GColorFromHEX(0xff0000)).argb)
; cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0x00aaff)).argb); cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0xaa0055)).argb); cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0x55aa55)).argb); cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0xff5555)).argb); cl_assert_equal_i(GC...
/* * 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_size_4_called == 2)
; }
layer); // update rect y for the label height if (active_window->layout == WorkoutLayout_TwoStaticAndScrollable) { rect.origin.y += prefer_larger_font ? 11 : 15; } else { rect.origin.y += prefer_larger_font ? 12 : 15; } if (draw_hr_zones) { prv_render_hr_zones(ctx, &rect, active_window); // ...
dialog_set_fullscreen(dialog, true)
; dialog_set_text(dialog, i18n_get("End Workout?", workout_dialog)); dialog_set_background_color(dialog, BACKGROUND_COLOR); dialog_set_text_color(dialog, TEXT_COLOR); dialog_set_icon(dialog, RESOURCE_ID_WORKOUT_APP_END); dialog_set_icon_animate_direction(dialog, DialogIconAnimateNone); dialog_set_destroy_on...
0x3110, 0x32100, 0x432100, 0x5321100, 0x64321100, }; // Set up the insets for doing the top corners. uint32_t corner_insets_left = (corner_mask & GCornerTopLeft) ? round_top_corner_lookup[radius] : 0; uint32_t corner_insets_right = (corner_mask & GCornerTopRight) ? round_top_corner_lookup[radius] : 0; cons...
(rect->origin.x + radius, rect->origin.y + rect->size.h - radius - 1)
, radius, GCornerBottomLeft); bottom_rect_origin_x += radius; bottom_rect_size_w -= radius; } if (corner_mask & GCornerTopRight) { circle_func(ctx, GPoint(rect->origin.x + rect->size.w - radius - 1, rect->origin.y + radius), radius, GCornerTopRight); t...
radius_inner.raw_value) { // Nothing will be drawn... return; } // TODO: Adapt this to support new precision, for now this is faked by regular fill // This will be done with PBL-24777 /* if (radius_outer.raw_value - radius_inner.raw_value == FIXED_S16_3_ONE.raw_value) { // Color hack GColor tmp...
((*center))
/common/bluetooth/local_addr.h" #include "services/common/bluetooth/local_id.h" #include "services/common/bluetooth/pairability.h" #include "services/common/regular_timer.h" #include "services/common/system_task.h" #include "services/normal/bluetooth/ble_hrm.h" #include "os/mutex.h" #include <bluetooth/init.h> #inclu...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Shutting down the BT stack on boot"); bt_driver_power_down_controller_on_boot(); }
- 1, .newest_key = prv_minute_file_get_settings_key(utc_now) + 1, .utc_start = 0, .oldest_requested_utc = oldest_requested_utc, .last_record_idx_written = -1, }; // Read the minute data from flash status_t status = settings_file_each(file, prv_read_minute_history_file_cb, &context); if (status...
(LOG_LEVEL_DEBUG, "Done. End # of records: %"PRIu16, s_alg_state->num_minute_records)
; return success; } // ------------------------------------------------------------------------------- // Immediately send a fake logging record to data logging. This aids in testing the mobile // app bool activity_algorithm_test_send_fake_minute_data_dls_record(void) { AlgMinuteDLSRecord record = { }; prv_init...
/* * 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...
{ analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_WATCH_ONLY_TIME); worker_manager_enable(); services_set_runlevel(RunLevel_Normal); }
s_prev_low_power_active = s_low_power_active; } static void prv_low_power_toggle_timer_callback(void* data) { launcher_task_add_callback(prv_low_power_launcher_task_callback, data); } static void prv_low_power_transition(bool active) { s_low_power_active = active; if (s_toggle_timer == TIMER_INVALID_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...
(alloc_size)
; snprintf(buf, 80, "%luB/%luB\n\nJust allocated %lu%% of the app heap.", alloc_size, heap_size, 100*alloc_size/heap_size); text_layer_set_text(text_heap_info, buf); layer_add_child(window_layer, text_layer_get_layer(text_heap_info)); } static void deinit(void) { // Don't free anything } static void s_main(vo...
rameter; } if (s_gatt_client_op_write_should_fail_unlimited) { return BTErrnoInvalidParameter; } const uint32_t comple_dict_uid = ((GetNotificationAttributesMsg*)s_complete_dict)->notification_uid; const uint32_t chunked_dict_uid = ((GetNotificationAttributesMsg*)s_chunked_dict_part_one)->notification_u...
if (uid == attribute_at_end_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(memory_with_attribute_id_at_end.attribute_data), (uint8_t*) memory_with_attribute_id_at_end.attribute_data); prv_fake_receiving_ds_notification(ARRAY_LENGTH(memory_with_attribute_id_at_end_p2), (uint8_t*) memory_with_attribute_id...
prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_split_timestamp_dict_part_two), (uint8_t*) s_split_timestamp_dict_part_two); s_num_ds_notifications_received += 2; } else if (uid == message_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_message_dict), (uint8_t*) s_message_dict); s_num...
t(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); } void test_timeline__none_backwards(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIte...
iter_prev(&iterator)
); } static int prv_num_items(Iterator iterator) { int n = 1; while (iter_next(&iterator)) { n++; } return n; } void test_timeline__gc_past(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // Tue Jan 13 11:40:00 PST 2015 rtc_set_time(1421178000); fake...
x.dest_bitmap, "draw_round_rect_offset_r4_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 1); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw1_...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 5)
; graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // AA = true, SW = 11 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 11); graphics_draw_ro...
, 208, -128}, { 928, 288, -168}, { 1024, 360, -96}, { 1104, 400, -48}, { 1048, 408, -32}, { 1200, 392, 16}, { 1616, 472, -80}, { 1168, 512, -64}, { 1392, 600, -112}, { 1120, 832, -352}, { 952, 480, -256}, { 968, 424, -88}, { 1224, 520, -88}, { 1440, 408, -16}, // ...
{ 1136, 232, -280}, { 1072, 224, -160}, { 896, 160, -136}, { 776, 200, -160}, { 824, 256, -112}, { 928, 296, -96}, { 1016, 312, -80}, { 1040, 328, -96}, { 1168, 336, -144}, { 1568, 400, -160}, { 1280, 376, -48}, { 1528, 416, -24}, { 1056, 600, -248}, { 824, 680, -...
void prv_event_cb(void *data) { while (true) { // No need to worry about reading a partial message here, we write messages to the circular // buffer while disabling interrupts the whole time. uint32_t log_length; if (!prv_isr_buffer_read_and_consume(&log_length, sizeof(log_length))) { // No mo...
prv_send_pulse_packet(log_level, src_filename, src_line_number, message)
; } void *pulse_logging_log_sync_begin( uint8_t log_level, const char *src_filename, uint16_t src_line_number) { MessageContents *contents = pulse_push_send_begin(PULSE_PROTOCOL_LOGGING); prv_serialize_log_header(contents, log_level, prv_get_timestamp_ms(), pebble_task_get_current(),...
/* * 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...
interpolate_int16(animation_timing_scaled(normalized_progress, discontinuity_progress, ANIMATION_NORMALIZED_MAX), -to, 0)
; } } static void prv_port_hole_transition_animation_init(Animation *animation) { animation_set_duration(animation, PORT_HOLE_TRANSITION_DURATION_MS); s_data.animation_offset_px = 0; } static void prv_port_hole_transition_animation_update(GContext *ctx, Anim...
GPoint src_origin_offset, GCompOp compositing_mode, GColor tint_color) { if (!src_bitmap->palette) { return; } const int8_t dest_begin_x = (dest_rect.o...
if (dest_fmt != GBitmapFormat1Bit) { return; }
switch (src_fmt) { case GBitmapFormat1Bit: bitblt_bitmap_into_bitmap_tiled_1bit_to_1bit(dest_bitmap, src_bitmap, dest_rect, src_origin_offset, compositing_mode, tint_color); break; case GBitmapFormat1BitPalette: case GBitmapFormat2BitPalette...
harge_state().charge_percent, 50); // Should be stable by now // Shouldn't update percent (actually, shouldn't even send events.) PBL_LOG(LOG_LEVEL_DEBUG, "Shouldn't be any updates"); PBL_LOG(LOG_LEVEL_DEBUG, "▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼"); fake_battery_set_millivolts(high_mv); periodic_timer_trigger(20); c...
battery_get_charge_state()
; // due to fudge factors we merely check that the percentage is in range and // that it is monotonically decreasing cl_assert((result.charge_percent >= 0) && (result.charge_percent <= 100)); cl_assert(result.charge_percent <= last_discharge_percent); cl_assert(!result.is_charging); cl_assert(!r...
68}, { 944, 24, -288}, { 504, 24, -280}, { 352, 8, -224}, { 360, 64, -176}, { 496, 136, -192}, { 680, 144, -296}, { 976, 112, -320}, { 1256, 200, -408}, { 1232, 72, -224}, { 1152, 136, -312}, { 1512, 120, -328}, { 1552, 40, -216}, { 1288, 56, -216}, { 768, 64, -20...
{ 1592, -232, -232}, { 768, 136, -248}, { 1272, -128, -264}, { 1224, 40, -336}, { 928, 0, -352}, // 83 seconds { 560, -16, -264}, { 424, 0, -176}, { 400, 8, -184}, { 544, 56, -224}, { 784, 176, -256}, { 1112, 144, -208}, { 1200, 144, -248}, { 1544, 8, -288}, {...
{ 376, -8, -176}, { 464, 24, -168}, { 712, 16, -136}, { 1120, 24, -256}, { 1392, 8, -248}, { 1440, -24, -312}, { 872, 192, -56}, { 1256, -24, -360}, { 1184, 192, -336}, { 960, 64, -288}, { 584, 48, -264}, { 416, -56, -104}, { 416, 48, -168}, // 86 seconds { 6...
atic AccelRawData s_last_analytics_position; static AccelRawData s_latest_reading; // Buffer for holding the accel data static SharedCircularBuffer s_buffer; static uint8_t s_buffer_storage[50*sizeof(AccelRawData)]; // 400 bytes (~1s of data at 50Hz) static void lis3dh_IRQ1_handler(bool *should_context_switch); stati...
if (!running) { accel_stop(); }
return true; } AccelRawData s_accel_data; void accel_get_last_data(AccelRawData* data) { *data = s_accel_data; } void accel_get_data(AccelRawData* data, int num_samples) { if (!s_running) { PBL_LOG(LOG_LEVEL_ERROR, "Accel Not Running"); return; } // accel output registers have adjacent addresses...
se_items[1].header.id)); cl_assert(iter_next(&iterator)); #endif cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[2].header.id)); cl_assert(!iter_next(&iterator)); } // 8:16 am, 8:00 event has passed but not 8:15 event void test_timeline__extra_case_middle_past(void) { prv_insert_extra_case_ite...
timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000)
, 0); cl_assert_equal_i(pin_db_delete((uint8_t *)&s_items[4].header.id, sizeof(Uuid)), 0); // next item should be items[5], going back should skip over items[4] cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id)); cl_assert(iter_prev(&iterator)); cl_assert(...
qual_i(a->header.layout, b->header.layout); compare_attr_list(a->attr_list, b->attr_list); cl_assert_equal_i(a->action_group.num_actions, b->action_group.num_actions); for (int i = 0; i < a->action_group.num_actions; i++) { cl_assert_equal_i(a->action_group.actions[i].id, b->action_group.actions[i].id); c...
(notification_storage_get(&i, &r))
; compare_notifications(&e, &r); free(r.allocated_buffer); notification_storage_remove(&i); cl_assert_equal_b(notification_storage_get(&i, &r), false); } void test_notification_storage__set_actioned_flag(void) { Uuid i; uuid_generate(&i); TimelineItem e = { .header = { .id = i, .type = T...
if (animation) { property_animation_init(scroll_layer->animation, &implementation, scroll_layer, NULL, &offset); if (was_running && !scroll_layer_get_paging(scroll_layer)) { animation_set_curve(animation, AnimationCurveEaseOut); } } else { scroll_layer...
{ scroll_layer->callbacks = callbacks; }
void scroll_layer_set_context(ScrollLayer *scroll_layer, void *context) { scroll_layer->context = context; } void scroll_layer_set_shadow_hidden(ScrollLayer *scroll_layer, bool hidden) { PBL_ASSERTN(scroll_layer); // paging and shadow_sublayer are mutually exclusive // so init shadow_sublayer if it was pagi...
2, 360, -320}, { 1432, 432, -648}, { 1136, 288, -104}, { 968, 688, -408}, { 744, 760, -512}, { 664, 520, -352}, { 624, 632, -216}, { 656, 568, -232}, { 760, 560, -200}, { 976, 600, -96}, { 784, 816, -24}, { 536, 1200, 184}, { 880, 1168, 272}, { 1400, 1104, 344}, {...
{ 1480, 456, -344}, { 1272, 368, -304}, { 1056, 288, -256}, { 912, 248, -224}, // 53 seconds { 760, 264, -208}, { 712, 328, -232}, { 664, 488, -376}, { 592, 416, -272}, { 616, 432, -248}, { 568, 416, -224}, { 616, 432, -264}, { 736, 432, -352}, { 864, 344, -312}, ...
{ 664, 320, -248}, { 656, 368, -224}, { 680, 392, -208}, { 728, 464, -216}, { 736, 464, -160}, { 800, 440, -216}, { 816, 360, -312}, { 936, 224, -272}, { 1192, 48, -152}, { 1288, -248, -96}, { 1416, -72, -368}, { 1672, -16, -40}, { 1424, 176, 56}, // 56 seconds ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_ASSERTN(s_vibe_history_mutex); mutex_assert_held_by_curr_task(s_vibe_history_mutex, true); while (s_vibe_history && s_vibe_history->time_end != END_NOT_SET) { VibeHistory *vibe = s_vibe_history; if (cutoff != HISTORY_CLEAR_ALL && vibe->time_end >= cutoff) { break; } s_vibe_history = (V...
DEFINE_SYSCALL(void, sys_vibe_history_start_collecting, void) { s_vibe_history_enabled = true; } DEFINE_SYSCALL(void, sys_vibe_history_stop_collecting, void) { s_vibe_history_enabled = false; mutex_lock(s_vibe_history_mutex); prv_vibe_history_clear(HISTORY_CLEAR_ALL); mutex_unlock(s_vibe_history_mutex); } ...