prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
(alarms_glance)
; } static void prv_set_glance_icon(LauncherAppGlanceAlarms *alarms_glance, uint32_t new_icon_resource_id) { if (alarms_glance->icon_resource_id == new_icon_resource_id) { // Nothing to do, bail out return; } // Destroy the existing icon kino_reel_destroy(alarms_glance-...
TEXT_COLOR, container); active_window->workout_controller->metric_to_string(metric_type, (char *) number_text_node->text, buffer_size, i18n_owner, ...
{ // text is long so use smaller font number_text_node->font = prv_get_number_font(false); }
G(LOG_LEVEL_DEBUG, "Rebooting to apply new firmware!"); boot_bit_set(BOOT_BIT_NEW_FW_AVAILABLE); services_set_runlevel(RunLevel_BareMinimum); system_reset(); } static void erase_fw(const uint32_t start_address) { // Erase flash flash_erase_sector_blocking(start_address); // Set everything high // Set up...
{ AppData *data = app_malloc_check(sizeof(AppData)); app_state_set_user_data(data); push_window(data); }
static void handle_deinit(void) { AppData *data = app_state_get_user_data(); app_free(data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* grenade_launcher_app_get_info() { static const PebbleProcessMdSystem s_app_info = { .common.main_func...
-64, 136}, { 808, 136, 152}, { 592, 32, 24}, { 544, 16, 40}, { 568, -16, 64}, { 624, -56, 80}, { 720, -48, 72}, { 984, -16, 48}, { 1312, -32, 104}, { 2048, -184, 440}, // 64 seconds { 1952, 184, 384}, { 1504, 768, -248}, { 1136, 456, -120}, { 960, 152, 288}, ...
{ 616, -32, 72}, { 656, -56, 24}, { 904, 72, -96}, { 1136, 0, -64}, { 1680, -192, 184}, { 1712, 32, 240}, { 1256, 504, -120}, { 1120, 376, -120}, { 1032, 88, 200}, { 992, 96, 304}, { 1016, 176, 264}, { 912, 304, 200}, { 840, 376, 120}, { 840, 368, 40}, { 856, ...
{ 864, 312, 40}, { 928, 424, -16}, { 1064, 520, -8}, { 1240, 512, 32}, { 1648, 416, 160}, { 1856, 304, 216}, { 1112, 224, 96}, { 960, 136, 96}, { 1352, 64, 296}, { 1472, 96, 376}, { 1272, 72, 272}, { 1072, 16, 192}, { 976, 48, 160}, { 880, 24, 184}, { 864, 96...
/* * 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...
{ // clean system startup -> open dialog display_calibration_prompt_show_if_needed(); cl_assert(prv_does_open_dialog()); }
void test_display_calibration_prompt__mfg_offset(void) { // startup with existing mfg offset but no user offset -> open dialog s_mfg_offset = GPoint(0, 0); display_calibration_prompt_show_if_needed(); cl_assert(prv_does_open_dialog()); } void test_display_calibration_prompt__user_offset(void) { // startup ...
tings_file_exists(store, &key, sizeof(key)); } DEFINE_SYSCALL(int, persist_get_size, const uint32_t key) { LOCK_AND_GET_STORE(store); int result = settings_file_get_len(store, &key, sizeof(key)); return result ?: E_DOES_NOT_EXIST; } DEFINE_SYSCALL(bool, persist_read_bool, const uint32_t key) { bool value = fa...
settings_file_exists(store, &key, sizeof(key))
) { result = settings_file_delete(store, &key, sizeof(key)); if (PASSED(result)) { result = S_TRUE; } } else { result = E_DOES_NOT_EXIST; } return result; }
ing_based) { const GAPLEConnection *connection = gap_le_connection_find_by_irk(&request->bonding.irk); if (!connection) { if (sm_is_pairing_info_irk_not_used(&request->bonding.irk)) { PBL_LOG(LOG_LEVEL_DEBUG, "register_intent: IRK not used, searching by addr"); connection = gap_le_connecti...
gap_le_connection_is_connected(device)
; const BTBondingID bonding_id = prv_get_bonding_id_for_intent(intent); // Flag as unused: intent->client[c].is_used = false; bool should_remove_and_free = false; if (!prv_is_intent_used(intent)) { should_remove_and_free = true; if (is_connected_real) { // Disconnect the device because no o...
/* * 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(119, 143)
); } void same_start_stop_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(20, 20), GPoint(20, 20)); } #define ORIGIN_RECT_NO_CLIP ...
a system app (where it doesn't matter) or for apps that were compiled with // an SDK that supports app glances (which is newer than the first SDK that supported published // resources as proved by the following asserts) _Static_assert((APP_GLANCE_MIN_SUPPORTED_SDK_VERSION_MAJOR > TI...
launcher_app_glance_structured_get_data(structured_glance)
/ Reload the glance with two slices app_glance_reload(prv_basic_reload_cb, s_test_state.context); cl_assert_equal_b(s_test_state.reload_callback_was_called, true); // Read the glance back AppGlance glance = {}; cl_assert_equal_i(app_glance_db_read_glance(&APP_GLANCE_TEST_UUID, &glance), S_SUCCESS); // Com...
(session, slice)
& APP_GLANCE_RESULT_INVALID_TEMPLATE_STRING); // Check that adding a slice that expires in the past fails slice = (AppGlanceSlice) { .expiration_time = rtc_get_time() - 10, .layout.icon = APP_GLANCE_SLICE_DEFAULT_ICON, .layout.subtitle_template_string = "Test subtitle", }; cl_assert(app_glance_add...
ontrolled in software; pull up to high when inactive gpio_cfg.GPIO_Mode = GPIO_Mode_OUT; gpio_cfg.GPIO_Pin = (1 << FLASH_CONFIG.scs_pin); gpio_cfg.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(FLASH_CONFIG.spi_gpio, &gpio_cfg); // Set up a SPI bus on SPI1 SPI_InitTypeDef spi_cfg; SPI_I2S_DeInit(FLASH_CONFIG.spi); ...
prv_flash_start()
; // Assume that last time we shut down we were asleep. Come back out. prv_flash_deep_sleep_exit(); prv_disable_flash_spi_clock(); prv_flash_whoami(); } bool flash_sanity_check(void) { return prv_is_whoami_correct(); } void flash_read_bytes(uint8_t* buffer, uint32_t start_addr, uint32_t buffer_size) { ...
================================================================================ // Try and delete, then re-add a regular timer from its callback static int s_reg_timer_3_callback_count = 0; static void reg_timer_3_callback(void* data) { s_reg_timer_3_callback_count++; PBL_LOG(LOG_LEVEL_DEBUG, "STT running reg_time...
PBL_ASSERTN(success)
; // Wait for them to fire psleep(500); PBL_ASSERTN(s_app_data->fired_time[timer_idx_0] != 0); PBL_ASSERTN(s_app_data->fired_time[timer_idx_1] != 0); PBL_ASSERTN(s_app_data->fired_time[timer_idx_1] < s_app_data->fired_time[timer_idx_0]); bool scheduled = new_timer_scheduled(s_app_data->timer[timer_idx_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...
dialog_set_timeout(dialog, DIALOG_TIMEOUT_SNOOZE)
; simple_dialog_push(simple_dialog, prv_get_window_stack()); } // ---------------------------------------------------------------------------------------------- //! Dismiss confirm dialog static void prv_show_dismiss_confirm_dialog(void) { SimpleDialog *simple_dialog = simple_dialog_create("AlarmSnooze"); Dialo...
ctive_header; } flash_write_bytes(header, cursor, REGISTRY_HEADER_SIZE_BYTES); } //! Verifies the flash cursor is at the active registry (as initialized by `registry_init()`. //! Cursor must be subsector aligned and within the bounds of REGISTRY_FLASH_BEGIN and //! REGISTRY_FLASH_END. static void prv_assert_valid_...
(registry)
; // Write empty registry if one does not exist if (registry->cursor->address == (unsigned)FLASH_CURSOR_UNINITIALIZED) { registry_private_write_to_flash(registry); } else { registry_private_read_from_flash(registry); } prv_assert_valid_cursor(registry->cursor); }
_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); // Complete B 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), 1); cl_assert_equal_i(prv...
prv_count_handler_entries(&s_started_handler_calls, a)
| delay_c | duration_c | // | delay_s | delay_d | duration_d | // ----------------------------------------------------------------------------------- // | spawn scheduled here void tes...
if (distance > ANIMATION_NORMALIZED_MAX / 2) { animation_unschedule_all(); }
} // -------------------------------------------------------------------------------------- // Test unscheduling animations arbitrarily in an update handler. static void prv_unschedule_all_in_update_handler(bool auto_destroy) { const int duration_a = 300; // This one will complete const int delay_a = 10; prv...
d(&ctx, GPoint(23, 6), 10); graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 7), 10); graphics_draw_vertical_line_dotted(&ctx, GPoint(24, 7), 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_even_offset_no_clip"))); // Even cols of different lengths setup_t...
(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_odd_offset_no_clip")))
; // Even cols of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, 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)...
60) ? 7 : 0; const uint16_t left_margin_px = PBL_IF_RECT_ELSE(5, 0); const uint16_t action_bar_width = show_action_bar ? ACTION_BAR_WIDTH : 0; const uint16_t content_and_action_bar_horizontal_spacing = PBL_IF_RECT_ELSE(left_margin_px, show_action_bar ? 11 : left_margin_px); const uint16_t right_margin_px...
text_layer_set_line_spacing_delta(text_layer, text_layer_line_spacing_delta)
; layer_add_child(&window->layer, &text_layer->layer); if (workout_dialog->subtext_buffer) { y = subtext_top_margin_px; TextLayer *subtext_layer = &workout_dialog->subtext_layer; text_layer_init_with_parameters(subtext_layer, &GRect(x, y, w, h), workout_dialog->sub...
08}, { -32, 824, -664}, { -16, 816, -632}, { -48, 1040, -640}, { 56, 720, -704}, { 152, 968, -800}, { -168, 1136, -792}, { -432, 1008, -416}, { -536, 784, -112}, { -512, 696, 176}, { -368, 584, 320}, { -296, 464, 408}, { -208, 488, 600}, { -168, 448, 704}, { -176,...
{ 104, 696, -640}, { 104, 704, -632}, { 104, 704, -640}, { 120, 688, -648}, // 14 seconds { 104, 712, -632}, { 112, 696, -640}, { 104, 680, -632}, { 96, 704, -640}, { 112, 696, -648}, { 112, 680, -648}, { 112, 696, -648}, { 112, 688, -648}, { 120, 688, -656}, ...
{ 48, 888, -1152}, { -64, 512, -1184}, { -144, 968, -1432}, { -280, 1096, -1288}, { -320, 976, -920}, { -368, 976, -704}, { -408, 864, -704}, { -504, 616, -600}, { -504, 424, -552}, { -440, 304, -584}, // 17 seconds { -360, 208, -536}, { -272, -32, -544}, { -144,...
buffer, (uint8_t*) "789", 3)); // too big cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 2); cl_assert(circular_buffer_read(&buffer, 4, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 4); cl_assert(memcmp(out_buffer, "1234", 4) == 0); cl_assert_equal_i(circular_buffer_get_wri...
(circular_buffer_copy_offset(&buffer, 4 /* start_offset */, data_out, data_out_size), 0)
; // Free up 2 bytes at the beginning: circular_buffer_consume(&buffer, 2); // Write data that will be wrapped: cl_assert_equal_b(circular_buffer_write(&buffer, (uint8_t *)"456789", 6), true); cl_assert_equal_i(circular_buffer_copy_offset(&buffer, 2 /* start_offset */, ...
/* * 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_tictoc_icon_bitmap)
; gbitmap_deinit(&s_smart_alarm_icon_bitmap); gbitmap_destroy(s_dest_bitmap); s_dest_bitmap = NULL; } // Helpers ////////////////////// // This struct represents the data for a column of the grid of our resulting test image typedef struct { const char *title_font; const char *subtitle_font; const char *v...
services/common/i18n/i18n.h" #include "services/normal/activity/activity.h" #include "shell/prefs.h" #include "util/time/time.h" #include "util/units.h" #include "util/string.h" #include <limits.h> #include <stdio.h> #include <string.h> static void prv_convert_duration_to_hours_and_minutes(int duration_s, int *hours,...
{ int hours; int minutes; prv_convert_duration_to_hours_and_minutes(duration_s, &hours, &minutes); const int units_offset_y = fonts_get_font_height(number_font) - fonts_get_font_height(units_font); const int hours_and_minutes_buffer_size = sizeof("00"); if (hours != INT_MIN) { GTextNodeText *hours_text_...
minutes_units_text_node->node.offset.y = units_offset_y; } } void health_util_convert_fraction_to_whole_and_decimal_part(int numerator, int denominator, int* whole_part, int *decimal_part) { const int figure = ROUND(numerator * 100, denominator * 10)...
d should return false cl_assert(!timeline_resources_get_id_system(TIMELINE_RESOURCE_INVALID, TimelineResourceSizeTiny, TimelineResourceTestAppId_ValidApp, &res_info)); // Calling the function with an invalid size should return false cl_assert(!timeline_resources_get_id_system( (TimelineResource...
(NULL, TimelineResourceSizeTiny, &res_info)
); cl_assert_passert(timeline_resources_get_id(&timeline_res_info, TimelineResourceSizeTiny, NULL)); // Set the TimelineResourceInfo to have the UUID of an app with an invalid LUT const TimelineResourceTestAppData *app_with_invalid_lut_data = prv_get_data_for_app_with_id(TimelineResourceTestAppId_AppWithIn...
/* * 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...
{ task_free(app_state_get_rocky_runtime_context_buffer()); app_state_set_rocky_runtime_context(NULL, NULL); }
double jerry_port_get_current_time (void) { time_t seconds; uint16_t millis; time_ms(&seconds, &millis); return ((double)seconds * 1000.0) + millis; } /* jerry_port_get_current_time */ DEFINE_SYSCALL(bool, jerry_port_get_time_zone, jerry_time_zone_t *tz_p) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert...
fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 5); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 5); graphics_draw_rect(&ctx...
(&ctx, GColorBlack)
; // Draw rectangles around boundaries of clipping box - AA true prv_draw_rects(&ctx, 1, 0, 0); prv_draw_rects(&ctx, 2, CLIP_OFFSET, 0); prv_draw_rects(&ctx, 3, 2 * CLIP_OFFSET, 0); prv_draw_rects(&ctx, 4, 3 * CLIP_OFFSET, 0); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_clip_rect_aa.${BIT_DEPTH_NA...
, }, }; event_put(&event); } mutex_unlock_recursive(s_activity_state.mutex); } // Modify our sampling period now if necessary // NOTE: Must be kept at the bottom of the function, or at least below // `activity_metrics_prv_add_median_hr_sample` prv_heart_rate_...
{ // Version 1 had no settings key in it. *written_version = 1; }
text) { // check entry is valid if (info->val_len == 0 || info->key_len != sizeof(AlarmStorageKey)) { return true; // continue iterating } ForEachAlarmItrData *itr_data = (ForEachAlarmItrData*) context; AlarmStorageKey key; info->get_key(file, (uint8_t*) &key, info->key_len); if (key.type != ALARM_...
{ const char *alarm_day_text = NULL; switch (kind) { case ALARM_KIND_EVERYDAY: alarm_day_text = all_caps ? /// A frequency option for alarms, i.e. the alarm would go off every day. Respect /// capitalization! i18n_noop("EVERY DAY") : /// A frequency option for a...
/// A frequency option for alarms, i.e. the alarm would only go off one time ever. Respect /// capitalization! i18n_noop("Once"); break; case ALARM_KIND_CUSTOM: // TODO: Use selected days as the string alarm_day_text = all_caps ? /// A frequency option ...
ixedS16_3(radius, 0); // 1 pixel width means radius of 0 r = GRect(-1, -5, 1, 1); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, -1, -5); cl_assert_fixedS16_3(radius, 0); // 2 pixel width means: center is 1px from side, 0.5 pixels to center of outer pixels r = GRec...
(s_center, 0.0, 0.0)
vSemaphoreDelete(info.interlock)
; prompt_send_response("Modal Stack, top to bottom:"); char buffer[128]; for (ModalPriority priority = NumModalPriorities - 1; priority > ModalPriorityInvalid; --priority) { prompt_send_response_fmt(buffer, sizeof(buffer), "Priority: %d (%zu)", priority, info.count...
eat *heartbeat, AnalyticsMetric metric) { uint8_t *location = prv_heartbeat_get_location(heartbeat, metric); return prv_location_get_value(location, analytics_metric_element_type(metric)); } int64_t analytics_heartbeat_get_array(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric, uint32_t index) { uint8_t *lo...
snprintf(buf + written, BUF_LENGTH - written, "%s%" PRId32 " (0x%" PRIx32 ")", sep, (int32_t)val, (int32_t)val)
; } } PBL_LOG(LOG_LEVEL_DEBUG, "%3" PRIu32 ": %s: %s", analytics_metric_offset(metric), name, buf); } } void analytics_heartbeat_print(AnalyticsHeartbeat *heartbeat) { switch (heartbeat->kind) { case ANALYTICS_HEARTBEAT_KIND_DEVICE: PBL_LOG(LOG_LEVEL_DEBUG, "Device heartbeat:"); prv_print_h...
space - offset; if (payload_size == 0) { // No data to send return NULL; } // Cap to the size that the GATT MTU allows: payload_size = MIN(payload_size, max_payload_size); } PPoGATTPacket *packet = prv_lazily_allocate_packet_if_needed(client, heap_packet_in_out); if (!packet) { ...
prv_send_next_packets(client)
; } // ------------------------------------------------------------------------------------------------- void ppogatt_close(struct Transport *transport) { bt_lock_assert_held(true); PPoGATTClient *client = (PPoGATTClient *) transport; prv_delete_client(client, false /* is_disconnected */, DeleteReason_CloseCall...
ot_disturb_set_schedule_enabled(WeekendSchedule, true); rtc_set_time(s_friday_08_30); // Out of schedule do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will go off at 23:00 on Friday. (14.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_...
(WeekdaySchedule, true)
; do_not_disturb_set_schedule_enabled(WeekendSchedule, true); rtc_set_time(s_friday_23_30); // In schedule do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == true); // Timer will go off at 00:00 on Saturday. (0.5 hours) cl_assert_equal_i(stub_new_timer_timeout(...
/* * 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...
(data->alarm_id, !data->alarm_info.is_smart)
; if (data->alarm_editor_callback) { data->alarm_editor_callback(EDITED, data->alarm_id, data->callback_context); } } static void prv_edit_time_handler(ActionMenu *action_menu, const ActionMenuItem *item, void *context) { AlarmDetailData *data...
136, -120, -968}, { 144, -120, -976}, { 136, -120, -976}, { 136, -112, -968}, { 144, -120, -976}, { 136, -120, -976}, { 152, -120, -976}, { 136, -120, -984}, { 144, -144, -960}, { 136, -120, -968}, { 152, -128, -976}, { 136, -128, -960}, { 144, -120, -976}, { 144, -1...
{ 136, -136, -968}, { 144, -152, -976}, { 136, -152, -968}, { 144, -144, -976}, { 144, -136, -968}, { 136, -160, -968}, { 144, -144, -976}, { 136, -152, -968}, { 128, -160, -968}, { 144, -152, -968}, { 136, -144, -976}, { 136, -152, -968}, { 136, -160, -976}, { 14...
imation__reschedule(void) { #ifdef TEST_INCLUDE_BASIC PropertyAnimation *prop_h; Layer layer; GRect from_r; GRect to_r; const int duration = 100; const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; memset(&layer, 0, sizeof(layer)); from_r = ...
{ detected_reset_of_elapsed = true; }
cl_assert(max_loops > 0); max_loops--; } // Make sure we detected a reset of the elapsed after rescheduling cl_assert(s_stopped_handler_calls.num_calls == 2); cl_assert(detected_reset_of_elapsed); // Make sure the frame reached the "to" state cl_assert_equal_point(layer.frame.origin, to_r.origin...
a[2] & 0x0F) == PACKET_FOOTER); *(uint16_t *)result = (response.data[0] << 4) | (response.data[1] >> 4); *(uint16_t *)result <<= 8; *(uint16_t *)result |= (response.data[1] << 4) | (response.data[2] >> 4); } else { // invalid type WTF; } } #endif // Memory Operations //////////////////////////...
{ PBL_LOG(LOG_LEVEL_ERROR, "Got unexpected packet (%"PRIx8")", message.packet_id); }
} } static void prv_exti_cb(bool *should_context_switch) { if (s_callback_scheduled) { return; } PebbleEvent e = { .type = PEBBLE_CALLBACK_EVENT, .callback.callback = prv_process_pending_messages }; *should_context_switch = event_put_isr(&e); s_callback_scheduled = true; } // Initializatio...
/* * 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(-0.4)
, -0.0); cl_assert_equal_d(round(0.5), 1.0); cl_assert_equal_d(round(-0.5), -1.0); cl_assert_equal_d(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); }
release(DISP_GPIO); } //! These functions needed to be called around any commands that //! are sent to the display. NOINLINE only for code size savings. static NOINLINE void prv_enable_display_access(void) { prv_enable_display_spi_clock(); prv_enable_chip_select(); } static NOINLINE void prv_disable_display_acces...
(DISP_GPIO, &s_disp_gpio_init)
; // Set up a SPI bus on SPI2 SPI_I2S_DeInit(DISP_SPI); SPI_Init(DISP_SPI, &s_disp_spi_init); SPI_Cmd(DISP_SPI, ENABLE); // +5V to 5V_EN pin GPIO_WriteBit(PWR_CTL_GPIO, PWR_CTL_PIN, Bit_RESET); // +5V to LCD pin (Set this pin low to turn off the display) GPIO_WriteBit(DISP_GPIO, DISP_PIN_LCD, Bit_SE...
ID timer_id = stub_new_timer_get_next(); cl_assert_equal_i(timer_id, TIMER_INVALID_ID); } void test_calendar__init_with_future_event(void) { timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); cl_assert_equal_i(fake_ev...
(timeline_add(&item1))
; timeline_event_handle_blobdb_event(); cl_assert(timeline_add(&item2)); timeline_event_handle_blobdb_event(); cl_assert(timeline_add(&item3)); timeline_event_handle_blobdb_event(); cl_assert(timeline_add(&item4)); timeline_event_handle_blobdb_event(); timeline_event_init(); cl_assert_equal_i(fake_ev...
/* * 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...
islower(c)
) { return toupper(c); } else { return c; } } int tolower_theirs(int c) { if (isupper(c)) { return tolower(c); } else { return c; } } // "Define" libc functions we're testing #include "pblibc_private.h" #include "include/ctype.h" //////////////////////////////////////////////////////////////...
* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distribut...
(s_is_outbox_message_pending, true)
sting_attributes[]) { return true; } bool weather_layout_verify(bool existing_attributes[]) { return true; } const TimelineEventImpl *timeline_peek_get_event_service(void) { return NULL; } // Helpers //////////////////////////////////////////////////////////////// static bool s_in_calendar_event = false; stat...
cl_assert(stub_new_timer_is_scheduled(timer_id))
; cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000); } void test_calendar_handle__future_event_added_and_removed(void) { timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert_equal...
imitations under the License. */ #include "util/list.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include "clar.h" #include "stubs_passert.h" // Stubs /////////////////////////////////////////////////////////// int g_pbl_log_level = 0; void pbl_log(int level, const char* src_filename, int src_lin...
list_sorted_add(head, &bar2.list_node, (Comparator) sorting_comparator, false)
; cl_assert(head == &bar2.list_node); head = list_sorted_add(head, &bar3.list_node, (Comparator) sorting_comparator, false); cl_assert(head == &bar3.list_node); cl_assert(list_get_tail(head) == &bar2.list_node); head = list_sorted_add(head, &bar1.list_node, (Comparator) sorting_comparator, false); cl_asse...
utex; //! The connected server that provides media metadata and accepts control commands const MusicServerImplementation *implementation; //! The volume setting of the current player uint8_t player_volume_percent; char player_name[MUSIC_BUFFER_LENGTH]; char title[MUSIC_BUFFER_LENGTH]; char artist[MUSI...
mutex_lock_recursive(s_music_ctx.mutex)
default: break; // Not implemented } menu_layer_reload_data(&s_data->menu_layer); prv_update_text_layer_visibility(s_data); } // we don't handle reminders within the notifications app } /////////////////// // Window callbacks static void prv_window_appear(Window *window) { Notificati...
event_service_client_unsubscribe(&data->notification_event_info)
(prv_convert_content_size_between_platforms(PreferredContentSizeMedium, PlatformTypeBasalt, PlatformTypeBasalt), PreferredContentSizeMedium)
; // Converting between two platforms with the same default content size should return the input cl_assert_equal_i(prv_convert_content_size_between_platforms(PreferredContentSizeMedium, PlatformTypeDiorite, ...
rows, }); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(0, l.selection.y); const int16_t basic_cell_height = menu_cell_basic_cell_height(); const int row0_vertically_centered = (height - basic_cell_height)/2; cl_assert_equal_i(row0_vertically_centered, scroll_layer_get_conte...
(&l, true, MenuRowAlignNone, false)
; cl_assert_equal_i(2 * FOCUSED, l.selection.y); cl_assert_equal_i(NORMAL, l.selection.h); cl_assert_equal_b(false, s_content_available[ContentIndicatorDirectionUp]); cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]); // WTF?! menu_layer_set_selected_index(&l, MenuIndex(0, 1), Men...
/* * 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...
(model_buffer)
uted under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "applib/graphics/gtypes.h" #include "kernel/eve...
fake_event_get_last()
; cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT); cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable); touch_event = touch_event_queue_get_event(1, 0); prv_test_touch_event(touch_event, 1, TouchEvent_Liftoff, &GPointZero, 0, 0, &GPoint(1, 13), 3686401, 0, true); } v...
bs_analytics.h" #include "stubs_hexdump.h" #include "stubs_layout_layer.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_prompt.h" #include "stubs_rand_ptr.h" #include "stubs_sleep.h" #include "stubs_task_watchdog.h" #define CONTACT_1_UUID ...
cl_assert_equal_i(contacts_db_insert((uint8_t *)&contact, UUID_SIZE, (uint8_t *)&contact, sizeof(contact)), 0)
; cl_assert_equal_i(contacts_db_get_len((uint8_t *)&contact, UUID_SIZE), sizeof(contact)); SerializedContact *serialized_contact; contacts_db_get_serialized_contact((Uuid *)&contact, &serialized_contact); cl_assert_equal_i(serialized_contact->flags, 0); cl_assert_equal_i(serialized_contact->num_attributes, 1...
t circle_origin; uint16_t circle_radius; int16_t circle_velocity_x; int16_t circle_velocity_y; GColor circle_color; // Triangle GPath *triangle; GPoint triangle_offset; int16_t triangle_velocity_x; int16_t triangle_velocity_y; // Bucket GPath *bucket; GPoint bucket_offset; int16_t bucket_vel...
if (data->point_p0.y < 0 || data->point_p0.y > data->window.layer.bounds.size.h) { data->point_velocity_y = data->point_velocity_y * -1; }
} else if (shape == LINE) { // Move the line 2*X per Y data->line_p0.x += (data->line_velocity_x * PIXEL_SPEED_PER_FRAME * 2); data->line_p1.x += (data->line_velocity_x * PIXEL_SPEED_PER_FRAME * 2); if (data->line_p0.x < 0 || data->line_p0.x > data->window.layer.bounds.size.w || d...
date_callback); layer_render_tree(&layer, &ctx); #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_clear.8bit.pbi")); #else cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)); #endif } #define BOX_OFFSET_X 8 #define BOX_OFFSET_Y 4 #define ...
GPoint(19, 5)
); graphics_draw_pixel(ctx, GPoint(20, 10)); graphics_draw_pixel(ctx, GPoint(21, 15)); // Top boundary graphics_draw_pixel(ctx, GPoint(5, -1)); graphics_draw_pixel(ctx, GPoint(10, 0)); graphics_draw_pixel(ctx, GPoint(15, 1)); // Bottom boundary graphics_draw_pixel(ctx, GPoint(5, 19)); graphics_draw_...
////////////////////////// uint32_t time_get_uptime_seconds(void) { return rtc_get_time(); } // Tests //////////////////////////////////// static MenuLayer menu_layer; static AppMenuDataSource data_source; static bool app_filter_callback(struct AppMenuDataSource *source, AppInstallEntry *entry) { if (app_install_...
{ AppMenuNode *node = app_menu_data_source_get_node_at_index(&data_source, i); cl_assert_equal_i(node->install_id, app_default_order[i]); }
app_menu_data_source_deinit(&data_source); } static uint16_t prv_reverse_index(AppMenuDataSource *data_source, uint16_t original_index, void *context) { return app_menu_data_source_get_count(data_source) - 1 - original_index; } void test_app_menu_data_source__transform_index(vo...
_draw_bitmap_in_rect(ctx, &aml->item_animation.fade_top, &top_bounds); } if (draw_bottom_shading) { GRect bottom_bounds = label_text_container; bottom_bounds.size.h = fade_height; bottom_bounds.origin.y = grect_get_max_y(&label_text_container) - (fade_height + VERTICAL_PADD...
fonts_get_font_height(aml->layout_cache.font)
; // If we have short items, just return the line height. if (prv_aml_is_short(aml)) { return line_height; } #if PBL_ROUND return menu_layer_is_index_selected(menu_layer, cell_index) ? MENU_CELL_ROUND_FOCUSED_SHORT_CELL_HEIGHT : MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT; #else co...
OutgoingObject *object_queue; //! This timer runs when not in SessionOpen. //! Upon timeout, the head of the object queue is error'd out. AppTimer *session_closed_object_queue_timer; //! Type of message that is currently in the outbox, being sent out. OutboxMsgType msg_type; //! Number of fa...
{ DBG("Object Send Complete."); prv_object_queue_pop_head(true /* should_free_data_buffer */); }
else { OutgoingObject * const obj = s_state.out.object_queue; obj->offset_bytes += sent_chunk_payload_size; } } static void prv_object_queue_send_current_chunk(void) { PBL_ASSERTN(s_state.out.object_queue); DictionaryIterator *it = NULL; app_message_outbox_begin(&it); if (!it) { PBL_LOG(LOG_LEV...
; second_block->PrevSize = first_part_size; second_block->is_allocated = false; second_block->Size = block->Size - first_part_size; block->Size = first_part_size; /* Calculate the pointer to the next segment. */ HeapInfo_t* next_next_block = get_next_block(heap, second_block); /* Check for a w...
{ unsigned long block_size = (long)(heap_iter->Size) * ALIGNMENT_SIZE; if (heap_iter->is_allocated) { pc = (void *)heap_iter->pc; type = ""; num_alloc_blocks++; num_alloc_bytes += block_size; } else { pc = NULL; type = "FREE"; num_free_blocks++; num_free_byte...
tion_timestamp)); } } bool activity_prefs_has_activation_delay_insight_fired(ActivationDelayInsightType type) { return (s_activity_activation_delay_insight & (1 << type)); } void activity_prefs_set_activation_delay_insight_fired(ActivationDelayInsightType type) { s_activity_activation_delay_insight |= (1 << typ...
{ return s_alarms_app_opened; }
#endif /* CAPABILITY_HAS_HEALTH_TRACKING */ #if PLATFORM_SPALDING void shell_prefs_set_display_offset(GPoint offset) { const GPoint user_offset = gpoint_sub(offset, mfg_info_get_disp_offsets()); prv_pref_set(PREF_KEY_DISPLAY_USER_OFFSET, &user_offset, sizeof(user_offset)); } GPoint shell_prefs_get_display_offset...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
BITS_BETWEEN(3,5)
); cl_assert_equal_i(0b00010000, BITS_BETWEEN(4,4)); } // Flash memory is organized into twelve sectors of unequal sizes. // Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB. // The remaining sectors are 128 KiB. // Bitset of sectors that have been "erased" static uint32_t erased_sector; static bool flash_locked, flash_f...
alue = 100; const int duration = 200; const int delay = 25; const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; static const PropertyAnimationImplementation implementation = { .base = { .setup = prv_setup_handler, .update = (Animatio...
property_animation_get_animation(prop_h)
; void *context = &value; animation_set_handlers(h, handlers, context); animation_set_duration(h, duration); animation_set_delay(h, delay); animation_set_auto_destroy(h, false); prv_clear_handler_histories(); animation_schedule(h); int max_loops = 20; int num_loops = 0; uint64_t start_ms = prv_n...
/* * 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...
(text_heap_info, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD))
; // Get the size of the heap from the beginning of the first thing allocated unsigned long heap_size = 0x20020000 - (unsigned long)start; unsigned long alloc_size = 0.75*heap_size; char *buf = app_malloc_check(alloc_size); snprintf(buf, 80, "%luB/%luB\n\nJust allocated %lu%% of the app heap.", alloc_size, ...
/* * 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_get_user_data(window)
; Layer *window_root_layer = &window->layer; KinoLayer *logo_layer = &data->logo_layer; kino_layer_init(logo_layer, &window_root_layer->bounds); kino_layer_set_reel_with_resource(logo_layer, RESOURCE_ID_WEATHER_CHANNEL_LOGO); layer_add_child(window_root_layer, ...
sageStateAwaitingResetCompleteLocalInitiated || s_state.state == PostMessageStateAwaitingResetCompleteRemoteInitiated); s_state.state = PostMessageStateAwaitingResetRequest; } static void prv_awaiting_reset_request__inbox_received(DictionaryIterator *it, void *context) { if (dict_find(it, PostMessag...
prv_json_parse(json_buffer)
y = (data->state == TimelineAppStateStationary); if (data->state == TimelineAppStateNoEvents) { if (!next) { prv_exit(data); } return; // There are no events } else if (prv_attempt_hide_day_sep(data)) { return; // Successfully interrupted the day separator, let it hide } else if (!prv_set_s...
peek_layer_deinit(&data->peek_layer)
; window_set_click_config_provider_with_context(&data->timeline_window, prv_click_config_provider, data); data->timeline_layer.animating_intro_or_exit = false; if (!finished || (!prv_set_state(s_app_data, TimelineAppStateStationary) && !prv_set_...
(&s_read_consumer.mbuf_iter, s_read_info.footer_byte)
) { // no room left to store this byte s_read_info.should_drop = true; } } // Store this byte in the footer_byte. Note that we will still calculate the checksum on this byte // and verify that the checksum is 0 at the end, so if this byte is the actual footer byte (aka. // the checksum), we will...
ata *data, VoiceStatus error_status) { uint64_t elapsed = prv_get_time_ms() - data->start_ms; const bool speech_detected = (data->speech_detected) || (elapsed < MIN_ELAPSED_DURATION); data->error_count++; if (data->show_error_dialog) { if (error_status == VoiceStatusRecognizerResponseError) { prv_sh...
if (event->type == VoiceEventTypeSilenceDetected) { VOICE_LOG("Silence detected"); prv_stop_dictation(data); }
size; } void attribute_list_add_cstring(AttributeList *list, AttributeId id, const char *cstring) { if (prv_attribute_type(id) != AttributeTypeString) { PBL_LOG(LOG_LEVEL_WARNING, "Adding attribute with type cstring for non-cstring attribute"); } prv_add_attribute(list, id)->cstring = (char*) cstring; } vo...
(prv_attribute_type(id) == AttributeTypeString)
; Attribute *attribute = attribute_find(attr_list, id); return attribute ? attribute->cstring : default_value; } StringList *attribute_get_string_list( const AttributeList *attr_list, AttributeId id) { PBL_ASSERTN(attr_list != NULL); Attribute *attribute = attribute_find(attr_list, id); return attribute...
/* * 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...
event_service_client_subscribe(&state->did_focus_info)
; } if (handlers.will_focus) { state->will_focus_info.type = PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT; state->will_focus_info.handler = prv_focus_event_handler; event_service_client_subscribe(&state->will_focus_info); } state->handlers = handlers; } void app_focus_service_subscribe(AppFocusHandler handle...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
list_get_count()
>= 10) { list_free_last(); } // Create new ScanResult: result = (ScanResult *) malloc(sizeof(ScanResult)); if (!result) { APP_LOG(APP_LOG_LEVEL_ERROR, "Out of memory!"); return; } // Zero out: memset(result, 0, sizeof(ScanResult)); } // Update all the fields into the ...
format <= GBitmapFormat4BitPalette; } T_STATIC GBitmap *prv_gbitmap_create_blank_internal_no_platform_checks(GSize size, GBitmapFormat format) { GBitmap* bitmap = prv_gbitmap_create_blank(size, format); // If bitmap allocated and format requi...
(bitmap, data)
; if (is_builtin) { // for builtin resources, we don't do the extra bitmap manipulation below. return true; } // Verify the metadata is valid const GBitmapFormat format = gbitmap_get_format(bitmap); const size_t addr_offset = offsetof(BitmapData, data); const uint32_t pixel_data_bytes = bitmap->row...
24}, { -528, 136, -224}, { -664, 224, -272}, { -824, 264, -296}, { -808, 296, -152}, { -1096, 736, -584}, { -1064, 160, -392}, { -1040, -48, -168}, { -1680, 448, -752}, { -1544, -144, 56}, { -1336, 256, -248}, { -1032, 232, -160}, { -840, -56, 64}, // 5 seconds { ...
{ -1048, -8, 24}, { -1064, 208, -184}, // 10 seconds { -864, 184, -120}, { -616, 8, 32}, { -568, 176, -16}, { -632, 160, -56}, { -672, 96, -104}, { -904, 176, 24}, { -1064, 224, -352}, { -1152, 232, -280}, { -1208, 280, -248}, { -1560, 184, -208}, { -688, 232, -11...
{ -280, 224, -160}, { -568, 312, -248}, { -840, 456, -184}, { -1008, 264, -544}, { -1128, 200, -280}, { -1264, 304, -248}, { -1488, 248, -216}, { -1784, 224, -296}, { -1104, 48, -96}, { -1048, 200, -272}, { -792, 40, 8}, { -480, 64, -32}, // 13 seconds { -480, 96...
d_sector); cl_assert(flash_locked); } void test_system_flash__erase_some_sectors_from_beginning(void) { cl_assert(system_flash_erase(FLASH_BASE, 128 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 4), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_full_flash(void) { cl_assert(...
(!flash_locked, "Attempted to write to a locked flash")
; cl_assert_(address >= flash_data_start && address < flash_data_start + flash_data_length, "Address out of range"); cl_assert_(flash_written_flag[address - flash_data_start] == false, "Overwriting an already-written byte"); if (return_status == FLASH_COMPLETE) { flash_w...
/* * 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...
{ state = prv_animation_state_get(PebbleTask_Current); }
// Look for this animation by id. It could either be in the unscheduled or scheduled list ListNode* node = list_find(state->unscheduled_head, prv_handle_list_filter, (void*)handle); if (!node) { node = list_find(state->scheduled_head, prv_handle_list_filter, (void*)handle); } if (!node) { if (!quiet...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
for (uint32_t idx = 0; idx < bounds.size.w * bounds.size.h; idx++) { ((GColor *)(bmp->addr + idx))->a = opacity; }
------------------------------------------------------------------------ // Count how many entries were entered for the given animation static uint32_t prv_count_handler_entries(AnimTestHandlerHistory *history, Animation *animation) { uint32_t count = 0; for (int i = 0; i < history->num_calls; i++) { if (!ani...
("%"PRIu64" ms: Executing teardown handler for %d\n", prv_now_ms(), (int)animation)
; } // -------------------------------------------------------------------------------------- // update handler // implemented in Animation.c AnimationPrivate *prv_animation_get_current(void); void prv_update_handler(Animation *animation, const AnimationProgress distance) { // always ensure that animation state gi...
32_t max_streak; int32_t first_streak; int32_t median; } result; stats_calculate_basic(op, data, num_data, NULL, NULL, &result.sum); cl_assert_equal_i(result.sum, 357); cl_assert_equal_i(result.avg, 23); cl_assert_equal_i(result.min, -5); cl_assert_equal_i(result.max, 80); cl_assert_equal_i(result...
(result.max, INT32_MIN)
; cl_assert_equal_i(result.count, 0); cl_assert_equal_i(result.max_streak, 0); cl_assert_equal_i(result.first_streak, 0); cl_assert_equal_i(result.median, 0); } void test_stats__null_data(void) { const StatsBasicOp op = StatsBasicOp_Average; int32_t result = 0x73110; stats_calculate_basic(op, NULL, 0, NU...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ Layer *window_layer = window_get_root_layer(window); GRect bounds = layer_get_bounds(window_layer); s_text_layer = text_layer_create((GRect) { .origin = { 0, 72 }, .size = { bounds.size.w, 20 } }); text_layer_set_text(s_text_layer, "Press a button"); text_layer_set_text_alignment(s_text_layer, GTextAlignme...
or; struct clar_error *errors; struct clar_error *last_error; void (*local_cleanup)(void *); void *local_cleanup_payload; jmp_buf trampoline; int trampoline_enabled; } _clar; struct clar_func { const char *name; void (*ptr)(void); }; struct clar_suite { int index; const char *name; struct cla...
printf("Usage: %s [options]\n\n", arg)
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 "clar.h" #include "util.h" #include <stdio.h> // Hel...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_x_offset_layer.${BIT_DEPTH_NAME}.pbi")
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_nx_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&la...
or); #endif qspi_release(dev->qspi); return result ? S_TRUE : S_FALSE; } void qspi_flash_ll_set_register_bits(QSPIFlash *dev, uint8_t read_instruction, uint8_t write_instruction, uint8_t value, uint8_t mask) { // make sure we're not trying to set any bits not within the mask ...
qspi_indirect_read_dma(dev->qspi, instruction, 0, dummy_cycles, buffer_dma, size, is_ddr)
; profiler_stop(); uint32_t dma_time = profiler_get_total_duration(true); profiler_start(); qspi_indirect_read(dev->qspi, instruction, 0, dummy_cycles, buffer_pol, size, is_ddr); profiler_stop(); uint32_t pol_time = profiler_get_total_duration(true); if (memcmp(buffer_dma, buffer_pol, size) != 0) { ...
time_t timestamp, ANCSProperty properties) { const ANCSAttribute *app_id = notif_attributes[FetchedNotifAttributeIndexAppID]; const ANCSAttribute *display_name = app_attributes[FetchedAppAttributeIndexDisplayName]; const ANCS...
{ TimelineItemAction *action = &notif_prefs->action_group.actions[i]; if (prv_should_hide_reply_because_group_sms(action, app_id, subtitle)) { continue; } attributes_per_action[action_idx++] = action->attr_list.num_attributes; }
} int num_attr = ((title && title->length > 0 && !has_multimedia) ? 1 : 0) + ((display_name && display_name->length > 0) ? 1 : 0) + ((subtitle->length > 0) ? 1 : 0) + ((app_id->length > 0) ? 1 : 0) + ((message->length > 0 || has_multimedia) ? 1 :...
/* * 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_LOG(APP_LOG_LEVEL_ERROR, "Accelerometer error %i", error)
; return; } static char accel_text[20]; #if !ACCEL_RAW_DATA int32_t delta = prv_compute_delta_pos(&accel_data, &s_last_accel_data); s_last_accel_data = accel_data; snprintf(accel_text, sizeof(accel_text), "Accel delta: %"PRIu32, delta); APP_LOG(APP_LOG_LEVEL_INFO, accel_text); #else snprintf(accel_t...
, 160, -32}, { 672, 160, -56}, { 688, 192, -8}, { 808, 152, -32}, { 872, 112, 0}, { 1032, 112, -64}, // 29 seconds { 1072, 112, -64}, { 1032, 112, -112}, { 1168, 160, -152}, { 1168, 160, -56}, { 1056, 208, -104}, { 1232, 216, -152}, { 1256, 272, -160}, { 1000, 288...
{ 816, 168, -48}, { 648, 152, -56}, { 680, 128, -72}, { 776, 136, -8}, { 984, 176, 0}, { 1080, 104, -48}, { 1144, 120, -16}, { 1168, 112, -16}, { 1128, 56, -72}, { 1208, 88, -16}, { 1112, 72, 16}, { 1320, 128, -80}, { 1360, 120, -72}, { 1096, 176, -104}, { 704...
{ 1160, 232, -136}, { 1288, 256, -128}, { 1136, 240, -112}, { 832, 288, -272}, { 576, 200, -120}, { 496, 160, -128}, { 520, 216, -120}, { 664, 240, -160}, { 800, 216, -160}, { 1016, 288, -240}, { 1104, 336, -296}, { 1152, 296, -240}, { 1104, 336, -208}, { 1072, 3...
anyway. return true; } ATTHandleRange *range = (ATTHandleRange *) value; PBL_LOG(LOG_LEVEL_DEBUG, "Service Changed Indication: %x - %x", range->start, range->end); // Initiate rediscovery on KernelBG if the Server is asking us to rediscover everything // (See "2.5.2 Attribute Caching" in BT Core Specific...
PBL_LOG(LOG_LEVEL_INFO, "Indicating Service Changed to remote device")
/* * 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 (address < 0) { prompt_send_response("Invalid address"); return; }
*) property_animation->animation.implementation) ->accessors.setter.gpoint(property_animation->subject, result); } void property_animation_legacy2_update_grect(PropertyAnimationLegacy2 *property_animation, const uint32_t distance_normalized) { GRect result; result.origin...
task_malloc(sizeof(struct PropertyAnimationLegacy2))
nds { -920, -352, 64}, { -1208, -80, -32}, { -1440, 184, 80}, { -1376, 472, -104}, { -1456, 128, -88}, { -1480, -208, 32}, { -1440, 256, -16}, { -1288, 272, 48}, { -1176, 208, 184}, { -1144, 176, 176}, { -1160, 144, 216}, { -1056, 136, 224}, { -1024, 192, 224}, { ...
{ -1560, 0, 296}, { -1488, 48, 232}, { -1312, 56, 200}, { -1256, 152, 136}, { -1280, -16, 40}, { -792, -392, -160}, { -944, -64, -288}, { -1088, -104, -160}, { -1280, 232, -120}, { -1232, 392, -40}, { -1320, 72, 120}, { -1512, -48, 280}, { -1496, 152, 248}, { -148...
// 91 seconds { -1736, 368, -56}, { -1968, 496, -96}, { -2080, 272, 176}, { -1904, 200, 296}, { -1760, 280, 264}, { -1696, 368, 208}, { -1680, 272, 296}, { -1664, 176, 344}, { -1584, 40, 424}, { -1136, 512, 472}, { -1008, 544, 560}, { -712, 456, 656}, { -712, 616...
/* * 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...
{ // Schedule/reschedule the watchdog if (!new_timer_start(s_call_watchdog, poll_interval_ms, prv_timer_callback, NULL, TIMER_START_FLAG_REPEATING)) { PBL_LOG(LOG_LEVEL_ERROR, "Could not start the phone call watchdog timer"); prv_handle_call_end(true /* Treat this as a disco...
else { PBL_LOG(LOG_LEVEL_INFO, "Not starting phone call watchdog, this isn't iOS 8: %d", s_call_source); } } static void prv_cancel_call_watchdog(void) { new_timer_stop(s_call_watchdog); pp_get_phone_state_set_enabled(false); } static bool prv_can_answer(void) { // We can't answer calls with ...
data->hrm_quality = HRMQuality_Excellent; } else if (hrm_data_regs.sqi <= AS7000SQIThreshold_Good) { data->hrm_quality = HRMQuality_Good; } else if (hrm_data_regs.sqi <= AS7000SQIThreshold_Acceptable) { data->hrm_quality = HRMQuality_Acceptable; } else if (hrm_data_regs.sqi <= AS7000SQIThreshold_Poor) { ...
(hrm_handling)
; // Starting to respond to handshake toggle // Reset the watchdog counter s_missing_interrupt_count = 0; *should_context_switch = new_timer_add_work_callback_from_isr(prv_handle_handshake_pulse, NULL); } static void prv_interrupts_enable(HRMDevice *dev, bool enable) { mutex_assert_held_by_curr_task(dev->sta...
= { BLOB_DB_COMMAND_START_SYNC, // cmd 0x12, 0x34, // token BlobDBIdiOSNotifPref, // db id }; static const uint8_t s_start_sync_response[] = { BLOB_DB_COMMAND_START_SYNC_RESPONSE, // cmd 0x12, 0x34, // token BLOB_DB_SUCCESS, // statu...
{ s_expected_msg = s_writeback_message; blob_db_endpoint_send_writeback(BlobDBIdiOSNotifPref, last_updated, &key, 1, &val, 1); }
static const uint8_t s_write_message[] = { BLOB_DB_COMMAND_WRITE, // cmd 0x22, 0x00, // token BlobDBIdiOSNotifPref, // db id 0x01, 0x00, 0x00, 0x00, // last updated 0x01, // key_len key, // key 0x01, 0x00...
/* * 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...
(data->text_buffer, TEXT_BUFFER_SIZE, "Multi Click! (%u)\nMin: 2, Max: 10", count)
; PBL_LOG(LOG_LEVEL_DEBUG, "Multi Click! (%u)", click_number_of_clicks_counted(recognizer)); text_layer_set_text(&data->text, data->text_buffer); toggle_color(window); } static void select_single_click_handler(ClickRecognizerRef recognizer, Window *window) { ClickAppData *data = window_get_user_data(window); ...
layer.h" #include "applib/ui/window.h" #include "applib/ui/window_stack.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "popups/phone_ui.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "services/common/i18n/i18n.h" #include "services/normal/ti...
phone_ui_handle_incoming_call(&caller, true, false, PhoneCallSource_PP)
; } static void prv_select_single_click_handler(ClickRecognizerRef recognizer, void *context) { launcher_task_add_callback(prv_show_incoming_call, NULL); } static void prv_select_long_click_handler(ClickRecognizerRef recognizer, void *context) { SwapLayerDemoData *data = context; data->idx = 0; swap_layer_rel...
uint8_t *buffer = task_malloc(sizeof(PostMessageChunkPayload) + TINY_CHUNK_SIZE); // Chunk 1: { const size_t json_bytes_size = MIN(TINY_CHUNK_SIZE, json_bytes_remaining); const size_t expected_size = sizeof(PostMessageChunkPayload) + json_bytes_size; PostMessageChunkPayload *chunk = (PostMessageChun...
(false /* start_connected */)
ESET_LOOP_DETECT_ONE); break; default: PBL_CROAK("reset loop boot bits overrun"); break; } return false; } static bool prv_check_for_recovery_start_failure() { return boot_bit_test(BOOT_BIT_RECOVERY_START_IN_PROGRESS); } static bool prv_check_for_fw_start_failure() { // Add more failure conditio...
(bootloader_version_str)
; dbgserial_putstr(""); dbgserial_putstr(""); } int main(void) { prv_check_and_handle_resuming_from_standby(); board_init(); dbgserial_init(); dbgserial_putstr("\r\n\r\n\r\n"); dbgserial_putstr("██████╗ ██████╗ ██████╗ ███████╗██████╗ ████████╗"); dbgserial_putstr("██╔══██╗██╔═══██╗██╔══██╗██╔════╝...
text, &GRect(20, 80, 40, 10), 4, GCornersAll, GColorBlack)); #else ASSERT_CALLED(prv_fill_rect_aa(&context, &GRect(20, 80, 40, 10), 4, GCornersAll, GColorBlack)); #endif } void test_graphics_context_${BIT_DEPTH_NAME}__lock(void) { // Test all the setup test combinations as above setup_test(&context, false, 1, GC...
(&draw_state, &context.draw_state, sizeof(GDrawState))
== 0); // Fill Color draw_state = graphics_context_get_drawing_state(&context); graphics_context_set_fill_color(&context, GColorGreen); cl_assert(memcmp(&draw_state, &context.draw_state, sizeof(GDrawState)) == 0); // Compositing Mode draw_state = graphics_context_get_drawing_state(&context); graphics_c...
otifications.h" // Stubs //////////////////////////////////////////////////////////////// #include "stubs_analytics.h" #include "stubs_hexdump.h" #include "stubs_layout_layer.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_prompt.h" #inclu...
memcpy(contact, s_contact_1, sizeof(s_contact_1))
/* * 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...
{ CommSession *app_session = comm_session_get_current_app_session(); const Uuid app_uuid = app_manager_get_current_app_md()->uuid; SettingsFile settings_file; status_t open_status = prv_open(&settings_file); uint64_t cached_capabilities = 0; if (PASSED(open_status)) { settings_file_get(&settings_file...
static void prv_rewrite_cb(SettingsFile *old_file, SettingsFile *new_file, SettingsRecordInfo *info, void *context) { if (!info->val_len) { return; // Cache for this app has been deleted, don't rewrite it } Uuid key; uint64_t...
Y_BUF_LEN], BTBondingID bond_id, BtPersistBondingData *data) { bool matches_prf; if (data->type == BtPersistBondingTypeBTClassic) { prompt_send_response_fmt(display_buf, DISPLAY_BUF_LEN, "Classic Key %d", (int)bond_id); bluetooth_persistent_sto...
memcmp(key, ROOT_KEYS_KEY, info->key_len)
== 0) { SM128BitKey root_keys[SMRootKeyTypeNum], sprf_root_keys[SMRootKeyTypeNum]; PBL_ASSERTN(info->val_len == sizeof(root_keys)); memcpy(&root_keys, val, sizeof(root_keys)); bluetooth_persistent_storage_debug_dump_root_keys(&root_keys[SMRootKeyTypeEncryption], ...
ead_stale_glance_blob(void) { // Force the insertion of a stale glance blob (outdated version) const SerializedAppGlanceHeader app_glance = (SerializedAppGlanceHeader) { .version = APP_GLANCE_DB_CURRENT_VERSION - 1, }; cl_assert_equal_i(app_glance_db_insert_stale((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE,...
cl_assert_equal_i(app_glance_db_read_glance(&APP_GLANCE_TEST_UUID, NULL), E_INVALID_ARGUMENT)
; } void test_app_glance_db__inserting_glance_with_invalid_arguments_fails(void) { // NULL UUID fails const AppGlance glance = {}; cl_assert_equal_i(app_glance_db_insert_glance(NULL, &glance), E_INVALID_ARGUMENT); // NULL glance fails cl_assert_equal_i(app_glance_db_insert_glance(&APP_GLANCE_TEST_UUID, NULL...
/////////////// // Callback Functions // // Up/Down click handler static void prv_up_down_click_handler(ClickRecognizerRef recognizer, void *context) { HealthCardView *health_card_view = context; const bool slide_up = (click_recognizer_get_button_id(recognizer) == BUTTON_ID_UP); const int next_card_index = prv_g...
prv_refresh_content_indicators(health_card_view)
; return health_card_view; } void health_card_view_destroy(HealthCardView *health_card_view) { // destroy cards health_activity_summary_card_destroy(health_card_view->card_layers[Card_ActivitySummary]); health_sleep_summary_card_destroy(health_card_view->card_layers[Card_SleepSummary]); // destroy self wi...
memcpy(ctx->buffer, data, copied_size)
; ctx->copied_size = copied_size; ctx->company_id = company_id; return false; // stop parsing } size_t ble_ad_copy_manufacturer_specific_data(const BLEAdData *ad, uint16_t *company_id, uint8_t *buffer, size_t size) { s...