prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * 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...
{ const gap_device_t *const device = &devices[i]; uint16_t svc_chg_ccc = 0; ble_storage_get_u16(device->conn_idx, STORAGE_KEY_SVC_CHANGED_CCC, &svc_chg_ccc); const bool is_subscribed_to_service_changed = !!(svc_chg_ccc & GATT_CCC_INDICATIONS); if (is_subscribed_to_service_changed) { ble_gatts_...
}
from; GRect to; GSize size; GPoint offset; } ScaleToGValues; typedef struct { const struct { ScaleToGValues integer; ScaleToGValues precise; Fixed_S32_16 duration_fraction; GPointIndexLookup *lookup; AnimationProgress normalized; InterpolateInt64Function interpolate; bool is_offs...
Fixed_S16_3_add(native, op_value)
; default: WTF; } } static bool prv_gdraw_command_scale_stroke_width(GDrawCommand *command, uint32_t index, void *context) { ScaleStrokeWidthCBContext *scale = context; const Fixed_S16_3 stroke_width = Fixed_S16_3(gdraw_command_get_stroke_width(com...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(reading, 1, 1)
; cl_assert_equal_i(result, 0); } // Make sure our new method for calculating battery usage matches the old one for stm32f2 /////////////////////////////////////////////////////////// static int prv_legacy_f2_calculation_millivolts(ADCVoltageMonitorReading reading) { return (int) ((reading.vmon_total * (2730) / re...
quence_create(a, b, NULL); animation_set_play_count(seq, repeat_count); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); // Start A prv_advance_to_ms_with_timers(start_ms + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handle...
(seq, repeat_count)
; // Now, clone it Animation *clone = animation_clone(seq); // Destroy the original animation_destroy(seq); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(clone); // Start A prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_en...
app_state_get_user_data()
; health_data_update_step_derived_metrics(health_app_data->health_data); health_card_view_mark_dirty(health_app_data->health_card_view); } // Activity change callback static void prv_health_service_event_handler(HealthEventType event, void *context) { HealthAppData *health_app_data = context; if (event == Heal...
-880, 496, -168}, { -904, 624, -136}, { -952, 632, 24}, { -936, 704, 40}, { -864, 512, -32}, { -840, 208, -168}, { -824, 64, -168}, { -856, 320, -304}, { -824, 368, -136}, { -832, 520, -48}, { -848, 568, -8}, { -896, 704, -16}, { -872, 656, 8}, { -872, 560, -16}, ...
{ -872, 440, -168}, { -872, 440, -176}, { -832, 504, -216}, { -904, 408, -72}, { -776, 248, -320}, { -920, 528, -288}, { -872, 312, -192}, { -952, 328, -48}, { -944, 264, 80}, { -944, 248, 176}, { -928, 240, 112}, // 106 seconds { -928, 176, 32}, { -944, 216, -112...
_subscribe, .handle_read_or_notification = ppogatt_handle_read_or_notification, }, [KernelLEClientANCS] = { .debug_name = "ANCS", .service_uuid = &s_ancs_service_uuid, .characteristic_uuids = s_ancs_characteristic_uuids, .num_characteristics = NumANCSCharacteristic, .handle_service_discovere...
{ bool removed = false; for (int c = 0; c < KernelLEClientNum; c++) { const KernelLEClient * const client = &s_clients[c]; if (uuid_equal(&service_remove_info->uuid, client->service_uuid)) { removed = true; client->handle_service_removed( (BLECharacteristic *)&service_rem...
} static void prv_handle_all_services_invalidated(void) { for (int c = 0; c < KernelLEClientNum; c++) { const KernelLEClient * const client = &s_clients[c]; client->invalidate_all_references(); } } static void prv_handle_services_added( PebbleBLEGATTClientServicesAdded *added_services, BTDeviceIntern...
(void *)(uintptr_t) ancs_uid, fd)) { found = true; *uuid_out = header.common.id; // Seek to the end of this item's payload (start of the next item) if (pfs_seek(fd, header.payload_length, FSeekCur) < 0) { break; } } prv_file_close(fd); return found; } static bool prv_compa...
if (iter_callback == NULL) { return; }
int fd = prv_file_open(OP_FLAG_READ); if (fd < 0) { return; } Iterator iter; NotificationIterState iter_state = { .fd = fd }; iter_init(&iter, (IteratorCallback)prv_iter_next, NULL, &iter_state); while (iter_next(&iter)) { uint8_t status = iter_state.header.common.status; if (!(stat...
nder the License. */ #include "applib/graphics/utf8.h" #include "utf8_test_data.h" #include "clar.h" #include <string.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> // Stubs /////////////////////////////////////////////////////////// #include "stubs_logging.h" #include "stubs_passert.h" // Tests /...
memset(dest, 0, 5)
; size_t copied = utf8_copy_character(dest, (utf8_t *)"\xf0", 5); cl_assert_equal_i(copied, 0); cl_assert_equal_s((char *)dest, ""); } void test_utf8__invalid_character(void) { utf8_t dest[5]; memset(dest, 0, 5); size_t copied = utf8_copy_character(dest, (utf8_t *)"\xf0hi", 5); cl_assert_equal_i(copi...
const ActionMenuItem *item, void *context) { NotificationWindowData *window_data = (NotificationWindowData*) item->action_data; prv_dismiss_all(window_data, action_menu); } static int64_t prv_interpolate_moook_peek_animation(int32_t normalized, int64_t from, int64_t to)...
evented_timer_register_or_reschedule(data->peek_layer_timer, PEEK_LAYER_HIDE_DELAY, prv_hide_peek_layer, data)
; } static void prv_show_peek_for_notification(NotificationWindowData *data, Uuid *id, bool is_first_notification) { // reload everything, doesn't matter since it will be covered by the peek layer notification_window_focus_notification(id, false); // if the peek animat...
Manager Callbacks //////////////////////////////// typedef struct InstallData { AppInstallId id; AppMenuDataSource *source; InstallEventType event_type; } InstallData; void prv_alert_data_source_changed(AppMenuDataSource *data_source) { if (data_source->callbacks.changed) { data_source->callbacks.changed(...
list_get_next((ListNode *)iter)
; // if the node belonged to the app_db, remove if (app_install_id_from_app_db(iter->install_id)) { prv_unload_node(source, iter); } iter = temp; } prv_alert_data_source_changed(source); } static void prv_app_db_cleared_callback(const AppInstallId install_id, void *data) { // data is just...
ual_i(prv_count_handler_entries(&s_update_handler_calls, c), 0); // Execute to the start of B and C prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_sto...
prv_count_handler_entries(&s_stopped_handler_calls, a)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // A should start out low distance = prv_last_update_distance(a); c...
te_pin(time_t pin_time_utc, time_t now_utc, uint32_t duration_m, LayoutId layout_id, AttributeList *pin_attr_list, HealthCardType health_card_type) { return prv_create_pin_with_response_items(pin_time_utc, now_utc, duration_m, layout_id, ...
(&pin_attr_list, AttributeIdBody, i18n_get(percent_config->body, &pin_attr_list))
; attribute_list_add_resource_id(&pin_attr_list, AttributeIdIconTiny, config->icon); attribute_list_add_resource_id(&pin_attr_list, AttributeIdIconSmall, s_tier_config[tier].card_icon); attribute_list_add_uint8(&pin_attr_list, AttributeIdDisplayTime, WeatherTimeType_None); attr...
const int duration_b = 500; const int delay_b = 20; const int delay_seq = 30; const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); // Create a property animation and play it ...
(c, delay_c)
; Animation *d = prv_create_test_animation(); animation_set_duration(d, duration_d); animation_set_delay(d, delay_d); // ------------------------------------------------------------------------------------- // Run A to completion animation_schedule(a); prv_advance_to_ms_with_timers(start_ms + 20); cl...
_COMPLEX const int duration_a = 300; const int duration_total = 2 * duration_a; const int repeat_count = 2; uint32_t distance; // Create animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); Animation *b = animation_clone(a); animation_set_reverse(b, true); ...
prv_create_test_animation()
; animation_set_duration(c, duration_c); // Create a spawn out of b and c Animation *spawn = animation_spawn_create(b, c, NULL); cl_assert(spawn != NULL); // Create a sequence by putting a in front and repeat it 5 times // We now have a -> (b | c) Animation *seq = animation_sequence_create(a, spawn, NUL...
+ pos, buffer_size - pos, end_hours, end_minutes, false); } static void prv_set_deep_sleep(char *buffer, size_t buffer_size, int32_t sleep_duration, void *i18n_owner) { if (sleep_duration <= 0) { strncpy(buffer, EN_DASH, buffer_size); return; } ...
(card_data->headings[i].primary_value)
; app_free(card_data->headings[i].secondary_value); } for (int i = 0; i < card_data->num_subtitles; i++) { app_free(card_data->subtitles[i].label); } for (int i = 0; i < card_data->num_zones; i++) { app_free(card_data->zones[i].label); } i18n_free_all(card_data); app_free(card_data); health_...
oss_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_across_nx_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_y_layer_update_callback); layer_render_tree(&layer, &ctx); ...
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // AA = true, SW = 3 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 3); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); // TODO: Fix o...
{ 1280, 176, 48}, { 1072, 264, 80}, { 1296, 336, 184}, { 1096, 472, 480}, { 952, 976, 248}, { 1096, 544, 0}, { 904, 304, 8}, { 1232, 400, 152}, { 1640, 520, 200}, { 1648, 344, 88}, { 1408, 144, 184}, { 1368, -16, 288}, { 1288, -64, 88}, { 1168, 8, -8}, { 1016,...
{ 1008, 48, 32}, { 1008, -16, 104}, { 1016, -96, 72}, { 664, -176, 16}, { 1104, -136, -72}, { 1160, -8, -88}, { 1320, 104, -168}, { 1456, 24, -112}, { 1576, 16, -120}, { 1304, 136, -120}, { 1072, 184, -120}, { 1128, 264, -128}, { 1152, 320, -72}, { 1216, 280, -40...
/* * 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...
(sizeof(*s_ctx))
; framebuffer_init(s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_graphics_context_init(s_ctx, s_fb); framebuffer_clear(s_fb); } void test_graphics_context_mask__cleanup(void) { free(s_ctx); free(s_fb); gbitmap_destroy(s_dest_bitmap); s_dest_bitmap = NULL; } /////////////////////////////////////////////...
info_text_box, GTextOverflowModeWordWrap, GTextAlignmentLeft, NULL); } static bool prv_is_selection_last_weekday(HealthGraphCard *graph_card) { // If the selection is today, the selection is last week's only if today has no progress // Else if today is Sunday, the entire graph represents the ...
if (IS_EMPTY_STRING(buffer)) { return; }
prv_draw_info_with_text(graph_card, ctx, buffer); } static void prv_health_graph_layer_update_proc(Layer *layer, GContext *ctx) { HealthGraphCard *graph_card = (HealthGraphCard *)layer; prv_draw_title(graph_card, ctx); prv_draw_day_labels_background(graph_card, ctx); prv_draw_day_bars(graph_card, ctx); p...
(intent) { GAPLEConnectionIntent *next = (GAPLEConnectionIntent *) intent->node.next; if (prv_intent_matches_connection(intent, connection)) { found_match = true; if (intent->is_bonding_based) { // Update connection address: intent->device = event->peer_addr...
prv_update_clients(intent, event->reason, GAPLEConnectionEventDisconnected)
) { // Only if the intent hasn't been cleaned up by now: if (prv_is_intent_using_whitelist(intent)) { // Add to white-list, because the device is disconnected now and we // need to start connecting again: prv_mutate_whitelist_safely(&event->peer_address,...
/* * 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, true)
metric_values.out.history[0] = 123; bool success = health_service_private_get_yesterdays_sleep_activity(&start_sec, &end_sec); cl_assert(success); cl_assert_equal_i(123, start_sec); cl_assert_equal_i(123, end_sec); cl_assert_equal_i(1, s_sys_activity_get_metric_values.in.history_len); cl_assert_equal_i(Acti...
(result, 2 *exp_weekly)
; } // Return the sum of a bunch of step average chunks that cover the given time range. The time // range is given in the minute offsets from midnight. This logic is written to produce the // same results as implemented in health_data_steps_get_current_average() of health_data.c // Once the Health app is updated to ...
for the specific language governing permissions and * limitations under the License. */ #include "util/heap.h" #include "util/assert.h" #include "util/math.h" #include "util/logging.h" #include <inttypes.h> #include <stddef.h> #include <string.h> #include <stdio.h> /* The following defines a type that is the siz...
{ heap->corrupt_block = ptr; return; }
UTIL_ASSERT(0); // Error: Heap corrupt around <ptr> } static HeapInfo_t *find_segment(Heap* const heap, unsigned long n_units); static HeapInfo_t *allocate_block(Heap* const heap, unsigned long n_units, HeapInfo_t* heap_info_ptr); //! Advance the block pointer to the next block. static HeapInfo_t* get_next_block(H...
TEXT_COLOR, container); active_window->workout_controller->metric_to_string(metric_type, (char *)number_text_node->text, buffer_size, i18n_owner, active_window->workout_data); if (strlen(number_text_node->text) > 5) { // text is lon...
action_bar_layer_set_icon(action_bar, BUTTON_ID_DOWN, active_window->action_bar_next)
; } } static void prv_update_ui(WorkoutActiveWindow *active_window) { if (window_manager_is_window_visible(&active_window->window)) { layer_mark_dirty(&active_window->base_layer); // Update the action bar in case another client updated the workout's status prv_set_action_bar_icons(active_window); } ...
case ACCEL_SAMPLING_25HZ: case ACCEL_SAMPLING_50HZ: case ACCEL_SAMPLING_100HZ: break; default: return -1; } mutex_lock_recursive(s_accel_manager_mutex); state->sampling_interval_us = (US_PER_SECOND / rate); prv_update_driver_config(); mutex_unlock_recursive(s_accel_manager_mutex...
mutex_unlock_recursive(s_accel_manager_mutex)
; } /* * Driver Callbacks - See accel.h header for more context */ static bool prv_shared_buffer_empty(void) { bool empty = true; mutex_lock_recursive(s_accel_manager_mutex); { AccelManagerState *state = (AccelManagerState *)s_data_subscribers; while (state) { int left = shared_circular_buffer_g...
#include "kernel/pbl_malloc.h" #include "kernel/ui/kernel_ui.h" #include "kernel/ui/modals/modal_manager.h" #include "kernel/util/segment.h" #include "kernel/util/task_init.h" #include "mcu/cache.h" #include "mcu/privilege.h" #include "os/mutex.h" #include "popups/health_tracking_ui.h" #include "popups/timeline/peek.h"...
if (is_unprivileged || is_rocky_app) { mcu_state_set_thread_privilege(false); }
const PebbleMain main_func = entry_point; main_func(); // Clean up after the app. Remember to put only non-critical cleanup here, // as the app may crash or otherwise misbehave. If something really needs to // be cleaned up, make it so the kernel can do it on the apps behalf and put // the call at the b...
typedef enum { StationaryAnalyticsEnterNormally, StationaryAnalyticsEnterFromPeek, StationaryAnalyticsExitNormally, StationaryAnalyticsExitToPeek, StationaryAnalyticsEnterCharging, StationaryAnalyticsExitCharging, StationaryAnalyticsEnableStationaryMode, StationaryAnalyticsDisableStationaryMode } Statio...
prv_watch_is_motionless()
; } else { prv_watch_is_in_motion(); } } //! Called every minute to determine whether any motion has occured since the last time //! the call was made. The current position is updated at this time static void prv_stationary_check_timer_cb(void *unused_data) { //! All stationary events need to be handled by k...
eturn prv_get_duration(data); } static GSize prv_size_getter(KinoReel *reel) { KinoReelTransformData *data = kino_reel_custom_get_data(reel); return interpolate_gsize(data->normalized, data->from.size, data->to.size); } static void prv_transform_list(KinoReelTransformData *data) { KinoReel *reel = prv_get_curre...
if (data->normalized == ANIMATION_NORMALIZED_MAX) { prv_draw_processed_at_rect(data, ctx, offset, data->to, processor); return; }
prv_transform_list(data); if (data->global) { prv_draw_processed_in_global(data, ctx, offset, processor); } else { prv_draw_processed_in_local(data, ctx, offset, processor); } } static GDrawCommandList *prv_get_gdraw_command_list(KinoReel *reel) { KinoReelTransformData *data = kino_reel_custom_get...
to stop advertising before we can start a new job: PBL_LOG(GAP_LE_ADVERT_LOG_LEVEL, "Disable last Ad job"); bt_driver_advert_advertising_disable(); s_is_advertising = false; analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BLE_ESTIMATED_BYTES_ADVERTISED_COUNT); } } if (next) { // S...
if (terms[i].min_interval_slots < min_threshold || terms[i].max_interval_slots < terms[i].min_interval_slots) { return NULL; }
/* * 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 *bitmap = setup_pbi_test(TEST_PBI_FILE); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE)); }
// Tests 4-bit palettized PBI loading into gbitmap // Result: // - gbitmap matches platform loaded PBI void test_pbi__color_4_bit(void) { GBitmap *bitmap = setup_pbi_test(TEST_PBI_FILE); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE)); } // Tests 8-bit color PBI loading into gbitmap // Result: // - gbitmap ...
ENTED_TIMER_INVALID_ID; kino_layer_deinit(&peek_layer->kino_layer); text_layer_deinit(&peek_layer->title.text_layer); text_layer_deinit(&peek_layer->number.text_layer); text_layer_deinit(&peek_layer->subtitle.text_layer); layer_deinit(&peek_layer->layer); } void peek_layer_set_frame(PeekLayer *peek_layer, co...
if (prev_reel) { icon_from = kino_reel_get_elapsed(prev_reel) ? kino_reel_transform_get_to_frame(prev_reel) : kino_reel_transform_get_from_frame(prev_reel); }
kino_layer_set_reel(&peek_layer->kino_layer, NULL, false); KinoReel *from_reel = kino_reel_create_with_resource_system(peek_layer->res_info.res_app_num, peek_layer->res_info.res_id); if (!from_reel) { return; } KinoReel *to_reel = NULL; if...
ecursive(s_app_cache_mutex); return rv; } ////////////////////// // AppCache Helpers ////////////////////// // Remove the filename entry in the PFSFileList (via context) that corresponds to the // app install id passed in via info static bool prv_remove_matching_resource_file_callback(SettingsFile *file, ...
(s_app_cache_mutex)
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_color_assign.8bit.pbi"))
; setup_test_aa_sw(&ctx, fb, GRect(0, 0, 144, 168), GRect(0, 0, 144, 168), false, 1); graphics_context_set_fill_color(&ctx, GColorRed); graphics_fill_rect(&ctx, &GRect(0, 0, 144, 168)); graphics_context_set_compositing_mode(&ctx, GCompOpSet); graphics_context_set_text_color(&ctx, GColorBlue); graphics_draw...
1024, 176, -16}, { 1096, 176, -48}, { 1248, 200, -104}, { 1048, 176, -80}, { 1064, 168, -112}, { 1312, 208, -96}, { 1296, 232, -104}, { 1072, 256, -160}, { 760, 232, -184}, { 536, 208, -176}, { 472, 184, -152}, { 456, 168, -128}, { 504, 208, -112}, { 720, 304, -184},...
{ 1064, 312, -112}, { 1016, 264, -48}, { 864, 272, -32}, { 784, 216, -24}, // 48 seconds { 752, 176, -16}, { 752, 168, -32}, { 784, 160, -8}, { 840, 144, -48}, { 976, 144, -88}, { 1000, 120, -128}, { 1024, 120, -184}, { 1192, 144, -216}, { 1064, 128, -184}, { ...
{ 1040, 184, -16}, { 1064, 168, 0}, { 1088, 128, -32}, { 1232, 168, -72}, { 1112, 176, -104}, { 920, 152, -160}, { 1048, 168, -176}, { 1168, 208, -144}, { 1064, 248, -96}, { 880, 248, -88}, { 664, 232, -128}, { 552, 224, -136}, // 51 seconds { 520, 224, -88}, ...
ons_msg.capabilities.activity_insights_support = 1; #endif versions_msg.capabilities.voice_api_support = 1; versions_msg.capabilities.unread_coredump_support = 1; // FIXME: PBL-31627 In PRF, APP_ID_SEND_TEXT isn't defined - requiring the #ifdef and ternary op. #ifdef APP_ID_SEND_TEXT versions_msg.capabilities.s...
(buffer, sizeof(buffer), "System Resources:\n CRC:0x%"PRIx32"\n Valid:%s", system_resources_version.crc, bool_to_str(system_resource_is_valid()))
; #if CAPABILITY_HAS_PMIC uint8_t chip_id; uint8_t chip_revision; uint8_t buck1_vset; pmic_read_chip_info(&chip_id, &chip_revision, &buck1_vset); prompt_send_response_fmt(buffer, sizeof(buffer), "PMIC Chip Id: 0x%"PRIx8" Chip Rev: 0x%"PRIx8" Buck1 VSET: 0...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(" r offset %"PRIu32, logging_session->storage.read_offset)
; WRITE_LINE(" w sector %u", logging_session->storage.write_sector); WRITE_LINE(" w offset %"PRIu32, logging_session->storage.write_offset); #undef WRITE_LINE } #endif void command_dls_erase_all(void) { dls_clear(); } void command_dls_send_all(void) { // Use this to trigger a send of all data logging data ...
ystem task because it could take a while and also require // more stack space than provided by the timer task. system_task_add_callback(send_timeout_msg, (void*)(uintptr_t)(session->comm.session_id)); // Set reschedule to false because: 1.) we don't need to reschedule the timer since all // we did was...
update_session_state(session, DataLoggingSessionCommStateOpening, true /*reschedule*/)
; return (comm_session_send_data(comm_session, ENDPOINT_ID_DATA_LOGGING, (uint8_t *)&msg, sizeof(DataLoggingOpenSessionMessage), COMM_SESSION_DEFAULT_TIMEOUT)); } void dls_endpoint_close_session(uint8_t session_id) { CommSession *session = comm_ses...
V_APP_MESSAGE(TupletBytes(PostMessageKeyChunk, (const uint8_t *) &chunk, sizeof(chunk))); \ } while(0); //! Asserts whether the outbox has a pending message containing the tuples passed to this macro. //! The value and type of the tuples is also asserted. //! @note Only asserts if expected tuples are MISSING. It wil...
{ prv_init_api(false /* start_connected */); prv_simulate_transport_connection_event(true /* is_connected */); prv_simulate_transport_connection_event(false /* is_connected */); EXPECT_OUTBOX_NO_MESSAGE_PENDING(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateDisconnected); }
cmd_step_sessions(int index, void *context) { ActivityDemoAppData *data = context; // Allocate space for the sessions. Usually, there will only be about 4 or 5 sessions // (1 container and a handful of restful periods). Allocating space for 32 (an arbitrary // number) should be more than enough. uint32_t num...
prv_display_alert(data->debug_card.dialog_text)
; } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_minute_data(int index, void *context) { ActivityDemoAppData *data = context; bool success; const uint32_t k_size = 1000; HealthMinuteData *minute_data = app_malloc(k_size * sizeof(Health...
_bytes_available, }; size_t crc_len = sizeof(local_status_out) - sizeof(local_status_out.crc); local_status_out.crc = crc32(CRC32_INIT, &local_status_out, crc_len); // Full duplex transaction to exchange Status: { spi_transfer_data transfer = { .wbuf = &local_status_out, .rbuf = &remote_statu...
// If not, flip s_is_transacting back while the lock is taken. Otherwise, a concurrent call to // host_transport_tx_enqueue() would be prevented to unblock the transaction loop again. bool has_more_tx_data = circular_buffer_get_read_space_remaining(&s_tx_buffer); bool should_continue = (has_more_tx_data || shou...
CT_NO_INTENT_COUNT, AnalyticsClient_System); } void bluetooth_analytics_handle_ble_pairing_request(void) { analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_PAIRING_COUNT, AnalyticsClient_System); } void bluetooth_analytics_handle_bt_classic_pairing_request(void) { analytics_inc(ANALYTICS_DEVICE_METRIC_BT_PAIRING_COUNT, ...
{ GAPLEConnection *connection = gap_le_connection_get_gateway(); if (!connection) { goto unlock; } LEChannelMap le_channel_map; const bool success = bt_driver_analytics_collect_ble_parameters(&connection->device, &le_channel_map); if (success) { analytics_set(ANALYTICS_DEVIC...
unlock: bt_unlock(); } void analytics_external_collect_chip_specific_parameters(void) { bt_lock(); bt_driver_analytics_external_collect_chip_specific_parameters(); bt_unlock(); } void analytics_external_collect_bt_chip_heartbeat(void) { // TODO: PBL-38365: Re-enable this once it is fixed :( #if 0 if (bt_ct...
%"PRIx32, i->cookie); // PBL_LOG(LOG_LEVEL_DEBUG, "Caller Number: %s", i->caller_number); // PBL_LOG(LOG_LEVEL_DEBUG, "Caller Name: %s", i->caller_name); } static void prv_put_call_disconnect_event(void) { PebbleEvent e = { .type = PEBBLE_PHONE_EVENT, .phone = { .type = PhoneEventType_Disconnect, ...
(LOG_LEVEL_INFO, iter, length)
_pbi_eq(&dest_bitmap, "test_bitblt__8bit_comptint_blend-expect.8bit.pbi")); } // Tests assign, clipping, makes sure in bottom right corner. // Setup: // - Source is 10x15, black box ((0, 0), (5, 10)), rest is red. // - Dest is White, 50x50. // - Dest offset is set to 5x10 pixels in bottom right corner. // Result...
(dest_data, GColorBlue.argb, sizeof(dest_data))
; GRect dest_rect = GRect(0, 0, src_bitmap->bounds.size.w*2, src_bitmap->bounds.size.h*2); GPoint src_origin_offset = { 2, 2 }; // Offset past the 2 red rows bitblt_bitmap_into_bitmap_tiled_8bit_to_8bit( &dest_bitmap, src_bitmap, dest_rect, src_origin_offset, GCompOpAssign, GColorWhite); cl_assert(gbitm...
fault: WTF; } // set the mode and enable the appropriate interrupts switch (transfer_type) { case DMARequestTransferType_Direct: this->stream->periph->CR &= ~DMA_SxCR_CIRC; this->stream->periph->CR |= DMA_SxCR_TCIE; break; case DMARequestTransferType_Circular: this->stream-...
PBL_ASSERTN(this->stream == stream)
; bool has_tc; bool has_ht; prv_get_and_clear_interrupt_flags(this, &has_tc, &has_ht); if (!has_tc && !has_ht) { // we shouldn't be here portEND_SWITCHING_ISR(should_context_switch); return; } switch (this->state->transfer_type) { case DMARequestTransferType_Direct: if (has_tc) { ...
n-flexible parts if (data_size < total_size) { return false; } // check version number if (score->version > VIBE_SCORE_VERSION) { return false; } // check if attr_list_size is correct if (score->attr_list_size != (data_size - (sizeof(VibeScore) - sizeof(GenericAttributeList)))) { return fals...
prv_vibe_score_get_pattern_length(pattern_attribute)
nectionStateRequest *consumer_request = (ConnectionStateRequest *)list_find((ListNode *)conn_mgr_info->requests, prv_find_source, (void *)consumer); bool is_already_granted = (gap_le_connect_params_get_actual_state(hdl) >= state); if (consumer_request == NULL) { ...
(LOG_LEVEL_DEBUG, "Mode chaos monkey: next change=%"PRIu32"ms", delay_ms)
; new_timer_start(s_chaos_monkey_timer, delay_ms, prv_mode_chaos_monkey_callback, data, 0); unlock: bt_unlock(); } void command_le_mode_chaos_monkey(char *enabled_str) { bool new_enabled = atoi(enabled_str); bool is_enabled = (s_chaos_monkey_timer != TIMER_INVALID_ID); if (new_enabled == is_enabled) { ...
, "fill_rect_origin_r1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 2, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_no_clip.${BIT_DEPTH_NAME}.pbi")); s...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r5_aa_no_clip.${BIT_DEPTH_NAME}.pbi"))
; // TODO: Fix left corners PBL-15915 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 6, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r6_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix lef...
acquire(DIALOG_SPI); spi_ll_slave_drive_clock(DIALOG_SPI, false); } static void prv_disable_spi_clock(void) { // When the SPI peripheral is disabled, the CLK line floats. Let's // reconfigure the CLK GPIO to be active low so the Dialog BT controller // doesn't see a false clock edge spi_ll_slave_drive_clock(...
{ dialog_spi_start_cmd(); for (size_t i = 0; i < buf_len; i++) { receive_buf[i] = dialog_spi_send_and_receive_byte(0); } dialog_spi_end_cmd(); }
// NB: this function is used only by the bootloader. void dialog_spi_receive_data(uint8_t *receive_buf, size_t buf_len) { // Dialog will always signal when it has data ready to send dialog_spi_wait_for_int(); dialog_spi_receive_data_no_wait(receive_buf, buf_len); } void dialog_spi_init(ExtiHandlerCallback int_...
rigin, data->circle_radius); } else if (shape == GPATH_TRIANGLE) { gpath_draw_outline(ctx, data->triangle); } else if (shape == GPATH_OPEN_BUCKET) { gpath_draw_outline_open(ctx, data->bucket); } } } static int64_t prv_time_64(void) { time_t s; uint16_t ms; rtc_get_time_ms(&s, &ms); re...
(33, timer_callback, NULL)
; } static void deinit(void) { AppData *data = app_state_get_user_data(); task_free(data); } static void s_main(void) { init(); app_event_loop(); deinit(); } const PebbleProcessMd* pebble_shapes_get_app_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = s_main, ....
s_app_state.h" #include "stubs_heap.h" #include "stubs_logging.h" #include "stubs_memory_layout.h" #include "stubs_pbl_malloc.h" #include "stubs_resources.h" #include "stubs_syscalls.h" #include <stdio.h> #include <sys/stat.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <libgen.h> #include "u...
(filename)
+ 5]; // add space for .pdc + '\0' prv_get_base_path(filename, output); strcat(output, ".png"); write_gbitmap_to_pbi(&ctx.dest_bitmap, output, s_pbi2png_path); prv_teardown_context(&ctx); } static void prv_convert_pdc(const char *filename) { FILE *f = fopen(filename, "rb"); if (f == NULL) { printf...
} uint16_t timeline_layer_get_fat_pin_height(void) { return prv_get_style()->fat_pin_height; } uint16_t timeline_layer_get_ideal_sidebar_width(void) { return prv_get_style()->sidebar_width; } /////////////////////////////////////////////////////////// // Drawing functions ////////////////////////////////////////...
(style->sidebar_width, 0)
, .today_low = entry->today_low_temp, .current_weather_type = entry->current_weather_type, .tomorrow_high = entry->tomorrow_high_temp, .tomorrow_low = entry->tomorrow_low_temp, .tomorrow_weather_type = entry->tomorrow_weather_type, .time_updated_utc = entry->last_update_time_utc, }; // add ...
{ task_free(forecast_out); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return; }
void connection_service_state_init(ConnectionServiceState *state) { } void tick_timer_service_state_init(TickTimerServiceState *state) { return; } void framebuffer_clear(FrameBuffer* f) { return; } void launcher_task_add_callback(void (*callback)(void *data), void *data) { callback(data); } void app_idle_ti...
ayer_set_text(msg_text_layer, "Switch Mode"); break; default: text_layer_set_text(msg_text_layer, "Unknown Test"); break; } text_layer_set_text_alignment(msg_text_layer, GTextAlignmentCenter); text_layer_set_background_color(msg_text_layer, GColorBlack); text_layer_set_text_color(msg_text...
stop_flash_test_case()
ularBuffer *buffer = s_circular_buffer[c]; bt_unlock(); // If we do not hold the bt_lock() at this point it's safe to block for a little bit waiting // for notifications to be consumed uint32_t write_timeout = bt_lock_is_held() ? 0 : GATT_CLIENT_SUBSCRIPTIONS_WRITE_TIMEOUT_MS; bool consumed = prv_w...
{ prv_remove_subscription(connection, subscription); }
// ------------------------------------------------------------------------------------- // We use NOINLINE to reduce the stack requirements during the minute handler (see PBL-38130) static void NOINLINE prv_set_dls_minute_record_entry(AlgMinuteDLSRecord *dls_record, AlgMinu...
{ prv_set_file_minute_record_entry(file_record, &cbuf_record->data, i, cbuf_record->utc_sec, was_sleeping); // Handle writing the record out to data logging }
else { prv_set_dls_minute_record_entry(dls_record, &cbuf_record->data, i, cbuf_record->utc_sec, was_sleeping); } } return true; } // ------------------------------------------------------------------------------------- // If we have enough minute data in our circu...
e LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * dis...
cl_will_return(icache_line_size, 8)
; cl_will_return(dcache_line_size, 8); cl_will_return(syscall_internal_check_return_address, true); s_user_start = 0x24; s_user_size = 0x20; memory_cache_flush((void*)0x26, 0x2); cl_assert_equal_i(s_flush_addr, 0x20); cl_assert_equal_i(s_flush_size, 0x08); cl_assert_equal_i(s_invalidate_addr, 0x20); ...
//////////////////////////////// // Fakes #include "fake_gbitmap_get_data_row.h" // Setup //////////////////////////////////// static GBitmap *test_image_bw; static GBitmap *test_image_color; static FrameBuffer *fb = NULL; #if SCREEN_COLOR_DEPTH_BITS == 1 extern bool get_bitmap_bit(GBitmap *bmp, int x, int y); #elif ...
(&ctx, fb)
; // No Clip, Angle 0 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet); graphics_draw_rotated_bitmap(&ctx, test_image_bw, GPointZero, DEG_TO_TRIGANGLE(0), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_b...
) { prv_init_and_goto_session_open(); const char *not_jsonable_error = "TypeError: Argument at index 0 is not a JSON.stringify()-able object"; EXECUTE_SCRIPT_EXPECT_ERROR("_rocky.postMessage(undefined);", not_jsonable_error); EXECUTE_SCRIPT_EXPECT_ERROR("_rocky.postMessage(function() {});", not_jsonable_err...
("_rocky.postMessage('')")
; EXPECT_OUTBOX_NO_MESSAGE_PENDING(); cl_assert_equal_b(app_timer_trigger(t), true); } ASSERT_JS_GLOBAL_EQUALS_B("didError", true); ASSERT_JS_GLOBAL_EQUALS_S("dataJSON", "{\"x\":1}"); } void test_rocky_api_app_message__postmessageerror_while_disconnected(void) { prv_init_api(false /* start_connected...
(accel_data, sizeof(*accel_data)); } analytics_inc(ANALYTICS_DEVICE_METRIC_ACCEL_PEEK_COUNT, AnalyticsClient_System); PebbleTask task = pebble_task_get_current(); if (task == PebbleTask_Worker || task == PebbleTask_App) { analytics_inc(ANALYTICS_APP_METRIC_ACCEL_PEEK_COUNT, AnalyticsClient_CurrentTask); ...
while (state) { if (!state->raw_buffer || state->samples_per_update == 0) { state = (AccelSubscriberState *)state->list_node.next; continue; } // If buffer has room, read more data if (state->num_samples < state->samples_per_update) { // Read available data. We have to ...
analytics_add(ANALYTICS_DEVICE_METRIC_ACCEL_SAMPLE_COUNT, num_samples, AnalyticsClient_System); PBL_ASSERTN(state->num_samples <= state->raw_buffer_size); } // If buffer is full, notify subscriber to process it if (state->num_samples >= state->samples_per_update...
prv_exti_cb); exti_enable(BOARD_CONFIG_ACCESSORY.exti); } static void prv_initialize_uart(uint32_t baudrate) { #if RECOVERY_FW // In PRF / MFG, we'll have a strong (2k) external pull-up, so we should always be open-drain const bool is_open_drain = true; #else // If we raise the baud rate above 115200 we need ...
prv_unlock()
; } bool accessory_send_stream(AccessoryDataStreamCallback stream_callback, void *context) { bool success = true; prv_lock(); PBL_ASSERTN(xSemaphoreTake(s_send_semaphore, portMAX_DELAY) == pdPASS); PBL_ASSERTN(stream_callback != NULL); PBL_ASSERTN(!s_input_enabled); if (s_dma_enabled) { uart_clear_rx_d...
ob_db/app_db.h" // Fixture //////////////////////////////////////////////////////////////// // Fakes //////////////////////////////////////////////////////////////// #include "fake_spi_flash.h" // Stubs //////////////////////////////////////////////////////////////// #include "stubs_analytics.h" #include "stubs_app_...
(&app1.uuid, &temp)
); cl_assert_equal_b(true, uuid_equal(&app1.uuid, &temp.uuid)); cl_assert_equal_i(0, strncmp((char *)&app1.name, (char *)&temp.name, APP_NAME_SIZE_BYTES)); // check app 3 memset(&temp, 0, sizeof(AppDBEntry)); cl_assert_equal_i(S_SUCCESS, app_db_get_app_entry_for_uuid(&app3.uuid, &temp)); cl_assert_equal_b(...
/* * 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_idle_timeout_pause(); }
return; case PEBBLE_SYS_NOTIFICATION_EVENT: // This handles incoming Notifications and actions on Notifications and Reminders notification_window_handle_notification(&e->sys_notification); return; case PEBBLE_CALENDAR_EVENT: do_not_disturb_handle_calendar_event(&e->calendar); ...
/* * 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 (num_remainder_bytes) { uint32_t last_word = 0; for (unsigned int i = 0; i < num_remainder_bytes; ++i) { last_word = (last_word << 8) | data[i]; } return crc_update(crc, (uint8_t*)&last_word, 4); }
NT, }, [ANCSCharacteristicData] = { [0] = ANALYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_DS_SUBSCRIBE_COUNT, [1] = ANALYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_DS_SUBSCRIBE_FAIL_COUNT, } }; const bool no_error = (error == BLEGATTErrorSuccess); AnalyticsMetric metric = metric_matrix[characteristic...
if (nsnotification->category_id == CategoryIDIncomingCall) { properties |= ANCSProperty_IncomingCall; } else if (nsnotification->category_id == CategoryIDVoicemail) { properties |= ANCSProperty_VoiceMail; }
// Handle the EventFlags if (nsnotification->event_flags & EventFlagMultiMedia) { properties |= ANCSProperty_MultiMedia; } if (s_ancs_client->version >= ANCSVersion_iOS9OrNewer) { properties |= ANCSProperty_iOS9; } // Handle the EventID switch (nsnotification->event_id) { case EventIDNotif...
} // 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; } } // -----------------------------------------------------------...
(&state->common)
) { return false; } } // Parse next set of samples in the current file bool success = prv_parse_activity_samples_file(state); if (success) { *entry = state->test_entry; return true; } else { // No more in this file fclose(state->common.file); state->commo...
/* * 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...
(memcmp(s_expected_data.buf, data, len) == 0)
; } static void prv_assert_no_handler_calls(void) { for (int i = 0; i < NumHandlers; i++) { cl_assert_equal_i(s_handler_call_count[i], 0); } } static void prv_endpoint_handler_a( CommSession *session, const uint8_t *data, size_t length) { s_handler_call_count[HandlerA]++; prv_assert_data_matches_expec...
onst bool mark_synced = !uuid_equal(&item->header.parent_id, &reminders_data_source_uuid); rv = prv_insert_serialized_item( (uint8_t *)&item->header.id, sizeof(TimelineItemId), buffer, sizeof(SerializedTimelineItemHeader) + payload_size, mark_synced); if (rv == S_SUCCESS && emit_event) { blob_db_eve...
timeline_item_storage_flush(&s_pin_db_storage)
; } status_t pin_db_is_dirty(bool *is_dirty_out) { *is_dirty_out = false; return timeline_item_storage_each(&s_pin_db_storage, sync_util_is_dirty_cb, is_dirty_out); } BlobDBDirtyItem* pin_db_get_dirty_list(void) { BlobDBDirtyItem *dirty_list = NULL; timeline_item_storage_each(&s_pin_db_storage, sync_util_buil...
ssert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(has_next); cl_assert_equal_i(new_idx, 5); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[...
timeline_model_get_iter_state(0)
->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(2)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_mo...
); attribute_list_add_cstring(&list, AttributeIdBody, "Topics for the week can be found here: " "http://docs.google.com/u/1/#inbox/14b9fa5f872ebbc6\n\n" "Will email before if we need to cancel"); attribute_list_add_uint32(&list, ...
{ app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = APP_ID_NOTIFICATIONS }); }
void timeline_pins_demo_add_pins(TimelinePinsDemoSet pin_set) { const bool has_broadcaster = true; const bool has_short_subtitle = true; const bool has_short_title = true; const bool has_subtitle = true; const bool has_timestamp = true; const bool is_all_day = true; const bool is_ingame = true; const ...
s = 1, .subtitles = &(HealthDetailSubtitle) { .label = "30 DAY AVG", .fill_color = PBL_IF_COLOR_ELSE(GColorYellow, GColorBlack), }, .bg_color = BG_COLOR, .daily_avg = 900, .weekly_max = 1300, .num_zones = ARRAY_LENGTH(s_zones), .zones = s_zones, }; HealthDetailCard *card = (...
(&card->scroll_layer)
EXECUTE_SCRIPT("var d = new Date();"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {day: 'short'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Mon, 8:04:05 PM"); } void test_rocky_api_datetime__locale_date_string(void) { rocky_global_init(s_api); EXECUTE_SCRIPT( "var d = new Date();\n" "var s = d.to...
ASSERT_JS_GLOBAL_EQUALS_S("s", "25"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'short'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Mon"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'long'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Monday"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undef...
// specified that the data is 8-bits. // Why clear isn't 8-bit is beyond me, but ok. bus->spi->CR2 |= SPI_CR2_FRXTH; #endif // Activate the SPI mode (Reset I2SMOD bit in I2SCFGR register) bus->spi->I2SCFGR &= (uint16_t)~((uint16_t)SPI_I2SCFGR_I2SMOD); prv_spi_disable_peripheral_clock(slave->spi_bus); } sta...
{ slave->spi_bus->state->spi_clock_speed_hz = frequency_hz; prv_spi_slave_init(slave); }
void spi_slave_wait_until_idle_blocking(const SPISlavePort *slave) { while (prv_spi_get_flag_status(slave->spi_bus, SpiI2sFlag_BSY)) continue; } uint32_t spi_get_dma_base_address(const SPISlavePort *slave) { return (uint32_t)&(slave->spi_bus->spi->DR); } // //! Low level slave port interface //! This part of the...
}, { 1392, 288, -96}, { 1344, 280, -48}, { 1432, 232, -96}, { 1272, 112, 0}, { 704, -216, -88}, { 968, -80, -208}, { 728, -208, 8}, { 952, 304, -280}, { 1144, 224, -176}, { 1232, 384, -248}, { 1304, 352, -208}, { 1352, 496, -216}, { 1448, 784, -200}, { 1488, 800, ...
{ 1176, 992, -240}, { 744, 1224, -232}, { 632, 992, -88}, { 1080, 1072, 16}, { 1016, 696, -24}, { 1280, 792, -24}, // 81 seconds { 1592, 688, 0}, { 1496, 408, -80}, { 1288, 344, -104}, { 1328, 216, -96}, { 1392, 304, -80}, { 1472, 264, -96}, { 1224, 208, -80}, ...
{ 1304, 240, -208}, { 1216, 288, -264}, { 1152, 312, -224}, { 1272, 416, -184}, { 1592, 544, -168}, { 1792, 704, -120}, { 1632, 1264, -72}, { 992, 1264, -240}, { 696, 1176, -168}, { 912, 1128, -128}, { 768, 872, -136}, { 1032, 704, -160}, { 1480, 632, -104}, { 15...
ert(gcolor_equal(value, mid_value)); // End prv_advance_to_ms_with_timers(start_ms + duration + MIN_FRAME_INTERVAL_MS*2); cl_assert(gcolor_equal(value, end_value)); #endif } // -------------------------------------------------------------------------------------- // Test that the schedule/unschedule calls wor...
(layer.frame.origin, to_r.origin)
; // ------------------------------------------------------------------------------- // Now, reschedule it prv_advance_by_ms_no_timers(10); prv_clear_handler_histories(); animation_schedule(h); max_loops = 20; start_ms = prv_now_ms(); while (s_stopped_handler_calls.num_calls == 0) { prv_fire_anima...
e at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific languag...
comm_session_is_system(session)
) { const PebbleProtocolCapabilities capabilities = { .flags = capability_flags }; bt_persistent_storage_set_cached_system_capabilities(&capabilities); } } //! Resets the session (close and attempt re-opening the session) //! @note If the underlying transport is iAP, this will end up closing all the session...
.subtype = PebbleBLEGATTClientEventTypeServiceChange, }, }, }, }; // TODO: send only to tasks that are connected virtually event_put(&e); } static void prv_send_services_added_event( const GAPLEConnection *connection, BTErrno status) { uint8_t num_services_changed = (status ==...
kernel_free(node)
BLE[0] (main stack pointer) // PSP = Unknown (process stack pointer) // LR = 0xFFFFFFFF // PC = VECTOR_TABLE[1] // PRIMASK = 0x0 // FAULTMASK = 0x0 // BASEPRI = 0x0 // CONTROL = 0x0 // // Attempt to put the processor into as close to the reset state as possible // bef...
if (!(button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK))) { // stop waiting if not held down any longer return false; }
ystem_session_ptr); } if (s_app_session_ptr) { prv_process_send_queue(s_app_session_ptr); } } // Tests that exercise the sanity checking of the input from the app //////////////////////////////////////////////////////////////////////////////////////////////////// void test_app_message_sender__outbox_data_to...
comm_session_send_queue_consume(s_app_session_ptr, length - 1)
; comm_session_send_queue_cleanup(s_app_session_ptr); assert_consumed(AppMessageSenderErrorDisconnected, 1); cl_assert_equal_i(s_app_install_timestamp_update_count, 0); app_free(outbox_data); } void test_app_message_sender__byte_by_byte_consume(void) { AppMessageAppOutboxData *outbox_data = prv_create_...
h; } Animation *timeline_layer_create_sidebar_animation(TimelineLayer *timeline_layer, int16_t to_sidebar_width) { static const PropertyAnimationImplementation s_implementation = { .base.update = (AnimationUpdateImplementation) property_animation_update_int16, ...
prv_get_style()
; // The arrow is inverted on round, so hide it by extending the width of the sidebar layer->sidebar_width = frame_ref->size.w + PBL_IF_ROUND_ELSE(style->sidebar_arrow_size.w, 0); // layouts layer->scroll_direction = scroll_direction; layer->move_delta = prv_get_scroll_delta(layer); if (scroll_direction == ...
new pin, false if it updated static bool prv_push_pin(TimelineItem *item, Uuid *existing_uuid) { bool rv = false; if (item) { item->header.from_watch = true; item->header.parent_id = (Uuid)UUID_HEALTH_DATA_SOURCE; if (!uuid_is_invalid(existing_uuid)) { item->header.id = *existing_uuid; } els...
{ INSIGHTS_LOG_DEBUG("History validation failed - total/consecutive days didn't match: " "%"PRIu8" %"PRIu8, stats->total_days, stats->consecutive_days); return false; }
// We want to look at the x days before today (which is always index 0), so add 1 uint32_t history_len = insight_settings->reward.target_qualifying_days + 1; if (history_len > ACTIVITY_HISTORY_DAYS) { PBL_LOG(LOG_LEVEL_ERROR, "Insight qualifying history length is too long: %"PRIu32, history_len)...
nds on readings. enum AS7000SQIThreshold { AS7000SQIThreshold_Excellent = 2, AS7000SQIThreshold_Good = 5, AS7000SQIThreshold_Acceptable = 8, AS7000SQIThreshold_Poor = 10, AS7000SQIThreshold_Worst = 20, AS7000SQIThreshold_OffWrist = 254, AS7000SQIThresholdInvalid, }; enum AS7000Status { AS7000Status_O...
PPG_DBG("host one second time: %"PRIu32" ms", average_ms)
; // Register takes a reading in 0.1ms increments uint16_t value = average_ms * 10; const uint8_t msb = (value >> 8) & 0xff; const uint8_t lsb = value & 0xff; return prv_write_register(dev, ADDR_HOST_ONE_SECOND_TIME_MSB, msb) && prv_write_register(dev, ADDR_HOST_ONE_SECOND_TIME_LSB, lsb); } static vo...
em_size, num_bytes[i]); } // Clear the logging sessions from RAM dls_list_remove_all(); DataLoggingSessionRef logging_session = dls_list_get_next(NULL); cl_assert(logging_session == NULL); // Reset regular timer. dls_init() will add the same timer info again regular_timer_deinit(); regular_timer_init(...
{ DataLoggingSessionRef logging_session; // Create session Uuid system_uuid = UUID_SYSTEM; const PebbleProcessMd *md = sys_process_manager_get_current_process_md(); const Uuid *uuid; if (buffered) { uuid = &md->uuid; } else { uuid = &system_uuid; } logging_session = (DataLoggingSessionRef)dls...
const int items_per_send = (COMM_MAX_OUTBOUND_PAYLOAD_SIZE - sizeof(DataLoggingSendDataMessage)) / item_size; const int num_sends = num_items / items_per_send; for (int i = 0; i < num_sends + 5; i++) { // This sends a chunk out and it should show up in our prv_transport_sent_data_...
next(&iterator)); } static void prv_insert_extra_case_items(void) { pin_db_flush(); for (int i = 0; i < ARRAY_LENGTH(s_extra_case_items); i++) { cl_assert_equal_i(pin_db_insert_item(&s_extra_case_items[i]), 0); } } // 5am, no events passed void test_timeline__extra_case_forwards(void) { prv_insert_extra_c...
timeline_init(&head)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
kernel_malloc_check(sizeof(Uuid))
; *uuid = notification->header.id; notifications_handle_notification_added(uuid); }
ONE); break; default: PBL_CROAK("reset loop boot bits overrun"); break; } return false; } static bool check_for_recovery_start_failure() { return boot_bit_test(BOOT_BIT_RECOVERY_START_IN_PROGRESS); } static bool check_for_fw_start_failure() { // Add more failure conditions here. if (!watchdog_...
dbgserial_putstr(" ___ _ _ _ ")
; dbgserial_putstr("/ __><_>| || |__"); dbgserial_putstr("\\__ \\| || || / /"); dbgserial_putstr("<___/|_||_||_\\_\\"); dbgserial_putstr(""); // PMIC requires I2C i2c_init(); dbgserial_putstr("i2c inited"); pmic_init(); dbgserial_putstr("pmic inited"); boot_bit_init(); dbgserial_putstr("boo...
sleep" snprintf(short_subtitle, max_attr_length, short_subtitle_fmt, elapsed); attribute_list_add_cstring(&pin_attr_list, AttributeIdShortSubtitle, short_subtitle); attribute_list_add_cstring(&pin_attr_list, AttributeIdSubtitle, elapsed); const char *title_i18n = PBL_IF_RECT_ELSE(i18n_noop("YOU NAPPED"), ...
{ Uuid pin_uuid = UUID_INVALID; TimelineItem *pin_item = prv_create_nap_pin(now_utc, session); if (prv_push_pin(pin_item, &pin_uuid) && activity_prefs_sleep_insights_are_enabled()) { prv_push_nap_session_notification(now_utc, session, &pin_uuid); } }
// ----------------------------------------------------------------------------------------- static void prv_do_nap_session(time_t now_utc, ActivitySession *session) { if (s_nap_pin_state.last_triggered_utc >= session->start_utc) { INSIGHTS_LOG_DEBUG("Not adding nap pin - already added"); return; } 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...
{ uint8_t testbuf1[8] = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, }; uint8_t testbuf2[8] = { 0x12, 0x34, 0x56, 0x78, 0x00, 0xBC, 0xDE, 0xF0, }; cl_assert_equal_b(!memcmp(testbuf1, testbuf2, 8), false); }
void test_memcmp__partial(void) { uint8_t testbuf1[9] = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0x0D, }; uint8_t testbuf2[9] = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0xBA, }; cl_assert_equal_b(!memcmp(testbuf1, testbuf2, 8), true); }
fs_read(fd, read_buffer, header->payload_length); if (result < 0) { goto cleanup; } if (!timeline_item_deserialize_item(notification, header, read_buffer)) { goto cleanup; } task_free(read_buffer); return true; cleanup: task_free(read_buffer); return false; } size_t notification_storage_get_...
(&header, prv_uuid_equal_func, (void *) id, fd)
) { *status = header.common.status; rv = true; } prv_file_close(fd); return rv; } void notification_storage_set_status(const Uuid *id, uint8_t status) { PBL_ASSERTN(s_notif_storage_mutex != NULL); SerializedTimelineItemHeader header = { .common.id = UUID_INVALID }; int fd = prv_file_open(OP_FLAG...
_flags = prv_get_page_flags(pg); if (!IS_PAGE_TYPE(pg_hdr.page_flags, PAGE_FLAG_START_PAGE)) { continue; // only start pages contain file name info } FileHeader file_hdr; prv_flash_read((uint8_t *)&file_hdr.file_namelen, sizeof(file_hdr.file_namelen), prv_page_to_flash_offset(...
{ // default index to overwrite if nothing better is found optimal_idx = MAX_PAGE_CACHE_ENTRIES - 1; uint8_t contiguous_pgs = fpc[0].contiguous_pgs; // find the entry with the smallest number of sequential pages as this // will be the best page to remove from the cache for (int i = 0; i < MAX_...
else { (*cur_idx)++; // we are adding a new entry } fpc[optimal_idx] = *toadd; } static NOINLINE void allocate_page_cache(int fd) { File *f = &PFS_FD(fd).file; if (f->pg_cache != NULL) { return; // already cached } if ((f->file_size / free_bytes_in_page(f->start_page)) < 1) { return; // on...
start_time + (5 * SECONDS_PER_HOUR), HealthServiceTimeScopeDailyWeekdayOrWeekend); cl_assert_equal_i(value, exp_value); // --- // Compute daily step average from midnight to 9am. This should use the 15-minute // step averages that we stuffed in. exp...
(value, stats->min)
; stats->max = MAX(value, stats->max); stats->count++; stats->avg = stats->sum / stats->count; } // Test that health_service_aggregate_averaged() returns the correct result when asked to get the // aggregates of rate metrics (like heart rate). For these metrics, only min, max, and avg are // valid aggregation fu...
th the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o...
{ char res_path[strlen(CLAR_FIXTURE_PATH) + strlen(APP_REGISTRY_FIXTURE_PATH) + strlen(name) + 3]; sprintf(res_path, "%s/%s/%s", CLAR_FIXTURE_PATH, APP_REGISTRY_FIXTURE_PATH, name); // Check that file exists and fits in buffer struct stat st; cl_assert(stat(res_path, &st) == 0); FILE *file = fopen(res_path...
/* Start of test */ static const AppInstallId CRAZY_ID = 171717; bool app_install_get_entry_for_uuid(const Uuid *uuid, AppInstallEntry *entry) { AppInstallId id = app_install_get_id_for_uuid(uuid); return app_install_get_entry_for_install_id(id, entry); } static bool prv_app_install_is_watchface(AppInstallId...
bDBResponse); return iter; } T_STATIC void prv_send_response(CommSession *session, uint8_t *response, uint8_t response_length) { comm_session_send_data(session, BLOB_DB2_ENDPOINT_ID, response, response_length, COMM_SESSION_DEFAULT_TIMEOUT); } static void p...
{ if (length < SYNC_DONE_RESPONSE_LENGTH) { PBL_LOG(LOG_LEVEL_ERROR, "Got a sync done response with an invalid length: %"PRIu32"", length); return; } // read token and response code BlobDBToken token; BlobDBResponse response_code; prv_read_token_and_response(data, &token, &response_code); if (re...
static void prv_send_error_response(CommSession *session, BlobDBCommand cmd, const uint8_t *data, BlobDBResponse response_code) { struct PACKED ErrorResponseMsg { BlobDBCommand cmd; BlobDBToken token;...
al_b(app_message_is_accepting_outbound(), true); } void test_app_message__send_happy_case_ack_then_outbox_sent(void) { prv_set_remote_receive_handler(prv_ack_sent_callback); prv_send_test_data(); prv_process_sent_data(); // With certain PP transports (i.e. PPoGATT), the 'consuming' of the outbound data / outb...
(prv_nack_sent_callback)
; // Disconnect the comm session s_is_connected = false; // The return value should be APP_MSG_OK, even though we already know it's going to fail. // The failure should be delivered after returning from app_message_outbox_send(), because // some apps call .._send() again from the failed_callback. prv_send...
/* * 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_window_stack_push(number_window_get_window(vibe_num_window), 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...
fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)
); text_layer_set_text_alignment(pass, GTextAlignmentRight); text_layer_set_text(pass, "Pass"); layer_add_child(&window->layer, &pass->layer); bounds.origin.y = 120; TextLayer *fail = &results_ui->fail_text_layer; text_layer_init(fail, &bounds); text_layer_set_font(fail, fonts_get_system_font(FONT_KEY_GO...
/* * 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...
event_service_client_unsubscribe(&state->will_focus_info)
; } if (state->handlers.did_focus) { event_service_client_unsubscribe(&state->did_focus_info); } state->handlers = (AppFocusHandlers) {}; }
pp_num, uint32_t resource_id, uint32_t *num_bytes_out) { return NULL; } // setup and teardown void test_gdraw_command_sequence__initialize(void) { } void test_gdraw_command_sequence__cleanup(void) { } size_t prv_create_test_sequence(GDrawCommandSequence **sequence_ptr) { size_t size = sizeof(GDrawCommand...
gdraw_command_sequence_get_frame_by_index(sequence, 1)
);; cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_elapsed(sequence, 44)); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_elapsed(sequence, 45)); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_elapsed(sequence, 46)); // test that frame is skipped when the duration is z...
BACKWARD, &data->icon_skip_backward, animated); if (music_get_playback_state() == MusicPlayStatePaused) { action_bar_layer_set_icon_animated(&data->action_bar, BUTTON_ID_SELECT, &data->icon_play, animated); } else { action_bar_layer...
(data->volume_is_up)
; prv_do_haptic_feedback_vibe(context); } static void prv_volume_long_click_start_handler(ClickRecognizerRef recognizer, void *context) { const bool volume_is_up = (click_recognizer_get_button_id(recognizer) == BUTTON_ID_UP); prv_change_volume(volume_is_up); prv_set_action_bar_state(context, ActionBarStateLong...