prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
r the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "services/normal/blob_db/reminder_db.h" // Fixture //////////////////////////////////////////////////////////////// // Fakes //////////////////////////////////////////////////////////////// #include "f...
reminder_db_insert_item(&item3)
); } // Setup //////////////////////////////////////////////////////////////// void test_reminder_db__initialize(void) { reminder_db_init(); } void test_reminder_db__cleanup(void) { reminder_db_deinit(); fake_settings_file_reset(); } // Tests //////////////////////////////////////////////////////////////// v...
gbitmap_get_data_row_info(&app_framebuffer, y1.integer)
; GColor8 *input = (GColor8 *)(source_data_row_info.data + x); GBitmapDataRowInfo destination_data_row_info = gbitmap_get_data_row_info(framebuffer, y1.integer); GColor8 *output = (GColor8 *)(destination_data_row_info.data + x); // first pixel with blending const uint16_t data_row_offset = (uint16_t)(de...
_ELSE( 37, bounds.size.h - vertical_divider_height); const uint16_t horizontal_divider_y_offset = PBL_IF_ROUND_ELSE( vertical_divider_y_offset + (vertical_divider_height / 2), vertical_divider_y_offset); graphics_context_set_stroke_color(ctx, GColorBlack); draw_dotted_line(ctx, GPoint(horizontal_divi...
PBL_IF_ROUND_ELSE(FONT_KEY_LECO_20_BOLD_NUMBERS, FONT_KEY_LECO_38_BOLD_NUMBERS)
; // hole, par numbers const char * const font_key_large_numbers = PBL_IF_ROUND_ELSE(FONT_KEY_LECO_32_BOLD_NUMBERS, FONT_KEY_LECO_38_BOLD_NUMBERS); // "disconnected" text const char * const font_key_disconnected = FONT_KEY_GOTHIC_24_BOLD; static...
/* * 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...
(&session->dictation_result_sub)
buffer_size, i18n_owner, active_window->workout_data); heart_node_offset.y += fonts_get_font_cap_offset(number_font); heart_node = graphics_text_node_create_custom(prv_draw_heart_node_callback, ...
( metric_type, active_window->workout_data)
{ -1192, 376, -224}, { -1560, 760, -232}, { -1208, 352, -232}, { -864, 408, -472}, { -1256, 560, -344}, { -1640, 512, -128}, { -1904, 336, 72}, { -1776, 8, 264}, { -1584, -184, 320}, // 5 seconds { -1416, -256, 248}, { -1328, -56, 0}, { -1232, 32, 8}, { -1224, 80, ...
{ -1392, 480, -248}, // 10 seconds { -1784, 312, 0}, { -1880, 264, 64}, { -1656, 232, 64}, { -1456, 176, 80}, { -1272, 192, 80}, { -1136, 112, 88}, { -1016, 16, -56}, { -1024, -72, 88}, { -816, -344, 80}, { -808, -296, -128}, { -1136, -248, 0}, { -1288, -80, -352}...
{ -1128, -8, -112}, { -1248, 312, -328}, { -1432, 472, -536}, { -1432, 160, -328}, { -1288, -24, -160}, { -1128, 152, -80}, { -976, 352, 48}, { -1056, 440, -88}, { -992, 320, -16}, { -840, 256, 40}, { -1216, 536, -56}, { -1416, 672, 112}, { -1280, 976, -96}, // 1...
eteContext context = { .success = false, .is_notify = true }; system_task_add_callback(prv_read_complete_system_task_cb, context.context_ptr); } } void prv_schedule_notify_timeout(void *context) { // make sure there's still a notification pending if (smartstrap_fsm_state_get() == SmartstrapSt...
smartstrap_fsm_state_get()
); return SmartstrapResultBusy; } // We are now be in a state which allows us to freely modify static variables as we can be sure // that no ISR or other tasks will be allowed to access or modify them while we are in this // state. accessory_disable_input(); // NOTE: Accessory input will be re-enabled ...
0x25, 0x26, 0x27, 0x08, 0x09, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x20 }, }, .identity = (BTDeviceInternal) { .address = (BTDeviceAddress) { .octets = { 0x21, 0x22, 0x13, 0x14, 0x15, 0x26 }, }, .is_...
prv_fire_writeback_timer()
; cl_assert(id != BT_BONDING_ID_INVALID); // Read it back ret = bt_persistent_storage_get_ble_pairing_by_addr(&pairing.identity, &irk_out, NULL); cl_assert(ret); cl_assert_equal_m(&irk_out, &pairing.irk, sizeof(irk_out)); } void test_bluetooth_persistent_storage_prf__delete_ble_pairing_by_id(void) { bool...
/* * 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(20)
} if (!success) { PBL_LOG(LOG_LEVEL_ERROR, "Migration failed of session file %d", session->comm.session_id); dls_storage_delete_logging_storage(session); } return success; } // ----------------------------------------------------------------------------------------- void dls_storage_invalidate_all(void...
prv_release_session_file(session)
; } if (!success) { PBL_LOG(LOG_LEVEL_ERROR, "Nuking storage for session %d", session->comm.session_id); dls_storage_delete_logging_storage(session); } return success; } // ----------------------------------------------------------------------------------------- // Special case: if buffer is NULL, ju...
"stubs_pebble_process_info.h" #include "stubs_pebble_tasks.h" #include "stubs_pbl_malloc.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_session.h" #include "stubs_sleep.h" #include "stubs_status_bar_layer.h" #include "stubs_system_theme.h" #include "stubs_syscalls.h" #include "stubs_task_watchd...
(LauncherMenuLayerTestApp_NoIcon)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_launcher_menu_layer__interior_app(void) { prv_render_launcher_menu_layer(LauncherMenuLayerTestApp_InteriorApp); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_launcher_menu_layer__no_icon_app_with_glance(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...
window_init(window, WINDOW_NAME("Scroll Demo"))
lse); if (i == 0 || i == len - 1) { cl_assert(is_complete == true); cl_assert(should_store == false); } else { cl_assert(is_complete == false); cl_assert(should_store == true); cl_assert(c == str[i]); } } } void test_hdlc__special_characters(void) { // make sure the escape...
{ char c = buffer[i++]; bool should_store, is_invalid; bool is_complete = hdlc_streaming_decode(&ctx, (uint8_t *)&c, &should_store, &is_invalid); cl_assert(is_invalid == false); if (should_store) { cl_assert(is_complete == false); cl_assert(c == str[read_idx++]); } if (is_complet...
cl_assert(read_idx == strlen(str)); }
DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &clear_layer_update_callback); layer_render_tree(&layer, &ctx); #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_clear.8bit.pbi")); #else cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)...
(ctx, GPoint(1, 15))
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10...
prv_create_card_and_render(&health_data)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_activity_summary_card__render_current_above_typical4(void) { HealthData health_data = { .step_data = 866, .step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,...
/* * 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...
(CRASH_REASON_BUFFER_SIZE)
; const char *crash_str = i18n_noop("%s%.*s is not responding.\n\nOpen app?"); sniprintf(crash_reason, CRASH_REASON_BUFFER_SIZE, i18n_get(crash_str, crash_reason), app_found ? " " : "", MAX_APP_NAME_STRING_LENGTH, app_found ? entry.name : ""); i18n_free(crash_str, c...
g/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 * limi...
animation_set_handlers(animation2, (AnimationHandlers) { .stopped = prv_animation_stopped_success, }, data)
; Animation *animation = animation_sequence_create(animation1, animation2, NULL); data->result_animation = animation; animation_schedule(animation); #else // Don't animate to a dot on old platforms, just finish immediately. static const bool success = true; prv_finished(data, success); #endif } static vo...
d(&window->layer, status_bar_layer_get_layer(status_layer)); } // Deinit the common status bar component. static void prv_deinit_status_bar(StatusBarLayer *status_layer) { layer_remove_from_parent(status_bar_layer_get_layer(status_layer)); status_bar_layer_deinit(status_layer); } // Dialog callbacks for confirmat...
(dialog, i18n_get("The core dump was created successfully. " "Please create a support request as usual.", s_dialog))
address - (uintptr_t)context->load_start); } // Not in app space: return system_address; } // ---------------------------------------------------------------------------------------------- extern char __APP_RAM__[]; extern char __APP_RAM_end__[]; extern char __WORKER_RAM__[]; extern char __WORKER_RAM_end__[]; ...
sys_process_manager_get_current_process_md()
); return sdk_type == ProcessAppSDKType_Legacy2x; } // ------------------------------------------------------------------------------------------- DEFINE_SYSCALL(bool, process_manager_compiled_with_legacy3_sdk, void) { PebbleTask task = pebble_task_get_current(); if (task != PebbleTask_App && task != PebbleTask...
meMax, 0); } s_session.id = AUDIO_ENDPOINT_SESSION_INVALID_ID; s_session.setup_completed = NULL; s_session.stop_transfer = NULL; bt_unlock(); if (s_dropped_frames > 0) { PBL_LOG(LOG_LEVEL_INFO, "Dropped %"PRIu32" frames during audio transfer", s_dropped_frames); } } #ifndef PLATFORM_TINTIN void aud...
(false /* call_stop_handler */)
ax_x(&ctx->draw_state.clip_box) - 1; x1 = MAX(x1, x_min); x2 = MIN(x2, x_max); if (!WITHIN(y, y_min, y_max) || x1 > x2) { // Outside of drawing bounds.. return; } // Capture framebuffer & pass it to drawing implementation GBitmap *framebuffer = graphics_capture_frame_buffer(ctx); if (!framebuff...
{ if (gcolor_is_invisible(color)) { return; } // look for clipbox if (!WITHIN(x, clip_box->origin.x, grect_get_max_x(clip_box) - 1)) { return; } const int16_t min_valid_y = clip_box->origin.y; if (y1.integer < min_valid_y) { y1 = (Fixed_S16_3){.integer = min_valid_y, .fraction = 0}; } c...
advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); animation_destroy(a); animation_destroy(b); animation_destroy(c); } // -------------------------------------------------------------------------------------- // Test unscheduling animations arbitrarily in an update handler with auto d...
(a, AnimationCurveDefault)
; cl_assert_equal_p(animation_get_custom_curve(a), NULL); cl_assert_equal_p(animation_get_custom_interpolation(a), NULL); cl_assert_equal_i(animation_get_curve(a), AnimationCurveDefault); animation_destroy(a); } void test_animation__current_interpolate_override(void) { // just some pointer to compare agains...
/* * 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...
i18n_ctx_noop("NotifVibe", "Low")
ahead of line origin x=<%u>", cursor.origin.x, line->origin.x); const int glyph_width_px = prv_codepoint_get_horizontal_advance(&ctx->font_cache, text_box_params->font, codepoint); line->width_px = (cursor.origin.x + glyph_width_px) - line->origin.x; PBL_ASSERT(line->width_px <= text_box_params->bo...
if (walked_width_px < next_glyph_width_px) { break; }
walked_width_px -= next_glyph_width_px; if (!iter_prev(&char_iter)) { break; } current_codepoint = utf8_iter_state->codepoint; } } if (line->suffix_codepoint) { GRect cursor = { .origin = line->origin, .size.w = next_glyph_width_px, .size.h = fonts_get_fo...
{ percent += 30; } if (s_fetch_state.worker) { percent += 10; } if (s_fetch_state.resources) { percent += 60; } // add in the progress for the currently transferring piece. percent += (type_percent / 3); // store value return MIN(100, percent); } //! Cleans up the state of the app fetc...
(AppFetchResultSuccess)
clude "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_passert.h" #include "stubs_task_watchdog.h" void app_storage_delete_app(AppInstallId id) { char buffer[30]; itoa_int(id, buffer, 10); pfs_remove(buffer); } bool app_storage_app_exists(AppInstallId id) { return true; } AppInstallId s_test_id_ql_u...
(app3.id, app3.size)
); // remove 3 cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app1.id)); cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app2.id)); cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app3.id)); cl_assert_equal_i(fake_event_get_count(), 3); // ensure the one that is evicted is INVALID_ID cl_as...
QSPI_ComConfig_InitTypeDef qspi_com_config; QSPI_ComConfig_StructInit(&qspi_com_config); qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Write; qspi_com_config.QSPI_ComConfig_IMode = QSPI_ComConfig_IMode_1Line; qspi_com_config.QSPI_ComConfig_Ins = MT25QCommand_QSPIEnable; QSPI_ComConfig_I...
(&qspi_com_config)
; qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Read; qspi_com_config.QSPI_ComConfig_DMode = QSPI_ComConfig_DMode_4Line; qspi_com_config.QSPI_ComConfig_DummyCycles = MT25Q_FASTREAD_DUMMYCYCLES; qspi_com_config.QSPI_ComConfig_ADMode = QSPI_ComConfig_ADMode_4Line; qspi_com_config.QSPI_Com...
ce, false /* no auto_reconnect */, true /* is_pairing_required */, GAPLEClientKernel); // Expect intent: cl_assert_equal_b(gap_le_connect_has_connection_intent(&device, GAPLEClientKernel), true); prv_fake_connect(&de...
(bonding_id, BtPersistBondingOpWillDelete)
; // Verify the app task got a (virtual) disconnection event: prv_assert_client_event(&device, false /* connected */, (1 << PebbleTask_App), GAPLEConnectHCIReasonExtensionUserRemovedBonding); // Verify there are no more intents: cl_assert_equal_i(gap_le_connect_connection_intents_coun...
{ sample_buf[i] = hr->samples[i]; weight_buf[i] = hr->weights[i]; }
// Calculate the total weight stats_calculate_basic(StatsBasicOp_Sum, weight_buf, hr->num_samples, NULL, NULL, &total_weight); // Calculate the weighted median median = stats_calculate_weighted_median(sample_buf, weight_buf, num_hr_samples); task_free(sample_buf); ta...
eCompletionStatus; typedef struct { bool use_legacy_mode; union { FwUpdateCompletionStatus status; LegacyFwUpdateCompletionStatus legacy_status; }; } FwUpdateCurrentCompletionStatus; static FwUpdateCurrentCompletionStatus s_current_completion_status = { 0 }; // // Start handlers for legacy percentage ...
xSemaphoreGive(s_firmware_update_semaphore)
; return result; } static void prv_handle_firmware_update_start_msg(PebbleSystemMessageEvent *event) { FirmwareUpdateStatus result = prv_firmware_update_start(event); s_update_status = result; PBL_ASSERTN((result == FirmwareUpdateRunning) || (result == FirmwareUpdateStopped) || (res...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ data[i] = i; }
*StatusResult = 0; return 0; } int HCI_LE_Add_Device_To_White_List(unsigned int BluetoothStackID, Byte_t Address_Type, BD_ADDR_t Address, Byte_t *StatusResult) { const uint32_t count = list_count(&s_head-...
additional_crumbs); } static void prv_render_action_menus_animated( SettingsContentSize content_size, const ActionMenuLevel *root_level, unsigned int selected_index, unsigned int additional_crumbs) { const int16_t x_offset = GRID_CELL_PADDING + (content_size * (GRID_CELL_PADDING + DISP_COLS)); for (A...
action_menu_level_set_display_mode(root_level, ActionMenuLevelDisplayModeThin)
; for (size_t i = 0; i < ARRAY_LENGTH(thin_values); i++) { action_menu_level_add_action(root_level, thin_values[i], prv_noop_action_callback, NULL); } const unsigned int selected_index = 4; prv_prepare_canvas_and_render_action_menus_static(root_level, selected_index, 0); cl_check(gbitmap_pbi_eq(s_dest_bi...
/* * 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...
fake_kernel_malloc_mark()
; fake_comm_session_init(); s_transport = fake_transport_create(TransportDestinationSystem, NULL, NULL); s_session = fake_transport_set_connected(s_transport, true); } void test_meta_endpoint__cleanup(void) { // Check for leaks: fake_kernel_malloc_mark_assert_equal(); fake_kernel_malloc_deinit(); fake_...
_reel_impl = (KinoReelImpl) { .destructor = prv_destructor, .set_elapsed = prv_elapsed_setter, .get_elapsed = prv_elapsed_getter, .get_duration = prv_duration_getter }; test_reel = kino_reel_custom_create(test_reel_impl, test_reel_data); cl_assert(test_reel != NULL); test_player = malloc(sizeo...
(animation)
, false); animation_schedule(animation); animation_set_elapsed(animation, 20); animation_set_duration(animation, 300); prv_play_animation_update(animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 20); } void test_kino_player__infinite_animation_finite_reel_forwar...
/* * 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_view_model_did_change(data)
&& !struct_migration) { return; } struct prv_missed_events_s *missed_events = (struct prv_missed_events_s*)context; WakeupId wakeup_id; info->get_key(old_file, (uint8_t*)&wakeup_id, sizeof(WakeupId)); WakeupEntry entry; info->get_val(old_file, (uint8_t*)&entry, info->val_len); if (struct_migration)...
if (prv_compiled_without_utc_support()) { // Legacy apps get local time returned from the time() call. timestamp = time_local_to_utc(timestamp); }
lways be at least sizeof(s_log_buffer_ram). uint32_t start_addr = (uint32_t)s_log_buffer_ram; uint32_t end_addr = (uint32_t)&__ble_vars_start__; uint32_t available_ram = end_addr - start_addr; uint16_t circular_buffer_size = sizeof(s_log_buffer_ram); if (circular_buffer_size < available_ram) { circular_b...
{ // length + strlen(string) + padding (round up to nearest uint32_t). msg_size += 1 + str1_len + (3 - (1 + str1_len + 3) % 4); }
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 in writing, software * distr...
while (length > avail_space) { if (!advance_slackers) { return false; } // Delete data from the biggest slacker slacker->read_index = buffer->write_index; max_data = prv_get_max_data_length(buffer, &slacker); avail_space = buffer->buffer_size - max_data; }
const uint16_t remaining_length = buffer->buffer_size - buffer->write_index; if (remaining_length < length) { // Need to write the message in two chunks around the end of the buffer. Write the first chunk memcpy(&buffer->buffer[buffer->write_index], data, remaining_length); buffer->write_index = 0; ...
endif graphics_fill_rect( ctx, &(GRect) { { x_range_begin.integer + 1, y }, { x_range_end.integer - x_range_begin.integer - 1, 1 } }); } void gpath_draw_filled(GContext* ctx, GPath* path) { #if PBL_COLOR // This algorithm makes sense only in 8bit mode... if (ctx->draw_state.antialiase...
(&path->points[0], path->rotation, &path->offset)
); min_x = max_x = rot_points[0].x.integer; min_y = max_y = rot_points[0].y.integer; // begin finding the last path segment's direction going backwards through the path // we must go backwards because we find intersections going forwards for (int i = path->num_points - 1; i > 0; --i) { rot_points[i] = ro...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gpio_use(FLASH_CONFIG.spi_gpio)
; GPIO_ResetBits(FLASH_CONFIG.spi_gpio, 1 << FLASH_CONFIG.scs_pin); gpio_release(FLASH_CONFIG.spi_gpio); } static void prv_flash_end_cmd(void) { gpio_use(FLASH_CONFIG.spi_gpio); GPIO_SetBits(FLASH_CONFIG.spi_gpio, 1 << FLASH_CONFIG.scs_pin); gpio_release(FLASH_CONFIG.spi_gpio); // 50ns required between SC...
f(PebbleProtocolHeader) + payload_length; // If we cannot fit another message after this one, increment the length to use up the space: if (bytes_free <= (sizeof(PebbleProtocolHeader) + payload_length)) { payload_length += bytes_free; bytes_free = 0; } write_sb[i] = comm_session_send_buffe...
(write_sb, NULL)
data, ((data->state_index - 1) % APP_STATE_NUM_STATES)); log_state(data); } static void up_handler(ClickRecognizerRef recognizer, void *context) { AppData *data = app_state_get_user_data(); if (stroke_width_enabled(data->state_index)) { data->stroke_width++; if (data->stroke_width >= MAX_STROKE_WIDTH) {...
if (data->rectr.origin.x < 0 || data->rectr.origin.x + data->rectr.size.w > data->window.layer.bounds.size.w) { data->rectr_velocity_x = data->rectr_velocity_x * -1; }
data->rectr.origin.y += (data->rectr_velocity_y * PIXEL_SPEED_PER_FRAME * 4); if (data->rectr.origin.y < 0 || data->rectr.origin.y + data->rectr.size.h > data->window.layer.bounds.size.h) { data->rectr_velocity_y = data->rectr_velocity_y * -1; } } else if (shape == CIRCLE) { ...
the two parts const int sep_pos = strcspn(cursor, "/"); cursor[sep_pos] = '\0'; // Store pointer to region name region_names[i] = cursor + sep_pos + 1; // If the continent is the same as the last entry, keep going as-is if (strcmp(cursor, last_cursor) == 0) { data->continent_end[continent...
settings_menu_mark_dirty(SettingsMenuItemDateTime)
heduled(timer_id)); cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); cl_assert_equal_i(fake_event_get_count(), 2); cl_assert(prv_get_calendar_ongoing()); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(5*60, stub_new_timer_timeout(timer_id) / 1000); cl_assert(ti...
stub_new_timer_get_next()
; cl_assert_equal_i(timer_id, TIMER_INVALID_ID); } void test_calendar__handle_all_day_pins(void) { // Insert an all day pin cl_assert(timeline_add(&item6)); timeline_event_handle_blobdb_event(); timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); ...
if there is no next. That's OK since animation_spawn CAN take two NULL's // and perform the creation correctly. Animation *next_up = prv_create_anim_frame_scroll((Layer *)swap_layer->next, SWAP_MS, dy, &swap_down_scroll_curve); return animation_spawn_create(prev...
{ int16_t max_dy = swap_layer->current->layer.frame.size.h - swap_layer->layer.frame.size.h; // we are peeking the next notification if we have a next. if (swap_layer->next != NULL) { max_dy += PEEK_PX; } else { #if PBL_ROUND // The last notification has to be able to scroll past content to stay page a...
static void prv_handle_swap_attempt(SwapLayer *swap_layer, ScrollDirection direction, bool is_repeating) { // if this is a regular click or we have waited long enough if (!is_repeating || swap_layer->swap_delay_remaining <= 0) { prv_attempt_swap(swap_layer, direction, false...
|| (attr->length == 0)) { return 0; } return (size_t) attr->length + strlen(s_utf8_ellipsis) + 1 /* zero terminator */; } static uint8_t *prv_add_pstring_to_attribute(uint8_t *buffer, const ANCSAttribute *ancs_attr, int max_length, Attribute *attribute, ...
(prv_max_ellipsified_cstring_size(title))
; } uint8_t *rv = prv_add_pstring_to_attribute(*buffer, title, ACTION_MAX_LENGTH, &action->attr_list.attributes[1], AttributeIdTitle); // We want to rename the "Clear" action to "Dismiss" if (strcmp(action->attr_list.attributes[1].cstring, "Clear") == 0) { // T...
t_is_service_discovery_running(), false); prv_assert_event(&device, BTErrnoOK); fake_event_clear_last(); // Start discovery again, expect not to run (already discovered): cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); cl_assert_equal_b(fake_gatt_is_service_discovery_running(), fa...
prv_simulate_and_assert_discovery_of_one_service(&device)
)prv_heartbeat_get_array_location(heartbeat, ANALYTICS_APP_METRIC_UUID, 0); } /////////////////// // Create / Clear AnalyticsHeartbeat *analytics_heartbeat_create(AnalyticsHeartbeatKind kind) { uint32_t size = sizeof(AnalyticsHeartbeat) + analytics_heartbeat_kind_data_size(kind); AnalyticsHeartbeat *heartbeat = ke...
(heartbeat)
; char uuid_buf[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(uuid, uuid_buf); PBL_LOG(LOG_LEVEL_DEBUG, "App heartbeat for %s:", uuid_buf); prv_print_heartbeat(heartbeat, ANALYTICS_APP_METRIC_START, ANALYTICS_APP_METRIC_END); break; } default: PBL_LOG(LOG_LEVEL_DEBUG, "Unable to print heartbeat...
te 1 Length // Attribute text: 'L', 'i', 'k', 'e', 0x07, // Attribute 2 ID - ANCS UID 0x01, 0x00, // Attribute 2 Length // Attribute text: "Test" 0x01 }; static uint8_t attr_list3_serialized[] = { // Attribute 1 0x01, // Attribut...
(&list2, AttributeIdBody, "")
, "Body"); // check that the pointers have moved cl_assert(attribute_get_string(&list2, AttributeIdTitle, "") != attribute_get_string(&list, AttributeIdTitle, "")); cl_assert(attribute_get_string(&list2, AttributeIdSubtitle, "") != attribute_get_string(&list, AttributeIdSubtitle, "")); cl_assert(attrib...
ning permissions and * limitations under the License. */ #include "ble_demo_scan.h" static Window *s_scan_window; static void descriptor_write_handler(BLEDescriptor descriptor, BLEGATTError error) { char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; Uuid descriptor_uuid = ble_des...
uuid_equal(&device_name_characteristic, &characteristic_uuid)
) { BTErrno err = ble_client_read(characteristics[c]); APP_LOG(APP_LOG_LEVEL_INFO, "Reading... %u", err); } // If the characteristic is the Alert Control Point, try to write something to it const Uuid alert_control_point = bt_uuid_expand_16bit(0x2A44); if (uuid_equal(&alert_con...
t_put = *event; if (event->type == PEBBLE_BATTERY_STATE_CHANGE_EVENT) { battery_monitor_handle_state_change_event(event->battery_state.new_state); } else if (event->type == PEBBLE_BATTERY_CONNECTION_EVENT) { battery_state_handle_connection_event(event->battery_connection.is_connected); periodic_timer_t...
(battery_get_charge_state().charge_percent, percent)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
layer_init(&pin_window->action_button_layer, &window_layer->bounds)
; layer_set_clips(&pin_window->action_button_layer, false); pin_window->action_button_layer.update_proc = action_button_update_proc; layer_add_child(&pin_window->layer, &pin_window->action_button_layer); StatusBarLayer *status_layer = &pin_window->status_layer; status_bar_layer_init(status_layer); status_b...
h_event = touch_event_queue_get_event(0, 0); prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(10, 10), 20, 5, true); touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420); touch_event = touch_event_queue_get_event(0, 1); ...
(ctx.idx, 2)
; prv_test_touch_event(&ctx.touch_events[0], 0, TouchEvent_Touchdown, &GPoint(13, 13), 3686420, 6, NULL, 0, 0, false); prv_test_touch_event(&ctx.touch_events[1], 0, TouchEvent_PositionUpdate, &GPoint(13, 13), 3686420, 6, &GPoint(2, 2), 20, 0, true); TouchEvent *touch_...
return; } int value = atoi(value_str); if ((value < 0) || (value > 0xFF)) { prompt_send_response("Invalid value"); return; } // Fill flash with a character value uint8_t page[WRITE_PAGE_SIZE_BYTES]; for (uint32_t i = 0; i < WRITE_PAGE_SIZE_BYTES; i++) { page[i] = (uint8_t)(value++ & 0xFF); ...
prompt_send_response_fmt(err_buf, sizeof(err_buf), "FAIL at ADDR %d Got: %d Wanted %d", (int)offset, (int)memmap_buffer[i], (int)want)
; break; } } } // clean up flash_erase_sector_blocking(TEST_ADDR); if (!flash_sector_is_erased(TEST_ADDR)) { prompt_send_response("FAIL: sector not erased"); return; } prompt_send_response("OK"); } //! Some flash chips have an accelerated method of checking for erased sectors. ...
/* * 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...
pwm->timer.preload(pwm->timer.peripheral, TIM_OCPreload_Enable)
; TIM_ARRPreloadConfig(pwm->timer.peripheral, ENABLE); periph_config_disable(pwm->timer.peripheral, pwm->timer.config_clock); } void pwm_set_duty_cycle(const PwmConfig *pwm, uint32_t duty_cycle) { TIM_OCInitTypeDef tim_oc_init; TIM_OCStructInit(&tim_oc_init); tim_oc_init.TIM_OCMode = TIM_OCMode_PWM1; tim...
/* * 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 (!entry) { PBL_LOG(LOG_LEVEL_ERROR, "OOM in plugin_service_subscribe"); return false; }
entry->service_index = service_index; entry->handler = handler; list_append(list, &entry->list_node); // Subscribe to the app event service if we haven't already if (!state->subscribed_to_app_event_service) { state->subscribed_to_app_event_service = true; event_service_client_subscribe(&state->event...
/* * 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...
gdraw_command_image_draw(&ctx, l, GPoint(48, 48))
; l = weather_app_resource_create_sun(); gdraw_command_image_attract_to_square(l, t += dt); gdraw_command_image_draw(&ctx, l, GPoint(0, 96)); l = weather_app_resource_create_sun(); gdraw_command_image_attract_to_square(l, t += dt); gdraw_command_image_draw(&ctx, l, GPoint(48, 96)); cl_check(gbitmap_pbi...
dress(address_str); if (address < 0) { prompt_send_response("Invalid address"); return; } int length = atoi(length_str); if (length <= 0) { prompt_send_response("Invalid length"); return; } char buffer[128]; prompt_send_response_fmt(buffer, 128, "Erasing sectors from 0x%"PRIx32" for %ub"...
while (bytes_remaining > 0) { uint32_t bytes_to_write = WRITE_PAGE_SIZE_BYTES; if (bytes_remaining < WRITE_PAGE_SIZE_BYTES) { bytes_to_write = bytes_remaining; } flash_write_bytes(page, address, bytes_to_write); bytes_remaining -= bytes_to_write; address += bytes_to_write; }
} // Pass in test case number and number of iterations to run // Currently iterations only applies to FLASH_TEST_CASE_RUN_STRESS_ADDR_TEST // All other tests run once void command_flash_test(const char* test_case_num_str, const char* iterations_str) { int32_t test_case_num = atoi(test_case_num_str); int32_t i...
"resource/resource.h" #include "resource/resource_ids.auto.h" #include "services/normal/timeline/timeline_resources.h" #include "util/buffer.h" #include "util/graphics.h" #include "util/hash.h" #include "util/math.h" #include "util/size.h" #include "util/trig.h" #include "clar.h" #include <stdio.h> // Fakes ////////...
PBL_IF_COLOR_ELSE(GBitmapFormat8Bit, GBitmapFormat1Bit)
); bitblt_bitmap_into_bitmap(s_dest_bitmap, screen_bitmap, GPointZero, GCompOpAssign, GColorClear); gbitmap_destroy(screen_bitmap); } } typedef struct TimelinePeekItemConfig { time_t timestamp; const char *title; const char *subtitle; TimelineResourceId icon; int num_c...
6, 784, 632}, { 784, 560, 488}, { 768, 432, 384}, { 808, 424, 432}, { 784, 480, 416}, { 760, 464, 360}, { 776, 504, 264}, { 744, 552, 288}, { 728, 600, 352}, { 768, 528, 360}, { 792, 448, 360}, { 824, 456, 448}, { 848, 576, 416}, { 840, 648, 432}, { 784, 784, 552}...
{ 912, 616, -16}, { 1480, 1256, 176}, { 896, 56, 432}, { 496, -344, 472}, { 680, 208, 400}, { 800, 656, 504}, { 888, 712, 592}, { 816, 488, 512}, { 784, 344, 424}, { 736, 352, 408}, { 776, 440, 336}, { 832, 480, 224}, { 792, 504, 272}, { 752, 552, 312}, { 760,...
{ 896, 600, 48}, { 920, 624, 112}, { 1032, 640, 104}, { 1056, 608, -8}, { 816, 448, 32}, { 944, 520, -48}, { 1488, 1240, 192}, { 1056, 216, 432}, { 448, -384, 552}, { 728, 80, 400}, { 672, 624, 488}, { 832, 848, 560}, { 768, 544, 504}, { 784, 392, 384}, { 776...
t_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); layer_set_update_proc(&layer, &draw_text_single_li...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_jja00.${BIT_DEPTH_NAME}.pbi"))
; // Test when clipping/drawing are at (2, 0) and text bounds is at (0, 0) setup_test_aa_sw(&ctx, fb, RECT_TEXT_2_0, RECT_TEXT_2_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_TEXT_0_0, GTextOverflowModeTrailingEllipsis,...
ssert(!ret); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Local Device Info void test_bluetooth_persistent_storage__test_active_gateway(void) { bool ret; BtPersistBondingType type_out; BTBondingID id_out; // Nothing is stored, so no active gatewa...
.is_random_address = false, }, .is_remote_identity_info_valid = true, }; BTBondingID id_3 = bt_persistent_storage_store_ble_pairing(&pairing_1, true /* is_gateway */, NULL, false /...
ret = bt_persistent_storage_has_active_bt_classic_gateway_bonding(); cl_assert(!ret); ret = bt_persistent_storage_has_active_ble_gateway_bonding(); cl_assert(ret); } void test_bluetooth_persistent_storage__test_is_faithful(void) { bool ret; // No pairing yet, we should be unfaithful ret = bt_persistent...
e the settings cache prv_minute_update(ACTIVE_MINUTES); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); } // --------------------------------------------------------------------------------------- // Make sure we don't push an activity pin when we have no history to compare aga...
(rtc_get_time())
; // At midnight, enter/exit get set to midnight UTC (for PST, this is 4PM), total sleep is 0 uint32_t midnight_local = ((24 + tz.tm_gmtoff) % 24) * SECONDS_PER_HOUR; s_data.metric_history[ActivityMetricSleepState][0] = ActivitySleepStateAwake; s_data.metric_history[ActivityMetricSleepStateSeconds][0] = 30 * ...
/* * 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 (notification_storage_notification_exists(&notification.header.id)) { notification_storage_set_status(&notification.header.id, notification.header.status); PBL_LOG(LOG_LEVEL_INFO, "Notification modified: %s", uuid_string); notifications_handle_notification_acted_upon(id); } else if (!has_status_bits) {...
timeline_item_free_allocated_buffer(&notification); return S_SUCCESS; } int notif_db_get_len(const uint8_t *key, int key_len) { if (key_len < UUID_SIZE) { return 0; } return notification_storage_get_len((Uuid *)key); } status_t notif_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int val_...
stem/logging.h" #include "util/attributes.h" #include "util/build_id.h" #include "util/crc32.h" #include "util/math.h" #include <os/tick.h> #if PLATFORM_ROBERT #define CORE_DUMP_RX_BUFFER_SIZE (16 * 1024) // Place in DTCM on Robert static unsigned char DMA_BSS DMA_READ_BSS s_rx_buffer[CORE_DUMP_RX_BUFFER_SIZE]; #else...
PBL_LOG(LOG_LEVEL_ERROR, "Unable to get Text CRC")
; goto spi_failed; } memcpy(&text_crc_matches, s_rx_buffer, sizeof(text_crc_matches)); // Get the Build ID cmd = (CoreDumpSPICmd) { .cmd = CoreDumpCmd_GetBuildID }; if (!prv_spi_transaction(&cmd, s_rx_buffer, sizeof(build_id))) { PBL_LOG(LOG_LEVEL_ERROR, "Unable to get Build ID"); goto spi_failed...
/* * 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...
{ // NOTE: Was originally: // static const int MAX_CRUMBS = 16; // 168 / (4px diameter + 4px in between each) // However that math literally doesn't add up, it would've been 20 like that. // I'm going to just return 16 all the time like we used to, but leave a "correct" version // commented out. // ...
static void prv_crumbs_layer_update_proc_rect(Layer *layer, GContext *ctx) { const int crumb_radius = prv_crumb_radius(); const int crumb_spacing = prv_crumb_spacing(); const int xpos = prv_crumb_x_position(); GPoint p = GPoint(xpos, crumb_radius + prv_crumb_space_from_top()); CrumbsLayer *cl = (CrumbsLaye...
ypedef enum { PPoGATTSessionType_InferredFromUuid = 0x00, PPoGATTSessionType_Hybrid = 0x01, PPoGATTSessionTypeCount, } PPoGATTSessionType; typedef struct PACKED { uint8_t ppogatt_min_version; uint8_t ppogatt_max_version; Uuid app_uuid; PPoGATTSessionType pp_session_type:8; } PPoGATTMetaV1; typedef struc...
prv_get_state(conn)
frame.origin.y + frame.size.h); } else if (cur <= limit_e) { // zone d - e return GPoint(frame.origin.x, frame.origin.y + DIV_X(frame.size.h * (1000 - MULT_X((cur - limit_d), (limit_e - limit_d))))); } else { // zone e - 0 return GPoint(frame.origin.x + ...
GEdgeInsets(-1)
); graphics_draw_rect(ctx, &inner_bounds); #endif app_free(path.points); #elif PBL_ROUND const int32_t degree = total ? (360 * current / total) : 0; const int32_t to_angle = DEG_TO_TRIGANGLE(degree); graphics_fill_radial(ctx, outer_bounds, GOvalScaleModeFitCircle, fill_thickness, 0, to_angle); #endif } #if...
de.font = TEST_FONT; text_node.overflow = GTextOverflowModeTrailingEllipsis; text_node.alignment = GTextAlignmentCenter; s_data.text_node = &text_node.node; s_data.max_used_size = TEST_TEXT_SIZE; GSize size; graphics_text_node_get_size(&text_node.node, ctx, &TEST_TEXT_BOX, NULL, &size); cl_assert(size.w...
cl_assert_equal_i(vertical_a->container.max_nodes, 2)
; cl_assert_equal_i(vertical_a->container.num_nodes, 0); cl_assert(graphics_text_node_container_add_child(&vertical_a->container, &horizontal_a->container.node)); cl_assert(graphics_text_node_container_add_child(&vertical_a->container, &custom_a->node)); cl_assert(!graphics_text_node_container_add_child(&vertic...
e given time, firing all timers that are scheduled along the way static void prv_advance_to_ms_with_timers(uint64_t dst_time) { uint64_t now = prv_now_ms(); while (now < dst_time) { TimerID sys_timer_id = animation_service_test_get_timer_id(); if (!sys_timer_id) { DPRINTF("timer not created\n"); ...
prv_last_handler_entry(&s_update_handler_calls, animation)
; if (entry) { return (uint32_t)entry->context; } else { return 0; } } // ============================================================================================= // Handlers // -------------------------------------------------------------------------------------- // Started handler static void pr...
/* * 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 (new_state == AccessoryInputStateIdle) || (new_state == AccessoryInputStateImaging) || (new_state == AccessoryInputStateMic); }
_S32_16_PRECISION)}; cl_assert((memcmp(&t_c, &test_array, sizeof(GTransform)) == 0)); cl_assert(gtransform_is_equal(&t_c, (const GTransform*)&test_array)); t_c = GTransformFromNumbers(1, 2, 3, 4, 5, 6); cl_assert(gtransform_is_equal(&t_c, (const GTransform*)&test_array)); // Test to make sure implemented r...
GTransformIdentity()
; t2 = GTransformIdentity(); t_c = GTransformIdentity(); gtransform_concat(&t_new, &t1, &t2); cl_assert(gtransform_is_equal(&t_new, &t_c)); // Test identity concatenation with non-identity t1 = GTransformFromNumbers(1, 2, 3, 4, 5, 6); t2 = GTransformIdentity(); t_c = GTransformFromNumbers(1, 2, 3, 4, ...
//////////////////////////////////////////////////////////////////////////////// // Functions for array object values //////////////////////////////////////////////////////////////////////////////// uint32_t jerry_get_array_length(const jerry_value_t value) { if (!jerry_value_is_array(value)) { return 0; } re...
{ return __jerryRefs.ref(Module.Pointer_stringify($0, $1)); }
bDBIdTest); blob_db_init_dbs(); s_num_until_timeout = 0; s_num_writebacks = 0; } void test_blob_db_sync__cleanup(void) { blob_db_flush(BlobDBIdTest); fake_system_task_callbacks_cleanup(); } void test_blob_db_sync__no_dirty(void) { uint8_t ids[NumBlobDBs]; uint8_t num_ids; blob_db_get_dirty_dbs(ids, &n...
{ char *keys[] = { "key1", "key2", "key3", "key4", "key5" }; int key_len = strlen(keys[0]); char *values[] = { "val1", "val2", "val3", "val4", "val5" }; int value_len = strlen(values[0]); // insert all keys for (int i = 0; i < ARRAY_LENGTH(keys); ++i) { blob_db_insert(BlobDBIdTest, (uint8_t *)keys[i], ...
void test_blob_db_sync__sync_some(void) { char *keys[] = { "key1", "key2", "key3", "key4", "key5" }; int key_len = strlen(keys[0]); char *values[] = { "val1", "val2", "val3", "val4", "val5" }; int value_len = strlen(values[0]); // insert all keys, mark some as synced for (int i = 0; i < ARRAY_LENGTH(keys...
istance of the battery is quite high (~1Ω) and // we reach the termination voltage at around 70% SOC. To workaround this, we set VBATREG to 4.35V // and VBATRECHG to 70mV, turn the charger off and on again, then configure the charger to our // desired settings. The PMIC then recovers into a charge state. This wil...
prv_write_register(rail_control_reg, register_value)
; if (success) { // We enabled the rail! *ref_count = 1; // We need to wait a bit for the rail to stabilize before continuing to use the device. // It takes 2.6ms for the LDO rails to ramp. psleep(3); return true; } return false; } } else { ...
DOT_LAYER_SIZE}; grect_align(&dot_frame, root_frame, GAlignCenter, false); layer_init(mic_dot_layer, &dot_frame); layer_set_clips(mic_dot_layer, false); // layer_set_update_proc(mic_dot_layer, prv_dot_layer_update_proc); layer_add_child(root_layer, mic_dot_layer); layer_set_hidden(mic_dot_layer, true); ...
(&data->voice_event_sub)
; prv_disable_select_click(data); } // Mic window unload called last when UI is exited. Unsubscribe from events and free UI data static void prv_mic_window_unload(Window *window) { VoiceUiData *data = window_get_user_data(window); kino_layer_deinit(&data->mic_window.icon_layer); loading_layer_deinit(&data->mi...
ng, 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 * limitations under the License. */ #include <string.h> #include "system/logging.h" #i...
{ size_t size = sizeof(uint16_t); // Traverse list uint8_t *data_ptr = (pstring16_list->pstrings)->data; uint8_t idx = 0; uint16_t pstring_length; do { if (idx == pstring16_list->count) { // End of list, copy contents of pstring memcpy(data_ptr, &(pstring->str_length), size); data_ptr...
PascalString16 *pstring_get_pstring16_from_list(PascalString16List *pstring16_list, uint16_t index) { size_t size = sizeof(uint16_t); PascalString16 *pstring = NULL; uint16_t idx = 0; if (index >= pstring16_list->count) { return NULL; } // Traverse lis...
/* * 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(size.w > 0)
; cl_assert(size.h > 0); cl_assert_equal_i(size.w, TEST_TEXT_SIZE.w); cl_assert_equal_i(size.h, TEST_TEXT_SIZE.h); } void test_graphics_text_node__text_size(void) { GContext *ctx = &s_data.gcontext; GTextNodeText text_node = {}; text_node.text = (char *)TEST_TEXT; text_node.font = TEST_FONT; text_node....
althMetricHeartRateBPM, now - 10, now, HealthAggregationSum, HealthServiceTimeScopeDaily }, .out = { HealthServiceAccessibilityMaskNotSupported } }, { .desc = "Valid time range with ScopeDaily and Avg. Not available because Daily", .in = { HealthMetricHeartRateBPM, now - 10, no...
(&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 - (20 * SECONDS_PER_MINUTE), now - (10 * SECONDS_PER_MINUTE))); // range after doesn't match, even if it touches cl_assert_equal_b(false, fun(&session, HealthAc...
(int)(timeout_ms - ticks_to_milliseconds(timeout_end_ticks - rtc_get_ticks()))); analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_GATT_STALLED_NOTIFICATIONS_COUNT, AnalyticsClient_System); } return true; } const RtcTicks now_ticks = rtc_get_ticks(); if (now_ticks > ...
{ prv_send_notification_event(task_mask); }
unlock: bt_unlock(); } // ------------------------------------------------------------------------------------------------- static GATTClientSubscriptionNode * prv_find_subscription_and_connection_for_cccd( BLEDescriptor cccd_ref, ...
prv_now_ms()
; animation_schedule(h); // Test the accessor functions Fixed_S32_16 test_value; property_animation_get_from_fixed_s32_16(prop_h, &test_value); cl_assert_equal_fixed_s32_16(test_value, start_value); property_animation_get_to_fixed_s32_16(prop_h, &test_value); cl_assert_equal_fixed_s32_16(test_value, en...
, GColorLavenderIndigoARGB8}, {"limerick", GColorLimerickARGB8}, {"brass", GColorBrassARGB8}, {"lightgray", GColorLightGrayARGB8}, {"babyblueeyes", GColorBabyBlueEyesARGB8}, {"springbud", GColorSpringBudARGB8}, {"inchworm", GColorInchwormARGB8}, {"mintgreen", GColorMintGreenARGB8}, {"celeste", GColorCel...
jerry_string_to_utf8_char_buffer(value, (jerry_char_t *)color_str, sizeof(color_str))
; return rocky_api_graphics_color_parse(color_str, result); } return false; }
{ 2147483646LL, 14, "1652CA930", }, { 2147483646LL, 14, "1652ca930", }, { -2147483647LL, 14, "-1652CA931", }, { -2147483647LL, 14, "-1652ca931", }, { 2147483646LL, 15, "C87E66B6", }, { 2147483646LL, 15, "c87e66b6", }, { -2147483647LL, 15, "-C87E66B7", }, { -2147483647LL, 15, "-c87e66b7", }, { 2147483...
(" -573bb", NULL, 0)
, -573); cl_assert_equal_i(strtol(" -0x573ghghghgh", NULL, 0), -0x573); cl_assert_equal_i(strtol(" -0573faf", NULL, 0), -0573); } void test_strtol__bogus(void) { cl_assert_equal_i(strtol(" ", NULL, 10), 0); cl_assert_equal_i(strtol(" -", NULL, 10), 0); cl_assert_equal_i(strtol("-", NULL, 10), 0); cl_asser...
/* * 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...
(name, "t")
; } void bluetooth_analytics_handle_put_bytes_stats(bool successful, uint8_t type, uint32_t total_size, uint32_t elapsed_time_ms, const SlaveConnEventStats *orig_stats) { } bool bt_driver_analytics_get_conn_event_stats(Sla...
graphics_draw_line(ctx, p0, p1); graphics_draw_line(ctx, p1, p2); graphics_draw_line(ctx, p2, p3); graphics_draw_line(ctx, p3, p0); return; } if (data->operation == OP_TEST2) { int x1 = 50, x2 = 100, y1 = 40, y2 = 120; GPoint p0 = GPoint(x1, y1); GPoint p1 = GPoint(x1, y2...
(ctx, data->stroke_width)
; if (data->stroke_width >= 2) { graphics_line_draw_precise_stroked_non_aa(ctx, p0, p1, data->stroke_width); } else { graphics_draw_line(ctx, GPoint(p0.x.integer, p0.y.integer), GPoint(p1.x.integer, p1.y.integer)); } return; } int x1, y1, x2, y2; if (data->o...
*message) { if (!prv_check_initialized()) { return false; } prv_assign_next_transaction_id(message); return prv_enqueue(message); } static HcProtocolMessage *prv_create_message(HcEndpointID endpoint_id, HcCommandID command_id, const uint8_t *request_payload, ...
hc_protocol_enqueue_and_expect(request)
; kernel_free(request); return response; } HcProtocolMessage *hc_protocol_enqueue_and_expect(HcProtocolMessage *request_message) { if (!prv_check_initialized()) { return false; } // Don't allow because we'd deadlock otherwise: PBL_ASSERTN(!host_transport_is_current_task_host_transport_task()); prv_...
prv_stop_tracking_early(); } mutex_unlock_recursive(s_activity_state.mutex); return system_task_add_callback(prv_stop_tracking_cb, NULL); } // ------------------------------------------------------------------------------------------------ bool activity_tracking_on(void) { bool result; mutex_lock_recurs...
DEFINE_SYSCALL(bool, sys_activity_get_minute_history, HealthMinuteData *minute_data, uint32_t *num_records, time_t *utc_start)
{ if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(utc_start, sizeof(*utc_start)); syscall_assert_userspace_buffer(num_records, sizeof(*num_records)); syscall_assert_userspace_buffer(minute_data, *num_records * sizeof(HealthMinuteData)); } return activity_get_minute_history(minute_data,...
no_reel_pdci.h" #include "applib/ui/vibes.h" #include "applib/ui/window_stack.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "system/passert.h" static void prv_app_timer_callback(void *context) { dialog_pop(context); } void dialog_init(Dialog *dialog, const char *...
if (!reel) { // Fall back to using the image reel as is which could be an animation without the scaling reel = image; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
layer_init(&progress_layer->layer, frame)
; progress_layer->layer.update_proc = (LayerUpdateProc) progress_layer_update_proc; progress_layer->foreground_color = GColorBlack; progress_layer->background_color = GColorWhite; progress_layer->corner_radius = 1; } void progress_layer_deinit(ProgressLayer* progress_layer) { layer_deinit(&progress_layer->la...
) { notification_window_init(false /*is_modal*/); // Bail if a notification came in ahead of us and created a modal window // before we had a chance to react to the select button event. if (notification_window_is_modal()) { return false; } // iterate over visible items as visible (including the groups...
prv_invert_bw_color(gdraw_command_get_fill_color((GDrawCommand *)command))
); } static void prv_draw_pdc_bw_inverted(GContext *ctx, GDrawCommandImage *image, GPoint offset) { GDrawCommandProcessor processor = { .command = prv_invert_pdc_colors, }; gdraw_command_image_draw_processed(ctx, image, offset, &processor); } ////////////// // MenuLayer callbacks static const uint8_t BAR_P...
advert_terms_b, sizeof(advert_terms_b)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert(job_b); cl_assert_equal_b(gap_le_is_advertising_enabled(), false); regular_timer_...
cl_assert_equal_p(s_unscheduled_job, job_b)
; cl_assert_equal_b(s_unscheduled_completed, true); // Expect A's fourth term: assert_ad_data("A"); cl_assert_equal_b(gap_le_is_advertising_enabled(), true); gap_le_assert_advertising_interval(advert_terms_a[3].min_interval_slots, advert_terms_a[3].max_interval_slots); ...
// elapsed: 3 minutes { 48, 0, -1000}, { 48, 8, -1008}, { 48, 0, -1000}, { 40, 8, -1000}, { 48, 8, -1008}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1008}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 0, -1000}, { 48, 0, -1008}, { 48, 8, -1000}, ...
{ 48, 0, -1000}, { 48, 0, -1008}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 0, -1000}, { 48, 8, -1008}, { 48, 0, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1008}, { 48, 8, -1008}, { 48, 8, -1000}, { 48, 8, -1000}, {...
Clear-Enable Register NVIC->ICER[i] = 0xFFFFFFFF; // Interrupt Clear-Pending Register NVIC->ICPR[i] = 0xFFFFFFFF; } // Disable all of the peripheral clocks we may have on, but don't touch any of // the reserved bits. The reset values in the stm32f412 reference manual are // not to be trusted, so ma...
boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_ONE)
; if (counter == 7) { boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_THREE); return true; } switch (++counter) { case 1: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 2: boot_bi...
/* * 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...
{ uint32_t size = FLASH_REGION_DEBUG_DB_BEGIN - 0; fake_flash_assert_region_untouched(0, size); size = FLASH_SIZE - FLASH_REGION_DEBUG_DB_END; fake_flash_assert_region_untouched(FLASH_REGION_DEBUG_DB_END, size); fake_spi_flash_cleanup(); }
y = screen_is_obstructed ? 4 : 47; #elif SPALDING_SCREEN_RES bounds.origin.y = 50; #endif graphics_text_node_draw(&container->node, ctx, &bounds, NULL, NULL); graphics_text_node_destroy(&container->node); } #if PBL_BW || ROBERT_SCREEN_RES static void prv_draw_bpm(GContext *ctx, int32_t current_bpm, GFont font, ...
{ prv_draw_bpm(ctx, data->current_bpm, data->steps_font, &data->heart_icon, bounds, screen_is_obstructed, data); }
#endif // draw steps and shoe prv_draw_steps_and_shoe(ctx, data->steps_buffer, data->steps_font, bounds, text_color, shoe, screen_is_obstructed, has_bpm); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Data static void prv_upda...
.num_nodes = ARRAY_LENGTH(horizontal_config_nodes), .container.nodes = (LayoutNodeConfig **)&horizontal_config_nodes, }; #endif GTextNode *metric_node = (GTextNode *)layout_create_text_node_from_config( layout, PBL_IF_ROUND_ELSE(&vertical_config.container.extent.node, &hori...
(layout, vertical_node, i, &metric_node->node)
; } return vertical_node; } static GTextNode *prv_create_metrics_node(const LayoutLayer *layout, const LayoutNodeConfig *config) { GTextNode *node = &layout_create_metrics_node(layout)->container.node; prv_set_text_node_extent(node, (LayoutNodeExtentConfig *)config); ...
/* * 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_BATTERY_PLUGGED_TIME)
; } } static void prv_update_done_charging(void) { prv_update_plugged_change(); // Amount in mV to drop the "Full" voltage by to briefly stay at 100% once unplugged const uint16_t BATTERY_FULL_FUDGE_AMOUNT = 10; PBL_LOG(LOG_LEVEL_DEBUG, "Done charging - Updating curve"); battery_curve_set_full_voltage(s_l...
(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(has_next); cl_assert_equal_i(new_idx, 4); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[2]].heade...
cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(0)->pin.header.id))
; cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(2)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_stat...
ted 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 "apps/watch/kickstart/kickstart.h" #include "popups/timeline/peek.h" #include "applib/ui/window_pri...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_kickstart__render_steps_below_typical(void) { prv_set_data(&s_data, 5543, 6500, 8000, 0); window_set_on_screen(&s_data.window, true, true); window_render(&s_data.window, &s_ctx); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_kickstart__render_steps_above_daily_avg(vo...
jan_2_2015__13_00_00.tm_gmtoff = -600; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%z", &jan_2_2015__13_00_00); #if !OUR_STRFTIME_BUGS cl_assert_equal_s(tmbuf, "-0010"); #else // BUG!! cl_assert_equal_s(tmbuf, "+0010"); #endif jan_2_2015__13_00_00.tm_gmtoff = -3600; tmbuf[0] = '\0'; strftime(tmbuf, ...
(tmbuf, sizeof(tmbuf), "%7G %01g", &jan_2_10015__13_00_00)
; cl_assert_equal_s(tmbuf, "0010015 15"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%4k %0l", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, " 13 01"); #endif tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%3H %4I", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "013 0001"); tmbuf[0] ...