prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * 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...
app_timer_cancel(workout_glance->timer)
; } app_free(workout_glance); } static bool prv_set_glance_icon(LauncherAppGlanceWorkout *workout_glance, uint32_t new_icon_resource_id) { if (workout_glance->icon_resource_id == new_icon_resource_id) { // Nothing to do, bail out return false; } // Destroy the existin...
/* * 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...
fileops(FO_DELETE, _source, NULL)
; } static void fs_copy(const char *_source, const char *_dest) { fileops(FO_COPY, _source, _dest); } void cl_fs_cleanup(void) { fs_rm(fixture_path(_clar_path, "*")); } #else #ifdef EMSCRIPTEN #include <emscripten/emscripten.h> // fork() is not supported by Emscripten, so try to use Node's child_process.execSync ...
l, &s_parsed_msg.msrmt.num_types, s_parsed_msg.msrmt.types, &s_parsed_msg.msrmt.num_samples, s_parsed_msg.msrmt.offset_sec, &s_parsed_msg.msrmt.num_values, s_parsed_msg.msrmt.values); if (!success) { LOG("No encoded msg available"); } else { LOG("ProtobufLogType: %d", s_p...
LOG(" Uuid: %s", uuid_str)
; LOG(" time_utc: %"PRIu32", created_time_utc: %"PRIu32", utc_to_local: %"PRIi32"", event->time_utc, event->created_time_utc, event->utc_to_local); LOG(" duration: %"PRIu32, event->duration); // Activity Event if (event->type == pebble_pipeline_Event_Type_ActivitySessionEve...
t_ms + duration/2); cl_assert(abs((int32_t)value - (int32_t)mid_value) < 10); // End prv_advance_to_ms_with_timers(start_ms + duration + MIN_FRAME_INTERVAL_MS*2); cl_assert_equal_i(value, end_value); #endif } // -------------------------------------------------------------------------------------- // Test a...
{ DPRINTF("%"PRIu64": Unscheduling now\n", prv_now_ms()); animation_unschedule(h); stopped_at_r = layer.frame; unschedule_time = prv_now_ms(); }
} // Make sure the frame stopped at the state it was in when we unscheduled it cl_assert_equal_point(layer.frame.origin, stopped_at_r.origin); // Make sure our started and stopped handlers got called at cl_assert_equal_i(s_started_handler_calls.num_calls, 1);; cl_assert(s_started_handler_calls.entries[0]...
no one has fudged with the order and the fallback/default PBL_ASSERTN(s_window_timeouts_ms[DEFAULT_IDX] == NOTIF_WINDOW_TIMEOUT_DEFAULT); const uint32_t timeout_ms = alerts_preferences_get_notification_window_timeout_ms(); for (size_t i = 0; i < ARRAY_LENGTH(s_window_timeouts_ms); i++) { if (s_window_timeou...
settings_menu_reload_data(SettingsMenuItemNotifications)
; } static void prv_settings_notifications_event_handler(PebbleEvent *event, void *context) { switch (event->type) { case PEBBLE_BATTERY_CONNECTION_EVENT: // Redraw the menu so that the Vibration status will be re-rendered. settings_menu_mark_dirty(SettingsMenuItemNotifications); break; def...
/* * 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_ALWAYS, "Dialog: Rebooted due to StackOverflow")
; break; case RebootReasonCode_DialogPlatformReset: PBL_LOG(LOG_LEVEL_ALWAYS, "Dialog: Rebooted due to DialogPlatformReset: error 0x%"PRIx32, reason.extra); break; case RebootReasonCode_CoreDumpReentered: PBL_LOG(LOG_LEVEL_ALWAYS, "Dialog: Re-entered core dump. Possibly val...
entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); // Complete spawn prv_advance_to_ms_with_timers(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 2); cl_...
(inner_seq, 0)
strncpy(timezone_abbr, sys_tz, TZ_LEN); } struct tm *sys_gmtime_r(const time_t *timep, struct tm *result) { return gmtime_r(timep, result); } struct tm *sys_localtime_r(const time_t *timep, struct tm *result) { return localtime_r(timep, result); } // Tests //////////////////////////////////// void test_pbl_s...
pbl_memcpy(&to, &from, -sizeof(from))
; cl_assert_equal_i(to, 0); } void test_pbl_std__verify_difftime_double_conversion(void) { // Can only test positive diffs because of 64 bit vs 32 bit time_t cl_assert_equal_i(pbl_override_difftime(30, 10), 20); cl_assert_equal_i(pbl_override_difftime(22222222, 1), 22222222 - 1); cl_assert_equal_i(pbl_overri...
_r4_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix left corners PBL-15915 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 5, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r5_aa_no_clip.${BIT_...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1)
; graphics_fill_round_rect(&ctx, &ORIGIN_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...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERT((addr & (SUBSECTOR_SIZE_BYTES - 1)) == 0, "Sections must be subsector aligned! addr is 0x%" PRIx32, addr)
har *message) { uint8_t *resp = pulse_reliable_send_begin(PULSE2_BULKIO_PROTOCOL); resp[0] = BULKIO_RESP_MALFORMED_CMD; size_t message_len = strlen(message) + 1; memcpy(resp + 1, message, message_len); size_t response_len = sizeof(*resp) + message_len; size_t command_len = MIN(length, PULSE_MAX_SEND_SIZE...
{ prv_respond_internal_error(cmd, length, ret); }
return; } OpenResponse *resp = pulse_reliable_send_begin(PULSE2_BULKIO_PROTOCOL); resp->opcode = BULKIO_RESP_DOMAIN_OPEN; resp->fd = fd; pulse_reliable_send(resp, sizeof(*resp)); } static void prv_handle_close(Command *cmd, size_t length) { PulseTransferFD *pulse_fd = prv_get_fd(cmd, length); if (...
cular_buffer_read(&buffer, &client2, 1, &out_buffer, &out_length)); // Fill with data cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "123456", 6, false)); // Read different amounts from each client cl_assert(shared_circular_buffer_read(&buffer, &client1, 4, &out_buffer, &out_length)); cl_assert(...
shared_circular_buffer_write(&buffer, storage, 2, false)
); cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 2); // Consume it prv_read_and_consume(&buffer, &client, storage, 2); cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 0); } void test_shared_circular_buffer__subsampling_2of5(void) { ...
et_bw(GColorBlue).argb); cl_assert_equal_i(GColorWhiteARGB8, gcolor_get_bw(GColorTiffanyBlue).argb); cl_assert_equal_i(GColorBlackARGB8, gcolor_get_bw(GColorOrange).argb); } static void prv_test_get_luminance(GColor8 color_to_test, GColor8Component expected_luminance) { cl_assert_equal_i(gcolor_get_luminance(col...
(GColorRed, GColorBlack, GColorLightGray)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(BITS_BETWEEN(0, 4), erased_sector)
; cl_assert(flash_locked); } void test_system_flash__erase_full_flash(void) { cl_assert(system_flash_erase(FLASH_BASE, 1024 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 11), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_sector_0(void) { cl_assert(system_flash_erase(FLASH_B...
; } return icon; } static bool prv_app_resource_info_equal(const AppResourceInfo *a, const AppResourceInfo *b) { PBL_ASSERTN(a && b); return ((a == b) || ((a->res_id == b->res_id) && (a->res_app_num == b->res_app_num))); } static void prv_generic_glance_set_icon(LauncherAppGlanceGeneric *generic_glance, ...
(generic_glance)
; // Notify the service that the glance changed launcher_app_glance_structured_notify_service_glance_changed(structured_glance); } static void prv_update_subtitle_template_string_reeval_timer_if_necessary( LauncherAppGlanceStructured *structured_glance, time_t new_reeval_time) { LauncherAppGlanceGeneric *g...
NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw1_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 2 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLI...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); #endif } #define BOX_SIZE 8 #define CLIP_RECT_DRAW_BOX GRect(10, 10, 140, 30) #define CLIP_RECT_CLIP_BOX GRect(10, 10, 120, 2*BOX_SIZE + 4) #define CLIP_RECT_RECT_BOX GRect(0, 0, BOX_SIZE, BOX_SIZE) #define CLIP_OFFSET 40 // yoffset if used to allow for multiple test cases to be drawn and tested on the same test ...
attr ? (Uuid *)uuid_attr->data : NULL; if (result != VoiceEndpointResultSuccess) { voice_handle_dictation_result(result, session_id, NULL, app_initiated, app_uuid); return false; } if (attr_list->num_attributes == 0) { PBL_LOG(LOG_LEVEL_WARNING, "No attributes in message"); voice_handle_dictatio...
PBL_LOG(LOG_LEVEL_WARNING, "Invalid size for session setup result message")
; } break; } case MsgIdDictationResult: { if (size >= sizeof(VoiceSessionResultMsg)) { VoiceSessionResultMsg *msg = (VoiceSessionResultMsg *) data; prv_handle_dictation_result(msg, size); } else { PBL_LOG(LOG_LEVEL_WARNING, "Invalid size for dictation result messa...
/* * 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...
{ GRect bounds = item_layer->timeline_layout->layout_layer.layer.bounds; bounds.origin.y = 0 - item_layer->scroll_offset_pixels; layer_set_bounds((Layer *)item_layer->timeline_layout, &bounds); }
} /////////////////////////////////////////////////////////// // Scrolling related functions /////////////////////////////////////////////////////////// static int16_t prv_get_first_scroll_offset(TimelineItemLayer *item_layer) { if (!item_layer->timeline_layout->has_page_break) { return 0; } return MAX(prv...
ONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" #include "ap...
test_graphics_context_init(&ctx, fb)
; // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_WIDTH); graphics_draw_line(&ctx, START_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_...
STEM_CE_MARK); gbitmap_init_with_resource(&cd->weee_mark, RESOURCE_ID_SYSTEM_WEEE_MARK); gbitmap_init_with_resource(&cd->r_mark, RESOURCE_ID_SYSTEM_R_MARK); gbitmap_init_with_resource(&cd->t_mark, RESOURCE_ID_SYSTEM_T_MARK); gbitmap_init_with_resource( &cd->aus_rcm_mark, RESOURCE_ID_SYSTEM_AUS_RCM_MARK); ...
(&data->certification_data.t_mark)
; gbitmap_deinit(&data->certification_data.aus_rcm_mark); gbitmap_deinit(&data->certification_data.nom_nyce_mark); app_free(data->certification_data.regulatory_marks); app_free(data->certification_data.menu_items); prv_deinit_status_bar(&data->status_layer); } static void prv_certification_window_push(Sett...
(vibe_intensity_get())
; analytics_set(ANALYTICS_DEVICE_METRIC_SETTING_VIBRATION_STRENGTH, strength, AnalyticsClient_System); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ graphics_context_set_fill_color(ctx, colors->primary_color); }
graphics_fill_rect(ctx, &hr_box); } if (size_out) { *size_out = hr_box.size; } } static GTextNode *prv_horizontal_rule_constructor(const LayoutLayer *layout_ref, const LayoutNodeConstructorConfig *config) { GTextNodeCustom *custom_node = graphics_tex...
return pdTRUE; } UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) { return 0; } void vQueueDelete( QueueHandle_t xQueue ) { } void watchface_set_default_install_id(AppInstallId id) { } void compositor_reset_app_framebuffer_ownership(void) { } const char *app_install_get_custom_app_name(AppInstal...
cl_assert(app_manager_get_current_app_md() == (PebbleProcessMd*) &s_third_party_app)
248, 1368, -600}, { 320, 776, -472}, { 160, 912, -560}, { 184, 672, -552}, { 288, 544, -512}, { 216, 616, -552}, { 168, 512, -560}, { 72, 536, -512}, { 80, 616, -592}, { 112, 568, -552}, { 280, 480, -488}, { 608, 648, -584}, { 800, 472, -496}, { 1112, 424, -344}, ...
{ 1072, 664, 40}, { 1336, 736, -104}, { 1152, 600, -136}, { 928, 568, -200}, { 1128, 624, -24}, { 1552, 624, 8}, // 51 seconds { 1504, 408, 104}, { 1408, 232, 160}, { 1368, 72, 112}, { 1296, 104, -8}, { 1192, 112, -56}, { 1000, 168, -96}, { 968, 112, -72}, { 1...
{ 1016, 1464, 336}, { 720, 1216, 304}, { 472, 472, 88}, { 240, 408, -160}, { 104, 272, -616}, { -200, -8, -656}, { -712, 192, -400}, { -688, 584, -240}, { -520, 440, -368}, { -560, 560, -528}, { -688, 624, -408}, { -616, 264, -368}, { -544, -56, -384}, { -632, -1...
const char *name; size_t size; }; static struct file_description descriptions[] = { // this first set of files match some I found on my snowy bb2 {"gap_bonding_db", 8102}, {"pmap", 5632}, {"pindb", 57095}, {"appdb", 32603}, {"reminderdb", 57090}, {"appcache", 8108}, {"alarms", 8110}, {"notifpref",...
ARRAY_LENGTH(descriptions)
; ++i) { prv_check_file_exists(descriptions[i].name); } }
slave); } void spi_slave_set_frequency(const SPISlavePort *slave, uint32_t frequency_hz) { slave->spi_bus->state->spi_clock_speed_hz = frequency_hz; prv_spi_slave_init(slave); } void spi_slave_wait_until_idle_blocking(const SPISlavePort *slave) { while (prv_spi_get_flag_status(slave->spi_bus, SpiI2sFlag_BSY)) c...
(slave->slave_state->initialized)
; PBL_ASSERTN(slave->slave_state->acquired); const uint8_t *outp = out; uint8_t *inp = in; for (size_t n = 0; n < len; ++n) { uint8_t byte_out = outp ? *(outp++) : 0; uint8_t byte_in = spi_ll_slave_read_write(slave, byte_out); if (inp) { *(inp++) = byte_in; } } } void spi_ll_slave_burst...
tic void prv_handle_call_end(bool disconnected) { if (!disconnected) { analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_END_COUNT, AnalyticsClient_System); } if (s_call_in_progress) { prv_call_end_common(); phone_ui_handle_call_end(false /*call accepted*/, disconnected); } else if (!disconnected) {...
(s_call_identifier)
; } } void phone_call_decline(void) { analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_DECLINE_COUNT, AnalyticsClient_System); PBL_LOG(LOG_LEVEL_INFO, "Call declined"); if (prv_call_is_ancs()) { ancs_perform_action(s_call_identifier, ActionIDNegative); ancs_phone_call_temporarily_block_missed_calls();...
apng_fctl fctl = {0}; // Defaults work for IDAT frame without fctl data // If this frame doesn't have fctl, use the full width & height if (!upng_get_apng_fctl(upng, &fctl)) { fctl.width = width; fctl.height = height; // As a PNG image is only a single frame, display it forever bitmap_sequence->cur...
{ APP_LOG(APP_LOG_LEVEL_ERROR, APNG_UPDATE_ERROR); applib_free(buffer); }
return retval; } // total elapsed from start of animation bool gbitmap_sequence_update_bitmap_by_elapsed(GBitmapSequence *bitmap_sequence, GBitmap *bitmap, uint32_t elapsed_ms) { if (!bitmap_sequence) { return false; } // Disabled if play count is 0 and not...
/* * 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...
{ static const RockyGlobalAPI *const apis[] = { #if !APPLIB_EMSCRIPTEN &APP_MESSAGE_APIS, &CONSOLE_APIS, #endif &DATETIME_APIS, &GRAPHIC_APIS, #if !APPLIB_EMSCRIPTEN &MEMORY_APIS, &PREFERENCES_APIS, #endif &TICKSERVICE_APIS, #if !APPLIB_EMSCRIPTEN &TIMER_APIS, &WATCHINFO_APIS, ...
void rocky_api_deinit(void) { rocky_global_deinit(); }
prv_menu_layer_update_selection_highlight(menu_layer, up, animated, true); prv_menu_layer_update_selection_scroll_position(menu_layer, scroll_align, animated); // only call this here, on animated center focus, the announcement will happen in-between // as we change the selection index for real if (di...
if (it->count == 1) { MenuLayerSelectionWillChangeCallback cb = menu_layer->callbacks.selection_will_change; it->it.should_continue = false; it->did_change_selection = true; if (cb) { MenuIndex new_index = it->it.cursor.index; cb(menu_layer, &new_index, menu_layer->selection.index, menu_laye...
} void menu_layer_set_selected_next(MenuLayer *menu_layer, bool up, MenuRowAlign scroll_align, bool animated) { const MenuLayerBeforeSelectionChangeState before_state = prv_capture_state_and_cancel_center_focus_animation(menu_layer); MenuSelectNextIterator it = { .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...
window_set_on_screen(window, true, true)
8, 472, -320}, { 952, 384, -120}, { 1128, 496, -72}, { 1424, 472, -64}, { 1440, 368, 16}, { 1328, 160, 32}, // 54 seconds { 1264, 8, 72}, { 1200, -8, 0}, { 1088, 104, -16}, { 1000, 160, -64}, { 840, 192, -96}, { 1024, 160, -80}, { 1000, 152, -256}, { 928, 88, -96}...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_heather_19 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 85 //> TEST_EXPECTED_MAX 105 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { 584, -240, -1104}, { 1...
{ -160, 184, -952}, { -128, 200, -1072}, { -128, 200, -1136}, { -128, 264, -1144}, { -120, 256, -1096}, { -24, 376, -1008}, { 168, 344, -904}, { 368, 240, -736}, { 616, 312, -752}, { 752, 704, -456}, { 768, 696, -16}, { 824, 336, 160}, { 832, 376, 144}, { 1008, 5...
1000}, { -160, -128, -992}, { -160, -128, -992}, { -160, -144, -992}, { -160, -128, -984}, { -160, -128, -1000}, { -168, -136, -1000}, { -160, -136, -992}, { -160, -136, -992}, { -160, -128, -984}, { -160, -136, -992}, { -160, -136, -992}, { -160, -136, -992}, { -160,...
{ -152, -136, -992}, { -160, -120, -1000}, { -168, -136, -1000}, { -160, -120, -984}, { -160, -112, -992}, { -168, -120, -992}, { -168, -128, -992}, { -168, -128, -992}, // 248 seconds { -160, -120, -984}, { -160, -112, -1000}, { -168, -120, -1000}, { -168, -120, -984...
{ -160, -128, -992}, { -160, -128, -992}, { -168, -136, -1000}, { -160, -136, -992}, { -160, -128, -992}, { -160, -136, -1000}, { -160, -136, -992}, { -160, -136, -1000}, { -160, -136, -992}, { -160, -136, -992}, { -160, -136, -1000}, { -160, -136, -984}, { -160, -14...
sleep int32_t value; activity_get_metric(ActivityMetricSleepTotalSeconds, 1, &value); PBL_LOG(LOG_LEVEL_DEBUG, "sleep total: %"PRIi32" ", value); if (value < (60 * SECONDS_PER_MINUTE) || value > (100 * SECONDS_PER_MINUTE)) { passed = false; } prv_test_end(context, passed); } // ---------------------...
prv_test_end(context, passed)
key_len, uint8_t *val, int val_len) { cl_must_pass(settings_file_set(file, key, key_len, val, val_len)); verify(file, key, key_len, val, val_len); } void test_settings_file__set_get_one(void) { printf("\nTesting setting and retreiving a single key a single time...\n"); SettingsFile f...
(&file, "test_file_max_storage", max_used_space)
); uint8_t key[5]; int key_len = 4; uint8_t val[5]; int val_len = 4; for (int i = 0; i < 100; i++) { prv_print_stats(&file); snprintf((char *)key, sizeof(key), "k%03d", i); snprintf((char *)val, sizeof(val), "v%03d", i); printf("Iteration %d key %s val %s\n", i, key, val); set_and_verify(&...
*head = NULL; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 // check first timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000), 0); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check second cl_asse...
pin_db_insert_item(&s_long_items[i])
, 0); } } void test_timeline__long_middle_past(void) { prv_insert_long_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // initialize it to be 11 min after item cc has started timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head...
xecute_time <= rtc_get_time()) { CronJob *job = (CronJob*)s_scheduled_jobs; // Remove the job from the list, it's done. s_scheduled_jobs = list_pop_head(s_scheduled_jobs); // Release the mutex while we execute the callback mutex_unlock(s_list_mutex); job->cb(job, job->cb_data); mutex_lock(s...
mutex_unlock(s_list_mutex)
; return removed; } // --------------------------------------------------------------------------------------- // For Testing: void cron_clear_all_jobs(void) { mutex_lock(s_list_mutex); // Iterate over all the jobs to remove them all. for (ListNode* iter = s_scheduled_jobs; iter != NULL; ) { CronJob* jo...
reprehenderit ex incididunt.\" };\n"); } } //////////////////////////////////////////////////////////////////////////////// // .postMessage() Tests //////////////////////////////////////////////////////////////////////////////// #define SIMPLE_TEST_OBJECT "{ \"x\" : 1 }" static void prv_assert_simple_test_object_...
(raw_bytes_v1, buffer, expected_size)
; prv_rcv_app_message_ack(APP_MSG_OK); json_bytes_remaining -= json_bytes_size; } // Chunk 2: { const size_t json_bytes_size = MIN(TINY_CHUNK_SIZE, json_bytes_remaining); const size_t expected_size = sizeof(PostMessageChunkPayload) + json_bytes_size; const int payload_offset = expected_json_...
lse if (response_msg->response == ResponseNack) { ++s_nacks_received; } } void test_put_bytes__initialize(void) { fake_pb_storage_mem_reset(); fake_pb_storage_mem_set_crc(EXPECTED_CRC); fake_comm_session_init(); fake_event_reset_count(); Transport *transport = fake_transport_create(TransportDestinatio...
(event.put_bytes.failed, false)
; } void test_put_bytes__init_while_already_busy(void) { prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); assert_nack_count(1); } void test_put_bytes__init_too_large(void) { prv_receive_init(UINT_MAX, ObjectFirmware); // Fail due to massive total_siz...
2_t count_per_sec; } AnalyticsStopwatchNode; // Analytic Containers typedef struct { ListNode node; DialogAnalyticsMetric metric; uint32_t value; } AnalyticsNode; static ListNode *s_analytics_list = NULL; static ListNode *s_stopwatch_list = NULL; static PebbleRecursiveMutex *s_analytics_lock = NULL; // Locking...
{ analytics_stopwatch_start_at_rate(metric, MS_PER_SECOND); }
void analytics_stopwatch_stop(DialogAnalyticsMetric metric) { prv_lock(); AnalyticsStopwatchNode *stopwatch = prv_find_stopwatch_node(metric); if (stopwatch) { analytics_add(metric, prv_stopwatch_elapsed_ms(stopwatch, rtc_get())); list_remove(&stopwatch->node, &s_stopwatch_list, NULL); } prv_unlock(...
e I2C peripheral //! Lock the bus and peripheral config access before initialization static void bus_init(uint8_t bus_idx) { // Initialize peripheral I2C_InitTypeDef i2c_init_struct; I2C_StructInit(&i2c_init_struct); if (BOARD_CONFIG.i2c_bus_configs[bus_idx].clock_speed > I2C_NORMAL_MODE_CLOCK_SPEED_MAX) { //...
PBL_ASSERTN(s_initialized)
/* * 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...
reboot_reason_set(&reason)
; printf("ASSERT! lr=0x%lx\n", lr); reset_due_to_software_failure(); } NORETURN passert_rom_error_no_message_with_errortype(uint32_t error_type_stat) { RebootReason reason = { .code = RebootReasonCode_RomError, .extra = error_type_stat, }; reboot_reason_set(&reason); printf("RomErr! stat=0x%lx\n"...
0}, { 0, 0x47, 1665, 0x0}, // 990: Local time: 11:30:00 AM { 0, 0x48, 754, 0x0}, { 0, 0x36, 550, 0x0}, { 0, 0x45, 39, 0x0}, { 0, 0x35, 442, 0x0}, { 0, 0x45, 201, 0x0}, { 0, 0x45, 71, 0x0}, { 0, 0x45, 347, 0x0}, { 0, 0x45, 1255, 0x0}, { 0, 0x35, 183, 0x0}, { 0, 0x35, 239, ...
{ 69, 0x51, 6920, 0x0}, { 6, 0x57, 2104, 0x0}, { 0, 0x48, 475, 0x0}, { 10, 0x48, 523, 0x0}, { 8, 0x48, 278, 0x0}, { 0, 0x64, 882, 0x0}, { 0, 0x57, 1404, 0x0}, { 6, 0x85, 1975, 0x0}, { 0, 0x48, 153, 0x0}, // 1110: Local time: 01:31:00 PM { 0, 0x48, 809, 0x0}, { 6, 0x66, 20...
{ 13, 0x56, 2277, 0x0}, { 0, 0x47, 990, 0x0}, { 0, 0x67, 2957, 0x0}, { 0, 0x56, 2209, 0x0}, { 0, 0x67, 2653, 0x0}, { 7, 0x67, 1376, 0x0}, { 0, 0x57, 1182, 0x0}, { 0, 0x66, 1135, 0x0}, { 0, 0x66, 113, 0x0}, { 0, 0x66, 1805, 0x0}, { 0, 0x58, 328, 0x0}, { 0, 0x58, 257, 0x0}...
0x91, 0xf5, 0x01, 0x60, 0x0c, 0x9b, 0xdc, 0x59 }; static const Uuid music_uuid = {0x1f, 0x03, 0x29, 0x3d, 0x47, 0xaf, 0x4f, 0x28, 0xb9, 0x60, 0xf2, 0xb0, 0x2a, 0x6d, 0xd7, 0x57}; static const Uuid sports_uuid = {0x4d, 0xab, 0x81, 0xa6, 0xd2, 0xfc, 0x4...
app_install_get_entry_for_install_id(sports_id, &id_entry)
xcept in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY ...
gpio_input_read(&EWD1000->int_gpio)
) { if (rtc_get_ticks() > timeout) { PBL_CROAK("Touch controller didn't respond!"); } } } // Status Register Operations //////////////////////////////////////////////////////////////////////////////// #if 0 // TODO: this will be used to get FW information from the controller static void prv_status_re...
eq(bitmap, GET_PBI_NAME(3))); // Frame 3 has delay 1000 ms, frame 4 and 5 have zero delay, so at time 2000 ms == frame 5 gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 2 * 1000); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5))); // Since loop only equals 1, make sure that huge elapsed tim...
gbitmap_create_blank(gbitmap_sequence_get_bitmap_size(bitmap_sequence), GBitmapFormat1Bit)
; // We're interested in checking the following frames const int check_frames[] = { 1, 4, 23, 24, 25, 31, 75 }; int current_frame = 0; for (int i = 0; i < ARRAY_LENGTH(check_frames); ++i) { // Advance to the next frame we're interested in. for (; current_frame < check_frames[i]; ++current_frame) { ...
//! - Use private addresses for privacy / harder tracebility. #define GAP_LE_ADVERT_LOG_LEVEL LOG_LEVEL_DEBUG typedef struct GAPLEAdvertisingJob { ListNode node; //! The callback to call when this job is unscheduled. GAPLEAdvertisingJobUnscheduleCallback unscheduled_callback; //! The data to pass into the un...
{ return true; }
node = node->next; if (node == &s_jobs->node) { // wrapped around break; } } return false; } static void prv_increment_elapsed_time_for_job(GAPLEAdvertisingJob **job_ptr, bool *has_new_term) { GAPLEAdvertisingJob *job = *job_ptr; if (prv_is_current_term_infinite(job)) { return; }...
/* * 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 (length == 0) { // Empty string pstring = task_malloc_check(sizeof(uint16_t) + sizeof(char) * 1); pstring->str_length = length; pstring->str_value[0] = '\0'; } else { pstring = task_malloc_check(sizeof(uint16_t) + sizeof(char) * length); pstring->str_length = length; strncpy(pstring->st...
return pstring; } void pstring_destroy_pstring16(PascalString16 *pstring) { task_free(pstring); } void pstring_pstring16_to_string(const PascalString16 *pstring, char *string_out) { strncpy(string_out, pstring->str_value, pstring->str_length); string_out[(pstring->str_length)] = '\0'; } void pstring_string_...
ionNode *) list_find(head, prv_find_subscription_by_att_handle, (void *)(uintptr_t) att_handle); if (UNLIKELY(!subscription)) { // MT: I suspect this can be hit when the remote remembers the CCCD subscription state across // disconnections (while we don...
PBL_LOG(LOG_LEVEL_DEBUG, "No subscription and/or connection found for CCCD write response (%u)", error)
; return; } // Mask to mask out all tasks const PebbleTaskBitset task_mask_none = ~0; PebbleTaskBitset task_mask = task_mask_none; const bool has_error = (error != BLEGATTErrorSuccess); const BLESubscription type = has_error ? BLESubscriptionNone : prv_prevailing_subscri...
utes = attributes, }, .action_group = { .num_actions = ARRAY_LENGTH(actions), .actions = actions, } }; Uuid i2; uuid_generate(&i2); TimelineItem e2 = { .header = { .id = i2, .type = TimelineItemTypeNotification, .status = 0, .ancs_uid = 0, .layout = Lay...
(&uuids[j], &r)
); compare_notifications(&e, &r); free(r.allocated_buffer); // Fill up storage again for (++i; i < count + erase_count; i++) { e.header.id = uuids[i % count]; e.header.timestamp = timestamp + i; notification_storage_store(&e); cl_assert(notification_storage_get(&uuids[i % count], &r)); comp...
accel_running()) { accel_stop(); } } } mutex_unlock_recursive(s_mutex); } // ------------------------------------------------------------------------------------------- DEFINE_SYSCALL(void, sys_accel_manager_data_unsubscribe, AccelSessionRef session) { mutex_lock_recursive(s_mutex); { Ac...
(LOG_LEVEL_DEBUG, "result: %d", 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...
lis3dh_power_down()
; }
ondingID bonding_id = BT_BONDING_ID_INVALID; bt_lock(); // Find the Bonding ID for the LE connection that supports PPoGATT: GAPLEConnection *connection = gap_le_connection_by_device(gateway_device); // It's possible the connection is gone in the mean time; this runs on KernelMain. if (connection) { bondin...
// This message should help us determine if iOS is publishing the service PBL_LOG(LOG_LEVEL_INFO, "Found an instance of %s at 0x%"PRIx16"-0x%"PRIx16"!", client->debug_name, range.start, range.end); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Found an instance of %s at 0x%"PRIx16"-0x...
} static void prv_handle_gatt_service_discovery_event(const PebbleBLEGATTClientServiceEvent *event) { PebbleBLEGATTClientServiceEventInfo *event_info = event->info; if (event_info->status == BTErrnoServiceDiscoveryDisconnected) { // TODO: In the past we'd disconnect when service discovery // failed (not d...
ure features, HRMSubscriberCallback callback, void *context) { cl_assert_equal_p(NULL, callback); // we're using the event service cl_assert_equal_i(features, HRMFeature_BPM); ++s_hrm_manager_subscribe_with_callback_call_count; s_last_session_ref = ++s_next_sess...
device_from_le_connection(&s_conn_b)
; ble_hrm_init(); } void test_ble_hrm__init_deinit_no_subscriptions(void) { // let cleanup & initialize do the work :) } static void prv_assert_permissions_ui_and_respond(bool is_granted) { cl_assert(s_last_sharing_request); ble_hrm_handle_sharing_request_response(is_granted, s_last_sharing_request); s_las...
veSeconds, start_of_today, start_of_today + (9 * SECONDS_PER_HOUR), HealthServiceTimeScopeDailyWeekdayOrWeekend); cl_assert_equal_i(value, exp_value); // --- // Compute weekend step average from 4am to 9am. This ...
(123, result)
; // This is the equivalent to `peek_value` with HeartRateBPM. Make sure it is equal. result = health_service_aggregate_averaged(HealthMetricHeartRateBPM, now_utc - 60, now_utc - 60, HealthAggregationAvg, HealthServiceTimeSco...
/* * 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...
app_state_get_window_stack()
; GContext *ctx = app_state_get_graphics_context(); if (!window_stack_is_animating(stack)) { SYS_PROFILER_NODE_START(render_app); window_render(app_window_stack_get_top_window(), ctx); SYS_PROFILER_NODE_STOP(render_app); } else { // TODO: PBL-17645 render container layer instead of the two windows...
/* * 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...
(LOG_LEVEL_DEBUG, "ANCS notification already dismissed, dismissing again: %"PRIu32, notification->header.ancs_uid)
; prv_dismiss_notification(notification); } notification->header.status = existing_header->status; notification->header.id = existing_header->id; // Replace existing version of the notification notification_storage_remove(&notification->header.id); notification_storage_store(notification); // we wo...
tNodeText *number_text_node = health_util_create_text_node(buffer_size, number_font, TEXT_COLOR, container); active_window->workout_controller->metric_to_string(metric_type, (char *)number_text_node->text, buffer_size, i18n_owner, acti...
(ctx, icon, rect)
; } if (size_out) { *size_out = rect->size; } } static void prv_draw_heart_node_callback(GContext *ctx, const GRect *box, const GTextNodeDrawConfig *config, bool render, GSize *size_out, void *user_data) { WorkoutActiveWindow...
tedTimeUTC, 1, &last_update_utc); cl_assert_equal_i(last_median, 51); cl_assert(last_update_utc >= rtc_get_time() - 1); cl_assert(last_update_utc <= rtc_get_time()); // Reset the stats, the median should be 0 activity_metrics_prv_reset_hr_stats(); activity_metrics_prv_get_median_hr_bpm(&median, &total_weig...
cl_assert_equal_i(metric_values[6], 3333)
st, rest is blue. void test_bitblt__bitmap_into_bitmap_sub_bitmap(void) { GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__bitmap_into_bitmap_sub_bitmap.8bit.pbi"); GBitmap cropped_src_bitmap; gbitmap_init_as_sub_bitmap(&cropped_src_bitmap, src_bitmap, (GRect) { { 0, 2 }, src_bitmap->bounds.size })...
cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_black_on_white-expect.1bit.pbi"))
; // Destination Black memset(dest_data, 0b00000000, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorClear); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_black_on_black-expect.1bit.pbi")); memset(dest_data, 0b00000000, size...
tributed 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 "resource.h" #include "resource_storage.h" #include "resource_storage_builtin.h" #include "reso...
PBL_LOG(LOG_LEVEL_DEBUG, "Tried to read past end of resource, reading %d bytes", (int)num_bytes)
; } size_t bytes_read = resource_storage_read(&resource, offset, buffer, num_bytes); mutex_unlock_recursive(s_resource_mutex); return bytes_read; } size_t resource_size(ResAppNum app_num, uint32_t resource_id) { mutex_lock_recursive(s_resource_mutex); ResourceStoreEntry resource; prv_get_resource(app_nu...
_grey, light_grey, transparent) // Tests 1-bit jazzberry_jam colored palettized PNG loading into gbitmap // tests covers an old bug in image tooling where 1 color was 2 power 0 // so bitdepth was detected as 0 (incorrectly) // Result: // - gbitmap matches platform loaded PNG void test_png__color_1_bit_jazzberry_jam...
TEST_PBI_FILE_FMT(1bitpalette)
)); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat1BitPalette); } // Tests 2-bit greyscale PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__greyscale_2_bit(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(2bitpalette)); cl_assert(gbitmap_pbi_eq(...
096, -464}, { 464, 1320, -496}, { 760, 1096, -608}, { 552, 936, -544}, { 376, 936, -432}, { 184, 784, -352}, { 40, 672, -296}, { -40, 632, -232}, { -128, 648, -184}, { -152, 744, -232}, { -152, 832, -296}, { -176, 864, -304}, { -192, 944, -296}, { -168, 968, -312}, ...
{ 248, 1120, -536}, { 416, 1176, -656}, { 560, 992, -688}, { 368, 992, -616}, { 272, 912, -616}, { 208, 672, -544}, { 72, 592, -536}, { -128, 560, -712}, { -168, 216, -688}, { -104, 336, -784}, { -32, 336, -856}, // 16 seconds { -24, 216, -816}, { -8, 256, -872}, ...
{ 880, 120, -624}, { 744, 480, -584}, { 848, 688, -576}, { 912, 584, -376}, { 1272, 504, -216}, { 1424, 672, -336}, { 1384, 512, -216}, { 1440, 456, -128}, { 1512, 400, -128}, { 1256, 264, -120}, { 992, 240, -120}, { 864, 216, -152}, { 816, 144, -120}, { 824, 136...
if (is_system && (session->destination == TransportDestinationHybrid)) { // For Android, if the app is connected, PebbleKit should be // working as well prv_put_comm_session_event(true, false); } return session; } // ------------------------------------------------------------------------------------...
{ prv_send_next(session, false /* is_callback */); }
//! For unit test //! bt_lock() is expected to be taken by the caller! bool comm_session_send_next_is_scheduled(CommSession *session) { return session->is_send_next_call_pending; } // ------------------------------------------------------------------------------------------------- // Interface towards the system /...
ribute_list)); cl_assert(result == 9); cursor = s_invalid_serialized_attribute_list; result = attribute_get_buffer_size_for_serialized_attributes(3, &cursor, (uint8_t *)s_invalid_serialized_attribute_list + sizeof(s_invalid_serialized_attribute_list)); cl_assert(result < 0); } void test_timeline_i...
cl_assert_equal_s("", string_list_get_at(list, 1))
; cl_assert_equal_s("", string_list_get_at(list, 2)); cl_assert_equal_s("", string_list_get_at(list, 3)); // non-null-terminated string is treated as one string - this is the standard case // please note that the string will only be terminated if there's another \0 following // when deserializing the data, t...
app(&(AppLaunchConfig) { .md = app_fetch_ui_get_app_info(), .common.args = fetch_args, .common.transition = fetch_args->common.transition, .forcefully = fetch_args->forcefully, }); } // ----------------------------------------------------------------------------------------- static AppInstallId prv_g...
if (!s_app_task_context.app_md) { // No app has been started yet, so just use the default system size *size = GSize(DISP_COLS, DISP_ROWS); return; }
{ 1096, 304, 216}, // 99 seconds { 1032, 240, 128}, { 1032, 256, 32}, { 1048, 184, 8}, { 1064, 168, 64}, { 1072, 120, 104}, { 1064, 80, 128}, { 1024, 40, 136}, { 1024, 104, 136}, { 1032, 136, 136}, { 1040, 208, 72}, { 1056, 240, 40}, { 1008, 240, 0}, { 1000, 264, ...
{ 944, 136, -160}, { 1032, 160, -232}, { 1040, 280, -312}, { 1208, 232, -408}, { 1576, 96, -456}, { 1272, 8, -208}, { 968, -80, -8}, { 928, -8, 8}, { 944, -64, 88}, { 1008, 0, 136}, // 105 seconds { 1160, 16, 160}, { 1184, 0, 168}, { 1048, 16, 104}, { 960, 40,...
{ 1080, -144, 72}, { 1072, -224, -56}, { 1128, -152, -128}, { 1016, 0, -64}, { 1056, 0, 48}, { 1064, 64, 32}, { 1000, 112, 40}, { 952, 152, -48}, { 960, -8, -80}, { 1000, -32, -184}, { 1000, 72, -264}, { 1000, 152, -384}, { 976, 120, -344}, { 944, 112, -304}, ...
(sizeof(PebbleProtocolHeader) - i, length_available)
; } else { cl_assert_equal_i(length - i, length_available); } // Test the `copy` implementation: uint8_t byte_out = 0xff; cl_assert_equal_i(1, comm_session_send_queue_copy(s_app_session_ptr, 0 /* offset */, 1 /* length */, &byte_out)); ...
(id1, 10, 30, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule)
; // 2 pins should be added (for Thursday / Friday) cl_assert_equal_i(s_num_timeline_adds, 2); id2 = alarm_create(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule); cl_assert_equal_i(s_num_timeline_add...
d *data), void *data) { // Simple fake, can only handle one call cl_assert_equal_p(s_launcher_task_callback, NULL); s_launcher_task_callback = callback; s_launcher_task_callback_data = data; } // Tests: Disover AMS /////////////////////////////////////////////////////////// #define NUM_AMS_INSTANCES 2 static ...
{ // AMS Found: prv_discover_ams(1 /* num_instances */); // AMS Disappeared: prv_discover_ams(0 /* num_instances */); // Verify ams.c cannot handle the previous characteristics any more: prv_assert_can_handle_characteristics(0, false /* expect_can_handle */); }
ansport.status_remote)); PBL_LOG(LOG_LEVEL_DEBUG, "->IN:"); PBL_HEXDUMP(LOG_LEVEL_DEBUG, (uint8_t *)&s_spi_transport.status_remote, sizeof(s_spi_transport.status_remote)); prv_trigger_core_dump_from_isr(); return; } if (s_spi_transport.status_remote.msg_id != SPITransportMsgID_Statu...
prv_handle_rx_buffer_full()
/* * 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...
(accessory_manager_set_state(AccessoryInputStateIdle))
; } static void prv_monitor_timer_cb(void *context); static void prv_monitor_system_task_cb(void *context) { static uint32_t s_monitor_interval = 0; PBL_ASSERT_TASK(PebbleTask_KernelBackground); smartstrap_state_lock(); if (s_subscriber_count == 0) { prv_release_accessory(); smartstrap_state_unlock();...
.status_layer.layer, .times_out = true, .colors.foreground = dialog->text_color, .colors.background = dialog->window.background_color, }); layer_init(&expandable_dialog->content_down_arrow_layer, &GRect( 0, frame.size.h - CONTENT_DOWN_ARROW_HEIGHT, ...
gcolor_legible_over(background_color)
); dialog_set_callbacks(dialog, callbacks, dialog); } return expandable_dialog; } void expandable_dialog_show_action_bar(ExpandableDialog *expandable_dialog, bool show_action_bar) { expandable_dialog->show_action_bar = show_action_bar; } void expandable_dialog_set_acti...
ex); } static void prv_unlock(void) { mutex_unlock_recursive(s_adv_mutex); } static gap_disc_mode_t prv_dialog_discoverable_type_for_flag(uint8_t flags) { if (flags & GAP_LE_AD_FLAGS_GEN_DISCOVERABLE_MASK) { return GAP_DISC_MODE_GEN_DISCOVERABLE; } else if (flags & GAP_LE_AD_FLAGS_LIM_DISCOVERABLE_MASK) { ...
{ // TODO: Does the dialog stack gracefully handle calling stop before adds // are truly running. Is there an event we can wait on and have a Starting state? s_adv_state = AdvertState_Running; rv = prv_advert_enable(); }
(_clar.suite_errors > error_st) ); } static void clar_run_suite(const struct clar_suite *suite) { const struct clar_func *test = suite->tests; size_t i; if (!clar_category_is_suite_enabled(suite)) return; if (_clar.exit_on_error && _clar.total_errors) return; if (!_clar.report_errors_...
{ int offset = (argument[2] == '=') ? 3 : 2; if (strcasecmp("all", argument + offset) == 0) clar_category_enable_all(_clar_suite_count, _clar_suites); else clar_category_enable(argument + offset); break; }
int16_t value, int16_t size, int16_t from_range, int16_t to_range, int16_t from_min, int16_t to_min, int32_t normalized, InterpolateInt64Function interpolate); int64_t prv_default_interpolate(int32_t normalized, int64_t from, int64_t to); void test_gdraw_command_transforms__int_scale_to_translate_overflow(vo...
{ GContext ctx; test_graphics_context_init(&ctx, fb); graphics_context_set_antialiased(&ctx, true); int32_t dt = ANIMATION_NORMALIZED_MAX / 16; int32_t t = 0; InterpolateInt64Function interp = NULL; int16_t s = 48; GRect from = GRect(144 - s * 3 / 4, s / 4, s / 2, s / 2); GRect to = GRect(s / 2, s,...
); peek_layer_set_duration(&data->peek_layer, duration + ((num_frames_skip + num_frames_extend) * ANIMATION_TARGET_FRAME_INTERVAL_MS)); Animation *animation = (Animation *)peek_layer_create_play_animation(&data->peek_layer); animation_schedule(animation); ...
{ PeekLayer *peek_layer = &data->peek_layer; #if ANIMATION_DOT peek_layer_set_icon(peek_layer, timeline_res); #elif ANIMATION_SLIDE GRect icon_from; GRect icon_to; const bool shift_offscreen_from = true; const bool shift_offscreen_to = false; prv_get_icon_animation_frame(data, &icon_from, use_pin, shift_o...
T_STATIC void prv_setup_no_events_peek(TimelineAppData *data) { PeekLayer *peek_layer = &data->peek_layer; // set the text peek_layer_set_fields(peek_layer, "", i18n_get("No events", peek_layer), ""); // set the icon resource TimelineResourceInfo timeline_res = { .res_id = TIMELINE_RESOURCE_NO_EVENTS, ...
June 11th 2015, 23:59:30 (T-12:00:30) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) - 30); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Fri, 12:00 PM", time_buf); // June 11th 2015, 23:59:59 (T-12:00:01) rtc_set_time(event_time - (12 * SE...
{ char time_buf[64]; const int jun10th_noon_2015 = 1433937600; prv_clock_reset(0); rtc_set_time(jun10th_noon_2015); // Our test event is at June 9th 2015, 12:00:00 // Now - one day const int event_time = jun10th_noon_2015 - SECONDS_PER_DAY; // if the event is within 2 hours, then show the actual tim...
(!prv_is_mutable(state, animation)) { return false; } animation->context = context; animation->handlers = handlers; return true; } // ------------------------------------------------------------------------------------------- AnimationHandlers animation_get_handlers(Animation *animation_h) { if (anima...
{ // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. return ((AnimationLegacy2 *)animation_h)->delay_ms; }
AnimationPrivate *animation = prv_find_animation_by_handle(NULL, animation_h, false /*quiet*/); if (!animation) { return 0; } return animation->delay_ms; } // ------------------------------------------------------------------------------------------- uint32_t animation_get_abs_start_time_ms(Animation *a...
ge_get_valid_page_number(void); extern void shared_prf_storage_set_valid_page_number(uint32_t page_num); // Defines ////////////////////////////////////////////////////////// #define SPRF_REGION_SIZE (FLASH_REGION_SHARED_PRF_STORAGE_END - \ FLASH_REGION_SHARED_PRF_STORAGE_BEGIN) #define SPRF_...
SPRF_PAGE_FLASH_OFFSET(j)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ARRAY_LENGTH(APP_RECORDS)
; i++) { const AppRegistryEntry *reg_entry = &APP_RECORDS[i]; if (reg_entry->type == AppInstallStorageFw) { const PebbleProcessMd *md = reg_entry->md_fn(); if (md && uuid_equal(&md->uuid, uuid)) { return reg_entry->id; } } else if ((reg_entry->type == AppInstallStorageResources) ...
set.h" #include "process_management/app_manager.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "services/common/i18n/i18n.h" #include "services/common/system_task.h" #include "system/bootbits.h" #include "system/passert.h" #include <stdio.h> #include <string.h> type...
(menu_layer, cell_index)
; return (callbacks->row_height) ? callbacks->row_height(callbacks, row, is_selected) : PBL_IF_RECT_ELSE(menu_cell_basic_cell_height(), (is_selected ? MENU_CELL_ROUND_FOCUSED_SHORT_CELL_HEIGHT : MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT)); } /...
urn; } } printf("\nFound records:"); for (int i = 0; i < s_num_dls_activity_records; i++) { printf("\ntype: %d, start_utc: %"PRIu32", elapsed: %"PRIu32", utc_to_local: %"PRIu32" ", (int)s_dls_activity_records[i].activity, (uint32_t)s_dls_activity_records[i].start_utc, s_dls_activity_...
("\nFound: type: %d, start_utc: %d, len: %"PRIu16" ", (int)sessions[i].type, (int)sessions[i].start_utc, sessions[i].length_min)
; } printf("\nLooking for: type: %d, start_utc: %d, len: %"PRIu16" ", (int)exp_session->type, (int)exp_session->start_utc, exp_session->length_min); clar__assert(false, file, line, "Missing sleep activity record", "", true); } #define ASSERT_STEP_ACTIVITY_SESSION_PRESENT(session) \ prv_...
xt_init(); jerry_init(JERRY_INIT_EMPTY); s_app_window_stack_get_top_window = (Window){}; s_app_event_loop_callback = NULL; s_log_internal__expected = NULL; s_prv_api_init__callcount = 0; s_prv_api_add__callcount = 0; s_prv_api_add__result = false; s_prv_api_remove__callcount = 0; s_prv_listener_a1_...
jerry_obj_refcount(o)
); jerry_release_value(o); cl_assert_equal_i(2, jerry_obj_refcount(o)); jerry_release_value(o); cl_assert_equal_i(1, jerry_obj_refcount(o)); jerry_release_value(o); cl_assert_equal_i(0, jerry_obj_refcount(o)); } void test_rocky_api_global__calls_listeners(void) { static const RockyGlobalAPI *apis[] = {NU...
nd = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id1, 10, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule); cl_assert_equal_i(s_num_timeline_adds, 3); alarm_get_next_enabled_alarm(&next_alarm_time); cl_assert_equal_i(next_alarm_time, s_current_day + 10 * SECONDS_PER_HOUR + 30 * SEC...
{ AlarmId id; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_WEEKENDS }); prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_WEEKENDS, s_weekend_schedule); // It's currently Thursday @ 00:00. The alarm shouldn't go off for over 2 days + 10:30 s_current_hour = 10; s_current...
void test_alarm__recurring_weekends_alarm_timeout_behind(void) { AlarmId id; s_current_hour = 11; s_current_minute = 30; s_current_day = s_saturday; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_WEEKENDS }); prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_WEEKENDS, s_...
on *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_advance_to_ms_with_timers(start_ms + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_ent...
{ #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b = 200; const int duration_c = 500; const int repeat_count = 5; int duration_total = duration_a + MAX(duration_b, duration_c); // Create 3 animations Animation *a = prv_create_test_animation(); animation_set_duration(a, durat...
prv_advance_to_ms_with_timers(start_ms + duration_total + 1 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL), 3); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, NULL), 3); // If we keep going, we should repeat the whole sequence anoth...
1096, -80, -112}, { 1592, -112, -72}, { 1608, -88, -112}, { 1256, -32, -248}, { 888, -24, -368}, // 18 seconds { 928, 32, -352}, { 1104, -16, -168}, { 1168, -120, -104}, { 1056, -104, -104}, { 952, -40, -144}, { 904, -32, -160}, { 928, -24, -144}, { 1024, -32, -152}, ...
{ 968, -16, -72}, { 1064, -32, -80}, { 1120, -56, -88}, { 1272, -72, -48}, { 1432, -72, -160}, { 1296, -88, -96}, { 1232, -72, -168}, { 1016, -80, -216}, { 1016, -72, -232}, { 1120, -80, -256}, { 1128, -104, -192}, { 1144, -112, -128}, { 1080, -88, -104}, { 1048, ...
{ 1328, -152, -184}, { 1208, -144, -312}, { 904, -112, -400}, { 784, -144, -272}, { 1040, -200, -56}, { 1152, -136, -48}, { 1048, -56, -64}, { 928, 16, -96}, { 896, 24, -120}, { 864, -16, -112}, { 904, -56, -88}, { 944, -72, -176}, { 952, -88, -192}, { 1016, -88,...
/* * 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_get_called = true; if (!s_has_cache) { return E_DOES_NOT_EXIST; } *((uint64_t *)val_out) = s_get_value; return S_SUCCESS; }
static uint64_t s_set_value; status_t settings_file_set(SettingsFile *file, const void *key, size_t key_len, const void *val, size_t val_len) { cl_assert_equal_i(val_len, sizeof(uint64_t)); s_set_value = *(uint64_t *)val; return S_SUCCESS; } status_t settings_file_delete(SettingsFile...
/* * 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...
{ AppData *app_data = window_get_user_data(window); GRect frame; layer_get_frame(window_get_root_layer(&app_data->window), &frame); GRect text_frame = { .size.h = 48, .size.w = 100, }; grect_align(&text_frame, &frame, GAlignCenter, false); text_layer_init(&app_data->text, &text_frame); GFont fo...
static void prv_verify_modify_on_app_task(void *data) { AppData *app_data = data; if (app_data->test != 0x3C3C3C3C) { text_layer_set_text(&app_data->text, "FAILED"); } else { text_layer_set_text(&app_data->text, "PASSSED"); } } static void prv_verify_modify_on_kernel_task(void *data) { AppData *app...
that is allocated to pass into the wakeup_ui // to show that an app's wakeup event had triggered while the watch was off. To reduce // complexity, I have hard coded this buffer to a max size instead of going the linked_list // route. 16 apps should be more than enough. #define NUM_APPS_ALERT_ON_BOOT 16 static PebbleM...
info->get_key(file, (uint8_t*)&wakeup_id, sizeof(WakeupId))
; WakeupEntry entry; info->get_val(file, (uint8_t*)&entry, sizeof(WakeupEntry)); // If the wakeup_id is valid, and the timestamp of the entry is closer than // the timestamp of our global wakeup state, then set the next close wakeup event if (wakeup_id > 0 && (s_wakeup_state.current_wakeup_id == -1 || ...
t_handle, .value_length = sizeof(emulated_result), .context_ref = ((HcGattReadData *)hdr)->context_ref }; memcpy(data->value, &emulated_result, sizeof(emulated_result)); hc_protocol_enqueue_with_payload(HcEndpointID_Gatt, HcMessageID_Gatt_ReadCompleted, (uint8_t *)data,...
(num_included_services, num_characteristics, num_descriptors)
; // RivieraWaves caches values internally and only calls back once if we don't set this: const uint8_t enable_read_cb_flag = GATTS_FLAG_CHAR_READ_REQ; // Just use the max allowed size, no buffers get allocated because of GATTS_FLAG_CHAR_READ_REQ. const uint16_t data_wr_size = 512; prv_convert_uuid_to_litt...
AP_LE_AD_REPORT_DATA_MAX_LENGTH * 2]; size_t size = ble_ad_copy_raw_data(s_ad_data, buffer, sizeof(buffer)); cl_assert_equal_i(size, sizeof(data)); cl_assert_equal_i(memcmp(buffer, data, sizeof(data)), 0); // Test ble_ad_copy_local_name, destination buffer large enough: char local_name[64]; size = ble_ad_c...
memcpy(&expected_ad_data[2], uuid_bytes, sizeof(Uuid))
positorTransitionDirectionRight, GColorWhite); } void test_graphics_window_stack_animation__right_flip_first_frame_clipping(void) { prv_test_clipping_mask(prv_right_flip_first_frame_clipping, "right_flip_first_frame_clipping"); }; // This test records a clip...
{ GColor8 color = GColorFromRGB(1 * x * UINT8_MAX / DISP_COLS, 2 * x * UINT8_MAX / DISP_COLS, 4 * x * UINT8_MAX / DISP_COLS); if (row_info.min_x <= x && x <= row_info.max_x) { row_info.data[x] = color.argb; } }
} // nop graphics_private_move_pixels_horizontally(NULL, 50, false); graphics_private_move_pixels_horizontally(bitmap, 0, false); graphics_private_move_pixels_horizontally(bitmap, 50, false); cl_check(gbitmap_pbi_eq(bitmap, TEST_NAMED_PBI_FILE("move_horizontal_right"))); graphics_private_move_pixels_...
/* * 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...
dbgserial_print_hex(crc)
; dbgserial_newline(); return crc == firmware_description->checksum; } typedef enum UpdateFirmwareResult { UPDATE_FW_SUCCESS = 0, UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED = 1, UPDATE_FW_ERROR_MICRO_FLASH_MANGLED = 2 } UpdateFirmwareResult; static UpdateFirmwareResult update_fw(uint32_t flash_address) { disp...
/* * 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...
gpoint_add(s_mfg_offset, s_user_offset)
; } bool shell_prefs_should_prompt_display_calibration(void) { return s_should_prompt_display_calibration; } void shell_prefs_set_should_prompt_display_calibration(bool should_prompt) { s_should_prompt_display_calibration = should_prompt; } bool gpoint_equal(const GPoint * const point_a, const GPoint * const point_...
/* * 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 true; }
if (iter->data_index >= mbuf_get_length(iter->m)) { // we're at the end of this MBuf so move to the next one iter->m = mbuf_get_next(iter->m); iter->data_index = 0; // make sure this MBuf has data if (!prv_iter_to_valid_mbuf(iter)) { return true; } } return false; } bool mbuf_itera...
jerry_create_boolean(true), jerry_create_object(), }; for (int i = 0; i < ARRAY_LENGTH(mismatch_args); ++i) { jerry_value_t arg = mismatch_args[i]; JERRY_ARGS_MAKE(arg); for (RockyArgType type = RockyArgTypeUInt8; type <= RockyArgTypeDouble; ++type) { uint8_t buffer_untouched[8]; // The ty...
(output, cases[i].expected_output)
_workout_app_opened, sizeof(s_activity_prefs_workout_app_opened)); } } bool activity_prefs_activity_insights_are_enabled(void) { return s_activity_preferences.activity_insights_enabled; } void activity_prefs_activity_insights_set_enabled(bool enable) { s_activity_preferences.activity_insights_e...
prv_pref_set(PREF_KEY_TIMELINE_PEEK_ENABLED, &enabled, sizeof(enabled))
; } bool timeline_peek_prefs_get_enabled(void) { return s_timeline_peek_enabled; } void timeline_peek_prefs_set_before_time(uint16_t before_time_m) { prv_pref_set(PREF_KEY_TIMELINE_PEEK_BEFORE_TIME_M, &before_time_m, sizeof(before_time_m)); } uint16_t timeline_peek_prefs_get_before_time(void) { return s_timeli...
layout_get_colors((LayoutLayer *)layout)->primary_color : GColorBlack)); static const GRect page_frame_on_screen = { { 0, STATUS_BAR_LAYER_HEIGHT }, { DISP_COLS, DISP_ROWS - STATUS_BAR_LAYER_HEIGHT } }; const GTextNodeDrawConfig config = { .page_frame = is_peek ? &GRectZero : &page_frame_on_screen, .o...
(&layout->layout_layer, &s_body_config.text.extent.node)
); return vertical_node; } static void prv_page_break_node_callback(GContext *ctx, const GRect *box, const GTextNodeDrawConfig *config, bool render, GSize *size_out, void *user_data) { TimelineLayout *layout = user_data; const GRec...
/* * 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...
(crash, NULL)