prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
eturn key_matches(iter, key, key_len); } static bool search_forward(SettingsRawIter *iter, const uint8_t *key, int key_len) { const int resumed_pos = settings_raw_iter_get_resumed_record_pos(iter); // Resume searching at the current record for (; !settings_raw_iter_end(iter); settings_raw_iter_next(iter)) { ...
{ return E_DOES_NOT_EXIST; }
mbuf, "00"); } // Test the zero flag void test_strftime__zeroflag(void) { char tmbuf[512]; struct tm jan_2_10015__13_00_00 = { .tm_hour = 13, .tm_min = 0, .tm_sec = 0, // 13:00:00 .tm_year = 10015 - 1900, .tm_mon = 0, .tm_mday = 2, // 10015/01/02 .tm_wday = 5, .tm_yday = 1, // Friday, 2nd day of the y...
localized_strftime(tmbuf, sizeof(tmbuf), "%a %A %b %B", &jan_2_2015__13_00_00, i18n_get_locale())
; cl_assert_equal_s(tmbuf, "Fri Friday Jan January"); tmbuf[0] = '\0'; localized_strftime(tmbuf, sizeof(tmbuf), "%c", &jan_2_2015__13_00_00, i18n_get_locale()); cl_assert_equal_s(tmbuf, "Fri Jan 2 13:00:00 2015"); s_i18n_translate = true; s_i18n_locale_other = false; tmbuf[0] = '\0'; localized_strftim...
/* * 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...
(&common->uuid, &info->uuid, sizeof(Uuid))
; common->process_storage = process_storage; // Flags common->process_type = process_metadata_flags_process_type(info->flags, task); common->visibility = process_metadata_flags_visibility(info->flags); common->allow_js = process_metadata_flags_allow_js(info->flags); common->has_worker = process_metadata_fl...
ruct { const char *error_msg; int arg_offset; } RockyArgValueCheckError; typedef struct { bool (* check_value_and_assign)(const RockyArgBinding *binding, const jerry_value_t argv[], RockyArgValueCheckError *val_error_out); bool (* check_type)(const jerry_value_t argv[], RockyArgTypeCheckError...
rocky_string_alloc_and_copy(str)
; } static bool prv_malloc_and_assign_string(const RockyArgBinding *binding, const jerry_value_t argv[], RockyArgValueCheckError *value_error_out) { prv_convert_to_string_and_apply(argv[0], prv_malloc_and_assign_string_applier, binding); return true; } static void prv_copy...
sizeof(text.buffer), "%a %d", tick_time); } else if (type == CLOCK_TEXT_TYPE_TIME) { strftime(text.buffer, sizeof(text.buffer), "$l:%M%P", tick_time); } for (uint32_t i = 0; i < sizeof(text.buffer); i++) { text.buffer[i] = toupper((unsigned char)text.buffer[i]); } // TODO: Don't return a struct r...
tick_timer_service_subscribe(MINUTE_UNIT, prv_handle_time_update)
olorWhite); text_layer_set_text_color(&data->text_layer, GColorBlack); text_layer_set_text(&data->text_layer, text_buffer); GFont gothic_24_bold = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD); text_layer_set_font(&data->text_layer, gothic_24_bold); text_layer_set_text_alignment(&data->text_layer, GTextAlign...
(&data->window.layer, &data->canvas)
; // Init text layer init_text_layer(data, GRect(4, 4, 72, 32)); // Init direction layer text_layer_init(&data->direction_layer, &GRect(5, 100, 135, 20)); text_layer_set_background_color(&data->direction_layer, GColorWhite); text_layer_set_text_color(&data->direction_layer, GColorBlack); text_layer_set_...
/* * 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...
prv_bt_errno_for_event(conn_event)
); } BTErrno ble_central_set_connection_handler(BLEConnectionHandler handler) { BLEAppState *ble_app_state = app_state_get_ble_app_state(); const bool is_subscribed = (ble_app_state->connection_handler != NULL); ble_app_state->connection_handler = handler; if (handler) { if (!is_subscribed) { event_s...
== HRM_INVALID_SESSION_REF) { PBL_LOG(LOG_LEVEL_ERROR, "Error subscribing"); return false; } return true; #endif } // ---------------------------------------------------------------------------------------------- uint16_t health_service_get_heart_rate_sample_period_expiration_sec(void) { #if !CAPABILITY_H...
ARRAY_LENGTH(state->cache->sessions)
; if (!sys_activity_get_sessions(&num_sessions, state->cache->sessions)) { return; } const uint32_t actual_num_sessions = MIN(num_sessions, ARRAY_LENGTH(state->cache->sessions)); prv_sessions_sort(state->cache->sessions, actual_num_sessions, direction); for (uint32_t idx = 0; idx < actual_num_sessions; ...
" #include "../graphics/util.h" // Setup and Teardown //////////////////////////////////// // To easily render multiple windows in a single canvas, we'll use an 8-bit bitmap for color // displays (including round), but we can use the native format for black and white displays (1-bit) #define CANVAS_GBITMAP_FORMAT PBL...
PBL_IF_COLOR_ELSE(GColorShockingPink, GColorWhite)
_set_clips(&card_timeline_layout->icon_layer.layer, false); // TODO: PBL-28738 Refactor kino reel transform APIs or usage of APIs // There is a lot of shared code throughout, and the API is code space intensive const bool take_ownership = true; KinoReel *new_reel = kino_reel_scale_segmented_create(from_reel, t...
((Layer *)&pin_timeline_layout->icon_layer, &icon_to)
; // Unclip for the scaling animation layer_set_clips(&pin_timeline_layout->icon_layer.layer, false); layer_set_clips(&card_timeline_layout->icon_layer.layer, false); const bool take_ownership = true; KinoReel *new_reel = kino_reel_scale_segmented_create(from_reel, take_ownership, icon_from); kino_reel_tra...
idx = 0; idx < aml->num_items; idx++) { aml->layout_cache.item_heights[idx] = prv_get_item_line_height(aml, idx); } } #if PBL_ROUND const bool center_focused = !prv_aml_is_short(aml); menu_layer_set_center_focused(&aml->menu_layer, center_focused); #endif layer_mark_dirty(&aml->layer); menu_layer_...
(aml, default_selected_item)
; } void action_menu_layer_set_short_items(ActionMenuLayer *aml, const ActionMenuItem* items, int num_items, unsigned default_selected_item) { aml->short_items = items; aml->separator_index = 0; aml->num_short_items = num_items; prv_update_aml_cache(aml, default_selected_...
(void); static void prv_register_dump(int start_reg, int stop_reg); static void prv_initialize_interrupts(void); //! Request that the rail be used or released. Internally refcounted per rail so you don't have //! to worry about turning this off on another client. static bool prv_update_rail_state(PmicRail rail, bool e...
{ s_mon_config_mutex = mutex_create(); s_debounce_usb_conn_timer = new_timer_create(); if (!prv_set_pin_config()) { return false; } if (!prv_is_alive()) { return false; } prv_config_charger(); prv_initialize_interrupts(); prv_update_rail_state(PmicRail_LDO2, true); // FW should bring th...
static bool prv_update_rail_state(PmicRail rail, bool enable) { static int8_t s_ldo2_ref_count = 0; static int8_t s_ldo3_ref_count = 0; int8_t *ref_count; uint8_t rail_control_reg; if (rail == PmicRail_LDO2) { rail_control_reg = PmicRegisters_LDO2_CONFIG; ref_count = &s_ldo2_ref_count; } else if...
, NULL)) { dbgserial_putstr("We're dead"); return false; } prv_display_write_progress(i + chunk_size, firmware_length, NULL); } return true; } static bool check_firmware_crc(FirmwareDescription* firmware_description) { dbgserial_print("Checksumming "); dbgserial_print_hex(firmware_descripti...
(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO)
; cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 1 * HORIZ_ADVANCE_PX); // reset line line = (Line) { 0 }; line.max_width_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; cl...
cl_assert(line.suffix_codepoint == 0)
lank out any left overs from a previous frame to make sure we have a solid color // background. graphics_fill_rect(ctx, &ctx->draw_state.clip_box); // Draw in an expanding inner ring of the incoming app framebuffer. // Note that this only expands because we're running the animation backwards. draw_...
grect_center_point(&bounds)
; if (distance_normalized < COLLAPSE_END_DISTANCE) { const uint32_t local_distance = animation_timing_scaled(distance_normalized, 0, COLLAPSE_END_DISTANCE); prv_collapse_animation_update(ct...
BTErrno e; BLECharacteristic characteristic = prv_get_indicatable_characteristic(); e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoOK); fake_kernel_malloc_mark(); e = gatt_client_subscriptions_subscribe(characteristic, BLESubsc...
(s_last_cccd_value, 0)
; // Verify everything is cleaned up: fake_kernel_malloc_mark_assert_equal(); } void test_gatt_client_subscriptions__unsubscribe_not_last_subscriber(void) { BLECharacteristic characteristic = prv_get_indicatable_characteristic(); // Subscribe kernel: BTErrno e = gatt_client_subscriptions_subscribe(character...
ache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and ...
if (!rcv) { return NULL; }
rcv->session = session; const size_t header_bytes_remaining = MIN(MAX_HEADER_SIZE, total_payload_size); rcv->header_bytes_remaining = header_bytes_remaining; // Always forward the header to default system receiver as well, we'll cancel it later on if the // message was written succesfully to the app inbox....
_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert_equal_i(timer_id, TIMER_INVALID_ID); cl_assert(!stub_new_timer_is_scheduled(timer_id)); cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); cl_assert_equal_i(f...
timeline_add(&item5)
); timeline_event_handle_blobdb_event(); 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_i(timer_id, TIMER_INVALID_ID); } void test_calendar__handle_all_day_pins(void) { // Insert a...
strncpy(buffer, "Woooooooo", size)
; } void good_syscall(void * buffer, int size) { syscall_internal_elevate_privilege(); syscall_assert_userspace_buffer(buffer, size); do_stuff(buffer, size); } void bad_syscall(void * buffer, int size) { syscall_internal_elevate_privilege(); do_stuff(buffer, size); } void stupid_syscall(void * buffer, in...
nable_backlight_for_type(AlertReminder)); cl_assert(alerts_should_notify_for_type(AlertOther)); cl_assert(!alerts_should_vibrate_for_type(AlertOther)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_fo...
alerts_should_vibrate_for_type(AlertOther)
); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(alerts_should_enable_backlight_for_type(AlertOther)); }
1128, -328}, { 232, 896, -320}, { 280, 736, -88}, { 168, 904, -112}, { -16, 832, -248}, { -16, 1040, -328}, { 112, 832, -352}, { 264, 952, -392}, // 299 seconds { 120, 792, -344}, { 120, 880, -376}, { 56, 856, -376}, { 80, 832, -384}, { 144, 928, -352}, { 120, 84...
{ 360, 384, -832}, { 344, 392, -816}, { 352, 384, -800}, { 352, 400, -808}, { 344, 400, -824}, { 344, 400, -824}, { 344, 384, -816}, { 344, 384, -816}, { 336, 392, -816}, { 344, 416, -824}, { 344, 400, -832}, { 344, 384, -808}, { 352, 360, -792}, { 352, 392, -816}...
{ 344, 456, -800}, { 296, 408, -864}, // 307 seconds { 312, 416, -824}, { 360, 384, -800}, { 336, 352, -832}, { 328, 392, -776}, { 328, 336, -800}, { 336, 384, -856}, { 320, 392, -824}, { 320, 392, -824}, { 320, 376, -824}, { 328, 392, -832}, { 296, 376, -816}, ...
_LOG(LOG_LEVEL_ERROR, "Unable to get Region Table"); goto spi_failed; } memcpy(region_buf, s_rx_buffer, region_buf_size); // Dump the memory region table for (int index = 0; index < MemoryRegionTagCount; ++index) { PBL_LOG(LOG_LEVEL_ERROR, "Memory Region %d: %p - 0x%lx", index, region_buf[index].start,...
{ PBL_LOG(LOG_LEVEL_ERROR, "Insufficient space for BLE core dump terminator"); goto powerdown; }
flash_write_bytes((const uint8_t *)&chunk_hdr, flash_addr, sizeof(chunk_hdr)); powerdown: // Power down the chip cmd = (CoreDumpSPICmd) { .cmd = CoreDumpCmd_LowPowerMode }; if (!prv_spi_transaction(&cmd, NULL, 0)) { PBL_LOG(LOG_LEVEL_ERROR, "Unable to power down"); goto spi_failed; } spi_failed: #i...
= FLASH_LOG_INVALID_ADDR) { // this is the first page we've found log_start_addr = flash_addr; dist = 0; // nothing else to compare against yet } if ((dist == 0) || (dist == 1)) { prev_chunk_id = hdr.log_chunk_id; continue; // keep looking } // we have found a gap in the ...
if ((msg_length == 0) || (msg_length > MAX_MSG_LEN) || !s_flash_logging_enabled) { return FLASH_LOG_INVALID_ADDR; }
// bytes_remaining should always be 0, but if for some reason this gets called // again, just skip onto the next record spot s_curr_state.offset_in_log_page += s_curr_state.bytes_remaining; uint32_t payload_size = sizeof(LogRecordHeader) + msg_length; if ((s_curr_state.offset_in_log_page + payload_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...
(LOG_LEVEL_ERROR, "AppOutbox sent_handler not allowed <%p>", sent_handler)
; syscall_failed(); } const size_t max_length = def->max_length; if (length > max_length) { PBL_LOG(LOG_LEVEL_ERROR, "AppOutbox max_length exceeded %"PRIu32" vs %"PRIu32, (uint32_t)length, (uint32_t)max_length); syscall_failed(); } app_outbox_service_send(data, length, sent_handler, c...
prv_cleanup()
; } } static bool prv_check_putrequest_for_errors(const PutRequest *request_hdr, uint32_t tot_request_size); static bool prv_do_put(const PutRequest *request, uint32_t request_size, uint32_t token) { uint32_t data_length = ntohl(request->length); xSemaphoreTake(s_pb_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ if (evt->status != ATT_ERROR_OK) { PBL_LOG(LOG_LEVEL_WARNING, "Read_device_name failed: Idx: %d Att 0x%x Status %d", evt->conn_idx, evt->handle, evt->status); return; } PBL_LOG(LOG_LEVEL_DEBUG, "Read_device_name: Idx: %d Handle 0x%x Offset %d Length %d Data:", evt->conn_idx, evt->...
TB, &throwaway_read_result); } static void prv_log_status_registers(const char *preamble) { uint8_t status_a; uint8_t status_b; if (!prv_read_register(PmicRegisters_STATUSA, &status_a) || !prv_read_register(PmicRegisters_STATUSB, &status_b)) { PBL_LOG(LOG_LEVEL_WARNING, "Failed to read status register...
prv_mon_config_unlock()
; } #endif // RECOVERY_FW void set_ldo3_power_state(bool enabled) { i2c_use(I2C_MAX14690); prv_update_rail_state(PmicRail_LDO3, enabled); i2c_release(I2C_MAX14690); } void set_4V5_power_state(bool enabled) { gpio_output_set(&BOARD_CONFIG_POWER.rail_4V5_ctrl, enabled); } void set_6V6_power_state(bool enabled)...
aystate_for_ams_playback_state(value_out); break; } case AMSPlaybackInfoIdxRate: state->playback_rate_percent = value_out; break; case AMSPlaybackInfoIdxElapsedTime: state->elapsed_time_ms = value_out; break; default: WTF; } return true /* should_continue */; }...
music_update_track_artist(update->value_str, value_length)
; } static void prv_handle_track_album_update(const AMSEntityUpdateNotification *update, const uint16_t value_length) { music_update_track_album(update->value_str, value_length); } static void prv_handle_track_title_update(const AMSEntityUpdateNotification *update, ...
/*aplite*/ 5, /*basalt*/ 5, /*chalk*/ 4, /*diorite*/ 5, /*emery*/ 5); } // TODO: Once PBL-16032 is implemented, use that instead. static int64_t prv_get_precise_time(void) { time_t se...
(action_bar_circle_diameter, action_bar_circle_diameter)
}; grect_align(&action_bar_circle_frame, &action_bar->layer.bounds, GAlignLeft, false /* clips */); graphics_fill_oval(ctx, action_bar_circle_frame, GOvalScaleModeFitCircle); } void action_bar_update_proc(ActionBarLayer *action_bar, GContext* ctx) { const GColor bg_color = action_bar->background_color; if (...
prv_set_accel_power_mode(BMA255PowerMode_Standby)
; } PBL_LOG(LOG_LEVEL_WARNING, "Failed to program fifo reg, 0x%"PRIx8" = 0x%"PRIx8, address, data); } static void prv_set_fifo_mode(BMA255FifoMode mode) { BMA255_DBG("Set Fifo Mode: 0x%x", mode); const uint8_t out = (mode << BMA255_FIFO_MODE_SHIFT) | (BMA255FifoDataSel_XYZ << BMA255_FIFO_DATA_SEL_SHIFT)...
e 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 is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDI...
(ctx, s_text_buffer, &s_font_info, GRect(-44, 4, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL)
; } void draw_text_single_line_ellipsis_clip_across_x(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(34, 4, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } void draw_text_sing...
buffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); } // Teardown void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } // Tests //////////////////////////////////// void inside_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_...
(&layer, &outside_y_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_y_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_...
mutex_lock_recursive(s_list_mutex); DataLoggingSession **iter = &s_logging_sessions; for (int i = 0; i < logging_session->comm.session_id; i++) { if (*iter == NULL) { break; } PBL_ASSERTN(logging_session->comm.session_id != (*iter)->comm.session_id); if ((*iter)->comm.session_id > logging_s...
{ if (iter == logging_session) { mutex_unlock_recursive(s_list_mutex); return true; } iter = iter->next; }
mutex_unlock_recursive(s_list_mutex); return false; }
v_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(pr...
(prv_count_handler_entries(&s_started_handler_calls, b), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 0); // Execute to the end of B & C prv_advance_to_ms_with_timers(start_ms +...
/* * 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...
info->get_key(file, (uint8_t *)&app_id, info->key_len)
; info->get_val(file, (uint8_t *)&entry, info->val_len); if (uuid_equal(&uuid_data->uuid, &entry.uuid)) { uuid_data->found_id = app_id; return false; // stop iterating } return true; // continue iterating } //! Retrieves the AppInstallId for a given UUID using the SettingsFile that is already open. //...
inute() > s_activity_reward_settings.reward.activity.trigger_steps_per_minute) { s_activity_reward_state.active_minutes++; } else { s_activity_reward_state.active_minutes = 0; } if (activity_metrics_prv_steps_per_minute() > s_sleep_summary_settings.summary.sleep.trigger_notif_activity) { ...
(file, ActivitySettingsKeyInsightActivityRewardTime, &s_activity_reward_state.common.last_triggered_utc, sizeof(s_activity_reward_state.common.last_triggered_utc))
; prv_restore_state(file, ActivitySettingsKeyInsightActivitySummaryState, &activity_pin_last_state, sizeof(activity_pin_last_state)); prv_restore_state(file, ActivitySettingsKeyInsightSleepSummaryState, &s_sleep_pin_state, sizeof(s_sleep_pin_state)); prv_restore_s...
/* * 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...
prv_is_session_task()
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ cl_assert_equal_b(*data->destroyed, false); *data->destroyed = true; }
} static void prv_on_fail(Recognizer *recognizer) { TestImplData *data = recognizer_get_impl_data(recognizer, &s_test_impl); cl_assert_equal_i(data->test, TEST_PATTERN); if (data->failed) { cl_assert_equal_b(*data->failed, false); *data->failed = true; } } static void prv_sub_event_handler(const Reco...
s); } static void prv_render_action_menus_animated( SettingsContentSize content_size, const ActionMenuLevel *root_level, unsigned int selected_index, unsigned int additional_crumbs) { const int16_t x_offset = GRID_CELL_PADDING + (content_size * (GRID_CELL_PADDING + DISP_COLS)); for (ActionMenuLayerLon...
(root_level, ActionMenuLevelDisplayModeThin)
; for (size_t i = 0; i < ARRAY_LENGTH(thin_values); i++) { action_menu_level_add_action(root_level, thin_values[i], prv_noop_action_callback, NULL); } const unsigned int selected_index = 4; prv_prepare_canvas_and_render_action_menus_static(root_level, selected_index, 0); cl_check(gbitmap_pbi_eq(s_dest_bi...
} ///////////////////// // Peek Layer ///////////////////// static void prv_peek_anim_stopped(Animation *animation, bool finished, void *context) { NotificationWindowData *data = context; data->first_notif_loaded = true; peek_layer_destroy(data->peek_layer); data->peek_layer = NULL; TimelineItem *item = prv...
{ // reload everything, doesn't matter since it will be covered by the peek layer notification_window_focus_notification(id, false); // if the peek animation is already in progress, we've done all we need // data->peek_layer is only ever not null between the start and end of the peek // animation; it's clean...
.app_id = &data->notification_app_id, // This is set earlier when we reload the layout .fallback_id = fallback_icon_id, }; peek_layer_set_icon(data->peek_layer, &data->peek_icon_info); peek_layer_set_background_color(data->peek_layer, colors->bg_color); // This is so that only the banner of the swap_l...
over after turning accel off. if (!s_running) { return; } // Only post a new event if the prior one has been picked up. This prevents us from flooding the KernelMain // queue if (!s_pending_accel_event) { s_pending_accel_event = true; PebbleEvent e = { .type = PEBBLE_CALLBACK_EVENT, ....
prv_compute_delta_pos(&accel_data, &s_last_analytics_position)
; s_is_idle = (delta < ACCEL_MAX_IDLE_DELTA); s_last_analytics_position = accel_data; analytics_set(ANALYTICS_DEVICE_METRIC_ACCEL_XYZ_DELTA, delta, AnalyticsClient_System); } } // Self Test ////////////////////////////////////////////////////////////////////// bool accel_self_test(void) { AccelRawDat...
/////////////////////////////////////////////////////////////////// //! Increment / Decrement Animation //! This animation causes a the active cell to "bump" when the user presses the up button. //! This animation has two parts: //! 1) The "text to cell edge" //! 2) The "background settle" //! The "text to cell edge"...
prv_create_bump_settle_animation(selection_layer)
; selection_layer->value_change_animation = animation_sequence_create(bump_text, bump_settle, NULL); animation_schedule(selection_layer->value_change_animation); #else prv_update_cell_value(selection_layer, selection_layer->bump_is_upwards); #endif } //////////////////////////////////////////////////////////////...
ageHeader *hdr, uint16_t page) { memset(hdr, 0xff, sizeof(*hdr)); // before wiping a page, get its erase_count. This is not currently used but // enables future wear leveling improvements / analysis prv_flash_read((uint8_t *)&hdr->erase_count, sizeof(hdr->erase_count), prv_page_to_flash_offset(page) + of...
{ int num_erase_regions = s_pfs_page_count / PFS_PAGES_PER_ERASE_SECTOR; int start_region = s_last_page_written / PFS_PAGES_PER_ERASE_SECTOR; int end_region = start_region + num_erase_regions; uint16_t gc_erase_block = s_gc_block.gc_start_page / PFS_PAGES_PER_ERASE_SECTOR; for (int region = start_region; re...
equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); // Complete A and start B prv_advance_to_ms_with_timers(start_ms + delay_spawn + duration_a + delay_a + 2 * MIN_FRAME_INTERVAL_MS + 1);...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); #...
[URL_BUFFER_SIZE]; bool is_showing_version; TextLayer name_text_layer; char name_text_buffer[NAME_BUFFER_SIZE]; AppTimer *spinner_close_timer; //! Is the mobile app currently connected (comm session is up?) bool is_pebble_mobile_app_connected; //! Has the mobile app ever connected during this boot? Used...
{ uint32_t icon_res_id; const char *url_string; GColor background; GRect kino_area; int16_t icon_x_offset; int16_t icon_y_offset; int16_t text_y_offset; // Have we gone through first use before? If not, show first use UI. Otherwise show recovery UI. const bool first_use_is_complete = shared_prf_stora...
background = PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite); } // Create the icon KinoReel *icon_reel = kino_reel_create_with_resource(icon_res_id); if (!icon_reel) { PBL_CROAK("Couldn't create kino reel"); } // Position the icon kino_area = GRect(icon_x_offset, icon_y_offset, data->launch_app...
_begin_write(&s_session, ENDPOINT_ID, max_length /* required_free_length */, TIMEOUT_MS); cl_assert(write_sb); uint8_t fake_data[max_length]; memset(fake_data, 0, max_length); comm_session...
(&s_session, ENDPOINT_ID, 1 /* required_free_length */, TIMEOUT_MS)
; // Because the ..._begin_write() call happened from the BT02 task, expect the data to be // sent out immediately (we'd timeout or deadlock if an infinite timeout was set) cl_assert(write_sb2); comm_session_send_buffer_end_write(write_sb2); // write_sb is already cleaned up because it got sent out prv_cl...
/* * 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...
(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(system_flash_erase(FLASH_BASE, 1024 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 7), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_...
sions and * limitations under the License. */ #include <stdbool.h> #include <stdint.h> #include "board/board.h" #include "drivers/flash.h" #include "drivers/gpio.h" #include "drivers/periph_config.h" #include "util/delay.h" #include "stm32f7haxx_qspi.h" #define MT25Q_FASTREAD_DUMMYCYCLES 10 typedef enum MT25QCom...
(read_whoami)
; return false; } } void flash_init(void) { prv_enable_qspi_clock(); // init GPIOs for (unsigned i = 0; i < QSpiPinCount; ++i) { gpio_af_init(&BOARD_CONFIG_FLASH_PINS[i], GPIO_OType_PP, GPIO_Speed_100MHz, GPIO_PuPd_NOPULL); } if (BOARD_CONFIG_FLASH.reset_gpio.gpio) { gpio_output_init(&BOARD_CON...
ed = true; } } else if (m_info.has_history) { // This update is for a day in the past. Modify the copy stored in the settings file SettingsFile *file = activity_private_settings_open(); if (!file) { goto unlock; } ActivitySettingsValueHistory history; settings_file_get(file, &m_info....
("new active kcal: %"PRIu16"", state->step_data.active_kcalories)
; } mutex_unlock_recursive(state->mutex); } // -------------------------------------------------------------------------------------------- // Called periodically from the minute handler to update step derived metrics that do not have to // be updated in real time. // We use NOINLINE to reduce the stack requireme...
te_and_register(0, 1, test_message_handler, test_dropped_handler); cl_assert_equal_p(result, NULL); } void test_app_inbox__app_inbox_create_and_register_zero_min_num_messages(void) { void *result = app_inbox_create_and_register(BUFFER_SIZE, 0, test_message_handler, te...
app_inbox_service_register(storage_alt, sizeof(storage_alt), test_alt_message_handler, test_alt_dropped_handler, AppInboxServiceTagUnitTest /* same tag! */)
; cl_assert_equal_b(success, false); cl_assert_equal_b(false, app_inbox_service_has_inbox_for_storage(storage_alt)); fake_kernel_malloc_mark_assert_equal(); } //////////////////////////////////////////////////////////////////////////////////////////////////// // app_inbox_service_begin static void *s_writer = (...
_FILE("draw_dotted_line_cross_color"))); } static void draw_lines_same_point(GContext *ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_stroke_width(ctx, 1); graphics_draw_line(ctx, GPoint(10,10), GPoint(10,10)); graphics_context_set_antialiased(ctx, true); graphics_context_set_stro...
TEST_NAMED_PBI_FILE("draw_line_clip_rect")
)); } void test_graphics_draw_line__clipping_rect_aa(void) { GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, true, 1); graphics_context_set_stroke_color(&ctx, GColorBlack); // Draw lines around boundaries of clipping box - AA true, SW 1 ...
DetailData *) context; alarm_set_enabled(data->alarm_id, !data->alarm_info.enabled); if (data->alarm_editor_callback) { data->alarm_editor_callback(EDITED, data->alarm_id, data->callback_context); } } static void prv_toggle_smart_alarm_handler(ActionMenu *action_menu, const ActionMenuItem *item, ...
i18n_get("Delete", data)
4}, { 1040, 88, 288}, { 1024, 80, 288}, { 1072, 200, 216}, { 1096, 256, 176}, { 1480, 264, 184}, // 129 seconds { 1512, 256, 176}, { 952, 168, 104}, { 904, -136, -96}, { 1008, -368, 112}, { 1232, -192, 72}, { 1008, -152, 168}, { 856, -104, 152}, { 832, 64, 88}, ...
{ 976, 240, 192}, { 992, 336, 168}, { 1048, 360, 96}, { 1040, 224, 40}, { 1056, 16, 96}, { 1024, 88, 304}, { 968, 144, 304}, { 944, 112, 264}, { 1104, 136, 136}, { 1096, 240, 256}, { 1072, 480, 320}, { 1032, 624, 232}, { 1296, 632, 232}, // 135 seconds { 1272,...
{ 1424, -232, -144}, { 848, 40, 88}, { 792, 112, 96}, { 992, -32, 288}, { 1056, -112, 480}, { 1112, -24, 320}, { 984, -32, 272}, { 968, -56, 184}, { 1016, -16, 104}, { 1032, 8, 128}, { 1096, 64, 152}, { 1072, 168, 128}, { 1008, 192, 168}, { 1000, 216, 216}, {...
/* * 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...
{ const char *subtitle_string = NULL; // We only all-caps the subtitle in the card view on rectangular displays bool all_caps_desired = PBL_IF_RECT_ELSE(true, false); bool need_to_all_caps_string = false; // First, try to extract an AlarmKind from the pin to request a string with the desired // capitalizat...
static void prv_subtitle_update(const LayoutLayer *layout, const LayoutNodeTextDynamicConfig *config, char *buffer, bool render) { prv_get_subtitle_from_attributes(layout->attributes, buffer, config->buffer_size, layout); } static GTextNode *prv_card_...
et the path of the filename before the extension size_t prv_get_base_path(const char *filename, char *base) { char *ext = strrchr(filename, '.'); size_t len; if (ext == NULL) { len = strlen(filename); } else { len = ext - filename; } strncpy(base, filename, len); base[len] = '\0'; return len; }...
("Failed to read PDC content: %s\n", filename)
*aaa = layer_create(GRectZero); Layer *aaaa = layer_create(GRectZero); Layer *ab = layer_create(GRectZero); Layer *b = layer_create(GRectZero); layer_add_child(a, aa); layer_add_child(aa, aaa); layer_add_child(aaa, aaaa); layer_add_child(a, ab); a->next_sibling = b; stack[0] = a; // go to child ...
for (int i = 0; i < ARRAY_LENGTH(layers); ++i) { layer_init(layers[i], &GRectZero); }
"stubs_status_bar_layer.h" #include "stubs_syscall_internal.h" #include "stubs_syscalls.h" #include "stubs_task_watchdog.h" #include "stubs_vibes.h" #include "stubs_window_manager.h" #include "stubs_window_stack.h" AnimationProgress animation_timing_scaled(AnimationProgress time_normalized, ...
gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)
); } void test_simple_dialog__battery_charged(void) { SimpleDialog *simple_dialog = simple_dialog_create("Battery Status"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); dialog_set_text(dialog, "Fully Charged"); dialog_set_background_color(dialog, GColorKellyGreen); dialog_set_icon(dialog, RESOUR...
_cccd_hdl; uint16_t notify_hdl; uint16_t notify_cccd_hdl; uint32_t expected_read_header; //! the payload index we are expecting to receiver from the server uint32_t current_write_header; //! the current header we are writing to App } demo_server_hdl_t; static int8_t s_ble_perip_wdog_id; static void prv_log_...
connection_by_idx(event->conn_idx)
, { 1008, 88, -280}, { 1056, 56, -168}, // 26 seconds { 1000, 88, -192}, { 960, 144, -240}, { 960, 168, -240}, { 928, 120, -232}, { 968, 80, -232}, { 992, 56, -240}, { 1008, 0, -272}, { 1056, -32, -288}, { 1056, -120, -232}, { 1144, -120, -240}, { 1264, -80, -232}...
{ 1016, 32, 88}, { 984, 32, 120}, { 992, 40, 128}, { 1168, 64, 144}, { 1144, 96, 112}, { 984, 112, 72}, { 1064, 152, 120}, { 1096, 200, 224}, { 1128, 168, 296}, { 1136, 160, 280}, { 1112, 184, 176}, { 1128, 256, 112}, // 32 seconds { 1112, 248, 104}, { 1128, 1...
6, 8}, { 1128, -16, 0}, // 42 seconds { 1592, -24, 8}, { 1624, 8, -8}, { 1368, 8, -40}, { 1064, -24, -128}, { 912, 32, -112}, { 1104, 56, -48}, { 1224, 16, 24}, { 1120, -16, 32}, { 968, -8, -8}, { 920, 24, -64}, { 976, 40, -96}, { 1008, 32, -128}, { 1056, -24,...
{ 968, -56, 16}, { 1016, -48, 56}, { 1048, -32, 32}, { 1128, -8, 24}, { 1184, 0, 24}, { 1224, 8, 32}, { 1208, 24, 24}, { 1224, 16, 64}, // 48 seconds { 1560, 0, 112}, { 1432, 0, 184}, { 1056, 40, 104}, { 832, 64, -72}, { 784, 88, -152}, { 920, 24, -72}, { ...
/* * 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...
(&health_data)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_sleep_detail_card__render_sleep_data_1(void) { HealthData health_data = { .sleep_data[0] = (7 * SECONDS_PER_HOUR) + (11 * SECONDS_PER_MINUTE), .sleep_data[1] = (6 * SECONDS_PER_HOUR) + (52 * SECONDS_PER_MINUTE), .sleep_da...
be read into the subscriber buffer (it is assumed to be invalid memory at // that point) while (s_running) { uint16_t size = circular_buffer_copy(&s_circ_buffer, (uint8_t *) &s_subscriber.buffer[s_subscriber.idx], ((s_subscriber.size - s_subscriber.idx) * sizeof(int16_t))); if (size == 0) ...
system_task_add_callback_from_isr(prv_dispatch_samples_bg, NULL, &system_task_switch_context)
; } PROFILER_NODE_STOP(mic); return main_switch_context || system_task_switch_context; }
; prv_compare_recognizers_processed((int[]) {4, 0, 3, 1}, 4, &s_recognizers_handled); cl_assert_equal_p(manager.active_layer, &layer_c); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers...
(&e, &manager)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(1, s_method_func_imp_call_count)
; } void test_rocky_api_util__error_print(void) { s_log_internal__expected = (const char *[]){ "Unhandled Error", " "ERROR_STRING, NULL }; jerry_value_t error_val = jerry_create_error(JERRY_ERROR_COMMON, (const jerry_char_t *)ERROR_STRING); cl_assert(jerry_value_has_error_flag(error_val)); ...
ierCount]; } SummaryPinConfig; static char s_pin_subtitle_buffer[SUBTITLE_BUFFER_LENGTH] = ""; static const SummaryPinConfig ACTIVITY_SUMMARY_PIN_CONFIG = { .insight_settings = &s_activity_summary_settings, .short_title = i18n_noop("Activity Summary"), .short_subtitle = s_pin_subtitle_buffer, .health_card_type...
(attr_list, AttributeIdIconTiny, icon)
; attribute_list_add_cstring(attr_list, AttributeIdBody, body); attribute_list_add_uint8(attr_list, AttributeIdBgColor, GColorOrangeARGB8); attribute_list_add_uint8(attr_list, AttributeIdHealthInsightType, insight_type); attribute_list_add_uint8(attr_list, AttributeIdHealthActivityType, activity_type); } // --...
pdate_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_round_rect(ctx, &GRect(10, 2, 18, 4), 4, GCornersAll); } void across_nx_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ct...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_nx_offset_layer.${BIT_DEPTH_NAME}.pbi"))
; test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_y_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(old_address + registry->total_buffer_size_bytes)
; const bool is_space_for_registry = new_address + registry->total_buffer_size_bytes < registry->cursor->end; if (is_space_for_registry) { return new_address; } return registry->cursor->begin; } static void move_cursor_to_active_registry(Registry* registry) { // Search for an active registry, st...
Y, ORIGIN_RECT_CLIP_XY, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r8_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 1); graphics_draw_circle(&ctx,...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 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...
(buffer, buffer_len, fmt, fmt_args)
; va_end(fmt_args); return (len); } static char *get_expected_msg(void) { cl_assert(s_msg.msg_arr != NULL); cl_assert(s_msg.curr_msg_idx < s_msg.num_items); char *expected_msg = NULL; if (s_msg.num_processed != 0) { expected_msg = s_msg.msg_arr[s_msg.curr_msg_idx - 1]; } s_msg.curr_msg_idx++; s_m...
) { prv_assert_minute_data(&retrieve[i], &minute_data[i]); } } // --------------------------------------------------------------------------------------- // Test to make sure that the minute data file gets compacted correctly. If we write more than // ALG_MINUTE_DATA_FILE_LEN worth of data to the sleep file, it...
cl_assert_equal_i(start, start_utc)
; for (int i = 0; i < num_minutes; i++) { prv_assert_minute_data(&retrieve[i], &minute_data[i]); } // Retrieve, trying to start from a lot farther back, it should return the UTC of the first // record available. Also ask for more than what is available num_records = num_minutes * 2; start = start_utc -...
Human_TallMale, Human_ShortMale, Human_TallFemale, Human_ShortFemale, Human_Count, } Human; typedef struct HumanPrefs { uint8_t age_years; ActivityGender gender; uint16_t weight_dag; uint16_t height_mm; } HumanPrefs; #define ACTIVITY_DEFAULT_HEIGHT_MM 1620 // 5'3.8" // dag - decagram...
(Human_ShortMale)
; int short_guy_distance = activity_private_compute_distance_mm(steps, time_ms) / MM_PER_METER; cl_assert_within(short_guy_distance, 36000, 44000); cl_assert_gt(long_run_distance_m, short_guy_distance); // And finally throw in a specific value so that anyone who touches the function will have to // check up ...
ate_FingerDown, GPointZero, 3686380, 0); touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400); TouchEvent *touch_event = touch_event_queue_get_event(0, 0); prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(10, 10), 20, 5, ...
(0, TouchState_FingerDown, NULL, 5, 3686400)
); } void test_touch__handle_update_reset_queue_touchdown(void) { touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 3686380, 0); touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420); touch_handle_update(0, TouchState_FingerUp, &GPoint(15, 100), 0, 3686400); TouchEvent *touch_eve...
/* * 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 (num_events_logged > 100) { // don't log a ridiculous amount of tightly looped disconnects return; }
// It's okay to log to analytics directly from the BT02 callback thread // because flash writes are dispatched to KernelBG if the datalogging session // is buffered if (type != AnalyticsEvent_BtLeDisconnect) { analytics_event_bt_connection_or_disconnection(type, reason); } else { if (!vers_info) { /...
; static bool prv_wait_programmed(void) { // The datasheet lists the typical NVCM configuration time as 56 ms. // Something is wrong if it takes more than twice that time. int timeout = 100 * 10; while (GPIO_ReadInputDataBit(DISP_GPIO, DISP_PIN_CDONE) == 0) { if (timeout-- == 0) { dbgserial_putstr("F...
dbgserial_print("Precondition: BUSY asserted during scene draw? ")
; prv_draw_scene(SCENE_BLACK); ASSERT_BUSY_IS(Bit_SET); dbgserial_print("Is BUSY cleared after the reset command? "); prv_start_command(CMD_RESET_ASSERT); prv_end_command(); ASSERT_BUSY_IS(Bit_RESET); dbgserial_print("Are draw-scene commands ineffectual while in reset? "); prv_draw_scene(SCENE_BLACK);...
frame, offset); return; } } static void prv_render_bpm(GContext *ctx, Layer *base_layer) { HealthHrSummaryCardData *data = layer_get_data(base_layer); const int units_offset_y = fonts_get_font_height(data->bpm_font) - fonts_get_font_height(data->units_font); GTextNodeHorizontal *horiz_container = ...
ARRAY_LENGTH(s_hr_summary_progress_segments)
, .segments = s_hr_summary_progress_segments, }, .now_bpm = health_data_hr_get_current_bpm(health_data), .resting_bpm = health_data_hr_get_resting_bpm(health_data), .last_updated = health_data_hr_get_last_updated_timestamp(health_data), .bpm_font = fonts_get_system_font(FONT_KEY_LECO_26_BOLD_N...
tart); // Tests cl_assert(word_iter_state.current.start == word_iter_state.current.end); cl_assert(!iter_next(&word_iter)); cl_assert(word_iter_state.current.width_px == 0); } void test_word_iterator__test_unprintable(void) { // Allocate mutable types Iterator word_iter = (Iterator) { 0 }; WordIterState...
iter_next(&word_iter)
); cl_assert(*word_iter_state.current.start == 'I'); cl_assert(*word_iter_state.current.end == '\n'); cl_assert(HORIZ_ADVANCE_PX * 2 == word_iter_state.current.width_px); cl_assert(iter_next(&word_iter)); cl_assert(*word_iter_state.current.start == '\n'); cl_assert(*word_iter_state.current.end == 'o'); ...
{ -112, 904, -256}, { -112, 896, -256}, { -112, 904, -256}, { -112, 904, -248}, { -112, 904, -256}, { -112, 904, -256}, { -112, 904, -256}, // 10 seconds { -112, 896, -248}, { -112, 896, -256}, { -112, 904, -256}, { -112, 904, -256}, { -112, 904, -248}, { -120, 8...
{ -120, 904, -256}, { -120, 904, -248}, { -112, 904, -248}, { -120, 896, -256}, { -112, 904, -256}, { -112, 904, -248}, { -120, 904, -256}, { -112, 904, -248}, { -120, 904, -248}, { -120, 920, -240}, { -136, 952, -248}, { -144, 920, -192}, { -136, 864, -216}, { -1...
{ -128, 928, -72}, { -128, 928, -64}, { -128, 928, -64}, { -128, 920, -72}, { -128, 928, -72}, { -128, 928, -64}, { -136, 928, -64}, { -136, 928, -64}, // 18 seconds { -128, 928, -64}, { -128, 928, -64}, { -128, 936, -64}, { -128, 928, -64}, { -128, 928, -64}, ...
rvices/normal/app_inbox_service.h" #include "services/normal/app_outbox_service.h" #include "services/normal/music.h" #include "services/normal/music_endpoint.h" #include "services/normal/notifications/do_not_disturb.h" #include "services/normal/stationary.h" #include "services/normal/timeline/event.h" #include "shell/...
music_endpoint_handle_mobile_app_info_event(&e->bluetooth.app_info_event)
; analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_APP_INFO_COUNT, AnalyticsClient_System); return; case PEBBLE_MEDIA_EVENT: if (e->media.playback_state == MusicPlayStatePlaying) { app_install_mark_prioritized(APP_ID_MUSIC, true /* can_expire */); } return; case PEBBLE_HEALTH_...
s_is_advertising = true; PBL_LOG(GAP_LE_ADVERT_LOG_LEVEL, "Airing advertising job: %s ", prv_string_for_debug_tag(next->tag)); // Use average interval ms. BT controller does not report back what it uses. const uint32_t interval_ms = (min_interval_ms + max_interval_ms) / 2...
{ kernel_free(job->terms); kernel_free(job); job = NULL; }
} bt_unlock(); return job; } // ----------------------------------------------------------------------------- void gap_le_advert_unschedule(GAPLEAdvertisingJobRef job) { if (!job) { return; } bool is_registered = false; bt_lock(); { if (!s_gap_le_advert_is_initialized) { goto unlock; ...
/* * 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...
(&pair->white_layer.layer)
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. */ //! The app is driven by pebble protocol app_messages, used indirectly through app_sync. #include <pe...
app_sync_deinit(&data->sync)
; } // Used to draw lines to contain 'hole' and 'par' sections. static void draw_dotted_line(GContext *ctx, GPoint p0, uint16_t length, bool is_vertical) { bool even = (p0.x + p0.y) % 2 == 0; const GPoint delta = is_vertical ? GPoint(0, 1) : GPoint(1, 0); while (length >= 1) { if (even) { graphics_draw...
/* * 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("itoa buffer too small"); return; }
x_used_space) { return s_open_status; } static bool s_has_cache; static bool s_get_called; static uint64_t s_get_value; status_t settings_file_get(SettingsFile *file, const void *key, size_t key_len, void *val_out, size_t val_out_len) { s_get_called = true; if (!s_has_cache) { retu...
(CommSessionInfiniteLogDumping)
; cl_assert_equal_b(true, has_cap_infinite_log_dumping); // Check that cache is NOT re-written: cl_assert_equal_i(s_set_value, s_unwritten_value); cl_assert_equal_b(true, s_get_called); cl_assert_equal_b(true, s_close_called); }
uint8_t register_address, uint32_t size, uint8_t *data, TransferType type) { // Take control of bus; only one task may use bus at a time mutex_lock(bus->state->bus_mutex); if (bus->state->user_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "Attempted access to disabled bus %s", bus-...
mutex_unlock(bus->state->bus_mutex)
; if (!result) { prv_analytics_track_i2c_error(); } return result; } bool i2c_read_register(I2CSlavePort *slave, uint8_t register_address, uint8_t *result) { return i2c_read_register_block(slave, register_address, 1, result); } bool i2c_read_register_block(I2CSlavePort *slave, uint8_t register_address_s...
/* * 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...
(largest_free_block, UINT16_MAX)
, }, }; if (!sys_process_manager_get_current_process_uuid(&event_blob.app_oom.app_uuid)) { // Process has no UUID return; } #if LOG_DOMAIN_ANALYTICS ANALYTICS_LOG_DEBUG("app oom: is_rocky=%u, req_sz=%"PRIu32" tot_sz=%"PRIu32" free=%"PRIu32 " max_free=%"PRIu32, ...
harine ", dest, NAME_LENGTH); cl_assert_equal_s(dest, "Katharine"); } void test_phone_formatting__multibyte_initial(void) { char dest[NAME_LENGTH]; phone_format_caller_name("Donut " E_ACUTE "clair", dest, NAME_LENGTH); cl_assert_equal_s(dest, "Donut " E_ACUTE "."); } void test_phone_formatting__overflowin...
(dest_len)
; // malloc'd memory is protected by DUMA phone_format_phone_number(test_number, dest, dest_len); cl_assert_equal_s(dest, "12345\n123456"); } void test_phone_formatting__phone_number_intl_germany(void) { char test_number[] = "+49 030 90 26 0"; // Berlin, Rotes Rathaus int dest_len = sizeof(test_number) + 1...
for another "Good" or better. // // So, for the first 0 to HRM_SENSOR_SPIN_UP_SEC seconds after turning the sensor on or first // contacting the wrist after being off-wrist, the readings can be unstable and this method will // return false during that time. // // @param[in] data pointer to last received HRMdata or NULL...
if (state->expire_utc && (utc_now >= state->expire_utc)) { // Ignore expired subscriptions continue; }
int64_t subscriber_age_ticks; if (state->last_valid_ticks) { subscriber_age_ticks = cur_ticks - state->last_valid_ticks; } else { // Never got an update yet subscriber_age_ticks = milliseconds_to_ticks(state->update_interval_s * MS_PER_SECOND); } in...
= alarm_create(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule); // Delete the 10:30 alarm alarm_delete(id1); // The 10:30 alarm should not go off s_current_hour = 11; s_current_minute = 0; cr...
alarm_set_enabled(id3, false)
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language gover...
alerts_get_mask()
== AlertMaskAllOn); } void test_alerts__dnd_interruptions(void) { s_dnd_active = true; alerts_set_dnd_mask(AlertMaskAllOff); alerts_set_mask(AlertMaskAllOn); cl_assert(alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_vibrate_for_type(AlertMobile)); alerts_set_notification_vibe_timest...
gin_r9_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_no_clip....
gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , 3, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r3_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLI...
------------------------------------------------------------- void test_kraepelin_algorithm__sleep_tests(void) { bool success = prv_sample_discovery_init(&s_sleep_sample_discovery_state.common, SampleFileType_MinuteSamples, "activit...
{ printf("| ---------------------- "); }
float weighted_sum = 0.0; int pass_count = 0; int fail_count = 0; SleepFileTestEntry *entry = &test_entry[0]; SleepTestResults *results; for (int i = 0; i < num_tests; i++, entry++, results++) { results = &test_results[entry->test_idx]; // Generate the status string const char *status = prv_s...
dst * (1 - alpha_normalized) static ALWAYS_INLINE void prv_gbitmap_sequence_blend_over(GColor8 src_color, GColor8 *dst) { if (src_color.a == 3) { // Fast path: 100% opacity *dst = src_color; } else if (src_color.a == 0) { // Fast path: 0% opacity, no-op! } else { const GColor8 dest_color = *dst; const...
(bitmap_sequence->png_decoder_data.palette)
; applib_free(bitmap_sequence); } } static ALWAYS_INLINE GColor8 *prv_target_pixel_addr(GBitmap *bitmap, apng_fctl *fctl, uint32_t x, uint32_t y) { uint32_t offset = (fctl->y_offset + y + bitmap->bounds.origin.y) * bitmap->row_size_bytes + (fctl->x_offs...
) mfg_display_app_get_info()); } static void prv_select_runin(int index, void *context) { launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_runin_app_get_info()); } static void prv_select_vibe(int index, void *context) { launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_vibe_app_get_info()); } st...
memcpy(*out_menu_items, s_menu_items, sizeof(s_menu_items))
; // Now we're going to modify the first two elements in the menu to include data available only // at runtime. If it was available at compile time we could have just shoved it in the // s_menu_items array but it's not. Note that we allocate a few buffers here that we never // bother freeing for simplicity. It...
&GPointZero); animation_set_duration(layer_in, TIMELINE_CARD_TRANSITION_MS / 2); animation_set_custom_interpolation(layer_in, interpolate_moook); animation_set_handlers(layer_in, (AnimationHandlers) { .stopped = prv_back_from_card_stopped, }, data); data->current_animation = layer_in; animation_sch...
app_free(s_app_data)
; } static void prv_main(void) { prv_init(); app_event_loop(); prv_deinit(); } const PebbleProcessMd *timeline_get_app_info() { static const PebbleProcessMdSystem s_app_md = { .common = { .main_func = prv_main, // uuid: 79C76B48-6111-4E80-8DEB-3119EEBEF33E .uuid = {0x79, 0xC7, 0x6B, 0x...
file_hdr.file_namelen = strlen(f->name); file_hdr.file_size = f->file_size; file_hdr.file_type = f->file_type; write_file_header(&file_hdr, start_page); prv_flash_write((uint8_t *)f->name, strlen(f->name), prv_page_to_flash_offset(start_page) + FILE_NAME_OFFSET); if (!f->is_tmp) { update_curr_stat...
if (unref != -1) { mark_fd_free(unref); // clean up previous file state }
return ((*fdp != -1) ? FDAvail : NoFDAvail); } /* * Exported PFS APIs */ size_t pfs_get_file_size(int fd) { mutex_lock_recursive(s_pfs_mutex); size_t res = 0; if (FD_VALID(fd)) { res = PFS_FD(fd).file.file_size; } mutex_unlock_recursive(s_pfs_mutex); return (res); } int pfs_read(int fd, void ...
d) {} ResAppNum sys_get_current_resource_num(void) { return 0; } const uint8_t *sys_resource_read_only_bytes(ResAppNum app_num, uint32_t resource_id, size_t *num_bytes_out) { return NULL; } int8_t vibe_get_braking_strength(void) { return -100; } // fake typedef struc...
{ uint8_t buffer[] = { 'V', 'I', 'B', 'E', // FourCC 1, 0, // version 0, 0, 0, 0, // reserved bytes 18, 0, // attr_list_size 2, // GenericAttributeList.num_attributes VibeAttributeId_Notes, 8, 0, // GenericAttribute.length 200, 0, // VibeNote.vibe_duration_ms 1, /...
void test_vibe_score__test_get_repeat_delay_ms_custom_delay(void) { uint8_t buffer[] = { 'V', 'I', 'B', 'E', // FourCC 1, 0, // version 0, 0, 0, 0, // reserved bytes 23, 0, // attr_list_size 3, // GenericAttributeList.num_attributes VibeAttributeId_Notes, 8, 0, // GenericAt...
/* * 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...
(&client->list_node, &buffer->clients, NULL)
onResultMsg) + sizeof(GenericAttributeList); const bool app_initiated = (msg->flags.app_initiated == 1); Uuid *app_uuid = NULL; if (!prv_handle_result_common(msg->result, app_initiated, msg->session_id, &msg->attr_list, attr_list_size, &app_uuid)) { return; } if (app_uuid)...
if (app_uuid) { // set this after struct initialization because the rest of the fields in the bitfield are left // uninitialized if just one is set. msg->flags.app_initiated = 1; // we're also sending the app UUID msg->attr_list.num_attributes += 1; // add app UUID attribute attr = generic...
attr = generic_attribute_add_attribute(attr, VEAttributeIdAudioTransferInfoSpeex, info, sizeof(AudioTransferInfoSpeex)); size_t actual_size = (uint8_t *)attr - (uint8_t *)msg; PBL_ASSERTN(actual_size == size); comm_session_send_data(comm_session, VOICE_CONTROL_ENDPOINT, (uint8_t *)msg, ...
; GPoint p3 = GPoint(x2, y1); // graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, true); graphics_context_set_stroke_width(ctx, data->stroke_width); graphics_draw_line(ctx, p1, p2); graphics_draw_line(ctx, p3, p0); /* graphics_context_set_strok...
(ctx, true)
; graphics_context_set_stroke_width(ctx, data->stroke_width); graphics_draw_line(ctx, GPoint(x1, y1), GPoint(x2, y2)); } static void main_window_load(Window *window) { AppData *data = window_get_user_data(s_window); Layer *window_layer = window_get_root_layer(window); window_set_background_color(window, GCol...
ANCSClientStateReassemblingNotification || new_state == ANCSClientStateRequestedApp || new_state == ANCSClientStateRetrying || new_state == ANCSClientStateIdle); case ANCSClientStateReassemblingNotification: return (new_state == ANCSClientStateRequestedApp || ...
prv_do_notif_queue_operation()
; } // ----------------------------------------------------------------------------- // Reset & Error Handling static void prv_reset_and_idle(void) { prv_set_state(ANCSClientStateIdle); prv_reset_reassembly_context(); } static void prv_reset_and_retry(void *unused) { if (s_ancs_client == NULL) { return; ...