prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
al_sleep_end_24h % TWELVE_HOURS; const int typical_start = (typical_sleep_start_12h * HEALTH_PROGRESS_BAR_MAX_VALUE / TWELVE_HOURS); const int typical_end = (typical_sleep_end_12h * HEALTH_PROGRESS_BAR_MAX_VALUE / TWELVE_HOURS); #if PBL_COLOR const bool fell_asleep_late = (typical_sleep_st...
if (typical_sleep) { health_util_format_hours_and_minutes(sleep_text, sizeof(sleep_text), typical_sleep, base_layer); } else { snprintf(sleep_text, sizeof(sleep_text), EM_DASH); }
health_ui_render_typical_text_box(ctx, base_layer, sleep_text); } static void prv_render_no_sleep_data_text(GContext *ctx, Layer *base_layer) { HealthSleepSummaryCardData *data = layer_get_data(base_layer); const int y = PBL_IF_RECT_ELSE(91, 100); const GRect rect = GRect(0, y, base_layer->bounds.size.w, 60...
// Even cols of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, 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); graphics_draw_vertical_line_dotted(&ctx, GPoint(4, 0), 0); ...
graphics_draw_vertical_line_dotted(&ctx, GPoint(2, 0), MAX_NUM_ROWS + 4)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(result, image, size)
; } return result; } void gdraw_command_image_destroy(GDrawCommandImage *image) { applib_resource_munmap_or_free(image); } bool gdraw_command_image_validate(GDrawCommandImage *image, size_t size) { if (!image || (size < sizeof(GDrawCommandImage)) || (image->version > GDRAW_COMMAND_VERSION) || ...
back to run from the kernel main task static void prv_launch_app_cb(void *data) { app_manager_launch_new_app(&(AppLaunchConfig) { .md = data }); } #if PBL_ROUND static void prv_select_calibrate_display(int index, void *context) { launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_display_calibration_app_get...
prv_get_icon_for_test(MfgTest_ALS)
, .title = "Test ALS", .callback = prv_select_als }, #if !PLATFORM_SILK { .title = "Test bt_sig_rf", .callback = prv_select_bt_sig_rf }, #endif #if CAPABILITY_HAS_BUILTIN_HRM { .title = "Test HRM", .callback = prv_select_hrm }, #endif #if BT_CONTROLLER_DA14681 { .title = "Test BTL...
tx, GColorRed); // cross - even vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 10), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(5, 15), 10); // cross - odd vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(41, 11), 10); graphics_draw_horizontal_line_dotted(&ct...
(ctx, false)
; graphics_context_set_stroke_width(ctx, 4); graphics_draw_line(ctx, GPoint(70,70), GPoint(70,70)); graphics_context_set_antialiased(ctx, true); graphics_context_set_stroke_width(ctx, 4); graphics_draw_line(ctx, GPoint(80,80), GPoint(80,80)); graphics_context_set_antialiased(ctx, false); graphics_contex...
cl_assert_equal_b(true, activity_sessions_is_session_type_ongoing(ActivitySessionType_Sleep)); cl_assert_equal_i(HealthActivityRun | HealthActivityWalk | HealthActivitySleep , health_service_peek_current_activities()); } static void prv_set_median_hr_for_minutes(int bpm, int num_minutes) { const int num_samples =...
(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes)
/* * 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...
pulse_send_message(PROMPT_RESP_MESSAGE, response)
; } else { dbgserial_putstr(response); } } static void prv_dbgserial_command_complete_callback(void) { SerialConsoleState state = serial_console_get_state(); if (state == SERIAL_CONSOLE_STATE_PULSE) { prv_pulse_done_command(); } else if (state == SERIAL_CONSOLE_STATE_PROMPT) { start_prompt(); }...
xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3232 - 3248 */ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3248 - 3264 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* by...
cl_assert_equal_i( resource_load_byte_range_system(resource_bank, no_litter_res_id, image_size, image_buf, 1), 0)
//! This way the time-outs can be crammed into 2 bits per packet. static uint8_t s_timer_ticks; static uint8_t s_disconnect_counter; // ------------------------------------------------------------------------------------------------- // Function Prototypes static void prv_send_next_packets(PPoGATTClient *client); st...
{ return ((PPOGATT_SN_MOD_DIV + sn - 1) % PPOGATT_SN_MOD_DIV); }
edule(intro); if (!layer_get_hidden((Layer *)&data->peek_layer)) { prv_scale_peek_to_first_pin_icon(data, duration, was_mini_peek); } } static void prv_open_did_focus_handler(PebbleEvent *e, void *context) { TimelineAppData *data = context; event_service_client_unsubscribe(&data->focus_event_info); prv_...
TimelineResourceSizeTiny, icon_from); } else { const bool use_pin = false; prv_setup_peek_animation(data, &first_timeline_layout->icon_info, use_pin); } }
static void NOINLINE prv_setup_peek(TimelineAppData *data) { TimelineIterState *state = timeline_model_get_current_state(); TimelineItem *first_pin = state ? &state->pin : NULL; EventServiceEventHandler focus_handler = prv_open_did_focus_handler; // we'll only show the first pin peek if timeline peek (aka qu...
LID, &uuid)); cl_assert_equal_uuid(uuid, UUID_INVALID); cl_assert_equal_b(true, app_install_get_uuid_for_install_id(tictoc_id, &uuid)); cl_assert_equal_uuid(uuid, tictoc_uuid); cl_assert_equal_b(true, app_install_get_uuid_for_install_id(music_id, &uuid)); cl_assert_equal_uuid(uuid, music_uuid); cl_assert_...
cl_assert_equal_b(false, menu_layer_md->has_worker)
.frames_in = s_custom_moook_frames_in, .num_frames_in = ARRAY_LENGTH(s_custom_moook_frames_in), .frames_out = s_custom_moook_frames_out, .num_frames_out = ARRAY_LENGTH(s_custom_moook_frames_out), }; static void prv_move_region_of_bitmap_horizontally(GBitmap *bitmap, const GRect *region, ...
(ctx, selection_color)
; graphics_fill_rect(ctx, &stretch_rect_below_selection_rect); } } static void prv_launcher_app_transition_animation_update(GContext *ctx, Animation *UNUSED animation, uint32_t distance_normalized) { const bool is_right = s_data.app_is_destination; con...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ periph_config_enable(bus->spi, bus->state->spi_clock_periph); }
void prv_spi_disable_peripheral_clock(const SPIBus *bus) { periph_config_disable(bus->spi, bus->state->spi_clock_periph); } static void prv_spi_clear_flags(const SPIBus *bus) { prv_spi_receive_data(bus); prv_spi_get_flag_status(bus, (SpiI2sFlag)0); } static void prv_spi_dma_cmd(const SPIBus *bus, SpiI2sDma dm...
/* * 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...
{ SimpleMessage msg = { .lucky_number = 42, }; uint8_t *buffer = app_malloc(30); pb_ostream_t s = pb_ostream_from_buffer(buffer, 30); pb_encode(&s, SimpleMessage_fields, &msg); PBL_LOG(LOG_LEVEL_DEBUG, "Encoded message, size: %u bytes", s.bytes_written); PBL_HEXDUMP(LOG_LEVEL_DEBUG, buffer, s.bytes_wr...
static void prv_deinit(void) { SimpleMessage msg = {0}; uint8_t *buffer = app_state_get_user_data(); pb_istream_t s = pb_istream_from_buffer(buffer, 30); pb_decode(&s, SimpleMessage_fields, &msg); PBL_LOG(LOG_LEVEL_DEBUG, "The lucky number is %"PRId32, msg.lucky_number); } static void prv_app_main(void) { ...
permissions and * limitations under the License. */ #include "peek.h" #include "drivers/rtc.h" #include "kernel/event_loop.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "kernel/pebble_tasks.h" #include "services/common/system_task.h" #include "services/normal/blob_db/pin_db.h" #include "ser...
{ update->today_timed_event_passed = 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...
fake_system_task_callbacks_invoke_pending()
; } } BlobDBToken blob_db_endpoint_send_writeback(BlobDBId db_id, time_t last_updated, const void *key, int key_len, const void *val, ...
util/attributes.h" #define CMSIS_COMPATIBLE #include <mcu.h> // I-Cache definition doesn't always exist #ifndef __ICACHE_PRESENT # define __ICACHE_PRESENT 0U #endif // D-Cache definition doesn't always exist #ifndef __DCACHE_PRESENT # define __DCACHE_PRESENT 0U #endif // Most of these implementations are derived fr...
dcache_line_size()
, (uintptr_t)addr, size); #endif } MOCKABLE void dcache_invalidate(void *addr, size_t size) { #if __DCACHE_PRESENT prv_cache_operation_range(&SCB->DCIMVAC, dcache_line_size(), (uintptr_t)addr, size); #endif } MOCKABLE void dcache_flush_invalidate(const void *addr, size_t size) { #if __DCACHE_PRESENT prv_cache_ope...
/* * 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_m(dstbuf, "Hello!\nI am er\0\xFF", 16)
; } void test_sprintf__long_conversion(void) { char dstbuf[256]; uint64_t val = 0xFFFFFFFFFFFFFFFFULL; snprintf(dstbuf, 256, "%#llo", val); cl_assert_equal_s(dstbuf, "01777777777777777777777"); } void test_sprintf__null(void) { cl_assert_equal_i(snprintf(NULL, 0, "Hello!\nI am error"), 17); } void test_s...
es(length); prv_config_indirect_read(dev, instruction, addr, dummy_cycles, is_ddr); prv_read_bytes(buffer, length); QSPI_ClearFlag(QSPI_FLAG_TC); prv_wait_for_not_busy(); } void qspi_indirect_read_no_addr(QSPIPort *dev, uint8_t instruction, uint8_t dummy_cycles, void *buffer,...
{ prv_indirect_write(dev, instruction, QSPI_ADDR_NO_ADDR, buffer, length); }
void qspi_indirect_write(QSPIPort *dev, uint8_t instruction, uint32_t addr, const void *buffer, uint32_t length) { prv_indirect_write(dev, instruction, addr, buffer, length); } void qspi_indirect_write_no_addr_1line(QSPIPort *dev, uint8_t instruction) { prv_set_ddr_enabled(false); uin...
r, window); if (option_menu->choice != OPTION_MENU_CHOICE_NONE) { menu_layer_set_selected_index(&option_menu->menu_layer, MenuIndex(0, option_menu->choice), MenuRowAlignCenter, false); } layer_add_child(window_get_root_layer(window), menu_layer_get_layer(&option_menu->menu_la...
("OptionMenu")
); window_set_user_data(&option_menu->window, option_menu); window_set_window_handlers(&option_menu->window, &(WindowHandlers) { .load = prv_window_load, .unload = prv_window_unload, }); StatusBarLayer *status_layer = &option_menu->status_layer; status_bar_layer_init(status_layer); status_bar_l...
etMinutes = jerry_get_object_field(now, "getMinutes"); jerry_value_t getHours = jerry_get_object_field(now, "getHours"); jerry_value_t getDate = jerry_get_object_field(now, "getDate"); jerry_value_t result_seconds = jerry_call_function(getSeconds, now, NULL, 0); jerry_value_t result_minutes = jerry_call_functi...
jerry_release_value(result_year)
; jerry_release_value(result_month); jerry_release_value(result_date); jerry_release_value(result_hours); jerry_release_value(result_minutes); jerry_release_value(result_seconds); jerry_release_value(getYear); jerry_release_value(getMonth); jerry_release_value(getDate); jerry_release_value(getHours); ...
goto unhandled; } uint8_t offset = att_hdl - EMULATED_PPOGATT_SERVICE_HDL; switch (offset) { case EMULATED_META_CHAR_OFFSET: return prv_handle_emulated_meta_read(msg); case EMULATED_DATA_CHAR_OFFSET: return prv_handle_emulated_write(conn_idx, msg); case EMULATED_DATA_CCCD_OFFSET: { ...
PEBBLE_BT_UUID_EXPAND( PEBBLE_BT_PPOGATT_WATCH_SERVER_DATA_WR_CHARACTERISTIC_UUID_32BIT)
}, &uuid); PBL_ASSERTN(ble_gatts_add_characteristic(&uuid, GATT_PROP_WRITE_NO_RESP, ATT_PERM_WRITE, data_wr_size, enable_read_cb_flag, NULL, &ctx->att_hdl.data_wr) == BLE_STATUS_OK); PB...
/* * 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...
(0 /* offset */, 0x1000000 /* length */)
30, }; do_not_disturb_set_schedule(WeekdaySchedule, &schedule_1); do_not_disturb_set_schedule_enabled(WeekdaySchedule, true); active = do_not_disturb_is_active(); cl_assert(active == true); // Scheduled ON DoNotDisturbSchedule schedule_2 = { .from_hour = 5, .from_minute = 0, .to_hour = 13, ...
do_not_disturb_is_active()
; cl_assert(active == false); // Timer will go off at 01:00 on Sunday. (14.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 52200 * MS_PER_SECOND); do_not_disturb_set_schedule_enabled(WeekendSchedule, false); rtc_set_time(s_saturday_01_30); do_not_disturb_handle_clock_change(); acti...
/* * 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(list_count(&a) == 3)
; cl_assert(list_count(&b) == 3); cl_assert(list_count(&c) == 3); cl_assert(list_count_to_tail_from(&a) == 3); cl_assert(list_count_to_tail_from(&b) == 2); cl_assert(list_count_to_tail_from(&c) == 1); cl_assert(list_count_to_head_from(&c) == 3); cl_assert(list_count_to_head_from(&b) == 2); cl_assert(lis...
&cron_tm.tm_mday, &cron_tm.tm_hour, &cron_tm.tm_min, &cron_tm.tm_sec, }; const int curr_arr[CRON_INDEX_COUNT] = { current_tm.tm_year, current_tm.tm_mon, current_tm.tm_mday, current_tm.tm_hour, current_tm.tm_min, current_tm.tm_sec, }; const int spec_arr[CRON_INDEX_COUNT] ...
time_get_isdst(t)
) { t -= time_get_dstoffset(); if (!time_get_isdst(t)) { // We're in the hole where DST starts. // We want holed alarms to fire instantly, so set time to DST start time. t = time_get_dst_start(); } } // We could be in the overlap where DST ends, but we don't actually care about it. /...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(config.units, 1)
; cl_assert_equal_i(config.sign, RTC_CalibSign_Negative); } void test_rtc_calibration__invalid_frequency(void) { // Bigboards don't have a frequency stored in their mfg info registry. RTCCalibConfig config = rtc_calibration_get_config(0, TARGET_FREQUENCY_mHZ); cl_assert_equal_i(config.units, 0); }
fs_read(SettingsRawIter *iter, uint8_t *data, int data_len) { status_t status = pfs_read(iter->fd, data, data_len); if (status >= 0) { return status; } int pos = pfs_seek(iter->fd, 0, FSeekCur); PBL_LOG(LOG_LEVEL_ERROR, "Could not read data to %p of length %d at pos %d: %"PRId32, data, data_len...
{ if (iter->hdr.val_len == 0) return; sfs_seek(iter, iter->hdr_pos + sizeof(SettingsRecordHeader) + iter->hdr.key_len, FSeekSet); sfs_write(iter, val, iter->hdr.val_len); }
void settings_raw_iter_write_byte(SettingsRawIter *iter, int offset, uint8_t byte) { sfs_seek(iter, iter->hdr_pos + sizeof(SettingsRecordHeader) + iter->hdr.key_len + offset, FSeekSet); sfs_write(iter, &byte, 1); } void settings_raw_iter_deinit(SettingsRawIter *iter) { int status = pfs_close(iter->fd); ...
ode static NOINLINE bool file_found_in_cache(const char *name, uint8_t op_flags, int *fd_used) { int fd, res; bool is_tmp = ((op_flags & OP_FLAG_OVERWRITE) != 0); bool file_found = false; if ((res = get_avail_fd(name, &fd, is_tmp)) == NoFDAvail) { res = E_OUT_OF_RESOURCES; goto cleanup; } else if (re...
PFS_FD(fd)
.fd_status = FD_STATUS_IN_USE; } return (res); } int pfs_open(const char *name, uint8_t op_flags, uint8_t file_type, size_t start_size) { size_t namelen = (name == NULL) ? 0 : strlen(name); if ((namelen < 1) || (namelen > FILE_MAX_NAME_LEN)) { return (E_INVALID_ARGUMENT); } mutex_lock_recursive(s...
ut->icon_layer, notification_layout_frame); prv_draw_banner_round(layout, ctx, notification_layout_frame, *colors); // work around the clip box and smaller layout_height for circular text paging ctx->draw_state.clip_box.size.h = MIN(ctx->draw_state.clip_box.size.h, LAYOUT_HEIGHT); #else static const GRe...
attribute_get_uint8(layout->attributes, AttributeIdPrimaryColor, GColorBlack.argb)
; #endif } static const LayoutColors *prv_layout_get_colors(const LayoutLayer *layout_ref) { return &((NotificationLayout *)layout_ref)->colors; } static void *prv_layout_get_context(LayoutLayer *layout) { NotificationLayout *notification_layout = (NotificationLayout *)layout; return (void *)notification_layout...
igin.y >= DISP_ROWS); // Peek service shows the peek UI. Not animated for this unit test. TimelineItem *item = prv_set_timeline_item(&(TimelinePeekItemConfig) { .title = "CoreUX Design x Eng", .subtitle = "ConfRM-Missile Command", .icon = TIMELINE_RESOURCE_TIMELINE_CALENDAR, .num_concurrent = 0, ...
timeline_peek_set_visible(false, false /* animated */)
; // For simplicity, the implementation also moves the layer even though it is not necessary. cl_assert(layer->frame.origin.y >= DISP_ROWS); // Transition back to the watchface s_is_watchface_running = true; timeline_peek_set_visible(true, false /* animated */); // Peek should be visible again and on-scree...
_used_space); kernel_free(name); return status; } T_STATIC status_t settings_file_compact(SettingsFile *file) { return settings_file_rewrite_filtered(file, NULL, NULL); } static bool key_matches(SettingsRawIter *iter, const uint8_t *key, int key_len) { SettingsRecordHeader *hdr = &iter->hdr; if (key_len != ...
search_forward(&file->iter, key, key_len)
) { memset(val_out, 0, val_out_len); return E_DOES_NOT_EXIST; } if (deleted_and_expired(&file->iter.hdr)) { memset(val_out, 0, val_out_len); return E_DOES_NOT_EXIST; } size_t val_len = file->iter.hdr.val_len; if (val_out_len > val_len) { memset(val_out, 0, val_out_len); return E_RANGE;...
ctx, uint8_t stroke_width) {} void gpath_draw_stroke(GContext* ctx, GPath* path, bool open) {} void gpath_draw_filled(GContext* ctx, GPath *path) {} void graphics_draw_circle(GContext* ctx, GPoint p, uint16_t radius) {} void graphics_fill_circle(GContext* ctx, GPoint p, uint16_t radius) {} void graphics_context_move_d...
cl_assert(!gdraw_command_sequence_validate(sequence, size))
s_last_event = (PebbleEvent) { 0 }; } void test_evented_timer__initialize(void) { s_times_callback_executed = 0; s_last_event = (PebbleEvent) { 0 }; } void test_evented_timer__cleanup(void) { evented_timer_reset(); } void test_evented_timer__simple(void) { EventedTimerID e_timer = evented_timer_register...
s_last_event.callback.callback(s_last_event.callback.data)
; // And we're done! Even though we let the timer fire and generate the event, cancelling before the event is // handled should stop the registered timer callback from being called. cl_assert(!s_times_callback_executed); }
Line) { 0 }; line.max_width_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter))...
(word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 2)
; line_reset(&line, utf8_bounds.start); cl_assert(line_add_words(&line, &word_iter, NULL)); cl_assert(line.height_px == 10); cl_assert(line.width_px == HORIZ_ADVANCE_PX * 3); cl_assert(line.origin.x == 0); cl_assert(line.suffix_codepoint == 0); cl_assert(*line.start == 'a'); // ani- cl_assert(*word_...
/* * 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 !uuid || uuid_equal(uuid, &invalid_uuid); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
( FIRMWARE_BASE, firmware_length, prv_display_erase_progress, 0)
; } static void prv_display_write_progress( uint32_t progress, uint32_t total, void *ctx) { display_firmware_update_progress(progress/2 + total/2, total); } static bool write_new_firmware(uint32_t flash_new_fw_start, uint32_t firmware_length) { dbgserial_putstr("write_new_firmwa...
////////////////////////////////////////////////////////////////////////////////// // Helpers static void prv_prep_and_open_active_window(ActivitySessionType type) { WorkoutAppData *data = app_state_get_user_data(); data->workout_controller = (WorkoutController) { .is_paused = workout_service_is_paused, ....
dialog_set_background_color(dialog, PBL_IF_COLOR_ELSE(GColorYellow, GColorWhite))
ailed to read notification"); goto cleanup; } } else if (type == NotificationReminder) { // validate reminder int rv = reminder_db_read_item(item, id); if (rv != S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to read reminder"); goto cleanup; } } // Determine if the icon isn'...
pin_db_get(&reminder.header.parent_id, &item)
) { return; } timeline_item_free_allocated_buffer(&item); // Use the latest stale time to auto-hide the reminder. const time_t reminder_stale_time = prv_get_stale_time(&reminder); const time_t event_stale_time = prv_get_stale_time(&item); const time_t stale_time = MAX(reminder_stale_time, event_stale_t...
ps/system_apps/settings/settings_option_menu.h" #include "kernel/pbl_malloc.h" #include "popups/health_tracking_ui.h" #include "resource/resource_ids.auto.h" #include "services/common/i18n/i18n.h" #include "services/normal/activity/activity.h" #include "services/normal/alarms/alarm.h" #include "system/logging.h" #inclu...
if (data->creating_alarm) { time_selection_window_deinit(&data->time_picker_window); }
// Editing recurrence menu_layer_deinit(&data->day_picker_menu_layer); prv_remove_windows(data); i18n_free_all(&data->day_picker_window); task_free(data); data = NULL; } static void prv_handle_selection(int index, void *callback_context) { AlarmEditorData *data = (AlarmEditorData *)callback_context; ...
e = task_zalloc(size + max_nodes * sizeof(GTextNode *)); if (container_node) { *container_node = (GTextNodeContainer) { .node.type = type, .node.free_on_destroy = true, .max_nodes = max_nodes, .nodes = max_nodes ? (GTextNode **)((uint8_t *)container_node + size) : NULL, }; } return...
if (ctx->render) { const GColor prev_text_color = ctx->gcontext->draw_state.text_color; if (!gcolor_is_invisible(text_node->color)) { ctx->gcontext->draw_state.text_color = text_node->color; } graphics_draw_text(ctx->gcontext, text_node->text, text_node->font, ctx->box, text...
if (ctx->size_out) { *ctx->size_out = layout.max_used_size; } } static void prv_draw_text_node_text_dynamic(GTextNodeDrawContext *ctx) { GTextNodeTextDynamic *text_node = (GTextNodeTextDynamic *)ctx->node; text_node->update(ctx->gcontext, &text_node->text.node, &ctx->box, ctx->config, ctx->render, ...
uteIdLocationName, s_test_data.location_name); } if (s_test_data.body) { attribute_list_add_cstring(attr_list, AttributeIdBody, s_test_data.body); } if (!gcolor_is_invisible(s_test_data.primary_color)) { attribute_list_add_uint8(attr_list, AttributeIdPrimaryColor, s_test_data.primary_color.argb); } ...
attribute_list_destroy_list(&s_test_data.statics.attr_list)
; s_test_data = (NotificationWindowTestData) {}; } void test_notification_window__cleanup(void) { } // Helpers ////////////////////// extern NotificationWindowData s_notification_window_data; //! Static function in swap_layer.c used to scroll void prv_attempt_scroll(SwapLayer *swap_layer, ScrollDirection directio...
nd(DayPickerMenuItems index) { switch (index) { case DayPickerMenuItemsWeekdays: return ALARM_KIND_WEEKDAYS; case DayPickerMenuItemsWeekends: return ALARM_KIND_WEEKENDS; case DayPickerMenuItemsEveryday: return ALARM_KIND_EVERYDAY; case DayPickerMenuItemsJustOnce: return ALARM_K...
menu_cell_basic_draw(ctx, cell_layer, i18n_get(cell_text, &data->day_picker_window), NULL, NULL)
; } static void prv_day_picker_handle_selection(MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) { AlarmEditorData *data = (AlarmEditorData *)callback_context; data->day_picker_was_completed = false; if (cell_index->row == DayPickerMenuItemsCustom...
/* * 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_moook_in_only(ANIMATION_NORMALIZED_MAX, -20000, 20000), 20000)
; } void test_animation_interpolate__moook_out(void) { const int expected[] = {20004, 20002, 20001, 20000}; const int num_frames = ARRAY_LENGTH(expected); for (int i = 0; i < num_frames; i++) { printf("frame: %d\n", i); cl_assert_equal_i(interpolate_moook_out((i * ANIMATION_NORMALIZED_MAX) / num_frames, ...
rtc_get_time()
+ SECONDS_PER_HOUR + (15 * SECONDS_PER_MINUTE); struct tm local_tm; localtime_r(&utc_sec, &local_tm); local_tm.tm_min -= (local_tm.tm_min % 15); local_tm.tm_sec = 0; data->timestamp = mktime(&local_tm); } // If the user doesn't accept the transcription, try again. data->ui_st...
eat_delay_attribute = generic_attribute_find_attribute(&score->attr_list, VibeAttributeId_RepeatDelay, score->attr_list_size); if (repeat_delay_attribute) { if (repeat_delay_attribute->length != sizeof(uint16_t)) { return false; } uint16_t *delay = (uint1...
vibe_get_braking_strength()
); } } sys_vibe_pattern_trigger_start(); } VibeScore *vibe_score_create_with_resource(uint32_t resource_id) { ResAppNum app_num = sys_get_current_resource_num(); return vibe_score_create_with_resource_system(app_num, resource_id); } void vibe_score_destroy(VibeScore *score) { if (!score) { return; ...
------------ // Test unschedule all when we have multiple animations, some complex void test_animation__unschedule_all(void) { #ifdef TEST_INCLUDE_COMPLEX // Create animations // Create a sequence Animation *a = prv_create_test_animation(); Animation *b = prv_create_test_animation(); Animation *seq = animat...
cl_assert(animation_get_duration(h, true, true) == 2*(duration + delay))
; // Curve cl_assert(animation_get_curve(h) == AnimationCurveDefault); animation_set_curve(h, AnimationCurveEaseOut); cl_assert(animation_get_curve(h) == AnimationCurveEaseOut); static const PropertyAnimationImplementation implementation2 = { .base = { .setup = prv_setup_handler, .update =...
/* * 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...
{ // All events other than SmartstrapConnectionEvent contain the attribute pointer SmartstrapAttribute *attr = event.attribute; PBL_ASSERTN(attr); if ((event.type == SmartstrapDataSentEvent) && state->handlers.did_write) { state->handlers.did_write(attr, event.result); } else if ((event.type =...
may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the L...
(WINDOW_NAME("Shutdown Charging"))
; Dialog *dialog = simple_dialog_get_dialog(data->dialog); dialog_set_background_color(dialog, GColorBlack); dialog_set_text_color(dialog, GColorWhite); window_set_click_config_provider(&dialog->window, prv_config_provider); // The assumption is that this app is launched when the charger is connected // an...
eduled_days[DAYS_PER_WEEK]; GBitmap deselected_icon; GBitmap selected_icon; GBitmap checkmark_icon; uint32_t current_checkmark_icon_resource_id; bool show_check_something_first_text; AlarmEditorCompleteCallback complete_callback; void *callback_context; AlarmId alarm_id; int alarm_hour; int alarm_...
(data->alarm_id, data->alarm_kind)
; data->complete_callback(EDITED, data->alarm_id, data->callback_context); app_window_stack_pop(true); } } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Custom Day Picker static void prv_custom_day_picker_window_unload(Window *window) { AlarmEditor...
atoi(s_perftest_text_arguments.y_offset)
; bounds.origin.y -= y_offset; if (y_offset > 0) { bounds.size.h = DISP_ROWS + y_offset; } uint32_t avg = 0; for (int i = 0; i < PERFTEST_TEXT_ITERATIONS; i++) { // Sometimes this loop takes long enough that we end up watchdogging watchdog_feed(); task_watchdog_bit_set_all(); GContext *...
2_t s_last_heading = -1; // the last heading we found #ifdef RECOVERY_FW static MagData s_last_mag_sample = { 0 }; #endif ////////////////////////////////////////////////////////////////////////////////// // Calibration state variables static void prv_calibration_time_expired_cb(void* data); static bool s_high_freq_c...
sin_lookup(pitch)
) / TRIG_MAX_RATIO) * cos_lookup(roll)) / TRIG_MAX_RATIO; my_rot = mz * sin_lookup(roll) - my * cos_lookup(roll); my_rot /= TRIG_MAX_RATIO; int32_t heading = (atan2_lookup(-my_rot, mx_rot) + corr) % TRIG_MAX_ANGLE; return (heading); } ///////////////////////////////////////////////////////////////////...
d_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_updat...
(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); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); // Start A prv...
data->fg_color.argb = (s_color_table[data->fg_color_index] | ALPHA_100); } else if (data->property == PROPERTY_BG_COLOR) { data->bg_color_index = (data->bg_color_index - 1) & 0x3F; data->bg_color.argb = (s_color_table[data->bg_color_index] | ALPHA_100); } else if (data->property == PROPERTY_ALPHA) { ...
{ // Destroy Layer layer_destroy(s_canvas_layer); }
static void init(void) { AppData *data = task_malloc(sizeof(AppData)); if (!data) { return; } memset(data, 0x00, sizeof(AppData)); s_window = window_create(); window_set_user_data(s_window, data); window_set_fullscreen(s_window, true); window_set_window_handlers(s_window, &(WindowHandlers) { ...
/* * 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 (BOARD_CONFIG_VIBE.options & ActuatorOptions_HBridge) { // Scale from -100..100 (strength) to 0..100 (duty cycle) return ((PWM_DUTY_CYCLE_FULL - PWM_DUTY_CYCLE_OFF) * strength / VIBE_STRENGTH_MAX) + PWM_DUTY_CYCLE_OFF; } else { // Treat "reverse" rotation strength as if it were "forwa...
ed from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); // ----------------------------------- // Test that we receive step update events fake_event_reset_count(); // Feed in 100 st...
prv_feed_cannned_accel_data(6 * SECONDS_PER_HOUR, 50, ActivitySleepStateAwake)
; // switch into PST (which would be 3pm) tz_info = (TimezoneInfo) { .tm_zone = "PST", .tm_gmtoff = -8 * SECONDS_PER_HOUR, }; time_util_update_timezone(&tz_info); // Walk some more until 11pm PST prv_feed_cannned_accel_data(8 * SECONDS_PER_HOUR, 50, ActivitySleepStateAwake); // Starting at 11pm...
rt_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaitingResetCompleteLocalInitiated); // Receive yet another chunk in "Awaiting Reset Complete Local Initiated": RCV_DUMMY_CHUNK(); // https://pebbletechnology.atlassian.net/browse/PBL-42466 // TODO: assert that chunk is NACKd ...
rocky_api_app_message_get_state()
, PostMessageStateAwaitingResetCompleteRemoteInitiated); RCV_RESET_COMPLETE(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateSessionOpen); } void test_rocky_api_app_message__postmessageconnected_and_postmessagedisconnected_remote_rr(void) { prv_postmessageconnected_pos...
/* * 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...
round(-1.0)
, -1.0); cl_assert_equal_d(round(1.7976931348623157e+308), 1.7976931348623157e+308); cl_assert_equal_d(round(2.2250738585072014e-308), -0.0); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
DEFINE_SYSCALL(int32_t, persist_read_int, const uint32_t key)
{ int32_t value = 0; LOCK_AND_GET_STORE(store); settings_file_get(store, &key, sizeof(key), &value, sizeof(value)); return value; } DEFINE_SYSCALL(int, persist_read_data, const uint32_t key, void *buffer, const size_t buffer_size) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_b...
/* * 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(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE))
; } // Tests 8-bit color PBI loading into gbitmap // Result: // - gbitmap matches platform loaded PBI void test_pbi__color_8_bit(void) { GBitmap *bitmap = setup_pbi_test(TEST_PBI_FILE); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE)); } // Tests 1-bit transparent palettized PBI loading into gbitmap // Result: ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (bitmap) { memset(bitmap, 0, sizeof(GBitmap)); gbitmap_init_with_png_data(bitmap, png_data, png_data_size); }
return bitmap; } bool gbitmap_init_with_png_data(GBitmap *bitmap, const uint8_t *data, size_t data_size) { GColor8 *palette = NULL; bool retval = false; upng_t *upng = upng_create(); if (!upng) { goto cleanup; } upng_load_bytes(upng, data, data_size); upng_error upng_state = upng_decode_image(upn...
ects global... static const RockyGlobalAPI *apis[] = { NULL, }; rocky_global_init(apis); EXECUTE_SCRIPT(test_object); ASSERT_JS_GLOBAL_EQUALS_S("t", "object"); // ...which also has a method .on() EXECUTE_SCRIPT("var t = typeof _rocky.on"); ASSERT_JS_GLOBAL_EQUALS_S("t", "function"); /// ...whic...
prv_add_event_listener_to_list("a", jerry_create_external_function(prv_listener_a2))
; cl_assert_equal_b(true, rocky_global_has_event_handlers("a")); cl_assert_equal_b(true, rocky_global_has_event_handlers("b")); jerry_value_t a_event = rocky_global_create_event("a"); rocky_global_call_event_handlers(a_event); cl_assert_equal_i(1, s_prv_listener_a1__callcount); cl_assert_equal_i(1, s_prv_l...
/* * 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...
blob_db_sync_cancel(session)
; } static void prv_timeout_timer_callback(void *data) { system_task_add_callback(prv_timeout_kernelbg_callback, data); } static void prv_send_writeback(BlobDBSyncSession *session) { // we want to write-back the first item in the dirty list BlobDBDirtyItem *dirty_item = session->dirty_list; int item_size = bl...
tBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, }; // Init mutable types word_iter_init(&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start); // Tests cl_assert(word_iter_state.current.start == word_iter_state.current.end); cl_assert(!iter_next(&word_i...
(*word_iter_state.current.start == '\n')
; cl_assert(*word_iter_state.current.end == '\0'); cl_assert(!iter_next(&word_iter)); }
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...
{ return new_node; }
else { return head; } } ListNode *next = node->next; if (next == NULL) { list_insert_after(node, new_node); return head; } node = next; } } bool list_contains(const ListNode *node, const ListNode *node_to_search) { if (node == NULL || node_to_search == NULL) { ret...
.id = 0, .type = TimelineItemActionTypeComplete, .attr_list = completed_attr_list, }, { .id = 1, .type = TimelineItemActionTypePostpone, .attr_list = postpone_attr_list, }, { .id = 2, .type = TimelineItemActionTypeRemoteRemove, .at...
strncat(data->dialog_text, " ", buf_space_remaining)
; buf_space_remaining = MAX(buf_space_remaining - 1, 0);; clock_get_time_number(tmp, date_time_len, data->timestamp); strncat(data->dialog_text, tmp, buf_space_remaining); buf_space_remaining = MAX(buf_space_remaining - strlen(tmp), 0); clock_get_time_word(tmp, date_time_len, data->timestamp); strncat(dat...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Pushing window %p onto app window stack %p", window, app_state_get_window_stack()); window_stack_push(app_state_get_window_stack(), window, animated); }
indowStack *stack = window->parent_window_stack; if (window_transition_context_has_legacy_window_to(stack, window)) { // for 2.x apps, we cannot animate the window frame during a transition but need to use this // externalized state const GPoint displacement = stack->transition_context.window_to_displacem...
{ PBL_LOG(LOG_LEVEL_ERROR, "Tried to init a NULL window"); return; }
*window = (Window){}; #ifndef RELEASE window->debug_name = debug_name; #else (void)debug_name; #endif bool fullscreen = !process_manager_compiled_with_legacy2_sdk(); const GRect frame = window_calc_frame(fullscreen); layer_init(&window->layer, &frame); window->is_fullscreen = fullscreen; window->layer...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&window->layer, simple_menu_layer_get_layer(menu))
; } static void handle_init(void) { AppData *data = app_malloc_check(sizeof(AppData)); app_state_set_user_data(data); Window *window = &data->window; window_init(window, WINDOW_NAME("Simple Menu Demo")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load ...
72854 }, // priority rank 42 { .id = 49, .priority = 49, .size = 217548 }, // priority rank 37 { .id = 50, .priority = 1, .size = 207357 }, // priority rank 1 }; extern uint32_t app_cache_get_size(void); void prv_load_lotta_apps(void) { for (int i = 0; i < 50; i++) { // time is the basis of the priority....
app_cache_remove_entry(17)
; } return GPointPreciseFromGPoint(imprecise_center_point); } static void prv_draw_clock_face(GContext *ctx, ClockFace *face) { MultiWatchData *data = app_state_get_user_data(); const GRect *bounds = &window_get_root_layer(&data->window)->bounds; const GPointPrecise center = prv_get_clock_center_point(face->...
app_event_loop()
; prv_deinit(); }
(void) { if (!s_dma_enabled) { return; } s_dma_enabled = false; uart_stop_rx_dma(ACCESSORY_UART); } //! The interval timer callback. static void prv_timer_interval_expired_cb(void *data) { if (!s_stop_mode_monitor.data_seen_this_interval) { // The accessory connector didn't have any data since the la...
prv_disable_dma()
; prv_enable_dma(); } } } void accessory_init(void) { s_send_semaphore = xSemaphoreCreateBinary(); xSemaphoreGive(s_send_semaphore); s_blocked_lock = mutex_create_recursive(); prv_initialize_hardware(); accessory_set_power(false); accessory_enable_input(); } void accessory_block(void) { prv_...
}, { 0, 0x7f, 4211, 128, 0}, { 0, 0xe, 28, 125, 0}, { 0, 0xe, 0, 125, 0}, { 0, 0xe, 17, 123, 0}, { 0, 0xe, 0, 122, 0}, { 0, 0xe, 0, 122, 0}, // 645: Local time: 2016-05-20 07:52:00 AM { 0, 0xe, 0, 123, 0}, { 0, 0xe, 0, 122, 0}, { 0, 0xe, 0, 122, 0}, { 0,...
// 735: Local time: 2016-05-20 09:22:00 AM { 65, 0x52, 8008, 198, 0}, { 81, 0x65, 6245, 164, 0}, { 116, 0x55, 8784, 167, 0}, { 5, 0x34, 4313, 155, 0}, { 20, 0x43, 7667, 174, 0}, { 50, 0x52, 7869, 168, 0}, { 57, 0x54, 4964, 169, 0}, { 0, 0x54, 4528, 172, 0}, { ...
*len = ARRAY_LENGTH(samples); return samples; } // DESCRIPTION: // This test stops in the middle of a deep sleep session. // - Test that we have an orarching Sleep session that starts around 75-90 and lasts // until we shuwn activity down // - Test that we have 2 full deep sleep sessions, and c...
r^2, m[i][1] = x } solution[2] = shift_factor[2] + sphere_determinant4x4(matrix, c00 * 2); rv = true; cleanup: for (int i = 0; i < N_SAMPS; i++) { kernel_free(matrix[i]); } kernel_free(matrix); return (rv); } // Earths magnetic field intensity ranges from 25uT (near the equator) to 65uT // (near the...
for (int i = 0; i < n_vals; i++) { if (vals[i] > max) { max = vals[i]; } else if (vals[i] < min) { min = vals[i]; } }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
settings_option_menu_push( title, OptionMenuContentType_SingleLine, index, &callbacks, ARRAY_LENGTH(s_intensity_labels), true /* icons_enabled */, s_intensity_labels, data)
; } // Timeout Settings ///////////////////////////// static const uint32_t s_timeout_values[] = { 3000, 5000, 8000 }; static const char *s_timeout_labels[] = { i18n_noop("3 Seconds"), i18n_noop("5 Seconds"), i18n_noop("8 Seconds") }; static int prv_timeout_get_selection_index() { uint32_t timeout_ms = back...
&& !struct_migration) { return; } struct prv_missed_events_s *missed_events = (struct prv_missed_events_s*)context; WakeupId wakeup_id; info->get_key(old_file, (uint8_t*)&wakeup_id, sizeof(WakeupId)); WakeupEntry entry; info->get_val(old_file, (uint8_t*)&entry, info->val_len); if (struct_migration)...
if (prv_compiled_without_utc_support()) { // Legacy apps get local time returned from the time() call. timestamp = time_local_to_utc(timestamp); }
time_t current_time = rtc_get_time(); int32_t time_difference = timestamp - current_time; WakeupId wakeup_id = s_wakeup_state.next_wakeup_id++; // Disallow scheduling past events if (time_difference <= 0) { return E_INVALID_ARGUMENT; } Uuid uuid = app_manager_get_current_app_md()->uuid; WakeupE...
_selection_complete(Animation *animation, bool finished, void *context) { MenuLayer *menu_layer = (MenuLayer *) context; menu_layer->animation.animation = NULL; } static bool prv_cancel_selection_animation(MenuLayer *menu_layer) { const bool result = animation_is_scheduled(menu_layer->animation.animation); if ...
if (menu_layer->center_focused) { return MenuRowAlignCenter; }
return align; } static void prv_menu_layer_update_selection_scroll_position(MenuLayer *menu_layer, MenuRowAlign scroll_align, bool animated) { scroll_align = prv_corrected_scroll_align(menu_laye...
ine_ellipsis_clip_across_ny_descender); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_ny_descender.${BIT_DEPTH_NAME}.pbi")); // Ellipsis tests test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_x.${BIT_DEPTH_NAME}.pbi")
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_outside_ny); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_ny.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb...
return (start_time != end_time); } // Converts the sensor time from the BMI160 captured at the time the sample // was collected to the actual system time static uint64_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_colle...
BMI160_DBG("0x%"PRIx8" = 0x%"PRIx8, addr, bmi160_read_reg(addr))
mationStartedHandler) animation_started, .stopped = (AnimationStoppedHandler) animation_stopped, }, NULL /* callback data */); PropertyAnimation *a_rev = property_animation_clone(a); animation_set_handlers((Animation*) a_rev, (AnimationHandlers) { .started = (AnimationStartedHandler) animation_started, ...
(seq, (Animation *)c, prv_create_custom_animation(), NULL)
; animation_schedule(s_animation); } static void deinit(void) { animation_destroy(s_animation); window_stack_remove(window, false); window_destroy(window); text_layer_destroy(s_text_layer_a); } int main(void) { init(); app_event_loop(); deinit(); }
olor color) { const Fixed_S16_3 x1_fixed = (Fixed_S16_3) { .integer = x1 }; const Fixed_S16_3 x2_fixed = (Fixed_S16_3) { .integer = x2 }; prv_assign_horizontal_line_raw(&ctx->dest_bitmap, y, x1_fixed, x2_fixed, color); } void test_graphics_draw_core__assign_horizontal_line_raw(void) { GContext ctx; test_grap...
prv_assign_vertical_line_raw(&ctx->dest_bitmap, x, y1_fixed, y2_fixed, color)
; } void test_graphics_draw_core__assign_vertical_line_raw(void) { GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1); prv_draw_vline_test_pattern(&ctx, prv_vline_pattern_assign_vertical_line_raw); cl_check(gbitmap_pbi_eq(&ctx.de...
map_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 5); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi"))
; // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 4 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 4); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offs...
_t buffer[buffer_size]; \ DictionaryIterator it; \ const DictionaryResult result = \ dict_serialize_tuplets_to_buffer_with_iter(&it, tuplets, ARRAY_LENGTH(tuplets), \ buffer, &buffer_size); \ cl_assert_equal_i(DICT_OK, result); \ if (s_received_...
prv_init_api(false /* start_connected */)
; prv_simulate_transport_connection_event(true /* is_connected */); RCV_DUMMY_CHUNK(); // https://pebbletechnology.atlassian.net/browse/PBL-42466 // TODO: assert that app message was NACK'd // Expect responding with a ResetRequest: EXPECT_OUTBOX_RESET_REQUEST(); EXPECT_OUTBOX_MESSAGE_PENDING(TupletBytes...
/* * 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...
(searching_for_uuid, found_uuid)
; } static AnalyticsHeartbeatList *prv_app_node_create(const Uuid *uuid) { AnalyticsHeartbeatList *app_heartbeat_node = kernel_malloc_check(sizeof(AnalyticsHeartbeatList)); list_init(&app_heartbeat_node->node); app_heartbeat_node->heartbeat = analytics_heartbeat_app_create(uuid); return app_heartbeat_node; }...
(heap_info_ptr < heap->end)) { prv_sanity_check_block(heap, heap_info_ptr); /* Check to see if the current entry is free and is large*/ /* enough to hold the data being requested. */ if (heap_info_ptr->is_allocated || (heap_info_ptr->Size < n_units)) { /* If the requested size is l...
memcpy(new_ptr, ptr, MIN(nbytes, original_size))
; heap_free(heap, ptr, client_pc); } return new_ptr; } void* heap_zalloc(Heap* const heap, size_t size, uintptr_t client_pc) { void *ptr = heap_malloc(heap, size, client_pc); if (ptr) { memset(ptr, 0, size); } return ptr; } void* heap_calloc(Heap* const heap, size_t count, size_t size, uintptr_t c...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ModalPriorityCritical)
t_discovery__watchdog_error_out_after_max_retries(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); prv_fire_watchdog_timeouts(&device, GATT_CLIENT_DISCOVERY_MAX_RETRY); } void test_gatt_client_discov...
list_count(&connection->gatt_remote_services->node)
>= TransportID1 && i <= TransportID3); return s_transport_uuid[i]; } static CommSessionTransportType prv_get_type(struct Transport *transport) { return CommSessionTransportType_QEMU; } static const TransportImplementation s_transport_imp = { .send_next = prv_send_next, .close = prv_close, .reset = prv_rese...
comm_session_get_by_type(CommSessionTypeApp)
, session); comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection); fake_system_task_callbacks_invoke_pending(); // get dls called cl_assert_equal_b(s_dls_private_handle_disconnect_called, false); cl_assert_equal_b(s_comm_session_event_put, false); } void test_session__last_system_session_...
.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_ADVA...
cl_assert(layout.box.size.w == box.size.w)
; cl_assert_equal_i(layout.max_used_size.w, 4 * HORIZ_ADVANCE_PX); // 3 lines - one line extra being layed out so that it will clip ("Jr\nWho-\npper") cl_assert_equal_i(layout.max_used_size.h, 3 * (FONT_HEIGHT + FONT_LINE_DELTA)); graphics_text_layout_get_max_used_size(&gcontext, "JR Whopper 123", font, box, G...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
test_graphics_context_init(&s_ctx, fb)
{ graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_round_rect(ctx, &GRect(4, -5, 18, 10), 4, GCornersAll); } void corners_all_update_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_colo...
layer_set_update_proc(&layer, &corners_clipped_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_clipped.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_fill_rect_${BIT_DEPTH_NAME}__color(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 32, 24)); layer_set_up...
_Paused); } prv_unlock(); return true; } // --------------------------------------------------------------------------------------- bool workout_service_stop_workout(void) { bool rv = true; prv_lock(); { if (!workout_service_is_workout_ongoing()) { PBL_LOG(LOG_LEVEL_WARNING, "No workout in progre...
prv_lock()
; if (!type_out || !workout_service_is_workout_ongoing()) { rv = false; } else { if (type_out) { *type_out = s_workout_data.current_workout->type; } } prv_unlock(); return rv; } // --------------------------------------------------------------------------------------- bool workout_service_g...
t_Liftoff); cl_assert_equal_b(updated, true); cl_assert_equal_i(rec_event, RecognizerEvent_Completed); r->state = RecognizerState_Possible; updated = false; new_state = RecognizerState_Started; recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_Touchdown }); cl_assert_equal_i(last_touch_...
recognizer_should_evaluate_simultaneously(NULL, r2)
); cl_assert(!recognizer_should_evaluate_simultaneously(r1, r2)); recognizer_set_simultaneous_with(r1, prv_simultaneous_with_cb); cl_assert(!recognizer_should_evaluate_simultaneously(NULL, NULL)); cl_assert(!recognizer_should_evaluate_simultaneously(r1, NULL)); cl_assert(!recognizer_should_evaluate_simultane...
/* * 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...
(base, filename, len)
; base[len] = '\0'; return len; } // Reset the graphics context, fill the background color and center the drawing box according to the // bounds provided static void prv_setup_context(GContext *ctx, GSize bounds) { // just a fake FB so that we can successfully call _context_init() // the actual pixel data we w...
SART_ISR_FE) != 0, .noise_detected = (errors & USART_ISR_NE) != 0, }; return flags; } bool uart_is_rx_ready(UARTDevice *dev) { return dev->periph->ISR & USART_ISR_RXNE; } bool uart_has_rx_overrun(UARTDevice *dev) { return dev->periph->ISR & USART_ISR_ORE; } bool uart_has_rx_framing_error(UARTDevice *dev...
(should_context_switch)
; } void uart_clear_all_interrupt_flags(UARTDevice *dev) { dev->periph->RQR |= USART_RQR_RXFRQ; dev->periph->ICR |= USART_ICR_ORECF; } // DMA //////////////////////////////////////////////////////////////////////////////// void uart_start_rx_dma(UARTDevice *dev, void *buffer, uint32_t length) { dev->periph->C...
uration_s, distance_m, bpm; HRZone hr_zone; cl_assert(workout_service_start_workout(ActivitySessionType_Run)); prv_inc_time(10); prv_inc_steps_and_put_event(10); prv_put_bpm_event(100, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, ...
cl_assert_equal_i(bpm, 0)
; cl_assert(workout_service_stop_workout()); } // --------------------------------------------------------------------------------------- void test_workout_service__receive_offwrist_reading(void) { int32_t steps, duration_s, distance_m, bpm; HRZone hr_zone; cl_assert(workout_service_start_workout(ActivitySes...
{ if (!prv_get_notification(item_out, &header, fd)) { PBL_LOG(LOG_LEVEL_ERROR, "Could not retrieve notification with id %s and size %u", uuid_string, header.payload_length); rv = false; } }
prv_file_close(fd); return rv; } //! @return is_advanced static bool prv_iter_next(NotificationIterState *iter_state) { int result = pfs_read(iter_state->fd, (uint8_t *)&iter_state->header, sizeof(iter_state->header)); // Restore flags & status iter_state->header.common.flags = ~iter_state->header.commo...
nclude "kernel/util/sleep.h" #include "services/common/bluetooth/bt_compliance_tests.h" #include "services/common/new_timer/new_timer.h" #include "services/common/system_task.h" #include "system/passert.h" #include "system/reboot_reason.h" #include "system/reset.h" EventServiceInfo bt_state_change_event_info; typedef...
window_set_overrides_back_button(window, true)
; TextLayer *title = &data->title; text_layer_init(title, &window->layer.bounds); text_layer_set_font(title, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); text_layer_set_text(title, "BT Test Mode"); layer_add_child(&window->layer, &title->layer); TextLayer *status = &data->status; text_layer_init(sta...
{ return false; } } return true; } bool attribute_group_deserialize(AttributeGroupType type, AttributeList *attr_list, void *group_ptr, uint8_t *buffer, uint8_t *buf_end, ...
if (type == AttributeGroupType_Action) { group_type_element_attribtue_list = prv_serialize_action( &((TimelineItemActionGroup *)group_ptr)->actions[i], &buffer); } else { group_type_element_attribtue_list = prv_serialize_address( &((AddressList *)group_ptr)->addresses[i], &buffer); ...
PBL_ASSERTN(buffer <= buf_end); buffer += attribute_list_serialize(group_type_element_attribtue_list, buffer, buf_end); } return buffer; } size_t attribute_group_serialize_payload(AttributeGroupType type, AttributeList *attr...
////////////////// #include "fake_rtc.h" #include "stubs_fonts.h" #include "stubs_layout_layer.h" #include "stubs_passert.h" #include "stubs_logging.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_rand_ptr.h" static uint8_t s_payload_complete[] = { // Attribute 1 0x01, ...
cl_assert(result < 0)
; } void test_timeline_item__deserialize_payload(void) { size_t buf_size = 18 + 9 + 64 + 8 + 5 + 5; char *buffer; TimelineItem *item = timeline_item_create(3, 2, (uint8_t[]) {1, 2}, buf_size, (uint8_t **)&buffer); timeline_item_deserialize_payload(item, buffer, buf_size, s_payload_complete, sizeof(s_payload_co...