prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
OG_LEVEL_ERROR, "PutBytes command 0x%x not permitted in current state 0x%x", command, s_pb_state.current_command); return true; } return false; } static uint32_t prv_parse_token(const PutBytesCommand command, const SharedHeader *header) { if (command == PutBytesInit) { return 0; } return ...
if (!s_pb_state.receiver.buffer || s_pb_state.receiver.length == 0) { PBL_LOG(LOG_LEVEL_WARNING, "No message pending, PutBytes cancelled in the mean time?"); prv_send_response(ResponseNack, s_pb_state.token); goto finally; }
const PutBytesCommand cmd = s_pb_state.receiver.buffer[0]; // Validation: const uint32_t request_token = prv_parse_token(cmd, (const SharedHeader *)s_pb_state.receiver.buffer); const bool has_error = prv_check_for_state_error(cmd, request_token, s_pb_state.receiver.length); if (has_error) { prv_...
blob_db_util_free_dirty_list(dirty_list); char *keys[] = { "key1", "key2", "key3", "key4", "key5" }; int key_len = strlen(keys[0]); char *values[] = { "val1", "val2", "val3", "val4", "val5" }; int value_len = strlen(values[0]); // insert all keys for (int i = 0; i < ARRAY_LENGTH(keys); ++i) { blob_db...
{ char *keys[] = { "key1", "key2", "key3", "key4", "key5" }; int key_len = strlen(keys[0]); char *values[] = { "val1", "val2", "val3", "val4", "val5" }; int value_len = strlen(values[0]); // insert all keys, mark some as synced for (int i = 0; i < ARRAY_LENGTH(keys); ++i) { blob_db_insert(BlobDBIdTest,...
r_count(), 1); // Ensure the click config handler was called cl_assert_equal_i(window->is_waiting_for_click_config, false); window_stack_pop(stack, false); cl_assert_equal_i(window_stack_count(stack), 0); // Ensure the disappear handler was called cl_assert_equal_i(prv_get_appear_disappear_count(), 0); ...
prv_get_load_unload_count()
, 1); window_stack_pop(stack, true); cl_assert_equal_i(window_stack_count(stack), 1); cl_assert_equal_i(prv_get_load_unload_count(), 1); } // Description: // In this test we push two windows that push windows during their unload handlers. // We want to verify that those two windows stay on the stack after call...
/* * 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...
write_line_cb(level, src_filename, src_line_number, line_buffer)
; offset += 16; } }
han the screen's radius so we don't see the top/bottom of the circle int16_t circle_radius = DISP_COLS * 3 / 4; const int16_t flip_overlap_region_width = layer_bounds->size.w / 5; const GPoint bounds_center = grect_center_point(layer_bounds); const int16_t flip_point_x = bounds_center.x - (flip_overlap_region_w...
graphics_context_set_antialiased(ctx, false)
; } ///////////////////////////////////////// // Public functions ///////////////////////////////////////// // when we create a new next or previous item, we want it out of view so we can animate it in void timeline_layer_set_next_item(TimelineLayer *layer, int index) { PBL_LOG(LOG_LEVEL_DEBUG, "Setting next item w...
es //////////////////////////////////////////////////////////////// #include "fake_new_timer.h" #include "fake_pbl_malloc.h" #include "fake_pebble_tasks.h" #include "fake_rtc.h" #include "fake_spi_flash.h" #include "fake_settings_file.h" #include "fake_events.h" bool calendar_layout_verify(bool existing_attributes[]) ...
fake_event_get_count()
if (data->dls_session == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "Unable to create DLS session"); return; } } if (finish) { PBL_ASSERTN(num_samples == 0 && accel_data == NULL); } // Save the samples for (uint32_t i = 0; finish || i < num_samples; i++, accel_data++) { // Init the record hea...
// Reset the stored record. 0 in num_samples causes it to be re-initialized // at the top of this loop. data->record.num_samples = 0; }
if (finish) { break; } } } // ------------------------------------------------------------------------------------------------ // Accel callback. Called from KernelBG task. Feeds new samples into the algorithm, saves // the updated step and sleep stats into our globals, and posts a service event if ...
chunk_idx %= ACTIVITY_NUM_METRIC_AVERAGES; } return result; } // ---------------------------------------------------------------------------------------------- // Fills in the range structure based on time_start and time_end. This computes the following // values: // * How many whole days of data are needed to ...
PBL_ASSERTN((time_range != NULL) && (daily_history != NULL))
; // TODO: PBL-31628 permission system to reply with HealthServiceAccessibilityMaskNoPermission if (!prv_get_metric_daily_history(state, metric, daily_history)) { return HealthServiceAccessibilityMaskNotAvailable; } if (!prv_calculate_time_range(time_start, time_end, time_range)) { return HealthServi...
/* * 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...
graphics_draw_bitmap_in_rect_processed(ctx, bitmap_reel->bitmap, &bounds, NULL_SAFE_FIELD_ACCESS(processor, bitmap_processor, NULL))
; // Restore previous compositing mode graphics_context_set_compositing_mode(ctx, prev_compositing_mode); } static GSize prv_get_size(KinoReel *reel) { KinoReelImplGBitmap *bitmap_reel = (KinoReelImplGBitmap *)reel; GRect bounds = gbitmap_get_bounds(bitmap_reel->bitmap); return bounds.size; } static size_t...
ell_index, void *callback_context) {} static uint16_t prv_get_num_rows(struct MenuLayer *menu_layer, uint16_t section_index, void *callback_context) { return s_num_rows; } void test_menu_layer__test_set_selected_classic(void)...
scroll_layer_get_content_offset(&l.scroll_layer)
.y); cl_assert_equal_b(false, s_content_available[ContentIndicatorDirectionUp]); cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]); const int FOCUSED = MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT; const int NORMAL = menu_cell_basic_cell_height(); cl_assert_equal_i(FOCUSED, l.selection...
------------------------------------------------------------------------- static void steps_up_click_handler(ClickRecognizerRef recognizer, void *context) { HealthAPITestAppData *data = (HealthAPITestAppData *)context; #if TEST_MODE data->steps_offset += 5; data->cur_steps += 5; layer_mark_dirty(window_get_root...
APP_LOG(APP_LOG_LEVEL_INFO, "Crossed HR threshold of %d. HR: %"PRIi32" ", (int)HEART_RATE_THRESHOLD, now_bpm)
; data->num_hr_alerts++; prv_hr_update_text(data); } } // ------------------------------------------------------------------------------- static void steps_base_layer_update_proc(Layer *layer, GContext* ctx) { const GRect bounds = layer_get_bounds(layer); graphics_context_set_fill_color(ctx, GColorBlac...
/* * 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 (GBitmapDataRowInfo) { .data = (uint8_t*)bitmap->addr + y * bitmap->row_size_bytes, .min_x = 0, // while this is conceptually wrong for .max_x as it should be // (.row_size_bytes / .bytes_per_pixel) - 1 // it's still a valid value as we assume grect_get_max_x(.bounds...
} MOCKABLE GBitmapDataRowInfo gbitmap_get_data_row_info(const GBitmap *bitmap, uint16_t y) { return prv_gbitmap_get_data_row_info(bitmap, y); } void gbitmap_init_with_data(GBitmap *bitmap, const uint8_t *data) { BitmapData* bitmap_data = (BitmapData*) data; memset(bitmap, 0, prv_gbitmap_size()); bitmap->ro...
e_dump_connect_ping)) == 0) { // Handshake received. Switch to tx mode. hw_spi_change_fifo_mode(s_spi->bus_id, HW_SPI_FIFO_TX_ONLY); rx_mode = false; tx_index = 0; tx_start_ticks = prv_timer_get_ticks(); continue; } else { // ...
("region table\n")
; prv_send_response((uint8_t *)s_MemoryRegions, sizeof(s_MemoryRegions)); break; case CoreDumpCmd_ReadMemory: { printf("read memory %p %d\n", cmd.addr, cmd.len); prv_send_response(cmd.addr, cmd.len); } break; case CoreDumpCmd_ReadRunningThreadInfo: p...
/* * 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...
("xPSR=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_xPSR])
; printf("SP=0x%08" PRIx32 "\n", (uint32_t) g_stacked_regs); // Stack Pointer reset_due_to_software_failure(); } static bool prv_handle_hardfault_due_to_bkpt(void) { // Note: assumes Thumb2! const uint16_t instr = *(const uint16_t *)g_stacked_regs[Stacked_Register_PC]; const uint16_t bkpt_instruction_opcode...
_with_png_data(GBitmap *bitmap, const uint8_t *data, size_t data_size) { return false; } bool gbitmap_png_data_is_png(const uint8_t *data, size_t data_size) { return false; } ResAppNum sys_get_current_resource_num(void) { return 0; } const uint8_t *sys_resource_read_only_bytes(ResAppNum app_num, uint32_t resou...
gbitmap_init_with_resource_system(&bitmap, 0, 0)
); s_fake_bitmap_data.info.format = GBitmapFormat1Bit; s_fake_bitmap_data.width = 63; cl_assert(gbitmap_init_with_resource_system(&bitmap, 0, 0)); }
rt_page) { return (!get_curr_state(start_page, TMP_STATE_OFFSET, TMP_STATE_DONE)); } static uint32_t compute_pg_header_crc(PageHeader *hdr) { PageHeader crc_hdr = *hdr; // don't factor fields which can change after file write into crc calc crc_hdr.last_written = 0xff; return legacy_defective_checksum_memory...
if ((memcmp(name, file_name, namelen) == 0) && (!is_tmp_file(pg))) { if (read_header(pg, &pg_hdr, &file_hdr) == HdrCrcCorrupt) { PBL_LOG(LOG_LEVEL_WARNING, "%d: CRC corrupt", pg); continue; } *page = pg; return (S_SUCCESS); }
} } return (E_DOES_NOT_EXIST); } // Populates 'hdr' with what the new erase header for the 'page' specified // should look like static int get_updated_erase_hdr(PageHeader *hdr, uint16_t page) { memset(hdr, 0xff, sizeof(*hdr)); // before wiping a page, get its erase_count. This is not currently used but...
lete"); text_layer_set_text(stress_data.text_layer, (char *)status); } static void app_timer_cb(void *data) { static const int num_stress_iters = 1000; struct Region region = s_flash_regions[2]; PBL_LOG(LOG_LEVEL_INFO, ">>>> %s %d", "Test Loop", stress_data.stress_iteration); PBL_LOG(LOG_LEVEL_INFO, "Erasin...
("Out of memory")
; } app_state_set_user_data(data); push_window(data); } static void handle_deinit(void) { FlashDiagAppData *data = app_state_get_user_data(); simple_menu_layer_deinit(&data->menu_layer); app_free(data); } static void s_main(void) { if (resource_storage_flash_get_unused_bank()->begin == s_flash_reg...
/* * 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...
("Invalid runlevel number. Choices:")
; prv_list_runlevels(); return; } char response[80]; strcpy(response, "Switching to runlevel "); strcat(response, s_runlevel_debug_names[runlevel]); prompt_send_response(response); services_set_runlevel(runlevel); }
/* * 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...
ios_notif_pref_db_insert((uint8_t *) key, key_len, (void *) &val, val_len)
; } static void prv_support_sms_replies_no_emoji(void) { // Store the preference in our DB char *key = "com.apple.MobileSMS"; int key_len = strlen(key); const int flags = 0; const int num_attributes = 0; const int num_actions = 1; const int action_id = 12; const int reply_action_attrs = 2; // Title + E...
map_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r16_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r16_cli...
(&ctx, fb)
; layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_ny_offset_layer.${BIT_DEPTH_NAME}.pbi")); } #define OFFSET_RECT_NO_CLIP GRect(10, 10, 40, 50) #define OFFSET_RECT_CLIP_XY GRect(10, 10, 3...
_active__workout_render_run(void) { s_workout_data = (WorkoutData) { .steps = 567, .duration_s = 84, .distance_m = 1234, .avg_pace = health_util_get_pace(84, 1234), .bpm = 71, .hr_zone = 0, }; WorkoutActiveWindow *active_window = workout_active_create_for_activity_type( ActivitySess...
(active_window, 2)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } // Workout Tests ////////////////////// void test_workout_active__sports_pace(void) { s_sports_data = (SportsData) { .current_bpm = 71, .duration_string = "30:00", .distance_string = "5.0", .pace_string = "6:00", }; WorkoutMet...
/* * 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(*output == 0)
; // add one more entry uint32_t input = i; lru_cache_put(&s_cache, i, &input); // check that entry 0 is around output = lru_cache_get(&s_cache, 0); cl_assert(output); cl_assert(*output == 0); // check that entry 1 got evicted output = lru_cache_get(&s_cache, 1); cl_assert(output == NULL); // ...
tion_b, Animation *animation_c, ...) { PBL_ASSERTN(!animation_private_using_legacy_2(NULL)); va_list args; va_start(args, animation_c); Animation *animation = prv_call_using_vargs(animation_spawn_create_from_array, animation_a, animation_b, animation...
animation_private_resume()
snprintf(file_small, sizeof(file_small), "file%d", i); snprintf(buf, sizeof(buf), "This is small buf %d!", i); int len = strlen(buf); int fd = pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, len); cl_assert(fd >= 0); cl_assert(pfs_write(fd, (uint8_t *)buf, len) == len); cl_...
{ snprintf(file_small, sizeof(file_small), "file%d", i); uint8_t buf[PFS_SECTOR_SIZE * 2]; memset(&buf[0], i, sizeof(buf)); int fd = pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(buf)); cl_assert(fd >= 0); cl_assert_equal_i(pfs_write(fd, &buf[0], sizeof(buf)), sizeof(buf)); ...
// force partial garbage collection test_force_reboot_during_garbage_collection(start_page); // reset our state variables, there should be no files found pfs_reset_all_state(); for (int i = 0; i < pages_to_write; i++) { snprintf(file_small, sizeof(file_small), "file%d", i); int fd = pfs_open(file_s...
e_address, sizeof(region_hdr)); // Clear the unformatted bit in the flash region header flash_hdr.unformatted &= ~(1 << start_idx); prv_flash_write_bytes(&flash_hdr, CORE_DUMP_FLASH_START, sizeof(flash_hdr)); return base_address; } // -------------------------------------------------------------------------...
{ // registers [r0-r12, msp, lr, pc, psr] packed_info.registers[i] = s_saved_registers.core_reg[i]; }
(LOG_LEVEL_ERROR, "Not getting BLE id %d. Type mismatch", bonding)
; return false; } strncpy(data.ble_data.name, device_name, BT_DEVICE_NAME_BUFFER_SIZE); data.ble_data.name[BT_DEVICE_NAME_BUFFER_SIZE - 1] = '\0'; GapBondingFileSetStatus status; status = prv_file_set(&bonding, sizeof(bonding), &data, sizeof(data)); // If this is the gateway, update SPRF so our pairi...
char name_in[BT_DEVICE_NAME_BUFFER_SIZE] = "Device 1"; uint8_t platform_bits_in = 0x11; BTBondingID id = bt_persistent_storage_store_bt_classic_pairing(&addr_in, &link_key_in, name_in, &platform_bits_in); prv_fire_writeback_timer(); cl_assert(id !=...
prv_fire_writeback_timer()
; cl_assert(id_1 != BT_BONDING_ID_INVALID); // It should be the active gateway ret = bt_persistent_storage_get_active_gateway(&id_out, &type_out); cl_assert(ret); cl_assert_equal_i(id_out, id_1); cl_assert_equal_i(type_out, BtPersistBondingTypeBTClassic); ret = bt_persistent_storage_has_active_bt_classi...
onst Connection *connection) { return prv_get_flag(connection, ConnectionFlag_ShouldAutoAcceptRePairing); } bool connection_is_reversed_ppogatt_enabled(const Connection *connection) { return prv_get_flag(connection, ConnectionFlag_IsReversedPPoGATTEnabled); } bool connection_is_subscribed_to_gatt_mtu_notification...
prv_unlock()
; } // // Other functions // void connection_enqueue_gatt_op(Connection *connection, uintptr_t context_ref, GattRespDest resp_dest, GattOpType op_type) { prv_lock(); { GattOperation *node = kernel_malloc_check(sizeof(GattOperation)); *node = (GattOperation) { .object_...
/* * 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 BleConnectionParamsUpdateReq *params = &req->params; gap_conn_params_t conn_params = { .interval_min = params->interval_min_1_25ms, .interval_max = params->interval_max_1_25ms, .slave_latency = params->slave_latency_events, .sup_timeout = params->supervision_timeout_10ms, }; Connection ...
void hc_endpoint_responsiveness_notify_update( const BleConnectionParams *params, const BTDeviceInternal *addr, HciStatusCode status) { uint8_t response_len = sizeof(HcProtocolMessage) + sizeof(BleConnectionUpdateCompleteEvent); uint8_t buf[response_len]; HcProtocolMessage *msg = (HcProtocolMessa...
.started = prv_started_handler, .stopped = prv_stopped_handler }; static const PropertyAnimationImplementation implementation = { .base = { .update = (AnimationUpdateImplementation) property_animation_update_gpoint, }, .accessors = { .setter = { .gpoint = (const GPointSetter) prv_gpo...
property_animation_get_from_gtransform(prop_h, &test_value)
; cl_assert_equal_gtransform(test_value, GTransformIdentity()); property_animation_set_from_gtransform(prop_h, &start_value); // Start, we should start at the start values prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_gtransform(value, start_value); // Halfway through prv_advance_to_ms_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...
GPoint(segment_width * i, SCREEN_HEIGHT)
); graphics_draw_line(ctx, GPoint(0, segment_height * i), GPoint(SCREEN_WIDTH, segment_height * i)); } #endif gpath_rotate_to(s_current_path, s_path_angle * TRIG_MAX_ANGLE / 360); if (s_outline_mode) { graphics_context_set_stroke_color(ctx, GColorBlack); gpath_draw_outline(ctx, s_cur...
/* * 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...
{ BTErrno rv = BTErrnoOK; HcGattHdr *hdr = (HcGattHdr *)&msg->payload[0]; Connection *conn = connection_by_address(&hdr->addr); if (!conn) { rv = BTErrnoInvalidParameter; goto respond; } const uint16_t conn_idx = connection_get_idx(conn); if (ppogatt_emulated_server_handle_msg(conn_idx, conn, ms...
void hc_endpoint_gatt_send_read_complete(const BTDeviceInternal *addr, uint16_t handle, BLEGATTError status, uint16_t value_length, const uint8_t *value, uintptr_t context_ref) { const uint32_t alloc_size = sizeof(HcGattReadRespData) + value_length; HcGattReadRespData *data = kernel_zalloc_check(alloc_size);...
/* * 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 launcher_task_is_current_task(); }
// Test copy when there is nothing in the buffer: cl_assert_equal_i(circular_buffer_copy(&buffer, data_out, data_out_size), 0); // Write + consume, so read index is at 2: circular_buffer_write(&buffer, (uint8_t *)"0123", 4); circular_buffer_consume(&buffer, 2); // Write data that will be wrapped: circula...
(&buffer, 2)
; cl_assert_equal_i(circular_buffer_copy(&buffer, copy_out, copy_out_size), 8); cl_assert_equal_i(memcmp(copy_out, "234567AB", 8), 0); contiguous_num_bytes_left = circular_buffer_write_prepare(&buffer, &data_out); cl_assert_equal_i(contiguous_num_bytes_left, 0); cl_assert_equal_p(data_out, NULL); } void te...
} static void prv_toggle_playing(void) { music_command_send(MusicCommandTogglePlayPause); } static void prv_play_pause_click_handler(ClickRecognizerRef recognizer, void *context) { reset_action_bar_revert_timer(context); prv_toggle_playing(); } static void prv_handle_volume_repeat(void *context) { MusicAppD...
{ window_single_click_subscribe(BUTTON_ID_BACK, prv_handle_no_music_back); }
static MusicNoMusicWindow *prv_create_no_music_window(void) { MusicNoMusicWindow *window = app_malloc_check(sizeof(MusicNoMusicWindow)); window_init(&window->window, WINDOW_NAME("NoMusicWindow")); window_set_background_color(&window->window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite)); window_set_window_...
animation->duration_ms) : ANIMATION_NORMALIZED_MAX; const uint32_t time_normalized = MIN(time_normalized_raw, ANIMATION_NORMALIZED_MAX); uint32_t distance_normalized; if (animation->curve >= AnimationCurveCustomFunction) { distance_normalized = prv_custom_curve_ptr_unpack( ...
{ dbgserial_putstr_fmt(buffer, buffer_size, "<%p> { abs_start_time_ms = %"PRIu32", delay = %"PRIu32", duration = %"PRIu32", " "curve = %i, run = %p }", animation, animation->abs_start_time_ms, animation->delay_ms, animation->duration_ms, animation->curve, animation->implementation->u...
} void command_legacy2_animations_info(void) { char buffer[128]; dbgserial_putstr_fmt(buffer, sizeof(buffer), "Now: %"PRIu32, animation_legacy2_get_ms_since_system_start()); dbgserial_putstr_fmt(buffer, sizeof(buffer), "Kernel AnimationLegacy2s:"); dump_scheduler(buffer, sizeof(buffer),...
G(LOG_LEVEL_ERROR, "Failed to query BMA255"); return; } const bool pass = bma255_selftest(); if (pass) { PBL_LOG(LOG_LEVEL_DEBUG, "BMA255 self test pass, all 3 axis"); } else { PBL_LOG(LOG_LEVEL_ERROR, "BMA255 self test failed one or more axis"); } // Workaround to fix FIFO Frame Leakage: Disab...
prv_get_curr_system_time_ms()
* 1000; const uint32_t sampling_interval_us = accel_get_sampling_interval(); uint8_t fifo_status = bma255_read_register(BMA255Register_FIFO_STATUS); BMA255_DBG("Drain %"PRIu8" samples", num_samples_available); const uint8_t num_samples_available = fifo_status & 0x3f; if (num_samples_available == 0) { r...
/* * 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...
{ void *ptr = prv_heap_malloc(bytes); if (ptr) { memset(ptr, 0, bytes); } return ptr; }
void *kernel_malloc_check(size_t bytes) { void *ptr = prv_heap_malloc(bytes); PBL_ASSERTN(ptr); return ptr; } void *kernel_zalloc_check(size_t bytes) { void *ptr = prv_heap_malloc(bytes); PBL_ASSERTN(ptr); memset(ptr, 0, bytes); return ptr; } void kernel_free(void *ptr) { register uintptr_t lr __asm...
perties; typedef struct AppData { uint8_t property; GColor bg_color; GColor fg_color; uint8_t alpha; TextLayer *alpha_text; char alpha_text_buffer[30]; TextLayer *fg_text; char fg_text_buffer[5]; TextLayer *fg_color_text; char fg_color_text_buffer[20]; uint8_t fg_color_index; TextLayer *bg_te...
GPoint(point.x + 1, point.y)
se /* connected */, (1 << PebbleTask_App), GAPLEConnectHCIReasonExtensionAirPlaneMode); } // ----------------------------------------------------------------------------- // Auto-reconnect Tests void __disabled_test_gap_le_connect__single_client_no_autoreconnect(void) { BTDeviceInternal de...
(&device, GAPLEClientApp)
; cl_assert_equal_i(e, BTErrnoOK); // The LE Cancel Create Connection command is always followed by an event that // is sent by the BT Controller. Simulate this event: fake_gap_le_put_cancel_create_event(&device, true /* is_master */); // Verify the app task got a (virtual) disconnection event: prv_assert...
tests start at 5pm, which is 1020 minutes into a 1440 minute day. The BMR for // the above user is 1388 kcalories per day, so we expect to get: // 1388 * 1020/1440 = 1023 kcalories activity_get_metric(ActivityMetricRestingKCalories, 1, &value); const int k_bmr_cal = 1388 * ACTIVITY_CALORIES_PER_KCAL; cl_a...
(value, SECONDS_PER_HOUR)
; activity_get_metric(ActivityMetricStepCount, 1, &value); cl_assert_equal_i(value, k_exp_steps_2); activity_get_metric(ActivityMetricActiveKCalories, 1, &value); // The following determined from a known good commit int32_t exp_active_kcalories_2 = 486; cl_assert_equal_i(value, exp_active_kcalories_2); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; Uuid descriptor_uuid = ble_descriptor_get_uuid(descriptor); uuid_to_string(&descriptor_uuid, uuid_buffer); APP_LOG(APP_LOG_LEVEL_INFO, "Read Descriptor %s, %u bytes, error: %u", uuid_buffer, value_length, error); for (size_t i = 0; i < value_length; ++...
static void read_handler(BLECharacteristic characteristic, const uint8_t *value, size_t value_length, uint16_t value_offset, BLEGATTError error) { char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; Uuid characteristic_uu...
/* * 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...
(bitmap_layer_get_layer(&bitmap_layer), &s_ctx)
; } static void prv_origin_bitmap_layer_test(GPoint bounds_origin) { prv_bitmap_layer_test(GPointZero, bounds_origin); } static void prv_offset_bitmap_layer_test(GPoint bounds_origin) { prv_bitmap_layer_test(TEST_LAYER_OFFSET_ORIGIN, bounds_origin); } // Composite Test Support ///////////////////////////////////...
GAPLEConnectHCIReasonExtensionCancelConnect); } bt_unlock(); return ret_value; } // ------------------------------------------------------------------------------------------------- BTErrno gap_le_connect_connect_by_bonding(BTBondingID bonding_id, bool auto_reconnect, ...
bt_unlock()
; } // ------------------------------------------------------------------------------------------------- // For unit testing bool gap_le_connect_has_pending_create_connection(void) { bt_lock(); const bool ret_value = s_has_pending_create_connection; bt_unlock(); return ret_value; } bool gap_le_connect_has_co...
/* * 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...
(atol("2147483647"), 2147483647)
GE_ENDPOINT_ID (0x31) #define RUN_STATE_KEY (1) #define STATE_FETCH_KEY (2) #define INVALID_KEY (0xffffffff) #define RUNNING (1) #define NOT_RUNNING (0) #define TRANSACTION_ID (0xA5) #define assert_ack(ack) \ fake_comm_session_process_send_next(); \ const AppMessageAc...
fake_transport_assert_nothing_sent(s_transport)
; } void test_launcher_app_message__send_app_state(void) { Uuid uuid = {APP_UUID_RAW}; bool running = true; launcher_app_message_send_app_state_deprecated(&uuid, running); // Even though the Launcher App Message documentation states that the value is a uint8_t, // the original implementation used uint32_t f...
l compare = true; if (data->property == PROPERTY_FG_COLOR) { compare_color = data->fg_color; } else if (data->property == PROPERTY_BG_COLOR) { compare_color = data->bg_color; } else { compare = false; } for (uint8_t row = 0; row < 2; row++) { for (uint8_t color_index = row * ROW_LENGTH; colo...
graphics_fill_rect(ctx, &GRect(72, 0, 72, 110))
/* * 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...
{ QuickLaunchData *data = (QuickLaunchData *) context; i18n_free_all(data); app_free(data); }
static void prv_update_app_names(QuickLaunchData *data) { for (ButtonId button = 0; button < NUM_BUTTONS; button++) { char *subtitle_buf = data->app_names[button]; prv_get_subtitle_string(quick_launch_get_app(button), data, subtitle_buf, APP_NAME_SIZE_BYTES); } } static void prv_draw_row_cb(SettingsCallb...
/* * 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_i(state, ResponseTimeMin)
; cl_assert_equal_i(secs_to_wait, BT_CONN_MGR_INACTIVITY_TIMEOUT_SECS); cl_assert_equal_i(fake_gap_le_connect_params_get_last_requested(), ResponseTimeInvalid); prv_regular_timer_spend_seconds(BT_CONN_MGR_INACTIVITY_TIMEOUT_SECS); state = conn_mgr_get_latency_for_le_connection(&s_hdl, &secs_to_wait); cl_ass...
_valid); if (free_region_start >= 0) { s_gc_block = (GCBlock) { .block_valid = true, .block_writes = 0, .gc_start_page = free_region_start }; PBL_LOG(LOG_LEVEL_DEBUG, "New Erase Region: %d", s_gc_block.gc_start_page); return (true); } return (false); } ...
{ // IMPORTANT: prv_invoke_watch_file_callbacks assumes that we already have s_pfs_mutex prv_invoke_watch_file_callbacks(f->name, FILE_CHANGED_EVENT_CLOSED); }
res = S_SUCCESS; cleanup: mutex_unlock_recursive(s_pfs_mutex); return (res); } status_t pfs_close_and_remove(int fd) { mutex_lock_recursive(s_pfs_mutex); status_t res = E_UNKNOWN; if (!FD_VALID(fd)) { res = E_INVALID_ARGUMENT; } else { File *f = &PFS_FD(fd).file; char file_name[f->namelen ...
umbers measured from design spec const int16_t vertical_divider_height = PBL_IF_ROUND_ELSE(107, 50); const int16_t horizontal_divider_width = PBL_IF_ROUND_ELSE(51, bounds.size.w - ACTION_BAR_WIDTH); const int16_t vertical_divider_x_offset = PBL_IF_ROUND_ELSE(72, horizontal_divider_width / 2); const int16_t hori...
layer_add_child(background, status_bar_layer_get_layer(data->status_layer))
; // labels const char * const font_key_label = FONT_KEY_GOTHIC_09; // back, mid, front numbers const char * const font_key_small_numbers = PBL_IF_ROUND_ELSE(FONT_KEY_LECO_20_BOLD_NUMBERS, FONT_KEY_LECO_28_LIGHT_NUMBERS); const char * const font...
c == ActivityMetricRestingKCalories) { uint32_t full_day_resting_calories = activity_private_compute_resting_calories(MINUTES_PER_DAY); for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++) { if (i == 0) { uint32_t elapsed_minutes = time_util_get_minute_of_day(utc_now); ...
mutex_unlock_recursive(state->mutex)
; return success; } // ------------------------------------------------------------------------------------------------ DEFINE_SYSCALL(bool, sys_activity_get_metric, ActivityMetric metric, uint32_t history_len, int32_t *history) { if (PRIVILEGE_WAS_ELEVATED) { if (history) { syscall_asser...
eFitCircle, fill_thickness, 0, to_angle); #endif } #if PBL_ROUND static void prv_draw_outer_dots(GContext *ctx, GRect bounds) { const GRect inset_bounds = grect_inset(bounds, GEdgeInsets(6)); // outer dots placed along inside circumference const int num_dots = 12; for (int i = 0; i < num_dots; i++) { GPoi...
graphics_text_node_create_horizontal(MAX_TEXT_NODES)
; GTextNodeContainer *container = &horiz_container->container; horiz_container->horizontal_alignment = GTextAlignmentCenter; char time_buffer[8]; char am_pm_buffer[4]; const time_t now = rtc_get_time(); /// Current time in 24 or 12 hour const char *time_fmt = clock_is_24h_style() ? "%R" : "%l:%M"; str...
heir very low default retry count which // could cause us to lose events if the system is busy doing something else. #define NUM_RETRIES (0x10CC) // data lengths #define DATA_LEN_FINGER (3) #define DATA_LEN_STATUS_RESPONSE (3) typedef union { uint8_t packet_id; struct PACKED { uint32_t data; uint32_t padd...
{ // invalid type WTF; }
} #endif // Memory Operations //////////////////////////////////////////////////////////////////////////////// #if 0 // TODO: we might want to use these this to verify configuration settings static uint16_t prv_read_ram(uint16_t address) { address = htons(address); MemoryPacket packet = { .packet_id = PACKE...
done_callback; void* callback_data; } InstallCallbackData; InstallCallbackData s_install_callback_data; static bool prv_ids_equal(AppInstallId one, AppInstallId two) { return ((one == two) && (one != INSTALL_ID_INVALID)); } static void app_install_launcher_task_callback(void *context) { if (!s_install_callbac...
PBL_LOG(LOG_LEVEL_ERROR, "Failed to do app callbacks, already in progress")
; return false; } s_install_callback_data = (InstallCallbackData) { .callback_in_progress = true, .install_id = install_id, .uuid = uuid, .install_type = event_type, .done_callback = done_callback, .callback_data = callback_data }; launcher_task_add_callback(app_install_launcher_ta...
if (y >= framebuffer->bounds.size.h || y < 0) { return; }
int16_t x_min = MAX(MIN(x0, x1), framebuffer->bounds.origin.x); int16_t x_max = MIN(MAX(x0, x1), framebuffer->bounds.origin.x + framebuffer->bounds.size.w); for (int i=x_min; i < x_max; i++) { #if SCREEN_COLOR_DEPTH_BITS == 8 GColor *output = (GColor*)framebuffer->addr + y * framebuffer->row_size_bytes + i...
*session, const uint8_t *data, uint32_t length) { if (length < MIN_INSERT_LENGTH) { prv_send_response(session, prv_try_read_token(data, length), BLOB_DB_INVALID_DATA); return; } const uint8_t *iter = data; BlobDBToken token; BlobDBId db_id; // Read token and db_id iter = endpoint_private_read_t...
prv_send_response(session, prv_try_read_token(data, data_length), BLOB_DB_INVALID_OPERATION)
; break; } } void blob_db_protocol_msg_callback(CommSession *session, const uint8_t* data, size_t length) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); analytics_inc(ANALYTICS_DEVICE_METRIC_BLOB_DB_EVENT_COUNT, AnalyticsClient_System); PBL_HEXDUMP_D(LOG_DOMAIN_BLOBDB, LOG_LEVEL_DEBUG, data, length); ...
/* * 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_INFO, (const uint8_t *)&bonding->pairing_info.local_encryption_info.ediv, sizeof(bonding->pairing_info.local_encryption_info.ediv))
/* * 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...
{ 904, 944, -680}, { 688, 472, -472}, { 688, 312, -408}, { 912, 728, -496}, { 816, 480, -296}, { 968, 960, -392}, { 872, 912, -264}, { 704, 632, -152}, { 648, 576, -232}, { 600, 728, -384}, { 672, 496, -192}, { 656, 384, -72}, { 656, 456, -224}, { 744, 488, -152},...
// 5 seconds { 720, 224, 152}, { 664, 184, 136}, { 632, 184, 168}, { 752, 280, 64}, { 784, 168, 168}, { 872, 368, 64}, { 1208, 288, 120}, { 1344, 296, 240}, { 1576, 392, 216}, { 1352, 552, 96}, { 784, 400, -24}, { 832, 296, -48}, { 944, 8, 280}, { 952, 184, 2...
bool result = rocky_event_loop_with_string_or_snapshot(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 cl...
(jerry_eval((const jerry_char_t *)source, strlen(source), false))
; cl_assert_equal_i(s_app_heap_analytics_log_rocky_heap_oom_fault_call_count, 1); }
, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, ...
for(; (i < (Nb * (Nr + 1))); ++i) { for(j = 0; j < 4; ++j) { tempa[j]=RoundKey[(i-1) * 4 + j]; } if (i % Nk == 0) { // This function rotates the 4 bytes in a word to the left once. // [a0,a1,a2,a3] becomes [a1,a2,a3,a0] // Function RotWord() { k = tempa[0]; ...
} // This function adds the round key to state. // The round key is added to the state by an XOR function. static void AddRoundKey(uint8_t round) { uint8_t i,j; for(i=0;i<4;++i) { for(j = 0; j < 4; ++j) { (*state)[i][j] ^= RoundKey[round * Nb * 4 + i * Nb + j]; } } } // The SubBytes Functio...
ROCKY_BSS__[]; memset(__ROCKY_BSS__, 0, (size_t)__ROCKY_BSS_size__); // ROCKY_BSS is inside APP_RAM to make the syscall buffer checks pass. // However, we want to avoid overlapping with any splits we're about to make: app_ram.end = __ROCKY_BSS__; // Reduce the size available for the code + app hea...
(s_app_task_context.install_id, &entry)
INSIGHTS_LOG_DEBUG("Not notifying sleep pin - not active enough (%d < %d)", s_sleep_pin_state.active_minutes, trigger_active_minutes)
; return; } s_sleep_pin_state.notified = true; prv_push_sleep_summary_notification(now_utc, sleep_total_seconds, s_sleep_stats.mean, VARIANT_RANDOM); prv_save_state(ActivitySettingsKeyInsightSleepSummaryState, &s_sleep_pin_state, sizeof(s_sleep_pin_st...
/* * 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 status; }
return pfs_remove(name); } static bool prv_bad_persist_file_filter(const char *filename) { return is_app_file_name(filename) && strcmp(filename + APP_FILE_NAME_PREFIX_LENGTH, "persist") == 0; } // Designed to be called once during reset void persist_service_init(void) { persist_map_init(); s_mutex =...
/* * 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_sensor_enable(false); }
// Multiply vmon/vref * 2/3 to find a percentage of the full scale and then // multiply it back by 4096 to get a full 12-bit light level. uint32_t value = (reading.vmon_total * 4096 * 2) / (reading.vref_total * 3); return value; } void command_als_read(void) { char buffer[16]; prompt_send_response_fmt(bu...
u 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 WARRANT...
prv_unlock()
; } void exti_disable_other(ExtiLineOther exti_line) { prv_lock(); uint32_t exti_bit = prv_exti_line_to_bit(exti_line); EXTI->IMR &= ~exti_bit; EXTI->PR = exti_bit; // No need to disable the NVIC ISR. If all the EXTIs that feed a given shared ISR are disabled // the ISR won't fire. prv_unlock(); } v...
void test_hrm_manager__set_features(void) { AppInstallId app_id = 1; const uint16_t expire_s = SECONDS_PER_MINUTE; const HRMSessionRef session_ref = sys_hrm_manager_app_subscribe(app_id, 1, expire_s, HRMFeature_BPM); HRMSubscriberState *state =...
hrm_is_enabled(HRM)
x06, .write_disable = 0x04, .read_status = 0x05, .read_flag_status = 0x2B, .erase_suspend = 0xB0, .erase_resume = 0x30, .enter_low_power = 0xB9, .exit_low_power = 0xAB, .enter_quad_mode = 0x35, .reset_enable = 0x66, .reset = 0x99, .qspi_id = 0xAF, .block_lock = 0x36, ...
qspi_flash_erase_resume(QSPI_FLASH, sector_addr)
; return S_SUCCESS; } status_t flash_impl_read_sync(void *buffer_ptr, FlashAddress start_addr, size_t buffer_size) { PBL_ASSERT(buffer_size > 0, "flash_impl_read_sync() called with 0 bytes to read"); qspi_flash_read_blocking(QSPI_FLASH, start_addr, buffer_ptr, buffer_size); return S_SUCCESS; } int flash_impl_...
the delete till after the callback returns. The next call // to task_timer_manager_execute_expired_timers service loop will take care of this for us. if (timer->executing) { timer->defer_delete = true; mutex_unlock(manager->mutex); } else { PBL_ASSERTN(list_contains(manager->idle_timers, &timer->list...
if (next_timer->defer_delete) { PBL_ASSERTN(list_contains(manager->idle_timers, &next_timer->list_node)); list_remove(&next_timer->list_node, &manager->idle_timers /* &head */, NULL /* &tail */); mutex_unlock(manager->mutex); kernel_free(next_timer); } else { mutex_unlock(manager->mu...
} } void* task_timer_manager_get_current_cb(const TaskTimerManager *manager) { return manager->current_cb; }
} else { break; // the list is ordered so we are done } node = next_node; } } static void prv_put_outgoing_call_event(uint32_t call_identifier, const char *caller_id) { PebbleEvent event = { .type = PEBBLE_PHONE_EVENT, .phone = { .type = PhoneEventType_Outgoing, .source = PhoneC...
(*head, timestamp, iter_state->midnight, direction)
; TimelineNode *node = prv_find_first(*head, direction, timestamp, iter_state->midnight, iter_state->show_all_day_events); if (node == NULL) { iter_init(iter, prv_iter_dummy, prv_iter_dummy, iter_state); return S_NO_MORE_ITEMS; } status_t rv = pin_db_get(&node->id, &iter_state->pin); if (rv != S_...
har *device_name = "iPhone"; BTBondingID id = bt_persistent_storage_store_ble_pairing(&pairing, false /* is_gateway */, device_name, false /* requires_address_pinning */, ...
cl_assert_equal_i(id_1, id_X)
; cl_assert_equal_i(fake_shared_prf_storage_get_bt_classic_store_count(), 2); // Read both pairings back again ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_1, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl_assert_...
t); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1); cl_assert_equal_i(fake_notification_storage_get_store_count(), 1); cl_assert_equal_i(fake_notification_storage_get_remove_count(), 0); // If there's a notification that matches with a different uid, we update the notificat...
ancs_handle_service_discovered(s_characteristics)
; // we should be back in the Idle state cl_assert_equal_i(prv_get_state(), ANCSClientStateIdle); // Make sure we can still receive notifications prv_send_notification((uint8_t *)&s_complete_dict); cl_assert_equal_i(s_num_requested_notif_attributes, 2); cl_assert_equal_i(s_num_ds_notifications_received, 1);...
the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "services/normal/blob_db/reminder_db.h" // Fixture //////////////////////////////////////////////////////////////// // Fakes //////////////////////////////////////////////////////////////...
cl_assert_equal_i(S_SUCCESS, reminder_db_insert_item(&item3))
; } // Setup //////////////////////////////////////////////////////////////// void test_reminder_db__initialize(void) { reminder_db_init(); } void test_reminder_db__cleanup(void) { reminder_db_deinit(); fake_settings_file_reset(); } // Tests //////////////////////////////////////////////////////////////// vo...
date_callback); layer_render_tree(&layer, &ctx); #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_clear.8bit.pbi")); #else cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)); #endif } #define BOX_OFFSET_X 8 #define BOX_OFFSET_Y 4 #define ...
GPoint(19, 5)
bsolute value of %+u", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, the absolute value of 4294967292"); // Minimum digits output snprintf(dstbuf, 256, "There are %.2u lights, %.2u", 4, -4); cl_assert_equal_s(dstbuf, "There are 04 lights, 4294967292"); // Minimum digits output (zero digits) snpri...
(dstbuf, "zero1")
; // Horrible thing snprintf(dstbuf, 256, "%#.ozero", 0); cl_assert_equal_s(dstbuf, "0zero"); // Length modifiers uint64_t hurf = 0x123456789ABCDEF0ULL; snprintf(dstbuf, 256, "%hho,%ho,%o,%lo", hurf, hurf, hurf, hurf); cl_assert_equal_s(dstbuf, "360,157360,23257157360,23257157360"); snprintf(dstbuf, 2...
x, int y); #elif SCREEN_COLOR_DEPTH_BITS == 8 extern GColor get_bitmap_color(GBitmap *bmp, int x, int y); #endif void test_graphics_draw_rotated_bitmap__initialize(void) { s_fake_data_row_handling = false; fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_image_bw = ...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_bw_set_0.Xbit.pbi")
); // Top-left corner rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet); graphics_draw_rotated_bitmap(&ctx, test_image_bw, GPointZero, DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, ...
/* * 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...
dbgserial_putstr("Stuck button register is invalid, clearing.")
; dbgserial_print_hex(button_counter_register); RTC_WriteBackupRegister(STUCK_BUTTON_REGISTER, 0); return false; } button_counter[button_id] += 1; if (button_counter[button_id] >= STUCK_BUTTON_THRESHOLD) { dbgserial_print("Button id "); dbgserial_print_hex(button_id); ...
e, oldest_requested_utc); // Create the context AlgReadMinutesContext context = (AlgReadMinutesContext) { .minute_data = minute_data, .array_size = array_size, .oldest_key = prv_minute_file_get_settings_key(oldest_requested_utc) - 1, .newest_key = prv_minute_file_get_settings_key(utc_now) + 1, ...
prv_write_minute_file_record(&record)
; if (!success) { break; } system_task_watchdog_feed(); if ((i % 25) == 0) { PBL_LOG(LOG_LEVEL_DEBUG, "wrote %"PRIu32" records...", i); } } PBL_LOG(LOG_LEVEL_DEBUG, "Done. End # of records: %"PRIu16, s_alg_state->num_minute_records); return success; } // ------------------------...
/* * 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...
pp_get_phone_state()
alse = move left or right bool word_wrap; // True = word wrap; False = don't word wrap } AppState; static const char* text_buffer = "Text Clipping"; static void init_text_layer(AppState *data, GRect frame) { text_layer_init(&data->text_layer, &GRect(frame.origin.x, frame.origin.y, ...
graphics_draw_rect(ctx, &GRect(39, 39, 82, 42))
; } static void prv_window_load(Window *window) { AppState *data = window_get_user_data(window); data->select_index = SelectIndexPixels; data->up_down_direction = true; data->word_wrap = false; // Init canvas (i.e. clipping box) data->canvas_size = GSize(80, 40); layer_init(&data->canvas, &GRect(40, 4...
1088, 928}, { 8, 1048, 632}, { -40, 664, 368}, { -128, 480, 384}, // 46 seconds { -80, 648, 440}, { 0, 744, 512}, { 24, 672, 448}, { -24, 576, 408}, { -88, 600, 400}, { -32, 712, 352}, { -48, 712, 392}, { -64, 728, 496}, { 0, 1096, 600}, { 96, 1168, 688}, { 88...
{ 8, 592, 400}, { 16, 696, 416}, { 24, 688, 344}, { -32, 704, 328}, { -56, 712, 304}, { -16, 800, 320}, { -16, 824, 296}, // 52 seconds { -32, 936, 344}, { 56, 1112, 408}, { 240, 1128, 552}, { 184, 1352, 816}, { 336, 1168, 616}, { 280, 800, 200}, { 144, 544, 1...
{ 176, 688, 168}, { 112, 528, 232}, { 72, 520, 312}, { -32, 584, 304}, { -40, 744, 312}, { -8, 720, 344}, { -48, 832, 264}, { -32, 864, 224}, { -64, 944, 208}, { -136, 1008, 264}, { -144, 1136, 384}, { -80, 1072, 584}, // 55 seconds { -24, 1336, 928}, { 144, ...
/* * 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_add_child(&s_low_power_data->low_power_window.layer, &s_low_power_data->low_power_kino_layer.layer)
; text_layer_init_with_parameters(&s_low_power_data->low_power_time_layer, &s_low_power_data->low_power_window.layer.frame, NULL, text_font, GColorBlack, GColorClear, text_alignment, text_overflow_mode); layer_set_frame(&s_low_power_data->low_powe...
VEL_DEBUG, LOG_LEVEL_DEBUG_VERBOSE, LOG_LEVEL_DEBUG_VERBOSE, LOG_LEVEL_DEBUG_VERBOSE }; static const struct OVERRUN { HcProtocolMessage hc_header; BinLogMessage_Header_v1 header; uint8_t string[8]; } OVERRUN = { .hc_header = { .message_length = sizeof(OVERRUN), }, ...
hw_uart_send(CONFIG_LOG_UART, data, length, prv_uart_tx_callback, NULL)
; } static void prv_log_to_buffer(uint8_t *buffer, uint16_t length) { prv_lock(); if (!circular_buffer_write(&s_log_buffer.circular_buffer, buffer, length)) { // Out of memory! Attempt to print an overrun message circular_buffer_write(&s_log_buffer.circular_buffer, (uint8_t *)&OVERRUN.header, ...
n = ACTIVITY_INSIGHTS_SETTINGS_CURRENT_STRUCT_VERSION, \ .enabled = true, \ .summary = { \ .above_avg_threshold = 10, \ .below_avg_threshold = -10, \ .fail_threshold = -50, \ .activity = { \ .trigger_minute = (20 * MINUTES_PER_HOUR) + 30, \ .update_threshold_steps = 1000, \ .update...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Didn't find insight with key %s", insight_name); goto close; }
(&ctx->font_cache, text_box_params->font, current_codepoint)
; } // Safety check if (walked_width_px < next_glyph_width_px) { break; } walked_width_px -= next_glyph_width_px; if (!iter_prev(&char_iter)) { break; } current_codepoint = utf8_iter_state->codepoint; } } if (line->suffix_codepoint) { GRect ...
}, { -1120, 64, -264}, { -1264, 112, -240}, { -1280, 16, -24}, { -1456, 80, 96}, // 28 seconds { -1800, 288, 48}, { -1840, 464, 56}, { -1440, 368, 224}, { -1192, 424, 8}, { -1064, 272, 32}, { -1184, 232, 120}, { -1208, 232, 184}, { -1416, 272, 288}, { -1392, 448, ...
{ -952, -168, -104}, { -1040, -104, -136}, { -1224, -48, -192}, { -1152, 64, -184}, { -1320, 40, -24}, { -1640, 152, 80}, { -1864, 328, 40}, { -1688, 424, 136}, { -1392, 488, 104}, { -1064, 632, -128}, { -1072, 280, -40}, { -1200, 280, 216}, { -1152, 232, 88}, { -...
4 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...
(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_across_y_origin_layer"))
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_across_ny_origin_layer"))); } void test_graphics_draw_line__offset_layer(void) { GConte...
pplib/ui/recognizer/recognizer_private.h" #include "util/size.h" // Stubs #include "stubs_app_state.h" #include "stubs_gbitmap.h" #include "stubs_graphics.h" #include "stubs_heap.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_proc...
{ prv_store_recognizer_idx(recognizer, &s_recognizers_handled); return true; }
static Recognizer **prv_create_recognizers(int count) { Recognizer **recognizers = malloc(sizeof(Recognizer*) * count); cl_assert(recognizers); for (int i = 0; i < count; i++) { recognizers[i] = recognizer_create_with_data(&s_dummy_impl, &i, sizeof(i), prv_su...
/* * 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_test_db.ram_storage, key, key_len)
; }
ius, 2); r = GRect(0, 0, 6, 6); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 2.5, 2.5); cl_assert_fixedS16_3(radius, 2.5); r = GRect(0, 0, 10, 10); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 4.5, 4.5); cl_assert_fixedS...
cl_assert_equal_i(DEG_TO_TRIGANGLE(180), TRIG_PI)
f (uuid_equal(&factory->uuid, &node->uuid)) { glance = factory->constructor(node); break; } } // If we haven't loaded a glance yet, try loading a generic glance for the node if (!glance) { glance = launcher_app_glance_generic_create(node, service->generic_glance_icon, ...
{ const bool use_glance_cache = prv_should_use_glance_cache_for_app_with_uuid(&node->uuid); LauncherAppGlance *glance = use_glance_cache ? prv_fetch_from_cache_or_load_glance_for_node(node, service) : prv_load_glance_for_node(node, service); // Draw the glance in the provided fram...
void launcher_app_glance_service_rewind_current_glance(LauncherAppGlanceService *service) { if (!service) { return; } kino_player_rewind(&service->glance_reel_player); } void launcher_app_glance_service_pause_current_glance(LauncherAppGlanceService *service) { if (!service) { return; } kino_playe...
NGLE (TRIG_MAX_ANGLE / 360) // 1 degree #define MIN_OPS 0 #define OP_ROTATE 0 #define OP_CHANGE_WIDTH 1 #define OP_MOVE_P1_X 2 #define OP_MOVE_P1_Y 3 #define OP_MOVE_P2_X 4 #define OP_MOVE_P2_Y 5 #define OP_TEST 6 #define OP_TEST2 7 #define OP_TEST3 8 #define OP_TEST4 9 #define OP_TEST5 10 #define OP_ROTATE2 11 #define...
graphics_context_set_stroke_color(ctx, GColorGreen)
------------------------------ bool shared_circular_buffer_add_client(SharedCircularBuffer* buffer, SharedCircularBufferClient *client) { PBL_ASSERTN(!list_contains(buffer->clients, &client->list_node)); buffer->clients = list_prepend(buffer->clients, &client->list_node); client->read_index = buffer->write_index;...
(list_contains(buffer->clients, &client->list_node))
; return prv_get_data_length(buffer, client); } // ------------------------------------------------------------------------------------------------- bool shared_circular_buffer_read_consume(SharedCircularBuffer *buffer, SharedCircularBufferClient *client, uint16_t length, uint8_t *data, ui...
tart_quadrant.quadrant & GCornersBottom || (config.end_quadrant.quadrant & GCornersBottom && config.end_quadrant.angle % QUADRANT_ANGLE != 0)); // Offsets for mirroring of scanline (they differ for even and odd height of the...
(y, center, config.start_quadrant.quadrant, &top_starting_edge, &bottom_ending_edge, start_top, start_bottom)
; prv_get_angles_mask_edge(y, center, config.end_quadrant.quadrant, &top_ending_edge, &bottom_starting_edge, end_top, end_bottom); } // Calculate outer radius edges int16_t outer_edge = prv_get_ellipsis_border(y, radius_outer_y_sq, radius_outer_x_sq).raw_value; int1...
if (current_scroll <= first_scroll) { prv_update_scroll_offset(item_layer, min_scroll, true); #if PBL_RECT // fudge breaks ROUND display paging } else if (current_scroll - (SCROLL_AMOUNT + SCROLL_FUDGE_AMOUNT) < first_scroll) { prv_update_scroll_offset(item_layer, first_scroll, false); #endif } else { ...
layer_mark_dirty(&item_layer->layer); } static void prv_handle_back_click(ClickRecognizerRef recognizer, void *context) { timeline_animate_back_from_card(); } static void timeline_item_layer_click_config_provider(void *context) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, prv_handle_up_click); ...
lure(0, NULL); extern void pfs_reset_all_state(void); pfs_reset_all_state(); pfs_init(false); // Reopen the file we were in the middle of writing. SettingsFile file_new; cl_must_pass(settings_file_open(&file_new, "test_file_atomic", 4096)); settings_file_dump(&file_new); int val_len_o...
(&file, "test_file_each", 4096)
); uint8_t key[5]; int key_len = 4; uint8_t val[5]; int val_len = 4; for (int i = 0; i < 255; i++) { snprintf((char *)key, sizeof(key), "k%03d", i); snprintf((char *)val, sizeof(val), "v%03d", i); printf("Iteration %d key %s val %s\n", i, key, val); set_and_verify(&file, key, key_len, val, va...
ash_init(0, 0x1000000); pfs_init(false); weather_db_init(); weather_shared_data_init(); } void test_weather_db__cleanup(void) { weather_shared_data_cleanup(); } // Tests //////////////////////////////////////////////////////////////// static void prv_db_iterator_cb(WeatherDBKey *key, WeatherDBEntry *entry, vo...
weather_db_get_keys(keys)
); for(int x = 0; x < WEATHER_DATA_SHARED_WEATHER_DB_NUM_DB_ENTRIES; x++) { cl_assert(weather_shared_data_get_key_exists(&keys[x])); } } void test_weather_db__read_stale_entries(void) { WeatherDBKey key = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; size_t entry_size = weather_shared_data_insert_sta...
board.h" #include "drivers/flash/flash_impl.h" #include "drivers/flash/qspi_flash.h" #include "drivers/flash/qspi_flash_part_definitions.h" #include "flash_region/flash_region.h" #include "system/passert.h" #include "system/status_codes.h" #include "system/version.h" #include "util/math.h" #define STM32F4_COMPATIBLE #...
qspi_flash_is_erase_complete(QSPI_FLASH)
es/common/system_task.h" #include "services/runlevel.h" #include "shell/prefs.h" #include "system/logging.h" #include "system/passert.h" #include "util/size.h" #include <stdlib.h> #define STATIONARY_PEEKING_TIME_MINS 5 #define STATIONARY_WAIT_BEFORE_ENGAGING_TIME_MINS 30 #define STATIONARY_ENABLED_DIALOG_TIMEOUT_MS 1...
{ analytics_inc(ANALYTICS_DEVICE_METRIC_STATIONARY_TIME_MINUTES, AnalyticsClient_System); prv_handle_action(StationaryActionGoToSleep); }
} //! The orientation of the accelerometer is checked every minute. If the orientation has //! changed by a significant amount, we consider the watch as in motion, and restart the //! stationary counter static void prv_watch_is_in_motion(void) { prv_handle_action(StationaryActionWakeUp); } static void prv_stationa...
G, "->IN"); PBL_HEXDUMP(LOG_LEVEL_DEBUG, (uint8_t *)&remote_status_in, sizeof(remote_status_in)); prv_core_dump(); } HOST_TRANSPORT_DEBUG_LOG("Local Status: %u bytes sendable, %u bytes receivable", local_status_out.bytes_sendable_count, loca...
("prv_host_transport_main loop unblocked, about to read..")
; spi_device dev = ad_spi_open(PEBBLE_HOST); ad_spi_device_acquire(dev); host_transport_configure_spi_scs_pin(SCSPinFunction_SPI_CS); while (prv_transact(dev)) {}; // Re-enable interrupt handling before processing, // so that endpoint handlers can cause the loop to get unblocked immediately:...