prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * 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_actionable_dialog_push(&confirmation_dialog->action_dialog)
; } void confirmation_dialog_pop(ConfirmationDialog *confirmation_dialog) { if (confirmation_dialog == NULL) { return; } action_bar_layer_remove_from_window(&confirmation_dialog->action_bar); action_bar_layer_deinit(&confirmation_dialog->action_bar); gbitmap_deinit(&confirmation_dialog->confirm_icon); ...
/* * 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...
gap_le_connection_by_device(&payload->address)
784, 224, 80}, { 792, 264, 48}, { 872, 288, 8}, { 992, 360, -128}, { 1248, 304, -120}, { 1216, 224, -120}, { 1760, 160, -24}, { 1488, 352, -32}, // 25 seconds { 936, 280, 40}, { 1128, 152, 136}, { 1104, 56, 192}, { 888, 120, 72}, { 760, 80, 112}, { 712, 80, 16}, ...
{ 744, 0, 120}, { 728, -32, 136}, { 880, -64, 128}, { 1064, -56, 64}, { 968, 32, 0}, { 1576, -56, 120}, { 1328, 160, 104}, { 1184, 432, -192}, { 1216, 384, -48}, { 864, 248, 136}, { 784, 440, 176}, { 888, 104, 152}, // 31 seconds { 816, 264, 168}, { 800, 424, ...
{ 1632, 472, 104}, { 1512, 560, 56}, { 864, 400, 0}, { 912, 280, 0}, { 1128, 128, 104}, { 976, 72, 184}, { 808, 96, 152}, { 760, 120, 104}, { 712, 64, 88}, { 728, 16, 104}, { 792, -8, 104}, { 1000, -72, 112}, { 1176, -32, 8}, { 1288, -120, 64}, { 1584, -136, ...
app_window_stack_push(window, true /* Animated */)
; Layer *window_layer = window_get_root_layer(window); text_heap_info = text_layer_create(window_layer->frame); text_layer_set_text_color(text_heap_info, GColorWhite); text_layer_set_background_color(text_heap_info, GColorBlack); text_layer_set_font(text_heap_info, fonts_get_system_font(FONT_KEY_GOTHIC_28_BO...
app_state_get_user_data()
; if (in_focus) { launcher_menu_layer_set_selection_animations_enabled(&data->launcher_menu_layer, true); } } static void prv_will_focus(bool in_focus) { LauncherAppWindowData *data = app_state_get_user_data(); if (!in_focus) { launcher_menu_layer_set_selection_animations_enabled(&data->launcher_menu_l...
} else if (BMI160SampleRate_25_HZ == sample_rate) { acc_odr = BMI160AccODR_25_HZ; } else if (BMI160SampleRate_50_HZ == sample_rate) { acc_odr = BMI160AccODR_50_HZ; } else if (BMI160SampleRate_100_HZ == sample_rate) { acc_odr = BMI160AccODR_100_HZ; } else if (BMI160SampleRate_200_HZ == sample_rate) { ...
{ map_val = BMI160_INT_MAP_1_INT2_FIFO_WATERMARK; int_en_val = BMI160_INT_EN_1_FWM_EN; }
ap, "stroke_circle_offset_aa_r16_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Medium circles setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL)
; graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornersRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quads_right.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL...
circular_cache_contains(&s_test_cache, &s_test_item[1])
); } void test_circular_cache__fill(void) { circular_cache_fill(&s_test_cache, (uint8_t *)&s_test_item[1]); cl_assert_equal_m(&s_cache_buffer[0], &s_test_item[1], sizeof(TestCacheItem)); cl_assert_equal_m(&s_cache_buffer[1], &s_test_item[1], sizeof(TestCacheItem)); cl_assert_equal_m(&s_cache_buffer[2], &s_test...
d, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(time...
(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(2)->pin.header.id)
); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(1)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(t...
" #include <bluetooth/analytics.h> #include <bluetooth/bluetooth_types.h> #include <inttypes.h> #include <stdint.h> void slave_window_stats_collect(SlaveConnEventStats *stats); static void prv_handle_collect_ble_parameters(const HcProtocolMessage *msg) { uint64_t channel_map_uint; const ble_error_t e = ble_gap...
hc_protocol_enqueue_with_payload( HcEndpointID_Analytics, HcMessageID_Analytics_LogBleMicErrorEvent, (uint8_t *)&info, sizeof(info))
; } void hc_endpoint_analytics_ctlr_handler(const HcProtocolMessage *msg) { switch (msg->command_id) { case HcMessageID_Analytics_CollectBLEParameters: prv_handle_collect_ble_parameters(msg); break; case HcMessageID_Analytics_GetConnectionQuality: prv_handle_get_connection_quality(msg); ...
int stop_count_before_rediscovery = fake_gatt_is_service_discovery_stop_count(); // Re-discovery: cl_assert_equal_i(gatt_client_discovery_rediscover_all(&device), BTErrnoOK); // Assert the previous process has been stopped: cl_assert_equal_i(stop_count_before_rediscovery + 1, fake_gatt_is_service_discovery_st...
cl_assert_equal_i(gatt_client_discovery_rediscover_all(&device), BTErrnoOK)
; // Assert the previous process has been stopped: cl_assert_equal_i(1, fake_gatt_is_service_discovery_stop_count()); // Expect "Database Changed" event: prv_assert_event(&device, BTErrnoServiceDiscoveryDatabaseChanged); prv_simulate_and_assert_discovery_of_one_service(&device); // None of the batched u...
"drivers/mic.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "os/mutex.h" #include "process_management/app_install_manager.h" #include "process_management/app_manager.h" #include "services/common/new_timer/new_timer.h" #include "services/normal/audio_endpoint.h" #include "services/normal/voice/tr...
(transition_to_state == SessionState_VoiceEndpointSetupReceived || transition_to_state == SessionState_AudioEndpointSetupReceived)
; if (s_state == SessionState_Idle) { // we error'ed out return; } if (s_state == SessionState_StartSession) { // we are still waiting for one of the subsystems to be ready s_state = transition_to_state; } else { PBL_ASSERTN((s_state == SessionState_VoiceEndpointSetupReceived || ...
/* * 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_manager_launch_new_app(&(AppLaunchConfig) { .md = panic_app_get_app_info(), })
; } }
5200,"30","07"},{1185321600,"30","07"},{1185408000,"30","07"},{1185494400,"30","07"}, {1185580800,"30","07"},{1185667200,"30","07"},{1185753600,"31","07"},{1185840000,"31","07"},{1185926400,"31","07"},{1186012800,"31","07"},{1186099200,"31","07"}, {1186185600,"31","07"},{1186272000,"31","07"},{1186358400,"32","07"}...
strftime(tmbuf, sizeof(tmbuf), "%V", &wrk)
; cl_assert_equal_s(tmbuf, s_iso8601_data[i].str_V); printf("%s, ", tmbuf); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%g", &wrk); cl_assert_equal_s(tmbuf, s_iso8601_data[i].str_g); printf("%s\n", tmbuf); } } #endif #if EXTENSION_SU void test_strftime__full_percent_z(void) { char tmbu...
> PPOGATT_DISCONNECT_COUNT_MAX) { // only log this the first couple of times it happens if (s_disconnect_counter < (PPOGATT_DISCONNECT_COUNT_MAX + 3)) { PBL_LOG(LOG_LEVEL_ERROR, "Not disconnecting because max disconnects reached..."); } return; } else { PBL_LOG(LOG_LEVEL_ERROR...
(client->out.rx_window_size, payload->ppogatt_max_tx_window)
; } } PBL_LOG(LOG_LEVEL_DEBUG, "Hurray! PPoGATT Session is opened (Vers: %d TXW: %d RXW: %d)!", client->version, client->out.tx_window_size, client->out.rx_window_size); } // ------------------------------------------------------------------------------------------------- static void prv_handle_ack...
urce_ids.auto.h" #include "services/common/clock.h" #include "services/normal/alarms/alarm.h" #include "services/normal/timeline/attribute.h" #include "system/passert.h" #include "util/attributes.h" #include "util/string.h" #include "util/struct.h" #include <stdio.h> typedef struct LauncherAppGlanceAlarms { char ti...
(alarm_time_epoch)
; const bool is_alarm_for_today = (alarm_midnight == today_midnight); const size_t alarm_subtitle_size = sizeof(alarms_glance->subtitle); // Only show the day of the week if the alarm is not for today if (!is_alarm_for_today) { // Get a string for the abbreviated day of the week in the user's lo...
/* * 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...
(1000, prv_timer_callback, 0)
; } static void deinit(void) { window_destroy(window); } int main(void) { init(); app_event_loop(); deinit(); }
d event_service_init(PebbleEventType type, EventServiceAddSubscriberCallback start_cb, EventServiceRemoveSubscriberCallback stop_cb) {} void sys_vibe_history_start_collecting(void) {} void sys_vibe_history_stop_collecting(void) {} int32_t sys_vibe_get_vibe_strength(void) ...
for (int i = 0; i < num_items; i++) { sys_accel_manager_data_unsubscribe(sessions[i]); stub_pebble_tasks_set_current(tasks[i]); } }
// enumerate through all possible sampling rate combinations and confirm // that the correct frequency is selected void test_accel_manager__subscription_sampling_rates(void) { int sample_rates[] = { ACCEL_SAMPLING_10HZ, ACCEL_SAMPLING_25HZ, ACCEL_SAMPLING_50HZ, ACCEL_SAMPLING_100HZ}; prv_...
36, 592, -808}, { -128, 584, -816}, // 325 seconds { -120, 576, -800}, { -128, 560, -800}, { -144, 576, -824}, { -120, 576, -824}, { -112, 584, -824}, { -104, 560, -816}, { -96, 560, -808}, { -128, 560, -808}, { -128, 560, -816}, { -112, 584, -808}, { -136, 600, -800}...
{ -128, 592, -808}, { -136, 584, -808}, { -136, 584, -808}, { -136, 592, -800}, { -128, 584, -800}, { -136, 584, -800}, { -128, 592, -808}, { -136, 584, -816}, { -136, 576, -808}, { -136, 584, -800}, { -128, 584, -800}, { -136, 576, -800}, { -128, 592, -816}, { -1...
{ -136, 584, -808}, { -128, 576, -816}, { -112, 592, -816}, { -112, 592, -792}, // 333 seconds { -136, 592, -792}, { -144, 584, -800}, { -136, 576, -808}, { -120, 592, -816}, { -120, 584, -808}, { -128, 584, -792}, { -136, 592, -792}, { -128, 592, -816}, { -136, ...
TimelineItemStatusDeleted)) { // Only check compare notifications if it is not deleted, otherwise skip it and look for // the next match if (compare_func(header, data)) { return true; } } if (pfs_seek(fd, header->payload_length, FSeekCur) < 0) { break; } } return ...
uuid_is_invalid(&iter_state->header.common.id)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ handle_init(); app_event_loop(); handle_deinit(); }
const PebbleProcessMd* flash_prof_get_app_info() { static const PebbleProcessMdSystem s_app_info = { .common.main_func = &s_main, .name = "Flash Prof" }; return (const PebbleProcessMd*) &s_app_info; }
{ app_free(card_data->subtitles[i].label); }
for (int i = 0; i < card_data->num_zones; i++) { app_free(card_data->zones[i].label); } i18n_free_all(card_data); app_free(card_data); health_detail_card_destroy(card); }
the License for the specific language governing permissions and * limitations under the License. */ #define FILE_LOG_COLOR LOG_COLOR_BLUE #include "ble_client.h" #include "ble_app_support.h" #include "applib/applib_malloc.auto.h" #include "process_state/app_state/app_state.h" #include "syscall/syscall.h" #include...
{ uint8_t *value = NULL; uint16_t value_length = e->value_length; const uintptr_t object_ref = e->object_ref; BLEGATTError gatt_error = e->gatt_error; // Read Responses / Notifications with 0 length data must not be attempted to be consumed if (value_length) { value = (uint8_t *) applib_malloc(value_le...
static void prv_consume_notifications(const PebbleBLEGATTClientEvent *e, GenericReadHandler handler) { uint8_t *value = NULL; BLEGATTError gatt_error = e->gatt_error; uint16_t heap_buffer_size = 0; uint16_t value_length = 0; bool has_more = sys_ble_client_get_notificat...
/* * 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...
{ char hello[] = { 'h', 'e', 'l', 'l', 'o' }; int fd_z = pfs_open("z", OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(hello)); cl_assert(fd_z >= 0); int bytes_written = pfs_write(fd_z, (uint8_t *)hello, sizeof(hello)); cl_assert(bytes_written == sizeof(hello)); pfs_close(fd_z); }
extern void test_force_garbage_collection(uint16_t start_page); extern uint16_t test_get_file_start_page(int fd); void test_pfs__garbage_collection(void) { char file_small[10]; uint16_t start_page = 0; // create a sectors worth of files for (int i = 0; i < 16; i++) { snprintf(file_small, sizeof(file_small...
e_item_free_allocated_buffer(reminder); return true; // continue iteration } if (reminder_info->filter_cb && !reminder_info->filter_cb(&header, context)) { timeline_item_free_allocated_buffer(reminder); return true; // continue iteration } reminder_info->match = true; return false; // stop itera...
prv_insert_reminder(key, key_len, val, val_len, mark_synced)
/* * 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...
{ uint32_t gothic_18_handle = RESOURCE_ID_GOTHIC_18; cl_assert(text_resources_init_font(0, gothic_18_handle, 0, &s_font_info)); int8_t horiz_advance = text_resources_get_glyph_horiz_advance(&s_font_cache, 'a', &s_font_info); cl_assert(horiz_advance != 0); cl_assert_equal_i(horiz_advance, text_resources...
= 11, .tm_mday = 5, .tm_mon = 4, .tm_year = 115, .tm_wday = 2, .tm_yday = 124, .tm_isdst = 1 }; static struct tm bad_data = { .tm_sec = 49756567, .tm_min = 49756567, .tm_hour = 49756567, .tm_mday = 49756567, .tm_mon = 49756567, .tm_year = 49756567, .tm_wday = 49756567, .tm_yday = 49756567,...
(APP_LOG_LEVEL_DEBUG, "Error with \"S\": %s", buf)
/* * 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_deinit(&dialog->text_layer)
/* * 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...
(HRM_SERVICE_EXPECTED_ATT_STARTING_HANDLE)
; ppogatt_service_register(PEBBLE_PPOGATT_SERVICE_EXPECTED_ATT_STARTING_HANDLE); s_has_registered = true; } //! @note this will be called multiple times! void gatt_local_services_register(void) { mutex_lock(s_svc_register_mutex); prv_gatt_local_services_register(); mutex_unlock(s_svc_register_mutex); } voi...
(!icon_reel) { PBL_CROAK("Couldn't create kino reel"); } // Position the icon kino_area = GRect(icon_x_offset, icon_y_offset, data->launch_app_window.layer.bounds.size.w, data->launch_app_window.layer.bounds.size.h); layer_set_frame((Layer *) &data->kino_layer, &kino_area); kino_layer...
window_get_user_data(window)
; KinoLayer *kino_layer = &data->kino_layer; kino_layer_init(kino_layer, &window->layer.bounds); layer_add_child(&window->layer, &kino_layer->layer); #if PLATFORM_ROBERT || PLATFORM_CALCULUS const char *url_font_key = FONT_KEY_GOTHIC_28_BOLD; const GColor name_bg_color = GColorClear; const char *name_font...
4, 104}, { 344, 648, 160}, { 392, 720, 304}, { 328, 848, 224}, // 5 seconds { 496, 1152, 272}, { 336, 1208, 432}, { 392, 1520, 296}, { 216, 1040, 376}, { 376, 1048, 232}, { 256, 888, 288}, { 248, 720, 264}, { 256, 584, 168}, { 304, 600, 192}, { 352, 664, 288}, ...
{ 48, 1136, 312}, { 64, 1552, 536}, { -152, 1312, 184}, { 32, 1120, 392}, { 72, 880, 224}, { 104, 640, 136}, { 176, 512, 112}, { 248, 632, 112}, // 11 seconds { 192, 1024, 168}, { 8, 976, 0}, { 24, 1120, 160}, { -80, 1064, 248}, { -32, 1088, 64}, { -136, 1280,...
{ 248, 944, 80}, { 280, 1192, 136}, { 72, 1288, 368}, { 144, 1280, 544}, { -128, 1504, 264}, { -8, 1168, 456}, { -112, 952, 352}, { -112, 848, 208}, { 56, 576, 160}, { 176, 568, 168}, { 168, 672, 184}, { 128, 736, 384}, { -64, 848, 160}, // 14 seconds { -96, ...
//////////////////////// #include "stubs_passert.h" #include "stubs_logging.h" #include "stubs_pbl_malloc.h" #include "stubs_mutex.h" // Globals QemuSerialGlobals s_state; // Setup //////////////////////////////////// void test_qemu_serial__initialize(void) { qemu_serial_private_init_state(&s_state); } void test_...
(&s_state, &rcv_bytes, &rcv_protocol)
); prv_send_bytes(msg_data, sizeof(msg_data)); rcv_msg = qemu_serial_private_assemble_message(&s_state, &rcv_bytes, &rcv_protocol); cl_assert(rcv_msg); cl_assert_equal_i(rcv_bytes, 2*sizeof(msg_data)); cl_assert_equal_m(msg_data, rcv_msg, sizeof(msg_data)); cl_assert_equal_m(msg_data, rcv_msg+sizeof(msg_da...
m)->freed = true; } } static int prv_comparator(void *a, void *b) { return ((TestCacheItem *)a)->id - ((TestCacheItem *)b)->id; } // setup and teardown void test_circular_cache__initialize(void) { memset(s_cache_buffer, 0, sizeof(s_cache_buffer)); circular_cache_init(&s_test_cache, (uint8_t *)s_cache_buffer, ...
circular_cache_push(&s_test_cache, &s_test_item[0])
; circular_cache_flush(&s_test_cache); cl_assert(*s_test_item[0].freed); cl_assert(!(*s_test_item[1].freed)); cl_assert(!(*s_test_item[2].freed)); memset(s_cache_buffer, 0, sizeof(s_cache_buffer)); *s_test_item[0].freed = false; circular_cache_push(&s_test_cache, &s_test_item[0]); circular_cache_push...
, { 1344, 296, -152}, { 1040, 304, 24}, { 848, 256, 40}, { 824, 240, 56}, { 840, 256, 40}, // 89 seconds { 824, 304, 0}, { 800, 304, -72}, { 896, 376, -176}, { 1120, 344, -184}, { 1136, 312, -192}, { 1344, 200, 32}, { 1496, 320, 56}, { 1288, 400, 0}, { 1104, 2...
{ 1456, 384, 0}, { 976, 272, 40}, { 1168, 200, 80}, { 1312, -8, 240}, { 1056, 16, 224}, { 920, 48, 160}, { 848, 48, 128}, { 816, -16, 96}, { 760, -96, 80}, { 744, -176, 32}, { 848, -208, 0}, // 95 seconds { 960, -120, -56}, { 1472, -208, 32}, { 1528, -96, 72},...
day: timestamp at beginning of event, duration for rest of the day // middle days: all day events // end days: event at end time // // single event: // timestamp, duration are same as the original item nodes[0]->timestamp = timeline_item_get_tz_timestamp(header); const time_t midnight_first = time_util_ge...
prv_show_event(new_node, now, midnight, direction, show_all_day)
between the title and subtitle container_rect.size.h += fcc_number_subtitle_height; } grect_align(&container_rect, cell_layer_bounds, GAlignCenter, true /* clip */); // Draw the FCC title in the top left of the container // We'll reuse this box for the title, subtitle, and icon frames GRect box = (GRect...
(cd->menu_items, sizeof(*cd->menu_items) * ++cd->menu_count)
----------- AnimationHandlers animation_get_handlers(Animation *animation_h) { if (animation_private_using_legacy_2(NULL)) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. AnimationHandlers *handlers =...
if (!animation) { return 0; }
return animation->delay_ms; } // ------------------------------------------------------------------------------------------- uint32_t animation_get_abs_start_time_ms(Animation *animation_h) { if (animation_private_using_legacy_2(NULL)) { // We need to enable other applib modules like scroll_layer, menu_layer...
printf(" -q \t\tOnly report tests that had an error\n"); printf(" -Q \t\tQuit as soon as a test fails\n"); printf(" -l \t\tPrint suite, category, and test names\n"); printf(" -tXX\t\tRun a specifc test by name\n"); exit(-1); } static void clar_parse_args(int argc, char **argv) { int i; for (i = 1;...
if (argc > 1) clar_parse_args(argc, argv);
if (_clar.active_suite == NULL) { size_t i; for (i = 0; i < _clar_suite_count; ++i) clar_run_suite(&_clar_suites[i]); } clar_print_shutdown( _clar.test_count, (int)_clar_suite_count, _clar.total_errors ); clar_on_shutdown(); clar_mock_cleanup(); clar_unsandbox(); return _...
health_service_metric_averaged_accessible( metric, day_start, now, HealthServiceTimeScopeDailyWeekdayOrWeekend)
; if (!(accessible & HealthServiceAccessibilityMaskAvailable)) { prv_display_alert("NOT ACCESSIBLE"); return; } // Weekday/weekend avg up to now char temp[64]; HealthValue avg; avg = health_service_sum_averaged(metric, day_start, now, HealthServiceTimeScopeDailyW...
odule extern void gatt_client_discovery_discover_range( GAPLEConnection *connection, ATTHandleRange *hdl_range); void command_bt_disc_start(char *start_handle, char *end_handle) { bt_lock(); { ATTHandleRange range = { .start = atoi(start_handle), .end = atoi(end_handle) }; GAPLEConnecti...
{ log_level = 255; }
hc_endpoint_logging_set_level(log_level); prompt_send_response_fmt(buffer, 32, "Ble Log level set to: %i", log_level); } extern bool hc_endpoint_logging_get_level(uint8_t *level); void command_ble_logging_get_level(void) { uint8_t log_level; char buffer[32]; if (!hc_endpoint_logging_get_level(&log_level)) {...
&file->iter, key); settings_raw_iter_write_val(&file->iter, val); // Mark the new record as write complete, now that we have completely written // out the header, key, and value. set_flag(&new_hdr, SETTINGS_FLAG_WRITE_COMPLETE); settings_raw_iter_write_header(&file->iter, &new_hdr); file->used_space += rec...
settings_file_close(file)
; // We have to close and reopen the new_file so that it's temp flag is cleared. // Before the close succeeds, if we reboot, we will just end up reading the // old file. After the close suceeds, we will end up reading the new // (compacted) file. char *name = kernel_strdup(new_file.name); settings_file_clos...
) { tempa[0] = getSBoxValue(tempa[0]); tempa[1] = getSBoxValue(tempa[1]); tempa[2] = getSBoxValue(tempa[2]); tempa[3] = getSBoxValue(tempa[3]); } tempa[0] = tempa[0] ^ Rcon[i/Nk]; } else if (Nk > 6 && i % Nk == 4) { // Function Subword() { ...
{ a = (*state)[i][0]; b = (*state)[i][1]; c = (*state)[i][2]; d = (*state)[i][3]; (*state)[i][0] = Multiply(a, 0x0e) ^ Multiply(b, 0x0b) ^ Multiply(c, 0x0d) ^ Multiply(d, 0x09); (*state)[i][1] = Multiply(a, 0x09) ^ Multiply(b, 0x0e) ^ Multiply(c, 0x0b) ^ Multiply(d, 0x0d); (*state)[i][2] = ...
} // The SubBytes Function Substitutes the values in the // state matrix with values in an S-box. static void InvSubBytes(void) { uint8_t i,j; for(i=0;i<4;++i) { for(j=0;j<4;++j) { (*state)[j][i] = getSBoxInvert((*state)[j][i]); } } } static void InvShiftRows(void) { uint8_t temp; // ...
->shoe_blue_small : &data->shoe_blue); #else GBitmap *shoe = has_passed_goal ? &data->shoe_green : &data->shoe_blue; #endif // SNOWY_SCREEN_RES #else const GColor fill_color = GColorDarkGray; const GColor text_color = GColorWhite; GBitmap *shoe = &data->shoe; #endif // PBL_COLOR #if PBL_ROUND prv_draw_outer_...
prv_update_daily_steps_avg(data)
; prv_update_hrm_bpm(data); prv_normalize_data(data); layer_mark_dirty(&data->base_layer); } #if UNITTEST T_STATIC void prv_set_data(KickstartData *data, int32_t current_steps, int32_t typical_steps, int32_t daily_steps_avg, int32_t current_bpm) { data->current_steps = current_steps;...
void time_selection_window_configure(TimeSelectionWindowData *time_selection_window, const TimeSelectionWindowConfig *config) { text_layer_set_text(&time_selection_window->label_text_layer, config->label); if (config->color.a) { selection_layer_set_active_bg_color(&time_sele...
(&time_selection_window->status_layer, PBL_IF_COLOR_ELSE(OPTION_MENU_STATUS_SEPARATOR_MODE, StatusBarLayerSeparatorModeNone))
; layer_add_child(&time_selection_window->window.layer, &time_selection_window->status_layer.layer); time_selection_window_configure(time_selection_window, config); } void time_selection_window_deinit(TimeSelectionWindowData *time_selection_window) { if (time_selection_window) { status_bar...
app_free(card_data->headings[i].secondary_value)
; } for (int i = 0; i < card_data->num_subtitles; i++) { app_free(card_data->subtitles[i].label); } for (int i = 0; i < card_data->num_zones; i++) { app_free(card_data->zones[i].label); } i18n_free_all(card_data); app_free(card_data); health_detail_card_destroy(card); }
ash_write_bytes((uint8_t *)data, prv_current_page_flash_addr(), sizeof(*data)); } } static void prv_erase_region_and_save(SharedPRFData *data) { flash_region_erase_optimal_range_no_watchdog(FLASH_REGION_SHARED_PRF_STORAGE_BEGIN, FLASH_REGION_SHARED_PRF_STORAGE_BEGIN, ...
PBL_LOG(LOG_LEVEL_DEBUG, "Overwriting SPRF field at offset %d, size %d", (int)offset, (int)field_size)
; // write the crc first so it's easier to detect a non empty field (we can just read if the CRC is // not 0xFFFFFFFF instead of comparing all bytes. *(uint32_t *)field = new_crc; flash_write_bytes(field, prv_current_page_flash_addr() + offset, field_size); cleanup: prv_dealloc_struct(data); } static void...
_MISSES_REG = 0x0; CACHE->CACHE_MRM_CTRL_REG = 0x0; CACHE->CACHE_MRM_TINT_REG = 0x0; CACHE->CACHE_MRM_THRES_REG = 0x0; CACHE->SWD_RESET_REG = 0x0; #if DEFAULT_REGISTER_DEBUG // DCDC REG_SETF(DCDC, DCDC_CTRL_0_REG, DCDC_FAST_STARTUP, 0x0); REG_SETF(DCDC, DCDC_CTRL_0_REG, DCDC_BROWNOUT_LV_MODE, 0x1); REG...
(DCDC, DCDC_TEST_0_REG, DCDC_OUTPUT_MONITOR, 0x0)
; REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_ANA_TEST, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_IDLE, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V18P, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_VDD, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V18, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCD...
mestamp_valid(data->last_processed_timestamp)) { return; } PBL_LOG(LOG_LEVEL_INFO, "Got SleepData for wday: %d, cur_wday: %d, sleep: %"PRIu32"", wday, cur_wday, data->sleep_duration); activity_metrics_prv_set_metric(ActivityMetricSleepTotalSeconds, wday, data->sleep_duration); activity...
{ if (metric != ActivityMetricStepCount && metric != ActivityMetricSleepTotalSeconds) { PBL_LOG(LOG_LEVEL_WARNING, "Health DB doesn't store an average for metric %d", metric); return false; } SettingsFile file; if (prv_file_open_and_lock(&file) != S_SUCCESS) { return false; } char key[HEALTH_D...
bool health_db_get_typical_step_averages(DayInWeek day, ActivityMetricAverages *averages) { if (!averages) { return false; } // Default results _Static_assert(((ACTIVITY_METRIC_AVERAGES_UNKNOWN >> 8) & 0xFF) == (ACTIVITY_METRIC_AVERAGES_UNKNOWN & 0xFF), "Cannot use memset"); memset...
_is_in_progress; bool firmware_update_is_in_progress(void) { return s_firmware_update_is_in_progress; } void psleep(int millis) { } void app_storage_get_file_name(char *name, size_t buf_length, AppInstallId app_id, PebbleTask task) { strcpy(name, "t"); } void bluetooth_analytics_ha...
htonl(crc)
, }; prv_receive_data(s_session, (const uint8_t *)&commit_msg, sizeof(commit_msg)); } static void prv_receive_abort(uint32_t cookie) { AbortRequest abort_msg = (AbortRequest) { .cmd = CmdAbort, .cookie = htonl(cookie), }; prv_receive_data(s_session, (const uint8_t *) &abort_msg, sizeof(abort_msg)); }...
ies, }; prv_att_uuid_to_uuid(&item->uuid, &char_dest->uuid); end_ptr += sizeof(GATTCharacteristic); uuid_to_string(&char_dest->uuid, uuid_str); PBL_LOG(LOG_LEVEL_DEBUG, " Found Characteristic %s Handle 0x%"PRIx16, uuid_str, item->c.value_handle); } else if (item->type =...
if (!cccd_found) { // gah, Android doesn't seem to create the CCCD, but it does seem to auto-subscribe any // bonded device so let's assume this is what happen and notify the main firmware that we are // subscribed. PBL_LOG(LOG_LEVEL_DEBUG, "No cccd found for service changed characteristic, assu...
UP, 0, prv_volume_long_click_start_handler, prv_volume_long_click_end_handler); window_long_click_subscribe(BUTTON_ID_DOWN, 0, prv_volume_long_click_start_handler, prv_volume_long_click_end_handler); window_long_click_subscribe(BUTTON_ID_SELECT, 0, prv_pla...
{ app_window_stack_remove(&data->no_music_window->window, true); app_free(data->no_music_window); data->no_music_window = NULL; }
} static void prv_update_now_playing(MusicAppData *data) { layer_set_hidden((Layer *)&data->track_pos_bar, !music_is_progress_reporting_supported()); char artist_buffer[MUSIC_BUFFER_LENGTH]; char title_buffer[MUSIC_BUFFER_LENGTH]; music_get_now_playing(title_buffer, artist_buffer, NULL); if (music_needs_u...
LL) { return; } menu_layer_deinit(menu_layer); applib_free(menu_layer); } Layer* menu_layer_get_layer(const MenuLayer *menu_layer) { return &((MenuLayer *)menu_layer)->scroll_layer.layer; } ScrollLayer* menu_layer_get_scroll_layer(const MenuLayer *menu_layer) { return &((MenuLayer *)menu_layer)->scroll_...
MAX(a->row, b->row)
000}, { 64, 16, -992}, { 64, 24, -1000}, { 64, 16, -1000}, { 64, 32, -992}, { 64, 8, -1000}, { 64, 24, -1000}, { 64, 24, -1000}, { 72, 16, -1000}, { 64, 24, -992}, { 64, 24, -1000}, { 64, 16, -1000}, { 64, 24, -1000}, { 64, 16, -1000}, { 64, 24, -1000}, { 72, ...
{ 56, 24, -1000}, { 64, 16, -1000}, { 64, 16, -1000}, { 64, 16, -1000}, { 64, 16, -992}, { 64, 24, -1000}, { 64, 16, -1000}, { 64, 16, -1000}, { 64, 16, -992}, { 64, 16, -1000}, { 64, 16, -1000}, { 56, 24, -1000}, { 64, 8, -1008}, { 64, 24, -1000}, { 56, 16, -...
{ 56, 24, -1000}, { 64, 24, -1000}, { 56, 16, -1000}, { 64, 16, -1000}, { 56, 16, -1000}, { 56, 16, -1000}, { 64, 24, -1000}, { 56, 16, -1000}, { 64, 24, -992}, { 56, 24, -1000}, { 64, 16, -1000}, { 64, 16, -992}, { 56, 16, -1000}, { 56, 16, -1000}, { 56, 24,...
fault timeout after which looking for follow up clicks will be stopped static const uint32_t MULTI_CLICK_DEFAULT_TIMEOUT_MS = 300; //! Default delay before long click is fired static const uint32_t LONG_CLICK_DEFAULT_DELAY_MS = 400; typedef enum { ClickHandlerOffsetSingle = offsetof(ClickConfig, click.handler), Cl...
prv_multi_click_get_min(recognizer)
; } return recognizer->config.multi_click.max; } static uint32_t prv_multi_click_get_timeout(ClickRecognizer *recognizer) { if (false == prv_is_multi_click_enabled(recognizer)) { return 0; } if (recognizer->config.multi_click.timeout == 0) { return MULTI_CLICK_DEFAULT_TIMEOUT_MS; } return recogni...
de "drivers/periph_config.h" #include "util/delay.h" #include "stm32f4xx_gpio.h" #include "stm32f4xx_qspi.h" #define MX25U_FASTREAD_DUMMYCYCLES 4 typedef enum MX25UCommand { // SPI/QSPI Commands MX25UCommand_FastRead = 0x0B, // FAST_READ MX25UCommand_QSPIEnable = 0x35, // QPI MX25UCommand_Reset...
(&qspi_config)
; qspi_config.QSPI_SShift = QSPI_SShift_HalfCycleShift; qspi_config.QSPI_Prescaler = 0x0; qspi_config.QSPI_CKMode = QSPI_CKMode_Mode0; qspi_config.QSPI_CSHTime = QSPI_CSHTime_1Cycle; qspi_config.QSPI_FSize = 22; // 2^23 = 8MB. -> 23 - 1 = 22 qspi_config.QSPI_FSelect = QSPI_FSelect_1; qspi_config.QSPI_DFla...
/* * 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_hrm_subscribed = false; s_hrm_expiration = 0; return true; }
uint32_t time_get_uptime_seconds(void) { return SECONDS_PER_DAY + rtc_get_time(); } static uint32_t s_total_step_count; bool activity_get_metric(ActivityMetric metric, uint32_t history_len, int32_t *history) { if (metric != ActivityMetricStepCount) { return false; } *history = s_total_step_count; retur...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
( "d.toLocaleTimeString('en-us');", "TypeError: Unsupported locale" )
; EXECUTE_SCRIPT( "var d = new Date();\n" "d.toLocaleDateString(undefined);\n" ); EXECUTE_SCRIPT_EXPECT_ERROR( "d.toLocaleDateString('de');", "TypeError: Unsupported locale" ); EXECUTE_SCRIPT( "var d = new Date();\n" "d.toLocaleString(undefined);\n" ); EXECUTE_SCRIPT_EXPECT_ERROR...
s_invoke_pending(); // All tests start at 5pm, which is 1020 minutes into a 1440 minute day. The BMR for // the above user is 1859 kcalories per day, so we expect to get: // 1859 * 1020/1440 = 1328 kcalories activity_get_metric(ActivityMetricRestingKCalories, 1, &value); const int k_bmr_cal_2 = 1859 * ACT...
cl_assert_equal_i(value, 220 * SECONDS_PER_MINUTE)
; cl_assert_equal_i(health_service_sum_today(HealthMetricSleepSeconds), 220 * SECONDS_PER_MINUTE); activity_get_metric(ActivityMetricSleepRestfulSeconds, 1, &value); cl_assert_equal_i(value, 100 * SECONDS_PER_MINUTE); cl_assert_equal_i(health_service_sum_today(HealthMetricSleepRestfulSeconds), ...
/* * 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...
{ // Couldn't capture framebuffer return; }
ctx->draw_state.draw_implementation->blend_horizontal_line(ctx, y, x1, x2, ctx->draw_state.stroke_color); graphics_release_frame_buffer(ctx, framebuffer); } void prv_assign_line_vertical_non_aa(GContext* ctx, int16_t x, int16_t y1, int16_t y2) { 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...
(animation->subject, animation->values.from.grect)
; } if (to_frame) { animation->values.to.grect = *to_frame; } return (PropertyAnimation *)animation; }
0x01, 0x00, 0x41, 0x2c, 0x42, 0x2e, 0x30, 0x2c, 0x31, 0x38, 0x34, 0x2e, 0x37, 0x35, 0x35, }; prv_receive_entity_update(nan_playback_info_update, sizeof(nan_playback_info_update)); prv_assert_initial_playback_state(); } void test_ams__receive_incomplete_csv_list_player_playback_info_update(void) { prv_con...
{ ams_destroy(); ams_create(); // No assert hit. }
void test_ams__destroy_after_destroy_is_fine(void) { ams_destroy(); ams_destroy(); // No assert hit. } void test_ams__destroy_disconnects_from_music_service(void) { prv_discover_ams(1 /* num_instances */); // Simulate successful subscription: BLECharacteristic entity_update = s_characteristics[0][AMSCha...
/* * 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 (pebble_task_get_current() == PebbleTask_App) { return app_state_get_current_timeline_item_action_source(); } else { return s_kernel_current_timeline_item_action_source; }
} void kernel_ui_set_current_timeline_item_action_source(TimelineItemActionSource current_source) { if (pebble_task_get_current() == PebbleTask_App) { app_state_set_current_timeline_item_action_source(current_source); } else { s_kernel_current_timeline_item_action_source = current_source; } }
/* * 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) { .origin = { 0, 40 }, .size = { bounds.size.w, 100 } })
; prv_populate_amb_read_str(&data->ambient_reading[0]); text_layer_set_font(data->text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); text_layer_set_text(data->text_layer, data->ambient_reading); text_layer_set_text_alignment(data->text_layer, GTextAlignmentCenter); layer_add_child(window_layer, te...
/* * 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_times", 1.0)
)); *node = (NotificationQueueNode) { .op = NotificationQueueOpPerformAction, .uid = uid, .action_id = action_id }; prv_notif_queue_push_common(node); } static void prv_notif_queue_push_attr_request(uint32_t uid, ANCSProperty properties) { NotificationQueueNode *node = kernel_malloc_check(sizeof(N...
(LOG_LEVEL_DEBUG, "ANCS is alive!")
; // Restart analytics tracking (if it stopped) and the 'is alive' timer prv_ancs_is_alive_start_tracking(); } T_STATIC void prv_check_ancs_alive(void) { // Stop the next check timer prv_ancs_is_alive_stop_timer(); if (s_ancs_client) { s_ancs_client->alive_check_pending = false; prv_set_state(ANCSC...
or; } else if (battery_mv >= battery_curve[num_curve_points-1].voltage) { return battery_curve[num_curve_points-1].percent * scaling_factor; } // search through the curves for the next charge level... uint32_t charge_index; for (charge_index = num_curve_points-2; (charge_index > 0) && (battery_mv < b...
{ return ((hours * 100) / BOARD_CONFIG_POWER.battery_capacity_hours) + BOARD_CONFIG_POWER.low_power_threshold; }
// for unit tests and analytics int32_t battery_curve_lookup_percent_with_scaling_factor( int battery_mv, bool is_charging, uint32_t scaling_factor) { return (prv_lookup_percent_by_voltage(battery_mv, is_charging, scaling_factor)); }
e(s_activity_state.bg_wait_semaphore, k_timeout); } return *cb_success; } // ------------------------------------------------------------------------------------------------ bool activity_init(void) { ACTIVITY_LOG_DEBUG("init"); s_activity_state = (ActivityState) {}; s_activity_state.mutex = mutex_create_r...
{ bool result; mutex_lock_recursive(s_activity_state.mutex); result = s_activity_state.started; mutex_unlock_recursive(s_activity_state.mutex); return result; }
1st) at 00:00 // date -d "2014/01/01 00:00:00" "+%s" ==> 1388563200 fake_rtc_init(0, 1388563200); // Init fake filesystem used to load/store wakeup events fake_spi_flash_init(0, 0x1000000); //from test_settings_file.c pfs_init(false); stub_pebble_tasks_set_current(PebbleTask_KernelBackground); // Reset...
(late_wakeup_id, wakeup_get_next_scheduled())
; // Set time 10 minutes into the future, late_event should fire rtc_set_time(late_event); // Force wakeup to check for current wakeup event. wakeup_enable(false); wakeup_enable(true); // Simulate the firing of the late event stub_new_timer_fire(wakeup_get_current()); wakeup_dispatcher_system_task((v...
break; case ProcessAppSDKType_4x: app_type = "4.x"; break; } char *const sdk_platform = platform_type_get_name(process_metadata_get_app_sdk_platform(app_md)); PBL_LOG(LOG_LEVEL_DEBUG, "Starting %s app <%s>", app_type, process_metadata_get_name(app_md)); // new logging only allows for 2 %s...
memory_segment_get_size(&app_ram)
- stack_guard_size); MemorySegment app_segment; PBL_ASSERTN(memory_segment_split(&app_ram, &app_segment, app_segment_size)); PBL_ASSERTN(memory_segment_split(&app_segment, NULL, stack_guard_size)); // No (accessible) memory segments can be placed between the top of APP_RAM // and the end of stack. Stacks al...
&pg_hdr, curr_page); break; // we are done } } // we have succesfully allocated space for the file, so add file specific info f->start_page = f->curr_page = start_page; FileHeader file_hdr; memset(&file_hdr, 0xff, sizeof(file_hdr)); file_hdr.file_namelen = strlen(f->name); file_hdr.file_size =...
for (int fd = FD_INDEX_OFFSET; fd < FD_INDEX_OFFSET+PFS_FD_SET_SIZE; fd++) { if (PFS_FD(fd).fd_status == FD_STATUS_FREE) { *fdp = fd; return (FDAvail); } if (PFS_FD(fd).fd_status == FD_STATUS_UNREFERENCED) { if ((unref == -1) || (PFS_FD(fd).time_closed < curr_time_closed)) { unref ...
; settings_file_each(&file, prv_each_cb_quit_early, (void *)&cur_val); cl_assert_equal_i(STOPPING_NUM, cur_val); } void test_settings_file__in_place(void) { printf("Testing that we can update a setting file in place\n"); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_in_place", 4096))...
settings_raw_iter_next(&file.iter)
; // We now are forced to start searching in the middle, wrap around, and continue searching // from the beginning. This will result in us calling `settings_raw_iter_next` NUM_RECORDS - 1 // times. before_count = settings_raw_iter_prv_get_num_record_searches(); cl_must_pass(settings_file_get(&file, key, key_...
ice->add_subscriber_callback(subscription->task); } service->subscribers[subscription->task] = subscription->event_queue; ++service->num_subscribers; } void event_service_subscribe_from_kernel_main(PebbleSubscriptionEvent *subscription) { PBL_ASSERT_TASK(PebbleTask_KernelMain); prv_event_service_subscribe(s...
if (!prv_event_service_send_event(service->subscribers[i], e)) { PBL_LOG(LOG_LEVEL_INFO, "Queue full! %d not delivered to task %d!", (int)e->type, (int)i); #if !RELEASE // For 3rd party apps, just close them. For a 1st party app or other task, reboot // the watch ...
-16, -344}, { 1080, -32, -400}, { 1264, 56, -432}, { 1232, 120, -408}, { 1352, 80, -400}, { 1032, 112, -304}, { 1504, 0, -176}, { 1528, -128, -136}, { 1480, -240, -104}, { 1192, -240, -112}, { 928, -192, -128}, // 34 seconds { 784, -136, -176}, { 720, -152, -176}, ...
{ 1328, 392, -280}, { 1344, 400, -288}, { 928, 376, -312}, { 1480, 192, -296}, { 1608, 16, -216}, { 1640, -176, -184}, { 1416, -176, -192}, { 1104, -176, -152}, { 912, -136, -152}, { 872, -168, -216}, { 848, -240, -160}, { 800, -200, -296}, { 808, -232, -304}, { 8...
{ 968, -568, -328}, { 664, -248, -264}, { 848, -128, -336}, { 1288, -120, -424}, { 1368, -360, -384}, { 1080, -264, -352}, { 936, -128, -328}, { 912, -8, -264}, { 928, -48, -304}, { 984, -112, -344}, // 42 seconds { 1120, 0, -528}, { 1312, 144, -504}, { 1304, 232...
er->length); prv_start_retransmit_timer(retransmit_sequence_number); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Reached maximum number of retransmit attempts."); prv_bounce_ncp_state(); } } static void prv_start_retransmit_timer(uint8_t sequence_number) { pulse2_reliable_retransmit_timer_start( RETRANS...
xSemaphoreCreateBinary()
; xSemaphoreGive(s_tx_lock); } static void prv_bounce_ncp_state(void) { ppp_control_protocol_lower_layer_is_down(PULSE2_TRAINCP); ppp_control_protocol_lower_layer_is_up(PULSE2_TRAINCP); } #endif
PBL_ASSERTN(state->test_entry.name[0] != 0); int steps = 0; int orientation = 0; int vmc = 0; int light = 0; int plugged_in = 0; if (state->test_entry.version == 1) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d", &steps, &orientation, &vmc); } else if (state->test_...
{ sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.min); }
else if (strcmp(token, "TEST_START_AT_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.max); } else if (strcmp(token, "TEST_FORCE_SHUT_DOWN_AT") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.force_shut_down_at); } else if (strcmp(token,...
sk_App), HCI_ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST); } void test_gap_le_connect__connection_event_for_registered_client_by_bonding(void) { BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk(); BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_devic...
prv_dummy_device(1)
; // Register connection intent: BTErrno e = gap_le_connect_connect(&device, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoOK); prv_fake_connec...
mount of time for busy bit to clear static bool prv_wait_for_not_busy(I2CBus *bus) { static const int WAIT_DELAY = 10; // milliseconds if (i2c_hal_is_busy(bus)) { delay_ms(WAIT_DELAY); if (i2c_hal_is_busy(bus)) { PBL_LOG(LOG_LEVEL_ERROR, "Timed out waiting for bus %s to become non-busy", bus->name); ...
(slave, register_address, 1, result)
/* * 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 (!index_out) { return false; } for (size_t idx = 0; idx < prefs->num_locations; idx++) { if (uuid_equal(location, &prefs->locations[idx])) { *index_out = idx; return true; } } return false; }
static void prv_add_to_list_if_valid(WeatherDBKey *key, WeatherDBEntry *entry, void *context) { WeatherDBIteratorContext *iterator_context = context; SerializedWeatherAppPrefs *prefs = iterator_context->serialized_prefs; char key_string_buffer[UUID_STRING_BUFFER_LENGTH] = {0...
, used, section(".log_string.header"))) = NEW_LOG_HEADER "=<file>:<line>:<level>:<color>:<msg>,"\ "CORE_ID=" str(CORE_ID_MAIN_MCU) ",CORE_NAME=Tintin"; // Confirm the size calculations. If these fail, update tools/loghashing/check_elf_log_strings.py // We can't currently handle 64 bit values. ...
app_state_get_log_state()
; } else if (task == PebbleTask_Worker) { log_state = worker_state_get_log_state(); } if (log_state) { if (log_state->in_progress) { return NULL; } log_state->in_progress = true; return log_state; } else { return kernel_applib_get_log_state(); } } // Release the LogState buffer...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(prv_notification_iterator_cb, &last_notification_received_id)
; TimelineItem notification; if (!notification_storage_get(&last_notification_received_id, &notification)) { // We couldn't load the notification for some reason; just bail out with the subtitle cleared notifications_glance->subtitle[0] = '\0'; return; } const char *title = attribute_get_string(&n...
int segment_height = SCREEN_HEIGHT / num_segments; for (int i = 1; i < num_segments; ++i) { graphics_draw_line(ctx, GPoint(segment_width * i, 0), GPoint(segment_width * i, SCREEN_HEIGHT)); graphics_draw_line(ctx, GPoint(0, segment_height * i), GPoint(SCREEN_WIDTH, segment_hei...
GPoint(SCREEN_WIDTH / 2, SCREEN_HEIGHT)
); ctx.draw_state.drawing_box = GRect(0, -SCREEN_HEIGHT / 2, SCREEN_WIDTH, SCREEN_HEIGHT); ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled.${BIT_DEPTH_NAME}.pbi")); printf("-- left\n"); prv_reset...
-48, -272}, // 149 seconds { 1088, -40, -264}, { 1080, -24, -240}, { 1080, -32, -224}, { 1280, -40, -240}, { 1448, -48, -208}, { 1216, -64, -160}, { 1048, -72, -160}, { 960, -32, -168}, { 984, -32, -160}, { 1296, -56, -176}, { 1360, -64, -88}, { 1168, -104, -40}, ...
{ 1624, -40, -288}, { 1216, -32, -176}, { 880, -16, -168}, { 728, 8, -192}, { 1024, 40, -200}, { 1232, 0, -128}, { 1256, -32, -88}, { 1112, -80, -64}, { 1024, -112, -32}, { 1016, -104, -32}, { 992, -72, -32}, { 1008, -72, -56}, { 976, -72, -48}, // 155 seconds ...
{ 968, -48, -256}, { 1016, -24, -288}, { 1080, -16, -280}, { 1120, -40, -240}, { 1528, -40, -264}, { 1480, -24, -216}, { 1208, -40, -168}, { 944, -40, -168}, { 832, -8, -160}, { 1072, -8, -152}, { 1280, -48, -88}, { 1224, -48, -32}, { 1120, -88, 8}, { 1064, -64, ...
.oldest_valid_key = oldest_valid_key, .newest_valid_key = newest_valid_key, .watchdog_kicks_left = max_records, }; // Rewrite the settings file, keeping only the keys we need PBL_LOG(LOG_LEVEL_DEBUG, "Compacting minute file down to %"PRIu16" records", max_records); status_t status = settings_file_rew...
if (minute_file) { prv_minute_data_file_close(minute_file); }
/* * 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...
bt_driver_cb_pairing_confirm_handle_request(ctx, NULL /* device name */, NULL /* "just works", so no token */)
; bluetooth_analytics_handle_ble_pairing_request(); } void pairing_confirm_handle_complete(const BTDeviceInternal *device, HciStatusCode status) { const PairingUserConfirmationCtx *ctx; bt_lock(); { ctx = (const PairingUserConfirmationCtx *)gap_le_connection_by_device(device); } bt_unlock(); if (!ct...
e StateTransitionToText, StateError, StateFinished, StateExiting, }; _Static_assert(StateExiting < ARRAY_LENGTH(state_map), "The number of states has grown, but state" "the simple state mapping has not been updated"); PBL_ASSERTN(state < ARRAY_LENGTH(state_map)); return state_map[state]; ...
{ VoiceUiData *data = subject; data->mic_window.mic_dot_radius = radius; layer_mark_dirty(&data->mic_window.mic_dot_layer); }
static PropertyAnimation *prv_create_int16_prop_anim(int16_t from, int16_t to, uint32_t duration, const PropertyAnimationImplementation *impl, void *subject) {...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ window_destroy(window); }
; s_head = result; } else { // Insert as tail: prev->next = result; result->next = NULL; } } static ScanResult *list_get_by_index(uint8_t index) { ScanResult *result = s_head; while (index && result) { result = result->next; --index; } return result; } static void list_free_all(voi...
(ctx, cell_layer, (section_index == SectionData) ? "Results" : "Options")
; } static void draw_data_row(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) { ScanResult *result = list_get_by_index(cell_index->row); // Build the title string: char title[32]; // Annotate with "HRM" if the device has a heart rate service: char *hrm_st...
Id *parent_id = &item1.header.parent_id; // cnfirm the two are here cl_assert(reminder_db_get_len((uint8_t *)&item1.header.id, sizeof(Uuid)) > 0); cl_assert(reminder_db_get_len((uint8_t *)&item2.header.id, sizeof(Uuid)) > 0); // remove the two that share a parent cl_assert_equal_i(reminder_db_delete_with_pare...
cl_assert(is_dirty)
; dirty_list = reminder_db_get_dirty_list(); cl_assert(dirty_list); cl_assert_equal_i(list_count((ListNode *)dirty_list), 2); // Mark the final 2 items as synced reminder_db_mark_synced((uint8_t *)&item2.header.id, sizeof(TimelineItemId)); reminder_db_mark_synced((uint8_t *)&item4.header.id, sizeof(Timeli...
// TODO: PBL-22271 Complete timeline text node unit tests // Fakes ///////////////////// typedef struct GTextNodeTestData { GContext gcontext; GRect clip_box; GTextNode *text_node; GSize max_used_size; } GTextNodeTestData; GTextNodeTestData s_data; #define TEST_TEXT "DUMMY TEXT" #define TEST_FONT ((void *)...
(&custom_node.node, ctx, &TEST_TEXT_BOX, NULL, &size)
; cl_assert(size.w > 0); cl_assert(size.h > 0); cl_assert_equal_i(size.w, TEST_TEXT_SIZE.w); cl_assert_equal_i(size.h, TEST_TEXT_SIZE.h); cl_assert_equal_i(size.w, custom_node.node.cached_size.w); cl_assert_equal_i(size.h, custom_node.node.cached_size.h); cl_assert_equal_i(s_num_draw_custom_calls, 1); ...
e this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDI...
property_animation_get_to_grect(a, &test_rect)
; APP_LOG(APP_LOG_LEVEL_DEBUG, "rect is %d, %d, %d, %d", test_rect.origin.x, test_rect.origin.y, test_rect.size.w, test_rect.size.h); switch (click_recognizer_get_button_id(recognizer)) { case BUTTON_ID_UP: animation_set_curve((Animation*) a, AnimationCurveEaseOut); animation_set_curve((An...
jerry_size_t args_count) { JS_VAR JSON = jerry_get_global_builtin((const jerry_char_t *)GLOBAL_JSON); PBL_ASSERTN(!jerry_value_is_undefined(JSON)); JS_VAR func = jerry_get_object_field(JSON, function_name); PBL_ASSERTN(jerry_value_is_function(func)); return jerry_cal...
{ if (s_state.out.object_queue) { list_append((ListNode *)s_state.out.object_queue, (ListNode *)msg); return false; } else { s_state.out.object_queue = msg; return true; } }
JERRY_FUNCTION(prv_post_message) { if (argc < 1) { return rocky_error_arguments_missing(); } const jerry_value_t js_msg = argv[0]; JS_VAR json_string = prv_json_stringify(js_msg); if (jerry_value_has_error_flag(json_string)) { return jerry_acquire_value(json_string); } if (jerry_value_is_undef...
eds = data->current_steps % 1000; if (thousands) { /// Step count greater than 1000 with a thousands seperator snprintf(data->steps_buffer, sizeof(data->steps_buffer), i18n_get("%d,%03d", data), thousands, hundreds); } else { /// Step count less than 1000 snprintf(data->steps_buffer, si...
fonts_get_system_font(FONT_KEY_AGENCY_FB_88_THIN_NUMBERS_AM_PM)
; #elif SNOWY_SCREEN_RES || SPALDING_SCREEN_RES #if PBL_RECT gbitmap_init_with_resource(&data->shoe_blue_small, RESOURCE_ID_STRIDE_SHOE_BLUE_SMALL); gbitmap_init_with_resource(&data->shoe_green_small, RESOURCE_ID_STRIDE_SHOE_GREEN_SMALL); #endif // PBL_RECT data->steps_font = fonts_get_system_font(FONT_KEY_AGENCY...
es/common/comm_session/session_send_queue.h" #include "services/common/comm_session/protocol.h" #include "util/net.h" #include "util/size.h" #include "FreeRTOS.h" #include "semphr.h" #include "clar.h" extern SendBuffer * comm_session_send_buffer_create(bool is_system); extern void comm_session_send_buffer_destroy(S...
(write_sb, fake_data, max_length)
; comm_session_send_buffer_end_write(write_sb); // Set a yield callback that gives the semph in time but does not clear out the send buffer: SemaphoreHandle_t write_semph = comm_session_send_buffer_write_semaphore(); fake_queue_set_yield_callback(write_semph, prv_receive_but_no_bytes_freed_yield_cb); // Try...
+ 1; // shift to accommodate growing radius end.size.w = DOT_COMPOSITOR_RADIUS * 2; end.size.h = DOT_COMPOSITOR_RADIUS * 2; end.origin.x = DOT_OFFSET - DOT_COMPOSITOR_RADIUS - 1; end.origin.y = BAR_HEIGHT - DOT_COMPOSITOR_RADIUS - 2; // shift to accommodate growing radius PropertyAnimation *prop_anim = ...
if (data->progress_percent >= data->max_fake_progress_percent) { // Hit the max, we're done data->fake_progress_timer = EVENTED_TIMER_INVALID_ID; } else { data->fake_progress_timer = evented_timer_register(FAKE_PROGRESS_UPDATE_INTERVAL, false, prv_fak...
} //////////////////////////// // Public API //////////////////////////// void progress_window_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); ...
{ -144, 840, -192}, { -144, 848, -184}, { -136, 864, -184}, { -152, 848, -168}, { -152, 864, -168}, { -144, 864, -176}, { -144, 872, -176}, { -152, 840, -176}, { -160, 888, -216}, { -152, 872, -208}, // 242 seconds { -144, 896, -240}, { -160, 912, -232}, { -176, ...
{ -176, -824, -616}, { -136, -816, -632}, { -208, -784, -680}, { -192, -800, -704}, { -168, -824, -688}, { -176, -824, -656}, { -136, -808, -640}, { -120, -840, -624}, { -88, -872, -544}, { -16, -1008, -456}, { -40, -984, -464}, { -80, -944, -584}, { -144, -984, -504}...
zone_id, sizeof(timezone_id)); } int16_t shell_prefs_get_automatic_timezone_id(void) { return s_clock_phone_timezone_id; } // Emulate the old BacklightBehaviour type for analytics. // This is a deprecated method and should not be called by new code. BacklightBehaviour backlight_get_behaviour(void) { if (s_backlig...
prv_pref_set(key, &pref, sizeof(pref))
; } void quick_launch_set_enabled(ButtonId button, bool enabled) { QuickLaunchPreference pref; const char *key = NULL; switch (button) { case BUTTON_ID_UP: pref = s_quick_launch_up; key = PREF_KEY_QUICK_LAUNCH_UP; break; case BUTTON_ID_DOWN: pref = s_quick_launch_down; key ...
, 248}, { -1048, 256, 192}, { -1064, 320, 176}, { -1048, 416, 168}, { -1224, 440, 352}, { -1096, 936, 432}, { -1248, 56, 296}, { -1256, 472, 344}, { -1072, 552, 232}, { -1168, 536, 192}, // 44 seconds { -1408, 368, 272}, { -1560, 256, 336}, { -1416, 184, 328}, { -...
{ -1312, 480, 16}, { -1384, 656, -72}, { -1360, 656, 24}, { -1224, 600, 160}, { -968, 656, 136}, { -920, 432, 104}, { -1032, 584, 104}, { -1048, 528, 128}, { -1280, 664, 240}, { -1152, 520, 272}, { -1000, 424, 264}, { -1208, 440, 232}, { -1472, 408, 272}, { -1576,...
BufferedNotificationHeader header = { .characteristic = BLE_CHARACTERISTIC_INVALID, .value_length = 0, }; bool has_more = gatt_client_subscriptions_get_notification_header(GAPLEClientKernel, &header); cl_assert_equal_i(header.value_length...
cl_assert(s_connection->gatt_subscriptions != NULL)
; ATTHandleRange range; fake_gatt_get_bp_att_handle_range(&range.start, &range.end); ATTHandleRange bogus_range = { .start = range.end + 1, .end = range.end + 5 }; prv_pend_events_to_kernel_and_app(); // should have no effect since service is not in this range gatt_client_subscription_cleanup_...
const int16_t height_actual = height - (2 * radius); // Take into account the radius values to determine the eight points for each of the four lines const GPoint top_l = GPoint(origin.x + radius, origin.y); const GPoint top_r = GPoint(origin.x + radius + width_actual - 1, origin.y); const GPoint bottom_l =...
(ctx, rect, radius, ctx->draw_state.stroke_width)
; } else { // Non-Antialiased and Stroke Width == 1 prv_draw_round_rect(ctx, rect, radius); } } } void graphics_draw_round_rect_by_value(GContext* ctx, GRect rect, uint16_t radius) { graphics_draw_round_rect(ctx, &rect, radius); } void graphics_context_init(GContext *context, FrameBuffer *fram...
D_ENDPOINT_ID (9000) // GetBytes #define ALLOWED_ENDPOINT_ID (APP_MESSAGE_ENDPOINT_ID) static const uint8_t TEST_PAYLOAD[] = {0xaa, 0xbb, 0xcc, 0xdd}; static uint8_t TEST_EXPECTED_PP_MSG[sizeof(PebbleProtocolHeader) + sizeof(TEST_PAYLOAD)]; void test_app_message_sender__initialize(void) { s_system_session_ptr = &s...
(s_system_session_ptr)
; assert_consumed(AppMessageSenderErrorSuccess, 1); app_free(outbox_data); } void test_app_message_sender__system_session_and_js_app(void) { s_process_md.allow_js = true; AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbox_message(s_system_session_ptr, ALLOWED_ENDPOINT_ID, ...