prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
971, 364}, { 392, 1088, 336}, { 625, 242, 247}, { 554, 874, -34}, { 660, 960, 174}, { 680, 603, 99}, { 536, 1178, 243}, { 567, 1088, 143}, { 444, 678, 473}, { 661, 1114, 136}, { 580, 1028, -39}, { 653, 806, 514}, { 509, 705, 285}, { 328, 975, -18}, { 451, 775, -6...
{ -674, 254, -198}, { -673, 281, -188}, { -801, 298, -95}, { -1182, 336, -8}, { -1229, 340, 101}, { -1018, 312, 83}, { -912, 295, -1}, { -929, 354, -10}, { -940, 339, 109}, { -922, 315, 90}, { -829, 276, 72}, { -735, 268, 94}, { -778, 301, 73}, { -780, 321, 56}, ...
{ -807, 333, -53}, { -847, 380, -54}, { -923, 400, 0}, { -1046, 342, 105}, { -1238, 396, 119}, { -968, 355, 129}, { -897, 330, 99}, { -792, 316, 73}, { -842, 254, 130}, { -991, 183, 190}, { -1010, 244, 232}, { -934, 247, 148}, { -830, 189, 63}, { -798, 84, 78}, ...
= 'b'; list->data[2] = '\0'; list->data[3] = 'c'; // end of data list->data[4] = '\0'; cl_assert_equal_i(2, string_list_count(list)); cl_assert_equal_s("ab", string_list_get_at(list, 0)); cl_assert_equal_s("c", string_list_get_at(list, 1)); // 3 strings (last two are is empty) list->serialized_byte_len...
cl_assert_equal_p(timeline_item_find_action_by_type(&item, 0), NULL)
; } void test_timeline_item__find_dismiss_action(void) { // Make sure we're resilient to NULL items cl_assert_equal_p(timeline_item_find_dismiss_action(NULL), NULL); // Make sure we can handle timeline items with no actions TimelineItem item = {}; cl_assert_equal_p(timeline_item_find_dismiss_action(&item), ...
/* * 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_flush_addr, 0x00)
; cl_assert_equal_i(s_flush_size, 0x20); cl_assert_equal_i(s_invalidate_addr, 0x00); cl_assert_equal_i(s_invalidate_size, 0x20); cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Valid); } void test_cpu_cache__userspace_fail_from_size(void) { cl_will_return(icache_is_enabled, true); cl_will_return(dcache_i...
_LE_AD_REPORT_DATA_MAX_LENGTH); static uint8_t s_buffer[s_buffer_size]; static BLEAdData * const s_ad_data = (BLEAdData *)s_buffer; static void set_ad_data(uint8_t *data, size_t length) { memcpy(s_ad_data->data, data, length); s_ad_data->ad_data_length = length; } void test_ble_ad_parse__initialize(void) { mems...
{ BLEAdData *ad = ble_ad_create(); ble_ad_start_scan_response(ad); uint8_t expected_scan_resp_data[] = { 1 /* +1 for Type byte */ + strlen("Pebble 1234"), 0x09, // Local Name, Complete 'P', 'e', 'b', 'b', 'l', 'e', ' ', '1', '2', '3', '4' }; // Should fit fine, expect true: cl_assert_equal_b(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...
(utc_time)
) ? 'D' : 'S'; // Workaround for UK Winter, Greenwich Mean Time; UK Summer, British Summer Time if (!strncmp(out_buf, "BDT", TZ_LEN)) { strncpy(out_buf, "BST", TZ_LEN); } else if (!strncmp(out_buf, "BST", TZ_LEN)) { strncpy(out_buf, "GMT", TZ_LEN); } } } // converts time_t to struct tm fo...
the entire flash length. QSPI_SetDataLength(length - 1); } static void prv_wait_for_qspi_transfer_complete(QSPIFlag actions) { while (QSPI_GetFlagStatus(QSPI_FLAG_TC) == RESET) { } if (actions == QSPIFlag_ClearTC) { QSPI_ClearFlag(QSPI_FLAG_TC); } } static void prv_wait_for_qspi_not_busy(void) { while ...
(&qspi_com_config)
; qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Read; qspi_com_config.QSPI_ComConfig_DMode = QSPI_ComConfig_DMode_4Line; qspi_com_config.QSPI_ComConfig_DummyCycles = MX25U_FASTREAD_DUMMYCYCLES; qspi_com_config.QSPI_ComConfig_ADMode = QSPI_ComConfig_ADMode_4Line; qspi_com_config.QSPI_Com...
dow, 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_window_stack__modal_properties_unfocused(void) { ...
(windows[2][1]->on_screen, false)
; cl_assert_equal_i(windows[2][1]->is_click_configured, false); cl_assert_equal_p(s_last_click_configured_window, windows[3][0]); // Add priority 1 opaque window 0 cl_assert(NumModalPriorities > 1); window_stack_push(window_stacks[1], windows[1][0], false); // An opaque top window is now below two unfocus...
:%02d" : "%d:%02d"; return snprintf(buffer, buffer_size, i18n_get(fmt, i18n_owner), minutes, seconds); } } int health_util_format_minutes_and_seconds(char *buffer, size_t buffer_size, int duration_s, void *i18n_owner) { int minutes = duration_s / SECONDS_PER_MINUTE; ...
snprintf(buffer, buffer_size, i18n_get(fmt_i18n, buffer), converted_distance_whole_part, converted_distance_decimal_part)
; i18n_free(fmt_i18n, buffer); return rv; } int health_util_get_distance_factor(void) { switch (shell_prefs_get_units_distance()) { case UnitsDistance_Miles: return METERS_PER_MILE; case UnitsDistance_KM: return METERS_PER_KM; case UnitsDistanceCount: break; } return 1; } const...
ssert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl...
(prv_count_handler_entries(&s_stopped_handler_calls, b), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0); cl_assert(prv_last_handler_entry(&s_stopped_handler_calls, a)->fire_order < prv_last_handler_entry(&s_started_handler_calls, b)->fire_orde...
CUSED_CELL_HEIGHT)) / 2; const GEdgeInsets menu_layer_frame_insets = GEdgeInsets(top_bottom_inset, 0); menu_layer_frame = grect_inset(menu_layer_frame, menu_layer_frame_insets); #endif MenuLayer *menu_layer = &launcher_menu_layer->menu_layer; menu_layer_init(menu_layer, &menu_layer_frame); menu_layer_set_hig...
if (!launcher_menu_layer) { return; }
menu_layer_reload_data(&launcher_menu_layer->menu_layer); } void launcher_menu_layer_set_selection_state(LauncherMenuLayer *launcher_menu_layer, const LauncherMenuLayerSelectionState *new_state) { if (!launcher_menu_layer || !launcher_menu_layer->data_source || !new_s...
240, 1296, 176}, { 392, 1272, 208}, { 392, 1968, 280}, { -40, 1304, 320}, { -8, 768, 208}, { -64, 1096, 208}, { -40, 984, 208}, { 112, 656, 104}, { 152, 544, 152}, { 152, 696, 272}, { 112, 912, 280}, { 128, 928, 232}, { 24, 1144, 240}, { -64, 1032, 192}, { 96, 138...
{ -16, 816, 288}, { 120, 568, 88}, { 192, 584, 152}, { 176, 720, 160}, { 200, 776, 200}, { 224, 912, 272}, { 144, 1176, 248}, { 16, 1136, 240}, { 96, 1336, 304}, { -56, 1176, 432}, { -32, 1264, 200}, { 8, 968, 216}, // 101 seconds { 0, 880, 144}, { 112, 712, 7...
// ---------------------------------------------------------------- // Sample captured: 2015-10-05 16:12:25 local AccelRawData *activity_sample_walk_200_pbl_25671_11(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25671_11 //> TEST_EXPECTED 200 //>...
= data[i].z }; samples_in_minute++; if (chunk_size == KALG_SAMPLE_HZ) { steps = ref_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; }...
if (strcmp(token, "TEST_EXPECTED_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.exp_steps_min); } else if (strcmp(token, "TEST_EXPECTED_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.exp_steps_max); } else if (strcmp(token, "TEST_WEIGHT") =...
} // If this is a "static AccelRawData samples[] = {" line, skip it if (strcmp(token, "static") == 0) { continue; } // Grab a sample if (strcmp(token, "{") == 0) { PBL_ASSERTN(state->test_entry.name[0] != 0); int x, y, z; sscanf(token + strlen(token) + 1, "%d, %d, %d",...
will // prevent the BT controller from continously doing a status exchange // only to find out it can't send any data if (!prv_handle_rx_buffer_full()) { prv_handle_int_idle(); } break; case SPITransportState_WaitingForReceiving: prv_handle_int_waiting_for_receiving(); ...
if (success) { prv_indicate_has_data_if_idle(); 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_t **data_ptr_out, size_t length) { prv_lock(); b...
me out at 5pm on Jan 1, 2015 for all of these tests struct tm time_tm = { // Thursday, Jan 1, 2015, 5pm .tm_hour = 17, .tm_mday = 1, .tm_year = 115 }; const time_t utc_sec = mktime(&time_tm); fake_rtc_init(0 /* initial_ticks */, utc_sec); // Setup graphics context framebuffer_init(&s_fb, &...
gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)
); } void test_timeline_peek__peek_newline(void) { prv_render_timeline_peek(&(TimelinePeekItemConfig) { .title = "NY 3\nSF 12", .subtitle = "Bottom of\nthe 9th", .icon = TIMELINE_RESOURCE_TIMELINE_BASEBALL, .num_concurrent = 1, }); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void t...
f_config) { AttributeList notif_attr_list = {0}; prv_build_notification_attr_list(&notif_attr_list, i18n_get(notif_config->text_body, &notif_attr_list), notif_config->icon, notif_config->insight_type, ...
prv_push_notification(item, NULL)
; } typedef struct ResponseItem { ActivityInsightResponseType type; const char *text; AttributeList attr_list; } ResponseItem; static void prv_set_open_app_action(AttributeList *action_attr_list, HealthCardType card_type, void *i18n_owner) { attribute_list_add_cstring(actio...
ime = MIN(node->duration, 10) * SECONDS_PER_MINUTE; #endif // deal with all day events if (node->all_day && node->timestamp == midnight) { return show_all_day_events; } else if (direction == TimelineIterDirectionFuture) { return (node->timestamp >= timestamp - fudge_time); } else { // direction == Timel...
if (num_nodes == 1) { nodes[0]->duration = header->duration; } else { // first item has correct timestamp, duration should make it last for the rest of the day const time_t until_midnight = midnight_first + SECONDS_PER_DAY - header->timestamp; nodes[0]->duration = until_midnight / SECONDS_PER_MINUTE; ...
nodes[0]->all_day = (nodes[0]->duration == MINUTES_PER_DAY && nodes[0]->timestamp == midnight_first); // middle days are all day events time_t midnight = time_util_get_midnight_of(header->timestamp); for (int i = 1; i < num_nodes - 1; i++) { midnight += SECONDS_PER_DAY; nodes[i]...
size == sizeof(int16_t)); test_num = 1 << FIXED_S16_3_PRECISION; num = (Fixed_S16_3){ .integer = 1, .fraction = 0 }; // Test number creation test_num = (int16_t)((float)1 * (1 << FIXED_S16_3_PRECISION)); cl_assert(num.raw_value == test_num); cl_assert((FIXED_S16_3_ONE.raw_value == test_num)); cl_assert(...
(num.fraction == 4)
; test_num = (int32_t)((float)0.625 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == 0); cl_assert(num.fraction == 5); test_num = (int32_t)((float)0.750 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.i...
0x61, 0, 0x0}, { 0, 0x61, 0, 0x0}, { 0, 0x61, 162, 0x0}, { 0, 0x52, 171, 0x0}, { 0, 0x52, 0, 0x0}, { 0, 0x52, 0, 0x0}, { 0, 0x52, 0, 0x0}, { 0, 0x52, 0, 0x0}, { 0, 0x52, 0, 0x0}, { 0, 0x52, 0, 0x0}, { 0, 0x52, 0, 0x0}, // 90: Local time: 10:41:00 PM { 0, 0x52, 0, 0x0}, ...
{ 0, 0x18, 0, 0x0}, { 0, 0x18, 0, 0x0}, { 0, 0x18, 467, 0x0}, { 0, 0x15, 32, 0x0}, { 0, 0x15, 0, 0x0}, { 0, 0x15, 0, 0x0}, // 210: Local time: 12:41:00 AM { 0, 0x15, 0, 0x0}, { 0, 0x15, 0, 0x0}, { 0, 0x15, 0, 0x0}, { 0, 0x15, 0, 0x0}, { 0, 0x15, 0, 0x0}, { 0, 0x15, 0,...
{ 0, 0x7e, 0, 0x0}, { 0, 0x7e, 0, 0x0}, { 0, 0x7e, 0, 0x0}, { 0, 0x7e, 0, 0x0}, { 0, 0x7e, 0, 0x0}, { 0, 0x7e, 0, 0x0}, // 270: Local time: 01:41:00 AM { 0, 0x7e, 0, 0x0}, { 0, 0x7e, 0, 0x0}, { 0, 0x7e, 0, 0x0}, { 0, 0x7e, 0, 0x0}, { 0, 0x7e, 0, 0x0}, { 0, 0x7e, 0, 0...
(void) { char string_buffer[PERSIST_STRING_MAX_LENGTH]; memset(string_buffer, '~', sizeof(string_buffer)); cl_assert_equal_i( persist_read_string(0, string_buffer, sizeof(string_buffer)), E_DOES_NOT_EXIST); for (size_t i = 0; i < sizeof(string_buffer); ++i) { if (string_buffer[i] != '~') { ...
for (int i = 0; i < n; ++i) { PBL_LOG(LOG_LEVEL_DEBUG, "i = %d", i); cl_assert_equal_i(persist_write_data(i, &buffer, sizeof(buffer)), sizeof(buffer)); }
e_layer_implementation, layer, from_frame, to_frame); if (from_frame) { animation->values.from.grect = *from_frame; PropertyAnimationImplementation *impl = (PropertyAnimationImplementation *)animation->animation.implementation; impl->accessors.setter.grect(animation->subject, animation->values.from....
(bitmap_size, CANVAS_GBITMAP_FORMAT)
; PBL_ASSERTN(canvas_bitmap); GContext *ctx = fake_graphics_context_get_context(); ctx->dest_bitmap = *canvas_bitmap; // We modify the bitmap's data pointer below so save a reference to the original here uint8_t *saved_bitmap_addr = ctx->dest_bitmap.addr; const uint8_t bitdepth = gbitmap_get_bits_per_pixel...
nt_height = timeline_peek_get_concurrent_height(num_concurrent); gpoint_add_eq(&icon_node->node.offset, GPoint(PBL_IF_RECT_ELSE(1, 2), PBL_IF_RECT_ELSE(0, -1) - (concurrent_height / 2))); graphics_text_node_container_add_child(&vertical_icon_node->container, &icon_node...
(layout, config)
mat = upng_get_format(upng); if (png_format >= UPNG_INDEXED1 && png_format <= UPNG_INDEXED8) { bitmap_sequence->png_decoder_data.palette_entries = gbitmap_png_load_palette(upng, &bitmap_sequence->png_decoder_data.palette); if (bitmap_sequence->png_decoder_data.palette_entries == 0) { APP_LOG(APP...
if (metadata_bytes <= 0) { goto cleanup; }
buffer = applib_zalloc(metadata_bytes); if (buffer == NULL) { goto cleanup; } ResAppNum app_num = sys_get_current_resource_num(); const size_t bytes_read = sys_resource_load_range( app_num, bitmap_sequence->resource_id, png_decoder_data->read_cursor, buffer, metadata_bytes); if (bytes_re...
/* * 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 (1) { 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...
emx_resources_remove_custom(id_1)
; ASSERT(emx_resources_get_size(1, id_1) == 0); emx_resources_remove_custom(id_3); ASSERT(emx_resources_get_size(1, id_3) == 0); // verify 4 is ok buf = 0; ASSERT(emx_resources_read(1, id_4, 0, (uint8_t *)&buf, 1) == 4); ASSERT(buf == 4); ASSERT(s_read_4_called == 2); // remove 4 emx_resources_remo...
s_dropped_reason = APP_MSG_OK; s_failure_result = APP_MSG_OK; s_process_manager_callback = NULL; s_process_manager_callback_data = NULL; s_is_connected = true; // Create the dictionary that is used to compare with what has been received: dict_write_begin(&s_expected_iter, s_expected_buffer, MAX_SIZE_OUTB...
cl_assert_equal_b(app_message_is_accepting_outbound(), true)
; } void test_app_message__send_rejected(void) { // Sending ack on timeout, but reject the send prv_set_remote_receive_handler(prv_nack_sent_callback); prv_send_test_data(); prv_call_outbox_sent(AppOutboxStatusSuccess); prv_process_sent_data(); // Fire the ack timeout after receiving the nack app_timer_...
Set initial values to assume failure bool color_status_bar = false; GColor bg_color = GColorClear; // If there is a current layout, then fetch the color and whether or not the status bar // should be colored if (swap_layer->current) { const GRect *cur_frame = &swap_layer->current->layer.frame; #if PBL_R...
(layer, &end)
; } } //! Creates an animation that moves a layer from its original frame to another frame that is offset //! dy (change in origin.y). static Animation *prv_create_anim_frame_scroll(Layer *layer, uint32_t duration, int16_t dy, ScrollAnimationCurve *curve) { if (!layer...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&touch_event->start_pos, start_pos)
ormal/blob_db/watch_app_prefs_db.h" #include "services/normal/blob_db/weather_db.h" #include "services/normal/weather/weather_types.h" #include "system/logging.h" #include "system/passert.h" static int prv_weather_data_list_node_comparator(void *a, void *b) { return ((WeatherDataListNode *)b)->id - ((WeatherDataList...
uuid_to_string(key, key_string_buffer)
; PBL_LOG(LOG_LEVEL_WARNING, "Could not create forecast from %s's entry", key_string_buffer); task_free(node); return; } ListNode *to_add = (ListNode *)node; list_init(to_add); const bool ascending = true; iterator_context->head = (WeatherDataListNode *)list_sorted_add((ListNode *)iterator...
DITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "ams.h" #include "ams_analytics.h" #include "ams_util.h" #include "comm/ble/ble_log.h" #include "comm/ble/gap_le_connection.h" #include "comm/ble/gatt_c...
conn_mgr_set_ble_conn_response_time(connection, consumer, state, max_period_secs)
; } } bt_unlock(); } static void prv_request_reduced_latency_cb(void *data) { const bool reduced_latency = (uintptr_t)data; const ResponseTimeState state = reduced_latency ? ResponseTimeMiddle : ResponseTimeMax; prv_request_response_time(BtConsumerMusicServiceIndefinite, state, MAX_PERIOD_RUN_FOREVER); }...
handler) { heap->corruption_handler = corruption_handler; } void *heap_malloc(Heap* const heap, unsigned long nbytes, uintptr_t client_pc) { // Check to make sure the heap we have is initialized. UTIL_ASSERT(heap->begin); /* Convert the requested memory allocation in bytes to alignment */ /* size. ...
HEAP_ASSERT_SANE(heap, previous_block->Size == heap_info_ptr->PrevSize, heap_info_ptr); /* Check to see if the previous segment can be combined. */ if(!previous_block->is_allocated) { /* Add the segment to be freed to the new beginer. */ previous_block->Size += heap_info_ptr->Size...
/* Since we merged the next segment, we have to update*/ /* the next next segment's PrevSize field. */ HeapInfo_t *next_next_block = get_next_block(heap, heap_info_ptr); /* If we are pointing at the end of the heap, then use*/ /* the begin as the next next segment. ...
_destroy(s_dest_bitmap); s_dest_bitmap = NULL; } // Helpers ////////////////////// static char s_emoji_string[] = "😄😃😀😊☺😉😍😘😚😗😙😜😝😛😳😁😔😌😒😞😣😢😂😭😥😪😰😅😓😩😫😨😱" "😠😡😤😖😆😋😷😎😴😵😲😟😧😈👿😮😬😐😕😯😶😇😏😑😺😸😻😽😼🙀😿😹😾💩" "👍👎👌👊✊✌👋✋👐👆👇👉👈🙌🙏☝👏💛💙💜💚❤💔💗💓💕💖💞💘💋�...
{ prv_prepare_canvas_and_render_emoji(RESOURCE_ID_GOTHIC_28_EMOJI); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); }
ICENSE-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 * limitations unde...
(GColorWhite, GColorBlack)
radius, p.y)); graphics_private_set_pixel(ctx, GPoint(p.x - radius, p.y)); } #if PBL_COLOR T_STATIC void graphics_circle_draw_1px_aa(GContext* ctx, GPoint p, uint16_t radius) { graphics_circle_quadrant_draw_1px_aa(ctx, p, radius, GCornersAll); } //! Draws an antialiased circle of stroke width > 1 //! @note This ...
GPoint(x0 - y, y0 - x)
, y + 1); } if (quadrant & GCornerTopRight) { if (x == 1) { prv_fill_horizontal_line(ctx, GPoint(x0, y0), radius + 1); } prv_fill_horizontal_line(ctx, GPoint(x0, y0 - y), x + 1); prv_fill_horizontal_line(ctx, GPoint(x0, y0 - x), y + 1); } } } static void graphics_fill_hal...
utton! break; } } if (button_state == 0) { // We made it through with all the buttons released. We're good. return; } // Alright, so either the button is held down or we hit a bounce. Wait // for all the buttons to release again. // 100000 is about a second in practic...
{ if (button_get_state_bits() == 0) { // stop waiting if not held down any longer and go back to sleep return false; } }
return true; } void leave_standby_mode(void) { // Speed up the RTC so the firmware doesn't need to deal with it rtc_speed_up(); }
tion_handler) { swap_layer->callbacks.interaction_handler(swap_layer, swap_layer->context); } } static void prv_refresh_next_layer(SwapLayer *swap_layer) { prv_remove_old_layout(swap_layer, swap_layer->next); LayoutLayer *new_next = prv_fetch_next_layout(swap_layer, +1); swap_layer->next = new_next; if...
graphics_context_set_compositing_mode(ctx, compositing_mode)
; graphics_draw_bitmap_in_rect(ctx, &arrow_layer->arrow_bitmap, &arrow_bounds); } //////////////////////////////// // SWAPPING/ANIMATION FUNCTIONS //////////////////////////////// //! Returns the current offset of the notification //! Always returns a positive number. static int16_t prv_get_current_notification_of...
t 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 WARRANTIES OR C...
gpio_output_set(&BMA255_SCS_CONFIG, false)
/* * 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...
(BOARD_CONFIG.mic_config.i2s_ck.gpio)
t(layer); #endif } void timeline_layer_set_sidebar_color(TimelineLayer *timeline_layer, GColor color) { timeline_layer->sidebar_color = color; } void timeline_layer_set_sidebar_width(TimelineLayer *timeline_layer, int16_t width) { timeline_layer->sidebar_width = width; } static void prv_sidebar_setter(void *cont...
{ prv_set_layout_hidden(layout, hidden); }
} layer_set_hidden((Layer *)&layer->end_of_timeline, hidden); } void timeline_layer_init(TimelineLayer *layer, const GRect *frame_ref, TimelineScrollDirection scroll_direction) { *layer = (TimelineLayer) {}; // timeline layer layer_init(&layer->layer, frame_ref); layer_set_clips(...
tem2.header.id, stub_new_timer_callback_data(get_reminder_timer_id()), sizeof(TimelineItemId)); cl_assert(stub_new_timer_timeout(get_reminder_timer_id()) == 100 * 1000); now = 100; stub_pebble_tasks_set_current(PebbleTask_NewTimers); cl_assert(stub_new_timer_fire(get_reminder_timer_id())); stub_pebble_tasks_s...
(stub_new_timer_timeout(get_reminder_timer_id()), (2 * 60 + 30) * 60 * 1000)
; cl_assert(uuid_equal(&s_all_day_reminder.header.id, (Uuid *)stub_new_timer_callback_data(get_reminder_timer_id()))); } void test_reminders__stale_all_day(void) { time_util_update_timezone(&s_tz); // set time to 21:00 PST March 5, when s_all_day_reminder should be rejected for being stale now = 1425618000...
LayoutIdUnknown, &attributes, &notif_prefs->action_group); bool rv = false; // Make sure we have a reply action (this properly handles NULL items) cons...
(s_phone_ui_data->call_duration_timer)
ANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "drivers/accessory.h" #include "services/common/new_timer/new_timer.h" #include "services/normal/accessory/accessory_manager.h" #include "se...
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 by pending attributes. bool did_send = false; if (smartstrap_profiles_send_control()) { did_send = true; } else if (smartstrap_attribute_send_pending()) { did_send = true; } ...
prv_announce_interaction(swap_layer)
; const bool is_repeating = true; prv_attempt_scroll(swap_layer, prv_direction_for_recognizer(recognizer), is_repeating); } } static void prv_up_multi_click_handler(ClickRecognizerRef recognizer, void *context) { SwapLayer *swap_layer = (SwapLayer *)context; prv_finish_animation(swap_layer); prv_annou...
| //! | | | | //! +--+--------+-------------------------------------+ //! #define FILE_SIZE_BYTES ((FLASH_REGION_DEBUG_DB_END - FLASH_REGION_DEBUG_DB_BEGIN) / DEBUG_DB_NUM_FILES) #define FILE_ID_BIT_WIDTH 4 #define VERSION_ID_BIT_WID...
{ file_id[i] = file_header.file_id; }
} debug_db_determine_current_index(file_id, &s_current_file_index, &s_current_file_id); PBL_LOG(LOG_LEVEL_DEBUG, "Found files {%u, %u, %u, %u}, using file %u with new id %u", file_id[0], file_id[1], file_id[2], file_id[3], s_current_file_index, s_current_file_id); debug_db_reformat_header_section();...
nt16_t gaps_get_starting_att_handle(void) { return 4; } // Helpers /////////////////////////////////////////////////////////// #define TEST_GATT_CONNECTION_ID (1234) static BTDeviceInternal prv_dummy_device(uint8_t octet) { BTDeviceAddress address = { .octets = { [0] = octet, [1] = octet, [...
(gatt_client_characteristic_get_properties(characteristic_ref), expected_characteristic->properties)
; // Test gatt_client_characteristic_get_service(): cl_assert_equal_i(gatt_client_characteristic_get_service(characteristic_ref), service_ref); // Test gatt_client_characteristic_get_device(): BTDeviceInternal returned_device = gatt_client_characteristic_get_device(characteristic_ref); c...
//// // Intro Animation ///////////////////////////////////// static void prv_intro_anim_stopped(Animation *anim, bool finished, void *context) { TimelineAppData *data = context; i18n_free_all(&data->peek_layer); peek_layer_deinit(&data->peek_layer); window_set_click_config_provider_with_context(&data->timelin...
timeline_layout_get_icon_frame(&frame, data->timeline_layer.scroll_direction, &icon_to)
; const bool align_in_frame = true; PeekLayer *peek_layer = &data->peek_layer; peek_layer_set_scale_to_image(peek_layer, &first_timeline_layout->icon_info, TimelineResourceSizeTiny, icon_to, align_in_frame); #if ANIMATION_SLIDE if (was_mini_peek) { prv_play_peek_in(data); ...
, .size = 42163 }, // priority rank 19 { .id = 48, .priority = 56, .size = 72854 }, // priority rank 42 { .id = 49, .priority = 49, .size = 217548 }, // priority rank 37 { .id = 50, .priority = 1, .size = 207357 }, // priority rank 1 }; extern uint32_t app_cache_get_size(void); void prv_load_lotta_apps(void)...
cl_assert_equal_b(true, prv_file_for_id_exists(17))
&& !buffer)) { PBL_LOG(LOG_LEVEL_ERROR, "OOM for GATT notification"); return; } const uint16_t next_value_length = gatt_client_subscriptions_consume_notification(&header.characteristic, buffer, &header.value_length, ...
bt_driver_reconnect_try_now(false /*ignore_paused*/)
; } } else { 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); } } // -----------------------------------------------...
_non_aa(&ctx, COLOR_START_POINT, COLOR_END_POINT, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); */ } /* * Following points come from bug reports, causing "plasma effect" where multiple * lines in close vicinity of one spot (~1 pixel) caused arti...
for (int j=0; j<9; j++) { graphics_line_draw_precise_stroked_non_aa(&ctx, p, p, radius); p.x.raw_value += 1; p.y.integer += 16; }
} cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_same_points_pattern_non_aa.${BIT_DEPTH_NAME}.pbi")); }
GPointZero, GCompOpTint, GColorBlue); cl_assert(gbitmap_eq(&dest_bitmap, &expect_bmp, "test_bitblt__8bit_comptint-expect.8bit.pbi")); // Rewrite the destination bitmap to be all black. memset(dest_data, GColorBlack.argb, sizeof(dest_data)); // Verify that if the tint color is clear, than the source bitmap sh...
bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, &src_bmp, lower_right_legend_rect, GPointZero, GCompOpAssign, GColorWhite); }
// RGB value should be discarded later on adding them here might relveal bugs. // .a is the important part GColor8 test_blend_colors[] = { (GColor8){.a = 0, .r = 3, .g = 2, .b = 1}, (GColor8){.a = 1, .r = 0, .g = 3, .b = 2}, (GColor8){.a = 2, .r = 1, .g = 0, .b = 3}, (GColor8){.a = 3, .r = 2, .g...
/* * 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 0; }
const AnimationImplementation* animation_get_implementation(Animation *animation_h) { return NULL; } const GDrawRawImplementation g_compositor_transitions_app_fb_draw_implementation = {0}; void compositor_port_hole_transition_draw_outer_ring(GContext *ctx, int16_t pixels, ...
, -608}, { 736, -112, -584}, { 744, -112, -560}, { 744, -136, -560}, { 744, -120, -584}, { 736, -120, -576}, { 736, -88, -624}, { 728, -56, -648}, { 728, -88, -632}, { 736, -72, -624}, { 736, -104, -592}, { 744, -112, -584}, { 752, -112, -576}, // 119 seconds { 75...
// 124 seconds { 688, -40, -656}, { 696, -40, -664}, { 696, -40, -656}, { 704, -40, -632}, { 704, -56, -624}, { 704, -64, -632}, { 712, -56, -632}, { 712, -72, -632}, { 712, -48, -640}, { 712, -56, -632}, { 720, -56, -624}, { 728, -72, -608}, { 736, -64, -592}, ...
{ 712, -144, -616}, { 712, -80, -640}, { 720, -56, -632}, { 728, -64, -616}, { 728, -32, -624}, { 720, -64, -608}, { 728, -48, -608}, { 720, -56, -608}, // 127 seconds { 728, -40, -624}, { 720, -48, -616}, { 728, -56, -616}, { 728, -48, -632}, { 720, -56, -624}, ...
c void prv_init_and_goto_session_open_with_tiny_buffers(void) { prv_init_and_goto_awaiting_reset_complete_remote_initiated(); RCV_APP_MESSAGE(TupletBytes(PostMessageKeyResetComplete, \ (const uint8_t *)&TINY_RESET_COMPLETE, sizeof(TINY_RESET_COMPLETE))); cl_assert_equal_i(rocky_api_a...
prv_init_and_goto_session_open()
; const char *not_jsonable_error = "TypeError: Argument at index 0 is not a JSON.stringify()-able object"; EXECUTE_SCRIPT_EXPECT_ERROR("_rocky.postMessage(undefined);", not_jsonable_error); EXECUTE_SCRIPT_EXPECT_ERROR("_rocky.postMessage(function() {});", not_jsonable_error); EXECUTE_SCRIPT_EXPECT_ERROR("_r...
message->endpoint_id, message->command_id); s_num_consec_enqueue_failures++; if (initialized && (s_num_consec_enqueue_failures >= NUM_CONSEC_FAILURES)) { core_dump_and_reset_or_reboot(); } success = false; goto done; } } s_num_consec_enqueue_failures = 0; do...
if (prv_check_initialized() && (s_num_consec_request_failures >= NUM_CONSEC_FAILURES)) { core_dump_and_reset_or_reboot(); }
} return response; } HcProtocolMessage *hc_protocol_enqueue_with_payload_and_expect(HcEndpointID endpoint_id, HcCommandID command_id, const uint8_t *request_payload, ...
#include "services/normal/activity/activity_insights.h" #include "services/normal/blob_db/api.h" #include "services/normal/blob_db/pin_db.h" #include "services/normal/blob_db/reminder_db.h" #include "services/normal/notifications/notification_storage.h" #include "services/normal/phone_call_util.h" #include "services/no...
{ if (current->timestamp > now) { break; } if (!current->all_day && (current->timestamp >= today_midnight)) { show = !show; break; } current = (TimelineNode *)current->node.next; }
m/ble_hrm_reminder_popup.h" #include "popups/ble_hrm/ble_hrm_sharing_popup.h" #include "process_management/app_manager.h" #include "services/common/analytics/analytics.h" #include "services/common/analytics/analytics_event.h" #include "services/common/hrm/hrm_manager_private.h" #include "services/common/regular_timer.h...
(connection)
; } bool ble_hrm_is_sharing(void) { return (s_ble_hrm_subscription_count > 0); } typedef struct { BTDeviceInternal *next_permitted_device; size_t slots_left; } CopySharingDevicesCtx; static void prv_copy_sharing_devices_for_each_connection_cb(GAPLEConnection *connection, ...
return false; } static bool check_for_recovery_start_failure() { return boot_bit_test(BOOT_BIT_RECOVERY_START_IN_PROGRESS); } static bool check_for_fw_start_failure() { // Add more failure conditions here. if (!watchdog_check_reset_flag() && !boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { // We're ...
dbgserial_putstr(" /\\ \\L\\ \\/\\ \\/\\ \\ \\ \\_\\ \\ \\ \\_/ \\_/ \\ \\ \\_\\ \\")
; dbgserial_putstr(" \\ `\\____\\ \\_\\ \\_\\ \\____/\\ \\___x___/'\\/`____ \\"); dbgserial_putstr(" \\/_____/\\/_/\\/_/\\/___/ \\/__//__/ `/___/> \\"); dbgserial_putstr(" /\\___/"); dbgserial_putstr(" \\/__/"); // PM...
/* * 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_get_content_size()
; jerry_set_object_field(preferences, ROCKY_USERPREFERENCES_CONTENTSIZE, content_size); } static void prv_init(void) { bool was_created = false; JS_VAR rocky = rocky_get_rocky_singleton(); JS_VAR preferences = rocky_get_or_create_object(rocky, ROCKY_USERPREFERENCES, ...
ELL_ROUND_UNFOCUSED_SHORT_CELL_HEIGHT, MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT, #endif 0, //!< Will be interpreted as "use menu_cell_basic_cell_height()" MENU_CELL_ROUND_FOCUSED_SHORT_CELL_HEIGHT, MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT, }; #define GRID_CELL_PADDING 5 static int16_t prv_get_row_height_for...
prv_menu_cell_draw_dispatch(&s_ctx, &cell_layer, cell_type, &config, row_data->icon_subbitmap)
; } void prv_prepare_canvas_and_render_cells(MenuCellType cell_type, int16_t cell_width, const MenuLayerSystemCellTestColumnData *columns, unsigned int num_columns, bool is_legacy2) { gbitmap_destroy(s_dest_bitmap); const unsigned i...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ system_task_add_callback(prv_handle_response_from_phone, session); }
return 12345; } BlobDBToken blob_db_endpoint_send_write(BlobDBId db_id, time_t last_updated, const void *key, int key_len, const void *val, ...
; static void prv_enable_qspi_clock(void) { periph_config_enable(RCC_AHB3PeriphClockCmd, RCC_AHB3Periph_QSPI); } static void prv_disable_qspi_clock(void) { periph_config_disable(RCC_AHB3PeriphClockCmd, RCC_AHB3Periph_QSPI); } static void prv_set_num_data_bytes(uint32_t length) { // From the docs: QSPI_DataLeng...
prv_flash_reset()
; prv_disable_qspi_clock(); } bool flash_sanity_check(void) { prv_enable_qspi_clock(); bool result = prv_flash_check_whoami(); prv_disable_qspi_clock(); return result; } void flash_read_bytes(uint8_t *buffer_ptr, uint32_t start_addr, uint32_t buffer_size) { prv_enable_qspi_clock(); prv_set_num_data...
plib/ui/app_window_click_glue.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/click.h" #include "applib/ui/layer.h" #include "applib/ui/layer_private.h" #include "applib/ui/window_manager.h" #include "applib/ui/window_stack.h" #include "applib/applib_malloc.auto.h" #include "applib/legacy2/ui/status_bar_...
{ window->is_render_scheduled = false; return; }
// workaround for 3rd-party apps // if a window is configured as non-fullscreen, it's frame needs to start at .origin={0,0} // to compensate for cases where clients configure a layer hierarchy with // my_layer = layer_create(window.root_layer.frame) // ! wrong, should be .bounds // Of course on the screen...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_set_window_handlers(window, &s_main_menu_handlers)
; app_window_stack_push(window, true /*animated*/); } static void handle_deinit(void) { // Don't bother freeing anything, the OS should be re-initing the heap. } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* timer_app_get_info() { static const Pebbl...
us, sed venenatis " "augue maximus a. Duis venenatis tortor sit amet justo sodales suscipit. " "Morbi tincidunt rutrum nisl, eget placerat nisi condimentum a. Vestibulum " "ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia " "Curae; Cras varius sagittis mauris, in consequat sapien tincidunt ...
cl_assert_(string_buffer[i] == '~', "persist_read_string writes past the end of destination buffer")
; } } void test_persist__size_of_nonexistent_key(void) { cl_assert_equal_i(persist_get_size(0), E_DOES_NOT_EXIST); } void test_persist__size(void) { char data[] = { 1, 2, 3, 4, 5, 6 }; cl_assert_equal_i(persist_write_data(0, data, sizeof(data)), sizeof(data)); cl_assert_equal_i(persist_get_size(0), sizeof(d...
= text_node->line_spacing_delta, }; const GTextNodeDrawConfig *config = ctx->config; if (config) { if (config->text_flow) { graphics_text_attributes_enable_screen_text_flow((TextLayout *)&layout, config->content_inset); } if (config->paging...
(&ctx->box.origin)
[axis] += size[axis]; ToGValue(&ctx->box.size)[axis] -= size[axis]; return true; } static void prv_draw_text_node_custom(GTextNodeDrawContext *ctx) { GTextNodeCustom *custom_node = (GTextNodeCustom *)ctx->node; custom_node->callback(ctx->gcontext, &ctx->box, ctx->config, ctx->render, ctx->size_out, ...
=%u)", prv_string_for_debug_tag(job->tag), gap_le_connect_is_connected_as_slave()); // Set to next job (round-robin) that isn't silent (unless there is no non-silent one): s_jobs = (GAPLEAdvertisingJob *) job->node.next; while (prv_is_current_term_silent(s_jobs) && s_jobs != jo...
PBL_LOG(GAP_LE_ADVERT_LOG_LEVEL, "Airing advertising job: %s ", prv_string_for_debug_tag(next->tag))
; // Use average interval ms. BT controller does not report back what it uses. const uint32_t interval_ms = (min_interval_ms + max_interval_ms) / 2; // The ad data is fixed in size. See below. // The scan response data size is omitted here, because we can't tell how // often a ...
///////////////////////////////////////////////// #include "fake_kernel_malloc.h" #include "fake_session_send_buffer.h" #include "fake_system_task.h" #include "fake_app_manager.h" MetaResponseInfo s_last_meta_response_info; void meta_endpoint_send_response_async(const MetaResponseInfo *meta_response_info) { s_last...
{ ++s_cleanup_count; }
const ReceiverImplementation g_system_test_receiver_imp = { .prepare = prv_system_test_receiver_prepare, .write = prv_system_test_receiver_write, .finish = prv_system_test_receiver_finish, .cleanup = prv_system_test_receiver_cleanup, }; // Tests /////////////////////////////////////////////////////////// v...
ed in max encoded message size PBL_ASSERTN(max_msg_size <= PLOG_DLS_RECORD_SIZE); if (max_msg_size == 0) { max_msg_size = PLOG_DLS_RECORD_SIZE; } // Default transport if (!transport) { transport = prv_dls_transport; } // Create a buffer for the final fully-formed record. Since we send it out thr...
PBL_ASSERTN(session_ref != NULL)
; PLogSession *session = (PLogSession *)session_ref; PBL_ASSERTN(session->config.type == ProtobufLogType_Measurements); int32_t offset_sec = sample_utc - session->start_utc; offset_sec = MAX(0, offset_sec); // error check PBL_ASSERT(num_values == session->config.measurements.num_types, "Wrong number of val...
/* * 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 localtime_r(timep, result); }
// i18n dummies //////////////////////////////////// static bool s_i18n_translate = false; static bool s_i18n_locale_other = false; char *i18n_get_locale(void) { if (s_i18n_locale_other) { return "es_ES"; } else { return "en_US"; } } char *app_get_system_locale(void) { return "es_ES"; } const char *...
app_cache__initialize(void) { rtc_set_time(1478397600); fake_spi_flash_init(0, 0x1000000); fake_event_init(); pfs_init(false); app_cache_init(); app_cache_flush(); } void test_app_cache__cleanup(void) { fake_system_task_callbacks_cleanup(); s_test_id_ql_up = 0; s_test_id_ql_down = 0; s_test_id_wat...
app_cache_app_launched(j)
new_state = WordStateGrowing; } break; case WordStateJoining: if (codepoint == NEWLINE_CODEPOINT) { new_state = WordStateEnd; } else if (codepoint_is_ideograph(codepoint)) { new_state = WordStateIdeograph; } else if (codepoint == WORD_JOINER_CODEPOINT) { ...
(codepoint)
) { if (!iter_next(char_iter)) { return false; } } while (codepoint_is_zero_width(utf8_iter_state->codepoint)) { if (utf8_iter_state->codepoint == 0) { PBL_ASSERTN(utf8_iter_state->current == utf8_iter_state->bounds->end); return false; } if (!iter_next(char_iter)) { br...
der = { .id = {0x02}, .parent_id = {0}, .timestamp = 1421107200, // Tue Jan 13 midnight 2015 UTC .duration = MINUTES_PER_DAY, .type = TimelineItemTypePin, .all_day = 1, .layout = LayoutIdTest, }, .attr_list = { .num_attributes = 0, .attrib...
(uuid_equal(&state.pin.header.id, &s_items[1].header.id))
; } void test_timeline__forward_and_back(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 // check first timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionF...
h" // Overrides ////////////////////////////////////////////////////////// void sys_get_time_ms(time_t *t, uint16_t *out_ms) {} time_t sys_time_utc_to_local(time_t t) { return t; } const char *get_timezone_abbr(void) { static const char s_timezone_abbr[] = "A"; return s_timezone_abbr; } void sys_copy_timezone...
(tmbuf, sizeof(tmbuf), "%d", &jan_2_2015__13_00_00)
; cl_assert_equal_s(tmbuf, "02"); #if EXTENSION_C99 tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%F", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "2015-01-02"); #endif #if EXTENSION_TZ tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%G %g", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "201...
/* * 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...
{ size_t remaining_length = length; const SessionSendQueueJob *job = session->send_queue_head; while (job && remaining_length) { const size_t job_length = job->impl->get_length(job); if (job_length <= start_offset) { start_offset -= job_length; } else { const size_t copied_length = job->im...
size_t comm_session_send_queue_get_read_pointer(const CommSession *session, const uint8_t **data_out) { if (!session->send_queue_head) { return 0; } const SessionSendQueueJob *job = session->send_queue_head; return job->impl->get_read_pointer(job, data_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...
load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, CHINESE_FIXTURE_NAME, "lang")
; //cl_assert(resource_has_valid_system_resources()); memset(&s_font_info, 0, sizeof(s_font_info)); memset(&s_font_cache, 0, sizeof(s_font_cache)); FontCache *font_cache = &s_font_cache; memset(font_cache->cache_keys, 0, sizeof(font_cache->cache_keys)); memset(font_cache->cache_data, 0, sizeof(font_cache-...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ bt_driver_reconnect_try_now(true /*ignore_paused*/); }
e_outbox_send()); } //////////////////////////////////////////////////////////////////////////////// // Handling Inbound Object Chunks //////////////////////////////////////////////////////////////////////////////// static void prv_cleanup_inbound_reassembly_buffer(void) { task_free(s_state.in.reassembly_buffer); ...
prv_cleanup_inbound_reassembly_buffer()
; } return true; } //////////////////////////////////////////////////////////////////////////////// // Control Message Queue //////////////////////////////////////////////////////////////////////////////// static void prv_control_message_queue_pop_head(void) { MessageNode *old_head = s_state.out.control_msg_qu...
th_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; // Init mutable types word_iter_init(&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start); // Tests cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.hei...
(line.width_px == 1 * HORIZ_ADVANCE_PX)
; // reset line line = (Line) { 0 }; line.max_width_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); cl_...
RAGE_MINIMUM_INCREMENT_SIZE; // Free up space size in blocks size_t size_available = 0; NotificationIterState iter_state = { .fd = fd, }; Iterator iter; iter_init(&iter, (IteratorCallback)&prv_iter_next, NULL, &iter_state); while (iter_next(&iter)) { uint8_t status = iter_state.header.common.statu...
{ return; }
size_t size_needed = header.payload_length + sizeof(SerializedTimelineItemHeader); if (size_needed > (NOTIFICATION_STORAGE_FILE_SIZE - s_write_offset)) { if (!prv_compress(size_needed, &fd)) { // Notification storage compression failed. Clear notifications storage goto reset_storage; } } 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...
PBL_ASSERTN(!s_cache)
; s_cache = kernel_zalloc_check(sizeof(*s_cache)); uint8_t *buffer = kernel_zalloc_check(sizeof(AncsAppNameStorageEntry) * ANCS_APP_NAME_STORAGE_SIZE); circular_cache_init(s_cache, buffer, sizeof(AncsAppNameStorageEntry), ANCS_APP_NAME_STORAG...
uid_a = TEST_UUID_A; static const int test_uuid_b_id = 2; static const Uuid test_uuid_b = { 0xC3, 0x0D, 0xBA, 0xF1, 0x5F, 0x6F, 0x4F, 0x22, 0xBA, 0xAA, 0x8C, 0x2A, 0x96, 0x8C, 0xFC, 0x28 }; static const int test_uuid_c_id = 3; static const Uuid test_uuid_c = { 0x1D, 0x6C, 0x7F, 0x01, 0xD9, 0x48, 0x42, 0xA6, 0xAA, 0x4...
persist_read_data(key, &uuid_buffer, sizeof(uuid_buffer))
, size); cl_assert(uuid_equal(&test_uuid_a, &uuid_buffer)); } void test_persist__data_too_big(void) { char buf[PERSIST_DATA_MAX_LENGTH+2]; memset(buf, '~', sizeof(buf)); cl_assert_equal_i(persist_write_data(0, lipsum, sizeof(lipsum)), PERSIST_DATA_MAX_LENGTH); cl_assert_equal_i(persist_...
/* * 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...
(bytes_written, sizeof(s_chunked_dict_part_two))
; bool error = false; cl_assert(ancs_util_is_complete_notif_attr_response(b->data, b->bytes_written, &error)); cl_assert(!error); ANCSAttribute* attr_ptrs[NUM_FETCHED_NOTIF_ATTRIBUTES]; // Only pass the attribute data to ancs_util_get_attr_ptrs: const GetNotificationAttributesMsg *msg = (const GetNotif...
ng that we want to reconnect/connect to. If this isn't set then // we don't register an intent for the device and thus don't connect. // Currently only 1 ble pairing is really supported so this works for now // FIXME: https://pebbletechnology.atlassian.net/browse/PBL-15277 .ble_data.supports_ancs = is_g...
prv_file_get(&bonding, sizeof(bonding), &data, sizeof(data))
) { return false; } if (data.type != BtPersistBondingTypeBLE) { PBL_LOG(LOG_LEVEL_ERROR, "Not getting BT Classic id %d. Type mismatch", bonding); return false; } prv_fill_ble_data(&data.ble_data.pairing_info.irk, &data.ble_data.pairing_info.identity, data.ble_data.name, irk_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_equal_i(e.type, PEBBLE_MEDIA_EVENT)
; cl_assert_equal_i(e.media.type, PebbleMediaEventTypeTrackPosChanged); char artist[MUSIC_BUFFER_LENGTH]; char album[MUSIC_BUFFER_LENGTH]; char title[MUSIC_BUFFER_LENGTH]; music_get_now_playing(title, artist, album); cl_assert_equal_s(artist, "one"); cl_assert_equal_s(album, "two"); c...
it_msg, sizeof(init_msg)); } static void prv_receive_init_file(uint32_t total_size, const char *fn, size_t fn_len) { uint8_t buffer[sizeof(InitRequest) + fn_len]; InitRequest *init_msg = (InitRequest *)buffer; *init_msg = (InitRequest) { .cmd = CmdInit, .total_size = htonl(total_size), .type = Objec...
{ // Not the put bytes endpoint, ignore return; }
// We should only be getting ACKs and NACKs back on this endpoint, which are both 5 bytes long cl_assert_equal_i(data_length, 5); ResponseMsg *response_msg = (ResponseMsg *)data; s_last_response_cookie = ntohl(response_msg->cookie); if (response_msg->response == ResponseAck) { ++s_acks_received; } el...
/* * 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...
graphics_context_get_framebuffer_size(ctx)
; layer_init(&status_bar_layer->layer, &GRect(0, 0, current_framebuffer_size.w, prv_height())); status_bar_layer->layer.update_proc = prv_status_bar_layer_render; status_bar_layer->layer.property_changed_proc = prv_status_bar_property_changed; // tick event to callback which checks every second if the time is...
izeof(Intersection)); // If either malloc failed, log message and cleanup if (!intersections_up || !intersections_down) { APP_LOG(APP_LOG_LEVEL_ERROR, GPATH_ERROR); goto cleanup; } int intersection_up_count; int intersection_down_count; // convert clip coordinates to drawing coordinates const i...
swapIntersections(&x_a, &x_b)
; } // this is done by callback now... // x_a.x.integer++; // x_b.x.integer--; cb(ctx, i, x_a.x, x_b.x, x_a.delta, x_b.delta, user_data); } } } // restore original stroke color ctx->draw_state.stroke_color = tmp; cleanup: applib_free(rot_points); applib_fre...
(uint8_t*) s_this_message_has_no_content_response); s_num_ds_notifications_received++; } else if (uid == s_invalid_param_uid) { ancs_handle_write_response(0, 0xA2); s_num_ds_notifications_received++; } else if (uid == multiple_complete_dict_uid) { prv_fake_receiving_ds_notifica...
prv_send_notification((uint8_t *)&s_chunked_dict_part_one)
otification_removed_common(Uuid *id, NotificationType type) { NotificationWindowData *data = &s_notification_window_data; if (s_in_use && data->is_modal && !data->window_frozen) { prv_remove_notification(data, id, true /* close am */); } } static void prv_handle_notification_acted_upon(Uuid *id) { Notific...
{ if (!s_in_use && e->type != NotificationAdded) { return; } switch (e->type) { case NotificationActionResult: prv_handle_action_result(e->action_result); break; case NotificationAdded: prv_handle_notification_added_common(e->notification_id, NotificationMobile); break; cas...
65243370); stub_pebble_tasks_set_current(PebbleTask_App); app_manager_get_task_context()->to_process_event_queue = (void *)0x1; fake_system_task_callbacks_cleanup(); s_activity_prefs_heart_rate_is_enabled = true; s_event_count = 0; s_num_cb_events_1 = 0; s_num_cb_events_2 = 0; memset(&s_hrm_state, 0, ...
{ AppInstallId app_id = 1; const uint16_t expire_s = SECONDS_PER_MINUTE; HRMSessionRef session_ref = sys_hrm_manager_app_subscribe(app_id, 1, expire_s, HRMFeature_BPM); cl_assert(sys_hrm_manager_get_app_subscription(app_id) == session_ref); prv_fake_send_new_data(); // We should get the BPM event cl_a...
er_consume(&buffer, &client, 1)); // Consume one without reading it cl_assert(shared_circular_buffer_consume(&buffer, &client, 1)); // Read the last little bit cl_assert(shared_circular_buffer_read(&buffer, &client, 1, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 1); cl_assert(memcmp(out_buff...
(shared_circular_buffer_get_read_space_remaining(&buffer, &client1), 3)
; cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client2), 5); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 3); // If we remove client2, it should create more space shared_circular_buffer_remove_client(&buffer, &client2); cl_assert_equal_i(shared_c...
ation((Layer *)layout, &frame, direction); } } const GRect *day_sep_from = &((Layer *)&layer->day_separator)->frame; animations[num_animations++] = prv_create_bounce_back_animation((Layer *)&layer->day_separator, ...
kino_layer_set_reel_with_resource(&layer->end_of_timeline, RESOURCE_ID_END_OF_TIMELINE)
*data, uint8_t length, void *cb_data) { struct ManufacturerSpecificCtx *ctx = (struct ManufacturerSpecificCtx *) cb_data; const uint8_t copied_size = MIN(ctx->size, length); memcpy(ctx->buffer, data, copied_siz...
if (!ad_data || !element) { return false; }
const size_t size_to_write = element->header.length + 1 /* Length Byte */; uint8_t* length = prv_length_to_increase(ad_data, size_to_write); if (!length) { // Not enough space... return false; } // Undo the magic number trick: if (*length == BLE_AD_DATA_FINALIZED) { *length = 0; } // Appe...
= len * 1000, }; prv_insert_artificial_activity_session(minute_raw_data, k_minute_data_len, &exp_session); prv_feed_activity_minutes(minute_raw_data, k_minute_data_len); cl_assert_equal_i(s_num_captured_activity_sessions, 0); } // ------------------------------------------------------------------...
cl_assert_equal_i((now - stats.uncertain_start_utc) / SECONDS_PER_MINUTE, KALG_MAX_UNCERTAIN_SLEEP_M)
; } // After we're certain sleep ended if (i > k_sleep_end_m + KALG_MAX_UNCERTAIN_SLEEP_M) { cl_assert_equal_i(stats.sleep_start_utc, k_sleep_start_utc); cl_assert_equal_i(stats.sleep_len_m, k_sleep_end_m - k_sleep_start_m); cl_assert_equal_i(stats.uncertain_start_utc, 0); } now ...
_line_dotted(&ctx, GPoint(0, 8), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 10), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); graphics_draw_horizonta...
GPoint(0, 12)
, 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20), MAX_NUM_COLS - 1); graphics_draw_horizontal_line_dotted(&...
(int32_t)c->s32); cl_assert_equal_i(s64, (int64_t)c->s64); cl_assert_equal_d(d, (double)c->d); } JERRY_ARGS_RELEASE(); } } void test_rocky_api_util_args__number_type_mismatch(void) { jerry_value_t mismatch_args[] = { jerry_create_null(), jerry_create_string((const jerry_char_t *)"one"),...
jerry_create_object()
, .expected_output = "[object Object]", }, }; for (int i = 0; i < ARRAY_LENGTH(cases); ++i) { jerry_value_t input = cases[i].input; JERRY_ARGS_MAKE(input); // Exercise ROCKY_ARG (automatic binding creation, defaults to malloc'd string for char *): { char *output = NULL; ROCKY...
so8601_adjust(t, year)) { case -1: // 53 weeks if the current year started on a Friday, // orrrrrr Saturday and last year was a leap year. return prv_year_week_count(year - 1, t, 5, 6); case 1: return 1; default: return prv_iso8601_base_week(t); } } // Sorry I made a mess, i...
{ cpystr = i18n_get(i18nstr, dest_str); }
length = localized_strftime(dest_str, left, cpystr, t, locale); if (i18nstr) { i18n_free(i18nstr, dest_str); } if (length == 0) { goto _out_of_size; } dest_str += length; left -= length; break; case 'C': // SU FMT_INTCOPY...
nclude "services/normal/filesystem/pfs.h" #include "services/normal/settings/settings_file.h" #include "services/normal/timeline/attributes_actions.h" #include "system/logging.h" #include "system/passert.h" #include "util/attributes.h" #include "util/units.h" #include <stdio.h> T_STATIC const char *iOS_NOTIF_PREF_DB_...
{ char buffer[key_len + 1]; strncpy(buffer, (const char *)app_id, key_len); buffer[key_len] = '\0'; PBL_LOG(LOG_LEVEL_ERROR, "Could not parse serial data for <%s>", buffer); prv_free_serialzed_prefs(serialized_prefs); return NULL; }
const size_t alloc_size = attributes_actions_get_required_buffer_size(serialized_prefs->num_attributes, serialized_prefs->num_actions, attributes_per_action, st...
/* * 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)
, -336}, { 160, 968, -464}, { 120, 1136, -568}, { 160, 744, -488}, { 56, 968, -592}, { 160, 1000, -496}, // 13 seconds { 184, 912, -504}, { 32, 576, -416}, { -32, 488, -328}, { -64, 480, -280}, { -72, 592, -240}, { -136, 808, -416}, { -160, 856, -440}, { -120, 107...
{ 160, 1344, -640}, { 104, 1056, -432}, { 120, 1008, -440}, { 216, 1064, -440}, { 184, 872, -456}, { 88, 664, -424}, { 16, 392, -360}, { 0, 400, -256}, { -40, 544, -264}, { 0, 672, -328}, { 56, 864, -520}, { 128, 928, -536}, { 56, 1120, -720}, { 280, 1248, -688}, ...
{ 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, -4...
{ if (!s_fu_app_data) { return; } if (!event->bluetooth.comm_session_event.is_system) { return; } const bool is_connected = event->bluetooth.comm_session_event.is_open; // When the Pebble app is connected, to being discoverable / pairable. We do this to avoid // stressing out the BT controller d...
static void prv_bt_event_handler(PebbleEvent *event, void *context) { if (!s_fu_app_data) { return; } prv_update_name_text(s_fu_app_data); } static void prv_gather_debug_info_event_handler(PebbleEvent *event, void *context) { if (!s_fu_app_data) { return; } if (event->debug_info.state == DebugInf...