prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
); const GPoint br = GPoint(rect->origin.x + rect->size.w - 1, rect->origin.y + rect->size.h - 1); graphics_line_draw_stroked_non_aa(ctx, tl, tr, stroke_width); graphics_line_draw_stroked_non_aa(ctx, tl, bl, stroke_width); graphics_line_draw_stroked_non_aa(ctx, tr, br, stroke_width); graphics_line_draw_strok...
(ctx, rect, radius)
; } T_STATIC void prv_draw_round_rect_aa_stroked(GContext* ctx, const GRect *rect, uint16_t radius, uint8_t stroke_width) { // Assumes AA and stroke_width is set appropriately in ctx prv_draw_round_rect(ctx, rect, radius); } #endif // SCREEN_COLOR_DEPTH_BITS T_STATIC v...
se. */ #include "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" #include "clar.h" #include "util.h" #include <stdio.h> // Helper Functions //////////////////////////////////// #include "test_graphics.h" #include "${BIT_DEPTH...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_inside_offset_layer.${BIT_DEPTH_NAME}.pbi")
om accel manager extern void test_accel_manager_get_subsample_info( AccelManagerState *state, uint16_t *num, uint16_t *den, uint16_t *samps_per_update); extern void test_accel_manager_reset(void); // stub void event_service_init(PebbleEventType type, EventServiceAddSubscriberCallback start_...
cl_assert_equal_i(samps_per_update, 1)
; } } cl_assert_equal_i(1000000 / s_sampling_interval_us, fastest_rate); cl_assert_equal_i(s_num_samples, 1); for (int i = 0; i < num_items; i++) { sys_accel_manager_data_unsubscribe(sessions[i]); stub_pebble_tasks_set_current(tasks[i]); } } // enumerate through all possible sampling rate combi...
info.sent_escape = false; return prv_send_byte_and_check(s_send_info.escaped_byte); } // send the next byte bool result = true; MBufIterator *iter = &s_send_info.mbuf_iter; MBuf *mbuf = mbuf_iterator_get_current_mbuf(iter); uint8_t read_data; PBL_ASSERTN(mbuf_iterator_read_byte(iter, &read_data)); ...
if (!accessory_send_stream(prv_send_stream_callback, (void *)read_mbuf)) { accessory_enable_input(); }
if (is_read) { // If we sent the request successfully, the send ISR will have transitioned us out of // ReadDisabled. const bool was_successful = (smartstrap_fsm_state_get() != SmartstrapStateReadDisabled); if (was_successful) { // start the timer for the read timeout PBL_ASSERTN(new_tim...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
heap_get_minimum_headroom(&s_kernel_heap)
oid prv_handle_read(Command *cmd, size_t length) { if (cmd->read.length == 0) { prv_respond_internal_error(cmd, length, E_INVALID_ARGUMENT); return; } PulseTransferFD *pulse_fd = prv_get_fd(cmd, length); if (!pulse_fd) { // prv_get_fd has already sent an error response return; } pulse_fd->...
{ EraseResponse *resp = pulse_reliable_send_begin(PULSE2_BULKIO_PROTOCOL); resp->opcode = BULKIO_RESP_DOMAIN_ERASE; resp->domain = domain_type; resp->status = status; resp->cookie = cookie; pulse_reliable_send(resp, sizeof(*resp)); }
static void prv_handle_packet(void *data) { BulkIOPacketCallbackData *callback_data = data; Command *cmd = (Command*)&callback_data->packet; size_t length = callback_data->length; if (length) { switch (cmd->opcode) { case BULKIO_CMD_DOMAIN_OPEN: prv_handle_open(cmd, length); break; ...
/* * 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 0; }
BTErrno bt_driver_gatt_write(GAPLEConnection *connection, const uint8_t *value, size_t value_length, uint16_t att_handle, void *context) { return 0; } BTErrno bt_driver_gatt_read(GAPLEConnection *con...
{ while (s_queue_value <= 0) { fake_system_task_callbacks_invoke_pending(); } s_queue_value--; return true; }
signed portBASE_TYPE xQueueGenericSend(QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, portBASE_TYPE xCopyPosition) { PBL_ASSERTN(xQueue == QUEUE_HANDLE); s_queue_value++; return true; } QueueHandle_t xQueueGenericCreate(unsigned portBASE_...
/* * 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 - first_sector + 1, count, progress_context)
; } } FLASH_Lock(); return true; } bool system_flash_write( uint32_t address, const void *data, size_t length, SystemFlashProgressCb progress_callback, void *progress_context) { FLASH_Unlock(); FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLA...
/* * 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...
weather_shared_data_get_entry(index)
; weather_shared_data_assert_entries_equal(key, to_check, original); task_free(to_check); } } void test_weather_db__check_small_record_not_inserted(void) { const size_t entry_size = MIN_ENTRY_SIZE - 1; void *entry = task_zalloc_check(entry_size); WeatherDBKey key = (WeatherDBKey) { 0, 0, 0, 0, 0, 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...
event_put(&event)
; } //! Simply posts the type of event given. static void prv_put_event_simple(AppFetchEventType type) { PebbleEvent event = { .type = PEBBLE_APP_FETCH_EVENT, .app_fetch = { .type = type, .id = s_fetch_state.app_id, } }; event_put(&event); } //! Recomputes and saves the progress percent...
printf(" -sXX\t\tRun only the suite number or name XX\n"); printf(" -i<name>\tInclude category <name> tests\n"); printf(" -q \t\tOnly report tests that had an error\n"); printf(" -Q \t\tQuit as soon as a test fails\n"); printf(" -l \t\tPrint suite, category, and test names\n"); printf(" -tXX\t\tRu...
if (clar_sandbox() < 0) { clar_print_onabort("Failed to sandbox the test runner.\n"); exit(-1); }
clar_mock_reset(); clar_on_init(); if (argc > 1) clar_parse_args(argc, argv); if (_clar.active_suite == NULL) { size_t i; for (i = 0; i < _clar_suite_count; ++i) clar_run_suite(&_clar_suites[i]); } clar_print_shutdown( _clar.test_count, (int)_clar_suite_count, _clar.total...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_ERROR, "Couldn't malloc space for new font"); return NULL; }
bool result = text_resources_init_font(app_num, resource_id, 0 /* extended resource */, font_info); if (!result) { // couldn't init the font applib_free(font_info); return NULL; } return font_info; } void fonts_unload_custom_font(GFont font) { // fonts...
= 0; int plugged_in = 0; if (state->test_entry.version == 1) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d", &steps, &orientation, &vmc); } else if (state->test_entry.version == 2) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d", &steps, &orientation, &vmc, &light); }...
strlen(token)
+ 1, "%d", &state->test_entry.start_at.max); } else if (strcmp(token, "TEST_FORCE_SHUT_DOWN_AT") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.force_shut_down_at); } else if (strcmp(token, "TEST_WEIGHT") == 0) { sscanf(token + strlen(token) + 1, "%f", &state->test_entr...
2 - ending point for precomputed edges setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_THREE); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MAX_PRECOMPUTED); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r2_no_clip.${BIT_DEPTH_NAME}.pbi")); ...
(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerTopLeft)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_top_left.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL); graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerTopR...
blt_palette_1bit__1bit_palette_to_1bit_set(void) { GBitmap *src_bitmap = get_gbitmap_from_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_bit...
("test_bitblt_palette_1bit__2bit_palette_to_1bit.pbi")
; bitblt_bitmap_into_bitmap(&s_dest_bitmap, src_bitmap, GPoint(20,20), GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(&s_dest_bitmap, "test_bitblt_palette_1bit__2bit_palette_to_1bit_offest-expect.pbi")); gbitmap_destroy(src_bitmap); } void test_bitblt_palette_1bit__get_1bit_graphics_gr...
hics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(-5, -5)); } void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__origin_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 10, 10)); layer_set_update_proc(&layer, &inside...
("white_over_black", ctx.parent_framebuffer, GColorWhite)
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &clear_layer_update_callback); layer_ren...
NULL)); cl_assert_passert(recognizer_create_with_data(&s_test_impl, NULL, sizeof(s_test_impl_data), dummy, NULL)); cl_assert_passert(recognizer_create_with_data(&s_test_impl, &s_test_impl_data, ...
recognizer_transition_state(r, RecognizerState_Completed)
GCornersAll); } // Draw foreground color GColor fg_color = (GColor){ .argb = (data->fg_color.argb | ALPHA_100) }; graphics_context_set_fill_color(ctx, fg_color); graphics_fill_round_rect(ctx, &GRect(36, 2, 30, 20), 4, GCornersAll); // Draw border if (gcolor_equal(data->bg_color, GColorBlack)) { grap...
{ if (s_color_table == color_table_hsv) { s_color_table = color_table_hvs; } else if (s_color_table == color_table_hvs) { s_color_table = color_table_hsv; } }
layer_mark_dirty(s_canvas_layer); } static void click_config_provider(void *context) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, up_handler); window_single_repeating_click_subscribe(BUTTON_ID_SELECT, 100, select_handler); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, down_handl...
cable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "drivers/deb...
{ __disable_irq(); const uint32_t button_counter_register = RTC_ReadBackupRegister(STUCK_BUTTON_REGISTER); if (button_counter_register != 0) { // Create bitmask with all 1s, except on the counter byte for this button_id in button_counter_register. AND to mask out: const uint32_t updated_button_counter_re...
void debounced_button_init(void) { button_init(); #if defined(BOARD_SNOWY_BB2) || defined(BOARD_SPALDING_BB2) // Snowy BB2s have a capacitor that results in a really slow rise time (~0.4ms). Sleep for // at least 1 ms to prevent fake button events psleep(2); #endif for (int i = 0; i < NUM_BUTTONS; ++i) { ...
ble_recursive_mutex_t { PebbleMutexCommon common; }; // macros should only be called while we hold the mutex we are logging so no // additional locking is needed #define LOG_LOCKED(logged_lr, new_lr) \ if (logged_lr == 0) { \ logged_lr = new_lr; \ } #define LOG_UNLOCKED(logged_l...
{ uintptr_t myLR = (uintptr_t) __builtin_return_address(0); OS_ASSERT(!mcu_state_is_isr()); TickType_t timeout_ticks = milliseconds_to_ticks(timeout_ms); LightMutexHandle_t mutex = handle->common.freertos_mutex; if (xLightMutexLockRecursive(mutex, timeout_ticks) == pdTRUE) { LOG_LOCKED(handle->common.l...
bool mutex_is_owned_recursive(PebbleRecursiveMutex * handle) { LightMutexHandle_t mutex = handle->common.freertos_mutex; void* holder = xLightMutexGetHolder(mutex); void* current = xTaskGetCurrentTaskHandle(); return (holder == current); } void mutex_unlock_recursive(PebbleRecursiveMutex * handle) { OS_ASS...
obs(GAPLEConnection *connection); // Defined in gap_le_connect_params.c extern void gap_le_connect_params_setup_connection(GAPLEConnection *connection); extern void gap_le_connect_params_cleanup_by_connection(GAPLEConnection *connection); // ----------------------------------------------------------------------------...
{ bt_lock_assert_held(true /* is_held */); PBL_ASSERTN(!gap_le_connection_is_connected(device)); GAPLEConnection *connection = kernel_zalloc_check(sizeof(GAPLEConnection)); *connection = (const GAPLEConnection) { .device = *device, .local_is_master = local_is_master, .conn_mgr_info = bt_conn_mgr_i...
// ------------------------------------------------------------------------------------------------- void prv_destroy_connection(GAPLEConnection *connection) { gatt_service_changed_server_cleanup_by_connection(connection); gap_le_connect_params_cleanup_by_connection(connection); gatt_client_discovery_cleanup_b...
/* * 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...
("573888")
, 573888); cl_assert_equal_i(atol("713713"), 713713); } void test_atol__whitespace_pfx(void) { cl_assert_equal_i(atol(" 500"), 500); cl_assert_equal_i(atol(" 765"), 765); cl_assert_equal_i(atol(" 573888"), 573888); cl_assert_equal_i(atol(" 713713"), 713713); } void test_atol__suff...
ed); cl_assert_equal_i(response_action->attr_list.attributes[1].uint8, 1); ActionMenuItem menu_item = (ActionMenuItem) { .action_data = &notif->action_group.actions[1], }; s_expected_send_data = s_sms_action_data; timeline_actions_invoke_action(&notif->action_group.actions[1], notif, NULL /*complete_cb*/...
cl_assert(item)
; cl_assert_equal_i(item->action_group.num_actions, 1); cl_assert_equal_i(item->action_group.actions[0].type, TimelineItemActionTypeAncsNegative); } void test_ancs_pebble_actions__test_group_sms(void) { prv_support_sms_replies(); ANCSAttribute *notif_attributes[NUM_FETCHED_NOTIF_ATTRIBUTES] = {0}; ANCSAttri...
tx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 11); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw11_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 11); graphics_dr...
(&ctx.dest_bitmap, "draw_rect_offset_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 5); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if S...
with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express...
cl_assert_equal_i(start.hour, 2)
; cl_assert_equal_i(end.ds_label, 'S'); cl_assert_equal_i(end.month, 10); cl_assert_equal_i(end.mday, 1); cl_assert_equal_i(end.hour, 2); } void test_timezone_database__kazakhstan(void) { { const int almaty_region = FIND_REGION("Asia/Almaty"); TimezoneInfo tz_info; bool result = timezone_databa...
static void prv_remove_node(TimelineNode **head, TimelineNode *node) { list_remove((ListNode *)node, (ListNode **)head, NULL); task_free(node); } static int prv_num_nodes_for_serialized_item(CommonTimelineItemHeader *header) { int num_days; if (header->all_day) { num_days = header->duration ? (header->dur...
{ return true; // continue iteration }
lar_buffer_get_write_space_remaining(&buffer), 0); cl_assert(!shared_circular_buffer_write(&buffer, (uint8_t*) "d", 1, false)); // too full cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 0); // Try a wrapped read cl_assert(shared_circular_buffer_read(&buffer, &client, 6, &out_buff...
(&buffer, &client2)
yout_removed_handler(SwapLayer *swap_layer, LayoutLayer *layout, void *context) { // layer_destroy(layer); } static void prv_layout_will_appear_handler(SwapLayer *swap_layer, LayoutLayer *layout, void *context) { } static void prv_lay...
if (notif.prim_color != GColorClearARGB8) { attribute_list_add_uint8(&attr_list, AttributeIdPrimaryColor, notif.prim_color); }
cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, sizeof(s_short_data_fragment)), true); ppogatt_send_next(transport); fake_gatt_client_o...
fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, sizeof(s_short_data_fragment) - sn)
, true); ppogatt_send_next(transport); prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment) - sn); } // Simulate the regular timer firing a bunch of times to expire the timeout for all the packets: for (int...
lized attributes followed by serialized actions } SerializedNotifPrefs; static PebbleMutex *s_mutex; static status_t prv_file_open_and_lock(SettingsFile *file) { mutex_lock(s_mutex); status_t rv = settings_file_open(file, iOS_NOTIF_PREF_DB_FILE_NAME, iOS_NOTIF_PREF_MAX_SIZE); if (rv != S_SUCCESS) { mutex_u...
kernel_zalloc_check(sizeof(iOSNotifPrefs) + alloc_size)
; uint8_t *buffer = (uint8_t *)notif_prefs + sizeof(iOSNotifPrefs); uint8_t *const buf_end = buffer + alloc_size; attributes_actions_init(&notif_prefs->attr_list, &notif_prefs->action_group, &buffer, serialized_prefs->num_attributes, serialized_prefs->num_actions, ...
/* * 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...
(&compositing_mode, tint_color)
; const int8_t dest_begin_x = (dest_rect.origin.x / 32); const uint32_t * const dest_block_x_begin = ((uint32_t*)dest_bitmap->addr) + dest_begin_x; const int dest_row_length_words = (dest_bitmap->row_size_bytes / 4); // The number of bits between the beginning of dest_block and the beginning of the nearest 32-...
nel/event_loop.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "kernel/pebble_tasks.h" #include "os/mutex.h" #include "services/common/system_task.h" #include "services/normal/blob_db/pin_db.h" #include "system/logging.h" #include "system/passert.h" #include "system/status_codes.h" #include "util/...
{ PBL_ASSERT_TASK(PebbleTask_KernelBackground); if (!s_mutex) { return; } mutex_lock(s_mutex); new_timer_stop(s_timer); SerializedTimelineItemHeader *filter_headers = kernel_zalloc_check(TimelineEventServiceCount * sizeof(SerializedTimelineItemHeader)); // Will update for (unsigned int i = 0;...
e(test_addr, test_pattern, 0x00, false); VERIFY_TEST_STATUS(status); // read base address to insure that it wasn't modified due to a stuck at zero in an address // bit status = prv_read_verify_byte(base_addr, data_pattern, FLASH_TEST_ERR_STUCK_AT_LOW, bitpos, false); ...
(LOG_LEVEL_DEBUG, ">START - STRESS TEST 1")
; uint16_t halfwordcount = 0; unsigned int iteration_count = 0; // Read/Write from address 1 uint32_t stress_addr1 = FLASH_TEST_STRESS_ADDR1; uint16_t stress_data1 = FLASH_TEST_STRESS_DATA1; // Read/Write from adress 2 uint32_t stress_addr2 = FLASH_TEST_STRESS_ADDR2; uint16_t stress_data2 = FLASH_TES...
shaky in the short term (i.e. a flaky USB connection), or we // just started charging. Make sure we have settled before transitioning into the // RuninStatePass state if (data->pass_count > 5) { next_state = RuninStatePass; data->countdown_running = false; // disab...
app_event_loop()
; } const PebbleProcessMd* mfg_runin_app_get_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = &s_main, // UUID: fbb6d0e6-2d7d-40bc-8b01-f2f8beb9c394 .common.uuid = { 0xfb, 0xb6, 0xd0, 0xe6, 0x2d, 0x7d, 0x40, 0xbc, 0x8b, 0x01, 0xf2, 0xf8, 0xbe, 0xb9, ...
(struct_migration) { entry.timestamp = wakeup_id; // WakeupId (key) is a timestamp entry.utc = false; // If we're migrating, this has not been utc } int32_t timestamp = entry.timestamp; time_t current_time = rtc_get_time(); int32_t time_difference = timestamp - current_time; if (timestamp >= s_wake...
if (time_difference <= 0) { return E_INVALID_ARGUMENT; }
Uuid uuid = app_manager_get_current_app_md()->uuid; WakeupEntry entry = { .uuid = uuid, .reason = reason, .notify_if_missed = notify_if_missed, .timestamp = timestamp, .utc = clock_is_timezone_set() }; // Add to settings file StatusCode retval = prv_wakeup_settings_add_entry(wakeup_id,...
/* * 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...
{ i2c_bus_rail_ctl_config((OutputConfig){ GPIOH, GPIO_Pin_0, true}); }
// v2_0 ///////// void v2_0_rail_ctl_fn(bool enable) { do_rail_power(enable, GPIOH, GPIO_Pin_0, true); } void v2_0_rail_cfg_fn(void) { i2c_bus_rail_ctl_config((OutputConfig){ GPIOH, GPIO_Pin_0, true}); } // ev2_4 ///////// void ev2_4_rail_ctl_fn(bool enable) { do_rail_power(enable, GPIOH, GPIO_Pin_0, true); }...
g_to_char_buffer(const jerry_value_t value, jerry_char_t *buffer_p, jerry_size_t buffer_size) { return jerry_string_to_utf8_char_buffer(value, buffer_p, buffer_size); } jerry_size_t jerry_object_to_string_to_utf8_char_buffer(const jerr...
{ if (jerry_value_has_error_flag(value)) { return TYPE_ERROR_FLAG; } return (jerry_value_t)EM_ASM_INT({ return __jerryRefs.ref(Number(__jerryRefs.get($0))); }, value); }
jerry_value_t jerry_value_to_object(const jerry_value_t value) { if (jerry_value_has_error_flag(value)) { return TYPE_ERROR_FLAG; } return (jerry_value_t)EM_ASM_INT({ return __jerryRefs.ref(new Object(__jerryRefs.get($0))); }, value); } jerry_value_t jerry_value_to_primitive(const jerry_value_t v...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_ERROR, "Failed to malloc buffer for 'mic start' command")
ionSessionStatusFailureConnectivityError; } else { prv_exit_and_send_result_event(data, DictationSessionStatusFailureConnectivityError); } } static void prv_handle_bt_conn_result(bool connected, void *context) { VoiceUiData *data = context; if (connected) { if (data->state == StateError) { // We ...
{ if (data->buffer_size == 0) { // If buffer size is set to 0, the buffer was allocated when the last transcription was received applib_free(data->message); data->message = NULL; } data->message = sys_voice_get_transcription_from_event(event, data->message, data->buffer_size, &data->message_len)...
static void prv_handle_dictation_error(VoiceUiData *data, VoiceStatus error_status) { uint64_t elapsed = prv_get_time_ms() - data->start_ms; const bool speech_detected = (data->speech_detected) || (elapsed < MIN_ELAPSED_DURATION); data->error_count++; if (data->show_error_dialog) { if (error_status == V...
ted_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); // ------------------------------------------------------------------------------------- // Build up a sequence out of a + b Anim...
(prv_count_handler_entries(&s_stopped_handler_calls, a), 1)
test_state.context); // Check that the limit passed in matches the max slices per glance cl_assert_equal_i(limit, APP_GLANCE_DB_MAX_SLICES_PER_GLANCE); unsigned int num_slices_added = 0; AppGlanceSlice slice = {}; // Check that using a bogus session variable fails AppGlanceReloadSession bogus_session; ...
cl_assert(result & APP_GLANCE_RESULT_EXPIRES_IN_THE_PAST)
; cl_assert(result & APP_GLANCE_RESULT_SLICE_CAPACITY_EXCEEDED); cl_assert(result & APP_GLANCE_RESULT_INVALID_ICON); cl_assert(result & APP_GLANCE_RESULT_TEMPLATE_STRING_TOO_LONG); } void test_app_glance__reload_with_validation_callback(void) { app_glance_reload(prv_reload_with_validation_cb, s_test_state.cont...
/* * 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_history_enabled) { return; }
VibeHistory *vibe = kernel_malloc(sizeof(VibeHistory)); if (vibe == NULL) { s_vibe_history_enabled = false; return; } list_init((ListNode*)vibe); time_t s; uint16_t ms; rtc_get_time_ms(&s, &ms); vibe->time_start = ((uint64_t)s) * 1000 + ms; vibe->time_end = END_NOT_SET; PBL_ASSERTN(s_vibe_...
/* * 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_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load })
/* * 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_state_get_user_data()
; PBL_LOG(LOG_LEVEL_DEBUG, "Sending status and version to mobile app"); AppMessageResult result = app_message_outbox_begin(&app_data->out_iter); if (result != APP_MSG_OK) { PBL_LOG(LOG_LEVEL_DEBUG, "Failed to begin outbox - reason %i %s", result, prv_translate_error(result)); return; } d...
---------------------------------------------------------------------- // Return current time in ms static uint64_t prv_ms(void) { time_t cur_sec; uint16_t cur_ms = time_ms(&cur_sec, NULL); return ((uint64_t)cur_sec * 1000) + cur_ms; } // -------------------------------------------------------------------------...
(data->debug_window, true /* Animated */)
; } // ------------------------------------------------------------------------------- static void sleep_click_config_provider(void *context) { const int k_long_press_timeout_ms = 1000; window_single_click_subscribe(BUTTON_ID_SELECT, sleep_select_click_handler); window_single_click_subscribe(BUTTON_ID_UP, sleep...
"var c1 = 100 + 50 * Math.cos(0);\n" "var c2 = 100 + 50 * Math.cos(2 * Math.PI);\n" ); cl_assert_equal_i(100, (int32_t)jerry_get_number_value(prv_js_global_get_value("s1"))); cl_assert_equal_i(99, (int32_t)jerry_get_number_value(prv_js_global_get_value("s2"))); cl_assert_equal_i(150, (int32_t)jerry_get_numb...
(snapshot, snapshot_size)
; cl_assert(result); } static int s_cleanup_calls; static void prv_cleanup_cb(const uintptr_t native_p) { ++s_cleanup_calls; } void test_js__js_value_cleanup(void) { s_cleanup_calls = 0; { // Sanity check: // we don't clean up when a bare jerry_value_t goes out of scope. jerry_value_t value = jer...
_screen, true); cl_assert_equal_i(windows[2][1]->is_click_configured, false); cl_assert_equal_i(windows[1][0]->on_screen, true); cl_assert_equal_i(windows[1][0]->is_click_configured, false); cl_assert_equal_p(s_last_click_configured_window, windows[3][1]); for (ModalPriority idx = ModalPriorityMin; idx < Num...
cl_assert_equal_i(windows[3][1]->on_screen, true)
; cl_assert_equal_i(windows[3][1]->is_click_configured, false); cl_assert_equal_i(windows[3][0]->on_screen, false); cl_assert_equal_i(windows[3][0]->is_click_configured, false); cl_assert_equal_i(windows[2][1]->on_screen, false); cl_assert_equal_i(windows[2][1]->is_click_configured, false); cl_assert_equal_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
layer_set_clips(&pin_window->action_button_layer, false)
; pin_window->action_button_layer.update_proc = action_button_update_proc; layer_add_child(&pin_window->layer, &pin_window->action_button_layer); StatusBarLayer *status_layer = &pin_window->status_layer; status_bar_layer_init(status_layer); status_bar_layer_set_separator_mode(status_layer, StatusBarLayerSepa...
bus and peripheral config access before enabling it static void bus_enable(uint8_t bus_idx) { // Don't power up rail if the bus is already in use (enable can be called to reset bus) if (i2c_buses[bus_idx].user_count == 0) { bus_rail_power_up(bus_idx); } bus_pin_cfg_i2c(BOARD_CONFIG.i2c_bus_configs[bus_id...
bus_lock(bus)
; if (bus->user_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "Attempted reset of disabled bus %d by device %d", bus_idx, device_id); bus_unlock(bus); return; } PBL_LOG(LOG_LEVEL_WARNING, "Resetting I2C bus %" PRId8, bus_idx); // decrement user count for reset so that if this user is the only user, the ...
/* * 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_kernel_receiver_available) { return NULL; } s_kernel_receiver_is_receiving = true; cl_assert_equal_p(endpoint->handler, app_message_app_protocol_system_nack_callback); cl_assert(total_payload_size <= MAX_HEADER_SIZE); return s_kernel_receiver; }
static void prv_default_kernel_receiver_write(Receiver *receiver, const uint8_t *data, size_t length) { cl_assert_equal_p(receiver, s_kernel_receiver); memcpy(s_kernel_receiver_buffer + s_kernel_receiver_buffer_idx, data, length); s_kernel_receiver_buffer_idx += len...
FW Includes /////////////// #include "services/normal/blob_db/api.h" #include "services/normal/blob_db/util.h" #include "services/normal/blob_db/sync.h" #include "util/size.h" // Writebacks counter //////////////////////// static int s_num_writebacks; static int s_num_until_timeout; void blob_db_endpoint_send_sync...
(list_count(&dirty_list->node), ARRAY_LENGTH(keys))
; for (int i = 0; i < ARRAY_LENGTH(keys); ++i) { cl_assert(list_find(&dirty_list->node, prv_list_key_comparator, keys[i]) != NULL); } blob_db_util_free_dirty_list(dirty_list); // mark one as synced and re-check for (int synced_idx = 1; synced_idx < ARRAY_LENGTH(keys); ++synced_idx) { blob_db_mark_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...
ARRAY_LENGTH(s_delta_moook_in)
* ANIMATION_TARGET_FRAME_INTERVAL_MS; } uint32_t interpolate_moook_out_duration() { return ARRAY_LENGTH(s_delta_moook_out) * ANIMATION_TARGET_FRAME_INTERVAL_MS; } uint32_t interpolate_moook_duration() { return interpolate_moook_in_duration() + interpolate_moook_out_duration(); } uint32_t interpolate_moook_soft_...
s){}; } static void prv_update_conn_params(uint16_t slave_latency_events, uint16_t supervision_to_10ms) { bt_lock(); s_le_conn_params.slave_latency_events += slave_latency_events; s_le_conn_params.supervision_to_ms += (supervision_to_10ms * 10); s_le_conn_params.num_samps++; ...
{ if (!local_is_master) { analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_TIME); analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_ENCRYPTED_TIME); prv_update_conn_event_timer(0, true); } }
const GTextNodeBaseImpl s_custom_impl = { .destructor = prv_destroy_text_node_base, .will_draw = prv_draw_noop, .did_draw = prv_draw_noop, .draw = prv_draw_text_node_custom, }; static const GTextNodeContainerImpl s_horizontal_impl = { .base.is_container = true, .base.destructor = prv_destroy_text_node_cont...
{ ctx->gcontext->draw_state.clip_box = ctx->cached_clip_box; }
gsize_add_eq(ctx->size_out, node->margin); } if (parent_ctx) { prv_container(parent_ctx->node)->did_draw_child(parent_ctx, node); } } static void prv_draw_text_node_tree(GTextNode *root_node, GContext *gcontext, const GRect *box, const GTextNodeDrawConfig *config, bo...
ARRAY_LENGTH(s_horizontal_config_nodes), .container.nodes = (LayoutNodeConfig **)&s_horizontal_config_nodes, }; GTextNodeHorizontal *horizontal_node = (GTextNodeHorizontal *)layout_create_text_node_from_config( &layout->layout_layer, &s_horizontal_config.container.extent.node); horizontal_nod...
{ // Move the hour and title closer together const int hour_title_margin = is_fat ? style->fat_time_margin_h : style->thin_time_margin_h; if (time_text_node) { time_text_node->margin.h += hour_title_margin; } static const LayoutNodeTextConfig s_primary_config = { .extent.node.type = Lay...
primary_node->node.margin.h = style->primary_secondary_peek_margin_h; } graphics_text_node_container_add_child(&vertical_node->container, &primary_node->node); } if (has_secondary) { LayoutNodeTextDynamicConfig secondary_config = { .text.extent.node.type = is_peek ? LayoutNodeType_TextDyna...
/* * 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(is_app_file_name("@00000001/abc") == true); }
void test_app_file__is_app_file_name_hex(void) { cl_assert(is_app_file_name("@abcdef01/abc") == true); } void test_app_file__is_app_file_name_negative(void) { cl_assert(is_app_file_name("@feedface/abc") == true); } void test_app_file__is_app_file_name_obviously_false(void) { cl_assert(is_app_file_name("appdb"...
// Don't send an error here! The initiating side is supposed have detected the version // incompatibility and not sent the ResetComplete (and send an Error message), but apparently // we did get the ResetComplete somehow? prv_awaiting_reset_request__enter(); return; } prv_session_...
{ inbox_rcv(it, context); }
else { DBG_VERBOSE("No inbox_received handler for state %d", s_state.state); } } static void prv_inbox_dropped(AppMessageResult reason, void *context) { // Q: We don't know what got dropped here. Should we send/initiate a ResetRequest? // A: No, a drop will be a NACK to the other side, so the other side sho...
ou 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 * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRAN...
(row_bits_left, src_bits_left)
); const uint32_t mask_outer_bit = ((number_of_bits < 31) ? (1 << number_of_bits) : 0); const uint32_t mask = ((mask_outer_bit - 1) << dest_shift); switch (compositing_mode) { case GCompOpClear: *(dest_block) &= ~(mask & src); break; case GCompOpSet: *(d...
_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 ...
graphics_draw_vertical_line_dotted(&ctx, GPoint(71, 91), 10)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(67, 96), 5); // T facing left - even vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(100, 90), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(100, 95), 5); // T facing left - odd vert, odd horiz graphics_draw_vertical_line_dotted...
imation *property_animation_create_bounds_origin(Layer *layer, GPoint *from, GPoint *to) { // no legacy2 support as this was never exposed on 2.x PropertyAnimation *result = property_animation_create(&s_bounds_layer_implementation, layer, NULL, NULL); GRect value = layer->bounds; if (from) { value.o...
if (size > MEMBER_SIZE(PropertyAnimationPrivate, values.from)) { APP_LOG(APP_LOG_LEVEL_WARNING, "invalid size"); return false; }
if (set) { memcpy(&property_animation->values.from, value, size); } else { memcpy(value, &property_animation->values.from, size); } return true; } // ----------------------------------------------------------------------------------------- bool property_animation_to(PropertyAnimation *property_animat...
timer = evented_timer_register(PEEK_LAYER_UNFOLD_DURATION + standing_ms, false, prv_finished_failure_callback, data); } else { prv_finished_failure_callback(data); } } static void prv_animation_stopped_failure(Animation *animation, bool finished, void *contex...
(animation)
; #else // Don't animate, just show the peek layer immediately. prv_show_peek_layer(data); #endif } //////////////////////////// // Internal Helper Functions //////////////////////////// //! Used to clean up the application's data before exiting static void prv_cancel_fake_progress_timer(ProgressWindow *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...
(DISP_GPIO, &gpio_cfg)
; RCC_APB2PeriphClockCmd(DISPLAY_SPI_CLOCK, ENABLE); s_spi_clock_hz = MHZ_TO_HZ(SPI_DEFAULT_MHZ); prv_configure_spi(s_spi_clock_hz); } bool display_program(const uint8_t *fpga_bitstream, uint32_t bitstream_size) { GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET); // wait a bit. delay_ms(1); GPIO_Write...
vice, [TimelineEventService_Peek] = timeline_peek_get_event_service, }; // This mutex protects all state, but is only used for factory resetting synchronously, therefore // it should not significantly increase blocking time. static PebbleMutex *s_mutex; static TimelineEventState s_states[TimelineEventServiceCount];...
{ timeline_item_deserialize_header(&item, state->filter_header); }
est_kino_player__create_finite_animation_finite_reel_foward(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = 300; Animation *animation = (Animation *)kino_player_create_play_animation(test_player); c...
(animation_is_scheduled(animation), false)
; animation_schedule(animation); animation_set_elapsed(animation, 20); animation_set_duration(animation, ANIMATION_DURATION_INFINITE); prv_play_animation_update(animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 20); } void test_kino_player__infinite_animation_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...
memcmp(pstr->str_value, cstr, pstr->str_length)
] __RETAINED; static uint8_t s_rx_storage[HOST_TRANSPORT_CTLR_RX_BUFFER_SIZE] __RETAINED; static void prv_lock(void) { OS_ENTER_CRITICAL_SECTION(); } static void prv_unlock(void) { OS_LEAVE_CRITICAL_SECTION(); } static void prv_core_dump(void) { // TODO Implement core dump PBL_ASSERTN(0); } void host_transp...
{ ad_spi_complex_transact(dev, transfer, 1, host_transport_set_mcu_int); }
static bool prv_transact(spi_device dev) { const uint8_t *tx_bytes = NULL; prv_lock(); uint16_t tx_bytes_available = circular_buffer_get_read_space_remaining(&s_tx_buffer); if (tx_bytes_available) { circular_buffer_read(&s_tx_buffer, tx_bytes_available, &tx_bytes, &tx_bytes_available); } uint8_t *rx_...
dowHandlers) { .appear = prv_window_appear, .disappear = prv_window_disappear, .unload = prv_window_unload, }); window_set_user_data(window, data); // Initialize some variables early Layer *root_layer = window_get_root_layer(window); const GRect *window_frame = &root_layer->frame; // pre...
{ NotificationWindowData *data = &s_notification_window_data; if (animated) { #if PBL_RECT Uuid *second_id = notifications_presented_list_relative( notifications_presented_list_first(), +1); if (second_id) { // On rectangular displays, get the notification below the one we want to focus, ...
void notification_window_service_init(void) { s_notification_window_mutex = mutex_create(); s_notification_window_data.pop_timer_id = EVENTED_TIMER_INVALID_ID; } ////////////////// // Event Handers ////////////////// static void prv_handle_action_result(PebbleSysNotificationActionResult *action_result) { if ...
_logging.h" #include "stubs_notifications.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pin_db.h" #include "stubs_regular_timer.h" #include "stubs_reminder_db.h" #include "stubs_timeline.h" #include "stubs_uuid.h" #include "stubs_nexmo.h" iOSNotifPrefs* ios_notif_pref_db_get_prefs(const u...
(fake_event_get_count(), 1)
; cl_assert_equal_i(event.type, PEBBLE_PHONE_EVENT); cl_assert_equal_i(event.phone.type, PhoneEventType_Hide); cl_assert_equal_i(event.phone.source, PhoneCallSource_ANCS); cl_assert_equal_i(event.phone.call_identifier, uid); // Make sure that having a matching notification in notif_db still results in a call...
*context) { SettingsData *data = context; const uint16_t old_row = old_index.row; SettingsCallbacks *callbacks = prv_get_current_callbacks(data); if (callbacks->selection_will_change) { callbacks->selection_will_change(callbacks, &new_index->row, old_row); } } static void prv_draw_row_callback(GContext...
{ callbacks->expand(data->callbacks); }
} static void prv_settings_window_appear(Window *window) { SettingsData *data = window_get_user_data(window); SettingsCallbacks *callbacks = prv_get_current_callbacks(data); if (callbacks->appear) { callbacks->appear(data->callbacks); } } static void prv_settings_window_unload(Window *window) { Setting...
nt(&data->from), grect_center_point(&data->to)); return gpoint_sub(offset, GPoint(size.w / 2, size.h / 2)); } static bool prv_image_size_eq_rect_size(KinoReelTransformData *data, GRect rect) { GSize size = kino_reel_get_size(prv_get_current_reel(data)); return gsize_equ...
if (!list) { return; }
if (!gdraw_command_list_copy(list, gdraw_command_list_get_data_size(source_list), source_list)) { return; } if (data->impl->apply) { const GSize size = kino_reel_get_size(reel); data->impl->apply(list, size, &data->from, &data->to, data->normalized, data->context); }...
/* * 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...
(a.ty.integer - b.ty.integer)
_CANARY = 0xbaebaef8; typedef struct { KinoReel base; uint32_t canary; const KinoReelImpl *impl; void *data; } KinoReelImplCustom; static void prv_destructor(KinoReel *reel) { KinoReelImplCustom *custom_reel = (KinoReelImplCustom *)reel; if (custom_reel->impl->destructor) { custom_reel->impl->destruct...
if (!prv_kino_reel_custom_is_custom(reel)) { return NULL; }
KinoReelImplCustom *custom_reel = (KinoReelImplCustom *)reel; return custom_reel->data; }
by the action menu/action callbacks TimelineItem *item = s_phone_ui_data->call_response_item; s_phone_ui_data->call_response_item = NULL; TimelineItemAction *reply_action = timeline_item_find_reply_action(item); if (!reply_action) { return; } switch (reply_action->type) { case TimelineItemAction...
( property_animation_create_layer_frame(&s_phone_ui_data->action_bar.layer, NULL, &offscreen))
; animation_set_duration(action_bar_animation, ACTION_BAR_DISAPPEAR_ANIMATION_FRAMES * ANIMATION_FRAME_MS); animation_set_curve(action_bar_animation, AnimationCurveEaseIn); GPoint overshoot = GPoint(PBL_IF_RECT_ELSE(ACTION_BAR_WIDTH / 2, 0) + BOUNCEBACK_DISTANCE, 0);...
.callback = { .callback = prv_system_task_starved_callback, .data = NULL, }, }; event_put_isr(&event); } prv_log_failed_message(&reason); // Re-write the reason including the stuck task info collected by prv_log_failed_message() reboot_reason_clear(); ...
task_watchdog_disable_interrupt()
; s_watchdog_bits |= (1 << task); task_watchdog_enable_interrupt(); } bool task_watchdog_mask_get(PebbleTask task) { task_watchdog_disable_interrupt(); bool result = (s_watchdog_mask & (1 << task)); task_watchdog_enable_interrupt(); return result; } void task_watchdog_mask_set(PebbleTask task) { task_wa...
_assert_equal_i(result, 1000); cl_assert_equal_i(s_sys_activity_get_metric_values.in.history_len, ACTIVITY_HISTORY_DAYS); // today into future result = health_service_sum(HealthMetricStepCount, time_util_get_midnight_of(now), now + 12345); cl_assert_e...
(s_sys_activity_get_metric_values.in.history_len, ACTIVITY_HISTORY_DAYS)
; // 1/2 of today's captured seconds so far result = health_service_sum(HealthMetricStepCount, time_util_get_midnight_of(now), (time_util_get_midnight_of(now) + now) / 2); cl_assert_equal_i(result, 500); } void test_health__cache(void) { cl_assert_eq...
(uint8_t)(FIXED_S16_3_ONE.raw_value - y1.fraction)); } y1.integer++; data_row_info = gbitmap_get_data_row_info(framebuffer, y1.integer); output = (GColor8 *)(data_row_info.data + x); } // middle pixels while (y1.integer <= y2.integer) { // Only draw the pixel if its with...
(framebuffer, y)
; clip_box_min_x = MAX(clip_box_min_x, data_row_info.min_x); clip_box_max_x = MIN(clip_box_max_x, data_row_info.max_x); // If x1 is further outside the clip box than the left gradient width, we need to move x1 up // to clip_box_min_x and proceed such that we don't draw the left gradient int16_t x1_distance_ou...
prv_move_rect(data)
; layer_mark_dirty(&data->window.layer); app_timer_register(1000 / TARGET_FPS, prv_redraw_timer_cb, NULL); } static void s_main(void) { AppData *data = app_malloc_check(sizeof(AppData)); app_state_set_user_data(data); Window *window = &data->window; window_init(window, WINDOW_NAME("Bouncing Box")); w...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const bool has_hrm = mfg_info_is_hrm_present(); AppData *data = task_zalloc(sizeof(*data)); app_state_set_user_data(data); Window *window = &data->window; window_init(window, ""); window_set_fullscreen(window, true); TextLayer *title = &data->title_text_layer; text_layer_init(title, &window->layer....
app_window_stack_push(window, true); } static void prv_handle_deinit(void) { AppData *data = app_state_get_user_data(); event_service_client_unsubscribe(&data->hrm_event_info); if (mfg_info_is_hrm_present()) { sys_hrm_manager_unsubscribe(data->hrm_session); } text_layer_deinit(&data->title_text_layer...
, &s_parsed_msg.events.num_events, s_parsed_msg.events.events, s_parsed_msg.events.uuids, &s_parsed_msg.events.num_sessions, s_parsed_msg.events.sessions); if (!success) { LOG("No encoded msg available"); } else { LOG("ProtobufLogType: %d", s_parsed_msg.type); LOG("payload_sender_ty...
(a_event->activity_session.type.type.internal_type, b_event->activity_session.type.type.internal_type)
; cl_assert_equal_i(a_event->activity_session.start_reason, b_event->activity_session.start_reason); // TODO: Add more detailed comparisons } } } } static void prv_fill_version(TestPLParsedMsg *msg) { msg->payload_sender_v_major = GIT_TAG_V_MAJOR; msg->payload_...
d_response("Starting BT sleep check test"); s_sleep_test_timer = new_timer_create(); new_timer_start(s_sleep_test_timer , 10, prv_sleep_timer_test_cb, (void *)(uintptr_t)0, 0); prompt_command_continues_after_returning(); } void command_btle_unmod_tx_start(char *tx_channel) { bt_driver_start_unmodulated_tx(ato...
GPoint(DISP_COLS, DISP_ROWS)
); // ~63 degrees graphics_draw_line(ctx, GPoint(DISP_COLS/2, 0), GPoint(DISP_COLS, DISP_ROWS)); // ~33 degrees graphics_draw_line(ctx, GPoint(0, DISP_ROWS/3), GPoint(DISP_COLS, DISP_ROWS)); // ~53 degrees graphics_draw_line(ctx, GPoint(DISP_COLS/4, 0), GPoint(DISP_COLS, DISP_ROWS)); // ~39 degrees grap...
/* * 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(" Link Key:"); PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG, (uint8_t *)link_key, sizeof(SM128BitKey)); prompt_send_response_fmt(display_buf, DISPLAY_BUF_LEN, " BT ADDR: " BD_ADDR_FMT, BT_DEVICE_ADDRESS_XPLODE(*addr)); prompt_send_response_fmt(display_buf, DISPLAY_BUF_LEN, ...
void bluetooth_persistent_storage_debug_dump_root_keys(SM128BitKey *irk, SM128BitKey *erk) { prompt_send_response("Root Key hexdumps:"); prompt_send_response(" IRK:"); if (irk) { PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG, (uint8_t *)irk, sizeof(SM128BitKey)); } else { prompt_send_response(" None"); };...
/* * 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...
{ ANCSAttribute* attr = (ANCSAttribute*) iter; const uint8_t* next_iter = (uint8_t*) attr->value + attr->length; // Match this attribute with its entry in the FetchedNotifAttribute list bool is_found = false; for (int i = 0; i < num_attrs; ++i) { is_found = (attr->id == attr_list[i].id); ...
// The dictionary was well-formed, all the attributes found so far are ones // that were in the FetchedNotifAttribute list // Check if there are any outstanding attributes that have not been found for (int i = 0; i < num_attrs; ++i) { const bool optional = (attr_list[i].flags & FetchedAttributeFlagOption...
L_LOG(LOG_LEVEL_DEBUG, "Raw UP"); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Raw DOWN"); } text_layer_set_text(&data->text, data->text_buffer); toggle_color(window); (void)recognizer; } static void raw_up_click_handler(ClickRecognizerRef recognizer, Window *window) { raw_click_handler(recognizer, window, true)...
window_init(window, WINDOW_NAME("Click Demo"))
; window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); window_set_click_config_provider(window, (ClickConfigProvider) config_provider); const bool animated = true; app_window_stack_push(window, animated); } //////////////////// // App b...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(data_out)
try entry = prv_wakeup_settings_get_entry(wakeup_id); // Only allow owner to delete its own wakeup events if (uuid_equal(&app_manager_get_current_app_md()->uuid, &entry.uuid)) { if (wakeup_id == s_wakeup_state.current_wakeup_id && new_timer_scheduled(s_current_timer_id, NULL)) { new_timer_stop(s_...
settings_file_rewrite(&wakeup_settings, prv_delete_events_by_uuid_callback, NULL)
; settings_file_close(&wakeup_settings); } } mutex_unlock(s_mutex); // We may have cancelled the timer, next_pending will check prv_wakeup_timer_next_pending(); } DEFINE_SYSCALL(time_t, sys_wakeup_query, WakeupId wakeup_id) { status_t status = E_DOES_NOT_EXIST; WakeupEntry entry = {}; if (wak...
prv_iter_remove(AnimationState *state, AnimationPrivate *animation) { // If this animation is the iterator's next, bump the iterator if (state->aux->iter_next == (ListNode *)animation) { state->aux->iter_next = list_get_next((ListNode *)animation); } } // -----------------------------------------------------...
if (animation->parent == parent) { // Direct descendent return true; }
// Get parent's parent animation = animation->parent; } return false; } // ------------------------------------------------------------------------------------------- static int32_t prv_get_elapsed(AnimationPrivate *animation, uint32_t now) { // Compute the absolute start time of this animation, backi...
llRegisters ALL_REGISTERS; #endif // DEFAULT_REGISTER_DEBUG void default_registers_restore(void) { DCDC->DCDC_CTRL_0_REG = 0x2f24; DCDC->DCDC_CTRL_1_REG = 0x5410; DCDC->DCDC_CTRL_2_REG = 0x882d; DCDC->DCDC_V14_0_REG = 0xa1a4; DCDC->DCDC_V14_1_REG = 0xd890; DCDC->DCDC_V18_0_REG = 0xe3e4; DCDC->DCDC_V18_...
REG_SETF(DCDC, DCDC_VDD_1_REG, DCDC_VDD_ENABLE_HV, 0x1)
; REG_SETF(DCDC, DCDC_VDD_1_REG, DCDC_VDD_ENABLE_LV, 0x1); REG_SETF(DCDC, DCDC_VDD_1_REG, DCDC_VDD_CUR_LIM_MAX_LV, 0xB); REG_SETF(DCDC, DCDC_VDD_1_REG, DCDC_VDD_IDLE_HYST, 0x4); REG_SETF(DCDC, DCDC_VDD_1_REG, DCDC_VDD_IDLE_MIN, 0x10); REG_SETF(DCDC, DCDC_V18P_0_REG, DCDC_V18P_FAST_RAMPING, 0x1); REG_SETF(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...
if (index < 0) { return ANIMATION_NORMALIZED_MAX; }
if ((uint32_t)index >= num_segments) { return 0; } const int32_t duration_per_item = ((int64_t) ANIMATION_NORMALIZED_MAX * duration_fraction.raw_value) / FIXED_S32_16_ONE.raw_value; const int32_t delay_per_item = (ANIMATION_NORMALIZED_MAX - duration_per_item) / num_segments; const int32_t normaliz...
if (!timeline_item_deserialize_item(notification, header, read_buffer)) { goto cleanup; } task_free(read_buffer); return true; cleanup: task_free(read_buffer); return false; } size_t notification_storage_get_len(const Uuid *uuid) { int fd = prv_file_open(OP_FLAG_READ); if (fd < 0) { return 0; ...
prv_file_close(fd)
; return rv; } void notification_storage_set_status(const Uuid *id, uint8_t status) { PBL_ASSERTN(s_notif_storage_mutex != NULL); SerializedTimelineItemHeader header = { .common.id = UUID_INVALID }; int fd = prv_file_open(OP_FLAG_READ | OP_FLAG_WRITE); if (fd < 0) { return; } if (prv_find_next_not...
; // deinit should free all the memory timeline_iter_deinit(&iterator1, &state1, &head); timeline_iter_deinit(&iterator2, &state2, &head); cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), init_net_allocs); } void test_timeline__delete_on_iterator(void) { Iterator iterator = {0}; TimelineIterState state...
(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1425272400), S_SUCCESS)
; time_t midnight_march_2_pst = 1425283200; // day 1 cl_assert(uuid_equal(&state.pin.header.id, &multiday_item.header.id)); cl_assert(uuid_equal(&state.node->id, &multiday_item.header.id)); cl_assert(!state.node->all_day); cl_assert_equal_i(state.node->timestamp, 1425312000); cl_assert_equal_i(state.node...
ror: prompt_send_response("ERROR"); } // Perform a button press from the serial console. Three responses are provided // to users/tools using the interface to indicate status. They are: OK, BUSY, and ERROR. void command_button_press(const char *button_index, const char *hold_down_time_ms) { prv_button_press_mu...
for (int i = 0; i < 16; ++i) { system_task_add_callback(spam_callback, (void *)(uintptr_t) i); }
} #ifdef TEST_FLASH_LOCK_PROTECTION #include "flash_region/flash_region.h" #include "drivers/task_watchdog.h" #include "drivers/watchdog.h" // This test attempts to write over every region of the flash. // If we can still boot PRF after running this, it means we have successfully // protected those regions void flas...
static void prv_window_pop_cb(void *unused) { s_phone_ui_data->window_pop_timer = EVENTED_TIMER_INVALID_ID; prv_window_pop(); } static void prv_window_pop_with_delay(uint32_t delay_ms) { s_phone_ui_data->window_pop_timer = evented_timer_register( delay_ms, false /* repeating */, prv_window_pop_cb, NULL); ...
(&s_phone_ui_data->call_status_text_layer, &call_status_text_rect, NULL, s_phone_ui_data->status_font, GColorBlack, PBL_IF_COLOR_ELSE(GColorClear, GColorWhite), PBL_IF_RECT_ELSE(GTextA...
; layer_set_hidden(&s_phone_ui_data->call_status_text_layer.layer, true); layer_set_clips(&s_phone_ui_data->call_status_text_layer.layer, false); layer_add_child(&s_phone_ui_data->core_ui_container, &s_phone_ui_data->call_status_text_layer.layer); // Shrink the bounds but not the frame size to...
lse)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 3); cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "abc", 3, false)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 0); cl_assert(!shared_circular_buffer_write(&buffer, (uint8_t*) "d", ...
(shared_circular_buffer_get_write_space_remaining(&buffer), 3)
; cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client1), 5); cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client2), 2); // Make client2 fall behind again cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "abc", 3, false)); cl_assert_equa...
/* * 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_graphics_draw_bitmap_in_rect__rect = *rect; }
animating) { // we reconfigure the current index to be the previous index so that all parties in the ongoing // animation will continue to reply with the proper values with respect to the selection // half-way through the animation we then switch (back) to the new index menu_layer->animation.new_selection = men...
{ // it's critical to cancel the animation for center focus here so that any potential in-between // selection state will be cleaned up const bool was_animating = menu_layer->center_focused ? prv_cancel_selection_animation(menu_layer) : false; return (Me...
(void) { s_ppogatt_version = USE_PPOGATT_VERSION; s_tx_window_size = 25; s_rx_window_size = 25; prv_create_expected_reset_request(); prv_create_expected_reset_complete(); s_mtu_size = MTU_SIZE; fake_pbl_malloc_clear_tracking(); fake_gatt_client_op_init(); fake_gatt_client_subscriptions_init(); regul...
(ppogatt_get_destination(client), metas[i].expected_destination)
; ppogatt_close(client); } } void test_ppogatt__handles_unsupported_meta_ppogatt_version(void) { PPoGATTMetaV0 future_meta_non_compatible = s_meta_v0_system; future_meta_non_compatible.ppogatt_min_version = 0xaa; future_meta_non_compatible.ppogatt_max_version = 0xff; prv_notify_services_discovered(1); ...
i = 0; i < ARRAY_LENGTH(keys); ++i) { blob_db_insert(BlobDBIdTest, (uint8_t *)keys[i], key_len, (uint8_t *)values[i], value_len); } // check the dirty list blob_db_get_dirty_dbs(ids, &num_ids); cl_assert_equal_i(num_ids, 1); dirty_list = blob_db_get_dirty_list(BlobDBIdTest); cl_assert_equal_i(list_coun...
cl_assert(blob_db_sync_db(BlobDBIdTest) == S_SUCCESS)
; prv_generate_responses_from_phone(); cl_assert_equal_i(s_num_writebacks, 5); } void test_blob_db_sync__sync_while_syncing(void) { char *keys[] = { "key1", "key2", "key3", "key4", "key5" }; int key_len = strlen(keys[0]); char *values[] = { "val1", "val2", "val3", "val4", "val5" }; int value_len = strlen(v...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
memcmp(t1, t2, sizeof(GTransform))
== 0; } ////////////////////////////////////// /// Modifying Transforms ////////////////////////////////////// // Note that t_new can be set to either of t1 or t2 safely to do in place muliplication // Note this operation is not commutative. The operation is as follows t_new = t1 * t2 void gtransform_concat(GTransfor...
id-length string as date... // Apple rdar://19639333 timestamp = rtc_get_time(); // copy out app ID to a char buffer char app_id_buffer[app_id->length + 1]; pstring_pstring16_to_string(&app_id->pstr, app_id_buffer); PBL_LOG(LOG_LEVEL_WARNING, "No valid date. Offending iOS app: %s", app_id_buffe...
{ // Apple's Mail.app sometimes sends a notification with "Loading..." or // "This message has no content." when Mail.app is still fetching the body of the email. // PBL-8407 / PBL-1090 / Apple bug report number: rdr://17851582 // Obviously this only works around the issue when the language is set to English. ...
static bool prv_should_ignore_because_stale(time_t timestamp) { static const time_t MAXIMUM_NOTIFY_TIME = 2 * 60 * 60; // 2 hours static const time_t INVALID_TIME = ~0; const time_t now = rtc_get_time(); // workaround for PBL-8400 (ignore notifications older than 2 hours) // PBL-9066: Increased to 20 minut...