prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
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())); if (s_from_app) { s_app_uuid = app_manager_get_curr...
PBL_LOG(LOG_LEVEL_WARNING, "Error occurred setting up session: %d", result)
; prv_send_event(VoiceEventTypeSessionSetup, status, NULL); goto done; } if (app_initiated != s_from_app) { prv_cancel_session(); if (app_initiated) { PBL_LOG(LOG_LEVEL_WARNING, "Received session setup result for app initiated session when it " "was not expected"); } else { ...
TEST_PAYLOAD, sizeof(TEST_PAYLOAD)); prv_process_send_queue(s_app_session_ptr); assert_not_consumed(); prv_process_send_queue(s_system_session_ptr); assert_consumed(AppMessageSenderErrorSuccess, 1); app_free(outbox_data); } void test_app_message_sender__system_session...
(s_app_session_ptr, o, length_to_copy, bytes_out)
); cl_assert_equal_i(0, memcmp(bytes_out, TEST_EXPECTED_PP_MSG + o + c, length_to_copy)); } comm_session_send_queue_consume(s_app_session_ptr, 1 /* length */); } assert_consumed(AppMessageSenderErrorSuccess, 1); cl_assert_equal_i(s_app_install_timestamp_update_count, 1); app_free(outbox_data); }...
ed 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 and * limitations under the License. */ #include <string.h> #include <inttypes...
{ analytics_add_for_uuid(metric, amount, analytics_uuid_for_client(client)); }
/////////////////// // Stopwatches static bool prv_is_stopwatch_for_metric(ListNode *found_node, void *data) { AnalyticsStopwatchNode* stopwatch_node = (AnalyticsStopwatchNode*)found_node; return stopwatch_node->metric == (AnalyticsMetric)data; } AnalyticsStopwatchNode *prv_find_stopwatch(AnalyticsMetric metric) ...
mutex_unlock_recursive(state->mutex); } // ------------------------------------------------------------------------------------------ // Pushes an HR Median/Filtered/LastStable event. static void prv_push_median_hr_event(uint8_t median_hr) { if (median_hr > 0) { PebbleEvent event = { .type = PEBBLE_HEALT...
{ state->hr.metrics.current_hr_zone++; }
g) { .primary_label = "LABEL1", .primary_value = "value1", .secondary_label = "LABEL2", .secondary_value = "value2", .fill_color = GColorWhite, #if PBL_BW .outline_color = GColorBlack, #endif }, .bg_color = BG_COLOR, }; prv_create_card_and_render(&config); cl_check(gbi...
{ HealthDetailZone zones[] = DEFAULT_ZONES; zones[1].show_crown = true; HealthDetailCardConfig config = { .num_headings = 1, .headings = &(HealthDetailHeading) { .primary_label = "LABEL1", .primary_value = "value1", .fill_color = GColorWhite, #if PBL_BW .outline_color = GColorBlac...
void test_health_detail_card__render_zone_hide_typical(void) { HealthDetailCardConfig config = { .num_headings = 1, .headings = &(HealthDetailHeading) { .primary_label = "LABEL1", .primary_value = "value1", .fill_color = GColorWhite, #if PBL_BW .outline_color = GColorBlack, #endif ...
heck(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } static void prv_render_long_strings_test(bool is_current_location) { const WeatherLocationForecast forecast = { .location_name = "QWERTYUIO ASEDDFFGHHJ", .is_current_location = is_current_location, .current_temp = 68, .today_high = 68...
{ const WeatherLocationForecast forecast = { .location_name = "PALO ALTO", .current_temp = -88, .today_high = -88, .today_low = -88, .current_weather_type = WeatherType_HeavySnow, .current_weather_phrase = "Heavy Snow", .tomorrow_high = -99, .tomorrow_low = -99, .tomorrow_weather_t...
void test_weather_app_layout__render_all_unknown_values(void) { const WeatherLocationForecast forecast = { .location_name = "PALO ALTO", .current_temp = WEATHER_SERVICE_LOCATION_FORECAST_UNKNOWN_TEMP, .today_high = WEATHER_SERVICE_LOCATION_FORECAST_UNKNOWN_TEMP, .today_low = WEATHER_SERVICE_LOCATION...
ake); prv_feed_cannned_accel_data(60, 0, ActivitySleepStateLightSleep); prv_feed_cannned_accel_data(60, 0, ActivitySleepStateRestfulSleep); // Wait long enough for our recompute sleep logic to run. prv_feed_cannned_accel_data(SECONDS_PER_MINUTE * ACTIVITY_SESSION_UPDATE_MIN, 0, Ac...
memset(exp_history, 0, sizeof(exp_history))
0, 100, 200); // x, y, width, height to_r = GRect(1000, 2000, 100, 200); // x, y, width, height prop_h = property_animation_create_layer_frame(&layer, &from_r, &to_r); Animation *h = property_animation_get_animation(prop_h); void *context = &layer; animation_set_handlers(h, handlers, context); animatio...
(layer.frame.origin, to_r.origin)
ication && header_out) { // When tackling https://pebbletechnology.atlassian.net/browse/PBL-14151 this should probably // not be an assert, but just return 0, in case the app mucked with the storage PBL_ASSERTN(header_out->value_length <= read_space - sizeof(*header_out)); } unlock: prv_unlock(); retu...
{ PBL_ASSERTN(s_circular_buffer_retain_count[client]); --s_circular_buffer_retain_count[client]; if (s_circular_buffer_retain_count[client] == 0) { // Last subscription for this client to require the circular buffer, go ahead and clean it up: kernel_free(s_circular_buffer[client]); s_circu...
prv_unlock(); } // Increments ownership count static bool prv_retain_buffer(GAPLEClient client) { bool rv = true; prv_lock(); { if (s_circular_buffer_retain_count[client] == 0) { // First subscription for this client to require the circular buffer, go ahead and create it: PBL_ASSERTN(s_circula...
/* * 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...
((int16_t)((y2 - y1) / fixedpoint_base), (int16_t)((x2 - x1) / fixedpoint_base))
Window *window1 = window_create(); Window *window2 = window_create(); uint8_t base_priority = ModalPriorityDiscreet + 3; window_set_click_config_provider(window1, prv_click_config_provider); window_set_click_config_provider(window2, prv_click_config_provider); modal_window_push(window1, base_priority, fals...
(window_is_transparent(window2), false)
; window_set_transparent(window2, true); cl_assert_equal_b(window_is_transparent(window2), true); WindowStack *app_stack = app_state_get_window_stack(); WindowStack *modal_stack = modal_manager_get_window_stack(ModalPriorityGeneric); cl_check(app_stack); cl_check(modal_stack); cl_check(!app_stack->list...
S OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "flash_region/flash_region.h" #include "clar.h" // Stubs /////////////////////////////////////////////////////////// #include "stubs_logging.h...
cl_assert_equal_i(s_command_list[1].addr, 64 * 1024)
; cl_assert_equal_i(s_command_list[1].type, SectorEraseCommand); cl_assert_equal_i(s_command_list[2].addr, 2 * 64 * 1024); cl_assert_equal_i(s_command_list[2].type, SubsectorEraseCommand); } void test_flash_region__erase_optimal_range_96k_app_banks(void) { // Various tests that look like erasing our 96k app r...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(grect_get_max_y(&(GRect){.origin.y = 1, .size.h = INT16_MAX}) < 0)
; text_layer.layer.frame.origin.y = 1; layer_add_child(&window.layer, &text_layer.layer); GPoint origin; GRect page; cl_assert(text_layer_calc_text_flow_paging_values(&text_layer, &origin, &page)); cl_assert_equal_i(page.origin.y, text_layer.layer.frame.origin.y); // must not overflow cl_assert(grect...
DayInWeek day_in_week = local_tm.tm_wday; // Our _initialize should set us to Monday, 9am UTC cl_assert_equal_i(day_in_week, Monday); // ---------------------------------- // Let's fill in known data for the 15-minute step averages s_sys_activity_get_step_averages_values_weekday = (sys_activity_get_step_...
(0, 9 * MINUTES_PER_HOUR, &s_sys_activity_get_step_averages_values_weekend.out.averages)
; exp_value /= 7; start_of_today = time_start_of_today(); value = health_service_sum_averaged(HealthMetricStepCount, start_of_today, start_of_today + (9 * SECONDS_PER_HOUR), HealthServiceTimeScopeDaily); cl_asse...
G file with 8-bit color, 5 frames and loop infinite, size 64x64 // Tests gbitmap_sequence for bitmap bounds offset and DISPOSE_OP_BACKGROUND // Result: // - gbitmaps matches platform decoded APNG void test_gbitmap_sequence__color_8bit_bounds(void) { #if PLATFORM_SPALDING uint32_t resource_id = sys_resource_load_fil...
(status, true)
; } printf("Checking %u\n", current_frame); // Don't use GET_PBI_NAME, it doesn't like not using anything other than an integer literal char filename_buffer[128]; snprintf(filename_buffer, sizeof(filename_buffer), "%s_%u.pbi", __func__, current_frame); cl_check(gbitmap_pbi_eq(bitmap, filename_...
ource); 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, length, value); prv_pop_if_failing_rv(conn_idx, rv); return rv; } ble_err...
(&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_indication(&addr, evt->handle, evt->length, evt->value); // GATT Indications are alrea...
ata; return (subscription->characteristic == characteristic_ref); } static GATTClientSubscriptionNode * prv_find_subscription_for_characteristic( BLECharacteristic characteristic_ref, GAPLECo...
{ // Already a pending subscription in flight... return BTErrnoInvalidState; }
previous_prevailing_type = prv_prevailing_subscription_type(subscription); } else { if (subscription_type == BLESubscriptionNone) { // No subscription, so nothing to unsubscribe from... return BTErrnoInvalidState; } // No subscriptions for the characteristic yet, go create one: subscr...
/* * 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_WARNING, "Failed to query Mag")
(animation->handle); } animation->did_setup = false; } if (force_destroy || (allow_auto_destroy && animation->auto_destroy)) { prv_unlink_and_free(state, animation); } } return; } // Unschedule the passed in animation ANIMATION_LOG_DEBUG("unscheduling %d (%p)", (...
prv_reschedule_timer(state, 0)
; } } ANIMATION_LOG_DEBUG("scheduled %d (%p) to run at (%d). delay:%d, duration:%d", (int)animation->handle, animation, (int)animation->abs_start_time_ms, (int)(animation->delay_ms), (int)(animation->duration_ms)); } // -------------------------------------------------------------------------...
te the app's persist file when the user explicitly removes the // app, not during an AppDB clear. if (!app_upgrade) { persist_service_delete_file(s_install_callback_data.uuid); comm_session_app_session_capabilities_evict(s_install_callback_data.uuid); } break; case APP_DB_CLE...
mutex_create_recursive()
NECT_MASTER_MAX_CONNECTION_INTENTS) { // When the limit is reached, expect "not enough resources" error: cl_assert_equal_i(e, BTErrnoNotEnoughResources); } else { cl_assert_equal_i(e, BTErrnoOK); const bool registered = gap_le_connect_has_connection_intent(&device, ...
cl_assert_equal_b(registered, true)
; // Register another connection intent using the bonding: e = gap_le_connect_connect_by_bonding(bonding_id, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp); cl_asse...
.busy = 1 << 0, .write_enable = 1 << 1, }, .flag_status_bit_masks = { .erase_suspend = 1 << 6, }, .dummy_cycles = { .fast_read = 10, .fast_read_ddr = 8, }, .block_lock = { .has_lock_data = true, .lock_data = 0x1, .locked_check = 0x1, }, .reset_latency_ms = 51, .suspend_to...
(QSPI_FLASH)
; } status_t flash_impl_enter_low_power_mode(void) { qspi_flash_set_lower_power_mode(QSPI_FLASH, true); return S_SUCCESS; } status_t flash_impl_exit_low_power_mode(void) { qspi_flash_set_lower_power_mode(QSPI_FLASH, false); return S_SUCCESS; } status_t flash_impl_set_burst_mode(bool burst_mode) { // NYI r...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
GATT_LOG_DEBUG("gatt_wrapper_read_uuid: context_ref: %d, source: %d", context_ref, source)
; const GattRespDest resp_dest = prv_dest_from_source(source); if (!prv_enqueue(conn_idx, context_ref, resp_dest, GattOpType_Read)) { return BLE_ERROR_NOT_CONNECTED; } ble_error_t rv = ble_gattc_read_by_uuid(conn_idx, start_h, end_h, uuid); prv_pop_if_failing_rv(conn_idx, rv); return rv; } ble_error_...
/* * 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_on_echo_request(this, packet)
/process_manager.h" #include "system/logging.h" #include "util/trig.h" typedef struct CrumbsLayerSizeConfig { int layer_width; int crumb_radius; int crumb_spacing; int crumb_space_from_top; } CrumbsLayerSizeConfig; static const CrumbsLayerSizeConfig s_crumb_configs[NumPreferredContentSizes] = { //! @note th...
(prv_crumbs_layer_update_proc_rect, prv_crumbs_layer_update_proc_round)
top only when button is pushed; // else go until iterations hit static FlashTestErrorType prv_run_stress_addr_test(uint32_t iterations) { PBL_LOG(LOG_LEVEL_DEBUG, ">START - STRESS TEST 1"); uint16_t halfwordcount = 0; unsigned int iteration_count = 0; // Read/Write from address 1 uint32_t stress_addr1 = ...
(LOG_LEVEL_DEBUG, "Read %lu bytes, median throughput %lu KBps", num_bytes, (num_bytes * 1000 * 64 / ticks[1]))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_vibe_history_clear(HISTORY_CLEAR_ALL)
; mutex_unlock(s_vibe_history_mutex); } static void prv_vibe_history_start_event(void) { if (!s_vibe_history_enabled) { return; } VibeHistory *vibe = kernel_malloc(sizeof(VibeHistory)); if (vibe == NULL) { s_vibe_history_enabled = false; return; } list_init((ListNode*)vibe); time_t s; uin...
}, { 1768, 432, -120}, { 1408, 272, -232}, { 1232, 136, -392}, { 704, -392, -264}, { 424, -520, -632}, { 920, -472, -408}, { 1120, -104, -248}, { 1272, 200, -288}, { 1488, 200, -160}, { 1832, 384, -128}, { 1744, 536, -128}, { 1760, 544, -136}, { 1896, 656, -80}, {...
{ -1984, 464, -232}, { 1904, 608, -184}, { 1776, 768, -96}, { 1664, 728, -56}, { 1584, 504, -24}, { 1440, 776, 128}, { 1480, -1960, 32}, { 624, 1480, 96}, { 1112, 1400, -136}, { 1024, 816, -344}, { 1312, 544, -232}, { 1944, 712, 40}, { -1880, 704, 16}, { -1880, 57...
{ 1696, 440, -48}, { 1456, 352, -208}, { 1304, -56, -120}, { 728, -552, 8}, { 792, -304, -472}, { 1200, -344, -232}, { 1584, 72, -232}, { 1632, 160, -120}, { 1888, 280, -128}, { 1944, 440, -248}, { 1872, 568, -192}, { 1768, 696, -96}, { 1528, 832, 16}, { 1504, 59...
EG; // CRG_TOP uint16_t BANDGAP_REG; uint16_t BOD_STATUS_REG; uint16_t FORCE_SLEEP_REG; uint16_t LDOS_DISABLE_REG; uint16_t AON_SPARE_REG; // QSPIC uint32_t QSPIC_CTRLMODE_REG; uint32_t QSPIC_BURSTCMDA_REG; uint32_t QSPIC_BURSTCMDB_REG; uint32_t QSPIC_WRITEDATA_REG; uint32_t QSPIC_DUMMYDA...
REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_ENABLE_HV, 0x1)
; REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_ENABLE_LV, 0x1); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_CUR_LIM_MAX_LV, 0x6); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_IDLE_HYST, 0x4); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_IDLE_MIN, 0x10); REG_SETF(DCDC, DCDC_V18_0_REG, DCDC_V18_FAST_RAMPING, 0x1); REG_SETF(DCD...
al_i(circular_buffer_get_write_space_remaining(&buffer), 1); cl_assert_equal_i(circular_buffer_get_read_space_remaining(&buffer), 7); contiguous_num_bytes_left = circular_buffer_write_prepare(&buffer, &data_out); cl_assert_equal_i(contiguous_num_bytes_left, 1); memcpy(data_out, "7", 1); circular_buffer_writ...
cl_assert_equal_i(sizeof(storage) - sizeof(letterA), num_bytes)
; uint8_t letterB = 'B'; data_buf[0] = letterB; cl_assert(circular_buffer_read( &buffer, sizeof(letterA), (const uint8_t **)&data_buf, &num_bytes)); cl_assert_equal_i(num_bytes, sizeof(letterA)); cl_assert_equal_m(data_buf, &letterA, sizeof(letterA)); cl_assert(circular_buffer_consume(&buffer, size...
67788, }, .csrk = { .data = { 0xcc, 0xdd, 0xee, 0xff, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x22, 0x33, }, }, .is_local_encryption_info_valid = true, .is_remote_encryption_info_valid = true, .is_remote_identity_info_valid = true, .is_remote_signing_info_valid = ...
shared_prf_storage_set_getting_started_complete(true)
; cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), true); shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), false); } void test_shared_prf_storage_v3__ble_pairing(void) { shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_...
tate, .periph = DMA2, .rcc_bit = RCC_AHB1Periph_DMA2, }; // DMA Streams CREATE_DMA_STREAM(1, 1); // DMA1_STREAM1_DEVICE - Debug UART RX CREATE_DMA_STREAM(1, 3); // DMA1_STREAM3_DEVICE - Mic I2S RX CREATE_DMA_STREAM(1, 6); // DMA1_STREAM6_DEVICE - Accessory UART RX CREATE_DMA_STREAM(2, 0); // DMA2_STREAM0_DEVICE -...
IRQ_MAP(UART8, uart_irq_handler, ACCESSORY_UART)
; // I2C DEVICES static I2CBusState I2C_PMIC_MAG_BUS_STATE = {}; static const I2CBusHal I2C_PMIC_MAG_BUS_HAL = { .i2c = I2C1, .clock_ctrl = RCC_APB1Periph_I2C1, .clock_speed = 400000, .duty_cycle = I2CDutyCycle_16_9, .ev_irq_channel = I2C1_EV_IRQn, .er_irq_channel = I2C1_ER_IRQn, }; static const I2CBus...
_alarm_time, alarm->config.is_smart); } // ---------------------------------------------------------------------------------------------- //! Checks to see if this alarm is the new next alarm. If it is, adjust the timer so it's scheduled. static void prv_check_and_schedule_alarm(SettingsFile *fd, Alarm *alar...
prv_alarm_operation(s_most_recent_alarm_id, prv_record_alarm_op, NULL)
; } } } // ---------------------------------------------------------------------------------------------- static void prv_snooze_kernel_bg_callback(void *unused) { prv_process_most_recent_alarm(); } // ---------------------------------------------------------------------------------------------- static void p...
ialize(void) { } void test_hdlc__cleanup(void) { } // Tests void test_hdlc__decode_no_special(void) { // without any special characters const char *str = "\x7eThis is a long string without any special characters to be escaped.\x7e"; int len = strlen(str); HdlcStreamingContext ctx; hdlc_streaming_decode_res...
for (int i = 0; i < strlen(str); i++) { char c = str[i]; if (hdlc_encode((uint8_t *)&c)) { buffer[write_idx++] = HDLC_ESCAPE; } buffer[write_idx++] = 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...
strcmp(first, "Musique")
/* * 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_clocksource_is_lse_started()
) { return true; } delay_us(1000); } dbgserial_putstr("LSE oscillator did not start"); return false; } //! This routine relies on bootbits already having enabled //! access to the PWR clock and backup domain. Re-enabling //! it here breaks wakeup for some reason //! Returns false if configuring LS...
1 << 3), //!< End of charge PmicInt1_ChDet = (1 << 4), //!< Charger detected PmicInt1_OnKey = (1 << 5), //!< On Key held PmicInt1_OvTemp = (1 << 6), //!< Set when 110deg is exceeded PmicInt1_LowBat = (1 << 7), //!< Low Battery detected. Set when BSUP drops below ResVoltFall }; enum PmicRail { PmicR...
(PmicRegisters_REFERENCE_CNTL, ref_cntl)
; // Enable PWM Output on GPIO2 (Fig. 64) // Bits 6-4: Mode, 0x1 = Output // Bits 0-3: iosf, 0xe = PWM uint8_t val = (1 << 4) | 0x0e; success = prv_write_register(PmicRegisters_GPIO2_CNTL, val); } PBL_ASSERT(success, "Failed to start PMIC 120Hz PWM"); } static void prv_configure_charging(void)...
sert(fread(buf, 1, st.st_size, file) > 0); pfs_remove(pfs_name); int fd = pfs_open(pfs_name, OP_FLAG_WRITE, FILE_TYPE_STATIC, st.st_size); cl_assert(fd >= 0); int bytes_written = pfs_write(fd, buf, st.st_size); cl_assert(st.st_size == bytes_written); pfs_close(fd); } // ----------------------------------...
(50 * SECONDS_PER_MINUTE, 0, ActivitySleepStateRestfulSleep)
; // Wait long enough for our recompute sleep logic to run. prv_feed_cannned_accel_data(SECONDS_PER_MINUTE * ACTIVITY_SESSION_UPDATE_MIN, 60, ActivitySleepStateAwake); // See if we got the expected sleep events cl_assert(s_num_captured_sleep_events > 0); event = s_captured_sle...
'->child_c // // +-child_a // | // '->grand_child_a // layer_remove_from_parent(&child_a); cl_assert(parent.first_child == &child_c); cl_assert(child_c.parent == &parent); cl_assert(child_a.parent == NULL); cl_assert(child_a.next_sibling == NULL); cl_assert(grand_child_a.parent == ...
cl_assert_equal_i(2, current_stack)
; cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(aa, stack[1]); cl_assert_equal_p(aaa, stack[2]); // go to child if possible actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_stack, true); cl_assert_equal_p(aaaa, actual); cl_assert_equal_i(3, current_stack); cl_...
//////////////////////// #include "graphics_common_stubs.h" #include "stubs_applib_resource.h" static FrameBuffer *fb = NULL; // Setup void test_graphics_stroke_circle_${BIT_DEPTH_NAME}__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); } // Teardown void...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_THREE)
; graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MAX_PRECOMPUTED); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r2_no_clip.${BIT_DEPTH_NAME}.pbi")); // No circle setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_THREE); graphics_draw_circle...
/* * 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...
strncpy(buffer, "15 minutes ago", buf_size)
; buffer[buf_size - 1] = '\0'; } } // Stubs ///////////////////// #include "stubs_action_menu.h" #include "stubs_analytics.h" #include "stubs_animation_timing.h" #include "stubs_app_install_manager.h" #include "stubs_app_timer.h" #include "stubs_app_window_stack.h" #include "stubs_bootbits.h" #include "stubs_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...
snprintf(data->text, sizeof(data->text), "Axis: %c\nDouble Taps: %6"PRIu32, axes[axis], count)
; text_layer_set_text(&data->text_layer, data->text); } static void prv_window_load(Window *window) { AppData *data = window_get_user_data(window); GSize size = window->layer.frame.size; TextLayer *thumbsup_layer = &data->thumbsup_layer; text_layer_init(thumbsup_layer, &(GRect){{0, 1 * (size.h / 3)}, {size...
(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; }
//////////////////////////// //! Counter variables static int s_num_timer_register_calls = 0; static int s_alarm_timer_timeout_ms = 0; static int s_snooze_timer_timeout_ms = 0; static int s_snooze_timer_id = 0; /////////////////////////////////////////////////////////////////////////////////////////////////// //! Fak...
{ AlarmId id; id = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule); id = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id, 4, 1...
void test_alarm__alarm_create_just_once(void) { AlarmId id; // It's currently Thursday @ 00:00 bool just_once_schedule_thursday[7] = {false, false, false, false, true, false, false}; id = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_JUST_ONCE }); prv_assert_alarm_config(id, 3, 14,...
", 0, 1); cl_assert_equal_s(dstbuf, "0zero1"); // Variable length character output snprintf(dstbuf, 256, "There are %*o lights", 3, 8); cl_assert_equal_s(dstbuf, "There are 10 lights"); // Variable length digits output snprintf(dstbuf, 256, "There are %.*o lights", 3, 8); cl_assert_equal_s(dstbuf, "The...
(dstbuf, 256, "There are %#X lights, %#X", 16, -4)
; cl_assert_equal_s(dstbuf, "There are 0X10 lights, 0XFFFFFFFC"); // Zero padded minimum character output snprintf(dstbuf, 256, "There are %03X lights, %03X", 16, -4); cl_assert_equal_s(dstbuf, "There are 010 lights, FFFFFFFC"); // Space padded minimum character output snprintf(dstbuf, 256, "There are %3X...
////////////////////////////// // Set up dialog labels and callbacks typedef struct DialogNode { const char *label; void (*show)(DialogsData *data); } DialogNode; static const DialogNode nodes[] = { { .label = "D1 - Confirm", .show = prv_show_confirm_dialog, }, { .label = "D2 - D...
{ DialogsData *data = app_state_get_user_data(); menu_layer_deinit(&data->menu_layer); i18n_free_all(data); app_free(data); }
//////////////////// // App boilerplate static void s_main(void) { prv_handle_init(); app_event_loop(); prv_handle_deinit(); } const PebbleProcessMd* dialogs_demo_get_app_info() { static const PebbleProcessMdSystem s_app_md = { .common = { .main_func = s_main, // UUID: ab470e5f-5ffd-46f2-9aa...
->out_iter, AppMessageKey_HRMProtocolVersionMajor, hrm_info.protocol_version_major); dict_write_uint8(app_data->out_iter, AppMessageKey_HRMProtocolVersionMinor, hrm_info.protocol_version_minor); dict_write_uint8(app_data->out_iter, AppMessageKey_HRMSoftwareVersionMajor,...
"Sending message - bpm:%u quality:%u current:%u " "ppg_readings:%u accel_readings %"PRIu32, bpm, bpm_quality, led_current, hrm->debug->ppg_data.num_samples, hrm->debug->accel_data.num_samples); led_current = bpm = b...
} } static void prv_enable_hrm(void) { AppData *app_data = app_state_get_user_data(); app_data->hrm_event_info = (EventServiceInfo) { .type = PEBBLE_HRM_EVENT, .handler = prv_handle_hrm_data, }; event_service_client_subscribe(&app_data->hrm_event_info); // TODO: Let the mobile app control this? ...
/* * 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...
ppogatt_emulated_server_wa_enabled(conn_idx)
}; } static uint8_t prv_handle_connection_state_read(uint16_t conn_idx, uint8_t response_buf[READ_RESPONSE_BUFFER_SIZE]) { PebblePairingServiceConnectivityStatus status = {}; prv_get_connectivity_status(conn_idx, &status); memcpy(response_buf, &status, sizeof(st...
{ if (!session) { return 0; } return s_live_capabilities; }
static CommSession *s_app_session_ptr; CommSession *comm_session_get_current_app_session(void) { return s_app_session_ptr; } static bool s_close_called; void settings_file_close(SettingsFile *file) { s_close_called = true; } static status_t s_open_status; status_t settings_file_open(SettingsFile *file, const ch...
RMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = 300; Animation *animation = (Animation *)kino_player_create_play_animation(test_player); cl_assert_equal_i(animation_is_scheduled(animation), false); animation_schedule(animation); animation_set_reverse(animation, true); animati...
cl_assert_equal_i(animation_is_scheduled(animation), false)
; // Create play animation unschedules previous animation animation = (Animation *)kino_player_create_play_animation(test_player); cl_assert_equal_i(animation_is_scheduled(animation), false); animation_schedule(animation); // Pause unschedules the current animation cl_assert_equal_i(animation_is_scheduled...
ccel_manager_set_jitterfree_sampling_rate(AccelManagerState *state, uint32_t min_rate_mHz) { // HACK // We're dumb and don't support anything other than 12.5hz for jitter-free sampling. We chose // this rate because it divides evenly into all the native rates we...
{ int left = shared_circular_buffer_get_read_space_remaining( &s_buffer, &state->buffer_client.buffer_client); if (left != 0) { empty = false; break; } state = (AccelManagerState *)state->list_node.next; }
} mutex_unlock_recursive(s_accel_manager_mutex); return empty; } void accel_cb_new_sample(AccelDriverSample const *data) { prv_update_last_accel_data(data); s_accel_samples_collected_count++; if (!s_buffer.clients) { return; // no clients so don't buffer any data } AccelManagerBufferData accel_...
s_in_buffer[2][IN_BUFFER_LENGTH]; static uint8_t s_circ_buf_store[(MIC_SAMPLE_RATE / 1000) * CIRCULAR_BUF_BATCH_SIZE * 4 * sizeof(uint16_t)]; static PDMFilter_InitStruct s_pdm_filter; static uint16_t s_volume; static bool s_running = false; static bool s_main_pending = false; static...
if (BOARD_CONFIG.mic_config.mic_gpio_power.gpio) { gpio_output_set(&BOARD_CONFIG.mic_config.mic_gpio_power, true); } else { set_ldo3_power_state(true); }
} static void prv_mic_power_disable(void) { if (BOARD_CONFIG.mic_config.mic_gpio_power.gpio) { gpio_output_set(&BOARD_CONFIG.mic_config.mic_gpio_power, false); } else { set_ldo3_power_state(false); } } void mic_init(MicDevice *this) { PBL_ASSERTN(!s_initialized); s_main_pending = false; s_bg_pen...
// Verify the collected data AccelRawData captured_data[k_raw_samples]; prv_uncompress_captured_data(captured_data, k_raw_samples); cl_assert_equal_m(raw_data, captured_data, k_raw_samples * sizeof(AccelRawData)); } // --------------------------------------------------------------------------------...
(num_records, exp_num_records)
; cl_assert_equal_i(utc_start, exp_utc_start); cl_assert_equal_i(minutes[0].steps, exp_utc_start % 255); // --------------------------------------------------------------------------------------- // Once a minute, retrieve the last ALG_MINUTES_PER_RECORD minutes of data. We should // get 1 fewer record each...
e_pending(); // Feed in 100 steps/min over 10 minutes, for a total of 1000 steps for today 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, ...
activity_start_tracking(false /*test_mode*/)
; fake_system_task_callbacks_invoke_pending(); // Feed in the test cadence for 2 minutes. Compute the expected distance in 2 minutes // as well int steps_per_minute = (int)((float)params->steps / params->seconds * SECONDS_PER_MINUTE); int exp_distance_m = ROUND(params->exp_distance_m * k_elapsed_se...
/* * 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 (client == AnalyticsClient_Ignore) { return NULL; } else { WTF; }
if (md != NULL) { return &md->uuid; } else { return NULL; } } AnalyticsHeartbeat *analytics_storage_find(AnalyticsMetric metric, const Uuid *uuid, AnalyticsClient client) { PBL_ASSERTN(analytics_storage_has_lock()); switch (analytics_metric_kind(metric))...
----------------------------------------------------------- static void prv_snooze_kernel_bg_callback(void *unused) { prv_process_most_recent_alarm(); } // ---------------------------------------------------------------------------------------------- static void prv_snooze_timer_callback(void *unused) { PBL_LOG(LO...
PBL_ASSERTN(id >= 0 && id < MAX_CONFIGURED_ALARMS)
te resource. const uint32_t update_length = resource_size( SYSTEM_APP, RESOURCE_ID_AS7000_FW_IMAGE); if (update_length == 0) { // We don't have a firmware to write so there's no point in booting // the HRM. PBL_LOG(LOG_LEVEL_DEBUG, "No HRM FW update available"); return; } AS7000FWUpdateHe...
mutex_unlock(dev->state->lock)
copies the app frame buffer to the system frame buffer op_3) System sends the system frame buffer to the display hardware (using DMA). op_3 can happen in parallel with op_1, so the effective frame period is: frame_period = MAX(op_1_time + op_2_time, op2_time + op_3_time) This app measures op_1_time + op_2...
__profiler_start()
; } data->rendered_frames++; } void prv_syncing_selection_changed(MenuLayer *menu_layer, MenuIndex old_index, MenuIndex new_index, void *context) { ScrollLayer *scroll_layer = (ScrollLayer *)menu_layer; AppData *data = context; GPoint offset = scroll_layer_get_content_offset(scroll_layer); scroll_laye...
700, -436}, { -523, 822, -430}, { -709, 1022, -538}, { -557, 571, -575}, { -709, 694, -524}, { -710, 1507, -142}, { -642, 742, -259}, { -432, 369, 42}, { -519, 627, -27}, { -494, 731, -168}, { -491, 625, -223}, { -442, 773, -172}, { -402, 875, -144}, { -410, 784, -64...
{ -677, 863, -115}, { -604, 996, -98}, { -630, 1125, -130}, { -536, 812, -127}, { -656, 576, -151}, { -834, 491, -104}, { -960, 625, -60}, { -771, 607, -98}, { -551, 560, -216}, { -431, 572, -293}, { -397, 589, -362}, { -410, 599, -343}, { -430, 530, -323}, { -494...
{ -812, 241, -144}, { -660, 435, -191}, { -496, 498, -260}, { -405, 574, -383}, { -388, 583, -447}, { -454, 484, -417}, { -586, 486, -465}, { -749, 747, -518}, { -713, 750, -546}, { -457, 505, -711}, { -970, 825, -373}, { -688, 769, -302}, { -691, 365, -196}, { -...
/* * 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...
{ // ignore this character and escape the next one ctx->escape = true; }
} else { if (ctx->escape) { *data ^= HDLC_ESCAPE_MASK; ctx->escape = false; } *should_store = true; } return is_complete; } bool hdlc_encode(uint8_t *data) { if (*data == HDLC_FLAG || *data == HDLC_ESCAPE) { *data ^= HDLC_ESCAPE_MASK; return true; } return 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...
{ return s_activity_prefs_heart_rate_is_enabled; }
static bool s_bt_driver_hrm_service_is_enabled; static int s_bt_driver_hrm_service_enable_call_count; void bt_driver_hrm_service_enable(bool enable) { s_bt_driver_hrm_service_enable_call_count++; s_bt_driver_hrm_service_is_enabled = enable; } static BleHrmServiceMeasurement s_last_ble_hrm_measurement; static int...
/* * 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...
(HRM_SERVICE_EXPECTED_ATT_STARTING_HANDLE, HRM_SERVICE_EXPECTED_ATT_ENDING_HANDLE)
; } else { // Unfortunately, there is no clean way to remove a service from RivieraWaves once it has been // added. The various ble_... APIs do nuke the GATT DB entirely, but can only be called when // there is no connection / on-going air operations. // The next time the BT stack is restarted (grante...
o a different place, we need // to clean up this state or else we'll just hit an INVSTATE UsageFault immediately. The only bit we leave // set is the bit that says we're in thumb state, which must always be set on Cortex-M3, since the micro doesn't // even support non-thumb instructions. // See: https://pebblet...
__set_PSP((uint32_t)stacked_args)
; } else { __set_MSP((uint32_t)stacked_args); } attempt_handle_stack_overflow(stacked_args); } else { prv_save_debug_registers(stacked_args); fault_handler_dump(buffer, stacked_args); // BREAKPOINT; // NOTE: If you want to get a stack trace at this point. Set a breakpoint here (yo...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return; }
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 and * limitations under the License. */ #include "protobuf_log_activity_s...
prv_activity_type_to_proto_type(session->type)
, } }, .start_reason = (session->manual) ? pebble_pipeline_ActivitySession_StartReason_Manual : pebble_pipeline_ActivitySession_StartReason_Automatic, .intervals = { .funcs.encode = prv_encode_intervals, .arg = session, } } };...
pped, }; animation_set_handlers(animation, anim_handler, selection_layer); selection_layer->slide_amin_impl = (AnimationImplementation) { .update = prv_slide_impl, }; animation_set_implementation(animation, &selection_layer->slide_amin_impl); return animation; } static Animation* prv_create_slide_set...
if (num_cells > MAX_SELECTION_LAYER_CELLS) { num_cells = MAX_SELECTION_LAYER_CELLS; }
// Set layer defaults *selection_layer = (SelectionLayer) { .num_cells = num_cells, .cell_padding = DEFAULT_CELL_PADDING, .selected_cell_idx = DEFAULT_SELECTED_INDEX, .font = fonts_get_system_font(prv_selection_config()->font_key), .active_background_color = DEFAULT_ACTIVE_COLOR, .inactive...
(angle_2), ); // adjust for coordinate system center.x.raw_value -= FIXED_S16_3_HALF.raw_value; center.y.raw_value -= FIXED_S16_3_HALF.raw_value; radius1.raw_value = MAX(0, radius1.raw_value); radius2.raw_value = MAX(0, radius2.raw_value); const Fixed_S16_3 inner_radius = Fixed_S16_3(MIN(radius1.raw_val...
task_free(state)
; } rocky_api_graphics_text_deinit(); rocky_api_graphics_path2d_reset_state(); } static bool prv_add_handler(const char *event_name, jerry_value_t handler) { return strcmp(ROCKY_EVENT_DRAW, event_name) == 0; } const RockyGlobalAPI GRAPHIC_APIS = { .init = prv_init_apis, .deinit = prv_deinit_apis, .add_h...
orage, 2, false)); cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 2); // Consume it prv_read_and_consume(&buffer, &client, storage, 2); cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 0); } void test_shared_circular_buffer__subsamplin...
{ SharedCircularBuffer buffer; uint16_t item_size = 2; uint8_t storage[12*item_size]; uint8_t out_buffer[12*item_size]; shared_circular_buffer_init(&buffer, storage, sizeof(storage)); SubsampledSharedCircularBufferClient client = {}; shared_circular_buffer_add_subsampled_client(&buffer, &client, 1, 2); ...
void test_shared_circular_buffer__subsampling_set_ratio_is_idempotent(void) { SharedCircularBuffer buffer; uint16_t item_size = 2; uint8_t storage[12*item_size]; uint8_t out_buffer[12*item_size]; shared_circular_buffer_init(&buffer, storage, sizeof(storage)); SubsampledSharedCircularBufferClient client ...
/* * 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...
(op, data, num_data, NULL, NULL, &result)
; cl_assert_equal_i(result, 34); } void test_stats__all_basic_ops(void) { const int32_t data[] = { 10, 0, 40, 6, 0, -5, 0, 32, 73, 0, 80, 34, 25, 62, 0 }; const size_t num_data = ARRAY_LENGTH(data); const StatsBasicOp op = (StatsBasicOp_Sum | StatsBasicOp_Average | StatsBasicOp_Min | StatsBasicOp_Max | ...
ezone_id(); } void clock_set_timezone_by_region_id(uint16_t region_id) { TimezoneInfo tz_info; prv_clock_get_timezone_info_from_region_id(region_id, rtc_get_time(), &tz_info); prv_update_time_info_and_generate_event(NULL, &tz_info); } void clock_get_friendly_date(char *buffer, int buf_size, time_t timestamp) { ...
if (timestamp_midnight <= last_week_midnight || timestamp_midnight >= next_week_midnight) { switch (style) { case FullStyleLower12h: case FullStyleCapital12h: if (with_fulltime) { time_fmt = i18n_noop("%b %e, %l:%M %p"); } else { time_fmt = i18n_noop("%B %e"); ...
prv_format_time(buffer, buf_size, time_fmt, timestamp); } static void prv_clock_get_relative_time_string(char *buffer, int buf_size, time_t timestamp, bool capitalized, int max_relative_hrs, bool with_fulltime) { time_t ...
comp_corr_reset(); mag_change_sample_rate(MagSampleRate20Hz); regular_timer_add_multiminute_callback(&s_cb_info, 2); s_calib_run = true; s_high_freq_calib_active = true; samples_collected = 0; return; // if we are switching to high freq mode, don't use 1st sample } if (sampl...
launcher_task_add_callback(prv_ecompass_stop_callback, NULL)
; psleep(5); // give the compass some time to stop char buffer[40]; prompt_send_response_fmt(buffer, sizeof(buffer), "%"PRId32" degrees", (s_last_heading * 360) / TRIG_MAX_ANGLE); prompt_send_response_fmt(buffer, sizeof(buffer), "Mx=%d, My=%d, Mz=%d", s_last_mag_sample.x, s_last_mag_sample.y,...
ase ACCEL_SAMPLING_50HZ: case ACCEL_SAMPLING_100HZ: break; default: cl_assert(0); } } } static void prv_run_accel_test(int *sample_arr, int num_items) { PebbleTask tasks[] = { PebbleTask_KernelMain, PebbleTask_Worker, PebbleTask_App }; AccelManagerState* sessions[3]; if (num_it...
(main_session, fake_buf, 11)
/* * 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(NULL != bmp)
; cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, GBitmapFormat2BitPalette); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, GBitmap...
2_t ret_update_interval_s; uint16_t ret_expire_s; HRMFeature ret_features; cl_assert(sys_hrm_manager_get_subscription_info(session_ref, &ret_app_id, &ret_update_interval_s, &ret_expire_s, &ret_features)); cl_assert(ret_app_id == app_id); cl_assert(ret_update_interval_s == update_interval_s); cl_...
(s_cb_events_1[0].event_type, HRMEvent_BPM)
; cl_assert_equal_i(s_cb_events_1[0].bpm.bpm, s_hrm_event_data.hrm_bpm); cl_assert_equal_i(s_cb_events_1[0].bpm.quality, s_hrm_event_data.hrm_quality); // Now advance time to just before the expiration time rtc_set_time(rtc_get_time() + expire_s - 1); // Send more data, the callback should get the expiring...
s, ((const uint32_t [ACTIVITY_HISTORY_DAYS]) {3 * SECONDS_PER_MINUTE, 2 * SECONDS_PER_MINUTE, 1 * SECONDS_PER_MINUTE, 0, 0, 0, 0})); } // ---------------------------------------------------------------------------------...
(in_path, "r")
; cl_assert(file); uint8_t buf[st.st_size]; // copy file to fake flash storage cl_assert(fread(buf, 1, st.st_size, file) > 0); pfs_remove(pfs_name); int fd = pfs_open(pfs_name, OP_FLAG_WRITE, FILE_TYPE_STATIC, st.st_size); cl_assert(fd >= 0); int bytes_written = pfs_write(fd, buf, st.st_size); cl_as...
cl_assert_equal_b(false, s_path_open); cl_assert(prv_compare_points((GPoint*)points, s_stroke_points, s_path_num_points)); prv_reset(); // change to open path and ensure that only draws 2 lines command->path_open = true; gdraw_command_draw(NULL, command); cl_assert_equal_i(1, s_path_stroke_precise_count...
cl_assert(prv_compare_points(&center, s_fill_points, s_path_num_points))
; prv_reset(); // restore stroke color and set radius to zero - only a stroke should be drawn gdraw_command_set_stroke_color(command, GColorPurple); gdraw_command_set_radius(command, 0); gdraw_command_draw(NULL, command); cl_assert_equal_i(s_stroke_color.argb, GColorPurpleARGB8); cl_assert_equal_i(s_fill...
text_layer = &dialog->text_layer; text_layer_init_with_parameters(text_layer, &GRect(x, y, w, h), dialog->buffer, dialog_text_font, dialog->text_color, GColorClear, text_alignment, GTextOverflowModeWordWrap); #if PBL...
applib_malloc(sizeof(WorkoutDialog))
; if (workout_dialog) { workout_dialog_init(workout_dialog, dialog_name); } return workout_dialog; } Dialog *workout_dialog_get_dialog(WorkoutDialog *workout_dialog) { return &workout_dialog->dialog; } ActionBarLayer *workout_dialog_get_action_bar(WorkoutDialog *workout_dialog) { return &workout_dialog-...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return 123456; }
_count, 1); cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points)); cl_assert_equal_p(s_fill_points, NULL); prv_reset(); // set stroke color to be transparent and restore fill - fill should be drawn, but no outline // should be drawn gdraw_command_set_fill_color(command, GColorGreen); ...
(prv_compare_points((GPoint*)points, s_stroke_points, s_path_num_points))
; free(command); } void test_gdraw_command__draw_circle(void) { GDrawCommand *command = malloc(sizeof(GDrawCommand) + sizeof(GPoint)); *command = (GDrawCommand){ .type = GDrawCommandTypeCircle, .hidden = false, .stroke_color = GColorGreen, .stroke_width = 1, .fill_color = GColorOrange, ...
.label = "Wed", .progress = 1100, .fill_color = FILL_COLOR }, \ { .label = "Tue", .progress = 400, .fill_color = FILL_COLOR }, \ { .label = "Mon", .progress = 1300, .fill_color = FILL_COLOR }, \ { .label = "Sun", .progress = 800, .fill_color = FILL_COLOR }, \ { .label = "Sat", .progress = 700, .fill_color = FIL...
prv_create_card_and_render(&config)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_detail_card__render_zones(void) { HealthDetailCardConfig config = { .num_headings = 1, .headings = &(HealthDetailHeading) { .primary_label = "LABEL1", .primary_value = "value1", .secondary_label = "LABEL2", ...
con_bitmap; GBitmap *app_menu_data_source_get_node_icon(AppMenuDataSource *source, AppMenuNode *node) { cl_assert(source); cl_assert(node); if (!node->icon_resource_id) { return &s_default_app_icon_bitmap; } gbitmap_deinit(&s_app_icon_bitmap); gbitmap_init_with_resource(&s_app_icon_bitmap, node->icon_...
app_glance_db_init()
; // Setup AppGlanceService app_glance_service_init(); // Default to showing bitmap icons s_use_pdc_icons = false; } void app_glance_db_deinit(void); void test_launcher_menu_layer__cleanup(void) { app_glance_db_deinit(); gbitmap_deinit(&s_app_icon_bitmap); gbitmap_deinit(&s_default_app_icon_bitmap); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(secs_to_wait, 30 - BT_CONN_MGR_INACTIVITY_TIMEOUT_SECS)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(data->reading_text_layer)
; window_destroy(data->window); task_free(data); } static void prv_main(void) { prv_handle_init(); app_event_loop(); prv_handle_deinit(); } const PebbleProcessMd* mfg_als_app_get_info(void) { static const PebbleProcessMdSystem s_ambient_light_info = { .common.main_func = prv_main, .name = "MfgALS"...
..._.. //0020 db 0b ec a5 95 ab 92 8a aa f6 1c 47 90 53 43 ff ...........G.SC. //0030 75 36 9c 6e 1a 1b eb 5f fb 89 db 0b ec a5 95 7a u6.n..._.......z //0040 f3 e7 44 f6 1c 47 90 53 43 18 d1 6d 89 95 83 aa ..D..G.SC..m.... //0050 5e 7f ff 39 b3 47 36 e4 37 7e 05 1b 85 e3 b8 98 ^..9.G6.7~...... //0060 ...
(&key, sizeof(key), v1_data, v1_size)
; cl_assert_equal_i(data_len, v1_size); // 00000000: 0005 1b85 e3b8 98b5 a809 cc1a dffa 8e96 ................ // 00000010: 8776 accf b815 1269 5068 6f6e 6520 4d61 .v.....iPhone Ma // 00000020: 7274 7900 0000 0000 0000 0001 0000 0000 rty............. // 00000030: 0000 0000 0000 0000 0000 0000 0000 0000...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ kernel_free(contact); return NULL; }
contact->id = serialized_contact->uuid; contact->flags = serialized_contact->flags; return contact; } Contact* contacts_get_contact_by_uuid(const Uuid *uuid) { SerializedContact *serialized_contact = NULL; const int serialized_contact_data_len = contacts_db_get_serialized_contact(uuid, ...
/* * 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...
(FONT_KEY_GOTHIC_18_BOLD)
; const int single_line_text_height_px = fonts_get_font_height(dialog_text_font); const int max_text_line_height_px = 2 * single_line_text_height_px + 8; const uint16_t status_layer_offset = dialog->show_status_layer ? 6 : 0; uint16_t text_top_margin_px = icon ? icon_size.h + 22 : 6; uint16_t subtext_top_mar...
r_data->previous_height; y++) { const GBitmapDataRowInfo row_info = gbitmap_get_data_row_info(bitmap, y); const uint32_t x_origin = bitmap->bounds.origin.x + png_decoder_data->previous_xoffset; const int16_t min_x = MAX((uint32_t)row_info.min_x, x_origin); const int16_t max_x = MIN((uint32_t)row...
{ const uint32_t corrected_dst_x = x + delta_x; uint8_t channel = raw_image_get_value_for_bitdepth(upng_buffer, x, y, row_stride_bytes, bpp); if (transparent_gray >= 0 && channel == transparent_gray) { // Grayscale only has fu...
} } // Successfully updated gbitmap from sequence retval = true; cleanup: if (!retval) { APP_LOG(APP_LOG_LEVEL_ERROR, APNG_UPDATE_ERROR); applib_free(buffer); } return retval; } // total elapsed from start of animation bool gbitmap_sequence_update_bitmap_by_elapsed(GBitmapSequence *bitmap_s...
me listener twice return; } JS_VAR listeners = prv_get_or_create_listener_array(event_name); const uint32_t num_entries = jerry_get_array_length(listeners); JS_UNUSED_VAL = jerry_set_property_by_index(listeners, num_entries, listener); } static bool prv_remove_listener(jerry_value_t event_listeners, uint32...
if (jerry_value_has_error_flag(arg_result)) { return jerry_acquire_value(arg_result); }
const bool removed = prv_remove_event_listener_from_list(event_name, func); if (removed) { API_REFS_FOREACH(api_ref) { if ((*api_ref)->remove_handler) { (*api_ref)->remove_handler(event_name, func); } } } else { APP_LOG(LOG_LEVEL_WARNING, "Unknown handler for event '%s'", event_n...
e "popups/timeline/peek.h" #include "applib/ui/window_private.h" #include "fw/graphics/util.h" #include "util/size.h" #include "clar.h" extern void prv_window_load_handler(Window *window); extern void prv_window_unload_handler(Window *window); extern void prv_set_unobstructed_area_height(int16_t height); extern void...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_kickstart__render_steps_above_daily_avg(void) { prv_set_data(&s_data, 10323, 7500, 8000, 0); window_set_on_screen(&s_data.window, true, true); window_render(&s_data.window, &s_ctx); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_kickstart__render_hr_bpm(void) { #if (P...
_i(-53, sports_id); // load system resources load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, true); resource_init(); // simulate installing bg_counter on flash app_db_insert(...
cl_assert_equal_b(false, app_install_is_watchface(bg_counter_id))
; cl_assert_equal_b(false, app_install_is_watchface(menu_layer_id)); cl_assert_equal_b(false, app_install_is_watchface(CRAZY_ID)); } void test_app_install_manager__is_watchface_via_entry(void) { cl_assert_equal_b(true, prv_app_install_is_watchface(tictoc_id)); cl_assert_equal_b(false, prv_app_install_is_watc...
) { PBL_LOG(LOG_LEVEL_WARNING, "Tried to insert AppGlanceDB entry with at least one invalid slice"); return E_INVALID_ARGUMENT; } // Trim the serialized glance of excess slices by shrinking `val_len` to `validated_size` // We do this if the glance entry has more slices than the max number of ...
settings_file_delete(&s_app_glance_db.settings_file, key, (size_t)key_len)
Layer parent, child_a, child_b; Layer *layers[] = {&parent, &child_a, &child_b}; for (int i = 0; i < ARRAY_LENGTH(layers); ++i) { layer_init(layers[i], &GRectZero); } // Create this hierarchy: // // +-parent // | // '->child_a->child_b // layer_add_child(&parent, &child_a); layer_ad...
(aaaa, stack[3])
; // go back two levels and then to sibling actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_stack, true); cl_assert_equal_p(ab, actual); cl_assert_equal_i(1, current_stack); cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(ab, stack[1]); // go back one level and ...
tr_list_to_serialize, const uint8_t *expected_attr_list_serialized, size_t expected_attr_list_serialized_size) { uint8_t buffer[expected_attr_list_serialized_size]; const size_t size = attribute_list_serialize(attr_list_to_serialize, bu...
(list.num_attributes, 2)
; attribute_list_add_uint32(&list, AttributeIdLastUpdated, value_uint32); attribute_list_add_uint8(&list, AttributeIdBgColor, value_uint8); cl_assert_equal_i(value_uint32, attribute_get_uint32(&list, AttributeIdLastUpdated, 0)); cl_assert_equal_i(value_uint8, attribute_get_uint8(&list, AttributeIdBgColor, 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...
(&GPIO_InitStructure)
contiguous_num_bytes_left = circular_buffer_write_prepare(&buffer, &data_out); cl_assert_equal_i(contiguous_num_bytes_left, 0); cl_assert_equal_p(data_out, NULL); const uint16_t copy_out_size = 8; uint8_t copy_out[copy_out_size]; cl_assert_equal_i(circular_buffer_copy(&buffer, copy_out, copy_out_size), 8); ...
( &buffer, sizeof(letterB), (const uint8_t **)&data_buf, &num_bytes)
/* * 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...
dcache_flush(start, size)
; } if (icache_is_enabled()) { icache_invalidate(start, size); } }
eCaller* phone_call_util_create_caller(const char *number, const char *name) { return NULL; } void ancs_perform_action(uint32_t notification_uid, uint8_t action_id) { } void notifications_handle_notification_action_result( PebbleSysNotificationActionResult *action_result) { } void notification_storage_set_stat...
timeline_remove(&id)
); cl_assert(!timeline_exists(&id)); cl_assert_equal_i(pin_db_get(&id, &item_temp), -9); }
/* * 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...
(session->db_id, dirty_item->last_updated, dirty_item->key, dirty_item->key_len, item_buf, ...
; } kernel_free(item_buf); } BlobDBSyncSession* prv_create_sync_session(BlobDBId db_id, BlobDBDirtyItem *dirty_list, BlobDBSyncSessionType session_type) { BlobDBSyncSession *session = kernel_zalloc_check(sizeof(BlobDBSyncSession)); session->state = BlobDBSyncSessionS...
HealthServiceMetricAlertInfo *info) { if (info->threshold == 0) { // No threshold set return; } int32_t value; bool success = sys_activity_get_metric(prv_get_activity_metric(metric), 1, &value); if (!success) { return; } bool went_above = ((value > info->threshold) && (info->prior_reading...
{ // as the number of sessions is expected to be small (<=16), and we don't seem to have a generic // sort implementation, we do a simple bubble sort here for (uint32_t i = 0; i + 1 < num_sessions; i++) { for (uint32_t j = i + 1; j < num_sessions; j++) { if (prv_session_compare(&sessions[i], &sessions[j...
// ---------------------------------------------------------------------------------------------- static MeasurementSystem prv_get_shell_prefs_metric_for_distance(void) { #if !CAPABILITY_HAS_HEALTH_TRACKING return MeasurementSystemUnknown; #else switch (sys_shell_prefs_get_units_distance()) { case UnitsDistan...
10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(131, 96), 5); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_dotted_line_cross"))); } void test_graphics_draw_line_8bit__dotted_cross_color(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Test horizontal and vertical...
graphics_context_set_antialiased(ctx, true)