prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
---------------------------- // Sample captured: 2015-09-29 18:03:45 local AccelRawData *activity_sample_taking_vitamins(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME taking_vitamins //> TEST_EXPECTED 0 //> TEST_EXPECTED_MIN 0 //> TEST_EXPECTED_MAX 100 //> TES...
{ -48, 744, -592}, { -32, 800, -600}, { -24, 800, -544}, { -56, 632, -592}, { -72, 680, -576}, { -112, 768, -616}, // 6 seconds { -80, 776, -616}, { -48, 616, -632}, { -88, 784, -592}, { -104, 696, -640}, { -80, 688, -680}, { -72, 712, -624}, { -72, 632, -640}, ...
{ -168, 1136, -792}, { -432, 1008, -416}, { -536, 784, -112}, { -512, 696, 176}, { -368, 584, 320}, { -296, 464, 408}, { -208, 488, 600}, { -168, 448, 704}, { -176, 376, 808}, { -216, 328, 800}, { -256, 256, 896}, { -304, 248, 880}, { -328, 192, 896}, { -328, 176...
THOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/l...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r1_clip_nxny.${BIT_DEPTH_NAME}.pbi"))
; // Testing of the special cases for radius: // Radius of 3 - starting point for calculated edges setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_THREE); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MIN_CALCULATED); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap...
// Assign the individual bits for the capabilities that we support. versions_msg.capabilities.run_state_support = 1; versions_msg.capabilities.infinite_log_dumping_support = 1; versions_msg.capabilities.extended_music_service = 1; versions_msg.capabilities.extended_notification_service = 1; versions_msg.ca...
(buffer, sizeof(buffer), "MCU Serial: %08"PRIx32" %08"PRIx32" %08"PRIx32, mcu_serial[0], mcu_serial[1], mcu_serial[2])
; prompt_send_response_fmt(buffer, sizeof(buffer), "Boot:%"PRIu32"\nHW:%s\nSN:%s", boot_version_read(), hw_version, serial_number); ResourceVersion system_resources_version = resource_get_system_version(); prompt_send_response_fmt(buffer, sizeof(buffer), "Sy...
{ // Not scheduled, so analytics stopwatch would have been stopped analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_CONNECT_TIME, AnalyticsClient_System); }
prv_ancs_is_alive_schedule_next_check(); } static void prv_is_ancs_alive_response_timeout_launcher_task_cb(void *data) { if (!s_ancs_client) { return; } prv_reset_due_to_bt_error(); // Stop the wait for response timer prv_ancs_is_alive_stop_timer(); } static void prv_is_ancs_alive_response_timeout(...
ng_mode == GCompOpTintLuminance) { gcolor_tint_luminance_lookup_table_init(tint_color, tint_luminance_lookup_table); } const int16_t dest_begin_y = dest_rect.origin.y; const int16_t dest_end_y = grect_get_max_y(&dest_rect); const int16_t src_begin_y = src_bitmap->bounds.origin.y; const int16_t src_end_y ...
grect_get_max_y(&dest_rect)
; const int16_t src_begin_y = src_bitmap->bounds.origin.y; const int16_t src_end_y = grect_get_max_y(&src_bitmap->bounds); int16_t src_y = src_begin_y + src_origin_offset.y; // Default all compositing modes to GCompAssign except for GCompOpSet // and GCompOpOr. switch (compositing_mode) { case GCompOpA...
/* * 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...
DEFINE_SYSCALL(void, sys_current_process_schedule_callback, CallbackEventCallback async_cb, void *ctx)
{ // No userspace buffer assertion for ctx needed, because it won't be accessed by the kernel. PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = async_cb, .data = ctx, }, }; const PebbleTask task = pebble_task_get_current(); PBL_ASSERTN(task == PebbleTask...
ool async, uint8_t log_level, const char* src_filename, int src_line_number, const char* fmt, va_list args) { LogState *state = prv_get_log_state(); if (!state) { return; } va_list bin_args; va_copy(bin_args, args); pbl_log_binary_format(state->buffer, sizeof(state->buffer), l...
{ strcat(expanded_fmt_buffer, " %x"); // add a space }
} prv_sprintf_to_msg(msg, max_message_length, expanded_fmt_buffer, fmt_args); } } sys_pbl_log((LogBinaryMessage*) state->buffer, async); prv_release_log_state(state); } #endif /* PBL_LOGS_HASHED */ void pbl_log_vargs(uint8_t log_level, const char *src_filename, int src_line...
/* * 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...
{ int fd = pfs_open(name, op_flags, file_type, start_size); #if IS_BIGBOARD if (fd < 0) { // pmap, where'd you go, we miss you so?! PBL_HEXDUMP_D(LOG_LEVEL_INFO, LOG_LEVEL_INFO, (uint8_t *)s_pmap_fd_diagnostic_data, sizeof(s_pmap_fd_diagnostic_data)); test_infra_quarantine_board("pmap fi...
static int seek_map(int fd, SearchCallback callback, void *data) { pfs_seek(fd, sizeof(PersistMapHeader), FSeekSet); bool found = false; PersistMapIdField field; while (true) { int read_result = pfs_read(fd, (uint8_t *)&field, sizeof(field)); // short read, EOF, or check field to see if it matches ...
/* * 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_will_return(syscall_internal_check_return_address, true)
; s_user_start = 0x00; s_user_size = 0x20; memory_cache_flush((void*)0x0F, 0x2); cl_assert_equal_i(s_flush_addr, 0x00); cl_assert_equal_i(s_flush_size, 0x20); cl_assert_equal_i(s_invalidate_addr, 0x00); cl_assert_equal_i(s_invalidate_size, 0x20); cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Valid...
ssageChunkPayload)) { PBL_LOG(LOG_LEVEL_ERROR, "Chunk tuple too short to be valid!"); return false; } const size_t payload_size = (tuple->length - sizeof(PostMessageChunkPayload)); const bool is_expecting_first = (s_state.in.reassembly_buffer == NULL); if (chunk->is_first != is_expecting_first) { P...
{ // FIXME: Handle not being able to open inbox ?? WTF; }
dict_write_data(it, node->key, node->data, node->length); dict_write_end(it); PBL_ASSERTN(s_state.out.msg_type == OutboxMsgTypeNone); s_state.out.msg_type = OutboxMsgTypeControl; PBL_ASSERTN(APP_MSG_OK == app_message_outbox_send()); } static void prv_control_message_queue_add(uint32_t key, const void *dat...
/* * 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_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, current_value)
; } bool boot_bit_test(BootBitValue bit) { uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR); return (current_value & bit); } void boot_bit_dump(void) { PBL_LOG(LOG_LEVEL_DEBUG, "0x%"PRIx32, RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR)); } uint32_t boot_bits_get(void) { return RTC_ReadBackupR...
xt); typedef void (*GTextNodeDestroyMethod)(GTextNode *node); typedef void (*GTextNodeDrawMethod)(GTextNodeDrawContext *context); typedef bool (*GTextNodeAddChildMethod)(GTextNodeContainer *parent, GTextNode *child); typedef bool (*GTextNodeDrawChildMethod)(GTextNodeDrawContext *context, GTextNode *child_node); ty...
{ if (node && node->free_on_destroy) { task_free(node); } }
8, -144}, { 776, -104, -224}, { 1096, 40, -376}, { 1408, 104, -184}, { 1456, 336, -224}, { 1344, 296, -208}, { 1344, 360, -144}, { 1488, 520, -136}, { 1656, 656, -88}, { 1696, 768, 8}, { 1464, 896, -80}, { 928, 1232, 32}, { 752, 1296, 8}, { 936, 1336, 128}, { 1032...
{ 1000, 1408, -24}, { 928, 984, 0}, { 1256, 880, -144}, { 1496, 768, -120}, { 1680, 680, -56}, { 1576, 496, -16}, { 1448, 256, -40}, { 1464, 240, -80}, { 1560, 312, -104}, { 1656, 192, 80}, // 103 seconds { 1456, 176, 32}, { 1280, 64, 0}, { 1040, -600, 96}, { ...
{ 1160, 8, -296}, { 1240, 200, -184}, { 1248, 264, -192}, { 1328, 336, -192}, { 1592, 448, -136}, { 1888, 680, -112}, { 1608, 1000, 32}, { 1536, 760, -312}, { 968, 1288, 16}, { 632, 1360, -8}, { 880, 1400, 48}, { 1224, 968, -24}, { 1456, 816, -112}, { 1656, 720, ...
r_frozen); } static void prv_release_app_framebuffer(void) { // Inform the app that the render is complete and it is safe to write into its framebuffer again. PebbleEvent event = { .type = PEBBLE_RENDER_FINISHED_EVENT, }; process_manager_send_event_to_process(PebbleTask_App, &event); } void compositor_app...
(animation)
= weather_db_insert, .get_len = weather_db_get_len, .read = weather_db_read, .del = weather_db_delete, .flush = weather_db_flush, #else .disabled = true, #endif }, [BlobDBIdiOSNotifPref] = { .init = ios_notif_pref_db_init, .insert = ios_notif_pref_db_insert, .get_len = ios_notif_pre...
(key, key_len, val_out, val_len)
; } return E_INVALID_OPERATION; } status_t blob_db_delete(BlobDBId db_id, const uint8_t *key, int key_len) { if (!prv_db_valid(db_id)) { return E_RANGE; } const BlobDB *db = &s_blob_dbs[db_id]; if (db->del) { status_t rv = db->del(key, key_len); if (rv == S_SUCCESS) { blob_db_event_...
end; } } char time_start_text[64]; struct tm *local_tm = localtime(&time_start); strftime(time_start_text, sizeof(time_start_text), "%F %r", local_tm); char time_end_text[64]; local_tm = localtime(&time_end); strftime(time_end_text, sizeof(time_end_text), "%F %r", local_tm); APP_LOG(APP_LOG_LEV...
localtime(&utc_start)
; strftime(time_start_text, sizeof(time_start_text), "%F %r", local_tm); char time_end_text[64]; local_tm = localtime(&utc_end); strftime(time_end_text, sizeof(time_end_text), "%F %r", local_tm); if (num_minutes > 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Got %d minutes in %"PRIu32" ms: %s to %s", num_minute...
/ This is used if all subscribers are peek mode only, no FIFO needed } else if (num_samples == 0) { // Min FIFO setting is 1 deep num_samples = 1; } else if (num_samples > ACCEL_MAX_SAMPLES_PER_UPDATE) { num_samples = ACCEL_MAX_SAMPLES_PER_UPDATE; } accel_set_num_samples(num_samples); s_accel_samp...
{ PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = state->data_cb_handler, .data = state->data_cb_context, }, }; QueueHandle_t queue = pebble_task_get_to_queue(state->task); // Note: This call may fail if the queue is ful...
case PebbleTask_KernelBackground: return system_task_add_callback(state->data_cb_handler, state->data_cb_context); case PebbleTask_NewTimers: return new_timer_add_work_callback(state->data_cb_handler, state->data_cb_context); default: WTF; // Unsupported task for the accel manager } } ...
/* * 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...
((jerry_char_t *) buffer, buffer_size, false)
; } bool error_occurred = jerry_value_has_error_flag(rv); if (error_occurred) { jerry_value_clear_error_flag(&rv); rocky_log_exception("Evaluating JS", rv); } jerry_release_value(rv); return !(error_occurred); } static void prv_rocky_deinit(void) { app_heap_analytics_log_stats_to_app_heartbeat(...
f (s_next_app.md->process_storage != ProcessStorageFlash) { PBL_CROAK("Failed to start system app <%s>!", process_metadata_get_name(s_next_app.md)); } PBL_LOG(LOG_LEVEL_WARNING, "Failed to start app <%s>! Restarting launcher", process_metadata_get_name(s_next_app.md)); prv_app_start(syste...
app_manager_launch_new_app(&(AppLaunchConfig) { .md = app_fetch_ui_get_app_info(), .common.args = fetch_args, .common.transition = fetch_args->common.transition, .forcefully = fetch_args->forcefully, })
; } // ----------------------------------------------------------------------------------------- static AppInstallId prv_get_app_exit_reason_destination_install_id_override(void) { switch (s_app_task_context.exit_reason) { case APP_EXIT_NOT_SPECIFIED: return INSTALL_ID_INVALID; case APP_EXIT_ACTION_PER...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gbitmap_init_with_resource_system(&bitmap, 0, 0)
_uuid = {0x4d, 0xab, 0x81, 0xa6, 0xd2, 0xfc, 0x45, 0x8a, 0x99, 0x2c, 0x7a, 0x1f, 0x3b, 0x96, 0xa9, 0x70}; AppInstallId tictoc_id; AppInstallId music_id; AppInstallId sports_id; AppInstallId bg_counter_id; AppInstallId menu_layer_id; void test_app_install_manager__initialize(void) { ...
(bg_counter_id, &id_entry)
); cl_assert_equal_b(true, app_install_get_entry_for_uuid(&bg_counter.uuid, &uuid_entry)); cl_assert_equal_b(true, app_install_entries_equal(&id_entry, &uuid_entry)); cl_assert_equal_b(true, app_install_get_entry_for_install_id(menu_layer_id, &id_entry)); cl_assert_equal_b(true, app_install_get_entry_for_uuid(...
me as before): assert_num_message_callbacks(3); assert_message(2, s_test_data, BUFFER_SIZE); assert_num_dropped_callbacks(1); } void test_app_inbox__multiple_writes_consume_from_message_handler(void) { prv_create_test_inbox_and_begin_write(); // Message 1: cl_assert_equal_b(true, app_inbox_service_write...
(AppInboxServiceTagUnitTest)
); } void test_app_inbox__app_inbox_service_end_inbox_closed_in_mean_time_with_pending_failure(void) { prv_create_test_inbox_and_begin_write(); // One message, too large, so it should get dropped: cl_assert_equal_b(false, app_inbox_service_write(AppInboxServiceTagUnitTest, ...
9:05pm", "Yesterday 12:33pm" const size_t required_buf_size = sentence_len + date_time_len + 2 /* \n\n */ + 1 /* \0 */; data->dialog_text = app_zalloc_check(required_buf_size); // The string that is being built below looks something like: // "Take out the trash" // // "Tomorrow 7:00AM" int buf_space_rem...
("Reminders")
); WindowHandlers handlers = { .appear = prv_appear, }; window_set_window_handlers(window, &handlers); data->event_service_info = (EventServiceInfo) { .type = PEBBLE_DICTATION_EVENT, .handler = prv_handle_dictation_event, .context = data, }; event_service_client_subscribe(&data->event_service_in...
n: handler = prv_handle_ns_notification; break; case ANCSCharacteristicData: handler = prv_handle_ds_notification; break; default: WTF; } handler(value_length, value); } // ----------------------------------------------------------------------------- // Writing commands to the...
(sizeof(ANCSClient))
; buffer_init(&s_ancs_client->reassembly_ctx.buffer, sizeof(s_ancs_client->reassembly_ctx.buffer_storage)); ancs_app_name_storage_init(); } void ancs_destroy(void) { if (!s_ancs_client) { return; } analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_CONNECT_TIME); prv_ancs_...
/////////////////// // ActionableDialog with custom action bar static void prv_custom_action_bar_click_up(ClickRecognizerRef recognizer, void *context) { Dialog *dialog = context; dialog_set_text(dialog, "The text has changed!"); layer_mark_dirty(&dialog->text_layer.layer); } static void prv_custom_action_bar_c...
dialog_show_status_bar_layer(dialog, true)
; expandable_dialog_set_header(expandable_dialog, "Header"); app_expandable_dialog_push(expandable_dialog); } //////////////////////////////// // Expandable Dialog with header static void prv_show_expandable_dialog_no_action_bar(DialogsData *data) { ExpandableDialog *expandable_dialog = expandable_dialog_creat...
/* * 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...
bluetooth_pairing_ui_handle_event(&e->bluetooth.pair)
; return; default: return; } }
E_INVALID_ARGUMENT); // Invalid val length should fail const size_t invalid_val_size = sizeof(SerializedAppGlanceHeader) - 1; cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, (uint8_t *)&s_app_glance_basic, invalid_val_s...
((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, (uint8_t *)&app_glance_1, glance_1_size)
, S_SUCCESS); cl_assert_equal_i(app_glance_db_get_len((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE), glance_1_size); // Try to insert a different glance blob with an older creation time; this should fail SerializedAppGlanceHeader app_glance_2 = (SerializedAppGlanceHeader) {...
ionsData *data) { AlertMask mask = alerts_get_mask(); size_t cycle_len = ARRAY_LENGTH(s_alert_mode_values); size_t index = 0; // TODO PBL-24306: update once AlertMask logic is made safer for (size_t i = 0; i < cycle_len; i++) { if (s_alert_mode_values[i] == mask) { index = i; break; } } ...
_Static_assert(ARRAY_LENGTH(s_window_timeouts_ms) == ARRAY_LENGTH(s_window_timeouts_labels), "")
PBL_LOG(LOG_LEVEL_WARNING, "Session setup result for invalid session type received"); goto done; } if (result != VoiceEndpointResultSuccess) { prv_cancel_session(); VoiceStatus status = prv_get_status_from_result(result); PBL_LOG(LOG_LEVEL_WARNING, "Error occurred setting up session: %d", result)...
PBL_LOG(LOG_LEVEL_WARNING, "Received session result for non-app session when an app " "session result was expected")
; } prv_send_event(VoiceEventTypeSessionResult, VoiceStatusErrorGeneric, NULL); return false; } return true; } // receiving this ends the session, sending an event to the main task with the result void voice_handle_dictation_result(VoiceEndpointResult result, AudioEndpointSessionId session_id, ...
g LSE oscillator"); RCC_LSEConfig(RCC_LSE_ON); for (int i = 0; i < LSE_READY_TIMEOUT_MS; i++) { if (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 enab...
prv_bcd_to_byte((time_register & (RTC_TR_MNT | RTC_TR_MNU)) >> 8)
; const uint32_t seconds = prv_bcd_to_byte(time_register & (RTC_TR_ST | RTC_TR_SU)); return (((hours * 60) + minutes) * 60) + seconds; } static uint32_t prv_elapsed_ticks(uint32_t before, uint32_t after) { int32_t result = after - before; if (result < 0) { result = (TICKS_IN_INTERVAL - before) + after; ...
/* * 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...
PATTERN_FROM_DURATIONS(pat, LONG_PULSE_DURATIONS)
; vibes_enqueue_custom_pattern(pat); } void vibes_double_pulse(void) { VibePattern pat; PATTERN_FROM_DURATIONS(pat, DOUBLE_PULSE_DURATIONS); vibes_enqueue_custom_pattern(pat); } void vibes_cancel(void) { sys_vibe_pattern_clear(); } void vibes_enqueue_custom_pattern(VibePattern pattern) { if (pattern.dura...
se. */ #include "process_manager.h" #include "app_install_manager.h" #include "app_manager.h" #include "worker_manager.h" #include "applib/app_logging.h" #include "applib/accel_service_private.h" #include "applib/platform.h" #include "applib/rockyjs/rocky_res.h" #include "applib/ui/dialogs/dialog.h" #include "applib...
(xTaskGetCurrentTaskHandle())
; } } // --------------------------------------------------------------------------------------------- void process_manager_init(void) { s_deinit_timer_id = new_timer_create(); } // ----------------------------------------------------------------------------------------------------------- void process_manager_p...
econd animation, calling the b's transition init func. The animation // should not be scheduled as we're waiting for the interrupted app to render cl_assert_equal_i(s_count_animation_create, 2); cl_assert_equal_i(s_count_animation_schedule, 1); cl_assert_equal_i(s_count_compositor_init_func_a, 1); cl_assert_e...
cl_assert_equal_i(s_count_animation_create, 0)
; // Push a modal window with an animation and then pop it without an animation. The app still // shouldn't be ready. s_modal_window_present = true; compositor_transition(&s_transition_a); cl_assert_equal_i(s_count_animation_create, 1); s_modal_window_present = false; compositor_transition(NULL); // ...
; cl_assert(GColorRed.b == 0b00); cl_assert(GColorRed.a == 0b11); } void test_graphics_colors__green(void) { cl_assert(GColorGreen.r == 0b00); cl_assert(GColorGreen.g == 0b11); cl_assert(GColorGreen.b == 0b00); cl_assert(GColorGreen.a == 0b11); } void test_graphics_colors__blue(void) { cl_assert(GColorB...
cl_assert_equal_i(GColorClearARGB8, gcolor_get_bw(GColorClear).argb)
/* * 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...
string_list_count(list)
); list->serialized_byte_length = 3; // 4 empty strings cl_assert_equal_i(4, string_list_count(list)); cl_assert_equal_s("", string_list_get_at(list, 0)); cl_assert_equal_s("", string_list_get_at(list, 1)); cl_assert_equal_s("", string_list_get_at(list, 2)); cl_assert_equal_s("", string_list_get_at(list,...
/* * 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, (WindowHandlers) { .unload = unload_handler, })
; window_set_click_config_provider(window, click_config_provider); s_next_window_fullscreen = !s_next_window_fullscreen; window_stack_push(window, true); } int main(void) { push_window(); app_event_loop(); }
typical_start, sleep_start); } else { health_progress_bar_mark(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, typical_start); } const bool woke_up_early = (typical_sleep_end_24h > sleep_end_24h); if (woke_up_early) { health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_...
("No sleep data,\nwear your watch\nto sleep", base_layer)
; graphics_context_set_text_color(ctx, NO_DATA_TEXT_COLOR); graphics_draw_text(ctx, text, data->typical_font, rect, GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } static bool prv_has_sleep_data(HealthData *health_data) { // daily weekly stats doesn't include the first index so we...
{ 1032, 80, 40}, { 1080, 96, 64}, { 984, 168, 24}, { 920, 192, 40}, { 856, 160, 56}, { 816, 152, 80}, { 800, 80, 112}, { 792, 72, 104}, { 816, 88, 80}, { 888, 128, 128}, { 920, 176, 112}, { 912, 184, 24}, { 920, 192, -88}, { 1256, 184, 56}, { 1088, 152, -8}, ...
{ 872, 64, 32}, { 960, 48, 104}, { 952, 112, 96}, { 896, 160, 32}, { 840, 176, -40}, { 824, 120, -64}, { 840, 184, -80}, { 816, 144, -72}, { 808, 136, -88}, { 936, 152, -40}, { 1064, 184, 8}, { 1072, 168, 96}, { 1304, 152, 144}, { 1224, 200, 152}, { 1040, 128,...
{ 848, 216, -104}, { 832, 176, -120}, { 928, 176, -104}, { 984, 296, 40}, { 1000, 144, 136}, { 1288, 112, 152}, { 1256, 192, 112}, { 1080, 200, 56}, { 1072, 104, 64}, { 1064, 112, 64}, { 912, 128, 16}, { 840, 128, 16}, { 816, 112, 16}, { 816, 88, 64}, { 816, ...
e_attract_to_square(l, t += dt); gdraw_command_image_draw(&ctx, l, GPoint(48, 48)); l = weather_app_resource_create_sun(); gdraw_command_image_attract_to_square(l, t += dt); gdraw_command_image_draw(&ctx, l, GPoint(0, 96)); l = weather_app_resource_create_sun(); gdraw_command_image_attract_to_square(l, t ...
gdraw_command_image_scale_segmented_to(l, from, to, t += dt, interp, index_lookup, f, false)
; gdraw_command_image_draw(&ctx, l, GPoint(0, 96)); l = weather_app_resource_create_sun(); gdraw_command_image_scale_segmented_to(l, from, to, t += dt, interp, index_lookup, f, false); gdraw_command_image_draw(&ctx, l, GPoint(0, 144)); l = weather_app_resource_create_sun(); gdraw_command_image_scale_segme...
ialog->window, DIALOG_IS_ANIMATED); } void dialog_push(Dialog *dialog, WindowStack *window_stack) { window_stack_push(window_stack, &dialog->window, DIALOG_IS_ANIMATED); } void app_dialog_push(Dialog *dialog) { dialog_push(dialog, app_state_get_window_stack()); } // Loads the core dialog. Should be called from e...
status_bar_layer_init(status_layer)
; layer_set_frame(&status_layer->layer, status_layer_frame); status_bar_layer_set_colors(status_layer, GColorClear, dialog->text_color); layer_add_child(&dialog->window.layer, &status_layer->layer); }
/* * 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...
(install_id)
; return APP_WORKER_RESULT_SUCCESS; } // --------------------------------------------------------------------------------------------------------------- // Kill the worker for the current app DEFINE_SYSCALL(AppWorkerResult, sys_app_worker_kill, void) { const PebbleProcessMd *md = worker_manager_get_current_worke...
t everything manager->active_layer = new_active_layer; prv_reset_all_recognizers(manager); manager->state = RecognizerManagerState_RecognizersActive; } } else /* manager->state == RecognizerManagerState_RecognizersActive */ { if (!new_active_layer_is_ancestor) { ...
PBL_ASSERTN(changed)
; PBL_ASSERTN(recognizer_get_manager(changed) == manager); Recognizer *triggered = recognizer_has_triggered(changed) ? changed : NULL; prv_cleanup_state_change(manager, triggered); }
d = s_invalid_param_uid; // This will return with an error ANCS_INVALID_PARAM // Should not get re-requested prv_fake_receiving_ns_notification(sizeof(ns_notification), (uint8_t*) &ns_notification); cl_assert_equal_i(s_num_requested_notif_attributes, 1 ); cl_assert_equal_i(s_num_ds_notifications_received, 1);...
prv_send_notification((uint8_t *)&s_unknown_app_unique_title_dict)
; prv_cmp_last_received_notification(&s_unknown_app_unique_title_parsed_item); // Test an MMS without a caption prv_send_notification_with_event_flags((uint8_t *)&s_mms_no_caption_dict, EventFlagMultiMedia); prv_cmp_last_received_notification(&s_mms_no_caption_parsed_item); // Test an MMS with a caption p...
{ 1144, 40, 104}, { 1072, 64, 32}, // 54 seconds { 968, 88, 0}, { 872, 64, 8}, { 760, 32, 16}, { 1032, 16, 48}, { 1168, 40, 24}, { 1040, 96, -24}, { 1256, 120, -56}, { 1208, 176, -184}, { 1216, 240, -336}, { 1136, 120, -256}, { 1000, 40, -104}, { 760, 40, -144...
{ -112, -120, -936}, { -168, -104, -800}, { -224, -168, -792}, { -224, -232, -832}, { -192, -264, -824}, { -200, -368, -728}, { -240, -608, -552}, { -88, -552, -368}, { 208, -456, -232}, { 800, 80, -232}, { 1416, 376, -120}, // 60 seconds // elapsed: 1 minutes { 1...
{ 1448, 320, -200}, { 1248, 296, -208}, { 1176, 48, -56}, { 992, 16, 16}, { 816, 120, -320}, { 752, 264, -120}, { 872, 200, 128}, { 992, 240, 24}, { 960, 264, -32}, { 984, 240, 8}, { 1464, 368, 24}, { 1072, 728, 224}, { 1312, 536, -160}, { 1088, 184, -80}, { ...
lette = bmp->palette; src_color = palette[cindex]; } return src_color; } #endif void graphics_draw_rotated_bitmap(GContext* ctx, GBitmap *src, GPoint src_ic, int rotation, GPoint dest_ic) { PBL_ASSERTN(ctx); if (rotation == 0) { graphics_draw_bitmap_in_rect( ctx,...
{ for (int x = dest_clip.origin.x; x < dest_clip.origin.x + dest_clip.size.w; ++x) { // only draw if within the dest range const GBitmapDataRowInfo dest_info = gbitmap_get_data_row_info(dest_bitmap, y); if (!WITHIN(x, dest_info.min_x, dest_info.max_x)) { continue; } const int3...
}; const int32_t vert_contrib[3] = { src_vector_y.rem < 0 ? (-src_vector_y.rem) >> 3 : 0, src_vector_y.rem < 0 ? (TRIG_MAX_RATIO + src_vector_y.rem) >> 3 : (TRIG_MAX_RATIO - src_vector_y.rem) >> 3, src_vector_y.rem < 0 ? 0 : (src_vector_y.rem) >> 3 ...
= atoi(test_case_num_str); int32_t iterations = atoi(iterations_str); int32_t status = FLASH_TEST_ERR_OTHER; if (!((test_case_num == FLASH_TEST_CASE_RUN_STRESS_ADDR_TEST) && (iterations <= 0))) { // Check to make sure stress test has at least 1 iteration or its another test case status = run_flash_test_c...
{ bool erased = (is_subsector) ? flash_subsector_is_erased(addr) : flash_sector_is_erased(addr); if (erased) { char buffer[64]; uint32_t end_addr = addr + (is_subsector ? SUBSECTOR_SIZE_BYTES : SECTOR_SIZE_BYTES); for (uint32_t i_addr = addr; i_addr < end_addr; i_addr += sizeof(buffer)) { flash_re...
// ARG: // 0 - Only show sectors // 1 - Show subsectors too if sector is not erased void command_flash_show_erased_sectors(const char *arg) { const bool show_subsectors = (atoi(arg) == 1); char buffer[64]; uint32_t addr = 0; while (addr < BOARD_NOR_FLASH_SIZE) { bool erased = prv_is_really_erased(addr, f...
elapsed_ms; return true; } static uint32_t prv_duration_getter(KinoReel *reel) { return ((TestReelData*)kino_reel_custom_get_data(reel))->duration_ms; } static struct TestReelData *test_reel_data; static KinoReelImpl *test_reel_impl = NULL; static KinoReel *test_reel = NULL; static KinoPlayer *test_player = NULL;...
(test_player->animation, 300)
{ return 0; } iter->end = iter->cursor; return dict_size(iter); } //! Returns the cursor, or NULL if the tuple at cursor extends beyond the bounds of the backing storage static Tuple * get_safe_cursor(DictionaryIterator *iter) { // If iter->cursor is already at the end, return now so we don't try and read ...
dict_write_begin(iter, buffer, *size_in_out)
) != DICT_OK) { return result; } for (unsigned int i = 0; i < tuplets_count; ++i) { if ((result = dict_write_tuplet(iter, &tuplets[i])) != DICT_OK) { return result; } } *size_in_out = dict_write_end(iter); return DICT_OK; } // Legacy version to prevent previous app breakage, __deprecated pr...
integer) { return; } #if PBL_COLOR GColor8 *output = (GColor8 *)(data_row_info.data + x1.integer); // first pixel with blending if fraction is different than 0 const unsigned int data_row_offset = data_row_info.data - (uint8_t *)framebuffer->addr; if (x1.fraction != 0) { graphics_private_raw_blend_c...
MAX(x1, data_row_info.min_x)
; x2 = MIN(x2, data_row_info.max_x); #if PBL_COLOR for (int i = x1; i <= x2; i++) { GColor *output = (GColor *)(data_row_info.data + i); const unsigned int data_row_offset = data_row_info.data - (uint8_t *)framebuffer->addr; prv_set_color(ctx, output, data_row_offset, i, 1, gcolor_alpha_blend(color, *o...
event should be emitted gap_le_connection_remove(&device); prv_assert_event(&device, BTErrnoServiceDiscoveryDisconnected); } void test_gatt_client_discovery__watchdog_race_with_restarting(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_disco...
fake_gatt_is_service_discovery_start_count()
); fake_gatt_put_discovery_complete_event(GATT_SERVICE_DISCOVERY_STATUS_SUCCESS, TEST_GATT_CONNECTION_ID); // Nothing was found so we should just have a completion event cl_assert_equal_i(1, fake_event_get_count()); prv_assert_event(&device, BTErrnoOK); cl_assert_equ...
two_columns_round(ctx, &cell_layer_bounds, config, cell_is_selected); } else { prv_menu_cell_basic_draw_custom_one_column_round(ctx, &cell_layer_bounds, config, GTextAlignmentCenter, GAlignCenter, ...
{ // Title: if (title) { const bool is_legacy2 = process_manager_compiled_with_legacy2_sdk(); if (is_legacy2) { // Update the text color to Black for legacy apps - this is to maintain existing behavior for // 2.x compiled apps - no need to restore original since original 2.x did not do any resto...
x->draw_state.stroke_color); graphics_release_frame_buffer(ctx, framebuffer); return; } #endif // PBL_COLOR if (opacity <= (MAX_PLOT_BRIGHTNESS / 2)) { int16_t y1_rounded = (y1.raw_value + (FIXED_S16_3_ONE.raw_value / 2)) / FIXED_S16_3_ONE.raw_value; int16_t y2_rounded = ...
{ const GRect column_to_replicate = (GRect) { .origin = GPoint(src_x, framebuffer->bounds.origin.y), .size = GSize(1, framebuffer->bounds.size.h), }; GBitmap column_to_replicate_sub_bitmap; gbitmap_init_as_sub_bitmap(&column_to_replicate_sub_bitmap, framebuffer, column_to_replicate); for (int16_t x = ...
void graphics_patch_trace_of_moving_rect(GContext *ctx, int16_t *prev_x, GRect current) { const int16_t new_x = current.origin.x; int16_t src_x = 0; // just so that GCC accepts that src_x is always initialized int16_t dst_x1 = INT16_MAX; int16_t dst_x2 = INT16_MIN; if (*prev_x == INT16_MAX) { // do noth...
xtra_case_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, s_feb_5_midnight + 8 * SECONDS_PER_HOUR + 16 * SECONDS_PER_MINUTE), 0); #if CAPABILITY_H...
(iter_next(&iterator))
; cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id)); cl_assert(!iter_prev(&iterator)); timeline_iter_deinit(&iterator, &state, &head); } void test_timeline__skip_deleted_item(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head)...
PebbleEvent* e) { switch (e->type) { case PEBBLE_APP_OUTBOX_MSG_EVENT: e->app_outbox_msg.callback(e->app_outbox_msg.data); return; case PEBBLE_APP_FETCH_REQUEST_EVENT: prv_handle_app_fetch_request_event(e); return; case PEBBLE_PUT_BYTES_EVENT: // TODO: inform the other thin...
{ s_back_hold_timer = new_timer_create(); process_manager_init(); app_manager_init(); worker_manager_init(); vibes_init(); battery_monitor_init(); evented_timer_init(); #if CAPABILITY_HAS_MAGNETOMETER ecompass_service_init(); #endif tick_timer_service_init(); debounced_connection_service_init(); ...
PBL_LOG(LOG_LEVEL_INFO, "Not launching worker because of 2 strikes"); } else { process_manager_launch_process(&(ProcessLaunchConfig) { .id = worker_manager_get_default_install_id(), .worker = true, }); } #endif notify_system_ready_for_communication(); serial_console_enable_prompt(); } ...
raphics_release_frame_buffer(ctx, &ctx->dest_bitmap); APP_LOG(APP_LOG_LEVEL_WARNING, "Frame buffer was not released. " "Make sure to call graphics_release_frame_buffer before leaving update_proc."); } descend = true; } node_hidden_do_not_descend: node = prv_layer_tre...
(child, NULL)
; child->next_sibling = NULL; } void layer_remove_child_layers(Layer *parent) { Layer *child = parent->first_child; while (child) { // Get the reference to the next now; layer_remove_from_parent will unlink them. Layer *next_sibling = child->next_sibling; layer_remove_from_parent(child); child = ...
GAPLEClientApp, &has_more); cl_assert_equal_i(handle_out, BLE_CHARACTERISTIC_INVALID); cl_assert_equal_i(value_length, 0); // Notification will be eaten, regardless of whether it was copied: cl_assert_equal_b(has_more, false); cl_assert_equal_i(next_length, 0); } void test_gatt_clie...
(gatt_client_get_event_pending_state(GAPLEClientApp), true)
hone_call.h" #include "ancs_notifications_util.h" #include "nexmo.h" #include "comm/ble/kernel_le_client/ancs/ancs_types.h" #include "drivers/rtc.h" #include "kernel/pbl_malloc.h" #include "services/common/analytics/analytics.h" #include "services/common/i18n/i18n.h" #include "services/normal/blob_db/ios_notif_pref_db...
(&title->pstr, reminder_title_buffer)
; TimelineItem reminder; // If we found an existing reminder, replace its dismiss action with ancs negative action if (reminder_db_find_by_timestamp_title(timestamp, reminder_title_buffer, prv_reminder_filter, &reminder)) { ancs_item_update_dismiss_action(&reminder,...
/* * 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...
(0, s_tick_timer_service_subscribe.call_count)
; cl_assert_equal_b(false, rocky_global_has_event_handlers("secondchange")); cl_assert_equal_b(false, rocky_global_has_event_handlers("minutechange")); cl_assert_equal_b(false, rocky_global_has_event_handlers("hourchange")); cl_assert_equal_b(false, rocky_global_has_event_handlers("daychange")); EXECUTE_SCRI...
eters_t *GAP_LE_Advertising_Parameters, GAP_LE_Connectability_Parameters_t *GAP_LE_Connectability_Parameters, GAP_LE_Event_Callback_t GAP_LE_Event_Callback, unsigned long CallbackParameter) { s_is_le_advertising_enabled = true; ...
BTDeviceAddressToBDADDR(device->address)
, }; GAP_LE_Event_Data_t event = (GAP_LE_Event_Data_t) { .Event_Data_Type = etLE_Connection_Complete, .Event_Data_Size = sizeof(GAP_LE_Connection_Complete_Event_Data_t), .Event_Data.GAP_LE_Connection_Complete_Event_Data = &event_data, }; if (is_master) { prv_fake_gap_le_create_connection_event_...
------------------------------------------------------------------------------------- static bool prv_parse_activity_samples_file(ActivitySampleDiscoveryState *state) { // Init for next set of samples state->test_entry = (ActivityFileTestEntry) { .samples = state->samples, .version = 1, .activity_type =...
{ PBL_ASSERTN(state->test_entry.name[0] != 0); int steps = 0; int orientation = 0; int vmc = 0; int light = 0; int plugged_in = 0; if (state->test_entry.version == 1) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d", &steps, &orientation, &vmc); } else if (state...
// End of a sample if (strcmp(token, "}") == 0) { PBL_ASSERTN(state->test_entry.name[0] != 0); break; } } // Did we get samples? if (state->test_entry.num_samples > 0) { return true; } else { return false; } } // -------------------------------------------------------------...
se if (bus->state->spi_apb == SpiAPB_2) { // Enable SPIx reset state RCC_APB2PeriphResetCmd(bus->state->spi_clock_periph, ENABLE); // Release SPIx from reset state RCC_APB2PeriphResetCmd(bus->state->spi_clock_periph, DISABLE); } spi_ll_slave_release(slave); } // //! High level slave port interface ...
(slave->slave_state->initialized)
; PBL_ASSERTN(slave->slave_state->acquired == false); prv_spi_enable_peripheral_clock(slave->spi_bus); prv_spi_clear_flags(slave->spi_bus); slave->slave_state->acquired = true; spi_ll_slave_spi_enable(slave); } void spi_ll_slave_release(const SPISlavePort *slave) { PBL_ASSERTN(slave->slave_state->initializ...
er.h" #include "services/normal/timeline/timeline.h" #include "system/hexdump.h" #include "system/passert.h" #include "system/logging.h" #include "util/attributes.h" #include "util/buffer.h" #include "util/size.h" #include <string.h> // ----------------------------------------------------------------------------- /...
{ PBL_ASSERTN(prv_can_transition_state(new_state)); s_ancs_client->state = new_state; }
T_STATIC ANCSClientState prv_get_state(void) { return s_ancs_client->state; } // ----------------------------------------------------------------------------- // Notification Queue Logic static void prv_do_notif_queue_operation(void) { if (s_ancs_client->queue->op == NotificationQueueOpGetAttributes) { prv_...
_ms; } inline static bool prv_can_more_clicks_follow(ClickRecognizer *recognizer) { if (recognizer->number_of_clicks_counted >= prv_multi_click_get_max(recognizer)) { return false; } return true; } uint8_t click_number_of_clicks_counted(ClickRecognizerRef recognizer_ref) { ClickRecognizer *recognizer = (C...
{ // If there's a repeat interval configured, start the repetition delay timer: recognizer->hold_timer = app_timer_register( CLICK_REPETITION_DELAY_MS, prv_repetition_delay_callback, recognizer); }
/* * 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 (!ancs_notifications_util_is_sms(app_id)) { return false; } // The defining feature of a group sms (vs a regular sms) is that it has a subtitle field if (!subtitle || subtitle->length == 0) { return false; } return true; }
/* * 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...
process_manager_compiled_with_legacy2_sdk()
, -64, -192}, { 1520, -16, -296}, { 1192, -24, -152}, { 736, -16, -144}, { 1024, 32, -216}, { 1272, 40, -120}, { 1296, -56, 32}, { 1200, -48, 16}, { 1128, -72, 32}, { 1056, -56, 32}, { 1008, -48, 16}, { 968, -64, 40}, { 896, -56, 16}, { 872, -48, 0}, { 864, -72, 8...
{ 1072, -32, -184}, { 1112, -32, -192}, { 1672, 0, -240}, { 1384, -224, -40}, { 1088, -312, 16}, { 832, -296, 8}, { 1016, -304, 32}, // 62 seconds { 1280, -344, 200}, { 1088, -304, 248}, { 1032, -232, 128}, { 984, -160, 56}, { 1152, -160, 80}, { 1096, -144, 128}, ...
rces.h" #include "stubs_text_render.h" #include "stubs_pbl_malloc.h" #include "stubs_reboot_reason.h" #include "stubs_resources.h" #include "stubs_syscalls.h" #include "stubs_compiled_with_legacy2_sdk.h" /////////////////////////////////////////////////////////// // Fakes static GContext s_ctx; static FrameBuffer s_f...
(iter_next(&word_iter))
; cl_assert(*word_iter_state.current.start == 'N'); cl_assert(*word_iter_state.current.end == '\n'); cl_assert(iter_next(&word_iter)); cl_assert(*word_iter_state.current.start == '\n'); cl_assert(*word_iter_state.current.end == 'o'); cl_assert(iter_next(&word_iter)); cl_assert(*word_iter_state.current.s...
/* * 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 (cur_type != ReconnectType_None) { prv_unschedule_adv_if_needed(); #if CAPABILITY_HAS_BUILTIN_HRM const bool use_hrm_payload = (cur_type == ReconnectType_BleHrm); #else const bool use_hrm_payload = false; #endif BLEAdData *ad; if (use_hrm_payload) { // Create adv payload with only flags +...
// a non-issue (because addresses will be private). Therefore I decided to // still leave out the flags. static BLEAdData payload = { .ad_data_length = 0, .scan_resp_data_length = 0, }; ad = &payload; } size_t num_terms = 0; const GAPLEAdvertisingJobTerm *adv...
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 "local_id.h" #include "mfg/mfg_serials.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" ...
((uint8_t *)tmp, full_len)
/* * 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, resp, true /* should_free_request */)
; } bool bt_driver_advert_advertising_enable(uint32_t min_interval_ms, uint32_t max_interval_ms, bool enable_scan_resp) { const uint32_t alloc_size = sizeof(HcProtocolMessage) + sizeof(HcAdvertEnableData); HcProtocolMessage *request = kernel_malloc_check(alloc_size); *req...
48, 504, -184}, { -1448, 528, -168}, { -1568, 536, -272}, { -1208, 424, -168}, { -1352, 360, -24}, { -1272, 288, 0}, { -912, 320, -16}, { -544, 320, -40}, { -392, 312, -40}, { -424, 312, 16}, { -384, 176, 88}, { -408, 96, 112}, { -496, 152, 64}, { -640, 224, 104}, ...
{ -1136, 624, -536}, { -592, 312, -368}, { -472, 352, -456}, { -440, 448, -272}, { -648, 392, -16}, { -688, 272, -88}, { -688, 232, 32}, { -576, 304, -104}, { -752, 392, -328}, { -1016, 416, -416}, { -1352, 360, -248}, { -1904, 768, -568}, { -1752, 440, 104}, // 5...
{ -896, 440, -160}, { -1256, 584, -264}, { -1496, 584, -200}, { -1392, 664, -264}, { -1264, 600, -184}, { -1192, 600, -112}, { -1088, 400, -32}, { -832, 304, 24}, { -568, 296, 16}, { -536, 296, 0}, { -528, 232, 88}, { -504, 136, 88}, { -576, 136, 64}, { -736, 208...
raw_state.fill_color.argb); s_graphics_fill_rect = (MockCallRecordings){}; EXECUTE_SCRIPT( "ctx.fillRect(5, 6, 7, 8);\n" ); cl_assert_equal_i(1, s_graphics_fill_rect.call_count); cl_assert_equal_rect(GRect(5, 6, 7, 8), s_graphics_fill_rect.last_call.rect); s_graphics_draw_rect_precise = (MockCallReco...
(0, lc->fill_radial_precise.radius_inner.raw_value)
; cl_assert_equal_i(20 * 8, lc->fill_radial_precise.radius_outer.raw_value); // outer radius capped to >= 0 EXECUTE_SCRIPT( "ctx.rockyFillRadial(30, 40, -10, -20, 0, Math.PI);\n" ); cl_assert_equal_i(3, s_graphics_fill_radial_precise_internal.call_count); cl_assert_equal_point_precise((PP(29.5, 39.5)),...
orm_${BIT_DEPTH_NAME}__types_precise(void) { GPointPrecise pointP = GPointPreciseFromGPoint(GPoint(2, 5)); GPointPrecise pointP_c = GPointPrecise((2 % GPOINT_PRECISE_MAX) << GPOINT_PRECISE_PRECISION, (5 % GPOINT_PRECISE_MAX) << GPOINT_PRECISE_PRECISION); cl_assert(gpoin...
(&t_new, &t_c)
); // Test pointer re-use gtransform_concat(&t1, &t1, &t2); cl_assert(gtransform_is_equal(&t1, &t_c)); // Test concatenation of two non-identity matrices t1 = GTransformFromNumbers(3, 5, 7, 11, 13, 17); t2 = GTransformFromNumbers(1, 2, 3, 4, 5, 6); t_c = GTransformFromNumbers(18, 26, 40, 58, 69, 10...
/* * 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...
RCC_GetClocksFreq(&RCC_ClocksStatus)
; int prescaler = RCC_ClocksStatus.HCLK_Frequency / dev->clock_speed_hz; if ((RCC_ClocksStatus.HCLK_Frequency / prescaler) > dev->clock_speed_hz) { // The desired prescaler is not an integer, so we'll round up so that the clock is never // faster than the desired frequency. prescaler++; } // enable...
// We enabled the rail! *ref_count = 1; // We need to wait a bit for the rail to stabilize before continuing to use the device. // It takes 2.6ms for the LDO rails to ramp. delay_ms(3); return true; } return false; } } else { if (*ref_count <= 1) { ...
GPIO_Init(GPIOB, &gpio_init_struct)
; // I2C config GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_I2C1); GPIO_PinAFConfig(GPIOB, GPIO_PinSource9, GPIO_AF_I2C1); gpio_release(GPIOB); // Initialize the GPIOs for the 4V5, 6V6, and accessory rails gpio_use(GPIOF); gpio_init_struct.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_13; gpio_i...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_app_message_pp_buffer, data, length)
; s_app_message_pp_received_length = length; } static void prv_protocol_msg_callback(CommSession *session, const uint8_t* data, size_t length) { app_message_app_protocol_msg_callback(session, data, length, NULL); } void app_message_inbox_handle_dropped_messages(uint32_t num_d...
GAPLEClientKernel); cl_assert_equal_i(e, BTErrnoOK); fake_event_clear_last(); fake_kernel_malloc_mark(); // Subscribe again: e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, GAPLEClientKernel); cl_ass...
(s_last_cccd_value, BLESubscriptionIndications)
_mask = s_watchdog_mask & ~(1 << PebbleTask_KernelBackground); if ((new_mask & s_watchdog_bits) == new_mask) { // Put system task callback using from ISR variant PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_system_task_starved_callb...
{ taskEXIT_CRITICAL(); NVIC_EnableIRQ(TIM2_IRQn); }
void task_watchdog_bit_set_all(void) { task_watchdog_disable_interrupt(); s_watchdog_bits |= s_watchdog_mask; task_watchdog_enable_interrupt(); } void task_watchdog_bit_set(PebbleTask task) { task_watchdog_disable_interrupt(); s_watchdog_bits |= (1 << task); task_watchdog_enable_interrupt(); } bool task...
/* * 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_num, handle)
{ 80, 40, -1112}, { 88, 48, -1112}, { 112, 8, -1120}, { 128, 8, -1000}, { 160, 8, -1040}, { 152, -16, -1000}, { 128, 0, -1024}, { 152, 48, -1056}, { 176, 0, -1048}, { 184, -40, -1008}, { 152, 48, -992}, { 48, 24, -1040}, // 83 seconds { 48, 8, -944}, { 144, 24...
{ -320, 1032, 352}, { -376, 976, 440}, { -320, 848, 344}, { -344, 824, 304}, { -408, 800, 272}, { -408, 760, 328}, { -472, 824, 344}, // 89 seconds { -432, 704, 344}, { -440, 816, 408}, { -464, 816, 488}, { -448, 848, 392}, { -440, 936, 320}, { -368, 888, 152}, ...
this // within 30ms~ of getting the handshake or else we'll lose PPG data). The other registers can // be read at anytime before the next handshake, so it's ok to do this first. prv_read_ppg_data(HRM, &data.ppg_data); if (should_expect_samples) { interval_timer_take_sample(&s_handshake_interval_timer); }...
PBL_LOG(LOG_LEVEL_INFO, "AS7000 enabled! Protocol v%" PRIu8 ".%" PRIu8 ", SW v%" PRIu8 ".%" PRIu8 ".%" PRIu8 ", HW Rev %" PRIu8, info->protocol_version_major, info->protocol_version_minor, HRM_SW_VERSION_PART_MAJOR(info->sw_version_major), HRM_SW_VERSION_PART_MINOR(info->sw_ver...
; } prv_log_running_apps(dev); return true; } static bool prv_is_app_running(HRMDevice *dev, AS7000AppId app) { uint8_t running_apps = 0; if (!prv_read_register(dev, ADDR_APP_IDS, &running_apps)) { return false; } PBL_LOG(LOG_LEVEL_DEBUG, "Apps running: 0x%"PRIx8, running_apps); if (app == AS7000Ap...
cide to implement CMD_REQUEST, or remove it return; case CMD_ACK: case CMD_NACK: // Received ACK/NACK in response to previously pushed update: app_message_out_handle_ack_nack_received(message); return; default: PBL_LOG(LOG_LEVEL_ERROR, "Unknown Cmd 0x%x", message->command); ...
if (prv_supports_8k()) { return (APP_MSG_8K_DICT_SIZE); } else { // Legacy behavior: return (APP_MESSAGE_OUTBOX_SIZE_MINIMUM + APP_MSG_HDR_OVRHD_SIZE); }
} AppMessageResult app_message_open(const uint32_t size_inbound, const uint32_t size_outbound) { // We're making this assumption in this file; here's as good a place to check it as any. // It's probably not super-bad if this isn't true, but we'll have type casts between different // sizes without over/underflow...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_watchinfo_api)
; EXECUTE_SCRIPT("var major = _rocky.watchInfo.firmware.major"); ASSERT_JS_GLOBAL_EQUALS_I("major", VERSION_MAJOR); EXECUTE_SCRIPT("var minor = _rocky.watchInfo.firmware.minor"); ASSERT_JS_GLOBAL_EQUALS_I("minor", VERSION_MINOR); EXECUTE_SCRIPT("var patch = _rocky.watchInfo.firmware.patch"); ASSERT_JS_GL...
.menu_layer->selection = it->it.cursor; it->it.should_continue = false; it->did_change_selection = true; } } static void prv_menu_layer_iterator_update_selection(MenuIterator *iterator) { MenuLayer *menu_layer = iterator->menu_layer; if (menu_index_compare(&iterator->cursor.index, &menu_layer->selection....
{ if (!reached_second_half_before) { const MenuIndex prev_index = state.menu_layer->selection.index; state.menu_layer->selection = state.menu_layer->animation.new_selection; prv_announce_selection_changed(state.menu_layer, prev_index); } // this favors robustness over efficiency - the func...
layer_mark_dirty(&state.menu_layer->scroll_layer.layer); } void prv_center_focus_animation_update_in_and_out(Animation *animation, const AnimationProgress progress) { const AnimationProgress half_progress = ANIMATION_NORMALIZED_MAX / 2; const bool second_half = ...
AnimationPrivate *child = prv_find_animation_by_parent_child_idx(state, animation, child_idx); if (!child) { break; } if (child->type == AnimationTypePrimitive) { if (prv_animation_is_scheduled(state, child)) { return true; } } else if (prv_animation_is_sch...
{ if (animation->implementation->teardown != NULL) { animation->implementation->teardown(animation->handle); } animation->did_setup = false; }
_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_1.irk, sizeof(irk_out)); cl_asser...
(id, &irk_out, &device_out, NULL)
; cl_assert(!ret); // Add the pairing again bonding_sync_add_bonding(&ble_bonding); id = bt_persistent_storage_store_ble_pairing(&pairing, true /* is_gateway */, NULL, false /* requires_address_pinning */, false /* au...
"aaaa aaaa aaaa aaaa " // 20- 40 "aaaa aaaa aaaa aaaa " // 40- 60 "aaaa aaaa aaaa aaaa " // 60- 80 "aaaa aaaa aaaa aaaa " // 80-100 "aaaa aaaa aaaa aaaa " //100-120 "aaaa aaaa a...
cl_assert_equal_i(jntest[1], 0)
; zntest[0] = zntest[1] = 0; snprintf(dstbuf, 512, "aaaa aaaa aaaa aaaa " // 0- 20 "aaaa aaaa aaaa aaaa " // 20- 40 "aaaa aaaa aaaa aaaa " // 40- 60 "aaaa aaaa aaaa aaaa " // 60- 80 "aaaa aaaa aaaa aaaa " // 80-100 ...
/* * 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...
{ KinoLayerDemoData *data = app_state_get_user_data(); kino_layer_deinit(&data->kino_layer); app_free(data); }
/////////////////////////// // app boilerplate /////////////////////////// static void s_main(void) { prv_init(); app_event_loop(); prv_deinit(); } const PebbleProcessMd *kino_layer_demo_get_info(void) { static const PebbleProcessMdSystem s_app_info = { .common = { .main_func = s_main, // UU...
is_first = false, }; memcpy(chunk->chunk_data, expected_json + payload_offset, TINY_CHUNK_SIZE); EXPECT_OUTBOX_MESSAGE_PENDING(TupletBytes(PostMessageKeyChunk, (const uint8_t *) chunk, expected_size)); // Compare with hard-coded byte array, to catch accide...
(chunk_msg_defs)
; ++i) { RCV_APP_MESSAGE(TupletBytes(PostMessageKeyChunk, (const uint8_t *) chunk_msg_defs[i].byte_array, chunk_msg_defs[i].length)); } JS_VAR event_valid = prv_js_global_get_value("event"); cl_assert_equal_b(true, jerry_value_is_obj...
app_num, uint32_t resource_id) { PBL_ASSERTN(app_num == SYSTEM_APP); // get from resource store mutex_lock_recursive(s_resource_mutex); ResourceStoreEntry res; resource_storage_get_resource(app_num, resource_id, &res); if (res.id < 1) { mutex_unlock_recursive(s_resource_mutex); return 0; } // ...
mutex_unlock_recursive(s_resource_mutex)
; return rv; } bool resource_version_matches(const ResourceVersion *v1, const ResourceVersion *v2) { return (v1->crc == v2->crc); }
ert(!iter_next(&iterator)); // 2 deletes cl_assert(timeline_iter_remove_node_with_id(&head, &all_day_item.header.id)); cl_assert(timeline_iter_remove_node_with_id(&head, &all_day_item.header.id)); cl_assert(!timeline_iter_remove_node_with_id(&head, &all_day_item.header.id)); } void test_timeline__24h_non_all_...
timeline_iter_remove_node_with_id(&head, &multiday_item.header.id)
); } void test_timeline__all_day_ios_bug(void) { TimelineItem item = { .header = { .id = {0x29, 0xac, 0xd8, 0xb5, 0x9, 0xc7, 0x4c, 0x31, 0xbf, 0x6f, 0x3, 0x64, 0xd0, 0x5b, 0x9b, 0xc2}, .parent_id = {0}, .timestamp = 1430236800, // 9am Apr 28, 2015 PDT .duration = MINUTE...
64}, { 1200, 352, -16}, { 1480, 392, 24}, { 1288, 632, 160}, { 840, 776, -40}, { 1168, 424, 32}, { 960, 408, -48}, { 1024, 344, 0}, { 1232, 408, 48}, { 1576, 376, 56}, { 1400, 216, 112}, { 1448, 16, 176}, { 1472, -56, 80}, { 1392, -16, 16}, { 1168, 32, 0}, { 8...
{ 1168, 104, 104}, // 16 seconds { 1136, -32, 88}, { 1136, -48, 8}, { 1080, 40, -80}, { 960, 80, -48}, { 1128, 8, 24}, { 1048, 32, -96}, { 792, -24, -104}, { 1048, -72, -80}, { 1096, -32, 8}, { 1200, 112, -128}, { 1328, 120, -200}, { 1344, 136, -224}, { 952, 1...
{ 864, 16, -112}, { 1032, 128, 8}, { 1120, 192, 96}, { 1032, 304, 72}, { 992, 392, 128}, { 1336, 464, 352}, { 1080, 960, 376}, // 19 seconds { 856, 472, 0}, { 1112, 320, 152}, { 1256, 576, 80}, { 1520, 456, 144}, { 1784, 408, 224}, { 1776, 296, 120}, { 1632, ...
/* * 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(filename + APP_FILE_NAME_PREFIX_LENGTH, APP_RESOURCES_FILENAME_SUFFIX)
; } //! Parses an app-file name to get the AppInstallId. //! Assumes the file is indeed an app-file AppInstallId app_file_parse_app_id(const char *filename) { return (AppInstallId)strtol(filename + 1, NULL, 16); // + 1 to skip the initial '@' } //! Parses an app-file name to get the AppInstallId. //! //! @returns I...
ACK_FULL_MSG, max_message_length); msg->message[max_message_length-1] = 0; msg->message_length = strlen(msg->message); return true; } else { return false; } } // ------------------------------------------------------------------------------------------- static void prv_sprintf_to_msg(LogBinaryMess...
prv_release_log_state(state)
; } #ifdef PBL_LOGS_HASHED void pbl_log_hashed_sync(const uint32_t packed_loghash, ...) { va_list fmt_args; va_start(fmt_args, packed_loghash); pbl_log_hashed_vargs(false, CORE_ID_MAIN_MCU, packed_loghash, fmt_args); va_end(fmt_args); } void pbl_log_hashed_async(const uint32_t packed_loghash, ...) { va_...
_bar_icons(LauncherMenuData *data) { // Draw airplane mode, do not disturb, or silent status icon. AlertMask alert_mask = alerts_get_mask(); // Get the connectivity ResourceId uint32_t new_connectivity_icon_id = RESOURCE_ID_INVALID; if (bt_ctl_is_airplane_mode_on()) { new_connectivity_icon_id = RESOURCE_...
kino_layer_init(&data->connectivity_icon, &GRect(kino_padding, 0, kino_width, STATUS_BAR_LAYER_HEIGHT))
; kino_layer_set_alignment(&data->connectivity_icon, GAlignLeft); layer_add_child(&window->layer, kino_layer_get_layer(&data->connectivity_icon)); kino_layer_init(&data->battery_icon, &GRect(DISP_COLS - kino_width - kino_padding, 0, kino_width, STATUS_BAR_LAYER_HEIGHT...
/* * 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(!s_mfg_mode_entered)
; prv_release_button(BUTTON_ID_DOWN); // Make sure we've waited the appropriate amount of time StubTimer *timer = prv_find_combo_timer(); cl_assert(timer); cl_assert_equal_i(stub_new_timer_timeout(timer->id), 5000); // Pretend 5000ms have elapsed stub_new_timer_fire(timer->id); // We now should be i...
ar-Enable Register NVIC->ICER[i] = 0xFFFFFFFF; // Interrupt Clear-Pending Register NVIC->ICPR[i] = 0xFFFFFFFF; } // Set the peripheral clock enable registers to their reset values as // specified in the datasheet. RCC->AHB1ENR = 0x00100000; // Core-coupled memory is enabled at reset RCC->AHB2ENR...
(BOOT_BIT_RESET_LOOP_DETECT_TWO)
; boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_THREE); return true; } switch (++counter) { case 1: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 2: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; case 3: boot_bit_se...
ion 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS...
bma255_disable_spi_clock()
; gpio_output_set(&BMA255_SCS_CONFIG, false); } void bma255_burst_read(uint8_t address, uint8_t *data, size_t len) { const uint8_t reg = address | BMA255_READ_FLAG; bma255_prepare_txn(reg); for (size_t i = 0; i < len; ++i) { data[i] = bma255_send_and_receive_byte(0); } bma255_end_txn(); } uint8_t bma...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_WARNING, "System task callback: %p", current_cb)
; reboot_reason->watchdog.stuck_task_callback = (uint32_t)current_cb; } static void prv_log_stuck_task(RebootReason *reboot_reason, PebbleTask task) { TaskHandle_t *task_handle = pebble_task_get_handle_for_task(task); void *current_lr = (void*) ulTaskDebugGetStackedLR(task_handle); void *current_pc = (void*) u...
inished, void *context) { TimelineAppData *data = context; if (!finished || !prv_set_state(data, TimelineAppStateDaySeparator)) { return; } // Pins will reappear after the day separator completes hiding in `prv_hide_day_sep_stopped` timeline_layer_set_layouts_hidden(&data->timeline_layer, true); prv_s...
if (prv_pin_in_card(data, id)) { // remove the pin window if we just removed the pin app_window_stack_remove((Window *)&data->pin_window, false); prv_set_state(data, TimelineAppStateStationary); }
timeline_model_remove(id); prv_update_timeline_layer(data); } else if (type == BlobDBEventTypeInsert) { for (int i = 0; i < TIMELINE_NUM_VISIBLE_ITEMS; i++) { if (timeline_model_get_iter_state(i)->node && uuid_equal(&timeline_model_get_iter_state(i)->pin.header.id, id)) { prv_refr...