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...
{ SharedCircularBuffer buffer; uint8_t storage[9]; shared_circular_buffer_init(&buffer, storage, sizeof(storage)); const uint8_t* out_buffer; uint16_t out_length; // Add a client SharedCircularBufferClient client = (SharedCircularBufferClient) {}; shared_circular_buffer_add_client(&buffer, &client); ...
cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "abc", 3, false)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 0); cl_assert(!shared_circular_buffer_write(&buffer, (uint8_t*) "d", 1, false)); // too full cl_assert_equal_i(shared_circular_buffer_get_write_space_remain...
/* * 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...
while (true) { // Poll the status register's ready bit: while (attempts_left) { const uint32_t status = RNG->SR; // Check clock flags, they would indicate programmer error. PBL_ASSERTN((status & (RNG_SR_CECS | RNG_SR_CEIS)) == 0); // First check the seed error bits: // We're check...
/* * 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 ActivityGenderMale; }
uint16_t activity_prefs_get_weight_dag(void) { return 7539; } uint16_t activity_prefs_get_height_mm(void) { return 1900; } uint8_t activity_prefs_heart_get_elevated_hr(void) { return 100; } uint8_t activity_prefs_heart_get_zone1_threshold(void) { return 130; } uint8_t activity_prefs_heart_get_zone2_thresh...
(fake_pbl_malloc_num_net_allocs(), num_net_allocs)
; } void test_timeline__cleanup(void) { fake_settings_file_reset(); fake_pbl_malloc_clear_tracking(); } // Tests /////////////////////////// void test_timeline__all_forwards(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // Note: 1421178000 = Tue Jan 13 11:40:00...
{ // "add alarm" cell not highlighted // Have to manually override the tint color as we're using a color that differs // from the ones the MenuLayer uses. graphics_context_set_tint_color(ctx, GColorLightGray); }
} if (new_bitmap_resource != data->current_plus_icon_resource_id) { // Change the icon to the dotted one data->current_plus_icon_resource_id = new_bitmap_resource; gbitmap_deinit(&data->plus_icon); gbitmap_init_with_resource(&data->plus_icon, data->current_plus_icon_resource_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...
{ s_last_phone_ui_event = PhoneEventType_End; }
void phone_ui_handle_call_hide(void) { s_last_phone_ui_event = PhoneEventType_Hide; } void phone_ui_handle_caller_id(PebblePhoneCaller *caller) { s_last_phone_ui_event = PhoneEventType_CallerID; } /////////////////////////////////////////////////////////// // Helpers ///////////////////////////////////////////...
/* * 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 (reel) { return ((KinoReelImplPDCI*)reel)->image; }
Item temp = {{{0}}}; cl_assert(S_SUCCESS == reminder_db_read((uint8_t*)&item1.header.id, sizeof(Uuid), (uint8_t*)&temp, sizeof(CommonTimelineItemHeader))); // Note: we set things to null because it makes it easier to compare two // TimelineItems with memcmp // check item 1 memset(&temp, 0, sizeof(Timel...
cl_assert_equal_i(reminder_db_delete_with_parent(parent_id), S_SUCCESS)
; // confirm the two are gone 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); // confirm the others are still here cl_assert(reminder_db_get_len((uint8_t*)&item3.header.id, sizeof(Uuid)) > 0); cl_...
1256, -96, 160}, // 10 seconds { 1120, -96, 104}, { 1064, -88, 56}, { 1016, -16, 48}, { 952, 0, 96}, { 880, -72, 88}, { 816, -72, 72}, { 848, -40, 40}, { 896, -32, -8}, { 952, -80, -56}, { 1160, -104, 64}, { 1600, -128, -16}, { 1376, -56, -112}, { 1080, -72, -304...
{ 96, -368, -808}, { 32, -368, -824}, { 0, -392, -800}, { -8, -408, -832}, { 16, -408, -848}, { 0, -424, -848}, { -56, -416, -824}, { -112, -408, -872}, { -96, -432, -848}, { -96, -416, -912}, { -120, -368, -952}, { -152, -304, -1072}, { -72, -216, -1024}, // 16 s...
{ 2112, 64, -56}, { 1560, 152, -184}, { 1072, 80, -224}, { 832, -112, -80}, { 992, -120, 64}, { 1088, -152, 136}, { 1040, -40, 64}, { 952, 24, 0}, { 880, 16, -112}, { 784, -16, -136}, { 840, -32, -176}, { 904, -48, -240}, { 936, -72, -296}, { 1000, -112, -344}, ...
a_length, sizeof(expected_scan_resp_data)); // Compare scan response data: cl_assert_equal_i(memcmp(expected_scan_resp_data, ad->data + ad->ad_data_length, ad->scan_resp_data_length), 0); ble_ad_destroy(ad); } void test_ble_ad_parse__set_service_uuids_128_bi...
memcmp(expected_ad_data, ad->data, ad->ad_data_length)
/* * 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...
aligned (8)
)) static const uint8_t GENERIC_WARNING_LARGE_builtin_bytes[] = { 0x50, 0x44, 0x43, 0x49, 0xe9, 0x00, 0x00, 0x00, 0x01, 0x00, 0x50, 0x00, 0x50, 0x00, 0x0d, 0x00, /* bytes 0 - 16 */ 0x03, 0x00, 0xc0, 0x03, 0xff, 0x01, 0x00, 0x02, 0x00, 0x20, 0x01, 0x48, 0x02, 0x20, 0x01, 0xa8, /* bytes 16 - 32 */ 0x01, 0x03, 0x00,...
/* * 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...
delay_us(1000)
GColor color) { // FIXME PBL-34552: This test produces an incorrect image, see JIRA const Fixed_S16_3 x1_fixed = (Fixed_S16_3) { .integer = x1 }; Fixed_S16_3 x2_fixed = (Fixed_S16_3) { .integer = x2 }; const uint8_t gradient_width = (uint8_t)(...
(ctx, true /* transparent */)
; cl_assert(transparent_mask); // Verify all mask pixels are initialized to be transparent (0) prv_verify_mask_pixel_values(ctx, transparent_mask, 0); graphics_context_mask_destroy(ctx, transparent_mask); GDrawMask *opaque_mask = graphics_context_mask_create(ctx, false /* transparent */); cl_assert(opaque_...
le_dictation_result to be called next with a dictation response void voice_stop_dictation(VoiceSessionId session_id) { mutex_lock(s_lock); if ((s_state == SessionState_Idle) || (session_id != s_session_id) || (session_id == VOICE_SESSION_ID_INVALID)) { goto unlock; } if (s_state != SessionState...
(sentence, (char *) word->data, word->length)
; } return true; } static bool prv_handle_dictation_nlp_result_common(VoiceEndpointResult result, AudioEndpointSessionId session_id, bool app_initiated, Uuid *app_uuid) { if (s_state == SessionState_Idle) { ...
num_contacts = NUM_SEND_TEXT_CONTACTS; for (int i = 0; i < NUM_SEND_TEXT_CONTACTS; ++i) { prefs->contacts[i] = (SerializedSendTextContact) { .is_fav = (i < (NUM_SEND_TEXT_CONTACTS/2)), }; uuid_generate(&prefs->contacts[i].contact_uuid); uuid_generate(&prefs->contacts[i].address_uuid); } Ser...
{ cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_text_prefs, sizeof(s_send_text_prefs)), S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_insert(WEATHER_KEY, WEATHER_KEY_LEN, s_weather_prefs, ...
void test_watch_app_prefs_db__get_send_text(void) { const int data_len = sizeof(s_send_text_prefs); cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_text_prefs, data_len), S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_get_len(...
or (int i = 0; i < num_minutes; i++) { prv_assert_minute_data(&retrieve[i], &minute_data[i]); } } // --------------------------------------------------------------------------------------- // Test to make sure that the minute data file gets compacted correctly. If we write more than // ALG_MINUTE_DATA_FILE_LEN ...
(num_records, num_minutes)
; cl_assert_equal_i(start, start_utc); for (int i = 0; i < num_minutes; i++) { prv_assert_minute_data(&retrieve[i], &minute_data[i]); } // Retrieve, trying to start from a lot farther back, it should return the UTC of the first // record available. Also ask for more than what is available num_records =...
/* * 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...
(QSPI_FLASH, &QSPI_FLASH_PART, qspi_flash_is_in_coredump_mode(QSPI_FLASH))
animated); GBitmap const *select_bitmap; switch (music_get_playback_state()) { case MusicPlayStatePlaying: select_bitmap = &data->icon_pause; break; case MusicPlayStatePaused: select_bitmap = &data->icon_play; break; default: select_bitmap = &data->icon_play_pause; break; ...
prv_toggle_playing()
; prv_set_action_bar_state(context, ActionBarStateLongPress); prv_do_haptic_feedback_vibe(context); } static void prv_play_pause_long_click_end_handler(ClickRecognizerRef recognizer, void *context) { prv_set_action_bar_state(context, ActionBarStateSkip); } static void prv_skipping_click_config_provider(void *co...
ue: %d)", (int)peek_steps); data->cur_steps = peek_steps + data->steps_offset; steps_update_text(data); } else if (event == HealthEventSignificantUpdate) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Got significant update event"); steps_update_text(data); } else if (event == HealthEventSleepUpdate...
text_layer_get_layer(data->steps_card.delta_step_layer)
); // "Tracking disabled" message data->steps_card.msg_layer = text_layer_create(root_bounds); text_layer_set_text_alignment(data->steps_card.msg_layer, GTextAlignmentCenter); text_layer_set_font(data->steps_card.msg_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set...
analytics_inc(ANALYTICS_DEVICE_METRIC_TIMELINE_PAST_NAVIGATION_COUNT, AnalyticsClient_System); } else { analytics_inc(ANALYTICS_DEVICE_METRIC_TIMELINE_FUTURE_NAVIGATION_COUNT, AnalyticsClient_System); } } static void prv_click_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_BACK, p...
(data, true /* open */)
; animation_set_duration(sidebar_slide, duration); Animation *speed_lines = data->launch_into_deep_pin ? timeline_layer_create_speed_lines_animation(&data->timeline_layer) : NULL; return animation_spawn_create(peek_out, sidebar_slide, speed_lines, NULL); } static void prv_play_peek_in(TimelineAppData *da...
node_with_text( i18n_get("BPM", base_layer), data->units_font, TEXT_COLOR, container); units_text_node->node.offset.x += 2; units_text_node->node.offset.y = units_offset_y; } const int offset_y = PBL_IF_RECT_ELSE(101, 109); graphics_text_node_draw(&container->node, ctx, &GRect(0, offset_y,...
app_window_stack_push(window, true)
; } void health_hr_summary_card_destroy(Layer *base_layer) { HealthHrSummaryCardData *data = layer_get_data(base_layer); app_timer_cancel(data->pulsing_heart_timer); gdraw_command_sequence_destroy(data->pulsing_heart); i18n_free_all(base_layer); layer_destroy(base_layer); } GColor health_hr_summary_card_get...
e_client.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "kernel/pebble_tasks.h" #include "process_management/app_manager.h" #include "process_management/worker_manager.h" #include "os/mutex.h" #include "services/common/event_service.h" #include "syscall/syscall_internal.h" #include "syscall/s...
{ if ((service = s_event_services[i]) == NULL) { continue; } if (service->subscribers[task] == NULL) { continue; } PebbleSubscriptionEvent event = { .subscribe = false, .task = task, .event_type = i, }; prv_event_service_unsubscribe(&event); }
} void event_service_system_init(void) { s_plugin_list_mutex = mutex_create(); } void event_service_init(PebbleEventType type, EventServiceAddSubscriberCallback add_subscriber_callback, EventServiceRemoveSubscriberCallback remove_subscriber_callback) { if(s_event_services[type] != NULL) { // an event ser...
/* * 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, 0, 300, 400)
); // only expands .h, keeps .w layer_set_frame(&l, &GRect(10, 20, 200, 500)); cl_assert_equal_grect(l.bounds, GRect(0, 0, 300, 500)); } void test_layer_rect__3_x_sync_if_applicable(void) { Layer l; s_process_manager_compiled_with_legacy2_sdk = false; layer_init(&l, &GRect(10, 20, 30, 40)); cl_assert_e...
andler) ); __builtin_unreachable(); } static bool check_and_increment_reset_loop_detection_bits(void) { uint8_t counter = (boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_THREE) << 2) | (boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_TWO) << 1) | boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_ONE); if (counter == 7)...
(error_code_buffer)
; display_error_code(error_code); static uint8_t prev_button_state = 0; prev_button_state = button_get_state_bits() & ~SELECT_BUTTON_MASK; while (1) { // See if we should restart uint8_t button_state = button_get_state_bits() & ~SELECT_BUTTON_MASK; if (button_state != prev_button_state) { sy...
che.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and ...
graphics_context_get_bitmap(ctx)
; cl_assert(native_framebuffer->info.format == GBitmapFormat8BitCircular); cl_assert(DISPLAY_FRAMEBUFFER_BYTES == 25944); bitblt_bitmap_into_bitmap(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE)); } // Tests 8-bit bitblt tiling s...
tion = &item->action_group.actions[i]; if (prv_should_show_action_in_action_menu(window_data, item, action) && action != dismiss_action) { timeline_actions_add_action_to_root_level(action, root_level); } } if (has_ancs_mute_action) { const char *app_id = attribute_get_string(&item->attr_li...
(item, window_data, source)
; if (config.root_level == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "Couldn't create notification action menu"); return; } window_data->action_menu = timeline_actions_push_action_menu( &config, window_manager_get_window_stack(NOTIFICATION_PRIORITY)); } static void prv_select_long_click_handler(ClickRecogn...
0, -701}, { 207, 744, -658}, { 129, 491, -735}, { 134, 681, -701}, { 154, 758, -660}, { 180, 677, -746}, { 176, 651, -756}, { 177, 651, -675}, { 150, 680, -683}, { 173, 680, -747}, { 227, 780, -723}, { 178, 739, -716}, { 136, 561, -734}, { 142, 623, -662}, { 205, ...
{ 72, 24, -1000}, { 80, 16, -1000}, { 72, 16, -1008}, { 72, 16, -1000}, { 72, 16, -1000}, { 72, 16, -1000}, { 72, 16, -1000}, { 72, 16, -992}, { 72, 8, -1000}, { 72, 24, -1000}, { 72, 8, -1000}, { 80, 8, -1008}, { 72, 24, -1000}, { 72, 16, -1000}, { 72, 8, -10...
{ 72, 24, -1000}, { 72, 16, -1000}, { 72, 32, -1000}, { 64, 16, -1000}, { 72, 24, -992}, { 72, 24, -1000}, { 72, 24, -1000}, { 64, 24, -1000}, { 72, 24, -1000}, { 64, 24, -1000}, { 72, 24, -1000}, { 72, 16, -1000}, { 64, 24, -1000}, { 72, 24, -1000}, { 72, 24...
uint8_t gradient_width = (uint8_t)((x2 - x1) / 2); x2_fixed.integer -= gradient_width; const int16_t clip_box_min_x = ctx->draw_state.clip_box.origin.x; const int16_t clip_box_max_x = (int16_t)(grect_get_max_x(&ctx->draw_state.clip_box) - 1); prv_assign_horizontal_line_delta_raw(ctx, y, x1_fixed, x2_fixed, gr...
graphics_context_mask_create(ctx, false /* transparent */)
; cl_assert(opaque_mask); // Verify all mask pixels are initialized to be opaque (3) prv_verify_mask_pixel_values(ctx, opaque_mask, 3); graphics_context_mask_destroy(ctx, opaque_mask); } //extern const GDrawRawImplementation g_mask_recording_draw_implementation; void test_graphics_context_mask__basic_record(v...
ransition_to(this, LinkState_RequestSent); } break; case LinkState_AckReceived: if (prv_handle_configure_request(this, packet)) { prv_transition_to(this, LinkState_Opened); } break; default: break; } } static void prv_on_configure_ack(PPPControlProtocol *this, ...
if (this->state->link_state == LinkState_AckReceived) { prv_transition_to(this, LinkState_RequestSent); } else if (this->state->link_state == LinkState_Opened) { PBL_LOG(LOG_LEVEL_WARNING, "Terminate-Ack received on an open connection"); prv_send_configure_request(this); prv_transition_to(this, LinkSt...
} // Protected interface (control_protocol_impl.h) // ============================================= void ppp_control_protocol_init(PPPControlProtocol *this) { *this->state = (PPPControlProtocolState) { .lock = mutex_create(), .link_state = LinkState_Initial, .restart_count = 0, .restart_timer = new...
in = time_elapsed, .type = ActivitySessionType_Sleep, .ongoing = true, }; activity_sessions_prv_add_activity_session(&sleep_activity); // Flip the switch to say we are in light sleep. activity_private_state()->sleep_data.cur_state = ActivitySleepStateLightSleep; // Run,Walk,Sleep sessions active, en...
(ActivityMetricHeartRateZone3Minutes, 1, &zone3_minutes)
; cl_assert_equal_i(zone3_minutes, 2); // Add a "blip" which shouldn't affect our zone counts. // This shouldn't affect our zone counts prv_set_median_hr_for_minutes(180 /* BPM */, 1 /* minutes */); cl_assert_equal_b(prv_is_hr_elevated(), true); prv_set_median_hr_for_minutes(70 /* BPM */, 1 /* minutes */);...
88 * 100 + (49 - 1) * 100); cl_assert_equal_b(status, true); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(49))); // Since loop only equals 2, make sure that huge elapsed time leaves us at final frame status = gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence,...
(0, 0, 180, 180)
; int xshift = 71; int yshift = 39; GRect shift_bounds = GRect(xshift, yshift, orig_bounds.size.w - xshift, orig_bounds.size.h - yshift); GBitmapSequence *bitmap_sequence = gbitmap_sequence_create_with_resource(resource_id); cl_assert(bitmap_sequence)...
--------------------------------------- static bool prv_verify_checksum(const PebbleProcessInfo* app_info, const uint8_t* data) { const uint8_t header_size = sizeof(PebbleProcessInfo); const uint8_t *crc_data = data + header_size; const uint32_t app_size = app_info->load_size - header_size; uint32_t calculated...
prv_intialize_sdk_process(task, &info, destination)
; } // ---------------------------------------------------------------------------------------------- static bool prv_load_from_resource(const PebbleProcessMdResource *app_md, PebbleTask task, MemorySegment *destination) { PebbleProcessInfo info; ...
} void app_message_outbox_close(AppMessageCtxOutbox *outbox) { // Verify outbox phase. if (outbox->phase == OUT_CLOSED) { return; } // Cancel any outstanding timer. prv_stop_timer(outbox); outbox->transmission_size_limit = 0; applib_free(outbox->app_outbox_message); outbox->app_outbox_message = ...
app_state_get_app_message_ctx()
->outbox; if (prv_is_message_pending(outbox->phase)) { PBL_LOG(LOG_LEVEL_ERROR, "Can't call app_message_outbox_send() now, wait for sent_callback!"); return APP_MSG_BUSY; } if (outbox->phase != OUT_WRITING) { return APP_MSG_INVALID_STATE; } const size_t transmission_size = dict_write_end(&outbox-...
ure //////////////////////////////////////////////////////////////// // Fakes //////////////////////////////////////////////////////////////// #include "fake_rtc.h" // Stubs //////////////////////////////////////////////////////////////// #include "stubs_analytics.h" #include "stubs_app_cache.h" #include "stubs_app_i...
timeline_item_destroy(item)
; } void test_timeline_api__item_pin_to_timeline(void) { TimelineItem *item = timeline_item_create_with_attributes(0, 0, TimelineItemTypePin, LayoutIdTest, NULL, NULL); Uuid id = item->header.id; cl_assert(!timeline_exists(&id)); cl_assert(timeline_add(item)); timeline_item_destroy(item); cl_assert(ti...
er the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/applib_malloc.auto.h" #include "kernel/events.h" #include "kernel/...
pebble_task_get_current()
== CONSUMER_TASK; } else if ((current_state == SmartstrapAttributeStateWritePending) && (new_state == SmartstrapAttributeStateIdle)) { return pebble_task_get_current() == CONSUMER_TASK; } else if ((current_state == SmartstrapAttributeStateRequestPending) && (new_state == SmartstrapAtt...
/* * 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...
FAILED(len)
) { RETURN_STATUS_UP(len); } const size_t restricted_size = MIN(buffer_size, (size_t)len); const status_t read_result = settings_file_get( store, &key, sizeof(key), buffer, restricted_size); if (FAILED(read_result)) { RETURN_STATUS_UP(read_result); } return restricted_size; } // Legacy versi...
t.x = start_inner_point.x + 3; } #endif const int32_t max_points = 20; GPath path = (GPath) { .points = app_zalloc_check(sizeof(GPoint) * max_points), .num_points = 0, }; const int32_t top_right = frame.size.w / 2; const int32_t bot_right = frame.size.h + top_right; const int32_t bot_left = fra...
(ctx, p1, p2)
; } #endif static void prv_draw_steps_and_shoe(GContext *ctx, const char *steps_buffer, GFont font, GRect bounds, GColor color, GBitmap *shoe_icon, bool screen_is_obstructed, bool has_bpm) { #if PBL_BW bounds.origin.y += screen_is_obstructed ? (...
, "Got a PutBytes Object that we shouldn't have gotten"); prv_cleanup(AppFetchResultGeneralFailure); goto finally; } // add the size of the finished PutBytes transaction to the total size. s_fetch_state.total_size += pb_event->total_size; } if (s_fetch_state.app && s_fetch_state.worker...
prv_put_event_simple(AppFetchEventTypeStart)
; put_bytes_expect_init(FETCH_TIMEOUT_MS); break; case APP_FETCH_RESPONSE_BUSY: PBL_LOG(LOG_LEVEL_WARNING, "Error: Phone is currently busy"); prv_cleanup(AppFetchResultPhoneBusy); break; case APP_FETCH_RESPONSE_UUID_INVALID: PBL_LOG(LOG_LEVEL_WARNING, "Error: UUID Invalid"); ...
1, FONT_HEIGHT - 1 } }, .font = (GFont) { 0 }, .overflow_mode = GTextOverflowModeWordWrap, .alignment = GTextAlignmentLeft, .max_used_size = (GSize) { 0, 0 } }; // In all cases, the first line should be layed out (not truncated) graphics_text_layout_get_max_used_size(&gcontext, "JR Whopper", font...
framebuffer_clear(fb)
; graphics_draw_text(&gcontext, "\n", font, box, GTextOverflowModeFill, GTextAlignmentLeft, NULL); graphics_draw_text(&gcontext, "\n\n", font, box, GTextOverflowModeFill, GTextAlignmentLeft, NULL); graphics_draw_text(&gcontext, "\1\n", font, box, GTex...
/* * 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...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_600_pbl_28361_1 //> TEST_EXPECTED 600 //> TEST_EXPECTED_MIN 550 //> TEST_EXPECTED_MAX 650 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { 88, 224, -1080}, { -...
{ -848, 608, -872}, { -696, 384, -952}, { -776, 600, -1176}, { -224, 472, -1184}, { -168, 328, -1016}, { -192, 416, -1064}, { -40, 400, -984}, { 72, 296, -864}, { -24, 312, -816}, { -80, 232, -744}, { -88, 136, -736}, { -72, 344, -800}, { 24, 152, -824}, { 136, 1...
mutex); } static void prv_dispatch_samples_main(void *context_ptr) { MicDevice *this = context_ptr; this->state->main_pending = false; prv_dispatch_samples(context_ptr); } static void prv_dispatch_samples_bg(void *context_ptr) { MicDevice *this = context_ptr; this->state->bg_pending = false; prv_dispatch_...
system_task_add_callback_from_isr(prv_dispatch_samples_bg, (void *)this, &system_task_switch_context)
; } PROFILER_NODE_STOP(mic); return system_task_switch_context || main_switch_context; } extern MicDevice * const MIC; bool mic_selftest(void) { stop_mode_disable(InhibitorMic); // Configure mic serial data pin with pull-down so that the GPIO does // not float if there is an open-circuit condition on th...
mutex(); return app_id; } /////////////////////////// // App DB API /////////////////////////// //! Fills an AppDBEntry for a given UUID. This is a wrapper around app_db_read to keep it uniform //! with `app_db_get_app_entry_for_install_id` status_t app_db_get_app_entry_for_uuid(const Uuid *uuid, AppDBEntry *entry...
{ rv = settings_file_set(&s_app_db.settings_file, (uint8_t *)&app_id, sizeof(AppInstallId), val, val_len); }
prv_close_file_and_unlock_mutex(); if (rv == S_SUCCESS) { // app install something app_install_do_callbacks(new_install ? APP_AVAILABLE : APP_UPGRADED, app_id, NULL, NULL, NULL); } return rv; } int app_db_get_len(const uint8_t *key, int key_len) { status_t rv = prv_lock_mutex_and_open_file(); i...
eturn pdPASS; } signed portBASE_TYPE xQueueGenericReceive( QueueHandle_t pxQueue, void * const pvBuffer, TickType_t xTicksToWait, portBASE_TYPE xJustPeeking ) { return pdTRUE; } BaseType_t xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue ) { return pdTRUE; } UBaseType_t uxQueueMessagesWaiting( const ...
cl_assert(s_last_to_app_event.type == PEBBLE_PROCESS_DEINIT_EVENT)
; // Simulate the deinit timer timing out instead of the app actually closing. app_manager_close_current_app(false /* gracefully */); // However it's still not ready to die. cl_assert(app_manager_get_current_app_md() == (PebbleProcessMd*) &s_third_party_app); // The trap has been set and eventually the sys...
/* * 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...
{ DiscoveryJobQueue *node = connection->discovery_jobs; if (!node) { return BTErrnoOK; // no more jobs to run } // Note, that the job only gets removed from the list after discovery // has finished or error'ed out. That way the watchdog retry mechanism // can simply call this routine again to kick off ...
/* * 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 (fd < 0) { PBL_LOG(LOG_LEVEL_ERROR, "Could not create app menu order file"); goto cleanup; }
// write back the whole file int wrote_storage_bytes = pfs_write(fd, (uint8_t *)storage, storage_size); if (wrote_storage_bytes != storage_size) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to write all bytes of order list"); } pfs_close(fd); cleanup: kernel_free(storage); mutex_unlock(s_data.order_mutex); ...
arStateVolume, ActionBarStateLongPress, }; typedef struct MusicAppSizeConfig { const char *music_time_font_key; const char *no_music_font_key; int16_t horizontal_margin; GRangeVertical artist_field; GRangeVertical title_field; GRangeVertical time_field; GRect cassette_rect; int16_t cassette_animati...
prv_config()
; return GRect(config->horizontal_margin, config->track_field.origin_y, prv_content_width(), config->track_field.size_h); } static const ButtonId BUTTON_FORWARD = BUTTON_ID_DOWN; static const ButtonId BUTTON_BACKWARD = BUTTON_ID_UP; static const int16_t BOUNCEBACK_OFFSET = 6; // These offsets get rid...
y_animation_legacy2_update_int16((PropertyAnimationLegacy2 *)property_animation_h, distance_normalized); return; } PropertyAnimationPrivate *property_animation = prv_find_property_animation(property_animation_h); if (!property_animation) { return; } int1...
interpolate_int16( distance_normalized, property_animation->values.from.grect.size.w, property_animation->values.to.grect.size.w)
; result.size.h = interpolate_int16( distance_normalized, property_animation->values.from.grect.size.h, property_animation->values.to.grect.size.h); ((PropertyAnimationImplementation*) property_animation->animation.implementation) ->accessors.setter.grect(property_animation->subject, res...
/* * 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 ((end_time >= end_utc) && (end_time <= utc_sec) && (!remove_ongoing || !sessions[i].ongoing)) { // Keep it continue; }
bt_persistent_storage_get_bt_classic_pairing_by_id(id_1, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_1, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&link_key_1, &link_key_out, sizeof(link_key_out)); cl_...
(&link_key_1, &link_key_out, sizeof(link_key_out))
; cl_assert_equal_s(name_1, name_out); cl_assert_equal_i(platform_bits_1, platform_bits_out); ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_2, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_2, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ APP_LOG(APP_LOG_LEVEL_ERROR, "Cannot determine size for published icon"); is_valid = false; }
else if (resource_size > RESOURCE_MAX_SIZE) { APP_LOG(APP_LOG_LEVEL_ERROR, "Published icon size %zuB > %dB max", resource_size, RESOURCE_MAX_SIZE); is_valid = false; } } kino_reel_destroy(reel); return is_valid; } T_STATIC bool prv_validate_lut(ResAppNum res_app_num) { uint32_t ...
/* * 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...
("1234", 4)
; assert_checksum(0xc2091428); } void test_legacy_checksum__repeated_byte(void) { update("1111", 4); assert_checksum(0x13cbc447); } void test_legacy_checksum__two_words(void) { update("abcd", 4); update("efgh", 4); assert_checksum(0x18c4859c); } void test_legacy_checksum__split_word(void) { update("123...
; i < 5; i++) { // Each write is 1/8 to 1/4 of the initial file size. int num_bytes = DLS_FILE_INIT_SIZE_BYTES/8 + (rand() % DLS_FILE_INIT_SIZE_BYTES/8); // By doing 16 loops, we are sure to cycle through the allocated file size at least twice. for (int j=0; j<16; j++) { prv_log_consume_random(lo...
{ continue; }
/* * 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...
gcolor_get_bw(tint_color)
; if (gcolor_equal(tint_color, GColorBlack)) { *compositing_mode = GCompOpAnd; } else if (gcolor_equal(tint_color, GColorWhite)) { *compositing_mode = GCompOpSet; } } } void bitblt_bitmap_into_bitmap_tiled_1bit_to_1bit(GBitmap* dest_bitmap, co...
LL, 0 /*flags*/); PBL_ASSERTN(success); } static void dls_endpoint_print_message(uint8_t *message, int num_bytes) { PBL_ASSERTN(message != NULL); switch (message[0]) { case DataLoggingEndpointCmdClose: { DataLoggingCloseSessionMessage *msg = (DataLoggingCloseSessionMessage *)message; PBL_LOG...
legacy_defective_checksum_memory(data, num_bytes)
, }; comm_session_send_buffer_write(sb, (const uint8_t *) &header, sizeof(header)); comm_session_send_buffer_write(sb, data, num_bytes); comm_session_send_buffer_end_write(sb); dls_endpoint_print_message((uint8_t *) &header, num_bytes); DLS_HEXDUMP(data, MIN(num_bytes, 64)); logging_session->comm.num_by...
>bus->name); } prv_bus_pins_cfg_i2c(slave->bus); prv_bus_reset(slave->bus); return recovered; } /*--------------------DATA TRANSFER FUNCTIONS--------------------------*/ //! Wait a short amount of time for busy bit to clear static bool prv_wait_for_not_busy(I2CBus *bus) { static const int WAIT_DELAY = 10;...
{ // Reset I2C bus if busy flag does not clear prv_bus_reset(bus); }
return result; } bool i2c_read_register(I2CSlavePort *slave, uint8_t register_address, uint8_t *result) { return i2c_read_register_block(slave, register_address, 1, result); } bool i2c_read_register_block(I2CSlavePort *slave, uint8_t register_address_start, uint32_t read_size, uint...
fer, MUSIC_BUFFER_LENGTH); strncpy(data->title_buffer, title_buffer, MUSIC_BUFFER_LENGTH); // It is sufficient to mark one layer as dirty. layer_mark_dirty(&data->title_text_layer.layer); } else if (title_changed) { prv_trigger_track_change_animation(data); } } prv_update_layout(data...
(&data->window.layer, &data->position_text_layer.layer)
; prv_configure_music_text_layer(&data->length_text_layer, data->length_buffer, &time_rect, TIME_BOUNDS_OFFSET, GTextAlignmentRight, fonts_get_system_font(config->music_time_font_key)); layer_add_child(&data->window.layer, &data->length_text_layer.l...
/* * 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...
{ params[0] = s_le_conn_params.slave_latency_events / num_samps; params[1] = s_le_conn_params.supervision_to_ms / num_samps; }
s_le_conn_params = (LeConnectionParams){}; } static void prv_update_conn_params(uint16_t slave_latency_events, uint16_t supervision_to_10ms) { bt_lock(); s_le_conn_params.slave_latency_events += slave_latency_events; s_le_conn_params.supervision_to_ms += (supervision_to_10m...
uality_Acceptable: return "Acceptable"; case HRMQuality_Good: return "Good"; case HRMQuality_Excellent: return "Excellent"; } WTF; } static char *prv_translate_error(AppMessageResult result) { switch (result) { case APP_MSG_OK: return "APP_MSG_OK"; case APP_MSG_SEND_TIMEOUT: ret...
layer_mark_dirty(&app_data->window.layer)
; bpm = hrm->bpm.bpm; bpm_quality = hrm->bpm.quality; } else if (hrm->event_type == HRMEvent_LEDCurrent) { led_current = hrm->led.current_ua; } else if (hrm->event_type == HRMEvent_Diagnostics) { if (!app_data->ready_to_send) { return; } AppMessageResult result = ap...
); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 0); // -----------------------------------------------------------------------...
MAX(duration_b, duration_c)
; // Create 3 animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); Animation *c = prv_create_test_animation(); animation_set_duration(c, duration_c); // Create a spawn out of b...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ *((uint8_t*)location) = (uint8_t)CLIP(val, 0, UINT8_MAX); return; }
night_of(timestamp); time_t yesterday_midnight = time_util_get_midnight_of(rtc_get_time() - SECONDS_PER_DAY); time_t last_week_midnight = time_util_get_midnight_of(rtc_get_time() - SECONDS_PER_WEEK); time_t next_week_midnight = time_util_get_midnight_of(rtc_get_time() + SECONDS_PER_WEEK); const char *time_fmt ...
if (num_minutes == 1) { str_fmt = i18n_noop("%lu minute ago"); } else { str_fmt = i18n_noop("%lu minutes ago"); }
snprintf(buffer, buf_size, i18n_get(str_fmt, buffer), num_minutes); } else if (difference >= 0) { strncpy(buffer, capitalized ? i18n_get("NOW", buffer) : i18n_get("Now", buffer), buf_size); } else if (difference >= -(SECONDS_PER_HOUR - SECONDS_PER_MINUTE)) { const int num_minutes = prv_round(...
ut, name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_2, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&link_key_2, &link_key_out, sizeof(link_key_out)); cl_assert_equal_s(name_2, name_out); cl_assert_equal_i(platform_bits_2, platform_...
cl_assert_equal_m(&link_key_in, &link_key_out, sizeof(link_key_out))
; cl_assert_equal_s(name_in, name_out); cl_assert_equal_i(platform_bits_in, platform_bits_out); // Now try to read out a pairing that doesn't exist addr_in.octets[0] = 0xff; id_out = bt_persistent_storage_get_bt_classic_pairing_by_addr(&addr_in, &link_key_out, ...
/* * 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(raw_image_get_value_for_bitdepth(test1, 0, 3, 1, 1) == 1)
r_list.attributes[1].id, AttributeIdAncsAction); cl_assert_equal_i(item->action_group.actions[1].attr_list.attributes[1].uint8, 1); timeline_item_destroy(item); } static Attribute action1_attributes[] = { {.id = AttributeIdTitle, .cstring = "Dismiss"}, }; static Attribute action2_attributes[] = { {.id = Attri...
cl_assert_equal_s("", string_list_get_at(list, 0))
; cl_assert_equal_s("b", string_list_get_at(list, 1)); cl_assert_equal_s("", string_list_get_at(list, 2)); cl_assert_equal_s("", string_list_get_at(list, 3)); // 2 strings (last is not terminated and will fall through) will return 2 strings // when deserializing, the deserializer puts a \0 at the end // th...
/* * 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...
kernel_zalloc_check(alloc_size)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ uint8_t opcode; int32_t status_code; uint8_t bad_command[0]; }
InternalErrorResponse; #define REGISTER_BULKIO_HANDLER(domain_type, domain_id, vtable) \ extern PulseBulkIODomainHandler vtable; #include "pulse_bulkio_handler.def" #undef REGISTER_BULKIO_HANDLER static PulseBulkIODomainHandler * const s_domain_handlers[] = { #define REGISTER_BULKIO_HANDLER(domain_type, domain_i...
&line); // Top Notch for Bar 2 // Filled rect used to draw line of REL_BAR_LINE_WIDTH stroke width notch.origin.x = line.origin.x - REL_BAR_LINE_NOTCH_HORIZ_OFFSET + 1; notch.origin.y = line.origin.y; notch.size.w = REL_BAR_LINE_CHECK_LENGTH + REL_BAR_LINE_WIDTH; notch.size.h = REL_BAR_LINE_WIDTH; graphi...
(timeline_layer, ctx, current, rel_bar_value)
; break; case RelationshipBarTypeOverlap: // Draw overlapping lines prv_draw_rel_bar_overlap(timeline_layer, ctx, current, rel_bar_value); break; case RelationshipBarTypeBackToBack: prv_draw_rel_bar_line(timeline_layer, ctx, current, rel_bar_value); break; ...
/* * 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...
attribute_list_add_uint32_list(&attr_list, AttributeIdMetricIcons, metric_values)
/* * 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((idx < MAX_GPIO) && !(s_gpio_clock_count[idx]++)) { SET_BIT(RCC->AHB1ENR, (0x1 << idx)); }
} void gpio_release(GPIO_TypeDef* GPIOx) { uint8_t idx = ((((uint32_t)GPIOx) - AHB1PERIPH_BASE) / 0x0400); if((idx < MAX_GPIO) && s_gpio_clock_count[idx] && !(--s_gpio_clock_count[idx])) { CLEAR_BIT(RCC->AHB1ENR, (0x1 << idx)); } } void gpio_output_init(OutputConfig pin_config, GPIOOType_TypeDef otype, ...
/* * 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...
gbitmap_destroy(s_dest_bitmap)
; s_dest_bitmap = gbitmap_create_blank(GSize(size.w * steps_x, size.h * steps_y), GBITMAP_NATIVE_FORMAT); ctx.dest_bitmap = *s_dest_bitmap; ctx.draw_state.clip_box = (GRect){.size = size}; ctx.draw_state.drawing_box = ctx.draw_state.clip_box; graphics_context_set_text_co...
); // -450 degrees (-90 * 5 -> -90) should be (-5, 0) result = gpoint_from_polar_internal(&center, radius, -(TRIG_MAX_ANGLE * 5 / 4)); cl_assert_equal_gpoint(result, GPoint(-5, 0)); // 450 degrees (90 * 5 -> 90) should be (0, 5) result = gpoint_from_polar_internal(&center, radius, (TRIG_MAX_ANGLE * 5 / 4));...
p3.x.raw_value += FIXED_S16_3_HALF.raw_value; cl_assert_equal_grect(GRect(5, 5, 2, 2), grect_centered_internal(&p3, GSize(2, 2))); // Repeat for a negative offset center point with 0.5 fractions GPointPrecise p4 = GPointPreciseFromGPoint(GPoint(-5, -5)); p4.x.raw_value -= FIXED_S16_3_HALF.raw_value; p4.y.r...
#define cl_assert_fixedS16_3(v, f) \ cl_assert_equal_i((v).raw_value, (int)((f) * FIXED_S16_3_ONE.raw_value)) #define cl_assert_gpoint_precise(p, px, py) \ do { \ cl_assert_fixedS16_3(p.x, px); \ cl_assert_fixedS16_3(p.y, py); \ } while(0) void test_graphics_circle__grect_polar_calc_values_handles_nu...
S) { return status; } // Keep going until DOWN button is pushed or iterations reached while(((iterations == 0) && enable_flash_test) || ((iterations > 0) && (iteration_count < iterations))) { // Confirm write took place - data should now be set to stress_data1 status = prv_read_verify_halfwo...
task_watchdog_mask_get(pebble_task_get_current())
; if (previous_task_watchdog_state) { task_watchdog_mask_clear(pebble_task_get_current()); } enable_flash_test = true; // Schedule test to run switch (test_case_num) { case FLASH_TEST_CASE_RUN_DATA_TEST: status = prv_run_data_test(); break; case FLASH_TEST_CASE_RUN_ADDR_TEST: ...
rn; } const size_t temp_buffer_size = MIN(bytes_remaining, QEMU_MAX_DATA_LEN); uint8_t *temp_buffer = kernel_malloc_check(temp_buffer_size); while (bytes_remaining) { const size_t bytes_to_copy = MIN(bytes_remaining, temp_buffer_size); comm_session_send_queue_copy(session, 0 /* start_offset */, bytes_t...
(s_transport.session, data, length)
; unlock: bt_unlock(); }
/* * 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(pass, GTextAlignmentRight)
; text_layer_set_text(pass, "Pass"); layer_add_child(&window->layer, &pass->layer); bounds.origin.y = 120; TextLayer *fail = &results_ui->fail_text_layer; text_layer_init(fail, &bounds); text_layer_set_font(fail, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text_alignment(fail, GTextAl...
ng permissions and * limitations under the License. */ #include "util/heap.h" #include "util/assert.h" #include "util/math.h" #include "util/logging.h" #include <inttypes.h> #include <stddef.h> #include <string.h> #include <stdio.h> /* The following defines a type that is the size in bytes of the */ /* desire...
UTIL_ASSERT(0)
; // Error: Heap corrupt around <ptr> } static HeapInfo_t *find_segment(Heap* const heap, unsigned long n_units); static HeapInfo_t *allocate_block(Heap* const heap, unsigned long n_units, HeapInfo_t* heap_info_ptr); //! Advance the block pointer to the next block. static HeapInfo_t* get_next_block(Heap * const heap,...
if (s_data_ptr) { window_stack_remove(&s_data_ptr->window, true /* animated */); }
} static void prv_pop_window_kernel_main_cb(void* unused) { prv_pop_window(); } static void prv_pop_window_timer_callback(void *unused) { launcher_task_add_callback(prv_pop_window_kernel_main_cb, NULL); } static void prv_push_pairing_window(void) { BTPairingUIData *data = s_data_ptr; Window *window = &data-...
_voltage( int battery_mv, bool is_charging, uint32_t scaling_factor) { VoltagePoint const * const battery_curve = (is_charging) ? charge_curve : discharge_curve; uint8_t const num_curve_points = (is_charging) ? NUM_CHARGE_POINTS : NUM_DISCHARGE_POINTS; // Constrain the voltage between the min and max points ...
{ if (percent_remaining <= BOARD_CONFIG_POWER.low_power_threshold) { return 0; } percent_remaining -= BOARD_CONFIG_POWER.low_power_threshold; return ((BOARD_CONFIG_POWER.battery_capacity_hours * percent_remaining) / 100); }
//! This call is used internally with PreciseBatteryChargeState //! So must add low_power_threshold to get percentage in terms of //! PreciseBatteryChargeState (which includes low_power_mode) uint32_t battery_curve_get_percent_remaining(uint32_t hours) { return ((hours * 100) / BOARD_CONFIG_POWER.battery_capacity_h...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
test_graphics_context_reset(&ctx, fb)
; layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_across_x_origin_layer"))); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_nx_layer_update_callback)...
OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_role_set: %u", e); } // FIXME: PBL-23399: Single-source this. const gap_conn_params_t preferred_params = { .interval_min = 6, // 7.5ms .interval_max = 24, // 30ms .slave_latency = 4, .sup_timeout = 600, // 6000ms }; e = ble_gap_per_pref_conn_params...
((ble_evt_gap_adv_completed_t *) hdr)
/* * 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...
{ NumberWindow *light_num_window = number_window_create("Light Config", (NumberWindowCallbacks) { .selected = selected_pwm_percentage }, NULL); app_state_set_user_data(light_num_window); uint8_t scale_granularity = 5; // 5 percent at a time uint8_t curr_percent = scale_granularity * ((backlight_get...
static void handle_deinit(void) { NumberWindow *data = app_state_get_user_data(); number_window_destroy(data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* light_config_get_info() { static const PebbleProcessMdSystem s_accel_config_info = { ...
sert(uuid_equal(&state.node->id, &multiday_item.header.id)); cl_assert(state.node->all_day); cl_assert_equal_i(state.node->timestamp, midnight_march_2_pst); cl_assert_equal_i(state.node->duration, MINUTES_PER_DAY); cl_assert_equal_i(state.current_day, midnight_march_2_pst); // day 2 cl_assert(iter_next(&it...
cl_assert_equal_i(timeline_init(&head), S_SUCCESS)
og page size must be divisible by the erase unit size"); //! Given the current address and amount to increment it by, handles wrapping //! and computes the valid flash address static uint32_t prv_get_page_addr(uint32_t curr_page_addr, uint32_t incr_by) { uint32_t new_offset = ((curr_page_addr - FLASH_REGION_DE...
if (log_start_addr == FLASH_LOG_INVALID_ADDR) { // this is the first page we've found log_start_addr = flash_addr; dist = 0; // nothing else to compare against yet }
s_every_day_schedule); cl_assert_equal_i(s_num_timeline_adds , 3); s_current_hour = 10; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); } void test_alarm__recurring_daily_alarm_timeout_behind(void) { AlarmId id; s_current_hour = 11; s_current_minute = 30; id =...
cl_assert_equal_i(s_num_timeline_removes, 36)
; cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // First alarm goes off. Second one should be up s_current_hour = 10; s_current_minute = 30; s_current_day = s_sunday; // Make sure the wday can wrap properly cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 7)...
c language governing permissions and * limitations under the License. */ #include "mfg_command.h" #include "applib/app_launch_reason.h" #include "applib/app_watch_info.h" #include "console/prompt.h" #include "kernel/util/standby.h" #include "mfg/mfg_info.h" #include "process_management/app_install_manager.h" #inclu...
prompt_command_finish()
; BLTEST_LOG("BOOTLOADER TEST STAGE 1"); boot_bit_set(BOOT_BIT_FW_STABLE); BLTEST_LOG("STAGE 1 -- Setting test boot bits"); boot_bit_clear(BOOT_BIT_BOOTLOADER_TEST_A | BOOT_BIT_BOOTLOADER_TEST_B); boot_bit_set(BOOT_BIT_BOOTLOADER_TEST_A); bool as_fw = true; if (strcmp(dest_type, "prf") == 0) { as_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...
option_menu_set_callbacks(option_menu, &callbacks, data)
; return option_menu; } OptionMenu *settings_option_menu_push( const char *i18n_title_key, OptionMenuContentType content_type, int choice, const OptionMenuCallbacks *callbacks_ref, uint16_t num_rows, bool icons_enabled, const char **rows, void *context) { OptionMenu * const option_menu = settings_optio...
uint16_t max_subtitle_length; NotificationAttributeID message:8; uint16_t max_message_length; //! Finish with the Date because the response value for the Date is //! fixed-length which allows us to determine whether the total response is //! finished or whether we need to expect DS notification...
ancs_util_get_attr_ptrs(data, length, s_fetched_notif_attributes, NUM_FETCHED_NOTIF_ATTRIBUTES, s_ancs_client->attributes, ...
86, 362, -59}, { -796, 392, -45}, { -744, 396, -58}, { -750, 414, -62}, { -779, 421, -56}, { -811, 410, -65}, { -856, 427, -90}, { -905, 457, -110}, { -955, 463, -115}, { -914, 431, -86}, { -1064, 447, -36}, { -1068, 509, -51}, { -999, 499, 27}, { -961, 451, 18}, ...
rtc_get_time()
+ 1); samples_remaining -= chunk_size; if (minute_idx != samples_remaining / (60 * SAMPLES_PER_SECOND)) { activity_test_run_minute_callback(); minute_idx = samples_remaining / (60 * SAMPLES_PER_SECOND); prv_clear_event_queue(); } } } // ------------------------------------------------...
/* * 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...
{ *progress_layer = (ProgressLayer){}; layer_init(&progress_layer->layer, frame); progress_layer->layer.update_proc = (LayerUpdateProc) progress_layer_update_proc; progress_layer->foreground_color = GColorBlack; progress_layer->background_color = GColorWhite; progress_layer->corner_radius = 1; }
void progress_layer_deinit(ProgressLayer* progress_layer) { layer_deinit(&progress_layer->layer); } void progress_layer_set_foreground_color(ProgressLayer* progress_layer, GColor color) { progress_layer->foreground_color = color; } void progress_layer_set_background_color(ProgressLayer* progress_layer, GColor c...
result, context); } } static void prv_app_message_setup(void) { s_inbox_size = 0; s_outbox_size = 0; s_outbox_buffer = NULL; s_app_message_outbox_send_call_count = 0; s_is_outbox_message_pending = false; app_message_deregister_callbacks(); } static void prv_app_message_teardown(void) { if (s_outbox_b...
(DICT_OK, result)
; \ for (Tuple *expected_t = dict_read_first(&expected_it); expected_t != NULL; \ expected_t = dict_read_next(&expected_it)) { \ Tuple *found_t = dict_find(&s_outbox_iterator, expected_t->key); \ cl_assert(found_t); \ cl_assert_equal_i(found_t->type, expected_t->type); \ cl_assert_e...
* MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_...
(a, delay_a)
; animation_set_play_count(a, play_count_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_delay(b, delay_b); animation_set_play_count(b, play_count_b); // Create a spawn Animation *spawn = animation_spawn_create(a, b, NULL); cl_assert(spawn != NULL);...
urn prv_create_oom_error(); } jerry_string_to_utf8_char_buffer(json_string, (jerry_char_t *)data_buffer, str_size); OutgoingObject * const obj = task_zalloc(sizeof(*obj)); if (!obj) { task_free(data_buffer); return prv_create_oom_error(); } *obj = (OutgoingObject) { .data_buffer = data_buffer, ...
(ROCKY_EVENT_ERROR, event_name)
== 0) { return true; } return prv_handle_callback_registration(event_name, handler); } const RockyGlobalAPI APP_MESSAGE_APIS = { .init = prv_init_apis, .deinit = prv_deinit_apis, .add_handler = prv_add_handler, }; //////////////////////////////////////////////////////////////////////////////// // Uni...
data->to_reel); } gdraw_command_list_destroy(data->list_copy); applib_free(data); } static uint32_t prv_elapsed_getter(KinoReel *reel) { KinoReelTransformData *data = kino_reel_custom_get_data(reel); return scale_int32(data->normalized, ANIMATION_NORMALIZED_MAX, data->duration); } static uint32_t prv_get_du...
(reel, ctx, offset, processor)
; } } static void prv_draw_processed_in_local(KinoReelTransformData *data, GContext *ctx, GPoint offset, KinoReelProcessor *processor) { KinoReel *reel = prv_get_current_reel(data); GDrawCommandList *source_list = kino_reel_get_gdraw_command_list(reel); GDrawCommandList ...
ef_accel_data_handler(accel_buf, chunk_size); chunk_size = 0; } if (samples_in_minute >= KALG_SAMPLE_HZ * SECONDS_PER_MINUTE) { ref_minute_stats(&orientation, &vmc); samples_in_minute = 0; } } // leftover data, if any if (chunk_size > 0) { steps = ref_accel_data_handler(accel_bu...
{ sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight); }
else if (strcmp(token, "TEST_NAME") == 0) { sscanf(token + strlen(token) + 1, "%s", state->test_entry.name); } } // If this is a "static AccelRawData samples[] = {" line, skip it if (strcmp(token, "static") == 0) { continue; } // Grab a sample if (strcmp(token, "{") == 0) ...
/* * 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...
snprintf(s_text_buf, 80, "Heap full at %dB", s_alloc_total)
; text_layer_set_text(text_heap_info, s_text_buf); return; } s_alloc_total += ALLOC_SIZE; snprintf(s_text_buf, 80, "%dB allocated", s_alloc_total); text_layer_set_text(text_heap_info, s_text_buf); } static void config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, select_cl...
r toggle between the 2 functions or define a dedicated GPIO pin // for Wake-up." // // NB: used by core_dump.c void host_transport_configure_spi_scs_pin(SCSPinFunction function) { if (function == SCSPinFunction_Wakeup_GPIO) { // Configure SCS to generate a wake up interrupt when the line is pulled down: hw_gp...
("Remote Status: %u bytes sendable, %u bytes receivable", remote_status_in.bytes_sendable_count, remote_status_in.bytes_receivable_count)
; } // Single duplex write: size_t tx_len = MIN(tx_bytes_available, remote_status_in.bytes_receivable_count); if (tx_len) { // Calculate the CRC before Transmitting SPITransportMsgFooter tx_footer; tx_footer.crc = crc32(CRC32_INIT, tx_bytes, tx_len); HOST_TRANSPORT_DEBUG_LOG("Expecting to writ...
cted */, (1 << PebbleTask_App), HCI_ERROR_CODE_SUCCESS); } void test_gap_le_connect__register_for_already_connected_bonding(void) { BTErrno e; BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk(); BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_device()...
prv_fake_disconnect(&device, true /* is_master */)
; // Verify both app task and kernel got the (virtual) disconnection event: prv_assert_client_event(&device, false /* connected */, (1 << PebbleTask_App) | (1 << PebbleTask_KernelMain), HCI_ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST); // Verify that the co...
log.h" #include "applib/ui/dialogs/dialog_private.h" #include "applib/ui/dialogs/expandable_dialog.h" #include "applib/ui/dialogs/simple_dialog.h" #include "applib/ui/progress_window.h" #include "applib/ui/window.h" #include "applib/ui/window_manager.h" #include "applib/voice/voice_window.h" #include "applib/voice/voic...
(data->response.timer)
; } } static void prv_cleanup_action_result(ActionResultData *data, bool succeeded) { if (!data) { return; } // report to analytics the result of the action if (data->response.attribute.id == AttributeIdTitle && data->response.attribute.cstring) { analytics_event_canned_response(data->response...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Raw DOWN"); }
text_layer_set_text(&data->text, data->text_buffer); toggle_color(window); (void)recognizer; } static void raw_up_click_handler(ClickRecognizerRef recognizer, Window *window) { raw_click_handler(recognizer, window, true); } static void raw_down_click_handler(ClickRecognizerRef recognizer, Window *window) { ...
Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is ...
if (accessory_is_present() || smartstrap_is_connected()) { // If the accessory is present and we are connected then we can send data freely. If the // accessory is present but we're not connected, we'll try to connected. If we are connected // but the accessory is not present, we'll disconnect. ...
} else if (smartstrap_fsm_state_get() != SmartstrapStateUnsubscribed) { // There is a request in progress. We'll get kicked when it's completed. s_monitor_interval = KICK_TIMEOUT_INTERVAL; } smartstrap_state_unlock(); if (can_send) { // We should attempt to send control messages first, followed b...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
hr_util_is_elevated(80)
, false); cl_assert_equal_b(hr_util_is_elevated(99), false); cl_assert_equal_b(hr_util_is_elevated(100), true); cl_assert_equal_b(hr_util_is_elevated(120), true); cl_assert_equal_b(hr_util_is_elevated(240), true); }