prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
prv_send_response(ResponseNack, s_pb_state.token); } return; } uint32_t token = 0; for (int job_idx = 0; job_idx < num_put_jobs; job_idx++) { PutBytesJob *job = &put_jobs->job[(read_idx + job_idx) % put_jobs->num_allocated_pb_jobs]; // Process requests until we run into a different command c...
prv_cleanup()
cs_draw_vertical_line_dotted(&ctx, GPoint(15, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(17, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(19, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 0), MAX_...
GPoint(10, 90)
, 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(10, 96), 5); // T facing right - even vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(50, 90), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(46, 95), 5); // T facing right - odd vert, odd horiz graphics_draw_vertical_line_d...
/* * 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 (cmd == RCC_AHB1PeriphClockCmd) { return "AHB1"; } else if (cmd == RCC_AHB2PeriphClockCmd) { return "AHB2"; } else { return NULL; }
} #endif // F(S)MC is the only AHB3 peripheral #ifdef FMC_R_BASE #define AHB3_BASE FMC_R_BASE #else #define AHB3_BASE FSMC_R_BASE #endif _Static_assert(APB1PERIPH_BASE < APB2PERIPH_BASE, "Clock mapping assumptions don't hold"); _Static_assert(APB2PERIPH_BASE < AHB1PERIPH_BASE, "Clock mapping assumptions don't hold")...
------------------------------------------------------ // Runs on the timer task. Simply register a callback for the KernelBG task from here. static void prv_minute_cb(CronJob *job, void *data) { system_task_add_callback(prv_minute_system_task_cb, data); cron_job_schedule(job); } static CronJob s_activity_job = { ...
{ PBL_LOG(LOG_LEVEL_WARNING, "Error %"PRIi32" while logging raw sample data", (int32_t)result); }
// Generate a log message as well. This is temporary until we have better support to // send the DLS data to a server and retrieve it from there. The record itself // is about 112 bytes. Base64 encoded it becomes 112 * 4/3 = 150 bytes. That is too much // to fit in a single log line, so we spl...
dowStackItem *top_item = (WindowStackItem *)window_stack->list_head; WindowStackItem *next_item; do { // We manually remove each item to ensure that we do not call prv_remove_unloaded_windows // until we have cleaned up the list. This prevents us from running into the issue where // an unload handler p...
prv_set_new_window_on_screen(window_to)
; ClickManager *click_manager = window_manager_get_window_click_manager(window_to); if (window_manager_is_window_focused(window_to)) { // TODO: PBL-37477 Window Stack directly calls click config // Either this or app_click_config_setup_with_window should be calling // window_setup_click_config_provider...
/* * 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 (wday == normal_compare || (YEAR_IS_LEAP(year) && wday == leap_compare)) { return 53; } else { return 52; }
} static int prv_iso8601_adjust(const struct tm *t, int year) { const int week = prv_iso8601_base_week(t); if (week == 0) { return -1; } else if (week > prv_year_week_count(year, t, 4, 3)) { // 53 weeks if the current year started on a Thursday, // orrrrr Wednesday and this year is a leap year. ...
MALL); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r8_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Small circles setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL); graphics_draw_circ...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_clip_nxny.${BIT_DEPTH_NAME}.pbi"))
; // Small circles setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_SMALL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFF...
NULL); text_layer_set_text(text[TextMid], NULL); text_layer_set_text(text[TextFront], NULL); text_layer_set_text(text[TextPar], "-"); text_layer_set_text(text[TextHole], "-"); } else { // Return text to normal size. Display '...' while waiting for updated data. text_layer_set_text(text[TextMid...
text_layer_set_text_color(text_layer, GColorBlack)
; text_layer_set_background_color(text_layer, GColorClear); } static void window_load(Window *window) { AppData *data = &s_data; // Action bar icon bitmaps. data->up_bitmap = gbitmap_create_from_png_data(s_golf_api_up_icon_png_data, sizeof(s_golf_api_up_icon_pn...
{ -136, 464, -816}, { -112, 616, -696}, { -232, 736, -480}, { -32, 552, -608}, { -16, 568, -632}, { 0, 592, -528}, { 40, 656, -488}, { -8, 768, -472}, { -24, 920, -448}, { -48, 968, -448}, { -40, 1008, -528}, { -32, 992, -568}, { 32, 992, -576}, { 56, 960, -560}, ...
{ 256, 584, -728}, { 248, 576, -720}, { 248, 560, -712}, // 21 seconds { 256, 584, -728}, { 264, 584, -720}, { 256, 568, -720}, { 256, 568, -720}, { 256, 568, -728}, { 264, 576, -712}, { 264, 568, -720}, { 264, 568, -720}, { 264, 576, -712}, { 272, 568, -720}, ...
requires_address_pinning, flags); } static void prv_load_data_from_prf(void) { prv_load_local_data_from_prf(); prv_load_pinned_address_from_prf(); if (bt_driver_supports_bt_classic()) { prv_load_bt_classic_data_from_prf(); } prv_load_ble_pairing_from_prf(); } /////////////////////////...
(&a->identity.opaque, &b->identity.opaque)
&& memcmp(&a->irk, &b->irk, sizeof(SMIdentityResolvingKey)) == 0); } static bool prv_get_key_for_sm_pairing_info_itr(SettingsFile *file, SettingsRecordInfo *info, void *context) { // check entry is valid if (info->val_len == 0 || info->key_len != sizeof(BT...
!= end_time); } // Converts the sensor time from the BMI160 captured at the time the sample // was collected to the actual system time static uint64_t prv_get_sample_time_us(uint8_t sensor_time[3]) { uint64_t curr_time_us = prv_get_curr_system_time_ms() * 1000; uint32_t time_since_data_collection_us = prv_get_ti...
bmi160_read_reg(addr)
); } BMI160_DBG("Latched = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_LATCH)); BMI160_DBG("Err reg = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_ERR)); BMI160_DBG("INT_MAP[0] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_MAP_0)); BMI160_DBG("INT_MAP[1] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_MAP_1)); BMI160_DBG(...
(prv_num_system_task_events_queued(), 1); // Make sure we successfully consume the event fake_system_task_callbacks_invoke_pending(); // Make sure we got the expected data cl_assert_equal_i(s_num_cb_events_1, 1); cl_assert_equal_i(s_cb_events_1[0].event_type, HRMEvent_BPM); cl_assert_equal_i(s_cb_events_1...
(session_ref, update_interval_b_s, expire_b_s)
; cl_assert(prv_get_subscriber_state_from_ref(session_ref) == state); cl_assert(state->update_interval_s == update_interval_b_s); cl_assert(state->expire_utc == rtc_get_time() + expire_b_s); } #define NUM_TEST_EVENTS 2 void test_hrm_manager__circular_buffer_event_copy(void) { // Make sure there will be unalign...
// No sessions active, ensure that asking for run,walk,sleep returns false cl_assert_equal_b(false, activity_sessions_is_session_type_ongoing(ActivitySessionType_Run)); cl_assert_equal_b(false, activity_sessions_is_session_type_ongoing(ActivitySessionType_Walk)); cl_assert_equal_b(false, activity_sessions_is_s...
(ActivityMetricHeartRateZone1Minutes, 1, &zone1_minutes)
; cl_assert_equal_i(zone1_minutes, 1); activity_get_metric(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes); cl_assert_equal_i(zone2_minutes, 1); activity_get_metric(ActivityMetricHeartRateZone3Minutes, 1, &zone3_minutes); cl_assert_equal_i(zone3_minutes, 2); // Add some "regular" heart rates. // ...
/* * 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...
(CMD_SET_PARAMETER, (uint8_t *)&param, sizeof(param))
; } #ifdef DISPLAY_DEMO_LOOP static void prv_play_demo_loop(void) { while (1) { for (int i = 0; i <= UPDATE_PROGRESS_MAX; ++i) { display_firmware_update_progress(i, UPDATE_PROGRESS_MAX); delay_ms(80); } for (uint32_t i = 0; i <= 0xf; ++i) { display_error_code(i * 0x11111111); del...
(next_sibling code path): // // +-parent // | // '->child_b->child_c->child_a // layer_insert_above_sibling(&child_c, &child_b); cl_assert(parent.first_child == &child_b); cl_assert(child_b.next_sibling == &child_c); cl_assert(child_c.parent == &parent); cl_assert(child_c.next_sibling == &c...
layer_is_descendant(&child_b, &child_a)
); cl_assert(!layer_is_descendant(&child_c, &child_a)); layer_add_child(&child_a, &child_c); cl_assert(layer_is_descendant(&child_c, &child_a)); cl_assert(layer_is_descendant(&child_c, &parent)); cl_assert(!layer_is_descendant(&child_c, &child_b)); } void test_layer__find_layer_contains_point(void) { Laye...
void test_app_inbox__app_inbox_create_and_register_drop_handler_not_permitted(void) { // The syscall_failed() fake will trigger passert: cl_assert_passert(app_inbox_create_and_register(BUFFER_SIZE, 1, test_message_handler, ...
app_inbox_service_is_being_written_for_tag(AppInboxServiceTagUnitTest)
TimelineItemTypePin, LayoutIdHealth, &list, NULL); pin_db_insert_item_without_event(item); timeline_item_destroy(item); attribute_list_destroy_list(&list); } static void prv_launch_timeline(void) { app_manager_put_launch_app...
{ return ARRAY_LENGTH(timeline_demo_strings); }
static void prv_menu_draw_row(OptionMenu *option_menu, GContext *ctx, const Layer *cell_layer, const GRect *text_frame, uint32_t row, bool selected, void *context) { option_menu_system_draw_row(option_menu, ctx, cell_layer, text_frame, timeline_demo_string...
TIMEOUT_SEC) { state->recv_state = QemuRecvState_WaitingHdrSignatureMSB; PBL_LOG(LOG_LEVEL_WARNING, "Resetting receive state - max packet time expired"); } state->callback_pending = false; uint16_t bytes_avail = shared_circular_buffer_get_read_space_remaining(&state->isr_buffer, &state->...
{ PBL_LOG(LOG_LEVEL_WARNING, "Invalid footer signature"); }
state->recv_state = QemuRecvState_WaitingHdrSignatureMSB; } } break; } // switch() } // while (!exit && bytes_avail) // Return pointer if we got a complete message if (got_msg) { *msg_bytes= state->msg_buffer_bytes; *protocol = state->hdr.protocol; return state->msg...
ddress, followed by a repeat start for reads NoRegisterAddress // Do not send a register address } TransferType; static uint32_t s_max_transfer_duration_ticks; static void prv_analytics_track_i2c_error(void); /*----------------SEMAPHORE/LOCKING FUNCTIONS--------------------------*/ static bool prv_semapho...
I2C_DEBUG("Waiting %"PRIu32"ms before enabling I2C bus %s rail.", (uint32_t)(MIN_STOP_TIME_MS - time_stopped_ms), bus->name)
sizeof(s_test_impl_data), dummy, &sub_data); cl_assert(r != NULL); cl_assert_equal_p(r->impl, &s_test_impl); cl_assert_equal_m(r->impl_data, &s_test_impl_data, sizeof(s_test_impl_data)); cl_assert_equal_p(r->subscriber.event, dummy); cl_assert_...
cl_assert_passert(recognizer_transition_state(r, RecognizerState_Started))
; recognizer_transition_state(r, RecognizerState_Updated); cl_assert_equal_i(r->state, RecognizerState_Updated); cl_assert_equal_i(event_type, RecognizerEvent_Updated); cl_assert(!s_manager_state_change); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Failed)); cl_assert_passert(recognize...
r->state = I2CTransferState_WriteAddressRx; break; case I2CTransferState_WriteAddressRx: // Write the I2C bus address again, but this time in read mode. i2c->DR = transfer->device_address | I2C_READ_WRITE_BIT; if (transfer->size == 1) { // Last byte, we want to NACK this one to tell...
{ portEND_SWITCHING_ISR(prv_error_irq_handler(bus)); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_s(expected, (char *)s_result)
; } void test_ihex__eof_record(void) { ihex_encode(s_result, IHEX_TYPE_EOF, 0, NULL, 0); prv_assert_ihex(":00000001FF"); } void test_ihex__data_record(void) { uint8_t data[7] = { 1, 2, 3, 4, 5, 6, 7 }; ihex_encode(s_result, IHEX_TYPE_DATA, 0xABCD, data, sizeof(data)); prv_assert_ihex(":07ABCD000102030405060...
(LOG_LEVEL_ALWAYS, __FILE_NAME__, 0)
; pulse_logging_log_sync_append(ctx, msg); pulse_logging_log_sync_append(ctx, buffer); pulse_logging_log_sync_send(ctx); #else int max_length = 256; while (*msg && max_length--) { dbgserial_putchar(*msg); ++msg; } dbgserial_putstr(buffer); #endif } static NORETURN prv_reset(void) { dbgserial_fl...
i(glyph->header.width_px, 5); cl_assert_equal_i(glyph->header.height_px, 12); uint8_t glyph_size_bytes = glyph_get_size_bytes(glyph); cl_assert_equal_m(wildcard_bytes, glyph->data, glyph_size_bytes); } void test_text_resources__test_gothic_wildcard(void) { uint8_t wildcard_bytes[] = {0xff, 0x60, 0x30, 0x18, 0x...
cl_assert(text_resources_init_font(0, gothic_18_handle, 0, &s_font_info))
; uint8_t glyph_size_bytes; const GlyphData *glyph; const Codepoint PHONE_CODEPOINT = 0x260E; glyph = text_resources_get_glyph(&s_font_cache, PHONE_CODEPOINT, &s_font_info); cl_assert(glyph != NULL); glyph_size_bytes = glyph_get_size_bytes(glyph); cl_assert_equal_m(phone_bytes, glyph->data, glyph_size_b...
are * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "util/iterator.h" #include "applib/graphics/utf8.h" ...
(layout.max_used_size.w, 4 * HORIZ_ADVANCE_PX)
; cl_assert_equal_i(layout.max_used_size.h, 3 * FONT_HEIGHT); // 3 lines - one line extra being layed out so that it will clip ("Jr\nWho-\npper") graphics_text_layout_get_max_used_size(&gcontext, "JR Whopper 123", font, box, GTextOverflowModeWordWrap, GTextAlignmentLeft, (void*)&layout); cl_assert_equal_i(layo...
for (unsigned int i = 0; i < ARRAY_LENGTH(s_items); ++i) { cl_assert_equal_i(pin_db_insert_item(&s_items[i]), 0); }
cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0); } void test_timeline_model__cleanup(void) { } // Tests /////////////////////////// static int s_correct_order[] = {0, 4, 5, 2, 1, 3}; void test_timeline_model__future(void) { TimelineModel model = {0}; model.direction = TimelineIterDirectionFuture; ti...
uid) { const GetNotificationAttributesMsg cmd_header = { .command_id = CommandIDGetNotificationAttributes, .notification_uid = uid, }; static const size_t request_max_size = 32; Buffer *request_buffer = buffer_create(request_max_size); const size_t written_size = buffer_add(request_buffer, ...
PBL_LOG(LOG_LEVEL_INFO, "Hurray! ANCS subscribed: %u", characteristic_id)
; if (characteristic_id == ANCSCharacteristicData) { prv_ancs_is_alive_start_tracking(); prv_start_temp_notification_connection_delay_timer(); } } else { PBL_LOG(LOG_LEVEL_ERROR, "Failed to subscribe charx: %u (error=%u)", characteristic_id, error); } } void ancs_invalidate_all_references(...
/* * 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...
(link_close_response, sizeof(uint8_t))
; } static void prv_bad_packet_response(uint8_t type, uint8_t bad_id, void *body, size_t body_length) { typedef struct PACKED Response { uint8_t type; uint8_t bad_identifier; char body[8]; } Response; Response *response = pulse_best_effort_send_begin(PULSE_PROTOCO...
ess or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "text_clipping.h" #include "applib/app.h" #include "applib/fonts/fonts.h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "process_management/app_manager.h" #include ...
if (data->word_wrap) { text_layer_set_text(&data->word_wrap_layer, "Overflow: Word Wrap"); text_layer_set_overflow_mode(&data->text_layer, GTextOverflowModeWordWrap); } else { text_layer_set_text(&data->word_wrap_layer, "Overflow: Ellipsis"); text_layer_set_overflow_mode(&data->text_layer, GTextOverfl...
} static void config_provider(Window *window) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, (ClickHandler)click_handler); window_single_repeating_click_subscribe(BUTTON_ID_SELECT, 100, (ClickHandler)click_handler); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, (ClickHandler)click_h...
clude "stubs_system_reset.h" #include "stubs_task_watchdog.h" #include "stubs_app_state.h" #include "stubs_worker_state.h" // Overrides ////////////////////////////////////////////////////////// void sys_get_time_ms(time_t *t, uint16_t *out_ms) {} time_t sys_time_utc_to_local(time_t t) { return t; } int localized_...
(str, fp_msg)
; pbl_snprintf(str, STR_SIZE, "abc %jd%s", 42, "b"); cl_assert_equal_s(str, "abc 42b"); //---------------------------------------------------- pbl_snprintf(str, STR_SIZE, "abc %A%s", "a", 1.0, "b"); cl_assert_equal_s(str, fp_msg); pbl_snprintf(str, STR_SIZE, "abc %zd%s", 42, "b"); cl_assert_equal_s(str, ...
n(b, duration_b); Animation *c = prv_create_test_animation(); animation_set_duration(c, duration_c); // Create a spawn out of b and c Animation *spawn = animation_spawn_create(b, c, NULL); cl_assert(spawn != NULL); // Create a sequence by putting a in front // We now have a -> (b | c) Animation *seq ...
(prv_count_handler_entries(&s_stopped_handler_calls, c), 2)
; cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, c), 1); #endif } // -------------------------------------------------------------------------------------- // Test using clone and reverse in a complex animation voi...
ms, TouchPressure diff_pressure, bool test_diff) { cl_assert(touch_event); cl_assert_equal_i(touch_event->type, type); cl_assert_equal_i(touch_event->index, idx); cl_assert_equal_i(touch_event->start_time_ms, start_time_ms); cl_assert(gpoint_equal(&touch_event->start_pos, start_pos)); cl_assert_equal_i(touc...
fake_event_reset_count()
; touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420); cl_assert_equal_i(fake_event_get_count(), 0); // no event if previous one not handled touch_event = touch_event_queue_get_event(0, 1); prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, ...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1)
; graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_right.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_...
addr = dest_data, .row_size_bytes = 100, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = { { 0, 0 }, { 100, 100 } } }; memset(dest_data, GColorBlue.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpAssign, GColorWh...
(&dest_bitmap, "test_bitblt__1bit_to_8bit_comptint_white_cross_black_corners-expect.8bit.pbi")
/* * 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 (connection) { // Associate the connection with the bonding: connection->bonding_id = bonding_id; connection->is_gateway = bonding->is_gateway; if (!connection->is_gateway) { PBL_LOG(LOG_LEVEL_DEBUG, "New bonding is not gateway?"); } // Request device name. iOS returns a...
} bt_unlock(); }
heck that the event is about an item that is about to start rtc_set_time(s_future_item.header.timestamp - TIMELINE_PEEK_DEFAULT_SHOW_BEFORE_TIME_S / 2); ADD_EVENT( .item = &s_future_item ); CHECK_EVENT( .count = 2, .item_id = s_future_item.header.id, .num_concurrent = 0, .timeout_ms = (TIMELINE_PEE...
(SECONDS_PER_HOUR)
; TimelineItem item = DEFINE_EVENT( .id = 0x01, .timestamp = SECONDS_PER_HOUR + 20 * SECONDS_PER_MINUTE, .duration = 70 ); TimelineItem UNUSED item2 = DEFINE_EVENT( .id = 0x02, .timestamp = 0, .duration = MINUTES_PER_DAY, .all_day = true ); TimelineItem UNUSED item3 = DEFIN...
5 * SECONDS_PER_MINUTE, 0, ActivitySleepStateLightSleep); prv_feed_cannned_accel_data(15 * SECONDS_PER_MINUTE, 20, ActivitySleepStateAwake); } activity_get_metric(ActivityMetricSleepEnterAtSeconds, 1, &value); cl_assert_equal_i(value, 23 * SECONDS_PER_HOUR /* 11pm */); activity_get_metric(ActivityMetricS...
( HealthMetricStepCount, time_start_of_today() - (12 * SECONDS_PER_HOUR), rtc_get_time())
; cl_assert_equal_i(steps, 2500); // If we ask for the sum from latter half of yesterday till half of today, we should get 1500 time_t elapsed_today = rtc_get_time() - time_start_of_today(); steps = health_service_sum( HealthMetricStepCount, time_start_of_today() - (12 * SECONDS_PER_HOUR), time_start_o...
{ static const PropertyAnimationImplementation s_implementation = { .base.update = (AnimationUpdateImplementation) property_animation_update_int16, .accessors.setter.int16 = prv_sidebar_setter, .accessors.getter.int16 = prv_sidebar_getter, }; Animation *animation = (Animation *)property_animation_crea...
PBL_IF_ROUND_ELSE(style->sidebar_arrow_size.w, 0)
; // layouts layer->scroll_direction = scroll_direction; layer->move_delta = prv_get_scroll_delta(layer); if (scroll_direction == TimelineScrollDirectionUp) { s_height_offsets[0] = (PAST_TOP_MARGIN_EXTRA + style->thin_pin_height + (2 * style->fat_pin_height)); s_height_offsets...
4, -200}, { -440, 888, -240}, { -456, 856, -168}, { -440, 928, -248}, { -432, 832, -232}, { -456, 720, -232}, { -504, 704, -240}, { -512, 712, -280}, { -520, 624, -192}, { -512, 680, -168}, { -552, 808, -184}, { -520, 792, -168}, { -472, 752, -136}, { -552, 824, -104}...
{ 1184, 56, -288}, { 936, -136, -216}, { 656, -216, -208}, { 896, -40, -216}, { 1008, 0, -200}, { 1112, 256, -328}, { 1312, 176, -344}, // 13 seconds { 1304, 256, -304}, { 1288, 328, -232}, { 1224, 512, -232}, { 1216, 544, -232}, { 1320, 768, -296}, { 1216, 808, -...
{ -272, -448, -1360}, { -304, -248, -1168}, { -288, -96, -1160}, { -40, -240, -928}, { -24, -216, -728}, { -48, -360, -528}, { -16, -232, -448}, { 80, -40, -432}, { 272, -144, -376}, { 608, -56, -408}, { 976, -16, -336}, { 1392, 416, -552}, { 1552, 384, -760}, { ...
_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_right_clipped.${BIT_DEPTH_NAME}.pbi")); } // outside with no clipping -- results should be identical to the regular filled test void test_graphics_gpath_${BIT_DEPTH_NAME}__filled_outside(void) { GContext ctx; Layer l...
prv_filled_update_proc(NULL, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_left_clipped_aa.${BIT_DEPTH_NAME}.pbi")); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); graphics_context_set_antialias...
rvices/common/comm_session/session.h" #include "system/passert.h" #include "syscall/syscall.h" #include "util/attributes.h" #include "util/math.h" #include "util/string.h" #define DEBUG_ROCKY_APPMESSAGE 1 #if DEBUG_ROCKY_APPMESSAGE #define DBG(fmt, ...) PBL_LOG(LOG_LEVEL_DEBUG, fmt, ## __VA_ARGS__) #else #define DBG(f...
{ // Handle the race. See comment in prv_init_apis(). return; }
DBG("Transport Connected"); prv_awaiting_reset_request__enter(); } T_STATIC void prv_handle_disconnection(void) { if (s_state.state == PostMessageStateDisconnected) { // Handle the race. See comment in prv_init_apis(). return; } DBG("Transport Disconnected"); const bool did_exit_session_open = (s_...
e_data.num_sessions_created < TEST_ACTIVITY_MAX_SESSIONS); cl_assert(s_test_alg_state.minute_data.sleep_current_container_idx < 0); s_test_alg_state.minute_data.sleep_current_container_idx = s_test_alg_state.minute_data.num_sessions_created; s_test_alg_state.minute_data.sessi...
for (uint32_t i = 0; i < s_test_alg_state.minute_data.num_sessions_created; i++) { ActivitySession *session = &s_test_alg_state.minute_data.sessions[i]; int start_minute = time_util_get_minute_of_day(session->start_utc); ACTIVITY_LOG_DEBUG("Found session %d: start_min: %d, len_min: %"PRIu16" ", session->typ...
return true; } void activity_algorithm_post_process_sleep_sessions(uint16_t num_input_sessions, ActivitySession *sessions) { } void activity_algorithm_minute_handler(time_t utc_sec, AlgMinuteRecord *record_out) { s_test_alg_state.last_sleep_utc = utc_sec; re...
cl_assert_equal_i(s_num_timeline_removes, 5); 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_current_minute = 30; s_current_day = s_sunday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fi...
alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_JUST_ONCE })
; // It's currently Thursday @ 00:00 bool just_once_schedule_thursday[7] = {false, false, false, false, true, false, false}; prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday); // Only 1 pin should be added cl_assert_equal_i(s_num_timeline_adds, 1); } void test_alar...
EFERENCES; #define PREF_KEY_ACTIVITY_ACTIVATED_TIMESTAMP "activityActivated" static time_t s_activity_activation_timestamp = 0; #define PREF_KEY_ACTIVITY_ACTIVATION_DELAY_INSIGHT "activityActivationDelayInsights" static uint32_t s_activity_activation_delay_insight = 0; #define PREF_KEY_ACTIVITY_HEALTH_APP_OPENED "ac...
(BOARD_CONFIG.backlight_on_percent)
ypted; local_is_master = connection->local_is_master; connected_device = &connection->device; } intent = prv_get_intent_by_bonding_id(request->bonding.id); } else { is_already_connected = gap_le_connection_is_connected(request->device); intent = prv_get_intent_by_device(request->device); ...
{ PBL_LOG(LOG_LEVEL_ERROR, "Ble disconnect failed: %d", result); }
} else { if (prv_is_intent_using_whitelist(intent)) { // Remove from white-list: prv_mutate_whitelist_safely(device, false /* remove */); } } } if (should_send_disconnection_event) { // Send virtual disconnection event: const PebbleTaskBitset task_mask = ~gap_le_pebble_...
d_buffer, uint8_t word_buffer_size, time_t timestamp, time_t end_time) { time_t now = rtc_get_time(); // average without overflows since time_t might be signed and now ~1.4 billion, so 2*now > INT_MAX time_t midtime = timestamp / 2 + end_time / 2; if (midtime > now) { // future time_t difference = timestamp...
prv_update_time_info_and_generate_event(&t, NULL)
; char buffer[80]; char time_buffer[26]; prompt_send_response_fmt(buffer, 80, "Time is now <%s>", rtc_get_time_string(time_buffer)); } void clock_get_timezone_region(char* region_name, const size_t buffer_size) { if (!region_name) { return; } if (clock_is_timezone_set()) { int region_id = clock_g...
MEOUT_ATTEMPTS_MAX; while((i2c_buses[bus_idx].i2c->SR2 & I2C_SR2_BUSY) != 0) { --attempts; if (!attempts) { return false; } } return true; } //! Abort the transfer //! Should only be called when the bus is locked static void abort_transfer(I2cBus *bus) { // Disable all interrupts on the bus ...
bus_unlock(bus)
; return result; } bool i2c_read_register(I2cDevice device_id, uint8_t i2c_device_address, uint8_t register_address, uint8_t *result) { return i2c_read_register_block(device_id, i2c_device_address, register_address, 1, result); } bool i2c_read_register_block(I2cDevice device_id, uint8_t i2c_device_address, uint8...
, -24}, { -192, 472, -272}, { -32, -128, -728}, { 24, -312, -1104}, { -32, -128, -1104}, { -48, -264, -1056}, { -40, -424, -1032}, { 16, -304, -1000}, { -32, -304, -960}, { -96, -280, -912}, { -128, -344, -888}, // 377 seconds { -112, -224, -944}, { -80, -272, -976}, ...
{ 32, -192, -1032}, { 16, -240, -992}, { 16, -264, -984}, { -16, -232, -1008}, { -8, -248, -1008}, { -16, -144, -1024}, { -32, -248, -1024}, { -24, -192, -1032}, { -32, -200, -1024}, { -32, -248, -1016}, { -48, -216, -992}, { -48, -224, -976}, { -72, -256, -920}, ...
{ 104, -344, -976}, { 104, -360, -976}, // 385 seconds { 96, -344, -976}, { 96, -352, -976}, { 96, -352, -976}, { 96, -352, -976}, { 88, -352, -976}, { 96, -368, -968}, { 120, -408, -968}, { 144, -552, -992}, { 64, -536, -928}, { 424, -96, -896}, { 392, 224, -912...
xt and zones is less on round rect.origin.y -= 10; } rect.origin.x -= 24; #endif prv_render_metric_label(ctx, &rect, metric_type, active_window, layer); // update rect y for the label height if (active_window->layout == WorkoutLayout_TwoStaticAndScrollable) { rect.origin.y += prefer_larger_font ? 11...
workout_dialog_init(workout_dialog, "Workout End")
else { // don't show the day separator return; } layer_set_frame((Layer *)&layer->day_separator, &day_sep_frame); layer_set_hidden((Layer *)&layer->day_separator, false); } static void prv_place_end_of_timeline(TimelineLayer *timeline_layer) { const bool was_hidden = layer_get_hidden((Layer *)&timeli...
graphics_context_set_fill_color(ctx, GColorWhite)
; graphics_fill_rect(ctx, &(GRect) { .size = bounds->size }); AnimationProgress progress; if (timeline_layer->animating_intro_or_exit && animation_get_progress(timeline_layer->animation, &progress)) { const GPoint offset = { PEEK_ANIMATIONS_SPEED_LINES_OFFSET_X, interpolate_...
/* * 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...
(state->handler != NULL)
; TimeUnits units_changed = 0; struct tm currtime; sys_localtime_r(&e->clock_tick.tick_time, &currtime); if (!state->first_tick) { if (state->last_time.tm_sec != currtime.tm_sec) { units_changed |= SECOND_UNIT; } if (state->last_time.tm_min != currtime.tm_min) { units_changed |= MINUTE...
= true; active = do_not_disturb_is_active(); cl_assert(active == true); s_event_ongoing = false; active = do_not_disturb_is_active(); cl_assert(active == false); s_event_ongoing = true; active = do_not_disturb_is_active(); cl_assert(active == true); // Testing the override capability do_not_distu...
stub_new_timer_timeout(get_dnd_timer_id())
, 25200 * MS_PER_SECOND); do_not_disturb_set_schedule_enabled(WeekendSchedule, true); do_not_disturb_set_schedule_enabled(WeekdaySchedule, false); rtc_set_time(s_thursday_01_00); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will go off at...
{ 1344, 416, -392}, { 1304, 544, -496}, { 1072, 576, -552}, { 960, 656, -608}, { 1120, 688, -544}, { 976, 552, -416}, { 1168, 520, -368}, { 1232, 360, -336}, { 1144, 264, -296}, { 848, 160, -280}, { 808, 128, -216}, { 992, 88, -256}, { 1184, 120, -232}, { 1136, 56, -...
{ 928, 152, -400}, { 1096, 160, -400}, { 944, 128, -288}, { 808, 112, -232}, { 864, 248, -288}, { 1064, 376, -376}, { 1200, 552, -440}, { 976, 680, -400}, // 74 seconds { 904, 568, -456}, { 840, 584, -368}, { 1432, 672, -512}, { 1240, 488, -248}, { 1256, 496, -320...
{ 1168, 80, -192}, { 1144, 96, -208}, { 1128, 80, -200}, { 880, 40, -256}, { 1008, 128, -216}, { 552, 0, -400}, { 928, 176, -472}, { 976, 112, -376}, { 800, 80, -352}, { 744, 176, -280}, { 904, 272, -304}, { 1184, 440, -368}, { 1280, 544, -392}, { 1072, 664, -368...
{ 1376, 64, -136}, { 1200, 216, -96}, { 1112, 296, -104}, { 1176, 256, -8}, { 1336, 344, 48}, { 1216, 416, -8}, { 1224, 440, -80}, { 1536, 528, 8}, { 1056, 856, 160}, { 1200, 816, 0}, { 856, 640, -88}, { 872, 560, -136}, { 1096, 584, -88}, { 1472, 648, -112}, ...
{ 1176, 104, -304}, { 1112, 152, -152}, { 976, 184, -128}, { 952, 248, -168}, { 976, 304, -160}, // 56 seconds { 1048, 288, -64}, { 1120, 312, -24}, { 1032, 336, -40}, { 1328, 440, -80}, { 1224, 504, 24}, { 1104, 608, -16}, { 1224, 688, -32}, { 808, 536, -160}, ...
{ 816, 536, -288}, { 1240, 616, -400}, { 1072, 504, -328}, { 1088, 376, -360}, { 1184, 384, -344}, { 1176, 400, -152}, { 1336, 536, -152}, { 1456, 544, 96}, { 1512, 776, 200}, { 1400, 648, 160}, { 1280, 632, 56}, { 1048, 528, 56}, { 912, 392, -152}, // 59 seconds...
cGlanceIconBitmapProcessor structured_glance_icon_bitmap_processor = { .bitmap_processor = { .pre = prv_strucutred_glance_icon_bitmap_processor_pre_func, .post = prv_structured_glance_icon_bitmap_processor_post_func, }, .desired_tint_color = desired_tint_color, }; GColor8 luminance_tint_loo...
{ strncpy(buffer, title, buffer_size); buffer[buffer_size - 1] = '\0'; }
} static GTextNode *prv_structured_glance_create_title_text_node( LauncherAppGlanceStructured *structured_glance) { return prv_structured_glance_create_text_node( structured_glance, structured_glance->title_font, APP_NAME_SIZE_BYTES, prv_structured_glance_title_dynamic_text_node_update); } typedef ...
clear_handler_histories(); // Create a property animation and advance it Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); animation_set_delay(a, delay_a); uint64_t start_ms = prv_now_ms(); animation_schedule(a); // -----------------------------------------------------...
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1)
; cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); // ------------------------------------------------------------------------------------- // Build up a sequence out of a + b Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_delay(b,...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(Fixed_S16_3_size == sizeof(int16_t))
ert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_tim...
(&s_items[s_correct_order[0]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)
SizeTiny, &icon_res_info); loaded_node->icon = gdraw_command_image_create_with_resource_system(icon_res_info.res_app_num, icon_res_info.res_id); loaded_node->icon_is_default = (timeline_res_id == NOTIF_FALLBACK_ICON) || ...
(dialog, &(DialogCallbacks) { .unload = prv_dialog_unloaded, }, data)
; app_actionable_dialog_push(actionable_dialog); data->actionable_dialog = actionable_dialog; } static GColor prv_invert_bw_color(GColor color) { if (gcolor_equal(color, GColorBlack)) { return GColorWhite; } else if (gcolor_equal(color, GColorWhite)) { return GColorBlack; } return color; } static ...
er_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "d...
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw1_clip_xy.$...
{ if (this->state->link_state == LinkState_Opened) { struct LCPPacket *reply = pulse_link_send_begin(this->protocol_number); memcpy(reply, packet, ntoh16(packet->length)); reply->code = ControlCode_EchoReply; pulse_link_send(reply, ntoh16(packet->length)); } }
static void prv_on_echo_reply(PPPControlProtocol *this, struct LCPPacket *packet) { // TODO } static bool prv_handle_extended_lcp_codes(PPPControlProtocol *this, LCPPacket *packet) { switch (packet->code) { case ControlCode_ProtocolRejec...
) { NotificationWindowData *window_data = data; TimelineItem *item = prv_get_current_notification(window_data); if (!prv_should_provide_action_menu_for_item(window_data, item)) { return; } LayoutLayer *layout = swap_layer_get_current_layout(&window_data->swap_layer); const LayoutColors *colors = layou...
window_deinit(window)
; i18n_free_all(data); s_in_use = false; } ////////////////////// // Callback Handlers ////////////////////// static void prv_layout_did_appear_handler(SwapLayer *swap_layer, LayoutLayer *layout, int8_t rel_change, void *context) { NotificationWindowData *data = contex...
written_flag; void *source_buffer; uint32_t flash_data_start, flash_data_length; bool callback_called; void test_system_flash__initialize(void) { erased_sector = 0; flash_locked = true; flash_flags_set = false; return_status = FLASH_COMPLETE; flash_written_data = NULL; flash_written_flag = NULL; flash_da...
(flash_locked)
; cl_assert_equal_s(testdata, (const char *)&flash_written_data[10]); assert_flash_unwritten(0, 10); assert_flash_unwritten(10 + sizeof(testdata), 90 - sizeof(testdata)); cl_assert(callback_called); } void test_system_flash__write_error(void) { return_status = FLASH_ERROR_OPERATION; malloc_flash_data(10); ...
---------------------------------------------------------------------------- // Comm session fake support void data_logging_protocol_msg_callback(CommSession *session, const uint8_t *data, size_t length); static CommSession *s_session; static DataLoggingSendDataMessage s_prev_send_data_hdr; static uint8_t s_prev_send...
(logging_session, item_size, num_items)
; prv_check_session_data(logging_session, random_crc, item_size * num_items); } // ---------------------------------------------------------------------------------------- void test_data_logging__initialize(void) { regular_timer_init(); prv_init_fake_flash(); stub_pebble_tasks_set_current(PebbleTask_KernelBack...
int8_t error_code) { PBL_LOG(LOG_LEVEL_WARNING, "App Fetch: prv_app_fetch_failure: %d", error_code); if (error_code == AppFetchResultUserCancelled) { app_window_stack_pop(true); } data->result = error_code; if ((watchface_get_default_install_id() == data->install_entry.install_id) && app_install_e...
(data, FAILURE_PERCENT)
; } // subscribe to PutBytes events data->fetch_event_info = (EventServiceInfo) { .type = PEBBLE_APP_FETCH_EVENT, .handler = prv_app_fetch_event_handler }; event_service_client_subscribe(&data->fetch_event_info); app_progress_window_push(&data->window); } static void handle_deinit(void) { AppFe...
; cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1); cl_assert_equal_i(fake_notification_storage_get_store_count(), 1); cl_assert_equal_i(fake_notification_storage_get_remove_count(), 0); // We should reject any notification that matches and has the exact same uid uint32_t u...
cl_assert_equal_i(s_num_ds_notifications_received, 5)
; } extern ANCSClientState prv_get_state(void); extern void prv_check_ancs_alive(void); void test_ancs__alive_check_disconnection(void) { prv_check_ancs_alive(); // check we're in the alive check state and we sent a single request cl_assert_equal_i(prv_get_state(), ANCSClientStateAliveCheck); cl_assert_equal...
: analytics_inc(ANALYTICS_DEVICE_METRIC_NOTIFICATION_DISMISSED_COUNT, AnalyticsClient_System); // This is a notification that was sourced from timeline. The mobile phone does not care // about dismissing it. We just confirm and dismiss locally. if (item->header.from_watch || (((item->...
(&header.parent_id)
== INSTALL_ID_INVALID) { analytics_info->visible_count.other++; analytics_info->hourly_count.other += within_hour; } } return true; // continue iteration } void analytics_external_collect_timeline_pin_stats(void) { PinAnalyticsInfo analytics_info = { .timestamp = rtc_get_time() }; pin_d...
/* * 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...
pebble_task_get_current()
== PebbleTask_App) { gmtime_tm = app_state_get_gmtime_tm(); } else { gmtime_tm = worker_state_get_gmtime_tm(); } sys_gmtime_r(timep, gmtime_tm); return gmtime_tm; } struct tm *pbl_override_localtime(const time_t *timep) { struct tm *localtime_tm = NULL; char *localtime_zone = NULL; if (pebble_...
/* * 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...
MAX(0, radius)
; int32_t height = 0; int32_t width = 0; const int32_t top = center.y - radius; const int32_t bottom = center.y + radius; int32_t range_start = vertical_range.origin_y; int32_t range_end = vertical_range.origin_y + vertical_range.size_h; // Check if both top and bottom are outside but not surrounding t...
------------------------------------------------------------------ static void prv_handle_ack(PPoGATTClient *client, uint32_t sn) { if (prv_is_packet_with_sn_awaiting_ack(client, sn)) { client->out.timeouts_counter = 0; client->out.ack_timeout_state = AckTimeoutState_Inactive; // Ack'd one of the packet...
LIKELY(packet->type == PPoGATTPacketTypeAck)
deinit(void); void test_launcher_menu_layer__cleanup(void) { app_glance_db_deinit(); gbitmap_deinit(&s_app_icon_bitmap); gbitmap_deinit(&s_default_app_icon_bitmap); free(fb); } // Helpers ////////////////////// //! Declared T_STATIC in launcher_menu_layer.c so we can easily change the launcher's selected ind...
{ const LauncherMenuLayerTestAppNode *test_node = &s_fake_app_nodes[i]; const uint32_t icon_resource_id = s_use_pdc_icons ? test_node->pdc_slice_icon_resource_id : test_node->bitmap_slice_icon_resource_id; AppGlance glance = (AppGlance) { .num_sl...
aying_info(session, msg, length); break; case MusicEndpointCmdIDPlayStateInfoResponse: prv_update_play_state_info(session, msg, length); break; case MusicEndpointCmdIDVolumeInfoResponse: prv_update_volume_info(session, msg, length); break; case MusicEndpointCmdIDPlayerInfoRespo...
(&s_pp_music_implementation, connected)
) { s_connected = connected; } else { s_connected = false; } if (s_connected) { // Request initial state: prv_send_music_command_to_handset(MusicEndpointCmdIDGetAllInfo); } } void music_endpoint_handle_mobile_app_info_event(const PebbleRemoteAppInfoEvent *app_info_event) { if (app_info_event-...
{ if (animation_private_using_legacy_2(NULL)) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. return (Animation *)animation_legacy2_create(); } AnimationPrivate *animation = applib_type_malloc(Ani...
// ------------------------------------------------------------------------------------------- bool animation_destroy(Animation *animation_h) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); if (animation_private_using_legacy_2(state)) { // We need to enable other applib modules like sc...
tionUpdateFunc func, Animation *animation, const AnimationProgress distance_normalized) { if (!prv_should_render()) { if (!s_deferred_render.transition_complete.pending) { s_deferred_render.animation.pending = true; s_deferred_render.animation.progress = distance_norm...
animation_create()
, .impl = compositor_animation }; static const AnimationImplementation s_compositor_animation_impl = { .update = prv_animation_update, .teardown = prv_animation_teardown, }; animation_set_implementation(s_animation_state.animation, &s_compositor_animation_impl); compositor_animat...
es_read; bytes_read = pfs_read(fd, buf, size); if (bytes_read < S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Err %d while reading", (int)bytes_read); return false; } else if (bytes_read < (int)size) { PBL_LOG(LOG_LEVEL_ERROR, "Read only %d bytes, expected %d", (int)bytes_read, (int)size); return false; ...
prv_pfs_get_file_size(session->storage.fd)
; uint32_t target_free_bytes = prv_get_desired_free_bytes(session); if ((cur_size > 0) && (session->storage.num_bytes + target_free_bytes < cur_size)) { // We have more than the desired number of free bytes in this file, so it is a candidate // for compaction. uint32_t new_size = session->storage.num_by...
own = STATIONARY_WAIT_BEFORE_ENGAGING_TIME_MINS; } static void prv_enter_awake_state(void) { PBL_LOG(LOG_LEVEL_INFO, "Exiting stationary: Setting run level to normal"); analytics_event_stationary_state_change(rtc_get_time(), StationaryAnalyticsExitNormally); prv_reset_stationary_counter(); s_current_state = St...
{ switch (action) { case StationaryActionGoToSleep: break; case StationaryActionWakeUp: // No-op here. Awake gives us the same runlevel as Disabled, so no harm in just staying in // the disabled state. Could potentially be caused in races where we tap or press a button // to wake us up...
typedef void (*StationaryActionHandler)(StationaryAction action); static void prv_handle_action(StationaryAction action) { // we need to be on kernel main so that we subscribe to event services // for kernel main PBL_ASSERT_TASK(PebbleTask_KernelMain); PBL_LOG_D(DEBUG_STATIONARY, LOG_LEVEL_DEBUG, "Stationary...
const char *title, const char *subtitle, GDrawCommandImage *icon) { // as measured from the design specs const int horizontal_inset = MENU_CELL_ROUND_UNFOCUSED_HORIZONTAL_INSET; const int top_inset = 2; GRect frame = cell_l...
if (!menu_layer_is_index_selected(&s_data->menu_layer, cell_index)) { draw_cell = prv_draw_notification_cell_round_unselected; }
#endif bool first_row = (cell_index->row == 0); // Test if there are any notifications in the list. if (first_row) { // Draw "Clear all" box and exit #if PBL_ROUND draw_cell(ctx, cell_layer, i18n_get("Clear All", data), NULL, NULL); #else const GFont font = system_theme_get_font_for_default_size(Tex...
SW = 1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_...
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 5); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitma...
bmi160.h" #include "drivers/qemu/qemu_serial.h" #include "drivers/rtc.h" #include "os/mutex.h" #include "pebble_errors.h" #include "system/logging.h" #include "system/passert.h" #include "util/math.h" #include "util/net.h" #include <string.h> #define ACCEL_LOG_DEBUG(fmt, args...) PBL_LOG_D(LOG_DOMAIN_ACCEL, LOG_LEV...
{ QemuProtocolAccelHeader *hdr = (QemuProtocolAccelHeader *)data; // Validate the packet uint32_t data_bytes = hdr->num_samples * sizeof(AccelRawData); if (data_bytes != len - sizeof(QemuProtocolAccelHeader)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid packet received"); return; } ACCEL_LOG_DEBUG("Got acce...
void qemu_accel_init(void) { PBL_ASSERTN(!s_initialized); s_initialized = true; s_latest_reading = s_default_sample; s_accel_mutex = mutex_create(); s_timer_id = new_timer_create(); } uint32_t accel_set_sampling_interval(uint32_t interval_us) { mutex_lock(s_accel_mutex); { s_sampling_interval_ms ...
288, -304}, { 1480, 488, -504}, { 1320, 704, -528}, { 1256, 664, -616}, { 1176, 488, -472}, { 960, 504, -536}, { 1224, 376, -440}, { 1368, 360, -288}, { 1312, 280, -200}, { 1144, 216, -168}, { 1136, 184, -160}, { 1200, 176, -136}, { 1232, 168, -144}, { 1144, 128, -176...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-16 12:39:07 local AccelRawData *activity_sample_walk_100_pbl_28397_11(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_28397_11 //> TE...
system_task_cb() ActivityScalarStore prev_steps = s_activity_state.step_data.steps; mutex_lock_recursive(s_activity_state.mutex); { activity_algorithm_get_steps(&s_activity_state.step_data.steps); // Are we logging raw accel samples? if (s_activity_state.sample_collection_enabled) { prv_collect...
if (activity_algorithm_init(&sampling_rate)) { PBL_LOG(LOG_LEVEL_DEBUG, "Starting activity tracking..."); // Subscribe to the accelerometer from KernelBG s_activity_state.test_mode = test_mode; if (!test_mode) { PBL_ASSERTN(s_activity_state.accel_session == NULL); s_activity_state.accel_ses...
} // ------------------------------------------------------------------------------------------------ // Stop activity tracking system callback static void prv_stop_tracking_cb(void *context) { s_activity_state.should_be_started = false; if (!s_activity_state.started) { return; } cron_job_unschedule(&s_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ // This assumes that the user of this library can differentiate empty entries in the cache from // valid ones. for (int i = 0; i < c->total_items; i++) { uint8_t* item = prv_get_item_at_index(c, i); if (c->item_destructor) { c->item_destructor(item); } } c->next_erased_item_idx = 0; }
valid_attribute_length)->notification_uid; const uint32_t attribute_at_end_uid = ((GetNotificationAttributesMsg*)memory_with_attribute_id_at_end.attribute_data)->notification_uid; const uint32_t loading_uid = ((GetNotificationAttributesMsg*)s_loading_response)->notification_uid; const uint32_t no_content_uid = ((...
{ prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_multiple_complete_dicts), (uint8_t*) s_multiple_complete_dicts); s_num_ds_notifications_received += 3; }
else if (uid == split_timestamp_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_split_timestamp_dict_part_one), (uint8_t*) s_split_timestamp_dict_part_one); prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_split_timestamp_dict_part_two), (uint8_t*) s_split_timestamp_dict_part_two); s_num_ds_notif...
return is_bonded; } static void prv_device_foreach_search_gateway(const device_t *dev, void *ud) { bool *has_bonded_gateway = ud; if (dev->is_gateway) { *has_bonded_gateway = true; } } static bool prv_has_bonded_gateway(void) { bool has_bonded_gateway = false; storage_acquire(); device_foreach(prv_de...
PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_set_sec_level: %u", e)
; } } } static uint8_t prv_handle_handle_cccd_read(uint16_t handle, uint16_t conn_idx, uint8_t response_buffer[READ_RESPONSE_BUFFER_SIZE]) { Connection *connection = connection_by_idx_check(conn_idx); bool notifications_enabled = false; if (handle == s_pps_ctx.att...
prv_deinit_dialog_bootrom_interface()
; #if ACCESSORY_UART_IS_SHARED_WITH_BT // We are sharing a UART with the accessory port, so we need to block it from being used while we // are using it and then unblock at the end. accessory_unblock(); #endif if (success) { PBL_LOG(LOG_LEVEL_DEBUG, "Succesfully loaded second stage BLE bootloader!"); } ...
/////////////////////////////////////// #include "ancs_test_data.h" // Tests /////////////////////////////////////////////////////////// void test_ancs_util__should_parse_complete_notif_attr_dict(void) { bool error = false; cl_assert(ancs_util_is_complete_notif_attr_response(s_complete_dict, sizeof(s_complete_di...
strncmp((char*) message->value, expected_message, message->length)
== 0); // Ensure the dupe is detected bool was_added_to_cache = ancs_util_cache_notification( attr_ptrs[FetchedAttributeIndexAppID], attr_ptrs[FetchedAttributeIndexTitle], attr_ptrs[FetchedAttributeIndexSubtitle], attr_ptrs[FetchedAttributeIndexMessage], attr_ptrs[FetchedAttributeInd...
" #include "drivers/flash/qspi_flash_part_definitions.h" #include "flash_region/flash_region.h" #include "system/passert.h" #include "system/status_codes.h" #include "util/math.h" #define STM32F4_COMPATIBLE #define STM32F7_COMPATIBLE #include <mcu.h> static QSPIFlashPart QSPI_FLASH_PART = { .instructions = { ....
{ return qspi_flash_erase_begin(QSPI_FLASH, sector_addr, false /* !is_subsector */); }
status_t flash_impl_erase_suspend(FlashAddress sector_addr) { return qspi_flash_erase_suspend(QSPI_FLASH, sector_addr); } status_t flash_impl_erase_resume(FlashAddress sector_addr) { qspi_flash_erase_resume(QSPI_FLASH, sector_addr); return S_SUCCESS; } status_t flash_impl_read_sync(void *buffer_ptr, FlashAddr...
/* * 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...
(dstbuf, 256, "%#llo", val)
; cl_assert_equal_s(dstbuf, "01777777777777777777777"); } void test_sprintf__null(void) { cl_assert_equal_i(snprintf(NULL, 0, "Hello!\nI am error"), 17); } void test_sprintf__percent_d(void) { char dstbuf[256]; // Simple %d snprintf(dstbuf, 256, "There are %d lights, %d", 4, -4); cl_assert_equal_s(dstbu...
er *child) { PBL_ASSERTN(parent != NULL); PBL_ASSERTN(child != NULL); if (child->parent) { layer_remove_from_parent(child); } PBL_ASSERTN(child->next_sibling == NULL); child->parent = parent; layer_set_window(child, parent->window); if (child->window) { window_schedule_render(child->window); }...
layer_convert_point_to_screen(layer, rect.origin)
, .size = rect.size, }; } void layer_get_global_frame(const Layer *layer, GRect *global_frame_out) { *global_frame_out = (GRect) { .origin = layer_convert_point_to_screen(layer, GPointZero), .size = layer->frame.size, }; } bool layer_contains_point(const Layer *layer, const GPoint *point) { if (!l...
t_string(&action->attr_list, AttributeIdBody, (char *)i18n_get("Thanks!", &i18n_key)); const uint32_t timeline_res_id = attribute_get_uint32(&action->attr_list, AttributeIdIconLarge, TIMELINE_RESOURCE_THUMBS_UP); ...
(ANALYTICS_DEVICE_METRIC_NOTIFICATION_DISMISSED_COUNT, AnalyticsClient_System)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(window_layer, text_layer_get_layer(s_text_layer))
; } static void prv_window_unload(Window *window) { text_layer_destroy(s_text_layer); } static void prv_init(void) { s_window = window_create(); window_set_click_config_provider(s_window, prv_click_config_provider); window_set_window_handlers(s_window, (WindowHandlers) { .load = prv_window_load, .unlo...
/* * 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->text_layer_2)
); text_layer_enable_screen_text_flow_and_paging(&data->text_layer_2, inset); const GSize max_size_2 = text_layer_get_content_size(app_state_get_graphics_context(), &data->text_layer_2); text_layer_set_size(&data->text_layer_1, GSize(scroll_bounds.size.w, max_size_2.h + padding)); // Setup paging before ...
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10...
(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_health_activity_summary_card__render_current_above_typical4(void) { HealthData health_data = { .step_data = 866, .step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return 0; }
// Construct the double in two uint32_t's then reinterpret as double // Using a uint64_t would pull in helper functions for 64bit shifts union { double result; uint32_t representation[2]; } conv; conv.representation[1] = 0; if (time < 0) { // set the sign bit conv.representation[1] |= (1 ...
b/graphics/gtypes.h" #include "applib/ui/property_animation.h" #include "applib/ui/status_bar_layer.h" #include "applib/ui/shadows.h" #include "applib/ui/window.h" #include "resource/resource_ids.auto.h" #include "services/normal/timeline/layout_layer.h" #include "services/normal/timeline/notification_layout.h" #includ...
(swap_layer->layer.frame.size.h, size.h)
{ 1192, 520, -24}, { 1480, 504, -40}, { 1416, 496, -232}, { 920, 216, -512}, { 1200, 216, -216}, { 752, 144, -104}, { 744, 584, -360}, { 968, 400, -136}, { 800, 320, -32}, // 332 seconds { 640, 424, -24}, { 688, 472, 88}, { 824, 488, 24}, { 1104, 640, 56}, { 1224...
{ 824, 608, 528}, { 824, 816, 464}, { 896, 488, 312}, { 1128, 456, 96}, { 1200, 464, 56}, { 1064, 592, 72}, { 808, 320, 32}, { 656, 320, -96}, { 784, 480, -24}, { 1152, 536, 8}, { 1424, 656, 112}, { 1336, 448, -24}, { 1120, 416, -168}, { 872, 696, -152}, { 896...
{ 664, 200, -16}, { 584, 320, -24}, { 648, 288, 64}, { 1016, 296, 128}, { 1312, 424, 176}, { 1376, 544, 320}, { 1288, 840, 496}, { 1224, 848, 608}, { 1104, 584, 272}, { 664, 672, 360}, { 784, 512, 384}, { 856, 408, 424}, { 816, 368, 280}, { 656, 376, 144}, { ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_malloc(prv_find_size(ApplibType_${name}), saved_lr)
andler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // Complete A and start B p...
prv_count_handler_entries(&s_stopped_handler_calls, b)
, 0); // Complete A and start B prv_advance_to_ms_with_timers(start_ms + delay_spawn + duration_a + delay_a + 2 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_hand...
s_sys_exit.h" size_t heap_bytes_free(void) { return 123456; } static Window s_app_window_stack_get_top_window; Window *app_window_stack_get_top_window() { return &s_app_window_stack_get_top_window; } static int s_prv_api_init__callcount; static void prv_api_init(void) { s_prv_api_init__callcount++; } static i...
("t", "function")
; // rocky.off exists EXECUTE_SCRIPT( "t = typeof _rocky.off;\n" "var eq = _rocky.off === _rocky.removeEventListener;\n" ); ASSERT_JS_GLOBAL_EQUALS_S("t", "function"); ASSERT_JS_GLOBAL_EQUALS_B("eq", true); // from MDN docs: // Calling removeEventListener() with arguments that do not identify ...
distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "stats.h" #include "kernel/pbl_malloc.h" #include <util/m...
if (op & StatsBasicOp_ConsecutiveFirst) { basic_out[out_index++] = consecutive_first; }
if (op & StatsBasicOp_Median) { basic_out[out_index++] = prv_calculate_median(data, num_data, min, max, num_values, filter, context); } } typedef struct WeightedValue { int32_t value; int32_t weight_x100; } WeightedValue; static int prv_cmp_weighted_value...