prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
er(msg, data->mic_window.text_buffer, sizeof(data->mic_window.text_buffer)); text_layer_set_text(&data->mic_window.text_layer, data->mic_window.text_buffer); } static void prv_kino_reel_stopped_handler(KinoLayer *layer, bool finished, void *context) { if (!finished) { return; } // This stopped handler is ...
window_get_root_layer(layer_get_window(dot_layer))
->frame; GRect dot_frame = {.size = MIC_DOT_LAYER_SIZE}; grect_align(&dot_frame, root_frame, GAlignCenter, false); GRect from; GRect to; if (fly_in) { to = dot_frame; from = dot_frame; from.origin.x = -to.size.w; } else { from = dot_frame; to = dot_frame; to.origin.x = -from.size.w...
ude "console/pulse_llc.h" #include "console/pulse_protocol_impl.h" #include "kernel/pbl_malloc.h" #include "os/mutex.h" #include "services/common/new_timer/new_timer.h" #include "services/common/system_task.h" #include "system/passert.h" #include "util/attributes.h" #include "util/legacy_checksum.h" #include "util/like...
(SERIAL_CONSOLE_STATE_LOGGING)
; } void pulse_prepare_to_crash(void) { } static void prv_process_received_frame(void *frame_ptr) { IncomingPulseFrame *frame = frame_ptr; uint32_t fcs; // Comply with strict aliasing rules. The memcpy is optimized away. memcpy(&fcs, &frame->data[frame->length - sizeof(fcs)], sizeof(fcs)); uint32_t crc = le...
, GColorMayGreenARGB8}, {"cadetblue", GColorCadetBlueARGB8}, {"pictonblue", GColorPictonBlueARGB8}, {"brightgreen", GColorBrightGreenARGB8}, {"screamingreen", GColorScreaminGreenARGB8}, {"mediumaquamarine", GColorMediumAquamarineARGB8}, {"electricblue", GColorElectricBlueARGB8}, {"darkcandyapplered", GCol...
if (parsed_color->a == 0) { *parsed_color = GColorClear; }
return true; } } } return false; } bool rocky_api_graphics_color_parse(const char *color_value, GColor8 *parsed_color) { return prv_parse_name(color_value, parsed_color) || prv_parse_hex(color_value, parsed_color); } bool rocky_api_graphics_color_from_value(jerry_value_t value, GColor *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...
(confirmation_dialog, prv_calibrate_click_config)
; confirmation_dialog_push(confirmation_dialog, modal_manager_get_window_stack(MODAL_PRIORITY)); } static bool prv_display_has_user_offset(void) { GPoint display_offset = shell_prefs_get_display_offset(); GPoint mfg_display_offset = mfg_info_get_disp_offsets(); return (!gpoint_equal(...
/* * 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...
for (unsigned int index = 0; index < ARRAY_LENGTH(map); ++index) { const struct ANCSAppMetadata *mapping = &map[index]; if (pstring_equal_cstring(&app_id->pstr, mapping->app_id)) { return mapping; } }
/* * 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_FROM_FAULT_HANDLER(" Bus Fault Status Register:")
; if (bfsr & (1 << 7)) { PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, " BFARVALID = yes 0x%"PRIx32, SCB->BFAR); } print_set_indexes(buffer, &bfsr, bfsr_mappings, ARRAY_LENGTH(bfsr_mappings)); } // Memory Management Fault Status Register const uint8_t mmfsr = cfsr & 0xff; static const Index...
!= 0); if (double_tap) { int32_t direction; IMUCoordinateAxis axis = prv_get_axis_direction(int0_status, int2_status, BMI160_INT_STATUS_2_TAP_SIGN, BMI160_INT_STATUS_2_TAP_FIRST_X, &direction); if (doub...
prv_get_min_sampling_interval_us()
; uint64_t start_time = last_frame_time - curr_num_samples * curr_sampling_interval_us; for (int i = 0; i < len; i += fifo_frame_len) { uint8_t burst_buf[fifo_frame_len]; spi_ll_slave_burst_read(BMI160_SPI, &burst_buf[0], fifo_frame_len); AccelDriverSample data; prv_process_fifo_frame(burst_buf, &...
text_layer_deinit(&data->title_text)
; text_layer_deinit(&data->info_text); i18n_free_all(data); } static void prv_push_kcc_window(SystemCertificationData *data) { window_init(&data->kcc_window, WINDOW_NAME("System KCC")); window_set_user_data(&data->kcc_window, data); window_set_window_handlers(&data->kcc_window, &(WindowHandlers) { .load ...
if (idx < 0) { return true; // continue iterating }
my_data->storage->id_list[idx] = entry->install_id; return true; // continue iterating } //! Should be called on system task. void write_uuid_list_to_file(const Uuid *uuid_list, uint8_t count) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); int storage_size = sizeof(AppMenuOrderStorage) + (count * sizeof(A...
raw_text(ctx, s_text_buffer, &s_font_info, GRect(34, 4, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_text_single_line_wordwrap_clip_outside_ny(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &...
(&layer, &draw_text_single_line_ellipsis_clip_outside_y)
; layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_outside_y.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_outside_nx); layer_render_tree(&canvas, &ctx); cl_...
e;}\n" "try {f2();} catch(e) {e2 = e;}\n" "try {f3();} catch(e) {e3 = e;}\n"; EXECUTE_SCRIPT(script); jerry_value_t e1 = prv_js_global_get_value("e1"); jerry_value_t e2 = prv_js_global_get_value("e2"); jerry_value_t e3 = prv_js_global_get_value("e3"); // error s_log_internal__expected = (const ch...
cl_assert(jerry_value_is_object(json_builtin))
nds.size = state.menu_layer->inverter.layer.frame.size; // when scrolling up, bounce back at the top (otherwise at the bottom) if (!state.up) { state.menu_layer->inverter.layer.frame.origin.y -= abs_content_offset; } } layer_mark_dirty(&state.menu_layer->scroll_layer.layer); } void prv_center_fo...
animation_set_delay(anim, duration)
; } animation_set_duration(anim, duration); animation_set_curve(anim, AnimationCurveEaseInOut); animation_schedule(anim); if (was_animating) { // create visual state that's already reflecting the beginning of the "out" animation prv_center_focus_animation_update_out_only(anim, 0); } } static void ...
system: Temporary size - %"PRId32" Kb", (s_ftl_size / 1024)); pfs_set_size(s_ftl_size, false /* don't erase regions */); } //! return a layout version that associates with the labels from above static uint8_t prv_ftl_get_layout_version(void) { // add all regions so PFS can know about them temporarily prv_layout_...
( s_region_list[idx].start + offset - curr_virt_offset_begin)
ms_fired, 6); cl_assert_equal_i(s_num_alarm_events_put, 6); cl_assert_equal_i(s_num_timeline_adds, 48); cl_assert_equal_i(s_num_timeline_removes, 36); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // First alarm goes off. Second one should be up s_current_hour = 10; s_c...
rtc_get_time()
); } void test_alarm__recurring_weekday_alarm_timeout_ahead(void) { AlarmId id; s_current_day = s_saturday; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_WEEKDAYS }); prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule); // Only 1 pin should be a...
/* * 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...
{ // timed out because of lost connection return; }
DataLoggingSession *logging_session = dls_list_find_by_session_id(session_id); struct PACKED { uint8_t command; uint8_t session_id; } msg = { .command = DataLoggingEndpointCmdTimeout, .session_id = logging_session->comm.session_id, }; comm_session_send_data(session, ENDPOINT_ID_DATA_LOGGIN...
ay_len; success: return jerry_create_undefined(); } #define TRY_ALLOCATE_STEPS_OR_RETURN_ERROR(num_steps_increment) \ ROCKY_RETURN_IF_ERROR(prv_try_allocate_steps(num_steps_increment)) static jerry_value_t prv_add_pt(jerry_length_t argc, const jerry_value_t *argv, RockyAPIPathStepT...
{ prv_fill_points(points, points_num); points_num = 0; ADD_P(step->pt); break; }
case RockyAPIPathStepType_LineTo: { ADD_P(step->pt); break; } case RockyAPIPathStepType_Arc: { rv = rocky_error_argument_invalid("fill() does not support arc()"); goto cleanup; } } } rv = jerry_create_undefined(); prv_fill_points(points, points_num); ...
rn job; } // ----------------------------------------------------------------------------- void gap_le_advert_unschedule(GAPLEAdvertisingJobRef job) { if (!job) { return; } bool is_registered = false; bt_lock(); { if (!s_gap_le_advert_is_initialized) { goto unlock; } is_registered = ...
{ bt_lock(); { if (!s_gap_le_advert_is_initialized) { goto unlock; } // The link layer state machine inside the Bluetooth controller // automatically stops advertising when transitioning to "connected", so // update our own state. See 7.8.9 of Bluetooth Specification // // We don't...
// ----------------------------------------------------------------------------- void gap_le_advert_handle_disconnect_as_slave(void) { bt_lock(); { if (!s_gap_le_advert_is_initialized) { goto unlock; } // Call prv_perform_next_job() to trigger refreshing the configuration of // the controlle...
nimationPrivate *top_level_animation, uint32_t top_level_start_time, bool do_update); #define PebbleTask_Current PebbleTask_Unknown // ------------------------------------------------------------------------------------------- static AnimationState *prv_animation_state_get(PebbleTask task) { if (...
{ // If this animation is the iterator's next, bump the iterator if (state->aux->iter_next == (ListNode *)animation) { state->aux->iter_next = list_get_next((ListNode *)animation); } }
// ------------------------------------------------------------------------------------------- // Remove from our list of allocated animations and free the memory static void prv_unlink_and_free(AnimationState *state, AnimationPrivate *animation) { // It's an error if it's scheduled PBL_ASSERTN(list_contains(stat...
drivers/voltage_monitor.h" #include "drivers/watchdog.h" #include "resource/resource.h" #include "resource/system_resource.h" #include "kernel/util/stop.h" #include "kernel/util/task_init.h" #include "kernel/util/sleep.h" #include "kernel/events.h" #include "kernel/kernel_heap.h" #include "kernel/fault_handling.h" #i...
rtc_init()
; #if BOOTLOADER_TEST_STAGE2 #define BLTEST_LOG(x...) pbl_log(LOG_LEVEL_ALWAYS, __FILE__, __LINE__, x) BLTEST_LOG("BOOTLOADER TEST STAGE 2"); boot_bit_set(BOOT_BIT_FW_STABLE); BLTEST_LOG("STAGE 2 -- Checking test boot bits"); if (boot_bit_test(BOOT_BIT_BOOTLOADER_TEST_A) && !boot_bit_test(BOOT_BIT_BOOTLOADER_...
GAPLEClientKernel); PBL_ASSERTN(e == BTErrnoOK); } } bool ancs_can_handle_characteristic(BLECharacteristic characteristic) { if (!s_ancs_client) { return false; } for (int c = 0; c < NumANCSCharacteristic; ++c) { if (s_ancs_client->characteristics[c] == characterist...
if (s_ancs_client->state == ANCSClientStateRequestedNotification || s_ancs_client->state == ANCSClientStateReassemblingNotification) { prv_reassemble_ds_notification(length, data); }
} void ancs_handle_read_or_notification(BLECharacteristic characteristic, const uint8_t *value, size_t value_length, BLEGATTError error) { if (error != BLEGATTErrorSuccess) { PBL_LOG(LOG_LEVEL_ERROR, "Read or notification error: %d", error); prv_reset_due_to_bt_error();...
-48}, { 1320, -120, 72}, { 1408, 128, -112}, { 1504, 128, -48}, { 1512, 104, -16}, { 1224, 216, -112}, { 952, 184, -96}, { 1000, 224, -48}, { 1080, 240, -8}, { 1080, 272, -40}, { 944, 320, -72}, { 1184, 320, 32}, { 1184, 448, 192}, { 936, 568, 40}, { 1192, 456, -...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-05 16:15:30 local AccelRawData *activity_sample_walk_200_pbl_25667_15(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25667_15 //> TE...
+ header->duration * SECONDS_PER_MINUTE - 1); const time_t full_span = end_span - start_span; num_days = full_span / SECONDS_PER_DAY; } return MAX(num_days, 1); } static void prv_set_nodes(TimelineNode *nodes[], CommonTimelineItemHeader *header, int num...
((ListNode *)node)
; } } static int prv_first_event_comparator(TimelineNode *new_node, TimelineNode *old_node, TimelineIterDirection direction) { const time_t now = rtc_get_time(); const time_t midnight = time_util_get_midnight_of(now); const bool show_all_day = false; const bool show_new ...
/* * 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...
(id, type)
; s_presented_notifs = (NotifList *) list_sorted_add(&s_presented_notifs->list_node, &new_entry->list_node, comparator, ascending); } NotificationType notifications_presented_list_get_type(Uuid *id) { NotifList *node = prv_find_listnode_for_notif(id); if (!node) { return NotificationInvalid; } retu...
(stack), 1); // Ensure the load handler was called cl_assert_equal_i(prv_get_load_unload_count(), 1); // Ensure the appear handler was called cl_assert_equal_i(prv_get_appear_disappear_count(), 1); // Ensure the click config handler was called cl_assert_equal_i(window->is_waiting_for_click_config, false)...
window_stack_count(stack)
, 0); window_stack_push(stack, window, true); cl_assert_equal_i(window_stack_count(stack), 1); cl_assert_equal_i(window->on_screen, true); cl_assert_equal_i(prv_get_load_unload_count(), 1); window_stack_pop(stack, true); cl_assert_equal_i(window_stack_count(stack), 1); cl_assert_equal_i(prv_get_load_u...
744}, { 384, 464, -752}, { 392, 488, -752}, // 141 seconds { 384, 480, -752}, { 392, 472, -752}, { 400, 496, -744}, { 384, 480, -752}, { 368, 448, -752}, { 384, 496, -744}, { 400, 480, -744}, { 424, 488, -736}, { 400, 496, -744}, { 392, 496, -744}, { 384, 496, -74...
{ 400, 480, -752}, { 376, 336, -784}, { 376, 520, -760}, { 368, 480, -760}, { 384, 520, -808}, { 336, 480, -816}, { 400, 352, -736}, { 344, 344, -760}, { 304, 400, -1280}, { 336, 680, -784}, { 560, 168, -648}, { 504, 456, -584}, { 80, 688, -880}, // 147 seconds ...
SSAGE_PENDING(TupletBytes(PostMessageKeyChunk, (const uint8_t *) chunk, expected_size)); // Compare with hard-coded byte array, to catch accidental changes to the ABI: const uint8_t raw_bytes_v1[] = { 0x04, 0x00, 0x00, 0x00, ':', '1', '2', '3', }; cl_...
(TupletBytes(PostMessageKeyChunk, (const uint8_t *) chunk_msg_defs[i].byte_array, chunk_msg_defs[i].length))
; } JS_VAR event_valid = prv_js_global_get_value("event"); cl_assert_equal_b(true, jerry_value_is_object(event_valid)); // Make sure that there is a "data" property JS_VAR data_prop = jerry_get_object_field(event_valid, "data"); cl_assert_equal_b(true, jerry_value_is_object(data_prop)); /...
G_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_COMP_CLK, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_CURRENT, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_OUTPUT_MONITOR, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_ANA_TEST, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_IDLE, 0x0); REG_SETF(DCDC, DCDC_TEST_0_R...
(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, QSPIC_BURSTCMDB_REG, QSPIC_WRAP_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_INST_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_DMY_NUM, 0x0); REG_SETF(QSPI...
tring) + 1; \ cl_assert_equal_i(gap_le_get_advertising_data(&ad_data_out), data_length); \ cl_assert_equal_s((const char *) &ad_data_out, ad_data_cstring); \ } //! Helper to create BLEAdData from C strings. //! In reality, people will use ble_ad_create() and the ble_ad_set_* functions, //! but that's part of anoth...
(gap_le_is_advertising_enabled())
; assert_ad_data("yo"); gap_le_assert_advertising_interval(advert_terms[0].min_interval_slots, advert_terms[0].max_interval_slots); regular_timer_fire_seconds(1); // Second term: cl_assert(gap_le_is_advertising_enabled()); assert_ad_data("yo"); gap_le_assert_advertis...
/* * 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_analytics_lock)
; } static void prv_unlock(void) { mutex_unlock_recursive(s_analytics_lock); } // Analytic Node Functions static bool prv_compare_analytic(ListNode *found_node, void *data) { AnalyticsNode *node = (AnalyticsNode *)found_node; return (node->metric == (DialogAnalyticsMetric)data); } static AnalyticsNode *prv_fi...
r writes). Assertion and deassertion of SCS //! is up to the caller. Asserts in the code will help to ensure that the //! API is used correctly. // void spi_ll_slave_acquire(const SPISlavePort *slave) { PBL_ASSERTN(slave->slave_state->initialized); PBL_ASSERTN(slave->slave_state->acquired == false); prv_spi_en...
PBL_ASSERTN(slave->slave_state->acquired)
AX_LENGTH, &item->attr_list.attributes[attr_idx], AttributeIdiOSAppIdentifier); attr_idx++; } // add the icon attribute item->attr_list.attributes[attr_idx].id = AttributeIdIconTiny; item->attr_list.attributes[attr_idx].u...
{ positive_action = NULL; }
const ANCSAttribute *negative_action = notif_attributes[FetchedNotifAttributeIndexNegativeActionLabel]; if (negative_action && negative_action->length == 0) { negative_action = NULL; } // See if we support any additional actions (beyond what ANCS supports) for this type of notif if (app_id && app_...
/* * 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...
boot_bit_set(BOOT_BIT_FORCE_PRF)
; #endif prv_factory_reset_post(should_shutdown); } #if !RECOVERY_FW void close_db_files() { // Deinit the databases and any clients timeline_event_deinit(); reminder_db_deinit(); pin_db_deinit(); } void factory_reset_fast(void *unused) { s_in_factory_reset = true; // disable the watchdog... we've got...
ItemAction *action, const TimelineItem *pin, void *context) { ActionResultData *data = applib_zalloc(sizeof(ActionResultData)); if (!data) { return NULL; } data->action_menu = action_menu; data->chaining_d...
analytics_event_pin_action(pin->header.timestamp, &app_uuid, action->type)
/* * 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...
(&layer, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_x_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_nx_or...
health_service_private_weekend_filter, (void *)(uintptr_t)local_tm->tm_wday, &stats->weekend.sum); // We want to sum only the days that are this far from index 0 (which is local_tm.tm_wday) int day_offset = local_tm->tm_wday - weekly_day; if (day_offset < 0) { day_offset += ...
{ if (averages->average[i] == ACTIVITY_METRIC_AVERAGES_UNKNOWN) { averages->average[i] = default_value; } // If this entry is cached, fix up the cache entry if (state->cache && (metric == HealthMetricStepCount)) { if (state->cache->step_averages.average[i] == ACTIVITY_METRIC_AVERAGES_UNKNOWN...
return true; } // ---------------------------------------------------------------------------------------------- // Compute the sum of the chunks in the averages array that comprise the given time range from // time_start to time_end. The averages array represents all the chunks for a day, and time_start // to time...
tmap, TEST_NAMED_PBI_FILE("draw_dotted_line_cross_color"))); } static void draw_lines_same_point(GContext *ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_stroke_width(ctx, 1); graphics_draw_line(ctx, GPoint(10,10), GPoint(10,10)); graphics_context_set_antialiased(ctx, true); graph...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_clip_rect")))
; } void test_graphics_draw_line__clipping_rect_aa(void) { GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, true, 1); graphics_context_set_stroke_color(&ctx, GColorBlack); // Draw lines around boundaries of clipping box - AA true, SW 1 ...
t KernelLEClient * const client = &s_clients[c]; if (!uuid_equal(&service_uuid, (const Uuid *)client->service_uuid)) { continue; } // We have found a service that a client is looking for. Make sure the // characteristics we want are present and if so notify the interested client about ...
kernel_malloc(value_length)
; if (UNLIKELY(!buffer)) { PBL_LOG(LOG_LEVEL_ERROR, "OOM for GATT read response - %d bytes", (int)value_length); return; } gatt_client_consume_read_response(event->object_ref, buffer, value_length, GAPLEClientKernel); } if (client->handle_read_or_notifi...
i_cfg.SPI_NSS = SPI_NSS_Soft; spi_cfg.SPI_BaudRatePrescaler = spi_find_prescaler(spi_clock_hz, DISPLAY_SPI_CLOCK_PERIPH); spi_cfg.SPI_FirstBit = SPI_FirstBit_MSB; SPI_Init(DISP_SPI, &spi_cfg); SPI_Cmd(DISP_SPI, ENABLE); } void display_start(void) { // Enable the GPIOG clock; this is required before configur...
(DISP_SPI, d)
; while (!SPI_I2S_GetFlagStatus(DISP_SPI, SPI_I2S_FLAG_RXNE)) continue; return SPI_I2S_ReceiveData(DISP_SPI); }
}, { 480, -248, -792}, { 176, -352, -936}, { 208, -280, -1200}, { 264, -560, -1072}, { 0, -264, -992}, { 0, 200, -1120}, { -32, 264, -1000}, { -144, -88, -968}, { -80, -272, -864}, { -208, -320, -736}, { -192, -432, -776}, { -248, -448, -808}, { -248, -504, -872}, ...
{ 1264, 240, -48}, { 2032, 504, -136}, { 2296, 968, -952}, { 1872, 1464, -912}, { 1432, 424, -328}, { 1008, 1136, -632}, { 464, 968, -328}, // 275 seconds { 608, 1176, -280}, { 952, 1016, -240}, { 1016, 512, -248}, { 968, 312, -424}, { 1080, 272, -360}, { 1368, 29...
{ 1064, -384, 184}, { 840, 176, 192}, { 576, 304, -856}, { 928, 80, -584}, { 1216, 232, -104}, { 1056, 144, -184}, { 1096, 248, -304}, { 1288, 440, -288}, { 1496, 664, -240}, { 1528, 1288, -400}, { 1184, 1176, -248}, { 992, 624, -416}, { 864, 680, -320}, { 864, 1...
ossible dest_colors for (int16_t y = 0; y < bitmap_size.h; y++) { for (int16_t column_index = 0; column_index < num_dest_colors; column_index++) { const int16_t starting_x = column_index * hline_applying_test_column_width; for (int16_t x = starting_x; x < starting_x + hline_applying_test_column_width;...
test_graphics_context_mask_set_value_for_coordinate(ctx, mask, mask_pixel_value, GPoint(x, y))
; } } return mask; } typedef void (*VerticalClippingMaskApplyFunc)(GContext *ctx, int16_t x, int16_t y1, int16_t y2, GColor color); static void prv_mask_apply_vline_test_pattern(VerticalClippingMaskApplyFunc apply_func) { GContext *ctx = s_ctx; prv_prepare_c...
nt32_t avg_mv, uint32_t battery_mv) { // Basic low-pass filter - See PBL-23637 const uint8_t VOLTAGE_FILTER_BETA = 2; uint32_t avg = (avg_mv << VOLTAGE_FILTER_BETA); avg -= avg_mv; avg += battery_mv; return avg >> VOLTAGE_FILTER_BETA; } static bool prv_is_stable(const BatteryState *state) { // After a re...
(charging ? "CHARGING" : "DISCHARGING", s_last_battery_state.voltage)
; if (forced || likely_stable || s_last_battery_state.percent <= ALWAYS_UPDATE_THRESHOLD || charging || state_changed) { battery_state_put_change_event(prv_get_precise_charge_state(&s_last_battery_state)); } } static void prv_update_callback(void *data) { // Running the battery monitor on the timer ta...
88, -824, -336}, { -488, -832, -336}, { -488, -824, -344}, { -488, -824, -344}, { -480, -824, -336}, { -496, -832, -328}, { -488, -832, -336}, // 62 seconds { -488, -816, -352}, { -480, -832, -352}, { -480, -832, -344}, { -480, -824, -344}, { -488, -824, -336}, { -488...
{ -488, -832, -320}, { -488, -832, -312}, { -496, -832, -312}, // 67 seconds { -488, -832, -312}, { -488, -832, -320}, { -488, -832, -304}, { -488, -840, -320}, { -488, -832, -320}, { -488, -832, -312}, { -488, -840, -312}, { -488, -840, -312}, { -488, -832, -320}, ...
num { ANCSVersion_Unknown, ANCSVersion_iOS9OrNewer, } ANCSVersion; typedef struct { ListNode list_node; NotificationQueueOp op; uint32_t uid; ActionId action_id; // Only valid if op == NotificationQueueOpPerformAction ANCSProperty properties; } NotificationQueueNode; typedef struct ANCSClient { ANCSCl...
{ s_ancs_client->queue = (NotificationQueueNode *)list_prepend((ListNode *)s_ancs_client->queue, (ListNode *)node); prv_do_notif_queue_operation(); }
else { list_append((ListNode *)s_ancs_client->queue, (ListNode *)node); } } static void prv_notif_queue_push_action(uint32_t uid, ActionId action_id) { NotificationQueueNode *node = kernel_malloc_check(sizeof(NotificationQueueNode)); *node = (NotificationQueueNode) { .op = NotificationQue...
_tuple == NULL_TUPLE); break; case SOME_STRING_KEY: is_string_updated = true; cl_assert(new_tuple->type == TUPLE_CSTRING); cl_assert(new_tuple->length == strlen(NEW_STRING) + 1); cl_assert(strcmp(new_tuple->value->cstring, NEW_STRING) == 0); cl_assert(old_tuple->type == TUPLE_CST...
(should_update_existing_keys_only == false)
tor mbuf_iter; bool is_read; bool sent_escape; uint8_t escaped_byte; } SendInfo; //! Info on the current frame being read static ReadInfo s_read_info; //! The consumer of the next frame which is read static ReadConsumer s_read_consumer; //! MBuf for storing the header when receiving static MBuf s_header_mbuf; st...
if (s_read_info.length > 0) { // copy the previous byte from the footer_byte field into the payload if (!mbuf_iterator_write_byte(&s_read_consumer.mbuf_iter, s_read_info.footer_byte)) { // no room left to store this byte s_read_info.should_drop = true; } }
// Store this byte in the footer_byte. Note that we will still calculate the checksum on this byte // and verify that the checksum is 0 at the end, so if this byte is the actual footer byte (aka. // the checksum), we will still include it in the checksum. s_read_info.footer_byte = data; // increment the len...
x00, 0x80, 0x7b, 0x22, 0x78, 0x22, 0x3a, 0x31, 0x7d, 0x00, }; cl_assert_equal_i(sizeof(raw_bytes_v1), expected_size); cl_assert_equal_m(raw_bytes_v1, buffer, expected_size); task_free(buffer); } void test_rocky_api_app_message__postmessage_just_before_connected(void) { prv_init_api(false /* start_connected ...
prv_rcv_app_message_ack(APP_MSG_OK)
; json_bytes_remaining -= json_bytes_size; } // Chunk 3: { const size_t json_bytes_size = MIN(TINY_CHUNK_SIZE, json_bytes_remaining); const size_t expected_size = sizeof(PostMessageChunkPayload) + json_bytes_size; const int payload_offset = expected_json_size - json_bytes_remaining; PostMess...
tate == SmartstrapStateReadDisabled)) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); } else if ((prev_state == SmartstrapStateNotifyInProgress) && (new_state == SmartstrapStateReadComplete)) { PBL_ASSERTN(mcu_state_is_isr() || (pebble_task_get_current() == PebbleTask_NewTimers)); } else if ((p...
{ return; }
// if we're disconnecting, disconnect the services first if (s_is_connected) { mutex_lock(s_services_lock); while (s_num_connected_services) { const uint16_t service_id = s_connected_services[s_num_connected_services - 1]; prv_set_service_connected(service_id, false); } s_num_connected_...
< S_SUCCESS) { status = check.wakeup_count; } else if (check.wakeup_count >= MAX_WAKEUP_EVENTS_PER_APP) { status = E_OUT_OF_RESOURCES; } else { settings_file_set(&wakeup_settings, (uint8_t*)&wakeup_id, sizeof(WakeupId), (uint8_t*)&entry, sizeof(WakeupEntry))...
(LOG_LEVEL_ERROR, "Error: could not open wakeup settings")
; } } mutex_unlock(s_mutex); } static void prv_wakeup_rewrite_kernel_bg_cb(void *data) { // Update each wakeup entry via prv_update_events_callback and record any missed events struct prv_missed_events_s missed_events = { 0, NULL }; mutex_lock(s_mutex); { SettingsFile wakeup_settings; if (sett...
{ 1152, 304, -432}, { 1008, 160, -152}, { 944, 88, -208}, { 824, 88, -256}, { 704, 104, -208}, { 616, 88, -200}, { 704, 112, -176}, { 840, 48, -96}, // 64 seconds { 1064, -8, -176}, { 1424, 64, -216}, { 1568, 248, -384}, { 1616, 200, -232}, { 1568, 72, -16}, {...
{ 1288, 32, -152}, { 1736, 448, -320}, { 1760, 488, -656}, { 1768, 88, 216}, { 1480, 128, 56}, { 1248, 576, -336}, { 944, 448, -232}, { 800, 448, 24}, { 856, 736, -64}, { 792, 848, -48}, { 808, 896, -144}, { 880, 880, -216}, { 872, 856, -304}, { 752, 768, -304}, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
RTC_ReadBackupRegister(REBOOT_REASON_STUCK_TASK_LR)
; raw[4] = RTC_ReadBackupRegister(REBOOT_REASON_STUCK_TASK_CALLBACK); raw[5] = RTC_ReadBackupRegister(REBOOT_REASON_DROPPED_EVENT); } void reboot_reason_clear(void) { RTC_WriteBackupRegister(REBOOT_REASON_REGISTER_1, 0); RTC_WriteBackupRegister(REBOOT_REASON_REGISTER_2, 0); RTC_WriteBackupRegister(REBOOT_REA...
ounter = 0; system_task_add_callback(prv_update_hrm_enable_system_cb, NULL); } unlock: mutex_unlock_recursive(s_manager_state.lock); } void hrm_manager_handle_prefs_changed(void) { system_task_add_callback(prv_update_hrm_enable_system_cb, NULL); } void hrm_manager_init(void) { s_hrm_present = mfg_info_is_...
(HRMSessionRef, sys_hrm_manager_get_app_subscription, AppInstallId app_id)
{ mutex_lock_recursive(s_manager_state.lock); HRMSessionRef ref = HRM_INVALID_SESSION_REF; HRMSubscriberState *state = prv_get_subscriber_state_from_app_id(pebble_task_get_current(), app_id); if (state) { ref = state->session_ref; } mut...
nfo_valid = true, .is_remote_encryption_info_valid = true, .is_remote_identity_info_valid = true, .is_remote_signing_info_valid = true, .is_mitm_protection_enabled = true, }; // Helpers /////////////////////////////////////////////////////////// static void prv_fill_flash_random_data(void) { uint8_t *buf = k...
shared_prf_storage_get_getting_started_complete()
, false); } void test_shared_prf_storage_v3__ble_pairing(void) { shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_get_ble_pairing_data(NULL, NULL, NULL, NULL), false); shared_prf_storage_store_ble_pairing_data(&PAIRING_INFO, DEVICE_NAME, false /* re...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(sizeof(AnalyticsEventBlob) == 36, "When the blob format or size changes, be sure to bump up ANALYTICS_EVENT_BLOB_VERSION")
; // ------------------------------------------------------------------------------------------ // Log an app launch event static bool prv_send_uuid(AnalyticsEvent event_enum, const Uuid *uuid) { if (uuid_is_invalid(uuid) || uuid_is_system(uuid)) { // No need to log apps with invalid uuids. This is typically bui...
fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 3); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 3); graphics_draw_rect...
(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 2)
; graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 2); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_...
_assert_equal_i(s_events_received[1].type, PEBBLE_HRM_EVENT); cl_assert_equal_i(s_events_received[1].hrm.event_type, HRMEvent_BPM); cl_assert_equal_i(s_events_received[2].type, PEBBLE_HRM_EVENT); cl_assert_equal_i(s_events_received[2].hrm.event_type, HRMEvent_SubscriptionExpiring); // Subscription should be go...
sys_hrm_manager_app_subscribe(app_id, 1, expire_s, 0 /* No feature */)
; prv_fake_send_new_data(); fake_system_task_callbacks_invoke_pending(); // HRM should be enabled, subscriber should exist, no callbacks triggered. cl_assert_equal_b(hrm_is_enabled(HRM), true); cl_assert(prv_get_subscriber_state_from_ref(session_ref)); cl_assert_equal_i(s_event_count, 0); sys_hrm_mana...
/* * 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 true; // continue iterating }
f (alpha == ALPHA_100) { graphics_context_set_stroke_color(ctx, fg_color); graphics_draw_pixel(ctx, point); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y)); graphics_draw_pixel(ctx, GPoint(point.x, point.y + 1)); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1)); } else if (alpha =...
(ctx, GColorWhite)
; graphics_draw_rect(ctx, &box); } } static void up_handler(ClickRecognizerRef recognizer, void *context) { AppData *data = window_get_user_data(s_window); if (data->property == PROPERTY_FG_COLOR) { data->fg_color_index = (data->fg_color_index + 1) & 0x3F; data->fg_color.argb = (s_color_table[data->f...
OR, "AMS playback info value failed to parse: %s", value); prv_analytics_log_event_with_info(AMSAnalyticsEventErrorPlayerPlaybackInfoFloatParse, idx); return false /* should_continue */; } PBL_LOG(LOG_LEVEL_DEBUG, "Playback info value update %"PRId32"=%"PRId32, idx, value_out); MusicPlayerStateUpdate *s...
(update->value_str, value_length)
; PBL_LOG(LOG_LEVEL_DEBUG, "Queue repeat mode update: %d", repeat_mode); // TODO: Do something with this info } // ------------------------------------------------------------------------------------------------- // Track entity update handlers static void prv_handle_track_artist_update(const AMSEntityUpdateNotif...
/* * 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...
{ // we will iterate over each resource to detect any compatible JS byte code // if there's any, we can assume that there's also a resource with ID 1. const uint32_t entries = resource_storage_get_num_entries(app_num, 1); for (uint32_t entry_id = 1; entry_id <= entries; entry_id++) { // this buffer needs to...
RockyResourceValidation rocky_app_validate_resources(const PebbleProcessMd *md) { if (!md || !md->is_rocky_app) { // it's not a rocky app, so it cannot have incompatible byte code return RockyResourceValidation_NotRocky; } const ResAppNum app_num = (ResAppNum)process_metadata_get_res_bank_num(md); if ...
/* * 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...
DEG_TO_TRIGANGLE(45)
, bitmap_center); } static void prv_test_45_set(Layer *layer, GContext* ctx) { graphics_context_set_compositing_mode(ctx, GCompOpSet); graphics_draw_rotated_bitmap(ctx, (GBitmap*)&s_gfx_rotated_bitmap_bitmap, bitmap_center, DEG_TO_TRIGANGLE(45), bitmap_center); } static void prv_tes...
t == SmartstrapResultBusy) { // there was another request in progress so we'll try again later return false; } else if ((result == SmartstrapResultOk) && (smartstrap_fsm_state_get() != SmartstrapStateReadReady)) { prv_set_attribute_state(attr, SmartstrapAttributeStateRequestInProgress); i...
(sizeof(SmartstrapAttributeInternal))
; if (!new_attr) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to allocate attribute"); return false; } *new_attr = (SmartstrapAttributeInternal) { .service_id = service_id, .attribute_id = attribute_id, .mbuf = MBUF_EMPTY }; list_init(&new_attr->list_node); mbuf_set_data(&new_attr->mbuf, buffer, ...
/* * 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...
GPoint(15, 40)
); } void across_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(40, 50), GPoint(35, 70)); } void across_ny_layer_update_callback(La...
src_bitmap->addr; uint8_t *dest_data = (uint8_t *)bitmap->addr; for (int y = 0; y < bitmap->bounds.size.h; ++y) { for (int b = 0; b < bitmap->row_size_bytes; ++b) { int dest_idx = y * bitmap->row_size_bytes + b; int src_idx = y * src_bitmap->row_size_bytes + b; dest_dat...
(bitmap, data, data_size, mmapped)
) { // in order to make memory-mapped bitmaps work, we need to decrement the reference counter // when we destroy it. This case is different from a sub-bitmap that shares the bitmap // data. We use .is_bitmap_heap_allocated=true here so that bitmap_deinit() can take care // of it. // As the pixel da...
) { return (prv_has_visible_window(context, NULL) && prv_has_focusable_window(context)); } static void prv_send_will_focus_event(bool in_focus) { static bool s_focus_lost = true; if (s_focus_lost == in_focus) { return; } s_focus_lost = in_focus; PebbleEvent event = { .type = PEBBLE_APP_WILL_CHANG...
{ #if !RECOVERY_FW && !SHELL_SDK app_idle_timeout_resume(); #endif }
static void prv_handle_app_to_modal_transition_focus(void) { #if !RECOVERY_FW && (!SHELL_SDK || CAPABILITY_HAS_SDK_SHELL4) watchface_reset_click_manager(); #endif // Let the underlying window know it has lost focus if this is the first modal // window to show up. prv_send_will_focus_event(false /* in_focus *...
*prv_get_icon(LauncherAppGlanceStructured *structured_glance) { LauncherAppGlanceMusic *music_glance = launcher_app_glance_structured_get_data(structured_glance); return NULL_SAFE_FIELD_ACCESS(music_glance, icon, NULL); } static const char *prv_get_title(LauncherAppGlanceStructured *structured_glance) { La...
music_get_now_playing(title_buffer, artist_buffer, NULL /* album_buffer */)
/* * 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...
{ *D = *D + delta; }
else { *D = *D + delta - SECONDS_PER_DAY; } *sum = *sum + *D; } // API Functions //////////////////////////////////////////////////////////////////////////////////////////////////// HealthData *health_data_create(void) { return (HealthData *)app_zalloc_check(sizeof(HealthData)); } void health_data_destr...
e throughout, and the API is code space intensive const bool take_ownership = true; KinoReel *new_reel = kino_reel_scale_segmented_create(from_reel, take_ownership, icon_to); kino_reel_transform_set_from_frame(new_reel, icon_from); kino_reel_transform_set_transform_duration(new_reel, duration); kino_reel_scal...
layer_set_clips(&card_timeline_layout->icon_layer.layer, false)
; const bool take_ownership = true; KinoReel *new_reel = kino_reel_scale_segmented_create(from_reel, take_ownership, icon_from); kino_reel_transform_set_to_frame(new_reel, icon_to); kino_reel_transform_set_transform_duration(new_reel, duration / 2); kino_reel_scale_segmented_set_delay_by_distance( new_...
gateway, // to prevent that iAP gets reconnected in the future: static void prv_set_active_gateway_and_disconn_bt_classic(const BTDeviceInternal *gateway_device) { BTBondingID bonding_id = BT_BONDING_ID_INVALID; bt_lock(); // Find the Bonding ID for the LE connection that supports PPoGATT: GAPLEConnection *con...
{ // We are trying to track down an issue on iOS where PPoGATT doesn't get opened (PBL-40084) // This message should help us determine if iOS is publishing the service PBL_LOG(LOG_LEVEL_INFO, "Found an instance of %s at 0x%"PRIx16"-0x%"PRIx16"!", client->debug_name, range.start, ...
else { PBL_LOG(LOG_LEVEL_DEBUG, "Found an instance of %s at 0x%"PRIx16"-0x%"PRIx16"!", client->debug_name, range.start, range.end); } #endif client->handle_service_discovered(characteristics); } } } static void prv_handle_gatt_service_discovery_event(const PebbleBLEGATTClient...
fake_event_get_last(); if (expect_is_handled) { cl_assert_equal_i(e.type, PEBBLE_MEDIA_EVENT); cl_assert_equal_i(e.media.type, PebbleMediaEventTypeVolumeChanged); cl_assert_equal_i(music_get_volume_percent(), 0x33); } else { cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT); } } static void prv_rece...
prv_set_dummy_server_connected(true /* connected */)
; // Android app connects: prv_receive_app_info_event(true /* is_android */); // Receive Now Playing info. Should be ignored, because other server is connected: prv_receive_and_assert_all(false /* expect_is_handled*/); // Disconnect dummy server, to clean up after ourselves: prv_set_dummy_server_connected...
info); return true; } return false; } static void prv_skip_message(ReceiveRouter *rtr, const uint32_t payload_length) { rtr->bytes_to_ignore = payload_length; rtr->bytes_received = 0; } static bool prv_ignore_skipped_message_if_needed(const uint8_t **data_p, size_t *data_size_p, ...
{ continue; // while (data_size) }
} prv_write_payload_to_receiver(rtr, &data_size, &data); // If the message payload is completed, call the Receiver to process it: if (rtr->bytes_received == (sizeof(PebbleProtocolHeader) + rtr->msg_payload_length)) { rtr->receiver_imp->finish(rtr->receiver); // Wipe it, to avoid confusin...
} // 11 am, all events passed void test_timeline__extra_case_backwards(void) { prv_insert_extra_case_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast,...
(pin_db_delete((uint8_t *)&s_items[2].header.id, sizeof(Uuid)), 0)
; cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check second cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id)); // check third cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id)); ...
/* * 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...
("Disable", data)
; } else { AppMenuNode *node = app_menu_data_source_get_node_at_index(&data->data_source, row - NUM_CUSTOM_CELLS); text = node->name; } option_menu_system_draw_row(option_menu, ctx, cell_layer, text_frame, text, selected, context); } static v...
/* * 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...
timeline_layer_set_sidebar_width(&timeline_layer, timeline_layer_get_ideal_sidebar_width())
; layer_add_child(&window.layer, &timeline_layer.layer); timeline_layer_reset(&timeline_layer); if (config->day_separator) { // Simulate showing the day separator int new_idx; bool has_new; cl_assert(timeline_model_iter_next(&new_idx, &has_new)); if (has_new) { timeline_layer_set_next_i...
v_assign_bool(const RockyArgBinding *binding, const jerry_value_t argv[], RockyArgValueCheckError *value_error_out) { *((bool *)binding->ptr) = jerry_value_to_boolean(argv[0]); return true; } static void prv_convert_to_string_and_apply(const jerry_value_t val, ...
{ if (!prv_check_type_is_number(&argv[i], type_error_out)) { type_error_out->arg_offset = i; return false; } }
return true; } static bool prv_check_color_type(const jerry_value_t argv[], RockyArgTypeCheckError *type_error_out) { if (jerry_value_is_number(argv[0]) || jerry_value_is_string(argv[0])) { return true; } *type_error_out = (RockyArgTypeCheckError) { .expected_type_name...
_noop_sample_handler(void *context) { } static void prv_validate_sample_rates(int *arr, int num_samples) { for (int i = 0; i < num_samples; i++) { // force a compiler error if user has not added all possible sample rates to array switch ((AccelSamplingRate)arr[i]) { case ACCEL_SAMPLING_10HZ: cas...
(fake_buf)
); } void test_accel_manager__batched_samples(void) { AccelRawData fake_buf[30]; stub_pebble_tasks_set_current(PebbleTask_KernelMain); AccelManagerState *main_session = sys_accel_manager_data_subscribe( ACCEL_SAMPLING_10HZ, prv_noop_sample_handler, NULL, PebbleTask_KernelMain); sys_accel_manager_set_sa...
{ s_adv_state = AdvertState_Off; s_desired_host_adv_state = AdvertState_Off; s_desired_ad_data.needs_updating = false; s_desired_ad_data.ad_data.ad_data_length = 0; s_desired_ad_data.ad_data.scan_resp_data_length = 0; s_adv_mutex = mutex_create_recursive(); }
/* * 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...
timeline_peek_draw_background(ctx, &DISP_FRAME, 0)
; peek_animations_draw_compositor_background_speed_lines( ctx, GPoint(PEEK_ANIMATIONS_SPEED_LINES_OFFSET_X, 0)); } const unsigned int num_concurrent = 3; timeline_peek_draw_background(ctx, &box, num_concurrent); const unsigned int concurrent_height = timeline_peek_get_concurrent_height(num_concurre...
t_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(5, 15)); } void outside_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(5, -5)); } void outside_x_y_layer_update_callback(Layer* me, GContext* ctx) { ...
framebuffer_is_empty("outside_x_ny_offset_layer", ctx.parent_framebuffer, GColorWhite)
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_nx_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_nx_ny_offset_layer", ctx.parent_framebuffer, GColorWhite)); } void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__clear(void) { ...
e->glance_cache = NULL; } } //! Don't call this directly; it's used by prv_get_glance_for_node() below static void prv_glance_cache_put(LauncherAppGlanceService *service, const Uuid *uuid, LauncherAppGlance *glance) { if (!service || !uuid || !glance) { return; } // If nec...
{ glance->service = service; }
return glance; } static LauncherAppGlanceCacheEntry *prv_find_glance_entry_in_cache( LauncherAppGlanceService *service, Uuid *uuid) { return (LauncherAppGlanceCacheEntry *)list_find(service->glance_cache, prv_glance_cache_entry_find_cb, uuid); } static Launche...
graphics_context_set_compositing_mode(ctx, GCompOpAssignInverted)
; GBitmap sad_watch_bitmap; gbitmap_init_with_data(&sad_watch_bitmap, sad_watch); const GRect bitmap_dest_rect = GRect(56, 68, 32, 32); graphics_draw_bitmap_in_rect(ctx, &sad_watch_bitmap, &bitmap_dest_rect); GFont error_code_face = fonts_get_system_font(FONT_KEY_GOTHIC_14); const GRect text_dest_rect = ...
manager_known_apps.h" }; for (size_t i = 0; i < ARRAY_LENGTH(mappings); i++) { if (uuid_equal(uuid, &mappings[i].uuid)) { return (GColor){.argb = mappings[i].color_argb}; } } #endif return GColorClear; } static GColor prv_valid_color_from_uuid(GColor color, Uuid *uuid) { #if PLATFORM_TINTIN |...
((PebbleProcessMd *)md)
ateTransitionToText: { prv_set_mic_window_state(data, StateFinished); if (data->show_confirmation_dialog) { TranscriptionDialog *transcription_dialog = &data->transcription_dialog; transcription_dialog_init(transcription_dialog); transcription_dialog_update_text(transcription_dialog...
if (next_state == StateTransitionToText) { return next_state; }
break; case StateTransitionToText: if (next_state == StateFinished) { return next_state; } break; case StateFinished: if ((next_state == StateWaitForReady) || (next_state == StateStartWaitForReady)) { return StateStartWaitForReady; } break; case ...
ry_get_number_value(prv_js_global_get_value("c2"))); cl_assert_equal_i(100, jerry_get_int32_value(prv_js_global_get_value("s1"))); cl_assert_equal_i(100, jerry_get_int32_value(prv_js_global_get_value("s2"))); cl_assert_equal_i(150, jerry_get_int32_value(prv_js_global_get_value("c1"))); cl_assert_equal_i(150, j...
(value, 0, prv_cleanup_cb)
/* * 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, "Task %s stack has %d bytes free", pcTaskGetTaskName(task), ((int)uxTaskGetStackHighWaterMark(task) * sizeof(StackType_t)))
; } } } DialogTask task_get_dialogtask(void) { if (mcu_state_is_isr()) { return DialogTask_ISR; } return task_to_dialogtask(xTaskGetCurrentTaskHandle()); } void task_unregister_task(OS_TASK task) { DialogTask index = task_to_dialogtask(task); if (index >= DialogTask_Last) { return; } Dialo...
teLightSleep; // Run,Walk,Sleep sessions active, ensure that asking if they are ongoing, it returns true cl_assert_equal_b(true, activity_sessions_is_session_type_ongoing(ActivitySessionType_Run)); cl_assert_equal_b(true, activity_sessions_is_session_type_ongoing(ActivitySessionType_Walk)); cl_assert_equal_b(t...
prv_is_hr_elevated()
, true); prv_set_median_hr_for_minutes(70 /* BPM */, 1 /* minutes */); cl_assert_equal_b(prv_is_hr_elevated(), false); activity_get_metric(ActivityMetricHeartRateZone1Minutes, 1, &zone1_minutes); cl_assert_equal_i(zone1_minutes, 2); activity_get_metric(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ if ((handle_command) && (!handle_command(command, i, callback_context))) { break; } command = prv_next_command(command); }
return command; } void gdraw_command_list_iterate(GDrawCommandList *command_list, GDrawCommandListIteratorCb handle_command, void *callback_context) { gdraw_command_list_iterate_private(command_list, handle_command, callback_context); } GDrawComma...
C_APB1Periph_UART5 | RCC_APB1Periph_I2C1 | RCC_APB1Periph_I2C2 | RCC_APB1Periph_I2C3 | RCC_APB1Periph_I2C4 | RCC_APB1Periph_CAN1 | RCC_APB1Periph_CAN2 | RCC_APB1Periph_CEC | RCC_APB1Periph_PWR | RCC_APB1Periph_DAC | RCC_APB1Periph_UART7 | RCC_APB1Periph_UART8; const uint32_t apb2_periphs = RCC_APB2Per...
(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)
); #endif // This needs to be done after drawing the progress bars or else the progress fill // overlaps the outline and things look weird health_progress_bar_outline(ctx, &data->progress_bar, PROGRESS_OUTLINE_COLOR); } static void prv_render_icon(GContext *ctx, Layer *base_layer) { HealthActivitySummaryCardD...
{ return CARD_BACKGROUND_COLOR; }
bool health_activity_summary_show_select_indicator(Layer *layer) { return true; }
er[50]; } AppData; static const uint32_t COUNT_PKEY = 1; static uint16_t get_num_sections_callback(struct MenuLayer *menu_layer, AppData *data) { (void)data; (void)menu_layer; return 1; } static uint16_t get_num_rows_callback(struct MenuLayer *menu_layer, uint16_t section_index, AppData *data) { (void)data; ...
{ AppData *data = (AppData *)app_zalloc_check(sizeof(AppData)); app_state_set_user_data(data); push_window(data); const int exist_result = persist_exists(COUNT_PKEY); PBL_LOG(LOG_LEVEL_DEBUG, "- exist_result %d", exist_result); if (exist_result == false) { PBL_LOG(LOG_LEVEL_DEBUG, "- writing..."); ...
r implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <stdio.h> #include "applib/app.h" #include "applib/app_message/app_message.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/text_layer.h" #include "applib/ui/window.h" #includ...
dict_write_uint8(app_data->out_iter, AppMessageKey_HRMProtocolVersionMajor, hrm_info.protocol_version_major)
; dict_write_uint8(app_data->out_iter, AppMessageKey_HRMProtocolVersionMinor, hrm_info.protocol_version_minor); dict_write_uint8(app_data->out_iter, AppMessageKey_HRMSoftwareVersionMajor, hrm_info.sw_version_major); dict_write_uint8(app_data->out_iter, AppMessageKey...
// Restore flags & status hdr->common.flags = ~hdr->common.flags; hdr->common.status = ~hdr->common.status; if (mark_as_synced) { settings_file_mark_synced(&storage->file, key, key_len); } mutex_unlock(storage->mutex); return rv; } int timeline_item_storage_get_len(TimelineItemStorage *storage, ...
kernel_free(val)
; } } status_t timeline_item_storage_flush(TimelineItemStorage *storage) { mutex_lock(storage->mutex); status_t rv = settings_file_rewrite(&storage->file, prv_flush_rewrite_cb, NULL); mutex_unlock(storage->mutex); return rv; }
cl_assert_equal_m(new_value, val_out, val_len_out); free(val_out); return RecordResultNew; } // Should not get here! This means that neither the old nor the new value // could be retreived, and thus the atomicity is broken! Aaaaaaaaaaaaaah!! cl_assert(false); } fake_spi_flash_force_futu...
info->get_val(file, val, info->val_len)
; key[info->key_len] = '\0'; val[info->val_len] = '\0'; printf("Read key of %s %d and val of %s %d\n", key, info->key_len, val, info->val_len); int key_i = atoi((char*)key + 1); cl_assert(key_i >= 0 && key_i < 255); uint8_t *cur_val = (uint8_t*)context; *cur_val = key_i; int val_i = atoi((char*)val + ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (!prv_clip_x_values_to_data_row_info(&current_data_row_info, &min_x, &max_x)) { return; }
// Update the relevant mask row pixel values for (int x = min_x; x <= max_x; x++) { const GPoint p = GPoint(x, y); // Calculate the new mask pixel value const GColor8Component src_color_luminance = gcolor_get_luminance(color); const uint8_t current_mask_value = graphics_private_raw_mask_get_value...
ection_event(bool is_connected) { const char *event_type = is_connected ? ROCKY_EVENT_CONNECTED : ROCKY_EVENT_DISCONNECTED; if (rocky_global_has_event_handlers(event_type)) { JS_VAR event = rocky_global_create_event(event_type); rocky_global_call_event_handlers(event); } else { DBG("No handler registe...
(PostMessageKeyResetComplete, &payload, sizeof(payload))
; } static void prv_awaiting_reset_complete_remote_initiated_enter(void) { PBL_ASSERTN(s_state.state == PostMessageStateAwaitingResetRequest || s_state.state == PostMessageStateAwaitingResetCompleteLocalInitiated || s_state.state == PostMessageStateSessionOpen); s_state.state = PostMess...
/* * 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...
{ uuid_generate(&weather_prefs->locations[i]); }
indow *window) { SystemCertificationData *data = (SystemCertificationData *) window_get_user_data(window); prv_deinit_status_bar(&data->status_layer); bitmap_layer_deinit(&data->bmp_layer); text_layer_deinit(&data->title_text); text_layer_deinit(&data->info_text); i18n_free_all(data); } static void prv_pus...
settings_menu_reload_data(SettingsMenuItemSystem)
; } static uint16_t prv_num_rows_cb(SettingsCallbacks *context) { return SystemMenuItem_Count; } static Window *prv_init(void) { SettingsSystemData *data = app_malloc_check(sizeof(SettingsSystemData)); *data = (SettingsSystemData){}; data->callbacks = (SettingsCallbacks) { .deinit = prv_deinit_cb, .d...
(&list, AttributeIdTitle, "Delfina Pizza")
; if (has_subtitle) { attribute_list_add_cstring(&list, AttributeIdSubtitle, "Open Table Reservation"); } attribute_list_add_cstring(&list, AttributeIdLocationName, "145 Williams John\n" "Palo Alto"); static StringList headings = StringListLiteral("A...
/* * 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...
(&pin_window->layer, &window_layer->bounds)
; layer_add_child(window_layer, &pin_window->layer); TimelineItemLayer *item_layer = &pin_window->item_detail_layer; timeline_item_layer_set_click_config_onto_window(item_layer, window); layer_add_child(&pin_window->layer, &item_layer->layer); layer_init(&pin_window->action_button_layer, &window_layer->boun...
icon_pause; GBitmap icon_play; GBitmap icon_play_pause; GBitmap icon_volume_up; GBitmap icon_volume_down; GBitmap image_cassette; GBitmap image_pause; GBitmap image_volume_up; GBitmap image_volume_down; Layer cassette_container; BitmapLayer cassette_layer; GBitmap *cassette_current_icon; Event...
prv_artist_rect()
), prv_create_layer_bounceback_animation(&data->title_text_layer.layer, prv_title_rect()), prv_create_layer_bounceback_animation(&data->position_text_layer.layer, time_rect), prv_create_layer_bounceback_animation(&data->length_text_layer.layer, time_rect), NULL); } static void prv_update_track_...
_FILE("draw_vert_dotted_line_odd_offset_even_cols_no_clip"))); // Odd cols of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(1, 0), MAX_NUM_ROWS); graphics_draw_vertical_line_dotted(&ctx, GPoint(3, 0), MAX_NUM_ROWS + 4);...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(45, 75), 5)
; // T facing right - odd vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(71, 71), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(66, 76), 5); // T facing left - even vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(100, 70), 10); graphics_draw_horizontal_line_dotte...