prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
sk_add_callback(void (*callback)(void *data), void *data) { callback(data); } // Tests /////////////////////////////////////////////////////////// void test_bluetooth_persistent_storage__initialize(void) { bonding_sync_init(); fake_spi_flash_init(0, 0x1000000); pfs_init(false); s_ble_bonding_change_add_cou...
(bt_persistent_storage_has_pinned_ble_pairings(), false)
; // Read it back ret = bt_persistent_storage_get_ble_pairing_by_id(id_1, &irk_out, &device_out, NULL /* name */); cl_assert(ret); cl_assert_equal_m(&irk_out, &pairing_1.irk, sizeof(irk_out)); cl_assert_equal_m(&device_out, &pairing_1.identity, sizeof(device_out)); // Store another pairing SMPairingInfo...
N_GEOMETRY (131) #define IMAGING_RESP_FINALIZE_REGION (132) #define IMAGING_RESP_MALFORMED_CMD (192) #define IMAGING_RESP_INTERNAL_ERROR (193) #define FLASH_REGION_PRF (1) #define FLASH_REGION_SYSTEM_RESOURCES (2) typedef union Command { uint8_t opcode; struct PACKED EraseCommand { uint8_t opcode; uint32...
(message, sizeof(EraseAndWriteAck))
; } s_erase_in_progress = false; } static void prv_handle_write(Command *cmd, size_t command_length) { if (command_length <= sizeof(cmd->write)) { prv_respond_malformed_command(cmd, command_length, NULL); return; } size_t write_length = command_length - sizeof(cmd->write); flash_write_bytes(&cmd-...
c void prv_exit(TimelineAppData *data) { UNUSED const TimelineAppState prev_state = data->state; if (!prv_set_state(data, TimelineAppStateExit)) { return; } #if ANIMATION_SLIDE prv_launch_watchface(data); #elif ANIMATION_DOT const uint32_t duration = interpolate_moook_in_duration(); animation_unschedu...
((Window *)&data->pin_window)
) { return false; } TimelineIterState *current_state = timeline_model_get_current_state(); if (current_state == NULL) { return false; } return uuid_equal(&current_state->pin.header.id, uuid); } static void prv_refresh_pin(TimelineAppData *data, int idx) { PBL_ASSERTN(idx >= 0); TimelineIterStat...
sert_equal_i(hr_zone_time_s[HRZone_Zone0], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 10); prv_inc_time(10); prv_put_bpm_event(ZONE_1_HR, HRMQuality_Good); workout_service_get_current_workout...
(5 * SECONDS_PER_MINUTE)
; // Close app and wait 30 minutes workout_service_frontend_closed(); prv_inc_time(30 * SECONDS_PER_MINUTE); // Make sure notification is not sent yet and the workout is still ongoing cl_assert_equal_b(s_abandoned_workout_notification_sent, false); cl_assert_equal_b(workout_service_is_workout_ongoing(), t...
XT_LINE_HEIGHT_PX (fonts_get_font_height(TEXT_FONT)) #define TEXT_MAX_HEIGHT_PX ((2 * TEXT_LINE_HEIGHT_PX) + 8) // 2 line + some space for descenders static int prv_get_rendered_text_height(const char *text, const GRect *text_box) { GContext *ctx = graphics_context_get_current_context(); TextLayoutExtended lay...
(text_layer, TEXT_FLOW_INSET_PX)
; #endif // Icon const GPoint icon_origin = GPoint((grect_get_max_x(&frame) - icon_size.w) / 2, icon_top_margin_px); if (dialog_init_icon_layer(dialog, icon, icon_origin, !simple_dialog->icon_static)) { layer_add_child(&dialog->window.layer, &dialog->icon_layer.layer); ...
ite = false }; // ISR stack guard static const MpuRegion s_isr_stack_guard_region = { .region_num = MemoryRegion_IsrStackGuard, .enabled = true, .base_address = (uint32_t) __isr_stack_start__, .size = (uint32_t) __stack_guard_size__, .cache_policy = MpuCachePolicy_NotCacheable, .priv_read = false, .priv_...
{ return &s_kernel_bg_stack_guard_region; }
bool memory_layout_is_pointer_in_region(const MpuRegion *region, const void *ptr) { uintptr_t p = (uintptr_t) ptr; return (p >= region->base_address && p < (region->base_address + region->size)); } bool memory_layout_is_buffer_in_region(const MpuRegion *region, const void *buf, size_t length) { return memory_l...
way to write to the display in the bootloader since we don't have interrupts. static void prv_display_write_byte(uint8_t d) { // Block until the tx buffer is empty SPI_I2S_SendData(DISP_SPI, d); while (!SPI_I2S_GetFlagStatus(DISP_SPI, SPI_I2S_FLAG_TXE)) {} } // Since all these values are constant we can save cod...
(DISP_GPIO)
; } // Clear-all mode is entered by sending 0x04 to the panel void display_clear(void) { prv_enable_display_access(); prv_display_write_byte(DISP_MODE_CLEAR); prv_display_write_byte(0x00); prv_disable_display_access(); } //! Static mode is entered by sending 0x00 to the panel //! This stops any further upda...
SYSTEM_APP; } else { return entry->install_id; } } bool app_install_is_app_running(AppInstallId id) { return app_manager_get_task_context()->install_id == id; } bool app_install_is_worker_running(AppInstallId id) { return worker_manager_get_task_context()->install_id == id; } void app_install_notify_app...
(0xaa0000)
/* * 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...
(command, length, "Empty command")
; } void pulse_flash_imaging_link_state_handler(PulseLinkState link_state) { } static bool s_erase_in_progress = false; static uint32_t s_erase_start_address; static uint32_t s_erase_length; typedef struct PACKED EraseAndWriteAck { uint8_t opcode; uint32_t address; uint32_t length; uint8_t complete; } EraseA...
s_ht = this->stream->controller->periph->LISR & DMA_LISR_HTIF2; break; case (uintptr_t)DMA1_Stream3: case (uintptr_t)DMA2_Stream3: *has_tc = this->stream->controller->periph->LISR & DMA_LISR_TCIF3; *has_ht = this->stream->controller->periph->LISR & DMA_LISR_HTIF3; break; case (uintpt...
this->stream->periph->FCR = fcr_value; prv_release_controller(this->stream->controller); // Configure and enable the IRQ if necessary (DMA interrupts enabled later) if (this->irq_priority != IRQ_PRIORITY_INVALID) { NVIC_SetPriority(this->stream->irq_channel, this->irq_priority); NVIC_EnableIRQ(this->st...
void dma_request_init(DMARequest *this) { if (this->state->initialized) { return; } // we only support 1 transfer per stream so assert that the stream isn't already initialized PBL_ASSERTN(!this->stream->state->initialized); // sanity check that the stream and controller are valid switch ((uintptr_t)...
nimation *parent_h, Animation **animation_array, uint32_t array_len, AnimationType type) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); if (array_len > ANIMATION_MAX_CHILDREN) { // Exceed max # of children allowed? return NULL; } bool success =...
animation_destroy(children[i])
; } return NULL; } } else { if (from->is_property_animation) { PropertyAnimationPrivate *prop = property_animation_private_clone( (PropertyAnimationPrivate *)from); if (prop) { clone = &prop->animation; cl...
th_px == 3 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); // reset line line = (Line) { 0 }; line.max_width_px = text_box_para...
(line.height_px == 10)
; cl_assert(line.width_px == HORIZ_ADVANCE_PX * 0); cl_assert(line.origin.x == 0); cl_assert(line.suffix_codepoint == 0); cl_assert(*line.start == '\n'); // \n cl_assert(*word_iter_state.current.start == '\n'); cl_assert(*word_iter_state.current.end == 'a'); cl_assert(word_iter_state.current.width_px =...
/* * 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...
pebble_task_get_name(pebble_task_get_current())
); } } // ------------------------------------------------------------------------------------------ DEFINE_SYSCALL(void, animation_service_timer_event_received, void) { PebbleTask task = pebble_task_get_current(); if (task == PebbleTask_KernelMain) { s_kernel_main_event_pending = false; } else if (tas...
= property_animation_get_animation( property_animation_create_bounds_origin(&data->cassette_container, &GPointZero, &left_target)); Animation *cassette_right = property_animation_get_animation( property_animation_create_bounds_origin(&data->cassette_container,...
(disappear_animation, bounceback_animation, NULL)
; data->cassette_current_icon = new_bitmap; animation_schedule(sequence); } static void prv_skipping_click_config_provider(void *data); static void prv_volume_click_config_provider(void *data); static void prv_update_cassette_icon(MusicAppData *data, bool animated) { if (music_get_playback_state() == MusicPlay...
ed at any given // time. The oldest pages will be removed as the log buffer wraps around. // // Since our logging routines call into this module, we should NOT have any // PBL_LOGs in this file, else you could generate infinite loops! // Configuration Defines #define LOG_REGION_SIZE (FLASH_REGION_DEBUG_DB_END - FLASH_...
(LOG_PAGE_SIZE <= ERASE_UNIT_SIZE, "Log pages must fit within an erase unit")
; _Static_assert((ERASE_UNIT_SIZE % LOG_PAGE_SIZE) == 0, "The log page size must be divisible by the erase unit size"); //! Given the current address and amount to increment it by, handles wrapping //! and computes the valid flash address static uint32_t prv_get_page_addr(uint32_t curr_page_addr, uint32_t incr_by...
", "Row 2", "Row 3", "Row 4", "Row 5", "Row 6", }; static uint16_t prv_get_num_rows(struct MenuLayer *menu_layer, uint16_t section_index, void *callback_context) { return ARRAY_LENGTH(prv_row_texts); } static void prv_draw_row(GContext* ctx, const Layer *cell_layer, char const *title, in...
layer_set_hidden(&data->action_list1.inverter.layer, true)
; scroll_layer_set_shadow_hidden(&data->action_list1.scroll_layer, true); layer_add_child(&window->layer, menu_layer_get_layer(&data->action_list1)); menu_layer_init(&data->action_list2, &menu_layer_rect); menu_layer_set_callbacks(&data->action_list2, NULL, &(MenuLayerCallbacks){ .get_num_rows = prv_get...
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 governing permissions an...
{ return app_install_is_watchface(app_manager_get_current_app_id()); }
AppInstallId system_app_state_machine_get_last_registered_app(void) { // If we're rooted in the watchface but we're not the watchface itself, or the launcher // is closing, we should launch the watchface. if ((s_rooted_in_watchface && !prv_current_app_is_watchface()) || (app_manager_get_current_app_md() =...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_ERROR, "Got a start sync with an invalid length: %"PRIu32"", length)
; return; } struct PACKED StartSyncResponseMsg { BlobDBCommand cmd; BlobDBToken token; BlobDBResponse result; } response = { .cmd = BLOB_DB_COMMAND_START_SYNC_RESPONSE, }; BlobDBId db_id; endpoint_private_read_token_db_id(data, &response.token, &db_id); status_t rv = blob_db_sync_db...
/* * 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...
(cb_data->patch, cb_data->size, cb_data->offset, true)
; kernel_free(cb_data); } // Does the flash write / erase on the background task static void prv_update_and_cleanup_struct_async(const void *data, size_t size, size_t offset) { WriteEraseCBData *callback_data = kernel_malloc_check(sizeof(*callback_data) + size); *callback_data = (WriteEraseCBData) { .size = ...
interpolate_int16(distance_normalized, DISP_ROWS_LAST_INDEX, 0)
; // The modal overshoots its destination by a few pixels. When this happens, fill in the pixels // at the bottom of the screen with black. if (new_modal_offset_y < 0) { graphics_fill_rect( ctx, &GRect(0, DISP_ROWS + new_modal_offset_y, DISP_COLS, -new_modal_offset_y)); } gpoint_add_eq(&ctx->dra...
/* * 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...
{ sys_launch_app_for_worker(); }
/* * 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...
(&settings_file)
; } } void comm_session_app_session_capabilities_init(void) { SettingsFile settings_file; if (PASSED(prv_open(&settings_file))) { settings_file_rewrite(&settings_file, prv_rewrite_cb, NULL); settings_file_close(&settings_file); } }
/* * 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 (!list_contains(list, &handler->list_node)) { PBL_LOG(LOG_LEVEL_DEBUG, "Event service handler not subscribed"); return; }
sys_event_service_client_unsubscribe(state, handler); } void event_service_client_handle_event(PebbleEvent *e) { EventServiceInfo *state = prv_get_state(); const uintptr_t type = e->type; // find the first callback ListNode *handler = list_find(&state->list_node, event_service_filter, (void *) type); whil...
sistent_storage_set_ble_pinned_address(const BTDeviceAddress *addr) { shared_prf_storage_set_ble_pinned_address(addr); return true; } bool bt_persistent_storage_has_pinned_ble_pairings(void) { bool requires_address_pinning_out = false; shared_prf_storage_get_ble_pairing_data(NULL, NULL, &requires_address_pinni...
shared_prf_storage_get_ble_pairing_data(&data, name, NULL, NULL)
) { return false; } if (IRK_out) { *IRK_out = data.irk; } if (device_out) { *device_out = data.identity; } if (name_out) { strncpy(name_out, name, BT_DEVICE_NAME_BUFFER_SIZE); name_out[BT_DEVICE_NAME_BUFFER_SIZE - 1] = 0; } return true; } bool bt_persistent_storage_get_ble_pairing...
/* * 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 (SDL_PollEvent(&event)) { switch (event.type) { case SDL_QUIT: keypress = 1; break; case SDL_KEYDOWN: keypress = 1; break; } }
} }
ActivityState *state = activity_private_state(); PBL_LOG(LOG_LEVEL_INFO, "resetting metrics for new day"); mutex_lock_recursive(state->mutex); { SettingsFile *file = activity_private_settings_open(); if (!file) { goto unlock; } ActivitySettingsValueHistory history; ActivityMetricInfo m...
(state->resting_calories, ACTIVITY_CALORIES_PER_KCAL)
; ACTIVITY_LOG_DEBUG("resting kcalories: %"PRIu16"", state->step_data.resting_kcalories); } mutex_unlock_recursive(state->mutex); } // ------------------------------------------------------------------------------------------ // Pushes an HR Median/Filtered/LastStable event. static void...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&health_data)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_sleep_summary_card__render_sleep_late_start_early_end1(void) { const time_t start_of_today = time_util_get_midnight_of(s_now_utc); HealthData health_data = { // Used for text .sleep_data[0] = (8 * SECONDS_PER_HOUR) + (12 *...
HOUT 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 "applib/app_logging.h" #include "applib/app_smartstrap.h" #include "applib/app_smartstrap_private.h" #include "applib/applib_malloc...
{ #if USE_SMARTSTRAP SmartstrapConnectionState *state = app_state_get_smartstrap_state(); state->handlers = (SmartstrapHandlers) {0}; if (!prv_should_subscribe()) { prv_state_deinit(); } #endif }
void app_smartstrap_set_timeout(uint16_t timeout_ms) { #if USE_SMARTSTRAP SmartstrapConnectionState *state = app_state_get_smartstrap_state(); state->timeout_ms = timeout_ms; #endif } SmartstrapAttribute *app_smartstrap_attribute_create(SmartstrapServiceId service_id, ...
l_identifier, event->call_identifier); return; } prv_call_end_common(); phone_ui_handle_call_hide(); analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_END_COUNT, AnalyticsClient_System); } static void prv_handle_call_end(bool disconnected) { if (!disconnected) { analytics_inc(ANALYTICS_DEVICE_METRIC_...
(s_call_identifier, ActionIDPositive)
; // We don't show an ongoing call UI on iOS, so from this service's point of view the call is // now complete. prv_call_end_common(); } else { pp_answer_call(s_call_identifier); } } void phone_call_decline(void) { analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_DECLINE_COUNT, AnalyticsClient_S...
aturday. (47.0 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 169200 * MS_PER_SECOND); do_not_disturb_set_schedule_enabled(WeekendSchedule, false); do_not_disturb_set_schedule_enabled(WeekdaySchedule, true); rtc_set_time(s_saturday_01_30); do_not_disturb_handle_clock_change(); cl_asse...
(enabled == false)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ player->callbacks.did_stop(player, finished, player->context); }
} /////////////////////////////// // Play Animation /////////////////////////////// T_STATIC void prv_play_animation_update(Animation *animation, const AnimationProgress normalized) { KinoPlayer *player = animation_get_context(animation); int32_t animation_elapsed_ms = 0; uint32_t elapsed_ms = 0; uint32_t ki...
RNING, "Resetting I2C bus %s", slave->bus->name); // decrement user count for reset so that if this user is the only user, the // bus will be powered down during the reset slave->bus->state->user_count--; // Reset and reconfigure bus and pins prv_bus_reset(slave->bus); // Restore user count slave->bus-...
PBL_LOG(LOG_LEVEL_ERROR, "I2C Error on bus %s", bus->name)
; } complete = true; result = (bus->state->transfer_event == I2CTransferEvent_TransferComplete); } else if (bus->state->transfer_nack_count < I2C_NACK_COUNT_MAX) { // NACK received after start condition sent: the MFI chip NACKs start conditions whilst it // is busy ...
re in a state where we explicitly do not allow stop mode. // FIXME: This seems overly cautious to me, we shouldn't have to do this. stop_mode_disable(InhibitorMain); // Turn off power to internal flash when in stop mode periph_config_enable(PWR, RCC_APB1Periph_PWR); pwr_flash_power_down_stop_mode(true /* pow...
pulse_init()
; pulse_logging_init(); #endif pebble_task_configure_idle_task(); task_init(); memory_layout_setup_mpu(); board_early_init(); display_show_splash_screen(); kernel_applib_init(); system_task_init(); events_init(); new_timer_service_init(); regular_timer_init(); clock_init(); task_watch...
prv_read_register(uint8_t register_address, uint8_t *result) { return i2c_read_register(I2C_LIS3DH, register_address, result); } // Simple write register command with no error handling static bool prv_write_register(uint8_t register_address, uint8_t value) { return i2c_write_register(I2C_LIS3DH, register_address,...
{ ctrl_reg1 |= LPen; if (prv_write_register(LIS3DH_CTRL_REG1, ctrl_reg1)) { // Write successful, low power mode enabled accel_stop(); return; } }
} PBL_LOG(LOG_LEVEL_ERROR, "Failed to enter low power mode"); } bool accel_running(void) { return (s_running); } bool accel_start(void) { if (!s_initialized) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to start accel, not yet initialized"); return false; } if (s_running) { return true; // Already run...
, .today_low = entry->today_low_temp, .current_weather_type = entry->current_weather_type, .tomorrow_high = entry->tomorrow_high_temp, .tomorrow_low = entry->tomorrow_low_temp, .tomorrow_weather_type = entry->tomorrow_weather_type, .time_updated_utc = entry->last_update_time_utc, }; // add ...
{ task_free(forecast_out); }
free_entry: task_free(entry); cleanup: mutex_unlock(s_mutex); } WeatherLocationForecast *weather_service_create_default_forecast(void) { mutex_lock(s_mutex); WeatherLocationForecast *forecast = NULL; if (s_default_forecast) { forecast = task_zalloc_check(sizeof(WeatherLocationForecast)); *forecast ...
equest(const void *payload, uint32_t length) { // echo it back prv_send_frame(OPCODE_PING, payload, length); } static void prv_handle_disconnect_request(const void *payload, uint32_t length) { if (length) { // should be 0 PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length); return; } ...
(OPCODE_FLASH_ERASE, &response, sizeof(response))
; // start the erase after sending the response if (start_erase) { uint32_t end_address = request->address + request->length; s_flash_erase_in_progress = true; flash_erase_optimal_range( request->address, request->address, end_address, (end_address + SECTOR_SIZE_BYTES - 1) & SECTOR_ADDR...
nst char *mute_label = i18n_noop("Mute %s"); static char mute_label_buf[32]; snprintf(mute_label_buf, sizeof(mute_label_buf), i18n_get(mute_label, root_level), display_name); const uint8_t mute_option = ancs_filtering_get_mute_type(notif_prefs); const bool is_mute_weekdays = mute_option == ...
{ analytics_inc(ANALYTICS_DEVICE_METRIC_NOTIFICATION_CLOSED_COUNT, AnalyticsClient_System); }
/* * 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...
{ *out_ms = t_ms; }
if (tloc) { *tloc = legacy_time; } return (t_ms); } extern size_t localized_strftime(char* s, size_t maxsize, const char* format, const struct tm* tim_p, const char *locale); struct tm *pbl_override_gmtime(const time_t *timep) { struct tm *gmtime_tm = NULL; if (pebble_task_get_current() == Pebb...
/* * 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...
(manager->idle_timers, &timer->list_node)
; mutex_unlock(manager->mutex); return timer->id; } // -------------------------------------------------------------------------------- // Schedule a timer to run. bool task_timer_start(TaskTimerManager *manager, TaskTimerID timer_id, uint32_t timeout_ms, TaskTimerCallback cb, void *cb_data...
>run_size); data->record.entries[data->record.num_entries++] = data->prev_sample; data->run_size = 1; data->prev_sample = encoded; } } // Save to data logging if the record is full now if (finish || data->record.num_entries >= ACTIVITY_RAW_SAMPLES_MAX_ENTRIES) { // Decr...
activity_private_compute_active_calories(distance_mm, rate_elapsed_ms)
; } } mutex_unlock_recursive(s_activity_state.mutex); if (s_activity_state.step_data.steps != prev_steps) { // Post a steps changed event PebbleEvent e = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event = { .type = HealthEventMovementUpdate, .data.movement_update = { ...
= prv_find_node_with_install_id(install_id, source); if (node == NULL) { return false; } prv_unload_node(source, node); return true; } //////////////////// // public interface void app_menu_data_source_init(AppMenuDataSource *source, const AppMenuDataSourceCallbacks *callba...
{ AppMenuNode *node = app_menu_data_source_get_node_at_index(source, cell_index->row); // Will return an icon or NULL depending on if icons are enabled. GBitmap *bitmap = app_menu_data_source_get_node_icon(source, node); const GCompOp op = (gbitmap_get_format(bitmap) == GBitmapFormat1Bit) ? GCompOpTint : GCompO...
e); cl_assert_equal_i(r->state, RecognizerState_Failed); cl_assert_equal_i(event_type, -1); // Test that invalid state transitions get caught by asserts cl_assert_passert(recognizer_transition_state(r, RecognizerState_Completed)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Started)); ...
cl_assert(failed)
; // Failed -> Failed invalid transition cl_assert_passert(recognizer_set_failed(r)); // (!Possible) -> Failed invalid transition r->state = RecognizerState_Started; cl_assert_passert(recognizer_set_failed(r)); r->state = RecognizerState_Completed; cl_assert_passert(recognizer_set_failed(r)); } static...
ss addr; SM128BitKey key; char classic_name[BT_DEVICE_NAME_BUFFER_SIZE]; uint8_t platform_bits; if (bt_persistent_storage_get_bt_classic_pairing_by_id( id, &addr, &key, classic_name, &platform_bits)) { shared_prf_storage_store_bt_classic_pairing_data( &addr, classic_name, &ke...
if (rv != S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to update gap bonding db, rv = %"PRId32, rv); return GapBondingFileSetFail; }
return (do_perform_update ? GapBondingFileSetUpdated : GapBondingFileSetNoUpdateNeeded); } //! Returns true if things were successful static bool prv_file_each(SettingsFileEachCallback itr_cb, void *itr_data) { status_t rv; prv_lock(); { SettingsFile fd; rv = settings_file_open(&fd, BT_PERSISTENT_STO...
_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); // -----------------------------------------------------------------------...
(start_ms + 500)
re_size); // test removing all and more bytes prv_cleanup(); to_free = SIZE_SUM + 1; before_size = app_cache_get_size(); cl_assert(before_size < to_free); cl_assert_equal_i(S_SUCCESS, app_cache_free_up_space(to_free)); fake_system_task_callbacks_invoke_pending(); after_size = app_cache_get_size(); cl...
pfs_close(fd)
; } void test_app_cache__purge_orphaned_files(void) { // create some 'standard' files for (uint32_t i = 0; i < ARRAY_LENGTH(descriptions); ++i) { prv_file_create(descriptions[i].name, descriptions[i].size); } // create some app and res files and list them in the app cache for (uint32_t i = 0; i < 15; ++i...
check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_across_x_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_across_nx_o...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 2); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // AA = true, SW = 3 setup_t...
* 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 govern...
prv_get_watchface_compositor_animation(CompositorTransitionDirectionRight)
; goto done; } else if (next_app_id == APP_ID_HEALTH_APP) { res = prv_get_health_compositor_animation(CompositorTransitionDirectionUp); goto done; } } else if ((current_app_id == APP_ID_HEALTH_APP) && app_install_get_entry_for_install_id(next_app_id, app_entry) && ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
heap_malloc(task_heap_get_for_current_task(), bytes, client_pc)
; } #endif void *task_malloc(size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_malloc(task_heap_get_for_current_task(), bytes, saved_lr); } void *task_malloc_check(size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; Heap *heap = task_heap_get...
le_hrm_is_inited) { return; } if (s_ble_hrm_subscription_count == 0) { return; } PBL_ASSERTN(e->type == PEBBLE_HRM_EVENT); const PebbleHRMEvent *const hrm_event = &e->hrm; if (hrm_event->event_type != HRMEvent_BPM) { return; } const BleHrmServiceMeasurement measurement = { .bpm = hrm_eve...
{ return; }
if (is_sharing) { if (s_ble_hrm_subscription_count == 0) { prv_reschedule_popup_timer(); prv_execute_on_kernel_main(prv_start_hrm_kernel_main); } ++s_ble_hrm_subscription_count; } else { --s_ble_hrm_subscription_count; if (s_ble_hrm_subscription_count == 0) { prv_stop_popup_t...
pin_attr_list)); const int num_actions = 2 + num_responses; TimelineItemActionGroup action_group = { .num_actions = num_actions, // Malloc the actions in order to save stack space .actions = kernel_zalloc_check(sizeof(TimelineItemActi...
("BELOW AVG")
, i18n_noop("Below avg")), .bg_color = GColorOrangeARGB8, .card_icon = TIMELINE_RESOURCE_ARROW_DOWN, }, [PercentTier_BelowAverage] = { .avg_relation = PBL_IF_RECT_ELSE(i18n_noop("BELOW AVG"), i18n_noop("Below avg")), .bg_color = GColorOrangeARGB8, .card_icon = TIMELINE_RESOURCE_ARR...
Allocate immutable types bool success = false; const char *sentence = NIHAO_JOINED NIHAO NIHAOMA_JOINED NIHAO_JOINED NIHAO_JOINED; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, sentence); cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, ...
(line_add_words(&line, &word_iter, NULL))
; cl_assert(line.height_px == 10); cl_assert(line.width_px == HORIZ_ADVANCE_PX * 3); cl_assert(line.origin.x == 0); cl_assert(line.origin.y == 0); cl_assert(line.suffix_codepoint == 0); cl_assert(*line.start == 'F'); // b cl_assert(*word_iter_state.current.start == 'b'); cl_assert(*word_iter_state.cu...
}, { -584, 208, 240}, { -648, 224, 200}, { -704, 216, 272}, { -1024, 536, 240}, { -984, 64, 40}, { -1304, 304, -96}, { -1456, -40, 32}, { -1312, 280, -120}, { -1112, 264, -104}, { -864, 144, -136}, { -592, 224, -152}, { -456, 288, -72}, { -408, 280, -64}, { -440, ...
{ -480, 216, 168}, { -552, 232, 144}, { -640, 224, 128}, { -832, 328, 128}, { -1200, 248, 232}, { -1248, 200, -16}, { -1512, 464, 208}, { -1136, 272, 8}, { -816, 392, -96}, // 47 seconds { -1024, 496, -184}, { -808, 352, -24}, { -560, 336, -112}, { -392, 392, -80}...
{ -384, 352, -128}, { -280, 432, -104}, { -360, 400, -64}, { -576, 536, -56}, { -712, 384, 0}, { -896, 424, -40}, { -1088, 512, -24}, { -1216, 480, 64}, { -1536, 704, -64}, { -1296, 504, -40}, { -1056, 440, 40}, { -1192, 384, 32}, { -984, 232, 136}, { -760, 192, ...
void *data) { callback(data); } void accessory_imaging_enable(bool enable) { } // Tests /////////////////////////////////////////////////////////////////////////////// static GettingStartedButtonComboState s_state; static bool s_select_cb_called; static void prv_select_c...
(timer->id)
; cl_assert(s_mfg_mode_entered); cl_assert(!s_factory_reset_called); }
/* * 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...
assert_float_parse("42", 3, true, 42 * 3)
; } void test_ams_util__float_string_parse_separator_but_no_fraction(void) { // "21." * 3 assert_float_parse("21.", 3, true, 21 * 3); } void test_ams_util__float_string_parse_comma_decimal_separator(void) { // "1.23456" * 3 is approx 3.7036800000000003, round up to 4 assert_float_parse("1,23456", 3, true, 4);...
etup_test(&context, true, SW_ODD, GColorBlack, GColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); #if PBL_COLOR ASSERT_CALLED(prv_draw_round_rect_aa_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_ODD)); #else ASSERT_CALLED(prv_draw_round_rect_stroked(&context, &GRect(20, 80, 40, ...
graphics_fill_circle(&context, GPoint(50, 50), 10)
); ASSERT_NO_CHANGE(graphics_fill_round_rect(&context, &GRect(20, 80, 40, 10), 4, GCornersAll)); setup_test(&context, true, 1, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ...
const ElfExternalNote *build_id, uint32_t timestamp) { CoreDumpImageHeader hdr = { .magic = CORE_DUMP_MAGIC, .core_number = core_number, .version = CORE_DUMP_VERSION, .time_stamp = timestamp, }; strncpy((char *)hdr.serial_number, mfg_get_serial_number(), sizeof(hdr.serial_number))...
boot_bit_clear(BOOT_BIT_NEW_FW_AVAILABLE)
; boot_bit_clear(BOOT_BIT_NEW_SYSTEM_RESOURCES_AVAILABLE); } // Normally a reboot reason would be set before initiating a core dump. In // case this isn't true, set a default reason so that we know the reboot was // because of a core dump. RebootReason reason; reboot_reason_get(&reason); if (reason.c...
alled, false); cl_assert_equal_b(s_comm_session_event_put, false); } void test_session__last_system_session_wins(void) { Transport *system_transport = (Transport *) TransportID1; CommSession *system_session = comm_session_open(system_transport, &s_transport_imp, ...
cl_assert_equal_i(fake_system_task_count_callbacks(), 1)
; comm_session_send_next(session); cl_assert_equal_i(fake_system_task_count_callbacks(), 1); comm_session_send_next(session); cl_assert_equal_i(fake_system_task_count_callbacks(), 1); cl_assert_equal_i(s_send_next_count, 0); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_i(fake_system_task_...
n 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 I...
{ for (unsigned int i = 0; i < ARRAY_LENGTH(s_receive_buffers); ++i) { s_receive_buffers[i] = kernel_malloc_check(sizeof(IncomingPulseFrame)); prv_return_receive_buffer(s_receive_buffers[i]); } s_current_receive_buffer = prv_take_receive_buffer(); s_drop_rest_of_frame = false; s_keepalive_timer = new...
void pulse_end(void) { prv_handlers_notify_state_changed(PulseLinkState_Closed); pulse_llc_send_link_closed_msg(); for (unsigned int i = 0; i < ARRAY_LENGTH(s_receive_buffers); ++i) { kernel_free(s_receive_buffers[i]); } s_current_receive_buffer = NULL; new_timer_delete(s_keepalive_timer); s_keepal...
Tok: %"PRIu32", type: %d", token, o->type); switch (o->type) { case ObjectFirmware: case ObjectSysResources: prv_finish_fw_update_if_completed(); break; case ObjectRecovery: boot_bit_set(BOOT_BIT_NEW_PRF_AVAILABLE); // >>> Fall-through! <<< default: break; } o->token = 0; s_pb_sta...
strlen(request->filename)
+ 1); strcpy(storage_info->filename, request->filename); break; } case ObjectWatchApp: case ObjectWatchWorker: { PebbleTask task = (request->type == ObjectWatchApp) ? PebbleTask_App : PebbleTask_Worker; char filename[APP_FILENAME_MAX_LENGTH + 1]; app_storage_get_file_name(file...
P_LE_Current_Connection_Parameters_t *params) { } void gap_le_connect_handle_bonding_change(BTBondingID bonding_id, BtPersistBondingOp op) { } void gap_le_connection_handle_bonding_change(BTBondingID bonding, BtPersistBondingOp op) { } void gap_le_device_name_request(uintptr_t stack_id, GAPLEConnection *connection) ...
(bt_persistent_storage_get_ble_pinned_address(NULL), false)
; } void test_bluetooth_persistent_storage__ble_store_and_get(void) { bool ret; // Output variables SMIdentityResolvingKey irk_out; BTDeviceInternal device_out; // Store a new pairing SMPairingInfo pairing_1; memset(&pairing_1, 0x00, sizeof(pairing_1)); pairing_1 = (SMPairingInfo) { .irk = (SMIde...
/* * 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...
(system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL))
; cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_16KB_sectors(void) { cl_assert(system_flash_erase(FLASH_BASE, 48 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 2), erased_sector); cl_assert(flash_locked); } void callback_is_called_cb(uin...
/* * 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...
(config.units, 1)
; cl_assert_equal_i(config.sign, RTC_CalibSign_Positive); } void test_rtc_calibration__slightly_fast_but_not_enough_to_calibrate(void) { // Approximately +1.01ppm RTCCalibConfig config = rtc_calibration_get_config(32768033, TARGET_FREQUENCY_mHZ); cl_assert_equal_i(config.units, 0); } void test_rtc_calibration...
e to close fds that are not open int rv = pfs_close(-1); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_close(0); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_close(1000000); cl_assert(rv == E_INVALID_ARGUMENT); int fd = pfs_open("file", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); rv = ...
{ pfs_format(false /* write erase headers */); // start with an empty flash pfs_init(false); char name[128]; snprintf(name, sizeof(name), "bigfile"); //Fill up entire memory section, subtract 32768 for header space. int fd = pfs_open(name, OP_FLAG_WRITE, FILE_TYPE_STATIC, pfs_get_size() - (num_pages()*128...
void test_pfs__active_regions(void) { pfs_format(false); cl_assert(!pfs_active_in_region(0, pfs_get_size())); // erase every page and make sure pfs is active pfs_format(true); cl_assert(pfs_active_in_region(0, pfs_get_size())); // write something on every page and make sure pfs is active char file_nam...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
GPoint(frame.origin.x + DIV_X(frame.size.w / 2 * MULT_X((cur - limit_e), (total - limit_e))), frame.origin.y)
e space needed will be removed. //! //! It is assumed that there will ALWAYS be space for a single application of maximum size based //! on the platform. The only time when this isn't true is the time between "add_entry" and the //! callback to clean up the cache. #define APP_CACHE_FILE_NAME "appcache" //! each cache...
(LOG_LEVEL_WARNING, "Invalid cache entry with key_len: %u and val_len: %u, flushing", info->key_len, info->val_len)
; system_task_add_callback(prv_delete_cache_callback, NULL); return false; // stop iterating, delete the file and binaries } EachEvictData *data = (EachEvictData *)context; AppInstallId id; AppCacheEntry entry; info->get_key(file, (uint8_t *)&id, info->key_len); info->get_val(file, (uint8_t *)&en...
/* * 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 (n--) { *dest++ = *src++; }
} else { while (n--) { dest[n] = src[n]; } } return s1; }
have code // in one of a few small ranges, a pointer can be packed into much fewer // than 28 bits while still being able to address a function anywhere in // memory that exists. // // For reference, those ranges are: // 0x0000 0000 - 0x0001 FFFF - Internal Flash, remapped at 0x0 // 0x0800 0000 - 0x0801 FFFF - Int...
MAX(delta_ms, 0)
+ rate_control_delay_ms; if (animation_legacy2_scheduler->timer_handle != NULL) { app_timer_reschedule(animation_legacy2_scheduler->timer_handle, interval_ms); // Ignore the return value of reschedule. If it fails it probably means the callback is already // fired and we're waiting for the handler to be...
h_resource(RESOURCE_ID_ACTION_BAR_ICON_STOP); active_window->action_bar_more = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_MORE); active_window->action_bar_next = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_TOGGLE); prv_set_pause_button(active_window); prv_set_action_bar_i...
{ if (hrm_is_available) { WorkoutMetricType scrollable_metrics[] = {WorkoutMetricType_Duration}; return workout_active_create_double_layout(WorkoutMetricType_Hr, ARRAY_LENGTH(scrollable_metrics), ...
case ActivitySessionType_Walk: { if (hrm_is_available) { WorkoutMetricType top_metric = WorkoutMetricType_Hr; WorkoutMetricType scrollable_metrics[] = {WorkoutMetricType_Duration, WorkoutMetricType_Distance, ...
static void prv_noop_sample_handler(void *context) { } static void prv_validate_sample_rates(int *arr, int num_samples) { for (int i = 0; i < num_samples; i++) { // force a compiler error if user has not added all possible sample rates to array switch ((AccelSamplingRate)arr[i]) { case ACCEL_SAMPLING...
(samples_per_update, ARRAY_LENGTH(fake_buf))
; } void test_accel_manager__batched_samples(void) { AccelRawData fake_buf[30]; stub_pebble_tasks_set_current(PebbleTask_KernelMain); AccelManagerState *main_session = sys_accel_manager_data_subscribe( ACCEL_SAMPLING_10HZ, prv_noop_sample_handler, NULL, PebbleTask_KernelMain); sys_accel_manager_set_sam...
jected"; break; case AnalyticsEvent_VoiceTranscriptionAutomaticallyAccepted: msg = "Automatically accepted"; break; default: break; } ANALYTICS_LOG_DEBUG("voice response %s event: size: %"PRIu16"; length (chars): %"PRIu16 "; length (ms): %"PRIu32"; Errors: %"PRIu8"; Sessio...
uuid_to_string(optional_app_uuid, uuid_str)
; ANALYTICS_LOG_DEBUG("Session close event. is_system_session=%u, uuid=%s, " "reason=%u, duration_mins=%"PRIu16, is_system_session, uuid_str, reason, session_duration_mins); #endif analytics_logging_log_event(&event_blob); } // ------------------------------------------...
/* * 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_corner_shape)
)? s_current_flush_line : DISP_ROWS - s_current_flush_line - 1; uint8_t corner_width = s_corner_shape[corner_idx]; for (uint8_t pixel = 0; pixel < corner_width; ++pixel) { bitset8_clear(s_line_buffer, pixel); bitset8_clear(s_line_buffer, DISP_COLS - pixel - 1); } row->dat...
tx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_inside_offset_layer"))); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_P...
gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_origin_even_rows_no_clip"))
// Find and assign bonding_id even if there is no intent. // https://pebbletechnology.atlassian.net/browse/PBL-20972 connection->bonding_id = intent->bonding->id; } prv_update_clients(intent, HciStatusCode_Success, GAPLEConnectionEventConnected...
prv_mutate_whitelist_safely(&event->peer_address, true /* add */)
; } if (intent->is_bonding_based) { // Clear out connection address (more for debugging than any else): intent->device = (const BTDeviceInternal) {}; } } } intent = next; } gap_le_connection_remove(&event->peer_addre...
target); return (distance_a > distance_b ? 1 : -1); } GPointIndexLookup *gdraw_command_list_create_index_lookup_by_distance(GDrawCommandList *list, GPoint target) { return gdraw_command_list_create_index_lookup(list, prv_distance_comparator, &ta...
gpoint_sub_eq(&point, gvalues->offset)
p(void) { free(fb); } // Tests //////////////////////////////////// void test_kino_reel__resource_gbitmap(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Test loading GBitmap Kino Reel uint32_t resource_id = sys_resource_load_file_as_resource( TEST_IMAGES_PATH, "test_kino_reel__resourc...
( gdraw_command_sequence_get_frame_by_elapsed( kino_reel_get_gdraw_command_sequence(kino_reel), 100))
; cl_assert(list2 != NULL); cl_assert(list2 != list1); cl_assert(list2 == list2_direct); } static KinoReelProcessor s_dummy_processor; static void prv_dummy_impl_draw_processed(KinoReel *reel, GContext *ctx, GPoint offset, KinoReelProcessor *processor) { cl_assert_equ...
tions under the License. */ #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "kernel/pebble_tasks.h" #include "mcu/interrupts.h" #include "services/normal/accessory/smartstrap_profiles.h" #include "services/normal/accessory/smartstrap_state.h" #include "syscall/syscall.h" #include "syscall/syscall_i...
{ return i; }
void gpath_draw_filled(GContext* ctx, GPath *path) {} void graphics_draw_circle(GContext* ctx, GPoint p, uint16_t radius) {} void graphics_fill_circle(GContext* ctx, GPoint p, uint16_t radius) {} void graphics_context_move_draw_box(GContext* ctx, GPoint offset) {} void graphics_line_draw_precise_stroked(GContext* ctx, ...
gdraw_command_sequence_validate(sequence, size)
); sequence->num_frames = 2; sequence->version = 0xFF; cl_assert(!gdraw_command_sequence_validate(sequence, size)); free(sequence); } void test_gdraw_command_sequence__get_frame_by_elapsed(void) { GDrawCommandSequence *sequence; prv_create_test_sequence(&sequence); GDrawCommandFrame *frame = gdraw_com...
/* * 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...
{ fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); }
// Teardown void test_graphics_draw_rect_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } //////////////////////////////////// static void inside_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_rect(ctx, &GRect(4, 2, 16, 8)); } static void wh...
cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); // Simulate getting one service indication... fake_gatt_put_discovery_indication_blood_pressure_service(TEST_GATT_CONNECTION_ID); // ... then a failure: fake_gatt_put_discovery_complete_event(GATT_SERVICE_DISCOVERY_STATUS_RESPONSE_TIMEO...
cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK)
; // Make Bluetopia's GATT_Start_Service_Discovery fail: // (Disconnected in the mean time, ...) fake_gatt_set_start_return_value(BTGATT_ERROR_INVALID_PARAMETER); // Fire the watchdog timer: const TimerID watchdog_timer = bt_driver_gatt_get_watchdog_timer_id(); stub_new_timer_fire(watchdog_timer); // S...
format(upng); uint8_t *upng_buffer = (uint8_t*)upng_get_buffer(upng); // Byte aligned rows for image at bpp uint16_t row_stride_bytes = (fctl.width * bpp + 7) / 8; if (png_format >= UPNG_INDEXED1 && png_format <= UPNG_INDEXED8) { const GColor8 *palette = png_decoder_data->palette; for (uint32_t y = ...
{ retval = true; }
} return retval; } // Helper functions int32_t gbitmap_sequence_get_current_frame_idx(GBitmapSequence *bitmap_sequence) { if (bitmap_sequence) { return bitmap_sequence->current_frame; } return -1; } uint32_t gbitmap_sequence_get_current_frame_delay_ms(GBitmapSequence *bitmap_sequence) { if (bitmap_s...
t_rocky_api_util__eval_no_error(void) { s_log_internal__expected = (const char *[]){ NULL }; prv_do_eval("1+1;"); cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_util__eval_throw_string(void) { s_log_internal__expected = (const char *[]){ "Unhandled exception", " "ERROR_STRING, ...
jerry_get_object_field(now, "getHours")
/* * 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...
(out_buffer, (uint8_t*) "a", 1)
== 0); cl_assert(shared_circular_buffer_consume(&buffer, &client, 1)); // Consume one without reading it cl_assert(shared_circular_buffer_consume(&buffer, &client, 1)); // Read the last little bit cl_assert(shared_circular_buffer_read(&buffer, &client, 1, &out_buffer, &out_length)); cl_assert_equal_i(out...
(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 4); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT)...
(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT)
//! This way the time-outs can be crammed into 2 bits per packet. static uint8_t s_timer_ticks; static uint8_t s_disconnect_counter; // ------------------------------------------------------------------------------------------------- // Function Prototypes static void prv_send_next_packets(PPoGATTClient *client); st...
{ return ((PPOGATT_SN_MOD_DIV + sn - 1) % PPOGATT_SN_MOD_DIV); }
// ------------------------------------------------------------------------------------------------- static uint16_t prv_get_payload_size_for_sn(const PPoGATTClient *client, uint32_t sn) { return client->out.payload_sizes[sn]; } static bool prv_is_packet_with_sn_awaiting_ack(const PPoGATTClient *client, uint32_t ...
ogle LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * ...
{ connection = gap_le_connection_by_addr(&event->dev_address); BLE_LOG_DEBUG("GATT Server Indication for handle %u " BT_DEVICE_ADDRESS_FMT, event->attr_handle, BT_DEVICE_ADDRESS_XPLODE(event->dev_address)); // We are done if we got disconnected in the meantime or if thi...
bt_unlock(); if (done) { return; } gatt_client_subscriptions_handle_server_notification( connection, event->attr_handle, event->attr_val, event->attr_val_len); } void bt_driver_cb_gatt_handle_buffer_empty(const GattDeviceBufferEmptyEvent *event) { bt_lock(); { const GAPLEConnection *connec...
/* * 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...
(SETTINGS_MENU_HIGHLIGHT_COLOR, GColorBlack)
, GColorWhite); menu_layer_set_click_config_onto_window(menu_layer, &data->window); layer_add_child(&data->window.layer, menu_layer_get_layer(menu_layer)); } static void prv_window_unload(Window *window) { SettingsAppData *data = window_get_user_data(window); menu_layer_deini...
{ 1088, -40, -344}, { 1064, -16, -304}, { 1632, -16, -384}, { 1336, 24, -312}, { 912, 24, -184}, { 1104, 80, -232}, { 1432, 96, -120}, { 1328, 64, -40}, { 1128, 96, -80}, { 1040, 128, -88}, { 1032, 160, -40}, { 984, 264, -88}, { 904, 248, -96}, { 880, 320, -80}, ...
{ 488, 816, -104}, { 480, 704, -128}, { 480, 576, -104}, { 480, 544, -88}, { 480, 408, -72}, { 544, 424, -48}, { 792, 464, -104}, { 800, 312, -88}, { 912, 192, -80}, { 984, 48, 96}, { 1496, 24, 104}, { 1432, 152, -96}, { 1440, 144, -264}, { 1456, 112, -336}, ...
lk); power_tracking_stop(PowerSystemMcuSpi2); } static void prv_enable_chip_select(void) { gpio_output_set(&BOARD_CONFIG_DISPLAY.cs, true); // setup time > 3us // this produces a setup time of ~7us for (volatile int i = 0; i < 32; i++); } static void prv_disable_chip_select(void) { // delay while last byt...
PBL_ASSERTN(uccb != NULL)
; stop_mode_disable(InhibitorDisplay); xSemaphoreTake(s_dma_update_in_progress_semaphore, portMAX_DELAY); analytics_stopwatch_start(ANALYTICS_APP_METRIC_DISPLAY_WRITE_TIME, AnalyticsClient_App); analytics_inc(ANALYTICS_DEVICE_METRIC_DISPLAY_UPDATES_PER_HOUR, AnalyticsClient_System); prv_enable_display_spi_cl...
/* * 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...
for(int i = -128; i < 256;) { \ int them = CHK##_theirs(i); \ int us = CHK(i++); \ cl_assert_equal_b(them, us); \ }
void test_ctype__isalpha(void) { ISCTYPE_TEST(isalpha) } void test_ctype__isupper(void) { ISCTYPE_TEST(isupper) } void test_ctype__islower(void) { ISCTYPE_TEST(islower) } void test_ctype__isdigit(void) { ISCTYPE_TEST(isdigit) } void test_ctype__isxdigit(void) { ISCTYPE_TEST(isxdigit) } void test_ctype__isspace(void) ...
ched_reminder_app_prefs; } s_watch_app_prefs_db; #define SETTINGS_FILE_NAME "watch_app_prefs" #define SETTINGS_FILE_SIZE KiBYTES(20) T_STATIC const char *PREF_KEY_SEND_TEXT_APP = "sendTextApp"; // Settings helpers //////////////////////////////////////////////////////////////////////////////// static status_t prv_l...
(key, key_len, PREF_KEY_REMINDER_APP)
; if (!is_valid_send_text_key && !is_valid_weather_key && !is_valid_reminder_key) { PBL_LOG(LOG_LEVEL_ERROR, "Error inserting app_prefs: invalid key"); return E_INVALID_ARGUMENT; } if (is_valid_send_text_key && !prv_validate_received_pref(val_len, sizeof(SerializedSendTextPrefs), ...
uetooth/bluetooth_types.h> #include <bluetooth/pebble_bt.h> #include <bluetooth/pebble_pairing_service.h> #include <util/attributes.h> #include <util/math.h> #include <util/size.h> #include <util/uuid.h> // Dialog SDK #include "ble_gap.h" #include "ble_gatt.h" #include "ble_gattc.h" #include "ble_gatts.h" #include "b...
{ // We're accessing data that's stored in Connection and we're not having extra locks, make sure // we only access from a single task (ble_task): ble_task_assert_is_executing_on_ble_task(); PPoGATTWorkAroundState *state = connection_get_ppogatt_wa_state(conn); if (!state) { state = (PPoGATTWorkAroundSta...
void ppogatt_destroy_state(PPoGATTWorkAroundState *state) { if (state->pending_response_data) { kernel_free(state->pending_response_data); } kernel_free(state); } static bool prv_is_emulated_server_wa_requested(uint16_t conn_idx) { bool enabled = false; storage_acquire(); device_t *dev = find_device_...
SerializedSendTextContact) { .is_fav = (i < (NUM_SEND_TEXT_CONTACTS/2)), }; uuid_generate(&prefs->contacts[i].contact_uuid); uuid_generate(&prefs->contacts[i].address_uuid); } SerializedWeatherAppPrefs *weather_prefs = (SerializedWeatherAppPrefs *)s_weather_prefs; weather_prefs->num_locations =...
watch_app_prefs_db_flush()
, S_SUCCESS); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_i(watch_app_prefs_db_get_len(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN), 0); } void test_watch_app_prefs_db__get_send_text(void) { const int data_len = sizeof(s_send_text_prefs); cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_T...
ow_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 = prv_handle_weather, }; event_se...
i18n_free_all(data)
; } static void prv_main(void) { prv_init(); app_event_loop(); prv_deinit(); } const PebbleProcessMd* weather_app_get_info() { const bool is_visible_in_launcher = weather_service_supported_by_phone(); static const PebbleProcessMdSystem s_weather_app_info = { .common = { .main_func = prv_main, ...
/* * 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...
grect_clip(area_out, &display_frame)
; } //! Currently, the unobstructed area is derived from the origin of the obstruction. //! This is equivalent to the height of the unobstructed area. static void prv_origin_y_to_area(int16_t origin_y, GRect *area_out) { PBL_ASSERTN(area_out); *area_out = (GRect) { .size = { DISP_COLS, origin_y }, }; prv_c...
ense. */ #include "debug/power_tracking.h" #include "drivers/mcu.h" #include "drivers/rtc.h" #include "drivers/task_watchdog.h" #include "kernel/memory_layout.h" #include "kernel/pbl_malloc.h" #include "os/tick.h" #include "kernel/util/stop.h" #include "kernel/util/wfi.h" #include "process_management/worker_manager....
power_tracking_stop(PowerSystemMcuCoreSleep)
; uint32_t systick_stop = SysTick->VAL; uint32_t cycles_elapsed; if (systick_stop < systick_start) { cycles_elapsed = systick_start - systick_stop; } else { cycles_elapsed = (SysTick->LOAD - systick_stop) + systick_start; } s_analytics_device_sleep_cpu_cycles += cyc...
/* * 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...
grect_clip(&rect, &dest_bitmap->bounds)
; grect_clip(&rect, &ctx->draw_state.clip_box); // Bail out early if the clipped drawing rectangle is empty if (grect_is_empty(&rect)) { goto call_processor_post_function_and_return; } // Calculate the offset of src_bitmap to use const GPoint src_offset = gpoint_sub(rect.origin, unclipped_origin); /...
g->ratio, 1); prv_set_mon_config_register(0); prv_mon_config_unlock(); return (uint16_t)millivolts; } bool pmic_set_charger_state(bool enable) { // Defaults to ON // LSB is enable bit uint8_t register_value; if (!prv_read_register(PmicRegisters_CHG_CNTL_A, &register_value)) { return false; } if...
(LOG_LEVEL_DEBUG, "Found the max14690")
static const TimeSelectionSizeConfig *s_time_selection_configs[NumPreferredContentSizes] = { [PreferredContentSizeSmall] = &s_time_selection_config_medium, [PreferredContentSizeMedium] = &s_time_selection_config_medium, [PreferredContentSizeLarge] = &s_time_selection_config_large, [PreferredContentSizeExtraLa...
GRect(left_offset, from_top_offset, width, selection_layer_default_cell_height())
; selection_layer_init(from_selection_layer, &frame, num_cells); for (int i = 0; i < num_cells; i++) { selection_layer_set_cell_width(from_selection_layer, i, cell_width); } selection_layer_set_cell_padding(from_selection_layer, padding); selection_layer_set_active_bg_color(from_selection_layer, color); ...
s // 12pm EST. Let's start out in this time zone then switch back to PST right before we fall // asleep. This replicates the conditions that resulted in PBL-24823 TimezoneInfo tz_info = { .tm_zone = "EST", .tm_gmtoff = -5 * SECONDS_PER_HOUR, }; time_util_update_timezone(&tz_info); // Start activity...
prv_feed_cannned_accel_data(10 * SECONDS_PER_MINUTE, 100, ActivitySleepStateAwake)
; // Wait long enough until we start the next day (15 hours) prv_feed_cannned_accel_data(SECONDS_PER_HOUR * 15, 0, ActivitySleepStateAwake); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricStepCount, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, 1000, 0, 0, 0,...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
dialog_spi_assert_chip_select(false)