prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
const MusicAppSizeConfig *config = prv_config(); return GRect(config->horizontal_margin, config->title_field.origin_y, prv_text_layer_width(), config->title_field.size_h); } static GRect prv_time_rect(void) { const MusicAppSizeConfig *config = prv_config(); return GRect(config->horizontal_margin,...
(MusicCommandVolumeUp)
|| !music_is_command_supported(MusicCommandVolumeDown)) { return; } MusicAppData *data = app_state_get_user_data(); prv_show_volume_image(volume_is_up ? &data->image_volume_up : &data->image_volume_down); music_command_send(volume_is_up ? MusicCommandVolumeUp : MusicCommandVolumeDown); } static Ani...
/* * 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...
(&bt_dialog->pebble_app_event_sub)
; if (bt_dialog->connected_handler) { bt_dialog->connected_handler(false, bt_dialog->context); } if (bt_dialog->owns_buffer) { applib_free(bt_dialog->text_buffer); } } void bt_conn_dialog_push(BtConnDialog *bt_dialog, BtConnDialogResultHandler handler, void *context) { if (!b...
E}__offset_sw(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // SW = 1 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 1); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_REC...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 5); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 11 setup_test_aa_sw(&ctx, f...
/ If the origin x value is not past the flip point, draw a colored circle starting at the x pos if (sidebar_x <= flip_point_x) { // Don't draw the circle in the flip region overlap; we want an instantaneous jump past this // region during the flip const int16_t circle_left_edge_x = MIN(sidebar_x, flip_poi...
(LOG_LEVEL_DEBUG, "Setting next item with index %d", index)
; TimelineIterState *iter_state = timeline_model_get_iter_state_with_timeline_idx(index); if (!iter_state) { return; } if (layer->layouts[s_nonvisible_items[1]]) { prv_destroy_layout(layer, s_nonvisible_items[1]); } prv_create_layout(layer, iter_state, s_nonvisible_items[1]); } void timeline_layer_...
i_peek) { prv_play_peek_in(data); return; } #endif peek_layer_set_duration(peek_layer, duration); peek_layer_play(peek_layer); } static void prv_intro_timer_callback(void *context) { TimelineAppData *data = context; data->intro_timer_id = EVENTED_TIMER_INVALID_ID; // if we are already hiding the ...
(&data->timeline_layer)
phics_draw_circle(&context, GPoint(50, 50), 10); ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, SW_ODD)); setup_test(&context, false, SW_ODD, GColorBlack, GColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); ASSERT_CALLED(prv_draw_round_rect_strok...
(&context, GPoint(50, 50), 10)
4, 3, 2, 1}, }, }, }; s_connections[0] = &s_conn_a; s_connections[1] = &s_conn_b; s_device_a = device_from_le_connection(&s_conn_a); s_device_b = device_from_le_connection(&s_conn_b); ble_hrm_init(); } void test_ble_hrm__init_deinit_no_subscriptions(void) { // let cleanup & initialize do the w...
(s_device_a, true)
; // Expect permissions UI to be presented: prv_assert_permissions_ui_and_respond(true /* is_granted */); cl_assert_equal_b(true, ble_hrm_is_sharing_to_connection(&s_conn_a)); cl_assert_equal_b(true, ble_hrm_is_sharing()); prv_assert_event_service_subscribed(true); // Revoke: ble_hrm_revoke_sharing_per...
/* * 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_set_compositing_mode(ctx, GCompOpSet)
; graphics_draw_rotated_bitmap(ctx, (GBitmap*)&s_gfx_rotated_bitmap_bitmap, GPointZero, 0, GPointZero); } static void prv_test_45_assign(Layer *layer, GContext* ctx) { graphics_context_set_compositing_mode(ctx, GCompOpAssign); graphics_draw_rotated_bitmap(ctx, (GBitmap*)&s_gfx_rota...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ uint8_t testbuf[8] = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, }; uint8_t expectbuf[8] = { 5, 5, 5, 5, 5, 5, 5, 5, }; memset(testbuf, 5, 8); cl_assert_equal_m(testbuf, expectbuf, 8); }
tComplete, }; static PPoGATTPacket s_server_reset_request = (const PPoGATTPacket) { .sn = 0, .type = PPoGATTPacketTypeResetRequest, }; static PPoGATTPacket * s_client_reset_request; static uint16_t s_client_reset_request_size; static PPoGATTPacket * s_client_reset_complete; static uint16_t s_client_reset_complet...
{ expected_response.payload = (const PPoGATTResetCompleteClientIDPayloadV1) { .ppogatt_max_rx_window = PPOGATT_V1_DESIRED_RX_WINDOW_SIZE, .ppogatt_max_tx_window = PPOGATT_V0_WINDOW_SIZE, }; }
fake_gatt_client_op_assert_write(characteristic, (const uint8_t *) &expected_response, s_client_reset_complete_size, GAPLEClientKernel, false /* is_response_required */); if (s_ppogatt_version > 0) { s_tx_window_size = MIN(s_tx_window_size...
opups/notifications/notification_window.h" #include "services/common/analytics/analytics.h" #include "services/common/i18n/i18n.h" #include "services/normal/notifications/alerts_preferences_private.h" #include "services/normal/notifications/alerts_private.h" #include "services/normal/vibes/vibe_intensity.h" #include "s...
ARRAY_LENGTH(strings_for_vibe_intensities)
, true /* icons_enabled */, strings_for_vibe_intensities, data); } #endif /* !CAPABILITY_HAS_VIBE_SCORES */ // Text Size //////////////////////// static const char *s_text_size_names[] = { [SettingsContentSize_Small] = i18n_noop("Smaller"), [SettingsContentSize_Default] = i18n_noop("Default"), [Setting...
/* * 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((region->base_address & 0x1f) == 0)
; PBL_ASSERTN((region->region_num & ~0xf) == 0); PBL_ASSERTN((region->cache_policy != MpuCachePolicy_Invalid) && (region->cache_policy < MpuCachePolicyNum)); // MPU Region Base Address Register // | Addr (27 bits) | Region Valid Bit | Region Num (4 bits) | // The address is unshifted, we take t...
" #include "stubs_compiled_with_legacy2_sdk.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_print.h" #include "stubs_resources.h" #include "stubs_serial.h" #include "stubs_syscalls.h" #include "stubs_ui_window...
gtransform_is_only_scale(&t_c)
L_DEBUG, "test start time: %d", (int)now_utc); const time_t midnight_utc = time_util_get_midnight_of(now_utc); const time_t nap_time_start = midnight_utc + (ALG_PRIMARY_MORNING_MINUTE * SECONDS_PER_MINUTE); const time_t nap_time_end = midnight_utc + (ALG_PRIMARY_EVENING_MINUTE * SECONDS_PER_MINUTE); // Go to ...
prv_test_end(context, passed)
; } // ------------------------------------------------------------------------------- static void prv_test_activity_reward(void *context) { bool passed = true; // TODO: is this needed here? // Hack to get around midnight rollover bug (only affects tests) rtc_set_time(time_util_get_midnight_of(rtc_get_time())...
ed_own_address(own_address_t *desired_address_out) { if (s_local_addr_desired_policy.allow_cycling) { PBL_LOG(LOG_LEVEL_DEBUG, "Trying to set local address to auto-cycling private resolvable address!"); desired_address_out->addr_type = PRIVATE_RANDOM_RESOLVABLE_ADDRESS; return; } PBL_LOG(...
if (s_local_addr_state == LocalAddressState_InSync && (!s_local_addr_desired_policy.allow_cycling)) { PBL_LOG(LOG_LEVEL_ERROR, "Address cycled even though it was expected not to! " BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE_PTR(updated_address)); }
ccessable via the LastStableBPM metric activity_get_metric(ActivityMetricHeartRateFilteredBPM, 1, &last_median); activity_get_metric(ActivityMetricHeartRateFilteredUpdatedTimeUTC, 1, &last_update_utc); cl_assert_equal_i(last_median, 51); cl_assert(last_update_utc >= rtc_get_time() - 1); cl_assert(last_update_...
(metric_values[2], 0000)
; cl_assert_equal_i(metric_values[3], 0000); cl_assert_equal_i(metric_values[4], 0000); cl_assert_equal_i(metric_values[5], 0000); cl_assert_equal_i(metric_values[6], 3333); // Set the current value to something larger activity_metrics_prv_set_metric(ActivityMetricStepCount, Thursday, 4444); activity_get...
/* * 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...
(sizeof(int32_t *) * N_SAMPS)
; for (int i = 0; i < N_SAMPS; i++) { matrix[i] = kernel_malloc(sizeof(int32_t) * N_AXIS); } // determine average value of x, y, & z coordinates // and shift by this factor to prevent overflow. int32_t shift_factor[N_AXIS] = { 0 }; for (int j = 0; j < N_AXIS; j++) { for (int i = 0; i < N_SAMPS; i++...
UE) { dialog_spi_send_and_receive_dma(tx_buffer, rx_buffer, length, prv_dma_cb); success = (xSemaphoreTake(s_spi_dma_semph, tick_timeout) == pdTRUE); } return success; } static bool prv_spi_transaction(CoreDumpSPICmd *cmd, uint8_t *buffer, size_t length) { // The protocol works thustly: 1) wait for EXTI...
for (int region = 0; region < MemoryRegionTagCount; ++region) { if (region == MemoryRegionTag_Text && text_crc_matches) { continue; } // Write out a chunk header chunk_hdr.key = CORE_DUMP_CHUNK_KEY_MEMORY; chunk_hdr.size = region_buf[region].length + sizeof(CoreDumpMemoryHeader); if (flas...
_equal_s(alarm_day_text_6, "Thursdays"); bool schedule_7[7] = {false, false, false, false, false, true, false}; char alarm_day_text_7[32] = {0}; alarm_get_string_for_custom(schedule_7, alarm_day_text_7); cl_assert_equal_s(alarm_day_text_7, "Fridays"); bool schedule_8[7] = {false, false, false, false, false,...
alarm_get_string_for_kind(ALARM_KIND_CUSTOM, all_caps)
, "Custom"); all_caps = true; cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_EVERYDAY, all_caps), "EVERY DAY"); cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_WEEKDAYS, all_caps), "WEEKDAYS"); cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_WEEKENDS, all_caps), "WEEKENDS"); cl_assert_e...
Section 2.2.1 of https://drive.google.com/a/pebble.com/file/d/0B9tTN3OlYns3bEZaczdoZUU3UEk/view bma255_write_register(BMA255Register_EXTENDED_MEMORY_MAP, BMA255_EXTENDED_MEMORY_MAP_OPEN); bma255_write_register(BMA255Register_EXTENDED_MEMORY_MAP, BMA255_EXTENDED_MEMORY_MAP_OPEN); bma255_write_register(BMA255Regist...
bma255_prepare_txn(BMA255Register_FIFO_DATA | BMA255_READ_FLAG)
; for (int i = 0; i < num_samples_available; ++i) { uint8_t buf[BMA255_FIFO_FRAME_SIZE_BYTES]; for (int j = 0; j < BMA255_FIFO_FRAME_SIZE_BYTES; ++j) { buf[j] = bma255_send_and_receive_byte(0); } prv_convert_accel_raw_data_to_mgs(buf, &data[i]); } bma255_end_txn(); // Timestamp & Dispatch...
r s_current_hour = 12; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 0); } void test_alarm__alarm_type_change_updates_timeout(void) { AlarmId id; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_W...
alarm_create(&(AlarmInfo) { .hour = 10, .minute = 20, .kind = ALARM_KIND_JUST_ONCE })
ef struct { void* start; uint32_t length; bool word_reads_only; // Some peripherals can only be read 32 bits at a // time, or you BusFault (maybe). Set this to true // for memory regions where reads smaller than 32 // b...
{ char buffer[12]; itoa(i, buffer, sizeof(buffer)); #if PULSE_EVERYWHERE void *ctx = pulse_logging_log_sync_begin(LOG_LEVEL_ALWAYS, __FILE_NAME__, 0); pulse_logging_log_sync_append(ctx, msg); pulse_logging_log_sync_append(ctx, buffer); pulse_logging_log_sync_send(ctx); #else int max_length = 256; while...
static NORETURN prv_reset(void) { dbgserial_flush(); system_hard_reset(); } // ----------------------------------------------------------------------------------------- void coredump_assert(int line) { prv_debug_str_int("CD: assert - line ", line); boot_bit_set(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED); prv_rese...
// Last iteration: expect event with error status and 0 services: prv_assert_event(device, BTErrnoServiceDiscoveryTimeout); } } } void test_gatt_client_discovery__watchdog_error_out_after_max_retries(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equa...
(list_count(&connection->gatt_remote_services->node), 0)
; // Put one, expect one: prv_simulate_and_assert_discovery_of_one_service(&device); cl_assert_equal_i(list_count(&connection->gatt_remote_services->node), 1); } void test_gatt_client_discovery__rediscover_already_running(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: ...
recognizer->flags = 0; } void recognizer_cancel(Recognizer *recognizer) { PBL_ASSERTN(recognizer && recognizer->impl); if (!recognizer_is_active(recognizer)) { return; } if (recognizer->state == RecognizerState_Possible) { // Nothing to cancel return; } if (recognizer->impl->cancel(recogni...
(list_append(list->node, &recognizer->node))
; } void recognizer_remove_from_list(Recognizer *recognizer, RecognizerList *list) { if (!recognizer || !list || !recognizer->is_owned) { return; } recognizer->is_owned = false; list_remove(&recognizer->node, &list->node, NULL); } //////////////////////////////////////////////////////////////////////////...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
rtc_get_time()
ialog = NULL; ExpandableDialog *expandable_dialog = NULL; Dialog *dialog = NULL; if (use_simple_dialog) { simple_dialog = simple_dialog_create("Action Result"); if (!simple_dialog) { goto cleanup; } dialog = simple_dialog_get_dialog(simple_dialog); } else { expandable_dialog = expanda...
{ ActionResultData *data = data_ptr; data->progress_window = applib_zalloc(sizeof(ProgressWindow)); if (!data->progress_window) { const bool success = false; prv_cleanup_action_result(data, success); return; } progress_window_init(data->progress_window); const int16_t max_fake_percent = 80; pr...
static void prv_handle_success_fail_response(ActionResultData *data, AttributeList *attr_list, bool success) { const char *msg = attribute_get_string(attr_list, AttributeIdSubtitle, suc...
cl_assert_equal_b(s_unscheduled_completed, false); // Expect no advertisement timer cl_assert_equal_i(regular_timer_seconds_count(), 0); free(ad); } void test_gap_le_advert__single_job_multiple_terms_silence_and_loop_around(void) { BLEAdData *ad = create_ad("yo", NULL); GAPLEAdvertisingJobTerm advert_term...
assert_ad_data("ad data")
; gap_le_assert_advertising_interval(advert_terms[term].min_interval_slots, advert_terms[term].max_interval_slots); regular_timer_fire_seconds(1); } } cl_assert(!gap_le_is_advertising_enabled()); cl_assert_equal_i(s_unscheduled_cb_count, 1); cl_assert_eq...
&s_tx_buffer->information[0], s_tx_buffer->length); prv_start_retransmit_timer(retransmit_sequence_number); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Reached maximum number of retransmit attempts."); prv_bounce_ncp_state(); } } static void prv_start_retransmit_timer(uint8_...
(sizeof(ReliableInfoBuffer) + pulse_reliable_max_send_size())
; s_tx_lock = xSemaphoreCreateBinary(); xSemaphoreGive(s_tx_lock); } static void prv_bounce_ncp_state(void) { ppp_control_protocol_lower_layer_is_down(PULSE2_TRAINCP); ppp_control_protocol_lower_layer_is_up(PULSE2_TRAINCP); } #endif
bitmap_loaded = true; return true; } static const GlyphData *prv_get_glyph_metadata_from_spi(Codepoint codepoint, FontCache *font_cache, const FontResource *font_res, ...
if (!num_bytes_loaded) { PBL_LOG(LOG_LEVEL_WARNING, "Failed to load glyph metadata from resources; cp: %"PRIx32", offset: %"PRIx32, codepoint, data->resource_offset); return NULL; }
LineCacheData *final_data; #if !CAPABILITY_HAS_GLYPH_BITMAP_CACHING // Copy the info into the glyph_buffer. // This must be done _before_ loading the bitmap, otherwise loading the bitmap may modify the // metadata! We will use `glyph_buffer` as the final data, and leave `data` as the uncooked // version, th...
/* * 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...
("Quiet Time\nEnded")
, .callbacks = { .get_state = prv_get_state, .set_state = prv_set_state, }, }; void do_not_disturb_toggle_push(ActionTogglePrompt prompt, bool set_exit_reason) { action_toggle_push(&(ActionToggleConfig) { .impl = &s_dnd_action_toggle_impl, .prompt = prompt, .set_exit_reason = set_exit_reason,...
ual_m(&DEVICE_ADDR, &addr_buf, sizeof(DEVICE_ADDR)); shared_prf_storage_set_ble_pinned_address(&DEVICE_ADDR); cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 0); shared_prf_storage_set_ble_pinned_address(NULL); rv = shared_prf_storage_get_ble_pinned_address(NULL); cl_assert_equal_b(rv, false);...
shared_prf_storage_get_local_device_name(device_name_out, sizeof(device_name_out))
, true); cl_assert_equal_s(DEVICE_NAME, device_name_out); } // Sets the getting started field, then corrupts the getting_started crc void test_shared_prf_storage_v3__handle_currupt_field_same(void) { bool GETTING_STARTED_COMPLETE = true; shared_prf_storage_set_getting_started_complete(GETTING_STARTED_COMPLETE); ...
receive_init_and_put_fw_object(); prv_receive_commit(s_last_response_cookie, EXPECTED_CRC); prv_process_and_reset_test_counters(); } static void prv_receive_init_put_commit_and_install(PutBytesObjectType object_type) { prv_receive_init(VALID_OBJECT_SIZE, object_type); prv_process_and_reset_test_counters(); ...
(4, ObjectWatchApp)
; assert_ack_count(1); assert_nack_count(0); s_do_before_write = prv_cancel_before_write_second_message; const uint8_t payload[] = { 0xaa, 0xbb, 0xcc }; prv_receive_put(s_last_response_cookie, payload, sizeof(payload)); assert_nack_count(1); } void test_put_bytes__invalid_command_opcode(void) { uint8_...
ble TXE interrupt for writing i2c->CR2 |= I2C_CR2_ITBUFEN; transfer->state = I2CTransferState_WriteData; } break; case I2CTransferState_RepeatStart: // Generate a repeat start i2c->CR1 |= I2C_CR1_START; transfer->state = I2CTransferState_WriteAddressRx; break; ...
("NACK received during I2C transfer; Bus: %s", bus->name)
; } } return prv_end_transfer_irq(bus, false); } void i2c_hal_event_irq_handler(I2CBus *bus) { portEND_SWITCHING_ISR(prv_event_irq_handler(bus)); } void i2c_hal_error_irq_handler(I2CBus *bus) { portEND_SWITCHING_ISR(prv_error_irq_handler(bus)); }
/* * 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...
distance_to_mod_boundary(origin.y, DISP_ROWS)
); } static void prv_window_transition_render(WindowTransitioningContext *context, GContext *ctx) { const WindowTransitionRoundImplementation *implementation = (WindowTransitionRoundImplementation *)context->implementation; Window *window_to = context->window_to; if (window_to) { // move framebuffer by a...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_graphics_draw_bitmap__offset_bitmap_layer_across_ny(void) { prv_offset_bitmap_layer_test(GPoint(0, -25)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__composite_assign(void) { prv_composite_test(__func__, GCompOpAssign); } void test_graphics_draw_...
case ActivityMetricSleepExitAtSeconds: info->value_p = &state->sleep_data.exit_at_minute; info->settings_key = ActivitySettingsKeySleepExitAtHistory; info->has_history = true; info->converter = prv_convert_minutes_to_seconds; break; case ActivityMetricSleepState: info->value_...
(cur_wday - wday, DAYS_PER_WEEK)
; if (history.values[day] != value) { history.values[day] = value; settings_file_set(file, &m_info.settings_key, sizeof(m_info.settings_key), &history, sizeof(history)); } activity_private_settings_close(file); } if (current_value_updated) { if (metric == Activi...
= TIM_CounterMode_Up; TIM_TimeBaseInit(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, &tim_config); TIM_Cmd(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, DISABLE); TIM_ClearITPendingBit(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, TIM_IT_Update); TIM_ITConfig(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, TIM_IT_Update, ENABLE...
if (crc != s_spi_transport.rx_footer.crc) { PBL_LOG(LOG_LEVEL_ERROR, "CRC failed on remote SPI Receive 0x%08" PRIX32 " != 0x%08" PRIX32, crc, s_spi_transport.rx_footer.crc); prv_trigger_core_dump_from_isr(); }
bool should_give_semaphore = false; if (s_spi_transport.bytes_sendable_count) { prv_watchdog_start(); s_spi_transport.state = SPITransportState_WaitingForSending; } else { // Nothing to send, we're done: s_spi_transport.state = SPITransportState_Idle; should_give_semaphore = true; } prv...
offset.raw_value * offset.raw_value)}; } return (Fixed_S16_3){ .raw_value = (integer_sqrt((opposite_radius_sq - opposite_radius_sq * ((offset.raw_value * offset.raw_value) >> FIXED_S16_3_PRECISION) / offset_radius_sq) << FIXED_S16_3_PRECISION))...
(p.x - x, p.y + y)
); graphics_private_set_pixel(ctx, GPoint(p.x - y, p.y + x)); } if (quadrant & GCornerTopLeft) { graphics_private_set_pixel(ctx, GPoint(p.x - x, p.y - y)); graphics_private_set_pixel(ctx, GPoint(p.x - y, p.y - x)); } } } static void prv_plot4(GBitmap *fb, GRect *clip_box, GPoint center...
_timeout_menu_push(SettingsDisplayData *data) { int index = prv_timeout_get_selection_index(); const OptionMenuCallbacks callbacks = { .select = prv_timeout_menu_select, }; const char *title = PBL_IF_RECT_ELSE(i18n_noop("TIMEOUT"), i18n_noop("Timeout")); settings_option_menu_push( title, OptionMenuC...
(subtitle, data)
, NULL); } static uint16_t prv_num_rows_cb(SettingsCallbacks *context) { if (!prv_should_show_backlight_sub_items()) { return NumSettingsDisplayItems - NUM_BACKLIGHT_SUB_ITEMS; } return NumSettingsDisplayItems; } static void prv_deinit_cb(SettingsCallbacks *context) { SettingsDisplayData *data = (Settings...
_hidden(timeline_layer, true); // hide until the peek is over layer_set_hidden((Layer *)&timeline_layer->day_separator, true); layer_add_child(&window->layer, (Layer *)timeline_layer); // peek layer prv_init_peek_layer(s_app_data); prv_setup_peek(s_app_data); } static void prv_timeline_window_appear(Window ...
{ data->timeline_model.direction = TimelineIterDirectionPast; }
else if (args == NULL) { data->timeline_model.direction = TimelineIterDirectionFuture; } else { data->timeline_model.direction = args->direction; } // check if we were asked to launch into a specific item time_t now = rtc_get_time(); TimelineItem pin; bool launch_into_pin = false; if (args && ar...
/* * 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_mock_type(bool)
; } void icache_invalidate(void *addr, size_t size) { s_invalidate_size = size; s_invalidate_addr = (uintptr_t)addr; } void dcache_flush(const void *addr, size_t size) { s_flush_size = size; s_flush_addr = (uintptr_t)addr; } bool syscall_internal_check_return_address(void * ret_addr) { s_addr_result = User...
ess, registry); } while (temp_address != registry->cursor->begin); } //////////////////////////////////////////////////////////// // Registry data structure //////////////////////////////////////////////////////////// static int registry_get_next_available_index(Registry* registry) { for (int i = 0; i < registry->...
if (uuid_match) { r->active = false; registry->is_different_from_flash = true; }
} } } int registry_private_remove(const char* key, const uint8_t key_length, const uint8_t* uuid, Registry* registry) { const int idx = record_get_index(key, key_length, uuid, registry); PBL_ASSERTN(idx < registry->num_records); if (idx >= 0) { Record* r = registry->recor...
mission_by_device(const BTDeviceInternal *device) { BLEHRMSharingPermission *p = prv_find_permission_by_device(device); if (!p) { return HrmSharingPermission_Unknown; } return p->permission; } void ble_hrm_handle_activity_prefs_heart_rate_is_enabled(bool is_enabled) { if (!prv_hw_and_sw_supports_hrm()) {...
(LOG_LEVEL_INFO, "Requesting BLE HRM sharing permission")
; BLEHRMSharingRequest *const sharing_request = kernel_zalloc_check(sizeof(*sharing_request)); sharing_request->connection = connection; launcher_task_add_callback(prv_push_sharing_request_window_kernel_main_cb, sharing_request); } static void prv_put_sharing_state_updated_event(int subscription_count) { // 2 ...
ay_index < 0 || delay_index >= lookup->max_index) { return; } // We are adding additional delay, the max delay index increases lookup->max_index += delay_amount; for (int i = 0; i < lookup->num_points; i++) { // The lookup maps definition index => delay index // We want to add delay to points at or ...
(point, gvalues->size, gvalues->from, gvalues->to, normalized, interpolate)
; if (scale->values.is_offset) { gpoint_add_eq(&point, gvalues->offset); } command->points[i] = point; scale->iter.current_index++; } return true; } void gdraw_command_list_scale_segmented_to( GDrawCommandList *list, GSize size, GRect from, GRect to, AnimationProgress normalized, I...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(task, &event)
; } DEFINE_SYSCALL(uint32_t, sys_process_events_waiting, PebbleTask task) { return process_manager_process_events_waiting(task); } DEFINE_SYSCALL(void, sys_event_service_client_subscribe, EventServiceInfo *handler) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(handler, sizeof(*handler)); }...
stub_new_timer_timeout(put_bytes_get_timer_id())
, PUT_BYTES_TIMEOUT_MS); fake_event_reset_count(); stub_new_timer_fire(put_bytes_get_timer_id()); fake_system_task_callbacks_invoke_pending(); // Expect only "Cleanup" event: cl_assert_equal_i(fake_event_get_count(), 1); assert_cleanup_event(ObjectFirmware, VALID_OBJECT_SIZE); } void test_put_bytes__expe...
dirty_item->key, dirty_item->key_len, item_buf, item_size); if (PASSED(status)) { regular_timer_add_multisecond_callback(&session->timeout_timer, SYNC_TIMEOUT_SECONDS); } else if (status == E_DOES_NOT_EXIST) { // item was removed blob_db...
PBL_LOG(LOG_LEVEL_INFO, "Starting BlobDB record sync: <%s>", buffer)
; BlobDBDirtyItem *dirty_list = kernel_zalloc_check(sizeof(BlobDBDirtyItem) + key_len); list_init((ListNode *)dirty_list); dirty_list->last_updated = last_updated; dirty_list->key_len = key_len; memcpy(dirty_list->key, key, key_len); session = prv_create_sync_session(db_id, dirty_list, BlobDBSyncSessionTy...
/* * 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...
(connection, e)
; } static void prv_handle_discover_service_changed_handle( HcProtocolDiscoveryServiceChangedHandlePayload *payload) { GAPLEConnection *connection = gap_le_connection_by_device(&payload->address); if (connection == NULL) { PBL_LOG(LOG_LEVEL_WARNING, "Discovery service_changed_handle but no device connected...
cation_list_filter_cb(ListNode *node, void *data) { LoadedNotificationNode *loaded_notification = (LoadedNotificationNode *)node; Uuid *id = data; return uuid_equal(&loaded_notification->notification.header.id, id); } static bool prv_notification_list_filter_cb(ListNode *node, void *data) { NotificationNode *n...
attribute_get_uint32(&notification.attr_list, AttributeIdIconTiny, NOTIF_FALLBACK_ICON)
USH (0x5021) #define PULSE_PROTOCOL_LOGGING (0x0003) static bool s_initialized; static const int SERIAL_BAUD_RATE = 1000000; typedef struct PACKED PulseFrame { net16 protocol; unsigned char information[]; } PulseFrame; typedef struct PACKED PushPacket { net16 protocol; net16 length; unsigned char informat...
{ return; }
for (; *str && s_message_length < MAX_MESSAGE; ++str) { if (*str == '\n') { prv_flush(); } else if (*str != '\r') { s_message_buffer[s_message_length++] = *str; } } } void dbgserial_print_hex(uint32_t value) { char buf[12]; itoa(value, buf, sizeof(buf)); dbgserial_print(buf); }
800, 536, -240}, // 131 seconds { 728, 536, -352}, { 696, 488, -352}, { 752, 488, -392}, { 784, 456, -408}, { 848, 408, -360}, { 920, 440, -336}, { 1304, 456, -296}, { 1424, 464, -392}, { 1144, 464, -304}, { 1432, 392, -128}, { 1440, 400, -176}, { 1600, 392, -248}, ...
{ -224, 1104, -248}, { -208, 1000, -272}, { -208, 976, -248}, { -224, 928, -256}, { -192, 912, -288}, { -200, 920, -256}, { -256, 768, -264}, { -264, 864, -224}, { -280, 872, -168}, { -240, 872, -192}, // 137 seconds { -200, 896, -288}, { -200, 880, -184}, { -176,...
{ -272, 944, 40}, { -264, 1008, 24}, { -264, 984, -16}, { -192, 984, -16}, { -176, 888, 40}, { -224, 1000, -128}, { -232, 944, -120}, { -264, 1080, -176}, { -248, 1096, -152}, { -240, 1048, -128}, { -240, 1080, -200}, { -160, 936, -184}, { -136, 848, -280}, { -88...
lt->local_name[0] = 0; } // Try to copy the first Service UUID, we'll display this in the list: const 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 ...
(cell_index->row)
; BTErrno e = ble_central_connect(result->device, true /* auto_reconnect */, false /* is_pairing_required */); if (e) { APP_LOG(APP_LOG_LEVEL_INFO, "ble_central_connect: %d", e); } } static void menu_select_long_callback(MenuLayer *menu_lay...
}, { -1440, 544, -392}, { -1120, 464, -328}, { -1632, 544, -296}, { -1760, 328, -320}, { -1672, 336, -264}, { -1416, 240, -152}, { -1384, 152, 8}, { -1368, 96, 104}, { -1248, 120, 96}, // 23 seconds { -1048, 0, 104}, { -992, -728, 536}, { -608, -96, -184}, { -1144...
{ -1088, 128, -160}, // 28 seconds { -1152, 128, -56}, { -1184, 112, -72}, { -1312, 136, -8}, { -1328, -200, 216}, { -968, -368, 200}, { -1328, -264, 32}, { -1288, 160, -328}, { -1264, 80, -368}, { -1304, 88, -336}, { -1104, 48, -312}, { -984, 184, -336}, { -960, ...
{ -912, 352, 160}, { -1056, 360, -24}, { -1184, 312, 16}, { -1616, 512, 72}, { -1224, 1624, 32}, { -1568, 0, -240}, { -1144, 360, -248}, { -1240, 552, 8}, { -1344, 496, 32}, { -1312, 176, -64}, { -1008, 0, -192}, { -1016, 184, -216}, // 31 seconds { -1216, 248, -...
/* * 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...
(flash_address, desc->firmware_length)
; return crc == desc->checksum; } static void prv_display_erase_progress( uint32_t progress, uint32_t total, void *ctx) { display_firmware_update_progress(progress, total * 2); } static bool erase_old_firmware(uint32_t firmware_length) { dbgserial_putstr("erase_old_firmware"); return system_flash_erase( ...
xpire = PredicateCondition_L; cond_to_valid = PredicateCondition_G; wait_time = predicate_value - state->filter_state; } else { // Value decrements over time, so a < will become valid and a > will expire. cond_to_expire = PredicateCondition_G; cond_to_valid = PredicateCondition_L; wait_time = ...
{ return; }
ibuted under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "settings.h" #include "settings_activity_tracker.h" #include "se...
callbacks->draw_row(callbacks, ctx, cell_layer, row, is_selected)
; } } static uint16_t prv_get_num_rows_callback(MenuLayer *menu_layer, uint16_t section_index, void *context) { PBL_ASSERTN(section_index < SettingsMenuItem_Count); SettingsData *data = context; SettingsCallbacks *callbacks = prv_get_current_callbacks(data); return ...
(NULL, s_start_writeback_response_success, sizeof(s_start_writeback_response_success))
; cl_assert(did_sync_next); blob_db2_protocol_msg_callback(NULL, s_start_writeback_response_error, sizeof(s_start_writeback_response_error)); cl_assert(did_sync_cancel); } static const uint8_t s_sync_done_response[] = { BLOB_DB_COMMAND_SYNC_DONE_RESPONSE, // cmd 0x56, 0x78,...
{ ExpandableDialog *expandable_dialog = context; prv_manual_scroll(&expandable_dialog->scroll_layer, -1); }
static void prv_config_provider(void *context) { ExpandableDialog *expandable_dialog = context; window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, prv_up_click_handler); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, prv_down_click_handler); if (expandable_dialog->select_click_handler) {...
to aggravate the get_minute logic start_utc += 7 * SECONDS_PER_MINUTE; rtc_set_time(start_utc); // The test data AlgMinuteDLSSample minute_data[num_minutes]; prv_create_test_data(num_minutes, minute_data); // Call the minute handler, which computes the minute stats and saves them to data logging // as ...
(num_records, ALG_MINUTES_PER_FILE_RECORD)
; cl_assert_equal_i(start, oldest_to_fetch); printf("\nReceived %d minute records", (int)num_records); for (int j = 0; j < num_records; j++) { printf("\nRecord:%d, steps: %d", j, (int)received_records[j].steps); } // Verify the contents of the records for (int j = 0; j < num_records; j++...
urn; } case PEBBLE_BLE_SCAN_EVENT: case PEBBLE_BLE_CONNECTION_EVENT: case PEBBLE_BLE_GATT_CLIENT_EVENT: kernel_le_client_handle_event(e); return; case PEBBLE_COMM_SESSION_EVENT: { PebbleCommSessionEvent *comm_session_event = &e->bluetooth.comm_session_event; debounced_connec...
{ prv_handle_event(&e); }
event_service_handle_event(&e); event_cleanup(&e); mcu_fpu_cleanup(); event_loop_upkeep(); } } __builtin_unreachable(); }
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governi...
dict_read_begin_from_buffer(&iterator, (const uint8_t *) &push_message->dictionary, dict_size)
; if (inbox->received_callback) { inbox->received_callback(&iterator, inbox->user_context); } // Mark data as consumed... app_inbox_consume(consumer_info); // ... only then send the ACK: app_message_inbox_send_ack_nack_reply(session, transaction_id, CMD_ACK); }
er = 0x01, PhoneCmdHangup = 0x02, PhoneCmdGetStateRequest = 0x03, PhoneCmdGetStateResponse = 0x83, PhoneCmdIncoming = 0x04, PhoneCmdOutgoing = 0x05, PhoneCmdMissed = 0x06, PhoneCmdRing = 0x07, PhoneCmdStart = 0x08, PhoneCmdEnd ...
get_call_info_from_msg(iter, length, &call_info)
; if (!result) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to read caller information from 'Incoming' phone event"); return false; } #ifndef RELEASE print_call_info(&call_info); #endif type = PhoneEventType_Incoming; caller = phone_call_util_create_caller(call_info.caller_number, ...
prv_perform_action(uint32_t notification_uid, ActionId action_id); // ----------------------------------------------------------------------------- // Static variables // // All accesses to these variables should happen from the KernelMain task, // therefore no concurrent accesses can happen and no lock is needed. //...
{ NotificationQueueNode *queue_node = (NotificationQueueNode *)found_node; NotificationQueueNode *key_node = (NotificationQueueNode *)data; return (queue_node->uid == key_node->uid) && (queue_node->op == key_node->op); }
static NotificationQueueNode *prv_notif_queue_find(NotificationQueueNode *node) { return (NotificationQueueNode *)list_find((ListNode *)s_ancs_client->queue, prv_notif_queue_comparator, (void *)node); } static void prv_notif_qu...
(serialized_glance_size)
; if (!serialized_glance) { rv = E_OUT_OF_MEMORY; goto cleanup; } // Populate the header of the serialized glance *serialized_glance = (SerializedAppGlanceHeader) { .version = APP_GLANCE_DB_CURRENT_VERSION, .creation_time = (uint32_t)rtc_get_time(), }; uint8_t *glance_buffer_start = (uint8...
ate images, but not the one currently on screen // clean it up here. Note that we don't have to do this on Tintin/Bianca as we // do not create an intermediary reel for animating. kino_reel_destroy(s_phone_ui_data->current_icon); animation_unschedule(s_phone_ui_data->bg_color_animation); animation_unschedul...
layer_add_child(&window->layer, &s_phone_ui_data->core_ui_container)
jerry_create_error(JERRY_ERROR_TYPE, msg)
; } jerry_value_t rocky_error_argument_invalid(const char *msg) { return jerry_create_error(JERRY_ERROR_TYPE, (jerry_char_t *)msg); } jerry_value_t rocky_error_argument_invalid_at_index(uint32_t arg_idx, const char *error_msg) { char buffer[100] = {0}; snprintf(buffer, sizeof(buffer), "Argument at index %"PRIu3...
graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(5, 35), GPoint(45, 40)); } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, ...
(&ctx, fb)
return (AnalyticsStopwatchNode *)list_find( s_stopwatch_list, prv_compare_stopwatch, (void *)(uintptr_t)metric); } static void prv_add_stopwatch(DialogAnalyticsMetric metric, uint32_t count_per_sec) { AnalyticsStopwatchNode *stopwatch = kernel_malloc_check(sizeof(AnalyticsStopwatchNode)); *stopwatch = (Analyt...
{ while (s_stopwatch_list) { ListNode *head = s_stopwatch_list; list_remove(head, &s_stopwatch_list, NULL); kernel_free(head); } s_stopwatch_list = NULL; while (s_analytics_list) { ListNode *head = s_analytics_list; list_remove(head, &s_analytics_list, NULL); kernel_free(head); } s_...
true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , 2, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1); graphics_fill_round_rect(&ctx, &ORI...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_bottomright.${BIT_DEPTH_NAME}.pbi"))
; } void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_aa_corners(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Remove these #ifdefs in PBL-15916 when support for non-antialiased rounded rect #if SCREEN_COLOR_DEPTH_BITS == 8 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_...
p_size_px, crop_size_px); } GRect grect_inset_internal(GRect rect, int16_t dx, int16_t dy) { return grect_inset(rect, (GEdgeInsets) {.top = dy, .right = dx, .bottom = dy, .left = dx}); } GRect grect_inset(GRect r, GEdgeInsets insets) { grect_standardize(&r); const int16_t new_width = r.size...
(background_color)
; // this value is derived from test_graphics_colors__inverted_readable_color() const int32_t MAGIC_THRESHOLD = 4510; const bool bright = luminance >= MAGIC_THRESHOLD; return bright ? GColorBlack : GColorWhite; } BitmapInfo gbitmap_get_info(const GBitmap *bitmap) { if (!bitmap) { return (BitmapInfo) { ...
ght > cell_layer_bounds_size.h) { // If we couldn't fit one title line and the subtitle, try cutting out the subtitle instead container_height = title_text_frame_height + icon_frame_size.h; if (container_height > cell_layer_bounds_size.h) { // If we couldn't fit just the title and icon, try ju...
if (icon_on_left) { // Move content to the right for the icon on the left cell_layer_bounds_origin_x = grect_get_max_x(&rect); cell_layer_bounds_size.w -= cell_layer_bounds_origin_x - cell_layer_bounds->origin.x; if (icon_align == GAlignLeft) { // Vertically center the title and subtitle within t...
// Draw the subtitle (if one was provided and we have room), taking into account the cap offset if (render_subtitle && (subtitle_text_frame_height != 0)) { int16_t subtitle_text_frame_origin_y = (int16_t)(title_text_frame_origin_y + title_text_frame_height - subtitle_text_cap_offset); if (icon_ali...
bt_uuid_expand_16bit(0x2a35); BLECharacteristic characteristic; num_copied = gatt_client_service_get_characteristics_matching_uuids(service, &characteristic, &characteristic_uuid, 1); cl_assert_equal_i(num_copied, 1); GAPLEConnection *conne...
(characteristic, BLESubscriptionIndications, GAPLEClientKernel)
; cl_assert_equal_i(e, BTErrnoOK); } void test_gatt_client_subscriptions__subscribe_already_subscribed(void) { BTErrno e; BLECharacteristic characteristic = prv_get_indicatable_characteristic(); e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, ...
_stacks[idx], windows[idx], true); // Modals are visible as we push from lowest priority to top most cl_assert_equal_b(windows[idx]->on_screen, true); } // Only the top modal is visible modal_manager_event_loop_upkeep(); for (ModalPriority idx = ModalPriorityMin; idx < NumModalPriorities; idx++) { ...
(s_disappear_count, 2)
gap_le_connect_connect_by_bonding(BT_BONDING_ID_INVALID, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoInvalidParam...
cl_assert_equal_b(registered, true)
; // Try registering the device again for different client: e = gap_le_connect_connect(&device, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientKernel); cl_assert_equal_i(e, BTErrnoOK); // Assert registr...
subtitle = body; } else { WTF; } draw_cell(ctx, cell_layer, title, subtitle, loaded_node->icon); } // Display the appropriate layer static void prv_update_text_layer_visibility(NotificationsData *data) { NotificationNode *node = data->notification_list; // Toggle which layer is visible if (node =...
(text_layer, &GRect(horizontal_margin, window->layer.bounds.size.h / 2 - 15, window->layer.bounds.size.w - horizontal_margin, window->layer.bounds.size.h / 2), i18n_get("...
; layer_add_child(&window->layer, text_layer_get_layer(text_layer)); #if PBL_ROUND GColor bg_color = GColorClear; GColor fg_color = GColorBlack; StatusBarLayer *status_bar = &data->status_bar_layer; status_bar_layer_init(status_bar); status_bar_layer_set_colors(status_bar, bg_color, fg_color); layer_add...
touch_handle_driver_event(TouchDriverEvent_PalmDetect)
; // Cancelled event, followed by a palm detection event cl_assert_equal_i(s_expected_palm_events[0].type, PEBBLE_TOUCH_EVENT); cl_assert_equal_i(s_expected_palm_events[0].touch.type, PebbleTouchEvent_TouchesCancelled); cl_assert_equal_i(s_expected_palm_events[1].type, PEBBLE_TOUCH_EVENT); cl_assert_equal_i(...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
menu_layer_set_normal_colors(menu_layer, GColorWhite, GColorBlack)
qual_p(ab, stack[1]); // not necessary to free memory on unit tests } void test_layer__is_ancestor(void) { Layer parent, child_a, child_b, child_c; Layer *layers[] = {&parent, &child_a, &child_b, &child_c}; for (int i = 0; i < ARRAY_LENGTH(layers); ++i) { layer_init(layers[i], &GRectZero); } layer_ad...
layer_add_child(&child_a, &child_b)
continue; } // Look for and parse the expected values if (strcmp(token, "//>") == 0) { token = strtok(NULL, " \t\n"); if (strcmp(token, "TEST_EXPECTED") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.exp_steps); } else if (strcmp(token, "TEST_EXPECTED_MIN"...
{ sscanf(token + strlen(token) + 1, "%d", &state->test_entry.deep.min); }
, 832, 144}, { 2048, 664, 32}, { 1872, 760, 32}, { 1752, 1048, 120}, { 1576, 1248, 184}, { 1320, 1464, 328}, { 1016, 1464, 336}, { 720, 1216, 304}, { 472, 472, 88}, { 240, 408, -160}, { 104, 272, -616}, { -200, -8, -656}, { -712, 192, -400}, { -688, 584, -240}, { ...
{ 1224, 528, -160}, { 1160, 680, -168}, { 1368, 712, 0}, { 1680, 696, 200}, { 1960, 520, 304}, // 59 seconds { 1888, 464, 96}, { 1608, 528, 8}, { 1448, 752, -200}, { 1256, 832, -128}, { 968, 688, -48}, { 672, 528, -176}, { 472, 256, -296}, { 328, 8, -424}, { 2...
{ -152, 1000, 328}, { -152, 952, 328}, { -136, 928, 328}, { -144, 920, 368}, { -128, 968, 368}, { -144, 1032, 400}, { -144, 1080, 320}, { -152, 984, 224}, { -144, 920, 120}, { -128, 968, -40}, { -96, 952, -96}, { -104, 1096, -224}, { -120, 1064, -192}, { -104, 97...
/* * 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_invalidate_addr, 0x00)
; cl_assert_equal_i(s_invalidate_size, 0x20); cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Valid); } void test_cpu_cache__userspace_fail_from_size(void) { cl_will_return(icache_is_enabled, true); cl_will_return(dcache_is_enabled, true); cl_will_return(icache_line_size, 1); cl_will_return(dcache_line_...
ed_glance, serialized_glance_size); if (rv != S_SUCCESS) { goto cleanup; } rv = prv_deserialize_glance((SerializedAppGlanceHeader *)serialized_glance, (size_t)serialized_glance_size, glance_out); cleanup: kernel_free(serialized_glance); return rv; } status_t app_glance_db_...
if (validation_context.is_at_least_one_slice_invalid) { PBL_LOG(LOG_LEVEL_WARNING, "Tried to insert AppGlanceDB entry with at least one invalid slice"); return E_INVALID_ARGUMENT; }
); cl_assert_equal_i(settings_file_set(&file, key, key_len, val, val_len), E_OUT_OF_STORAGE); int val_len_out = settings_file_get_len(&file, key, key_len); cl_must_pass(val_len_out); uint8_t *val_out = malloc(val_len_out); cl_assert_equal_i(settings_file_get(&file, key, key_len, val_out, val_len_out), E_DOES_...
cl_must_pass(val_len_out); uint8_t *val_out = malloc(val_len_out); cl_must_pass(settings_file_get(&file_new, key, 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...
void test_settings_file__atomic(void) { printf("\nTesting if we really are atomic...\n"); bool have_hit_old_value = false; bool have_hit_new_value = false; bool have_hit_end = false; for (int i = 1; i < 50; i++) { printf("Iteration %3d... ", i); RecordResult result = write_and_change_record_aborting...
on 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 * distributed under the License is distributed on an "AS ...
{ MenuLayer l; menu_layer_init(&l, &GRect(10, 10, 180, 180)); menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks){ .draw_row = prv_draw_row, .get_num_rows = prv_get_num_rows, }); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(0, l.selection.y); cl_assert_eq...
void test_menu_layer__test_set_selected_center_focused(void) { MenuLayer l; const int height = 180; menu_layer_init(&l, &GRect(10, 10, height, 180)); menu_layer_set_center_focused(&l, true); menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks){ .draw_row = prv_draw_row, .get_num_rows = prv_g...
// Default handling is to use daily totals if (scope == HealthServiceTimeScopeOnce) { return prv_compute_aggregate_using_daily_totals(state, metric, time_start, time_end, aggregation); } else { return prv_compute_aggregate_averaged_using_daily_totals(stat...
sys_hrm_manager_unsubscribe(hrm_session)
cl_assert(circular_buffer_read(&buffer, 6, &out_buffer, &out_length))
; cl_assert_equal_i(out_length, 4); cl_assert(memcmp(out_buffer, (uint8_t*) "5678", 4) == 0); cl_assert(circular_buffer_consume(&buffer, 4)); // Get the rest of the wrapped read cl_assert(circular_buffer_read(&buffer, 2, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 2); cl_assert(memcmp(out_b...
pon_oom(void) { fake_malloc_set_largest_free_block(1024); // PutBytes allocates ~2K prv_receive_init(1024 * 1024, ObjectFirmware); fake_malloc_set_largest_free_block(~0); assert_ack_count(0); assert_nack_count(1); } ///////////////////////////////////////////////////////////////////////////////////////////...
(event.put_bytes.bytes_transferred, sizeof(chunk))
; cl_assert_equal_i(event.put_bytes.progress_percent, 100 * sizeof(chunk) / VALID_OBJECT_SIZE); cl_assert_equal_b(event.put_bytes.failed, false); } static uint32_t s_next_value_to_write; static void prv_cb_before_write(void) { prv_receive_put(s_last_response_cookie, (uint8_t *)&s_next_value_to_write, VALID_OBJEC...
ge is used to move the drawn rectangle just outside each corner the clipping static void prv_draw_rects(GContext *ctx, uint8_t sw, uint16_t yoffset, int16_t nudge) { // Adjust drawing box and clipping box ctx->draw_state.drawing_box = CLIP_RECT_DRAW_BOX; ctx->draw_state.drawing_box.origin.y += yoffset; ctx->dra...
prv_draw_dither_rects(&ctx, GColorLightGray)
; prv_draw_dither_rects(&ctx, GColorDarkGray); #endif }
N(iter_next(line_iter)); } } //////////////////////////////////////////////////////////// // Text layout //! @return is_success bool line_add_word(GContext* ctx, Line* line, Word* word, const TextBoxParams* const text_box_params) { // Horizontal overflow if (line->width_px > line->max_width_px) { return fal...
{ word_iter_state->current = next_word; // Check if word was trimmed until the null termination if (next_word.start == NULL) { is_text_remaining = false; } else { is_text_remaining = true; } break; }
is_text_remaining = iter_next(word_iter); } if (last_line_cb) { last_line_cb(word_iter_state->ctx, line, word_iter_state->text_box_params, is_text_remaining); } prv_line_justify(line, word_iter_state->text_box_params); return is_text_remaining; } static bool prv_text_layout_is_fresh(TextLayout* ...
/* * 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_pixel(ctx, GPoint(-5, 15))
; } void outside_x_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(15, -5)); } void outside_nx_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel...
ontext, KAlgActivityType activity_type, time_t start_utc, uint32_t len_sec, bool ongoing, bool delete, uint32_t steps, uint32_t resting_calories, uint32_t active_calories, uint32_t distance_mm) { int entry_idx = s...
while (prv_accel_sample_discovery_next(&test_entry[num_tests])) { StepFileTestEntry *entry = &test_entry[num_tests]; #ifdef STEP_TEST_ONLY if (strcmp(entry->name, STEP_TEST_ONLY)) { continue; } #endif entry->test_idx = num_tests; printf("\n\n==================================================...
test_results[num_tests] = (StepTestResults) { .steps = steps, .ref_steps = ref_steps, .test_idx = num_tests, }; num_tests++; if (num_tests >= k_max_tests) { printf("RAN INTO MAX NUMBER OF TESTS WE SUPPORT"); break; } } // Make sure we discovered at least 1 test ...
GBitmap s_bmp = (GBitmap) { .addr = s_data, .row_size_bytes = ROW_STRIDE, .info.format = GBitmapFormat1BitPalette, .info.version = GBITMAP_VERSION_CURRENT, .bounds = { .size = { WIDTH, HEIGHT } }, .palette = s_palette, }; memset(s_data, 0, sizeof(s_data)); for (int y = 0; y < HEIGHT; +...
(get_bitmap_color(&s_bmp, x, y), s_palette[x])
, print_buf); } } #endif bitblt_bitmap_into_bitmap(&dest_bitmap, &s_bmp, GPointZero, compositing_mode, GColorWhite); switch (compositing_mode) { case GCompOpTint: { // Since this is opaque, the tint_color will be used for the RGB value of the destination // image, so we want to use that as o...
OG(LOG_LEVEL_ERROR, "Could not seek by %d from whence %d at pos %d: %"PRId32, amount, whence, pos, status); fatal_logic_error(iter); } static int sfs_pos(SettingsRawIter *iter) { return sfs_seek(iter, 0, FSeekCur); } static int sfs_read(SettingsRawIter *iter, uint8_t *data, int data_len) { status_t st...
{ if (iter->hdr.key_len == 0) return; sfs_seek(iter, iter->hdr_pos + sizeof(SettingsRecordHeader), FSeekSet); sfs_write(iter, key, iter->hdr.key_len); }
t_activities()); } // --------------------------------------------------------------------------------------- // Test that we report the that a Sleep session is ongoing. void test_activity__activity_sessions_sleep_ongoing_then_delete(void) { // Start activity tracking. This method assumes it can be called from any t...
(&sleep_activity)
; // Flip the switch to say we are in light sleep. activity_private_state()->sleep_data.cur_state = ActivitySleepStateLightSleep; // Run,Walk,Sleep sessions active, ensure that asking if they are ongoing, it returns true cl_assert_equal_b(true, activity_sessions_is_session_type_ongoing(ActivitySessionType_Run...
License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/bitmap_layer.h" #include "applib/ui/window_private.h" #include "util/size.h" #include <stdio.h> // He...
((size_t)file_size)
; if (!png_data) { goto cleanup; } // Go back to the start of the file and read it into the buffer if (fseek(fp, 0L, SEEK_SET) != 0) { goto cleanup; } cl_assert_equal_i(fread(png_data, 1, file_size, fp), file_size); // Create a GBitmap using the PNG data result = gbitmap_cr...
sturb_is_schedule_enabled(curr_schedule_type); time_t seconds_until_update; bool is_enable_next; int curr_day = time.tm_wday; if (!curr_schedule_enabled) { // Only next schedule is enabled is_enable_next = true; // Depending on the current schedule, determine the first day index of the next schedule ...
prv_push_manual_dnd_first_use_dialog(source)
; } else { if (source == ManualDNDFirstUseSourceSettingsMenu) { prv_toggle_manual_dnd_from_settings_menu(NULL); } else { prv_toggle_manual_dnd_from_action_menu(NULL); } } } bool do_not_disturb_is_smart_dnd_enabled(void) { return alerts_preferences_dnd_is_smart_enabled(); } void do_not_di...
zeof(uint32_t), (uint8_t *)&value, sizeof(uint32_t)); value += 1; set_and_verify(&file, (uint8_t *)&j, sizeof(uint32_t), (uint8_t *)&value, sizeof(uint32_t)); } } // ensure all values of every entry is equal to LOOPS uint32_t desired_value = LOOPS; settings_file_each(&fi...
("Iteration %d key %s val %s\n", i, key, val)
; set_and_verify(&file, key, key_len, val, val_len); // delete the first iteration if (j < 255) { settings_file_delete(&file, key, key_len); } } printf("Making sure we handle running out of storage gracefully...\n"); memcpy(key, "k255", 5); memcpy(val, "v255", 5); cl_assert_equal_i(setti...
.type = PEBBLE_BLE_GATT_CLIENT_EVENT, .task_mask = ~(gap_le_pebble_task_bit_for_client(client)), .bluetooth = { .le = { .gatt_client = { .subtype = subtype, .object_ref = object_ref, .gatt_error = gatt_error, .value_length = value_lengt...
list_remove(event->context, (ListNode **)&s_client_event_ctxs[data->client], NULL)
; kernel_free(event->context); unlock: bt_unlock(); } typedef uint16_t (*HandleAndConnectionGetter)(uintptr_t obj_ref, GAPLEConnection **connection_out); static GattClientEventContext *prv_create_event_context(GAPLEClient client) { GattClientEventContext *evt_ctx = ...
AttributeIdBody: cl_assert_equal_s(a.attributes[i].cstring, b.attributes[i].cstring); break; case AttributeIdAncsAction: cl_assert_equal_i(a.attributes[i].int8, b.attributes[i].int8); break; case AttributeIdCannedResponses: { StringList *list_a = a.attributes[i].stri...
notification_storage_store(&e1)
; TimelineItem r; cl_assert(notification_storage_get(&i1, &r)); compare_notifications(&e1, &r); free(r.allocated_buffer); notification_storage_store(&e2); notification_storage_store(&e3); cl_assert(notification_storage_get(&i1, &r)); compare_notifications(&e1, &r); free(r.allocated_buffer); cl_a...
; PPoGATTPacket *heap_packet = NULL; // Cap the number of times we loop here, to avoid blocking the task for too long. uint8_t loop_count = 0; while ((packet = prv_prepare_next_packet(client, &heap_packet, &payload_size))) { ++loop_count; const BTErrno e = gatt_client_op_write_without_response(client->...
list_count((ListNode *) s_ppogatt_head)
; } void ppogatt_trigger_rx_ack_send_timeout(void) { PPoGATTClient *client = s_ppogatt_head; while (client) { rx_ack_timer_cb(client); client = (PPoGATTClient *) client->node.next; } }