prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
-13, .text.extent.margin.h = -7, }; GTextNodeText *text_node = (GTextNodeText *)layout_create_text_node_from_config( &layout->layout_layer, &s_all_day_config.text.extent.node); // TODO: PBL-30522 Enable timeline list view text flow // Remove when text flow is enabled if (PBL_IF_ROUND_ELSE...
(buffer, prv_get_secondary_text(layout), config->buffer_size)
; buffer[config->buffer_size - 1] = '\0'; } } static GTextNode *prv_create_pin_view_node(TimelineLayout *layout) { const AttributeList *attributes = layout->layout_layer.attributes; const size_t num_vertical_nodes = 3; GTextNodeVertical *vertical_node = graphics_text_node_create_vertical(num_vertical_node...
; } jerry_size_t jerry_string_to_utf8_char_buffer(const jerry_value_t value, jerry_char_t *buffer_p, jerry_size_t buffer_size) { const jerry_size_t str_size = jerry_get_utf8_string_size(value); if (str_size == 0 || buffer_s...
{ return JERRY_CREATE_VALUE(NaN); }
jerry_value_t jerry_create_null(void) { return JERRY_CREATE_VALUE(null); } jerry_value_t jerry_create_object(void) { return JERRY_CREATE_VALUE(new Object()); } jerry_value_t jerry_create_string(const jerry_char_t *str_p) { if (!str_p) { return jerry_create_undefined(); } return jerry_create_string_utf...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(firmware_description->firmware_length)
; dbgserial_print(" bytes\r\n"); const uint32_t crc = crc32(CRC32_INIT, (const uint8_t *)FIRMWARE_BASE, firmware_description->firmware_length); dbgserial_print("Checksum - wanted "); dbgserial_print_hex(firmware_description->checksum); dbgserial_print(" got "); dbgserial_print...
B. // The remaining sectors are 128 KiB. // Bitset of sectors that have been "erased" static uint32_t erased_sector; static bool flash_locked, flash_flags_set; static FLASH_Status return_status; uint8_t *flash_written_data; bool *flash_written_flag; void *source_buffer; uint32_t flash_data_start, flash_data_length; bo...
(callback_called)
; } void test_system_flash__write_error(void) { return_status = FLASH_ERROR_OPERATION; malloc_flash_data(10); flash_data_start = FLASH_BASE; cl_assert(!system_flash_write(FLASH_BASE, "abc", 3, NULL, NULL)); cl_assert(flash_locked); assert_flash_unwritten(0, 10); } extern void FLASH_Lock(void) { flash_lo...
.c static void prv_disallowed_sent_handler(AppOutboxStatus status, void *cb_ctx) { } void test_app_outbox__send_disallowed_sent_handler(void) { prv_register(); cl_assert_passert(app_outbox_send(s_test_data, s_test_data_length, prv_disallowed_sent_handler, s_expected_cb_ctx)); ...
cl_assert_equal_i(s_num_app_outbox_events_sent, 1)
; fake_kernel_malloc_mark_assert_equal(); } void test_app_outbox__cleanup_all_with_pending_message(void) { fake_kernel_malloc_mark(); prv_register(); app_outbox_send(s_test_data, s_test_data_length, test_app_outbox_sent_handler, s_expected_cb_ctx); cl_assert(s_last_message); app_outbox...
art3", 0, 0, false}, [PowerSystemMcuI2C1] = { "McuI2C1", 0, 0, false}, [PowerSystemMcuI2C2] = { "McuI2C2", 0, 0, false}, [PowerSystemMcuSpi1] = { "McuSpi1", 0, 0, false}, #ifdef PLATFORM_TINTIN [PowerSystemMcuSpi2] = { "McuSpi2", 0, 0, false}, #else [PowerSystemMcuSpi6] = ...
rtc_get_ticks()
- current_profile->start_ticks); current_profile->start_ticks = 0; } #endif // SW_POWER_TRACKING
/* * 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...
(normalized, AnimationCurveEaseInOut)
/* * 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 uint32_t pattern = graphics_private_get_1bit_grayscale_pattern(color, (uint8_t) y); uint32_t left_edge_block, right_edge_block, mask; const uint32_t left_edge_bits_count = x % 32; const uint32_t right_edge_bits_count = (x + width) % 32; uint32_t *block = ((uint32_t*)framebuffer->addr) + (y * (framebuf...
// ## Line blending functions: // This function draws horizontal line with AA edges, given values have to be adjusted for // screen coordinates and clipped according to the clip box, does not respect transparency // on the drawn line (beside edges) T_STATIC void prv_assign_horizontal_line_raw(GContext *ctx, int1...
; } static int prv_crumb_spacing(void) { return prv_crumb_config()->crumb_spacing; } static int prv_crumb_space_from_top(void) { return prv_crumb_config()->crumb_space_from_top; } static int prv_crumb_maximum_count(void) { // NOTE: Was originally: // static const int MAX_CRUMBS = 16; // 168 / (4px di...
(prop_anim)
; }
{ bt_persistent_storage_delete_bt_classic_pairing_by_addr(address); bt_driver_classic_disconnect(address); analytics_inc(ANALYTICS_DEVICE_METRIC_BT_PAIRING_FORGET_COUNT, AnalyticsClient_System); } static void prv_forget_ble_remote(int id) { bt_persistent_storage_delete_ble_pairing_by_id(id); analytics_inc(...
(&data->action_menu)
; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(dialog, true)
; } //! Construct a worker crash reason string //! @param app_install_id The worker's install id //! @return The resulting string, which must be freed by the caller static char *prv_create_worker_crash_reason_string(AppInstallId app_install_id) { // Get the information about the app whose worker crashed AppInstall...
/* * 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...
bt_driver_cb_gatt_client_operations_handle_response(&r_resp.hdr)
; break; } case HcMessageID_Gatt_WriteCompleted: { HcGattWriteRespData *w_data = (HcGattWriteRespData *) &msg->payload[0]; PBL_LOG(LOG_LEVEL_DEBUG, "Gatt: Got a write complete event: handle=%d", w_data->att_handle); GattClientOpWriteReponse w_resp = { .hdr = { .type = G...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&points[i], &points[j], context)
; if (reverse ? cmp < 0 : cmp > 0) { prv_swap_gpoint(&points[i], &points[j]); } } } } bool gpointprecise_equal(const GPointPrecise * const pointP_a, const GPointPrecise * const pointP_b) { return ((pointP_a->x.raw_value == pointP_b->x.raw_value) && (pointP...
------------------------------ // Log a voice response event void analytics_event_voice_response(AnalyticsEvent event_type, uint16_t response_size_bytes, uint16_t response_len_chars, uint32_t response_len_ms, uint8_t error_count, uint8_t num_sessio...
(&event_blob)
; } // ------------------------------------------------------------------------------------------ //! Log when app_launch trigger failed. void analytics_event_bt_app_launch_error(uint8_t gatt_error) { analytics_event_bt_error(AnalyticsEvent_BtAppLaunchError, gatt_error); } // ---------------------------------------...
/* * 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_fd_from_context(context)
/* * 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...
{ OS_ASSERT(!mcu_state_is_isr()); xLightMutexLock(handle->common.freertos_mutex, portMAX_DELAY); LOG_LOCKED(handle->common.lr, myLR); }
/* * 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...
attribute_list_add_cstring(&list, AttributeIdTitle, ARRAY_RAND(titles))
; attribute_list_add_cstring(&list, AttributeIdBody, ARRAY_RAND(bodies)); attribute_list_add_uint32(&list, AttributeIdLastUpdated, now); TimelineItem *item = timeline_item_create_with_attributes(now + delta_time_s, 0, TimelineItemTypeNotification, ...
/* * 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...
(PebbleTask_Unknown)
; state->handler = NULL; event_service_init(PEBBLE_TICK_EVENT, &tick_timer_add_subscriber, &tick_timer_remove_subscriber); } void tick_timer_service_subscribe(TimeUnits tick_units, TickHandler handler) { TickTimerServiceState *state = prv_get_state(PebbleTask_Unknown); state->handler = handler; state->tick_u...
ge_ack(APP_MSG_OK); json_bytes_remaining -= json_bytes_size; } EXPECT_OUTBOX_NO_MESSAGE_PENDING(); task_free(buffer); } void test_rocky_api_app_message__postmessage_not_jsonable(void) { prv_init_and_goto_session_open(); const char *not_jsonable_error = "TypeError: Argument at index 0 is not a JSON.s...
(t != EVENTED_TIMER_INVALID_ID)
bootloader error display void display_spi_configure_default(void) { spi_slave_set_frequency(ICE40LP->spi_port, ICE40LP->base_spi_frequency); } void display_start() { periph_config_acquire_lock(); gpio_output_init(&ICE40LP->creset, GPIO_OType_OD, GPIO_Speed_25MHz); gpio_input_init(&ICE40LP->cdone); gpio_inpu...
display_spi_configure_default()
; } periph_config_release_lock(); return success; } void display_power_enable(void) { // The display requires us to wait 1ms between each power rail coming up. The PMIC // initialization brings up the 3.2V rail (VLCD on the display, LD02 on the PMIC) for us, but // we still need to wait before turning on t...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_DEBUG, "Got shutdown message! Going to fall into a deep sleep...")
; // Set the reboot reason to signify we shut down gracefully RebootReason reason = { .code = RebootReasonCode_Shutdown, }; // FIXME PBL-38181: For some reason, the reboot reason shutdown never gets persisted/recovered reboot_reason_set(&reason); // Send empty response as acknowledgement: hc_protoco...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ARRAY_LENGTH(s_fetched_notif_attributes)
imer.h" #include "services/common/i18n/i18n.h" #include "services/normal/blob_db/reminder_db.h" #include "services/normal/bluetooth/ble_hrm.h" #include "services/normal/notifications/action_chaining_window.h" #include "services/normal/notifications/alerts_preferences.h" #include "services/normal/notifications/ancs/ancs...
(data->voice_data)
late outbound queue full, so ack will have to wait until there's buffer space: fake_gatt_client_op_set_write_return_value(BTErrnoNotEnoughResources); // Receive data (that needs to be ack'd): uint8_t sn = 0; prv_receive_short_data_fragment(s_characteristics[0][PPoGATTCharacteristicData], sn); fake_gatt_client...
prv_receive_short_data_fragment(s_characteristics[0][PPoGATTCharacteristicData], sn)
; prv_assert_sent_ack(s_characteristics[0][PPoGATTCharacteristicData], sn); } } void test_ppogatt__close(void) { test_ppogatt__open_session_when_found_pebble_app(); Transport *client = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); cl_assert(client); ppogatt_close(client); cl_assert_equal_p(NU...
ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NULL_W, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_null_w", fb, GColorWhite)); setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1); graphics_cont...
GRect(0, 0, 144, 168)
, GRect(0, 0, 144, 168), false, 1); graphics_context_set_fill_color(&ctx, GColorRed); graphics_fill_rect(&ctx, &GRect(0, 0, 144, 168)); graphics_context_set_text_color(&ctx, GColorBlue); graphics_draw_text(&ctx, "blue100", &s_font_info, GRect(10, 10, 100, 30), GTextOverflowModeTrailingEllip...
t center, uint16_t radius, int32_t angle_start, int32_t angle_end) { // We're just casting this to precise points GPointPrecise fixed_center; // GPointPreciseFromGPoint doesnt work for unit tests (!!!) fixed_center.x.integer = center.x; fixed_center.y.integer = center.y; fix...
Fixed_S16_3(radius_outer.raw_value - inset_thickness * FIXED_S16_3_ONE.raw_value)
; graphics_fill_radial_precise_internal(ctx, center, radius_inner, radius_outer, angle_start, angle_end); } void graphics_fill_oval(GContext *ctx, GRect rect, GOvalScaleMode scale_mode) { const int32_t inset_thickness = MAX(ABS(rect.size.h), ABS(rect.size.w)); // Fill radi...
*a; *a = *b; *b = t; } void gpoint_sort(GPoint *points, size_t num_points, GPointComparator comparator, void *context, bool reverse) { for (size_t i = 0; i < num_points; i++) { for (size_t j = i + 1; j < num_points; j++) { int cmp = comparator(&points[i], &points[j], context); if (reverse ? c...
grect_standardize(&s_r1)
; grect_standardize(&s_r2); const uint8_t min_x = MIN(s_r2.origin.x, s_r1.origin.x); const uint8_t min_y = MIN(s_r2.origin.y, s_r1.origin.y); const uint8_t max_x = MAX(s_r2.origin.x + s_r2.size.w, s_r1.origin.x + s_r1.size.w); const uint8_t max_y = MAX(s_r2.origin.y + s_r2.size.h, ...
ate_palette(GBitmapFormat format) { PBL_ASSERTN(!process_manager_compiled_with_legacy2_sdk()); GColor *palette = NULL; uint8_t palette_size = gbitmap_get_palette_size(format); if (palette_size > 0) { palette = applib_zalloc(palette_size * sizeof(GColor)); } return palette; } #define BITMAP_FORMAT_IS_CI...
prv_gbitmap_create_blank(size, format)
; if (bitmap) { gbitmap_set_palette(bitmap, palette, free_on_destroy); } return bitmap; } // Adapted from http://aggregate.org/MAGIC/#Bit%20Reversal T_STATIC uint8_t prv_byte_reverse(uint8_t b) { b = (b & 0xaa) >> 1 | (b & 0x55) << 1; b = (b & 0xcc) >> 2 | (b & 0x33) << 2; b = (b & 0xf0) >> 4 | (b & 0...
vert_handle_connect_as_slave(); prv_put_legacy_connection_event(&event->peer_address, true /* connected */); } if (gap_le_connection_is_connected(&event->peer_address)) { // We have seen this crop up for cases where the phone has disconnected due to a timeout // but the watch has n...
(connection)
; #endif const bool local_is_master = connection->local_is_master; PBL_LOG(LOG_LEVEL_INFO, "LE Disconn: addr="BT_DEVICE_ADDRESS_FMT", is_random_addr=%u,", BT_DEVICE_ADDRESS_XPLODE(event->peer_address.address), event->peer_address.is_random_address); PBL_LOG(LOG_LEVEL_INFO,...
/* * 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...
("End Workout", &notif_attr_list)
); attribute_list_add_uint32(&end_workout_attr_list, AttributeIdLaunchCode, WorkoutLaunchArg_EndWorkout); AttributeList open_workout_attr_list = {0}; attribute_list_add_cstring(&open_workout_attr_list, AttributeIdTitle, i18n_get("Open Workout", &notif_attr...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTest" "TestTestTestTestTestTestTestTestTestTest" "TestTestTestTestTestTestTestTestTestTest" "TestTestTestTest...
; cl_assert_equal_i(s_num_event_puts, 0); cl_assert_equal_i(s_num_packets_sent, 1); cl_assert_equal_i(s_num_bytes_sent, LOG_METADATA_LENGTH + 128); cl_assert_equal_s(s_log_message_buffer, "TestTestTestTestTestTestTestTestTestTest" "TestTestTestTestTestTestTestTestTestT...
registered for today prv_feed_cannned_accel_data(150 * SECONDS_PER_MINUTE, 0, ActivitySleepStateLightSleep); // Awake for 30 minutes which puts us at 9pm. prv_feed_cannned_accel_data(30 * SECONDS_PER_MINUTE, 20, ActivitySleepStateAwake); // Another 2 hour sleep session starting at 9pm. This will leave us at 1...
prv_feed_raw_accel_data(raw_data, k_raw_samples)
; // Stop collection activity_raw_sample_collection(false, true, &enabled, &session_id, &num_samples, &seconds); cl_assert(!enabled); cl_assert_equal_i(num_samples, k_raw_samples); cl_assert_equal_i(seconds, (k_raw_samples + ALGORITHM_SAMPLING_RATE - 1) / ALGORITHM_SAMPLING_RA...
lingEllipsis, GTextAlignmentCenter, NULL); } void draw_text_single_line_ellipsis_clip_outside_ny(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, -40, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAl...
graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(80, 4, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL)
; } void canvas_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_rect(ctx, &GRect(39, 39, 82, 42)); } void test_graphics_draw_text_${BIT_DEPTH_NAME}__clipping(void) { GContext ctx; Layer canvas; Layer layer; prv_setup_resources(); uin...
ramebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); s_house_path = gpath_create(&s_house_path_info); s_bolt_path = gpath_create(&s_bolt_path_info); s_duplicates_path = gpath_create(&s_duplicates_path_info); s_crossing_path = gpath_create(&s_crossing_path_info); s_infinite_path = gpath_create(&s_infinite_pat...
(SCREEN_WIDTH, SCREEN_HEIGHT / 2)
); ctx.draw_state.drawing_box = GRect(-SCREEN_WIDTH / 2, 0, SCREEN_WIDTH, SCREEN_HEIGHT); ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled.${BIT_DEPTH_NAME}.pbi")); } // AA section void test_graphics_...
D_CRC: prv_handle_crc(command, length); return; case IMAGING_CMD_QUERY_REGION: prv_handle_query_region(command, length); return; case IMAGING_CMD_FINALIZE_REGION: prv_handle_finalize_region(command, length); return; default: prv_respond_malformed...
pulse_best_effort_send_begin(PULSE_PROTOCOL_FLASH_IMAGING)
; *ack = (CrcAck) { .opcode = IMAGING_RESP_CRC, .address = cmd->crc.address, .length = cmd->crc.length, .crc = crc }; pulse_best_effort_send(ack, sizeof(CrcAck)); } static void prv_handle_query_region(Command *cmd, size_t length) { if (length != sizeof(cmd->region)) { prv_respond_malformed_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_DEBUG, "Got init message!")
; const BTDriverConfig *config = (const BTDriverConfig *)request->payload; ble_task_init(config); hc_protocol_enqueue_response(request, NULL, 0); } static void prv_handle_shutdown(const HcProtocolMessage *request) { #if 0 // Fixme once some space is really freed up // Dump some statistics on stack usage befo...
/* * 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 (s_should_log_about_mic_error) { *max_subsequent_failures = s_max_subsequent_error_count_since_last_log; s_should_log_about_mic_error = false; s_max_subsequent_error_count_since_last_log = 0; return true; } return false; }
static void prv_mic_error_resilience_workaround(struct co_buf_rx_desc *rxdesc) { // MT: PBL-39297 -- Qualcomm WCN3660/WCN3680's encryption goes off in the weeds // occassionally for a couple packets... if (rxdesc->rxstatus & BLE_MIC_ERR_BIT) { if (++s_subsequent_mic_errors > s_max_subsequent_error_count_sin...
{ 80, 24, -1000}, { 80, 16, -1000}, { 72, 8, -1008}, { 72, 32, -1000}, { 72, 16, -992}, { 80, 24, -992}, { 72, 24, -1000}, { 80, 16, -1000}, { 72, 16, -992}, { 72, 16, -1000}, { 72, 24, -1000}, { 80, 16, -1000}, { 72, 16, -1008}, { 72, 16, -1000}, { 72, 16, -...
{ 72, 8, -1000}, { 64, 16, -1000}, { 64, 32, -992}, { 64, 8, -1000}, { 72, 24, -1000}, { 64, 16, -1000}, { 64, 24, -1008}, { 64, 16, -1000}, { 64, 16, -1000}, { 64, 16, -1000}, { 64, 16, -1000}, { 64, 24, -1000}, { 64, 16, -1000}, { 72, 24, -992}, { 64, 16, -1...
{ 64, 24, -1000}, { 64, 24, -1000}, { 72, 16, -1000}, { 64, 24, -992}, { 64, 24, -1000}, { 64, 16, -1000}, { 64, 24, -1000}, { 64, 16, -1000}, { 64, 24, -1000}, { 72, 16, -1008}, { 64, 16, -1000}, { 64, 16, -1008}, { 64, 16, -1000}, { 56, 16, -1000}, { 64, 16...
owStack *app_stack = app_state_get_window_stack(); WindowStack *modal_stack = modal_manager_get_window_stack(ModalPriorityGeneric); cl_check(app_stack); cl_check(modal_stack); cl_check(!app_stack->list_head); cl_check(!modal_stack->list_head); // Switch to the app state to push a window stub_pebble_tas...
cl_assert_equal_b(s_app_idle, false)
; // The app should retain focus PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT); cl_assert_equal_i(event.app_focus.in_focus, true); cl_assert_equal_i(window_stack_count(app_stack), 1); // Pop the modal window off the stack window_stack_remov...
/* * 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 false; }
} } } return true; } // Tests //////////////////////////////////// // setup and teardown void test_bitblt_palette__initialize(void) { framebuffer_init(&framebuffer, &(GSize) { DISP_COLS, DISP_ROWS }); test_graphics_context_init(&ctx, &framebuffer); } void test_bitblt_palette__cleanup(void) { } vo...
/* * 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 (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(handler, sizeof(*handler)); }
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "apps/prf_apps/recovery_first_use_app/getting_started_button_combo.h" #include "clar.h" // Stubs ////////////////////////...
(s_mfg_mode_entered)
; } void test_getting_started_button_combo__push_complex_and_release_to_simple(void) { // Up (nothing) -> Up+Select (mfg mode) -> Select (show version) prv_press_button(BUTTON_ID_UP); prv_press_button(BUTTON_ID_SELECT); prv_release_button(BUTTON_ID_UP); // Now we're just holding down, which is a differen...
auctor, turpis at cras " "amet."; _Static_assert(sizeof(lipsum) > PERSIST_STRING_MAX_LENGTH, "lipsum string is not long enough for persist tests"); void test_persist__initialize(void) { fake_spi_flash_init(0, 0x1000000); pfs_init(false); persist_service_init(); persist_service_client_open(&...
persist_write_int(0, 0)
)); cl_assert_equal_i(persist_delete(0), S_TRUE); cl_assert_equal_i(persist_delete(0), E_DOES_NOT_EXIST); } /* * Confirm that fields can be reassigned values. */ void test_persist__overwrite(void) { const uint32_t key = 0; cl_assert_equal_i(persist_write_int(key, 1), sizeof(int)); cl_assert_equal_i(persist...
// Generate a stop condition bus->hal->i2c->CR2 |= I2C_CR2_STOP; } void i2c_hal_init_transfer(I2CBus *bus) { I2CTransfer *transfer = &bus->state->transfer; if (transfer->type == I2CTransferType_SendRegisterAddress) { transfer->state = I2CTransferState_WriteRegAddress; } else { if (transfer->direction...
{ prv_resume_transfer(bus, false /* !generate_start */); }
if ((i2c->ISR & I2C_ISR_TC) != 0) { return prv_end_transfer_irq(bus, I2CTransferEvent_TransferComplete); } break; case I2CTransferState_WriteData: if ((i2c->ISR & I2C_ISR_TXIS) != 0) { i2c->TXDR = transfer->data[transfer->idx++]; } if ((i2c->ISR & I2C_ISR_NACKF)...
// Top of the list (no-op) // TODO: maybe we want an animation? return; } else { // animate the cards' positions prv_schedule_slide_animation(health_card_view, next_card_index, slide_up); } } // Select click handler static void prv_select_click_handler(ClickRecognizerRef recognizer, void *conte...
{ app_window_stack_push(&health_card_view->window, true); }
void health_card_view_mark_dirty(HealthCardView *health_card_view) { layer_mark_dirty(health_card_view->card_layers[health_card_view->current_card_index]); }
tem *items_to_unload[WINDOW_STACK_ITEMS_MAX]; unsigned int num_items = 0; while (window_stack->removed_list_head) { if (num_items >= WINDOW_STACK_ITEMS_MAX) { break; } WindowStackItem *removed_item = (WindowStackItem *)window_stack->removed_list_head; items_to_unload[num_items++] = removed_ite...
(list_node_closest_to_head)
ack(ActionResultData *data) { return window_manager_get_window_stack(data->voice_data ? ModalPriorityVoice : ModalPriorityNotification); } static void prv_cleanup_voice_data(VoiceResponseData *data) { event_service_client_unsubscribe(&data->event_service_...
(data, succeeded)
_get_session(PebbleTask_Unknown); accel_session_shake_unsubscribe(session); } // ---------------------------------------------------------------------------------------------- void accel_double_tap_service_subscribe(AccelTapHandler handler) { AccelServiceState * session = accel_service_private_get_session(PebbleT...
(&state->accel_shake_info)
settings_menu_reload_data(SettingsMenuItemBluetooth); } ////////// static void prv_settings_bluetooth_event_handler(PebbleEvent *event, void *context) { SettingsBluetoothData* settings_data = (SettingsBluetoothData *) context; PBL_LOG_COLOR(LOG_LEVEL_DEBUG, LOG_COLOR_BLUE, "BT EVENT"); switch (event->type) {...
{ # if CAPABILITY_HAS_BUILTIN_HRM _Static_assert(false, "FIXME: Implement round drawing code to show heart rate sharing status!"); # endif // CAPABILITY_HAS_BUILTIN_HRM menu_cell_basic_draw(ctx, cell_layer, remote_name, connected_string, NULL); }
#endif // PBL_ROUND static void draw_stored_remote_item(GContext *ctx, const Layer *cell_layer, uint16_t device_index, SettingsBluetoothData *data) { const uint32_t num_remotes = list_count(data->remote_list_head); PBL_ASSERT(device_index < num_remotes, "Got index %" PRId16 " ...
ished yet. static bool prv_run_animation(AnimationState *state, AnimationPrivate *animation, const uint32_t now, bool do_update) { bool blocked_on_children_complete = false; // Play count of 0 should have never been scheduled. PBL_ASSERTN(animation->play_count != 0); // If this i...
PBL_ASSERTN(animation_p != NULL)
; // Make sure this is an animation in the scheduled list PBL_ASSERTN(list_contains(state->scheduled_head, &animation->list_node)); #endif const int32_t rel_ms_running = serial_distance32(animation->abs_start_time_ms, now); if (rel_ms_running < 0) { // Animations are ordered by abs_st...
18n/i18n.h" #include "services/common/light.h" #include "services/common/new_timer/new_timer.h" #include "services/normal/alarms/alarm.h" #include "util/time/time.h" #include <stdio.h> #include <string.h> #if !PLATFORM_TINTIN #include "services/normal/vibes/vibe_client.h" #include "services/normal/vibes/vibe_score.h"...
{ // Only vibe 10 seconds every minute in low_power_mode _Static_assert(TINTIN_VIBE_REPEAT_INTERVAL_MS == MS_PER_SECOND, "LPM Vibes timing incorrect"); if (s_alarm_popup_data->vibe_count % SECONDS_PER_MINUTE < TINTIN_LPM_VIBES_PER_MINUTE) { vibes_long_pulse(); ...
return true; } GDrawCommandList *gdraw_command_list_clone(GDrawCommandList *list) { if (!list) { return NULL; } size_t size = gdraw_command_list_get_data_size(list); GDrawCommandList *result = applib_malloc(size); if (result) { memcpy(result, list, size); } return result; } void gdraw_command...
gdraw_command_list_iterate(command_list, prv_draw_command, ctx)
; } else { const size_t max_size = prv_get_list_max_command_size(command_list); GDrawCommandDrawProcessedCBData data = { .ctx = ctx, .list = command_list, .processor = processor, // malloc because we clear the memory within each iteration of `prv_draw_command_processed` .process...
.identity; } if (name_out) { strncpy(name_out, name, BT_DEVICE_NAME_BUFFER_SIZE); name_out[BT_DEVICE_NAME_BUFFER_SIZE - 1] = 0; } return true; } bool bt_persistent_storage_get_ble_pairing_by_addr(const BTDeviceInternal *device, SMIdentityResolvingKey *I...
{ *address_out = addr; }
TextOverflowModeWordWrap, text_alignment, text_attributes).h; if (text_height <= single_line_text_height_px) { text_top_margin_px += text_single_line_text_offset_px; icon_top_margin_px += ic...
(&workout_dialog->confirm_icon, RESOURCE_ID_ACTION_BAR_ICON_CHECK)
; gbitmap_init_with_resource(&workout_dialog->decline_icon, RESOURCE_ID_ACTION_BAR_ICON_X); ActionBarLayer *action_bar = &workout_dialog->action_bar; action_bar_layer_init(action_bar); action_bar_layer_set_icon(action_bar, BUTTON_ID_UP, &workout_dialog->confirm_icon); action_bar_layer_set_icon(action_bar, BU...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_bt_lock, portMAX_DELAY, myLR)
; } void bt_unlock(void) { mutex_unlock_recursive(s_bt_lock); } void bt_lock_assert_held(bool is_held) { mutex_assert_recursive_held_by_curr_task(s_bt_lock, is_held); } bool bt_lock_is_held(void) { return mutex_is_owned_recursive(s_bt_lock); }
/* * 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 BTErrnoOK; }
sizeof(filename), "draw_arc_origin_aa_precise_%s_%s_.${BIT_DEPTH_NAME}.pbi", precision_modes[precision_mode], mode_names[mode]); cl_check_(gbitmap_pbi_eq(&ctx.dest_bitmap, filename), filename); center.y.integer -= DRAWING_SPACING; angle_end += TRIG_MAX_ANGLE / 4; } center.x.fr...
prv_calc_draw_config_ellipsis(TO_TRIG(270), TO_TRIG(360 + 90))
of the window stack it is in // Test: An opaque top window above a transparent top window removes Transparent // i.e. A transparent top window below an opaque top window does not result in Transparent modal_manager_event_loop_upkeep(); cl_assert_equal_i(modal_manager_get_properties(), ...
window_set_focusable(windows[2][1], false)
; case ANCSClientStateReassemblingNotification: return (new_state == ANCSClientStateRequestedApp || new_state == ANCSClientStateIdle); case ANCSClientStatePerformingAction: return (new_state == ANCSClientStateIdle); case ANCSClientStateRequestedApp: return (new_state == ANCSC...
{ prv_set_state(ANCSClientStateIdle); prv_reset_reassembly_context(); }
static void prv_reset_and_retry(void *unused) { if (s_ancs_client == NULL) { return; } prv_reset_reassembly_context(); prv_notif_queue_next(); } static void prv_reset_and_next(void) { prv_reset_and_idle(); prv_notif_queue_pop(); prv_notif_queue_next(); } static void prv_reset_and_flush(void) { ...
timeline_item_free_allocated_buffer(&parent_item)
; return snooze_delay; } bool reminders_can_snooze(Reminder *reminder) { return (prv_calculate_snooze_delay((TimelineItem *)reminder) > 0); } status_t reminders_snooze(Reminder *reminder) { uint32_t snooze_delay = prv_calculate_snooze_delay((TimelineItem *)reminder); if (snooze_delay == 0) { return E_INVA...
void prv_enable_gpio(MicDevice *this, GPIOPuPd_TypeDef data_pupd) { gpio_af_init(&this->ck_gpio, GPIO_OType_PP, GPIO_Medium_Speed, GPIO_PuPd_NOPULL); // During normal operation it is probably more power-efficient to let // the data pin float (no pull) as no current would be wasted pulling // ag...
(this->filter, ENABLE)
; DFSDM_StartSoftwareRegularConversion(this->filter); dma_request_start_circular(this->dma, this->state->in_buffer, (void *)&this->filter->RDATAR, sizeof(this->state->in_buffer), prv_dma_handler, (void *)this); } static void prv_dfsdm_disable(MicDevice *this) { // Disable DMA and DFS...
s_num_captured_activity_sessions = 0; // Run samples through the activity detector time_t now = rtc_get_time(); time_t test_start_utc = now; for (int i = 0; i < entry->num_samples; i++) { const bool shutting_down = (entry->force_shut_down_at == i); kalg_activities_update(s_kalg_state, n...
{ int delta = actual->value - expected->value; printf(" (%3d,%3d) %s%3d (%+4d) ", expected->min, expected->max, indicator, actual->value, delta); }
else { printf(" (NA, NA ) %s%3d ", indicator, actual->value); } } printf(" %-10.2f %-10s", results->weighted_err, status); weighted_sum += results->weighted_err; } // --------------------------------------------------------------------------------- // Overall Summary if (fai...
mutex_lock_recursive(s_music_ctx.mutex); s_music_ctx.playback_state = state->playback_state; s_music_ctx.playback_rate_percent = state->playback_rate_percent; s_music_ctx.track_pos_ms = state->elapsed_time_ms; s_music_ctx.track_pos_updated_at = rtc_get_ticks(); mutex_unlock_recursive(s_music_ctx.mutex); ...
prv_is_capability_supported(MusicServerCapabilityProgressReporting)
&& track_length_ms); } bool music_is_volume_reporting_supported(void) { return prv_is_capability_supported(MusicServerCapabilityVolumeReporting); } void command_print_now_playing(void) { char title[MUSIC_BUFFER_LENGTH]; char artist[MUSIC_BUFFER_LENGTH]; char album[MUSIC_BUFFER_LENGTH]; music_get_now_playi...
/* * 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...
(GPIOD, &gpio_init)
; GPIO_WriteBit(GPIOD, GPIO_Pin_2, Bit_SET); // Configure pins relating to the FMC peripheral (30 pins!) // B7 - FMC AVD - FMC Address Valid aka Latch // D0-D1, D8-D15, E2-15 - FMC A, AD - FMC Address and Address/Data lines // D2 - Reset - GPIO Reset line // D3 - FMC CLK // D4 - FMC OE - FMC Output Ena...
ile (bytes_written < size) { size_t bytes_to_write = MIN(free_bytes_in_page(file->curr_page) - pg_offset, size - bytes_written); prv_flash_write(buf + bytes_written, bytes_to_write, prv_page_to_flash_offset(file->curr_page) + AVAIL_BYTES_OFFSET + pg_offset); bytes_written += bytes_to_write...
(&hdr, i + start_page)
efs, const ANCSAttribute *app_id, const ANCSAttribute *display_name, const ANCSAttribute *title) { // When we receive a notification, information about the app that sent us the notification // is recorded in the notif_pref_...
(app_notif_prefs)
; } kernel_free(app_name_buff); attribute_list_destroy_list(&new_attr_list); } uint8_t ancs_filtering_get_mute_type(const iOSNotifPrefs *app_notif_prefs) { if (app_notif_prefs) { return attribute_get_uint8(&app_notif_prefs->attr_list, AttributeIdMuteDayOfWeek, ...
int_should_skip(codepoint) || codepoint_is_formatting_indicator(codepoint)) { if (!iter_next(char_iter)) { return false; } } while (codepoint_is_zero_width(utf8_iter_state->codepoint)) { if (utf8_iter_state->codepoint == 0) { PBL_ASSERTN(utf8_iter_state->current == utf8_iter_state->bounds->...
{ if (utf8_iter_state->current >= utf8_iter_state->bounds->end) { // EOS while searching for valid codepoint return false; } bool is_utf8_advanced = iter_next(utf8_iter); codepoint = utf8_iter_state->codepoint; if (!is_utf8_advanced) { return is_utf8_advanced; } PBL_ASSE...
/* * 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...
notif_db_get_len((uint8_t *)&hdr, UUID_SIZE)
false; } else if (samples != state->num_samples) { PBL_LOG(LOG_LEVEL_DEBUG, "Dropping %d accel samples", (int)(state->num_samples - samples)); success = false; } state->event_posted = false; state->num_samples = 0; // Fill it again from circular buffer prv_dispatch_data(); mutex_unlock_recursiv...
{ // The accel manager is responsible for handling locking mutex_lock_recursive(s_accel_manager_mutex); AccelOffloadCallback cb = data; cb(); mutex_unlock_recursive(s_accel_manager_mutex); }
last_activity = cur_time, .can_expire = can_expire, }; circular_cache_push(&s_recent_apps.cache, &app); } } mutex_unlock_recursive(s_recent_apps.mutex); } #if UNITTEST void app_install_manager_flush_recent_communication_timestamps(void) { circular_cache_flush(&s_recent_apps.cache); mems...
{ kernel_free(entry); return; }
} } // Iterate over AppDB applications 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(u...
+= month_days[rtc_date.RTC_Month - 1 ]; // RTC_Month is 1-12 if ((rtc_date.RTC_Year + 1) % 4 == 0 && rtc_date.RTC_Month > 2) { // On a leap year and past February so add a leap day. days++; } // Add in previous days of the current month days += rtc_date.RTC_Date - 1; return rtc_time.RTC_Seconds + 60...
RTC_SetTime(RTC_Format_BIN, &rtc_default_time)
; RTC_DateTypeDef rtc_default_date; RTC_DateStructInit(&rtc_default_date); RTC_SetDate(RTC_Format_BIN, &rtc_default_date); }
e_wait_ready_blocking(const SPIBus *bus) { while (!prv_spi_receive_is_ready(bus)) continue; } static void prv_configure_spi_sclk(const AfConfig *clk_pin, uint16_t spi_sclk_speed) { gpio_af_init(clk_pin, GPIO_OType_PP, spi_sclk_speed, GPIO_PuPd_NOPULL); } static void prv_spi_bus_deinit(const SPIBus *bus, bool is_b...
prv_spi_bus_deinit(slave->spi_bus, prv_is_bidrectional(slave))
dest_row_info.data; const int16_t dest_delta_begin_x = MAX(dest_row_info.min_x - dest_rect.origin.x, 0); const int16_t dest_begin_x = dest_delta_begin_x ? dest_row_info.min_x : dest_rect.origin.x; const int16_t dest_end_x = MIN(grect_get_max_x(&dest_rect), dest_row_info.max_x + 1); if (d...
{ if (!WITHIN(src_x, src_begin_x, src_end_x - 1)) { // Check if content should wrap (under and over) for tiling if (!WITHIN(src_x, src_bitmap->bounds.origin.x, grect_get_max_x(&src_bitmap->bounds) - 1)) { // keep correct bounds alignment for circul...
/* * 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 + pos, buffer_size - pos, start_hours, start_minutes, false)
cl_assert(list_count_to_head_from(&c) == 3); cl_assert(list_count_to_head_from(&b) == 2); cl_assert(list_count_to_head_from(&a) == 1); } typedef struct IntNode { ListNode list_node; int value; } IntNode; int sorting_comparator(IntNode* a, IntNode* b) { return b->value - a->value; } void test_list__sort_asc...
(list_concatenate(&a, &b), &a)
; cl_assert_equal_p(a.next, &b); cl_assert_equal_p(b.prev, &a); cl_assert_equal_p(list_concatenate(&b, &c), &a); cl_assert_equal_p(b.next, &c); cl_assert_equal_p(c.prev, &b); cl_assert_equal_p(list_concatenate(&e, &f), &e); cl_assert_equal_p(list_concatenate(&d, &f), &d); cl_assert_equal_p(list_conca...
/* * 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...
mfg_info_write_boot_fpga_bitstream()
; } }
cl_assert(session->start_utc >= container_session->start_utc); cl_assert(session->start_utc < container_session->start_utc + container_session->len_m * SECONDS_PER_MINUTE); last_deep_session_len_m = session->len_m; // Accumulate restful sleep stats results->d...
kalg_state_size()
rite_end(&s_expected_iter); } void test_app_message__cleanup(void) { app_message_close(); cl_assert_equal_b(app_message_is_closed_inbound(), true); cl_assert_equal_b(app_message_is_closed_outbound(), true); fake_app_timer_deinit(); kernel_free(s_sent_data); s_sent_data = NULL; } // Test OUTBOUND (watch->p...
cl_assert_equal_i(s_out_sent_call_count, 0)
; cl_assert_equal_i(s_out_failed_call_count, 1); cl_assert_equal_i(s_failure_result, APP_MSG_SEND_REJECTED); // Check the state is reset properly cl_assert_equal_b(app_message_is_accepting_outbound(), true); } void test_app_message__nack_then_outbox_sent(void) { // Sending ack on timeout, but reject the sen...
const time_t now = rtc_get_time(); struct tm local_tm; localtime_r(&now, &local_tm); // Get the current steps health_service_private_get_metric_history(HealthMetricStepCount, 1, health_data->step_data); // Get the typical step averages for every 15 minutes activity_get_step_averages(local_tm.tm_wday, &he...
activity_prefs_heart_get_resting_hr()
; // Check the quality. If it doesn't meet our standards, bail int32_t quality; activity_get_metric(ActivityMetricHeartRateRawQuality, 1, &quality); if (quality < HRMQuality_Acceptable) { return; } uint32_t current_hr_timestamp; activity_get_metric(ActivityMetricHeartRateRawUpdatedTimeUTC, 1, ...
e BUFFER_SIZE 25 static const uint8_t s_music_launcher_icon_pixels[] = { 0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0x01, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, /* bytes 0 - 16 */ 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x18, 0x00, 0x7f, 0x00, 0x1f, 0x00, /* bytes 16 - 32 */ 0x7f, 0xf...
app_window_stack_push(detail_window, animated)
; } static void select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, AppData *data) { push_detail_window(data, cell_index, false); (void)menu_layer; } static void select_long_callback(MenuLayer *menu_layer, MenuIndex *cell_index, AppData *data) { push_detail_window(data, cell_index, true); (void)menu...
ECT_CLIP_NXNY, true, 11); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__offset_sw(void) { GContext ctx; test_gr...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw5_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 5); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NX...
ULL); } void draw_text_single_line_wordwrap_clip_outside_ny(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, -40, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_text_singl...
(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_outside_y.${BIT_DEPTH_NAME}.pbi")
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_outside_nx); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_outside_nx.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb...
4, -888}, { -104, -552, -984}, { -128, -440, -984}, { -144, -384, -904}, { -176, -464, -968}, { -224, -328, -960}, { -184, -408, -920}, { -208, -368, -976}, { -176, -320, -944}, { 632, -400, -1160}, { -336, -384, -960}, { -256, -368, -1016}, // 298 seconds { -224, -32...
{ 24, 576, -72}, { -896, 632, -784}, { -344, -8, -848}, { -232, 96, -1064}, { 96, 288, -792}, { -280, 456, -688}, { 168, 752, -800}, { -136, 888, -1192}, { 0, 904, -1448}, // 303 seconds { 112, 808, -1400}, { -288, 656, -1168}, { -448, 800, -696}, { -304, 696, -27...
{ -344, 760, -56}, { -328, 752, -136}, { -296, 800, -128}, { -232, 760, -64}, { -312, 784, 80}, { -312, 928, 280}, { -384, 864, 432}, { -440, 976, 488}, { -392, 1048, 360}, { -392, 864, 344}, { -304, 896, 304}, { -352, 840, 264}, { -320, 760, 144}, { -320, 720, 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...
malloc(sizeof(FrameBuffer))
accessible; } out; } TestInputOutput; const TestInputOutput tests[] = { { .desc = "Valid time range with ScopeDaily and Sum. Should be NotSupported", .in = { HealthMetricHeartRateBPM, now - 10, now, HealthAggregationSum, HealthServiceTimeScopeDaily }, .out = { HealthServi...
(true, fun(&session, HealthActivityMaskAll, now - (10 * SECONDS_PER_MINUTE), now))
; // too large time range matches cl_assert_equal_b(true, fun(&session, HealthActivityMaskAll, now - (20 * SECONDS_PER_MINUTE), now + (10 * SECONDS_PER_MINUTE))); // range before doesn't match, even if it touches cl_assert_equal_b(false, fun(&session, HealthActivityMaskAll, now -...
p icon_volume_down; GBitmap image_cassette; GBitmap image_pause; GBitmap image_volume_up; GBitmap image_volume_down; Layer cassette_container; BitmapLayer cassette_layer; GBitmap *cassette_current_icon; EventServiceInfo event_info; ProgressLayer track_pos_bar; uint32_t track_length; uint32_t tr...
prv_title_rect()
), prv_create_layer_bounceback_animation(&data->position_text_layer.layer, time_rect), prv_create_layer_bounceback_animation(&data->length_text_layer.layer, time_rect), NULL); } static void prv_update_track_progress(MusicAppData *data); static void prv_flip_animated_text(Animation *animation, bool f...
_data) { TextDynamicContext *text_context = user_data; text_context->config.update(text_context->layout, &text_context->config, buffer, render); } static GTextNodeTextDynamic *prv_create_text_dynamic_node_from_config( const LayoutLayer *layout, const LayoutNodeTextDynamicConfig *config) { PBL_ASSERTN(config)...
{ GTextNode *node = &timeline_layout_create_icon_node((const TimelineLayout *)layout)->node; prv_set_text_node_extent(node, config); return node; }
/* * 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 app_state_get_click_manager(); }
return modal_manager_get_click_manager(); }
----------------------------------- BTErrno gap_le_connect_cancel_by_bonding(BTBondingID bonding_id, GAPLEClient client) { if (bonding_id == BT_BONDING_ID_INVALID || client >= GAPLEClientNum) { return BTErrnoInvalidParameter; } bt_lock(); // Find the intent for the device: GAPLEConnectionIntent *intent =...
if (intent) { if (!intent->client[c].is_used) { // Not all specified clients own the intent ret_value = false; } } else { // Intent not found ret_value = false; }
bt_unlock(); return ret_value; } uint32_t gap_le_connect_connection_intents_count(void) { bt_lock(); const uint32_t count = prv_intents_count(); bt_unlock(); return count; }
License for the specific language governing permissions and * limitations under the License. */ #include "launcher_app_glance_notifications.h" #include "launcher_app_glance_structured.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "process_management/app_install_manager.h" #include "services...
{ string_to_use_in_glance_subtitle = title; }
else if (!IS_EMPTY_STRING(subtitle)) { // Fallback to the subtitle string_to_use_in_glance_subtitle = subtitle; } else { // Fallback to the body string_to_use_in_glance_subtitle = body; } // Copy the string to the glance const size_t glance_subtitle_size = sizeof(notifications_glance->subtitle...
/* * 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 (digit < 0x10) { c = 'a' + (digit - 0xa); } else { c = ' '; }
*buffer++ = c; } *buffer = '\0'; }
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed u...
(command->points, points2, sizeof(points2))
; frame = (GDrawCommandFrame *)(command->points + command->num_points); *frame = (GDrawCommandFrame) { .duration = 30, }; frame->command_list = (GDrawCommandList) { .num_commands = 1 }; command = gdraw_command_list_get_command(&frame->command_list, 0); points2[0].x++; // increment x value to dist...
/* * 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_get_8bit_x_from_1bit_x(dest_x)
); dest_x = 0; dest_y = 50; block_addr = (uint32_t *)(uintptr_t)(((dest_y * row_1bit_size_words) + (dest_x / 32)) * 4); cl_assert_equal_i(prv_convert_1bit_addr_to_8bit_x(bitmap, block_addr, dest_y), prv_get_8bit_x_from_1bit_x(dest_x)); dest_x = 20; dest_y = 100; block_addr = (uint32_...
/* * 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...
(timer_data->callback)
) { char *source_buf = rocky_string_alloc_and_copy(timer_data->callback); rocky_util_eval_and_log_uncaught_error((const jerry_char_t *)source_buf, strlen(source_buf)); task_free(source_buf); } if (!timer_data->is_repeating) { prv_timer_cleanup(timer_data); } } static jerry_value_t prv_create_tim...
al_console_get_state() == SERIAL_CONSOLE_STATE_PULSE) { pulse_send_message(PROMPT_RESP_MESSAGE, response); } else { dbgserial_putstr(response); } } static void prv_dbgserial_command_complete_callback(void) { SerialConsoleState state = serial_console_get_state(); if (state == SERIAL_CONSOLE_STATE_PULSE)...
{ ((CommandFuncNoParam) cmd->func)(); }
done: if (!s_command_continues_after_return && s_current_context) { prompt_command_finish(); } } static void prv_find_and_execute_command(char* cmd, size_t cmd_len, PromptContext *context) { if (!cmd_len) { // Empty command. s_executing_command = ExecutingCommandNone; return; } s_current_c...
rd it as // a "single click" after the multi-click timeout passed and this callback is called: if (recognizer->number_of_clicks_counted >= 1 && recognizer->is_repeating == false) { int clicks_over = recognizer->number_of_clicks_counted; for(int i = 0; i < clicks_over; i++) { prv_dispatch_event(recogni...
{ const bool needs_reset = true; prv_dispatch_event(recognizer, ClickHandlerOffsetLongRelease, needs_reset); return; }
prv_cancel_timer(&recognizer->hold_timer); if (local_is_multi_click_enabled && false == recognizer->is_repeating) { const bool local_can_more_clicks_follow = prv_can_more_clicks_follow(recognizer); bool should_fire_multi_click_handler = ((recognizer->config.multi_click.last_click_only && local_can_more_c...
tion_set_custom_interpolation(curr_rel_bar_anim, interpolate); } return curr_rel_bar_anim; } #define REL_BAR_LINE_CHECK_LENGTH 6 #define REL_BAR_LINE_WIDTH 2 #define REL_BAR_LINE_HORIZ_OFFSET ((SIDEBAR_WIDTH / 2) + (REL_BAR_LINE_WIDTH / 2)) #define REL_BAR_LINE_NOTCH_HORIZ_OFFSET ((REL_BAR_LINE_CHECK_LENGTH / 2) ...
if (!current) { curr_offset = 0; } else { curr_offset = (-timeline_layer->move_delta) * (REL_BAR_BACK_TO_BACK_OFFSET - curr_offset); prev_offset = 0; }
GRect first_icon_frame; GRect second_icon_frame; const int line_length = prv_get_line_length(timeline_layer, &first_icon_frame, &second_icon_frame) / 3; const int dot_padding = 1; const int solid_line_length = line_length - dot_padding; const int dot_line_length = line_length + dot_padding; // Ba...
ted(&ctx, GPoint(0, 16), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20), 143); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 22), 145); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_l...
(&ctx, GPoint(0, 14), 20)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20), MAX_NUM_COLS - 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 22), MAX_NUM_COLS + 1); cl_check(gbitmap_pbi_eq(&ct...
/* * 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 (state->is_changing) { return; }
// Always call the will handler even if the app restarts or starts out of sync with // the animation and has had its app state reinitialized. Set `is_changing` to keep track. state->is_changing = true; if (state->handlers.will_change) { GRect final_area; prv_origin_y_to_area(event->unobstructed_area.fi...
status_bar_layer_set_colors(&data->status_layer, status_color, gcolor_legible_over(status_color)); } static void prv_show_incoming_call(void *data) { PebblePhoneCaller caller = { .number = "+55 408-555-1212", .name = "Pankajavalli Balamurugan", }; phone_ui_handle_incoming_ca...
(timestamp, 0, notif.type, notif.layout_id, &attr_list, NULL)