prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
(&ctx, GPoint(0, row), MAX_NUM_COLS)
; } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_even_clip"))); // Clipping on odd boundaries - no offset setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_ODD, OFFSET_RECT_ODD, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_dr...
nnelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); // Setup timer 3 for periodic interrupts at TIMER_INTERRUPT_HZ TIM_TimeBaseInitTypeDef tim_config; TIM_TimeBaseStructInit(&tim_config); tim_config.TIM_Prescaler = timer_find_prescaler(&BOARD_BT_WATCHDOG_TIMER.timer, ...
circular_buffer_write_finish(&s_spi_transport.rx, s_spi_transport.bytes_receivable_count)
; prv_unlock(); } static void prv_handle_receiving_footer_complete_isr(bool *should_context_switch) { // Check the received CRC uint32_t crc = crc32(CRC32_INIT, s_spi_transport.rx_write_ptr, s_spi_transport.bytes_receivable_count); if (crc != s_spi_transport.rx_footer.crc) { PBL_LOG(...
ode; //! The tick value when this timer will expire (in ticks). If the timer isn't currently //! running (scheduled) this value will be zero. RtcTicks expire_time; RtcTicks period_ticks; TaskTimerID id; //<! ID assigned to this timer //! client provided callback function and argument TaskTi...
list_remove(&timer->list_node, &manager->running_timers /* &head */, NULL /* &tail */)
; } else { PBL_ASSERTN(list_contains(manager->idle_timers, &timer->list_node)); list_remove(&timer->list_node, &manager->idle_timers /* &head */, NULL /* &tail */); } // Set timer variables timer->cb = cb; timer->cb_data = cb_data; timer->expire_time = current_time + timeout_ticks; timer->repeati...
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 writing, software ...
{ prv_put_comm_session_event(app_connected); prv_put_phone_event(PhoneEventType_Incoming, source, ANCS_CALL_UID); }
static void prv_call_end(void) { // Note: the source doesn't matter here, phone_call.c ignores it prv_put_phone_event(PhoneEventType_End, PhoneCallSource_PP, ANCS_CALL_UID); } static void prv_call_start(void) { // Note: the source doesn't matter here, phone_call.c ignores it prv_put_phone_event(PhoneEventTyp...
te), "Could not acquire semaphore token"); // Set up transfer bus->state->transfer = (I2CTransfer) { .device_address = device_address, .register_address = register_address, .direction = direction, .type = type, .size = size, .idx = 0, .data = data, }; i2c_hal_init_transfer(bus); ...
(slave->bus, Write, slave->address, register_address_start, write_size, (uint8_t*)buffer, SendRegisterAddress)
; if (!result) { PBL_LOG(LOG_LEVEL_ERROR, "Write failed on bus %s", slave->bus->name); } return result; } bool i2c_write_block(I2CSlavePort *slave, uint32_t write_size, const uint8_t* buffer) { PBL_ASSERTN(slave); PBL_ASSERTN(buffer); // Do transfer locks the bus bool result = prv_do_transfer(slav...
s // Unaligned start, even length - Need to pad both ends // Unaligned start, odd length - Pad the start // Aligned start, odd length - Pad the end if (start_addr & 0x1 || bytes_in_page & 0x1) { ++num_shorts; } const FlashAddress sector_addr = flash_impl_get_sector_base_address(start_addr); flas...
// if they are concerned about reliability. result = S_SUCCESS; } } prv_allow_write_if_sector_is_not_protected(true, sector_addr); flash_impl_release(); return FAILED(result) ? result : (int)bytes_in_page; }
status_t flash_impl_get_write_status(void) { flash_impl_use(); const uint8_t status = prv_read_status_register(0); flash_impl_release(); if ((status & S29VSStatusBit_DeviceReady) == 0) return E_BUSY; if ((status & S29VSStatusBit_ProgramSuspended) != 0) return E_AGAIN; if ((status & S29VSStatusBit_Program...
* 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, either express or implied. * See the License for the specific language gover...
(bfsr_mappings)
/* * 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_put_area_event(UnobstructedAreaEventType_DidChange, final_y, final_y, ANIMATION_NORMALIZED_MAX); }
}; rocky_global_init(apis); s_prv_api_add__result = true; EXECUTE_SCRIPT( "var f1 = function(){};\n" "var f2 = function(){};\n" "_rocky.on('foo', f1)\n" ); cl_assert_equal_i(1, s_prv_api_add__callcount); cl_assert_equal_b(true, rocky_global_has_event_handlers("foo")); // variables f1, f2 co...
( "_rocky.Event.prototype.myCustomThing = 'xyz';\n" "var e = new _rocky.Event('myevent');\n" "var t = e.type;\n" "var c = e.myCustomThing;\n" )
; ASSERT_JS_GLOBAL_EQUALS_S("t", "myevent"); ASSERT_JS_GLOBAL_EQUALS_S("c", "xyz"); } void test_rocky_api_global__call_event_handlers_async(void) { static const RockyGlobalAPI api = { .init = prv_api_init, .add_handler = prv_api_add, }; static const RockyGlobalAPI *apis[] = { &api, 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...
prv_unlock()
; return initialized; } static bool prv_enqueue(HcProtocolMessage *message) { PBL_ASSERTN(message->message_length >= sizeof(HcProtocolMessage)); if (!prv_update_enqueue_count(true)) { return false; } bool success = true; // Retry for 500ms TickType_t start_ticks = xTaskGetTickCount(); while (1)...
(AnalyticsEvent_BtClassicPairingError, error); } void bluetooth_analytics_ble_mic_error(uint32_t num_sequential_mic_errors) { PBL_LOG(LOG_LEVEL_INFO, "MIC Error detected ... %"PRIu32" packets", num_sequential_mic_errors); analytics_event_bt_error(AnalyticsEvent_BtLeMicError, num_sequential_mic_errors); } static u...
{ // TODO: PBL-38365: Re-enable this once it is fixed :( #if 0 if (bt_ctl_is_bluetooth_running()) { // No need for lock bt_driver_analytics_external_collect_bt_chip_heartbeat(); } #endif }
) { return 0; } return (jerry_size_t)EM_ASM_INT({ return Module.lengthBytesUTF8(__jerryRefs.get($0)); }, value); } jerry_size_t jerry_string_to_utf8_char_buffer(const jerry_value_t value, jerry_char_t *buffer_p, ...
(-Infinity)
; } else { return JERRY_CREATE_VALUE(Infinity); } } jerry_value_t jerry_create_number_nan(void) { return JERRY_CREATE_VALUE(NaN); } jerry_value_t jerry_create_null(void) { return JERRY_CREATE_VALUE(null); } jerry_value_t jerry_create_object(void) { return JERRY_CREATE_VALUE(new Object()); } jerry_valu...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
fake_spi_flash_init(FLASH_REGION_SHARED_PRF_STORAGE_BEGIN, FLASH_REGION_SHARED_PRF_STORAGE_END - FLASH_REGION_SHARED_PRF_STORAGE_BEGIN)
; shared_prf_storage_init(); } void test_shared_prf_storage_v2__cleanup(void) { fake_spi_flash_cleanup(); } void test_shared_prf_storage_v2__wipe_all(void) { SMPairingInfo sm_pairing_info; memset(&sm_pairing_info, 0xaa, sizeof(sm_pairing_info)); sm_pairing_info.is_local_encryption_info_valid = true; sm_pa...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
system_task_get_current_callback()
ClickHandler handler) {} void window_set_click_config_provider_with_context(Window *window, ClickConfigProvider click_config_provider, void *context) {} void window_set_click_context(ButtonId button...
cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row)
; cl_assert_equal_i(0, l.selection.y); // Test disabled first l.selection_animation_disabled = true; menu_layer_set_selected_index(&l, MenuIndex(0, 1), MenuRowAlignTop, true); cl_assert_equal_i(1, menu_layer_get_selected_index(&l).row); cl_assert(!l.animation.animation); // Test enabled l.selection_an...
ent_resource_num(); return gbitmap_sequence_create_with_resource_system(app_num, resource_id); } GBitmapSequence *gbitmap_sequence_create_with_resource_system(ResAppNum app_num, uint32_t resource_id) { uint8_t *frame_data_buffer = NULL; // Allocate g...
if (bitmap_format == GBitmapFormat1Bit) { if (!gcolor_is_invisible(color)) { const bool pixel_is_white = !gcolor_equal(color, GColorBlack); bitset8_update(row_data, x, pixel_is_white); } } else if ((bitmap_format == GBitmapFormat8Bit) || (bitmap_format == GBitmapFormat8BitCircular)) {...
} bool gbitmap_sequence_update_bitmap_next_frame(GBitmapSequence *bitmap_sequence, GBitmap *bitmap, uint32_t *delay_ms) { bool retval = false; uint8_t* buffer = NULL; // Disabled if play count is 0 and not the very first frame if (!bitmap_sequence || (bitm...
{ 664, 24, -248}, { 1480, 216, 64}, // 2 seconds { 2384, 432, -16}, { 2632, 544, -168}, { 2200, 528, 96}, { 1928, 368, 40}, { 1728, 376, 8}, { 1416, 480, -176}, { 1424, 408, -120}, { 1512, 352, -48}, { 1456, 448, -56}, { 1400, 456, -112}, { 1376, 496, -224}, { 984...
{ 1208, 136, -344}, { 1384, 152, -264}, { 1408, 120, -240}, { 1336, 192, -192}, { 1256, 336, -176}, { 1120, 360, -144}, { 1136, 360, -112}, { 1168, 408, -152}, { 1112, 448, -232}, { 1008, 496, -280}, { 736, 480, -160}, { 512, 480, -88}, { 784, 656, -112}, // 8 sec...
KUP_TABLE_SIZE 64 // Blending lookup table to map from: // dd: 2-bit dest luminance dd, // ss: src luminance ss, // aa: src alpha // to a final 2-bit luminance // result = s_blending_mask_lookup[0b00aaddss] // or s_blending_mask_lookup[(aa << 4) | (dd << 2) | ss] const GColor8Component g_bitblt_private...
(src_color, dest_color)
/* * 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...
mutex_create_recursive()
; } void notification_storage_lock(void) { mutex_lock_recursive(s_notif_storage_mutex); } void notification_storage_unlock(void) { mutex_unlock_recursive(s_notif_storage_mutex); } static int prv_file_open(uint8_t op_flags) { notification_storage_lock(); int fd = pfs_open(FILENAME, op_flags, FILE_TYPE_STATIC,...
andler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 0); // Should have been deleted automatically cl_assert_equal_i(prv_count_animations(), 0); #endif } // -------------------------------------------------------------------------------------- // Test setting a dura...
(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX)
; cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, se...
ePath; cl_assert(gdraw_command_list_validate(command_list, size)); free(command_list); } void test_gdraw_command__validate_image(void) { size_t size = sizeof(GDrawCommandImage) + (3 * sizeof(GDrawCommand)) + (sizeof(GPoint) * 6); GDrawCommandImage *image = malloc(size); GDrawCommandList *command_list...
prv_compare_points(points, s_fill_points, s_path_num_points)
); prv_reset(); gdraw_command_frame_draw(ctx, NULL, frame, GPoint(-1, 1)); cl_assert_equal_i(s_path_num_points, 2); points[0] = GPoint(0, 2); points[1] = GPoint(1, -1); cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points)); cl_assert(prv_compare_points(points, s_fill_points, s_path_nu...
{ 440, 440, -752}, { 488, 424, -744}, { 464, 448, -800}, { 440, 360, -784}, { 448, 416, -760}, { 456, 424, -752}, { 464, 416, -736}, // 5 seconds { 464, 448, -752}, { 448, 384, -768}, { 440, 376, -792}, { 472, 448, -736}, { 464, 416, -760}, { 456, 416, -760}, { 46...
{ 472, 488, -728}, { 464, 424, -760}, { 464, 448, -760}, { 456, 448, -704}, { 472, 456, -728}, { 456, 464, -712}, { 480, 448, -736}, { 480, 480, -784}, { 464, 400, -728}, { 440, 416, -720}, { 456, 440, -728}, { 496, 496, -704}, { 496, 424, -760}, { 424, 424, -736}...
------------------------------------------ // Test calling unschedule on the sequence from the stopped handler of one of its children void test_animation__sequence_unschedule_from_child(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b = 500; const int play_count_b = 2; int du...
(&s_started_handler_calls, a)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b),...
184}, { -760, 128, 192}, { -832, 112, 208}, { -960, 224, 232}, { -1080, 120, 280}, { -1328, 424, 368}, { -1616, 400, 112}, { -1232, 1632, -1088}, { -896, 88, -32}, { -816, 104, 248}, { -1032, 472, 184}, // 52 seconds { -1192, 560, 360}, { -1192, 408, 456}, { -1120...
{ -1152, 56, 232}, { -1080, 72, 232}, { -992, 64, 240}, { -952, 48, 240}, { -952, 48, 240}, { -992, 24, 248}, { -1024, 16, 272}, { -960, 24, 256}, { -1120, 16, 288}, { -1184, -64, 312}, { -936, 224, 112}, { -872, 256, 88}, { -1024, 344, -8}, { -1216, 328, -80}, ...
{ -1080, 144, 104}, { -1360, 272, -8}, { -1776, 264, 104}, { -1960, 400, 464}, { -1568, 968, 640}, { -784, 968, -296}, // 60 seconds // elapsed: 1 minutes { -1032, 848, -376}, { -1144, -24, 312}, { -1120, 80, 264}, { -976, 240, 200}, { -792, 184, 264}, { -704, 20...
/* * 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 true; // Only watchfaces }
activity_private_compute_resting_calories(short_time_m)
/ ACTIVITY_CALORIES_PER_KCAL); prv_set_user(Human_ShortFemale); cl_assert_equal_i(1155, activity_private_compute_resting_calories(long_time_m) / ACTIVITY_CALORIES_PER_KCAL); cl_assert_equal_i(4, activity_private_compute_resting_calories(short_time_m) / ACTIVITY_CALORIES_PER_KCAL); prv_set_user(Human_TallFem...
960, 280, -272}, { 1200, 296, -224}, { 1296, 248, -48}, { 1416, 312, 24}, { 1280, 440, -176}, { 1488, 432, -112}, { 1384, 232, 0}, { 1112, 280, -112}, { 688, 496, -272}, { 520, 472, -248}, { 664, 368, -160}, { 696, 448, -176}, { 736, 488, -280}, { 840, 504, -280}, ...
{ 776, 136, -136}, { 624, 72, -208}, { 600, 40, -200}, { 624, 56, -176}, { 1016, 232, -64}, { 1592, 360, -152}, { 1616, 312, -368}, { 1664, 312, -160}, // 78 seconds { 1240, 200, -160}, { 808, 48, -208}, { 784, 312, 48}, { 760, 760, -208}, { 768, 976, -160}, {...
{ 744, 528, -384}, { 832, 560, -528}, { 960, 536, -504}, { 1120, 560, -544}, { 992, 552, -440}, { 1176, 544, -344}, { 1264, 576, -328}, { 1360, 672, -376}, { 1648, 568, -120}, { 1680, 488, -8}, { 1320, 352, -16}, { 1016, 336, -24}, { 896, 336, -32}, { 816, 280, -...
// // Note that `is_strict` is currently unsupported by emscripten jerry_value_t jerry_eval(const jerry_char_t *source_p, size_t source_size, bool is_strict) { return (jerry_value_t)EM_ASM_INT({ // jerry_eval() uses an indirect eval() call, // so the global execution context is used. // Also see EC...
({ return Module.lengthBytesUTF8(__jerryRefs.get($0)); }, value)
; } jerry_size_t jerry_string_to_utf8_char_buffer(const jerry_value_t value, jerry_char_t *buffer_p, jerry_size_t buffer_size) { const jerry_size_t str_size = jerry_get_utf8_string_size(value); if (str_size == 0 || buffer_s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_DEBUG, "Done!")
; } #endif void check_prf_update(void) { if (!boot_bit_test(BOOT_BIT_NEW_PRF_AVAILABLE)) { return; } boot_bit_clear(BOOT_BIT_NEW_PRF_AVAILABLE); #ifndef RECOVERY_FW prv_do_update(); #endif }
/* * 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...
(&tz_info)
; time_t actual = mktime(&apr_3_13_00); rtc_set_time(actual); ANCSAttribute *valid_date = prv_create_ancs_attr("20150403T130000"); time_t calculated = ancs_notifications_util_parse_timestamp(valid_date); prv_destroy_ancs_attr(valid_date); cl_assert_equal_i(calculated, actual); ANCSAttribute *invalid_da...
ice = bt_device_init_with_address(address, true /* is_random */); return *(BTDeviceInternal *)(&device); } static BTDeviceInternal prv_connected_dummy_device(uint8_t octet) { BTDeviceInternal device = prv_dummy_device(octet); gap_le_connection_add(&device, NULL, true /* local_is_master */); GAPLEConnection *co...
cl_assert(bt_device_equal(&returned_device.opaque, &device.opaque))
; // Test gatt_client_characteristic_get_descriptors(): const uint8_t num_descriptors = expected_characteristic->num_descriptors; BLEDescriptor descriptor_refs[num_descriptors]; const uint8_t num_found_descriptors = gatt_client_characteristic_get_descriptors(character...
ete_ble_pairing_by_id(9); cl_assert_equal_i(s_ble_bonding_change_delete_count, 1); cl_assert_equal_i(fake_shared_prf_storage_get_ble_delete_count(), 3); // Make sure the pairing is actually still there ret = bt_persistent_storage_get_ble_pairing_by_id(id, &irk_out, &device_out, NULL); cl_assert(ret); // A...
cl_assert_equal_i(ancs_id, id2)
; ret = bt_persistent_storage_has_ble_ancs_bonding(); cl_assert(ret); ret = bt_persistent_storage_is_ble_ancs_bonding(id2); cl_assert(ret); } void test_bluetooth_persistent_storage__ble_device_name(void) { SMPairingInfo pairing = { .irk = (SMIdentityResolvingKey) { .data = { 0x01, 0x02, 0x0...
aster than DMA even). We only support the app framebuffer being smaller than // the system framebuffer and we assume the system framebuffer is always DISP_COLS x DISP_ROWS. const int16_t app_width = app_framebuffer_size.w; const int16_t app_height = app_framebuffer_size.h; const int16_t bezel_width = (...
PBL_ASSERT_TASK(PebbleTask_KernelMain)
; // Stop the framebuffer_prepare performance timer. This timer was started when the client // first posted the render event to the system. compositor_display_update(prv_handle_display_update_complete); } static void prv_send_did_focus_event(bool in_focus) { PebbleEvent event = { .type = PEBBLE_APP_DID_CH...
t); bottom_rect_origin_x += radius; bottom_rect_size_w -= radius; } if (corner_mask & GCornerTopRight) { circle_func(ctx, GPoint(rect->origin.x + rect->size.w - radius - 1, rect->origin.y + radius), radius, GCornerTopRight); top_rect_size_w -= radius; } if (corn...
(ctx, tl, bl, stroke_width)
; graphics_line_draw_stroked_aa(ctx, tr, br, stroke_width); graphics_line_draw_stroked_aa(ctx, bl, br, stroke_width); } #endif // PBL_COLOR T_STATIC void prv_draw_rect_stroked(GContext *ctx, const GRect *rect, uint8_t stroke_width) { const GPoint tl = GPoint(rect->origin.x, rect->origin.y); const GPoint tr = G...
cl_assert_equal_i(DESIRED_EVICT_ID, app_cache_get_next_eviction())
; } void test_app_cache__clear(void) { // add all three cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app1.id, app1.size)); cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app2.id, app2.size)); cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app3.id, app3.size)); app_cache_flush(); cl_assert_equal_b...
, rd_len + 1); cl_assert(rv == E_RANGE); } void test_pfs__close(void) { // shouldn't be able to close fds that are not open int rv = pfs_close(-1); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_close(0); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_close(1000000); cl_assert(rv == E_INVALID_ARGUMENT); ...
(name, sizeof(name), "bigfile")
; //Fill up entire memory section, subtract 32768 for header space. int fd = pfs_open(name, OP_FLAG_WRITE, FILE_TYPE_STATIC, pfs_get_size() - (num_pages()*128)); printf("%d\n", pfs_get_size() - 1024); cl_assert(fd >= 0); cl_assert(pfs_close(fd) == S_SUCCESS); cl_assert(pfs_remove(name) == S_SUCCESS); } ...
/normal/voice/voice.h" #include "shell/normal/watchface.h" #include "syscall/syscall.h" #include "system/logging.h" #include "system/passert.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/modals/modal_manager.h" #include "util/heap.h" #include "syscall/syscall_internal.h" #include "apps/system_apps/app_fetch...
event_put_from_process(task, &event)
same as Large until ExtraLarge is designed */ \ /* x-large */ 6 \ ) #define TIME_NUMBERS_MARGIN_W \ PREFERRED_CONTENT_SIZE_SWITCH(PreferredContentSizeDefault, \ /* This is the same as Medium until Small is designe...
(attributes, tertiary_id, fallback_resource)
); } void timeline_layout_init_with_icon_id(TimelineLayout *layout, const LayoutLayerConfig *config, const TimelineLayoutImpl *timeline_layout_impl, TimelineResourceId icon_resource) { TimelineLayoutInfo *info = config->context; static ...
om_pbi("test_bitblt_palette_1bit__1bit_palette_to_1bit.pbi"); bitblt_bitmap_into_bitmap(&s_dest_bitmap, src_bitmap, GPointZero, GCompOpSet, GColorWhite); cl_assert(gbitmap_pbi_eq(&s_dest_bitmap, "test_bitblt_palette_1bit__1bit_palette_to_1bit_set-expect.pbi")); gbitmap_destroy(src_bitmap); } ...
GPoint(20,20)
/* * 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_process_callback_events_alt(false /* should_execute_callback */)
; } #define assert_num_callback_events(num) \ cl_assert_equal_i(list_count((ListNode *)s_event_head), num); //////////////////////////////////////////////////////////////////////////////////////////////////// // Inbox Service Stubs void app_message_receiver_message_handler(const uint8_t *data, size_t length, ...
MenuCellSpan *cursor, GContext* ctx) { if (cursor->h == 0) { // cell has height 0, no need to draw anything. return; } cell_layer->bounds.size.h = cursor->h; cell_layer->frame.size.h = cursor->h; cell_layer->frame.origin.y = cursor->y; // Save current drawing state: GDrawState prev_state = grap...
{ MenuRenderIterator *it = (MenuRenderIterator*)iterator; const int16_t iter_y = it->it.cursor.y; const int16_t top_diff = it->it.cursor.y - it->content_top_y; const bool is_row_in_frame = (top_diff >= 0 && it->it.cursor.y <= it->content_bottom_y) || (it->it.cell_bottom_y >= it->content_top_y && it->it.c...
// NOTE: The following two iteration functions are asymmetrical! // In other words, even one is going downward and the other upward, there are some subtle // differences. Most importantly: the downward function calls the row_callback_after_geometry for // the row the iterator's cursor is currently set to, while the u...
/* * 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...
(ctx, GColorClear)
; graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(14, 14), 12); } void across_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(28, 14), 12); } ...
"%.*izero%.*i", -3, 0, -3, 1); cl_assert_equal_s(dstbuf, "zero1"); // Length modifiers int64_t hurf = 0x123456789ABCDEF0ULL; snprintf(dstbuf, 256, "%hhi,%hi,%i,%li", hurf, hurf, hurf, hurf); cl_assert_equal_s(dstbuf, "-16,-8464,-1698898192,-1698898192"); snprintf(dstbuf, 256, "%lli,%ji", hurf, hurf); cl_...
{ char dstbuf[256]; // Simple %o snprintf(dstbuf, 256, "There are %o lights, %o", 8, -4); cl_assert_equal_s(dstbuf, "There are 10 lights, 37777777774"); // Alternate form (adds 0 prefix) snprintf(dstbuf, 256, "There are %#o lights, %#o", 8, -4); cl_assert_equal_s(dstbuf, "There are 010 lights, 037777777...
cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.-3ozero%.-3o", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (non-zero digits outputting zero) snprintf(dstbuf, 256, "%.1ozero%.1o", 0, 1); cl_assert_equal_s(dstbu...
_id_payload); return packet; } else { // PPoGATTPacketTypeResetComplete if (prv_client_supports_enhanced_throughput_features(client)) { *packet = (const PPoGATTPacket) { .sn = 0, .type = PPoGATTPacketTypeResetComplete, }; PPoGATTResetCompleteClientIDPayloadV1 *client_id_paylo...
{ return NULL; }
NUTE); prv_inc_steps_and_put_event(900 /* 180 steps per min * 5 mins */); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(steps, 900); cl_assert_equal_i(5900, s_total_step_count); cl_a...
workout_service_stop_workout()
; // Pull out the saved session and make sure it matches our numbers ActivitySession *stored_session = &s_saved_session; cl_assert_equal_i(stored_session->start_utc, session.start_utc); cl_assert_equal_i(stored_session->length_min, 20); cl_assert_equal_i(stored_session->step_data.steps, 3800); cl_assert_eq...
s_increased = false; int32_t new_val = nf->value + nf->step_size; if (new_val <= nf->max_val && new_val > nf->value) { nf->value = new_val; is_increased = true; } if (is_increased) { if (nf->callbacks.incremented != NULL) { nf->callbacks.incremented(nf, nf->callback_context); } update_...
update_output_value(nf)
; } if (nf->max_val < min) { nf->max_val = min; } } void number_window_set_value(NumberWindow *nf, int32_t value) { nf->value = value; if (nf->value > nf->max_val) { nf->value = nf->max_val; } if (nf->value < nf->min_val) { nf->value = nf->min_val; } update_output_value(nf); } void numbe...
animation_set_handlers(animation2, (AnimationHandlers) { .stopped = prv_animation_stopped_success, }, data)
; Animation *animation = animation_sequence_create(animation1, animation2, NULL); data->result_animation = animation; animation_schedule(animation); #else // Don't animate to a dot on old platforms, just finish immediately. static const bool success = true; prv_finished(data, success); #endif } static vo...
lues->values[2] = 300; attribute_list_add_uint32_list(&attr_list, AttributeIdMetricIcons, metric_values); Uint32List *other = attribute_get_uint32_list(&attr_list, AttributeIdMetricIcons); for (int i = 0; i < metric_values->num_values; i++) { cl_assert_equal_i(metric_values->values[i], other->values[i]); }...
0x3f, 0x00, // Attribute Length // Attribute text: "This is a test notification. Look at it and behold the awesome." 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x2...
void test_attribute__attributes_add_to_list(void) { static const uint32_t value_uint32 = 123123423; static const uint8_t value_uint8 = 17; AttributeList list = {0}; attribute_list_add_cstring(&list, AttributeIdTitle, "Title1"); cl_assert_equal_s(attribute_get_string(&list, AttributeIdTitle, ""), "Title1")...
, { 1024, 752, -56}, { 1128, 760, -40}, { 856, 352, 80}, { 952, 456, -120}, { 1448, 1080, -112}, { 1096, 256, 448}, { 448, -256, 552}, { 696, 160, 344}, { 680, 624, 408}, { 840, 848, 448}, { 800, 640, 432}, { 800, 392, 360}, { 792, 352, 432}, { 776, 408, 432}, ...
{ 536, 232, -32}, { 608, 272, -16}, { 776, 464, -48}, { 864, 696, -16}, { 896, 688, 24}, { 1048, 696, 56}, { 1112, 512, 32}, { 848, 416, 48}, { 1024, 688, 16}, { 1544, 1272, 160}, { 688, -208, 432}, { 616, -176, 440}, { 784, 272, 344}, { 656, 728, 504}, { 760,...
{ 1032, 240, 488}, { 952, 480, 456}, { 880, 584, 312}, { 744, 464, 216}, { 648, 304, 128}, { 576, 200, 24}, { 640, 280, -16}, { 784, 448, -40}, { 856, 616, -32}, { 936, 784, -24}, { 1064, 840, 40}, { 976, 520, 16}, { 784, 376, 24}, { 1176, 728, -24}, { 1496, ...
= false; r->state = RecognizerState_Completed; recognizer_reset(r); cl_assert_equal_i(r->state, RecognizerState_Possible); cl_assert_equal_b(reset, true); cl_assert_equal_b(cancelled, false); reset = false; r->state = RecognizerState_Started; recognizer_reset(r); cl_assert_equal_i(r->state, Recogniz...
(r, &(TouchEvent) {})
/* * 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_snooze_timer_timeout_ms = 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////// //! Setup void test_alarm__initialize(void) { s_num_timer_register_calls = 0; s_num_timeline_adds = 0; s_num_timeline_removes = 0; s_num_alarm_events_put = 0; s_alarm_timer_timeout_ms = 0; s_snooze_timer_...
xt_buffer; memset(str, 0 , INFO_TEXT_BUFFER_SIZE); if (total > MAX_INFO_TOTAL) { // total is large; display as a percentage itoa_int(current * 100 / total, str, 10); strcat(str, "%"); } else { // display as an X/Y itoa_int(current, str, 10); strcat(str, "/"); char buffer[(INFO_...
(x_start, y, width, font_height)
, text_format.overflow_mode, text_format.text_alignment, NULL); } // Renders all of StatusBarLayer when layer_mark_dirty triggers LayerUpdateProc void status_bar_layer_render(GContext *ctx, const GRect *bounds, StatusBarLayerConfig *config) { // define x and y coords of stat...
g->dialog.dialog; dialog_set_destroy_on_pop(dialog, false /* free_on_pop */); bt_conn_dialog_push(bt_dialog, prv_handle_bt_conn_result, data); } static uint64_t prv_get_time_ms(void) { time_t now_s; uint16_t now_ms; sys_get_time_ms(&now_s, &now_ms); uint64_t ms = (now_s * 1000) + now_ms; return ms; } s...
("No speech detected! Exiting...")
Overrides same function in graphics.c; we need to do this so we can release the framebuffer we're // using even though its format doesn't match GBITMAP_NATIVE_FORMAT (see comment for mocked // graphics_capture_frame_buffer() above) bool graphics_release_frame_buffer(GContext *ctx, GBitmap *buffer) { PBL_ASSERTN(ctx)...
(dialog, snooze_buf)
; dialog_set_icon(dialog, RESOURCE_ID_GENERIC_CONFIRMATION_LARGE); dialog_set_background_color(dialog, GColorJaegerGreen); dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT); prv_push_and_render_simple_dialog(dialog); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_simple_dialog__alarm_d...
/* * 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...
(af_config->gpio, af_config->gpio_pin, asserted? Bit_SET : Bit_RESET)
l expect_is_handled) { uint8_t msg[] = { 0x10, 3, 'o', 'n', 'e', 3, 't', 'w', 'o', 5, 't', 'h', 'r', 'e', 'e', 0xAA, 0x00, 0x00, 0x00, 0xAA, 0x00, 0xAA, 0x00 }; prv_receive_pp_data(msg, sizeof(msg)); PebbleEvent e = fake_event_get_last(); if (expect_is_handled) { cl_assert_equal_i(e.typ...
cl_assert_equal_i(data_length, 1)
; cl_assert_equal_i(data[0], 0x04); // MusicEndpointCmdIDNextTrack s_next_track_command_sent = true; } static bool s_is_playback_cmd_sent; static uint8_t s_playback_cmd_sent; static void prv_assert_playback_command_sent_cb(uint16_t endpoint_id, const uint8_t* data, ...
/* * 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...
((ListNode *) s_session_head, &session->node)
; } // ------------------------------------------------------------------------------------------------- //! Extern'd interface for protocol.c // ------------------------------------------------------------------------------------------------- bool comm_session_has_capability(CommSession *session, CommSessionCapabili...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gdraw_command_image_draw(&ctx, l, GPoint(48, 96))
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "test_gdraw_command_transforms__to_square.8bit.pbi")); } // re-enable this "test" to debug per-frame transitions void _test_gdraw_command_transforms__to_square_sequence(void) { GContext ctx; test_graphics_context_init(&ctx, fb); graphics_context_set_antialiased(&ct...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ // Up (nothing) -> Up+Select (mfg) -> Up+Select+Down (nothing) -> Up+Select (mfg) prv_press_button(BUTTON_ID_UP); prv_press_button(BUTTON_ID_SELECT); prv_press_button(BUTTON_ID_DOWN); // We should have cancelled the timer cl_assert(!prv_find_combo_timer()); cl_assert(!s_mfg_mode_entered); prv_rele...
void test_getting_started_button_combo__push_combo_and_release_one(void) { // Up (nothing) -> Up+Select (mfg) -> Up (nothing) -> Up+Select (mfg) prv_press_button(BUTTON_ID_UP); prv_press_button(BUTTON_ID_SELECT); prv_release_button(BUTTON_ID_SELECT); // We should have cancelled the timer cl_assert(!prv...
es */); cl_assert_equal_s(music_get_connected_server_debug_name(), NULL); } void test_ams__dont_connect_music_service_if_subscribe_entity_update_characteristic_fails(void) { prv_discover_ams(1 /* num_instances */); // Simulate failed subscription: BLECharacteristic entity_update = s_characteristics[0][AMSChar...
{ prv_discover_ams(1 /* num_instances */); // Simulate not having enough resources to process the request: fake_gatt_client_op_set_write_return_value(BTErrnoNotEnoughResources); // Simulate successful subscription: BLECharacteristic entity_update = s_characteristics[0][AMSCharacteristicEntityUpdate]; ams_...
alse; break; } } } // Compute the default average value uint16_t default_value = 0; if (use_default) { HealthServiceMetricStats stats; if (!prv_get_metric_stats(state, metric, &stats, day_in_week)) { return false; } HealthValue value_per_day = stats.weekly.avg; defa...
prv_get_midnight_of_local_time(now)
+ SECONDS_PER_DAY; // never work with values in the future time_end = MIN(time_end, now); // never work with values older than the supported history of data time_start = MAX(time_start, midnight_after_now - (SECONDS_PER_DAY * ACTIVITY_HISTORY_DAYS)); if (time_end < time_start) { retur...
time is a bit silly, but the strn function expect a size_t (unsigned). // Calling MAX ensures that a negative value isn't passed in which gets cast to something positive buf_space_remaining = MAX(buf_space_remaining - sentence_len, 0); strncat(data->dialog_text, "\n\n", buf_space_remaining); buf_space_remainin...
(data->voice_window, false)
; // Let the main window manage the voice window app_window_stack_push(window, false); } static void prv_deinit(void) { ReminderAppData *data = app_state_get_user_data(); voice_window_destroy(data->voice_window); event_service_client_unsubscribe(&data->event_service_info); app_free(data->dialog_text); a...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (!boot_bit_test(BOOT_BIT_INITIALIZED)) { RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, BOOT_BIT_INITIALIZED); }
} void boot_bit_set(BootBitValue bit) { uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR); current_value |= bit; RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, current_value); } void boot_bit_clear(BootBitValue bit) { uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR); curre...
idr; #endif #if __DCACHE_PRESENT static uint32_t s_dcache_cssidr; #endif #if __ICACHE_PRESENT || __DCACHE_PRESENT static uint32_t prv_get_line_size(uint32_t ccsidr) { return ((CCSIDR_LINESIZE(ccsidr)) + 1) << 4; } static void prv_cache_operation_range(volatile uint32_t *reg, uint32_t line_size, uintptr_t addr, ...
{ // Need to adjust the address and size because the address is unaligned. *size += *addr & line_mask; *addr &= ~line_mask; }
n we are active, we don't trigger without being above average s_data.steps_per_minute = 80; s_data.metric_history[ActivityMetricStepCount][0] = AVERAGE_STEPS; prv_minute_update(ACTIVE_MINUTES); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); } void test_activity_insights__a...
{ // Use reasonable insight settings prv_set_sleep_history_avg(); // Let's start at 11:30pm struct tm start_tm = { // Thursday, Jan 1, 2015, 11:30pm .tm_hour = 23, .tm_min = 30, .tm_mday = 1, .tm_mon = 0, .tm_year = 115 }; prv_set_time(&start_tm); activity_insights_init(rtc_get_ti...
rtc_set_time(rtc_get_time() + 7 * SECONDS_PER_HOUR + 5 * SECONDS_PER_MINUTE); // Puts us at 7:05 prv_add_sleep_session(0, 7); // Make sure we update the existing pin as soon as we are awake. We shouldn't add another pin // because the sleep includes all sleep since ACTIVITY_LAST_SLEEP_MINUTE_OF_DAY (9pm) the...
} PROFILER_INIT; PROFILER_START; while (PROFILER_NODE_GET_TOTAL_US(gfx_test_update_proc) < (test->duration * US_PER_S)) { PROFILER_NODE_START(gfx_test_update_proc); test->test_proc(layer, ctx); PROFILER_NODE_STOP(gfx_test_update_proc); } PROFILER_STOP; PROFILER_PRINT_STATS; if (test->tear...
(window, false)
; window_set_window_handlers(window, &(WindowHandlers) { .load = prv_results_window_load, .unload = prv_results_window_unload, }); window_set_click_config_provider(window, prv_results_window_click_config_provider); TextLayer *text = &app_data->results_text; text_layer_init(text, &window->layer.bounds...
/* * 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...
(&context->window_stack)
e_offset_y); const GSize top_size = app_text_layer_get_content_size(top_layer); const int range_bottom_origin_y = range_origin_y + top_size.h; prv_vertical_align_text_layer(time_selection_window, bottom_layer, range_bottom_origin_y, 1, extra_line_offset_y); } static void prv_updat...
selection_layer_set_inactive_bg_color(selection_layer, GColorDarkGray)
/* * 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 (enable_gpios) { gpio_init = s_default_at_flash_cfg; } else { gpio_init = (GPIO_InitTypeDef) { .GPIO_Mode = GPIO_Mode_AN, .GPIO_Speed = GPIO_Speed_2MHz, .GPIO_PuPd = GPIO_PuPd_NOPULL }; }
// leave RESET_N and CE: they need to retain their state // Configure the rest as analog inputs to save as much power as possible // D2 - Reset - GPIO Reset line // D7 - FMC CE - FMC Chip Enable gpio_init.GPIO_Pin = GPIO_Pin_7; GPIO_Init(GPIOB, &gpio_init); gpio_init.GPIO_Pin = GPIO_Pin_All & (~GPIO_Pi...
or scheduled list ListNode* node = list_find(state->unscheduled_head, prv_handle_list_filter, (void*)handle); if (!node) { node = list_find(state->scheduled_head, prv_handle_list_filter, (void*)handle); } if (!node) { if (!quiet) { APP_LOG(APP_LOG_LEVEL_ERROR, "Animation %d does not exist", (int)h...
prv_find_animation_by_parent_child_idx(state, animation, child_idx)
; if (!child) { break; } child_duration = prv_get_total_duration(state, child, true, true); if (child_duration == PLAY_DURATION_INFINITE) { return PLAY_DURATION_INFINITE; } duration += child_duration; } } else if (animation->type == AnimationTypeSpawn) { /...
here will return X, Y, Z data #define WHO_AM_I_REG 0x07 #define SYSMOD_REG 0x08 #define CTRL_REG1 0x10 #define CTRL_REG2 0x11 static bool mag3110_read(uint8_t reg_addr, uint8_t data_len, uint8_t *data) { return i2c_read_register_block(I2C_MAG3110, reg_addr, data_len, data); } static bool mag...
mutex_unlock(s_mag_mutex)
; return (MagReadMagOff); } MagReadStatus rv = MagReadSuccess; uint8_t raw_data[7]; // DR_STATUS_REG is immediately before data registers if (!mag3110_read(DR_STATUS_REG, sizeof(raw_data), raw_data)) { rv = MagReadCommunicationFail; goto done; } // TODO: shouldn't happen at low sample rate,...
{ 1496, -568, -40}, { 1480, -432, 296}, { 1264, 112, 176}, { 2048, 2936, -632}, { 1264, 4000, -1800}, { -104, 3752, -1288}, { -1008, 1576, -584}, { -656, 608, -360}, { -632, -104, -504}, { -1264, -456, -128}, { -1408, -384, -216}, { -1200, -120, 144}, { -1032, 328, 32}, ...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-09 10:44:38 local AccelRawData *activity_sample_run_200_temp_95866_7(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME run_200_temp_95866_7 //> TEST...
on 3.10 and lower // that has not touched their vibe intensity preferences. // rtc_is_timezone_set() was chosen because it is a setting that gets written when the user // connects their watch to a phone prv_set_vibe_scores_based_on_legacy_intensity(DEFAULT_VIBE_INTENSITY); } } // PREF_K...
{ s_mask = mask; SET_PREF(PREF_KEY_MASK, s_mask); }
; active = do_not_disturb_is_active(); cl_assert(active == false); // Both OFF } void test_do_not_disturb__disable_manual_dnd_when_scheduled_ends(void) { bool active; // Time 00:00, Manual and Scheduled DND both OFF DoNotDisturbSchedule schedule = { .from_hour = 1, .from_minute = 0, .to_hour = 12...
do_not_disturb_is_manually_enabled()
== false); cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == false); cl_assert(do_not_disturb_is_schedule_enabled(WeekendSchedule) == false); active = do_not_disturb_is_active(); cl_assert(active == false); // 11 PM - 7 AM DoNotDisturbSchedule weekday_schedule = { .from_hour = 23, ....
/* * 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...
prompt_send_response("OK")
; } else { prompt_send_response("ERROR"); } } #if BOOTLOADER_TEST_STAGE1 #include "bootloader_test_bin.auto.h" #include "drivers/flash.h" #include "flash_region/flash_region.h" #include "system/firmware_storage.h" #include "system/bootbits.h" #include "system/logging.h" #include "system/reset.h" #include "uti...
it_and_send_result_event(data, DictationSessionStatusFailureRecognizerError); } } } static void prv_handle_dictation_result(VoiceUiData *data, PebbleVoiceServiceEvent *event) { VOICE_LOG("Handling result event"); data->session_id = VOICE_SESSION_ID_INVALID; bool success = false; switch (event->status) { ...
("Ignoring event")
gserial ExecutingCommandPulse, //!< Currently executing command is through Pulse ExecutingCommandContext, //!< Currently executing command is a custom \ref PromptContext } ExecutingCommand; static bool s_command_continues_after_return = false; static ExecutingCommand s_executing_command = ExecutingCommandNo...
{ prv_execute_given_command(cmd_iter, cmd + cmd_iter_length, cmd + cmd_len); command_found = true; break; }
} if (!command_found) { cmd[cmd_len] = '\0'; char buffer[64]; prompt_send_response_fmt(buffer, sizeof(buffer), "Invalid command <%s>! Try 'help'", cmd); prompt_command_finish(); } } void prompt_context_execute(PromptContext *context) { s_executing_command = ExecutingCommandContext; prv_fin...
.tomorrow_weather_type = WeatherType_Generic, }; prv_create_layout_for_forecast_and_render(&forecast); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_weather_app_layout__render_heavy_snow_rain_snow(void) { const WeatherLocationForecast forecast = { .location_name = "PALO AL...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); }
: cl_assert_equal_i(length, max_length); } cl_assert_equal_p(s_sent_data, NULL); s_sent_data = kernel_malloc(length); cl_assert(s_sent_data); memcpy(s_sent_data, data, length); s_sent_data_length = length; s_sent_endpoint_id = endpoint_id; } bool sys_app_pp_send_data(CommSession *session, uint16_t e...
(s_sent_data)
; s_sent_data = NULL; } // Test OUTBOUND (watch->phone): //////////////////////////////////// static void prv_send_test_data_expecting_result(AppMessageResult result) { DictionaryIterator *iter; cl_assert_equal_i(app_message_outbox_begin(&iter), APP_MSG_OK); cl_assert_equal_i(dict_write_data(iter, TEST_KEY, (...
FIXTURE_PATH, PUG_FIXTURE_NAME, "pug"); size_t pug_size = resource_size(SYSTEM_APP, RESOURCE_ID_PUG); cl_assert_equal_i(pug_size, sizeof(pug)); uint8_t pug_buf[pug_size]; cl_assert_equal_i( resource_load_byte_range_system(SYSTEM_APP, RESOURCE_ID_PUG, 0, pug_buf, pug_size), pug_size); for (unsigned...
(&entry, &manifest)
, 0); }
4}, { 1120, 376, -120}, { 1192, 392, -136}, { 1432, 504, -152}, { 1176, 592, -152}, { 1064, 552, -200}, { 1080, 688, -192}, { 1128, 704, -232}, { 1088, 584, -208}, { 1224, 456, -8}, { 1392, 256, 80}, { 1344, 200, 64}, { 1280, 224, 8}, // 53 seconds { 1272, 176, 72...
{ -88, -40, -1008}, { -72, -40, -1096}, { -104, -64, -1064}, { -128, -88, -992}, { -152, -96, -944}, { -128, -72, -936}, { -80, -88, -904}, { -72, -48, -880}, { -120, 152, -880}, { -72, 304, -896}, { -40, 360, -888}, { -64, 432, -896}, { -56, 496, -912}, { -104, 4...
{ 1048, 576, -272}, { 1360, 584, -144}, { 1544, 272, -24}, { 1384, 104, 48}, // 5 seconds { 1432, 80, -24}, { 1472, 160, -32}, { 1360, 200, -24}, { 1160, 232, -32}, { 1216, 232, -88}, { 1128, 360, -240}, { 928, 136, -216}, { 920, -128, -72}, { 648, -104, -120}, ...
/* * 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...
htons(log_message->line_number)
, log_message->message); } else { pulse_logging_log_sync( log_message->log_level, log_message->filename, htons(log_message->line_number), log_message->message); } #else prv_log_serial(log_message->log_level, log_message->filename, htons(log_message->line_number), log_message->...
crumbs_layer_set_level(&data->crumbs_layer, vm->num_dots); } static void prv_next_level_anim_stopped(Animation *anim, bool finished, void *context) { // update the view model AnimationContext *anim_ctx = (AnimationContext*) context; ActionMenuData *data = window_get_user_data((Window*) anim_ctx->window); if (!...
prv_set_level(data, item->next_level)
; } } static void prv_back_click_handler(ClickRecognizerRef recognizer, void *context) { ActionMenuData *data = context; if (animation_is_scheduled(data->level_change_anim)) { animation_set_elapsed(data->level_change_anim, animation_get_duration(data->level_change_anim, true, true)...
on the worker's behalf and put // the call at the bottom of prv_worker_cleanup. worker_state_deinit(); sys_exit(); } //! Heap locking function for our app heap. Our process heaps don't actually //! have to be locked because they're the sole property of the process and no //! other tasks should be touching it. A...
process_metadata_get_code_bank_num(app_md)
); return false; } // The rest of worker_ram is available for worker state to use as it sees fit. if (!worker_state_configure(&worker_ram)) { PBL_LOG(LOG_LEVEL_ERROR, "Worker state configuration failed"); return false; } // The remaining space in worker_segment is assigned to the worker's // he...
s; i++) { if (fastest_rate < sample_arr[i]) { fastest_rate = sample_arr[i]; } sessions[i] = sys_accel_manager_data_subscribe( sample_arr[i], prv_noop_sample_handler, NULL, tasks[i]); // buffer size of 1 sys_accel_manager_set_sample_buffer(sessions[i], fake_buf, 1); } // make su...
cl_assert_equal_i(s_num_samples, 7)
; /* 300ms / (1000ms / 25 samps) */ }
]) {3}, 1, &s_recognizers_handled); cl_assert_equal_p(manager.active_layer, &layer_c); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Updated); // Layer A recognizer's gesture completes and all recognizers are reset e.ty...
(recognizers[1]->state, RecognizerState_Cancelled)
00}, { 1008, 120, 184}, { 1040, 160, 208}, { 984, 208, 200}, { 936, 232, 160}, { 984, 192, 152}, { 1088, 208, 104}, { 1080, 248, 88}, { 1056, 232, 136}, { 1024, 232, 176}, { 1184, 248, 240}, { 1360, 280, 264}, { 1104, 296, 208}, { 864, 224, 24}, { 936, 48, -48}, ...
{ 1000, 40, 96}, { 1024, 56, 48}, { 1088, 48, 88}, { 1080, 128, 72}, { 1088, 160, 144}, { 1144, 208, 176}, { 1176, 280, 184}, { 1520, 288, 200}, { 1528, 216, 184}, { 1000, 160, -16}, { 752, -88, -40}, { 928, -408, 168}, { 1176, -200, 360}, { 1152, -160, 328}, ...
{ 1040, 128, 48}, { 1048, 88, 80}, { 1080, 112, 72}, // 110 seconds { 1096, 120, 72}, { 1128, 176, 128}, { 1136, 256, 176}, { 1160, 344, 200}, { 1576, 376, 184}, { 1392, 248, 128}, { 848, 136, -32}, { 768, -184, 8}, { 1104, -376, 144}, { 1168, -184, 224}, { 1...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (s_vibe_scores[selected_idx]) { vibe_score_do_vibe(s_vibe_scores[selected_idx]); }
} static void prv_load_scores(void) { int num_scores = ARRAY_LENGTH(s_vibe_scores); for (int i = 0; i < num_scores; i++) { s_vibe_scores[i] = vibe_score_create_with_resource(s_vibe_score_resources[i]); } } static void prv_unload_scores(void) { int num_scores = ARRAY_LENGTH(s_vibe_scores); for (int 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...
memcpy(c0->points, c0_points, sizeof(c0_points))
; val[info->val_len] = '\0'; printf("Read key of %s %d and val of %s %d\n", key, info->key_len, val, info->val_len); int key_i = atoi((char*)key + 1); cl_assert(key_i >= 0 && key_i < 255); uint8_t *cur_val = (uint8_t*)context; *cur_val = key_i; int val_i = atoi((char*)val + 1); cl_assert_equal_i(key_i...
snprintf((char *)key, sizeof(key), "k%03d", search_for_idx)
= bmp->data_row_infos); bmp = gbitmap_create_blank(s10, GBitmapFormat8Bit); cl_assert(NULL != bmp); cl_assert(NULL == bmp->data_row_infos); bmp = gbitmap_create_blank(s10, GBitmapFormat1BitPalette); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with ...
(s10, GBitmapFormat8Bit, p, true)
); bmp = gbitmap_create_blank_with_palette(s10, GBitmapFormat1BitPalette, p, true); cl_assert(NULL != bmp); cl_assert(p == gbitmap_get_palette(bmp)); bmp = gbitmap_create_blank_with_palette(s10, GBitmapFormat2BitPalette, p, true); cl_assert(NULL != bmp); cl_assert(p == gbitmap_get_palette(bmp)); bmp = ...
n a // document called "How to perform BMI160 accelerometer self-test" provided by Bosch, so I guess // it's the right thing to do. This document is attached to PBL-10951. bool pass = true; for (unsigned int i = 0; i < ARRAY_LENGTH(accel_test_axis); ++i) { int axis_delta = accel_test_axis[i].positive_value ...
{ sample_rate = BMI160SampleRate_12p5_HZ; }
else if (BMI160SampleRate_25_HZ <= interval_us) { sample_rate = BMI160SampleRate_25_HZ; } else if (BMI160SampleRate_50_HZ <= interval_us) { sample_rate = BMI160SampleRate_50_HZ; } else if (BMI160SampleRate_100_HZ <= interval_us) { sample_rate = BMI160SampleRate_100_HZ; } else if (BMI160SampleRate_200...
/* * 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(child_c.parent == &parent)
; // Remove first-child (child_a): // // +-parent // | // '->child_c // // +-child_a // | // '->grand_child_a // layer_remove_from_parent(&child_a); cl_assert(parent.first_child == &child_c); cl_assert(child_c.parent == &parent); cl_assert(child_a.parent == NULL); cl_a...
const uint32_t now, bool do_update) { bool blocked_on_children_complete = false; // Play count of 0 should have never been scheduled. PBL_ASSERTN(animation->play_count != 0); // If this is the animation's first frame, call the 'started' handler: if (animation->handlers.started && !animation->started) { ...
PBL_ASSERTN(list_contains(state->scheduled_head, &animation->list_node))
; #endif const int32_t rel_ms_running = serial_distance32(animation->abs_start_time_ms, now); if (rel_ms_running < 0) { // Animations are ordered by abs_start_time_ms. // We've reached an animation that should not start yet, so // everything after and including this animation shou...
ength < sizeof(FrameInfo)) || (header->length != length - sizeof(FrameInfo)) || (header->length > data_length) || (header->version != GENERIC_SERVICE_VERSION) || (header->error >= NumGenericServiceResults) || (header->service_id != s_read_info.service_id) || (header->attribute_id != ...
{ mbuf_free(s_read_header_mbuf); s_read_header_mbuf = NULL; mbuf_free(s_reserved_read_mbuf); s_reserved_read_mbuf = NULL; }
const SmartstrapProfileInfo *smartstrap_generic_service_get_info(void) { static const SmartstrapProfileInfo s_generic_service_info = { .profile = SmartstrapProfileGenericService, .max_services = MAX_SERVICES, .min_service_id = MIN_SERVICE_ID, .init = prv_init, .connected = prv_set_connected, ...
-------------- // Compute the sum of a metric, but averaged over multiple days. HealthValue health_service_sum_averaged(HealthMetric metric, time_t time_start, time_t time_end, HealthServiceTimeScope scope) { return health_service_aggregate_averaged(metric, time_start, time_end...
{ #if !CAPABILITY_HAS_HEALTH_TRACKING return 0; #else // Make sure this metric is supported by this type of aggregation if (!prv_metric_aggregation_implemented(metric, time_start, time_end, aggregation, scope)) { return 0; } // Get our state HealthServiceState *state = prv_get_state(true); if (scope...
dd(void) { // Stroke width odd > 1, antialiased setup_test(&context, true, SW_ODD, GColorBlack, GColorBlack, false); graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)); #if PBL_COLOR ASSERT_CALLED(graphics_line_draw_stroked_aa(&context, GPoint(5, 5), GPoint(45, 10), SW_ODD)); #else ASSERT_CALLED(graph...
graphics_draw_rect(&context, &GRect(10, 20, 40, 10))
express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "util/keyed_circular_cache.h" #include "util/size.h" #include "clar.h" #include <string.h> #define TEST_BUFFER_SIZE (3) typedef struct { uint32_t data[4]; } TestCacheItem; t...
prv_test_get_hit(0, 2)
; prv_test_get_hit(1, 0); prv_test_get_hit(2, 1); prv_test_get_miss(3); prv_push(3); prv_test_get_hit(0, 2); prv_test_get_hit(1, 0); prv_test_get_miss(2); prv_test_get_hit(3, 1); }
--------->| * Integrate over this range for the mean */ //! The current state of the backlight (example: ON/ON_TIMED/ON_FADING). static BacklightState s_light_state; //! The brightness of the display in a range between BACKLIGHT_BRIGHTNESS_OFF and BACKLIGHT_BRIGHTNESS_ON static int32_t s_cu...
if (!s_backlight_allowed) { return false; }
if (backlight_is_enabled()) { if (backlight_is_ambient_sensor_enabled()) { // If the light is off and it's bright outside, don't allow the light to turn on // (we don't need it!). Grab the mutex here so that the timer state machine doesn't change // the light brightness while we're checking ...
/* * 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_p(memset(testbuf, 5, 8), testbuf)
; } void test_memset__partial(void) { uint8_t testbuf[8] = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, }; uint8_t expectbuf[8] = { 0x12, 0x34, 0x56, 0x78, 5, 5, 5, 5, }; memset(testbuf+4, 5, 4); cl_assert_equal_m(testbuf, expectbuf, 8); } void test_memset__big_value(void) { uint8_t testbuf[8] = { 0x12...