prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
{ 1472, 640, -464}, { 1336, 256, -200}, { 1016, 120, -168}, { 784, 184, -136}, { 760, 256, -176}, { 744, 160, -112}, { 888, 224, -176}, { 960, 208, -200}, { 1040, 184, -200}, { 1184, 176, -176}, { 1312, 184, -80}, { 1808, 224, -88}, // 38 seconds { 1456, 504, -208...
{ 1328, 144, -128}, { 920, 192, -72}, { 752, 192, -64}, { 680, 200, -80}, { 688, 232, -88}, { 776, 248, -112}, { 896, 320, -152}, { 992, 288, -104}, { 1304, 360, -184}, { 1488, 232, -32}, { 1848, 408, -144}, { 1320, 448, -160}, { 1304, 368, -144}, { 1344, 248, -72...
{ 1112, 544, -184}, { 1208, 448, -136}, { 1392, 416, -152}, // 46 seconds { 1240, 336, -64}, { 936, 312, -32}, { 800, 296, -40}, { 800, 224, -24}, { 816, 176, 0}, { 824, 176, 8}, { 832, 144, 0}, { 872, 168, 24}, { 1024, 128, 8}, { 1136, 96, -16}, { 1520, 192,...
/* * 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...
accessory_mfg_mode_start()
; break; case AccessoryInputStateIdle: // restore accessory to default state accessory_enable_input(); accessory_set_baudrate(AccessoryBaud115200); accessory_set_power(false); break; case AccessoryInputStateImaging: accessory_enable_input(); accessory_set_baudrate(AccessoryBaud921600...
nd then clips a full-screen red rectangle to the resulting mask static void prv_right_flip_first_quarter_frame_clipping(GContext *ctx) { // The 1/4 progress frame is ANIMATION_NORMALIZED_MAX * 3/4 because the right flip animation is // actually played backwards compositor_round_flip_transitions_flip_animation_up...
TEST_NAMED_PBI_FILE("move_horizontal_right")
)); graphics_private_move_pixels_horizontally(bitmap, -100, false); cl_check(gbitmap_pbi_eq(bitmap, TEST_NAMED_PBI_FILE("move_horizontal_left"))); graphics_private_move_pixels_horizontally(bitmap, 400, false); cl_check(gbitmap_pbi_eq(bitmap, TEST_NAMED_PBI_FILE("move_horizontal_right_too_far"))); graphics_...
e state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000), 0); // s_items[0] is the earliest pin, followed by s_items[4] cl_assert_equal_i(pin_db_delete((uint8_t *)&s_items[0].header.id, sizeof(Uuid)...
cl_assert_equal_i(state.node->timestamp, 1425312000)
g_kcalories[i] = ROUND(s_exp_full_day_resting_kcalories * (MINUTES_PER_DAY - 1), MINUTES_PER_DAY); } else { exp_resting_kcalories[i] = s_exp_full_day_resting_kcalories; } } ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricRestingKCalories, exp_resting_kcalories); // ...
prv_feed_cannned_accel_data(1 * SECONDS_PER_MINUTE, 100, ActivitySleepStateAwake)
; prv_feed_cannned_accel_data(1 * SECONDS_PER_MINUTE, 10, ActivitySleepStateAwake); activity_get_metric(ActivityMetricActiveSeconds, 1, &value); cl_assert_equal_i(value, SECONDS_PER_HOUR + (2 * SECONDS_PER_MINUTE)); cl_assert_equal_i(health_service_sum_today(HealthMetricActiveSeconds), SECON...
ROPHONE prv_stop_mic_and_cleanup(data); #endif bt_driver_register_response_callback(NULL); snprintf(data->status_string, STATUS_STRING_LENGTH, "Test Failed to Start"); app_window_stack_push(&data->status_window, true); if (data->current_test_step != BTLETestStep_BTStart) { // A BTLE Test star...
(data->payload_menu_layer)
); } static void prv_payload_window_unload(Window *window) { AppData *data = app_state_get_user_data(); layer_remove_child_layers(window_get_root_layer(&data->payload_window)); simple_menu_layer_destroy(data->payload_menu_layer); app_free(data->payload_menu_items); } static void prv_payload_type_window(AppDa...
llback(data); } void app_idle_timeout_pause(void) { s_app_idle = true; } void app_idle_timeout_resume(void) { s_app_idle = false; } bool app_install_id_from_app_db(AppInstallId id) { return false; } void framebuffer_dirty_all(FrameBuffer *f) { return; } void framebuffer_mark_dirty_rect(FrameBuffer *f, GRec...
(window->on_screen, false)
dle_write(command, length); return; case IMAGING_CMD_CRC: prv_handle_crc(command, length); return; case IMAGING_CMD_QUERY_REGION: prv_handle_query_region(command, length); return; case IMAGING_CMD_FINALIZE_REGION: prv_handle_finalize_region(command, leng...
(cmd->crc.address, cmd->crc.length)
; CrcAck *ack = pulse_best_effort_send_begin(PULSE_PROTOCOL_FLASH_IMAGING); *ack = (CrcAck) { .opcode = IMAGING_RESP_CRC, .address = cmd->crc.address, .length = cmd->crc.length, .crc = crc }; pulse_best_effort_send(ack, sizeof(CrcAck)); } static void prv_handle_query_region(Command *cmd, size_...
ion //! The movement will not happen while looking at the launcher, it will only refresh on a //! close->open static const struct { AppInstallId install_id; bool move_on_activity; } s_override_table[] = { { APP_ID_SPORTS, false }, { APP_ID_GOLF, false }, #ifdef APP_ID_WORKOUT { APP_ID_WORKOUT, true }, #endif ...
app_order_read_order()
al_alignment = GTextAlignmentCenter; char time_buffer[8]; char am_pm_buffer[4]; const time_t now = rtc_get_time(); /// Current time in 24 or 12 hour const char *time_fmt = clock_is_24h_style() ? "%R" : "%l:%M"; strftime(time_buffer, sizeof(time_buffer), time_fmt, pbl_override_localtime(&now)); health_ut...
prv_draw_outer_ring(ctx, data->current_steps, data->daily_steps_avg, fill_thickness, bounds, fill_color)
.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)); GRect dest_rect = GRect(0, 0, src_bitmap->bounds.size.w*2, src_bitmap->bounds.size...
gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_src_origin_offset_wrap-expect.8bit.pbi")
); gbitmap_destroy(src_bitmap); } // Setup: // - Source width is not a multiple of 8 (ie. not byte aligned in source) // - Source starts with 2 rows and 4 columns of black pixels. // - Dest is all blue. // - Src origin is set to (4, 2) // - dest origin is set to 22, 6 // - dest size is twice the height ...
n); extern HRMSubscriberState * prv_get_subscriber_state_from_app_id(PebbleTask task, AppInstallId app_id); extern void prv_read_event_from_buffer_and_consume(CircularBuffer *buffer, PebbleHRMEvent *event); extern uint32_t prv_num_system_task_events_queue...
memset(&s_hrm_state, 0, sizeof(s_hrm_state))
; hrm_manager_init(); hrm_manager_enable(true); fake_event_init(); } void test_hrm_manager__subscription(void) { AppInstallId app_id = 1; const uint32_t update_interval_s = 1; const uint16_t expire_s = SECONDS_PER_MINUTE; HRMFeature features = HRMFeature_BPM; HRMSessionRef session_ref = sys_hrm_manage...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
simple_dialog_get_dialog(simple_dialog)
; dialog_set_text(dialog, lang_name); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_CONFIRMATION_LARGE); dialog_set_background_color(dialog, GColorJaegerGreen); dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT); simple_dialog_push(simple_dialog, modal_manager_get_window_stack(ModalPriorityAlert)); // after 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...
mutex_lock(s_mutex)
; psleep(20); PBL_LOG(LOG_LEVEL_DEBUG, "Locking mutex 2"); mutex_lock(s_mutex2); } static void s_main(void) { window = window_create(); app_window_stack_push(window, true /* Animated */); deadlock(); app_event_loop(); } const PebbleProcessMd* deadlock_get_app_info(void) { static const PebbleProcessM...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
memcmp(out_buffer, (uint8_t*) "5678", 4)
== 0); cl_assert(circular_buffer_consume(&buffer, 4)); // Get the rest of the wrapped read cl_assert(circular_buffer_read(&buffer, 2, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 2); cl_assert(memcmp(out_buffer, (uint8_t*) "9a", 2) == 0); cl_assert(circular_buffer_consume(&buffer, 2)); // ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(s_invalidate_size, 0x20)
; cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Valid); } void test_cpu_cache__userspace_fail_from_size(void) { cl_will_return(icache_is_enabled, true); cl_will_return(dcache_is_enabled, true); cl_will_return(icache_line_size, 1); cl_will_return(dcache_line_size, 1); cl_will_return(syscall_internal_c...
v_action_callback, (void *)window); action_menu_layer_set_align(action_menu_layer, data->config.align); // Init crumbs layer CrumbsLayer *crumbs_layer = &data->crumbs_layer; GRect frame = window_get_root_layer(window)->frame; #if PBL_RECT // on round display, the layer fills a full circle // here (on rect) ...
(window, data)
; window_set_fullscreen(window, true); window_set_background_color(window, GColorBlack); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_action_window_load, .unload = prv_action_window_unload, }); prv_action_window_push(window_stack, &data->action_menu, true /* animated */); ret...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
GColorARGB8FromHEX(0x808000)
}, {"yellow", GColorARGB8FromHEX(0xffff00)}, {"navy", GColorARGB8FromHEX(0x000080)}, {"blue", GColorARGB8FromHEX(0x0000ff)}, {"teal", GColorARGB8FromHEX(0x008080)}, {"aqua", GColorARGB8FromHEX(0x00ffff)}, {"antiquewhite", GColorARGB8FromHEX(0xfaebd7)}, {"aquamarine", GColorARGB8FromHEX(0x7fffd4)}, {"azu...
-1056}, // 2 seconds { -160, 224, -1024}, { -176, 200, -1000}, { -136, 184, -992}, { -152, 200, -968}, { -152, 184, -952}, { -160, 136, -960}, { -168, -16, -936}, { -208, 72, -1040}, { -232, 184, -1016}, { -224, -56, -1096}, { -280, 56, -1128}, { -248, 152, -1128}, ...
{ 1144, 408, -24}, { 1368, 400, 56}, { 1504, 336, 32}, { 1264, 200, 96}, { 1312, 8, 136}, { 1312, -88, 64}, { 1272, -56, 0}, { 1144, -8, 0}, { 1176, -48, 24}, { 1144, -160, 32}, // 8 seconds { 720, -272, 32}, { 1016, -176, -136}, { 1176, 32, -80}, { 1208, 104,...
{ 840, -16, -24}, { 1008, -16, 16}, { 1232, 136, 88}, { 1360, 304, 48}, { 1208, 392, -8}, { 1328, 432, 48}, { 1200, 784, 16}, { 920, 520, 40}, { 1144, 440, -32}, { 1048, 392, -88}, { 1128, 312, 0}, { 1296, 296, 32}, { 1416, 280, -8}, { 1320, 104, 24}, { 1312,...
int_logging_send_msg(hc_msg)) { // Attempt to send an OVERRUN message. hc_endpoint_logging_send_msg((HcProtocolMessage *)&OVERRUN.hc_header); } } // Re-use the msg_buffer. va_start(args, packed_loghash); int header_length = snprintf((char *)msg_buffer, msg_buffer_size, ":0> NL:%x", hash); in...
if (length_with_null >= msg_buffer_size) { length--; }
msg_buffer[length++] = '\n'; prv_log_to_buffer((uint8_t *)msg_buffer, length); } #endif // PBL_LOGS_HASHED
t_ms, }; // In order to avoid race conditions between button events and timers being registered, drive the // entire multi click sequence in new_timers. The callback will re-register this timer as needed // for each subsequent click event in the sequence. const bool timer_started = new_timer_start(s_console_...
(base + iteration * 16 + i)
; msg->log_level = LOG_LEVEL_ERROR; msg->message_length = sizeof(buffer) - sizeof(LogBinaryMessage); msg->line_number = 0; strncpy(msg->filename, "spam.exe", sizeof(msg->filename)); char letter = 'A' + i; memset(msg->message, letter, msg->message_length - 1); msg->message[msg->message_length...
316, -278}, { -778, -198, 1295}, { -1855, -2245, 1551}, { -1108, -390, 1044}, { -1178, -329, 505}, { -2648, 397, 1239}, { -3826, 3999, -513}, { -790, 3434, -250}, { 420, 1917, -33}, { 1001, 1309, -315}, { 2524, 816, -717}, { 1461, 333, -684}, { 912, 68, -357}, { 411, ...
{ -1591, 3999, -227}, { 32, 2229, -182}, { 424, 1006, -60}, { 674, 708, -241}, { 1195, 460, -882}, { 1949, 400, -667}, { 1064, 314, -395}, { 569, 2136, -649}, { -147, 3999, -523}, { -958, 3601, -169}, { -2888, 2536, 400}, { -648, -111, 112}, { -846, 174, 287}, { -...
{ -1126, 2746, 695}, { -871, 268, 397}, { -1009, 484, 9}, { -1116, -599, 823}, { -1586, -1566, 646}, { -1176, -168, 476}, { -1228, -253, 308}, { -2505, 677, 1019}, { -2782, 3999, -552}, { -754, 3407, -458}, { 188, 1628, -48}, { 512, 841, -87}, { 725, 548, -438}, ...
e immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "Foo bar"); cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, .box = (GRect) { GPointZero, (GSize) { 7 * HORIZ_ADVANCE_PX, 10 } } }; line.max_width...
(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params))
; cl_assert(line.height_px == 10); cl_assert(line.width_px == 1 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 1 * HORIZ_ADVANCE_PX); // reset line ...
nds = utf8_get_bounds(&success, sentence); cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, // Width for first word only: .box = (GRect) { (GPoint) { 0, 0 }, (GSize) { 3 * HORIZ_ADVANCE_PX, 10 } } }; line.max_width_px = text_box_params.box.s...
(line.origin.y == 0)
; cl_assert(line.suffix_codepoint == 0); cl_assert(*line.start == 'F'); // b cl_assert(*word_iter_state.current.start == 'b'); cl_assert(*word_iter_state.current.end == '\n'); cl_assert(word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 1); line_reset(&line, utf8_bounds.start); cl_assert(line_add_...
it(GBitmap* dest_bitmap, const GBitmap* src_bitmap, GRect dest_rect, GPoint src_origin_offset, GCompOp compo...
PBL_LOG(LOG_LEVEL_DEBUG, "OP: %d NYI", (int)compositing_mode)
schedule do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will go off at 23:00 on Friday. (14.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 52200 * MS_PER_SECOND); rtc_set_time(s_friday_23_30); // In schedule do_not_...
(s_friday_23_30)
; // In schedule do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == true); // Timer will go off at 00:00 on Saturday. (0.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 1800 * MS_PER_SECOND); rtc_set_time(s_saturday_00_00); do_not_disturb...
/* * 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_passert(content_indicator_init(&content_indicator))
; } void test_content_indicator__deinit_should_remove_from_buffer(void) { ContentIndicatorsBuffer *content_indicators_buffer = content_indicator_get_current_buffer(); Buffer *buffer = &content_indicators_buffer->buffer; ContentIndicator content_indicator; size_t bytes_written = 0; for (size_t i = 0; i < CON...
lect, }; /// The option in the Settings app for filtering notifications by type. const char *title = i18n_noop("Filter"); settings_option_menu_push( title, OptionMenuContentType_DoubleLine, index, &callbacks, cycle_len, true /* icons_enabled */, s_alert_mode_labels, data); } // Vibe Settings (If vi...
{ const int DEFAULT_IDX = 2; // Double check no one has fudged with the order and the fallback/default PBL_ASSERTN(s_window_timeouts_ms[DEFAULT_IDX] == NOTIF_WINDOW_TIMEOUT_DEFAULT); const uint32_t timeout_ms = alerts_preferences_get_notification_window_timeout_ms(); for (size_t i = 0; i < ARRAY_LENGTH(s_win...
static void prv_window_timeout_menu_select(OptionMenu *option_menu, int selection, void *context) { alerts_preferences_set_notification_window_timeout_ms(s_window_timeouts_ms[selection]); app_window_stack_remove(&option_menu->window, true /* animated */); } static void prv_window_timeout_menu_push(SettingsNotifi...
/* * 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...
(type, PlatformTypeBasalt)
; }
, PebblePutBytesEventTypeCleanup); \ cl_assert_equal_i(event.put_bytes.object_type, object_type_); \ cl_assert_equal_i(event.put_bytes.total_size, object_size_); \ cl_assert_equal_i(event.put_bytes.progress_percent, 0); \ cl_assert_equal_b(event.put_bytes.failed, true); \ static void prv_receive_init_fw_object...
put_bytes_get_semaphore()
); fake_queue_set_yield_callback(put_bytes_get_semaphore(), NULL); assert_nack_count(1); } static void prv_hold_lock_before_write(void) { // Take and hold for a long time: xSemaphoreTake(put_bytes_get_semaphore(), portMAX_DELAY); fake_queue_set_yield_callback(put_bytes_get_semaphore(), prv_taking_too_long_y...
prv_write_reg(BMI160_REG_SELF_TEST, 0x8 | 0b01); psleep(50); struct { char axis_name; uint8_t register_address; int pass_threshold; int16_t negative_value; int16_t positive_value; } accel_test_axis[] = { { .axis_name = 'X', .register_address = BMI160_REG_ACC_X_LSB, ....
{ break; }
psleep(5); BMI160_DBG("GYRO: want mode %d, actual %d", mode, status); } PBL_ASSERT(retries > 0, "Gyro: Could not set power mode to %d", mode); s_gyro_power_mode = mode; BMI160_DBG("PMU_STATUS: 0x%x", bmi160_read_reg(BMI160_REG_PMU_STATUS)); } /* * accel.h driver interface exposed to higher level cod...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ jerry_cleanup(); rocky_runtime_context_deinit(); fake_pbl_malloc_check_net_allocs(); }
void test_rocky_text_encoding__jerry_handles_cesu8_strings_in_source(void) { // Although CESU-8 and UTF-8 are not compatible on paper, JerryScript's lexer doesn't mind if // we feed it CESU-8 encoded strings... Test this, so we know when this changes in the future: EXECUTE_SCRIPT("var pileOfPooCESU8 = '\xed\xa0...
again. cl_assert_equal_b(app_message_is_accepting_outbound(), true); } static void prv_in_received_callback(DictionaryIterator *received, void *context) { cl_assert_equal_p(context, &s_context); prv_assert_dict_equal(received, &s_expected_iter); s_in_received_is_called = true; } static void prv_in_dropped_cal...
{ return (Version) {}; }
static uint16_t s_sent_endpoint_id; static uint8_t *s_sent_data; static uint16_t s_sent_data_length; void prv_send_data(uint16_t endpoint_id, const uint8_t* data, uint16_t length) { const size_t header_size = (uintptr_t)(((AppMessage *)0)->payload[0].push.dictionary.head[0].value->data); const uint16_t max...
12}, { 80, 552, 384}, { 24, 552, 424}, { -40, 624, 384}, { 8, 712, 352}, { -32, 712, 368}, { -64, 728, 328}, { -64, 800, 344}, { -56, 864, 368}, { -96, 968, 464}, { -64, 1096, 568}, { -56, 1296, 920}, { 72, 1296, 816}, { 24, 928, 424}, { -120, 576, 352}, { -10...
{ -32, 496, 376}, { -128, 632, 384}, { -128, 776, 376}, { -120, 744, 360}, { -144, 824, 264}, // 24 seconds { -152, 816, 248}, { -152, 880, 264}, { -176, 1024, 360}, { -144, 1120, 520}, { -136, 1192, 776}, { -112, 1320, 728}, { 16, 1032, 464}, { -56, 608, 312}, ...
{ 136, 1216, 552}, { 48, 744, 296}, { -104, 560, 296}, { -56, 744, 360}, { 16, 752, 392}, { -16, 720, 336}, { -40, 688, 288}, { -56, 688, 256}, { -48, 752, 288}, { -32, 808, 288}, { -80, 984, 376}, { 80, 1128, 440}, // 27 seconds { 152, 1296, 688}, { 208, 135...
/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limit...
(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, STROKE_SMALL)
; graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_SMALL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r1_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Testing of the special cases for radius: // Radius of 3 - starting point for calculated edges setup_test_aa_sw(&ctx, fb, ORIGIN...
/* * 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...
mutex_unlock(s_mutex)
; new_timer_delete(timer->sys_timer_id); kernel_free(timer); } } //! Wrapper for the user supplied callback. We installed this callback by posting a PEBBLE_CALLBACK_EVENT //! to the client's event queue. This gets executed on the target task. static void prv_evented_timer_event_callback(void* data) { // N...
every entry is equal to LOOPS uint32_t desired_value = LOOPS; settings_file_each(&file, prv_each_check_all_values, (void *)&desired_value); } void test_settings_file__manual_compaction_increment(void) { printf("\nTesting manual file compaction...\n"); const bool manual_compaction = true; prv_test_settings_f...
("Making sure we handle running out of storage gracefully...\n")
; memcpy(key, "k255", 5); memcpy(val, "v255", 5); cl_assert_equal_i(settings_file_set(&file, key, key_len, val, val_len), E_OUT_OF_STORAGE); int val_len_out = settings_file_get_len(&file, key, key_len); cl_must_pass(val_len_out); uint8_t *val_out = malloc(val_len_out); cl_assert_equal_i(settings_file_get(...
/* * 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...
{ // noop }
void bt_driver_pebble_pairing_service_handle_gatt_mtu_change(const GAPLEConnection *connection) { // noop }
GTH]; uuid_to_string(&s_app_uuid, uuid_str); PBL_LOG(LOG_LEVEL_INFO, "Starting app-initiated voice dictation session for app %s", uuid_str); } #if !defined(TARGET_QEMU) // TODO: replace stub #endif // TODO: replace fake values AudioTransferInfoSpeex transfer_info = (AudioTransferInfoSpeex) { .samp...
{ prv_cancel_session(); if (app_initiated) { PBL_LOG(LOG_LEVEL_WARNING, "Received session setup result for app initiated session when it " "was not expected"); } else { PBL_LOG(LOG_LEVEL_WARNING, "Received session setup result for non-app session when an app " "sessio...
has_error = false; done: if (has_error) { new_timer_stop(s_timeout); } else { prv_handle_subsystem_started(SessionState_VoiceEndpointSetupReceived); } unlock: mutex_unlock(s_lock); } static bool prv_get_string_size_cb(const TranscriptionWord *word, void *data) { size_t *size = data; *size += w...
bool search_forward(SettingsRawIter *iter, const uint8_t *key, int key_len) { const int resumed_pos = settings_raw_iter_get_resumed_record_pos(iter); // Resume searching at the current record for (; !settings_raw_iter_end(iter); settings_raw_iter_next(iter)) { if (prv_is_desired_hdr(iter, key, key_len)) { ...
(offset < file->iter.hdr.val_len)
; settings_raw_iter_write_byte(&file->iter, offset, byte); return S_SUCCESS; } // Note that this operation is designed to be atomic from the perspective of // an outside observer. That is, either the new value will be completely // written and returned for all future queries, or, if we reboot/loose power/ // run ...
3}, { -818, 328, 129}, { -916, 308, 157}, { -985, 295, 165}, { -905, 312, 83}, { -1069, 368, 131}, { -1014, 358, 120}, { -917, 443, -7}, { -762, 490, -147}, { -820, 544, -160}, { -753, 418, -100}, { -873, 373, -25}, { -828, 364, -24}, { -806, 406, -60}, { -757, 43...
event_queue_cleanup_and_reset(app_manager_get_task_context()->to_process_event_queue)
graphics_fill_rect(ctx, &layer->bounds); graphics_context_set_drawing_state(ctx, prev_state); } } //! helper struct to move displacement logic out of window_render() typedef struct { GPoint drawing_box_origin; GRect clip_box; } DrawingStateOrigins; static void prv_adjust_drawing_state_for_legacy2_apps(...
graphics_context_get_current_context()
; GRect result = (GRect) { .origin = { 0, 0 }, .size = graphics_context_get_framebuffer_size(ctx) }; result.size.h -= fullscreen ? 0 : STATUS_BAR_HEIGHT; return result; } // FIXME: there is a problem in this function: // This function initializes the root layer to be the screen size. So, on a // new w...
/* success */, cb_data); } } static void prv_push_dismiss_first_use_dialog(ActionMenu *action_menu) { if (alerts_preferences_check_and_set_first_use_complete(FirstUseSourceDismiss)) { return; } const char* tutorial_msg = i18n_get("Quickly dismiss all notifications by holding the " \ ...
i18n_noop("Ok")
, i18n_noop("Yes"), i18n_noop("No"), i18n_noop("Call me"), i18n_noop("Call you later"), }; template_level = prv_create_level(ARRAY_LENGTH(strings), parent_level); for (size_t i = 0; i < (int)ARRAY_LENGTH(strings); i++) { const char *label = i18n_get(strings[i], i18n_owner); ...
PBL_LOG(LOG_LEVEL_WARNING, "No connection for idx %d", event->conn_idx); return; } PBL_LOG(LOG_LEVEL_INFO, "MTU updated: %"PRIu16, event->mtu); pebble_pairing_service_handle_gatt_mtu_change(connection, event->conn_idx); hc_endpoint_gap_service_mtu_changed(connection, event->mtu); } static void prv_conf...
xSemaphoreGive(init_info->semph)
; for (;;) { BaseType_t ret; uint32_t notif; sys_watchdog_notify(s_ble_perip_wdog_id); sys_watchdog_suspend(s_ble_perip_wdog_id); ret = xTaskNotifyWait(0, (uint32_t) -1, &notif, portMAX_DELAY); configASSERT(ret == pdTRUE); sys_watchdog_resume(s_ble_perip_wdog_id); hc_protocol_proc...
ote" structure: struct ElfExternalNote { uint32_t name_length; uint32_t data_length; uint32_t type; // NT_GNU_BUILD_ID = 3 uint8_t data[]; // concatenated name ('GNU') + data (build id) }; //! This symbol and its contents are provided by the linker script, see the //! .note.gnu.build-id section in src/fw/stm32...
{ // read in the two X's (vX.X) sscanf(version_str, "v%u.%u", major, minor); }
cceeded); } if (data->action_complete.callback) { data->action_complete.callback(succeeded, data->action_complete.callback_data); } if (data->action_menu) { action_menu_close(data->action_menu, true); data->action_menu = NULL; } else if (data->chaining_data.action_chaining_window) { window_s...
{ progress_window_set_result_success(data->progress_window); }
else { const uint32_t delay_ms = 100; progress_window_set_result_failure(data->progress_window, timeline_res_id, message, delay_ms); } } else { prv_show_result_window(data, timeline_res_id, message, success); } return true; } static void prv_timeout_h...
(val_out, average_sleep_val)
; } void test_health_db__notify_listeners(void) { char *key; s_metric_updated_count = 0; key = "tuesday_sleepData"; cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_sleep_data, sizeof(s_sleep_data)), S_SUCCESS); cl_assert_e...
/* * 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...
strlen(IOS_SMS_APP_ID)
); char valid_message[128]; strcpy(valid_message, "possible preamble "); strcat(valid_message, NEXMO_REAUTH_STRING); strcat(valid_message, " possible postamble"); uint8_t expected_message_buf[128]; ANCSAttribute *expected_message = (ANCSAttribute *)&expected_message_buf; expected_message->length = strle...
s(100); timeout_us -= 100; } return false; } static bool prv_wait_programmed(void) { // The datasheet lists the typical NVCM configuration time as 56 ms. // Something is wrong if it takes more than twice that time. int timeout = 100 * 10; // * 100 microseconds while (!gpio_input_read(&ICE40LP->cdone))...
(LOG_LEVEL_DEBUG, "Disabling 4v5 (Display VDDP)")
; set_4V5_power_state(false); psleep(2); if (ICE40LP->use_6v6_rail) { PBL_LOG(LOG_LEVEL_DEBUG, "Disabling 6v6 (Display VDDC)"); set_6V6_power_state(false); psleep(2); } } //! //! Starts a frame. //! void display_start_frame(void) { // The iCE40UL framebuffer FPGA (S4) configuration requires a ...
en(file_name, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); pfs_close(fd); cl_assert(s_watch_file_callback_called_count == 1); // Callback should not get invoked if we close with read access s_watch_file_callback_called_count = 0; fd = pfs_open(file_name, OP_FLAG_READ, 0, 0); cl_assert(fd >= ...
cl_assert(fd >= 0)
; fd = pfs_open("a_test_1", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); fd = pfs_open("b_test_0", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); fd = pfs_open("b_test_1", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); // Get a directory listing with no filtering PFSF...
_set_max_fake_progress(ProgressWindow *window, int16_t max_fake_progress_percent) { window->max_fake_progress_percent = CLIP(max_fake_progress_percent, 0, MAX_PROGRESS_PERCENT); } void progress_window_set_progress(ProgressWindow *window, int16_t progress) { if (window->st...
(sizeof(ProgressWindow))
; progress_window_init(window); return window; } void progress_window_destroy(ProgressWindow *window) { if (window) { progress_window_pop(window); } progress_window_deinit(window); applib_free(window); }
iring_info_out.identity.opaque.opaque_64); cl_assert_equal_i(pairing_info->remote_encryption_info.rand, pairing_info_out.remote_encryption_info.rand); cl_assert_equal_i(pairing_info->remote_encryption_info.ediv, pairing_info_out.remote_encryption_info.ediv); cl_assert_equal...
(NULL, NULL, NULL, NULL)
, false); } void test_shared_prf_storage_v2__ble_pairing(void) { shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_get_ble_pairing_data(NULL, NULL, NULL, NULL), false); char device_name[BT_DEVICE_NAME_BUFFER_SIZE] = "ABCDEFGHIJKLMNOPQRS"; shared_prf_storage_store_ble_pairing_data(&s_pairing...
animation_schedule(property_animation_get_animation(data->info_text_in_animation))
; animation_schedule(property_animation_get_animation(data->info_text_out_animation)); } static void prv_add_prf_layers(GRect pair_text_area, BTPairingUIData *data) { GRect below_pair_text = GRect(0, 38, pair_text_area.size.w, 30); GRect above_pair_text = GRect(0, -34, pair_text_area.size.w, 30); data->pair_t...
rite(BLEGATTErrorSuccess); fake_event_clear_last(); // Nothing to be read before getting the notification: bool has_notification = gatt_client_subscriptions_get_notification_header(GAPLEClientApp, NULL); cl_assert_equal_b(has_notificat...
malloc(GATT_CLIENT_SUBSCRIPTIONS_BUFFER_SIZE)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
text_layer_get_layer(text_layer)
); } static void window_unload(Window *window) { text_layer_destroy(text_layer); } static void init(void) { window = window_create(); window_set_window_handlers(window, (WindowHandlers) { .load = window_load, .unload = window_unload, }); const bool animated = true; window_stack_push(window, animat...
{ 1608, 392, -192}, { 1744, 592, -288}, { 1576, 576, -296}, { 1240, 616, -440}, { 992, 816, -416}, { 928, 856, -360}, { 1080, 968, -320}, { 1080, 760, -288}, { 1200, 696, -240}, { 1328, 616, -216}, { 1472, 400, -120}, { 1440, 256, -96}, { 1512, 208, -88}, // 74 se...
{ 992, 992, -152}, // 79 seconds { 1160, 800, -64}, { 1536, 704, -16}, { 1752, 344, -48}, { 1592, 312, -48}, { 1576, 272, -32}, { 1544, 280, -16}, { 1632, 256, -96}, { 1624, 216, -56}, { 1384, 64, -88}, { 920, -272, -56}, { 720, -512, -160}, { 656, -640, 80}, ...
{ 1128, 256, -264}, { 1336, 336, -280}, { 1560, 384, -280}, { 1808, 600, -368}, { 1472, 960, -344}, { 1152, 824, -528}, { 856, 1288, -368}, { 1088, 928, -112}, { 1080, 688, -192}, { 1176, 584, -120}, // 82 seconds { 1256, 600, -88}, { 1296, 416, -72}, { 1344, 392...
in_use = 0; prompt_send_response("Page:\tFilename\tFile Size\tFile Info\tErase Count\n"); for (uint16_t pg = 0; pg < s_pfs_page_count; pg++) { PageHeader pg_hdr; FileHeader file_hdr; pg_hdr.page_flags = prv_get_page_flags(pg); if (!IS_PAGE_TYPE(pg_hdr.page_flags, PAGE_FLAG_START_PAGE)) { pa...
(s_gc_block.gc_start_page, false)
; } void test_override_last_written_page(uint16_t start_page) { s_test_last_page_written_override = s_last_page_written; } #endif
break; default: PBL_ASSERT(0, "unknown coposting mode %d", compositing_mode); return; } #endif // Backup context color const GColor ctx_color = ctx->draw_state.stroke_color; if (grect_contains_point(&src->bounds, &src_ic)) { // TODO: Optimize further (PBL-15657) // If src_ic is withi...
(src, src_x + i , src_y + j)
x = kernel_zalloc(sizeof(GattClientEventContext)); if (evt_ctx) { s_client_event_ctxs[client] = (GattClientEventContext *)list_prepend(&s_client_event_ctxs[client]->node, &evt_ctx->node); } return evt_ctx; } static BTErrno prv_read(uintptr_t obj_ref, GAPLEClient client, Handl...
{ BTErrno ret_val = BTErrnoOK; bt_lock(); { GAPLEConnection *connection; const uint16_t att_handle = gatt_client_characteristic_get_handle_and_connection(characteristic, &connection); if (!att_handle) { ret_val = BTErrnoInvalidParameter; goto unlock; } ret_val = bt_driver_...
BTErrno gatt_client_op_write_descriptor(BLEDescriptor descriptor, const uint8_t *value, size_t value_length, GAPLEClient client) { return prv_write(descriptor, value, value_length, client, ...
GTextNodeContainer *container) { int hours; int minutes; prv_convert_duration_to_hours_and_minutes(duration_s, &hours, &minutes); const int units_offset_y = fonts_get_font_height(number_font) - fonts_get_font_height(units_font); const int hours_and_minutes_buffer_size = sizeof("00"); if (hours...
{ if (!distance_meter) { return 0; } return ROUND(time_s * health_util_get_distance_factor(), distance_meter); }
/* * 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...
(fmt, args)
; va_end(args); } bool process_manager_compiled_with_legacy2_sdk(void) { return false; } ResAppNum sys_get_current_resource_num(void) { return 0; } const uint8_t * sys_resource_builtin_bytes(ResAppNum app_num, uint32_t resource_id, uint32_t *num_bytes_out) { return ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_spin_until_creset_is(false)
, "CRESET not low during reset"); // CRESET needs to be low for 200 ns to actually reset the FPGA. delay_us(10); #endif gpio_output_set(&ICE40LP->creset, true); // CRESET -> HIGH #if !defined(TARGET_QEMU) PBL_ASSERT(!gpio_input_read(&ICE40LP->cdone), "CDONE not low after reset"); // Wait until CRESET goes...
/* * 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...
health_service_sum_today(HealthMetricStepCount)
; APP_LOG(APP_LOG_LEVEL_INFO, "app: movement event, steps: %"PRIu32"", (uint32_t)steps); // Test getting historical steps time_t day_start = time_start_of_today(); for (int i = 0; i < 7; i++) { steps = health_service_sum(HealthMetricStepCount, day_start, day_start + SECONDS_PER_DAY); ...
ble law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #incl...
("_rocky.on('bar', function(){})")
; cl_assert_equal_i(2, s_prv_api_add__callcount); cl_assert_equal_b(false, rocky_global_has_event_handlers("bar")); cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_global__can_unsubsribe_event_handlers(void) { static const RockyGlobalAPI api = { .add_handler = prv_api_add, .remove_h...
/* * 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_within(0, 0, 0)
; cl_assert_within(1, 1, 1); cl_assert_within(1, 1, 10); cl_assert_within(5, 1, 10); cl_assert_within(10, 1, 10); cl_assert_within(-10, -10, 0); cl_assert_within(-5, -10, 0); cl_assert_within(0, -10, 0); cl_assert_within(0, -10, 0); } void test_clar__test_assert_near(void) { cl_assert_near(0, 0, 0...
, NULL), 7); #endif } // -------------------------------------------------------------------------------------- // Test scheduling a sequence of 2 spawns. Insure that ALL of the primitives in the first spawn, // finish before the primitives from the 2nd spawn start. static void prv_test_sequence_of_spawns(int create_...
(&s_stopped_handler_calls, spawn_a)
->fire_order); uint32_t first_fire_b = prv_last_handler_entry(&s_started_handler_calls, b0)->fire_order; first_fire_b = MIN(first_fire_b, prv_last_handler_entry(&s_started_handler_calls, b1)->fire_order); first_fire_b = MIN(first_fire_b, prv_last_handler_entry(&s_started_h...
/* * 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...
pcTaskGetTaskName(task)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ GRect bounds = layer_get_bounds(layer); graphics_context_set_text_color(ctx, GColorBlack); __profiler_start(); for (int i = 0; i < ITERATIONS; ++i) { graphics_draw_text(ctx, TEXT, fonts_get_system_font(FONT_KEY_GOTHIC_14), bounds, GTextOverflowModeWordWrap, GTextAlignmentLeft, ...
t data[] = { 42 }; const size_t num_data = ARRAY_LENGTH(data); const StatsBasicOp op = (StatsBasicOp_Sum | StatsBasicOp_Average | StatsBasicOp_Min | StatsBasicOp_Max | StatsBasicOp_Count | StatsBasicOp_Consecutive | StatsBasicOp_ConsecutiveFirst | StatsBasicOp_Median); struct { int32...
.answer = 20, }, { // Only one value, return that value .values = {1}, .weights = {100}, .num_values = 1, .answer = 1, }, { // Two values, equal weight. Return the lower of the two .values = {1, 2}, .weights = {1, 1}, .num_values = 2, .an...
ds, is_highlighted, node); // If we should launch an app after this render, push a callback to do that on the app task if (launcher_menu_layer->app_to_launch_after_next_render != INSTALL_ID_INVALID) { const AppInstallId app_to_launch_install_id = l...
menu_layer_init(menu_layer, &menu_layer_frame)
ert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0); cl_assert(prv_last_handler_entry(&s_stopped_handler_calls, a)->fire_order < prv_last_handler_entry(&s_started_handler_calls, b)->fire_order); // F...
(&s_started_handler_calls, b)
, -208}, { 1248, 144, -56}, { 888, 224, -88}, { 736, 264, -88}, { 656, 288, -48}, { 680, 344, -32}, { 744, 376, -32}, { 864, 368, -8}, { 1072, 416, -24}, { 1368, 496, -48}, { 1376, 408, 136}, { 1816, 608, -8}, { 1280, 584, -64}, { 1200, 376, 8}, { 1400, 368, -16},...
{ 1240, 456, -352}, { 1304, 432, -368}, { 1304, 520, -192}, { 1184, 280, 32}, { 952, 280, 0}, { 792, 280, -32}, { 696, 288, -16}, { 704, 312, -32}, { 824, 400, -56}, { 920, 416, -48}, { 1056, 416, -16}, { 1328, 440, -72}, { 1504, 336, 104}, { 1736, 432, 32}, {...
return __jerryRefs.ref(Module.Pointer_stringify($0, $1)); }, str_p, str_size); } jerry_value_t jerry_create_undefined(void) { return JERRY_CREATE_VALUE(undefined); } //////////////////////////////////////////////////////////////////////////////// // General API Functions of JS Objects /////////////////////////...
jerry_value_is_string(obj_val)
) { return TYPE_ERROR_ARG; } if ((pdp->is_writable_defined || pdp->is_value_defined) && (pdp->is_get_defined || pdp->is_set_defined)) { return TYPE_ERROR_ARG; } if (pdp->is_get_defined && !jerry_value_is_function(pdp->getter)) { return TYPE_ERROR_ARG; } if (pdp->is_set_defined && !jerry_va...
Once; scope <= HealthServiceTimeScopeDaily; scope++) { // Figure out the expected value HealthServiceStats *stats = NULL; char *scope_str; switch (scope) { case HealthServiceTimeScopeOnce: stats = &yesterday_stats; scope_str = "once"; break; ...
for (unsigned i = 0; i < num_minutes_per_call; i++) { min_value = MIN(min_value, value); max_value = MAX(max_value, value); sum += value; count++; s_sys_activity_get_minute_history_values.out[1].records[i].heart_rate_bpm = value; value++; if (value > 200) { value = 50; } }
int32_t avg_value = ROUND(sum, count); // Test each aggregation for (HealthAggregation agg = HealthAggregationAvg; agg <= HealthAggregationMax; agg++) { s_sys_activity_get_minute_history_values.stage = 0; if (agg == HealthAggregationMin) { PBL_LOG(LOG_LEVEL_DEBUG, "foo"); } HealthValue re...
* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distribute...
if (!prv_send_vt(vt_buf, vector_table_size)) { PBL_LOG(LOG_LEVEL_WARNING, "Failed to send VT!"); goto cleanup; }
success = true; cleanup: kernel_free(vt_buf); return success; } static bool prv_transfer_main_image_code_and_data( uint32_t image_size, ObjectBinInfo *info) { bool success = false; int vt_and_info_blob_size = info->vector_table_size + sizeof(ObjectBinInfo); image_size -= vt_and_info_blob_size; co...
gging.h" #include "system/passert.h" #include "util/crc8.h" #include <string.h> #include <time.h> static status_t bootup_check(SettingsFile *file); static void compute_stats(SettingsFile *file); static bool file_hdr_is_uninitialized(SettingsFileHeader *file_hdr) { return (file_hdr->magic == 0xffffffff) && (file_hd...
settings_raw_iter_deinit(&file->iter)
; kernel_free(file->name); file->name = NULL; } static int record_size(SettingsRecordHeader *hdr) { return sizeof(*hdr) + hdr->key_len + hdr->val_len; } // Flags are stored in flash the inverse of how you might normally expect- a // zero denotes that the flag is set, a 1 means it is not. This is because our // ...
sert_equal_i(prv_count_animations(), 0); } // -------------------------------------------------------------------------------------- // Test setting a play count of 0 void test_animation__basic_play_count_0(void) { #ifdef TEST_INCLUDE_BASIC const int duration_a = 300; Animation *a = prv_create_test_animation();...
(start_ms + duration_a - 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_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0...
GRect(2, 2, 28, 20), 4); } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, false); graphics_draw_round_rect(ctx, &GRect(2, 2, 28, 20), 4); } void clear_layer_update_callback(Layer* me, GContext* ctx) { grap...
(&layer, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_across_ny_offset_layer.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__clear(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 32, 24)); layer_set_update_pro...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return false; }
bool bt_driver_classic_copy_connected_device_name(char nm[BT_DEVICE_NAME_BUFFER_SIZE]) { return false; }
is_timeout = true; } else { is_timeout = (xSemaphoreTake(s_retry_semph, remaining_ticks) == pdFALSE); } bool initialized = prv_check_initialized(); if (is_timeout || !initialized) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to enqueue HC request (endpoint:%d, command:%"PRIu8")", messag...
prv_unlock()
; if (response) { s_num_consec_request_failures = 0; } else { s_num_consec_request_failures++; PBL_LOG(LOG_LEVEL_ERROR, "HC request timed out (endpoint:%d, command:%"PRIu8")", end_id, cmd_id); if (prv_check_initialized() && (s_num_consec_request_failures >= NUM_CONSEC_FAILURES)) { ...
/* * 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...
(card_data->zones, &card_data->num_zones, &card_data->weekly_max, false /* format hours and minutes */, true /* show crown */, ...
; const size_t buffer_len = 32; HealthDetailHeading *heading = &card_data->headings[card_data->num_headings++]; *heading = (HealthDetailHeading) { .primary_label = (char *)i18n_get("CALORIES", card_data), .primary_value = app_zalloc_check(buffer_len), .secondary_label = (char *)i18n_get("DISTANCE",...
{ 1144, 296, -408}, { 1016, 288, -456}, { 856, 264, -480}, { 752, 216, -392}, { 856, 216, -368}, { 1032, 216, -448}, { 944, 160, -384}, { 872, 96, -320}, { 808, 88, -344}, { 752, 112, -416}, { 704, 112, -416}, { 704, 120, -480}, { 696, 128, -544}, { 696, 136, -552}, ...
{ 1056, -320, 256}, { 936, -288, 184}, { 992, -216, 48}, { 976, -152, 40}, { 936, -120, 16}, { 1032, -56, -64}, { 1088, -24, -96}, // 32 seconds { 1040, -64, -152}, { 960, -56, -104}, { 984, -16, -136}, { 1016, 40, -120}, { 1184, 88, -72}, { 1224, 40, -80}, { ...
{ 888, -72, -184}, { 896, -96, -168}, { 992, 24, -152}, { 1040, 88, -160}, { 1040, 56, -160}, { 1032, -40, -184}, { 992, -56, -136}, { 1024, -40, -200}, { 1024, -16, -208}, { 992, 8, -176}, { 1048, -24, -208}, { 1000, -24, -232}, { 992, -72, -272}, { 1056, -192, ...
/* * 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...
strncpy(_path, base, sizeof(_path))
; if (_path[root_len - 1] != '/') _path[root_len++] = '/'; if (fixture_name[0] == '/') fixture_name++; strncpy(_path + root_len, fixture_name, sizeof(_path) - root_len); return _path; } #ifdef CLAR_FIXTURE_PATH const char *cl_fixture(const char *fixture_name) { return fixture_path(CLAR_FIXTURE_PATH, f...
(bt_dev_name, false)
; (*out_menu_items)[0].subtitle = bt_dev_name; // Poke in the serial number buffer_size = MFG_SERIAL_NUMBER_SIZE + 1; char *device_serial = app_malloc(buffer_size); mfg_info_get_serialnumber(device_serial, buffer_size); (*out_menu_items)[1].subtitle = device_serial; // We've now populated out_menu_ite...
// items with long duration static TimelineItem s_long_items[] = { { .header = { .id = {0xaa}, .timestamp = 10000, .duration = 30, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, } }, { .header = { .id = {0xbb}, .timestamp = 12000, ...
fake_settings_file_reset()
; fake_pbl_malloc_clear_tracking(); } // Tests /////////////////////////// void test_timeline__all_forwards(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 // check first timeline_init(&head); cl_assert_equal_...
L_LOG(LOG_LEVEL_ERROR, "Error waiting for header response"); return false; } if (c != 0x06) { PBL_LOG(LOG_LEVEL_ERROR, "Bootrom did not accept header (0x%x)", c); return false; } return true; } static bool prv_load_second_stage_bootloader(void) { bool success = true; // Find the image we are g...
(LOG_LEVEL_INFO, "BLE Second Stage Bootloader loaded in %d attempts!", retries)
; return true; } } return false; }
buffer, buf_end); } else { group_type_element_attribtue_list = prv_deserialize_address( &((AddressList *)group_ptr)->addresses[i], &cursor, payload_end, buffer, buf_end); } if (!attribute_deserialize_list((char**)&buffer, (char *)buf_end, &cursor, ...
if (type == AttributeGroupType_Action) { num_group_type_elements = ((TimelineItemActionGroup *)group_ptr)->num_actions; } else { num_group_type_elements = ((AddressList *)group_ptr)->num_addresses; }
for (int i = 0; i < num_group_type_elements; i++) { AttributeList *group_type_element_attribtue_list; if (type == AttributeGroupType_Action) { group_type_element_attribtue_list = prv_serialize_action( &((TimelineItemActionGroup *)group_ptr)->actions[i], &buffer); } else { group_typ...
cl_assert(pfs_close(fd) == S_SUCCESS); // delete every few files and a bunch of pages near the end if (((i & 0x1) == 0) || ((i > ((num_pages() * 7) / 10)) && (i < ((num_pages() * 8) / 10)))) { cl_assert(pfs_remove(file_small) == S_SUCCESS); } } // We limit this number because we would...
(rv == (len - 5))
; rv = pfs_seek(fd, -6, FSeekCur); cl_assert(rv == E_RANGE); rv = pfs_seek(fd, 0, FSeekSet); cl_assert(rv == 0); rv = pfs_seek(fd, len + 1, FSeekCur); cl_assert(rv == E_RANGE); rv = pfs_seek(fd, len + 1, FSeekSet); cl_assert(rv == E_RANGE); rv = pfs_seek(fd, -1, FSeekSet); cl_assert(rv == E_RANGE)...
/* * 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...
atoi(id_str)
; if (id == 0) { prompt_send_response("invalid app number"); return; } AppInstallEntry entry; if (!app_install_get_entry_for_install_id(id, &entry)) { prompt_send_response("failed to get entry"); return; } // should delete from blob db and fire off an event to AppInstallManager that does t...
icense at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific la...
cl_assert_equal_s(str, "abc +42b")
; //---------------------------------------------------- pbl_snprintf(str, STR_SIZE, "abc %lf%s", "a", 1.0, "b"); cl_assert_equal_s(str, fp_msg); pbl_snprintf(str, STR_SIZE, "abc %ld%s", 42, "b"); cl_assert_equal_s(str, "abc 42b"); //---------------------------------------------------- pbl_snprintf(str,...
efs_db_read, .del = watch_app_prefs_db_delete, .flush = watch_app_prefs_db_flush, #else // Disabled on tintin for code savings .disabled = true, #endif }, [BlobDBIdHealth] = { #if CAPABILITY_HAS_HEALTH_TRACKING .init = health_db_init, .insert = health_db_insert, .get_len = health_db_get_...
{ status_t rv = db->mark_synced(key, key_len); // TODO event? return rv; }
return E_INVALID_OPERATION; }
er_get_num_sections, .get_num_rows = prv_day_picker_get_num_rows, .get_cell_height = prv_day_picker_get_cell_height, .draw_row = prv_day_picker_draw_row, .select_click = prv_day_picker_handle_selection, }); menu_layer_set_highlight_colors(&data->day_picker_menu_layer, ...
menu_cell_basic_draw_icon_right(ctx, cell_layer, cell_text, NULL, ptr_bitmap)
; } } static bool prv_is_custom_day_scheduled(AlarmEditorData *data) { for (unsigned int i = 0; i < sizeof(data->scheduled_days); i++) { if (data->scheduled_days[i]) { return true; } } return false; } static void prv_custom_day_picker_handle_selection(MenuLayer *menu_layer, MenuIndex *cell_index...
unce_timer; static bool s_default_connection_state; static unsigned int s_event_count = 0; static PebbleEvent s_cached_event; static Transport *s_transport; static CommSession *s_session; bool remote_is_connected(void) { return s_default_connection_state; } void event_put(PebbleEvent* event) { s_event_count++; ...
check_connected()
; // No event put cl_assert_equal_i(s_event_count, 0); }
kerboard pattern setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_o...
GPoint(100, 90)
, 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(100, 95), 5); // T facing left - odd vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(131, 91), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(131, 96), 5); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_dot...
basic_glance_insert_and_read(void) { const AppGlance glance = (AppGlance) { .num_slices = 2, .slices = { { .expiration_time = 1464734484, // (Tue, 31 May 2016 22:41:24 GMT) .type = AppGlanceSliceType_IconAndSubtitle, .icon_and_subtitle = { .icon_resource_id = RESOURCE_I...
test_app_glance_db__basic_glance_insert_and_read()
; // Let some time pass so the creation time of this next glance insertion is newer rtc_set_time(rtc_get_time() + 10); // Try inserting an empty glance; this should succeed and clear the glance AppGlance empty_glance = {}; cl_assert_equal_i(app_glance_db_insert_glance(&APP_GLANCE_TEST_UUID, &empty_glance), ...
/* * 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_set_zone(&card_data->zones[card_data->num_zones++], zone3_minutes, &max_progress, buffer_size, i18n_noop("Performance"), card_data)
; HealthDetailHeading *heading = &card_data->headings[card_data->num_headings++]; *heading = (HealthDetailHeading) { /// Resting HR .primary_label = (char *)i18n_get("TIME IN ZONES", card_data), .primary_value = app_zalloc_check(buffer_size), .fill_color = GColorWhite, .outline_color = PBL_IF_...
prv_shake_remove_subscriber_cb); event_service_init(PEBBLE_ACCEL_DOUBLE_TAP_EVENT, &prv_double_tap_add_subscriber_cb, &prv_double_tap_remove_subscriber_cb); // we always listen for motion events to decide whether or not to enable the backlight // TODO: KernelMain could probably subscribe to the motion ser...
{ case ACCEL_SAMPLING_10HZ: case ACCEL_SAMPLING_25HZ: case ACCEL_SAMPLING_50HZ: case ACCEL_SAMPLING_100HZ: break; default: return -1; }
mutex_lock_recursive(s_accel_manager_mutex); state->sampling_interval_us = (US_PER_SECOND / rate); prv_update_driver_config(); mutex_unlock_recursive(s_accel_manager_mutex); // TODO: doesn't look like our API specifies what this routine should return. return 0; } uint32_t accel_manager_set_jitterfree_...
ple_dialog_push(simple_dialog, prv_get_window_stack()); } // ---------------------------------------------------------------------------------------------- //! Dismiss confirm dialog static void prv_show_dismiss_confirm_dialog(void) { SimpleDialog *simple_dialog = simple_dialog_create("AlarmSnooze"); Dialog *dial...
new_timer_start(s_alarm_popup_data->vibe_timer, vibe_repeat_interval_ms, prv_vibe, NULL, TIMER_START_FLAG_REPEATING)
; } // ---------------------------------------------------------------------------------------------- //! Click Handler static void prv_dismiss_click_handler(ClickRecognizerRef recognizer, void *data) { alarm_dismiss_alarm(); prv_show_dismiss_confirm_dialog(); actionable_dialog_pop(s_alarm_popup_data->alarm_popu...
getting more // of these callbacks scheduled. if (is_callback) { session->is_send_next_call_pending = false; } // Kick the transport to send out the next bytes it has prepared. It's possible these bytes // are not in the send queue (i.e PPoGATT Acks) so we leave it up to the transport to ch...
if (!session) { return ctx.fallback_session; }
return session; } static bool prv_find_session_is_system_filter(ListNode *found_node, void *data) { CommSession *session = (CommSession *) found_node; const TransportDestination destination = session->destination; return (destination == TransportDestinationSystem || destination == TransportDestinationHybrid) ...
ed, 1); } // --------------------------------------------------------------------------------------- // Make sure that if you wake up for a short period of time, we'll move the sleep pin void test_activity_insights__sleep_summary_merge(void) { prv_set_sleep_history_avg(); activity_insights_init(rtc_get_time()); ...
{ time_t now = mktime(&s_init_time_tm); prv_set_activation_time(now); activity_insights_process_minute_data(now); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); now += SECONDS_PER_DAY; // Jan 2 @ 10:00am rtc_set_time(now); activity_insights_process_minute_data(now);...
// --------------------------------------------------------------------------------------- void test_activity_insights__activation_delay_insights_fifteen_interval_trigger(void) { time_t now = mktime(&s_init_time_tm); prv_set_activation_time(now); activity_insights_process_minute_data(now); cl_assert_equal_i(...