prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
a window, we pop it. void test_window_stack__pop_during_window_load(void) { Window *window = window_create(); window_set_window_handlers(window, &(WindowHandlers){ .load = prv_pop_window_load, .unload = prv_window_unload }); WindowStack *stack = app_state_get_window_stack(); // Switch to the app sta...
(prv_get_load_unload_count(), 1)
; cl_assert_equal_i(prv_get_appear_disappear_count(), 1); window_stack_remove(window, true); cl_assert_equal_i(window_stack_count(stack), 0); cl_assert_equal_i(prv_get_load_unload_count(), 0); cl_assert_equal_i(prv_get_appear_disappear_count(), 0); // FIXME: PBL-25460 // cl_assert_equal_b(animation_is_...
12, -64}, { -856, 320, -104}, { -848, 296, -128}, { -832, 280, -104}, { -1472, 496, -200}, { -728, 256, -152}, { -1312, 328, -216}, { -1616, 144, -48}, { -768, 416, -152}, { -856, 512, -120}, { -888, 376, 64}, { -752, 584, 72}, { -776, 560, 128}, { -704, 720, 56}, ...
// 83 seconds { -1600, 120, -112}, { -576, -40, -152}, { -760, 328, -280}, { -912, 104, -176}, { -512, 248, -72}, { -296, 304, -112}, { -344, 472, -128}, { -400, 288, 56}, { -616, 448, 8}, { -816, 944, 96}, { -864, 968, -56}, { -1008, 912, 0}, { -976, 640, 80}, ...
ytics_logging_log_event(&event_blob); } // ------------------------------------------------------------------------------------------ // Log a voice response event void analytics_event_voice_response(AnalyticsEvent event_type, uint16_t response_size_bytes, uint16_t response_len_cha...
("bluetooth event %d - error: %"PRIu32, event_blob.event, event_blob.bt_error.error_code)
; analytics_logging_log_event(&event_blob); } // ------------------------------------------------------------------------------------------ //! Log when app_launch trigger failed. void analytics_event_bt_app_launch_error(uint8_t gatt_error) { analytics_event_bt_error(AnalyticsEvent_BtAppLaunchError, gatt_error); ...
/* * 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...
menu_layer_set_callbacks(menu_layer, NULL, &(MenuLayerCallbacks) { .get_num_sections = prv_menu_get_num_sections_callback, .get_num_rows = prv_menu_get_num_rows_callback, .get_header_height = prv_menu_get_header_height_callback, .get_cell_height = prv_menu_get_cell_height_callback, .get_separator_he...
/* * 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...
{ item_layer->scroll_offset_pixels = value; layer_mark_dirty(&item_layer->layer); }
static int16_t prv_scroll_offset_getter(TimelineItemLayer *item_layer) { return item_layer->scroll_offset_pixels; } static void prv_update_scroll_offset(TimelineItemLayer *item_layer, int16_t new_offset, bool is_first_scroll) { static const PropertyAnimationImplementation imp...
ommandFrame *frame) { // Iterate to the end of the command list (next frame starts immediately afterwards) return gdraw_command_list_iterate_private(&frame->command_list, NULL, NULL); } GDrawCommandSequence *gdraw_command_sequence_create_with_resource(uint32_t resource_id) { ResAppNum app_num = sys_get_current_r...
{ frame = prv_next_frame(frame); }
return frame; } size_t gdraw_command_sequence_get_data_size(GDrawCommandSequence *sequence) { if (!sequence) { return 0; } size_t size = sizeof(GDrawCommandSequence); GDrawCommandFrame *frame = sequence->frames; for (uint32_t i = 0; i < sequence->num_frames; i++) { size += gdraw_command_frame_get...
eteLocalInitiated; } //////////////////////////////////////////////////////////////////////////////// // Awaiting Reset Complete Remote Initiated //////////////////////////////////////////////////////////////////////////////// static void prv_send_reset_complete(void) { const PostMessageResetCompletePayload payload...
{ // Ignore it. // https://pebbletechnology.atlassian.net/browse/PBL-42466 // TODO: NACK the Chunk. }
} //////////////////////////////////////////////////////////////////////////////// // Awaiting Reset Request //////////////////////////////////////////////////////////////////////////////// static void prv_awaiting_reset_request__enter(void) { PBL_ASSERTN(s_state.state == PostMessageStateDisconnected || ...
ular__color_1_bit(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE); GBitmap *native_framebuffer = graphics_context_get_bitmap(ctx); cl_assert(native_framebuffer->info.format == GBitmapFormat8BitCircular); cl_assert(DISPLAY_FRAMEBUFFER_BYTES == 25944); bitblt_bitmap_into_bitmap(native_framebuffer, bitma...
{ GBitmap *bitmap = setup_png_test(TEST_NAMED_PNG_FILE("test_bitblt_circular__spiral")); cl_assert(bitmap->info.format == GBitmapFormat8Bit); // Convert input PNG from rectangular to circular gbitmap_8bit_to_8bit_circular(bitmap); cl_assert(bitmap->info.format == GBitmapFormat8BitCircular); GBitmap *nativ...
/* * 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...
(&remote->classic.bd_addr)
; break; case StoredRemoteTypeBLE: prv_forget_ble_remote(remote->ble.bonding); break; case StoredRemoteTypeBTDual: prv_forget_bt_classic_remote(&remote->dual.classic.bd_addr); prv_forget_ble_remote(remote->dual.ble.bonding); break; default: WTF; } PBL_LOG(LOG_LE...
/* * 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...
(long_string)
; // We only expect to see the first 15 (MFG_INFO_MODEL_STRING_LENGTH - 1) characters mfg_info_get_model(buffer); cl_assert_equal_s(buffer, "012345678901234"); } } void test_spalding_mfg_info__1_to_2_conversion(void) { // Force in an old data version. typedef struct { uint32_t data_version; ...
oid clear_stuck_button(ButtonId button_id) { __disable_irq(); const uint32_t button_counter_register = RTC_ReadBackupRegister(STUCK_BUTTON_REGISTER); if (button_counter_register != 0) { // Create bitmask with all 1s, except on the counter byte for this button_id in button_counter_register. AND to mask out: ...
boot_bit_set(BOOT_BIT_FORCE_PRF)
< ARRAY_LENGTH(ctx->touch_events)); ctx->touch_events[ctx->idx++] = *event; } void test_touch__dispatch_touch_events_single_finger(void) { TouchEventContext ctx = { .idx = 0 }; touch_dispatch_touch_events(0, prv_touch_event_dispatch_cb, &ctx); cl_assert_equal_i(ctx.idx, 0); touch_handle_update(0, Tou...
{ touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420); touch_handle_driver_event(TouchDriverEvent_ControllerError); PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT); cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesCancelled); tou...
static PebbleEvent s_expected_palm_events[2]; static int s_palm_event_count = 0; static void prv_handle_palm_events(PebbleEvent *e) { s_expected_palm_events[s_palm_event_count++] = *e; } void test_touch__palm_detect_event(void) { touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420); touc...
cl_assert_equal_i(3, current_stack); cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(aa, stack[1]); cl_assert_equal_p(aaa, stack[2]); cl_assert_equal_p(aaaa, stack[3]); // go back two levels and then to sibling actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_stack...
cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(9, 9)), &child_f)
) { PBL_LOG(LOG_LEVEL_INFO, "Valid system resources found!"); s_valid_resources_found = true; return; } } // Welp, we found nothing. Leave s_valid_resources_found as false and when resource_storage_check // is called as part of system_resource_init we'll complain and handle missing resource...
{ uint8_t buffer[MANIFEST_SIZE] = {0}; flash_write_bytes(buffer, BANK.begin, MANIFEST_SIZE); }
bool resource_storage_system_bank_check(ResAppNum app_num, uint32_t resource_id, ResourceStoreEntry *entry, const ResourceVersion *expected_version) { if (!s_valid_resources_found) { // We determined that we had no valid banks duri...
analytics_add(ANALYTICS_DEVICE_METRIC_BT_UART_BYTES_OUT, length, AnalyticsClient_System)
; return HostTransportEnqueueStatus_Success; } return HostTransportEnqueueStatus_RetryLater; } size_t host_transport_rx_get_length(void) { prv_lock(); size_t rx_length = circular_buffer_get_read_space_remaining(&s_spi_transport.rx); prv_unlock(); return rx_length; } bool host_transport_rx_read(uint8_...
xInvert((*state)[j][i]); } } } static void InvShiftRows(void) { uint8_t temp; // Rotate first row 1 columns to right temp=(*state)[3][1]; (*state)[3][1]=(*state)[2][1]; (*state)[2][1]=(*state)[1][1]; (*state)[1][1]=(*state)[0][1]; (*state)[0][1]=temp; // Rotate second row 2 columns to right t...
BlockCopy(output, input)
nce_m, &bpm, &hr_zone)); cl_assert_equal_i(bpm, 180); cl_assert_equal_i(hr_zone, 3); cl_assert_equal_i(duration_s, 10 * SECONDS_PER_MINUTE + 10); cl_assert(workout_service_stop_workout()); cl_assert(!workout_service_get_current_workout_info(&steps, &durati...
workout_service_pause_workout(true)
_LEVEL_ERROR, "No characteristic found for descriptor! handle=0x%x", (int)item->handle); goto failure; } GATTDescriptor *desc_dest = (GATTDescriptor *)end_ptr; *desc_dest = (GATTDescriptor) { .att_handle_offset = item->handle - base_handle, }; prv_att_uuid_...
(connection, &address)
; hc_endpoint_discovery_service_changed_handle(&address, characteristic_info->c.value_handle); } } void gatt_client_discovery_process_service(const ble_evt_gattc_browse_svc_t *service) { uint32_t payload_size; HcProtocolDiscoveryServiceFoundPayload *payload = prv_gatt_client_discovery_build_gatt_servi...
= LayoutIdTest, } }; static TimelineItem item4 = { .header = { .id = {0x8c, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x44, 0x2c, 0x98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05}, .parent_id = {0xff, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0x03}, ...
((uint8_t *)&item2.header.id, sizeof(Uuid))
== 0); // check item 3 or 4 memset(&temp, 0, sizeof(TimelineItem)); cl_assert(S_SUCCESS == reminder_db_next_item_header(&temp)); if (uuid_equal(&item3.header.id, &temp.header.id)) { temp.attr_list.attributes = NULL; timeline_item_free_allocated_buffer(&temp); cl_assert(memcmp(&item3, &temp, sizeof...
ColorBlack, false); graphics_draw_circle(&context, GPoint(50, 50), 10); #if PBL_COLOR ASSERT_CALLED(graphics_circle_draw_stroked_aa(&context, GPoint(50, 50), 10, SW_ODD)); #else ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, SW_ODD)); #endif setup_test(&context, true, SW_ODD, G...
(10, 20, 40, 10)
)); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); ASSERT_NO_CHANGE(graphics_fill_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_fill_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHA...
"It's not your best, but there's always tonight."), i18n_noop("Goooood morning! You slept for %dH %dM which is %d%% below your typical. " "Go crush your day and then get back in bed 😉"), }, }, [PercentTier_Fail] = { .num_variants = 3, .variants = { ...
{ if (!s_activity_summary_settings.enabled) { return; } // Don't bother adding a summary if we don't have any history for an average if (s_activity_stats.total_days == 0) { return; } // Make sure it's not before the trigger time and the pin hasn't already been removed const int minute_of_day = t...
steps + s_activity_summary_settings.summary.activity.update_threshold_steps; // Determine the average for today ActivityScalarStore total_steps_avg = prv_cur_step_avg(now_utc, minute_of_day); const time_t pin_time_utc = time_util_get_midnight_of(now_utc) + (s_activity_summary_settings.summary.a...
/* * 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...
(&(HealthData) {})
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_hr_detail_card__render_zones(void) { HealthData health_data = { .hr_zone1_minutes = 21, .hr_zone2_minutes = 13, .hr_zone3_minutes = 6, }; HealthDetailCard *card = (HealthDetailCard *)prv_create_card_and_render(&healt...
u 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 distributed on an "AS IS" BASIS, * WITHOUT WARRANT...
(outer_point.y, frame->size.h - inset_amount)
) }; } #endif //////////////////////////////////////////////////////////////////////////////////////////////////// // UI Drawing static void prv_draw_outer_ring(GContext *ctx, int32_t current, int32_t total, int32_t fill_thickness, GRect frame, GColor color) { graphics_context_set_...
e variable length. In the // future, if we used this feature for files, this would allow for the same struct construction // on the mobile side uint32_t extra_info_offset = s_pb_state.receiver.length - sizeof(InitRequestExtraInfo); InitRequestExtraInfo *info = (InitRequestExtraInfo *)&s_pb_state...
{ s_pb_state.is_success = true; PBL_LOG(LOG_LEVEL_DEBUG, "PutBytes commit CB. CRC matches! Calculated CRC is 0x%"PRIx32 " expected 0x%"PRIx32, calculated_crc, crc); prv_commit_object(crc); }
else { PBL_LOG(LOG_LEVEL_ERROR, "PutBytes commit CB. Calculated CRC is 0x%"PRIx32" expected 0x%"PRIx32, calculated_crc, crc); } s_pb_state.is_success &= commit_succeeded; prv_mark_pb_jobs_complete(1); prv_cleanup_and_send_response((commit_succeeded) ? ResponseAck : ResponseNack); } static boo...
/* * 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...
{ status = HciStatusCode_VS_Base + e; PBL_LOG(LOG_LEVEL_DEBUG, "ble_gattc_browse: %u", e); goto failure; }
ModalProperty_RenderRequested); cl_assert_equal_i(windows[2][0]->on_screen, true); cl_assert_equal_i(windows[2][0]->is_click_configured, true); cl_assert_equal_p(s_last_click_configured_window, windows[2][0]); // Add priority 2 transparent window 1 window_set_transparent(windows[2][1], true); ...
cl_assert_equal_i(windows[1][0]->is_click_configured, false)
; cl_assert_equal_p(s_last_click_configured_window, windows[3][1]); for (ModalPriority idx = ModalPriorityMin; idx < NumModalPriorities; idx++) { for (int i = 0; i < num_windows_per_stack; i++) { window_stack_remove(windows[idx][i], false); window_destroy(windows[idx][i]); } } } void test_wi...
// Write data pattern status = prv_write_read_verify_byte(test_addr, data_pattern, data_pattern, display_logs); VERIFY_TEST_STATUS(status); } if (display_logs) { PBL_LOG(LOG_LEVEL_DEBUG, ">>> Initializing data patterns...complete"); } return FLASH_TEST_SUCCESS; } static FlashTestErrorType prv_run_addr_...
prv_write_read_verify_byte(test_addr, test_pattern, test_pattern, true)
; VERIFY_TEST_STATUS(status); // Confirm write into base_addr did not take place // If test_pattern was written over the data_pattern, then return data should be 0 since // data cannot transition from 0 to 1 without an erase status = prv_read_verify_byte(special_case_addr, 0xFF, FLASH_TEST_ERR_STUCK_AT_HIGH...
zedAppGlanceSliceHeader *serialized_slice_header = (SerializedAppGlanceSliceHeader *)glance_buffer_cursor; *serialized_slice_header = (SerializedAppGlanceSliceHeader) { .type = current_slice->type, .total_size = serialized_slice_total_size, .num_attributes = attr_list->num_attributes, ...
((uint8_t *)uuid, UUID_SIZE, (uint8_t *)serialized_glance, serialized_glance_size)
; } kernel_free(serialized_glance); return rv; } status_t app_glance_db_read_glance(const Uuid *uuid, AppGlance *glance_out) { if (!uuid || !glance_out) { return E_INVALID_ARGUMENT; } const uint8_t *key = (uint8_t *)uuid; const int key_size = UUID_SIZE; const int serialized_glance_size = app_gl...
/* * 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(graphics_context_mask_use(ctx, mask))
; cl_assert_equal_p(ctx->draw_state.draw_mask, mask); graphics_context_set_fill_color(ctx, GColorRed); graphics_fill_rect(ctx, &ctx->dest_bitmap.bounds); cl_assert(graphics_context_mask_use(ctx, NULL)); cl_assert_equal_p(ctx->draw_state.draw_mask, NULL); cl_check(gbitmap_pbi_eq(&ctx->dest_bitmap, TEST_NA...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Disconnected from Gateway!"); ppogatt_destroy(); ams_destroy(); ancs_destroy(); app_launch_handle_disconnection(); gap_le_slave_reconnect_start(); gatt_client_op_cleanup(GAPLEClientKernel); }
} // ------------------------------------------------------------------------------------------------- void kernel_le_client_handle_event(const PebbleEvent *e) { switch (e->type) { case PEBBLE_BLE_SCAN_EVENT: PBL_LOG(LOG_LEVEL_DEBUG, "PEBBLE_BLE_SCAN_EVENT"); return; case PEBBLE_BLE_CONNECTION_...
on_ref_1 = hrm_manager_subscribe_with_callback(INSTALL_ID_INVALID, 1, expire_s, HRMFeature_BPM, prv_fake_hrm_1_cb, NULL); fake_system_task_callbacks_invoke_pending(); HRMSessionRef ses...
{ circular_buffer_write(&cb, (const uint8_t *)&event[i], sizeof(PebbleHRMEvent)); }
PebbleHRMEvent out_event[NUM_TEST_EVENTS]; for (int i = 0; i < NUM_TEST_EVENTS; ++i) { prv_read_event_from_buffer_and_consume(&cb, &out_event[i]); cl_assert_equal_b(memcmp(&event[i], &out_event[i], sizeof(PebbleHRMEvent)), false); } } { // Test reading back unaligned for (int i = 0; i <...
{ if (prv_is_selection_last_weekday(graph_card)) { // The graph starts on Monday, so wrap around the selection and current_day for Sunday const time_t selection_time = ((positive_modulo(graph_card->selection - Monday, DAYS_PER_WEEK) - positive_modulo(graph_card->current_day - Monday, DAYS_P...
PBL_IF_RECT_ELSE(FONT_KEY_GOTHIC_24_BOLD, FONT_KEY_GOTHIC_18_BOLD)
); graph_card->legend_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD); graph_card->current_day = prv_get_weekday(graph_card->data_timestamp); // The day characters in standard tm weekday order graph_card->day_chars = i18n_get("SMTWTFS", graph_card); graph_card->selection = HealthGraphIndex_Ave...
/* * 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(!ancs_util_is_complete_notif_attr_response(s_chunked_dict_part_two, sizeof(s_chunked_dict_part_two), &error))
; cl_assert(error); } void test_ancs_util__should_extract_dict_from_buffer(void) { static const char* expected_message = "This is a very complicated case, Maude. You know, a lotta ins, lotta outs, lotta what-have-you's. And, uh, lotta strands to keep in my head, man. Lotta strands in old Duder's head. Luckily I'm ...
ck launch apps, 1 default watchface, 1 default worker #define DO_NOT_EVICT_LIST_SIZE (NUM_BUTTONS + 2) static PebbleRecursiveMutex *s_app_cache_mutex = NULL; //! Actual data structure stored in flash about an app cache entry typedef struct PACKED { time_t install_date; time_t last_launch; uint32_t total_...
(id, data->do_not_evict, DO_NOT_EVICT_LIST_SIZE)
) { priority = MAX_PRIORITY; } *node = (EvictListNode) { .id = id, .size = entry.total_size, .priority = MAX(priority, prv_calculate_priority(&entry)), }; data->list = (EvictListNode *)list_sorted_add((ListNode *)data->list, (ListNode *)node, evict_node_comparator, false); data->bytes_...
e(void) { if (s_i18n_locale_other) { return "es_ES"; } else { return "en_US"; } } char *app_get_system_locale(void) { return "es_ES"; } const char *i18n_get(const char *msgid, const void *owner) { if (s_i18n_translate) { return "Hola"; } else { return msgid; } } void i18n_get_with_buffer...
(tmbuf, sizeof(tmbuf), "%P", &jan_2_2015__13_00_00)
; cl_assert_equal_s(tmbuf, "pm"); #endif tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%S %U", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "00 00"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%w %W", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "5 00"); tmbuf[0] = '\0'; strftime(t...
"util/sle.h" #define CMD_NULL (0) #define CMD_SET_PARAMETER (1) #define CMD_DISPLAY_OFF (2) #define CMD_DISPLAY_ON (3) #define CMD_DRAW_SCENE (4) #define CMD_RESET_RELEASE (8) #define CMD_RESET_ASSERT (9) #define SCENE_BLACK (0) #define SCENE_SPLASH (1) #define SCENE_UPDATE (2) #define SCENE_ERROR (3) #define UPDATE...
prv_reset_fpga()
sJustOnce; case ALARM_KIND_CUSTOM: return DayPickerMenuItemsCustom; } return DayPickerMenuItemsJustOnce; } static AlarmKind prv_index_to_alarm_kind(DayPickerMenuItems index) { switch (index) { case DayPickerMenuItemsWeekdays: return ALARM_KIND_WEEKDAYS; case DayPickerMenuItemsWeekends: ...
(cell_index->row)
; const bool all_caps = false; const char *cell_text = alarm_get_string_for_kind(kind, all_caps); menu_cell_basic_draw(ctx, cell_layer, i18n_get(cell_text, &data->day_picker_window), NULL, NULL); } static void prv_day_picker_handle_selection(MenuLayer *menu_layer, MenuIndex *cell_index, ...
ntries, sessions); cl_assert_equal_i(sessions[0].type, ActivitySessionType_Nap); cl_assert_equal_i(sessions[1].type, ActivitySessionType_Nap); } { // Create a 2 hour session that ends after 9pm ==> should be regular sleep ActivitySession sessions[] = { { .start_utc = start_of_today + (20 ...
printf("\n Counted %d steps next 40m", steps_awake_100m - steps_awake_60m)
; printf("\n Counted %d steps last 20m", steps_awake_120m - steps_awake_100m); printf("\n Total: %d\n", steps_awake_120m); // Compute the expected number of steps int exp_steps = 0; for (int i = 0; i < num_minutes; i++) { exp_steps += minute_data[i].base.steps; } cl_assert_equal_i(steps_awake_120m,...
TT_CONNECTION_ID); prv_assert_no_event(); cl_assert_equal_b(fake_gatt_is_service_discovery_running(), true); const 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 pr...
for (int i = 0; i < 10; i++) { gatt_client_discovery_discover_range(connection, &range); }
// kick off a full discovery 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, BTErrnoServiceDiscov...
rue, 5); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 5); graphics_draw_round_rect(&ctx, &OR...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi"))
state_change(&manager, r[0]); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive); cl_assert_equal_p(manager.active_layer, &layer_a); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); r[1]->state = RecognizerState_Failed; recognizer_manager_handle_state_change(&manager,...
(&manager, r[1])
; cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered); cl_assert_equal_p(manager.triggered, r[0]); cl_assert_equal_p(manager.active_layer, &layer_a); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); cl_assert_equal_i(r[0]->state, RecognizerState_Started); cl_assert...
rcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text)); // Daily avg avg = health_service_sum_averaged(metric, day_start, day_start + SECONDS_PER_DAY, HealthServiceTimeScopeDaily); snprintf(temp, sizeof(temp), "\ndaily: %d", (int)avg); prv_safe_strcat...
(HealthMetricHeartRateBPM, time_start_of_today(), time(NULL), HealthAggregationSum, HealthServiceTimeScopeOnce)
; APP_LOG(APP_LOG_LEVEL_DEBUG, "Result from aggregate_averaged heart-rate: %"PRIi32" ", value); if (value != 0) { passed = false; goto exit; } // accessibility with calories should work HealthServiceAccessibilityMask access; access = health_service_metric_aggregate_averaged_accessible( Health...
if (!system_flash_write(FIRMWARE_BASE + i, buffer, chunk_size, NULL, NULL)) { dbgserial_putstr("We're dead"); return false; } prv_display_write_progress(i + chunk_size, firmware_length, NULL); } return true; } static bool check_firmware_crc(FirmwareDescription* firmware_description) { dbgseri...
boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE)
; boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO); boot_bit_set(BOOT_BIT_RECOVERY_START_IN_PROGRESS); break; case UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED: case UPDATE_FW_ERROR_MICRO_FLASH_MANGLED: // Keep us booting into recovery firmware. boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); ...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_y_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_ny_offset_layer.$...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
mutex_create()
; } void voltage_monitor_device_init(const VoltageMonitorDevice *device) { gpio_analog_init(&device->input); } //! It takes ~12µs to get our ADC readings. From time to time, we're busy //! processing elsewhere for upwards of 25µs and end up getting overrun issues. //! //! When OVR occurs, we clear both the OVR flag...
0 steps int32_t steps_after; activity_get_metric(ActivityMetricStepCount, 1, &steps_after); PBL_LOG(LOG_LEVEL_DEBUG, "steps taken during sleep:: %d", (int)(steps_after - steps_before)); if (steps_after - steps_before > 16) { PBL_LOG(LOG_LEVEL_ERROR, "too many steps during sleep: test FAILED"); passed =...
time_util_get_minute_of_day(session->start_utc)
, session->length_min); if (session->start_utc < after_time) { PBL_LOG(LOG_LEVEL_DEBUG, " Ignoring because too old"); continue; } if ((session->type == ActivitySessionType_Sleep) || (session->type == ActivitySessionType_RestfulSleep)) { (*num_sleep)++; } if ((s...
tion_legacy2_get_ms_since_system_start(); animation->abs_start_time_ms = now + animation->delay_ms; if (animation->implementation->setup != NULL) { animation->implementation->setup(animation); } const bool old_head_is_animating = animation_legacy2_scheduler->head ? (((AnimationLegacy2 *)animation_l...
if (rel_ms_running < 0) { // AnimationLegacy2s are ordered by abs_start_time_ms. // We've reached an animation that should not start yet, so // everything after and including this animation shouldn't run yet. break; }
// Get a pointer to next now, because after unscheduling this animation won't have a next. AnimationLegacy2 *next = (AnimationLegacy2*) list_get_next(&animation->list_node); if (animation->is_completed) { // Unschedule + call animation.stopped callback: const bool finished = true; anima...
); cl_assert(!app_state_get_unobstructed_area_state()->handlers.will_change); cl_assert(!app_state_get_unobstructed_area_state()->handlers.change); cl_assert(!app_state_get_unobstructed_area_state()->handlers.did_change); } void test_unobstructed_area_service__will_change(void) { UnobstructedAreaHandlers handl...
cl_assert_equal_p(app_state_get_unobstructed_area_state()->handlers.change, prv_change)
; const GRect to_area = GRect(0, 0, DISP_COLS, 200); const GRect area = GRect(0, 0, DISP_COLS, 200); const AnimationProgress progress = ANIMATION_NORMALIZED_MAX / 2; unobstructed_area_service_change(area.size.h, to_area.size.h, progress); fake_event_service_handle_last(); cl_assert_equal_i(s_data.num_will_...
nt8_t*)&item2.header.id, sizeof(Uuid)) > 0); cl_assert(reminder_db_get_len((uint8_t*)&item3.header.id, sizeof(Uuid)) > 0); // remove #1 and confirm it's deleted cl_assert(S_SUCCESS == reminder_db_delete((uint8_t*)&item1.header.id, sizeof(Uuid))); cl_assert(reminder_db_get_len((uint8_t *)&item1.header.id, sizeo...
reminder_db_insert_item(&not_a_reminder)
); } void test_reminder_db__delete_parent(void) { prv_insert_default_reminders(); const TimelineItemId *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, si...
/* * 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...
{ (void) recognizer; set_text(window, "Boom!"); system_task_add_callback(crash, NULL); }
static void config_provider(Window *window) { window_single_click_subscribe(BUTTON_ID_UP, (ClickHandler) up_click_handler); window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler) select_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler) down_click_handler); window_single_clic...
/* * 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 gatt_client_discovery_discover_all(&device); }
DEFINE_SYSCALL(uint8_t, sys_ble_client_copy_services, BTDeviceInternal device, BLEService services[], uint8_t num_services) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(services, sizeof(BLEService) * num_services); } return gatt_client_copy_service_refs(&device, s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG, (uint8_t *)erk, sizeof(SM128BitKey)); }
else { prompt_send_response(" None"); }; } extern void bluetooth_persistent_storage_dump_contents(void); void command_gapdb_dump(void) { #if !RECOVERY_FW bluetooth_persistent_storage_dump_contents(); #endif shared_prf_storage_dump_contents(); }
/* * 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...
(temp, sizeof(temp), "\n%d: %d", i, (int)values[i])
; safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text)); } prv_display_alert(data->debug_card.dialog_text); } // ----------------------------------------------------------------------------------------- static void prv_display_averages_alert(ActivityDemoAppData *data, DayInWeek...
0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, }, }, .rand = 0x11223344, .ediv = 9876, }, .irk = (const SMIdentityResolvingKey) { .data = { 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, }, }, .identity = (cons...
&pairing_info_out.remote_encryption_info.ltk, sizeof(SMLongTermKey)), 0); cl_assert_equal_i(memcmp(&pairing_info->irk, &pairing_info_out.irk, sizeof(SMIdentityResolvingKey)), 0); cl_assert_equal_i(memcmp(&pairing_info->csrk, &pairing_info_out.csrk, ...
/* * 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_process_all_recognizers(manager, prv_dispatch_touch_event, &ctx)
; return ctx.triggered; } typedef struct FailRecognizerCtx { Recognizer *triggered; bool recognizers_active; } FailRecognizerCtx; T_STATIC bool prv_fail_recognizer(Recognizer *recognizer, void *context) { FailRecognizerCtx *ctx = context; if ((recognizer == ctx->triggered) || !recognizer_is_active(rec...
cl_assert_equal_i(rec_event, -1)
; r->state = RecognizerState_Completed; recognizer_cancel(r); cl_assert_equal_i(r->state, RecognizerState_Completed); cl_assert_equal_b(cancelled, false); cl_assert_equal_i(rec_event, -1); r->state = RecognizerState_Started; recognizer_cancel(r); cl_assert_equal_i(r->state, RecognizerState_Cancelled);...
void) { // Test for PBL-19951: Reset charge percent on reconnection events int percent = 10; int charge_mv = battery_curve_lookup_voltage_by_percent(percent, true); int discharge_mv = battery_curve_lookup_voltage_by_percent(percent, false); fake_battery_init(discharge_mv, false, false); battery_monitor_in...
cl_assert(!s_in_low_power)
; cl_assert_equal_i(s_power_state, PowerStateGood); } void test_battery_monitor__low_first_run(void) { int low_mv = battery_curve_lookup_voltage_by_percent(3, false); fake_battery_init(low_mv, false, false); battery_monitor_init(); periodic_timer_trigger(1); cl_assert(battery_monitor_critical_lockout());...
ancs) pairing.identity.address.octets[0] = 0x12; BTBondingID id2 = bt_persistent_storage_store_ble_pairing(&pairing, true /* is_gateway */, NULL, false /* requires_address_pinning */, false /* au...
(id_2 != BT_BONDING_ID_INVALID)
; cl_assert_equal_i(fake_shared_prf_storage_get_bt_classic_store_count(), 2); // Read both pairings back ret = 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_...
/* * 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 GAP_DISC_MODE_GEN_DISCOVERABLE; }
else if (flags & GAP_LE_AD_FLAGS_LIM_DISCOVERABLE_MASK) { return GAP_DISC_MODE_LIM_DISCOVERABLE; } else { return GAP_DISC_MODE_NON_DISCOVERABLE; } } ble_error_t advert_set_interval(uint16_t min_slots, uint16_t max_slots) { // No need to lock / take here, this API just sets a couple vars in ble_mgr_dev_p...
92, 944, -472}, { 160, 784, -464}, { 32, 552, -376}, { 0, 456, -312}, { -8, 520, -352}, { -8, 640, -352}, { 24, 768, -392}, { 56, 912, -520}, { 144, 968, -552}, { 304, 1048, -712}, { 128, 936, -560}, { 128, 920, -584}, { 240, 816, -584}, { 144, 664, -512}, // 16 s...
{ 80, 832, -440}, { -40, 472, -400}, { -56, 400, -328}, { -104, 528, -304}, { -72, 736, -416}, { -88, 808, -512}, { 48, 1008, -648}, { 32, 1096, -640}, { 208, 1232, -696}, { 72, 992, -456}, { 104, 1008, -480}, { 192, 1032, -424}, { 216, 872, -456}, { 136, 720, -42...
{ 56, 696, -416}, { 104, 744, -392}, { 208, 888, -600}, { 224, 976, -624}, { 184, 1112, -576}, { 200, 1096, -656}, { 184, 744, -528}, // 24 seconds { 224, 776, -608}, { 96, 664, -408}, { 32, 512, -296}, { -16, 448, -208}, { 24, 584, -240}, { -144, 784, -352}, ...
_menu_and_render(MenuConfig *config) { option_menu_init(&s_data.option_menu); const OptionMenuConfig option_menu_config = { .title = config->title ?: "Option Menu", .content_type = config->content_type, .status_colors = { GColorWhite, GColorBlack }, .highlight_colors = { PBL_IF_COLOR_ELSE(GColorCob...
FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE()
; } void test_option_menu_window__short_title_special_height(void) { prv_create_menu_and_render_short_title(false /* icons_enabled */, "Special Height", true /* special_height */); FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE(); } void test_option_menu_window__short_title_...
/* * 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((memcmp(&tn, &test_num, sizeof(GTransformNumber)) == 0))
; t_c = GTransform(GTransformNumberFromNumber(1), GTransformNumberFromNumber(2), GTransformNumberFromNumber(3), GTransformNumberFromNumber(4), GTransformNumberFromNumber(5), GTransformNumberFromNumber(6)); int32_t test_array[6] = {1 * (1 << FIXED_S32_16_PRECISION), ...
/* * 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_spi_get_flag_status(bus, (SpiI2sFlag)0)
void *context) { s_command_list[s_command_list_index++] = (EraseCommand) { .addr = subsector_addr, .type = SubsectorEraseCommand }; cl_assert_equal_i(s_erase_mutex_locked, true); cb(context, (--s_simulate_flash_driver_error_countdown? S_SUCCESS : E_BUSY)); } void flash_erase_sector(uint3...
prv_test_erase_optimal_range( 60 * 1024, 60 * 1024, 2 * 64 * 1024, 2 * 64 * 1024, (EraseCommand[]) { { 60 * 1024, SubsectorEraseCommand }, { 64 * 1024, SectorEraseCommand }, { }, })
; } void test_flash_erase__subsectors_on_both_sides(void) { // Offer a more than a full sector range, needs subsectors on both sides prv_test_erase_optimal_range( 60 * 1024, 60 * 1024, ((2 * 64) + 4) * 1024, ((2 * 64) + 8) * 1024, (EraseCommand[]) { { 60 * 1024, SubsectorEraseCommand }, ...
r_has_space_available(); } // Clean-up & kill this task pebble_task_unregister(PebbleTask_BTRX); // Signal host_transport_deinit() that we're done s_spi_transport.task_is_running = false; vTaskDelete(NULL); } HostTransportEnqueueStatus host_transport_tx_enqueue(const uint8_t *data, size_t length) { if ...
hc_protocol_cb_dispatcher_deinit()
; }
red_glance = user_data; LauncherAppGlanceSettings *settings_glance = launcher_app_glance_structured_get_data(structured_glance); KinoReel *charging_indicator_icon = NULL_SAFE_FIELD_ACCESS(settings_glance, charging_indicator_icon, NULL); PBL_ASSER...
{ LauncherAppGlanceStructured *structured_glance = user_data; LauncherAppGlanceSettings *settings_glance = launcher_app_glance_structured_get_data(structured_glance); if (settings_glance) { buffer_size = MIN(sizeof(settings_glance->battery_percent_text), buffer_size); strncpy(buffer, settings_glance...
static GTextNode *prv_wrap_text_node_in_vertically_centered_container(GTextNode *node) { const size_t max_vertical_container_nodes = 1; GTextNodeVertical *vertical_container_node = graphics_text_node_create_vertical(max_vertical_container_nodes); vertical_container_node->vertical_alignment = GVerticalAlig...
.num_attributes = 0, .attributes = NULL, }, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, }, { .header = { .id = {0x02}, .parent_id = {0}, .timestamp = 1421107200, // Tue Jan 13 midnight 2015 UTC .durat...
iter_next(&iterator)
); cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].header.id)); cl_assert(state.node); cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); } void test_timeline__forward_and_back(void) { Iterator iterator = {0}; TimelineIterState state = {0}; Timeli...
apps like "Light // config" that we don't bother to declare a UUID for return false; } // FIXME: The sdkshell doesn't have a launcher menu so this causes a linker error. Maybe the // mapping of events to analytics should also be shell-specific? #ifndef SHELL_SDK // No need to log the launcher menu app...
{ prv_simple_pin_event(timestamp, parent_id, AnalyticsEvent_PinUpdated, "updated"); }
express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "applib/event_service_client.h" #include "services/normal/accessory/smartstrap_attribute.h" #include "kernel/pbl_malloc.h" #include "fake_smartstrap_profiles.h" ...
app_smartstrap_attribute_get_service_id(NULL)
== 0); cl_assert(app_smartstrap_attribute_get_attribute_id(NULL) == 0); // smartstrap_attribute_begin_write() uint8_t *buffer; size_t buffer_len; assert_result_invalid(app_smartstrap_attribute_begin_write(NULL, NULL, NULL)); assert_result_invalid(app_smartstrap_attribute_begin_write(NULL, &buffer, NULL));...
int extra_line_offset_y) { // Supports `lines` or `lines + 1` line vertical centering for i18n const int line_height = fonts_get_font_height(text_layer->font); GRect frame = GRect(0, origin_y, time_selection_window->window.layer.bounds.size.w, (lines + 1) * li...
(data, data->callback_context)
; } static void prv_handle_inc(unsigned index, void *context) { TimeSelectionWindowData *data = context; date_time_handle_time_change(&data->time_data, index, 1); prv_update_range_text_layer(data); } static void prv_handle_dec(unsigned index, void *context) { TimeSelectionWindowData *data = context; date_ti...
2th 2015, 00:30:01 (T-11:29:59) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) + (30 * SECONDS_PER_MINUTE) + 1); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 11 H", time_buf); // June 12th 2015, 00:59:59 (T-11:00:01) rtc_set_time(event_t...
rtc_set_time(event_time + (59 * SECONDS_PER_MINUTE) + 58)
; clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("59 MIN AGO", time_buf); // June 9th 2015, 12:59:59 (T+00:59:59) rtc_set_time(event_time + (59 * SECONDS_PER_MINUTE) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, ...
now + 11, &range); cl_assert_equal_b(result, true); cl_assert_equal_range(range, ((HealthServiceTimeRange){ .last_day_idx = 0, .num_days = 1, .seconds_first_day = 10, .seconds_last_day = 10, .seconds_total_last_day = 33142, })); // clamps value that goes into the future const time_t first...
prv_adjust_value_boundaries(values, ARRAY_LENGTH(values), &range)
; cl_assert_equal_i(values[0], 1000); cl_assert_equal_i(values[1], 1000); cl_assert_equal_i(values[2], 1000); // ensure we correctly handle the day index range = (HealthServiceTimeRange){ .num_days = 3, .last_day_idx = 1, .seconds_first_day = SECONDS_PER_DAY / 10, .seconds_last_day = SECONDS_...
/* * 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 &s_ctx; }
void test_timeline_layouts__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); const GContextInitializationMode context_init_mode = GContextInitializationMode_System; graphics_context_init(&s_ctx, fb, context_init_mode); framebuffer_clear(fb); //...
val, prop_name_val); } jerry_value_t jerry_get_property(const jerry_value_t obj_val, const jerry_value_t prop_name_val) { if (!jerry_value_is_object(obj_val) || !jerry_value_is_string(prop_name_val)) { return TYPE_ERROR_ARG; } return (jerry_value_t)EM_ASM_INT({ var obj = __jerryRefs.get($0); var ...
pdp->is_enumerable, /* $6 */ pdp->is_configurable_defined, /* $7 */ pdp->is_configurable, /* $8 */ pdp->value, /* $9 */ pdp->getter, /* $10 */ pdp->setter, /* $11 */ obj_val, /* $12 */ prop_name_val /* $13 */ )); }
jerry_value_t emscripten_call_jerry_function(jerry_external_handler_t func_obj_p, const jerry_value_t func_obj_val, const jerry_value_t this_val, const jerry_value_t args_p[], ...
/* * 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...
{ hc_protocol_enqueue_with_payload(HcEndpointID_Test, HcMessageID_Test_UnmodulatedTxStop, NULL, 0); }
\ { .label = "Tue", .progress = 400, .fill_color = FILL_COLOR }, \ { .label = "Mon", .progress = 1300, .fill_color = FILL_COLOR }, \ { .label = "Sun", .progress = 800, .fill_color = FILL_COLOR }, \ { .label = "Sat", .progress = 700, .fill_color = FILL_COLOR }, \ { .label = "Fri", .progress = 1200, .fill_color...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_health_detail_card__render_zones(void) { HealthDetailCardConfig config = { .num_headings = 1, .headings = &(HealthDetailHeading) { .primary_label = "LABEL1", .primary_value = "value1", .secondary_label = "LABEL2", .secondary_value = "value2", .fill_color = GColorW...
If x is negative we need to be fancy to get the rounded down remainder. This // is the number of bits to the right of the next 32-bit boundry to the left. // For example, if x is -5 we want this shift to be 27, since -32 (the nearest // boundry) + 27 = -5 const uint8_t dest_shift_at_line_begin = (x >= 0) ? ...
while (dest_block != dest_block_end && glyph_line_bits_left) { PBL_ASSERT(dest_block < dest_block_end, "DB=<%p> DBE=<%p>", dest_block, dest_block_end); PBL_ASSERTN(dest_block >= (uint32_t*) base_addr); PBL_ASSERTN(dest_block < (uint32_t*) base_addr + row_size_bytes * (dest_bitmap->bo...
} // Skip over pixels outside of the bitmap data's x coordinate range if (current_x < data_row.min_x) { continue; } // Find position in dest_bitmap that corresponds to the bit index // Write to that position if mask for that bit is 1 if ...
---------------------------------------------------------------------------------------------- void ppogatt_create(void) { bt_lock(); { PBL_ASSERT_TASK(PebbleTask_KernelMain); PBL_ASSERTN(!s_ppogatt_head); s_timer_ticks = 0; } bt_unlock(); } // -----------------------------------------------------...
{ PBL_LOG(LOG_LEVEL_ERROR, "PPoGATT Client failed to subscribe to Data"); prv_delete_client(client, false /* is_disconnected */, DeleteReason_SubscribeFailure); goto unlock; }
if (!is_subscribed) { // Unsubscribed due to removed client goto unlock; } prv_start_reset(client); } unlock: bt_unlock(); } // ------------------------------------------------------------------------------------------------- void ppogatt_handle_read_or_notification(BLECharacteristic char...
express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "template_string.h" #include "template_string_private.h" #include "services/common/i18n/i18n.h" #include "syscall/syscall.h" #include "system/passert.h" #include "util/attributes....
{ WTF; }
state->position++; if (*state->position == '=') { (*cond)++; state->position++; } else if (!isdigit(*state->position)) { state->error->status = TemplateStringErrorStatus_InvalidTimeUnit; return false; } *value = prv_template_predicate_time(state); if (state->error->status != TemplateStrin...
->size.h), TEXT_VISIBLE_UPPER_THRESHOLD)); #else const bool text_visible = render; #endif static const GRect box = { .origin = { CARD_MARGIN, LAYOUT_TOP_BANNER_HEIGHT }, .size = { DISP_COLS - 2 * CARD_MARGIN, LAYOUT_MAX_HEIGHT }, }; static const GRect page_frame_on_screen = { ...
{ prv_card_render(layout, graphics_context_get_current_context(), false); }
return layout->view_size; } static void prv_layout_destroy(LayoutLayer *layout) { NotificationLayout *notification_layout = (NotificationLayout *)layout; prv_destroy_view(notification_layout); kino_layer_deinit(&notification_layout->icon_layer); task_free(notification_layout); } static void prv_layout_init...
_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "000000000002"); #if EXTENSION_C99 tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%123F", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "10015-01-02"); #endif #if EXTENSION_TZ tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%7G %01g", &jan_2_10015__13_0...
(tmbuf, sizeof(tmbuf), "%c", &jan_2_2015__13_00_00, i18n_get_locale())
; cl_assert_equal_s(tmbuf, "Fri Jan 2 13:00:00 2015"); s_i18n_translate = true; s_i18n_locale_other = true; tmbuf[0] = '\0'; localized_strftime(tmbuf, sizeof(tmbuf), "%a %A %b %B", &jan_2_2015__13_00_00, NULL); cl_assert_equal_s(tmbuf, "Hola Hola Hola Hola"); tmbuf[0] = '\0'; localized_strftime(tmbuf,...
is_pressed(BUTTON_ID_BACK))) { // stop waiting if not held down any longer return false; } delay_ms(1); } return true; } void *reset_vector, *initial_sp; prv_get_fw_reset_vector(&reset_vector, &initial_sp); if ((uintptr_t)reset_vector == 0xffffffff || (uintptr_t)initi...
(0xd15ea5e5)
; delay_us(200000); display_error_code(0xdeadbeef); delay_us(200000); display_boot_splash(); delay_us(1000000); } #endif if (is_button_stuck()) { sad_watch(ERROR_STUCK_BUTTON); } if (is_flash_broken()) { sad_watch(ERROR_BAD_SPI_FLASH); } boot_bit_dump(); // If the recovery ...
t = (1 << 4), //!< Charger detected PmicInt1_OnKey = (1 << 5), //!< On Key held PmicInt1_OvTemp = (1 << 6), //!< Set when 110deg is exceeded PmicInt1_LowBat = (1 << 7), //!< Low Battery detected. Set when BSUP drops below ResVoltFall }; enum PmicRail { PmicRail_SD1, //!< 1.8V PmicRail_LDO1, //!< 3.0V ...
if (prv_read_register(PmicRegisters_REFERENCE_CNTL, &ref_cntl)) { ref_cntl |= 0x3; // Divisor of 16 prv_write_register(PmicRegisters_REFERENCE_CNTL, ref_cntl); // Enable PWM Output on GPIO2 (Fig. 64) // Bits 6-4: Mode, 0x1 = Output // Bits 0-3: iosf, 0xe = PWM uint8_t val = (1 << 4) | 0x0e; ...
PBL_ASSERT(success, "Failed to start PMIC 120Hz PWM"); } static void prv_configure_charging(void) { // Set charge control to low current range, constant current ctl to 118mA. bool success = false; if (prv_set_register_bit(PmicRegisters_CHARGE_CNTL, 7, true)) { uint8_t cntl; if (prv_read_register(PmicR...
bus->spi_miso.gpio_pin }; gpio_analog_init(&miso); } bus->state->initialized = false; } void prv_spi_bus_init(const SPIBus *bus, bool is_bidirectional) { if (bus->state->initialized) { return; } // copy the speed over to the transient state since the slave port can change it bus->state->spi_clock_...
dma_request_init(slave->tx_dma)
; } } static void prv_spi_acquire_helper(const SPISlavePort *slave) { spi_ll_slave_acquire(slave); spi_ll_slave_scs_assert(slave); } static void prv_spi_release_helper(const SPISlavePort *slave) { spi_ll_slave_scs_deassert(slave); spi_ll_slave_release(slave); } uint8_t spi_slave_read_write(const SPISlavePo...
t8_t *attributes_per_group_type_element_out) { PBL_ASSERTN(data != NULL && string_alloc_size_out != NULL); *string_alloc_size_out = 0; const uint8_t *end = data + size; const uint8_t *cursor = data; int32_t result = attribute_get_buffer_size_for_serialized_attributes(num_attributes, ...
for (int i = 0; i < num_group_type_elements; i++) { AttributeList *attr_list; if (type == AttributeGroupType_Action) { attr_list = &((TimelineItemActionGroup *) group_ptr)->actions[i].attr_list; } else { attr_list = &((AddressList *) group_ptr)->addresses[i].attr_list; } pr...
} } void attribute_group_init(AttributeGroupType type, AttributeList *attr_list, void *group_ptr, uint8_t **buffer, uint8_t num_attributes, uint8_t num_group_type_elements, ...
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_dots(ctx, bounds); #endif // ...
prv_update_hrm_bpm(data)
(json_string)
) { return jerry_acquire_value(json_string); } if (jerry_value_is_undefined(json_string)) { // ECMA v5.1, 15.12.3, Note 5: Values that do not have a JSON representation (such as undefined // and functions) do not produce a String. Instead they produce the undefined value. return rocky_error_unexpect...
} status_register = prv_flash_read_next_byte(); } while (status_register & 0x1); prv_flash_end_cmd(); } // Init the flash hardware void cd_flash_init(void) { // Enable the SPI clock RCC_APB2PeriphClockCmd(FLASH_SPI_CLOCK, ENABLE); // Enable the GPIO clock uint8_t idx = ((((uint32_t)FLASH_GPIO) - A...
prv_flash_send_and_receive_byte(FLASH_CMD_ERASE_SUBSECTOR)
; prv_flash_send_24b_address(sector_addr); prv_flash_end_cmd(); prv_flash_wait_for_write(); } // Erase a region comprised of 1 or more sub-sectors. This will erase sectors at a time if // the address and size allow. void cd_flash_erase_region(uint32_t start_addr, uint32_t total_bytes) { CD_ASSERTN(((start_add...
uint32_t flash_addr, max_size; if (!core_dump_reserve_ble_slot(&flash_addr, &max_size, (ElfExternalNote *)build_id)) { PBL_LOG(LOG_LEVEL_ERROR, "Can't reserve slot for BLE core dump"); goto powerdown; } uint32_t flash_addr_max = flash_addr + max_size; PBL_LOG(LOG_LEVEL_DEBUG, "Using flash slot %lx %lx",...
kernel_free(s_rx_buffer)
ercent: %"PRIu32, s_last_battery_state.voltage, s_last_battery_state.percent, ratio32_to_percent(s_last_battery_state.percent)); PWR_TRACK_BATT(charging ? "CHARGING" : "DISCHARGING", s_last_battery_state.voltage); if (forced || likely_stable || s_last_battery_state.percent <= ALWAYS_UPDATE_THR...
{ char buffer[32]; PreciseBatteryChargeState state = prv_get_precise_charge_state(&s_last_battery_state); prompt_send_response_fmt(buffer, 32, "%"PRIu16" mV", s_last_battery_state.voltage); prompt_send_response_fmt(buffer, 32, "batt_percent: %"PRIu32"%%", ratio32_to_percent(state.charge_percent)); promp...
///////////////// // Analytics // Note that this is run on a different thread than battery_state! void analytics_external_collect_battery(void) { // This should not be called for an hour after bootup int battery_mv = s_last_battery_state.voltage; int d_mv = battery_mv - s_analytics_previous_mv; analytics_s...
mode, &center, NULL); grect_polar_calc_values(&r, mode, NULL, &radius); cl_assert_gpoint_precise(center, 1, 2); cl_assert_fixedS16_3(radius, 1); grect_polar_calc_values(NULL, mode, &center, &radius); cl_assert_gpoint_precise(center, 1, 2); cl_assert_fixedS16_3(radius, 1); } void test_graphics_circle__gre...
cl_assert_gpoint_precise(s_center, 4.5, 5.5)
; cl_assert_fixedS16_3(s_radius_outer, 4.5); cl_assert(s_radius_inner.integer <= 0); cl_assert_equal_i(s_angle_start, 0); cl_assert_equal_i(s_angle_end, TRIG_MAX_ANGLE); graphics_fill_oval(NULL, GRect(10, 12, -10, -12), GOvalScaleModeFitCircle); cl_assert_gpoint_precise(s_center, 4.5, 5.5); cl_assert_fi...
&layer, &ctx); cl_check(framebuffer_is_empty("outside_y_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_ny_offset_layer", ctx....
graphics_draw_pixel(ctx, GPoint(p.x + 3, p.y + 3))
; graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 6, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y + 3)); } // Draws two columns of colors (first 32 colors in first column, second 32 colors in second column)...
ecover_gc_data(fd, &gcdata, true); // mark our data as valid gcdata.flags &= ~GC_DATA_VALID; pfs_seek(fd, offsetof(GCData, flags), FSeekSet); pfs_write(fd, &gcdata.flags, sizeof(gcdata.flags)); return (fd); } static NOINLINE status_t garbage_collect_sector(uint16_t *free_page, uint16_t sector_start_pag...
{ uint8_t page_flags = prv_get_page_flags(pg); if ((IS_PAGE_TYPE(page_flags, PAGE_FLAG_START_PAGE)) || (IS_PAGE_TYPE(page_flags, PAGE_FLAG_CONT_PAGE))) { allocated_space += free_bytes_in_page(pg); } }
// A full filesystem is bad for wear leveling since the same sectors will // wind up getting written repeatedly. We should really be enforcing this // within pfs_open but for now we will just let external callers use this // routine before allocating large files uint32_t tot_capacity = (pfs_get_size() * 8) ...
/* * 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 (num_actions > 0) { PBL_ASSERTN(attributes_per_action != NULL); } const size_t alloc_size = attributes_actions_get_required_buffer_size(num_attributes, num_actions, attributes_per_action, ...
esc_p = (jerry_property_descriptor_t) { .value = jerry_create_undefined(), .getter = jerry_create_undefined(), .setter = jerry_create_undefined(), }; } jerry_value_t jerry_define_own_property(const jerry_value_t obj_val, const jerry_value_t prop_name_val, ...
(getValue($1 + i*4, 'i32'))
); } // Call the constructor with new object as `this` var bindArgs = [null].concat(args); var boundConstructor = func_obj.bind.apply(func_obj, bindArgs); var rv = new boundConstructor(); return __jerryRefs.ref(rv); }, func_obj_val, args_p, args_count); } jerry_size_...
_aa(&context, GPoint(50, 50), 10, SW_ODD)); setup_test(&context, false, SW_ODD, GColorBlack, GColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); ASSERT_CALLED(prv_draw_round_rect_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_ODD)); } void test_graphics_context_${BIT_DEPTH_NAME}...
(&context, GPoint(50, 50), 10, SW_ODD)
); #else ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, SW_ODD)); #endif setup_test(&context, true, SW_ODD, GColorBlack, GColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); #if PBL_COLOR ASSERT_CALLED(prv_draw_round_rect_aa_stroked(&context, &GRe...
/* * 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 (s_subscribe_head) { cl_assert_equal_i(characteristic, s_subscribe_head->characteristic); cl_assert_equal_i(subscription_type, s_subscribe_head->subscription_type); cl_assert_equal_i(client, s_subscribe_head->client); } else { cl_assert_(false, "No gatt_client_subscriptions_subscribe() has happened...
s_subscribe_head = (Subscribe *) list_pop_head(&s_subscribe_head->node); }
nse 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 "services/normal/notifications/notification_storage.h" #include "services/normal/noti...
(list_b, idx)
); } break; } default: cl_assert(false); break; } } } static void compare_notifications(TimelineItem *a, TimelineItem *b) { cl_assert(uuid_equal(&a->header.id, &b->header.id)); cl_assert_equal_i(a->header.ancs_uid, b->header.ancs_uid); cl_assert_equal...
ED_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_system_session; s_app_session_ptr = &s_app_s...
(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, TEST_PAYLOAD, sizeof(TEST_P...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(event->type, PEBBLE_APP_OUTBOX_MSG_EVENT)
; event->callback.callback(event->callback.data); } static int s_num_app_outbox_events_sent; bool process_manager_send_event_to_process(PebbleTask task, PebbleEvent* e) { cl_assert_equal_i(e->type, PEBBLE_APP_OUTBOX_SENT_EVENT); cl_assert(e->app_outbox_sent.sent_handler); e->app_outbox_sent.sent_handler(e->app...