prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
the accessor functions GColor8 test_value; property_animation_get_from_gcolor8(prop_h, &test_value); cl_assert(gcolor_equal(test_value, start_value)); property_animation_get_to_gcolor8(prop_h, &test_value); cl_assert(gcolor_equal(test_value, end_value)); GColor8 set_value; set_value = (GColor8) {.a=0, ...
(&layer, &from_r, &to_r)
; Animation *h = property_animation_get_animation(prop_h); void *context = &layer; animation_set_handlers(h, handlers, context); animation_set_duration(h, duration); animation_set_auto_destroy(h, false); prv_clear_handler_histories(); animation_schedule(h); int max_loops = 20; uint64_t start_ms = p...
v_select_reset(int index, void *context) { system_reset(); } static void prv_select_shutdown(int index, void *context) { enter_standby(RebootReasonCode_ShutdownMenuItem); } static GBitmap * prv_get_icon_for_test(MfgTest test) { #if MFG_INFO_RECORDS_TEST_RESULTS const bool passed = mfg_info_get_test_result(test)...
(s_menu_items)
; } static void prv_window_load(Window *window) { MfgMenuAppData *data = app_state_get_user_data(); Layer *window_layer = window_get_root_layer(data->window); GRect bounds = window_layer->bounds; #ifdef PLATFORM_SPALDING bounds.origin.x += 25; bounds.origin.y += 25; bounds.size.w -= 50; bounds.size.h -=...
/* * 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...
sys_event_service_cleanup(e)
; }
/* * 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...
option_menu_set_choice(&data->option_menu, prv_get_chosen_row_index(data))
; option_menu_reload_data(&data->option_menu); } // Settings Menu callbacks /////////////////////////// static void prv_select_cb(OptionMenu *option_menu, int row, void *context) { SettingsActivityTrackerData *data = context; if (app_menu_data_source_get_count(data->data_source) == 0) { return; } if (ro...
; cl_assert(fd >= 0); // Get a directory listing with no filtering PFSFileListEntry *dir_list; dir_list = pfs_create_file_list(NULL); // Should have 4 entries in it cl_assert_equal_i(list_count(&dir_list->list_node), 4); cl_assert(list_find(&dir_list->list_node, prv_find_name, "a_test_0")); cl_assert(...
prv_file_exists("a_test_0")
, false); cl_assert_equal_b(prv_file_exists("a_test_1"), false); cl_assert_equal_b(prv_file_exists("b_test_0"), true); cl_assert_equal_b(prv_file_exists("b_test_1"), true); } void test_pfs__doesnt_give_out_fd_zero(void) { for (int i = 5; i > 0; --i) { char filename[20]; sprintf(filename, "test%d", i); ...
phics_context_set_antialiased(ctx, true); graphics_context_set_stroke_width(ctx, data->stroke_width); graphics_draw_line(ctx, p1, p2); graphics_draw_line(ctx, p3, p0); /* graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, true); graphics_context_set...
GPoint(x1, y1)
, GPoint(x2, y2)); } static void main_window_load(Window *window) { AppData *data = window_get_user_data(s_window); Layer *window_layer = window_get_root_layer(window); window_set_background_color(window, GColorBlack); GRect window_bounds = window_layer->bounds; data->debug_layer = layer_create(window_bound...
/* * 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...
delay_ms(200)
; display_boot_splash(); delay_ms(1000); } } #endif void display_init(void) { display_start(); if (!prv_reset_fpga()) { dbgserial_putstr("FPGA configuration failed."); return; } // enable the power rails display_power_enable(); // start with the screen off prv_screen_off(); // Work...
ll_prefs_set_clock_24h_style(bool is24h) { prv_pref_set(PREF_KEY_CLOCK_24H, &is24h, sizeof(is24h)); } bool shell_prefs_is_timezone_source_manual(void) { return s_clock_timezone_source_is_manual; } void shell_prefs_set_timezone_source_manual(bool manual) { prv_pref_set(PREF_KEY_CLOCK_TIMEZONE_SOURCE_IS_MANUAL, &...
app_install_get_uuid_for_install_id(app_id, &pref.uuid)
/* * 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...
uuid_is_invalid(&test_uuid_1)
); } void test_uuid__string(void) { char buffer[UUID_STRING_BUFFER_LENGTH]; const Uuid test_uuid_1 = (Uuid) { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; uuid_to_string(&test_uuid_1, buffer); cl_assert_equal_s(buffer, "{00010203-0405-0607-0809-000102030405}"); const Uuid system = UUID_SYSTEM; ...
/* * 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_DEBUG, "Golf sync error! dict: %u, app msg: %u", dict_error, app_message_error)
; } static void sync_tuple_changed_callback(const uint32_t key, const Tuple *new_tuple, const Tuple *old_tuple, void *context) { AppData *data = context; TextLayer **text = &data->text_layers[0]; switch (key) { case GOLF_BACK_KEY: case GOLF_MID_KEY: case GOLF_FRONT_K...
/* * 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...
{ state->special_codepoint_handler_cb(ctx, codepoint, cursor, state->special_codepoint_handler_context); }
return; } const GlyphData* glyph = text_resources_get_glyph(&ctx->font_cache, codepoint, font); PBL_ASSERTN(glyph); // Bitfiddle the metrics data: GRect glyph_metrics = get_glyph_rect(glyph); // Calculate the box that we intend to draw to the screen, in screen coordinates GRect glyph_target = { ...
/* * 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...
list_count_to_tail_from(list_get_head(node))
; } ListNode* list_get_at(ListNode *node, int32_t index) { while (node != NULL && index != 0) { if (index > 0) { node = node->next; index--; } else { node = node->prev; index++; } } return node; } ListNode* list_sorted_add(ListNode *node, ListNode *new_node, Comparator compar...
/* * 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...
{ char testbuf[9] = "hi\0five"; cl_assert_equal_i(strlen(testbuf), 2); }
alerts_preferences_set_vibrate(enable)
; } void alerts_set_mask(AlertMask mask) { alerts_preferences_set_alert_mask(mask); } void alerts_set_dnd_mask(AlertMask mask) { alerts_preferences_dnd_set_mask(mask); } void alerts_set_notification_vibe_timestamp() { // if we do vibrate, update timestamp of last vibration s_notification_vibe_tick_timestamp ...
// Only 1 pin should be added (for Saturday) cl_assert_equal_i(s_num_timeline_adds, 1); id2 = alarm_create(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_WEEKENDS }); prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_WEEKENDS, s_weekend_schedule); cl_assert_equal_i(s_num_timeline_adds, 2); ...
cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time())
; // First alarm goes off. Second one should be up s_current_hour = 10; s_current_minute = 30; s_current_day = s_friday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 3); cl_assert_equal_i(s_num_alarm_events_put, 3); cl_assert_equal_i(s_num_timeline_adds, 14); cl_assert_equal_i(s_num_t...
HRMEvent_BPM, .bpm = { .bpm = data->hrm_bpm, .quality = data->hrm_quality, }, }; break; case HRMFeature_HRV: *event = (PebbleHRMEvent) { .event_type = HRMEvent_HRV, .hrv = { .ppi_ms = data->hrv_ppi_ms, .quality = data->hrv_qu...
(&hrm_event, feature, data)
; PBL_ASSERTN(prv_event_put(state, &hrm_event)); } // If this is an app subscription, see if we need to send an "expiring" event. We check // KernelBG subscribers from the system callback function (prv_system_task_hrm_handler). if (!state->callback_handler && prv_needs_expiring_event(state, utc_n...
ay(b, delay_b); Animation *seq = animation_sequence_create(a, b, NULL); animation_set_handlers(seq, handlers, seq); animation_schedule(seq); // The duration of seq should include all of a and b uint32_t duration = animation_get_duration(seq, true, true); cl_assert_equal_i(duration, duration_a + delay_a + ...
cl_assert_equal_i(position, -delay_seq)
} // Make sure the frame reached the "to" state cl_assert_equal_point(layer.frame.origin, to_r.origin); // ------------------------------------------------------------------------------- // Now, reschedule it prv_advance_by_ms_no_timers(10); prv_clear_handler_histories(); animation_schedule(h); max_l...
prv_clear_handler_histories()
; // Before we run, the context should be non NULL cl_assert(animation_get_context(h) == context); animation_schedule(h); int max_loops = 20; uint64_t start_ms = prv_now_ms(); uint64_t time_ms; while (s_stopped_handler_calls.num_calls == 0) { prv_fire_animation_timer(); time_ms = prv_now_ms();...
d *)(uintptr_t) inbox->tag, }, }; const bool is_event_enqueued = process_manager_send_event_to_process(inbox->event_handler_task, &event); if (!is_event_enqueued) { PBL_LOG(LOG_LEVEL_ERROR, "Event queue full"); } inbox->has_pending...
prv_find_inbox_by_tag(tag)
!= NULL); prv_unlock(); return has_inbox; } bool app_inbox_service_has_inbox_for_storage(uint8_t *storage) { bool has_inbox; prv_lock(); has_inbox = (prv_find_inbox_by_storage(storage) != NULL); prv_unlock(); return has_inbox; } bool app_inbox_service_is_being_written_for_tag(AppInboxServiceTag tag) { ...
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 in writ...
(animation)
}; // Save a reference to the existing draw implementation const GDrawRawImplementation *saved_draw_implementation = ctx->draw_state.draw_implementation; // Replace the draw implementation with one that fills horizontal lines using the app framebuffer ctx->draw_state.draw_implementation = &g_compositor_tra...
/* * 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...
watch_info_get_firmware_version()
; snprintf(buffer, 64, "Version: %d.%d.%d\nColor: %d\nModel: %d", version.major, version.minor, version.patch, color, model); text_layer_set_text(text_layer, buffer); text_layer_set_text_alignment(text_layer, GTextAlignmentCenter); layer_add_child(window_layer, text_layer_get_layer(text_layer)); } static 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...
{ for(size_t i = 0; i < ARRAY_LENGTH(s_truncation_tests); i++) { #if DEBUG_PRINTING printf("size: %zu\n", s_truncation_tests[i].size); printf("intime: %jd\n", s_truncation_tests[i].intime); printf("input: \"%s\"\n", s_truncation_tests[i].instr); printf("result: \"%s\"\n", s_truncation_tests[i].output)...
//////////////////////////////////////////////////////////////////////////////////////////////////// // Test NULL arguments void test_template_string__null_arguments(void) { { TemplateStringVars vars = {}; TemplateStringError err = {}; TemplateStringEvalConditions cond = {}; vars.current_time = 0; ...
draw_vertical_line_dotted(&ctx, GPoint(101, 33), 5); graphics_draw_horizontal_line_dotted(&ctx, GPoint(97, 37), 10); // T facing left - lined up graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 70), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(5, 76), 5); // T facing right - even vert, odd hor...
graphics_draw_vertical_line_dotted(&ctx, GPoint(100, 70), 10)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(101, 75), 5); // T facing left - odd vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(131, 71), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(132, 76), 5); // T facing right - lined up graphics_draw_vertical_line_dotted(&ctx, GP...
DCDC, DCDC_V18P_1_REG, DCDC_V18P_ENABLE_LV, 0x0); REG_SETF(DCDC, DCDC_V18P_1_REG, DCDC_V18P_CUR_LIM_MAX_LV, 0xF); REG_SETF(DCDC, DCDC_V18P_1_REG, DCDC_V18P_IDLE_HYST, 0x4); REG_SETF(DCDC, DCDC_V18P_1_REG, DCDC_V18P_IDLE_MIN, 0x10); REG_SETF(DCDC, DCDC_RET_0_REG, DCDC_V18P_RET_CYCLES, 0x5); REG_SETF(DCDC, DCD...
(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_RXD_NEG, 0x0)
ontext); graphics_context_set_stroke_width(&context, 0); cl_assert(memcmp(&draw_state, &context.draw_state, sizeof(GDrawState)) == 0); // Check draw state memset(&draw_state, 0x5A, sizeof(GDrawState)); graphics_context_set_drawing_state(&context, draw_state); cl_assert(memcmp(&draw_state, &context.draw_sta...
(&context, false, SW_EVEN, GColorBlack, GColorBlack, 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...
custom_reel->impl->get_elapsed(reel)
; } return 0; } static bool prv_elapsed_setter(KinoReel *reel, uint32_t elapsed_ms) { KinoReelImplCustom *custom_reel = (KinoReelImplCustom *)reel; if (custom_reel->impl->set_elapsed) { return custom_reel->impl->set_elapsed(reel, elapsed_ms); } return false; } static uint32_t prv_duration_getter(Kin...
56, "%.0uzero%.0u", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (unspecified digits, acts as zero) snprintf(dstbuf, 256, "%.uzero%.u", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.-3uzero%.-3u", 0, 1); ...
snprintf(dstbuf, 256, "%llo,%jo", hurf, hurf)
; cl_assert_equal_s(dstbuf, "110642547423257157360,110642547423257157360"); snprintf(dstbuf, 256, "%zo,%to", hurf, hurf); cl_assert_equal_s(dstbuf, "23257157360,23257157360"); } void test_sprintf__percent_x(void) { char dstbuf[256]; // Simple %x snprintf(dstbuf, 256, "There are %x lights, %x", 16, -4); ...
r)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); cl_assert(state.node); } void test_timeline__none_forwards(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &hea...
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[1].header.id))
; cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[0].header.id)); cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[1].header.id)); #if !CAPABILITY_HAS_CORE_NAVIGATION4 cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(...
bugInfoEventState state) { PebbleEvent event = { .type = PEBBLE_GATHER_DEBUG_INFO_EVENT, .debug_info = { .source = DebugInfoSourceFWLogs, .state = state, }, }; event_put(&event); } static bool prv_bt_log_dump_line_cb(uint8_t *message, uint32_t total_length) { CommSession *session = s_bt...
prv_flash_logging_bluetooth_dump(session, generation, cookie)
e "kernel/util/sleep.h" #include "kernel/util/stop.h" #include "services/common/analytics/analytics.h" #include "services/common/analytics/analytics_logging.h" #include "services/common/bluetooth/bluetooth_ctl.h" #include "services/common/system_task.h" #include "system/hexdump.h" #include "system/logging.h" #include "...
TIM_Cmd(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, DISABLE)
; TIM_ITConfig(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, TIM_IT_Update, DISABLE); periph_config_disable(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, RCC_APB1Periph_TIM6); s_spi_transport.watchdog_timer_active = false; } static void prv_watchdog_start(void) { prv_lock(); if (!s_spi_transport.watchdog_timer_activ...
ramebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); const GContextInitializationMode context_init_mode = GContextInitializationMode_System; graphics_context_init(&s_ctx, fb, context_init_mode); framebuffer_clear(fb); // Setup resources fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(tr...
(&s_ctx.dest_bitmap, TEST_PBI_FILE_X(details2))
); #endif } void test_timeline_layouts__weather(void) { const TimelineLayoutTestConfig config = (TimelineLayoutTestConfig) { .layout_id = LayoutIdWeather, .title = "The Greatest Sunrise Ever", .subtitle = "90°/60°", .location_name = "Redwood City", .body = "A clear sky. Low around 60F.", .ico...
/* * 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...
{ content_indicator = content_indicator_create(); cl_assert(content_indicator); helper_check_buffer_for_content_indicator(i, content_indicator); }
// Creating more content indicators than the buffer can hold should return NULL cl_assert_equal_p(content_indicator_create(), NULL); } void test_content_indicator__init_should_add_to_buffer(void) { ContentIndicator content_indicator; for (size_t i = 0; i < CONTENT_INDICATOR_BUFFER_SIZE; i++) { content_in...
/* * 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...
memory_layout_is_pointer_in_region(&region, (void*) 1500)
); cl_assert(memory_layout_is_pointer_in_region(&region, (void*) 1999)); cl_assert(!memory_layout_is_pointer_in_region(&region, (void*) 2000)); cl_assert(!memory_layout_is_pointer_in_region(&region, (void*) 9999)); } void test_memory_layout__cstring_in_region(void) { const char buffer[] = "yyyxxxstrstr\0badstr...
break; } } return id_out; } // ---------------------------------------------------------------------------------------------- static int prv_get_day_for_just_once_alarm(int hour, int minute) { // Figure out what day the alarm should happen struct tm local_time; const time_t current_time = rtc_get_time(...
{ prv_assert_alarm_params(hour, minute); prv_alarm_operation(id, prv_set_alarm_time_op, &(SetAlarmTimeContext) { hour, minute }); }
// ---------------------------------------------------------------------------------------------- static bool prv_set_alarm_smart_op(AlarmId id, AlarmConfig *config, void *context) { config->is_smart = (uintptr_t)context; return true; } void alarm_set_smart(AlarmId id, bool smart) { prv_alarm_operation(id, prv...
larm) { PBL_ASSERT(alarm->id >= 0 && alarm->id < MAX_CONFIGURED_ALARMS, "Invalid id %d", alarm->id); AlarmStorageKey key = { .id = alarm->id, .type = ALARM_DATA_CONFIG }; AlarmConfig config = { .kind = alarm->config.kind, .is_disabled = alarm->config.is_disabled, .hour = alarm->config.hour, .minu...
{ PBL_ASSERT(hour < 24 && hour >= 0, "Invalid hour value, %d", hour); PBL_ASSERT(minute < 60 && minute >= 0, "Invalid minute value, %d", minute); }
// ---------------------------------------------------------------------------------------------- static void prv_enable_alarm_config(AlarmConfig *config, bool enable) { config->is_disabled = !enable; if (enable && config->kind == ALARM_KIND_JUST_ONCE) { // Update the day required for the alarm prv_set_da...
/* * 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_send_footer()
ice_deinit(); kernel_free(s_test_data); } static size_t s_consumer_data_length = 1; static void prv_register(void) { app_outbox_service_register(AppOutboxServiceTagUnitTest, prv_message_handler, PebbleTask_KernelMain, s_con...
(AppOutboxStatusSuccess)
; } fake_kernel_malloc_mark_assert_equal(); } void test_app_outbox__unregister_with_pending_message(void) { fake_kernel_malloc_mark(); prv_register(); app_outbox_send(s_test_data, s_test_data_length, test_app_outbox_sent_handler, s_expected_cb_ctx); cl_assert(s_last_message); app_out...
cl_assert_equal_b(s_unscheduled_completed, true); // Unschedule job "A" regular_timer_fire_seconds(1); cl_assert_equal_i(s_unscheduled_cb_count, 2); cl_assert_equal_p(s_unscheduled_job, job_a); cl_assert_equal_b(s_unscheduled_completed, true); cl_assert(!gap_le_is_advertising_enabled()); free(ad_a);...
gap_le_advert_schedule(ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0)
; cl_assert_equal_p(job, NULL); // No terms: job = gap_le_advert_schedule(ad, NULL, 0, unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert_equal_p(job, NULL); // No ad data: advert_term.min_interval_slots = 200; advert_term.max_interval_slots = 200; advert_term.du...
, dev->state->part->instructions.reset); 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 ...
{ uint8_t instruction; uint8_t dummy_cycles; bool is_ddr; prv_get_fast_read_params(dev, &instruction, &dummy_cycles, &is_ddr); prv_read_mmap_with_params(dev, addr, buffer, length, instruction, dummy_cycles, is_ddr); }
void qspi_flash_read_blocking(QSPIFlash *dev, uint32_t addr, void *buffer, uint32_t length) { // TODO: Figure out what thresholds we should use when switching between memory mapping, DMA, & // polling PBL-37438 bool should_use_dma = length > 128 && !dev->state->coredump_mode; bool should_use_memmap = length >...
/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 * limitations un...
cl_assert_equal_i(stub_new_timer_timeout(timer->id), 5000)
_battery_state.percent)); PWR_TRACK_BATT(charging ? "CHARGING" : "DISCHARGING", s_last_battery_state.voltage); if (forced || likely_stable || s_last_battery_state.percent <= ALWAYS_UPDATE_THRESHOLD || charging || state_changed) { battery_state_put_change_event(prv_get_precise_charge_state(&s_last_batter...
(buffer, 32, "plugged: %s", state.is_plugged ? "YES" : "NO")
or_create_new_alarm(prv_handle_alarm_editor_complete, data); app_window_stack_push(editor, true); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Menu Layer Callbacks static bool prv_is_add_alarm_cell(MenuIndex *cell_index) { return cell_index->row == 0; ...
graphics_context_set_compositing_mode(ctx, GCompOpTint)
; // If the alarm is not smart, use the icon as spacing but don't render it. // Otherwise if the alarm is smart draw according to the menu highlight. graphics_context_set_tint_color(ctx, !node->info.is_smart ? GColorClear : (cell_layer->is_highlighted ? GColorWhite : GColorB...
e_gatt_client_op_set_write_return_value(BTErrnoNotEnoughResources); // Receive data (that needs to be ack'd): uint8_t sn = 0; prv_receive_short_data_fragment(s_characteristics[0][PPoGATTCharacteristicData], sn); fake_gatt_client_op_assert_no_write(); // Receive Reset Request: prv_receive_reset_request(s_ch...
prv_assert_sent_ack(s_characteristics[0][PPoGATTCharacteristicData], sn)
info(&pairing_1, true), false); cl_assert_equal_b(bonding_sync_contains_pairing_info(&pairing_2, true), true); cl_assert_equal_b(bonding_sync_contains_pairing_info(&pairing_3, false), false); } void test_bluetooth_persistent_storage_prf__get_ble_by_address(void) { bool ret; // Output variables SMIdentityRes...
(&addr_1, &link_key_1, name_1, &platform_bits_1)
; prv_fire_writeback_timer(); cl_assert(id_1 != BT_BONDING_ID_INVALID); // Read it back ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_1, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_1, &add...
ense. */ #include "dbgserial.h" #include "drivers/gpio.h" #include "drivers/periph_config.h" #include "stm32f7haxx_rcc.h" #include "stm32f7haxx_gpio.h" #include "util/attributes.h" #include "util/cobs.h" #include "util/crc32.h" #include "util/net.h" #include "util/misc.h" #include <stdint.h> #include <string.h> #d...
for (size_t i = 0; i < cooked_length; ++i) { if (cooked_packet[i] == FRAME_DELIMITER) { prv_putchar('\0'); } else { prv_putchar(cooked_packet[i]); } }
prv_putchar(FRAME_DELIMITER); s_message_length = 0; } void dbgserial_putstr(const char* str) { dbgserial_print(str); dbgserial_newline(); } void dbgserial_print_hex(uint32_t value) { char buf[12]; itoa_hex(value, buf, sizeof(buf)); dbgserial_print(buf); }
icePacketLengthExtension)) { return ATT_ERROR_INVALID_VALUE_LENGTH; } #if !SUPPORTS_PACKET_LENGTH_EXTENSION return ((att_error_t)PebblePairingServiceGATTError_DeviceDoesNotSupportPLE); #else if (ple_req->trigger_ll_length_req) { extern void hci_initiate_length_change(uint16_t conn_idx); hci_initiate_...
(connection)
) { return; } prv_send_notification(conn_idx, s_pps_ctx.att_hdl.conn_params); } static void prv_convert_uuid_to_little_endian(const uint8_t *buf, att_uuid_t *uuid) { uint8_t *reverse_uuid = (uint8_t *)&UuidMakeFromLEBytes(buf); ble_uuid_from_buf(reverse_uuid, uuid); } static void prv_register(PebblePairin...
0x55, 0x65, 0x72, 0x22, 0xb4}, .timestamp = 0, .duration = 0, .type = TimelineItemTypeReminder, } // don't care about the rest }; static TimelineItem item2 = { .header = { .id = {0x55, 0xcb, 0x7c, 0x75, 0x8a, 0x35, 0x44, 0x87, 0x90, 0xa4, 0x91, 0x3f, 0x1f, 0xa6, 0x76, 0x01}, .time...
fake_system_task_callbacks_invoke(1)
; cl_assert_equal_i(num_events_put, 5); cl_assert(!new_timer_scheduled(get_reminder_timer_id(), NULL)); } void test_reminders__first_init_test(void) { cl_assert_equal_i(reminders_init(), 0); test_reminders__timer_test(); } static TimelineItem s_stale_reminder = { .header = { .id = {0x3C, 0xAF, 0x17, 0x...
/* * 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_font_info, 0, sizeof(s_font_info))
; memset(&s_font_cache, 0, sizeof(s_font_cache)); FontCache *font_cache = &s_font_cache; memset(font_cache->cache_keys, 0, sizeof(font_cache->cache_keys)); memset(font_cache->cache_data, 0, sizeof(font_cache->cache_data)); keyed_circular_cache_init(&font_cache->line_cache, font_cache->cache_keys, ...
sets_counter = 0; if (LIKELY(client->state == StateConnectedClosedAwaitingResetCompleteSelfInitiatedReset)) { client->out.reset_packet_to_send = (const PPoGATTPacket) { .sn = 0, .type = PPoGATTPacketTypeResetComplete, }; prv_send_next_packets(client); } client->state = StateConnectedOpen...
prv_next_sn(client->in.next_expected_data_sn)
/* * 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...
(metric_group->icons)
; task_free(metric_group); } bool metric_group_add_item(MetricGroup *metric_group, const char *name_i18n, const char *value, TimelineResourceId icon, void *i18n_owner) { if (metric_group->num_items >= metric_group->max_num_items) { return false; } const size_t max_list_size = Str...
/* * 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...
(state, ResponseTimeMiddle)
300, -8}, { 836, 274, -10}, { 900, 279, 6}, { 1147, 329, 35}, { 1264, 397, 37}, { 1291, 430, 50}, { 1463, 552, -62}, { 1181, 488, 98}, { 1230, 398, 124}, { 1088, 342, 80}, { 887, 334, 72}, { 807, 307, 101}, { 787, 244, 130}, { 834, 197, 187}, { 878, 176, 196}, ...
{ 1006, 381, 76}, { 891, 306, 94}, { 802, 247, 102}, { 786, 209, 130}, { 808, 190, 170}, { 849, 184, 148}, { 805, 192, 160}, { 992, 203, 211}, { 1177, 186, 234}, { 1227, 262, 142}, { 1351, 255, 203}, { 1120, 343, 50}, { 929, 424, -161}, { 938, 334, -27}, { 941...
ata); const int typical_sleep_start_12h = typical_sleep_start_24h % TWELVE_HOURS; const int typical_sleep_end_24h = health_data_sleep_get_typical_end_time(data->health_data); const int typical_sleep_end_12h = typical_sleep_end_24h % TWELVE_HOURS; const int typical_start = (typical_sleep_start_1...
layer_get_data(base_layer)
; const int typical_sleep = health_data_sleep_get_cur_wday_average(data->health_data); char sleep_text[32]; if (typical_sleep) { health_util_format_hours_and_minutes(sleep_text, sizeof(sleep_text), typical_sleep, base_layer); } else { snprintf(sleep_text, sizeof(sleep_text), EM_DASH); } health_u...
(&(status_bar_layer->layer))
; } // Sets info text either ot X/Y or percentage if total is larger than MAX_INFO_TOTAL void status_bar_layer_set_info_progress(StatusBarLayer *status_bar_layer, uint16_t current, uint16_t total) { PBL_ASSERTN(status_bar_layer); if (c...
er_insets_left >>= 4 * MIN(top_cropped_rows_count, 8); corner_insets_right >>= 4 * MIN(top_cropped_rows_count, 8); } // Mark the destination dirty before clipped_rect is modified. graphics_context_mark_dirty_rect(ctx, clipped_rect); // bit-block fiddling: const int16_t max_y = clipped_rect.origin.y + cl...
prv_fill_rect_legacy2(ctx, GRect(top_rect_origin_x, rect->origin.y, top_rect_size_w, radius), 0, GCornerNone, fill_color)
raw_command_image_draw_processed(ctx, image, offset, &processor); } ////////////// // MenuLayer callbacks static const uint8_t BAR_PX = 9; static const uint8_t BAR_SELECTED_PX = 12; static void prv_draw_notification_cell_rect(GContext *ctx, const Layer *cell_layer, const c...
(ctx, title_font, box, title, GAlignCenter)
; } } static void prv_draw_notification_cell_round_selected(GContext *ctx, const Layer *cell_layer, const char *title, const char *subtitle, GDrawCommandImage *icon) { // as measured from the design specs ...
dler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); // Start prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_...
prv_count_handler_entries(&s_teardown_handler_calls, a)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0); // Make sure seq, c, and d completed cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_h...
/* * 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...
DEFINE_SYSCALL(BTErrno, sys_ble_client_read, BLECharacteristic characteristic)
{ return gatt_client_op_read(characteristic, GAPLEClientApp); } DEFINE_SYSCALL(bool, sys_ble_client_get_notification_value_length, BLECharacteristic *characteristic_out, uint16_t *value_length_out) { if (PRIVILEGE_WAS_ELEVATED) { if (characteristic_out) { syscal...
PBL_ASSERTN(val_len <= file->iter.hdr.val_len)
; settings_raw_iter_set_current_record_pos(&file->iter, file->cur_record_pos); settings_raw_iter_read_val(&file->iter, val, val_len); } status_t settings_file_each(SettingsFile *file, SettingsFileEachCallback cb, void *context) { // Cannot set keys while iterating PBL_ASSERTN(file->c...
I_StructInit(&spi_cfg); spi_cfg.SPI_Direction = SPI_Direction_2Lines_FullDuplex; spi_cfg.SPI_Mode = SPI_Mode_Master; spi_cfg.SPI_DataSize = SPI_DataSize_8b; spi_cfg.SPI_CPOL = SPI_CPOL_High; spi_cfg.SPI_CPHA = SPI_CPHA_2Edge; spi_cfg.SPI_NSS = SPI_NSS_Soft; spi_cfg.SPI_BaudRatePrescaler = spi_find_prescal...
(DISP_SPI, SPI_I2S_FLAG_TXE)
) continue; SPI_I2S_SendData(DISP_SPI, d); } uint8_t display_write_and_read_byte(uint8_t d) { SPI_I2S_ReceiveData(DISP_SPI); while (!SPI_I2S_GetFlagStatus(DISP_SPI, SPI_I2S_FLAG_TXE)) continue; SPI_I2S_SendData(DISP_SPI, d); while (!SPI_I2S_GetFlagStatus(DISP_SPI, SPI_I2S_FLAG_RXNE)) continue; return SPI_I...
x, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax2_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); } #define OFFSET_RECT_NO_CLIP GRect...
(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 4)
; graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 4); graphics_draw_round_rect(&ctx, &OFFSET_DR...
/* * 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_render(window, fake_graphics_context_get_context())
; } // Tests ////////////////////// void test_timeline_no_events__future(void) { prv_create_no_events_and_render(false /* past */); FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE(); } void test_timeline_no_events__past(void) { prv_create_no_events_and_render(true /* past */); FAKE_GRAPHICS_CONTEXT_CHECK_DEST_B...
sizeof(CommSession)); if (!session) { PBL_LOG(LOG_LEVEL_ERROR, "Not enough memory for new CommSession"); return NULL; } *session = (const CommSession) { .transport = transport, .transport_imp = implementation, .destination = destination, }; s_session_head = (CommSession *) list_prepend((L...
(session, is_callback)
ber); // Write the actual log message. strncpy(contents->message, message, sizeof(contents->message)); size_t payload_length = MIN(sizeof(MessageContents), offsetof(MessageContents, message) + strlen(message)); return payload_length; } static void prv_send_pulse_packet(uint8_t ...
portEXIT_CRITICAL()
; } void pulse_logging_init(void) { circular_buffer_init(&s_isr_log_buffer, s_isr_log_buffer_storage, sizeof(s_isr_log_buffer_storage)); } void pulse_logging_log(uint8_t log_level, const char* src_filename, uint16_t src_line_number, const char* message) { if (portIN_C...
MessageCtxOutbox *outbox) { if (outbox->ack_nack_timer) { app_timer_cancel(outbox->ack_nack_timer); outbox->ack_nack_timer = NULL; } } void app_message_outbox_close(AppMessageCtxOutbox *outbox) { // Verify outbox phase. if (outbox->phase == OUT_CLOSED) { return; } // Cancel any outstanding tim...
prv_transition_to_accepting(outbox)
; return; } } } AppMessageResult app_message_outbox_send(void) { AppMessageCtxOutbox *outbox = &app_state_get_app_message_ctx()->outbox; if (prv_is_message_pending(outbox->phase)) { PBL_LOG(LOG_LEVEL_ERROR, "Can't call app_message_outbox_send() now, wait for sent_callback!"); return APP_MSG_BUS...
/ 2)) { int16_t x1_rounded = (x1.raw_value + (FIXED_S16_3_ONE.raw_value / 2)) / FIXED_S16_3_ONE.raw_value; int16_t x2_rounded = (x2.raw_value + (FIXED_S16_3_ONE.raw_value / 2)) / FIXED_S16_3_ONE.raw_value; prv_assign_line_horizontal_non_aa(ctx, y, x1_roun...
(ctx, framebuffer, &ctx->draw_state.clip_box, y, x1, x2, delta1, delta2, ctx->draw_state.stroke_color)
; graphics_release_frame_buffer(ctx, framebuffer); } #endif // PBL_COLOR void graphics_private_draw_horizontal_line_delta_non_aa(GContext *ctx, int16_t y, Fixed_S16_3 x1, Fixed_S16_3 x2, Fixed_S16_3 delta1, Fixed...
s_pending_did_write.active); cl_assert(s_pending_did_write.attribute == attribute); s_pending_did_write.active = false; } static void prv_prepare_for_notified(SmartstrapAttribute *attribute) { cl_assert(!s_pending_notified.active); s_pending_notified = (PendingInfo) { .active = true, .attribute = attri...
app_smartstrap_attribute_create(0x1111, 0x2222, 100)
; // start a read request stub_pebble_tasks_set_current(PebbleTask_App); assert_result_ok(app_smartstrap_attribute_read(attr)); // attempt to issue another read request assert_result_busy(app_smartstrap_attribute_read(attr)); // trigger the read request to be sent and expect a did_write handler call st...
d the driver // will configure the accelerometer in the highest power mode and with the highest sampling rate // required according which operating modes are enabled and what the requirements are thereof. typedef enum { AccelOperatingModeData, AccelOperatingModeShakeDetection, AccelOperatingModeDoubleTapDetectio...
(readings[cfg->axes_offsets[AXIS_Z]])
return jerry_create_undefined(); } GContext *rocky_api_graphics_get_gcontext(void) { return app_state_get_graphics_context(); } static jerry_value_t prv_rect_precise_call(const jerry_length_t argc, const jerry_value_t argv[], void (*func)(GContext *, const GRectPrecise *)) { ...
prv_graphics_get_color_string(rocky_api_graphics_get_gcontext()->draw_state.fill_color)
; } JERRY_FUNCTION(prv_fill_radial) { // pblFillRadial(cx, cy, radius1, radius2, angle1, angle2) // TODO: PBL-40555 consolidate angle handling here and in rocky_api_path2d.c GPointPrecise center; Fixed_S16_3 radius1, radius2; double angle_1, angle_2; ROCKY_ARGS_ASSIGN_OR_RETURN_ERROR( ROCKY_ARG(cent...
cs_draw_line(ctx, right_t, right_b); // right // Draw quadrants const GPoint tl = GPoint(origin.x + radius, origin.y + radius); const GPoint tr = gpoint_add(tl, GPoint(width_actual - 1, 0)); const GPoint bl = gpoint_add(tl, GPoint(0, height_actual - 1)); const GPoint br = gpoint_add(tl, GPoint(width_actual...
(font_cache->cache_data, 0, sizeof(font_cache->cache_data))
; keyed_circular_cache_init(&font_cache->line_cache, font_cache->cache_keys, font_cache->cache_data, sizeof(LineCacheData), LINE_CACHE_SIZE); graphics_context_set_default_drawing_state(context, init_mode); } void graphics_context_set_default_drawing_state(GContext *ctx, ...
XT_COLOR (GColorBlack) #define TEXT_ALIGNMENT (PBL_IF_RECT_ELSE(GTextAlignmentLeft, GTextAlignmentRight)) #define BACKGROUND_COLOR PBL_IF_COLOR_ELSE(GColorYellow, GColorWhite) typedef enum WorkoutLayout { WorkoutLayout_SingleMetric, WorkoutLayout_StaticAndScrollable, WorkoutLayout_TwoStaticAndScrollable, } Worko...
("PACE (/KM)")
); #endif case WorkoutMetricType_Speed: #if PBL_RECT /// Speed Label return i18n_noop("SPEED"); #else /// Speed Label with units return active_window->workout_controller->get_distance_string(i18n_noop("SPEED (MPH)"), i18n_no...
12, "aaaa aaaa aaaa aaaa " // 0- 20 "aaaa aaaa aaaa aaaa " // 20- 40 "aaaa aaaa aaaa aaaa " // 40- 60 "aaaa aaaa aaaa aaaa " // 60- 80 "aaaa aaaa aaaa aaaa " // 80-100 "aaaa aaaa aaaa aaaa " //100-12...
cl_assert_equal_i(tntest[0], 280)
; cl_assert_equal_i(tntest[1], 0); }
/* * 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...
(str_buffer)
ECT_CLIP_NXNY, true, 11); 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_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__origin_sw(void) { GContext ctx; test_g...
(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 5)
; 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_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 5); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW...
at our periodic minute callback correctly detects the midnight rollover void test_activity__day_rollover(void) { // Start activity tracking. This method assumes it can be called from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_tracking(false /*test_mode*/); fa...
if (i == 1) { exp_resting_kcalories[i] = ROUND(s_exp_full_day_resting_kcalories * (MINUTES_PER_DAY - 1), MINUTES_PER_DAY); } else { exp_resting_kcalories[i] = s_exp_full_day_resting_kcalories; }
} ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricRestingKCalories, exp_resting_kcalories); // Verify that the expired and invalid activity session have been removed ASSERT_NUM_ACTIVITY_SESSIONS(0); // Verify that we have the right history capacity uint32_t exp_history[ACTIVITY_HISTORY_DAYS]; for (int i = 1;...
(text, &window->layer.bounds)
; text_layer_set_text(text, "Use select button and try different clicks: single, hold-to-repeat, multiple, long press, etc.\n\nNOTE: a long click config will override hold-to-repeat config. Comment out the long_click section of the config to enable hold-to-repeat."); layer_add_child(&window->layer, &text->layer); }...
alized_attribute_list_to_deserialize + serialized_attribute_list_to_deserialize_size; const uint8_t *buffer_size_cursor = serialized_attribute_list_to_deserialize; const int32_t buffer_size = attribute_get_buffer_size_for_serialized_attributes(num_attributes, &buffer_size_cursor, en...
( strlen(app_glance_subtitle_attributes->cstring) > ATTRIBUTE_APP_GLANCE_SUBTITLE_MAX_LEN)
; AttributeList app_glance_subtitle_attribute_list = { .num_attributes = ARRAY_LENGTH(app_glance_subtitle_attributes), .attributes = app_glance_subtitle_attributes, }; const uint8_t app_glance_subtitle_attribute_list_serialized[] = { 0x2F, // Attribute ID - App Glance Subtit...
/* * 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_get_root_layer(window)
; GRect bounds = window_layer->bounds; // Parameters outer_size = 50; inner_size = 0; angle_start = TRIG_MAX_ANGLE / 4; angle_end = TRIG_MAX_ANGLE; prv_setup_data(bounds); } static void prv_setup_odd_full(Window *window) { Layer *window_layer = window_get_root_layer(window); GRect bounds = window_l...
session_get_current_app_session(), legacy_app_session); stub_app_set_uuid(modern_app_uuid); cl_assert_equal_p(comm_session_get_current_app_session(), modern_app_session); stub_app_set_uuid((Uuid)UUID_INVALID); cl_assert_equal_p(comm_session_get_current_app_session(), NULL); stub_app_set_uuid((Uuid)UUID_SYS...
comm_session_open(transport, &transport_imp, TransportDestinationSystem)
; s_is_current_task_schedule_task = true; cl_assert_equal_b(comm_session_is_current_task_send_next_task(session), true); s_is_current_task_schedule_task = false; cl_assert_equal_b(comm_session_is_current_task_send_next_task(session), false); comm_session_close(session, CommSessionCloseReason_UnderlyingDiscon...
/* * 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...
DEFINE_SYSCALL(void, sys_profiler_init, void)
{ profiler_init(); } DEFINE_SYSCALL(void, sys_profiler_start, void) { profiler_start(); } DEFINE_SYSCALL(void, sys_profiler_stop, void) { profiler_stop(); } DEFINE_SYSCALL(void, sys_profiler_print_stats, void) { profiler_print_stats(); } DEFINE_SYSCALL(void, sys_profiler_node_start, ProfilerNode *node) { ...
rue *defer_transition = false; // These transitions are always valid if ((next_state == StateFinished) || (next_state == StateExiting) || (next_state == StateError)) { return next_state; } // This determines whether a transition is valid and whether the transition should be deferred // unt...
(data, false /* is_reverse */)
; prv_show_mic_text(data, i18n_noop("Listening")); break; case StateStopRecording: // Fold animation back prv_disable_select_click(data); prv_hide_mic_text(data); prv_show_unfold_animation(data, true /* is_reverse */); break; case StateWaitForResponse: // pulse ...
(GPointPrecise( \ (int16_t)((x) * FIXED_S16_3_FACTOR), \ (int16_t)((y) * FIXED_S16_3_FACTOR))) void test_rocky_api_graphics__fill_radial(void) { prv_global_init_and_set_ctx(); EXECUTE_SCRIPT( "ctx.rockyFillRadial(30, 40, 10, 20, 0, Math.PI);\n" ); cl_assert_equal_i(1, s_graphics_fill_radial_precise_...
( "ctx.lineWidth = 8;\n" "var w = ctx.lineWidth;\n" )
; cl_assert_equal_i(1, s_graphics_context_set_stroke_width.call_count); cl_assert_equal_i(8, s_graphics_context_set_stroke_width.last_call.width); ASSERT_JS_GLOBAL_EQUALS_I("w", s_graphics_context_set_stroke_width.last_call.width); EXECUTE_SCRIPT( "ctx.lineWidth = 2.1;\n" "var w = ctx.lineWidth;\n" ...
/* * 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...
((uint8_t *)&read_buffer, read_addr, sizeof(read_buffer))
; } static void prv_assert_driver_addr_is_addr1(void) { cl_assert_equal_b(s_last_driver_addr_is_null, false); cl_assert_equal_m(&s_last_driver_addr, &TEST_PINNED_ADDR_1, sizeof(s_last_driver_addr)); } static void prv_assert_driver_addr_is_addr2(void) { cl_assert_equal_b(s_last_driver_addr_is_null, false); cl_...
cl_assert_equal_b(false, s_last_driver_allow_cycling)
; prv_assert_driver_addr_is_addr1(); }
_buffer); switch (action->type) { case TimelineItemActionTypeOpenWatchApp: { // find parent app AppInstallId install_id = app_install_get_id_for_uuid(&item->header.parent_id); if (install_id == INSTALL_ID_INVALID) { // This should never happen... but we're not quite there yet ...
PBL_LOG(LOG_LEVEL_ERROR, "Action type not implemented: %d", action->type)
; break; } } /////////////////////////////////// //! Timeline datasource functions /////////////////////////////////// typedef struct { Uuid id; const char *name; } PrivateDataSourceInfo; static const PrivateDataSourceInfo s_data_sources[] = { { .id = UUID_NOTIFICATIONS_DATA_SOURCE, .name = i18...
orSuccess); } static const MusicServerImplementation s_dummy_server_implementation = {}; static void prv_set_dummy_server_connected(bool connected) { music_set_connected_server(&s_dummy_server_implementation, connected /* connected */); } void test_ams__dont_register_if_another_music_se...
prv_ams_command_for_music_command(MusicCommandPlay)
; fake_gatt_client_op_assert_write(remote_command, &ams_cmd, sizeof(ams_cmd), GAPLEClientKernel, true /* is_response_required */); } void test_ams__send_remote_command_non_kernel_main_task_then_disconnect(void) { prv_connect_ams(); // Simulate Music app calling music_command_s...
void *payload, uint32_t length) { // there can be 1 or more payloads if (!length || (length % sizeof(FlashCRCRequest))) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length); return; } const FlashCRCRequest *request = payload; const uint32_t num_entries = length / sizeof(FlashCRCRequest);...
if (s_curr_buf->is_valid && s_curr_buf->checksum == CRC32_RESIDUE && s_curr_buf->index) { // queue up processing of this frame and clear s_curr_buf so we'll switch to a new one system_task_add_callback_from_isr(prv_process_frame, s_curr_buf, &should_context_switch); } else { prv_reset_buffer(s_cur...
s_curr_buf = NULL; } else if (should_store && s_curr_buf->is_valid) { if (s_curr_buf->index < MAX_FRAME_LENGTH) { // store this byte s_curr_buf->data[(s_curr_buf->index)++] = data; s_curr_buf->checksum = crc32(s_curr_buf->checksum, &data, 1); } else { // too long! s_curr_buf...
/* * 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...
{ sector_end -= SECTOR_SIZE_BYTES; }
int erase_count = 0; // Do the upkeep immediately just in case we've spent awhile running without feeding the // watchdog before doing this erase operation. if (sector_start < sector_end) { // Now erase the leading subsectors... for (int32_t i = subsector_start; i < sector_start; i += SUBSECTOR_SIZE...
firmware. // // No attempt is made to set CONTROL to zero as it should already be set to // the reset value when this code executes. __asm volatile ( "cpsie if\n" // Clear PRIMASK and FAULTMASK "mov lr, 0xFFFFFFFF\n" "mov sp, %[initial_sp]\n" "bx %[reset_handler]\n" : : [init...
(&reset_vector, &initial_sp)
; if ((uintptr_t)reset_vector == 0xffffffff || (uintptr_t)initial_sp == 0xffffffff) { dbgserial_putstr("Firmware is erased"); return true; } return false; } static void sad_watch(uint32_t error_code) { dbgserial_putstr("SAD WATCH"); char error_code_buffer[12]; itoa(error_code, error_code_buf...
/* * 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...
(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */)
; resource_init(); // Reset data prv_set_data(&s_data, 0, 0, 0, 0); prv_set_unobstructed_area_height(0); s_clock_is_24h_style = false; // Init window window_init(&s_data.window, WINDOW_NAME("Kickstart")); window_set_user_data(&s_data.window, &s_data); window_set_window_handlers(&s_data.window, &(Win...
if (recognizer->number_of_clicks_counted >= 1 && recognizer->is_repeating == false) { int clicks_over = recognizer->number_of_clicks_counted; for(int i = 0; i < clicks_over; i++) { prv_dispatch_event(recognizer, ClickHandlerOffsetSingle, false); } } prv_click_reset(recognizer); } static void prv_...
(&recognizer->hold_timer)
; if (local_is_multi_click_enabled && false == recognizer->is_repeating) { const bool local_can_more_clicks_follow = prv_can_more_clicks_follow(recognizer); bool should_fire_multi_click_handler = ((recognizer->config.multi_click.last_click_only && local_can_more_clicks_follow) == false); bool reset_using...
/* * 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...
{ line_buffer[buffer_offset++] = ' '; }
char c = data[offset + i]; if (c < 32 || c > 126 || c == '`') // ` is used for log hash string delimiting { c = '.'; } line_buffer[buffer_offset++] = c; } // No need to pad after a partial ascii line, since we don't line up // anything after it. // Null terminat...
/* * 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...
pstring_equal(ps1, NULL)
); cl_assert(!pstring_equal(NULL, NULL)); } void test_pstring__equal_cstring(void) { const char *str1 = "Phil"; uint8_t ps1_buf[128]; PascalString16 *ps1 = (PascalString16 *)&ps1_buf; ps1->str_length = strlen(str1); memcpy(ps1->str_value, str1, strlen(str1)); const char *str2 = "PhilG"; cl_assert(p...
rvices/common/system_task.h" #include "system/passert.h" #include "system/reboot_reason.h" #include "system/reset.h" EventServiceInfo bt_state_change_event_info; typedef enum { BtTestStateInit = 0, BtTestStateStopped, BtTestStateStarting, BtTestStateStopping, BtTestStateStarted, BtTestStateFailed, BtTes...
text_layer_set_font(title, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD))
; text_layer_set_text(title, "BT Test Mode"); layer_add_child(&window->layer, &title->layer); TextLayer *status = &data->status; text_layer_init(status, &GRect(0, 50, window->layer.bounds.size.w, window->layer.bounds.size.h - 30)); text_layer_set_font(status, fonts_get_system_font(FONT_KEY_...
; attribute_list_add_cstring(&dismiss_attr_list, AttributeIdTitle, i18n_get("Dismiss", &notif_attr_list)); AttributeList end_workout_attr_list = {0}; attribute_list_add_cstring(&end_workout_attr_list, AttributeIdTitle, i18n_get("End Workout", &notif_attr_...
{ bool found_session = false; uint32_t num_sessions = ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT; ActivitySession *sessions = app_zalloc_check(sizeof(ActivitySession) * ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT); activity_get_sessions(&num_sessions, sessions); for (int i ...
troke_count, 1); cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points)); cl_assert_equal_p(s_fill_points, NULL); prv_reset(); // set stroke color to be transparent and restore fill - fill should be drawn, but no outline // should be drawn gdraw_command_set_fill_color(command, GColorGreen...
cl_assert(prv_compare_points((GPoint*)points, s_stroke_points, s_path_num_points))
; free(command); } void test_gdraw_command__draw_circle(void) { GDrawCommand *command = malloc(sizeof(GDrawCommand) + sizeof(GPoint)); *command = (GDrawCommand){ .type = GDrawCommandTypeCircle, .hidden = false, .stroke_color = GColorGreen, .stroke_width = 1, .fill_color = GColorOrange, ...
update_key_callback, void* context) { DictionaryResult result = DICT_OK; // First, write the updated keys. for (Tuple* new = dict_read_first(new_iter); new; new = dict_read_next(new_iter)) { uint32_t key = new->key; const Tuple* orig = dict_find(orig_iter, key); ...
{ DictionaryIterator iter_copy = *iter; Tuple *tuple = dict_read_first(&iter_copy); while (tuple) { if (tuple->key == key) { return tuple; } tuple = dict_read_next(&iter_copy); } return NULL; }
ITHOUT 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 "launcher_app_glance_workout.h" #include "launcher_app_glance_structured.h" #include "applib/template_string.h" #include "apps/...
(structured_glance)
; PBL_ASSERTN(workout_glance); ActivitySession automatic_session = {}; const bool has_automatic_session = workout_utils_find_ongoing_activity_session(&automatic_session); ActivitySessionType workout_type; int32_t workout_duration_s = 0; if (workout_service_is_workout_ongoing()) { // Manual work...
sition from element that needs to be removed only if it was on the // top of the visible window stack. Window *window_from = NULL; // If this window is currently transitioning and it is a modal window if ((window_stack->transition_context.window_to == pop_item->window) && !window_manager_is_app_window(po...
(window_stack, window, prv_next_inserter, transition_to, transition_pop)
; } Window *window_stack_pop(WindowStack *window_stack, bool animated) { // Transition NULL will default to the registered pop_transition to the stack item const WindowTransitionImplementation *transition = animated ? NULL : &g_window_transition_none_implementation; return window_stack_pop_with_transition(...
d half of the animation where the app is the destination, draw the "expand to // app" frame and fill its inner ring with the app's frame buffer // Switch to the "expand to app" animation if necessary if (!s_data.expanding) { prv_modal_transition_animation_init_sequence(MODAL_EXPAND_TO_APP_ANIMATION); ...
{ gdraw_command_sequence_destroy(s_data.animation_sequence); s_data.animation_sequence = NULL; }
} const CompositorTransition *prv_modal_transition_get_rect(bool modal_is_destination) { // NOTE: This initialization will set .expanding to false so we default to contracting to a dot s_data = (CompositorModalTransitionData) { .modal_is_destination = modal_is_destination, // TODO: PBL-19849 // Decide...