prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
uld go away now prv_fake_send_new_data(); fake_system_task_callbacks_invoke_pending(); cl_assert(prv_get_subscriber_state_from_ref(session_ref) == NULL); } void test_hrm_manager__subscribe_multiple(void) { const int num_refs = 3; HRMSessionRef session_refs[num_refs]; AppInstallId app_ids[num_refs]; stu...
(app_id, 1, expire_s, HRMFeature_BPM|HRMFeature_LEDCurrent)
; } prv_fake_send_new_data(); // Two events for each app subscriber cl_assert_equal_i(s_event_count, num_refs * 2); for (int i = 0; i < num_refs; ++i) { sys_hrm_manager_unsubscribe(session_refs[i]); } } void test_hrm_manager__system_task_data_callback(void) { stub_pebble_tasks_set_current(PebbleTa...
e except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF A...
kernel_zalloc_check(TimelineEventServiceCount * sizeof(SerializedTimelineItemHeader))
; // Will update for (unsigned int i = 0; i < TimelineEventServiceCount; i++) { TimelineEventState *state = &s_states[i]; if (state->impl) { state->filter_header = &filter_headers[i]; state->filter_header->common.id = UUID_INVALID; if (state->impl->will_update) { state->impl->will...
equal_i(0b00111000, BITS_BETWEEN(3, 5)); cl_assert_equal_i(0b00010000, BITS_BETWEEN(4, 4)); } // Flash memory is organized into twelve sectors of unequal sizes. // Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB. // The remaining sectors are 128 KiB. // Bitset of sectors that have been "erased" static uint32_t erased_se...
cl_assert(flash_locked)
node->size); app_cache_remove_entry(node->id); node = (EvictListNode *)list_pop_head((ListNode *)node); kernel_free(temp); } } unlock: mutex_unlock_recursive(s_app_cache_mutex); return rv; } ////////////////////// // AppCache Helpers ////////////////////// // Remove the filename entry in ...
pfs_open(APP_CACHE_FILE_NAME, OP_FLAG_READ, FILE_TYPE_STATIC, 0)
arts of the circle if (draw_top) { prv_draw_scanline_collision_points(ctx, center.y.integer - i - special_line_offset_top, left, right, top_starting_edge, top_ending_edge, ignore_close_angles); } if (draw_bo...
{ for (int i=QUADRANTS_NUM - 1; i >= 0; i--) { if (quadrant & radius_quadrants[i]) { angle_end = ((i + 1) % 4) * (TRIG_MAX_ANGLE / 4); break; } } }
else { for (int i=1; i <= QUADRANTS_NUM; i++) { if (!(quadrant & radius_quadrants[i % 4])) { angle_end = i * (TRIG_MAX_ANGLE / 4); break; } } } } if (angle_end <= angle_start) { angle_end += TRIG_MAX_ANGLE; } prv_fill_oval_precise(ctx, point, outer_radi...
s[slice_index]; const AppGlanceSliceInternal *current_slice = &glance->slices[slice_index]; // Check the slice's type, fail the entire serialization if it's invalid if (!prv_is_slice_type_valid(current_slice->type)) { PBL_LOG(LOG_LEVEL_WARNING, "Tried to serialize a glance containing a s...
prv_is_slice_type_valid(serialized_slice->type)
|| !WITHIN(serialized_slice->total_size, APP_GLANCE_DB_SLICE_MIN_SIZE, APP_GLANCE_DB_SLICE_MAX_SIZE)) { return false; } // Deserialize the AttributeList from `serialized_slice` AttributeList attr_list = {}; char *attr_list_data_buffer = NULL; if (!prv_deserialize_attribute_list(seria...
/* * 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_panic(ERROR_BAD_RESOURCES)
Handle this better: there is no feedback to the UI that we've stopped recording s_state = SessionState_WaitForSessionResult; prv_stop_recording(); prv_start_result_timeout(); } static void prv_start_recording(void) { #if !defined(TARGET_QEMU) // TODO: reenable // PBL_ASSERTN(mic_start(MIC, &prv_audio_data_h...
mutex_unlock(s_lock)
; return VOICE_SESSION_ID_INVALID; } s_state = SessionState_StartSession; // check if we're being started from an app so we know to send the UUID when setting up a session s_from_app = ((pebble_task_get_current() == PebbleTask_App) && !app_install_id_from_system(app_manager_get_current_app_id())); ...
64_t start_ms = prv_now_ms(); // Create the animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); animation_set_delay(a, delay_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_delay(b, delay_b); Animation *c ...
animation_set_duration(b, duration_a)
ION, .layout.icon = RESOURCE_ID_SETTINGS_ICON_AIRPLANE, .layout.subtitle_template_string = "Test subtitle", }; cl_assert(app_glance_add_slice(session, slice) & APP_GLANCE_RESULT_INVALID_ICON); // Check that adding a slice with a subtitle that's too long fails const char *really_long_subtitle = "This is...
app_glance_service_get_current_slice(&APP_GLANCE_TEST_UUID, &slice_out)
, true); cl_assert_equal_m(&slice_out, &glance.slices[1], sizeof(slice_out)); // Let some time "pass" so that the creation time of this next reload doesn't get ignored fake_rtc_increment_time(10); // Reload the glance using the provided callback; this should empty the slices in the glance app_glance_reload(...
_data); prv_update_last_accel_data(&data); } mutex_unlock_recursive(s_accel_manager_mutex); return result; } DEFINE_SYSCALL(AccelManagerState*, sys_accel_manager_data_subscribe, AccelSamplingRate rate, AccelDataReadyCallback data_cb, void* context, PebbleTask handler_task) { ...
mutex_lock_recursive(s_accel_manager_mutex)
; { state->raw_buffer = buffer; state->samples_per_update = samples_per_update; state->num_samples = 0; prv_update_driver_config(); } mutex_unlock_recursive(s_accel_manager_mutex); return 0; } DEFINE_SYSCALL(uint32_t, sys_accel_manager_get_num_samples, AccelManagerState *sta...
/* * 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...
milliseconds_to_ticks(max_time_ms)
== (uint32_t)milliseconds_to_ticks_double(max_time_ms)); }
int animation_duration_ms = 300; const int animation_delay_ms = 1700; // This is the text that is currently not visible and animates into view data->info_text_in_animation = property_animation_create_layer_frame(&data->info_text_layer2.layer, &above_pair_tex...
prv_resource_id_for_state(data->ui_state)
); } static void prv_send_response(bool is_confirmed) { if (!s_data_ptr) { return; } bt_lock(); bt_driver_pairing_confirm(s_data_ptr->ctx, is_confirmed); bt_unlock(); } static bool prv_has_device_name(BTPairingUIData *data) { return (strlen(data->device_name_layer_buffer) != 0); } static bool prv_ha...
n is not reset; that would be foolish. RCC_DeInit(); // Reset flags for each bus taken from reset register lists in reference manual // starting with 5.3.5 "RCC AHB1 peripheral reset register" const uint32_t ahb1_periphs = 0 | RCC_AHB1Periph_CRC | RCC_AHB1Periph_DMA1 | RCC_AHB1Periph_DMA2 | RC...
(BOOT_BIT_RESET_LOOP_DETECT_ONE)
; break; case 6: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; case 7: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; default: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO)...
eel_get_gdraw_command_list(reel); prv_draw_reel_or_command_list_processed(ctx, reel, source_list, offset, processor); } static void prv_draw_processed_func(KinoReel *reel, GContext *ctx, GPoint offset, KinoReelProcessor *processor) { KinoReelTransformData *data = kino_reel_custo...
kino_reel_custom_get_data(reel)
; if (data) { return data->to; } return GRectZero; } void kino_reel_transform_set_global(KinoReel *reel, bool global) { KinoReelTransformData *data = kino_reel_custom_get_data(reel); if (data) { data->global = global; } } void kino_reel_transform_set_transform_duration(KinoReel *reel, uint32_t dur...
fo.ediv, pairing_info_out.local_encryption_info.ediv); cl_assert_equal_i(pairing_info->local_encryption_info.div, pairing_info_out.local_encryption_info.div); cl_assert_equal_i(pairing_info->identity.opaque.opaque_64, pairing_info_out.identity.opaque.opaqu...
memcmp(&out_addr, &addr, sizeof(addr))
, 0); cl_assert_equal_i(memcmp(&link_key_out, &link_key_out, sizeof(link_key)), 0); cl_assert_equal_i(platform_bits_out, 0xaa); shared_prf_storage_erase_bt_classic_pairing_data(); cl_assert_equal_b(shared_prf_storage_get_bt_classic_pairing_data(NULL, NULL, NULL, NULL), false); } void test_shared_prf_storage_v...
_read_stale_glance_blob(void) { // Force the insertion of a stale glance blob (outdated version) const SerializedAppGlanceHeader app_glance = (SerializedAppGlanceHeader) { .version = APP_GLANCE_DB_CURRENT_VERSION - 1, }; cl_assert_equal_i(app_glance_db_insert_stale((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZ...
app_glance_db_read_glance(&APP_GLANCE_TEST_UUID, NULL)
, E_INVALID_ARGUMENT); } void test_app_glance_db__inserting_glance_with_invalid_arguments_fails(void) { // NULL UUID fails const AppGlance glance = {}; cl_assert_equal_i(app_glance_db_insert_glance(NULL, &glance), E_INVALID_ARGUMENT); // NULL glance fails cl_assert_equal_i(app_glance_db_insert_glance(&APP_G...
EL_PEEK_COUNT, AnalyticsClient_System); PebbleTask task = pebble_task_get_current(); if (task == PebbleTask_Worker || task == PebbleTask_App) { analytics_inc(ANALYTICS_APP_METRIC_ACCEL_PEEK_COUNT, AnalyticsClient_CurrentTask); } if (!accel_running()) { return (-1); } mutex_lock_recursive(s_mutex);...
accel_consume_data(state->raw_buffer + state->num_samples, // buffer &state->buffer_client, ask_for, state->subsample_numerator, state->subsample_deno...
; // Set the timestamp if we just put the first item in the buffer. If we emptied accel's // buffer, we can resync the timestamp. Otherwise, we stick to the computed timestamp // updated by sys_accel_manager_consume_samples(). if (state->timestamp_ms == 0 || (state->num_samples == 0 && ...
Main); // Turn off power to internal flash when in stop mode periph_config_enable(PWR, RCC_APB1Periph_PWR); pwr_flash_power_down_stop_mode(true /* power_down */); periph_config_disable(PWR, RCC_APB1Periph_PWR); vTaskStartScheduler(); for(;;); } static void watchdog_timer_callback(void* data) { task_wat...
display_show_splash_screen()
; kernel_applib_init(); system_task_init(); events_init(); new_timer_service_init(); regular_timer_init(); clock_init(); task_watchdog_init(); analytics_init(); register_system_timers(); system_task_timer_init(); init_drivers(); #if defined(IS_BIGBOARD) // Program a random S/N into the Big...
e Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is...
(num_intervals, 2)
; cl_assert_equal_i(average_ms, 3000000000); fake_rtc_increment_time_ms(3000000000); 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, 3000000000); } void test_interval_timer__moving_average(void...
_peek(AccelDriverSample *data) { prv_read_curr_accel_data(data); return 0; } void accel_set_shake_sensitivity_high(bool sensitivity_high) { // Configure the threshold level at which the BMI160 will think shake has occurred if (sensitivity_high) { prv_write_reg(BMI160_REG_INT_MOTION_1, BOARD_CONFIG_...
(LOG_LEVEL_DEBUG, "enable shake detection %d", on)
; if (s_shake_detection_enabled == on) { // the requested change matches what we already have! return; } prv_update_accel_interrupts(on); if (on) { prv_enable_shake_detection(); } else { prv_disable_shake_detection(); } s_shake_detection_enabled = on; } void accel_enable_double_tap_dete...
ppMenuDataSource *source, AppMenuNode *menu_node, AppMenuOrderStorage *storage, bool update_and_take_ownership) { if (!storage) { return; } for (int i = 0; i < storage->list_length; i++) { const AppInstallId storage_app_id = storage->id_list[i]; if (storage_app_id ==...
(&entry, source)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_text_prefs, (data_len + 1)), E_INVALID_ARGUMENT)
; // Make sure we reject data that is too small to hold all entries cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_text_prefs, (data_len - sizeof(SerializedSendTextContact))), E_INVALID_ARGUMENT); // Make sure we reject keys we don't recognize cl_assert_equal_i(watc...
false /* auto_accept_re_pairing */); cl_assert(id != BT_BONDING_ID_INVALID); cl_assert_equal_b(bt_persistent_storage_has_pinned_ble_pairings(), true); bt_persistent_storage_delete_ble_pairing_by_id(id); cl_assert_equal_b(bt_persistent_storage_has_pinned_ble_pairings(), fa...
bt_persistent_storage_store_ble_pairing(&pairing_1, true /* is_gateway */, NULL, false /* requires_address_pinning */, false /* auto_acce...
e /* is_master */); // Verify the app task got a (virtual) disconnection event: prv_assert_client_event(&device, false /* connected */, (1 << PebbleTask_App), GAPLEConnectHCIReasonExtensionCancelConnect); // Verify there are no more intents: cl_assert_equal_i(gap_le_connect_connection...
fake_GAPAPI_put_encryption_change_event(true /* encrypted */, GAP_LE_PAIRING_STATUS_NO_ERROR, false /* is_master */, &device)
; // Verify the app task got a (virtual) connection event: prv_assert_client_event(&device, true /* connected */, (1 << PebbleTask_App), HCI_ERROR_CODE_SUCCESS); } void test_gap_le_connect__add_intent_requiring_pairing_after_connected_and_encrypted(void) { BTDeviceInternal device = *fa...
sert(!timeline_model_iter_next(NULL, NULL)); int new_idx; cl_assert(timeline_model_iter_prev(&new_idx, NULL)); cl_assert_equal_i(new_idx, 4); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(0)->pin.header....
timeline_model_init(first_time, &model)
; timeline_model_remove(&s_items[s_correct_order[1]].header.id); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[0]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timel...
t32_t sleep_total_seconds) { if (!activity_prefs_sleep_insights_are_enabled()) { return; } if (s_sleep_pin_state.notified) { INSIGHTS_LOG_DEBUG("Not notifying sleep pin - already notified"); return; } // Notify about the pin after a certain amount of time const time_t since_exited = now_utc - ...
(now_utc, sleep_exit_utc, sleep_enter_seconds, sleep_exit_seconds, sleep_total_seconds, s_sleep_stats.mean, &s_sleep_pin_state.uuid)
l_main(void *unused) { PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sharing started"); s_ble_hrm_session.service_info = (EventServiceInfo) { .type = PEBBLE_HRM_EVENT, .handler = prv_ble_hrm_handle_hrm_data, }; event_service_client_subscribe(&s_ble_hrm_session.service_info); s_ble_hrm_session.manager_session = ...
if (prv_get_permission_by_device(&connection->device) == permission) { return; }
const bool prev_is_sharing = prv_is_sharing(connection); prv_upsert_permission(&connection->device, permission); prv_update_is_sharing(connection, prev_is_sharing); } static void prv_disconnect_to_kill_subscription(GAPLEConnection *connection) { // Unfortunately, GATT does not offer a way to remove a subscrip...
k stop_transfer; TimerID active_mode_trigger; } AudioEndpointSession; static AudioEndpointSessionId s_session_id = AUDIO_ENDPOINT_SESSION_INVALID_ID; static AudioEndpointSession s_session; static uint32_t s_dropped_frames; static void prv_session_deinit(bool call_stop_handler) { bt_lock(); if (call_stop_handler...
{ s_dropped_frames++; PBL_LOG(LOG_LEVEL_DEBUG, "Dropping a frame..."); return; }
break; #endif #if CAPABILITY_HAS_MICROPHONE case RXMenuIdx_Microphone: title = "Microphone"; subtitle = data->is_mic_enabled ? "Enabled" : "Disabled"; break; #endif case RXMenuIdx_RunStop: title = (prv_test_is_running(data)) ? "Stop" : "Run"; break; } }...
prv_run_test_step(BTLETestStep_BTLEStop, data)
; // fallthrough case BTLETestStep_BTLEStop: prv_run_test_step(BTLETestStep_BTEnd, data); break; default: WTF; } } data->current_test_step = BTLETestStep_None; data->current_test = BTLETestType_None; } static void prv_enter_txrx_menu(AppData *data, BTLETestType te...
p_Max; int32_t result; stats_calculate_basic(op, data, num_data, NULL, NULL, &result); cl_assert_equal_i(result, 80); } void test_stats__avg(void) { const int32_t data[] = { 10, 40, 6, 32, 73, 80, 34, 25, 62 }; const size_t num_data = ARRAY_LENGTH(data); const StatsBasicOp op = StatsBasicOp_Average; int3...
cl_assert_equal_i(result.max, 80)
; cl_assert_equal_i(result.count, 9); cl_assert_equal_i(result.max_streak, 4); cl_assert_equal_i(result.first_streak, 1); cl_assert_equal_i(result.median, 34); } void test_stats__all_basic_ops_filtered_out(void) { const int32_t data[] = { 0, 0, 0, 0, 0 }; const size_t num_data = ARRAY_LENGTH(data); const...
(service, event->app_glance.app_uuid)
; if (glance_in_cache) { launcher_app_glance_update_current_slice(glance_in_cache); // If necessary, update the slice expiration timer with the updated current slice prv_update_slice_expiration_timer_if_necessary(service, glance_in_cache->current_slice.e...
/* * 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...
while (tuple) { uint8_t cmd = tuple->key; switch (cmd) { case RUN_STATE_KEY: if (tuple->value->uint8 != RUNNING_DEPRECATED) { cmd = APP_RUN_STATE_STOP_COMMAND; } else { cmd = APP_RUN_STATE_RUN_COMMAND; } success = true; break; case STATE_FE...
return success; } static void prv_send_ack_nack_reply(CommSession *session, const uint8_t transaction_id, bool ack) { const AppMessageAck nack_message = { .header = { .command = ack ? CMD_ACK : CMD_NACK, .transaction_id = transaction_id, }, }; comm_session_send_data(session, LAUNCHER_MESS...
atic const MemoryRegion s_MemoryRegions[MemoryRegionTagCount] = { { .tag = MemoryRegionTag_Text, // .text is first so it's easily excluded on crc check .start = &__text_start, .length = (uint32_t)__text_length, }, { .tag = MemoryRegionTag_VectorTable, .start = (void *)DATA_RAM_BASE_ADDRESS, .leng...
printf(".")
; // Feed the watchdog hw_watchdog_set_pos_val(0xFF); // Configure for RX mode rx_mode = true; hw_spi_change_fifo_mode(s_spi->bus_id, HW_SPI_FIFO_RX_ONLY); // Spin for 1 second before handling the watchdog/INT line uint16_t wd_start_ticks = prv_timer_get_ticks(); while (prv_timer_check...
/* * 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_log_buffer.level = level; }
uint8_t pbl_log_get_level(void) { return s_log_buffer.level; } int printf(const char *__restrict format, ...) { char line_buffer[128]; va_list args; va_start(args, format); int len = vsnprintf(line_buffer, sizeof(line_buffer), format, args); hw_uart_write_buffer(CONFIG_LOG_UART, li...
/* * 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...
{ *found_actl = actl_chunk_found; }
// current distance + data_length + chunk_parts return (current_offset - offset + marker.length + CHUNK_META_SIZE); } } else { // Seeking for data up to but not including FCTL or IDAT chunk (ie. image metadata) if (marker.chunk_type == CHUNK_IDAT || marker.chunk_type == CHUNK_FCTL) { ...
rv_get_icon_frame_exact(TimelineLayer *layer, int index, GRect *icon_frame) { const TimelineLayerStyle *style = prv_get_style(); GRect frame; prv_get_frame(layer, index, &frame); frame.origin.y += style->icon_offset_y; // Remove sidebar and apply icon margin frame.size.w += style->right_margin - style->icon...
{ for (int i = 0; i < (int)ARRAY_LENGTH(s_nonvisible_items); i++) { TimelineLayout *timeline_layout = layer->layouts[s_nonvisible_items[i]]; if (timeline_layout) { prv_destroy_layout(layer, s_nonvisible_items[i]); layer->layouts[s_nonvisible_items[i]] = NULL; } } }
BLE core dump -- RAM"); goto powerdown; } flash_write_bytes((const uint8_t *)&chunk_hdr, flash_addr, sizeof(chunk_hdr)); flash_addr += sizeof(chunk_hdr); // Write out a memory chunk header CoreDumpMemoryHeader mem_hdr; mem_hdr.start = (uint32_t)region_buf[region].start; flash_write_by...
reboot_reason_set(&reboot_reason)
; // Just reset the board, we don't want to wind up adding a normal coredump for the MCU system_hard_reset(); #else // Core dump has completed. Trigger a stack reset. bt_ctl_reset_bluetooth(); #endif }
16, 1208, 536}, { 24, 1336, 832}, { 88, 1192, 752}, { 152, 888, 392}, { 72, 608, 184}, { -8, 504, 296}, { -32, 496, 376}, { -128, 632, 384}, { -128, 776, 376}, { -120, 744, 360}, { -144, 824, 264}, // 24 seconds { -152, 816, 248}, { -152, 880, 264}, { -176, 1024, ...
{ 32, 1312, 552}, { 88, 1328, 696}, { 224, 1072, 488}, { 184, 840, 288}, { 56, 664, 192}, { 24, 560, 288}, { -24, 608, 304}, { -88, 736, 312}, { -32, 760, 280}, { -64, 776, 208}, { -104, 776, 176}, { -120, 896, 208}, { -80, 992, 200}, { -152, 1128, 304}, { -14...
{ -72, 1008, 352}, { -72, 1128, 496}, { -96, 1112, 544}, { -120, 1304, 896}, { 112, 1256, 544}, { 0, 736, 376}, { -144, 608, 376}, { 32, 672, 432}, { 40, 720, 456}, { -40, 648, 368}, { -32, 648, 256}, { -88, 704, 288}, { -40, 832, 280}, { -8, 864, 208}, { -56...
/* * 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...
comm_session_get_capabilities(app_session)
; if (FAILED(open_status)) { // File open failed, return live data without saving to cache goto done; } if (new_capabilities != cached_capabilities) { settings_file_set(&settings_file, &app_uuid, sizeof(app_uuid), &new_capabilities, sizeof(...
{ 1344, 592, -200}, { 1368, 616, -272}, { 1392, 552, -136}, { 1632, 504, -56}, { 1544, 400, -24}, { 1280, 336, -24}, { 1088, 312, 0}, { 944, 256, -24}, { 872, 216, -56}, { 824, 200, -88}, { 808, 144, -40}, // 72 seconds { 880, 128, -112}, { 896, -72, -64}, { 100...
{ 1032, 560, -160}, { 992, 552, -296}, { 928, 584, -344}, { 824, 688, -512}, { 832, 688, -528}, { 936, 776, -496}, { 968, 672, -344}, { 1056, 600, -264}, { 1104, 592, -288}, { 1328, 552, -184}, { 1800, 504, 0}, { 1976, 520, 48}, { 1816, 456, 0}, { 1480, 376, 8}, ...
{ 1480, 816, -320}, { 1952, 512, 56}, { 1952, 512, 40}, { 1912, 464, -80}, { 1552, 472, -72}, // 80 seconds { 1288, 344, 32}, { 968, 192, 80}, { 712, 128, 32}, { 520, 104, -136}, { 432, 24, -136}, { 448, 96, -104}, { 528, 144, -200}, { 600, 160, -344}, { 952,...
lude "stubs_logging.h" #include "stubs_memory_layout.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_resources.h" #include "stubs_syscalls.h" #include <stdio.h> // stubs InterpolateInt64Function animation_private_current_interpolate_override(void) { return NULL; } static FrameBuffer *f...
prv_int_scale_and_translate_to(-181, 1, 1, 181, 0, 0, ANIMATION_NORMALIZED_MAX, interp)
l_selection_animation(menu_layer); } // Move selection inverter layer: const int16_t w = menu_layer->scroll_layer.layer.frame.size.w; const GSize size = GSize(w, menu_layer->selection.h); menu_layer->inverter.layer.bounds = (GRect) { .origin = { 0, 0 }, .size = size, }; menu_laye...
property_animation_get_subject(prop_anim, (void **)&result.menu_layer)
; property_animation_to(prop_anim, &result.up, sizeof(result.up), false); return result; } static void prv_center_focus_animation_setup(Animation *animation) { CenterFocusSelectionAnimationState state = prv_center_focus_animation_state(animation); state.menu_layer->animation.cell_content_origin_offset_y = 0; ...
draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw2_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 2); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RA...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); }
id = &item->header.parent_id, .context = info, }; TimelineLayout *layout = (TimelineLayout *)layout_create(item->header.layout, &config); layer_add_child(&layer->layouts_layer, (Layer *)layout); GRect icon_rect; timeline_layer_get_icon_frame(layer, index, &icon_rect); layer_set_frame((Layer *)&layout->i...
prv_get_end_of_timeline_frame(layer, from_index, &from_frame)
; prv_get_end_of_timeline_frame(layer, to_index, &to_frame); PropertyAnimation *prop_animation = property_animation_create_layer_frame( (Layer *)&layer->end_of_timeline, &from_frame, &to_frame); Animation *animation = property_animation_get_animation(prop_animation); animation_set_duration(animation, dura...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_test_cycle_next(VibeClient_PhoneCalls, call_scores, 7, VibeScoreId_Jackhammer, 5)
; } void test_vibe_score_info__cycle_next_alarms(void) { const VibeScoreId alarm_scores[] = { VibeScoreId_StandardLongPulseLow, VibeScoreId_StandardLongPulseHigh, VibeScoreId_Pulse, VibeScoreId_NudgeNudge, VibeScoreId_Jackhammer, VibeScoreId_Reveille, VibeScoreId_Mario, }; prv_test_c...
/* * 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...
comm_session_send_buffer_begin_write(session, endpoint_id, length, timeout_ms)
; if (!sb) { return false; } comm_session_send_buffer_write(sb, data, length); comm_session_send_buffer_end_write(sb); return true; } CommSession * comm_session_open(Transport *transport, const TransportImplementation *implementation, TransportDestination destination) { ...
r->reel); bool is_reel_infinite = (kino_reel_duration == PLAY_DURATION_INFINITE); bool is_animation_reversed = animation_get_reverse(animation); bool is_animation_infinite = (animation_get_duration(animation, false, false) == PLAY_DURATION_INFINITE); if (!is_animation_infinite && !is_reel_infinite) { /...
{ kino_reel_set_elapsed(player->reel, from_elapsed_ms); prv_create_play_animation(player, from_elapsed_ms, to_elapsed_ms); animation_schedule(player->animation); }
ompability we have to adjust from integral points where given point means // center of the point center.x.raw_value += 4; center.y.raw_value += 4; radius.raw_value += 4; // Same for radius: radius.raw_value -= radius.raw_value % (FIXED_S16_3_ONE.raw_value / 2); if (stroke_width < 1 || angle_start > a...
{ // This function is going to be replaced with function that will support drawing of ellipsis // as documented in PBL-23640 // For now we only accept .0 and .5 radius precision radius_inner.raw_value -= radius_inner.raw_value % (FIXED_S16_3_ONE.raw_value / 2); radius_outer.raw_value -= radius_outer.raw_va...
prv_fill_oval_precise(ctx, center, radius_outer, radius_outer, radius_inner, radius_inner, angle_start, angle_end); } void graphics_fill_radial_internal(GContext *ctx, GPoint center, uint16_t radius_inner, uint16_t radius_outer, int32_t angle_start, int32_...
lude "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/bluetooth/local_addr.h" #include <bluetooth/bluetooth_types.h> #include <stdbool.h> #include <clar.h> //////////////////////////////////////////////////////////////////////////////////////////////////// // Fakes / Stubs #incl...
cl_will_return(bt_persistent_storage_set_ble_pinned_address, true)
; cl_will_return(bt_driver_set_local_address, 0); s_last_bt_persist_pinned_addr_is_null = false; s_last_bt_persist_pinned_addr = TEST_PINNED_ADDR_2; bt_local_addr_init(); cl_assert_equal_b(false, s_last_driver_allow_cycling); prv_assert_driver_addr_is_addr2(); } void test_local_addr__pause_resume(void) { ...
kendSchedule].schedule); s_dnd_schedule[WeekendSchedule].enabled = s_legacy_dnd_schedule_enabled; SET_PREF_ALREADY_OPEN(s_dnd_schedule_keys[WeekendSchedule].enabled_pref_key, &s_dnd_schedule[WeekendSchedule].enabled); #undef SET_PREF_ALREADY_OPEN #define DELETE_PREF(key) \ do { \ ...
rtc_is_timezone_set()
) { // Otherwise, if the timezone has been set, then we assume this is a user on 3.10 and lower // that has not touched their vibe intensity preferences. // rtc_is_timezone_set() was chosen because it is a setting that gets written when the user // connects their watch to a phone prv_set_v...
imeline_model_get_iter_state_with_timeline_idx(1)); int new_idx; bool has_next; cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(has_next); cl_assert_equal_i(new_idx, 2); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[0]].header.id, ...
timeline_model_iter_prev(&new_idx, NULL)
); cl_assert_equal_i(new_idx, 4); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id, &timeline_model_get_iter_state(1)->pin...
[]) { {-50, 0}, {-50, -60}, {10, -60}, {10, -20}, {-10, -20}, {-10, -40}, {-30, -40}, {-30, -20}, {50, -20}, {50, 40}, {-10, 40}, {-10, 0}, {10, 0}, {10, 20}, {30, 20}, {30, 0} } }; static const GPathInfo s_aa_clipping_path_info = { .num_points = 4, ...
GRect(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT)
tem/logging.h" #include "util/size.h" #include "workout_active.h" #include "workout_controller.h" #include "workout_metrics.h" #include <limits.h> #include <stdio.h> enum { SPORTS_TIME_KEY = 0x0, // TUPLE_CSTRING SPORTS_DISTANCE_KEY = 0x1, // TUPLE_CSTRING SPORTS_DATA_KEY = 0x2, // T...
if (!data->supports_third_party_hr) { data->supports_third_party_hr = true; health_service_set_heart_rate_sample_period(0 /* interval_s */); prv_update_scrollable_metrics(data); }
; } static bool prv_dma_handler(DMARequest *request, void *context, bool is_complete) { MicDevice *this = context; bool should_context_switch = false; PROFILER_NODE_START(mic); const int32_t *dfsdm_buffer = this->state->in_buffer[is_complete ? 1 : 0]; if (this->state->bytes_received == 0) { // Seed the...
prv_dfsdm_configure(MIC)
; // Start DFSDM conversion without DMA. Throw out the samples; we only // care about the short-circuit detection. DFSDM_Cmd(ENABLE); DFSDM_ChannelCmd(DFSDM_Channel2, ENABLE); DFSDM_FilterCmd(DFSDM_Filter0, ENABLE); DFSDM_RegularContinuousModeCmd(DFSDM_Filter0, ENABLE); DFSDM_StartSoftwareRegularConversi...
/* * 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_antialiased(ctx, false)
iter_next(&iterator)); cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[3].header.id)); #if CAPABILITY_HAS_CORE_NAVIGATION4 cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[2].header.id)); #endif cl_assert(!iter_prev(&iterato...
(&iterator)
); cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[1].header.id) || uuid_equal(&state.pin.header.id, &s_all_day_items[2].header.id)); cl_assert(!uuid_equal(&first_all_day_event, &state.pin.header.id)); cl_assert(state.node->all_day); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&stat...
ch_start_at_rate( ANALYTICS_DEVICE_METRIC_BLE_ESTIMATED_BYTES_ADVERTISED_COUNT, bytes_per_second, AnalyticsClient_System); } } } s_current = next; bt_driver_advert_client_set_cycled(true); } // -----------------------------...
if (is_registered) { PBL_LOG(LOG_LEVEL_INFO, "Unscheduling advertising job: %s", prv_string_for_debug_tag(job->tag)); prv_unlink_job(job); prv_perform_next_job(false); // Call the unscheduled callback: if (job->unscheduled_callback) { job->unscheduled_callback(job, ...
} unlock: bt_unlock(); if (is_registered) { kernel_free(job->terms); kernel_free(job); } } void gap_le_advert_unschedule_job_types( GAPLEAdvertisingJobTag *tag_types, size_t num_types) { bt_lock(); ListNode *first_node = bt_driver_advert_client_has_cycled() ? &s_current->node : &s_jobs->node...
/* * 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 (context->window_to == items_to_unload[i]->window) { context->window_to = NULL; }
amp_midnight == today_midnight) { switch (style) { case FullStyleLower12h: case FullStyleCapital12h: time_fmt = i18n_noop("%l:%M %p"); break; case FullStyleLower24h: case FullStyleCapital24h: time_fmt = i18n_noop("%R"); break; } } else if (timestamp_midn...
("In %lu minute")
prv_feed_steps_min(1); prv_test_end(context, passed); } // ------------------------------------------------------------------------------- static void prv_test_fill_sleep(void *context) { // Fill the sleep file bool success = activity_test_fill_minute_file(); prv_test_end(context, success); } // ----------...
app_malloc_check(num_tests * sizeof(SimpleMenuItem))
; for (uint32_t i = 0; i < num_tests; i++) { menu_items[i] = (SimpleMenuItem) { .title = s_test_entries[i].title, .callback = prv_test_begin }; } static SimpleMenuSection sections; sections.items = menu_items; sections.num_items = num_tests; data->menu_items = menu_items; data->menu_l...
, { 1080, 504, -240}, { 1264, 568, -344}, { 1256, 344, -184}, { 1328, 384, -128}, { 1472, 320, -96}, // 37 seconds { 1416, 176, -136}, { 1184, 40, -8}, { 1128, 200, -128}, { 1288, 320, -120}, { 1152, 240, 8}, { 984, 0, 24}, { 1232, -40, -32}, { 888, 24, -120}, ...
{ 824, -48, 32}, { 1240, 136, 112}, { 1416, 152, -224}, { 1368, 200, -104}, { 1368, 200, -176}, { 1056, 216, -256}, { 784, 200, -184}, { 888, 184, -152}, { 1128, 272, -168}, { 1328, 328, -192}, { 1336, 640, -264}, { 1512, 624, -464}, { 1080, 560, -288}, { 1272, 68...
el/events.h" #include "fake_events.h" #include "fake_session.h" #include "fake_system_task.h" #include "stubs_bt_lock.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_hexdump.h" #include "stubs_serial.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_i18n.h" extern voi...
phone_protocol_msg_callback(s_session, pp_msg, sizeof(pp_msg))
; fake_system_task_callbacks_invoke_pending(); prv_assert_last_event(PhoneEventType_End, true /* check_cookie */, false /* check_name_number */, NULL, NULL); } static void prv_assert_answer_call_sent_cb(uint16_t endpoint_id, const uint8_t* data, un...
ache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is dis...
(pattern_attribute)
_equal_i(ppogatt_get_destination(client), metas[i].expected_destination); ppogatt_close(client); } } void test_ppogatt__handles_unsupported_meta_ppogatt_version(void) { PPoGATTMetaV0 future_meta_non_compatible = s_meta_v0_system; future_meta_non_compatible.ppogatt_min_version = 0xaa; future_meta_non_compat...
{ fake_gatt_client_op_set_read_return_value(BTErrnoOK); prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], NULL, 0, BLEGATTErrorInvalidHandle); cl_assert_equal_i(ppoga...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_INFO, "HcGap: unhandled message id: %d\n", msg->command_id)
; break; } } void hc_endpoint_gap_service_set_dev_name(const char *name) { hc_protocol_enqueue_with_payload(HcEndpointID_GapService, HcMessageID_GapService_SetName, (const uint8_t *)name, strlen(name) + 1); } void hc_endpoint_gap_service_device_name_request(const BTDeviceI...
mmSessionCloseReason_UnderlyingDisconnection); cl_assert_equal_b(comm_session_is_valid(session), false); } void test_session__get_type_system(void) { Transport *transport = (Transport *) TransportID1; CommSession *session = comm_session_open(transport, &s_transport_imp, ...
(comm_session_get_current_app_session(), NULL)
; comm_session_close(system_session, CommSessionCloseReason_UnderlyingDisconnection); comm_session_close(legacy_app_session, CommSessionCloseReason_UnderlyingDisconnection); comm_session_close(modern_app_session, CommSessionCloseReason_UnderlyingDisconnection); } void test_session__assert_if_deinit_and_transpor...
/* * 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...
{ nf->callbacks.selected(nf, nf->callback_context); }
} static void click_config_provider(NumberWindow *nf) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 50, (ClickHandler) up_click_handler); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 50, (ClickHandler) down_click_handler); // Work-around: by using a multi-click setup for the select button,...
de "kernel/pebble_tasks.h" #include "process_management/process_manager.h" #include "os/mutex.h" #include "syscall/syscall_internal.h" #include "system/logging.h" #include "system/passert.h" #include "util/buffer.h" #include "util/list.h" typedef struct AppInboxNode { ListNode node; AppInboxServiceTag tag; AppIn...
prv_tag_for_event_handlers(message_handler, dropped_handler)
nd device from the bonding storage, // outside of bt_lock(), because it uses flash. if (!bt_persistent_storage_get_ble_pairing_by_id(bonding_id, &request.bonding.irk, &request.bonding.device, NULL)) { return BTErrnoInvalidParameter; } bt_lock(); BTErrno ret_val...
if (intent) { if (!intent->client[c].is_used) { // Not all specified clients own the intent ret_value = false; } } else { // Intent not found ret_value = false; }
enabled = false; prv_configure_operating_mode(); } uint32_t accel_set_sampling_interval(uint32_t interval_us) { BMA255SampleInterval actual_interval = prv_get_supported_sampling_interval(interval_us); // FIXME: For now, tie us to 125Hz. 125Hz is a rate that is easy enough to // subsample to all of our support...
{ map_value = BMA255_INT_MAP_1_INT2_FIFO_WATERMARK; en_value = BMA255_INT_EN_1_FIFO_WATERMARK; }
bma255_write_register(BMA255Register_INT_MAP_1, map_value); bma255_write_register(BMA255Register_INT_EN_1, en_value); prv_update_accel_interrupts(enable_int, AccelOperatingMode_Data); } void accel_set_num_samples(uint32_t num_samples) { // Disable interrupts so they won't fire while we change sampling rate ...
dle: %d, context_ref: %d, source: %d", handle, context_ref, source); const GattRespDest resp_dest = prv_dest_from_source(source); if (!prv_enqueue(conn_idx, context_ref, resp_dest, GattOpType_Write)) { return BLE_ERROR_NOT_CONNECTED; } ble_error_t rv = ble_gattc_write(conn_idx, handle, 0, ...
connection_get_address(conn, &addr)
; hc_endpoint_gatt_send_notification(&addr, evt->handle, evt->length, evt->value); } void gatt_wrapper_handle_indication(const ble_evt_gattc_indication_t *evt) { BTDeviceInternal addr; Connection *conn = connection_by_idx_check(evt->conn_idx); connection_get_address(conn, &addr); hc_endpoint_gatt_send_indica...
, lis3dh_IRQ2_handler); } static void disable_accel_interrupts(void) { for (unsigned int i = 0; i < ARRAY_LENGTH(BOARD_CONFIG_ACCEL.accel_ints); i++) { exti_disable(BOARD_CONFIG_ACCEL.accel_ints[i]); } } static void enable_accel_interrupts(void) { for (unsigned int i = 0; i < ARRAY_LENGTH(BOARD_CONFIG_ACCEL...
{ if (!s_running) { PBL_LOG(LOG_LEVEL_ERROR, "Accel Not Running"); return; } // accel output registers have adjacent addresses // MSB enables address auto-increment int num_bytes = 6 * num_samples; // Overflow bit doesn't get cleared until number of samples in fifo goes below // the watermark. R...
void lis3dh_init(void) { PBL_ASSERTN(!s_initialized); lis3dh_init_mutex(); s_initialized = true; if (!accel_start()) { s_initialized = false; return; } if (!lis3dh_config_set_defaults()) { // accel write will call reset if it fails, so just try again if (!lis3dh_config_set_defaults()) ...
/* * 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 (connection) { const char *device_name = connection->device_name ?: "<Unknown>"; strncpy(name, device_name, BT_DEVICE_NAME_BUFFER_SIZE); name[BT_DEVICE_NAME_BUFFER_SIZE - 1] = '\0'; connected = true; }
larm_events_put, 0); s_current_minute = 10; cl_assert_equal_i(s_num_alarm_events_put, 1); } void test_alarm__get_string_for_kind(void) { bool all_caps = false; 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_WEEK...
cl_assert_equal_i(s_num_alarms_fired, 1)
; } void test_alarm__recurring_daily_alarm_timeout_behind(void) { AlarmId id; s_current_hour = 11; s_current_minute = 30; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule); cl_asse...
static AppOutboxConsumer *prv_find_consumer_with_message(const AppOutboxMessage *message) { AppOutboxMessage *head = (AppOutboxMessage *)list_get_head((ListNode *)message); for (AppOutboxServiceTag tag = 0; tag < NumAppOutboxServiceTag; ++tag) { if (s_app_outbox_consumer[tag].head == head) { return &s_ap...
(consumer)
; list_remove(&message->node, (ListNode **)&consumer->head, NULL); prv_schedule_sent_handler(message->sent_handler, message->cb_ctx, status); } finally: kernel_free(message); prv_unlock(); } void app_outbox_service_cleanup_all_pending_messages(void) { prv_lock(); for (AppOutboxServiceTag tag = 0; tag...
_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl...
(a, spawn, NULL)
; // Make it repeat animation_set_play_count(seq, repeat_count); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); // Start A prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert...
, (uint8_t *)&entry, sizeof(AppCacheEntry)); } else { app_storage_delete_app(app_id); settings_file_delete(&file, (uint8_t *)&app_id, sizeof(AppInstallId)); } settings_file_close(&file); } unlock: mutex_unlock_recursive(s_app_cache_mutex); return rv; } //! Asks the app cache to...
(&file, prv_remove_matching_resource_file_callback, resource_list)
; settings_file_close(&file); mutex_unlock_recursive(s_app_cache_mutex); // resource_list now only contains filenames of resource files that don't have corresponding // entries in the app cache. We can safely delete these files. PFSFileListEntry *iter = *resource_list; while (iter) { PBL_LOG(LOG_LEVEL...
/* * 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...
(address, true /* is_random */)
; return *(BTDeviceInternal *)(&device); } static BTBondingID prv_add_bonding_for_fake_resolvable_device(void) { BTDeviceInternal identity_device = {}; const SMIdentityResolvingKey *irk = (const SMIdentityResolvingKey *) fake_GAPAPI_get_fake_irk(); BleBonding bonding = { .pairing_info = { .identity =...
ne_number) { } void vPortEnterCritical(void) { } void vPortExitCritical(void) { } void test_interval_timer__initialize(void) { fake_rtc_init(0, 0); } void test_interval_timer__simple(void) { IntervalTimer timer; interval_timer_init(&timer, 0, UINT32_MAX, 2); uint32_t num_intervals; uint32_t average_ms; ...
cl_assert_equal_i(average_ms, 1000)
; fake_rtc_increment_time_ms(1020); interval_timer_take_sample(&timer); // = 1000 + (0.25 * (1020 - 1000)) // = 1000 + (0.25 * 20) // = 1005 num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 2); cl_assert_equal_i(average_ms, 1005); fake_rtc_increment_time_ms...
} // -------- // If asked for an averaged sum over less than a day, we can use the intraday averages if ((scope != HealthServiceTimeScopeOnce) && (aggregation == HealthAggregationSum) && ((time_end - time_start) < SECONDS_PER_DAY)) { // For now, we will use the day of the week that time_start falls on...
(APP_LOG_LEVEL_INFO, "Only 1 alert allowed per metric")
; return NULL; } prv_init_metric_alert(state, HealthMetricHeartRateBPM, threshold, &state->cache->alert_threshold_heart_rate); return (void *)HealthMetricHeartRateBPM; default: return NULL; } #endif } // -------------------------------------------------...
_reel_impl = (KinoReelImpl) { .destructor = prv_destructor, .set_elapsed = prv_elapsed_setter, .get_elapsed = prv_elapsed_getter, .get_duration = prv_duration_getter }; test_reel = kino_reel_custom_create(test_reel_impl, test_reel_data); cl_assert(test_reel != NULL); test_player = malloc(sizeo...
(animation)
/* * 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...
(codepoint)
) { new_state = WordStateIdeograph; } else { new_state = WordStateGrowing; } break; case WordStateIdeograph: if (codepoint == WORD_JOINER_CODEPOINT) { new_state = WordStateJoining; } else { new_state = WordStateEnd; } case WordStateGrowing: ...
if (row_index < (int)ARRAY_LENGTH(s_rounded_corner_width)) { return s_rounded_corner_width[row_index]; } else if (num_rows - row_index - 1 < (int)ARRAY_LENGTH(s_rounded_corner_width)) { return s_rounded_corner_width[num_rows - row_index - 1]; } return 0; } void compositor_set_modal_transition_offset(GPoi...
(dst, GColorBlack.argb, bottom_bezel_length)
k_timer_manager.h" #include "kernel/pebble_tasks.h" #include "kernel/pbl_malloc.h" #include "os/mutex.h" #include "os/tick.h" #include "system/logging.h" #include "system/passert.h" #include "util/list.h" #include "FreeRTOS.h" #include "queue.h" #include "semphr.h" // Structure of a timer typedef struct TaskTimer {...
mutex_unlock(manager->mutex)
; return false; } // If the TIMER_START_FLAG_FAIL_IF_SCHEDULED flag is on, make sure timer is not already scheduled if ((flags & TIMER_START_FLAG_FAIL_IF_SCHEDULED) && timer->expire_time) { mutex_unlock(manager->mutex); return false; } // Remove it from its current list if (timer->expire_time)...
ch up (force the WFI to activate before moving on). // Tell the processor not to emter deepsleep mode for future WFIs. SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk; // Stop mode will change our system clock to the HSI. Move it back to the PLL. // Enable the PLL and wait until it's ready RCC_PLLCmd(ENABLE); while (...
{ sleep_mode_enable(false); }
void command_scheduler_resume_normal(void) { sleep_mode_enable(true); }
MALL); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r8_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Small circles setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL); graphics_draw_circ...
gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_clip_nxny.${BIT_DEPTH_NAME}.pbi")
------------------------------------------------------------- static uint16_t prv_get_max_payload_size(const PPoGATTClient *client) { const BTDeviceInternal device = gatt_client_characteristic_get_device(client->characteristics.data); const uint16_t mtu = gap_le_connection_get_gatt_mtu(&device); if (mtu ...
(LOG_LEVEL_ERROR, "Not disconnecting because max disconnects reached...")
; } return; } else { PBL_LOG(LOG_LEVEL_ERROR, "Disconnecting because max resets reached..."); // Record the time of this disconnect request analytics_event_PPoGATT_disconnect(rtc_get_time(), false); bt_lock(); const BLECharacteristic characteristic = client->characteristi...
/* * 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_app_glance_structured_get_data(structured_glance)
; return NULL_SAFE_FIELD_ACCESS(music_glance, title, NULL); } static void prv_music_glance_subtitle_dynamic_text_node_update( UNUSED GContext *ctx, UNUSED GTextNode *node, UNUSED const GRect *box, UNUSED const GTextNodeDrawConfig *config, UNUSED bool render, char *buffer, size_t buffer_size, void *user_d...
* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distribu...
graphics_context_set_compositing_mode(ctx, GCompOpTint)
; graphics_draw_bitmap_in_rect(ctx, icon, &icon_frame); return icon_frame.size.w + left_icon_spacing + style->right_icon_spacing; } static void prv_draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) { OptionMenu *option_menu = context...
rpolate_moook_soft); animation_set_duration((Animation *)anim, interpolate_moook_soft_duration(NUM_MOOOK_FRAMES_MID)); animation_set_handlers((Animation *)anim, (AnimationHandlers) { .stopped = prv_handle_animation_stop, }, data); data->mic_window.fly_anim = anim; animation_schedule((Animation *)anim); }...
(BUTTON_ID_BACK, &prv_mic_click_handler)
; window_set_click_context(BUTTON_ID_SELECT, context); window_single_click_subscribe(BUTTON_ID_SELECT, &prv_mic_click_handler); } static void prv_back_click_config_provider(void *context) { window_set_click_context(BUTTON_ID_BACK, context); window_single_click_subscribe(BUTTON_ID_BACK, &prv_mic_click_handler);...
prompt_send_response_fmt(status, sizeof(status), "Validated: 0x%lx", addr); flash_erase_sector_blocking(addr); flash_erase_sector_blocking(addr); // exercise already erased check } flash_write_bytes(&buf[0], addr, sizeof(buf)); flash_expect_program_failure(false); watchdog_f...
(buf, sizeof(buf), "Connected to " BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(conn->device.address))
; } return conn; } void command_bt_conn_param_set( char *interval_min_1_25ms, char *interval_max_1_25ms, char *slave_latency_events, char *timeout_10ms) { BleConnectionParamsUpdateReq req = { .interval_min_1_25ms = atoi(interval_min_1_25ms), .interval_max_1_25ms = atoi(interval_max_1_25m...
_scs_assert(slave); } static void prv_spi_release_helper(const SPISlavePort *slave) { spi_ll_slave_scs_deassert(slave); spi_ll_slave_release(slave); } uint8_t spi_slave_read_write(const SPISlavePort *slave, uint8_t out) { prv_spi_acquire_helper(slave); uint8_t ret = spi_ll_slave_read_write(slave, out); prv_...
(slave->slave_state->scs_selected)
; prv_spi_transmit_flush_blocking(slave->spi_bus); prv_spi_send_data(slave->spi_bus, out); prv_spi_receive_wait_ready_blocking(slave->spi_bus); return prv_spi_receive_data(slave->spi_bus); } void spi_ll_slave_write(const SPISlavePort *slave, uint8_t out) { PBL_ASSERTN(slave->slave_state->initialized); PBL_...
.size.w / 2) * FIXED_S16_3_ONE.raw_value; p0.y.raw_value = (data->canvas_layer->bounds.size.h / 2) * FIXED_S16_3_ONE.raw_value; p1.x.raw_value = (sin_lookup(rotation) * (line_length * FIXED_S16_3_ONE.raw_value) / TRIG_MAX_RATIO) + p0.x.raw_value; p1.y.raw_value = (-cos_lookup(rotation)...
window_set_fullscreen(s_window, true)
; window_set_window_handlers(s_window, &(WindowHandlers) { .load = main_window_load, .unload = main_window_unload, }); data->p1.x = 10; data->p1.y = 30; data->p2.x = 100; data->p2.y = 120; data->size = 40; data->operation = MIN_OPS; window_set_click_config_provider(s_window, click_config_pro...
sion_id; } // Calling this will end the recording, disable the mic and and stop the audio transfer session. We // expect voice_handle_dictation_result to be called next with a dictation response void voice_stop_dictation(VoiceSessionId session_id) { mutex_lock(s_lock); if ((s_state == SessionState_Idle) || (...
if (word->data[0] == '\x08') { strncat(sentence, (char *) &word->data[1], word->length - 1); } else { // if this is not the beginning of the string, insert a space before the word if (strlen(sentence) != 0) { strcat(sentence, " "); } strncat(sentence, (char *) word->data, word->length); }
return true; } static bool prv_handle_dictation_nlp_result_common(VoiceEndpointResult result, AudioEndpointSessionId session_id, bool app_initiated, Uuid *app_uuid) { if (s_state == SessionState_Idle) { retu...
tem_task.h" #include "fake_pbl_malloc.h" #include "fake_session.h" #include "stubs_bt_lock.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_hexdump.h" #include "stubs_passert.h" // Fakes /////////////////////////////////////////////////////////// static TimerID s_debounce_timer; static bool s_de...
init(true /* connected */)
; check_connected(); //! Get disconnected event prv_send_connection_event(false); check_waiting_to_send_disconnect(); // No event put cl_assert_equal_i(s_event_count, 0); //! Get connected event before timer fires prv_send_connection_event(true); check_connected(); // No event put cl_assert_...
/* * 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_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "send all sessions: empty %s connected %s counter %u", bool_to_str(check_counter == 0), bool_to_str(comm_session_get_system_session() != NULL), check_counter)
-1656}, { -864, 816, -1080}, { -976, 264, -648}, { -1440, -96, 104}, { -1280, 256, -160}, // 53 seconds { -968, 560, -136}, { -608, 2192, -976}, { -672, 3776, -1400}, { -128, 3656, -1600}, { 560, 2376, -872}, { 640, 976, -168}, { 960, 400, -80}, { 1296, -88, 80}, ...
{ 2424, 3984, -2392}, { 1336, 3480, -2208}, { 136, 1696, -1456}, { -432, 928, -680}, { -528, 224, -352}, { -752, -240, 144}, { -1480, -256, 120}, { -1184, 72, -80}, { -1296, 376, 72}, { -1216, 2832, -1080}, { -616, 4000, -2272}, { 1216, 2744, -1496}, { 928, 1288, -512...
{ -1280, -184, -72}, { -1464, -216, 128}, { -1112, 64, 48}, { -1016, 456, -8}, { -632, 2624, -1120}, { -584, 4000, -2240}, { 872, 3064, -1720}, { 728, 1560, -464}, { 1032, 648, -72}, { 1792, -304, 16}, { 1656, -816, 384}, // 61 seconds { 1624, -560, 200}, { 1360,...
is file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITION...
prv_show_warning_dialog(data, exit_on_pop, warning_text)
; weather_app_layout_set_down_arrow_visible(layout, false); weather_app_layout_set_data(layout, NULL); } } static void prv_main_window_appear(Window *window) { WeatherAppData *data = app_state_get_user_data(); data->weather_event_info = (EventServiceInfo) { .type = PEBBLE_WEATHER_EVENT, .handler ...
/* * 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_within(0, -10, 0)
; cl_assert_within(0, -10, 0); } void test_clar__test_assert_near(void) { cl_assert_near(0, 0, 0); cl_assert_near(1, 1, 1); cl_assert_near(1, 10, 10); cl_assert_near(1, 5, 10); cl_assert_near(0, 10, 10); } // GRect ///////////////////////// #define EX_GRECT GRect(5, 6, 7, 8) static GRect prv_get_grect...