prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
{ 1528, 504, -472}, { 1752, 848, -672}, { 1768, 800, -840}, { 1528, 672, -368}, { 1400, 720, -312}, { 1224, 848, -248}, { 992, 632, -288}, { 1056, 808, -48}, { 928, 912, -64}, { 720, 1240, -8}, { 744, 776, -8}, { 728, 1080, -64}, { 1144, 784, -8}, { 1392, 768, 0},...
{ 1728, 288, -152}, { 1552, 208, -152}, { 1496, 248, -216}, { 1224, -144, -8}, { 992, -376, -16}, { 808, -680, 64}, { 896, 56, -424}, { 1208, -216, 24}, { 1456, 320, -120}, // 68 seconds { 1232, 232, -344}, { 1344, 408, -232}, { 1592, 584, -232}, { 1584, 800, -39...
qual_i(value, 0xff); cl_assert_equal_b(has_more, false); } // ------------------------------------------------------------------------------------------------- // gatt_client_subscriptions_cleanup_by_client void test_gatt_client_subscriptions__cleanup_by_client(void) { fake_kernel_malloc_mark(); // Subscribe a...
fake_kernel_malloc_mark_assert_equal()
; } // ------------------------------------------------------------------------------------------------- // TODO: Write tests that exercise applib/bluetooth/ble_client.c
r_client(client)), .bluetooth = { .le = { .gatt_client = { .subtype = subtype, .object_ref = object_ref, .gatt_error = gatt_error, .value_length = value_length, }, }, }, }; event_put(&e); } static void prv_internal_...
bt_unlock()
; } typedef uint16_t (*HandleAndConnectionGetter)(uintptr_t obj_ref, GAPLEConnection **connection_out); static GattClientEventContext *prv_create_event_context(GAPLEClient client) { GattClientEventContext *evt_ctx = kernel_zalloc(sizeof(GattClientEventContext)); if (e...
ient/kernel_le_client.h" #include "comm/bt_lock.h" #include "console/prompt.h" #include "kernel/pbl_malloc.h" #include "os/mutex.h" #include "services/common/analytics/analytics.h" #include "services/common/bluetooth/pairability.h" #include "services/common/bluetooth/local_addr.h" #include "services/common/shared_prf_s...
mutex_lock(s_db_mutex)
; } static void prv_unlock(void) { mutex_unlock(s_db_mutex); } static bool prv_bt_persistent_storage_get_ble_smpairinginfo_by_id( BTBondingID bonding, SMPairingInfo *info_out, char *name_out, bool *requires_address_pinning, uint8_t *flags); static void prv_update_bondings(BTBondingID id, BtPersistBondingTy...
tack__push_during_window_unload(void) { Window *window = window_create(); window_set_window_handlers(window, &(WindowHandlers){ .load = prv_window_load, .unload = prv_push_window_unload }); WindowStack *stack = app_state_get_window_stack(); // Switch to the app state to push a window stub_pebble_...
animation_is_scheduled(first)
); window_stack_push(stack, window2, true); Animation *second = fake_animation_get_next_animation(first); cl_assert(!animation_is_scheduled(first)); cl_assert(animation_is_scheduled(second)); }
-776}, { 472, 376, -776}, { 472, 376, -768}, { 480, 376, -776}, { 472, 384, -768}, { 472, 368, -760}, { 464, 392, -776}, { 480, 376, -760}, { 480, 392, -760}, { 480, 384, -768}, { 472, 368, -768}, { 472, 368, -776}, { 464, 376, -776}, { 480, 376, -760}, { 488, 38...
{ 480, 400, -768}, { 472, 384, -760}, { 480, 392, -760}, { 480, 384, -768}, { 472, 376, -768}, // 102 seconds { 496, 384, -760}, { 472, 376, -776}, { 456, 432, -744}, { 496, 336, -784}, { 456, 368, -760}, { 472, 376, -736}, { 488, 416, -776}, { 472, 384, -752}, ...
{ 488, 384, -760}, { 480, 392, -760}, { 488, 384, -760}, { 496, 400, -760}, { 480, 368, -760}, { 488, 400, -760}, { 480, 376, -768}, { 472, 384, -768}, { 488, 392, -752}, { 480, 392, -760}, { 480, 384, -760}, { 488, 392, -768}, { 472, 384, -768}, // 105 seconds ...
// 102 seconds { -1400, 536, 120}, { -1560, 416, 224}, { -1416, -56, 320}, { -1224, 168, 240}, { -864, 216, 264}, { -656, 168, 168}, { -728, 120, 240}, { -824, 32, 184}, { -880, -16, 280}, { -1016, 16, 304}, { -1464, 88, 528}, { -1296, -40, 712}, { -1232, 312, 600}, ...
{ -1448, 256, 320}, { -1072, 304, 384}, { -872, 272, 280}, { -928, 232, 224}, { -976, 88, 256}, { -1008, 8, 312}, { -936, -64, 392}, { -1088, -24, 456}, { -1168, -120, 680}, { -1432, -48, 648}, { -1216, -168, 720}, { -1032, 536, 368}, // 108 seconds { -1272, 368, ...
{ 184, 48, 1088}, { 184, 64, 1088}, { 176, 72, 1072}, { 272, 64, 920}, { 216, 80, 1024}, { 192, 192, 928}, { 192, -48, 1048}, { 160, 24, 1088}, { 192, -64, 1072}, { 184, -80, 1080}, { 200, -136, 1024}, { 176, -48, 1000}, { 168, 24, 960}, { 152, -128, 1008}, {...
ing.h> typedef struct { Window low_power_window; TextLayer low_power_time_layer; KinoLayer low_power_kino_layer; char time_text[6]; } LowPowerFaceData; static LowPowerFaceData *s_low_power_data; static void prv_minute_tick(struct tm *tick_time, TimeUnits units_changed) { char *time_format; if (clock_is_...
{ static const PebbleProcessMdSystem s_app_md = { .common = { // UUID: e9475244-5bbe-4e0f-a637-a218af4c3110 .uuid = {0xe9, 0x47, 0x52, 0x44, 0x5b, 0xbe, 0x4e, 0x0f, 0xa6, 0x37, 0xa2, 0x18, 0xaf, 0x4c, 0x31, 0x10}, .main_func = low_power_main, .process_type = ProcessTypeWatchface, .vi...
(); } void test_music_endpoint__ignore_now_playing_while_not_connected(void) { // Don't connect app, but receive Now Playing info. Should be ignored: prv_receive_and_assert_all(false /* expect_is_handled */); } void test_music_endpoint__ignore_now_playing_while_other_server_connected(void) { // Another music se...
{ // Android app connects: prv_receive_app_info_event(true /* is_android */); // music_is_progress_reporting_supported() relies on a valid track duration prv_receive_and_assert_all(true /* expect_is_handled*/); cl_assert_equal_b(music_is_playback_state_reporting_supported(), true); cl_assert_equal_b(music_...
eturn s_comm_airplane_mode_on; } bool bt_ctl_is_bluetooth_active(void) { if (s_comm_enabled) { if (s_comm_override == BtCtlModeOverrideRun) { return true; } else if (s_comm_override == BtCtlModeOverrideNone && !s_comm_airplane_mode_on) { return true; } } return false; } bool bt_ctl_is_bl...
mutex_unlock(s_comm_state_change_mutex)
; prv_comm_state_change(NULL); } static void prv_track_quick_airplane_mode_toggles(bool is_airplane_mode_currently_on) { // Track when coming out of airplane mode and we've gone into airplane mode less than 30 secs ago: static RtcTicks s_airplane_mode_last_toggle_ticks; const RtcTicks now_ticks = rtc_get_ticks...
find_all = false, }; status_t rv = settings_file_each(&storage->file, prv_each_find_children, &info); if (rv) { goto cleanup; } if (info.num_children) { rv = S_SUCCESS; } else { rv = S_NO_MORE_ITEMS; } cleanup: mutex_unlock(storage->mutex); return rv == S_SUCCESS; } status_t timeline_it...
{ return E_INVALID_ARGUMENT; }
---------------------- //! Semaphore that is signaled when data has been consumed by the transport, //! when it calls to comm_default_kernel_sender_consume(). This semaphore is used to block calls to //! comm_session_send_buffer_begin_write() in case there is not enough space left. //! @note This semaphore *must never*...
MIN(length_after_offset, length)
; memcpy(data_out, prv_get_read_pointer(sb) + start_offset, length_to_copy); return length_to_copy; } static size_t prv_send_job_impl_get_read_pointer(const SessionSendQueueJob *send_job, const uint8_t **data_out) { SendBuffer *sb = (SendBuffer *)send_job; *data...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ APP_LOG(APP_LOG_LEVEL_ERROR, "no further info."); }
} void jerry_set_object_field(jerry_value_t object, const char *field, jerry_value_t value) { JS_VAR prop_name = jerry_create_string((jerry_char_t *)field); JS_UNUSED_VAL = jerry_set_property(object, prop_name, value); } jerry_value_t jerry_get_object_field(jerry_value_t object, const char* field) { JS_VAR 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...
(num_intervals, 1)
; cl_assert_equal_i(average_ms, 3000000000); fake_rtc_increment_time_ms(3000000000); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 2); cl_assert_equal_i(average_ms, 3000000000); fake_rtc_increment_time_ms(3000000000); int...
t Animation & Inactivity Timer ///////////////////////////////////// T_STATIC void prv_init_peek_layer(TimelineAppData *data); static void prv_launch_watchface(void *data) { #ifdef SHELL_SDK // FIXME: We don't want to show off our unfinished animations in the sdkshell watchface_launch_default(NULL); #else #if PL...
(&data->timeline_layer)
; if (!first_timeline_layout) { return NULL; } prv_init_peek_layer(data); GRect icon_from; layer_get_global_frame((Layer *)&first_timeline_layout->icon_layer, &icon_from); peek_layer_set_icon_with_size(peek_layer, &first_timeline_layout->icon_info, Time...
/* * 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...
(without_newlines, string_out)
ou may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See th...
write_new_firmware( flash_address + sizeof(FirmwareDescription), firmware_description.firmware_length)
; if (!check_firmware_crc(&firmware_description)) { dbgserial_putstr( "Our internal flash contents are bad (checksum failed)! " "This is really bad!"); return UPDATE_FW_ERROR_MICRO_FLASH_MANGLED; } return UPDATE_FW_SUCCESS; } void check_update_fw(void) { if (!boot_bit_test(BOOT_BIT_NE...
/* * 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...
(option_menu, ctx, cell_layer, text_frame, s_strings[row], selected, context)
; } static void prv_menu_unload(OptionMenu *option_menu, void *context) { option_menu_destroy(option_menu); } static void prv_init(void) { OptionMenu *option_menu = option_menu_create(); const OptionMenuConfig config = { .title = "Option Menu", .choice = OPTION_MENU_CHOICE_NONE, .status_colors = { ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
((Layer *)item_layer->timeline_layout, &bounds)
; } } /////////////////////////////////////////////////////////// // Scrolling related functions /////////////////////////////////////////////////////////// static int16_t prv_get_first_scroll_offset(TimelineItemLayer *item_layer) { if (!item_layer->timeline_layout->has_page_break) { return 0; } return MA...
t_nodes_all_day(nodes, header, num_nodes); } else { prv_set_nodes(nodes, header, num_nodes); } for (int i = 0; i < num_nodes; i++) { *list_head = (TimelineNode *)list_sorted_add((ListNode *)*list_head, (ListNode *)nodes[i], prv_time_comparator, true); } } static bool prv_each(SettingsFile *file,...
{ timeline_iter_state->node = (TimelineNode *)timeline_iter_state->node->node.next; if (timeline_iter_state->node == NULL) { timeline_iter_state->node = orig; return false; } }
while (!prv_show_event(timeline_iter_state->node, timeline_iter_state->start_time, timeline_iter_state->midnight, timeline_iter_state->direction, timeline_iter_state->show_all_day_events) || !timeline_exists(&timeline_iter_state->node->id)); timeline_item_free_allocated_buffer(&timeline_iter_state...
MenuIndex *new_index, MenuIndex old_index, void *callback_context) { if (new_index->row == 1) { new_index->row = 2; } if (new_index->row == 3) { new_index->row = 4; } } void test_menu_layer__center_focused_handles_skipped_rows(void) { Me...
menu_layer_set_selected_next(&l, false, MenuRowAlignNone, true)
; // these values are unchanged until the animation updates them cl_assert_equal_i(2, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(2 * basic_cell_height, l.selection.y); cl_assert_equal_i(initial_scroll_offset - 2 * basic_cell_height, l.scroll_layer.content_sublayer.bounds.origi...
mware which doesn't enter standby when the enable pin is high, // the board will need to be power-cycled (entering standby/shutdown // is sufficient) in order to get force-flashing to succeed. gpio_output_set(&dev->en_gpio, false); psleep(50); gpio_output_set(&dev->en_gpio, true); psleep(20); gpio_output_...
strlen(erase_magic_record)
) && prv_wait_for_loader_ready(HRM) && prv_write_register_block(HRM, ADDR_LOADER_STATUS, eof_record, strlen(eof_record)) && prv_wait_for_loader_ready(HRM); gpio_output_set(&HRM->en_gpio, false); mutex_unlock(HRM->state->lo...
b_tuple = dict_read_next(b); } if (b_tuple) { cl_fail("Dictionary `B` contained more tuples than dictionary `A`."); } else if (a_tuple) { cl_fail("Dictionary `A` contained more tuples than dictionary `B`."); } } // Callbacks //////////////////////////////////// static void prv_out_sent_callback(Dictio...
cl_assert_equal_i(message->command, CMD_NACK)
; } else { cl_assert(false); } } static void prv_no_reply_callback(uint16_t endpoint_id, const uint8_t* data, unsigned int length) { } // Overrides /////////////////////////////////// bool sys_app_pp_has_capability(CommSessionCapability capability) { return true; } static int s_sys_psleep_last_mill...
alytics/analytics_metric.h" #include "services/common/analytics/analytics_logging.h" #include "system/logging.h" #include "system/passert.h" #include "kernel/pbl_malloc.h" #include "util/math.h" #include <inttypes.h> #include <stdio.h> uint32_t analytics_heartbeat_kind_data_size(AnalyticsHeartbeatKind kind) { Anal...
{ uint8_t *location = prv_heartbeat_get_location(heartbeat, metric); prv_location_set_value(location, val, analytics_metric_element_type(metric)); }
void analytics_heartbeat_set_array(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric, uint32_t index, int64_t val) { uint8_t *location = prv_heartbeat_get_array_location(heartbeat, metric, index); prv_location_set_value(location, val, analytics_metric_element_type(metric)); } void analytics_heartbeat_set_ent...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_state_get_ble_app_state()
; if (!ble_app_state->scan_handler) { return; } // Use the same buffer size as the kernel itself: uint8_t *buffer = (uint8_t *) applib_malloc(GAP_LE_SCAN_REPORTS_BUFFER_SIZE); if (!buffer) { APP_LOG(LOG_LEVEL_ERROR, "Need %u bytes of heap for ble_scan_start()", GAP_LE_SCAN_REPORTS_BUFFER_...
e = malloc(sizeof(Write)); uint8_t *buffer; if (value_length) { cl_assert(value); buffer = malloc(value_length); memcpy(buffer, value, value_length); } else { cl_assert_equal_p(value, NULL); buffer = NULL; } *write = (const Write) { .characteristic = characteristic, .client = clien...
cl_assert_equal_i(client, s_write_head->client)
; cl_assert_equal_b(is_response_required, s_write_head->is_response_required); } else { fake_gatt_client_op_assert_write_failed(); } Write *old_write = s_write_head; s_write_head = (Write *) list_pop_head(&s_write_head->node); free(old_write->value); free(old_write); }
a_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 11); graphics...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw5_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 5); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, fals...
nt32_t after_free = t_data[16].size + t_data[24].size + t_data[41].size + t_data[46].size; s_test_id_ql_up = 17; s_test_id_ql_down = 25; s_test_id_watchface = 42; s_test_id_worker = 47; // test removing all and more bytes prv_cleanup(); to_free = SIZE_SUM - after_free; before_size = app_cache_get_size...
(filename)
; } // finally, make sure the 'standard' files are all there for (uint32_t i = 0; i < ARRAY_LENGTH(descriptions); ++i) { prv_check_file_exists(descriptions[i].name); } } void test_app_cache__purge_orphaned_files_no_apps(void) { // make sure nothing goes awry if there are no installed apps // create som...
/* * 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_set_text_alignment(&data->text_layer_2, GTextAlignmentCenter)
; // Add second text layer to scroll layer (required to get correct content size based on location) scroll_layer_add_child(&data->scroll_layer, text_layer_get_layer(&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_co...
(pg); } } // A full filesystem is bad for wear leveling since the same sectors will // wind up getting written repeatedly. We should really be enforcing this // within pfs_open but for now we will just let external callers use this // routine before allocating large files uint32_t tot_capacity = (pfs_g...
prompt_send_response("malloc error")
; goto cleanup; } memset(bytes, 0x00, num_bytes); if ((num_bytes = pfs_read(fd, bytes, num_bytes)) < 0) { prompt_send_response_fmt(buf, sizeof(buf), "rd err: %d", num_bytes); goto cleanup; } PBL_HEXDUMP_D_SERIAL(LOG_LEVEL_DEBUG, bytes, num_bytes); prompt_send_response("DONE"); cleanup: kern...
ent_queue_get_event(1, 0); cl_assert_equal_p(touch_event, NULL); // Test second touch touch_handle_update(1, TouchState_FingerDown, &GPoint(1, 13), 5, 3686401); event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT); cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvai...
(0, TouchState_FingerDown, GPointZero, 3686380, 0)
; touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400); TouchEvent *touch_event = touch_event_queue_get_event(0, 0); prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(10, 10), 20, 5, true); touch_handle_update(0, TouchS...
pmic_read_chip_info(uint8_t *chip_id, uint8_t *chip_revision, uint8_t *buck1_vset) { prv_read_register(PmicRegisters_CHIP_ID, chip_id); prv_read_register(PmicRegisters_CHIP_REV, chip_revision); prv_read_register(PmicRegisters_BUCK1_VSET, buck1_vset); } static void prv_clear_any_pending_interrupts(void) { // Re...
prv_set_mon_config(&MON_CONFIG[i])
; ADCVoltageMonitorReading reading = battery_read_voltage_monitor(); uint32_t millivolts = battery_convert_reading_to_millivolts(reading, MON_CONFIG[i].ratio, 1); char buffer[40]; prompt_send_response_fmt(buffer, sizeof(buffer), "%-15s: %"PRIu32" mV", MON_CONFIG[i].name, mi...
EX(0xdeb887)}, // {"cadetblue", GColorARGBFromHEX(0x5f9ea0)}, inconsistent with Pebble color {"chartreuse", GColorARGB8FromHEX(0x7fff00)}, {"chocolate", GColorARGB8FromHEX(0xd2691e)}, {"coral", GColorARGB8FromHEX(0xff7f50)}, {"cornflowerblue", GColorARGB8FromHEX(0x6495ed)}, {"cornsilk", GColorARGB8FromHEX(0x...
GColorARGB8FromHEX(0xffe4e1)
}, {"moccasin", GColorARGB8FromHEX(0xffe4b5)}, {"navajowhite", GColorARGB8FromHEX(0xffdead)}, {"oldlace", GColorARGB8FromHEX(0xfdf5e6)}, {"olivedrab", GColorARGB8FromHEX(0x6b8e23)}, {"orangered", GColorARGB8FromHEX(0xff4500)}, {"orchid", GColorARGB8FromHEX(0xda70d6)}, {"palegoldenrod", GColorARGB8FromHEX(...
_UNIT | DAY_UNIT | MONTH_UNIT | YEAR_UNIT, s_tick_timer_service_subscribe.last_call.tick_units); } void prv_tick_handler(struct tm *tick_time, TimeUnits units_changed); void test_rocky_api_tickservice__calls_handlers(void) { rocky_global_init(s_api); EXECUTE_SCRIPT( "var s = 0;\n" "v...
(&tm, SECOND_UNIT | MINUTE_UNIT | HOUR_UNIT | DAY_UNIT)
; ASSERT_JS_GLOBAL_EQUALS_D("s", 1.0); ASSERT_JS_GLOBAL_EQUALS_D("m", 2.0); ASSERT_JS_GLOBAL_EQUALS_D("h", 3.0); ASSERT_JS_GLOBAL_EQUALS_D("d", 4.0); cl_assert(*s_log_internal__expected == NULL); }
radius, (TRIG_MAX_ANGLE / 4)); cl_assert_equal_gpoint(result, GPoint(5, 0)); // 270 (90 * 3) degrees should be (-5, 0) result = gpoint_from_polar_internal(&origin_center, radius, (TRIG_MAX_ANGLE * 3 / 4)); cl_assert_equal_gpoint(result, GPoint(-5, 0)); const GPoint offset_center = GPoint(1, 1); // 90 degr...
GRect(4, 4, 2, 2)
, grect_centered_internal(&p2, GSize(2, 2))); p2.x.raw_value += FIXED_S16_3_HALF.raw_value; cl_assert_equal_grect(GRect(5, 4, 2, 2), grect_centered_internal(&p2, GSize(2, 2))); // Repeat for a positive offset center point with 0.5 fractions GPointPrecise p3 = GPointPreciseFromGPoint(GPoint(5, 5)); p3.x.raw_v...
tic uint16_t s_last_vmc = 0; bool activity_tracking_on(void) { return true; } bool activity_get_metric(ActivityMetric metric, uint32_t history_len, int32_t *history) { cl_assert_equal_i(history_len, 1); if (metric == ActivityMetricSleepState) { *history = s_sleep_state; return true; } else if (metric ...
(id, 10, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule)
; cl_assert_equal_i(s_num_timeline_adds, 3); cl_assert_equal_i(s_num_timeline_removes, 0); s_sleep_state = ActivitySleepStateRestfulSleep; s_sleep_state_seconds = 0; s_last_vmc = 0; prv_set_time(s_current_day, 10, 0); cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); cl_assert_equal_i(...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ dialog->vibe_on_show = vibe_on_show; }
void dialog_set_timeout(Dialog *dialog, uint32_t timeout) { dialog->timeout = timeout; } void dialog_set_callbacks(Dialog *dialog, const DialogCallbacks *callbacks, void *callback_context) { if (!callbacks) { dialog->callbacks = (DialogCallbacks) {}; return; } dialog->callb...
(s_characteristics[0][PPoGATTCharacteristicData]); // Expect "Reset Complete" to be sent by FW: prv_assert_sent_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]); // Expect Session to be opened now: cl_assert_equal_i(fake_comm_session_open_call_count(), 1); } void test_ppogatt__start_reset_upon...
for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) { regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); }
// Expect "Reset Request" sent by FW: prv_assert_sent_reset_request(s_characteristics[0][PPoGATTCharacteristicData]); } void test_ppogatt__server_reset_request_while_pending_ack(void) { test_ppogatt__open_session_when_found_pebble_app(); // Simulate outbound queue full, so ack will have to wait until there'...
static void prv_handle_erase(Command *cmd, size_t length); static void prv_handle_write(Command *cmd, size_t length); static void prv_handle_crc(Command *cmd, size_t length); static void prv_handle_query_region(Command *cmd, size_t length); static void prv_handle_finalize_region(Command *cmd, size_t length); static v...
pulse_best_effort_send(ack, sizeof(EraseAndWriteAck))
; // Since packets arrive so rapidly when writing, flash imaging can consume // all of the available CPU time and completely block lower-priority tasks. // To prevent DoSing KernelBG and tripping the watchdog, suspend the current // task for a couple ticks after each write to let other tasks catch up. psleep...
ose(0); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_close(1000000); cl_assert(rv == E_INVALID_ARGUMENT); int fd = pfs_open("file", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); rv = pfs_close(fd); cl_assert(rv == S_SUCCESS); rv = pfs_close(fd); // should not be able to double close an fd ...
("%d\n", pfs_get_size() - 1024)
; cl_assert(fd >= 0); cl_assert(pfs_close(fd) == S_SUCCESS); cl_assert(pfs_remove(name) == S_SUCCESS); } void test_pfs__active_regions(void) { pfs_format(false); cl_assert(!pfs_active_in_region(0, pfs_get_size())); // erase every page and make sure pfs is active pfs_format(true); cl_assert(pfs_active...
PER_MINUTE; nodes[num_nodes - 1]->timestamp = endtime; nodes[num_nodes - 1]->duration = 0; nodes[num_nodes - 1]->all_day = false; } nodes[0]->all_day = (nodes[0]->duration == MINUTES_PER_DAY && nodes[0]->timestamp == midnight_first); // middle days are all day events time_t m...
prv_set_node_from_header(old_common, &old_node)
; return prv_first_event_comparator(&new_node, &old_node, direction); } bool timeline_item_should_show(CommonTimelineItemHeader *header, TimelineIterDirection direction) { TimelineNode node; prv_set_node_from_header(header, &node); const time_t now = rtc_get_time(); const time_t midnight = time_util_get_midn...
rame.size.w = 72; frame.size.h = 60; } else { frame.size.w = 72; frame.size.h = 32; } init_text_layer(data, frame); if (data->word_wrap) { text_layer_set_text(&data->word_wrap_layer, "Overflow: Word Wrap"); text_layer_set_overflow_mode(&data->text_layer, GTextOverflowModeWordWrap); } els...
{ static const PebbleProcessMdSystem text_spacing_info = { .common.main_func = &s_main, .name = "Text Clipping" }; return (const PebbleProcessMd*) &text_spacing_info; }
dateImplementation) property_animation_update_uint32) { property_animation->values.to.uint32 = to_value ? *((uint32_t *)to_value) : implementation->accessors.getter.uint32(subject); property_animation->values.from.uint32 = from_value ? *((uint32_t *)from_value) ...
if (animation_private_using_legacy_2(NULL)) { // We need to enable other applib modules like sroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. return (PropertyAnimation *)property_animation_legacy2_create( (PropertyAnimationLegacy2Implementation ...
for (int i = 0; i < num_ops; i += 2) { int idx = i * VALID_OBJECT_SIZE; prv_receive_put(s_last_response_cookie, &buffer[idx], VALID_OBJECT_SIZE); idx += VALID_OBJECT_SIZE; memcpy(&s_next_value_to_write, &buffer[idx], VALID_OBJECT_SIZE); fake_pb_storage_register_cb_before_write(prv_cb_before_write);...
fake_pb_storage_mem_assert_contents_written(buffer, sizeof(buffer)); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Commit Message void test_put_bytes__commit_message_too_short(void) { prv_receive_init_and_put_fw_object(); const uint8_t incomplete_pu...
/* * 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...
(recognizer_create_with_data(NULL, &s_test_impl_data, sizeof(s_test_impl_data), dummy, NULL))
; cl_assert_passert(recognizer_create_with_data(&s_test_impl, NULL, sizeof(s_test_impl_data), dummy, NULL)); cl_assert_passert(recognizer_create_with_data(&s_test_impl, &s_test_impl_data, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(dialog, RESOURCE_ID_GENERIC_PIN_TINY)
; confirmation_dialog_set_click_config_provider(confirmation_dialog, prv_calibrate_click_config); confirmation_dialog_push(confirmation_dialog, modal_manager_get_window_stack(MODAL_PRIORITY)); } static bool prv_display_has_user_offset(void)...
scheduled(animation), false); animation_schedule(animation); animation_set_reverse(animation, true); animation_set_duration(animation, ANIMATION_DURATION_INFINITE); animation_set_elapsed(animation, 20); prv_play_animation_update(animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_el...
(animation_is_scheduled(animation), false)
; animation_schedule(animation); // Pause unschedules the current animation cl_assert_equal_i(animation_is_scheduled(animation), true); kino_player_pause(test_player); cl_assert_equal_i(animation_is_scheduled(animation), false); animation = (Animation *)kino_player_create_play_animation(test_player); cl...
pLeft) || (icon_align == GAlignTop) || (icon_align == GAlignTopRight)) { // Offset by the cap offset to match round's icon-title delta box.origin.y += fonts_get_font_cap_offset(title_font); } } if (config->icon_box_model) { box.origin = gpoint_add(box.origin, config->icon_...
{ return GRectZero; }
ar buffer prv_dispatch_data(); mutex_unlock_recursive(s_accel_manager_mutex); return success; } /* * TODO: APIs that still need to be implemented */ void accel_manager_enable(bool on) { } void accel_manager_exit_low_power_mode(void) { } // Return true if we are "idle", defined as seeing no movement in the...
{ PBL_ASSERTN(mcu_state_is_isr()); *should_context_switch = new_timer_add_work_callback_from_isr(prv_handle_accel_driver_work_cb, cb); }
bool accel_manager_run_selftest(void) { mutex_lock_recursive(s_accel_manager_mutex); bool rv = accel_run_selftest(); mutex_unlock_recursive(s_accel_manager_mutex); return rv; } #if !defined(PLATFORM_SILK) // Note: This selftest is only used for MFG today. When we start to build out a // gyro API, we will nee...
/* * 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; }
/* * 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 (data->num_heart_beats < max_heart_beats) { data->pulsing_heart_timer = app_timer_register(timer_duration, prv_pulsing_heart_timer_cb, base_layer); }
layer_mark_dirty(base_layer); } static void prv_render_progress_bar(GContext *ctx, Layer *base_layer) { HealthHrSummaryCardData *data = layer_get_data(base_layer); health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_BACKGROUND_COLOR, 0, HEALTH_PROGRESS_BAR_MAX_VALUE); } sta...
timeline_layer_get_icon_frame(layer, index, &icon_rect)
; layer_set_frame((Layer *)&layout->icon_layer, &icon_rect); layer_add_child(&layer->layouts_layer, (Layer *)&layout->icon_layer); layer->layouts[index] = layout; layer->layouts_info[index] = info; } static void prv_destroy_layout(TimelineLayer *layer, int index) { TimelineLayout *timeline_layout = layer->la...
OR ASSERT_CALLED(prv_draw_rect_aa_stroked(&context, &GRect(10, 20, 40, 10), SW_ODD)); #else ASSERT_CALLED(prv_draw_rect_stroked(&context, &GRect(10, 20, 40, 10), SW_ODD)); #endif setup_test(&context, true, SW_ODD, GColorBlack, GColorBlack, false); graphics_draw_circle(&context, GPoint(50, 50), 10); #if PBL_COL...
(&context, &GRect(20, 80, 40, 10), 4)
); setup_test(&context, false, SW_ODD, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(...
/* * 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 interval_end; }
AnimationProgress animation_timing_curve(AnimationProgress time_normalized, AnimationCurve curve) { return time_normalized; } KinoReel *kino_reel_scale_segmented_create(KinoReel *from_reel, bool take_ownership, GRect screen_frame) { return NULL; } void kino_reel_scale_...
#include "fake_rtc.h" #include "fake_events.h" #include "fake_spi_flash.h" #include "fake_system_task.h" // Stubs //////////////////////////////////// #include "stubs_analytics.h" #include "stubs_hexdump.h" #include "stubs_language_ui.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_pbl_malloc.h"...
(tzinfo.tm_zone, "UNK")
; tzinfo.dst_id = 0; tzinfo.tm_gmtoff = 0; tzinfo.timezone_id = -1; for (int32_t dstoff = min_dstoff; dstoff <= max_dstoff; dstoff += dstoff_slide) { prv_clock_reset(0); tzinfo.dst_start = dstoff; tzinfo.dst_end = tzinfo.dst_start + dstrange; rtc_set_timezone(&tzinfo); clock_init(); clo...
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, STR_SIZE, "abc %hf%s", "a", 1.0, "b"); cl_assert_equal_s(str, fp_msg); pbl_snprintf(str, STR_SIZE, "abc %hd%s", 42, "b"); cl_assert_equal_s(str,...
/* * 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...
memset(f->dirty_lines, 0xff, DISP_ROWS / 8)
APABILITY_HAS_BUILTIN_HRM if (!s_hrm_present) { return; } ACTIVITY_LOG_DEBUG("Got HR event: %d", (int) hrm_event->event_type); if (hrm_event->event_type == HRMEvent_BPM) { ACTIVITY_LOG_DEBUG("HR bpm: %"PRIu8", qual: %"PRId8" ", hrm_event->bpm.bpm, (int8_t) hrm_event->bpm.quality)...
(LOG_LEVEL_ERROR, "No settings file")
fake_app_info_dict), (uint8_t *)s_fake_app_info_dict); } else { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_message_app_info_dict), (uint8_t *)s_message_app_info_dict); } return BTErrnoOK; } // else: notif req...
s_num_ds_notifications_received++; } else if (uid == mms_with_caption_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_mms_with_caption_dict), (uint8_t *)s_mms_with_caption_dict); s_num_ds_notifications_received++; } else if (uid == s_get_wrong_data_uid) { // We wanted a notification at...
return BTErrnoOK; } // Tests /////////////////////////////////////////////////////////// #define TEST_START FILESYSTEM_FILE_TEST_SPACE_BEGIN #define TEST_SIZE (FILESYSTEM_FILE_TEST_SPACE_END - \ FILESYSTEM_FILE_TEST_SPACE_BEGIN) void test_ancs__initialize(void) { s_block_event_callback = false; regular_ti...
and reboot?"), RESOURCE_ID_GENERIC_QUESTION_LARGE); confirmation_dialog_set_click_config_provider(confirmation_dialog, prv_coredump_click_config); app_confirmation_dialog_push(confirmation_dialog); confirmation_dialog_pop((ConfirmationDialog *)context); } static void prv_information_click_config(void *con...
(info->hw_version_string, MFG_HW_VERSION_SIZE + 1)
; prv_populate_uptime_string(info); sniprintf(info->language_string, sizeof(info->language_string), "%s, v%u", i18n_get_locale(), i18n_get_version()); info->subtitle_text[SystemInformationItemBtAddress] = info->bt_mac_addr; info->subtitle_text[SystemInformationItemFirmware] = (char*)TINTIN_META...
/* * 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 (boot_version_read() == TINTIN_METADATA.version_timestamp) { return; } RTC_WriteBackupRegister(BOOTLOADER_VERSION_REGISTER, TINTIN_METADATA.version_timestamp); }
uint32_t boot_version_read(void) { return RTC_ReadBackupRegister(BOOTLOADER_VERSION_REGISTER); }
unlock(s_endpoint_data.mutex); // logging_session is waiting for an ack, we'll send next time around // don't return a failure, this is pretty innocuous. return true; } const uint32_t total_length = sizeof(DataLoggingSendDataMessage) + num_bytes; const uint32_t timeout_ms = 500; SendBuffer *sb = co...
(LOG_LEVEL_ERROR, "Too many nacks. Flushing...")
440, 176}, { -1440, 336, 128}, { -1232, 232, 160}, { -1224, 184, 208}, { -1232, 104, 256}, { -1240, 104, 248}, { -1256, 96, 232}, { -1200, 48, 280}, { -1016, -16, 160}, { -1048, 0, 144}, { -1008, 64, -48}, { -976, 400, -272}, { -1184, 168, -104}, { -1496, -8, 8}, ...
{ -1024, 24, 256}, { -984, -32, 264}, { -944, -16, 160}, { -1104, 32, 240}, { -1120, -104, 176}, // 44 seconds { -808, -136, 24}, { -1240, -16, -160}, { -1296, 112, -224}, { -1224, 208, -360}, { -1376, 160, -352}, { -1336, 0, -160}, { -1184, 128, -160}, { -920, 24...
ave clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = 300; Animation *animation = (Animation *)kino_player_create_play_animation(test_player); cl_assert_equal_i(animation_is_scheduled(animation), false); animation_schedule(animation); animation...
(test_player)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ s_preferred_content_size = PreferredContentSizeExtraLarge; rocky_global_init(s_preferences_api); EXECUTE_SCRIPT("var size = _rocky.userPreferences.contentSize"); ASSERT_JS_GLOBAL_EQUALS_S("size", "x-large"); }
act_dist_2min %%err"); printf("\n------------------------------------------------------------------------------------"); float pct_err_sum = 0; for (int i = 0; i < ARRAY_LENGTH(tests); i++) { DistanceTestParams *params = &tests[i]; int steps_per_minute = (int)((float)params->steps / params->seconds * S...
(ACTIVITY_DEFAULT_HR_PERIOD_SEC, 100 /*bpm*/, HRMQuality_Good, false /*force_continuous*/)
; cl_assert(s_hrm_manager_update_interval > SECONDS_PER_HOUR); // Advance to our next sampling period, the watch is no longer flat so we should be sampling s_test_alg_state.orientation = 0x22; // Not flat prv_advance_time_hr(ACTIVITY_DEFAULT_HR_PERIOD_SEC, 100 /*bpm*/, HRMQuality_Good, false /*force_continuous...
snprintf((char *)key, sizeof(key), "k%03d", 128); for (int i = 0; i < 128; i++) { snprintf((char *)val, sizeof(val), "v%03d", i); printf("Iteration %d val %s\n", i, val); set_and_verify(&file, key, key_len, val, val_len); } // Finally, try to set a key to a large value. This should succeed with // ...
(have_hit_old_value)
; cl_assert(have_hit_new_value); cl_assert(have_hit_end); } void test_settings_file__zero_length(void) { printf("\nTesting if we can set keys & values of zero length...\n"); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_zero_length", 4096)); uint8_t key[4]; int key_len = sizeof(k...
sk(); void *mem = heap_zalloc(heap, bytes, saved_lr); if (!mem && bytes != 0) { PBL_CROAK_OOM(bytes, saved_lr, heap); } return mem; } void *task_calloc(size_t count, size_t size) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_calloc(task_heap_get_for_current_task(), count...
heap_realloc(kernel_heap_get(), ptr, bytes, saved_lr)
; } void *kernel_zalloc(size_t size) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_zalloc(kernel_heap_get(), size, saved_lr); } void *kernel_zalloc_check(size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; Heap *heap = kernel_heap_get(); void *mem = ...
/* * 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...
(DISP_SPI, SPI_I2S_FLAG_TXE)
) {} } // Since all these values are constant we can save code space // by storing the initialized struct in memory rather than // needing to copy in each value static GPIO_InitTypeDef s_disp_gpio_init = { .GPIO_OType = GPIO_OType_PP, .GPIO_PuPd = GPIO_PuPd_NOPULL, .GPIO_Mode = GPIO_Mode_AF, .GPIO_Speed = GPIO...
STEPS_HEIGHT 45 #define STEPS_TOP ((DISP_ROWS - 3 * STEPS_HEIGHT)/2) #if PBL_RECT #define DISP_COLS 144 #define DISP_ROWS 168 #elif PBL_ROUND #define DISP_COLS 180 #define DISP_ROWS 180 #endif #define CUR_STEP_RECT GRect(0, STEPS_TOP, DISP_COLS, STEPS_HEIGHT) #define TIME_RECT GRect(0, STEPS_TOP + STEPS_HEIG...
APP_LOG(APP_LOG_LEVEL_DEBUG, "%d: %d", i, (int)value)
; char temp[32]; snprintf(temp, sizeof(temp), "\n%d: %d", i, (int)value); prv_safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text)); day_start -= SECONDS_PER_DAY; } prv_display_alert(data->debug_card.dialog_text); } // ----------------------------------------------...
palding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, GBitmapFormat4BitPalette); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, GBitmapFormat8BitCircular); cl...
(GSize(13, 10), GBitmapFormat1BitPalette)
); cl_assert_equal_i( 40, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat2BitPalette)); cl_assert_equal_i( 70, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat4BitPalette)); cl_assert_equal_i( 0, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat8BitCircular)); const size_t expected = PBL_IF_...
////////////////////////////////////// void compositor_app_framebuffer_fill_callback(GContext *ctx, int16_t y, Fixed_S16_3 x_range_begin, Fixed_S16_3 x_range_end, Fixed_S16_3 delta_begin, Fixed_S16_3 delta_end, ...
// Set all the black pixels from the start, which is the sum of the following: // - app_offset_y * DISP_COLS - the top part of the bezel // - bezel_width - the left bezel for the first row of the app // - corner_pixels - the top-left corner for the first row const int top_bezel_length = app_...
e->size); app_cache_remove_entry(node->id); node = (EvictListNode *)list_pop_head((ListNode *)node); kernel_free(temp); } } unlock: mutex_unlock_recursive(s_app_cache_mutex); return rv; } ////////////////////// // AppCache Helpers ////////////////////// // Remove the filename entry in the ...
(APP_CACHE_FILE_NAME, OP_FLAG_READ, FILE_TYPE_STATIC, 0)
; if (fd < 0) { prv_delete_cached_files(); goto unlock; } pfs_close(fd); } unlock: mutex_unlock_recursive(s_app_cache_mutex); prv_purge_orphaned_resource_files(); } //! Adds an entry with the given AppInstallId to the cache status_t app_cache_add_entry(AppInstallId app_id, uint32_t tota...
raw_value = (ctx->draw_state.stroke_width << FIXED_S16_3_PRECISION) / 2}; Fixed_S16_3 radius_inner = (Fixed_S16_3){.raw_value = MAX(0, radius.raw_value - half_stroke_width.raw_value)}; Fixed_S16_3 radius_outer = (Fixed_S16_3){.raw_value = radius.raw_value + half_stroke_width.raw_value}; if (radius_ou...
prv_fill_oval_precise(ctx, center, radius_outer, radius_outer, radius_inner, radius_inner, angle_start, angle_end); }
layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_across_ny_second_line)
; layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_ny_second_line.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_across_y); layer_render_tree(&canvas, &c...
Line* line, GRect cursor, const Codepoint codepoint) { (void) ctx; PBL_ASSERT(cursor.origin.x >= line->origin.x, "Text cursor x=<%u> ahead of line origin x=<%u>", cursor.origin.x, line->origin.x); const int glyph_width_px = prv_codepoint_get_horizontal_advance(&ctx->font_cache, text_box_params->font,...
{ // Newlines should not adjust the width if (current_codepoint == NEWLINE_CODEPOINT) { next_glyph_width_px = 0; } else { next_glyph_width_px = prv_codepoint_get_horizontal_advance(&ctx->font_cache, text_box_params->font, ...
} if (line->suffix_codepoint) { GRect cursor = { .origin = line->origin, .size.w = next_glyph_width_px, .size.h = fonts_get_font_height(text_box_params->font) }; cursor.origin.x += walked_width_px; if (char_visitor_cb) { char_visitor_cb(ctx, text_box_params, line, cursor, l...
quence prv_advance_to_ms_with_timers(start_ms + 2 * (duration_total + 4 * MIN_FRAME_INTERVAL_MS)); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 3); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 2); cl_assert_equal_i(prv_count_handler_entries(&s_started_h...
prv_count_handler_entries(&s_stopped_handler_calls, a)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1); // B should end low distance = prv_last_update_distance(b); cl_assert(distance < TEST_ANIMATION_NORMALIZED_LOW); // If we keep going, we shoul...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prompt_send_response_fmt(buffer, sizeof(buffer), "%"PRIi32": %s %s", entry->install_id, entry->name, uuid_buffer)
; return true; } void command_app_list(void) { app_install_enumerate_entries(prv_print_app_info, NULL); } void command_app_launch(const char *id_str) { int32_t id = atoi(id_str); if (id == 0) { prompt_send_response("invalid app number"); return; } AppInstallEntry entry; bool success = app_insta...
/* * 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...
ASSERT(emx_resources_read(1, id_1, 0, (uint8_t *)&buf, 1) == 4)
; ASSERT(buf == 1); ASSERT(s_read_1_called == 1); ASSERT(s_size_1_called == 1); // 2nd res uint32_t id_2 = emx_resources_register_custom(custom_res_read_2, custom_res_size_2); ASSERT(emx_resources_get_size(1, id_2) == 4); buf = 0; ASSERT(emx_resources_read(1, id_2, 0, (uint8_t *)&buf, 1) == 4); ASSER...
display_set_offset(GPointZero)
; light_enable(true); Window *window = &data->window; window_init(window, "SettingsDisplayCalibration"); window_set_click_config_provider_with_context(window, prv_config_provider, data); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .unload = prv_window_unload }...
me_r(&now_utc, &tm_now); if ((tm_now.tm_min % 15) != 0) { return; } time_t activation_time_utc = activity_prefs_get_activation_time(); if (activation_time_utc == 0) { return; } time_t activation_time = time_utc_to_local(activation_time_utc); time_t now = time_utc_to_local(now_utc); for (int i...
INSIGHTS_LOG_DEBUG("Checking sleep reward...")
jan1st_noon_2015); if (tz_info.dst_start != s_dst_correct_values[dstid][0]) { printf("start [%d] tz_info: %ld s_dst_correct_values: %ld\n", dstid, tz_info.dst_start, s_dst_correct_values[dstid][0]); } if (tz_info.dst_end != s_dst_correct_values[dstid][1]) { printf(" end [%d] tz_i...
prv_set_current_time(may_30)
; cl_assert_equal_i(clock_to_timestamp(TODAY, 5, 0), mktime(&may_31)); } void test_clock__time_until_one_hour_relative(void) { char time_buf[64]; const int jun10th_noon_2015 = 1433937600; prv_clock_reset(0); rtc_set_time(jun10th_noon_2015); // Our test event is at June 10th 2015, 14:00:00 // Now + two...
We're dumb and don't support anything other than 12.5hz for jitter-free sampling. We chose // this rate because it divides evenly into all the native rates we support right now. // Supporting a wider range of jitter-free rates is harder due to dealing with all the potential // combinations of different subscribe...
mutex_unlock_recursive(s_accel_manager_mutex)
; return empty; } void accel_cb_new_sample(AccelDriverSample const *data) { prv_update_last_accel_data(data); s_accel_samples_collected_count++; if (!s_buffer.clients) { return; // no clients so don't buffer any data } AccelManagerBufferData accel_buffer_data; accel_buffer_data.rawdata.x = data->x...
/* * 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(got_version == ANALYTICS_DEVICE_HEARTBEAT_BLOB_VERSION)
; uint32_t got_value = *((uint32_t *)(data + 28)); printf("Battery change period: %"PRIu32"\n", got_value); cl_assert(got_value == expected_value); dls_log_called = true; return DATA_LOGGING_SUCCESS; } DataLoggingSession *dls_create(uint32_t tag, DataLoggingItemType item_type, uint16_t item_size, ...
_next_card_idx(Card current, bool up) { const int direction = up ? 1 : -1; int next = current + direction; // Skip over the HR card if we don't support it #if CAPABILITY_HAS_BUILTIN_HRM if (next == Card_HrSummary && !activity_is_hrm_present()) { next = next + direction; } // if heart rate is diabled, cha...
(card_layer)
); } #define NUM_MID_FRAMES 1 static void prv_bg_animation_update(Animation *animation, AnimationProgress normalized) { HealthCardView *health_card_view = animation_get_context(animation); const AnimationProgress bounce_back_length = (interpolate_moook_out_duration() * ANIMATION_NORMALIZED_MAX) / int...
/* * 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...
(base, &s_timezone_gmt)
; // 2015 Nov 12, 12:45:00 int32_t target = 1447332300; cron_clear_all_jobs(); cl_assert_equal_i(cron_service_get_job_count(), 0); cron_job_schedule(job); cl_assert_equal_i((uintptr_t)job->cb_data, 0); cl_assert_equal_i(job->cached_execute_time, target); cl_assert_equal_i(cron_service_get_job_count(),...
lavePort *slave) { if (slave->slave_state->dma_state != SPISlavePortDMAState_Read) { return; } dma_request_stop(slave->rx_dma); PBL_ASSERTN(slave->slave_state->initialized); PBL_ASSERTN(slave->slave_state->acquired); prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqRx, false); slave->slave_state->dma_comp...
(slave->slave_state->initialized)
; spi_ll_slave_acquire(slave); prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqTx, enable); spi_ll_slave_release(slave); } void spi_ll_slave_set_rx_dma(const SPISlavePort *slave, bool enable) { PBL_ASSERTN(slave->slave_state->initialized); spi_ll_slave_acquire(slave); prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
for (int sector = first_sector; sector <= last_sector; ++sector) { FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR); if (FLASH_EraseSector(s_sectors[sector], VoltageRange_1) != FLASH_COMPLETE) { dbgserial...
FLASH_Lock(); return true; } bool system_flash_write(uint32_t address, const void *data, size_t length) { // enable programming of flash FLASH_Unlock(); // clear errors FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_F...
/* * 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(0, y, layer->bounds.size.w, PBL_IF_RECT_ELSE(35, 36))
s_set(ANALYTICS_APP_METRIC_FLASH_READ_BYTES_COUNT, s_analytics_read_bytes_count, AnalyticsClient_App); analytics_set(ANALYTICS_APP_METRIC_FLASH_WRITE_BYTES_COUNT, s_analytics_write_bytes_count, AnalyticsClient_App); // The overhead cost of tracking whether each flash read was due to...
if (s_erase.in_progress && !s_erase.suspended) { // If an erase is in progress, make sure it gets at least a mininum time slice to progress. // If not, the successive kicking of the suspend timer could starve it out completely psleep(100); task_watchdog_bit_set(s_erase.task); status_t status = flash...
} //! Assumes that s_flash_lock is held. static void prv_erase_resume(void) { if (s_erase.suspended) { status_t status = flash_impl_erase_resume(s_erase.address); PBL_ASSERT(PASSED(status), "Erase resume failure: %" PRId32, status); s_erase.suspended = false; } } static void prv_erase_suspend_timer_c...
ic void prv_display_end_write(void) { prv_display_write_byte(0x00); prv_disable_display_access(); } // Round a bit offset to a byte offset static unsigned prv_round_to_byte(unsigned x) { return (x + 7) >> 3; } // Draw bitmap onto buffer. static void prv_draw_bitmap(const uint8_t *bitmap, unsigned x_offset, un...
(pebble_logo_bits, 16, 64, pebble_logo_width, pebble_logo_height, buffer)
; prv_draw_bitmap(empty_bar_bits, x_offset, y_offset, empty_bar_width, empty_bar_height, buffer); for (unsigned y = 0; y < inner_bar_height; y++) { for (unsigned x = 0; x < num_pixels; x++) { // Add 1 to offsets so we don't write into outer box prv_set_bit(x + x_offset + 1, y_offset + y + 1, buff...
1560, 544, -240}, { 1472, 720, -192}, { 1176, 1528, -640}, { 1424, 864, -408}, { 872, 888, -304}, { 1072, 896, -208}, { 1000, 832, -304}, { 1248, 696, -328}, { 1712, 704, -128}, { 2024, 688, -80}, { 1864, 520, -56}, { 1768, 384, -16}, { 1680, 344, 8}, { 1680, 368, -1...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_heather_2 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 95 //> TEST_EXPECTED_MAX 110 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // elapsed: 0 minutes { -72, -128, -960}, { -104, -144, -976}, ...
{ -184, -160, -904}, { -192, -184, -888}, { -208, -176, -960}, { -240, -144, -968}, { -288, -104, -984}, { -296, -72, -1040}, { -296, -80, -1128}, { -176, 48, -1240}, { 16, -48, -1152}, { 160, -64, -904}, { 296, -56, -784}, { 480, -192, -688}, { 576, -144, -664}, ...
ed int) buffer_len > sizeof(LogBinaryMessage)); LogBinaryMessage* msg = (LogBinaryMessage*) buffer; time_t time_seconds = sys_get_time(); msg->timestamp = htonl(time_seconds); msg->log_level = log_level; msg->line_number = htons(src_line_number & 0xffff); msg->message_length = 0; // Ensure we only sen...
{ return; }
unsigned num_fmt_conversions = (packed_loghash >> PACKED_NUM_FMT_OFFSET) & PACKED_NUM_FMT_MASK; unsigned str_index_1 = (packed_loghash >> PACKED_STR1FMT_OFFSET) & PACKED_STR1FMT_MASK; unsigned str_index_2 = (packed_loghash >> PACKED_STR2FMT_OFFSET) & PACKED_STR2FMT_MASK; unsigned level = (packed_loghash >> PA...
_graphics_get_gcontext(); const GRect rect = prv_grect_from_precise(&prect); func(ctx, &rect); return jerry_create_undefined(); } JERRY_FUNCTION(prv_fill_rect) { return prv_rect_call(argc, argv, graphics_fill_rect); } static void prv_draw_rect_impl(GContext *ctx, const GRectPrecise *rect) { GRectPrecise adj...
jerry_create_undefined()
k to avoid centering the title / subtitle labels in the entire cell: ((Layer *)cell_layer)->bounds.size.h -= SHARING_HEART_RATE_EXTRA_HEIGHT_PX; } menu_cell_basic_draw(ctx, cell_layer, remote_name, connected_string, NULL); if (is_sharing_heart_rate_string) { // Restore original height: ((Layer *)cel...
{ #if PBL_RECT # if CAPABILITY_HAS_BUILTIN_HRM int heart_rate_sharing_text_height = 0; if (row > 0) { SettingsBluetoothData *data = (SettingsBluetoothData *) context; const uint16_t device_index = row - 1; StoredRemote* remote = (StoredRemote*) list_get_at(data->remote_list_head, device_index); if ...
if (subscription->pending_confirmation[c]) { subscription->pending_confirmation[c] = false; if (subscription->subscriptions[c] == BLESubscriptionNone) { // Client unsubscribed in the mean-time. Confirmation should already have been sent. continue; } if (has_error) { // Su...
{ bool has_more = false; GATTBufferedNotificationHeader next_header = {}; prv_lock(); { if (!prv_check_buffer(client)) { has_more = false; // the client went away goto unlock; } GATTBufferedNotificationHeader header = {}; const bool has_notification = prv_get_next_notification_head...
PBL_LOG(LOG_LEVEL_WARNING, "Consume called while no notifications in buffer"); *characteristic_ref_out = BLE_CHARACTERISTIC_INVALID; *value_length_in_out = 0; } has_more = has_notification && prv_get_next_notification_header(client, &next_header); } unlock: if...
Sample captured: 2015-08-06 15:20:05 GMT AccelRawData *activity_sample_20_hand_swings_at_side(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME hand_swings_at_side //> TEST_EXPECTED 0 //> TEST_EXPECTED_MIN 0 //> TEST_EXPECTED_MAX 25 //> TEST_WEIGHT 0.0 static Ac...
{ -1267, 372, 149}, { -1104, 311, 151}, { -957, 329, 286}, { -762, 442, 113}, { -621, 602, -16}, { -583, 529, -36}, { -605, 457, -9}, { -807, 413, 131}, { -877, 374, 144}, { -938, 491, 86}, { -1212, 562, 145}, { -1557, 546, 287}, { -1813, 590, 365}, { -1807, 654, ...
list = response_item->attr_list, }; } action_group.actions[num_responses + 1] = (TimelineItemAction) { .id = 1, .type = TimelineItemActionTypeRemove, .attr_list = remove_attr_list, }; // Note: it's fine if this returns null, since the parent functions will check for a null pointer TimelineIte...
(config, cur_val, average, &percentage)
- glyph_size_bytes]; } else { target = (uint8_t *)g->data; } SYS_PROFILER_NODE_START(text_render_flash); size_t num_bytes_loaded = sys_resource_load_range(font_res->app_num, font_res->resource_id, bitmap_addr, target, glyph_size_bytes); SYS...
SYS_PROFILER_NODE_STOP(text_render_flash)
; // convert to a GlyphHeaderData struct memcpy(&g->header, &header, sizeof(GlyphHeaderData)); g->header.horiz_advance = header.horiz_advance; } else { PBL_LOG_D(LOG_DOMAIN_TEXT, LOG_LEVEL_DEBUG, "GMD read: cp: %"PRIx32", offset: %"PRId32", bytes: %zu", codepoint, data->re...
eliable_retransmit_timer_start(unsigned int timeout_ms, uint8_t sequence_number) { mutex_lock(s_reliable_timer_state_lock); RtcTicks timeout_ticks = timeout_ms * RTC_TICKS_HZ / 1000; s_reliable_timer_expiry_time_tick = rtc_get_ticks() + timeout_ticks; s_reliable_timer...
if (c == '\0') { c = FRAME_DELIMITER; }
cobs_streaming_decode(&frame_decode_ctx, c); } } // Finally handle the timer. if (timeout == 0) { pulse2_reliable_retransmit_timer_expired_handler(timer_sequence_number); } prv_pulse_task_feed_watchdog(); } } static void prv_forge_terminate_ack(void) { // Send an LCP Term...