prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(last != ANALYTICS_METRIC_INVALID)
uint8_t value) { return i2c_write_register_block(device_id, i2c_device_address, register_address, 1, &value); } bool i2c_write_register_block(I2cDevice device_id, uint8_t i2c_device_address, uint8_t register_address_start, uint8_t write_size, const uint8_t* buffer) { #...
if (bus->transfer.idx + 1 == bus->transfer.size) { // Last byte, we want to NACK this one to tell the slave to stop sending us bytes. bus->i2c->CR1 &= ~I2C_CR1_ACK; } else if (bus->transfer.idx == bus->transfer.size) { // End transfer after all bytes have been received bus->i...
break; case TRANSFER_STATE_WRITE_DATA: bus->i2c->DR = bus->transfer.data[bus->transfer.idx]; bus->transfer.idx++; if (bus->transfer.idx == bus->transfer.size) { bus->i2c->CR2 &= ~I2C_CR2_ITBUFEN; bus->transfer.state = TRANSFER_STATE_END_WRITE; break; } ...
, 0xd6, 0x44, 0x2c, 0x98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05}, .app_version = { .major = 1, .minor = 1, }, .sdk_version = { .major = 1, .minor = 1, }, .info_flags = 0, .icon_resource_id = 0, }; // Setup //////////////////////////////////////////////////////////////// void...
(true, uuid_equal(&app1.uuid, &temp.uuid))
; // check app_db_get_install_id_for_uuid for app 2 memset(&temp, 0, sizeof(AppDBEntry)); cl_assert_equal_i(S_SUCCESS, app_db_get_app_entry_for_uuid(&app2.uuid, &temp)); cl_assert_equal_b(true, uuid_equal(&app2.uuid, &temp.uuid)); // check app_db_get_install_id_for_uuid for app 3 memset(&temp, 0, sizeof(A...
------------------------------------------------------------------------------ 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 th...
{ bt_lock(); bool ret_value = true; const GAPLEConnectionIntent *intent = prv_get_intent_by_bonding_id(bonding_id); 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; } ...
uint32_t gap_le_connect_connection_intents_count(void) { bt_lock(); const uint32_t count = prv_intents_count(); bt_unlock(); return count; }
et_system_font(FONT_KEY_BITHAM_42_BOLD), *layer_bounds, GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, text_attributes); graphics_text_attributes_destroy(text_attributes); } void prv_fill_mask_shape(GContext *ctx, const GRect *layer_bounds, const GSize *shape_size, ...
window_init(window, WINDOW_NAME("GDrawMask Demo"))
; window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers){ .load = prv_window_load, }); const bool animated = true; app_window_stack_push(window, animated); app_light_enable(true); } static void handle_deinit(void) { app_light_enable(false); } static void s_main(voi...
nsact_after_consuming_rx; uint8_t *rx_write_ptr; const uint8_t *tx_read_ptr; CircularBuffer rx; CircularBuffer tx; SemaphoreHandle_t semph; TaskHandle_t task; volatile bool task_should_deinit; volatile bool task_is_running; SPITransportMsgStatus *status_local; SPITransportMsgStatus status_remote; ...
(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, TIM_IT_Update)
; } static void prv_give_semamphore_from_isr(bool *should_context_switch) { portBASE_TYPE was_higher_task_woken = pdFALSE; xSemaphoreGiveFromISR(s_spi_transport.semph, &was_higher_task_woken); *should_context_switch = (was_higher_task_woken != pdFALSE); } static void prv_handle_sending_footer_complete_isr(bool ...
izeof(file_name), "file%d", i); cl_assert(pfs_remove(file_name) == S_SUCCESS); } cl_assert(pfs_active_in_region(0, pfs_get_size())); // continuation page on region and make sure pfs is active pfs_format(true); int fd = pfs_open("testfile", OP_FLAG_WRITE, FILE_TYPE_STATIC, 68000); cl_assert(fd >= 0); ...
cl_assert(memcmp(rbuf, buf, len) == 0)
; cl_assert(fd >= 0); cl_assert(pfs_close(fd) == S_SUCCESS); } } static uint32_t s_watch_file_callback_called_count = 0; static void prv_file_changed_callback(void *data) { s_watch_file_callback_called_count++; } void test_pfs__watch_file_callbacks(void) { const char* file_name = "newfile"; PFSCallba...
r the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #inc...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_origin_layer_non_aa.${BIT_DEPTH_NAME}.pbi"))
t in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND...
{ APP_LOG(APP_LOG_LEVEL_ERROR, "Out of memory!"); return; }
// Zero out: memset(result, 0, sizeof(ScanResult)); } // Update all the fields into the result: result->device = device; result->rssi = rssi; // Try getting TX Power Level: int8_t tx_power_level; if (ble_ad_get_tx_power_level(ad_data, &tx_power_level)) { APP_LOG(APP_LOG_LEVEL_INFO, "TX Powe...
ES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "services/common/bluetooth/ble_root_keys.h" #include "clar.h" #include <string.h> /// Stubs #include "stubs_hexdump.h" #include "stubs_loggin...
{ // Pretend one of the root keys isn't there: cl_will_return_count(bt_persistent_storage_get_root_key, true, 1); cl_will_return_count(bt_persistent_storage_get_root_key, false, 1); cl_will_return_count(rng_rand, false, RNG_MAX_RETRIES); cl_will_return_count(rand, 0x55, sizeof(SM128BitKey)); cl_will_return...
ntext *context); // Static State /////////////////// static ModalContext s_modal_window_stacks[NumModalPriorities]; static ClickManager s_modal_window_click_manager; static ModalPriority s_modal_min_priority = ModalPriorityMin; // Used to help us keep track various modal properties in aggregate, such as existence. ...
for (ModalPriority priority = MAX(low, ModalPriorityDiscreet + 1); priority <= high; priority++) { ModalContext *m_context = &s_modal_window_stacks[priority]; window_stack_pop_all(&m_context->window_stack, true /* animated */); }
} void modal_manager_pop_all(void) { prv_pop_stacks_in_range(ModalPriorityMin, NumModalPriorities - 1); } void modal_manager_pop_all_below_priority(ModalPriority priority) { prv_pop_stacks_in_range(ModalPriorityMin, priority - 1); } static const CompositorTransition *prv_get_compositor_transition(bool modal_is_...
aphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 11), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 13), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 15), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 17), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 19), 22); ...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 15), 20)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 17), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 19), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 21), MAX_NUM_COLS - 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 23), MAX_NUM_COLS + 1); cl_check(gbitmap_pbi_eq(&ctx...
atabaseChanged); // Put one, expect one: prv_simulate_and_assert_discovery_of_one_service(&device); } extern void gatt_client_discovery_discover_range(GAPLEConnection *connection, ATTHandleRange *hdl_range); void test_gatt_client_discovery__multiple_jobs_pending(v...
(2, fake_gatt_is_service_discovery_start_count())
se { // This is a very unlikely case. We store some default prefs which includes the mute // attribute when we receive the notification so either someone deleted the entry // in the DB or the mute attribute (neither of which should happen) PBL_LOG(LOG_LEVEL_WARNING, "Could not mute notification. No pref...
timeline_actions_add_action_to_root_level(dismiss_action, root_level)
; } if (has_snooze_action) { action_menu_level_add_action(root_level, i18n_get("Snooze", root_level), prv_snooze_reminder_cb, window_data); } for (int i = 0; i < item->action_group.num_actions; i++) { Time...
gth; system_task_add_callback(prv_domain_read_cb, (void*)(uintptr_t)cmd->fd); } static void prv_handle_write(Command *cmd, size_t length) { PulseTransferFD *pulse_fd = prv_get_fd(cmd, length); if (!pulse_fd) { // prv_get_fd has already sent an error response return; } size_t payload_length = length...
prv_handle_open(cmd, length)
; break; case BULKIO_CMD_DOMAIN_CLOSE: prv_handle_close(cmd, length); break; case BULKIO_CMD_DOMAIN_READ: prv_handle_read(cmd, length); break; case BULKIO_CMD_DOMAIN_WRITE: prv_handle_write(cmd, length); break; case BULKIO_CMD_DOMAIN_CRC: ...
s_characteristics[0][PPoGATTCharacteristicData]); prv_receive_reset_request(s_characteristics[0][PPoGATTCharacteristicData]); fake_gatt_client_op_assert_no_write(); } void test_ppogatt__ignore_server_reset_request_while_resetting_due_to_own_reset_request(void) { prv_notify_services_discovered(1); ppogatt_han...
cl_assert_equal_i(ppogatt_client_count(), 1)
; cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid), true); cl_assert_equal_i(fake_comm_session_close_call_count(), 0); } void test_ppogatt__ignore_data_during_reset(void) { prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristi...
0x5c, /* bytes 48 - 64 */ 0x00, 0x84, 0x00, 0x5c, 0x00, 0x94, 0x00, }; __attribute__ ((aligned (8))) static const uint8_t CHECK_INTERNET_CONNECTION_LARGE_builtin_bytes[] = { 0x50, 0x44, 0x43, 0x49, 0xe7, 0x00, 0x00, 0x00, 0x01, 0x00, 0x50, 0x00, 0x50, 0x00, 0x0b, 0x00, /* bytes 0 - 16 */ 0x03, 0x00, 0xc0, 0x04,...
aligned (8)
)) static const uint8_t ARROW_DOWN_builtin_bytes[] = { 0x03, 0x00, 0x06, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x15, 0x55, 0x54, 0x85, /* bytes 0 - 16 */ 0x55, 0x52, 0xa1, 0x55, 0x4a, 0xa8, 0x55, 0x2a, 0xaa, 0x14, 0xaa, 0xaa, 0x82, 0xaa, 0x80, 0xc0, /* bytes 16 - 32 */ 0x00, 0x00, }; __attribute_...
#include "ancs_filtering.h" #include "drivers/rtc.h" #include "kernel/pbl_malloc.h" #include "services/normal/notifications/alerts_preferences.h" #include "services/normal/timeline/attributes_actions.h" #include "system/logging.h" #include "util/pstring.h" void ancs_filtering_record_app(iOSNotifPrefs **notif_prefs,...
(sizeof(iOSNotifPrefs) + buf_size)
ueueReceive(s_pulse_task_queue, &c, 0) == pdTRUE) { if (UNLIKELY(c == FRAME_DELIMITER)) { size_t decoded_length = cobs_streaming_decode_finish(&frame_decode_ctx); prv_process_received_frame(decoded_length); cobs_streaming_decode_start(&frame_decode_ctx, s_current_rx_frame, ...
COBS_OVERHEAD(FRAME_MAX_SEND_SIZE)
, &header, sizeof(header)); return s_tx_buffer + COBS_OVERHEAD(FRAME_MAX_SEND_SIZE) + sizeof(header); } void pulse_link_send(void *buf, const size_t payload_length) { prv_assert_tx_buffer(buf); PBL_ASSERT(payload_length <= FRAME_MAX_SEND_SIZE, "PULSE frame payload too long"); // Rewind the pointer to...
//////////////////////////////////////////////// void test_health_db__initialize(void) { fake_settings_file_reset(); health_db_init(); s_metric_updated_count = 0; } void test_health_db__cleanup(void) { } // Dummy Data //////////////////////////////////////////////////////////////// #define NUM_CURRENT_MOVEME...
(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_sleep_data, sizeof(s_sleep_data)), S_SUCCESS)
; // check cl_assert(health_db_get_typical_value(ActivityMetricSleepTotalSeconds, Monday, &val_out)); cl_assert_equal_i(val_out, s_sleep_data[SD_TypicalSleepDuration]); // flush cl_assert_equal_i(health_db_flush(), S_SUCCESS); // check cl_assert(!health_db_get_typical_value(ActivityMetricSleepTotalSeco...
leep: case ActivitySessionType_Nap: params = &class_settings[ActivityClass_Sleep]; break; case ActivitySessionType_RestfulSleep: case ActivitySessionType_RestfulNap: params = &class_settings[ActivityClass_RestfulSleep]; break; case ActivitySessionType_Walk: ...
settings_file_set(file, &key, sizeof(key), state->activity_sessions, sizeof(state->activity_sessions))
stall_id == two->install_id); bool type = (one->type == two->type); bool visibility = (one->visibility == two->visibility); bool process_type = (one->process_type == two->process_type); bool uuid = !memcmp(&one->uuid, &two->uuid, sizeof(Uuid)); bool name = !strcmp(one->name,two->name); bool icon = (one->ico...
app_storage_get_file_name(filename_buf, sizeof(filename_buf), 2, PebbleTask_App)
; load_fixture_on_pfs(APP2_APP_FIXTURE_NAME, filename_buf); resource_storage_get_file_name(filename_buf, sizeof(filename_buf), 2); load_fixture_on_pfs(APP2_RESOURCES_FIXTURE_NAME, filename_buf); } void test_app_install_manager__cleanup(void) { } /************************************* ************************...
/* * 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_INFO, "Pausing address cycling (pinned_addr="BT_DEVICE_ADDRESS_FMT")", BT_DEVICE_ADDRESS_XPLODE(s_pinned_addr))
oid); void test_app_glance_db__cleanup(void) { app_glance_db_deinit(); } // Blob Tests //////////////////////////////////////////////////////////////// void test_app_glance_db__blob_insertion_with_invalid_key_or_val_length_fails(void) { // Invalid key length should fail const size_t invalid_key_length = 1337; ...
app_glance_db_delete((uint8_t *)&APP_GLANCE_TEST_UUID, invalid_key_length)
, E_INVALID_ARGUMENT); } void test_app_glance_db__glance_blob_with_older_creation_time_than_existing_not_inserted(void) { // Insert the first glance blob SerializedAppGlanceHeader app_glance_1 = (SerializedAppGlanceHeader) { .version = APP_GLANCE_DB_CURRENT_VERSION, .creation_time = 146...
offsetof(SharedPRFData, ble_data)); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! BT Classic Pairing Data bool shared_prf_storage_get_bt_classic_pairing_data(BTDeviceAddress *addr_out, char *device_...
prv_fetch_struct(&data)
; const bool is_complete = data.getting_started_is_complete; prv_cleanup_struct(&data); return is_complete; } void shared_prf_storage_set_getting_started_complete(bool is_complete) { prv_update_and_cleanup_struct_async(&is_complete, sizeof(is_complete), ...
g_rect, cell_index->row, is_selected, option_menu->context); } } static void prv_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *context) { OptionMenu *option_menu = context; option_menu->choice = cell_index->row; layer_mark_dirty((Layer *)&option_menu->...
{ option_menu_set_title(option_menu, config->title); option_menu_set_choice(option_menu, config->choice); option_menu_set_content_type(option_menu, config->content_type); option_menu_set_status_colors(option_menu, config->status_colors.background, config->status_colors.foreground...
void option_menu_init(OptionMenu *option_menu) { *option_menu = (OptionMenu) { .choice = OPTION_MENU_CHOICE_NONE, .title_font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle), }; // radio button icons are enabled by default option_menu_set_icons_enabled(option_menu, true); GBi...
curr_pg = 0; for (; curr_pg < s_pfs_page_count; curr_pg++) { uint8_t page_flags = prv_get_page_flags(curr_pg); if (IS_PAGE_TYPE(page_flags, PAGE_FLAG_START_PAGE)) { if (!is_create_complete(curr_pg)) { // make sure file creation completed PBL_LOG(LOG_LEVEL_WARNING, "File at %d creation did not ...
list_find(s_head_callback_node_list, watch_list_find_str, (char *)callback_node->name)
; if (find_str == NULL) { kernel_free((void *)(callback_node->name)); } kernel_free(callback_node); mutex_unlock_recursive(s_pfs_mutex); } // IMPORTANT: This call assumes that the caller has already grabbed s_pfs_mutex static void prv_invoke_watch_file_callbacks(const char* file_name, uint8_t event) { ...
app_event = (PebbleEvent) {0}; // Now the app sets the safe_to_kill flag to true and sends a kill event back to // the launcher to get the app killed again. This calls close_current_app, which ends // up launching s_third_party_app because it's in the next app slot. app_manager_get_task_context()->safe_to_kill...
cl_assert_equal_i(app_exit_reason_get(), default_exit_reason)
; // Specify the exit reason to be that an action was performed successfully app_exit_reason_set(APP_EXIT_ACTION_PERFORMED_SUCCESSFULLY); // Check that closing the current app takes us to the watchface app_manager_get_task_context()->safe_to_kill = true; app_manager_close_current_app(true /* gracefully */);...
tmap, 1 * 1000); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(3))); // Frame 3 has delay 1000 ms, frame 4 and 5 have zero delay, so at time 2000 ms == frame 5 gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 2 * 1000); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5))); // Since loop only e...
gbitmap_set_bounds(bitmap, shift_bounds); gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); gbitmap_set_bounds(bitmap, orig_bounds); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5))); #endif }
// Tests APNG file with 8-bit color, originally broke the updated upng+tinflate code // Result: // - gbitmaps matches platform decoded APNG void test_gbitmap_sequence__color_8bit_yoshi(void) { #if PLATFORM_SPALDING bool status = false; uint32_t resource_id = sys_resource_load_file_as_resource(TEST_IMAGES_PATH, ...
count_handler_entries(&s_setup_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_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), 2); cl_assert_equal_i(prv_...
fake_rtc_auto_increment_ticks(3)
; Animation *a0, *a1, *a2, *a3; Animation *b0, *b1, *b2, *b3; Animation *spawn_a, *spawn_b; for (int i=0; i<4; i++) { switch(create_order[i]) { case 0: a0 = prv_create_test_animation(); animation_set_duration(a0, duration_a); a1 = animation_clone(a0); a2 = animation_c...
/* * 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...
is_app_file_name("@1234567/abc")
/* * 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...
connection_get_idx(conn)
; ble_error_t e = ble_gattc_browse(conn_idx, NULL, req->range.start, req->range.end); if (e != BLE_STATUS_OK) { status = HciStatusCode_VS_Base + e; PBL_LOG(LOG_LEVEL_DEBUG, "ble_gattc_browse: %u", e); goto failure; } return; failure: // Notify Host that discovery terminated unexpectedly hc_endpo...
}, { .input = jerry_create_number(1.234e+60), .expected_output = "1.234e+60", }, { .input = jerry_create_string((const jerry_char_t *)""), .expected_output = "", }, { .input = jerry_create_string((const jerry_char_t *)"js"), .expected_output = "js", }, ...
jerry_create_number(0)
, [2] = jerry_create_number(0), [3] = jerry_create_string((const jerry_char_t *)"123"), }, .argc = 4, .error_msg = "TypeError: Argument at index 3 is not a Number", }, }; for (int i = 0; i < ARRAY_LENGTH(cases); ++i) { jerry_value_t *argv = cases[i].argv; jerry_length_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(recognizer)
) { case BUTTON_ID_UP: animation_set_curve(animation, AnimationCurveEaseOut); break; case BUTTON_ID_DOWN: // animation_set_curve(animation, AnimationCurveEaseIn); // animation_set_duration(animation, 2000); animation_set_custom_curve(animation, animation_bounce); break; ...
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 * (framebuffer->row_size_bytes / 4)) + (x / 32); bool both_edges_in_same_block = (left_edge_bits_count + widt...
gbitmap_get_data_row_info(framebuffer, y1.integer)
; GColor8 *output = (GColor8 *)(data_row_info.data + x); // first pixel with blending const unsigned int data_row_offset = data_row_info.data - (uint8_t *)framebuffer->addr; if (y1.fraction != 0) { // Only draw the pixel if its within the bitmap data row range if (WITHIN(x, data_row_info.min_x, data_ro...
e *max_size) { prv_clip_width(size, max_size); prv_clip_height(size, max_size); } static void prv_draw_text_node_text(GTextNodeDrawContext *ctx) { GTextNodeText *text_node = (GTextNodeText *)ctx->node; prv_clip_size(&ctx->box.size, &text_node->max_size); TextLayoutExtended layout = { .line_spacing_delta ...
ToGValue(&child_node->cached_size)
ransfer_data tx_footer_transfer = { .wbuf = &tx_footer, .length = sizeof(tx_footer), }; prv_do_blocking_spi_transfer(dev, &tx_footer_transfer); HOST_TRANSPORT_DEBUG_LOG("Sent %u bytes.", tx_len); } else { HOST_TRANSPORT_DEBUG_LOG("Nothing to send."); } // Single duplex read: const...
if (success) { prv_disable_spi_cs_wakeup_interrupt_handling_and_unblock_transaction_loop(); return HostTransportEnqueueStatus_Success; }
PBL_LOG(LOG_LEVEL_DEBUG, "Failed to enqueue %u bytes", length); return HostTransportEnqueueStatus_RetryLater; } size_t host_transport_rx_get_length(void) { prv_lock(); size_t rx_length = circular_buffer_get_read_space_remaining(&s_rx_buffer); prv_unlock(); return rx_length; } bool host_transport_rx_read...
/* * 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...
uart_init_tx_only(BT_TX_BOOTROM_UART)
; uart_set_baud_rate(BT_RX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE); uart_set_baud_rate(BT_TX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE); } else { uart_init(BT_RX_BOOTROM_UART); uart_set_baud_rate(BT_RX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE); } periph_config_release_lock(); } static voi...
/* * 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, 1024 KiB, NULL, NULL))
; cl_assert_equal_i(BITS_BETWEEN(0, 11), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_sector_0(void) { cl_assert(system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_16K...
---- // Close the settings file and free the file struct void activity_private_settings_close(SettingsFile *file) { settings_file_close(file); kernel_free(file); } // ---------------------------------------------------------------------------------------------- // Rewrite the settings file. Used when migrating fr...
activity_metrics_prv_get_metric_info(metric, &m_info)
; if (m_info.has_history) { ActivitySettingsValueHistory history; settings_file_get(file, &m_info.settings_key, sizeof(m_info.settings_key), &history, sizeof(history)); history.values[0] = *m_info.value_p; settings_file_set(file, &m_info.setti...
FMC_DataAddressMux = FMC_DataAddressMux_Enable, .FMC_MemoryType = FMC_MemoryType_NOR, .FMC_MemoryDataWidth = FMC_NORSRAM_MemoryDataWidth_16b, .FMC_BurstAccessMode = FMC_BurstAccessMode_Disable, .FMC_AsynchronousWait = FMC_AsynchronousWait_Disable, .FMC_WaitSignalPolarity = FMC_WaitSignalPolarity_Low...
if ((status & S29VSStatusBit_DeviceReady) == 0 || (status & (S29VSStatusBit_EraseSuspended | S29VSStatusBit_ProgramSuspended)) != 0) { ret = E_BUSY; goto done; }
prv_issue_command(base_addr, S29VSCommand_SectorBlank); status = prv_poll_for_ready(base_addr); ret = ((status & S29VSStatusBit_EraseStatus) == 0)? S_TRUE : S_FALSE; done: flash_impl_release(); return ret; } status_t flash_impl_blank_check_subsector(FlashAddress addr) { return flash_impl_blank_check_secto...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
for (int i = 0; i < a.num_attributes; i++) { cl_assert_equal_i(a.attributes[i].id, b.attributes[i].id); switch (a.attributes[i].id) { case AttributeIdTitle: case AttributeIdSubtitle: case AttributeIdBody: cl_assert_equal_s(a.attributes[i].cstring, b.attributes[i].cstring); brea...
} static void compare_notifications(TimelineItem *a, TimelineItem *b) { cl_assert(uuid_equal(&a->header.id, &b->header.id)); cl_assert_equal_i(a->header.ancs_uid, b->header.ancs_uid); cl_assert_equal_i(a->header.status, b->header.status); cl_assert_equal_i(a->header.timestamp, b->header.timestamp); cl_asser...
llback(data); } void app_idle_timeout_pause(void) { s_app_idle = true; } void app_idle_timeout_resume(void) { s_app_idle = false; } bool app_install_id_from_app_db(AppInstallId id) { return false; } void framebuffer_dirty_all(FrameBuffer *f) { return; } void framebuffer_mark_dirty_rect(FrameBuffer *f, GRec...
(window->on_screen, false)
; s_unload_count++; window_destroy(window); } static void prv_push_window_load(Window *window) { prv_window_load(window); Window *new_window = window_create(); window_set_window_handlers(new_window, &(WindowHandlers){ .load = prv_window_load, .unload = prv_window_unload }); cl_check(window->pare...
_list, AttributeIdTitle, i18n_get(response_item->text, pin_attr_list)); action_group.actions[i + 1] = (TimelineItemAction) { .id = response_items->type, .type = TimelineItemActionTypeInsightResponse, .attr_list = response_item->attr_list, }; } action_group.ac...
PBL_IF_RECT_ELSE(i18n_noop("ABOVE AVG"), i18n_noop("Above avg"))
, .bg_color = GColorIslamicGreenARGB8, .card_icon = TIMELINE_RESOURCE_ARROW_UP, }, }; // Determine percentage of target int percentage; const PercentTier tier = prv_calc_percent_tier(config, cur_val, average, &percentage); attribute_list_add_uint8(&pin_attr_list, AttributeIdBgColor, s_tier_c...
draw_command_processor, NULL)); ctx->draw_state.drawing_box.origin = draw_box_origin; } static void prv_draw_reel_or_command_list_processed( GContext *ctx, KinoReel *reel, GDrawCommandList *list, GPoint offset, KinoReelProcessor ...
(&s_kino_reel_impl_transform, data)
get_num_rows_callback(struct MenuLayer *menu_layer, uint16_t section_index, SettingsWatchfacesData *data) { return app_menu_data_source_get_count(&data->data_source); } static void draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, SettingsWatchfacesData *...
app_state_set_user_data(data)
; Window *window = &data->window; window_init(window, WINDOW_NAME("Watchfaces")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, .appear = prv_window_appear, .unload = prv_window_unload, }); const bool animated = true; app_w...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(GRect(0, 0, 144, 168))
; text_layer_set_text(time_layer, time_buf); text_layer_set_font(time_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); layer_add_child(window_layer, text_layer_get_layer(time_layer)); // Time layer struct tm *gm_time = gmtime(&the_time); static char gmtime_buf[32]; snprintf(gmtime_buf, 32, "gmtime...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
text_layer_init(title, &window->layer.bounds)
; text_layer_set_font(title, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text_alignment(title, GTextAlignmentCenter); text_layer_set_text(title, "BT_SIG_RF\nTEST"); layer_add_child(&window->layer, &title->layer); app_window_stack_push(window, true /* Animated */); // Enter the bluetoot...
ffer_init(&s_app_state_ptr->framebuffer, &fb_size); framebuffer_clear(&s_app_state_ptr->framebuffer); const GContextInitializationMode init_mode = (s_app_state_ptr->sdk_type == ProcessAppSDKType_System) ? GContextInitializationMode_System : GContex...
{ return &s_app_state_ptr->tick_timer_service_state; }
ConnectionServiceState *app_state_get_connection_service_state(void) { return &s_app_state_ptr->connection_service_state; } #if CAPABILITY_HAS_HEALTH_TRACKING HealthServiceState *app_state_get_health_service_state(void) { return &s_app_state_ptr->health_service_state; } #endif #if CAPABILITY_HAS_ACCESSORY_CONNE...
al_size_bytes); DBG("Payload Size: %"PRIu32, (uint32_t) payload_size); const bool is_last_chunk = (s_state.in.received_size_bytes == s_state.in.total_size_bytes); if (is_last_chunk) { if (rocky_global_has_event_handlers(ROCKY_EVENT_MESSAGE)) { // Last chunk MUST be zero terminated: if (s_state.in...
{ if (is_sent_successfully) { prv_control_message_queue_pop_head(); } else { if (s_state.out.failure_count >= CONTROL_MESSAGE_MAX_FAILURES) { MessageNode *node = s_state.out.control_msg_queue; PBL_LOG(LOG_LEVEL_ERROR, "Failed to send msg with key %"PRIu32, node ? node->ke...
case OutboxMsgTypeChunk: { if (is_sent_successfully) { prv_object_queue_handle_chunk_sent(); } else { if (s_state.out.failure_count >= CHUNK_MESSAGE_MAX_FAILURES) { APP_LOG(APP_LOG_LEVEL_WARNING, "Dropping Message."); prv_object_queue_pop_head_and_emit_error_event_a...
/* * 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 (id < 1) { *entry = (ResourceStoreEntry){0}; return; }
mutex_lock_recursive(s_resource_mutex); ListNode *node; if (app_num == SYSTEM_APP && (node = list_find((ListNode *)s_resource_list, prv_resource_filter, (void *)(uintptr_t)id))) { mutex_unlock_recursive(s_resource_mutex); *entry = ((CachedResource *)node)->stored_resource; return; } resou...
hat the reset values for the core registers // are as follows: // R0-R12 = Unknown // MSP = VECTOR_TABLE[0] (main stack pointer) // PSP = Unknown (process stack pointer) // LR = 0xFFFFFFFF // PC = VECTOR_TABLE[1] // PRIMASK = 0x0 // FAULTMASK = 0x0 // BASEPRI = 0x0 //...
button_is_pressed(BUTTON_ID_UP)
/* * 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...
decision()
EP_E)) //! Defined in sdk/interfaces/ble_stack/(Debug|Release)/libble_stack.a //! Also see https://github.com/pebble/bt-dialog-source/blob/master/ble_stack/src/rom_patch/rom_patch.c#L2687 extern ble_error_t __real_patch_rom_functions(void); static bool s_should_log_about_mic_error = false; static uint32_t s_max_subse...
(conhdl, LL_UNKN_RSP_LEN)
; } #endif #endif static const uint32_t s_orig_functions[] = { #if IS_AE_CHIP (uint32_t) llm_util_get_supp_features, #if !SUPPORTS_PACKET_LENGTH_EXTENSION (uint32_t) llc_length_rsp_pdu_send, #endif #endif (uint32_t) lld_data_rx_check, }; static const uint32_t s_patched_functions[] = { #if IS_AE_CHIP (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...
{ return &s_app_md; }
CommSessionCapability comm_session_get_capabilities(CommSession *session) { if (!session) { return 0; } return s_live_capabilities; } static CommSession *s_app_session_ptr; CommSession *comm_session_get_current_app_session(void) { return s_app_session_ptr; } static bool s_close_called; void settings_fil...
/* * 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; }
/* * 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...
(PDCI_SIZE_OFFSET == PDCS_SIZE_OFFSET, "code re-use between PDCI/PDCS requires same file format header")
; if (sys_resource_load_range(app_num, resource_id, sizeof(expected_signature), (uint8_t*)&output_data_size, sizeof(output_data_size)) != sizeof(output_data_size)) { return NULL; } *data_size = output_data_size; } return true; } bool gdraw_command_validate(GDrawCommand *command, size_t...
level) { return 'L'; } char pebble_task_get_char(PebbleTask task) { return 'T'; } PebbleTask pebble_task_get_current(void) { return PebbleTask_Unknown; } void *pulse_best_effort_send_begin(uint16_t protocol) { static char buffer[1024]; return buffer; // todo } static int s_num_packets_sent = 0; static i...
{ s_in_critical_section = true; pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTest" "TestTestTestTestTestTestTestTestTestTest" "TestTestTestTestTestTestTestTestTestTest" ...
void test_pulse_logging__isr_buffer_full(void) { s_in_critical_section = true; pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTestA"); cl_assert_equal_i(s_num_event_puts, 1); cl_assert_equal_i(s_num_packets_sent, 0); pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTe...
960, -80, -184}, { 960, -104, -176}, { 960, -128, -192}, { 1000, -136, -184}, // 141 seconds { 1016, -152, -200}, { 1056, -144, -152}, { 1432, -200, -88}, { 1520, -144, -96}, { 1248, -88, -112}, { 912, -72, -192}, { 832, -80, -104}, { 1056, -48, -48}, { 1088, -64, 24...
{ 872, 24, -264}, { 856, 56, -304}, { 808, 72, -440}, { 752, 88, -504}, { 752, 56, -632}, { 792, 32, -632}, { 856, 32, -592}, { 944, 80, -512}, { 968, 72, -472}, { 1160, -24, -264}, { 1344, 32, -240}, { 1128, 16, -304}, { 1032, -40, -256}, { 1160, -120, -216}, ...
{ 968, 72, -80}, { 1224, -24, 96}, { 1208, -8, 216}, { 1088, -56, 304}, { 1072, -56, 264}, { 1136, 32, 216}, { 1072, 16, 216}, { 1136, 0, 264}, { 1112, 40, 192}, { 1128, 16, 112}, { 1128, 24, 88}, { 1096, 8, -64}, { 1208, -24, -56}, { 1208, -128, -56}, { 1376...
/* * 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...
(3000000000)
/* * 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...
{ // NeWo return false; }
// TODO: Additional checks? return true; } static void prv_get_fw_reset_vector(void **reset_handler, void **initial_stack_pointer) { void** fw_vector_table; if (firmware_is_new_world(NULL)) { fw_vector_table = (void**) FIRMWARE_NEWWORLD_BASE; } else { fw_vector_table...
md, DISPLAY_SPI_CLOCK); } static void prv_enable_chip_select(void) { GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET); // required setup time > 3us delay_us(7); } static void prv_disable_chip_select(void) { // delay while last byte is emitted by the SPI peripheral delay_us(7); GPIO_WriteBit(DISP_GPIO, DIS...
(prv_reverse_bits(line_addr + 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...
TupletCString(SOME_STRING_KEY, SOME_STRING)
if (first_container || session->start_utc < enter_utc) { enter_utc = session->start_utc; }
if (first_container || session_exit_utc > exit_utc) { exit_utc = session_exit_utc; } first_container = false; } else { // Insure that restful sessions are inside the previous container cl_assert(container_session != NULL); cl_assert(session->start_utc >= container_sessi...
info, void *context) { // check entry is valid if (info->val_len == 0 || info->key_len != sizeof(BTBondingID)) { return true; // continue iterating } ForEachBLEPairingInternalData *internal_itr_data = (ForEachBLEPairingInternalData*) context; BTBondingID key; BtPersistBondingData stored_data; info->...
if (!address) { return BT_BONDING_ID_INVALID; }
BtPersistBondingData new_data = { .type = BtPersistBondingTypeBTClassic, .bt_classic_data.addr = *address, }; // Check if this we already have a key for this addr BTBondingID key = prv_get_key_for_bt_classic_addr(address); if (key == BT_BONDING_ID_INVALID) { key = prv_get_free_key(); if (ke...
calarStore steps, ActivityScalarStore total_steps_avg, Uuid *uuid) { sniprintf(ACTIVITY_SUMMARY_PIN_CONFIG.short_subtitle, SUBTITLE_BUFFER_LENGTH, i18n_get("%u Steps", &ACTIVITY_SUMMARY_PIN_CONFIG), steps); i18n_free_al...
prv_get_variant(&s_walking_intros, VARIANT_RANDOM)
/* * 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(sys_mobile_app_is_connected_debounced())
; } static void check_waiting_to_send_disconnect(void) { // Connected = true cl_assert(sys_mobile_app_is_connected_debounced()); } static void check_waiting_to_send_second_disconnect(void) { // Connected = false cl_assert(!sys_mobile_app_is_connected_debounced()); } static void check_disconnected(void) { /...
/* * 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_pending_did_write.active)
; s_pending_did_write = (PendingInfo) { .active = true, .attribute = attribute }; } static void prv_did_write_handler(SmartstrapAttribute *attribute, SmartstrapResult result) { cl_assert(result == SmartstrapResultOk); cl_assert(s_pending_did_write.active); cl_assert(s_pending_did_write.attribute == a...
/* * 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...
periph_config_enable(pwm->timer.peripheral, pwm->timer.config_clock)
; } else { periph_config_disable(pwm->timer.peripheral, pwm->timer.config_clock); gpio_output_init(&pwm->output, GPIO_OType_PP, GPIO_Speed_100MHz); gpio_output_set(&pwm->output, false /* force low */); } const FunctionalState state = (enable) ? ENABLE : DISABLE; TIM_Cmd(pwm->timer.peripheral, state...
/* * 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...
kernel_free(buffer)
; return legacy_defective_checksum_finish(&checksum); }
ection_get_conn_params(connection, &params); PebblePairingServiceConnParamsReadNotif *resp = (PebblePairingServiceConnParamsReadNotif *)response_buffer; #if SUPPORTS_PACKET_LENGTH_EXTENSION resp->packet_length_extension_supported = true; #else resp->packet_length_extension_supported = false; #endif resp->...
if (evt->handle == s_pps_ctx.att_hdl.conn_status_cccd || evt->handle == s_pps_ctx.att_hdl.gatt_mtu_cccd || evt->handle == s_pps_ctx.att_hdl.conn_params_cccd) { response_length = prv_handle_handle_cccd_read(evt->handle, evt->conn_idx, response); } else if (!prv_get_value(evt->conn_idx, ev...
ble_error_t e = ble_gatts_read_cfm(evt->conn_idx, evt->handle, response_status, response_length, response); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gatts_read_cfm: %u", e); } } static void prv_send_notification(uint16_t conn_idx, uint16_t value_handle) {...
-568, -912}, { -176, -536, -904}, { -184, -544, -912}, { -200, -544, -896}, { -192, -568, -896}, { -184, -584, -864}, { -168, -576, -872}, { -168, -600, -848}, { -160, -584, -864}, { -160, -568, -872}, { -160, -584, -872}, { -168, -568, -864}, // 293 seconds { -176, ...
{ -224, -328, -960}, { -184, -408, -920}, { -208, -368, -976}, { -176, -320, -944}, { 632, -400, -1160}, { -336, -384, -960}, { -256, -368, -1016}, // 298 seconds { -224, -320, -968}, { -88, -304, -992}, { -112, -392, -976}, { -144, -368, -992}, { -152, -376, -1008}, ...
{ -136, -408, -968}, { -136, -392, -952}, { -176, -392, -968}, { -152, -400, -976}, { -160, -424, -920}, { -120, -424, -944}, { -88, -440, -960}, { -112, -496, -1008}, { -168, -440, -1024}, { -120, -368, -960}, { -152, -448, -984}, { -168, -320, -960}, { -144, -416, ...
#if defined(PBL_ROUND) expandable_dialog_set_header_font(expandable_dialog, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); #endif // Show immediately since this is the first window and there is already a compositor animation app_window_stack_push(&expandable_dialog->dialog....
i18n_noop("Alarms")
id prv_detected_workout_click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_UP, prv_detected_workout_up_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, prv_detected_workout_down_click_handler); } static void prv_show_workout_detected_dialog(WorkoutAppData *data) { Workout...
(sizeof(WorkoutAppData))
; app_state_set_user_data(data); workout_service_frontend_opened(); if (workout_service_is_workout_ongoing()) { if (app_launch_get_args() == WorkoutLaunchArg_EndWorkout) { workout_service_stop_workout(); prv_show_workout_ended_dialog(data); } else { ActivitySessionType existing_workout...
nst int s_sunday_9_30 = 1427016600; // Sunday, March 22, 2015, 10:00 UTC static const int s_sunday_10_00 = 1427018400; // Sunday, March 22, 2015, 23:30 UTC static const int s_sunday_23_30 = 1427067000; // Monday, March 23, 2015, 10:30 UTC static const int s_monday_10_30 = 1427106600; static TimerID s_timer = TIMER_INV...
do_not_disturb_is_schedule_enabled(WeekdaySchedule)
== false); cl_assert(do_not_disturb_is_smart_dnd_enabled() == false); active = do_not_disturb_is_active(); cl_assert(active == false); // Manual && !Scheduled && !Smart do_not_disturb_set_manually_enabled(true); cl_assert(do_not_disturb_is_manually_enabled() == true); cl_assert(do_not_disturb_is_schedul...
ER_TASK; } else if ((current_state == SmartstrapAttributeStateIdle) && (new_state == SmartstrapAttributeStateWritePending)) { return pebble_task_get_current() == CONSUMER_TASK; } else if ((current_state == SmartstrapAttributeStateWritePending) && (new_state == SmartstrapAttributeStateR...
(PebbleTask_KernelBackground)
; mutex_lock(s_attr_list_lock); if (prv_find_by_state(SmartstrapAttributeStateRequestInProgress)) { // we already have a request in progress mutex_unlock(s_attr_list_lock); return false; } // get the next attribute which has a pending request SmartstrapAttributeInternal *attr = prv_find_by_state(...
elapsed_time_ms > 0) { int bytes_per_sec = (int)((s_pb_state.total_size * 1000) / elapsed_time_ms); PBL_LOG(LOG_LEVEL_DEBUG, "PutBytes pushed %d bytes/sec", bytes_per_sec); } bluetooth_analytics_handle_put_bytes_stats( commit_succeeded, s_pb_state.type, s_pb_state.total_size, elapsed_time_ms, &...
(num_put_jobs)
; return; } } xSemaphoreTake(s_pb_semaphore, portMAX_DELAY); { s_pb_state.current_command = PutBytesPut; uint32_t bytes_transferred = initial_remaining_bytes - s_pb_state.remaining_bytes; PebbleEvent event = { .type = PEBBLE_PUT_BYTES_EVENT, .put_bytes = { .type = Pebbl...
reak; case '0': zero_pad = true; break; case 'f': modulus = false; break; default: checking_flags = false; break; } if (checking_flags) { input++; } } if (value < 0) { prv_append_char(state, '-'); value = -value; } int ...
{ // Value increments over time, so a < will expire and a > will become valid. cond_to_expire = PredicateCondition_L; cond_to_valid = PredicateCondition_G; wait_time = predicate_value - state->filter_state; }
else { // Value decrements over time, so a < will become valid and a > will expire. cond_to_expire = PredicateCondition_G; cond_to_valid = PredicateCondition_L; wait_time = state->filter_state - predicate_value; } if (!previously_matched && match && ((predicate_cond == cond_to_expire) || ...
ECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 11 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi"))
; #endif // SW = 5 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 5); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RE...
ory is enabled at reset RCC->AHB2ENR = 0; RCC->AHB3ENR = 0; RCC->APB1ENR = 0; RCC->APB2ENR = 0; // Reset most peripherals used by the bootloader. We want to minimize the // chances that the firmware unintentionally relies on some state that the // bootloader leaves behind. This includes disabling the PLL...
(BOOT_BIT_RESET_LOOP_DETECT_TWO)
; break; case 3: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 4: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_THREE); break; case 5: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE);...
t_set_antialiased(ctx, true); graphics_context_set_stroke_width(ctx, 1); graphics_draw_line(ctx, GPoint(20,20), GPoint(20,20)); graphics_context_set_antialiased(ctx, false); graphics_context_set_stroke_width(ctx, 2); graphics_draw_line(ctx, GPoint(30,30), GPoint(30,30)); graphics_context_set_antialiased(c...
(&ctx, GColorBlack)
_time_text_node(const TimelineLayout *layout) { if (layout->info->all_day) { return prv_create_all_day_text_node(layout); } else { return prv_create_hour_text_node(layout); } } static const char *prv_get_secondary_text(const TimelineLayout *layout) { const AttributeList *attributes = layout->layout_lay...
gpoint_add_eq(&primary_node->node.offset, peek_text_offset)
; primary_node->max_size.w = peek_text_width; } primary_node->max_size.h = num_primary_lines * fonts_get_font_height(primary_node->font); primary_node->overflow = overflow; if (!is_peek) { primary_node->node.margin.h = style->primary_list_margin_h; } else if (has_secondary) { prima...
check_atan2(-247, 37)
; check_atan2(-119, 33); check_atan2(234, -253); check_atan2(355, -193); check_atan2(-6, -310); check_atan2(15, -19); check_atan2(34, -32); check_atan2(-158, 299); check_atan2(120, 102); check_atan2(0, 0); check_atan2(0, 10); check_atan2(10, 0); check_atan2(-32768, 1); // <- causes overflow for ...
/* * 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...
{ ISCTYPE_TEST(isupper) }
void test_ctype__islower(void) { ISCTYPE_TEST(islower) } void test_ctype__isdigit(void) { ISCTYPE_TEST(isdigit) } void test_ctype__isxdigit(void) { ISCTYPE_TEST(isxdigit) } void test_ctype__isspace(void) { ISCTYPE_TEST(isspace) } void test_ctype__ispunct(void) { ISCTYPE_TEST(ispunct) } void test_ctype__isalnum(void) {...
ake); prv_feed_cannned_accel_data(60, 0, ActivitySleepStateRestfulSleep); prv_feed_cannned_accel_data(60, 0, ActivitySleepStateLightSleep); // Wait long enough for our recompute sleep logic to run. prv_feed_cannned_accel_data(SECONDS_PER_MINUTE * ACTIVITY_SESSION_UPDATE_MIN, 0, Ac...
("activity_settings.v1", ACTIVITY_SETTINGS_FILE_NAME)
d(&ctx, GPoint(0, 8), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 10), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); graphics_draw_horizontal_line_dott...
GPoint(0, 6)
, 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 8), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 10), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16)...
up_down_direction); } else if (data->select_index == SelectIndexOverflow) { data->word_wrap = !(data->word_wrap); } } else if (button == BUTTON_ID_SELECT) { data->select_index = (data->select_index + 1) % SelectIndexMax; } else if (button == BUTTON_ID_DOWN) { if (data->select_index == SelectIn...
(&data->word_wrap_layer, "Overflow: Ellipsis")
; text_layer_set_font(&data->word_wrap_layer, gothic_14_bold); text_layer_set_text_alignment(&data->word_wrap_layer, GTextAlignmentCenter); text_layer_set_overflow_mode(&data->word_wrap_layer, GTextOverflowModeTrailingEllipsis); // Setup children for clipping canvas layer_add_child(&data->canvas, &data->text...
circle // lies in between lines const bool odd_line = (center.y.fraction == FIXED_S16_3_HALF.raw_value); // This will prevent rounding error from breaking the scanline when angles are on same side but // in reversed order (scanline first hits end angle then hits start angle const bool ignore_close_angle...
MIN(adjusted_top, clip_box.origin.y + clip_box.size.h)
; adjusted_bottom = MAX(adjusted_bottom, clip_box.origin.y); adjusted_bottom = MIN(adjusted_bottom, clip_box.origin.y + clip_box.size.h); // Remove offset from adjusted values adjusted_top -= ctx->draw_state.drawing_box.origin.y; adjusted_bottom -= ctx->draw_state.drawing_box.origin.y; // Calculate distan...
.swap_curve_kind = ScrollAnimationCurveKind_Interpolator, .interpolator = interpolate_moook }; Animation *current = prv_create_anim_frame_scroll((Layer *)swap_layer->current, SCROLL_MS, dy, &moook_scroll_curve); #if PBL_RECT animation_set_curve(curr...
(swap_layer)
t_utc)); activity_private_settings_close(file); } INSIGHTS_LOG_DEBUG("Last sleep reward state: %ld", s_sleep_reward_state.common.last_triggered_utc); INSIGHTS_LOG_DEBUG("Last activity reward state: %ld", s_activity_reward_state.common.last_triggered_utc); // Recal...
prv_push_reward(now_utc, &SLEEP_REWARD_NOTIF_CONFIG)
; } if (activity_prefs_activity_insights_are_enabled()) { prv_push_reward(now_utc, &ACTIVITY_REWARD_NOTIF_CONFIG); } } static void prv_test_push_day_insights(void *unused) { time_t now_utc = rtc_get_time(); for (int i = 0; i < ActivationDelayInsightTypeCount; i++) { prv_trigger_activation_delay_insi...
.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 * l...
if (is_app_quick_launch != is_new_quick_launch) { // Quick Launch only apps are first return (is_app_quick_launch ? 1 : 0) - (is_new_quick_launch ? 1 : 0); } else if (override_cmp_rv) { // Apps that override storage, record, and install order return (override_cmp_rv); } else if (app_node->storage_or...
MenuLayer day_picker_menu_layer; bool day_picker_was_completed; Window custom_day_picker_window; MenuLayer custom_day_picker_menu_layer; bool custom_day_picker_was_completed; bool scheduled_days[DAYS_PER_WEEK]; GBitmap deselected_icon; GBitmap selected_icon; GBitmap checkmark_icon; uint32_t current...
alarm_create(&info)
; data->complete_callback(CREATED, data->alarm_id, data->callback_context); app_window_stack_remove(&data->day_picker_window, true); } else { alarm_set_kind(data->alarm_id, data->alarm_kind); data->complete_callback(EDITED, data->alarm_id, data->callback_context); app_window_stack_pop(true); } }...
GLOBAL_EQUALS_S("s", "20"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "20:04:05"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, " "{hour: undefined, minute: undefined, second: undefined});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "20:04:05"); ...
("s", "25")
; EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: '2-digit'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "25"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'short'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Mon"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'long'});"); ASSERT_JS_GL...
/* * 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...
{ gmtime_r(t, lcltime); }
void launcher_task_add_callback(void (*callback)(void *data), void *data) { callback(data); } // Tests /////////////////////////// void test_clock__basic_no_timezone_set_time(void) { s_prefs_24h_style = false; fake_rtc_init(0, 0); rtc_timezone_clear(); clock_init(); static const time_t jan1st_noon_2005 =...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ANALYTICS_DEVICE_METRIC_STACK_FREE_BLUETOPIA_BIG, prv_task_get_stack_free(PebbleTask_BTCallback), AnalyticsClient_System)
; analytics_set(ANALYTICS_DEVICE_METRIC_STACK_FREE_BLUETOPIA_MEDIUM, prv_task_get_stack_free(PebbleTask_BTRX), AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_STACK_FREE_BLUETOPIA_SMALL, prv_task_get_stack_free(PebbleTask_BTTimer), AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_ME...
alse; break; } } } // Compute the default average value uint16_t default_value = 0; if (use_default) { HealthServiceMetricStats stats; if (!prv_get_metric_stats(state, metric, &stats, day_in_week)) { return false; } HealthValue value_per_day = stats.weekly.avg; defa...
prv_get_midnight_of_local_time(now)
// The user already knows about the Health app return NULL; } AttributeList notif_attr_list = {0}; const char *body = i18n_get("Wanna know more about you? " "Track your activity and sleep with Pebble Health.", &notif_attr_list); prv_build_notifi...
(&open_app_action_attr_list)
; return item; } // ------------------------------------------------------------------------------------------------ static TimelineItem *prv_create_day_10_insight(time_t notif_time) { AttributeList notif_attr_list = {0}; const char *body = i18n_get("Wish you could get daily updates on your " ...
ayer.h" #include "applib/ui/window_private.h" #include "resource/resource_ids.auto.h" #include <stdio.h> // Helper Functions //////////////////////////////////// #include "test_graphics.h" #include "${BIT_DEPTH_NAME}/test_framebuffer.h" #include "util.h" /////////////////////////////////////////////////////////// /...
(ctx, GColorBlack)
; graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, 40, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } void draw_text_single_line_ellipsis_clip_outside_nx(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text...
{ PBL_LOG(LOG_LEVEL_ERROR, "OOM for GATT notification"); return; } const uint16_t next_value_length = gatt_client_subscriptions_consume_notification(&header.characteristic, buffer, &header.value_length, ...
(false /*ignore_paused*/)
; } } else { PBL_LOG(LOG_LEVEL_DEBUG, "Disconnected from Gateway!"); ppogatt_destroy(); ams_destroy(); ancs_destroy(); app_launch_handle_disconnection(); gap_le_slave_reconnect_start(); gatt_client_op_cleanup(GAPLEClientKernel); } } // -----------------------------------------------...
onsecutiveFirst; int32_t result; stats_calculate_basic(op, data, num_data, prv_filter, &s_context, &result); cl_assert_equal_i(result, 3); } void test_stats__median(void) { const int32_t data[] = { 10, 40, 6, 32, 73, 80, 34, 25, 62 }; const size_t num_data = ARRAY_LENGTH(data); const StatsBasicOp op = Stat...
cl_assert_equal_i(result.min, 42)