prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
we don't trigger as soon as we're awake s_data.metric_history[ActivityMetricSleepState][0] = ActivitySleepStateAwake; s_data.metric_history[ActivityMetricSleepStateSeconds][0] = 1 * SECONDS_PER_HOUR; activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(fake_kernel_services_notifications_ancs...
memcpy(&s_data.metric_history[ActivityMetricStepCount], &step_history, sizeof(step_history))
; } void prv_set_sleep_history_avg() { const ActivityScalarStore AVERAGE_SLEEP = 5 * MINUTES_PER_HOUR; static const int32_t sleep_history[ACTIVITY_HISTORY_DAYS] = { AVERAGE_SLEEP, // This is 'today' AVERAGE_SLEEP, // Average sleep to make sure our median is fairly low AVERAGE_SLEEP, AVERAGE_SLEE...
rent app to exit. const AppInstallId current_app_id = s_app_task_context.install_id; AppInstallId destination_app_id = INSTALL_ID_INVALID; #if !RECOVERY_FW destination_app_id = prv_get_app_exit_reason_destination_install_id_override(); #endif if (destination_app_id == INSTALL_ID_INVALID) { // If we get he...
app_manager_get_current_app_md()
; if (app_metadata != NULL) { prompt_send_response_fmt(buffer, sizeof(buffer), "app name: %s", process_metadata_get_name(app_metadata)); prompt_send_response_fmt(buffer, sizeof(buffer), "is watchface: %d", (app_metadata->process_type == ProcessTypeWatc...
time"); } } activity_private_settings_close(file); } mutex_unlock_recursive(state->mutex); } } // ------------------------------------------------------------------------------------------------ // Load in the stored activities from our settings file void activity_sessions_prv_init(Sett...
prv_log_activities(utc_sec)
; } // ------------------------------------------------------------------------------------------------ bool activity_sessions_is_session_type_ongoing(ActivitySessionType type) { ActivityState *state = activity_private_state(); bool rv = false; mutex_lock_recursive(state->mutex); { for (int i = 0; i < st...
text_layer_set_text(s_text_layer_b, "Spawned")
; layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_text_layer_b)); // Animate text layer a from top-left to bottom right and back PropertyAnimation *a = property_animation_create_layer_frame( text_layer_get_layer(s_text_layer_a), &from_rect_a, &to_rect_a); animat...
//////////////////////////////////////////////////////////// // Walk Line typedef void (*CharVisitorCallback)(GContext* ctx, const TextBoxParams* const text_box_params, Line* line, GRect cursor, const Codepoint codepoint); void render_chars_char_visitor_cb(GContext* ctx, const Tex...
if (current_codepoint == NEWLINE_CODEPOINT) { if (is_newline_as_space) { current_codepoint = SPACE_CODEPOINT; } else { break; } }
/* * 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...
{ 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 white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(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...
analytics_metric_kind(metric)
) { case ANALYTICS_METRIC_KIND_DEVICE: PBL_ASSERTN(client == AnalyticsClient_Ignore || client == AnalyticsClient_System); return s_device_heartbeat; case ANALYTICS_METRIC_KIND_APP: { PBL_ASSERTN(client == AnalyticsClient_Ignore || client != AnalyticsClient_System); const Uuid uuid_system = UUID_SYST...
gn); graphics_draw_rotated_bitmap(&ctx, test_image_bw, GPointZero, DEG_TO_TRIGANGLE(45), GPoint(20, 20)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_bw_corner_45.Xbit.pbi")); // Top-left center rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb...
"draw_rotated_bitmap_origin_color_set_center_45_transparent.Xbit.pbi")); }
/* * 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...
emx_resources_read(1, id_1, 0, (uint8_t *)&buf, 1)
with window unload. In app deinit? When low memory? void window_set_on_screen(Window *window, bool new_on_screen, bool call_window_appear_handlers) { PBL_ASSERTN(window != NULL); // This tripped me up for about a day if (new_on_screen == window->on_screen) { return; } // Window went from offscreen to o...
{ return false; }
if (!window->is_fullscreen) { return true; } StatusBarLayer *status_bar = NULL; layer_process_tree(&window->layer, &status_bar, prv_find_status_bar_layer); return status_bar && !layer_get_hidden(&status_bar->layer); } void window_attach_recognizer(Window *window, Recognizer *recognizer) { if (!windo...
e payload const uint16_t *received_packets = (uint16_t *)(payload + 1); data->rx_test_received_packets = *received_packets; } data->last_test_step_result = success; xSemaphoreGive(data->btle_test_semaphore); } #if CAPABILITY_HAS_MICROPHONE static void prv_mic_cb(int16_t *samples, size_t sample_count, vo...
(BTLETestStep_BTLEStop, data)
) { failed = true; goto cleanup; } else if (data->current_test == BTLETestType_RX) { snprintf(data->status_string, STATUS_STRING_LENGTH, "Packets Received: %"PRIu16, data->rx_test_received_packets); app_window_stack_push(&data->status_window, true); } if (!prv_run_test_step(BTLETestS...
ke_width.last_call.width); EXECUTE_SCRIPT( "ctx.lineWidth = 2.1;\n" "var w = ctx.lineWidth;\n" ); ASSERT_JS_GLOBAL_EQUALS_I("w", 2); EXECUTE_SCRIPT_EXPECT_ERROR( "ctx.lineWidth = -4;\n", "TypeError: Argument at index 0 is invalid: Value out of bounds for native type" ); EXECUTE_SCRIPT("var...
GRect(0, 1, 11, large_int)
), s_graphics_draw_text.last_call.draw_text.box); EXECUTE_SCRIPT("ctx.fillText('some text', -0.5, 1.2, -0.5);"); cl_assert_equal_rect((GRect(-1, 1, -1, large_int)), s_graphics_draw_text.last_call.draw_text.box); } void test_rocky_api_graphics__fill_text_aligned(void) ...
version(); cl_assert_equal_s(written_hw_version2, hw_version); // Write third time const char* written_hw_version3 = "OPQRSTU"; command_hwver_write(written_hw_version3); hw_version = mfg_get_hw_version(); cl_assert_equal_s(written_hw_version3, hw_version); // Write fourth time const char* written_hw_v...
cl_assert_equal_i(r, MfgSerialsResultSuccess)
; cl_assert_equal_s(sn, second_sn); // Third time: const char *third_sn = "!@#$%^&*()-="; r = mfg_write_serial_number(third_sn, strlen(third_sn), &index); sn = mfg_get_serial_number(); cl_assert_equal_i(r, MfgSerialsResultSuccess); cl_assert_equal_s(sn, third_sn); cl_assert_equal_i(index, 4); // SERIAL...
{ // Load the glyph data at the end of the buffer target = &((uint8_t *)g->data)[CACHE_GLYPH_SIZE - glyph_size_bytes]; }
else { target = (uint8_t *)g->data; } SYS_PROFILER_NODE_START(text_render_flash); size_t num_bytes_loaded = sys_resource_load_range(font_res->app_num, font_res->resource_id, bitmap_addr, target, glyph_size_bytes); SYS_PROFILER_NODE_STOP(text_r...
s(&file); int i = j % 255; snprintf((char *)key, sizeof(key), "k%03d", i); snprintf((char *)val, sizeof(val), "v%03d", i); printf("Iteration %d key %s val %s\n", i, key, val); set_and_verify(&file, key, key_len, val, val_len); // delete the first iteration if (j < 255) { settings_file_...
(settings_file_get(&file_new, key, key_len, val_out, val_len_out))
; if (val_len_out == original_value_length) { printf("original! %d\n", original_value_length); cl_assert_equal_m(original_value, val_out, val_len_out); free(val_out); return RecordResultOld; } else if (val_len_out == new_value_length) { printf("new! %d\n", new_value_length); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
rtc_get_time()
; struct tm time; localtime_r(&t, &time); if (time.tm_sec == 0) { // If the phone sets the time, we may actually skip a regular_timer minute callback. Let's // get an idea of how often this happens by logging const time_t now_ts = rtc_get_ticks() / configTICK_RATE_HZ; if ((now_ts - s_last_minute_f...
_source_get_node_icon(&data->data_source, node); const char *subtitle = (data->active_watchface_id == node->install_id) ? i18n_get("Active", data) : NULL; const GCompOp op = (gbitmap_get_format(bitmap) == GBitmapFormat1Bit) ? GCompOpTint : GCompOpSet; graphics_context_set_compositing_mode(ctx, op); // T...
{ handle_init(); app_event_loop(); }
#else static void s_main(void) {} #endif // !TINTIN_FORCE_FIT const PebbleProcessMd* watchfaces_get_app_info() { static const PebbleProcessMdSystem s_app_md = { .common = { .main_func = s_main, // UUID: 18e443ce-38fd-47c8-84d5-6d0c775fbe55 .uuid = {0x18, 0xe4, 0x43, 0xce, 0x38, 0xfd, 0x47, 0xc...
Uninitialized: // the lock isn't even created yet - should never get here // fallthrough default: WTF; } led_disable(LEDEnablerHRM); analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_HRM_ON_TIME); } // NOTE: the caller must hold the device's state lock static void prv_enable(HRMDevice *dev) ...
{ PBL_LOG(LOG_LEVEL_ERROR, "Failed reading status"); return false; }
itmap, &box); } static void prv_draw_arrows(Layer *layer, GContext *ctx) { DisplayCalibrationData *data = window_get_user_data(layer_get_window(layer)); switch (data->state) { case DisplayCalibrationState_X_Adjust: if (data->offset.x > -MAX_OFFSET_MAGNITUDE) { prv_draw_arrow(layer, ctx, &data->a...
{ palette[i].argb = (bitmap->palette[i].argb & 0xc0) | (GColorCyan.argb & 0x3f); }
gbitmap_set_palette(bitmap, palette, true /* free on destroy */); } void settings_display_calibration_push(WindowStack *window_stack) { DisplayCalibrationData *data = task_zalloc_check(sizeof(DisplayCalibrationData)); *data = (DisplayCalibrationData) { .offset = shell_prefs_get_display_offset() }; shel...
/* * 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_analytics_inc(ANALYTICS_APP_METRIC_ACCEL_SHAKE_COUNT, AnalyticsClient_CurrentTask)
; } state->shake_handler(e->accel_tap.axis, e->accel_tap.direction); } // ---------------------------------------------------------------------------------------------- static void prv_do_double_tap_handle(PebbleEvent *e, void *context) { PebbleTask task = pebble_task_get_current(); AccelServiceState *state =...
/* * 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...
(buffer, "test_model")
; { char long_string[] = "01234567890123456789"; mfg_info_set_model(long_string); // We only expect to see the first 15 (MFG_INFO_MODEL_STRING_LENGTH - 1) characters mfg_info_get_model(buffer); cl_assert_equal_s(buffer, "012345678901234"); } } void test_snowy_mfg_info__1_to_2_conversion(void)...
(state, animation)
)) { // It's possible the stopped handler rescheduled, so check before we destroy it prv_unlink_and_free(state, animation); } } // ------------------------------------------------------------------------------------------- // Low level schedule of an animation, no recursion static void prv_schedule_low_leve...
------------------------------------------------------------------------------------------------- //! Extern'd interface for protocol.c // ------------------------------------------------------------------------------------------------- bool comm_session_has_capability(CommSession *session, CommSessionCapability capa...
prv_is_transport_type(transport, implementation, CommSessionTransportType_PULSE)
) { if (!existing_system_session->transport_imp->close) { // iAP sessions cannot be closed from the watch' side :( PBL_LOG(LOG_LEVEL_ERROR, "System session already exists and cannot be closed"); return NULL; } // Last system session to connect wins: // 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...
cl_assert_equal_i(b->data[2], b3)
sert_equal_i(activity_metrics_prv_get_active_calories(), 22 * ACTIVITY_CALORIES_PER_KCAL); activity_metrics_prv_set_metric(ActivityMetricRestingKCalories, Thursday, 2000); activity_metrics_prv_set_metric(ActivityMetricRestingKCalories, Wednesday, 44); activity_get_metric(ActivityMetricRestingKCalories, 2, metric...
(ActivitySessionType_Sleep)
update_timezone(&tz_info); // Start activity tracking. This method assumes it can be called from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); // Feed in 100 steps/min over 10 minute...
activity_prefs_set_height_mm((int)(params->height_in * 25.4))
xt, &s_context); prv_assert_dict_equal(failed, &s_expected_iter); s_failure_result = reason; // When the outbox failed callback is called, the outbox should be in the // ACCEPTING state again. cl_assert_equal_b(app_message_is_accepting_outbound(), true); } static void prv_in_received_callback(DictionaryIter...
{ return 600; }
void sys_app_pp_app_message_analytics_count_drop(void) { } bool sys_get_current_app_is_js_allowed(void) { return false; } Version sys_get_current_app_sdk_version(void) { return (Version) {}; } static uint16_t s_sent_endpoint_id; static uint8_t *s_sent_data; static uint16_t s_sent_data_length; void prv_send_da...
/* * 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...
analytics_set(ANALYTICS_APP_METRIC_FLASH_WRITE_BYTES_COUNT, s_analytics_write_bytes_count, AnalyticsClient_App)
; // The overhead cost of tracking whether each flash read was due to the foreground // or background app is large, so the best we can do is to attribute to both of them if (worker_manager_get_current_worker_md() != NULL) { analytics_set(ANALYTICS_APP_METRIC_FLASH_READ_COUNT, s_analytics_re...
d, green, blue) GColorARGB8FromRGBA(red, green, blue, 255) #define GColorARGB8FromHEX(v) \ GColorARGB8FromRGB(((v) >> 16) & 0xff, ((v) >> 8) & 0xff, ((v) & 0xff)) // if performance ever becomes an issue with this, we can sort the names and to a binary search T_STATIC const RockyAPIGraphicsColorDefinition s_color_def...
(0xfffacd)
}, {"lightblue", GColorARGB8FromHEX(0xadd8e6)}, {"lightcoral", GColorARGB8FromHEX(0xf08080)}, {"lightcyan", GColorARGB8FromHEX(0xe0ffff)}, {"lightgoldenrodyellow", GColorARGB8FromHEX(0xfafad2)}, // {"lightgray", GColorARGBFromHEX(0xd3d3d3)}, inconsistent with Pebble color {"lightgreen", GColorARGB8FromHEX(0x...
uns at 100Mhz // and we need to be efficient in handling the data to use it to its full capability. // // So this function is broken into 3 parts: // 1. Do reads 1 byte at a time until buffer_ptr is word-aligned // 2. Do 32-bit DMA transfers for as much as possible // 3. Do reads 1 bytes at a time to deal w...
QSPI_AutoPollingMode_Config(should_be_set ? bit_mask : 0, bit_mask, QSPI_PMM_AND)
; QSPI_AutoPollingModeStopCmd(ENABLE); prv_set_ddr_enabled(false); // Prepare transaction uint32_t modes_bitset = 0; modes_bitset |= QSPI_ComConfig_FMode_Auto_Polling; modes_bitset |= QSPI_ComConfig_DMode_4Line; modes_bitset |= QSPI_ComConfig_IMode_4Line; modes_bitset |= instruction; prv_set_comm_co...
/* * 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 (bt_test_bt_sig_rf_test_mode()) { app_data->test_state = BtTestStateStarted; } else { app_data->test_state = BtTestStateFailed; }
break; } case BtTestStateStopping: { PBL_ASSERTN(bt_ctl_is_bluetooth_active()); app_data->test_state = BtTestStateStopped; break; } case BtTestStateStopped: case BtTestStateStarted: break; default: WTF; } process_manager_send_callback_event_to_process(Pe...
/* * 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...
(request, LCP_HEADER_LEN)
; } static void prv_send_configure_ack(PPPControlProtocol *this, struct LCPPacket *triggering_packet) { if (ntoh16(triggering_packet->length) > pulse_link_max_send_size()) { // Too big to send and truncation will corrupt the packet. PBL_LOG(LOG_LEVEL_ERROR, "Configure-Reque...
BLEDescriptor descriptor_ref, GAPLEConnection **connection_out); // ------------------------------------------------------------------------------------------------- // Function implemented by the gatt_client_operations module to write...
if (LIKELY(write_space >= required_length)) { if (UNLIKELY(did_stall)) { PBL_LOG(LOG_LEVEL_DEBUG, "GATT notification stalled for %d ms...", (int)(timeout_ms - ticks_to_milliseconds(timeout_end_ticks - rtc_get_ticks()))); analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_GATT_STALLED_NOTIFI...
clude "kernel/pbl_malloc.h" #include "mfg/mfg_mode/mfg_factory_mode.h" #include "mfg/results_ui.h" #include "process_management/app_manager.h" #include "process_management/pebble_process_md.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "resource/system_resource.h" #i...
(radial_padding_size, layer->bounds.size.h / 2)
attribute_get_uint32_list(&attr_list, AttributeIdMetricIcons)
; for (int i = 0; i < metric_values->num_values; i++) { cl_assert_equal_i(metric_values->values[i], other->values[i]); } const size_t serialized_size = attribute_list_get_serialized_size(&attr_list); cl_assert_equal_i(serialized_size, 19); uint8_t serialized_buffer[serialized_size]; attribute_list_seri...
{ -1792, 608, -776}, { -1400, 24, -136}, { -1184, -48, -176}, { -1040, 256, -264}, { -952, 24, 0}, { -672, 32, -8}, { -648, 184, 0}, { -792, 248, 32}, { -824, 248, -56}, { -680, 280, -136}, // 31 seconds { -600, 320, -176}, { -656, 304, -200}, { -680, 384, -208},...
// 36 seconds { -416, 424, -552}, { -904, 408, -256}, { -1072, 120, -328}, { -1024, 168, -360}, { -1792, 1160, -1184}, { -1992, -216, 136}, { -1432, 112, -144}, { -1040, -72, -80}, { -712, -80, 48}, { -464, 32, 72}, { -496, 72, 0}, { -568, -72, 64}, { -992, 240, -...
{ -832, 1552, -720}, { -1136, 792, -456}, { -1784, 1080, -400}, { -1608, 280, -24}, { -1184, -208, 16}, { -1040, -664, 312}, { -1512, -344, 112}, { -1488, -320, 104}, { -1312, 96, -200}, { -1016, 232, -232}, { -736, 200, -200}, // 39 seconds { -568, 184, -120}, {...
/* * 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 (delete_file) { pfs_remove(ORDER_FILE); }
mutex_unlock(s_data.order_mutex); return storage; } //! Should be called on system task. static void prv_app_order_write_order(AppMenuOrderStorage *storage) { mutex_lock(s_data.order_mutex); int storage_size = sizeof(AppMenuOrderStorage) + (storage->list_length * sizeof(AppInstallId)); int fd = pfs_open(...
/* * 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 ((timeout_attempts-- > 0) && (bus->busy));
bus->busy = false; return (timeout_attempts != 0); } static void semaphore_give(I2cBus *bus) { } /*-------------------BUS/PIN CONFIG FUNCTIONS--------------------------*/ //! Configure bus power supply control pin as output //! Lock bus and peripheral config access before configuring pins void i2c_bus_rail_ctl_...
0, -56}, { 1192, 304, 56}, { 1736, 400, 104}, { 1344, 528, 40}, { 1104, 328, 72}, { 1112, 176, 184}, { 1216, 136, 264}, { 1032, 88, 232}, { 952, 24, 232}, { 968, 32, 216}, { 912, -16, 184}, // 58 seconds { 848, -32, 136}, { 888, -80, 120}, { 920, -136, 80}, { ...
{ 1296, -16, 88}, { 1616, -56, 120}, { 1120, 88, 104}, { 776, 224, -112}, { 880, 216, -152}, { 824, 184, 16}, { 792, 152, 24}, { 840, 240, -48}, { 944, 280, -24}, { 880, 320, -64}, { 832, 304, -112}, { 856, 312, -136}, { 1048, 232, -40}, { 1296, 192, 56}, { 16...
{ 1120, 160, 96}, { 984, 72, 112}, { 728, 88, 48}, { 688, 96, 0}, { 664, 56, 8}, { 736, 8, 32}, { 864, 8, 8}, { 1024, -24, -16}, { 1144, 0, -56}, { 1160, -104, -80}, { 1696, -128, 104}, { 1288, 168, 0}, { 1008, 248, -176}, { 912, 240, -112}, { 680, 144, 64}, ...
icense 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 "services/common/regular_timer.h" #include "os/mutex.h" #include "services/common...
{ PBL_ASSERTN(s_callback_list_semaphore == 0); s_callback_list_semaphore = mutex_create(); time_t seconds; uint16_t milliseconds; rtc_get_time_ms(&seconds, &milliseconds); s_timer_id = new_timer_create(); bool success = new_timer_start(s_timer_id, 1000-milliseconds, timer_callback_initializing, NULL, 0 ...
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 governing p...
bt_test_reset_callback(app_data)
; } } } static void config_provider(Window *window) { // single click / repeat-on-hold config: window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler) select_single_click_handler); window_single_click_subscribe(BUTTON_ID_BACK, (ClickHandler) back_single_click_handler); } static void handle_init() {...
able_dialog.h" #include "applib/ui/dialogs/simple_dialog.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/system_icons.h" #include "popups/ble_hrm/ble_hrm_stop_sharing_popup.h" #include "resource/resource_ids.auto.h" #include "services/common/analytics/analytics.h" #include "services/common/bluetooth/bluetooth_per...
(connection)
; app_simple_dialog_push(ble_hrm_stop_sharing_popup_create()); } #endif // CAPABILITY_HAS_BUILTIN_HRM void settings_remote_menu_push(struct SettingsBluetoothData *bt_data, StoredRemote *stored_remote) { SettingsRemoteData *data = app_malloc_check(sizeof(SettingsRemoteData)); PBL_LOG(LOG_LEVEL_DEBUG, "NAME: %s...
true /* is_granted */); // Expect HRM manager to be subscribed to: cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 1); prv_assert_event_service_subscribed(true); cl_assert_equal_b(true, ble_hrm_is_sharing_to_connection(&s_conn_a)); // Device A subscribes again, should be a no-op, no new ...
ble_hrm_is_sharing()
progress fill // overlaps the outline and things look weird health_progress_bar_outline(ctx, &data->progress_bar, PROGRESS_OUTLINE_COLOR); } static void prv_render_icon(GContext *ctx, Layer *base_layer) { HealthSleepSummaryCardData *data = layer_get_data(base_layer); const int y = PBL_IF_RECT_ELSE(PBL_IF_BW_...
layer_get_data(base_layer)
; layer_set_update_proc(base_layer, prv_base_layer_update_proc); // set health data *health_sleep_summary_card_data = (HealthSleepSummaryCardData) { .icon = kino_reel_create_with_resource(RESOURCE_ID_HEALTH_APP_SLEEP), .progress_bar = { .num_segments = ARRAY_LENGTH(s_sleep_summary_progress_segments)...
_app_event_info; EventServiceInfo bt_connection_event_info; EventServiceInfo pebble_gather_logs_event_info; EventServiceInfo ble_device_name_updated_event_info; GettingStartedButtonComboState button_combo_state; } RecoveryFUAppData; // Unfortunately, the event_service_client_subscribe doesn't take a void *con...
{ #if PBL_BW && !PLATFORM_TINTIN // Override the icon to use the fullscreen version icon_res_id = RESOURCE_ID_RECOVERY_LAUNCH_APP; icon_x_offset = 0; icon_y_offset = 0; url_string = ""; // URL is baked into the background image background = GColorWhite; #else url_string = "pebble.com/sos"; ...
else { url_string = "pebble.com/app"; background = PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite); } // Create the icon KinoReel *icon_reel = kino_reel_create_with_resource(icon_res_id); if (!icon_reel) { PBL_CROAK("Couldn't create kino reel"); } // Position the icon kino_area = GRect(icon...
w_layer, text_layer_get_layer(&data->info_text)); } static void prv_kcc_window_unload(Window *window) { SystemCertificationData *data = (SystemCertificationData *) window_get_user_data(window); prv_deinit_status_bar(&data->status_layer); bitmap_layer_deinit(&data->bmp_layer); text_layer_deinit(&data->title_tex...
settings_factory_reset_window_push()
; break; default: WTF; } settings_menu_reload_data(SettingsMenuItemSystem); } static uint16_t prv_num_rows_cb(SettingsCallbacks *context) { return SystemMenuItem_Count; } static Window *prv_init(void) { SettingsSystemData *data = app_malloc_check(sizeof(SettingsSystemData)); *data = (Setting...
static void prv_fail_then_reset_if_no_active_recognizers(RecognizerManager *manager) { bool other_recognizers_active = prv_fail_other_recognizers(manager); // Reset if all recognizers are complete or failed if (!recognizer_is_active(manager->triggered) && !other_recognizers_active) { prv_reset(manager); } ...
(root, &touch_event->start_pos)
: NULL; if (new_active_layer == root) { new_active_layer = NULL; } if (manager->state == RecognizerManagerState_WaitForTouchdown) { manager->state = RecognizerManagerState_RecognizersActive; manager->active_layer = new_active_layer; } else if (new_active_layer != manager->active_laye...
nst GRect draw_box = { .origin = gpoint_add(ctx->draw_box->origin, ctx->gcontext->draw_state.drawing_box.origin), .size = ctx->draw_box->size, }; grect_clip(&ctx->gcontext->draw_state.clip_box, &draw_box); } } static void prv_iter_did_draw(GTextNodeDrawContext *ctx, GTextNodeDrawContext *parent_c...
(ctx->node)
->is_container) { // This is a container, ascend a level into its first child if it has one GTextNodeContainer *container = (GTextNodeContainer *)ctx->node; if (container->num_nodes > 0) { contexts[++level].node = container->nodes[0]; continue; } } else { ...
{ const uint32_t res_id = prv_get_sys_resource_id(timeline_id, size); const bool success = (res_id != RESOURCE_ID_INVALID); if (success && res_info) { *res_info = (AppResourceInfo) { .res_app_num = SYSTEM_APP, .res_id = res_id, }; } return success; }
bool timeline_resources_is_system(TimelineResourceId timeline_id) { return (timeline_id & SYSTEM_RESOURCE_FLAG); } bool timeline_resources_get_id_system(TimelineResourceId timeline_id, TimelineResourceSize size, ResAppNum res_app_num, AppResourceInfo *res_info_out) { if (siz...
ecognizerManager *manager) { PBL_ASSERTN(recognizer); recognizer->manager = manager; } RecognizerManager *recognizer_get_manager(Recognizer *recognizer) { PBL_ASSERTN(recognizer); return recognizer->manager; } ////////////////////////////////////////////////////////////////////////////////////////////////////...
iter_cb((Recognizer *)node, context)
) { return false; } node = next; } return true; }
_by_type(CommSessionTypeApp), session); comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection); fake_system_task_callbacks_invoke_pending(); // get dls called cl_assert_equal_b(s_dls_private_handle_disconnect_called, false); cl_assert_equal_b(s_comm_session_event_put, false); } void test_s...
comm_session_send_next(session)
.w = frame_size.w, }, }, }, }; layer_add_child(&menu_layer->scroll_layer.content_sublayer, &render_iter->cell_layer); // Set separator color graphics_context_set_fill_color(ctx, GColorBlack); // We're caching the y-coord and index of the one row, as our "anchor" point in the menu...
if (false == it->cache_set) { // Prime the cursor cache: it->it.menu_layer->cache.cursor = it->it.cursor; // Set initial selection too: it->it.menu_layer->selection = it->it.cursor; it->cache_set = true; }
} //! Calculate the total height of all row cells and section headers, //! and assign the appropriate content size to the scroll_layer. //! Also prime the offset cache on the fly. void menu_layer_update_caches(MenuLayer *menu_layer) { // Save the currently selected cell index. MenuIndex selected_index = menu_laye...
_malloc_init(); fake_kernel_malloc_enable_stats(true); s_communication_timestamp_updated = false; } void test_app_message_receiver__cleanup(void) { fake_system_task_callbacks_cleanup(); fake_kernel_malloc_deinit(); } /////////////////////////////////////////////////////////////////////////////////////////////...
cl_assert_equal_b(false, s_kernel_receiver_is_receiving)
; cl_assert_equal_b(false, s_kernel_receiver_finish_called); cl_assert_equal_i(s_app_message_pp_received_length, 0); cl_assert_equal_b(true, s_communication_timestamp_updated); prv_destroy_inbox(); } void test_app_message_receiver__receive_push_buffer_overflow(void) { cl_assert_equal_b(true, app_message_r...
a vertically and automatically adds a page break on round static void prv_add_metric(TimelineLayout *layout, GTextNodeVertical *vertical_node, int index, GTextNode *metric_node) { graphics_text_node_container_add_child(&vertical_node->container, metric_node); #if PBL_ROUND if (index == M...
prv_set_text_node_extent(&custom->node, &config->extent)
/* * 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...
find_device_by_addr(&addr, true /* create */)
; dev->paired = true; dev->bonded = true; dev->is_gateway = bonding->is_gateway; dev->flags = bonding->flags; dev->mitm = info->is_mitm_protection_enabled; // The LTK that's used when the local device is the slave. if (info->is_remote_encryption_info_valid) { dev->ltk = prv_create_remote_ltk_from_in...
lse { map_val = BMI160_INT_MAP_1_INT2_FIFO_WATERMARK; int_en_val = BMI160_INT_EN_1_FWM_EN; } prv_read_modify_write(BMI160_REG_INT_MAP_1, map_val, map_mask); prv_read_modify_write(BMI160_REG_INT_EN_1, int_en_val, int_en_mask); BMI160_DBG("INT_MAP[1] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_MAP_1)); ...
{ // don't worry about the configuration registers but disable interrupts // generated for taps from the accel uint8_t dis_mask = BMI160_INT_MAP_ANYMOTION_EN_MASK; prv_read_modify_write(BMI160_REG_INT_MAP_0, 0, dis_mask); dis_mask = (BMI160_INT_EN_0_ANYMOTION_X_EN | BMI160_INT_EN_0_ANYMOTION_Y_EN | B...
as_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...
(id_3 != BT_BONDING_ID_INVALID)
; cl_assert_equal_i(s_ble_bonding_change_add_count, 3); cl_assert_equal_i(fake_shared_prf_storage_get_ble_store_count(), 2); // Read all three pairings 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_...
yout->transition_animation); timeline_layout_deinit_view(timeline_layout); prv_deinit_icon(timeline_layout); layer_deinit(&timeline_layout->layout_layer.layer); i18n_free_all(timeline_layout); } void timeline_layout_init_info(TimelineLayoutInfo *info, TimelineItem *item, time_t current_day) { *info = (Timeli...
kino_layer_set_alignment(icon_layer, GAlignLeft)
; } layer_add_child(&timeline_layout->layout_layer.layer, &icon_layer->layer); kino_layer_play(icon_layer); } static void prv_deinit_icon(TimelineLayout *layout) { kino_layer_deinit(&layout->icon_layer); } //////////////////////// // Layout Impl //////////////////////// GSize timeline_layout_get_content_size...
/* * 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...
(ctx, cell_layer, "Third Item", NULL, &app_data->checked_icon)
; break; case 3: menu_cell_basic_draw_icon_right(ctx, cell_layer, "Fourth Item", "with a subtitle", &app_data->checked_icon); break; } } static void menu_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *data) { return; } static int16_t...
_updated = true; dialog_utils_bd_address_to_bt_device(&evt->address, &e.device); dialog_utils_bd_address_to_bt_device(&evt->resolved_address, &e.new_device); // Also update the new address in the local connection list: Connection *connection = connection_by_idx_check(evt->conn_idx); connection_update_address...
PBL_LOG(LOG_LEVEL_DEBUG, "Setting local IRK:")
; PBL_HEXDUMP(LOG_LEVEL_DEBUG, (const uint8_t *)&config->root_keys[SMRootKeyTypeIdentity], sizeof(config->root_keys[SMRootKeyTypeIdentity])); ble_dev_params_t *dev_params = ble_mgr_dev_params_acquire(); memcpy(&dev_params->irk, &config->root_keys[SMRootKeyTypeIdentity], sizeof(dev_params->irk)); ...
/* * 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...
{ AmbientLightAppData *data = app_state_get_user_data(); prv_populate_amb_read_str(&data->ambient_reading[0]); layer_mark_dirty(window_get_root_layer(data->window)); app_timer_register(500, timer_callback, NULL); }
AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; static const PropertyAnimationImplementation implementation = { .base = { .update = (AnimationUpdateImplementation) property_animation_update_gcolor8, }, .accessors = { .setter = { .gco...
// Make sure our started and stopped handlers got called at cl_assert_equal_i(s_started_handler_calls.num_calls, 1);; cl_assert(s_started_handler_calls.entries[0].fired_time_ms - start_ms <= 1); cl_assert(s_started_handler_calls.entries[0].context == context); cl_assert_equal_i(s_stopped_handler_calls.num_ca...
// -------------------------------------------------------------------------------------- // Test that we can reschedule an animation after it completes and have it run again void test_animation__reschedule(void) { #ifdef TEST_INCLUDE_BASIC PropertyAnimation *prop_h; Layer layer; GRect from_r; GRect to_r; ...
rmined to be the point at which using the DMA // engine is advantageous #if !defined(TARGET_QEMU) const uint32_t num_reads_dma_cutoff = 34; #else // We are disabling DMA reads when running under QEMU for now because they are not reliable. const uint32_t num_reads_dma_cutoff = buffer_size + 1; #endif if (buffe...
handle_sleep_when_idle_begin()
; flash_write_enable(); flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_ERASE_BULK); flash_end_cmd(); flash_wait_for_write(); flash_prf_set_protection(true); disable_flash_spi_clock(); power_tracking_stop(PowerSystemFlashErase); flash_unlock(); } #endif void flash_sleep_when_idle(bool ...
pstring_get_pstring16_from_list(&pstring16_list, WeatherDbStringIndex_ShortPhrase); const bool is_valid_entry_update_time = (entry->last_update_time_utc != WEATHER_SERVICE_INVALID_DATA_LAST_UPDATE_TIME); const uint16_t location_pstring_length = location_pstring->str_length; if (!is_valid_entry_update_ti...
mutex_lock(s_mutex)
; weather_service_destroy_default_forecast(s_default_forecast); s_default_forecast = NULL; WeatherDBKey default_location_key; if (!prv_get_default_location_key(&default_location_key)) { goto cleanup; } const int entry_len = weather_db_get_len((uint8_t *)&default_location_key, ...
/* * 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...
(window, prv_click_config_provider, data)
; window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); const bool animated = true; app_window_stack_push(window, animated); } static void handle_deinit(void) { struct AppState* data = app_state_get_user_data(); tick_timer_service_unsubscribe(); app_free(data); } static...
lor(ctx, colors.bg_color); const int32_t saved_clip_box_size_h = ctx->draw_state.clip_box.size.h; const int32_t saved_clip_box_origin_y = ctx->draw_state.clip_box.origin.y; ctx->draw_state.clip_box.origin.y = MAX(ctx->draw_state.clip_box.origin.y - STATUS_BAR_LAYER_HEIGHT, 0); ctx->draw_state.clip_box.siz...
(layout->view_size.h, LAYOUT_HEIGHT)
; // Notifications are swapped using frame height, so last page includes additional arrow height layout->view_size.h += LAYOUT_ARROW_HEIGHT; #else layout->view_size.h += CARD_BOTTOM_PADDING; #endif } static void prv_card_render(NotificationLayout *layout, GContext *ctx, bool render) { if (!layout->view_node) {...
8, -136, -992}, { -168, -128, -992}, { -160, -128, -992}, // 233 seconds { -152, -144, -1008}, { -168, -176, -1032}, { -168, -128, -968}, { -160, -112, -976}, { -168, -112, -984}, { -176, -136, -1016}, { -168, -120, -984}, { -168, -104, -984}, { -184, -120, -992}, { -...
{ -168, -136, -992}, // 238 seconds { -160, -152, -992}, { -160, -136, -1000}, { -160, -128, -992}, { -160, -120, -992}, { -160, -144, -1000}, { -160, -144, -992}, { -152, -128, -1000}, { -160, -136, -1000}, { -160, -136, -976}, { -160, -120, -992}, { -168, -144, -100...
{ -160, -136, -992}, { -152, -136, -992}, { -160, -128, -992}, { -168, -128, -1000}, { -168, -136, -976}, { -152, -128, -1000}, { -152, -128, -992}, { -160, -128, -1000}, { -168, -136, -992}, { -160, -136, -992}, { -160, -128, -992}, { -160, -136, -1000}, { -168, -13...
tr_t)0, 0); prompt_command_continues_after_returning(); } void command_btle_unmod_tx_start(char *tx_channel) { bt_driver_start_unmodulated_tx(atoi(tx_channel)); } void command_btle_unmod_tx_stop(void) { bt_driver_stop_unmodulated_tx(); } void command_btle_test_le_tx_start( char *tx_channel, char *tx_packe...
GPoint(0, DISP_ROWS/3)
, GPoint(DISP_COLS, DISP_ROWS)); // ~53 degrees graphics_draw_line(ctx, GPoint(DISP_COLS/4, 0), GPoint(DISP_COLS, DISP_ROWS)); // ~39 degrees graphics_draw_line(ctx, GPoint(0, DISP_ROWS/5), GPoint(DISP_COLS, DISP_ROWS)); profiler_stop(); uint32_t total_time = profiler_get_total_duration(false); uint32_t ...
cs_service_uuid, .characteristic_uuids = s_ancs_characteristic_uuids, .num_characteristics = NumANCSCharacteristic, .handle_service_discovered = ancs_handle_service_discovered, .handle_service_removed = ancs_handle_service_removed, .invalidate_all_references = ancs_invalidate_all_references, .ca...
PBL_LOG(LOG_LEVEL_INFO, "%s removed: %d", uuid_string, (int)removed)
; #endif int num_hdls = service_remove_info->num_descriptors + service_remove_info->num_characteristics; service_remove_info = (PebbleBLEGATTClientServiceHandles *)&service_remove_info->char_and_desc_handles[num_hdls]; } } static void prv_handle_all_services_invalidated(void) { for (int c =...
160}, { 576, -160, -248}, { 896, -80, -200}, { 1080, 0, -176}, { 1312, 168, -256}, { 1608, 112, -360}, { 1760, 200, -568}, { 1320, 240, -344}, { 1056, 224, -288}, { 1184, 384, -496}, { 1272, 480, -352}, { 1144, 552, -264}, { 1176, 880, -232}, { 1040, 976, -264}, {...
{ 760, -264, -176}, { 1400, -112, -56}, { 1256, -24, -264}, { 1320, 72, -304}, { 1376, 80, -408}, { 1224, 160, -336}, { 984, 240, -336}, { 896, 280, -320}, { 1040, 264, -280}, // 34 seconds { 1200, 408, -312}, { 1120, 632, -272}, { 1288, 664, -448}, { 1184, 792, -...
{ 888, 608, -536}, { 1328, 560, -528}, { 1440, 576, -632}, { 1720, 488, -584}, { 2000, 352, -368}, { 1840, 360, -224}, { 1416, 208, -120}, { 1160, 200, -208}, { 1072, 80, -200}, { 1048, 32, -144}, { 1040, -64, -200}, { 1128, 0, -96}, { 960, -120, -120}, { 832, -8...
/* * 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...
{ // discover everything node->hdl = (ATTHandleRange) { .start = MIN_ATT_HANDLE, .end = MAX_ATT_HANDLE }; }
if (!connection->discovery_jobs) { list_init(&node->node); connection->discovery_jobs = node; } else { list_append((ListNode *)connection->discovery_jobs, (ListNode *)node); } } void gatt_client_discovery_discover_range(GAPLEConnection *connection, ATTHandleRange *hdl_range) { bt_lock(); { ...
entityResolvingKey irk; BTDeviceInternal device; if (bt_persistent_storage_get_ble_pairing_by_id(ble_rem->bonding, &irk, &device, NULL)) { bt_lock(); GAPLEConnection *connection = gap_le_connection_find_by_irk(&irk); if (!connection) { connection = gap_le_connection_by_dev...
graphics_draw_text(ctx, le_string, font, box, GTextOverflowModeFill, GTextAlignmentRight, NULL)
; } if (is_sharing_heart_rate_string) { const int horizontal_margin = menu_cell_basic_horizontal_inset(); GRect box = grect_inset(cell_layer->bounds, GEdgeInsets(0, horizontal_margin)); box.origin.y += 38; box.size.h = 24; graphics_draw_text(ctx, is_sharing_heart_rate_string, font, box, ...
ww.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...
(buf, sizeof(buf), "Profiler ran for %"PRIu32" ticks (%"PRIu32" us) (start: %"PRIu32"; stop:%"PRIu32")", total, total / mhz, g_profiler.start, g_profiler.end)
value; info->get_key(file, (uint8_t *)&key, sizeof(uint32_t)); info->get_val(file, (uint8_t *)&value, sizeof(uint32_t)); cl_assert(value == desired_value); return true; } static void prv_test_settings_file_compaction(const bool manual) { // If manual is enabled, then the test will force a compaction every s...
(val, "v255", 5)
; cl_assert_equal_i(settings_file_set(&file, key, key_len, val, val_len), E_OUT_OF_STORAGE); int val_len_out = settings_file_get_len(&file, key, key_len); cl_must_pass(val_len_out); uint8_t *val_out = malloc(val_len_out); cl_assert_equal_i(settings_file_get(&file, key, key_len, val_out, val_len_out), E_DOES_N...
mation_private_using_legacy_2(state)) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. animation_legacy2_set_delay((AnimationLegacy2 *)animation_h, delay_ms); return true; } AnimationPrivate *an...
(curve < AnimationCurveCustomFunction)
; animation->curve = curve; return true; } // ------------------------------------------------------------------------------------------- AnimationCurve animation_get_curve(Animation *animation_h) { if (animation_private_using_legacy_2(NULL)) { // We need to enable other applib modules like scroll_layer, men...
PBL_LOG(LOG_LEVEL_WARNING, "Data logging full at boot. Clearing..."); // We reset all data logging here, including data logging for applications, // because an inability to allocate a new session means all 200+ session // IDs are exhausted, likely caused by a misbehaving app_hb. See discussion at: // h...
(app_hb, ANALYTICS_APP_METRIC_TIMESTAMP, timestamp)
; analytics_heartbeat_set(app_hb, ANALYTICS_APP_METRIC_TIME_INTERVAL, dt_ms); app_hb_node = (AnalyticsHeartbeatList*)app_hb_node->node.next; } prv_dls_log(device_hb, app_hbs); } // Launcher task callback used to create our event logging session. static void prv_create_event_session_cb(void *ignored) { ...
/* * 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 (!ctx) { return false; }
// Stop any recording graphics_context_mask_record(ctx, NULL); // If a valid mask is set, the default draw implementation routines will respect it ctx->draw_state.draw_mask = mask; return true; #else return false; #endif } void graphics_context_mask_destroy(GContext *ctx, GDrawMask *mask) { #if CAPABIL...
o_app_event = (PebbleEvent) {0}; // Now the app sets the safe_to_kill flag to true and sends a kill event back to // the launcher to get the app killed again. This calls close_current_app, which ends // up launching s_third_party_app because it's in the next app slot. app_manager_get_task_context()->safe_to_ki...
app_exit_reason_get()
, default_exit_reason); // Specify the exit reason to be that an action was performed successfully app_exit_reason_set(APP_EXIT_ACTION_PERFORMED_SUCCESSFULLY); // Check that closing the current app takes us to the watchface app_manager_get_task_context()->safe_to_kill = true; app_manager_close_current_app(t...
48, 968, 160}, { 64, 888, 248}, { 40, 920, 248}, { 40, 928, 280}, // 56 seconds { 16, 880, 296}, { 8, 888, 328}, { 8, 864, 320}, { 64, 872, 304}, { 56, 888, 304}, { 56, 896, 296}, { 80, 896, 248}, { 104, 920, 248}, { 64, 944, 272}, { 80, 960, 288}, { 64, 944, ...
{ 0, 904, 64}, { -24, 936, 128}, { -32, 944, 152}, { -32, 1024, 88}, { -24, 1016, -40}, { -72, 808, -144}, { -88, 688, -192}, { -168, 680, -160}, { -120, 640, -128}, { 24, 680, -368}, { 248, 808, -632}, { 328, 552, -880}, { 416, 600, -1016}, { 528, 592, -1072}, ...
{ -32, 752, -960}, { -160, 488, -840}, { 256, 536, -960}, { -56, 624, -920}, { 120, 656, -488}, { -80, 760, -352}, { -352, 1200, -368}, { -512, 856, -296}, { -368, 648, -664}, { -400, 336, -816}, { -288, 48, -1024}, { -120, -624, -1200}, { -200, -328, -592}, { -1...
_SIZE]; // Setup //////////////////////////////////////////////////////////////// void test_watch_app_prefs_db__initialize(void) { fake_spi_flash_init(0, 0x1000000); pfs_init(false); watch_app_prefs_db_init(); // Set up our test prefs with some random data SerializedSendTextPrefs *prefs = (SerializedSendTe...
watch_app_prefs_db_get_len(WEATHER_KEY, WEATHER_KEY_LEN)
, 0); } void test_watch_app_prefs_db__flush(void) { cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_text_prefs, sizeof(s_send_text_prefs)), S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_insert(WEATHER_KEY, WEATHER_KEY_LEN, s_weat...
}, { 112, 656, -608}, { 96, 672, -576}, { 112, 992, -728}, { 424, 912, -688}, { 384, 848, -616}, // 50 seconds { 320, 616, -488}, { 360, 496, -496}, { 456, 544, -528}, { 536, 584, -456}, { 496, 592, -448}, { 432, 656, -520}, { 392, 648, -576}, { 352, 632, -544}, ...
{ 24, 1056, -736}, { 264, 992, -688}, { 216, 808, -560}, { 160, 576, -488}, { 160, 520, -536}, { 248, 568, -600}, { 304, 592, -544}, { 232, 544, -536}, { 152, 544, -560}, { 96, 560, -592}, { 64, 608, -624}, { 56, 592, -600}, { 24, 592, -608}, { -16, 608, -600}, ...
{ 952, 8, -96}, { 920, 80, -232}, { 872, 64, -200}, { 832, 96, -328}, { 840, 32, -192}, { 984, 104, -368}, { 1040, 184, -480}, { 1104, 256, -448}, { 1128, 264, -456}, { 1096, 176, -440}, { 1064, 120, -352}, { 1040, 96, -336}, { 960, 40, -240}, { 992, 32, -192}, ...
_low) { // Restore data back to original if stuck at low occurred status = write_initial_pattern(false /*display_logs*/, false /*skip_base_addr*/, NULL /*base_addr*/); } VERIFY_TEST_STATUS(status); } if (stuck_at_low) { return FLASH_TEST_ERR_STUCK_AT_LO...
{ PBL_LOG(LOG_LEVEL_DEBUG, ">> Read 256KB, iteration: %d", iteration_count); }
} iteration_count++; } PBL_LOG(LOG_LEVEL_DEBUG, "Ran %d iterations", iteration_count); PBL_LOG(LOG_LEVEL_DEBUG, ">PASS - STRESS TEST 1"); return FLASH_TEST_SUCCESS; } /***********************************************************/ /******************* Perf Data Test Functions **************/ /*******...
/* * 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_add_status_bar_layer(dialog, &GRect(x, y, w, h))
; } x = left_margin_px; w = bounds->size.w - left_margin_px - right_margin_px; GTextAttributes *text_attributes = NULL; #if PBL_ROUND // Create a GTextAttributes for the TextLayer. Note that the matching // graphics_text_attributes_destroy() will not need to be called here, as the ownership // of text_a...
data->menu_layer); prv_update_text_layer_visibility(s_data); } // we don't handle reminders within the notifications app } /////////////////// // Window callbacks static void prv_window_appear(Window *window) { NotificationsData *data = window_get_user_data(window); prv_update_text_layer_visibility(data)...
(data->loaded_notification_list)
; prv_notification_list_deinit(data->notification_list); i18n_free_all(data); app_free(data); s_data = NULL; } static void prv_s_main(void) { prv_handle_init(); app_event_loop(); prv_handle_deinit(); } #else static void prv_s_main(void) {} #endif const PebbleProcessMd* notifications_app_get_info() {...
1240, 352, -336}, { 1200, 312, -272}, { 1256, 360, -208}, { 1384, 376, -144}, { 1192, 168, -16}, // 29 seconds { 1064, 208, -16}, { 1160, 192, -48}, { 1296, 272, -56}, { 1184, 192, 24}, { 1264, -24, 120}, { 1088, -8, 64}, { 856, -56, 88}, { 1072, 0, 256}, { 1184, ...
{ 1232, -24, 176}, { 1224, 152, -16}, { 1280, 64, -88}, { 1232, 176, -96}, { 1064, 200, -240}, { 816, 136, -160}, { 856, 224, -192}, { 1088, 232, -208}, { 1224, 304, -280}, { 1312, 400, -320}, { 1600, 760, -776}, { 1168, 408, -352}, { 1360, 184, -360}, { 1360, 560...
melineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast, s_feb_5_midnight + 11 * 60 * 60), 0); cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[2].header.id)); cl_assert(iter_next...
(iter_next(&iterator))
t__corner_radius(void) { // Test 0 radius cases cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornerNone, 0), 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornerNone, 2), 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornersAll, 0), 0); cl_assert_equal_i(prv_clamp_corner...
gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_clip_rect_aa.${BIT_DEPTH_NAME}.pbi")
); }
/* * 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...
app_state_get_window_stack()
); } // Loads the core dialog. Should be called from each dialog window's load callback. void dialog_load(Dialog *dialog) { if (dialog->vibe_on_show) { vibes_short_pulse(); } if (dialog->timeout != DIALOG_TIMEOUT_INFINITE) { dialog->timer = app_timer_register(dialog->timeout, prv_app_timer_callback, dia...
SerializedReminderAppPrefs *watch_app_prefs_get_reminder(void) { SerializedReminderAppPrefs *result = NULL; mutex_lock_recursive(s_watch_app_prefs_db.mutex); if (s_watch_app_prefs_db.is_cached_reminder_app_prefs_valid) { result = task_zalloc(sizeof(*result)); if (result) { *result = s_watch_app_pref...
{ len = settings_file_get_len(&s_watch_app_prefs_db.settings_file, key, key_len); prv_close_file_and_unlock_mutex(); }
return len; } status_t watch_app_prefs_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len) { if (!val_out) { return E_INVALID_ARGUMENT; } status_t rv = prv_lock_mutex_and_open_file(); if (rv == S_SUCCESS) { rv = settings_file_get(&s_watch_ap...
/* * 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 (!session) { PBL_LOG(LOG_LEVEL_ERROR, "No system session"); return; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(task == PebbleTask_Worker)
; return worker_state_get_plugin_service(); } } // --------------------------------------------------------------------------------------------------------------- // Lookup the plugin service index from the UUID. We store the index in the event structure instead of the UUID // so that we have payload room. sta...
don't launch if (!s_workers_enabled) { PBL_LOG(LOG_LEVEL_WARNING, "Workers disabled"); return false; } // if we are trying to start another worker, then we want to enable relaunches on crashes. s_worker_crash_relaunches_disabled = false; // If there is a different worker currently running, tell it ...
(task_name, sizeof(task_name), "Worker <%s>", process_metadata_get_name(s_worker_task_context.app_md))
; TaskParameters_t task_params = { .pvTaskCode = prv_worker_task_main, .pcName = task_name, .usStackDepth = stack_size / sizeof(portSTACK_TYPE), .pvParameters = entry_point, .uxPriority = (tskIDLE_PRIORITY + 1) | portPRIVILEGE_BIT, .puxStackBuffer = stack, }; PBL_LOG(LOG_LEVEL_DEBUG, "St...
CT_NO_CLIP, true, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); c...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 11); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY,...
-920}, { 376, 416, -912}, { 400, 392, -904}, { 408, 360, -904}, { 408, 344, -920}, { 392, 360, -920}, { 368, 352, -912}, { 384, 376, -904}, { 384, 400, -920}, { 384, 392, -896}, { 368, 376, -896}, { 368, 392, -904}, { 384, 376, -920}, { 376, 360, -896}, { 376, 416...
{ -944, 536, -240}, { -904, -288, -16}, { -880, -144, -184}, { -928, -56, -160}, { -896, 56, -232}, { -936, 32, -72}, { -944, -16, -16}, { -928, 24, -152}, { -928, 80, -280}, { -920, 72, -328}, // 85 seconds { -904, 32, -360}, { -904, 48, -376}, { -888, 64, -368},...
{ -912, 256, -232}, { -904, 224, -256}, { -888, 256, -296}, { -840, 240, -400}, { -864, 200, -408}, { -944, 240, -216}, { -1032, 336, -112}, { -896, 248, -144}, { -944, 144, -160}, { -920, 72, -272}, { -904, 160, -360}, { -912, 168, -408}, { -888, 96, -368}, { -8...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_workout_active__workout_render_open_workout(void) { s_workout_data = (WorkoutData) { .steps = 0, .duration_s = 84, .distance_m = 0, .avg_pace = health_util_get_pace(84, 0), .bpm = 92, .hr_zone = 0, }; WorkoutActiveWindow *active_window = workout_active_create_for_activity_...
d_glance); KinoReel *charging_indicator_icon = NULL_SAFE_FIELD_ACCESS(settings_glance, charging_indicator_icon, NULL); PBL_ASSERTN(charging_indicator_icon); if (render && charging_indicator_icon) { launcher_app_glance_structured_draw_icon(structu...
(buffer, settings_glance->battery_percent_text, buffer_size)
; buffer[buffer_size - 1] = '\0'; } } static GTextNode *prv_wrap_text_node_in_vertically_centered_container(GTextNode *node) { const size_t max_vertical_container_nodes = 1; GTextNodeVertical *vertical_container_node = graphics_text_node_create_vertical(max_vertical_container_nodes); vertical_contain...
lude "dbgserial.h" #include "drivers/rtc.h" #include "kernel/pbl_malloc.h" #include "pulse_protocol_impl.h" #include "system/logging.h" #include "system/passert.h" #include "util/likely.h" #include "services/common/system_task.h" #include <string.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> #define...
if (args.num_args != cmd->num_params) { char buffer[128]; prompt_send_response_fmt(buffer, sizeof(buffer), "Incorrect number of arguments: Wanted %u Got %u", cmd->num_params, args.num_args); goto done; }
if (cmd->num_params == 4) { ((CommandFuncFourParams) cmd->func)(args.args[0], args.args[1], args.args[2], args.args[3]); } else if (cmd->num_params == 3) { ((CommandFuncThreeParams) cmd->func)(args.args[0], args.args[1], args.args[2]); } else if (cmd->num_params == 2) { ((CommandFuncTwoParams) cmd->...
ineResourceSizeLarge); const bool use_status_bar = true; const bool use_simple_dialog = simple_dialog_does_text_fit(msg, DISP_FRAME.size, simple_dialog_icon_size, use_status_bar); SimpleDialo...
if (!data->progress_window) { const bool success = false; prv_cleanup_action_result(data, success); return; }
progress_window_init(data->progress_window); const int16_t max_fake_percent = 80; progress_window_set_max_fake_progress(data->progress_window, max_fake_percent); progress_window_set_callbacks(data->progress_window, (ProgressWindowCallbacks) { .finished = prv_progress_window_finished, }, data); progress...
, -992}, { -184, -136, -992}, { -168, -120, -992}, { -168, -128, -992}, { -168, -128, -992}, // 180 seconds // elapsed: 3 minutes { -176, -128, -992}, { -160, -120, -984}, { -160, -120, -992}, { -176, -128, -1000}, { -176, -128, -992}, { -168, -120, -992}, { -160, -13...
{ -176, -128, -992}, { -176, -128, -984}, { -168, -128, -984}, { -168, -144, -1000}, // 185 seconds { -176, -152, -1000}, { -176, -144, -984}, { -168, -128, -984}, { -168, -128, -992}, { -168, -128, -1000}, { -168, -136, -1000}, { -160, -144, -992}, { -168, -144, -992...
{ -168, -136, -992}, { -168, -112, -992}, { -168, -128, -992}, { -168, -136, -984}, { -168, -136, -992}, { -168, -128, -1000}, { -168, -120, -992}, { -168, -128, -992}, { -168, -136, -992}, { -168, -128, -992}, { -168, -128, -992}, { -168, -136, -992}, { -168, -128, ...
/* * 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...
{ uint32_t num_intervals; portENTER_CRITICAL(); { num_intervals = timer->num_samples ? timer->num_samples - 1 : 0; *average_ms_out = timer->average_ms; } portEXIT_CRITICAL(); return num_intervals; }