prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ITS_PER_PIXEL = 2; const int PIXELS_PER_BYTE = (8 / BITS_PER_PIXEL); const int WIDTH = 4; const int HEIGHT = 4; const int ROW_STRIDE = (WIDTH + (PIXELS_PER_BYTE - 1)) / PIXELS_PER_BYTE; uint8_t s_data[ROW_STRIDE * HEIGHT]; GColor s_palette[] = { GColorRed, GColorWhite, GColorBlack, GColorBlue }; c...
prv_opaque_2bit_simple(GCompOpSet)
; } void test_bitblt_palette__2Bit_comptint_opaque(void) { prv_opaque_2bit_simple(GCompOpTint); } void test_bitblt_palette__4Bit_assign_opaque(void) { prv_4bit_simple(GCompOpAssign, GColorWhite, false /* opaque */); } void test_bitblt_palette__4Bit_assign_transparent(void) { prv_4bit_simple(GCompOpAssign, GCol...
ow->layout == WorkoutLayout_StaticAndScrollable; prv_render_metric(ctx, metric_type, layer, bg_color, draw_zones, prefer_larger_font); if (layer == &active_window->top_metric_layer) { status_bar_layer_set_colors(&active_window->status_layer, bg_color, GColorBlack); } if (active_window->layout == WorkoutL...
{ prv_handle_pause_button(active_window); }
} static void prv_select_click_handler(ClickRecognizerRef recognizer, void *context) { WorkoutActiveWindow *active_window = context; if (active_window->pause_button == BUTTON_ID_SELECT) { prv_handle_pause_button(active_window); } else { prv_handle_stop_button(active_window); } } static void prv_set_...
aw_stroked_non_aa(ctx, p, radius, stroke_width, quadrant); } else { // Non-Antialiased and Stroke Width == 1 graphics_circle_quadrant_draw_1px_non_aa(ctx, p, radius, quadrant); } } T_STATIC void graphics_circle_draw_1px_non_aa(GContext* ctx, GPoint p, uint16_t radius) { graphics_circle_quadrant_draw_1px_...
GPoint(x0 - x, y0 + y)
, x + 1); prv_fill_horizontal_line(ctx, GPoint(x0 - y, y0 + x), y + 1); } if (quadrant & GCornerBottomRight) { if (x == 1) { prv_fill_horizontal_line(ctx, GPoint(x0, y0), radius + 1); } prv_fill_horizontal_line(ctx, GPoint(x0, y0 + y), x + 1); prv_fill_horizontal_line(ctx,...
/* * 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...
nf->callbacks.selected(nf, nf->callback_context)
; } } static void click_config_provider(NumberWindow *nf) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 50, (ClickHandler) up_click_handler); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 50, (ClickHandler) down_click_handler); // Work-around: by using a multi-click setup for the select bu...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_DEBUG, ">> Reading Addr 0x%"PRIx32" value is 0x%"PRIx16, read_addr, read_buffer)
; } if (read_buffer != expected_val) { switch (err_code) { case FLASH_TEST_ERR_ERASE: PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Did not successfully erase the sector"); break; case FLASH_TEST_ERR_DATA_WRITE: PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Did not successfully write the data"); ...
/* * 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...
__builtin_return_address(0)
; return heap_malloc(&s_kernel_heap, bytes, saved_lr); } void *kernel_malloc(size_t bytes) { return prv_heap_malloc(bytes); } void *kernel_zalloc(size_t bytes) { void *ptr = prv_heap_malloc(bytes); if (ptr) { memset(ptr, 0, bytes); } return ptr; } void *kernel_malloc_check(size_t bytes) { void *ptr...
bool update_cancelled; struct { TouchEvent events[TOUCH_QUEUE_LENGTH]; uint32_t count; uint32_t read_idx; } touch_queue; GPoint start_pos; TouchPressure start_pressure; uint64_t start_time_ms; } TouchContext; static TouchContext s_touch_ctx[MAX_NUM_TOUCHES]; static PebbleMutex *s_touch_mutex; v...
if (update && !ctx->update_pending) { ctx->update_pending = true; send_event = true; }
mutex_unlock(s_touch_mutex); if (send_event) { PebbleEvent e = { .type = PEBBLE_TOUCH_EVENT, .touch = { .type = PebbleTouchEvent_TouchesAvailable, .touch_idx = touch_idx } }; event_put(&e); } } void touch_dispatch_touch_events(TouchIdx touch_idx, TouchEventHandler...
.origin.y -= DISP_ROWS; } else { icon_frame.origin.y += DISP_ROWS; } } *icon_frame_out = icon_frame; #endif } static Animation *prv_create_peek_exit_anim(TimelineAppData *data, TimelineAppState prev_state, uint32_t duration) { PeekLayer *peek_layer = &dat...
timeline_layer_get_current_layout(&data->timeline_layer)
; if (!timeline_layout) { return; } // cut to the card window app_window_stack_push(&data->pin_window.window, false); prv_set_state(data, TimelineAppStateCard); TimelineIterState *state = timeline_model_get_current_state(); Uuid app_uuid; timeline_get_originator_id(&state->pin, &app_uuid); analy...
/* * 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...
(ours, theirs)
== 0) { return ours; } } return NULL; } void circular_cache_push(CircularCache* c, void* new_item) { uint8_t* old_item = prv_get_item_at_index(c, c->next_erased_item_idx); if (c->item_destructor) { c->item_destructor(old_item); } memcpy(old_item, new_item, c->item_size); ++c->next_erased_i...
nder 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 * distributed under the Lic...
(x, y + text_single_line_text_offset_px, w, max_text_line_height_px)
; text_height = graphics_text_layout_get_max_used_size(ctx, dialog->buffer, dialog_text_font, probe_rect, ...
&test_bmp, upper_rect, GPointZero, GCompOpTint, upper_tint_color); // Lower row with destination colors from 31..63 const int16_t y_lower = y_upper + NUM_COLORS + OFFSET + LEGEND_HEIGHT; const GRect lower_rect = GRect(x, y_lower, test_bmp.bounds.size.w, NUM_COLORS); const GColor lower_tint_color = (GCo...
gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_wrap_y-expect.8bit.pbi")
); gbitmap_destroy(src_bitmap); } // Test src_origin_offset, shouldn't see any red in dest_bitmap. // This covers src_origin_offset, y-axis and x-axis wraparound. // Setup: // - Source 25x25, 2 columns, 2 rows red, rest is black. // - Source offset starts at (2, 2) // - Dest is blue, 100x100. // - Dest rect...
248, 128}, { -384, 1008, 240}, { -304, 952, 72}, { -224, 568, -56}, { -264, 504, -72}, // 350 seconds { -296, 616, -224}, { -272, 720, -8}, { -192, 944, -128}, { -240, 952, -56}, { -304, 952, -32}, { -352, 1032, -64}, { -352, 1080, -8}, { -344, 1088, -184}, { -272...
{ -200, 640, -72}, { -264, 528, -64}, { -352, 552, 24}, { -464, 664, 80}, { -568, 816, 112}, { -648, 888, 144}, { -752, 1024, 184}, { -520, 1064, 32}, { -768, 1032, 224}, { -600, 1104, 264}, { -528, 1112, 344}, { -432, 1064, 296}, { -240, 904, 128}, { -288, 648, -...
{ -120, 824, 8}, { -136, 888, 24}, { -160, 952, 144}, { -168, 1072, 72}, { -248, 1096, 112}, { -240, 1072, 40}, { -232, 1184, -8}, { -160, 992, -176}, { -184, 704, -80}, { -224, 584, -24}, { -288, 568, -8}, { -416, 640, 128}, { -568, 824, 128}, { -592, 896, 112},...
{ const Command* cmd = &s_prompt_commands[i]; if (cmd->num_params) { prompt_send_response_fmt(buffer, sizeof(buffer), "%s {%u args}", cmd->cmd_str, cmd->num_params); } else { prompt_send_response(cmd->cmd_str); } } } typedef struct CommandArgs { unsigned ...
OPTIMIZE_FUNC(2)
void prompt_handle_character(char c, bool* should_context_switch) { if (UNLIKELY(prompt_command_is_executing())) { return; } if (LIKELY(c >= 0x20 && c < 127)) { // Printable character. if (!prompt_context_append_char(&s_dbgserial_prompt_context, c)) { dbgserial_putchar(0x07); // bell ret...
_list__count(void) { ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LIST_NODE_NULL; ListNode *tail = list_append(list_append(&a, &b), &c); cl_assert(list_count(tail) == 3); cl_assert(list_count(&a) == 3); cl_assert(list_count(&b) == 3); cl_assert(list_count(&c) == 3); cl_assert(list_count_to_tail_fr...
(list_find_prev(&bar[3].list_node, (bool(*)(ListNode*, void*))is_odd, true, NULL) == NULL)
; // Test NULL starting node: cl_assert(list_find_next(NULL, filter_odd, false, NULL) == NULL); cl_assert(list_find_prev(NULL, filter_odd, false, NULL) == NULL); } void test_list__concatenate(void) { ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LIST_NODE_NULL; ListNode d = LIST_NODE_NULL, e = LIST_N...
ssert_equal_i(e, BTErrnoInvalidState); // Should still be registered from the first call: registered = gap_le_connect_has_connection_intent(&device, GAPLEClientApp); cl_assert_equal_b(registered, true); } void test_gap_le_connect__register_same_device_and_bonding(void) { // Test that it is possible to have 2 ...
(&device, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp)
; cl_assert_equal_i(e, BTErrnoOK); // Device isn't connected. Verify no event was caused as a result of the // registration. prv_assert_no_event(); // Connect & verify the client task gets the event: prv_fake_connect(&device, true /* is_master*/); prv_assert_client_event(&device, true /* connected */, (...
uint16_t day = time_util_get_day(old_history.utc_sec); int old_age = state->cur_day_index - day; // If this is resting kcalories, the default for each day is not 0 if (metric == ActivityMetricRestingKCalories) { uint32_t full_day_resting_calories = activity_private_compute_resting...
{ history[i] = m_info.converter(setting_history.values[i]); ACTIVITY_LOG_DEBUG("get metric %"PRIi32" %"PRIu32" days ago: %"PRIi32"", (int32_t)metric, i, history[i]); }
activity_private_settings_close(file); } } unlock: mutex_unlock_recursive(state->mutex); return success; } // ------------------------------------------------------------------------------------------------ DEFINE_SYSCALL(bool, sys_activity_get_metric, ActivityMetric metric, uint32_t h...
} const PPoGATTMetaV0 *meta = (const PPoGATTMetaV0 *) value; if (meta->ppogatt_min_version > PPOGATT_MAX_VERSION /* || meta->ppogatt_max_version < PPOGATT_MIN_VERSION // always true at the moment */) { goto handle_error; } if (uuid_is_invalid(&meta->app_uuid)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid...
{ bool client_removed = false; // Delete existing clients: PPoGATTClient *client = s_ppogatt_head; while (client) { PPoGATTClient *next = (PPoGATTClient *) client->node.next; for (int i = 0; i < num_characteristics; i++) { if (client->characteristics.meta == characteristics[i] || ...
bt_unlock(); } void ppogatt_invalidate_all_references(void) { bt_lock(); { PPoGATTClient *client = s_ppogatt_head; while (client) { PPoGATTClient *next = (PPoGATTClient *) client->node.next; prv_delete_client(client, true /* is_disconnected */, DeleteReason_InvalidateAllReferences); cl...
en successfully started when this is called, so check //! your null pointers! static void prv_app_cleanup(void) { // Back button may have been held down when this app quits. launcher_cancel_force_quit(); // Always notify the phone that the application is not running app_run_state_send_update(&s_app_task_contex...
(LOG_LEVEL_DEBUG, "Watchface crashed, launching default.")
; crash_info = (AppCrashInfo) { 0 }; watchface_set_default_install_id(INSTALL_ID_INVALID); watchface_launch_default(NULL); #endif } // --------------------------------------------------------------------------------------------- //! Switch to the app stored in the s_next_app global. The gracefully flag tells u...
the UART peripheral control registers // - 8-bit word length // - no parity // - RX / TX enabled // - 1 stop bit // - no flow control dev->periph->CR1 &= ~USART_CR1_UE; dev->periph->CR2 = (dev->do_swap_rx_tx ? USART_CR2_SWAP : 0); dev->periph->CR3 = (dev->half_duplex ? USART_CR3_HDSEL : 0); dev->per...
(dev->state->tx_irq_handler || dev->state->rx_irq_handler)
; // enable the interrupt NVIC_SetPriority(dev->irq_channel, dev->irq_priority); NVIC_EnableIRQ(dev->irq_channel); } else { // disable the interrupt NVIC_DisableIRQ(dev->irq_channel); } } void uart_set_rx_interrupt_handler(UARTDevice *dev, UARTRXInterruptHandler irq_handler) { PBL_ASSERTN(dev...
{ char script[] = "var a = 1; var b = 2; var c = a + b;"; EXECUTE_SCRIPT(script); ASSERT_JS_GLOBAL_EQUALS_I("c", 3.0); } void test_js__eval_error(void) { prv_deinit(); // engine will be re-initialized in rocky_event_loop~ char script[] = "function f({;"; s_log_internal__expected = (const char *[]){ "...
{ const char script[] = "function f(i) { \n" " if (i == 0) {_rocky.requestDraw();} \n" " else {f(i-1)}\n" "}\n" "f(10)"; static const RockyGlobalAPI *apis[] = { &GRAPHIC_APIS, NULL, }; rocky_global_init(apis); EXECUTE_SCRIPT(script); cl_assert_equal_i(1, s_layer_mark_dirty.cal...
)); // check fourth cl_assert(iter_next(&iterator)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id)); // check fifth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); // check sixth cl_assert(iter_ne...
cl_assert(iter_next(&iterator))
; cl_assert(iter_next(&iterator) == false); } void test_timeline__middle_backwards(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // check first timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast, ...
{ { 0, 2 }, src_bitmap->bounds.size }); uint8_t dest_data[50*50]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = 50, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = { { 0, 0 }, { 50, 50 } } }; memset(dest_data, GColorBlue.argb, sizeof(dest...
cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_black_on_black-expect.1bit.pbi"))
; memset(dest_data, 0b00000000, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorWhite); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_white_on_black-expect.1bit.pbi")); memset(dest_data, 0b00000000, sizeof(dest_data)); bitbl...
et_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_nx_zero_y_offset); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_nx_zero_y_offset.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&...
(&canvas, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_nx.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_across_x); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,...
_value = 0; // error case agg_str = "sum"; break; case HealthAggregationAvg: exp_value = stats->avg; agg_str = "avg"; break; case HealthAggregationMin: exp_value = stats->min; agg_str = "min"; break; case HealthAg...
(s_sys_activity_get_minute_history_values.in[0].num_records, num_minutes_per_call)
; cl_assert_equal_i(s_sys_activity_get_minute_history_values.in[1].utc_start, time_start + SECONDS_PER_HOUR); cl_assert_equal_i(s_sys_activity_get_minute_history_values.in[1].num_records, num_minutes_per_call); if (agg == HealthAggregationAvg) { cl_assert_e...
N_TIMEOUT_MS (55 * MS_PER_MINUTE) #define WORKOUT_ABANDON_WORKOUT_TIMEOUT_MS (5 * MS_PER_MINUTE) //! Allocated when a Workout is started typedef struct CurrentWorkoutData { ActivitySessionType type; time_t start_utc; time_t last_paused_utc; time_t duration_completed_pauses_s; int32_t duration_s; int32_t ...
activity_private_compute_active_calories(delta_distance_mm, delta_ms)
; wrkt_data->active_calories += active_calories; } // Reset the last event count regardless of whether we are paused wrkt_data->last_event_step_count = new_event_steps; wrkt_data->last_movement_event_time_ts = now_ts; } static void prv_handle_heart_rate_update(HealthEventHeartRateUpdateData *event) { Cu...
/* * 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(&weather_glance->weather_event_info)
; kino_reel_destroy(weather_glance->icon); } app_free(weather_glance); } static uint32_t prv_get_weather_icon_resource_id_for_type(WeatherType type) { AppResourceInfo res_info; const bool lookup_success = timeline_resources_get_id_system(weather_type_get_timeline_resource_id(type), ...
*/ #define MAX14690_ADDR 0x50 //! The addresses of the registers that we can read using i2c typedef enum PmicRegisters { PmicRegisters_CHIP_ID = 0x00, PmicRegisters_CHIP_REV = 0x01, PmicRegisters_STATUSA = 0x02, PmicRegisters_STATUSB = 0x03, PmicRegisters_INTA = 0x05, PmicRegisters_INTB = 0x06, PmicRegi...
{ // Failed to read the current register value return false; }
if (enable) { if (*ref_count) { (*ref_count)++; return true; } else { // Set the register byte to XXXXX01X to enable the rail, mask and set register_value = (register_value & ~0x06) | 0x02; success = prv_write_register(rail_control_reg, register_value); if (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...
PBL_LOG_SYNC(LOG_LEVEL_INFO, ">>>> Address 0x%lx failed to write: 0x%lx 0x%lx", i, read, write)
; success = false; } } return success; } // Writes 0's to the first half of a flash sector and confirms that everything // reads as 0. Then uses 8 subsector erases to erase the second half of the // sector. Then re-reads the first half to see if any bits have flipped static bool check_subsector_bitflip...
(render_modal)
; window_render(window, ctx); PROFILER_NODE_STOP(render_modal); } return true; } static void prv_update_modal_stacks(UpdateContext *context) { context->highest_idx = ModalPriorityInvalid; context->properties = ModalPropertyDefault; prv_each_modal_stack(prv_update_modal_stack_callback, context); } ...
------------ static void prv_convert_seconds_to_time(uint32_t secs_after_midnight, char *text, int text_len) { uint32_t minutes_after_midnight = secs_after_midnight / SECONDS_PER_MINUTE; uint32_t hour = minutes_after_midnight / MINUTES_PER_HOUR; uint32_t minute = minutes_af...
if (enabled) { activity_start_tracking(false /*test_mode*/); } else { activity_stop_tracking(); }
activity_prefs_tracking_set_enabled(enabled); data->debug_card.menu_items[index].subtitle = enabled ? "Enabled" : "Disabled"; layer_mark_dirty(simple_menu_layer_get_layer(data->debug_card.menu_layer)); } // ----------------------------------------------------------------------------------------- static void p...
FSET, root_frame->size.w, font_height * 2), NULL, font, GColorBlack, window_bg_color, GTextAlignmentCenter, GTextOverflowModeTrailingEllipsis); layer_add_child(root_layer, (La...
window_get_user_data(window)
; if (data->state != StateError) { // Do not indicate that an error occurred when a session is interrupted by a window transition if (data->state != StateFinished) { data->last_session_successful = false; } prv_cancel_dictation(data); } } static void prv_mic_window_appear(Window *window) { ...
if (!gcolor_equal(color, GColorClear)) { return color; }
// if color isn't provided, build hash over uuid and pick from selected fall-back colors GColor fall_back_colors[] = {GColorFromHEX(0x0000aa), GColorFromHEX(0x005500), GColorFromHEX(0x550055), GColorFromHEX(0xff0055), GColorFromHEX(0xaa0000)}; uint8_t uuid_byte_sum = 0; for (uint8_t *b = &uuid->byte0; b <...
quote for filter was missing.", "Invalid argument separator.", }; //////////////////////////////////////////////////////////////////////////////////////////////////// // Fakes & Stubs #include "stubs_passert.h" #include "stubs_i18n.h" ////////////////////////////////////////////////////////////////////////////////...
(s_output, "hurf")
; cl_assert_equal_i(cond.eval_time, 1); cl_assert_equal_b(cond.force_eval_on_time, true); } { TemplateStringVars vars = {}; TemplateStringError err = {}; TemplateStringEvalConditions cond = {}; vars.current_time = 0; cond.eval_time = EVAL_FALL_THROUGH; cond.force_eval_on_time = tru...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
kernel_free(read_buf)
; return rv; } // Only keep reminders that have not been fired yet. static bool prv_reminder_filter(SerializedTimelineItemHeader *hdr, void *context) { return ((TimelineItemStatusReminded & hdr->common.status) == 0); } status_t reminder_db_next_item_header(TimelineItem *next_item_out) { PBL_LOG(LOG_LEVEL_DEBUG,...
b_db insert operation from the mobile // (after we receive the blob_db update event). // // If changing of the setting requires more than just setting a global, this handler is the // place to perform those other actions. // // If the the handler gets passed a invalid new value, set its s_* global to a default value, /...
{ bool invalid_data = false; if (new_settings->height_mm <= 0) { new_settings->height_mm = ACTIVITY_DEFAULT_HEIGHT_MM; invalid_data = true; } if (new_settings->weight_dag <= 0) { new_settings->weight_dag = ACTIVITY_DEFAULT_WEIGHT_DAG; invalid_data = true; } if (!(new_settings->gender == A...
static bool prv_set_s_activity_activation_timestamp(time_t *timestamp) { s_activity_activation_timestamp = *timestamp; return true; } static bool prv_set_s_activity_activation_delay_insight(uint32_t *insight_bitmask) { s_activity_activation_delay_insight = *insight_bitmask; return true; } static bool prv_se...
t_equal_i(start, start_utc); for (int i = 0; i < num_minutes; i++) { prv_assert_minute_data(&retrieve[i], &minute_data[i]); } // Retrieve, trying to start from a lot farther back, it should return the UTC of the first // record available. Also ask for more than what is available num_records = num_minutes...
fake_rtc_increment_time(30)
; // 30 seconds s_alg_next_steps = exp_steps; AccelRawData samples[100] = { }; uint64_t timestamp = 0; // Calling activity_algorithm_handle_accel() on our stub algorithm registers the new steps // counts for this minute activity_algorithm_handle_accel(samples, s_sample_rate, timestamp); // Fetch the last...
/* * 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...
(buf == 4)
; ASSERT(s_read_4_called == 3); ASSERT(s_size_4_called == 2); // remove 4 again emx_resources_remove_custom(id_4); ASSERT(emx_resources_get_size(1, id_4) == 0); ASSERT(s_size_4_called == 2); }
/* * 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_handle_event(&event)
; prv_handle_event(&event); event_cleanup(&event); } } // ------------------------------------------------------------------------------------------------- void worker_launch_app(void) { sys_launch_app_for_worker(); }
create_undefined(); } #define COLOR_BUFFER_LENGTH (12) T_STATIC void prv_graphics_color_to_char_buffer(GColor8 color, char *buf_out) { if (color.a <= 1) { strncpy(buf_out, "transparent", COLOR_BUFFER_LENGTH); } else { snprintf(buf_out, COLOR_BUFFER_LENGTH, "#%02X%02X%02X", color.r * 85, color....
(ctx_prototype, ROCKY_CONTEXT2D_FILLRADIAL, prv_fill_radial)
// update range_subtitle_text_layer buffer = time_selection_window->range_subtitle_buf; snprintf(buffer, sizeof(time_selection_window->range_subtitle_buf), "%s", time_selection_window->range_text); text_layer_set_text(range_subtitle_text_layer, buffer); TextLayer *top_layer = PBL_IF_RECT_ELSE(ran...
(window, WINDOW_NAME("Time Selection Window"))
; window_set_user_data(window, time_selection_window); // Selection layer setup const TimeSelectionSizeConfig * const size_config = prv_selection_config(); const int num_cells = clock_is_24h_style() ? 2 : 3; const int padding = size_config->cell_padding; SelectionLayer *selection_layer = &time_selection_wi...
RANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "timeline.h" #include "util/uuid.h" #include "applib/ui/status_bar_layer.h" #include "apps/system_app_ids.h" #include "apps/system_apps/ti...
if (node->all_day && node->timestamp == midnight) { return show_all_day_events; } else if (direction == TimelineIterDirectionFuture) { return (node->timestamp >= timestamp - fudge_time); } else { // direction == TimelineIterDirectionPast return (node->timestamp < timestamp - fudge_time); }
} // All day events show up in future if no timed events have passed today, // i.e. no events exist between midnight today and now // iterate and figure out if we had a timed event pass today static bool prv_should_show_all_day_events(TimelineNode *head, time_t now, time_t today_midnight, TimelineIterDirection dire...
/* * 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...
(!pstring_equal_cstring(ps1, NULL))
; cl_assert(!pstring_equal_cstring(NULL, NULL)); }
buffer_size, time_t timestamp, uint16_t duration, time_t current_day, bool all_day) { time_t end_time = timestamp + duration * SECONDS_PER_MINUTE; if (all_day) { // all day event, multiday or single day prv_get_relative_all_day_string(word_buffer, word_buffer_size, current_day); strncpy(number_buffe...
rtc_get_time()
, &tz_info); prv_update_time_info_and_generate_event(NULL, &tz_info); } void clock_get_friendly_date(char *buffer, int buf_size, time_t timestamp) { const time_t now = rtc_get_time(); const time_t midnight = time_util_get_midnight_of(timestamp); const time_t today_midnight = time_util_get_midnight_of(now); ...
/* * 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_transmit_data((uint8_t *)&entries, sizeof(entries))
; dialog_spi_wait_for_int(); dialog_spi_start_cmd(); uint32_t expected_crc = CRC32_INIT; for (size_t i = 0; i < vt_size_bytes; i++) { // This could be made faster by using DMA if we needed expected_crc = crc32(expected_crc, &vt[i], 1); dialog_spi_send_and_receive_byte(vt[i]); } dialog_spi_end_c...
t 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, * WITHOUT WARRANTIES OR C...
cl_assert_equal_i(event_type, -1)
allId install_id) { return NULL; } void status_bar_push_text(const char *text) { } const CompositorTransition* shell_get_open_compositor_animation(AppInstallId current_app_id, AppInstallId next_app_id) { return NULL; } const CompositorTransition* sh...
cl_assert(app_manager_get_current_app_md() == (PebbleProcessMd*) &s_root_app)
; } void test_app_manager__watchface_crash_on_close(void) { test_app_manager__start_first(); // Launch a new app with a panning animation. This will kick off the closing of the // current app. app_manager_launch_new_app(&(AppLaunchConfig) { .md = &s_third_party_app.common, }); // We've sent the deini...
/* * 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...
(NULL, radius, 0)
; cl_assert_equal_gpoint(result, GPointZero); } void test_graphics_circle__gpoint_from_polar_returns_correct_points(void) { const uint16_t radius = 5; GPoint result; const GPoint origin_center = GPointZero; // 90 degrees should be (5, 0) result = gpoint_from_polar_internal(&origin_center, radius, (TRIG_MA...
_clock_periph, DISABLE); } spi_ll_slave_release(slave); } // //! High level slave port interface //! This part of the API can be used for fairly straightforward SPI interactions //! The assertion and deassertion of the SCS line is automatic // static bool prv_is_bidrectional(const SPISlavePort *slave) { bool ...
spi_ll_slave_spi_enable(slave)
NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 4 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT...
(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw2_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 2); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw...
upting the app name cache for (int i = 0; i < 4; ++i) { prv_send_notification((uint8_t *)&s_app_name_title_dict); prv_cmp_last_received_notification(&s_app_name_title_parsed_item); } // Test an unrecognized app with a duplicated title prv_send_notification((uint8_t *)&s_unknown_app_dict); prv_cmp_las...
prv_send_notification((uint8_t *)&s_complete_dict)
; // The retry fails and we give up on this one cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1); // And make sure we get to a state where we can handle more messages s_gatt_client_op_write_should_fail_unlimited = false; prv_send_notification((uint8_t *)&s_complete_dict); ...
governing permissions and * limitations under the License. */ #include "peek_layer.h" #include "util/trig.h" #include "applib/ui/kino/kino_reel/scale_segmented.h" #include "applib/ui/kino/kino_reel/transform.h" #include "applib/ui/kino/kino_reel/unfold.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/kernel_u...
(peek_layer, &frame)
; } return peek_layer; } void peek_layer_destroy(PeekLayer *peek_layer) { if (peek_layer) { peek_layer_deinit(peek_layer); } task_free(peek_layer); } void peek_layer_init(PeekLayer *peek_layer, const GRect *frame) { *peek_layer = (PeekLayer) { .icon_offset_y = PEEK_LAYER_ICON_OFFSET_Y, .subt...
/* * 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; }
AppMessageHeader *message = (AppMessageHeader *) data; switch (message->command) { case CMD_PUSH: // Incoming message: app_message_inbox_receive(session, (AppMessagePush *) message, length, consumer_info); return; case CMD_REQUEST: // Incoming request for an update push: //...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(data->active_window, num_scrollable_metrics, scrollable_metrics)
; } static void prv_sync_tuple_changed_callback(uint32_t key, const Tuple *new_tuple, const Tuple *old_tuple, void *context) { SportsAppData *data = context; switch (key) { case SPORTS_DATA_KEY: strncpy(data->pace_string, new_tuple->value->cstring, sizeof(data...
->steps_card.time_layer, data->steps_card.time_text); } if (data->lap_steps > data->cur_steps) { // We probably encountered a midnight rollover, reset the persistent storage too data->lap_steps = data->cur_steps; persist_write_int(AppPersistKeyLapSteps, data->lap_steps); } if (data->steps_card.del...
layer_add_child(window_layer, text_layer_get_layer(data->steps_card.cur_step_layer))
; // Time data->steps_card.time_layer = text_layer_create(TIME_RECT); text_layer_set_text_alignment(data->steps_card.time_layer, GTextAlignmentCenter); text_layer_set_font(data->steps_card.time_layer, fonts_get_system_font(FONT_KEY_LECO_38_BOLD_NUMBERS)); text_layer_set_background_color...
data_cb_context, }, }; QueueHandle_t queue = pebble_task_get_to_queue(state->task); // Note: This call may fail if the queue is full but when a new sample // becomes available from the driver, we will retry anyway return xQueueSendToBack(queue, &event, 0); } case PebbleTas...
DEFINE_SYSCALL(bool, sys_accel_manager_consume_samples, AccelSessionRef session, uint32_t samples)
s->spi_sclk.gpio, .gpio_pin = bus->spi_sclk.gpio_pin }; gpio_analog_init(&sclk); // MOSI InputConfig mosi = { .gpio = bus->spi_mosi.gpio, .gpio_pin = bus->spi_mosi.gpio_pin }; gpio_analog_init(&mosi); // MISO if (is_bidirectional) { InputConfig miso = { .gpio = bus->spi_miso.gpio, .gpio_pin = bus->spi...
{ // don't initialize twice if (slave->slave_state->initialized) { return; } slave->slave_state->initialized = true; slave->slave_state->acquired = false; slave->slave_state->scs_selected = false; prv_spi_bus_init(slave->spi_bus, prv_is_bidrectional(slave)); // SCS gpio_output_init(&slave->spi_sc...
static void prv_spi_acquire_helper(const SPISlavePort *slave) { spi_ll_slave_acquire(slave); spi_ll_slave_scs_assert(slave); } static void prv_spi_release_helper(const SPISlavePort *slave) { spi_ll_slave_scs_deassert(slave); spi_ll_slave_release(slave); } uint8_t spi_slave_read_write(const SPISlavePort *sla...
/* * 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...
debounced_connection_service_init()
= GOvalScaleModeFillCircle; GRect r = GRect(0, 5, 0, 0); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 0, 5); cl_assert_fixedS16_3(radius, 0); // 1 pixel width means radius of 0 r = GRect(-1, -5, 1, 1); grect_polar_calc_values(&r, mode, &center, &radius); cl_as...
(s_angle_start, 0)
; cl_assert_equal_i(s_angle_end, TRIG_MAX_ANGLE); graphics_fill_oval(NULL, GRect(0, 0, 0, 0), GOvalScaleModeFillCircle); cl_assert_gpoint_precise(s_center, 0.0, 0.0); cl_assert_fixedS16_3(s_radius_outer, 0.0); cl_assert(s_radius_inner.integer <= 0); cl_assert_equal_i(s_angle_start, 0); cl_assert_equal_i(...
Note: the source doesn't matter here, phone_call.c ignores it prv_put_phone_event(PhoneEventType_Start, PhoneCallSource_PP, ANCS_CALL_UID); } static void prv_call_hide(uint32_t call_identifier) { // Note: the source doesn't matter here, phone_call.c ignores it prv_put_phone_event(PhoneEventType_Hide, PhoneCallS...
prv_ancs_disconnect()
; ASSERT_LAST_EVENT(PhoneEventType_End); } // --------------------------------------------------------------------------------------- // Basic test for call start events void test_phone_call__call_start(void) { // A call start event with ANCS should act as a call end in order to hide the phone ui prv_put_incomi...
/* * 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...
memcpy(&common->uuid, &info->uuid, sizeof(Uuid))
; common->process_storage = process_storage; // Flags common->process_type = process_metadata_flags_process_type(info->flags, task); common->visibility = process_metadata_flags_visibility(info->flags); common->allow_js = process_metadata_flags_allow_js(info->flags); common->has_worker = process_metadata_fl...
i18n_get_length(const char *string) { return strlen(i18n_get(string, NULL)); } void i18n_free(const char *original, const void *owner) { } void i18n_free_all(const void *owner) { } void sys_i18n_get_with_buffer(const char *string, char *buffer, size_t length) { i18n_get_with_buffer(string, buffer, length); } s...
(tmbuf, "01/02/15 13:00:00")
; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%y %Y", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "15 2015"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%Z %%", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "UTC %"); } void test_strftime__return_value(void) { char tmbuf[512]; stru...
default: case 0: return 3; } } static int16_t get_header_height_callback(struct MenuLayer *menu_layer, uint16_t section_index, AppData *data) { (void)data; (void)menu_layer; (void)section_index; return MENU_CELL_BASIC_HEADER_HEIGHT; } static void draw_row_callback(GContext* ctx, Layer *cell_layer, Menu...
{ handle_init(); app_event_loop(); handle_deinit(); }
const PebbleProcessMd* persist_app_get_info() { static const PebbleProcessMdSystem s_app_info = { .common.main_func = &s_main, .name = "Persist Demo" }; return (const PebbleProcessMd*) &s_app_info; } #undef BUFFER_SIZE
TF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_DMY_FORCE, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_CS_HIGH_MIN, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_WRAP_SIZE, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_WRAP_LEN, 0x0); REG_SETF(QSPIC, QSP...
(CACHE, CACHE_CTRL2_REG, CACHE_WEN, 0x0)
; REG_SETF(CACHE, CACHE_CTRL2_REG, CACHE_LEN, 0x0); REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_CONTROLLER_RESET, 0x0); REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_RAM_SIZE_RESET_VALUE, 0x2); REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_LINE_SIZE_RESET_VALUE, 0x0); REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_ASSOCIATIVITY_RESET_...
/* * 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...
{ // Another ANCS / iOS quirk, some apps (i.e. the Phone app) // send an invalid-length string as date... // Apple rdar://19639333 timestamp = rtc_get_time(); // copy out app ID to a char buffer char app_id_buffer[app_id->length + 1]; pstring_pstring16_to_string(&app_id->pstr, app_id_buffer...
return timestamp; } static bool prv_should_ignore_because_calendar_reminder(const ANCSAttribute *app_id) { // do not show calendar notifications if we have reminders set (PBL-13271) return pstring_equal_cstring(&app_id->pstr, IOS_CALENDAR_APP_ID) && !reminder_db_is_empty(); } static bool prv_reminder_filter(S...
hBLEPairingData *)context; itr_data->cb(&stored_data->ble_data.pairing_info.identity, &stored_data->ble_data.pairing_info.irk, stored_data->ble_data.name, &key, itr_data->cb_data); } static bool prv_ble_pairing_internal_for_each_itr(SettingsFile *file, ...
prv_file_each(prv_get_key_for_bt_classic_addr_itr, &itr_data)
; return itr_data.key_out; } BTBondingID bt_persistent_storage_store_bt_classic_pairing(BTDeviceAddress *address, SM128BitKey *link_key, char *name, uint8_t *platform_bits) { if (!address) { r...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
text_layer_destroy(time_layer)
; text_layer_destroy(gmtime_layer); text_layer_destroy(localtime_layer); } static void init(void) { window = window_create(); window_set_window_handlers(window, (WindowHandlers) { .load = window_load, .unload = window_unload, }); const bool animated = true; window_stack_push(window, animated); } ...
end_begin( PULSE2_BULKIO_PROTOCOL); resp->opcode = BULKIO_RESP_INTERNAL_ERROR; resp->status_code = status_code; size_t response_len = sizeof(*resp); size_t command_len = MIN(length, PULSE_MAX_SEND_SIZE - response_len); response_len += command_len; memcpy(resp->bad_command, cmd, command_len); pulse...
pulse_reliable_send_begin(PULSE2_BULKIO_PROTOCOL)
; resp->opcode = BULKIO_RESP_DOMAIN_CLOSE; resp->fd = cmd->close.fd; pulse_reliable_send(resp, sizeof(*resp)); prv_free_fd(cmd->close.fd); } static void prv_handle_read(Command *cmd, size_t length) { if (cmd->read.length == 0) { prv_respond_internal_error(cmd, length, E_INVALID_ARGUMENT); return; ...
S_LOG_DEBUG("Not triggering activity reward - too soon to trigger"); return false; } // Make sure we're not still sleeping if (prv_get_sleep_state() != ActivitySleepStateAwake) { INSIGHTS_LOG_DEBUG("Not triggering reward - asleep"); return false; } // Finally, make sure the current metric value ...
prv_generate_sleep_pin_strings(sleep_enter_seconds, sleep_exit_seconds, sleep_total_seconds)
; // Insert or update the pin return prv_push_summary_pin(pin_time_utc, now_utc, uuid, sleep_total_seconds, sleep_average_seconds, &SLEEP_SUMMARY_PIN_CONFIG); } // ----------------------------------------------------------------------------------------- static NOINLINE TimelineItem ...
, 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 distributed on ...
if (b_node->priority > a_node->priority) { return 1; } else if (b_node->priority < a_node->priority) { return -1; } else { // bigger applications to have a lower priority if (b_node->size < a_node->size) { return 1; } else if (b_node->size > a_node->size) { return -1; } else { ...
} //! Trim the applications with highest priority while still keeping (bytes_in_list > bytes_needed) static void prv_trim_top_priorities(EvictListNode **list_node, uint32_t *bytes_in_list, uint32_t bytes_needed) { EvictListNode *node = *list_node; while (node) { E...
ght 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 in writing, s...
settings_file_open(&file, "notifpref", 1024)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&ctx, &byte)
) { cl_assert_equal_i(byte, 0x0); ++count; } cl_assert_equal_i(count, 5); } void test_sle__long_zeros(void) { SLEDecodeContext ctx; uint8_t buf[] = { 0xfd, // escape code 0xfd, 0xff, 0xaa, // 32810 zeroes 0xfd, 0x00 // end }; sle_decode_init(&ctx, buf); uint8_t byte; uint32_t count...
ml, item, selected, &label_text_frame); #if !defined(RECOVERY_FW) && SCREEN_COLOR_DEPTH_BITS == 8 const int16_t fade_height = 10; graphics_context_set_compositing_mode(ctx, GCompOpSet); if (draw_top_shading) { GRect top_bounds = label_text_container; t...
menu_cell_small_cell_height()
- line_height, default_sep_height) + 1; return sep_height; #endif } static int16_t prv_get_cell_height_cb(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *context) { ActionMenuLayer *aml = (Actio...
{ -168, -112, -992}, { -168, -128, -992}, { -160, -128, -1008}, { -160, -168, -1000}, { -160, -152, -992}, { -168, -128, -992}, { -168, -136, -992}, { -168, -120, -984}, { -168, -144, -984}, { -160, -128, -1000}, { -160, -144, -984}, { -168, -128, -1000}, { -168, -12...
{ -168, -96, -976}, { -168, -120, -1008}, { -168, -160, -992}, { -160, -152, -984}, { -160, -104, -1000}, { -176, -152, -984}, { -176, -144, -992}, { -160, -136, -992}, { -160, -144, -984}, { -168, -144, -992}, { -168, -136, -992}, { -168, -136, -992}, { -160, -128, -...
{ -160, -144, -992}, { -168, -136, -992}, { -160, -136, -1000}, { -160, -136, -976}, // 168 seconds { -168, -112, -992}, { -176, -120, -1008}, { -168, -160, -976}, { -160, -152, -992}, { -160, -128, -1008}, { -168, -136, -992}, { -160, -128, -992}, { -160, -128, -100...
.type = ProtobufLogType_Measurements, .msrmt = { .time_utc = rtc_get_time(), .utc_to_local = time_util_utc_to_local_offset(), .num_types = ARRAY_LENGTH(types), .types = types, .num_samples = ARRAY_LENGTH(offset_sec), .offset_sec = offset_sec, .num_value...
{ rtc_set_time(input.msrmt.time_utc + input.msrmt.offset_sec[i]); success = protobuf_log_session_add_measurements(session_ref, rtc_get_time(), input.msrmt.num_types, &input.msrmt.values[i * values_per_samples...
// Flush it out now, this should end up in our transport method being called TestPLParsedMsg *msg = prv_flush_get_record(&input, false /* use_data_logging */, session_ref); prv_assert_msg_equal(&input, msg); // ------------------ // Send another set of measurements uint32_t offset_sec_b[] = {2, 4, 6}; ...
rent chunk. static int s_current_chunk_id; //! The current offset in the chunk in bytes. [0 - CHUNK_SIZE_BYTES) static int s_current_offset; static bool s_enabled; static uint32_t get_current_address(int chunk, int offset) { return debug_db_get_logs_base_address(0) + (chunk * CHUNK_SIZE_BYTES) + offset; } static ...
if (cb(read_buffer, log_header.log_length)) { break; } else if (retries == 0) { error = true; break; }
} } kernel_free(read_buffer); return !error; } bool flash_dump_log_file(int generation, DumpLineCallback cb, DumpCompletedCallback completed_cb) { if (generation < 0 || generation >= DEBUG_DB_NUM_FILES) { completed_cb(false); return false; } if (!debug_db_is_generation_valid(generation)) { ...
window->workout_controller->stop(); } workout_push_summary_window(); workout_dialog_pop(&active_window->end_workout_dialog); app_window_stack_remove(&active_window->window, false); } static void prv_end_workout_down_click_handler(ClickRecognizerRef recognizer, void *context) { WorkoutActiveWindow *active_w...
window_single_click_subscribe(BUTTON_ID_DOWN, prv_down_click_handler)
; } static void prv_window_unload_handler(Window *window) { WorkoutActiveWindow *active_window = window_get_user_data(window); if (active_window) { app_timer_cancel(active_window->update_timer); app_timer_cancel(active_window->hr_measuring_timer); gbitmap_destroy(active_window->action_bar_start); g...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
DEFINE_SYSCALL(size_t, sys_resource_load_range, ResAppNum app_num, uint32_t id, uint32_t start_offset, uint8_t *data, size_t num_bytes)
{ if (PRIVILEGE_WAS_ELEVATED) { if (pebble_task_get_current() == PebbleTask_Worker) { // Not allowed from workers syscall_failed(); } syscall_assert_userspace_buffer(data, num_bytes); } return resource_load_byte_range_system(app_num, id, start_offset, data, num_bytes); } DEFINE_SYSCAL...
rv_count_handler_entries(&s_stopped_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 1); // If we keep going, we should repeat the whole sequence prv_advance_to_ms_with_timers(start_m...
cl_assert(distance > TEST_ANIMATION_NORMALIZED_HIGH)
; // Execute to the end of B prv_advance_to_ms_with_timers(start_ms + duration_total + 1 * 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_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_bonding_change_ops)
foo", .output = "", }, { .size = 3, .intime = 1000, .instr = "foo", .output = "fo", }, { .size = 3, .intime = 1000, .instr = "{format('foo')}", .output = "fo", }, { .size = 1, .intime = 1000, .instr = "{time_until(1004)|format('%S')}", .output = "", }, { .size = 2, .intime = ...
(err.status, TemplateStringErrorStatus_MissingArgument)
; cl_assert_equal_i(err.index_in_string, 40); } } //////////////////////////////////////////////////////////////////////////////////////////////////// // Test `time_since` and `time_until` filters static const struct { time_t current_time; const char *params; intmax_t done_state; } s_time_since_tests[] = ...
torage struct and create a new file for the compacted data DataLoggingSessionStorage new_storage = { .fd = DLS_INVALID_FILE, }; success = prv_open_file(&new_storage, OP_FLAG_OVERWRITE | OP_FLAG_READ, new_size, session); if (!success) { PBL_LOG(LOG_LEVEL_ERROR, "Could not create...
prv_assert_valid_task()
; bool success = false; bool got_session_file = prv_get_session_file(session, num_bytes); if (!got_session_file) { goto exit; } success = prv_write_data(&session->storage, data, num_bytes); exit: if (got_session_file) { prv_release_session_file(session); } if (!success) { PBL_LOG(LOG_LEV...
tch the key stored in shared resources SMPairingInfo sprf_info = {}; bool requires_address_pinning; uint8_t flags; shared_prf_storage_get_ble_pairing_data(&sprf_info, NULL, &requires_address_pinning, &flags); matches_prf = (memcmp(&sprf_info, &info, sizeof...
prv_dump_bonding_db_data(display_buf, id, (BtPersistBondingData *)&val)
; } else { prompt_send_response("Something new be in the bonding DB!"); PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG, &key[0], info->key_len); PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG, &val[0], info->val_len); } prompt_send_response(""); kernel_free(display_buf); return true; } void bluetooth_persistent_st...
MED_PBI_FILE("draw_horiz_dotted_line_even_offset_checkerboard_no_clip"))); // Clipping on even boundaries - no offset setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_EVEN, OFFSET_RECT_EVEN, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MA...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_EVEN, OFFSET_RECT_ODD, false, 1)
; for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_even_clip"))); // Clipping on odd boundaries - no offset setup_test_aa_...
y_marks_in_current_cell) { prv_append_certification_menu(cd, &(SystemCertificationMenuItem) { .draw_cell_fn = prv_draw_regulatory_marks_cell, .arg1 = (void *)(uintptr_t)cd->current_regulatory_marks_cell_start_idx, .arg2 = (void *)(uintptr_t)cd->num_regulatory_marks_in_current_cell, }); ...
if (flags->has_china_cmiit) { prv_append_certification_menu(cd, &(SystemCertificationMenuItem) { .draw_cell_fn = prv_draw_regulatory_id_cell, .arg1 = "CMIIT ID", .arg2 = prv_get_china_cmiit_id(), }); }
if (flags->has_korea_kcc) { prv_append_certification_menu(cd, &(SystemCertificationMenuItem) { .draw_cell_fn = prv_draw_korea_regulatory_cell, .arg1 = "South Korea KCC", .select_cb = prv_push_kcc_window, }); } if (flags->has_mexico_nom_nyce) { prv_append_certification_menu(cd,...
/* * 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...
{ JS_VAR listener = jerry_get_property_by_index(event_listeners, idx); if (jerry_value_is_function(listener)) { bool wants_more = callback(event_listeners, idx, listener, data); if (!wants_more) { break; } } }
} typedef struct { jerry_value_t listener; bool found; } ListenerQueryData; static bool prv_find_listener(jerry_value_t event_listeners, uint32_t idx, jerry_value_t listener, void *data) { ListenerQueryData *query_data = data; if (query_data->listener == listener) { query_data->fou...
rb_set_manually_enabled(!do_not_disturb_is_active()); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Helper Functions static void prv_assert_settings_value(const void *key, size_t key_len, const void *expected_value, size...
{ // 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_enabled(WeekdaySchedule) == false); cl_assert(do_not_disturb_is_smart_dnd_enabled() == false); active = do_not_...
cl_assert(do_not_disturb_is_active() == true); cl_assert(do_not_disturb_is_manually_enabled() == false); cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == true); cl_assert(do_not_disturb_is_smart_dnd_enabled() == false); active = do_not_disturb_is_active(); cl_assert(active == true); // E...
d/board.h" #include "os/mutex.h" #include "process_management/app_install_manager.h" #include "process_management/process_manager.h" #include "services/normal/activity/activity.h" #include "services/normal/activity/activity_insights.h" #include "services/normal/activity/insights_settings.h" #include "services/normal/se...
{ return true; // continue search }
st_alg_state.minute_data.sleep_state) { // We are waking -------------------- case ActivitySleepStateAwake: // End the container s_test_alg_state.minute_data.sleep_current_container_idx = -1; // Send all stored sleep sessions to the activity service now that sleep is over fo...
{ *steps = s_test_alg_state.rate_steps; *elapsed_ms = s_test_alg_state.rate_elapsed_ms; *end_sec = s_test_alg_state.rate_last_update_time; return true; }
bool activity_algorithm_metrics_changed_notification(void) { s_test_alg_state.steps = 0; s_test_alg_state.rate_last_steps = 0; s_test_alg_state.rate_last_update_time = rtc_get_time(); return true; } bool activity_algorithm_get_sleep_sessions(time_t sleep_earliest_end_utc, ...
/* * 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...
(&edit_attr_list)
_layer->item, .colors.background = colors->bg_color, .colors.foreground = colors->primary_color, }; timeline_actions_push_action_menu( &config, window_manager_get_window_stack(ModalPriorityNotification)); } static void prv_handle_up_click(ClickRecognizerRef recognizer, void *context) { TimelineItem...
layout_create(item_layer->item->header.layout, &config)
; layer_add_child(&item_layer->layer, (Layer *)item_layer->timeline_layout); }
44, 256}, { 872, -288, 416}, { 784, -200, 112}, { 1176, -64, -24}, { 2776, 4000, -256}, { 1184, 4000, -2248}, { -424, 2600, -1384}, { -736, 840, -408}, { -768, 80, -208}, { -1056, -216, -56}, { -1496, -328, -192}, { -1056, -160, -168}, { -736, 32, -136}, { -768, 520, ...
{ -1392, 3304, -1160}, { -240, 3544, -872}, { 224, 1256, -80}, { 576, 640, 64}, { 1136, 256, 32}, { 1248, -456, -296}, { 1064, 48, -64}, { 792, -80, 344}, { 728, 0, -24}, { 1016, 3432, -1072}, { 664, 4000, -2192}, { -552, 3024, -1408}, { -872, 1680, -824}, { -752,...
{ 1056, -240, 152}, // 15 seconds { 872, -152, 144}, { 1136, 856, -488}, { 960, 3848, -1568}, { 216, 4000, -1840}, { -600, 2144, -1168}, { -632, 1200, -776}, { -520, 568, -344}, { -376, -128, -112}, { -864, -448, 144}, { -1176, -488, -40}, { -648, -248, -96}, { -...
MenuIndex_StartTime; } else if (before_time_m <= 5) { return PeekBeforeTimingMenuIndex_5Min; } else if (before_time_m <= 10) { return PeekBeforeTimingMenuIndex_10Min; } else if (before_time_m <= 15) { return PeekBeforeTimingMenuIndex_15Min; } else if (before_time_m <= 30) { return PeekBeforeTimi...
prv_create_settings_window()
; app_window_stack_push(window, true /* animated */); } static Window *prv_create_first_use_dialog(void) { const void *i18n_owner = prv_create_first_use_dialog; // Use this function as the i18n owner /// Title for the Timeline Quick View first use dialog. const char *header = i18n_get("Quick View", i18n_owner)...
nsport Receive Buffer Full, exiting from rx'ing to process"); } prv_lock(); circular_buffer_write_finish(&s_rx_buffer, rx_len); // Check if more data is available in the circular buffer. // If not, flip s_is_transacting back while the lock is taken. Otherwise, a concurrent call to // host_transport_tx_enq...
(&s_tx_buffer, s_tx_storage, HOST_TRANSPORT_CTLR_TX_BUFFER_SIZE)
; circular_buffer_init(&s_rx_buffer, s_rx_storage, HOST_TRANSPORT_CTLR_RX_BUFFER_SIZE); // Start the task that runs the transaction loop: OS_BASE_TYPE status = OS_TASK_CREATE("HT", prv_host_transport_main, NULL /* ctx */, 1280 /* stack_size */, ...
Short: return "%a"; case ToStringFormatDayLong: return "%A"; case ToStringFormatMonthNumeric: case ToStringFormatMonth2Digit: return "%m"; case ToStringFormatMonthShort: return "%b"; case ToStringFormatMonthLong: return "%B"; case ToStringFormatYearNumeric: re...
(this_val, argc, argv, date_default_format, ToStringFormatDateMask, date_buffer, sizeof(date_buffer), &error)
ude "stubs_resources.h" #include "stubs_syscalls.h" #include "stubs_compiled_with_legacy2_sdk.h" /////////////////////////////////////////////////////////// // Fakes static GContext s_ctx; static FrameBuffer s_fb; size_t framebuffer_get_size_bytes(FrameBuffer *f) { return FRAMEBUFFER_SIZE_BYTES; } ///////////////...
(&char_iter)
); cl_assert(utf8_iter_state->codepoint == 'B'); cl_assert(iter_next(&char_iter)); cl_assert(utf8_iter_state->codepoint == ' '); cl_assert(!iter_next(&char_iter)); cl_assert(!iter_next(&char_iter)); cl_assert(!iter_next(&char_iter)); }
assert_equal_i(fake_shared_prf_storage_get_bt_classic_store_count(), 2); // Delete a pairing that doesn't exist bt_persistent_storage_delete_bt_classic_pairing_by_id(9); cl_assert_equal_i(fake_shared_prf_storage_get_bt_classic_delete_count(), 3); // Make sure the pairing is actually still there ret = bt_per...
cl_assert(id_1 != BT_BONDING_ID_INVALID)
peek_layer_clear_fields(peek_layer)
; peek_layer_set_scale_to(peek_layer, icon_to); peek_layer_set_duration(peek_layer, duration); #if PLATFORM_TINTIN return (Animation *)peek_layer_create_play_animation(&data->peek_layer); #else // Play only a section to reduce the duration to the scaling, ignoring the PDCS duration return (Animation *)peek_l...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
grect_inset((*layer_bounds), GEdgeInsets(shape_size->h / 2))
; const GRect shape_rect = grect_centered_from_polar(inset_layer_bounds, oval_scale_mode, current_angle, (*shape_size)); // Fill the radial circle graphics_fill_oval(ctx, shape_rect, oval_scale_mode); } static void prv_layer_update_proc(Layer *layer, GContext...
list_data->attr_list; const size_t attr_list_size = current_attr_list_data->attr_list_size; // Calculate the total size of this serialized slice const uint16_t serialized_slice_total_size = sizeof(SerializedAppGlanceSliceHeader) + attr_list_size; // Populate the serialized slice header Ser...
if (!uuid || !glance) { return E_INVALID_ARGUMENT; }
SerializedAppGlanceHeader *serialized_glance = NULL; size_t serialized_glance_size = 0; status_t rv = prv_serialize_glance(glance, &serialized_glance, &serialized_glance_size); if (rv == S_SUCCESS) { rv = app_glance_db_insert((uint8_t *)uuid, UUID_SIZE, (uint8_t *)serialized_glance, ...
isible_idx = idx; } if (prv_has_transition_window(context) && (iter.first_transition_idx == ModalPriorityInvalid)) { iter.first_transition_idx = idx; } if (prv_has_focusable_window(context) && (iter.first_focus_idx == ModalPriorityInvalid)) { iter.first_focus_idx = idx; } if (prv_has...
prv_each_modal_stack(prv_update_modal_stack_callback, context)
; } ModalProperty modal_manager_get_properties(void) { return modal_manager_get_enabled() ? s_current_modal_properties : ModalPropertyDefault; } void modal_manager_render(GContext *ctx) { PBL_ASSERTN(ctx); prv_each_modal_stack(prv_render_modal_stack_callback, ctx); } typedef struct VisibleContext { Window *...