prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
pen = false, .num_points = ARRAY_LENGTH(points2), }; memcpy(command->points, points2, sizeof(points2)); frame = (GDrawCommandFrame *)(command->points + command->num_points); *frame = (GDrawCommandFrame) { .duration = 30, }; frame->command_list = (GDrawCommandList) { .num_commands = 1 }; com...
free(sequence)
; } void test_gdraw_command_sequence__get_frame_by_index(void) { GDrawCommandSequence *sequence; prv_create_test_sequence(&sequence); GDrawCommandFrame *frame = gdraw_command_sequence_get_frame_by_index(sequence, 0); cl_assert_equal_i(frame->duration, 15); cl_assert_equal_i(frame->command_list.num_commands,...
/* * 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...
(circular_buffer_copy(&buffer, data_out, data_out_size), 0)
; // Write + consume, so read index is at 2: circular_buffer_write(&buffer, (uint8_t *)"0123", 4); circular_buffer_consume(&buffer, 2); // Write data that will be wrapped: circular_buffer_write(&buffer, (uint8_t *)"456789", 6); // Test copying the whole thing (providing buffer of 8 bytes): memset(data_...
und 90° and 270° if (radius_x == radius_y) { // We're dealing with circle here - theres an easier way... return prv_get_rotated_precise_point(center, radius_x, angle); } // This is an edge case due to fixedpoint math if (angle % QUADRANT_ANGLE == 0) { radius_x <<= FIXED_S16_3_PRECISION; radius_...
{ int16_t x = center.x + (offset.x * quadrant_mask_mul[i].x_mul); int16_t y = center.y + (offset.y * quadrant_mask_mul[i].y_mul); graphics_private_plot_pixel(fb, clip_box, x, y, brightness, stroke_color); }
} } static void prv_plot8(GBitmap *fb, GRect *clip_box, GPoint center, GPoint offset, int8_t brightness, GColor stroke_color, GCornerMask quadrant) { /* * This will mirror given offset point over all eighths of the circle at given center * \ x8| x / * \ | / * \ | ...
/* $6 */ pdp->is_configurable_defined, /* $7 */ pdp->is_configurable, /* $8 */ pdp->value, /* $9 */ pdp->getter, /* $10 */ pdp->setter, /* $11 */ obj_val, /* $12 */ prop_name_val /* $13 */ )); } jerry_value_t emscripten_call_jerry_functi...
{ return TYPE_ERROR_ARG; }
return (jerry_value_t)EM_ASM_INT({ return __jerryRefs.ref(__jerryRefs.get($0).prototype); }, value); } jerry_value_t jerry_set_prototype(const jerry_value_t obj_val, const jerry_value_t proto_obj_val) { return 0; // FIXME: Not sure what to do here } bool jerry_get_object_native_handle(const jerry_value...
tributes = NULL, }, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, } }; // items with long duration static TimelineItem s_long_items[] = { { .header = { .id = {0xaa}, .timestamp = 10000, .duration = 30, .type = TimelineI...
(&s_items[i])
oid test_shared_prf_storage_v2__bt_classic_pairing(void) { shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_get_bt_classic_pairing_data(NULL, NULL, NULL, NULL), false); BTDeviceAddress addr = { .octets = { 0x11, 0x22, 0x33, 0x44, 0x55, }, }; char device_name[BT_DEVICE_NAME_BU...
shared_prf_storage_set_getting_started_complete(true)
; // Expect flash getting touched: cl_assert(write_count < fake_flash_write_count()); cl_assert(erase_count < fake_flash_erase_count()); write_count = fake_flash_write_count(); erase_count = fake_flash_erase_count(); shared_prf_storage_set_getting_started_complete(true); // Expect flash NOT getting touch...
------------------------------ // delay_a | duration a | | // | delay_b | duration_b | // | delay_c | duration_c | // | delay_s | delay_d | duration_d | // ---------------------------...
{ prv_add_handler_entry(&s_update_handler_calls, animation, false, (void *)(uintptr_t)distance /*context*/); DPRINTF("%"PRIu64" ms: Executing update handler for %d, distance: %d\n", prv_now_ms(), (int)animation, (int)distance); if (distance > ANIMATION_NORMALIZED_MAX / 2) { a...
// -------------------------------------------------------------------------------------- // Test unscheduling animations arbitrarily in an update handler. static void prv_unschedule_all_in_update_handler(bool auto_destroy) { const int duration_a = 300; // This one will complete const int delay_a = 10; prv_c...
ndered setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NULL, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_null...
(&ctx, "jja", &s_font_info, RECT_NULL, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL)
; cl_check(framebuffer_is_empty("draw_text_null_null", fb, GColorWhite)); } void test_graphics_draw_text_8bit__color(void) { GContext ctx; prv_setup_resources(); uint32_t gothic_18_handle = RESOURCE_ID_GOTHIC_18_BOLD; cl_assert(text_resources_init_font(0, gothic_18_handle, 0, &s_font_info)); test_graphi...
nu(ActionMenuConfig *base_config, WindowStack *window_stack) { PBL_ASSERTN(base_config); TimelineActionMenu *timeline_action_menu = applib_zalloc(sizeof(TimelineActionMenu)); if (!timeline_action_menu) { return NULL; } ActionMenuConfig config = *base_config; ...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Didn't take any actions, cleaning up"); const bool success = false; prv_cleanup_action_result(data, success); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
dialog_spi_assert_chip_select(false)
; // FIXME: PBL-32865: The "OVR" (overrun) status flag gets set at some point, not sure why because // the data arrives OK. Need to reset it, otherwise the next transfer will get a 0x00 byte // prepended to the beginning... // From the F7 Spec: "When the SPI is used only to transmit data, it is possible to ena...
ly one byte: SendBuffer *write_sb2 = comm_session_send_buffer_begin_write(&s_session, ENDPOINT_ID, 1 /* required_free_length */, TIMEOUT_MS); // Because the ..._begin_write() call happened ...
(write_sb)
; // Expect comm_session_send_next to be called to trigger the transport: cl_assert_equal_i(s_send_next_count, 1); // Exercise the transport interface: const SessionSendQueueJob *job = (const SessionSendQueueJob *)write_sb; // ..._get_read_space_remaining(): size_t expected_bytes_incl_pebble_protocol_heade...
sys_activity_get_metric(ActivityMetricSleepEnterAtSeconds, 1, enter_sec)
& sys_activity_get_metric(ActivityMetricSleepExitAtSeconds, 1, exit_sec); } // ---------------------------------------------------------------------------------------------- HealthServiceAccessibilityMask health_service_any_activity_accessible( HealthActivityMask activity_mask, time_t start_time, time_t e...
s_bar_color(SwapLayer *swap_layer) { // Set initial values to assume failure bool color_status_bar = false; GColor bg_color = GColorClear; // If there is a current layout, then fetch the color and whether or not the status bar // should be colored if (swap_layer->current) { const GRect *cur_frame = &sw...
(property_animation, &end)
; layer_set_frame(layer, &end); } } //! Creates an animation that moves a layer from its original frame to another frame that is offset //! dy (change in origin.y). static Animation *prv_create_anim_frame_scroll(Layer *layer, uint32_t duration, int16_t dy, ScrollAni...
ess = activity_algorithm_get_minute_history(context->minute_data, context->num_records, context->utc_start); } else { context->success = false; } // Unblock the caller context->complete...
kernel_free(data)
; s_activity_state.sample_collection_data = NULL; s_activity_state.sample_collection_seconds = rtc_get_time() - s_activity_state.sample_collection_seconds; } *enabled = s_activity_state.sample_collection_enabled; *session_id = s_activity_state.sam...
/* * 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...
(&sessions[*session_entries], 0, num_sessions_to_clear * sizeof(ActivitySession))
; } // ------------------------------------------------------------------------------------ // Return true if the given activity type is a sleep activity bool activity_sessions_prv_is_sleep_activity(ActivitySessionType activity_type) { switch (activity_type) { case ActivitySessionType_Sleep: case ActivitySe...
l/syscall.h" #include "system/passert.h" #include "drivers/vibe.h" #include "applib/applib_malloc.auto.h" #include "util/net.h" #define VIBE_SCORE_MAX_REPEAT_DELAY_MS (10000) // matches MAX_VIBE_DURATION_MS in vibe_pattern static VibeNote *prv_vibe_score_get_note_list(GenericAttribute *notes_attribute) { return (V...
{ return false; }
} return true; } VibeScore *vibe_score_create_with_resource_system(ResAppNum app_num, uint32_t resource_id) { uint32_t data_size; if (!prv_vibe_score_resource_is_valid(app_num, resource_id, VIBE_SIGNATURE, &data_size)) { return NULL; } VibeScore *vibe...
tions_received, 5); } extern ANCSClientState prv_get_state(void); extern void prv_check_ancs_alive(void); void test_ancs__alive_check_disconnection(void) { prv_check_ancs_alive(); // check we're in the alive check state and we sent a single request cl_assert_equal_i(prv_get_state(), ANCSClientStateAliveCheck);...
fake_event_get_last()
.type, PEBBLE_ANCS_DISCONNECTED_EVENT); // Make sure that losing BT altogether sends the event ancs_destroy(); cl_assert_equal_i(fake_event_get_last().type, PEBBLE_ANCS_DISCONNECTED_EVENT); fake_event_clear_last(); } void test_ancs__unrequested_notifications(void) { prv_fake_receiving_ds_notification(ARRAY_...
d }); WindowStack *stack = app_state_get_window_stack(); // Switch to the app state to push a window stub_pebble_tasks_set_current(PebbleTask_App); cl_check(stack); cl_assert_equal_i(window_stack_count(stack), 0); window_stack_push(stack, window, true); cl_assert_equal_i(window_stack_count(stack), ...
(animation_is_scheduled(second))
; }
/* * 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...
{ // Simple fake, can only handle one call cl_assert_equal_p(s_launcher_task_callback, NULL); s_launcher_task_callback = callback; s_launcher_task_callback_data = data; }
ir callback procedure! if (reg_timer->pending_delete) { list_remove(&reg_timer->list_node, NULL, NULL); } } else { iter = list_get_next(iter); } } mutex_unlock(s_callback_list_semaphore); } // --------------------------------------------------------------------------------------...
(s_callback_list_semaphore)
; } // ----------------------------------------------------------------------------------------- void regular_timer_add_minutes_callback(RegularTimerInfo* cb) { // special case for triggering each minute regular_timer_add_multiminute_callback(cb, 1); } // ----------------------------------------------------------...
b_read(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, send_text_prefs_out, data_len), S_SUCCESS); cl_assert_equal_m(s_send_text_prefs, send_text_prefs_out, data_len); // Make sure we reject malformed data (not aligned to list size) cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_tex...
(WEATHER_KEY, WEATHER_KEY_LEN)
, data_len); SerializedWeatherAppPrefs *weather_prefs_out = watch_app_prefs_get_weather(); cl_assert_equal_m(s_weather_prefs, weather_prefs_out, data_len); watch_app_prefs_destroy_weather(weather_prefs_out); }
nticipation) // _out will be added to second value (overshoot, swing-back) static const int32_t s_delta_moook_in[] = {0, 1, 20}; static const int32_t s_delta_moook_out[] = {INTERPOLATE_MOOOK_BOUNCE_BACK, 2, 1, 0}; // TODO: export these as interpolation functions as well uint32_t interpolate_moook_in_duration() { ret...
{ return prv_interpolate_moook(normalized, from, to, s_delta_moook_in, ARRAY_LENGTH(s_delta_moook_in), s_delta_moook_out, ARRAY_LENGTH(s_delta_moook_out), num_frames_mid, true); }
int64_t interpolate_moook_custom(int32_t normalized, int64_t from, int64_t to, const MoookConfig *config) { PBL_ASSERTN(config); return prv_interpolate_moook(normalized, from, to, config->frames_in, config->num_frames_in, ...
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_assert_equal_i(prv...
animation_destroy(b)
{ return; }
int new_fd = pfs_open(FILENAME, OP_FLAG_OVERWRITE | OP_FLAG_READ, FILE_TYPE_STATIC, NOTIFICATION_STORAGE_FILE_SIZE); if (new_fd < 0) { prv_file_close(fd); return; } Iterator iter; NotificationIterState iter_state = { .fd = fd }; iter_init(&iter, (IteratorCallback)prv_rewrite_iter_next...
layout->metric_icon_layers[i - 1], }, }; GTextNodeText *metric_node = (GTextNodeText *)layout_create_text_node_from_config( layout_ref, &metric_config.extent.node); prv_add_metric(layout, vertical_node, i, &metric_node->node); } return vertical_node; } static GTextNode *p...
{ *size_out = frame.size; }
} GTextNodeCustom *layout_node_create_kino_layer_wrapper(KinoLayer *kino_layer) { return graphics_text_node_create_custom(prv_kino_layer_wrapper_callback, (void *)kino_layer); }
PBL_IF_RECT_ELSE(GTextAlignmentCenter, GTextAlignmentRight), GTextOverflowModeTrailingEllipsis); layer_add_child(&s_phone_ui_data->core_ui_container, &s_phone_ui_data->caller_id_text_layer.layer); // Shrink the bounds but not the frame size to allow for cen...
(TIMELINE_RESOURCE_DURING_PHONE_CALL)
; #else // action bar requires right-aligned icon, otherwise centered icon prv_set_icon_resource((can_decline) ? TIMELINE_RESOURCE_DURING_PHONE_CALL : TIMELINE_RESOURCE_DURING_PHONE_CALL_CENTERED); #endif prv_set_window_color(ACCEPT_COLOR, false); prv_action_bar_setup(can_decline ? Pho...
ction = prv_start_voice_reply, .action_data = action, }, #else { // This should never get used because prv_is_reply_option_supported() will return false }, #endif { .label = i18n_get("Canned messages", root_level), .is_leaf = 0, }, { .label = i18n_get("Emoji", root_...
action_menu_level_add_action(postpone_level, i18n_get("In 15 minutes", root_level), prv_postpone_15_minutes, action)
; if (show_later_today) { action_menu_level_add_action(postpone_level, i18n_get("Later today", root_level), prv_postpone_later_today, action); } action_menu_level_add_action(postpone_level, ...
gh to be registered as "awake" for over 2 hours prv_feed_steps_min((2.5 * MINUTES_PER_HOUR) + ACTIVITY_SESSION_UPDATE_MIN); // Fast forward time rtc_set_time(time_util_get_midnight_of(rtc_get_time()) + 4 * SECONDS_PER_DAY); } activity_prefs_sleep_insights_set_enabled(prev_insights_enabled); prv_test...
(mktime(&time_tm))
RTC_CoarseCalibCmd(ENABLE); } //! Our RTC tick counter actually overflows once every 86 seconds. If we don't call rtc_get_ticks() every 86 seconds, //! the counter may roll over multiple times, causing our clock to appear to have gaps. This repeating callback allows //! us to make sure this doesn't happen. static vo...
periph_config_acquire_lock()
; rtc_enable_backup_regs(); periph_config_release_lock(); restore_rtc_time_state(); initialize_fast_mode_state(); #ifdef PBL_LOG_ENABLED char buffer[TIME_STRING_BUFFER_SIZE]; PBL_LOG(LOG_LEVEL_DEBUG, "Current time is <%s>", rtc_get_time_string(buffer)); #endif } void rtc_init_timers(void) { static Regu...
0x0474) #define RAM_ADDR_LIFTOFF_RETRIES (0x04D3) // magic number for enabling palm detection + reporting #define RAM_VALUE_ENABLE_PALM_DETECTION (0x02BC) // If we don't service an interrupt, the controller will retry every 10ms. We never want to lose a // touch event, so we set the number of retries to a very high v...
if (type == StatusReadType_12bit) { // The 3 data bytes are ST PQ R1 (in hex) with ST being the address and RPQ being the value. PBL_ASSERTN(response.data[0] == address); PBL_ASSERTN((response.data[2] & 0x0F) == PACKET_FOOTER); *(uint16_t *)result = response.data[1] | ((uint16_t)(response.data[2] & 0xF0...
/* * 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 false; }
0}, {60, 4190}, {70, 4250}, }; #elif PLATFORM_SPALDING // When the voltage drops below these (mV), the watch will start heading for standby (after delay) #define BATTERY_CRITICAL_VOLTAGE_CHARGING 3700 #define BATTERY_CRITICAL_VOLTAGE_DISCHARGING 3300 // Battery Tables for Spalding static VoltagePoint discharge_cu...
{ compensate += s_battery_compensation_values[i]; }
return prv_lookup_percent_by_voltage(battery_mv + compensate, is_charging, scaling_factor); } uint32_t battery_curve_sample_ratio32_charge_percent(uint32_t battery_mv, bool is_charging) { const uint32_t scaling_factor = ratio32_from_percent(100) / 100 + 1; return prv_sample_scaled_charge_percent(battery_mv, is...
); cl_assert(NULL == bmp); bmp = gbitmap_create_blank(s10, GBitmapFormat1BitPalette); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, GBitmapFormat2BitPalette); cl_assert(NULL != bmp); cl_assert(g_gbitmap...
(s10, GBitmapFormat1BitPalette, p, true)
; cl_assert(NULL != bmp); cl_assert(p == gbitmap_get_palette(bmp)); bmp = gbitmap_create_blank_with_palette(s10, GBitmapFormat2BitPalette, p, true); cl_assert(NULL != bmp); cl_assert(p == gbitmap_get_palette(bmp)); bmp = gbitmap_create_blank_with_palette(s10, GBitmapFormat4BitPalette, p, true); cl_asser...
/* * 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...
{ bool success = prefs_private_read_backing(key, key_len, val_out, val_out_len); if (success) { return S_SUCCESS; } else { return E_INVALID_ARGUMENT; } }
status_t prefs_db_delete(const uint8_t *key, int key_len) { return E_INVALID_OPERATION; } status_t prefs_db_flush(void) { return E_INVALID_OPERATION; }
GSize(DISP_COLS, height)
}; const GPoint origin = GPoint(delta * sx, delta * sy); if (mode == RenderMoveTextBox) { box.origin = origin; ctx.draw_state.drawing_box.origin = GPointZero; } else { ctx.draw_state.drawing_box.origin = origin; } graphics_fill_rect(&ctx, &box); graphics_draw...
h.h" #define APNG_DECODE_ERROR "APNG decoding failed" #define APNG_MEMORY_ERROR "APNG memory allocation failed" #define APNG_FORMAT_ERROR "Unsupported APNG format, only APNG8 is supported!" #define APNG_LOAD_ERROR "Failed to load APNG" #define APNG_UPDATE_ERROR "gbitmap_sequence failed to update bitmap" #define APNG_E...
gbitmap_png_is_format_supported(upng)
) { APP_LOG(APP_LOG_LEVEL_ERROR, APNG_FORMAT_ERROR); goto cleanup; } // Create a color palette in RGBA8 format from RGB24 + ALPHA8 PNG Palettes upng_format png_format = upng_get_format(upng); if (png_format >= UPNG_INDEXED1 && png_format <= UPNG_INDEXED8) { bitmap_sequence->png_decoder_data.palette...
/* * 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...
((AppMessageSendJob *)send_job)
; } // ------------------------------------------------------------------------------------------------- // Interfaces towards Send Queue: static size_t prv_get_length(AppMessageSendJob *app_message_send_job) { AppOutboxMessage *outbox_message = prv_outbox_message_from_app_message_send_job(app_message_send_j...
imeline_layout) { KinoReel *from_reel = kino_reel_create_with_resource_system( card_timeline_layout->icon_res_info.res_app_num, card_timeline_layout->icon_res_info.res_id); if (!from_reel) { return; } const uint32_t duration = TIMELINE_CARD_TRANSITION_MS; GRect icon_from, icon_to; layer_ge...
(5 * FIXED_S32_16_ONE.raw_value / 6)
; kino_reel_scale_segmented_set_point_duration(new_reel, POINT_DURATION); kino_reel_scale_segmented_set_interpolate(new_reel, interpolate); prv_change_reel(layout, new_reel); // Unclip for the scaling animation layer_set_clips(&layout->icon_layer.layer, false); } PropertyAnimation *property_a...
tate.fill_color = menu_layer->normal_colors[MenuLayerColorBackground]; graphics_fill_rect(ctx, bounds); } graphics_context_set_drawing_state(ctx, prev_state); } void menu_layer_update_proc(Layer *scroll_content_layer, GContext* ctx) { MenuLayer *menu_layer = (MenuLayer*)(((uint8_t*)scroll_content_layer) - ...
inverter_layer_init(inverter, &GRectZero)
; scroll_layer_add_child(scroll_layer, &inverter->layer); // Hide inverter layer by default for 3.0 apps layer_set_hidden(inverter_layer_get_layer(&menu_layer->inverter), true); #if PBL_ROUND prv_set_center_focused(menu_layer, true); #endif } MenuLayer* menu_layer_create(GRect frame) { MenuLayer *layer = a...
or not. uint8_t file_id:FILE_ID_BIT_WIDTH; //! Just in case we have to change this struct in the future. uint8_t version_id:VERSION_ID_BIT_WIDTH; } FileHeaderBasic; typedef struct PACKED { char version_tag[FW_METADATA_VERSION_TAG_BYTES]; uint8_t is_recovery; } FileHeaderDetails; typedef struct PACKED { F...
generation_to_index(file_generation)
), sizeof(file_header)); if (file_header.magic != VALID_FILE_HEADER_MAGIC) { return false; } if (file_header.version_id != CURRENT_VERSION_ID) { return false; } if (file_header.file_id != (s_current_file_id - file_generation)) { PBL_LOG(LOG_LEVEL_DEBUG, "Id: %"PRIu8" Expected: %u", file_header....
; } static int16_t prv_custom_day_picker_get_cell_height(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) { return ALARM_DAY_LIST_CELL_HEIGHT; } static void prv_custom_day_picker_dra...
(data->alarm_id, data->scheduled_days)
; data->complete_callback(EDITED, data->alarm_id, data->callback_context); } app_window_stack_pop(true); } } else { // selecting a day of the week // day_of_week index starts from sunday, and printed list starts from monday uint16_t day_of_week = (cell_index->row) % DAYS_PER_WEEK; ...
ion(a, duration_a); prv_clear_handler_histories(); animation_schedule(a); uint64_t start_ms = prv_now_ms(); prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); // Should not have run at all cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 0); cl_ass...
cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0); // Complete A and start B prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handl...
/* * 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...
menu_layer_set_callbacks(&simple_menu->menu, simple_menu, &(MenuLayerCallbacks) { .get_num_sections = get_num_sections, .get_header_height = get_header_height, .get_num_rows = get_num_rows, .draw_row = draw_row, .select_click = select_click, .draw_header = draw_header, })
; menu_layer_set_click_config_onto_window(&simple_menu->menu, window); } SimpleMenuLayer* simple_menu_layer_create(GRect frame, Window *window, const SimpleMenuSection *sections, int32_t num_sections, void *callback_context) { Sim...
p duration i18n_noop("Good mornin’. You slept for %dH %dM. " "Every good day begins with a solid night’s sleep..." "kinda like that one 😉 Keep it up!"), i18n_noop("Good morning! You slept for %dH %dM. Consistency is key; " "keep doing what you're do...
{ sniprintf(ACTIVITY_SUMMARY_PIN_CONFIG.short_subtitle, SUBTITLE_BUFFER_LENGTH, i18n_get("%u Steps", &ACTIVITY_SUMMARY_PIN_CONFIG), steps); i18n_free_all(&ACTIVITY_SUMMARY_PIN_CONFIG); return prv_push_summary_pin(pin_time_utc, now_utc, uuid, steps, total_steps_avg, &ACT...
// ------------------------------------------------------------------------------------------------ // Checks to see if we should add/update an activity summary pin static NOINLINE void prv_do_activity_summary(time_t now_utc) { if (!s_activity_summary_settings.enabled) { return; } // Don't bother adding a ...
f (value_len != entry->value_len) { PBL_LOG(LOG_LEVEL_WARNING, "Attempt to set %s using invalid value_len of %"PRIu32"", entry->key, (uint32_t)value_len); return false; } status_t rv = E_ERROR; mutex_lock(s_mutex); { SettingsFile file = {{0}}; if (settings_file_open(&file, SHELL_PRE...
(event->key, event->key_len)
msg); msg += 4; msg_length += 4; uint8_t caller_number_size = *msg++; memcpy(&info->caller_number, msg, MIN(caller_number_size, sizeof(info->caller_number))); msg += caller_number_size; msg_length += caller_number_size + 1; uint8_t caller_name_size = *msg++; memcpy(&info->caller_name, msg, ...
{ type = PhoneEventType_End; call_info.cookie = *((uint32_t*) iter); did_parse = true; break; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ static const RockyGlobalAPI *apis[] = {NULL}; rocky_global_init(apis); EXECUTE_SCRIPT( "var d = new Date();\n" "var s1 = d.toString();\n" "var f = typeof(d.toLocaleTimeString);\n" "var s2 = d.toLocaleTimeString();\n" "var s3 = d.toLocaleDateString();\n" "var s4 = d.toLocaleString();\n" ...
void test_rocky_api_datetime__locale_time_string_12h(void) { s_clock_is_24h_style = false; rocky_global_init(s_api); EXECUTE_SCRIPT( "var d = new Date();\n" "var s = d.toLocaleTimeString();\n" ); ASSERT_JS_GLOBAL_EQUALS_S("s", "8:04:05 PM"); s_time += 4 * SECONDS_PER_HOUR; EXECUTE_SCRIPT( ...
70, 15), 5); graphics_draw_horizontal_line_dotted(&ctx, GPoint(65, 15), 10); // T facing down graphics_draw_vertical_line_dotted(&ctx, GPoint(101, 11), 5); graphics_draw_horizontal_line_dotted(&ctx, GPoint(96, 16), 10); // cross - even vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 3...
(&ctx, GPoint(66, 36), 10)
; // T facing down - lined up graphics_draw_vertical_line_dotted(&ctx, GPoint(101, 33), 5); graphics_draw_horizontal_line_dotted(&ctx, GPoint(97, 37), 10); // T facing left - lined up graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 70), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(5, 76), 5...
The movement will not happen while looking at the launcher, it will only refresh on a //! close->open static const struct { AppInstallId install_id; bool move_on_activity; } s_override_table[] = { { APP_ID_SPORTS, false }, { APP_ID_GOLF, false }, #ifdef APP_ID_WORKOUT { APP_ID_WORKOUT, true }, #endif { APP...
(source, menu_node, source->order_storage ?: app_order_read_order(), (source->order_storage == NULL))
; // If we're adding the Settings app node to the list and it hasn't received a storage order, // then give it its default order if ((menu_node->install_id == APP_ID_SETTINGS) && (menu_node->storage_order == AppMenuStorageOrder_NoOrder)) { menu_node->storage_order = AppMenuStorageOrder_SettingsDefaultO...
/* * 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...
(circular_buffer_write(&buffer, (uint8_t*) "123", 3))
; cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 5); cl_assert(circular_buffer_write(&buffer, (uint8_t*) "456", 3)); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 2); cl_assert(!circular_buffer_write(&buffer, (uint8_t*) "789", 3)); // too big cl_assert_equal_i(ci...
{ 1264, -408, 32}, { 968, -152, 0}, { 1232, -168, 56}, { 1688, -16, 72}, { 1728, 56, 128}, { 1184, 96, 248}, { 880, 64, 160}, { 848, 64, 184}, { 952, 88, 216}, { 1168, 112, 240}, { 1264, 256, 280}, { 1416, 552, 264}, { 1256, 576, 232}, { 1232, 424, 88}, { 1120...
{ 1800, 112, 448}, { 1864, -232, 520}, { 1448, -288, 320}, { 1224, -120, 144}, { 1136, -88, 168}, { 1048, -128, 112}, { 1056, -176, 120}, // 19 seconds { 1032, -264, 64}, { 1016, -352, 64}, { 1032, -472, 112}, { 1000, -368, 104}, { 984, -200, 48}, { 1464, -144, 48...
PBL_LOG(LOG_LEVEL_DEBUG, "Failed to read charging status B register")
; return false; #endif } bool usb_connected = (val >> 3) & 1; return usb_connected; } void pmic_read_chip_info(uint8_t *chip_id, uint8_t *chip_revision, uint8_t *buck1_vset) { prv_read_register(PmicRegisters_CHIP_ID, chip_id); prv_read_register(PmicRegisters_CHIP_REV, chip_revision); prv_read_registe...
http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing p...
dict_write_begin(&outbox->iterator, (uint8_t *)&push->dictionary, outbox->transmission_size_limit - APP_MSG_HDR_OVRHD_SIZE)
; } static void prv_stop_timer(AppMessageCtxOutbox *outbox) { if (outbox->ack_nack_timer) { app_timer_cancel(outbox->ack_nack_timer); outbox->ack_nack_timer = NULL; } } void app_message_outbox_close(AppMessageCtxOutbox *outbox) { // Verify outbox phase. if (outbox->phase == OUT_CLOSED) { return; ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
GColorARGB8FromHEX(0xff00ff)
}, // {"green", GColorARGBFromHEX(0x008000)}, inconsistent with Pebble color {"lime", GColorARGB8FromHEX(0x00ff00)}, {"olive", GColorARGB8FromHEX(0x808000)}, {"yellow", GColorARGB8FromHEX(0xffff00)}, {"navy", GColorARGB8FromHEX(0x000080)}, {"blue", GColorARGB8FromHEX(0x0000ff)}, {"teal", GColorARGB8FromHEX...
const uint8_t tuplets_count, const Tuplet * const tuplets, uint8_t *buffer, uint32_t *size_in_out) { DictionaryIterator iter; return dict_serialize_tuplets_to_buffer_with_iter(&iter, tuplets, tuplets_count, buffer, size_in_out); } DictionaryResult dict_serialize_tuplets(DictionarySerializeCallback cal...
dict_find(orig_iter, new->key)
/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limit...
rocky_add_global_function(ROCKY_CLEARTIMEOUT, clearTimer_handler)
; rocky_add_global_function(ROCKY_CLEARINTERVAL, clearTimer_handler); } const RockyGlobalAPI TIMER_APIS = { .init = prv_init_apis, };
/* * 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(&app_data->results_window, false)
; } static void prv_test_update_proc(Layer *layer, GContext* ctx) { AppData *app_data = window_get_user_data(layer->window); GfxTest *test = app_data->current_test; srand(RAND_SEED); // Setup rand for routines that need it if (test->setup) { test->setup(layer->window); } PROFILER_INIT; PROFILER_ST...
prv_log_failed_message(&reason); // Re-write the reason including the stuck task info collected by prv_log_failed_message() reboot_reason_clear(); reboot_reason_set(&reason); // If getting reset by the watchdog timer is imminent (it will reset the // CPU if not fed at least once every 7 second...
task_watchdog_disable_interrupt()
; bool result = (s_watchdog_mask & (1 << task)); task_watchdog_enable_interrupt(); return result; } void task_watchdog_mask_set(PebbleTask task) { task_watchdog_disable_interrupt(); s_watchdog_mask |= (1 << task); task_watchdog_enable_interrupt(); } void task_watchdog_mask_clear(PebbleTask task) { 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...
prompt_send_response("BT SIG RF Test Mode Enabled")
; } else { prompt_send_response("Failed to enter BT SIG RF Test Mode"); } } void command_bt_prefs_wipe(void) { bt_driver_classic_disconnect(NULL); bt_persistent_storage_delete_all_pairings(); } void command_bt_sprf_nuke(void) { shared_prf_storage_wipe_all(); #if RECOVERY_FW // Reset system to get cach...
See the License for the specific language governing permissions and * limitations under the License. */ #include "connection.h" #include "connection_private.h" #include "ble_task.h" #include "util/list.h" #include "kernel/pbl_malloc.h" #include "os/mutex.h" #include "system/logging.h" #include "system/passert.h" ...
connection_by_address(addr)
; PBL_ASSERTN(connection); } prv_unlock(); return connection; } static bool prv_connection_for_each_cb(ListNode *found_node, void *data) { ForEachCbData *cb_data = (ForEachCbData *)data; cb_data->cb((Connection *)found_node, cb_data->data); return false; // Force not found -- iterate the entire list } ...
args)); if (jerry_value_has_error_flag(remove_result)) { rocky_log_exception("removing event listener", remove_result); } for (size_t i = 0; i < ARRAY_LENGTH(args); i++) { jerry_release_value(args[i]); } // mark item as removed and stop iterating query_data->found = true; return...
jerry_get_object_field(rocky, name_from)
/* * 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...
check_atan2(120, 102)
.pin.header.id, &s_items[1].header.id)); } void test_timeline__all_day_past(void) { prv_insert_all_day_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; TimelineItem earlier_item = { .header = { .id = {0x04}, .parent_id = {0}, .timestamp = 1421...
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, s_feb_5_midnight + 8 * SECONDS_PER_HOUR + 16 * SECONDS_PER_MINUTE), 0)
c ExpectedMessage s_msg; void test_flash_logging_get_info(uint32_t *tot_size, uint32_t *erase_unit_size, uint32_t *chunk_size, uint32_t *page_hdr_size); const uint8_t *version_get_build_id(size_t *out_len) { static uint8_t build_id[20] = { 0xee, 0xd2, 0xbf, 0x50, 0x5b, 0x59, 0x04, 0xb5, 0x14, 0x98, 0x28...
free(msg_arr[i])
; } free(msg_arr); } // // Actual Tests // //! Simple test to confirm that we can log and read back several messages void test_flash_logging__basic(void) { flash_logging_init(); const char *test_messages[] = { "A simple test log message! Woohoo!", "Another message", "ABCDEFG 0123456789", "La...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pbl_snprintf(str, STR_SIZE, "abc %-5d%s", 42, "b")
; cl_assert_equal_s(str, "abc 42 b"); //---------------------------------------------------- pbl_snprintf(str, STR_SIZE, "abc %+f%s", "a", 1.0, "b"); cl_assert_equal_s(str, fp_msg); pbl_snprintf(str, STR_SIZE, "abc %+d%s", 42, "b"); cl_assert_equal_s(str, "abc +42b"); //-------------------------------...
/* * 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_value_clear_error_flag(&error_val); JS_VAR error_str = jerry_value_to_string(error_val); msg = rocky_string_alloc_and_copy(error_str); }
egate_averaged(HealthMetricHeartRateBPM, now_utc - 60, now_utc - 60, HealthAggregationAvg, HealthServiceTimeScopeOnce); cl_assert_equal_i(123, result); // The function call is the equivalent to `peek_value` with HeartRateBPM ...
{ prv_update_stats(&weekend_stats, value); }
else { prv_update_stats(&weekday_stats, value); } prv_update_stats(&daily_stats, value); } // ---------------------------------------- // Compute each combination of agg/stat and compare to expected for (HealthAggregation agg = HealthAggregationSum; agg <= HealthAggregationMax; agg++) { for...
/* * 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...
(dev->qspi, cmd, NULL, 0)
; } static void prv_write_enable(QSPIFlash *dev) { prv_write_cmd_no_addr(dev, dev->state->part->instructions.write_enable); // wait for writing to be enabled qspi_poll_bit(dev->qspi, dev->state->part->instructions.read_status, dev->state->part->status_bit_masks.write_enable, true /* set */, QSPI_...
/* * 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...
{ graphics_context_set_text_color(ctx, GColorBlack); const char *text = PBL_IF_RECT_ELSE("Masks are fun!", "\nMasks are fun!"); GTextAttributes *text_attributes = graphics_text_attributes_create(); const uint8_t inset = 4; graphics_text_attributes_enable_screen_text_flow(text_attributes, inset); graphics_dr...
ne1Minutes, 1, &zone1_minutes); cl_assert_equal_i(zone1_minutes, 2); activity_get_metric(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes); cl_assert_equal_i(zone2_minutes, 2); activity_get_metric(ActivityMetricHeartRateZone3Minutes, 1, &zone3_minutes); cl_assert_equal_i(zone3_minutes, 2); // Add a "...
cl_assert_equal_m(&activity_private_state()->activity_sessions[0], &next_activity, sizeof(ActivitySession))
; } } cl_assert_equal_m(&activity_private_state()->activity_sessions[0], &empty_session, sizeof(ActivitySession)); // Add lots of sessions then delete from the back for (int i = 0; i < ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT; i++) { ActivitySession activity = walk_activity; activi...
Zero, 3686380, 0); touch_handle_update(0, TouchState_FingerUp, &GPoint(15, 100), 0, 3686400); PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT); cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable); TouchEvent *touch_event = touch_event_queue_get_ev...
GPoint(18, 5)
, 1, 3686440); // Test the same event (event at index 1): it should update to reflect the difference between this // and the first event touch_event = touch_event_queue_get_event(0, 1); prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(18, 5)...
end up being re-erased. status = write_initial_pattern(true /*display_logs*/, false /*skip_base_addr*/, NULL /*erase_addr*/); VERIFY_TEST_STATUS(status); bool stuck_at_low = false; for (test_offset = 1, bitpos=0; test_offset & addr_mask; test_offset <<= 1, bitpos++) { if (...
(stress_addr2)
; status = prv_read_verify_halfword(stress_addr2, 0xFFFF, FLASH_TEST_ERR_ERASE, false); VERIFY_TEST_STATUS(status); // Write data to stress address locations PBL_LOG(LOG_LEVEL_DEBUG, ">> Writing Addr 0x%"PRIx32" to value 0x%"PRIx16, stress_addr1, stress_data1); flash_write_bytes((uint8_t *)&stress_...
{ 1360, 512, -128}, { 1296, 320, -88}, { 1200, 272, -80}, { 1288, 232, -56}, { 1352, 272, -32}, { 1488, 248, -80}, { 1728, 216, 32}, { 1408, 224, -88}, { 1384, 200, -160}, { 1000, -504, 72}, // 66 seconds { 488, -360, 80}, { 896, -160, -368}, { 1080, -232, 8}, { 1...
{ 1368, 200, -64}, { 728, -352, -56}, { 648, -264, -296}, { 720, -504, -328}, { 880, -192, -384}, { 1160, -104, -400}, { 1200, 32, -280}, { 1192, 88, -168}, { 1256, 288, -216}, { 1472, 472, -160}, { 1848, 432, -248}, { 1832, 512, -176}, { 1776, 672, -184}, { 1472,...
{ 928, 856, -360}, { 1080, 968, -320}, { 1080, 760, -288}, { 1200, 696, -240}, { 1328, 616, -216}, { 1472, 400, -120}, { 1440, 256, -96}, { 1512, 208, -88}, // 74 seconds { 1488, 208, -48}, { 1360, 200, -56}, { 1360, 184, -56}, { 1288, 192, -40}, { 1152, 160, -10...
cense, 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 * distributed under the License is distribute...
cl_assert(utf8_iter_state->codepoint == 'A')
; cl_assert(iter_next(&char_iter)); cl_assert(utf8_iter_state->codepoint == '\n'); cl_assert(iter_next(&char_iter)); cl_assert(utf8_iter_state->codepoint == 'B'); cl_assert(!iter_next(&char_iter)); cl_assert(!iter_next(&char_iter)); cl_assert(!iter_next(&char_iter)); } void test_char_iterator__decode_tes...
{ state->step_data.step_minutes++; ACTIVITY_LOG_DEBUG("new step minutes: %"PRIu16"", state->step_data.step_minutes); // The prior minute was the most recent active one state->last_active_minute = time_util_minute_of_day_adjust(minute_of_day, -1); ACTIVITY_LOG_DEBUG("last active minute: %"...
// Update the resting calories state->resting_calories = activity_private_compute_resting_calories(minute_of_day); state->step_data.resting_kcalories = ROUND(state->resting_calories, ACTIVITY_CALORIES_PER_KCAL); ACTIVITY_LOG_DEBUG("resting kcalo...
fer[30]; TextLayer *fg_text; char fg_text_buffer[5]; TextLayer *fg_color_text; char fg_color_text_buffer[20]; uint8_t fg_color_index; TextLayer *bg_text; char bg_text_buffer[5]; TextLayer *bg_color_text; char bg_color_text_buffer[20]; uint8_t bg_color_index; } AppData; static void set_text_elemen...
(ctx, fg_color)
urn BLOB_DB_KEY_DOES_NOT_EXIST; case E_RANGE: return BLOB_DB_INVALID_DATABASE_ID; case E_INVALID_ARGUMENT: return BLOB_DB_INVALID_DATA; case E_OUT_OF_STORAGE: return BLOB_DB_DATABASE_FULL; case E_INVALID_OPERATION: return BLOB_DB_DATA_STALE; default: PBL_LOG(LOG_LEVEL_W...
prv_send_response(session, token, prv_interpret_db_ret_val(ret))
; } static void prv_handle_database_clear(CommSession *session, const uint8_t *data, uint32_t length) { if (length < MIN_CLEAR_LENGTH) { prv_send_response(session, prv_try_read_token(data, length), BLOB_DB_INVALID_DATA); return; } BlobDBToken token; BlobDBId db_id; // Read token and db_id endpoi...
ror != BTErrnoOK) { prv_send_services_added_event(connection, error); return; } GATTServiceNode *node = kernel_zalloc_check(sizeof(GATTServiceNode)); node->service = service; // tag the service with the generation it was discovered as a part of node->service->discovery_generation = connection->gatt_s...
gatt_client_subscriptions_cleanup_by_connection(connection, true /* should_unsubscribe */)
; } prv_finalize_discovery(connection, BTErrnoServiceDiscoveryDatabaseChanged); ret_val = gatt_client_discovery_discover_all(device); } } bt_unlock(); return ret_val; }
notification(s_characteristics[0][PPoGATTCharacteristicMeta], (const uint8_t *) &s_meta_v0_system, sizeof(s_meta_v0_system), BLEGATTErrorSuccess); // Expect subscribe request was made: fake_gatt_client_...
fake_gatt_client_op_assert_no_write()
int s_saturday_00_00 = 1426896000; // Saturday, March 21, 2015, 00:30 UTC static const int s_saturday_00_30 = 1426897800; // Saturday, March 21, 2015, 01:30 UTC static const int s_saturday_01_30 = 1426901400; // Saturday, March 21, 2015, 10:30 UTC static const int s_saturday_10_30 = 1426933800; // Sunday, March 22, 201...
do_not_disturb_set_manually_enabled(false)
; active = do_not_disturb_is_active(); cl_assert(active == false); } void test_do_not_disturb__is_active(void) { // Time 00:00, Manual and Scheduled DND both OFF bool active; // !Manual && !Scheduled && !Smart cl_assert(do_not_disturb_is_manually_enabled() == false); cl_assert(do_not_disturb_is_schedule...
GColor src_color = (GColor) { .argb = (uint8_t)y }; for (int mask_value_index = 0; mask_value_index < num_mask_values; mask_value_index++) { int16_t x1 = (int16_t)(mask_value_index * num_pixels_per_mask_value); int16_t x2 = (int16_t)(x1 + num_pixels_per_mask_value - 1); record_func(ctx, y, x1, x...
{ // The initial transparency doesn't really matter since we're about to overwrite it const bool transparent = false; GDrawMask *mask = graphics_context_mask_create(ctx, transparent); cl_assert(mask); const GSize mask_size = ctx->dest_bitmap.bounds.size; for (int16_t x = 0; x < mask_size.w; x++) { cons...
typedef void (*HorizontalClippingMaskApplyFunc)(GContext *ctx, int16_t y, int16_t x1, int16_t x2, GColor color); static void prv_mask_apply_hline_test_pattern(HorizontalClippingMaskApplyFunc apply_func) { GContext *ctx = s_ctx; prv_prepare_canvas_for_hline_applyin...
/* * 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...
pfs_format(false)
; cron_service_init(); alarm_init(); alarm_service_enable_alarms(true); } void test_alarm_smart__cleanup(void) { cron_service_deinit(); } //////////////////////////////////////////////////////////////////////////////////////////////////// //! Smart alarms #define SMART_ALARM_UPDATE_MIN (SMART_ALARM_SNOOZE_...
notifications/notification_window.h" #include "services/common/analytics/analytics.h" #include "services/common/i18n/i18n.h" #include "services/normal/notifications/alerts_preferences_private.h" #include "services/normal/notifications/alerts_private.h" #include "services/normal/vibes/vibe_intensity.h" #include "shell/p...
(strings_for_vibe_intensities)
, true /* icons_enabled */, strings_for_vibe_intensities, data); } #endif /* !CAPABILITY_HAS_VIBE_SCORES */ // Text Size //////////////////////// static const char *s_text_size_names[] = { [SettingsContentSize_Small] = i18n_noop("Smaller"), [SettingsContentSize_Default] = i18n_noop("Default"), [Setting...
/* * 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...
SPI_Cmd(DISP_SPI, ENABLE)
; } void display_start(void) { // Enable the GPIOG clock; this is required before configuring the pins gpio_use(DISP_GPIO); GPIO_PinAFConfig(DISP_GPIO, GPIO_PINSOURCE_SCK, GPIO_AF_SPI6); // SCK GPIO_PinAFConfig(DISP_GPIO, GPIO_PINSOURCE_MOSI, GPIO_AF_SPI6); // MOSI GPIO_PinAFConfig(DISP_GPIO, GPIO_PINSOURCE...
/* * 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...
ARRAY_LENGTH(c1_points)
, }; memcpy(c1->points, c1_points, sizeof(c1_points)); GDrawCommand *c2 = gdraw_command_list_get_command(list, 2); *c2 = (GDrawCommand){ .type = GDrawCommandTypePath, .hidden = false, .stroke_color = GColorBlack, .stroke_width = 3, .path_open = true, .num_points = ARRAY_LENG...
source, AppMenuNode *node); //////////////////////////////// // List helper functions //////////////////////////////// static bool prv_is_app_filtered_out(AppInstallEntry *entry, AppMenuDataSource * const source) { return (source->callbacks.filter && (source->callbacks.filter(source, entry) == false)); } /////////...
{ AppMenuNode *other_node = prv_find_node_with_install_id(storage_app_id, source); if (other_node) { other_node->storage_order = new_storage_order; } }
} if (update_and_take_ownership) { app_free(storage); } } static void prv_sorted_add(AppMenuDataSource *source, AppMenuNode *menu_node) { // Update the entire list order only if we've just read the order in this context. If we haven't // just read the order, then we're building a list starting from an e...
prv_gbitmap_sequence_restart(bitmap_sequence, true)
; } void gbitmap_sequence_destroy(GBitmapSequence *bitmap_sequence) { if (bitmap_sequence) { upng_destroy(bitmap_sequence->png_decoder_data.upng, true); applib_free(bitmap_sequence->png_decoder_data.palette); applib_free(bitmap_sequence); } } static ALWAYS_INLINE GColor8 *prv_target_pixel_addr(GBitmap...
/* * 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...
rocky_global_has_event_handlers("daychange")
); cl_assert_equal_i(3, s_tick_timer_service_subscribe.call_count); cl_assert_equal_i(MINUTE_UNIT | HOUR_UNIT | DAY_UNIT | MONTH_UNIT | YEAR_UNIT, s_tick_timer_service_subscribe.last_call.tick_units); // register for minute again EXECUTE_SCRIPT("_rocky.on('minutechange', function() {});"); ...
se for the specific language governing permissions and * limitations under the License. */ #include "audio_endpoint.h" #include "audio_endpoint_private.h" #include "comm/bt_lock.h" #include "services/common/comm_session/session_send_buffer.h" #include "services/common/new_timer/new_timer.h" #include "system/logging...
(s_session.active_mode_trigger, ACTIVE_MODE_TIMEOUT - ACTIVE_MODE_START_BUFFER, prv_start_active_mode, NULL, TIMER_START_FLAG_REPEATING)
, 0); cl_assert_equal_p(touch_event, NULL); } void test_touch__dispatch_touch_events_two_fingers(void) { TouchEventContext ctx = { .idx = 0 }; touch_dispatch_touch_events(0, prv_touch_event_dispatch_cb, &ctx); cl_assert_equal_i(ctx.idx, 0); touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13)...
(1, TouchState_FingerDown, &GPoint(55, 55), 2, 3686480)
; fake_event_set_callback(prv_handle_palm_events); touch_handle_driver_event(TouchDriverEvent_PalmDetect); // Cancelled event, followed by a palm detection event cl_assert_equal_i(s_expected_palm_events[0].type, PEBBLE_TOUCH_EVENT); cl_assert_equal_i(s_expected_palm_events[0].touch.type, PebbleTouchEvent_To...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_spi_receive_data(bus)
; prv_spi_get_flag_status(bus, (SpiI2sFlag)0); } static void prv_spi_dma_cmd(const SPIBus *bus, SpiI2sDma dma_bits, bool enable) { if (enable) { bus->spi->CR2 |= (uint16_t)dma_bits; } else { bus->spi->CR2 &= (uint16_t)~dma_bits; } } static void prv_spi_cmd(const SPIBus *bus, SpiFunctionalState state) ...
x10, 0x00, 0x00, 0x00, 0x32, 0x8e, 0x0f, 0xbb, 0xc6, 0x42, 0x1a, 0xa6, 0x69, 0x9b, 0xda, 0xda, // Discovery Generation 0x00, // RSVD 0x00, // Size Bytes 0x51, 0x00, // Att Handle EMULATED_PPOGATT_SERVICE_HANDLE_LSB, EMULATED_PPOGATT_SERVICE_HANDLE_MSB, // Num characteristics 0x02, // Num Descripto...
{ PBL_LOG(LOG_LEVEL_DEBUG, "WOAH"); kernel_free(state->pending_response_data); }
} } layer->relbar_layer.curr_rel_bar.rel_bar_type = rel_bar_types[1]; if (layer->layouts_info[1]) { PBL_LOG(LOG_LEVEL_DEBUG, "Current rel bar %d, duration %"PRIu32, rel_bar_types[1], layer->layouts_info[1]->duration_s); } } ///////////////////////////////////////// // Public functions ////////...
layer_add_child((Layer*)timeline_layer, (Layer *)&timeline_layer->relbar_layer)
; relbar_layer->timeline_layer = timeline_layer; } //! Deinitialize the timeline relationship bar layer within the \ref TimelineLayer void timeline_relbar_layer_deinit(TimelineLayer *timeline_layer) { layer_deinit(&timeline_layer->relbar_layer.layer); }
<limits.h> static bool prv_char_iter_next_start_of_word(Iterator* char_iter); // PBL-23045 Eventually remove perimeter debugging void graphics_text_perimeter_debugging_enable(bool enable) { app_state_set_text_perimeter_debugging_enabled(enable); } // [CTX] processing individual codepoints doesn't work for context...
{ word->width_px += prv_codepoint_get_horizontal_advance(&ctx->font_cache, text_box_params->font, utf8_iter_state->codepoint); }
} static bool prv_each_find_children(SettingsFile *file, SettingsRecordInfo *info, void *context) { FindChildrenInfo *find_info = (FindChildrenInfo *)context; if (info->val_len < (int)sizeof(SerializedTimelineItemHeader) || info->key_len != UUID_SIZE) { // malformed values; deleted values have their le...
FAILED(rv)
) { PBL_LOG(LOG_LEVEL_ERROR, "Unable to create settings file %s, rv = %"PRId32 "!", filename, rv); } } void timeline_item_storage_deinit(TimelineItemStorage *storage) { settings_file_close(&storage->file); } status_t timeline_item_storage_insert(TimelineItemStorage *storage, const uint8_t *key...
us even if // the other unit is powered up in Normal mode if (s_accel_power_mode == BMI160_Accel_Mode_Normal || s_gyro_power_mode == BMI160_Gyro_Mode_Normal) { // Apparently this delays for ~3.5 us. Unconfirmed. delay_us(5); } else { psleep(2); // must sleep >= 450us } } static void prv_burs...
prv_sensortime_to_timestamp(sensor_time)
event_blob.event, event_blob.bt_error.error_code); analytics_logging_log_event(&event_blob); } // ------------------------------------------------------------------------------------------ //! Log when app_launch trigger failed. void analytics_event_bt_app_launch_error(uint8_t gatt_error) {...
(&event_blob)
; } // ------------------------------------------------------------------------------------------ // Log a health insight created event. void analytics_event_health_insight_created(time_t timestamp, ActivityInsightType insight_type, ...
6, -8, -232}, { 1168, -64, -288}, { 1640, -184, -208}, // 80 seconds { 952, 232, -328}, { 1400, 128, -256}, { 1056, 88, -264}, { 792, -48, -296}, { 584, -56, -224}, { 496, 24, -152}, { 408, 80, -152}, { 552, 128, -176}, { 776, 232, -272}, { 1008, 216, -288}, { 138...
{ 376, -8, -176}, { 464, 24, -168}, { 712, 16, -136}, { 1120, 24, -256}, { 1392, 8, -248}, { 1440, -24, -312}, { 872, 192, -56}, { 1256, -24, -360}, { 1184, 192, -336}, { 960, 64, -288}, { 584, 48, -264}, { 416, -56, -104}, { 416, 48, -168}, // 86 seconds { 65...
{ 1368, 104, -256}, { 1400, 24, -104}, { 1032, 16, -192}, { 616, 24, -192}, { 448, 16, -216}, { 464, -8, -128}, { 624, 48, -128}, { 824, 104, -168}, { 1112, 56, -280}, { 1168, 72, -248}, { 1648, -128, -480}, { 936, 248, -112}, { 1352, 32, -472}, { 1296, 232, -248...
icense"); * 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 IS" BASIS, * ...
{ if (out_len) { *out_len = TINTIN_BUILD_ID.data_length; } PBL_ASSERTN(TINTIN_BUILD_ID.data_length == BUILD_ID_EXPECTED_LEN); return &TINTIN_BUILD_ID.data[TINTIN_BUILD_ID.name_length]; }
void version_copy_build_id_hex_string(char *buffer, size_t buffer_bytes_left, const ElfExternalNote *elf_build_id) { size_t build_id_bytes_left = elf_build_id->data_length; const uint8_t *build_id = &elf_build_id->data[elf_build_id->name_length]; byte_stream_to_hex_string(b...
e_app_manager.h" #include "fake_new_timer.h" #include "fake_pbl_malloc.h" #include "fake_pebble_tasks.h" #include "fake_system_task.h" #include "stubs_analytics.h" #include "stubs_analytics_external.h" #include "stubs_gettext.h" #include "stubs_logging.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "s...
(tasks[i])
; uint16_t num, den, samps_per_update; test_accel_manager_get_subsample_info(sessions[i], &num, &den, &samps_per_update); if ((fastest_rate % sample_arr[i]) == 0) { // the current sample rate is a multiple of the rate we are running at cl_assert_equal_i(num, 1); cl_assert_equal_i(den, fa...