prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
viceMetricAlertInfo) {}; return true; default: return false; } #endif } // ---------------------------------------------------------------------------------------------- bool health_service_set_heart_rate_sample_period(uint16_t interval_sec) { #if !CAPABILITY_HAS_BUILTIN_HRM return false; #else i...
if (sys_activity_sessions_is_session_type_ongoing(ActivitySessionType_Open)) { result |= HealthActivityOpenWorkout; }
const BleConnectionParams *params) { ble_task_assert_is_executing_on_ble_task(); Connection *connection; prv_lock(); { connection = kernel_malloc_check(sizeof(Connection)); *connection = (Connection) { .conn_idx = conn_idx, .initial_addr = *initial_addr, .local_addr = *loca...
{ *addr_buf = connection->updated_addr; }
else { *addr_buf = connection->initial_addr; } } prv_unlock(); } void connection_get_local_address(Connection *connection, BTDeviceAddress *addr_buf) { prv_lock(); { *addr_buf = connection->local_addr; } prv_unlock(); } void connection_get_conn_params(const Connection *connection, ...
eros. Fusce ipsum metus, vehicula eu tortor " "sed, congue tempus mauris. Maecenas mollis lacus non cursus bibendum. " "Etiam id dolor lorem. Aenean scelerisque nulla sed tristique posuere. " "Proin dui magna, gravida faucibus ultricies non, tincidunt id metus. " "Integer a laoreet dolor, eu vulputate enim. Ut...
{ char string_buffer[PERSIST_STRING_MAX_LENGTH]; memset(string_buffer, '~', sizeof(string_buffer)); cl_assert_equal_i( persist_read_string(0, string_buffer, sizeof(string_buffer)), E_DOES_NOT_EXIST); for (size_t i = 0; i < sizeof(string_buffer); ++i) { if (string_buffer[i] != '~') { char...
void test_persist__string_write_unterminated_string(void) { char string_buffer[PERSIST_STRING_MAX_LENGTH + 2]; memset(string_buffer, '~', sizeof(string_buffer)); cl_assert_equal_i(persist_write_string(0, lipsum), PERSIST_STRING_MAX_LENGTH); cl_assert_equal_i(persist_get_size(0), PERSIST_STRING_MAX_LENGTH); ...
e buffer to the system framebuffer To measure op_3, we use a profiler timer node called "framebuffer_send". This profiler timer measures the amount of time we spend waiting for a display DMA to complete. op_1 can be computed from the app's update period - op_2_time */ static void prv_pop_all_windows_cb(void *cb...
window_get_root_layer(window)
; GRect bounds = layer_get_bounds(root_layer); const GRect full_rect = bounds; data->background_layer = bitmap_layer_create(full_rect); bitmap_layer_set_background_color(data->background_layer, GColorBlack); bitmap_layer_set_bitmap(data->background_layer, &s_fps_background_bitmap); layer_add_child(root_lay...
/* * 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...
UNLIKELY(c == 0x3)
xt_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(40, 50), GPoint(35, 70)); } void across_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_stroke_width(ctx, 10); graphics_con...
(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, STROKE_WIDTH)
; graphics_draw_line(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_same_point_offset_layer.${BIT_DEPTH_NAME}.pbi")); } #define COLOR_START_POINT GPoint(5, 35) #define COLOR_END_POINT GPoint(45, 40) void test_graphics_draw_stroke_${BIT_DEPTH_NAME}__color(void...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(progress/2 + total/2, total)
; } static bool write_new_firmware(uint32_t flash_new_fw_start, uint32_t firmware_length) { dbgserial_putstr("write_new_firmware"); // We can't just read the flash like memory, so we gotta lift everything ourselves. // buffer is static so it goes in BSS, since stack is only 8192 by...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25296_4 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { -88, -264, -1008}, { ...
{ -16, -8, -688}, { 8, 80, -680}, { 48, 184, -608}, { 120, 776, -896}, { 208, 656, -848}, { 176, 888, -872}, { 320, 1120, -920}, { 192, 944, -968}, { 328, 944, -928}, { 256, 608, -744}, { 352, 496, -528}, { 552, 648, -432}, { 752, 424, -328}, { 720, 280, -232}, ...
", .expected_test_image_bitmap_format = GBitmapFormat1Bit, .bitmap_create_func = prv_create_bitmap_from_pbi_file, .need_to_destroy_bitmap = false, }, { .test_name = "2bitTrns", .expected_test_image_bitmap_format = GBitmapFormat2BitPalette, .bitmap_create_func = prv_create_bitmap_from_png_fil...
(unit_test_result_image_file_base_name, ".pbi")
sizes_up_to(client, next_sn); client->out.next_expected_ack_sn = next_sn; if (prv_get_payload_size_for_sn(client, next_sn) != 0) { // Still awaiting ACKs prv_reset_ack_timeout(client); } prv_send_next_packets(client); } else if (sn == prv_prev_sn(client->out.next_expected_ack_sn)) { // Da...
{ goto handle_error; }
h" #include "app_install_manager_private.h" #include "pebble_process_info.h" #include "apps/system_app_ids.h" #include "kernel/pbl_malloc.h" #include "services/common/comm_session/session.h" #include "services/common/i18n/i18n.h" #include "system/logging.h" #include "util/attributes.h" #include "util/math.h" #includ...
(app_type, message->icon.row_size_bytes, message->icon.info_flags, message->icon.bounds, message->icon.image_data, image_data_length)
; break; } #endif default: return; } (void)session; } static CustomizableAppType get_app_type_for_app_id(AppInstallId app_id) { if (app_id == APP_ID_SPORTS) { return SPORTS; } else if (app_id == APP_ID_GOLF) { return GOLF; } return UNKNOWN_APP_TYPE; } // Retrieve the custom name or r...
false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); #if PBL_COLOR ASSERT_CALLED(prv_draw_round_rect_aa_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_EVEN)); #else ASSERT_CALLED(prv_draw_round_rect_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_EVEN)); #endif } void test_graphics_context_${B...
(&context, &GRect(10, 20, 40, 10))
); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); setup_test(&context, false, 2, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHA...
{BIT_DEPTH_NAME}__color(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 32, 24)); layer_set_update_proc(&layer, &corners_all_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_corners_all.${BIT_DE...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1)
; graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 6, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r6_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP,...
{ -930, 898, -5}, { -921, 338, 250}, { -696, 370, -82}, { -622, 337, 247}, { -762, 614, 89}, { -654, 836, 92}, { -600, 774, 103}, { -577, 521, 59}, { -526, 493, 127}, { -622, 496, 117}, { -709, 505, 92}, { -826, 704, 152}, { -906, 967, 214}, { -847, 743, 94}, ...
{ -882, 887, 220}, { -861, 946, 156}, { -749, 812, 182}, { -1180, 1006, 331}, { -1163, 609, 229}, { -1043, 65, -6}, { -1051, 73, 122}, { -840, 488, 57}, { -642, 622, 5}, { -517, 494, 38}, { -359, 236, -38}, { -310, 211, -200}, { -354, 397, -266}, { -568, 744, -377...
// ---------------------------------------------------------------- // Sample captured: 2015-08-11 19:49:18 GMT AccelRawData *activity_sample_raise_arm(int *len) { //> TEST_NAME raise_arm //> TEST_EXPECTED 0 //> TEST_EXPECTED_MIN 0 //> TEST_EXPECTED_MAX 50 //> TEST_WEIGHT 1.0 static AccelRawData samples[...
/* * 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...
mktime(&new_time)
; rtc_set_time(secs); } // Fakes /////////////////////////// void notifications_migrate_timezone(int utc_diff) { } void wakeup_migrate_timezone(int utc_diff) { } bool shell_prefs_get_clock_24h_style(void) { return s_prefs_24h_style; } void shell_prefs_set_clock_24h_style(bool is_24h_style) { s_prefs_24h_style = ...
/* * 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_DEBUG, "===LE Transmit Test===")
; uint8_t params[] = {0x00, 0x20, 0x01}; hci_rom_passthrough_send_cmd(0x8, 0x1e, &params[0], sizeof(params)); break; } case 2: PBL_LOG(LOG_LEVEL_DEBUG, "===LE Stop Tx Test==="); hci_rom_passthrough_send_cmd(0x8, 0x1f, NULL, 0); break; case 3: { PBL_LOG(LOG_LEVEL_DEB...
/* * 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...
(resp->name_length + 1, BT_DEVICE_NAME_BUFFER_SIZE)
; char *device_name = (char *)kernel_zalloc_check(device_name_buffer_length); if (!device_name) { return; } memcpy(device_name, resp->name, device_name_buffer_length - 1); if (connection->device_name) { kernel_free(connection->device_name); } connection->device_name = device_name; BTDeviceAddr...
/* * 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_context_mask_destroy(ctx, mask)
if (!current_cb) { PBL_LOG_SYNC(LOG_LEVEL_WARNING, "No timer in progress."); return; }
PBL_LOG_SYNC(LOG_LEVEL_WARNING, "Timer callback %p", current_cb); reboot_reason->watchdog.stuck_task_callback = (uint32_t)current_cb; } static void prv_log_stuck_system_task(RebootReason *reboot_reason) { void *current_cb = system_task_get_current_callback(); if (!current_cb) { PBL_LOG_SYNC(LOG_LEVEL_WA...
/* * 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...
gpath_draw_filled(ctx, path)
ruct ScreenshotState { CommSession *session; FrameBufferState framebuffer; bool sent_header; } ScreenshotState; static ScreenshotState s_screenshot_state; typedef struct PACKED { uint8_t response_code; uint32_t version; uint32_t width; uint32_t height; } ScreenshotHeader; typedef struct ScreenshotError...
PBL_LOG(LOG_LEVEL_WARNING, "Screenshot aborted, OOM.")
; prv_send_error_response(session, SCREENSHOT_OOM_ERROR); prv_finish(state); } uint32_t len = prv_framebuffer_next_chunk(&state->framebuffer, max_buf_len, buffer); session_len += len; if (len == 0) { kernel_free(buffer); prv_finish(state); return; } SendBuffer *sb; if (max_buf_len ==...
/* * 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...
(average_ms, 1010)
; // valid interval fake_rtc_increment_time_ms(1010); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 3); cl_assert_equal_i(average_ms, 1010); } // Make sure we don't run into any issues when our internals are close to UINT32_M...
/* * 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...
GColorARGB8FromHEX(0x8a2be2)
PBL_LOG(LOG_LEVEL_DEBUG, "Sector %#"PRIx32" already erased", sector_addr); return; } flash_lock(); if (!flash_is_enabled()) { flash_unlock(); return; } power_tracking_start(PowerSystemFlashErase); enable_flash_spi_clock(); handle_sleep_when_idle_begin(); flash_write_enable(); flash...
{ flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_WRITE_LOCK_REGISTER); flash_send_24b_address(addr); flash_send_and_receive_byte(lock_bits); flash_end_cmd(); }
disable_flash_spi_clock(); flash_unlock(); } void flash_erase_sector(uint32_t sector_addr, FlashOperationCompleteCb on_complete_cb, void *context) { // TODO: implement nonblocking erase flash_erase_sector_blocking(sector_addr); on_complete_cb(context, S_SUCC...
const uint32_t delay_ms = 100; progress_window_set_result_failure(data->progress_window, timeline_res_id, message, delay_ms); } } else { prv_show_result_window(data, timeline_res_id, message, success); } return true; } static void prv_timeout_handler(void *c...
prv_cleanup_action_result(data, false /* succeeded */)
ted_error, prv_status_str(act->passed)); } else { act->passed = true; printf("\nRESULTS for %s: exp: (NA), act: %d, error: NA, weighted_error: NA", name, (int)act->value); } return weighted_error; } // ===================================================================================...
cl_assert(container_session != NULL)
; cl_assert(session->start_utc >= container_session->start_utc); cl_assert(session->start_utc < container_session->start_utc + container_session->len_m * SECONDS_PER_MINUTE); last_deep_session_len_m = session->len_m; // Accumulate restful sleep stats re...
0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb3}, .parent_id = {0}, .timestamp = 1421183642, // Tue Jan 13 13:14:02 2015 PST .duration = 2, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, }, .attr_list = { .nu...
(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(1)->pin.header.id))
; cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(1)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(has_next); cl_assert_equal_i(new_idx, 3);...
void command_color_write(const char* color_num) { char *end; int color = strtol(color_num, &end, 10); if (*end) { prompt_send_response("Invalid color"); return; } mfg_info_set_watch_color(color); const WatchInfoColor written_color = mfg_info_get_watch_color(); if (written_color == color) { ...
("STAGE 1 -- Marking new FW boot bit")
; boot_bit_set(BOOT_BIT_NEW_FW_AVAILABLE); } else { BLTEST_LOG("STAGE 1 -- Copying STAGE 2 to PRF"); flash_prf_set_protection(false); prv_bootloader_test_copy(FLASH_REGION_SAFE_FIRMWARE_BEGIN, FLASH_REGION_SAFE_FIRMWARE_END); BLTEST_LOG("STAGE 1 -- Marking PRF boot bit"); boot_bit_set(BOOT_BI...
cl_assert(system_flash_erase(FLASH_BASE, 128 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 4), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_full_flash(void) { cl_assert(system_flash_erase(FLASH_BASE, 1024 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 7), erased_sect...
(address >= flash_data_start && address < flash_data_start + flash_data_length, "Address out of range")
; cl_assert_(flash_written_flag[address - flash_data_start] == false, "Overwriting an already-written byte"); if (return_status == FLASH_COMPLETE) { flash_written_data[address - flash_data_start] = data; } return return_status; } extern void dbgserial_print(char *str) { fprintf(stderr, "%s",...
ror ANCS_INVALID_PARAM // Should not get re-requested prv_fake_receiving_ns_notification(sizeof(ns_notification), (uint8_t*) &ns_notification); cl_assert_equal_i(s_num_requested_notif_attributes, 4); cl_assert_equal_i(s_num_ds_notifications_received, 4); ns_notification.uid = comple_dict_uid; prv_fake_rece...
(s_characteristics, NumANCSCharacteristic)
; ancs_handle_service_discovered(s_characteristics); cl_assert_equal_i(fake_event_get_last().type, PEBBLE_ANCS_DISCONNECTED_EVENT); fake_event_clear_last(); // If we unexpectedly register another session, make sure we send the event ancs_handle_service_discovered(s_characteristics); cl_assert_equal_i(fake_...
/* * 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...
(global_lock)
; mutex_unlock(global_lock2); } // Trying to repro the false positives unsuccessfully... extern bool decision(); inline void __attribute__((always_inline)) locker() { mutex_lock(global_lock); } inline void __attribute__((always_inline)) unlocker() { mutex_unlock(global_lock); } static inline void __attribut...
/* * 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 (!comm_session_is_valid(session)) { job->impl->free(job); *job_ptr_ptr = NULL; goto unlock; }
) { return BT_BONDING_ID_INVALID; } if (is_gateway && status == GapBondingFileSetUpdated) { prv_update_bondings(key, BtPersistBondingTypeBLE); } prv_call_ble_bonding_change_handlers(key, op); return key; } bool bt_persistent_storage_update_ble_device_name(BTBondingID bonding, const char *device_nam...
{ BtPersistBondingData data; if (!prv_file_get(&bonding, sizeof(bonding), &data, sizeof(data))) { return false; } if (data.type != BtPersistBondingTypeBLE) { PBL_LOG(LOG_LEVEL_ERROR, "Not getting BLE id %d. Type mismatch", bonding); return false; } if (info_out) { bt_persistent_storage_ass...
typedef struct { BTDeviceInternal device; SMIdentityResolvingKey irk_out; char name_out[BT_DEVICE_NAME_BUFFER_SIZE]; bool found; } FindByAddrItrData; static bool prv_find_by_addr_itr(SettingsFile *file, SettingsRecordInfo *info, void *context) { // check entry is valid if...
ng permissions and * limitations under the License. */ #include "drivers/accessory.h" #include "services/common/new_timer/new_timer.h" #include "services/normal/accessory/accessory_manager.h" #include "services/normal/accessory/smartstrap_attribute.h" #include "services/normal/accessory/smartstrap_comms.h" #include ...
smartstrap_state_unlock()
; if (can_send) { // We should attempt to send control messages first, followed by pending attributes. bool did_send = false; if (smartstrap_profiles_send_control()) { did_send = true; } else if (smartstrap_attribute_send_pending()) { did_send = true; } if (did_send && smartstrap_...
/* * 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_ASSERTN(ctx)
oid (*callback)(void *data), void *data) { callback(data); } void process_manager_send_callback_event_to_process(PebbleTask task, void (*callback)(void *data), void *data) { callback(data); } void accessory_imaging_enable(bool enable) { } // Tests /////////////...
prv_press_button(BUTTON_ID_UP)
; StubTimer *timer = prv_find_combo_timer(); cl_assert(timer); cl_assert_equal_i(stub_new_timer_timeout(timer->id), 5000); stub_new_timer_fire(timer->id); cl_assert(s_mfg_mode_entered); cl_assert(!s_factory_reset_called); }
&line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.w...
cl_assert(line.height_px == 10)
; cl_assert(line.width_px == HORIZ_ADVANCE_PX * 3); cl_assert(line.origin.x == 0); cl_assert(line.suffix_codepoint == 0); cl_assert(*line.start == 'a'); // ani- cl_assert(*word_iter_state.current.start == 'a'); cl_assert(*word_iter_state.current.end == '\0'); cl_assert(word_iter_state.current.width_px ...
e_response_from_phone(void *data) { s_num_writebacks++; BlobDBSyncSession *session = data; blob_db_sync_next(session); } static void prv_generate_responses_from_phone(void) { while (fake_system_task_count_callbacks()) { fake_system_task_callbacks_invoke_pending(); } } BlobDBToken blob_db_endpoint_send...
(BlobDBIdTest, (uint8_t *)keys[synced_idx - 1], key_len)
unk including that chunks data int32_t png_seek_chunk_in_resource(uint32_t resource_id, uint32_t offset, bool seek_framedata, bool *found_actl) { ResAppNum app_num = sys_get_current_resource_num(); return png_seek_chunk_in_resource_system(app_num, resource_id, offset, seek_frameda...
gbitmap_set_data(bitmap, upng_buffer, format, gbitmap_format_get_row_size_bytes(width, format), true)
s_info); pebble_pairing_service_init(); hrm_service_init(config->is_hrm_supported_and_enabled); ppogatt_service_init(); } static void prv_gatt_local_services_register(void) { device_information_service_register(DEVICE_INFORMATION_SERVICE_EXPECTED_ATT_STARTING_HANDLE); pebble_pairing_service_register(PEBBLE_P...
(mtu_size)
; gatt_local_services_re_register_if_needed(); return rv; }
/* * 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...
kernel_malloc(sizeof(Uuid))
; if (!removed_id) { return; } *removed_id = *reminder_id; PebbleEvent event = { .type = PEBBLE_REMINDER_EVENT, .reminder = { .type = type, .reminder_id = removed_id, } }; event_put(&event); } void reminders_handle_reminder_updated(const Uuid *reminder_id) { prv_put_reminder_...
add_units, zero_pad, modulus); break; #endif case 'd': // day // NOTE: This number of modulus is a hack! See PBL-39903 #if SUPPORT_MONTH prv_do_conversion(state, value, SECONDS_PER_DAY, 30, s_day_strings, add_units, zero_pad, modulus); #else prv_do_conversion(...
{ // This predicate could become valid over time. // If the conditional is not equal, add 1 to the wait time, because only the equals case // becomes valid on the specified value. if (predicate_cond == cond_to_valid) { wait_time++; } }
else { wait_time = INT_MAX; } if (state->eval_cond) { if (wait_time < state->eval_cond->eval_time) { state->eval_cond->eval_time = wait_time; } } // Only characters possible here are :,) if (*state->position == ':') { state->position++; } return match; } static void prv_format_pr...
v_api_init__callcount = 0; s_prv_api_add__callcount = 0; s_prv_api_add__result = false; s_prv_api_remove__callcount = 0; s_prv_listener_a1__callcount = 0; s_prv_listener_a2__callcount = 0; s_prv_listener_b__callcount = 0; } void test_rocky_api_global__cleanup(void) { fake_app_timer_deinit(); s_log_int...
jerry_release_value(o)
; cl_assert_equal_i(0, jerry_obj_refcount(o)); } void test_rocky_api_global__calls_listeners(void) { static const RockyGlobalAPI *apis[] = {NULL}; rocky_global_init(apis); prv_add_event_listener_to_list("a", jerry_create_external_function(prv_listener_a1)); cl_assert_equal_b(true, rocky_global_has_event_han...
sable_display_access(); } //! Static mode is entered by sending 0x00 to the panel //! This stops any further updates being registered by //! the display, preventing corruption on shutdown / boot static void prv_display_enter_static(void) { prv_enable_display_access(); prv_display_write_byte(DISP_MODE_STATIC); p...
prv_draw_code(code, buffer)
; prv_draw_bitmap(error_url_bits, 16, 144, error_url_width, error_url_height, buffer); prv_display_buffer(buffer); } //! Do whatever is necessary to prevent visual artifacts when resetting //! the watch. void display_prepare_for_reset(void) { prv_display_enter_static(); } //! Display the progress of a firmwar...
S OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/app_message/app_message.h" #include "applib/app_message/app_message_internal.h" #include "kernel/pbl_malloc.h" #include "process_state/app_state/app_st...
app_state_get_app_message_ctx()
, key_len, val_out, val_len_out)); if (val_len_out == original_value_length) { printf("original! %d\n", original_value_length); cl_assert_equal_m(original_value, val_out, val_len_out); free(val_out); return RecordResultOld; } else if (val_len_out == new_value_length) { printf("new...
(counts[i], 1)
, *bounds, GTextOverflowModeWordWrap, GTextAlignmentLeft, (GTextAttributes *)&text_layout); custom_text_size = text_layout.max_used_size; GSize avg_text_size = GSizeZero; int total_width = custom_text_size.w; const int info_paddi...
{ graph_card->stats = config->graph_data->stats; memcpy(graph_card->day_data, config->graph_data->day_data, sizeof(graph_card->day_data)); graph_card->data_timestamp = config->graph_data->timestamp; graph_card->data_max = MAX(config->graph_data->default_max, config->graph_...
if (config->info_update) { graph_card->info_update = config->info_update; } if (config->info_buffer_size) { graph_card->info_buffer_size = config->info_buffer_size; } if (!gcolor_equal(config->inactive_color, GColorClear)) { graph_card->inactive_color = config->inactive_color; } } void health_...
l_assert_equal_b(true, app_install_get_entry_for_install_id(tictoc_id, &id_entry)); cl_assert_equal_b(true, app_install_get_entry_for_uuid(&tictoc_uuid, &uuid_entry)); cl_assert_equal_b(true, app_install_entries_equal(&id_entry, &uuid_entry)); cl_assert_equal_b(true, app_install_get_entry_for_install_id(music_id...
app_install_id_from_system(1)
); cl_assert_equal_b(false, app_install_id_from_system(1000000)); } void test_app_install_manager__is_from_app_db(void) { cl_assert_equal_b(false, app_install_id_from_app_db(-1000000)); cl_assert_equal_b(false, app_install_id_from_app_db(-1)); cl_assert_equal_b(false, app_install_id_from_app_db(0)); cl_asser...
ion(b, duration_b); Animation *c = prv_create_test_animation(); animation_set_duration(c, duration_c); // Create a spawn out of b and c Animation *spawn = animation_spawn_create(b, c, NULL); cl_assert(spawn != NULL); // Create a sequence by putting a in front // We now have a -> (b | c) Animation *se...
prv_count_handler_entries(&s_stopped_handler_calls, c)
other; return; } // Iterate: prev = other; other = other->next; } // Broke out of the loop, this can happen at the head or the tail, handle it: if (s_head == other) { // Insert as head of the list: result->next = s_head; s_head = result; } else { // Insert as tail: p...
{ return MENU_CELL_BASIC_HEADER_HEIGHT; }
static void menu_draw_header_callback(GContext* ctx, const Layer *cell_layer, uint16_t section_index, void *data) { menu_cell_basic_header_draw(ctx, cell_layer, (section_index == SectionData) ? "Results" : "Options"); } static void draw_data_row(G...
= cases[WithinLowerBounds].u8 - margin, .u16 = cases[WithinLowerBounds].u16 - margin, .u32 = cases[WithinLowerBounds].u32 - margin, .u64 = cases[WithinLowerBounds].u64 - margin, .s8 = cases[WithinLowerBounds].s8 - margin, .s16 = cases[WithinLowerBounds].s16 - margin, .s32 = cases[WithinLowerBou...
(nan_script)
, false /* is_strict */); struct { jerry_value_t input; bool expected_output; } cases[] = { // Falsy: false, 0, "", null, undefined, and NaN: { .input = jerry_create_boolean(false), .expected_output = false, }, { .input = jerry_create_number...
/* * 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...
htonl(resources_version->timestamp)
; } static void prv_send_watch_versions(CommSession *session) { struct VersionsMessage versions_msg = { .command = VERSION_RESPONSE, .boot_version = htonl(boot_version_read()), }; _Static_assert(sizeof(struct VersionsMessage) >= 126 /* pre-v1.5 version info */ + 24 /* v1.5 versio...
notifications_presented_list_deinit(prv_handle_presented_notif_deinit, NULL); gbitmap_deinit(&data->dnd_icon); layer_deinit(&data->dnd_icon_layer); window_deinit(window); i18n_free_all(data); s_in_use = false; } ////////////////////// // Callback Handlers ////////////////////// static void prv_layout_did...
(window, "Notification Window")
; window_set_window_handlers(window, &(WindowHandlers) { .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 *...
- // Test to make sure that the minute data gets sent to data logging correctly void test_activity_algorithm_kraepelin__data_logging_test(void) { const int k_num_records = 2; const int num_minutes = k_num_records * ALG_MINUTES_PER_DLS_RECORD; // The test data AlgMinuteDLSSample minute_data[num_minutes]; prv_...
(SECONDS_PER_MINUTE)
/* * 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, "Meta protocol error: 0x%x (endpoint=%u)", meta_response_info->payload.error_code, meta_response_info->payload.endpoint_id)
; MetaResponseInfo *meta_response_info_heap_copy = kernel_zalloc_check(sizeof(*meta_response_info)); memcpy(meta_response_info_heap_copy, meta_response_info, sizeof(*meta_response_info)); system_task_add_callback(prv_send_meta_response_kernelbg_cb, meta_response_info_heap_copy); } void meta_protocol_msg_callbac...
n_mask; const int8_t fraction_for_right = (MAX(p0.x.raw_value, p1.x.raw_value) + radius.raw_value) & fraction_mask; // Drawing loop: Iterates over vertical lines from left to right // As part of optimisation, this algorithm is moving between drawing boundaries, //...
graphics_private_draw_vertical_line(ctx, x, top_margin, bottom_margin)
; } } // Blending of last line if (fraction_for_right != 0) { int16_t x = x_max + 1; // Starting and ending point of the line, initialized with extremes Fixed_S16_3 top_margin = {.raw_value = INT16_MAX}; Fixed_S16_3 bottom_margin = {.raw_value = INT16_MIN}; // Find edg...
odal_manager_event_loop_upkeep(); cl_assert_equal_i(modal_manager_get_properties(), ModalProperty_Exists | ModalProperty_CompositorTransitions | ModalProperty_RenderRequested); // Disable all modals modal_manager_set_min_priority(ModalPriorityMax); modal_manager_event_l...
cl_assert_equal_i(window2->on_screen, false)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ equal++; }
} if (less <= ((num_values + 1) / 2) && greater <= ((num_values + 1) / 2)) { break; } else if (less > greater) { max = max_lt_guess; } else { min = min_gt_guess; } } if (less >= ((num_values + 1) / 2)) { return max_lt_guess; } else if ((less + equal) >= ((num_values + 1...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(0, rl_margin)
); const GSize icon_size = kino_reel_get_size(icon); const int icon_x = drawing_rect.origin.x + PBL_IF_RECT_ELSE(0, (rl_margin / 2)) + (drawing_rect.size.w / 2) - (icon_size.w / 2); const int icon_y = PBL_IF_RECT_ELSE(45, 49); kino_reel_draw(icon, ctx, GPoint(icon_x, icon_y)); const int n...
ies(void) { return s_modal_window_present ? ModalProperty_Exists : ModalPropertyDefault; } GContext* kernel_ui_get_graphics_context(void) { static GContext s_context; return &s_context; } void framebuffer_clear(FrameBuffer* f) { } void framebuffer_dirty_all(FrameBuffer *fb) { } GBitmap framebuffer_get_as_bitm...
cl_assert_equal_i(s_count_compositor_init_func_a, 1)
; cl_assert_equal_i(s_count_compositor_init_func_b, 1); // Make the app render, now the animation should be scheduled compositor_app_render_ready(); cl_assert_equal_i(s_count_animation_schedule, 2); // Push a modal window mid transition, the resulting animation should be scheduled immediately. s_modal_win...
, 1360, 616}, { 904, 584, 392}, { 1056, -40, 584}, { 1128, -128, 344}, { 1032, 256, 168}, // 109 seconds { 1000, 784, 40}, { 848, 720, 152}, { 784, 552, 304}, { 688, 536, 208}, { 1032, 536, 48}, { 1280, 728, 136}, { 1016, 1392, -256}, { 1184, 688, -144}, { 1096, 6...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_150_pbl_25301_8 //> TEST_EXPECTED 150 //> TEST_EXPECTED_MIN 90 //> TEST_EXPECTED_MAX 170 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { -8, 56, -1032}, { 0, ...
{ -248, 784, 288}, { -272, 832, 344}, { -208, 880, 376}, { -168, 872, 328}, { -232, 856, 248}, { -288, 824, 224}, { -296, 960, 24}, { -344, 976, -104}, { -432, 1008, -144}, { -360, 1112, -120}, { -320, 1176, -200}, { -216, 1112, -192}, { -40, 936, -256}, { 240, 7...
orker) { return worker_state_get_accel_state(); } else { WTF; } } void accel_service_cleanup_task_session(PebbleTask task) { AccelServiceState *state = accel_service_private_get_session(task); if (state->manager_state) { sys_accel_manager_data_unsubscribe(state->manager_state); } } // ---------...
PBL_ASSERTN(state->data_handler != NULL || state->raw_data_handler != NULL || state->raw_data_handler_deprecated != NULL)
; uint16_t time_interval_ms = 1000 / state->sampling_rate; // Process in chunks to limit the amount of stack space we use up. uint32_t num_processed; do { num_processed = prv_do_data_handle_chunk(state, time_interval_ms); sys_analytics_add(ANALYTICS_APP_METRIC_ACCEL_SAMPLE_COUNT, num_processed, Analy...
t uint8_t num_services = ble_ad_copy_service_uuids(ad_data, &result->first_service_uuid, 1); if (num_services) { result->has_services = true; // Look for Heart Rate Monitor service: // See https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.asp...
ble_central_connect(result->device, true /* auto_reconnect */, false /* is_pairing_required */)
/* bytes 3200 - 3216 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* bytes 3216 - 3232 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3232 - 3248 */ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x...
{ char filename[32]; snprintf(filename, 32, "res_bank%u", resource_bank); load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, APP_RESOURCES_FIXTURE_NAME, filename); size_t image_size = resource_size(resource_bank, no_litter_res_id); uint8_t image_buf[image_size]; // read the last byte, and make sure it 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...
cl_assert(success)
; const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, }; Iterator char_iter; CharIterState char_iter_state; char_iter_init(&char_iter, &char_iter_state, &text_box_params, utf8_bounds.start); Utf8IterState* utf8_iter_state = (Utf8IterState*) &char_iter_state.utf8_iter_s...
el = _dma_channel + 1, \ }; CORE_DUMP_SPI_SLAVE_TO_EXT_MASTER(SPI1, CORE_DUMP_SPI, CONFIG_SPI_WORD_MODE, CONFIG_SPI_POL_MODE, CONFIG_SPI_PHASE_MODE, CONFIG_SPI_DMA_CHANNEL); void DMA_Handler(void); // This is the Dialog SPI/DMA Interrupt handler...
prv_timer_get_ticks()
gurable, /* $8 */ pdp->value, /* $9 */ pdp->getter, /* $10 */ pdp->setter, /* $11 */ obj_val, /* $12 */ prop_name_val /* $13 */ )); } jerry_value_t emscripten_call_jerry_function(jerry_external_handler_t func_obj_p, c...
{ return __jerryRefs.ref(__jerryRefs.get($0).prototype); }
, value); } jerry_value_t jerry_set_prototype(const jerry_value_t obj_val, const jerry_value_t proto_obj_val) { return 0; // FIXME: Not sure what to do here } bool jerry_get_object_native_handle(const jerry_value_t obj_val, uintptr_t *out_handle_p) { return EM_ASM_INT({ var ptr = __jerryRefs.getNativeHandle($...
/* * 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...
{ launcher_task_add_callback(prv_low_power_launcher_task_callback, data); }
static void prv_low_power_transition(bool active) { s_low_power_active = active; if (s_toggle_timer == TIMER_INVALID_ID) { s_toggle_timer = new_timer_create(); } // Rapid charger connection changes (aligning magnetic connector for example) // will cause repeated low power on/off requests. Require that a...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_WARNING, "Task <%s> stuck: LR: %p PC: %p", pebble_task_get_name(task), current_lr, current_pc)
6, 321, 44}, { 1168, 289, 72}, { 1059, 271, 115}, { 899, 244, 107}, { 862, 226, 87}, { 847, 185, 108}, { 774, 136, 116}, { 681, 120, 94}, { 740, 143, 83}, { 956, 160, 124}, { 1168, 210, 125}, { 1418, 257, 216}, { 1618, 270, 460}, { 1375, 438, 247}, { 1127, 483, -1...
{ 753, 161, 209}, { 818, 176, 196}, { 962, 156, 253}, { 1141, 165, 247}, { 1260, 235, 189}, { 1416, 256, 189}, { 1024, 375, -113}, { 1122, 436, -197}, { 1049, 375, -78}, { 888, 219, -5}, { 813, 208, -8}, { 831, 271, 6}, { 881, 349, 14}, { 912, 359, 6}, { 788, ...
eStringState *state); static void prv_filter_time_since(TemplateStringState *state); static void prv_filter_end(TemplateStringState *state); static const FilterImplementation s_filter_impls[] = { { "format", prv_filter_format, }, { "time_until", prv_filter_time_until, }, { "time_since", prv_filter_time_since, },...
i18n_ctx_noop("TmplStringSep", ", ")
, /// The second separator in `<hour> hours, <minute> minutes, and <second> seconds` i18n_ctx_noop("TmplStringSep", ", and "), }, }; /* Flag truth table. fmt = >= 1 hour >= 1 minute other %T = %H:%0M:%0S %M:%0S %S %uT = %uH, %uM, and %uS %uM, ...
/* * 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...
serial_console_set_state(SERIAL_CONSOLE_STATE_PROMPT)
; dbgserial_putstr(""); start_prompt(); } ///////////////////////////////////////////////////////////////// // Prompt infrastructure ///////////////////////////////////////////////////////////////// typedef void (*CommandFuncNoParam)(void); typedef void (*CommandFuncOneParam)(const char*); typedef void (*CommandF...
-------------------- // Sample captured: 2015-10-16 09:50:42 local AccelRawData *activity_sample_non_walk_pbl_28403_8(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME non_walk_pbl_28403_8 //> TEST_EXPECTED 0 //> TEST_EXPECTED_MIN 0 //> TEST_EXPECTED_MAX 100 //> T...
{ 216, 192, -1016}, { 216, 192, -1008}, { 232, 208, -1016}, { 216, 200, -1000}, { 248, 176, -1016}, // 5 seconds { 208, 216, -1024}, { 200, 192, -1016}, { 248, 168, -1008}, { 184, 192, -992}, { 200, 192, -1016}, { 216, 192, -1016}, { 200, 192, -1008}, { 208, 192, ...
{ 112, 160, -1048}, { 96, 160, -1016}, { 112, 160, -1024}, { 104, 160, -1040}, { 112, 160, -1032}, { 96, 168, -1024}, { 104, 168, -1024}, { 104, 168, -1008}, { 104, 168, -1032}, { 96, 168, -1024}, { 112, 168, -1032}, { 96, 176, -1024}, { 112, 168, -1016}, { 104, ...
ion %d", logging_session->comm.session_id); dls_storage_delete_logging_storage(logging_session); } return consumed_bytes; } // ----------------------------------------------------------------------------------------- // Called from dls_init() during boot time to scan for existing DLS storage files in the file...
PBL_LOG(LOG_LEVEL_INFO, "Restored %d sessions. Total %"PRIu32" bytes allocated", num_sessions_restored, prv_get_total_file_system_bytes())
; // Free the directory list pfs_delete_file_list(dir_list); // No longer in initialization. From now on, only KernelBG can use the session storage calls. s_initializing_storage = false; } // ------------------------------------------------------------------------------------------------- // Analytics stati...
ull size const GRect *peek_layer_frame = &window_get_root_layer(&data->window)->frame; data->peek_layer = peek_layer_create(*peek_layer_frame); if (!data->peek_layer) { if (is_first_notification) { // we don't have enough memory, no peek. Just push the modal window. modal_window_push(&data->window...
( notifications_presented_list_current(), rel_position)
; // if no layers, don't return one if (uuid_is_invalid(id)) { return NULL; } NotificationType type = notifications_presented_list_get_type(id); TimelineItem *item = task_zalloc_check(sizeof(TimelineItem)); if (type == NotificationMobile) { if (!notification_storage_get(id, item)) { PBL_LO...
decode_test_single_codepoint_string_single_byte(void) { // Mutable types Iterator utf8_iter; Utf8IterState utf8_iter_state; // Immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "A"); cl_assert(utf8_bounds.end - utf8_bounds.start == 1); cl_assert(success); ...
cl_assert_equal_i(s_codes[index], codepoint)
; cl_assert_equal_p(context, &s_context); s_each_count++; return (index != 2); } void test_utf8_iterator__each_codepoint_break(void) { void *context = &s_context; const char *str = "abcde"; s_each_count = 0; cl_assert_equal_b(utf8_each_codepoint(str, prv_each_codepoint_break, context), true); cl_assert...
rt_equal_i(s_path_num_points, 2); cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points)); cl_assert(prv_compare_points(points, s_fill_points, s_path_num_points)); prv_reset(); gdraw_command_image_draw(ctx, image, GPoint(-1, 1)); cl_assert_equal_i(s_path_num_points, 2); points[0] = GPoint...
(command_list)
; }
icesRemoved) { // For removals, we log info in the handler routine PBL_LOG(LOG_LEVEL_INFO, "Service changed Indication: type: %d status: %d", event_info->type, event_info->status); } switch (event_info->type) { case PebbleServicesRemoved: prv_handle_services_removed(&event_info->servi...
{ PBL_LOG(LOG_LEVEL_DEBUG, "No client to handle GATT notification from characteristic %p", (void*) header.characteristic); }
kernel_free(buffer); header.value_length = next_value_length; } } static void prv_handle_gatt_event(const PebbleBLEGATTClientEvent *event) { if (event->subtype == PebbleBLEGATTClientEventTypeBufferEmpty) { // Taking a shortcut here: ppogatt_handle_buffer_empty(); return; } else if (event->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...
{ Uuid *ret_uuid = *(Uuid **)arg; size_t uuid_len = stream->bytes_left; PBL_ASSERTN(uuid_len == sizeof(Uuid)); return pb_read(stream, (uint8_t *)ret_uuid, uuid_len); }
0am prv_feed_cannned_accel_data(30 * SECONDS_PER_MINUTE, 50, ActivitySleepStateAwake); activity_get_metric(ActivityMetricSleepState, 1, &value); cl_assert_equal_i(value, ActivitySleepStateAwake); // Assert that we got the same sleep sessions using the activity service as we do using // the health API prv_a...
if (multiplier == 1) { // The slot % 50 was chosen so that the total # of steps per day does not exceeed 2^16 return ((slot % 50) + 1); } else if (multiplier == 2) { // The slot % 30 was chosen so that the total # of steps per day does not exceeed 2^16 return 2 * ((slot % 30) + 1); } else { cl_a...
onding with a ResetComplete: EXPECT_OUTBOX_RESET_COMPLETE_PENDING(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaitingResetCompleteRemoteInitiated); } void test_rocky_api_app_message__awaiting_reset_request__receive_chunk(void) { prv_init_api(false /* start_connec...
prv_rcv_app_message_ack(APP_MSG_OK)
; EXPECT_OUTBOX_NO_MESSAGE_PENDING(); } void test_rocky_api_app_message__awaiting_reset_complete_rem_init__receive_request(void) { prv_init_and_goto_awaiting_reset_complete_remote_initiated(); RCV_RESET_REQUEST(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaiti...
/* * 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...
(MAG_Z_CORRECTION_VAL, 0x0)
/* * 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...
shared_circular_buffer_read(&buffer, &client, 1, &out_buffer, &out_length)
); cl_assert_equal_i(out_length, 1); cl_assert(memcmp(out_buffer, (uint8_t*) "a", 1) == 0); cl_assert(shared_circular_buffer_consume(&buffer, &client, 1)); // Consume one without reading it cl_assert(shared_circular_buffer_consume(&buffer, &client, 1)); // Read the last little bit cl_assert(shared_circu...
Ref prv_log_create_measurement(TestPLParsedMsg *input, bool use_data_logging) { // Create a session ProtobufLogTransportCB transport_cb = prv_protobuf_log_transport; if (use_data_logging) { transport_cb = NULL; } ProtobufLogConfig log_config = { .type = ProtobufLogType_Measurements, .measurements...
ARRAY_LENGTH(offset_sec)
, .offset_sec = offset_sec, .num_values = ARRAY_LENGTH(values), .values = values, }, }; ProtobufLogRef ref = prv_test_encode_measurements(&input, false /*use_data_logging*/); prv_test_decode_payload(&input, false /*use_data_logging*/, ref); } // A simple message with 1 typ...
/* * 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...
{ FrameBuffer *fb = compositor_get_framebuffer(); framebuffer_dirty_all(fb); compositor_display_update(NULL); }
static status_t framebuffer_domain_close(void* data) { animation_private_resume(); // Force the compositor to redraw the framebuffer launcher_task_add_callback(framebuffer_domain_close_cb, NULL); return S_SUCCESS; } PulseBulkIODomainHandler pulse_bulkio_domain_framebuffer = { .id = PulseBulkIODomainType_...
ssert_equal(); prv_assert_no_event(); } void test_gatt_client_subscriptions__unsubscribe_not_subscribed_but_other_client_is(void) { BTErrno e; BLECharacteristic characteristic = prv_get_indicatable_characteristic(); e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, GAPLEClient...
prv_assert_subscription_event(characteristic, BLESubscriptionNone, BLEGATTErrorSuccess, true /* kernel */, false /* app */)
; // CCCD value should be 0 now: cl_assert_equal_i(s_last_cccd_value, 0); // Verify everything is cleaned up: fake_kernel_malloc_mark_assert_equal(); } void test_gatt_client_subscriptions__unsubscribe_not_last_subscriber(void) { BLECharacteristic characteristic = prv_get_indicatable_characteristic(); // ...
static const TimeSelectionSizeConfig *s_time_selection_configs[NumPreferredContentSizes] = { [PreferredContentSizeSmall] = &s_time_selection_config_medium, [PreferredContentSizeMedium] = &s_time_selection_config_medium, [PreferredContentSizeLarge] = &s_time_selection_config_large, [PreferredContentSizeExtraLarg...
(left_offset, from_top_offset, width, selection_layer_default_cell_height())
; selection_layer_init(from_selection_layer, &frame, num_cells); for (int i = 0; i < num_cells; i++) { selection_layer_set_cell_width(from_selection_layer, i, cell_width); } selection_layer_set_cell_padding(from_selection_layer, padding); selection_layer_set_active_bg_color(from_selection_layer, color); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_DEBUG, "NT: Initializing")
; vSemaphoreCreateBinary(s_wake_srv_loop); task_timer_manager_init(&s_task_timer_manager, s_wake_srv_loop); const int WORK_QUEUE_SIZE = 5; s_work_queue = xQueueCreate(WORK_QUEUE_SIZE, sizeof(NewTimerWorkItem)); const int TASK_STACK_SIZE_BYTES = 1380; TaskParameters_t task_params = { .pvTaskCode = n...
ayer_deinit(&data->dnd_icon_layer); window_deinit(window); i18n_free_all(data); s_in_use = false; } ////////////////////// // Callback Handlers ////////////////////// static void prv_layout_did_appear_handler(SwapLayer *swap_layer, LayoutLayer *layout, int8_t rel_chan...
(window, &(WindowHandlers) { .appear = prv_window_appear, .disappear = prv_window_disappear, .unload = prv_window_unload, })
te_Started)); r->state = RecognizerState_Possible; cl_assert_passert(recognizer_transition_state(r, RecognizerState_Possible)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Updated)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Cancelled)); recognizer_transition_stat...
recognizer_set_failed(r)
); } static void prv_sub_destroy(const Recognizer *r) { bool *destroyed = recognizer_get_user_data(r); *destroyed = true; } void test_recognizer__destroy(void) { bool impl_destroyed = false; s_test_impl_data.destroyed = &impl_destroyed; bool sub_destroyed = false; Recognizer *r = test_recognizer_create(&...
/* * 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->window.layer, menu_layer_get_layer(menu_layer))
; } static void prv_window_unload(Window *window) { SettingsAppData *data = window_get_user_data(window); menu_layer_deinit(&data->menu_layer); app_free(data); } static void handle_init(void) { SettingsAppData *data = app_zalloc_check(sizeof(SettingsAppData)); Window *window = &data->window; window_init(...
length - offsetof(PebblePairingServiceConnParamsWrite, remote_desired_state)); switch (conn_params->cmd) { case PebblePairingServiceConnParamsWriteCmd_SetRemoteParamMgmtSettings: rv = prv_validate_set_remote_param_mgmt_settings_cmd(&conn_params->remote_param_m...
(ble_gatts_add_service(&uuid, GATT_SERVICE_PRIMARY, num_attr, start_hdl) == 0)
; // RivieraWaves caches values internally and only calls back once if we don't set this: const uint8_t enable_read_cb_flag = GATTS_FLAG_CHAR_READ_REQ; // Connectivity Status characteristic + CCCD: prv_convert_uuid_to_little_endian( (const uint8_t[]){PEBBLE_BT_PAIRING_SERVICE_CONNECTION_STATUS_UUID}, &u...
would only go off every weekday. Respect /// capitalization! i18n_noop("WEEKDAYS") : /// A frequency option for alarms, i.e. the alarm would only go off every weekday. Respect /// capitalization! i18n_noop("Weekdays"); break; case ALARM_KIN...
prv_put_alarm_event()
age follows. If this value is 0x0 this means there are no //! more logs remaining in this chunk. uint8_t log_length; } LogHeader; //! Which chunk we're writing to. [0 - NUM_CHUNKS) static int s_current_chunk; //! The id we're using for the current chunk. static int s_current_chunk_id; //! The current offset in th...
while (!error) { LogHeader log_header; flash_read_bytes((uint8_t*) &log_header, get_generation_address(generation, chunk_index, offset), sizeof(LogHeader)); if (log_header.log_length == 0 || log_header.log_length == 0xff) { break; } offset += sizeof(LogHeader); flash_read_bytes(read_buf...
kernel_free(read_buffer); return !error; } bool flash_dump_log_file(int generation, DumpLineCallback cb, DumpCompletedCallback completed_cb) { if (generation < 0 || generation >= DEBUG_DB_NUM_FILES) { completed_cb(false); return false; } if (!debug_db_is_generation_valid(generation)) { complet...
r GATT_Start_Service_Discovery has been called, except for the last iteration: cl_assert_equal_i(start_count + 1, fake_gatt_is_service_discovery_start_count()); // No client event: prv_assert_no_event(); } else { // Last iteration: expect event with error status and 0 services: prv_ass...
gatt_client_discovery_rediscover_all(&device)
, BTErrnoOK); // Expect "Database Changed" event: prv_assert_event(&device, BTErrnoServiceDiscoveryDatabaseChanged); // Expect all services nodes to be cleaned up: cl_assert_equal_i(list_count(&connection->gatt_remote_services->node), 0); // Put one, expect one: prv_simulate_and_assert_discovery_of_one_se...
// Size primary key: sizeof(Uuid) = 16 = 0x10 // Primary Key: UUID:16 0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4, }; void test_blob_db_endpoint__handle_delete_command_success(void) { uint8_t *cmd_ptr = (uint8_t*)s_delete_cmd_success; // check for DELETE ...
(response, s_expected_data, response_length)
} graphics_context_set_text_color(ctx, TEXT_COLOR); graphics_draw_text(ctx, i18n_get(prv_get_label_for_metric(metric_type, active_window), i18n_owner), fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD), label_box, overflow_mode, ...
(active_window->workout_controller->get_metric_value( metric_type, active_window->workout_data))
; const bool draw_zones = (metric_type == WorkoutMetricType_Hr) && hr_zone > HRZone_Zone0; const bool prefer_larger_font = active_window->layout == WorkoutLayout_SingleMetric || active_window->layout == WorkoutLayout_StaticAndScrollable; prv_render_metric(ctx, metric_type, layer...
s_next_unique_flash_app_id; static struct { SettingsFile settings_file; PebbleMutex *mutex; } s_app_db; ////////////////////// // Settings helpers ////////////////////// struct AppDBInitData { AppInstallId max_id; uint32_t num_apps; }; static status_t prv_lock_mutex_and_open_file(void) { mutex_lock(s_app_...
{ return rv; }
rv = settings_file_get(&s_app_db.settings_file, (uint8_t *)&app_id, sizeof(AppInstallId), (uint8_t *)entry, sizeof(AppDBEntry)); prv_close_file_and_unlock_mutex(); return rv; } bool app_db_exists_install_id(AppInstallId app_id) { status_t rv = prv_lock_mutex_and_open_file(); if (rv != S_SUCCESS) { ...
IGIN_DRAW_RECT_CLIP_XY, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2), GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax1_aa_clip_xy.${BIT_DEPTH_NAME}.pbi")); // Should draw same as rmax1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_fill_round_rect...
(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersRight)
/* * 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...
{ callback_called = true; cl_assert_equal_i(8675309, (uintptr_t)context); }
void test_system_flash__callback_is_called(void) { cl_assert(system_flash_erase(FLASH_BASE, 16 KiB, callback_is_called_cb, (void *)8675309)); cl_assert(callback_called); cl_assert(flash_locked); } void test_system_flash__handle_erase_error(void) { return_status = FLASH_ERROR_OPERATION; cl_asser...