prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
he 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 * distributed under the License i...
{ rx_tan /= cos_sq; }
ssion = comm_session_get_current_app_session(); *session_in_out = ((!*session_in_out) || (*session_in_out == permitted_session)) ? permitted_session : NULL; } // Helpers //////////////////////////////////////////////////////////////////////////////////////////////////// static void prv_send_out...
app_free(outbox_data)
; } void test_app_message_sender__system_session_but_not_js_app(void) { AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbox_message(s_system_session_ptr, ALLOWED_ENDPOINT_ID, TEST_PAYLOAD, sizeof(TEST_PAYLOAD)); assert_consumed(AppMessageSenderErrorDisco...
/* * 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(flash_locked)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_ALERTS_DND_ACTIVE_TIME); }
} static void prv_put_dnd_event(bool is_active) { PebbleEvent e = (PebbleEvent) { .type = PEBBLE_DO_NOT_DISTURB_EVENT, .do_not_disturb = { .is_active = is_active, } }; event_put(&e); } static char *prv_bool_to_string(bool active) { return active ? "Active" : "Inactive"; } static void prv_...
parent, char *name, jerry_external_handler_t handler) { bool result = false; JS_UNUSED_VAL = rocky_get_or_create_object(parent, name, prv_create_function, handler, &result); return result; } bool rocky_add_global_function(char *name, jerry_external_handler_t handler) { return rocky_add_function(jerry_create_u...
(1900 + tick_time->tm_year)
, jerry_create_number(tick_time->tm_mon), jerry_create_number(tick_time->tm_mday), jerry_create_number(tick_time->tm_hour), jerry_create_number(tick_time->tm_min), jerry_create_number(tick_time->tm_sec) }; date_obj = jerry_construct_object(date_constructor, args, ARRAY_LENGTH(args)); for (u...
s *bus) { #if MICRO_FAMILY_STM32F7 // STM32F7 needs to access as 8 bits in order to actually do 8 bits. // This _does_ work on F4, but QEMU doesn't agree, so let's just do it safely. return *(volatile uint8_t*)&bus->spi->DR; #else return bus->spi->DR; #endif } void prv_spi_enable_peripheral_clock(const SPIBus ...
{ return; }
// copy the speed over to the transient state since the slave port can change it bus->state->spi_clock_speed_hz = bus->spi_clock_speed_hz; prv_spi_pick_peripheral(bus); bus->state->initialized = true; // SCLK prv_configure_spi_sclk(&bus->spi_sclk, bus->spi_sclk_speed); // MOSI gpio_af_init(&bus->spi_mo...
app_install_manager__cleanup(void) { } /************************************* *************************************/ void test_app_install_manager__get_id_invalid_uuid(void) { const Uuid made_up = {0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0...
app_install_has_worker(CRAZY_ID)
); } void test_app_install_manager__is_hidden(void) { cl_assert_equal_b(false, app_install_is_hidden(tictoc_id)); cl_assert_equal_b(false, app_install_is_hidden(music_id)); cl_assert_equal_b(true, app_install_is_hidden(sports_id)); cl_assert_equal_b(false, app_install_is_hidden(bg_counter_id)); cl_assert_eq...
or not. uint8_t file_id:FILE_ID_BIT_WIDTH; //! Just in case we have to change this struct in the future. uint8_t version_id:VERSION_ID_BIT_WIDTH; } FileHeaderBasic; typedef struct PACKED { char version_tag[FW_METADATA_VERSION_TAG_BYTES]; uint8_t is_recovery; } FileHeaderDetails; typedef struct PACKED { F...
generation_to_index(file_generation)
nection *s_connection; static uint16_t s_handle; static BTDeviceInternal prv_dummy_device(uint8_t octet) { BTDeviceAddress address = { .octets = { [0] = octet, [1] = octet, [2] = octet, [3] = octet, [4] = octet, [5] = octet, }, }; BTDevice device = bt_device_init_with_...
(characteristic_out, characteristic)
; } } free(buffer); } static void prv_assert_notification_event(BLECharacteristic characteristic, const uint8_t *value, uint16_t assert_value_length, bool kernel, bool app) { prv_assert_notification_event_ext(characteristic, ...
ismiss_action_attr_list, AttributeIdTitle, i18n_get("Dismiss", &notif_attr_list)); AttributeList open_app_action_attr_list = {}; AttributeList open_pin_action_attr_list = {}; // Unfortunately, open app and pin both need the parent uuid, so they are mutually exclusive // Give open p...
i18n_noop("Killer job! You've walked %d steps today which is %d%% above your typical. " "Do it again tomorrow and you'll be on top of the world!")
, i18n_noop("Nice moves! You've walked %d steps today which is %d%% above your typical. " "Crush it again tomorrow 😀"), i18n_noop("Hey rockstar 🎤 You've walked %d steps today " "which is %d%% above your typical. Nothing can stop you!"), i18n_noop("We can bar...
/* * 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...
gpio_af_init(&BMA255_MISO_CONFIG, GPIO_OType_PP, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL)
; gpio_af_init(&BMA255_MOSI_CONFIG, GPIO_OType_PP, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL); gpio_output_init(&BMA255_SCS_CONFIG, GPIO_OType_PP, GPIO_Speed_50MHz); SPI_InitTypeDef spi_cfg; SPI_I2S_DeInit(BMA255_SPI); spi_cfg.SPI_Direction = SPI_Direction_2Lines_FullDuplex; spi_cfg.SPI_Mode = SPI_Mode_Master; ...
uf, 256, "%llo,%jo", hurf, hurf); cl_assert_equal_s(dstbuf, "110642547423257157360,110642547423257157360"); snprintf(dstbuf, 256, "%zo,%to", hurf, hurf); cl_assert_equal_s(dstbuf, "23257157360,23257157360"); } void test_sprintf__percent_x(void) { char dstbuf[256]; // Simple %x snprintf(dstbuf, 256, "There...
(dstbuf, 256, "There are %+X lights, the absolute value of %+X", 16, -4)
; cl_assert_equal_s(dstbuf, "There are 10 lights, the absolute value of FFFFFFFC"); // Minimum digits output snprintf(dstbuf, 256, "There are %.3X lights, %.3X", 16, -4); cl_assert_equal_s(dstbuf, "There are 010 lights, FFFFFFFC"); // Minimum digits output (zero digits) snprintf(dstbuf, 256, "%.0Xzero%.0X...
(AlgState) { .mutex = mutex_create_recursive(), .k_state = k_state, }; shared_circular_buffer_init(&s_alg_state->minute_data_cbuf, (uint8_t *)s_alg_state->minute_data_storage, sizeof(s_alg_state->minute_data_storage)); shared_circular_buffer_add_...
ROUND(ambient_light_get_light_level(), ALG_RAW_LIGHT_SENSOR_DIVIDE_BY)
tric_updated_count = 0; } void test_health_db__cleanup(void) { } // Dummy Data //////////////////////////////////////////////////////////////// #define NUM_CURRENT_MOVEMENT_METRICS 5 #define NUM_CURRENT_SLEEP_METRICS 4 #define NUM_CURRENT_HR_ZONE_METRICS 3 typedef enum MovementDataFields { MD_Version, MD_Times...
(health_db_get_typical_value(ActivityMetricSleepTotalSeconds, Monday, &val_out))
; cl_assert_equal_i(val_out, s_sleep_data[SD_TypicalSleepDuration]); // flush cl_assert_equal_i(health_db_flush(), S_SUCCESS); // check cl_assert(!health_db_get_typical_value(ActivityMetricSleepTotalSeconds, Monday, &val_out)); // insert something with an older version (this will succeed) cl_assert_equ...
NULL, fonts_get_system_font(name_font_key), GColorBlack, name_bg_color, GTextAlignmentCenter, GTextOverflowModeTrailingEllipsis); layer_add_child(&url_text_layer->layer, &name_text_layer->layer); data->is_showing_version = false; prv_update_...
getting_started_button_combo_deinit(&data->button_combo_state)
; kino_layer_deinit(&data->kino_layer); event_service_client_unsubscribe(&data->pebble_mobile_app_event_info); event_service_client_unsubscribe(&data->bt_connection_event_info); event_service_client_unsubscribe(&data->pebble_gather_logs_event_info); event_service_client_unsubscribe(&data->ble_device_name_up...
ction(pin, action, NULL); break; } return data; } // invoke actions that are immediately handled locally static void prv_invoke_local_action(const TimelineItemAction *action, const TimelineItem *pin) { timeline_invoke_action(pin, action, NULL); } static void prv_do_action_analytics(const TimelineItem *pi...
if (data) { data->action_complete.callback = complete_cb; data->action_complete.callback_data = cb_data; // We can assume that this is a standalone action since we have no action menu data->standalone_action = true; } else if (complete_cb) { // If data is NULL, something went wrong (or local acti...
} static void prv_push_dismiss_first_use_dialog(ActionMenu *action_menu) { if (alerts_preferences_check_and_set_first_use_complete(FirstUseSourceDismiss)) { return; } const char* tutorial_msg = i18n_get("Quickly dismiss all notifications by holding the " \ "Select butt...
rogress, int32_t total_progress, int32_t line_length, int32_t line_width, GRect frame, GColor color) { const GPoint line_outer_point = prv_steps_to_point(current_progress, total_progress, frame); #if PBL_RECT const GPoint line_inner_point = prv_inset_point(&frame, line_outer_point, l...
strftime(am_pm_buffer, sizeof(am_pm_buffer), "%p", pbl_override_localtime(&now))
; health_util_create_text_node_with_text( am_pm_buffer, am_pm_font, GColorWhite, container); } #if PBL_BW bounds.origin.y = screen_is_obstructed ? (has_bpm ? 13 : 23) : (has_bpm ? 36 : 53); #elif ROBERT_SCREEN_RES bounds.origin.y = screen_is_obstructed ? -12 : 6; #elif SNOWY_SCREEN_RES bounds.origi...
/* * 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_putstr("erase_old_firmware"); return system_flash_erase( FIRMWARE_BASE, firmware_length, prv_display_erase_progress, 0); }
static void prv_display_write_progress( uint32_t progress, uint32_t total, void *ctx) { display_firmware_update_progress(progress/2 + total/2, total); } static bool write_new_firmware(uint32_t flash_new_fw_start, uint32_t firmware_length) { dbgserial_putstr("write_new_firmware"...
e to swap... lm_p0 = far_left; lm_p1 = far_bottom; } if (y > rm_p1.y.integer) { // We're crossing far_right point, time to swap... rm_p0 = far_right; rm_p1 = far_bottom; } // Starting and ending point of the line, initialized with extremes Fixed_S1...
MAX(p0.x.raw_value, p1.x.raw_value)
+ radius.raw_value) >> FIXED_S16_3_PRECISION, clip_min_x, clip_max_x); // Blending of first line if (fraction_for_left != 0) { int16_t x = x_min; if (x > tm_p1.x.integer) { // We're crossing far_top point, time to swap... tm_p0 = far_top; tm...
y("outside_y_origin_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_x_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_x_y_origin_layer", ctx.parent_framebuffer, GColorWhite)); } void ...
(p.x + 2, p.y)
); graphics_draw_pixel(ctx, GPoint(p.x + 3, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 6, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y)); graphics_draw_pixel(ctx, GPoint(p.x + 0, p.y + 1)); graphics_d...
tex.h" #include "system/passert.h" #include "util/size.h" //! Flags used for internal purposes (bits 24-31 are allocated for this purpose) #define MBUF_FLAG_IS_MANAGED ((uint32_t)(1 << 24)) #define MBUF_FLAG_IS_FREE ((uint32_t)(1 << 25)) T_STATIC MBuf *s_free_list; static PebbleMutex *s_free_list_lock; //! This arra...
PBL_ASSERTN(m)
; m->next = NULL; } // Debug //////////////////////////////////////////////////////////////////////////////// void mbuf_debug_dump(MBuf *m) { char buffer[80]; while (m) { dbgserial_putstr_fmt(buffer, sizeof(buffer), "MBuf <%p>: length=%"PRIu32", data=%p, " "flags=0x%"PRIx32, m, m->...
(GColorBlack.r == 0b00)
; cl_assert(GColorBlack.g == 0b00); cl_assert(GColorBlack.b == 0b00); cl_assert(GColorBlack.a == 0b11); } void test_graphics_colors__white(void) { cl_assert(GColorWhite.r == 0b11); cl_assert(GColorWhite.g == 0b11); cl_assert(GColorWhite.b == 0b11); cl_assert(GColorWhite.a == 0b11); } void test_graphics_...
#define RADIUS_MIN_CALCULATED 3 #define RADIUS_MAX_PRECOMPUTED 2 #define RADIUS_SMALL 1 #define RADIUS_NONE 0 #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 30, 40) #define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 30, 40) #define CENTER_OF_ORIGIN_RECT GPoint(...
(&layer, &inside_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_inside_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_b...
ACKED_STR2FMT_OFFSET) & PACKED_STR2FMT_MASK; unsigned level = (packed_loghash >> PACKED_LEVEL_OFFSET) & PACKED_LEVEL_MASK; unsigned hash = (packed_loghash & PACKED_HASH_MASK) | ((CORE_ID_BLE & PACKED_CORE_MASK) << PACKED_CORE_OFFSET); // Calculate the total message size. This is more complicat...
hc_endpoint_logging_send_msg((HcProtocolMessage *)&OVERRUN.hc_header)
; } } // Re-use the msg_buffer. va_start(args, packed_loghash); int header_length = snprintf((char *)msg_buffer, msg_buffer_size, ":0> NL:%x", hash); int length = vsnprintf((char *)msg_buffer + header_length, msg_buffer_size - header_length, expanded_fmt_buffer, args); length ...
/* * 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 ((const PebbleProcessMdFlash*) md)->build_id; }
return NULL; } ////////////////////// // Md Builders ////////////////////// static void prv_init_from_info_common(PebbleProcessMd *common, const PebbleProcessInfo *info, PebbleTask task, ProcessStorage process_storage) { memcpy(&common->uuid, &info->uuid, sizeof(Uuid)); common->process_storage = process...
est_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 3); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_D...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw2_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 2); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, tr...
/* * 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...
{ case BtTestStateStopped: { new_state = BtTestStateStarting; bt_ctl_set_override_mode(BtCtlModeOverrideStop); break; } case BtTestStateStarted: { new_state = BtTestStateStopping; bt_ctl_set_override_mode(BtCtlModeOverrideRun); break; } case BtTestStateStarting: ...
data->test_state = new_state; update_text_layers_callback(data); } static void bt_test_reset_callback(void *timer_data) { RebootReason reason = { RebootReasonCode_MfgShutdown, 0 }; reboot_reason_set(&reason); system_reset(); } static void back_single_click_handler(ClickRecognizerRef recognizer, Window *wi...
ct_ping)); psleep(10); dialog_spi_receive_data_no_wait(buffer, sizeof(buffer)); if (memcmp(buffer, core_dump_connect_response, sizeof(core_dump_connect_response)) == 0) { PBL_LOG(LOG_LEVEL_INFO, "Core Dump connect response received"); return true; } } PBL_LOG(LOG_LEVEL_ERROR, "Failed to ...
if (!core_dump_reserve_ble_slot(&flash_addr, &max_size, (ElfExternalNote *)build_id)) { PBL_LOG(LOG_LEVEL_ERROR, "Can't reserve slot for BLE core dump"); goto powerdown; }
uint32_t flash_addr_max = flash_addr + max_size; PBL_LOG(LOG_LEVEL_DEBUG, "Using flash slot %lx %lx", flash_addr, flash_addr_max); // Read every region from the region table in blocks of 16k. cmd.cmd = CoreDumpCmd_ReadMemory; for (int region = 0; region < MemoryRegionTagCount; ++region) { if (region == ...
_PIXEL_BIT: ++data->pixel_bit; if (data->pixel_bit >= PIXEL_BIT_COUNT) { data->pixel_bit = 0; } break; case ATTRIBUTE_X: if (data->intersection.x < bounds.size.w - 1) { ++data->intersection.x; } break; case ATTRIBUTE_Y: if (data->intersection.y < b...
GColorFromRGB(r * saturation, g * saturation, b * saturation)
; graphics_context_set_stroke_color(ctx, line_color); graphics_draw_line(ctx, GPoint(0, data->intersection.y), GPoint(bounds.size.w, data->intersection.y)); graphics_draw_line(ctx, GPoint(data->intersection.x, 0), GPoint(data->intersection.x, bounds.size.h)); } static vo...
); dialog_set_icon(dialog, data->resource_id_25); dialog_show_status_bar_layer(dialog, true); expandable_dialog_set_header(expandable_dialog, "Header"); app_expandable_dialog_push(expandable_dialog); } //////////////////////////////// // Expandable Dialog with multi line header static void prv_show_expandabl...
(transcription_dialog)
; transcription_dialog_set_callback(transcription_dialog, prv_transcription_dialog_cb, data); } ///////////////////////////////////// // Set up dialog labels and callbacks typedef struct DialogNode { const char *label; void (*show)(DialogsData *data); } DialogNode; static const DialogNode nodes[] = { { .labe...
/* * 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...
modal_manager_get_top_window()
) { modal_manager_pop_all(); } modal_manager_set_min_priority(ModalPriorityMax); system_app_state_machine_panic(); } uint32_t launcher_panic_get_current_error(void) { return s_current_error; } void command_sim_panic_cb(void* data) { PebbleEvent event = { .type = PEBBLE_PANIC_EVENT, .panic = { ...
ords[i]; // Verify the header info cl_assert_equal_i(record->version, ACTIVITY_RAW_SAMPLES_VERSION); cl_assert_equal_i(record->len, sizeof(ActivityRawSamplesRecord)); if (i == 0) { cl_assert(record->flags & ACTIVITY_RAW_SAMPLE_FLAG_FIRST_RECORD); } else { cl_assert(!(record->flags & ACT...
health_service_activities_iterate(HealthActivityMaskAll, now - (2 * SECONDS_PER_DAY), now, direction, prv_activity_iterate_cb, NULL)
; PBL_LOG(LOG_LEVEL_DEBUG, "Found %"PRIu32" activities", s_health_sessions_count); *session_entries = s_health_sessions_count; } static void prv_assert_equal_activity_and_health_sleep_sessions(int exp_num_sessions) { // Get the sleep sessions and make sure we get the expected ones stub_pebble_tasks_set_curren...
_top; tm_p1 = far_right; } if (x > bm_p1.x.integer) { // We're crossing far_bottom point, time to swap... bm_p0 = far_bottom; bm_p1 = far_right; } // Starting and ending point of the line, initialized with extremes Fixed_S16_3 top_margin = {.raw_value = IN...
PBL_ASSERTN(*width >= MINIMUM_PRECISE_STROKE_WIDTH)
; if (*width % 2 == 0) { (*width)++; } } static void prv_draw_stroked_line_override_aa(GContext* ctx, GPointPrecise p0, GPointPrecise p1, uint8_t width, bool anti_aliased) { #if PBL_COLOR // Force antialiasing setting bool temp_anti_aliased = ctx->draw_state.a...
-448}, { -200, 1120, -552}, { 264, 1320, -608}, { 152, 1216, -536}, { 96, 1032, -408}, { 160, 992, -392}, { 152, 784, -368}, { 64, 592, -360}, { 16, 488, -296}, { 24, 544, -248}, { 40, 680, -280}, { 72, 728, -352}, { 136, 888, -528}, { 168, 888, -584}, { 280, 992...
{ 136, 856, -448}, // 64 seconds { 176, 944, -584}, { 320, 1072, -592}, { 208, 992, -600}, { 112, 888, -576}, { 176, 728, -552}, { 192, 728, -472}, { 112, 632, -384}, { 32, 488, -352}, { -32, 424, -280}, { -40, 592, -328}, { -64, 784, -392}, { -104, 880, -480}, ...
{ 160, 1192, -416}, { 192, 1144, -344}, { 128, 896, -424}, { 88, 624, -432}, { 64, 512, -328}, { -8, 432, -264}, { -104, 504, -216}, { -72, 720, -312}, { -16, 848, -360}, // 67 seconds { 80, 1000, -384}, { 112, 1232, -688}, { 16, 960, -424}, { 176, 1288, -608}, ...
egate_averaged(HealthMetricHeartRateBPM, now_utc - 60, now_utc - 60, HealthAggregationAvg, HealthServiceTimeScopeOnce); cl_assert_equal_i(123, result); // The function call is the equivalent to `peek_value` with HeartRateBPM ...
{ prv_update_stats(&weekend_stats, value); }
(LOG_LEVEL_INFO, "Ignoring reset request because local client already requested.")
; return; } if (client->state == StateConnectedClosedAwaitingResetCompleteRemoteInitiatedReset) { // Already in remote-initiated reset procedure, server retrying? // See https://pebbletechnology.atlassian.net/browse/PBL-12424 PBL_LOG(LOG_LEVEL_INFO, "Ignoring reset request because remote server alre...
ices/common/system_task.h" #include "services/normal/blob_db/pin_db.h" #include "system/logging.h" #include "system/passert.h" #include "system/status_codes.h" #include "util/time/time.h" typedef struct TimelineEventState { const TimelineEventImpl *impl; SerializedTimelineItemHeader *filter_header; void *context...
(LOG_LEVEL_ERROR, "Failed to find next event.")
applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "process_management/app_manager.h" #include "process_management/sdk_shims.h" #include "process_state/app_state/app_state.h" #include "system/logging.h" typedef struct AppState { Window window; ScrollLayer scroll_layer; TextLayer text_layer_1; TextLayer te...
WINDOW_NAME("Text Flow")
); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); const bool animated = true; app_window_stack_push(window, animated); } //////////////////// // App boilerplate static void handle_init(void) { struct AppState* data = app_zalloc_...
SET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 4); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_re...
(&ctx, 3, 2 * CLIP_OFFSET, 1)
tion *)anim); } // cancel the flying animation static void prv_stop_fly_dot(VoiceUiData *data) { if (animation_is_scheduled((Animation *)data->mic_window.fly_anim)) { GRect to; property_animation_get_to_grect(data->mic_window.fly_anim, &to); animation_unschedule((Animation *)data->mic_window.fly_anim); ...
window_single_click_subscribe(BUTTON_ID_BACK, &prv_mic_click_handler)
; } static void prv_enable_select_click(VoiceUiData *data) { window_set_click_config_provider_with_context(&data->mic_window.window, prv_back_select_click_config_provider, data); } static void prv_disable_select_click(VoiceUiData *data) { window_set_click_config_provider_with_context(&data->mic_window.windo...
== large_file_size); uint8_t *b = calloc(sz, 1); cl_assert(pfs_read(fd, b, sz) == sz); for (int j = 0; j < large_file_size / 4; j++) { uint32_t *val = ((uint32_t *)((uint8_t *)b)) + j; cl_assert(*val == (curr | (curr << 16))); curr++; } cl_assert(pfs_close(fd) == S_SUCCESS); ...
(0, 0x1000000)
; extern void ftl_force_version(int version_idx); pfs_init(true); ftl_force_version(1); // simulate a migration by leaving leaving files in various states // in the first region. Then try to add another region and confirm // none of the files have been corrupted char file_small[10]; char buf[50]; c...
ator in `<hour> hours, <minute> minutes, and <second> seconds` i18n_ctx_noop("TmplStringSep", ", and "), }, }; /* Flag truth table. fmt = >= 1 hour >= 1 minute other %T = %H:%0M:%0S %M:%0S %S %uT = %uH, %uM, and %uS %uM, and %uS %uS %...
i18n_ctx_noop("TmplStringPlur", " hours")
// - Scheduled simultaneously // - Transition card to pin // - Move timeline layer from the left // - After completion // - Bounce back the timeline layer // - Move pin window to the right animation_unschedule(data->current_animation); timeline_layer_set_layouts_hidden(&data->timeline_la...
(window, &(WindowHandlers) { .load = prv_timeline_window_load, .appear = prv_timeline_window_appear, .disappear = prv_timeline_window_disappear, .unload = prv_timeline_window_unload })
no parent at all, can't be if (!animation->parent) { return false; } if (animation->parent == parent) { // Direct descendent return true; } // Get parent's parent animation = animation->parent; } return false; } // -------------------------------------------------------...
{ // For a complex animation, check each component for (int child_idx = 0; child_idx < ANIMATION_MAX_CHILDREN; child_idx++) { AnimationPrivate *child = prv_find_animation_by_parent_child_idx(state, animation, child_idx); if (!child) { break; } if (child->type == AnimationTypePrim...
SPIC_CTRLBUS_REG = 0x0; QSPIC->QSPIC_CTRLMODE_REG = 0x0; QSPIC->QSPIC_BURSTCMDA_REG = 0x0; QSPIC->QSPIC_BURSTCMDB_REG = 0x0; QSPIC->QSPIC_WRITEDATA_REG = 0x0; QSPIC->QSPIC_DUMMYDATA_REG = 0x0; QSPIC->QSPIC_ERASECTRL_REG = 0x0; QSPIC->QSPIC_ERASECMDA_REG = 0x0; QSPIC->QSPIC_ERASECMDB_REG = 0x0; QSPIC->...
REG_SETF(DCDC, DCDC_RET_0_REG, DCDC_V18P_RET_CYCLES, 0x5)
; REG_SETF(DCDC, DCDC_RET_0_REG, DCDC_V18P_CUR_LIM_RET, 0xA); REG_SETF(DCDC, DCDC_RET_0_REG, DCDC_VDD_RET_CYCLES, 0x5); REG_SETF(DCDC, DCDC_RET_0_REG, DCDC_VDD_CUR_LIM_RET, 0x6); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V18_RET_CYCLES, 0x5); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V18_CUR_LIM_RET, 0xA); REG_SETF(DC...
/* * 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...
(idx, irq)
[idx + 16] = irq##_IRQHandler, #include "irq_stm32f7.def" #undef IRQ_DEF };
get_midnight_of(header->timestamp); for (int i = 1; i < num_nodes - 1; i++) { midnight += SECONDS_PER_DAY; nodes[i]->timestamp = midnight; nodes[i]->duration = MINUTES_PER_DAY; nodes[i]->all_day = true; } } static void prv_set_nodes_all_day(TimelineNode *nodes[], CommonTimelineItemHeader *header, ...
time_util_get_midnight_of(now)
; return prv_show_event(&node, now, midnight, direction, false /* show_all_day */); } #ifdef TIMELINE_SERVICE_DEBUG static void prv_debug_print_pins(TimelineNode *node0) { TimelineNode *node = (TimelineNode *)list_get_head((ListNode *)node0); PBL_LOG(LOG_LEVEL_DEBUG, "= = = = = = = ="); while (node) { PBL_...
/* * 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...
(expandable_dialog)
; } // ----------------------------------------------------------------------------------------- static void prv_display_scalar_history_alert(ActivityDemoAppData *data, const char *title, ActivityMetric metric) { strcpy(data->debug_card.dialog_text, title); // Get His...
te_msg(void) { uint32_t timeout = 3000; // Wait 3 seconds before rebooting so there is time to show the update complete screen PBL_LOG(LOG_LEVEL_ALWAYS, "Delaying reset by 3s so the UI can update..."); TimerID timer = new_timer_create(); // Don't bother cleaning up this timer, we're going to reset PBL_ASSER...
}; event_put(&e); prv_handle_firmware_complete_msg(); break; } case SysMsgFirmwareFail: { PBL_LOG_VERBOSE("Firmware transfer failed, time to clean up!"); PebbleEvent e = { .type = PEBBLE_SYSTEM_MESSAGE_EVENT, .firmware_update.type = PebbleSystemMessageFirmwareUpdateFailed, }...
} void system_message_send_firmware_start_response(FirmwareUpdateStatus status) { struct PACKED { uint8_t zero; uint8_t type; uint8_t status; } msg = { .zero = 0x00, .type = SysMsgFirmwareStartResponse, .status = status }; CommSession *session = comm_session_get_system_session(); co...
/* * 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 PebbleProcessMdSystem s_test_mpu_info = { .common.main_func = prv_main, .name = "Test MPU cache" }; return (const PebbleProcessMd*) &s_test_mpu_info; }
nfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 }); prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_CUSTOM, schedule_1); cl_assert_equal_i(s_num_timeline_adds, 2); // First alarm goes off. Second one should be up s_current_hour = 10; s_current_minute = 30; s...
(s_num_alarms_fired, 0)
; // Disable the 11:30 alarm alarm_set_enabled(id2, false); // The 11:30 alarm should not go off either s_current_hour = 12; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 0); // Enable the 11:30 alarm - now it should go off s_current_hour = 11; alarm_set_enabled(id2, true); s_curre...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(s_mapped_refcount_for_task[task] != 0)
; s_mapped_refcount_for_task[task]--; flash_release_many(1); } void resource_mapped_release_all(PebbleTask task) { flash_release_many(s_mapped_refcount_for_task[task]); s_mapped_refcount_for_task[task] = 0; } #endif
the timer expires is returned. // // If there is a timer running that has expired, the timer state is cleared so // that subsequent calls do not expire the same timer twice, sequence_number is // filled with the sequence number of the expired timer, and 0 is returned. static TickType_t prv_poll_timer(uint8_t *const se...
(s_tx_buffer_mutex != INVALID_MUTEX_HANDLE)
; } void pulse_start(void) { s_pulse_task_queue = xQueueCreate(RX_QUEUE_SIZE, sizeof(uint8_t)); s_pulse_task_service_semaphore = xSemaphoreCreateBinary(); s_reliable_timer_state_lock = mutex_create(); TaskParameters_t task_params = { .pvTaskCode = prv_pulse_task_main, .pcName = "PULSE", .usStackDe...
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 KIND, either expres...
{ // Using one "global" lock for all app outboxes. // If needed, we could easily give each app outbox its own mutex, but it seems overkill right now. mutex_lock_recursive(s_app_outbox_mutex); }
static void prv_unlock(void) { mutex_unlock_recursive(s_app_outbox_mutex); } static AppOutboxConsumer *prv_consumer_for_tag(AppOutboxServiceTag tag) { if (tag == AppOutboxServiceTagInvalid) { return NULL; } AppOutboxConsumer *consumer = &s_app_outbox_consumer[tag]; if (consumer->message_handler == NULL...
ow1, true); cl_assert_equal_i(window1->on_screen, false); cl_assert_equal_i(window_stack_count(app_stack), 0); window_destroy(window1); window_destroy(window2); } // Description: // This test ensures that the flow of adding a window to the window stack is followed // correctly. That is, we add the window to...
window_create()
callback static void menu_select_callback(int index, void *ctx) { PBL_LOG(LOG_LEVEL_DEBUG, "Selected menu item %d", index); // Here we just change the subtitle to a literal string s_app_data->menu_items[index].subtitle = "You've hit select here!"; // Mark the layer to be updated layer_mark_dirty(simple...
(stuck_system_task_callback, NULL)
; } else if (index == 12) { PBL_LOG(LOG_LEVEL_INFO, "Generate hard-fault"); // Modify behavior of the ARM so that bus faults generate a hard fault SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; // Write to protected memory extern uint32_t __isr_stack_start__[]; __isr_stack_start__[0] = 0x55; }...
/* * 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...
{ // File open failed, return live data without saving to cache goto done; }
if (new_capabilities != cached_capabilities) { settings_file_set(&settings_file, &app_uuid, sizeof(app_uuid), &new_capabilities, sizeof(new_capabilities)); } } else { // Not connected, use cached data. if (FAILED(open_status)) { // File o...
&timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(2)->pin.header.id)); cl_assert(timeline_mo...
timeline_model_is_empty()
------------------------------------------------------------------ static void prv_send_bytes(void *p, uint32_t size) { uint8_t *src = (uint8_t *)p; for (uint32_t i=0; i<size; i++) { qemu_test_add_byte_from_isr(&s_state, *src++); } } // -----------------------------------------------------------------------...
prv_send_footer()
/* * 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_DEBUG, "Executing setup handler for %d", (int)animation); }
// -------------------------------------------------------------------------------------- // teardown handler static void prv_teardown_handler(Animation *animation) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Executing teardown handler for %d", (int)animation); } // ------------------------------------------------------------...
ayout_create(&config); } static void prv_property_animation_grect_update(Animation *animation, const AnimationProgress progress) { PropertyAnimationPrivate *property_animation = (PropertyAnimationPrivate *)animation; if (property_animation) { layer_set_frame(prop...
layer_set_hidden(&s_notification_window_data.action_button_layer, false)
, 504, 384}, { -1328, 200, 392}, { -1240, 144, 352}, { -1224, 136, 288}, { -1080, 120, 280}, { -928, 112, 184}, { -784, 144, 192}, { -728, -32, 136}, { -648, -200, 40}, { -640, 48, -56}, { -1080, 232, 72}, { -1432, 504, 72}, { -1760, 720, 32}, { -1688, 328, 320}, ...
{ -1328, 336, 192}, { -1248, 352, 200}, { -920, 264, 176}, { -752, 160, 256}, { -768, 208, 272}, { -744, 208, 296}, // 110 seconds { -728, 208, 344}, { -880, 312, 472}, { -776, 224, 664}, { -1344, 488, 400}, { -1344, 104, 608}, { -1128, 304, 424}, { -1176, 392, 31...
t = bt_persistent_storage_get_bt_classic_pairing_by_addr(&addr_in, &link_key_out, name_out, &platform_bits_out); cl_assert(id_out == BT_BONDING_ID_INVALID); } void test_bluetooth_persistent_storage__delete_bt_classic_pairing_by_id(void) { bool ret; // Output...
bt_persistent_storage_delete_bt_classic_pairing_by_addr(&dummy_addr)
; // Make sure the pairing is actually still there ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); // And delete is again bt_persistent_storage_delete_bt_classic_pairing_...
{ if (info->key_len != sizeof(ActivitySettingsKey)) { PBL_LOG(LOG_LEVEL_WARNING, "Unexpected key len: %"PRIu32" ", (uint32_t)info->key_len); return; } // rewrite this entry ActivitySettingsKey key; info->get_key(old_file, &key, info->key_len); void *data = kernel_malloc_check(info->val_len); inf...
// ---------------------------------------------------------------------------------------------- // Migrate settings from an earlier version now if necessary static SettingsFile *prv_settings_migrate(SettingsFile *file, uint16_t *written_version) { status_t result = E_ERROR; ActivitySettingsKey key = ActivityS...
and response code BlobDBToken token; BlobDBResponse response_code; prv_read_token_and_response(data, &token, &response_code); BlobDBSyncSession *sync_session = blob_db_sync_get_session_for_token(token); if (sync_session) { if (response_code == BLOB_DB_SUCCESS) { blob_db_sync_next(sync_session); ...
{ BlobDBCommand cmd; BlobDBToken token; BlobDBId db_id; uint32_t last_updated; }
writeback_metadata = { .cmd = cmd, .token = prv_new_token(), .db_id = db_id, .last_updated = last_updated, }; size_t writeback_length = sizeof(writeback_metadata) + sizeof(uint8_t) /* key length size*/ + key_len + ...
= { .enabled = false, .sample_interval = BMI160SampleRate_25_HZ, }, [AccelOperatingModeShakeDetection] = { .enabled = false, .sample_interval = BMI160SampleRate_25_HZ, }, [AccelOperatingModeDoubleTapDetection] = { .enabled = false, .sample_interval = BMI160SampleRate_200_HZ, }, }; #de...
{ BMI160SampleRate sample_rate_max = BMI160SampleRate_12p5_HZ; for (uint32_t i = 0; i < ARRAY_LENGTH(s_operating_states); i++) { if (s_operating_states[i].enabled) { // use MIN because sample rate enum value is actually the sampling interval in us sample_rate_max = MIN(sample_rate_max, s_operating_s...
// Determine the bit that flips when the sample is collected (as sensor events // are synchronous to this register) static uint8_t prv_get_sample_collection_bit(void) { return (31 - (__builtin_clz(prv_get_min_sampling_interval_us() / BMI160_SENSORTIME_RESOLUTION_US))); } // Converts BMI160 sensortime data to...
"A"); regular_timer_fire_seconds(1); assert_ad_data("B"); regular_timer_fire_seconds(1); assert_ad_data("D"); } // "D" should be done now, so expect only infinite jobs to get air-time again: for (int i = 0; i < 10; ++i) { regular_timer_fire_seconds(1); assert_ad_data("E"); regular_tim...
assert_ad_data("A")
; // Schedule job "B": BLEAdData *ad_b = create_ad("B", NULL); GAPLEAdvertisingJobRef job_b; job_b = gap_le_advert_schedule(ad_b, advert_terms_b, sizeof(advert_terms_b)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data...
/* * 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...
(COUNT_PKEY)
; persist_write_int(COUNT_PKEY, num_beers-1); menu_layer_reload_data(menu_layer); break; } } } static void select_long_callback(MenuLayer *menu_layer, MenuIndex *cell_index, AppData *data) { (void)menu_layer; (void)data; switch (cell_index->row) { case 1: { int num_beers = persi...
GColorBlack, false); graphics_draw_circle(&context, GPoint(50, 50), 10); #if PBL_COLOR ASSERT_CALLED(graphics_circle_draw_stroked_aa(&context, GPoint(50, 50), 10, SW_ODD)); #else ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, SW_ODD)); #endif setup_test(&context, true, SW_ODD,...
GRect(10, 20, 40, 10)
)); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); ASSERT_NO_CHANGE(graphics_fill_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_fill_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHA...
); } void test_rocky_api_util_args__numbers_get_rounded_when_converting_to_integer(void) { struct { double input; int16_t expected_output; } cases[] = { { .input = 0.5, .expected_output = 1, }, { .input = -0.5, .expected_output = -1, }, { .input = 0.0, ...
ROCKY_ARG(u8)
, ROCKY_ARG(u16), ROCKY_ARG(u32), ROCKY_ARG(u64), ROCKY_ARG(s8), ROCKY_ARG(s16), ROCKY_ARG(s32), ROCKY_ARG(s64), ROCKY_ARG(d), ); ASSERT_JS_ERROR(error_value, c->expected_error_msg); if (!c->expected_error_msg) { cl_assert_equal_i(u8, (ui...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ if (!BOARD_CONFIG_BUTTON.button_com.gpio) { // This board doesn't use a button common pin. return; } // Configure BUTTON_COM to drive low. When the button // is pressed this pin will be connected to the pin for the // button. gpio_use(BOARD_CONFIG_BUTTON.button_com.gpio); GPIO_InitTypeDef GPIO...
static void initialize_button(const ButtonConfig* config) { // Configure the pin itself gpio_use(config->gpio); GPIO_InitTypeDef GPIO_InitStructure; GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.G...
E_SECTOR; pg++) { uint32_t base_addr = prv_page_to_flash_offset(sector_start_page + pg); uint32_t data_len; PageHeader hdr; if (do_copy) { // if the sector is not active we only need to copy the page header info data_len = (((sectors_active >> pg) & 0x1) == 0) ? 0 : PFS_PAGE_SIZE ...
{ PFS_FD(fd) = (FileDesc) { .fd_status = FD_STATUS_FREE }; }
ftl_populate_region_list(); if (run_filesystem_check) { if (!pfs_active()) { // either we have downgraded or there is no data on the flash PBL_LOG(LOG_LEVEL_INFO, "PFS not active ... formatting"); pfs_format(true /* write erase headers */); } } // we need to run this before reservi...
e /* start_connected */); RCV_RESET_REQUEST(); // Expect responding with a ResetComplete: EXPECT_OUTBOX_RESET_COMPLETE_PENDING(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaitingResetCompleteRemoteInitiated); } void test_rocky_api_app_message__awaiting_reset_...
cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaitingResetRequest)
k header flags to detect deleted notifications uint8_t status = iter_state.header.common.status; if (status & TimelineItemStatusDeleted) { // Skip over deleted notification pfs_seek(*fd, iter_state.header.payload_length, FSeekCur); continue; } TimelineItem notification; if (!prv_g...
{ int fd = prv_file_open(OP_FLAG_READ); if (fd < 0) { return false; } SerializedTimelineItemHeader header = { .common.id = UUID_INVALID }; bool found = prv_find_next_notification(&header, prv_uuid_equal_func, (void *)id, fd); prv_file_close(fd); return found; }
static bool prv_get_notification(TimelineItem *notification, SerializedTimelineItemHeader* header, int fd) { notification->allocated_buffer = NULL; // Must be initialized in case this goes to cleanup // Read notification to temporary buffer uint8_t *read_buffer = task_zalloc_check(header->payload_length); ...
est_bitmap, "gpath_filled_left_clipped_aa.${BIT_DEPTH_NAME}.pbi")); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); graphics_context_set_antialiased(&ctx, true); prv_filled_updat...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_house_105_aa.8bit.pbi"))
*ctx) { return gpoint_sub(point, ctx->draw_state.drawing_box.origin); } GRect grect_to_global_coordinates(const GRect rect, GContext *ctx) { GRect translated_rect = { .origin.x = ctx->draw_state.drawing_box.origin.x + rect.origin.x, .origin.y = ctx->draw_state.drawing_box.origin.y + rect.origin.y, .siz...
app_state_get_heap()
; return (BitmapInfo) { .is_bitmap_heap_allocated = bitmap->info.is_bitmap_heap_allocated && heap_is_allocated(heap, bitmap->addr), }; } return bitmap->info; } bool gcolor_is_invisible(GColor8 color) { return (color.a == 0); } #define RGB_LOOKUP_TABLE_SIZE (64) const GColor8Component g_...
(simple_dialog)
; dialog_set_background_color(dialog, GColorCobaltBlue); dialog_set_text_color(dialog, GColorWhite); dialog_set_text(dialog, "Ping"); prv_push_and_render_simple_dialog(dialog); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_simple_dialog__alarm_snooze(void) { SimpleDialog *simple_dial...
/* * 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...
{ int32_t dist = serial_distance32(0x0, 0xffffffff); cl_assert_equal_i(dist, -1); }
{ int32_t dist = serial_distance32(0xffffffff, 0x0); cl_assert_equal_i(dist, 1); } { int32_t dist = serial_distance32(0x0, 0x7fffffff); cl_assert_equal_i(dist, 0x7fffffff); } } void test_math__serial_distance3(void) { { int32_t dist = serial_distance(0, 1, 3); cl_assert_equal_i(dis...
prv_consume_read_response(event, client)
; return; default: break; } log_error: PBL_LOG(LOG_LEVEL_ERROR, "Unhandled GATT event:%u ref:%"PRIu32" err:%"PRIu16" len:%"PRIu16" cl:%p", event->subtype, (uint32_t)event->object_ref, (uint16_t)event->gatt_error, (uint16_t)event->value_length, ...
fault: WTF; } } static bool prv_event_put(HRMSubscriberState *state, PebbleHRMEvent *event) { bool success; if (state->queue) { PebbleEvent e = { .type = PEBBLE_HRM_EVENT, .hrm = *event, }; success = xQueueSendToBack(state->queue, &e, 0); } else { prv_queue_s...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Subscription %"PRIu32" expired", expired_state->session_ref); prv_remove_and_free_subscription(expired_state); }
} // Update the HRM enable state. If no subscribers need an update for a while, we can turn off the // HR sensor and set a timer to turn it on again later. To avoid this overhead on every callback, // we only check it once every HRM_CHECK_SENSOR_DISABLE_COUNT times if (++s_manager_state.check_disable_counte...
art_page, bool update_erase_count) { if (!update_erase_count) { prv_flash_erase_sector(start_page); return; } uint16_t max_erase = 0; uint16_t last_written_pg = INVALID_PAGE; PageHeader hdr; for (int i = 0; i < PFS_PAGES_PER_ERASE_SECTOR; i++) { get_updated_erase_hdr(&hdr, i + start_page); ...
if (!FD_VALID(fd)) { res = E_INVALID_ARGUMENT; goto cleanup; }
------------------------------------------------------------------------------- static MeasurementSystem prv_get_shell_prefs_metric_for_distance(void) { #if !CAPABILITY_HAS_HEALTH_TRACKING return MeasurementSystemUnknown; #else switch (sys_shell_prefs_get_units_distance()) { case UnitsDistance_Miles: retu...
prv_get_state(false)
; HealthServiceTimeRange time_range = {}; HealthServiceDailyHistory daily_history = {}; const HealthServiceAccessibilityMask accessible = prv_get_range_and_daily_history(state, metric, time_start, time_end, &time_range, &daily_history); if (accessible != HealthServiceAc...
(&app_glance_subtitle_attribute_list, app_glance_subtitle_attribute_list_serialized, app_glance_subtitle_attribute_list_serialized_size)
; // Now let's check that deserializing the serialized byte array above results in a truncated // version of the original string because it's longer than the max length // It's assumed we know the number of attributes in the serialized list, so just copy it from // the AttributeList we hope to recreate cons...
n = NULL; rot_points[0] = rot_end = GPointPreciseFromGPoint( rotate_offset_point(&path->points[0], path->rotation, &path->offset)); min_x = max_x = rot_points[0].x.integer; min_y = max_y = rot_points[0].y.integer; // begin finding the last path segment's direction going backwards through the path // w...
{ bool is_down = rot_end.y.integer != rot_start.y.integer ? rot_end.y.integer > rot_start.y.integer : last_is_down; // don't count end points in the same direction to avoid double intersections if (!(rot_start.y.integer == i && last_is_down == is_down)) { // line...
intersections_down[intersection_down_count].x.raw_value = x.raw_value; intersections_down[intersection_down_count].delta = delta; intersection_down_count++; } else { intersections_up[intersection_up_count].x.raw_value = x.raw_value; intersections_up...
ding attribute with type uint8 for non-uint8_t attribute"); } prv_add_attribute(list, id)->uint8 = uint8; } void attribute_list_add_string_list(AttributeList *list, AttributeId id, StringList *string_list) { PBL_ASSERTN(prv_attribute_type(id) == AttributeTypeStringList); prv_add_attribute(list, id)->string_lis...
{ PBL_ASSERTN(attr_list != NULL); PBL_ASSERTN(prv_attribute_type(id) == AttributeTypeUint32List); Attribute *attribute = attribute_find(attr_list, id); return attribute ? attribute->uint32_list : NULL; }
f the rect we specified in the .pre function cl_assert_equal_rect(*global_clipped_grect_used, EXPECTED_CLIPPED_RECT_AFTER_DRAWING_BITMAP); } void test_gbitmap_processor__pre_and_post_functions(void) { GBitmap bitmap = {0}; const GRect rect = EXPECTED_RECT_IN_PRE_FUNCTION; // Set the compositing mode and tint ...
cl_assert(processor.post_func_called)
; } static void post_function_called_even_if_pre_function_specifies_null_bitmap__pre( GBitmapProcessor *processor, GContext *ctx, const GBitmap **bitmap_to_use, GRect *global_grect_to_use) { PostFunctionCalledEvenIfPreFunctionCausesNothingToBeDrawnTestProcessor *processor_with_data = (PostFunctionCalledEvenI...
; s_pending_did_read = (PendingInfo) { .active = true, .attribute = attribute, .length = read_length }; } static void prv_did_read_handler(SmartstrapAttribute *attribute, SmartstrapResult result, const uint8_t *data, size_t length) { cl_assert(data == (uint8_t *)attri...
cl_assert(app_smartstrap_attribute_get_attribute_id(attr) == 0x2222)
; // destroy the attribute app_smartstrap_attribute_destroy(attr); // verify that we can no longer get the ids cl_assert(app_smartstrap_attribute_get_service_id(attr) == 0); cl_assert(app_smartstrap_attribute_get_attribute_id(attr) == 0); } void test_app_smartstrap__create_duplicate(void) { // create the...
rflow_mode, text_layer->text_alignment, prv_text_layer_legacy2_get_cache_handle(text_layer)); } } void text_layer_legacy2_init(TextLayerLegacy2 *text_layer, const GRect *frame) { PBL_ASSERTN(text_layer); *text_layer = (TextLayerLegacy2){}; text_layer->layer.frame = *frame; text_layer->...
(&(text_layer->layer))
; } void text_layer_legacy2_set_should_cache_layout(TextLayerLegacy2 *text_layer, bool should_cache_layout) { if (text_layer == NULL || should_cache_layout == text_layer->should_cache_layout) { return; } text_layer->should_cache_layout = should_cache_layout; ...
ntext, saved_ctx.is_subsector, saved_ctx.retries + 1); } else { // Only run the callback with no locks held so that the callback won't // deadlock if it kicks off another sector erase. saved_ctx.on_complete_cb(saved_ctx.cb_context, status); return 0; } } // Timer callback that checks to see...
(sector_addr, true /* is_subsector */, on_complete_cb, context)
; } void flash_erase_sector_blocking(uint32_t sector_addr) { prv_flash_erase_blocking(sector_addr, false /* is_subsector */); } void flash_erase_subsector_blocking(uint32_t subsector_addr) { prv_flash_erase_blocking(subsector_addr, true /* is_subsector */); } void flash_enable_write_protection(void) { flash_im...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 4 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 4); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_b...
properties GPoint point_p0; int16_t point_velocity_x; int16_t point_velocity_y; // Line properties GPoint line_p0; GPoint line_p1; int16_t line_velocity_x; int16_t line_velocity_y; // Square properties GRect square; int16_t square_velocity_x; int16_t square_velocity_y; // Rectangle properti...
(BUTTON_ID_DOWN, down_handler)
; } static void prv_move_shape(AppData *data) { for (uint8_t shape = POINT; shape < MAX_SHAPES; shape++) { if (shape == POINT) { // Move the point 4*X per Y data->point_p0.x += (data->point_velocity_x * PIXEL_SPEED_PER_FRAME * 4); if (data->point_p0.x < 0 || data->point_p0.x > data->window.laye...
/* * 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_worker_is_running()
; // Toggle running state if (running) { message = WORKER_ALREADY_RUNNING; } else { AppWorkerResult result = app_worker_launch(); if (result == APP_WORKER_RESULT_SUCCESS) { message = WORKER_LAUNCHED; } else { message = WORKER_LAUNCH_ERROR; } } text_layer_set_text(s_data.text...
UMENT; } SerializedAppGlanceHeader *serialized_glance = NULL; size_t serialized_glance_size = 0; status_t rv = prv_serialize_glance(glance, &serialized_glance, &serialized_glance_size); if (rv == S_SUCCESS) { rv = app_glance_db_insert((uint8_t *)uuid, UUID_SIZE, (uint8_t *)serialized_glance, ...
if ((rv == S_SUCCESS) && (serialized_glance->creation_time <= existing_glance.creation_time)) { PBL_LOG(LOG_LEVEL_WARNING, "Tried to insert AppGlanceDB entry with older creation_time (%"PRIu32")" " than existing entry (%"PRIu32")", serialized_glance->creation_time, existing_glanc...
!s_install_callback_data.callback_paused_for_worker) { // Only close the app the first time around. if (s_install_callback_data.install_type == APP_UPGRADED || s_install_callback_data.install_type == APP_REMOVED || s_install_callback_data.install_type == APP_DB_CLEARED) { const App...
(app_install_launcher_task_callback, NULL)
; return true; } const char *app_install_get_custom_app_name(AppInstallId install_id) { const char *name = app_custom_get_title(install_id); if (name) { return name; } return NULL; } uint32_t app_install_entry_get_icon_resource_id(const AppInstallEntry *entry) { return entry->icon_resource_id; } Re...
/* * 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 NULL; }
ons EnumerateData cb_data = { .cb = cb, .data = data, .entry_buf = entry, }; app_db_enumerate_entries(prv_app_install_enumerate_app_db, &cb_data); kernel_free(entry); } AppInstallId app_install_get_id_for_uuid(const Uuid *uuid) { if (uuid_is_invalid(uuid) || uuid_is_system(uuid)) { // Don't ...
(cur_worker_id, to_kill)
|| ((s_install_callback_data.install_type == APP_DB_CLEARED) && (app_install_id_from_app_db(cur_worker_id)))) { PBL_LOG(LOG_LEVEL_DEBUG, "close and delay callbacks for worker closing"); s_install_callback_data.callback_paused_for_worker = true; s_pending_worker_deletion = ...
, 549, 725}, { 484, 503, 651}, { 478, 474, 681}, { 441, 509, 658}, { 356, 516, 607}, { 304, 388, 639}, { 291, 541, 611}, { 298, 716, 587}, { 267, 838, 578}, { 223, 876, 373}, { 234, 1036, 296}, { 237, 1111, 308}, { 171, 1241, 236}, { 67, 1266, 195}, { -25, 1204, 1...
{ 1215, 140, 17}, { 688, -119, -8}, { 216, 169, -14}, { -41, 496, -177}, { 149, 1075, -112}, { 419, 950, -237}, { 1026, 1225, -226}, { 1649, 1216, -65}, { 1947, 148, -3}, { 1584, 306, 185}, { 1154, -162, 34}, { 802, -272, -300}, { 626, 315, -377}, { 43, -595, -669...
{ 730, -344, -511}, { 719, -491, -849}, { 610, -350, -1137}, { 922, -411, -1651}, { 1629, -509, -805}, { 2026, -119, -435}, { 1259, 253, -320}, { 814, 17, -218}, { 713, -529, -192}, { 560, -79, -367}, { 406, -465, -379}, { 1059, 726, -203}, { 438, 347, -1208}, { ...
system_app_ids.h" #include "apps/system_apps/app_fetch_ui.h" #include "apps/system_apps/settings/settings_quick_launch.h" #include "apps/system_apps/timeline/timeline.h" #include "kernel/low_power.h" #include "kernel/pbl_malloc.h" #include "popups/alarm_popup.h" #include "popups/bluetooth_pairing_ui.h" #include "popups...
if (blobdb_event->db_id == BlobDBIdPins) { timeline_event_handle_blobdb_event(); } else if (blobdb_event->db_id == BlobDBIdPrefs) { prefs_private_handle_blob_db_event(blobdb_event); }
return; } case PEBBLE_DO_NOT_DISTURB_EVENT: notification_window_handle_dnd_event(&e->do_not_disturb); return; case PEBBLE_REMINDER_EVENT: // This handles incoming Reminders notification_window_handle_reminder(&e->reminder); return; case PEBBLE_BATTERY_STATE_CHANGE...
84}, { -176, -184, -976}, { -176, -112, -976}, { -176, -104, -1016}, { -168, -144, -1000}, { -160, -136, -976}, { -168, -128, -992}, { -160, -144, -1000}, { -160, -168, -992}, { -160, -152, -1000}, { -160, -128, -984}, { -168, -152, -1000}, { -160, -88, -992}, { -160,...
{ -168, -128, -984}, { -168, -128, -992}, { -168, -128, -992}, { -168, -128, -984}, { -168, -128, -984}, { -168, -120, -1000}, { -168, -120, -992}, { -168, -72, -976}, { -160, -112, -1000}, { -160, -160, -992}, { -160, -144, -992}, { -160, -128, -992}, { -168, -120, -...
{ -168, -128, -984}, { -168, -120, -1000}, { -168, -128, -1008}, { -168, -136, -1000}, { -160, -168, -968}, { -160, -104, -1008}, { -168, -144, -1016}, { -168, -144, -960}, { -176, -72, -968}, { -168, -72, -1016}, // 178 seconds { -176, -160, -1008}, { -152, -208, -9...
/* * 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...
{ // there are other handlers for this task, don't unsubscribe it return; }
// Get info PebbleTask task = pebble_task_get_current(); // Unsubscribe from the service! PebbleEvent event = { .type = PEBBLE_SUBSCRIPTION_EVENT, .subscription = { .subscribe = false, .task = task, .event_type = handler->type, }, }; prv_put_event_from_process(task, &event); }...