prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
) { // Verify outbox phase. if (outbox->phase == OUT_CLOSED) { return; } // Cancel any outstanding timer. prv_stop_timer(outbox); outbox->transmission_size_limit = 0; applib_free(outbox->app_outbox_message); outbox->app_outbox_message = NULL; // Finish by moving to the next phase. outbox->pha...
(outbox->phase)
) { PBL_LOG(LOG_LEVEL_ERROR, "Can't call app_message_outbox_send() now, wait for sent_callback!"); return APP_MSG_BUSY; } if (outbox->phase != OUT_WRITING) { return APP_MSG_INVALID_STATE; } const size_t transmission_size = dict_write_end(&outbox->iterator) + APP_MSG_HDR_OVRHD_SIZE; if (transmissi...
/* * 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_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET)
; } static bool prv_wait_busy(void) { // The display should come out of busy within 35 milliseconds; // it is a waste of time to wait more than twice that. int timeout = 50 * 10; while (display_busy()) { if (timeout-- == 0) { dbgserial_putstr("Display busy-wait timeout expired!"); 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...
app_event_loop()
; } const PebbleProcessMd* test_mpu_cache_get_info() { static const PebbleProcessMdSystem s_test_mpu_info = { .common.main_func = prv_main, .name = "Test MPU cache" }; return (const PebbleProcessMd*) &s_test_mpu_info; }
_tests[i].output); #endif TemplateStringVars vars = {}; TemplateStringError err = {}; TemplateStringEvalConditions cond = {}; vars.current_time = s_truncation_tests[i].intime; cond.eval_time = EVAL_FALL_THROUGH; memset(s_output, 'Z', sizeof(s_output)); template_string_evaluate(s_truncatio...
printf("current_time: %ld\n", s_time_since_tests[i].current_time)
; printf("parameter: \"%s\"\n", s_time_since_tests[i].params); printf("result: %jd\n", s_time_since_tests[i].done_state); #endif prv_state_init(); s_vars.current_time = s_time_since_tests[i].current_time; prv_template_evaluate_filter(&s_state, "time_since", s_time_since_tests[i].params); cl_ass...
(GTextAttributes *)&text_layout); custom_text_size = text_layout.max_used_size; GSize avg_text_size = GSizeZero; int total_width = custom_text_size.w; const int info_padding_top = PBL_IF_RECT_ELSE(-1, 1); const int info_offset_y = LABEL_OFFSET_Y + LABEL_HEIGHT + info_padding_top; co...
MAX(config->graph_data->default_max, config->graph_data->stats.daily.max)
; } if (config->info_update) { graph_card->info_update = config->info_update; } if (config->info_buffer_size) { graph_card->info_buffer_size = config->info_buffer_size; } if (!gcolor_equal(config->inactive_color, GColorClear)) { graph_card->inactive_color = config->inactive_color; } } void he...
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_...
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // AA = true, SW = 11 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); // TODO: Fix offse...
format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = { { 0, 0 }, { 50, 50 } } }; memset(dest_data, GColorBlue.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, &cropped_src_bitmap, (GPoint) { 0, 2 }, GCompOpAssign, GColorWhite); cl_a...
bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorWhite)
; cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_white_on_black-expect.1bit.pbi")); memset(dest_data, 0b00000000, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorBlack); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_t...
if (!app_window_stack_contains_window((Window *)&data->pin_window)) { return false; }
TimelineIterState *current_state = timeline_model_get_current_state(); if (current_state == NULL) { return false; } return uuid_equal(&current_state->pin.header.id, uuid); } static void prv_refresh_pin(TimelineAppData *data, int idx) { PBL_ASSERTN(idx >= 0); TimelineIterState *state = timeline_model...
/* * 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_preferred_content_size = PreferredContentSizeMedium; rocky_global_init(s_preferences_api); EXECUTE_SCRIPT("var size = _rocky.userPreferences.contentSize"); ASSERT_JS_GLOBAL_EQUALS_S("size", "medium"); }
void test_rocky_api_preferences__large(void) { s_preferred_content_size = PreferredContentSizeLarge; rocky_global_init(s_preferences_api); EXECUTE_SCRIPT("var size = _rocky.userPreferences.contentSize"); ASSERT_JS_GLOBAL_EQUALS_S("size", "large"); } void test_rocky_api_preferences__extra_large(void) { s_p...
shing put_bytes transaction in our progress struct switch (pb_event->object_type) { case ObjectWatchApp: s_fetch_state.app = true; break; case ObjectWatchWorker: s_fetch_state.worker = true; break; case ObjectAppResources: s_fetch_state.resources = true; ...
put_bytes_expect_init(FETCH_TIMEOUT_MS)
; } //! Called from the system task. Translates an Endpoint error to an event error and sends //! off the appropriate event. void prv_handle_app_fetch_install_response(uint8_t result_code) { switch (result_code) { case APP_FETCH_RESPONSE_STARTING: PBL_LOG(LOG_LEVEL_INFO, "Phone confirmed it will start send...
/* * 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->port, gpio->pin, HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_GPIO)
; if (active) { hw_gpio_set_active(gpio->port, gpio->pin); } else { hw_gpio_set_inactive(gpio->port, gpio->pin); } gpio->is_active = active; } void debug_gpio_init(void) { for (int i = 0; i < DEBUG_GPIOS->num_debug_gpios; i++) { prv_config_gpio_as_output_and_set_state(&DEBUG_GPIOS->debug_gpio[i]...
_noop("BELOW AVG"), i18n_noop("Below avg")), .bg_color = GColorOrangeARGB8, .card_icon = TIMELINE_RESOURCE_ARROW_DOWN, }, [PercentTier_BelowAverage] = { .avg_relation = PBL_IF_RECT_ELSE(i18n_noop("BELOW AVG"), i18n_noop("Below avg")), .bg_color = GColorOrangeARGB8, .card_icon = TIM...
(pin_time_utc, now_utc, cur_val, average, config)
; return prv_push_pin(item, existing_uuid); } // ------------------------------------------------------------------------------------------------ // Pushes a new reward notification and saves the trigger time to flash static void prv_push_reward(time_t now_utc, const RewardNotifConfig *notif_config) { prv_push_rew...
now); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1); now += (3 * SECONDS_PER_DAY) + (2 * SECONDS_PER_HOUR); // Jan 5 @ 8:00pm rtc_set_time(now); activity_insights_process_minute_data(now); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1...
(s_data.notifs_shown, 2)
; }
nder_timer_id()), sizeof(TimelineItemId)); cl_assert(stub_new_timer_timeout(get_reminder_timer_id()) == 0); stub_pebble_tasks_set_current(PebbleTask_NewTimers); cl_assert(stub_new_timer_fire(get_reminder_timer_id())); stub_pebble_tasks_set_current(PebbleTask_KernelBackground); fake_system_task_callbacks_invok...
(&s_reminder_before_all_day_reminder.header.id, (Uuid *)stub_new_timer_callback_data(get_reminder_timer_id()))
); // set time to 21:00 PST March 4 now = 1425531600; stub_pebble_tasks_set_current(PebbleTask_NewTimers); cl_assert(stub_new_timer_fire(get_reminder_timer_id())); stub_pebble_tasks_set_current(PebbleTask_KernelBackground); fake_system_task_callbacks_invoke(1); cl_assert_equal_i(stub_new_timer_timeout(ge...
->transfer.state = TRANSFER_STATE_WRITE_ADDRESS_RX; break; case TRANSFER_STATE_WRITE_ADDRESS_RX: // Write the I2C device address again, but this time in read mode. bus->i2c->DR = bus->transfer.device_address | I2C_READ_WRITE_BIT; if (bus->transfer.size == 1) { // Last byte, we want ...
(bus, false)
; } void I2C1_EV_IRQHandler(void) { portEND_SWITCHING_ISR(irq_event_handler(&i2c_buses[0])); } void I2C1_ER_IRQHandler(void) { portEND_SWITCHING_ISR(irq_error_handler(&i2c_buses[0])); } void I2C2_EV_IRQHandler(void) { portEND_SWITCHING_ISR(irq_event_handler(&i2c_buses[1])); } void I2C2_ER_IRQHandler(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...
attribute_list_init_list(attr_list.num_attributes, &attr_list_out)
; const uint8_t *buffer = (uint8_t *)deserialized_buffer; const uint8_t *cursor = serialized_buffer; attribute_deserialize_list((char **)&buffer, (char *)&deserialized_buffer[buffer_size], &cursor, &serialized_buffer[serialized_size], attr_list_out); oth...
char *activity_name = "unknown"; switch (activity) { case HealthActivityNone: activity_name = "none"; break; case HealthActivitySleep: activity_name = "sleep"; break; case HealthActivityRestfulSleep: activity_name = "restful"; break; } // Update bed and awake t...
(APP_LOG_LEVEL_DEBUG, "Retrieved %d minute data records", (int)num_records)
; // Print detail on the last few minutes const int k_print_batch_size = 30; APP_LOG(APP_LOG_LEVEL_DEBUG, "Fetching last %d minutes", k_print_batch_size); utc_start = time(NULL) - (k_print_batch_size * SECONDS_PER_MINUTE); utc_end = time(NULL); uint64_t start_ms = prv_ms(); num_minutes = health_service_...
{ /// Shown when today's temperature and conditions phrase is known (e.g. "52° - Fair") const char *temp_and_phrase_formatter = i18n_get("%i° - %s", weather_glance); /// Today's current temperature (e.g. "68°") const char *temp_only_formatter = i18n_get("%i°", weather_glance); const char *...
} i18n_free_all(weather_glance); weather_service_destroy_default_forecast(forecast); // Broadcast to the service that we changed the glance launcher_app_glance_structured_notify_service_glance_changed(structured_glance); } static const LauncherAppGlanceStructuredImpl s_weather_structured_glance_impl = { ...
cl_assert_equal_i(window_stack_count(app_stack), 1)
; // Pop the modal window off the stack window_stack_remove(window2, true); cl_assert_equal_i(window_stack_count(modal_stack), 0); cl_assert_equal_i(window2->on_screen, false); // Switch to app happens via the compositor compositor_transition(NULL); // Call the upkeep function so the change in state is...
wn); // Layer C recognizer starts recognizing a gesture, failing other recognizers e.type = TouchEvent_Touchdown; s_next_state = RecognizerState_Started; s_idx_to_change = 1; recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed((int[]) {4, 0, 3, 1}, 4, &s_recognizers_handl...
cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered)
roke_width = (MockCallRecordings){0}; s_graphics_context_set_fill_color = (MockCallRecordings){0}; s_graphics_fill_rect = (MockCallRecordings){0}; s_graphics_fill_rect__color = GColorClear; s_graphics_draw_rect_precise = (MockCallRecordings){0}; s_graphics_fill_radial_precise_internal = (MockCallRecordings){0...
("uot", 6)
; ASSERT_JS_GLOBAL_EQUALS_I("uow", 7); ASSERT_JS_GLOBAL_EQUALS_I("uoh", 8); } static const jerry_value_t prv_global_init_and_set_ctx(void) { rocky_global_init(s_graphics_api); // make this easily testable by putting it int JS context as global Layer l = {.bounds = GRect(0, 0, 144, 168)}; const jerry_value...
ramebuffer around static int16_t prv_move_in(GContext *ctx, int move_size, uint32_t distance, bool vertical) { const int16_t current_offset_px = prv_interpolate_two_ways(distance, move_size); const int16_t diff = s_data.animation_offset_px - current_offset_px; if (vertical) { graphics_private_move_pixels_vert...
graphics_private_sample_line_color(&app_bitmap, (GColorSampleEdge)s_data.direction, GColorBlack)
; // Force the sampled color to be completely opaque, because we're using this to fill the // framebuffer background when moving the new app into focus. s_data.sampled_color.a = 3; } s_data.is_first_half = false; compositor_transition_render(prv_transition_animation_update, animation, progress); } st...
icable 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 * limitations under the License. */ #include "text.h" #i...
sys_resource_load_range(font_res->app_num, font_res->resource_id, hash_entry_offset, (uint8_t*)&table_entry, sizeof(FontHashTableEntry))
; SYS_PROFILER_NODE_STOP(text_render_flash); offset = s_font_md_size[version] + (sizeof(FontHashTableEntry) * font_res->md.hash_table_size) + table_entry.offset; num_bytes = table_entry.count * prv_offset_table_entry_size(&font_res->md); num_entries = table_entry.count; PBL_ASSERTN(n...
! //! At the beginning of a cycle, the scheduler decides which job to advertise //! next. It will just round-robin through the jobs to advertise. //! //! Note that only one job is advertising at a time. Even though a job might //! have such a long interval that another job could be squeezed in between, //! clever thing...
{ if (job->node.next == &job->node) { // Last job left... job->node.next = NULL; job->node.prev = NULL; s_jobs = NULL; } else { list_remove(&job->node, (ListNode **) &s_jobs, NULL); } // Part of CC2564 advertising bug work-around: if (job == s_current) { bt_driver_advert_client_set_cy...
static bool prv_is_registered_job(const GAPLEAdvertisingJob *job) { if (!job) { return false; } // Search jobs (can't use list_contains(), because circular): ListNode *node = &s_jobs->node; while (node) { if (node == (const ListNode *) job) { return true; } node = node->next; if (...
/ Cancel all wakeup events sys_wakeup_cancel_all_for_app(); cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); } void test_wakeup__max_events(void) { WakeupId wakeup_id = 0; sys_wakeup_cancel_all_for_app(); // Schedule 8 (max), at 1 minute offsets, then fail on 9th for (int i = 1; i <= MAX_...
(sys_wakeup_query(second_wakeup_id), second_event)
; TimerID test_timer = wakeup_get_current(); // Wakeup should still return the first event as scheduled cl_assert_equal_i(first_timer, test_timer); // Schedule another in the future time_t third_event = sys_get_time() + WAKEUP_EVENT_WINDOW * 3; WakeupId third_wakeup_id = sys_wakeup_schedule(third_event,...
{ -824, 520, -336}, { -760, 408, -240}, { -624, 448, -408}, // 555 seconds { -616, 512, -600}, { -792, 456, -608}, { -800, 464, -560}, { -736, 416, -464}, { -648, 352, -368}, { -568, 512, -208}, { -776, 808, -264}, { -1072, 1096, -456}, { -936, 696, -584}, { -808, 504...
{ -816, 520, -184}, { -744, 496, -264}, { -832, 312, -72}, { -816, 480, -104}, { -848, 672, 152}, { -920, 1016, 736}, { -968, 504, 288}, { -912, 664, -264}, { -760, 368, -264}, { -664, 16, -112}, { -720, -40, 80}, { -808, -16, 304}, { -912, 88, 360}, { -936, 248, ...
{ -872, 424, 112}, // 563 seconds { -736, 240, 144}, { -656, 88, 328}, { -704, 496, 496}, { -720, 368, 536}, { -840, 336, 456}, { -920, 328, 400}, { -928, 336, 328}, { -872, 360, 312}, { -808, 400, 336}, { -776, 424, 376}, { -752, 432, 384}, { -760, 464, 408}, ...
/* * 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...
dma_request_init(dev->rx_dma)
; } } void uart_init(UARTDevice *dev) { prv_init(dev, false /* !is_open_drain */, UARTCR1Flags_Duplex); } void uart_init_open_drain(UARTDevice *dev) { prv_init(dev, true /* is_open_drain */, UARTCR1Flags_Duplex); } void uart_init_tx_only(UARTDevice *dev) { prv_init(dev, false /* !is_open_drain */, UARTCR1Fla...
.minor = 1, }, .info_flags = 0, .icon_resource_id = 0, }; // Setup //////////////////////////////////////////////////////////////// void test_app_db__initialize(void) { fake_spi_flash_init(0, 0x1000000); pfs_init(false); app_db_init(); // add all three cl_assert_equal_i(S_SUCCESS, app_db_insert(...
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(AppDBEntry)); cl_assert_equal_i(S_SUCCESS, app_db_get_app_entry_for_uuid(&app3.uuid, &temp)); cl_assert_equal_b(true, uuid_equal(&app3.uuid, &temp.uuid)); } void test_app...
/* * 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 (page_rect_on_screen) { const Layer *container = text_layer_find_first_paging_container(text_layer) ?: &text_layer->layer; layer_get_global_frame(container, page_rect_on_screen); if (container == &text_layer->layer) { page_rect_on_screen->size.h = TEXT_LAYER_FLOW_DEFAULT_PAGING_HEIGHT; } ...
return true; }
m_task_callbacks_invoke_pending(); const int k_height_mm_2 = 1830; activity_prefs_set_height_mm(k_height_mm_2); activity_prefs_set_weight_dag(9100); activity_prefs_set_gender(ActivityGenderMale); activity_prefs_set_age_years(40); // Another day utc_sec += SECONDS_PER_DAY; rtc_set_time(utc_sec); prv_...
cl_assert_equal_i(value, exp_value)
; activity_get_metric(ActivityMetricSleepStateSeconds, 1, &value); // Ideally it would show 40 minutes, but we only sample once every ACTIVITY_SESSION_UPDATE_MIN minutes cl_assert(value <= 40 * SECONDS_PER_MINUTE && value >= (40 - ACTIVITY_SESSION_UPDATE_MIN) * SECONDS_PER_MINUTE); // Verify the r...
extNodeDrawContext *ctx, GTextNode *child_node) { const GValue *size = ToGValue(&child_node->cached_size); const GAxis axis = prv_container(ctx->node)->axis; const GAxis max_axis = prv_get_opposite_axis(axis); ToGValue(&ctx->size)[axis] += size[axis]; ToGValue(&ctx->size)[max_axis] = MAX(ToGValue(&ctx->size)[...
{ GRect global_box = grect_to_global_coordinates((GRect) { box->origin, node->cached_size }, ctx); grect_clip(&global_box, &ctx->draw_state.clip_box); if (!global_box.size.h) { return false; } }
return true; } static void prv_iter_will_draw(GTextNodeDrawContext *ctx, GTextNodeDrawContext *parent_ctx) { GTextNode *node = ctx->node; if (parent_ctx) { prv_container(parent_ctx->node)->will_draw_child(parent_ctx, node); prv_init_draw_context(ctx, node, parent_ctx->gcontext, &parent_ctx->box, parent_...
cl_assert_equal_i(strtol(" -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_assert_equal...
ditional tasks to the mask. For now this is all // the ones that the task_watchdog service watches over. const PebbleTask tasks_in_reverse_priority[] = { PebbleTask_KernelBackground, PebbleTask_KernelMain, PebbleTask_PULSE, PebbleTask_NewTimers }; for (unsigned int i = 0; i < ARRAY_LENGTH(tasks...
{ PBL_LOG(LOG_LEVEL_DEBUG, "WD: low priority ISR"); // Are we rebooting because of watch dog? RebootReason reason; reboot_reason_get(&reason); if (reason.code == RebootReasonCode_Watchdog) { // Check if system task is the one triggering the watchdog PebbleTaskBitset new_mask = s_watchdog_mask...
// ============================================================================================================ // Public functions // ------------------------------------------------------------------------------------------------- // Setup a very high priority interrupt to fire periodically. This ISR will call tas...
eld_Always }, }, }, }; iOSNotifPrefs *existing_prefs = &prefs; AttributeList expected_attributes = { .num_attributes = 5, .attributes = (Attribute[]) { { .id = AttributeIdTitle, .cstring = "Title" }, { .id = AttributeIdBody, .cstring = "Body" }, { .id = AttributeIdMuteDayOfWee...
(ancs_filtering_is_muted(&mute_weekdays))
; s_now += SECONDS_PER_DAY; // Saturday Jan 2, 2016 cl_assert(ancs_filtering_is_muted(&mute_always)); cl_assert(ancs_filtering_is_muted(&mute_weekends)); cl_assert(!ancs_filtering_is_muted(&mute_weekdays)); s_now += SECONDS_PER_DAY; // Sunday Jan 3, 2016 cl_assert(ancs_filtering_is_muted(&mute_always)); ...
*transport = (Transport *) ~0; //s_session = comm_session_open(transport, &s_transport_imp, // TransportDestinationSystem); fake_comm_session_init(); Transport *transport = fake_transport_create(TransportDestinationSystem, NULL, ...
cl_assert(logging_sessions[i])
; fake_system_task_callbacks_invoke_pending(); } // This should fill up the file system int bytes_per_session = 2 * DLS_TOTAL_STORAGE_BYTES / num_sessions; for (int i = 0; i < num_sessions; i++) { prv_log_random_data(logging_sessions[i], item_size, bytes_per_session); } // Check the total capacity...
/* * 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...
snprintf(data->alpha_text_buffer, sizeof(data->alpha_text_buffer), " a = %d %%", alpha_percent)
; if (data->property == PROPERTY_ALPHA) { set_text_element(data->alpha_text, data->alpha_text_buffer, true); } else { set_text_element(data->alpha_text, data->alpha_text_buffer, false); } // Set FG Text strncpy(data->fg_text_buffer, "FG =", sizeof(data->fg_text_buffer)); if (data->property == PROPE...
/* * 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...
{ IHEXRecord *record = (IHEXRecord *)out; uint8_t checksum = data_len + (address >> 8) + (address & 0xff) + type; record->start = ':'; prv_hexlify(record->data_count, data_len, sizeof(data_len)); prv_hexlify(record->address, address, sizeof(address)); prv_hexlify(record->type, type, sizeof(type)); for (ui...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
flash_region_erase_optimal_range(flash_addr, flash_addr, flash_addr+size+sizeof(FirmwareDescription), flash_end)
; FirmwareDescription fw_desc = { .description_length = sizeof(FirmwareDescription), .firmware_length = size, .checksum = 0, }; #if CAPABILITY_HAS_DEFECTIVE_FW_CRC fw_desc.checksum = legacy_defective_checksum_memory(bin, size); #else fw_desc.checksum = crc32(CRC32_INIT, bin, size); #endif flash_...
// Only reschedule the timer if the previous head animation wasn't running yet: if (old_head_is_animating == false) { animation_legacy2_reschedule_timer(animation_legacy2_scheduler, 0); } } } void animation_legacy2_private_unschedule(AnimationLegacy2 *animation, AnimationLegacy2Scheduler *anim...
if (animation->handlers.started && animation->abs_start_time_ms > animation_legacy2_scheduler->last_frame_time) { animation->handlers.started(animation, animation->context); }
const uint32_t time_normalized_raw = (animation->duration_ms != 0) ? ((ANIMATION_NORMALIZED_MAX * rel_ms_running) / animation->duration_ms) : ANIMATION_NORMALIZED_MAX; const uint32_t time_normalized = MIN(time_normalized_raw, ANIMATION_NORMALIZED_MAX); uint32_t distan...
/* * 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 (action_bar->layer.window && action_bar->layer.window->on_screen == false) { // clear first, fixes issue of returning from other page while highlighted for (int i = 0; i < NUM_ACTION_BAR_LEGACY2_ITEMS; i++) { action_bar_legacy2_set_highlighted(action_bar, i, false); } } }
* 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 "clar.h" #include "pebble_asserts.h" #include "applib/ui/menu_layer.h" #include "applib/ui/content_indicator_private.h" // ...
(-basic_cell_height, scroll_layer_get_content_offset(&l.scroll_layer).y)
; } void test_menu_layer__test_set_selected_center_focused(void) { MenuLayer l; const int height = 180; menu_layer_init(&l, &GRect(10, 10, height, 180)); menu_layer_set_center_focused(&l, true); menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks){ .draw_row = prv_draw_row, .get_num_rows = pr...
vice_uuid, 1); } else { // [MT] Advertise with an empty payload to save battery life with these // reconnection ad packets. This should be enough for the other // device to be able to reconnect. With iOS it works, need to test Android. // [MT] Note we leave out the Flags AD. According to th...
prv_set_and_evaluate(&s_is_hrm_reconnection_enabled, false)
nitTypeDef tim_config; TIM_TimeBaseStructInit(&tim_config); tim_config.TIM_Period = TIMER_PERIOD_TICKS; // The timer is on ABP1 which is clocked by PCLK1 TimerConfig tc = { .peripheral = TIM4, .config_clock = RCC_APB1Periph_TIM4, }; tim_config.TIM_Prescaler = timer_find_prescaler(&tc, ...
button_is_pressed(i)
; if (is_pressed == debounced_button_state) { // If the state is not changing, skip this button. s_button_timers[i] = 0; continue; } // Leave the timer running so we can track this button that's changing state. can_power_down_tim4 = false; s_button_timers[i] += 1; // If the...
eanup events. This is called //! from KernelMain's event handler when it receives a PEBBLE_PUT_BYTES_EVENT event. put_bytes //! posts these events to inform clients of progress. void app_fetch_put_bytes_event_handler(PebblePutBytesEvent *pb_event) { // If an app fetch isn't in progress, ignore it. if (!s_fetch_stat...
{ AppFetchError error = { .error = s_fetch_state.prev_error, .id = s_fetch_state.app_id, }; return error; }
static void prv_cancel_fetch_from_system_task(void *data) { AppInstallId app_id = (AppInstallId)data; if ((!s_fetch_state.in_progress) || ((s_fetch_state.app_id != app_id) && (app_id != INSTALL_ID_INVALID))) { PBL_LOG(LOG_LEVEL_DEBUG, "Attempted to cancel an app that is currently not being" ...
/* * 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_state.storage[fake_offset], 1, st.st_size, file)
> 0); } void fake_spi_flash_force_future_failure(int after_n_bytes, jmp_buf *retire_to) { s_state.bytes_left_till_write_failure = after_n_bytes; s_state.jmp_on_failure = retire_to; } void flash_read_bytes(uint8_t* buffer, uint32_t start_addr, uint32_t buffer_size) { cl_assert(start_addr >= s_state.offset); c...
rvice_is_enabled; static int s_bt_driver_hrm_service_enable_call_count; void bt_driver_hrm_service_enable(bool enable) { s_bt_driver_hrm_service_enable_call_count++; s_bt_driver_hrm_service_is_enabled = enable; } static BleHrmServiceMeasurement s_last_ble_hrm_measurement; static int s_bt_driver_hrm_service_handle_...
(NULL, info->handler)
; } } void test_ble_hrm__cleanup(void) { ble_hrm_deinit(); prv_assert_event_service_subscribed(false); // hrm manager sub vs unsub calls should be the same, there should be no subscription any more // after de-initing: cl_assert_equal_i(s_sys_hrm_manager_unsubscribe_call_count, s_hrm_m...
s_fill_rect.last_call.rect); cl_assert_equal_i(GColorBlackARGB8, s_graphics_fill_rect__color.argb); cl_assert_equal_i(GColorJaegerGreenARGB8, s_context.draw_state.fill_color.argb); s_graphics_fill_rect = (MockCallRecordings){}; EXECUTE_SCRIPT( "ctx.fillRect(5, 6, 7, 8);\n" ); cl_assert_equal_i(1, s_gr...
(2, s_graphics_fill_radial_precise_internal.call_count)
; cl_assert_equal_point_precise((PP(29.5, 39.5)), lc->fill_radial_precise.center); cl_assert_equal_i(0, lc->fill_radial_precise.radius_inner.raw_value); cl_assert_equal_i(20 * 8, lc->fill_radial_precise.radius_outer.raw_value); // outer radius capped to >= 0 EXECUTE_SCRIPT( "ctx.rockyFillRadial(30, 40, -...
/* * 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->continent_end[continent_index] = i + 1; continue; }
// If the new continent is filtered out, don't create a new continent or update the last // continent pointer. if (strcmp(cursor, "Etc") == 0) { // Filter out 'Etc' fake-continent continue; } // Set pointer for the continent name continent_names[continent_index] = last_cursor; // Set ...
l_i(modal_manager_get_properties(), ModalProperty_Exists | ModalProperty_CompositorTransitions | ModalProperty_RenderRequested | ModalProperty_Unfocused); cl_assert_equal_i(windows[3][1]->on_screen, true); cl_assert_equal_i(windows[3][1]->is_click_configured, false); cl_ass...
window_stack_remove(window1, true)
; cl_assert_equal_i(window1->on_screen, false); window_destroy(window1); window_destroy(window2); } // Description: // This test ensures that we are able to work with both the modal window stacks // and the application stack at the same time. void test_window_stack__modal_and_app(void) { Window *window1 = wi...
0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(10, 10), 20, 5, true); fake_event_reset_count(); touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420); cl_assert_equal_i(fake_event_get_count(), 0); // no event if previous one not handled touch_event ...
touch_handle_update(0, TouchState_FingerUp, NULL, 0, 3686440)
; touch_event = touch_event_queue_get_event(0, 1); prv_test_touch_event(touch_event, 0, TouchEvent_Liftoff, &GPointZero, 3686380, 0, &GPoint(13, 13), 60, 0, true); } void test_touch__assert_null_pos_not_liftoff(void) { // NULL position not valid for touchdown event cl_assert_passert(tou...
/* * 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...
(gcolor_equal(img_palettized->palette[0], GColorBlack))
; cl_assert(gcolor_equal(img_palettized->palette[1], GColorWhite)); gbitmap_pbi_eq_with_bounds(img_palettized, TEST_PALETTIZED_FILE, &test_bounds); gbitmap_destroy(img_palettized); gbitmap_destroy(img_1bit); }
/ true because technically we did successfully deserialize the AttributeList if (!num_attributes) { *attr_list_out = (AttributeList) {}; *attr_list_data_buffer_out = NULL; return true; } const uint8_t * const serialized_attr_list_start = serialized_slice->data; const uint8_t * const serialized_attr...
if (!success) { goto cleanup; }
AppGlance *glance_out = deserialization_context->glance_out; // Copy the common serialized slice fields to the output glance's slice const unsigned int current_slice_index = glance_out->num_slices; AppGlanceSliceInternal *current_slice_out = &glance_out->slices[current_slice_index]; // Note that we default...
S, * 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 <stdbool.h> #include <stdint.h> #include <stdio.h> #include <string.h> #include "clar.h" #include "drivers/system_flash....
{ int countdown = 3; cl_assert(!system_flash_erase(FLASH_BASE, 512 KiB, error_in_middle_cb, &countdown)); cl_assert(flash_locked); cl_assert_(countdown <= 0, "Callback not called enough times"); }
void malloc_flash_data(uint32_t size) { flash_data_length = size; flash_written_data = malloc(size * sizeof(uint8_t)); cl_assert(flash_written_data); flash_written_flag = malloc(size * sizeof(bool)); cl_assert(flash_written_flag); } void assert_flash_unwritten(uint32_t start, uint32_t length) { for (uin...
/* * 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_fetch_state.prev_error = error_code; PebbleEvent event = { .type = PEBBLE_APP_FETCH_EVENT, .app_fetch = { .type = AppFetchEventTypeError, .id = s_fetch_state.app_id, .error_code = error_code, } }; event_put(&event); }
//! Puts an event with the given progress static void prv_put_event_progress(uint8_t percent) { PebbleEvent event = { .type = PEBBLE_APP_FETCH_EVENT, .app_fetch = { .type = AppFetchEventTypeProgress, .id = s_fetch_state.app_id, .progress_percent = percent, } }; event_put(&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...
APP_LOG(APP_LOG_LEVEL_INFO, "kill result: %d", result)
; } static void click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler); window_single_click_subscribe(BUTTON_ID_UP, up_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, down_click_handler); } static uint32_t s_seconds_count; void handle_second_ti...
>size.w; rect->size.w = -rect->size.w; } if (rect->size.h < 0) { rect->origin.y += rect->size.h; rect->size.h = -rect->size.h; } } void grect_clip(GRect *rect_to_clip, const GRect * const rect_clipper) { int16_t overflow; if (rect_to_clip->origin.x < rect_clipper->origin.x) { overflow = rect_...
{ rect->origin.x = inside_rect->origin.x; rect->origin.y = ((inside_rect->size.h - rect->size.h) / 2) + inside_rect->origin.y; return; }
sizeof(uint16_t), sizeof(uint32_t), sizeof(int8_t), sizeof(int16_t), sizeof(int32_t), ...
case SOME_NULL_KEY: cl_assert(tuple->length == 0); null_cstring_found = true; break; case SOME_EMPTY_STRING_KEY: cl_assert(tuple->length == strlen(SOME_EMPTY_STRING) + 1); cl_assert(strncmp(tuple->value->cstring, SOME_EMPTY_STRING, strlen(SOME_EMPTY_STRING) + 1) == 0)...
cl_assert(count == key_count); cl_assert(data_found); cl_assert(string_found); cl_assert(uint8_found); cl_assert(uint16_found); cl_assert(uint32_found); cl_assert(int8_found); cl_assert(int16_found); cl_assert(int32_found); cl_assert(null_cstring_found); cl_assert(empty_cstring_found); } void te...
/* * 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...
{ KinoReelImplPDCS *dcs_reel = (KinoReelImplPDCS *)reel; return gdraw_command_sequence_get_data_size(dcs_reel->sequence); }
static void prv_draw_processed_func(KinoReel *reel, GContext *ctx, GPoint offset, KinoReelProcessor *processor) { KinoReelImplPDCS *dcs_reel = (KinoReelImplPDCS *)reel; if (!dcs_reel->current_frame) { return; } gdraw_command_frame_draw_processed(ctx, dcs_reel->sequence...
ffer *s_fb = NULL; void test_graphics_draw_bitmap__initialize(void) { s_fb = malloc(sizeof(FrameBuffer)); framebuffer_init(s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_graphics_context_init(&s_ctx, s_fb); read_pbi("no_litter_crop.png.pbi", &test_image); } void test_graphics_draw_bitmap__cleanup(void) { free...
if (!read_pbi(pbi_filename, &result)) { return NULL; } else { return &result; }
} typedef GBitmap *(*CompositeTestGBitmapCreateFunc)(const char *filename); typedef struct CompositeTest { const char *test_name; GBitmapFormat expected_test_image_bitmap_format; CompositeTestGBitmapCreateFunc bitmap_create_func; bool need_to_destroy_bitmap; } CompositeTest; static const CompositeTest s_com...
{ 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 40, 8, -1000}, { 48, 0, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1008}, { 48, 0, -1000}, { 48, 0, -1000}, { 48, 0, -992}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 40, 8, -1000}, {...
{ 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1008}, { 48, 0, -1008}, { 48, 0, -1000}, { 48, 0, -1008}, { 48, 8, -1000}, { 40, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -992}, { 48, 0, -1000}, { 48, 8, -1008}, { 48, 8, -1000}, { ...
{ 48, 0, -1000}, { 48, 0, -1000}, { 48, 0, -1000}, { 48, 0, -1008}, { 48, 0, -1000}, { 48, 0, -1000}, { 40, 0, -1000}, { 48, 0, -1000}, { 48, 8, -1000}, { 40, 0, -1000}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 8, -1000}, { 48, 0, -1008}, { 48, 8, -1000}, ...
/* * 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...
{ WTF; }
} int32_t base64_encode(char *out, int out_len, const uint8_t *data, int32_t data_len) { int result = (data_len + 2) / 3 * 4; if (result > out_len) { return result; } int32_t i; for (i = 0; i < data_len - 2; i += 3) { *out++ = prv_encode_char(data[i] >> 2); *out++ = prv_encode_char(((data[i] & ...
/* * 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...
strncpy(res->tm_zone, "UTC", TZ_LEN)
; res->tm_zone[TZ_LEN - 1] = '\0'; local_time = utc_time; } else { res->tm_gmtoff = time_get_gmtoffset(); res->tm_isdst = time_get_isdst(utc_time); time_get_timezone_abbr(res->tm_zone, utc_time); local_time = utc_time + res->tm_gmtoff + (res->tm_isdst ? s_dst_adjust : 0); } int32_t days =...
1280, 640, -208}, { 984, 584, -240}, { 1064, 528, -96}, { 1368, 528, 16}, { 1432, 336, 0}, { 1240, 144, 24}, // 13 seconds { 1176, 40, 40}, { 1096, 64, 16}, { 1064, 176, -8}, { 992, 184, -64}, { 968, 152, -8}, { 1272, 144, -56}, { 1144, 176, -144}, { 1240, 96, -1...
{ 1136, 192, -8}, { 1080, 32, 8}, { 1032, 80, 40}, { 1016, 200, -32}, { 968, 328, -40}, { 928, 328, 96}, { 1288, 312, 136}, { 1312, 376, -56}, { 1104, 312, -120}, { 1336, 200, -72}, { 1080, 328, -248}, { 856, 144, -168}, { 1032, -32, -200}, { 952, 24, -240}, {...
{ 1128, 48, -112}, { 984, 104, -176}, { 752, 144, -168}, { 704, 176, -128}, { 752, 216, -80}, { 888, 248, -56}, { 880, 296, -152}, { 1136, 328, -80}, { 1840, 400, -56}, { 1136, 624, 24}, { 1256, 920, -192}, { 1304, 656, -136}, { 808, 552, -168}, { 1048, 632, -120...
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, ...
(GColorWhiteARGB8, fun(GColorFromHEX(0xaa0000)).argb)
; // contradiction with previous case - oh dear... // cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0xff5500)).argb); cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0xaa5500)).argb); } void test_graphics_colors__grayscale_colors(void) { cl_assert_equal_i(GColorClearARGB8, gcolor_get_grayscale(G...
overy__rediscover_not_already_running(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); prv_simulate_and_assert_discovery_of_one_service(&device); GAPLEConnection *connection = gap_le_connection_by_...
(3, fake_gatt_is_service_discovery_start_count())
; fake_gatt_put_discovery_indication_blood_pressure_service(TEST_GATT_CONNECTION_ID); gatt_client_discovery_discover_range(connection, &range_alt); // BP service should have been discovered fake_gatt_put_discovery_complete_event(GATT_SERVICE_DISCOVERY_STATUS_SUCCESS, ...
unt_handler_entries(&s_started_handler_calls, c), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, c), 0); // Execute to the start of B and C prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAM...
(start_ms + 2 * MIN_FRAME_INTERVAL_MS)
r, 0, assert_value_length); if (kernel) { GATTBufferedNotificationHeader header = {}; gatt_client_subscriptions_get_notification_header(GAPLEClientKernel, &header); cl_assert_equal_i(header.value_length, assert_value_length); cl_assert_equal_i(header.characteristic, characteristic); if (should_co...
for (GAPLEClient c = 0; c < GAPLEClientNum; ++c) { gatt_client_subscriptions_cleanup_by_client(c); }
gap_le_connection_deinit(); gatt_client_subscription_cleanup(); fake_pbl_malloc_check_net_allocs(); fake_pbl_malloc_clear_tracking(); } // ------------------------------------------------------------------------------------------------- // gatt_client_subscriptions_subscribe void test_gatt_client_subscripti...
g) && (data->state != StateError)) { VOICE_LOG("Cancel dictation session"); sys_voice_cancel_dictation(data->session_id); data->session_id = VOICE_SESSION_ID_INVALID; app_timer_cancel(data->dictation_timeout); prv_set_mic_window_state(data, StateFinished); } } // Microphone Window ///////////////...
layer_set_hidden((Layer *)&data->mic_window.text_layer, false)
; sys_i18n_get_with_buffer(msg, data->mic_window.text_buffer, sizeof(data->mic_window.text_buffer)); text_layer_set_text(&data->mic_window.text_layer, data->mic_window.text_buffer); } static void prv_kino_reel_stopped_handler(KinoLayer *layer, bool finished, void *context) { if (!finished) { return; } /...
scroll_layer_is_paging_enabled(scroll_layer)); // Verify shadow_layer is not hidden when paging disabled cl_assert_equal_b(false, scroll_layer_get_shadow_hidden(scroll_layer)); scroll_layer_set_paging(scroll_layer, true); // Verify paging is enabled cl_assert_equal_b(true, prv_scroll_layer_is_paging_enabled...
scroll_layer_get_content_offset(scroll_layer)
.y); scroll_layer_scroll(scroll_layer, ScrollDirectionDown, false); offset += page_height; cl_assert_equal_i(offset, -scroll_layer_get_content_offset(scroll_layer).y); // we expect to scroll to the end of content padded to the last full page scroll_layer_scroll(scroll_layer, ScrollDirectionDown, false); o...
{ 1256, 136, 16}, { 1144, 112, 0}, { 880, 80, -144}, { 584, -392, 112}, { 424, 24, -320}, { 1080, -40, -408}, { 1344, 256, -352}, { 1408, 232, -384}, { 1408, 264, -176}, { 1376, 528, -160}, { 1536, 600, -200}, { 1504, 920, -232}, { 1328, 832, -360}, { 1008, 944, -496}...
{ 1144, 760, 72}, { 1344, 752, 16}, { 1736, 704, 56}, { 1736, 408, 88}, { 1368, 248, 8}, { 1264, 232, 16}, { 1208, 184, 0}, { 1344, 256, -56}, { 1464, 120, 128}, { 1304, 120, 40}, // 29 seconds { 1072, 72, -216}, { 608, -152, -88}, { 600, -272, -176}, { 504, 2...
{ 1040, 384, -192}, { 1232, 432, -112}, { 1360, 584, -120}, { 1384, 912, -56}, { 1192, 712, -272}, { 944, 1008, -104}, { 912, 1168, -24}, { 1184, 856, -64}, { 1184, 744, -80}, { 1280, 680, -48}, { 1256, 496, -88}, { 1152, 280, -112}, { 1144, 144, -112}, { 1144, 9...
ponse.data[0] & 0xF0) == (address & 0xF0)); PBL_ASSERTN((response.data[2] & 0x0F) == PACKET_FOOTER); *(uint16_t *)result = (response.data[0] << 4) | (response.data[1] >> 4); *(uint16_t *)result <<= 8; *(uint16_t *)result |= (response.data[1] << 4) | (response.data[2] >> 4); } else { // invalid typ...
("Touch controller reset!")
! Message Length Constants static const uint8_t MIN_INSERT_LENGTH = 8; static const uint8_t MIN_DELETE_LENGTH = 6; static const uint8_t MIN_CLEAR_LENGTH = 3; static bool s_bdb_accepting_messages; static void prv_send_response(CommSession *session, BlobDBToken token, BlobDBResponse result) { struct PACKED BlobDBRes...
(data, length)
, BLOB_DB_INVALID_DATA); return; } const uint8_t *iter = data; BlobDBToken token; BlobDBId db_id; // Read token and db_id iter = endpoint_private_read_token_db_id(iter, &token, &db_id); // Read key length and key bytes uint8_t key_size; const uint8_t *key_bytes = NULL; iter = prv_read_key_siz...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_gpoint(result, GPoint(0, 5))
; // -90 degrees should be (-5, 0) result = gpoint_from_polar_internal(&center, radius, -(TRIG_MAX_ANGLE / 4)); cl_assert_equal_gpoint(result, GPoint(-5, 0)); // -450 degrees (-90 * 5 -> -90) should be (-5, 0) result = gpoint_from_polar_internal(&center, radius, -(TRIG_MAX_ANGLE * 5 / 4)); cl_assert_equal...
bool recursive_bezier_fixed(GPathBuilder *builder, int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3, int32_t y3, int32_t x4, int32_t y4) { // Calculate all the mid-points of the line segments i...
if (builder->num_points != 0) { return false; }
prv_do_deferred_delete_cb(void *context) { s_deferred_delete_queued = false; mutex_lock(s_attr_list_lock); SmartstrapAttributeInternal *attr = s_attr_head; while (attr) { SmartstrapAttributeInternal *next = NEXT_ATTR(attr); if (attr->deferred_delete) { list_remove(&attr->list_node, (ListNode **)&s...
{ if (service_id) { syscall_assert_userspace_buffer(service_id, sizeof(uint16_t)); } if (attribute_id) { syscall_assert_userspace_buffer(attribute_id, sizeof(uint16_t)); } if (length) { syscall_assert_userspace_buffer(length, sizeof(size_t)); } }
if (service_id) { *service_id = attr->service_id; } if (attribute_id) { *attribute_id = attr->attribute_id; } if (length) { *length = mbuf_get_length(&attr->mbuf); } } DEFINE_SYSCALL(SmartstrapResult, sys_smartstrap_attribute_do_request, SmartstrapAttribute *app_attr, Smartstrap...
1576, 352, -64}, { 1360, 464, -296}, { 1552, 520, -368}, { 1400, 376, -80}, { 1064, 200, -8}, { 816, 216, -40}, { 672, 272, -64}, { 608, 328, -16}, { 704, 416, 0}, { 928, 424, -64}, { 1056, 376, -16}, { 1312, 408, -48}, { 1504, 384, -8}, { 1952, 400, 64}, { 1344,...
{ 1600, 408, -320}, { 1432, 256, -24}, // 46 seconds { 1032, 208, -8}, { 800, 280, -64}, { 688, 320, -88}, { 608, 320, -64}, { 728, 344, -80}, { 896, 360, -88}, { 1032, 360, -80}, { 1312, 352, -96}, { 1528, 384, -88}, { 1848, 480, -48}, { 1520, 520, -88}, { 10...
{ 1808, 488, -152}, { 1304, 440, -160}, { 1216, 320, -48}, { 1320, 264, -24}, { 1320, 224, 40}, { 1032, 192, 48}, { 856, 208, 40}, { 784, 192, 40}, { 816, 160, 56}, // 49 seconds { 792, 144, 80}, { 784, 104, 88}, { 832, 88, 96}, { 944, 96, 104}, { 1000, 80, 6...
ayer *s_canvas_layer; static uint8_t *s_color_table = NULL; // Sorted by Hue, Value, Saturation static uint8_t color_table_hvs[] = { 0x00, 0x15, 0x10, 0x2a, 0x25, 0x20, 0x3f, 0x3a, 0x35, 0x30, 0x34, 0x24, 0x39, 0x38, 0x14, 0x29, 0x28, 0x3e, 0x3d, 0x3c, 0x2c, 0x18, 0x2d, ...
set_text_element(data->fg_color_text, data->fg_color_text_buffer, false)
; } // Set BG Color Text uint8_t bg_color = data->bg_color.argb; snprintf(data->bg_color_text_buffer, sizeof(data->bg_color_text_buffer), "BG = 0x%02x", bg_color); if (data->property == PROPERTY_BG_COLOR) { set_text_element(data->bg_color_text, data->bg_color_text_buffer, true); } else { set_text_e...
prv_test_touch_event(touch_event, 0, TouchEvent_Liftoff, &GPointZero, 3686380, 0, &GPoint(18, 5), 60, 0, true)
; } void test_touch__handle_update_merge_liftoff_null_pos(void) { touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 3686380, 0); touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400); TouchEvent *touch_event = touch_event_queue_get_event(0, 0); prv_test_touch_event(touch_event, 0...
_path) + 2); sprintf(state->res_path, "%s/%s", CLAR_FIXTURE_PATH, test_files_path); state->dp = opendir(state->res_path); if (state->dp == NULL) { printf("\nCould not open directory %s", state->res_path); return false; } state->type = samples_type; return true; } // -----------------------------...
if (entry_a->exp_steps > 0 && entry_b->exp_steps == 0) { return -1; } else if (entry_a->exp_steps == 0 && entry_b->exp_steps > 0) { return +1; } else { return strcmp(entry_a->name, entry_b->name); }
rue to continue searching return true; } // ---------------------------------------------------------------------------------------------- // Fetch whatever records we have in our minute history circular buffer (i.e. not yet written // to flash) to satisfy a get_minute_history() request. The passed in context conta...
{ // Return number of records that were written, including missing records in the middle *num_records = context.last_record_idx_written + 1; *utc_start = context.utc_start; }
, sys_ble_central_cancel_connect, BTDeviceInternal device) { return gap_le_connect_cancel(&device, GAPLEClientApp); } // ----------------------------------------------------------------------------- // ble_client.h DEFINE_SYSCALL(BTErrno, sys_ble_client_discover_services_and_characteristics, ...
(characteristic, value, value_length, GAPLEClientApp)
; } DEFINE_SYSCALL(BTErrno, sys_ble_client_subscribe, BLECharacteristic characteristic, BLESubscription subscription_type) { return gatt_client_subscriptions_subscribe(characteristic, subscription_type, ...
r_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(5, 15)); } void outside_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(5, -5)); } void o...
(&layer, &ctx)
; cl_check(framebuffer_is_empty("outside_x_ny_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_nx_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_nx_ny_offset_layer", ctx.pare...
ble += sizeof(SerializedTimelineItemHeader) + iter_state.header.payload_length; if (size_needed <= *size_available) { return false; } } if (pfs_seek(fd, iter_state.header.payload_length, FSeekCur) < 0) { break; } } return true; } //! Compress storage by reading all valid notif...
(&header->common.id)
)) { break; } uint8_t status = header->common.status; if ((status & TimelineItemStatusUnused) || (header->common.type >= TimelineItemTypeOutOfRange) || (header->common.layout >= NumLayoutIds)) { pfs_close(fd); notification_storage_reset_and_init(); PBL_LOG(LOG_LEVEL_...
OTH, RESOURCE_ID_SETTINGS_ICON_BLUETOOTH_ALT, RESOURCE_ID_SETTINGS_ICON_AIRPLANE, }; typedef enum { ToggleStateIdle, ToggleStateEnablingBluetooth, ToggleStateDisablingBluetooth, } ToggleState; typedef struct SettingsBluetoothData { SettingsCallbacks callbacks; GBitmap icon_heap_bitmap[NumIcons]; Lis...
bt_device_equal(&le_device_with_classic_address.opaque, &device->opaque)
; } static void prv_add_and_merge_ble_remote(BTDeviceInternal *device, SMIdentityResolvingKey *irk, const char *name, BTBondingID *id, void *context) { SettingsBluetoothData *data = (SettingsBluetoothData*) context; if (!data) { return; } StoredRemote* remote = (St...
set_duration(animation, SLIDE_SETTLE_DURATION_MS); AnimationHandlers anim_handler = { .stopped = prv_slide_settle_stopped, }; animation_set_handlers(animation, anim_handler, selection_layer); selection_layer->slide_settle_anim_impl = (AnimationImplementation) { .update = prv_slide_settle_impl, }; a...
for (unsigned i = 0; i < num_cells; i++) { selection_layer->cell_widths[i] = 0; }
layer_create_with_data(*frame, sizeof(selection_layer)); layer_set_frame(&selection_layer->layer, frame); layer_set_clips(&selection_layer->layer, false); layer_set_update_proc(&selection_layer->layer, (LayerUpdateProc) prv_draw_selection_layer); } SelectionLayer* selection_layer_create(GRect frame, unsigned...
/* * 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...
(PWR_WakeUp_Pin3, DISABLE)
; periph_config_enable(RCC_APB2PeriphClockCmd, RCC_APB2Periph_SYSCFG); initialize_button_common(); for (int i = 0; i < NUM_BUTTONS; ++i) { initialize_button(&BOARD_CONFIG_BUTTON.buttons[i]); } periph_config_disable(RCC_APB2PeriphClockCmd, RCC_APB2Periph_SYSCFG); }
oing || (session_exit_utc <= *params->exit_utc)) { continue; } // Don't log *any* sleep events until we know for sure we are awake. For restful sessions // in particular, even if the session ended, it might later be converted to a restful nap // session (after the container sleep session it is in...
activity_algorithm_get_last_sleep_utc()
; // Post process sleep sessions if we got any new sleep sessions that showed up if (state->sleep_sessions_modified) { // Post-process the sleep activities. This is where we relabel sleep sessions as nap // sessions, depending on time and length heuristics. activity_algorithm_post_process_sleep_session...
/* * 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 codepoint_in_list(codepoint, END_OF_WORD_CODEPOINTS, ARRAY_LENGTH(END_OF_WORD_CODEPOINTS)); }
{ const CommSessionType requested_type = (const bool) (uintptr_t) data; const TransportDestination destination = ((const CommSession *) found_node)->destination; switch (requested_type) { case CommSessionTypeApp: return destination == TransportDestinationApp || destination == TransportDestinationHybrid;...
{ circular_buffer_consume(&session->send_buffer, length); }
static void prv_send_next_kernel_bg_cb(void *data) { CommSession *session = (CommSession *) data; if (!list_contains((const ListNode *) s_session_head, (const ListNode *) session)) { // Session closed in the mean time return; } // Flip the flag before the send_next callback, so it can schedule again i...
F_KEY_LEGACY_DND_MANUAL_FIRST_USE, manual_dnd_first_use_complete); RESTORE_AND_DELETE_PREF(PREF_KEY_LEGACY_DND_SMART_FIRST_USE, smart_dnd_first_use_complete); s_first_use_complete |= manual_dnd_first_use_complete << FirstUseSourceManualDNDActionMenu; s_first_use_complete |= smart_dnd_first_use_complete << FirstU...
(&file, FILE_NAME, FILE_LEN)
!= S_SUCCESS) { return; } #define RESTORE_PREF(key, var) \ do { \ __typeof__(var) _tmp; \ if (settings_file_get( \ &file, key, strlen(key), &_tmp, sizeof(_tmp)) == S_SUCCESS) { \ var = _tmp; \ } \ } while (0) RESTORE_PREF(PREF_KEY_MASK, s_mask); RESTORE_PREF(PREF_KEY_VIBE, s_v...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (s_dropped_frames > 0) { PBL_LOG(LOG_LEVEL_INFO, "Dropped %"PRIu32" frames during audio transfer", s_dropped_frames); }
} #ifndef PLATFORM_TINTIN void audio_endpoint_protocol_msg_callback(CommSession *session, const uint8_t* data, size_t size) { MsgId msg_id = data[0]; if (size >= sizeof(StopTransferMsg) && msg_id == MsgIdStopTransfer) { StopTransferMsg *msg = (StopTransferMsg *)data; if (msg->session_id == s_session.id) ...
(buffer, addr, BUFFER_SIZE)
; for (uint32_t i = 0; i < BUFFER_SIZE; i++) { if (buffer[i] != i) { char err_buf[80]; prompt_send_response_fmt(err_buf, sizeof(err_buf), "FAIL: Incorrect value at 0x%"PRIx32, addr + i); return; } } } // read it back, albeit awkwardly. We...
ging.h" #include "console/prompt.h" #include "drivers/accessory.h" #include "drivers/flash.h" #include "flash_region/flash_region.h" #include "kernel/core_dump.h" #include "kernel/core_dump_private.h" #include "mfg/mfg_mode/mfg_factory_mode.h" #include "resource/resource_storage_flash.h" #include "services/common/new_...
{ PBL_LOG(LOG_LEVEL_ERROR, "Ran out of buffers %d times and dropped %d bytes while imaging", s_no_buffer_count, s_dropped_char_count); }
flash_prf_set_protection(true); accessory_use_dma(false); accessory_manager_set_state(AccessoryInputStateMfg); new_timer_delete(s_timeout_timer); PBL_LOG(LOG_LEVEL_DEBUG, "Stopping accessory imaging"); } static void prv_timeout_timer_cb(void *context) { system_task_add_callback(prv_stop, NULL); } // Sen...
OR, .callback = { .update = true, .complete = prv_time_picker_complete, .context = data, }, }; time_selection_window_init(&data->time_picker_window, &config); window_set_user_data(&data->time_picker_window.window, data); data->time_picker_window.window.window_handlers.unload = prv_time...
task_malloc_check(sizeof(AlarmEditorData))
; *data = (AlarmEditorData) { .alarm_id = alarm_id, .complete_callback = complete_callback, .callback_context = callback_context, }; alarm_get_kind(alarm_id, &data->alarm_kind); if (data->alarm_kind == ALARM_KIND_CUSTOM) { alarm_get_custom_days(alarm_id, data->scheduled_days); } prv_setup_d...
905, 196, 50}, { 868, 214, 44}, { 848, 300, 47}, { 917, 353, 24}, { 965, 349, 21}, { 920, 351, -20}, { 850, 337, -53}, { 966, 373, -39}, { 1154, 410, -53}, { 1236, 450, -4}, { 1258, 606, -4}, { 1102, 432, 136}, { 1169, 443, 62}, { 1139, 424, 104}, { 1106, 429, 141...
{ 1191, 407, -39}, { 1159, 428, -27}, { 1177, 571, -22}, { 1246, 627, 13}, { 1148, 455, 102}, { 1187, 452, 115}, { 1228, 444, 165}, { 1036, 365, 196}, { 886, 267, 212}, { 867, 191, 226}, { 880, 191, 243}, { 863, 190, 216}, { 805, 208, 182}, { 916, 192, 216}, {...
{ 1048, 156, 185}, { 1131, 231, 118}, { 1461, 268, 144}, { 1166, 391, -106}, { 1126, 480, -188}, { 997, 350, 24}, { 919, 252, 37}, { 875, 223, 49}, { 816, 281, 90}, { 811, 314, 74}, { 843, 327, 58}, { 835, 336, 20}, { 875, 329, 8}, { 1072, 357, 3}, { 1272, 38...
? RESOURCE_ID_TINTIN_LAUNCHER_CHARGING_5_PERCENT : RESOURCE_ID_TINTIN_LAUNCHER_BATTERY_5_PERCENT; if (charge_state.charge_percent <= 100) { return battery_base_resource_id + (charge_state.charge_percent / 10); } else { WTF; } } static void prv_...
status_bar_layer_init(&data->status_bar)
; status_bar_layer_set_colors(&data->status_bar, GColorBlack, GColorWhite); layer_add_child(&window->layer, status_bar_layer_get_layer(&data->status_bar)); static const int kino_width = 20; static const int kino_padding = 6; kino_layer_init(&data->connectivity_icon, &GRect(kino_padding, 0, ...
(AccelDriverSample){}; prv_convert_accel_raw_data_to_mgs(res, data); data->timestamp_us = prv_get_sample_time_us(&res[6]); BMI160_DBG("%"PRId16" %"PRId16" %"PRId16, data->x, data->y, data->z); } static IMUCoordinateAxis prv_get_axis_direction(uint8_t int0_status, uint8_t int2_status, ...
{ s_accel_outstanding_motion_work = true; accel_offload_work_from_isr(prv_handle_motion_interrupts, should_context_switch); }
else { BMI160_DBG("%s", "We fell behind on motion interrupt handling!"); } } static uint8_t prv_get_fifo_frame_size(void) { return 6; // we are just storing {x, y, z} accel data in the fifo today } static uint16_t prv_get_current_fifo_length_and_timestamp(uint64_t *timestamp_us) { int retries = 0; while ...
= arrow_layer->arrow_bitmap.bounds; const GAlign arrow_alignment = PBL_IF_RECT_ELSE(GAlignTop, GAlignBottom); grect_align(&arrow_bounds, layer_bounds, arrow_alignment, false /* clip */); const int16_t arrow_nudge_y = PBL_IF_RECT_ELSE(7, -8); arrow_bounds.origin.y += arrow_nudge_y; // FIXME PBL-43428: // Fo...
prv_create_anim_frame_scroll((Layer *)swap_layer->previous, SWAP_MS, dy, NULL)
; Animation *current_down = prv_create_anim_frame_scroll((Layer *)swap_layer->current, SWAP_MS, dy, NULL); Animation *next_down = prv_create_anim_frame_scroll((Layer *)swap_layer->next, SWAP_MS, dy, NULL);...
/* * 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 (coredump_mode) { delay_us(dev->state->part->reset_latency_ms * 1000); } else { psleep(dev->state->part->reset_latency_ms); }
// Return the flash to Quad SPI mode, all our commands are quad-spi and it'll just cause // problems/bugs for someone if it comes back in single spi mode qspi_indirect_write_no_addr_1line(dev->qspi, dev->state->part->instructions.enter_quad_mode); if (!coredump_mode) { prv_check_whoami(dev); } qspi_...
t functions static int prv_alarm_comparator(void *a, void *b) { AlarmNode *alarm_a = (AlarmNode*) a; AlarmNode *alarm_b = (AlarmNode*) b; // Sort by alarm time, with 12:00AM being the starting point if (alarm_a->info.hour > alarm_b->info.hour) { return true; } if (alarm_a->info.hour == alarm_b->info.h...
app_window_stack_insert_next(editor)