prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
t_metric(ActivityMetricSleepExitAtSeconds, 1, &value); cl_assert_equal_i(value, 4 * SECONDS_PER_HOUR + 45 * SECONDS_PER_MINUTE /* 4:45am */); // Assert that we got the same sleep sessions using the activity service as we do using // the health API prv_assert_equal_activity_and_health_sleep_sessions(2); // -...
cl_assert_equal_i(steps, 1500)
; } // --------------------------------------------------------------------------------------- // Test distance using various speeds and user dimensions typedef struct { int height_in; int gender; int steps; float seconds; int exp_distance_m; // expected distance } DistanceTestParams; void test_activity__...
age 1 and 2 are consumed now: cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data + 1, BUFFER_SIZE - 1)); cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); // One callback event scheduled: assert_num...
app_inbox_service_end(AppInboxServiceTagUnitTest)
); // Begin another one: cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest, 1, s_writer)); // Expect to return 2, because two messages are being dropped, the successful one that was not // yet processed and the currently written one: ...
*)node; return (strcmp(filechg_node->name, (char *)data) == 0); } PFSCallbackHandle pfs_watch_file(const char* filename, PFSFileChangedCallback callback, uint8_t event_flags, void* data) { mutex_lock_recursive(s_pfs_mutex); PFSFileChangedCallbackNode *node = kernel_malloc_check(...
pfs_close(fd)
ler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_hand...
(a, duration_a)
; Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); // Create a sequence Animation *seq = animation_sequence_create(a, b, NULL); cl_assert(seq != NULL); animation_set_play_count(seq, play_count_seq); // Check the duration cl_assert_equal_i(animation_get_duration(seq, ...
592, -120}, { -616, 144, -152}, { -584, -120, -144}, { -496, -192, -40}, { -432, 728, -16}, { -24, 3520, 480}, { 496, 2264, 712}, { 464, 1376, 352}, { 304, 672, 200}, { 352, 112, 24}, { 416, -240, 88}, { 552, -560, 328}, { 712, -328, 160}, { 1096, 1768, 976}, { 6...
// 13 seconds { -464, 2752, 440}, { -168, 2720, 1048}, { 344, 1816, 664}, { 384, 1112, 336}, { 352, 576, 152}, { 320, -56, 264}, { 504, -344, 216}, { 592, -392, 296}, { 920, 464, 232}, { 320, 2480, 1008}, { 456, 2312, 304}, { -240, 1544, 192}, { -376, 992, 32}, ...
{ -416, 2176, 376}, { 152, 3264, 1032}, { 456, 2072, 584}, { 488, 1056, 168}, { 400, 344, 56}, { 376, -168, 152}, { 456, -232, 112}, { 448, -504, 336}, // 16 seconds { 760, 184, 264}, { 616, 2448, 784}, { 416, 2304, 288}, { -64, 1848, 184}, { -200, 1192, -40}, ...
DrawShape; #define NUM_SHAPES MAX_SHAPES static GColor s_display_colors[NUM_SHAPES]; #define MAX_STROKE_WIDTH 20 static const GPathInfo s_triangle_path = { 3, (GPoint[]) { { -10, 0 }, { 0, 10 }, { 10, 0 } } }; static const GPathInfo s_bucket_path = { 4, (GPoint[]) { { -10, 0 }, { -10, ...
stroke_width_enabled(data->state_index)
) { data->stroke_width++; if (data->stroke_width >= MAX_STROKE_WIDTH) { data->stroke_width = 1; } } log_state(data); } static void select_handler(ClickRecognizerRef recognizer, void *context) { AppData *data = app_state_get_user_data(); update_state(data, ((data->state_index + 1) % APP_STATE...
{ struct InstallableObject* o = NULL; for (int i = 0; i < NumObjects; ++i) { if (s_ready_to_install[i].token == token) { o = &s_ready_to_install[i]; break; } } if (token == 0 || o == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "Token does not exist; got 0x%" PRIx32, token); prv_cleanup_and_se...
if (s_pb_state.timer_id != TIMER_INVALID_ID) { new_timer_stop(s_pb_state.timer_id); } else { s_pb_state.timer_id = new_timer_create(); }
} static bool prv_setup_storage_for_init_request(const InitRequest *request, uint32_t index) { PutBytesStorageInfo *storage_info = NULL; switch (request->type) { #ifndef RECOVERY_FW case ObjectFile: { storage_info = kernel_malloc_check(sizeof(PutBytesStorageInfo) + ...
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_params, // while holding the ble_mgr_dev_params lock. ble_error_t rv = ble_gap_adv_intv_set(min_slots, max_slots); if (rv != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR,...
{ s_desired_host_adv_state = AdvertState_Running; prv_try_to_enter_host_desired_state(); rv = s_adv_state; }
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), ...
GTransformNumberZero, GTransformNumberZero); cl_assert(gtransform_is_equal(&t, &t_c)); angle = DEG_TO_TRIGANGLE(46); cosine = cos_lookup(angle); sine = sin_lookup(angle); t_c = GTransform(GTransformNumberFromNumber((float)cosine / TRIG_MAX_RATIO), GTr...
void test_graphics_gtransform_${BIT_DEPTH_NAME}__concat(void) { GTransform t_new; GTransform t1; GTransform t2; GTransform t_c; // matrix to compare against // Test identity concatenation t1 = GTransformIdentity(); t2 = GTransformIdentity(); t_c = GTransformIdentity(); gtransform_concat(&t_new, &t...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if ((s_dst_start == 0) || (s_dst_end == 0)) { return false; }
return ((s_dst_start <= utc_time) && (utc_time < s_dst_end)); } int time_will_transition_dst(time_t prev, time_t next) { if (time_get_isdst(prev) == time_get_isdst(next)) { return 0; } else if (time_get_isdst(prev)) { return time_get_dstoffset(); } else { return -time_get_dstoffset(); } } int3...
und_color); graphics_context_set_stroke_color(&s_ctx, foreground_color); Layer cell_layer; layer_init(&cell_layer, &cell_frame); cell_layer.is_highlighted = is_selected; s_cell_is_highlighted = is_selected; const MenuCellLayerConfig config = { .title_font = column_data->title_font ? fonts_get_system_f...
prv_prepare_canvas_and_render_cells( MenuCellType_Basic, cell_width, s_menu_system_basic_cell_test_column_data, ARRAY_LENGTH(s_menu_system_basic_cell_test_column_data), /* is_legacy2 */ true)
; cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); #endif } void test_menu_layer_system_cells__basic_cell_width_144(void) { const int16_t cell_width = 144; prv_prepare_canvas_and_render_cells( MenuCellType_Basic, cell_width, s_menu_system_basic_cell_test_column_data, ARRAY_LENGTH(s_menu_...
/* * 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...
blob_db_sync_next(session)
; } static void prv_generate_responses_from_phone(void) { while (fake_system_task_count_callbacks()) { fake_system_task_callbacks_invoke_pending(); } } BlobDBToken blob_db_endpoint_send_writeback(BlobDBId db_id, time_t last_updated, ...
N) { PBL_LOG(LOG_LEVEL_WARNING, "Invalid duration: %"PRIu16" ", session->length_min); return false; } // The flags must be valid if (session->reserved != 0) { PBL_LOG(LOG_LEVEL_WARNING, "Invalid flags: %d", (int)session->reserved); return false; } return true; } // ------------------------...
(&state->activity_sessions[found_session_idx], 0, sizeof(ActivitySession))
; } else { memmove(&state->activity_sessions[found_session_idx], &state->activity_sessions[found_session_idx + 1], num_to_move * sizeof(ActivitySession)); } state->activity_sessions_count--; } unlock: mutex_unlock_recursive(state->mutex); } // -----------------------...
((Layer *)&data->action_menu_layer, start, &stop); Animation *content_out = property_animation_get_animation(prop_anim); animation_set_duration(content_out, IN_OUT_ANIMATION_DURATION); AnimationHandlers anim_handlers = { .started = NULL, .stopped = prv_next_level_anim_stopped, }; AnimationContext *an...
applib_free(data)
; } static void prv_dummy_click_config(void *data) { } ActionMenuLevel *action_menu_get_root_level(ActionMenu *action_menu) { if (!action_menu) return NULL; ActionMenuData *data = window_get_user_data(&action_menu->window); return (ActionMenuLevel *)data->config.root_level; } void *action_menu_get_context(Acti...
// Now - one day const int event_time = jun10th_noon_2015 - SECONDS_PER_DAY; // if the event is within 24 hours, then show the actual time instead of "X hours ago" const int MAX_RELATIVE_HRS = 24; // June 9th 2015, 13:30:00 (T+01:30:00) rtc_set_time(event_time + SECONDS_PER_HOUR + (30 * SECONDS_PER_MINUT...
cl_assert_equal_s("IN 1 H", time_buf); // June 9th 2015, 14:00:00 (T-02:00:00) rtc_set_time(event_time - (2 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 2 H", time_buf); // June 9th 2015, 15:59:00 (T-00:01:00) rtc...
rtc_set_time(event_time + (7 * SECONDS_PER_DAY) + (1 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Jun 9, 4:00 PM", time_buf); } void test_clock__time_24h_style(void) { char time_buf[64]; const int jun10th_noon_2015 = ...
// We just successfully sent a read request, so should move to ReadInProgress to prepare to // read the response. We do this here to ensure we don't miss any bytes of the response due to // KernelBG not getting scheduled quickly enough. PBL_ASSERTN(!mbuf_get_next(&s_header_mbuf)); mbuf_append...
smartstrap_fsm_state_set(SmartstrapStateReadReady)
; return SmartstrapResultBusy; } } else { accessory_use_dma(false); smartstrap_fsm_state_set(SmartstrapStateReadReady); if (!mbuf_iterator_is_finished(&s_send_info.mbuf_iter)) { // The write was not successful, so return an error return SmartstrapResultBusy; } } return Smart...
} WakeupId wakeup_id; info->get_val(old_file, (uint8_t*)&wakeup_id, sizeof(WakeupId)); WakeupEntry entry; info->get_val(old_file, (uint8_t*)&entry, sizeof(WakeupEntry)); // Migrate the entries to the new timezone if (entry.utc == false) { entry.timestamp -= *((int*)utc_diff); entry.utc = true; ...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Rewriting wakeup file"); // Update settings file removing expired events settings_file_rewrite(&wakeup_settings, prv_update_events_callback, &missed_events); }
/* * 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...
itoa(val, buffer, sizeof(buffer))
ery_day_schedule); id2 = alarm_create(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule); // Delete the 10:30 alarm alarm_delete(id1); // The 10:30 alarm should not go off s_current_hour = 11; s...
(id2, false)
; alarm_set_enabled(id3, false); cl_assert_equal_b(alarm_is_next_enabled_alarm_smart(), false); } void test_alarm__skip_two_alarms(void) { AlarmId id1, id2; bool just_once_schedule_thursday[7] = {false, false, false, false, true, false, false}; id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 10, .kin...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prompt_send_response_fmt(buffer, sizeof(buffer), "window %p <%s>", info.dump[i].addr, info.dump[i].name)
; } cleanup: kernel_free(info.dump); }
{ if (window_stack->lock_push) { return; } const WindowTransitionImplementation *transition_to = &g_window_transition_none_implementation; const WindowTransitionImplementation *transition_pop = window_transition_get_default_pop_implementation(); prv_insert_with_function(window_stack, window, prv_ne...
Window *window_stack_pop(WindowStack *window_stack, bool animated) { // Transition NULL will default to the registered pop_transition to the stack item const WindowTransitionImplementation *transition = animated ? NULL : &g_window_transition_none_implementation; return window_stack_pop_with_transition(win...
/* * 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_buffer_index < BUFFER_LENGTH)
; s_buffer[s_buffer_index++] = data; s_did_send_byte = true; } void accessory_send_stream(AccessoryDataStreamCallback callback, void *context) { s_buffer_index = 0; memset(s_buffer, 0, BUFFER_LENGTH); while (callback(context)) { cl_assert(s_did_send_byte); } } void fake_accessory_get_buffer(uint8_t **...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_init(window, WINDOW_NAME("Workout Countdown"))
; window_set_user_data(window, countdown_window); window_set_background_color(window, PBL_IF_COLOR_ELSE(GColorYellow, GColorDarkGray)); window_set_window_handlers(window, &(WindowHandlers){ .unload = prv_window_unload_handler, }); layer_init(&countdown_window->base_layer, &window->layer.bounds); layer_...
init(QEMU_UART); uart_set_baud_rate(QEMU_UART, UART_SERIAL_BAUD_RATE); uart_set_rx_interrupt_handler(QEMU_UART, prv_uart_irq_handler); // enable the UART RX interrupt uart_set_rx_interrupt_enabled(QEMU_UART, true); } // -----------------------------------------------------------------------------------------...
mutex_lock(s_qemu_state.qemu_comm_lock)
; // Send the header QemuCommChannelHdr hdr = (QemuCommChannelHdr) { .signature = htons(QEMU_HEADER_SIGNATURE), .protocol = htons(protocol), .len = htons(len) }; prv_send((uint8_t *)&hdr, sizeof(hdr)); // Send the data prv_send(data, len); // Send the footer QemuCommChannelFooter footer =...
/* * 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...
(&f->size, &GSizeZero)
); if (!f->is_dirty) { f->dirty_rect = rect; } else { f->dirty_rect = grect_union(&f->dirty_rect, &rect); } const GRect clip_rect = (GRect) { GPointZero, f->size }; grect_clip(&f->dirty_rect, &clip_rect); f->is_dirty = true; }
s_data.is_first_half ? 0 : -end; const int16_t to = s_data.is_first_half ? end : 0; return interpolate_int16(normalized_progress, from, to); } // Draws the shutters based on the path definitions static void prv_draw_shutter(GContext *ctx, uint32_t distance, bool vertical) { graphics_context_set_antialiased(ctx, ...
{ prv_draw_in(ctx, s_small_movement_size, progress, direction_vertical, /*invert*/ draw_shutter ? direction_vertical : true); }
// We don't draw a shutter during the Down or Left transitions if (draw_shutter && direction_negative) { prv_draw_shutter(ctx, progress, direction_vertical); } ctx->draw_state = prev_state; } static void prv_transition_animation_first_update(Animation *animation, ...
(rv == E_RANGE); rv = pfs_seek(fd, len + 1, FSeekSet); cl_assert(rv == E_RANGE); rv = pfs_seek(fd, -1, FSeekSet); cl_assert(rv == E_RANGE); } void test_pfs__read(void) { const int rd_len = 10; int rv = pfs_read(-1, NULL, rd_len); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_read(0, NULL, rd_len); ...
(pfs_write(fd, bigbuf, large_file_size) == large_file_size)
; cl_assert(pfs_close(fd) == S_SUCCESS); } free(bigbuf); // now read back the large files curr = 0; for (int i = 0; i < 2; i++) { snprintf(file_large, sizeof(file_large), "large%d", i); int fd = pfs_open(file_large, OP_FLAG_READ, 0, 0); cl_assert(fd >= 0); size_t sz = pfs_get_file_size(fd...
/* * 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; }
uint32_t count = 1; while ((node = node->prev) != NULL) { ++count; } return count; } uint32_t list_count(ListNode* node) { return list_count_to_tail_from(list_get_head(node)); } ListNode* list_get_at(ListNode *node, int32_t index) { while (node != NULL && index != 0) { if (index > 0) { node...
/* * 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; }
void ancs_destroy(void) { return; } void ancs_handle_ios9_or_newer_detected(void) { } // ------------------------------------------------------------------------------------------------- // Analytics void analytics_external_collect_ancs_info(void) { return; }
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...
irmware_description = firmware_storage_read_firmware_description(flash_address); if (!firmware_storage_check_valid_firmware_description(&firmware_description)) { dbgserial_putstr("Invalid firmware description!"); return UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED; } if (!check_valid_firmware_crc( ...
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO)
; boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO); recovery_fw_ok = false; } break; } boot_bit_clear(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS); return recovery_fw_ok; }
ange(area.size.h, to_area.size.h, progress); fake_event_service_handle_last(); cl_assert_equal_i(s_data.num_will_change_calls, 1); cl_assert_equal_i(s_data.num_change_calls, 1); cl_assert_equal_i(s_data.last_change_progress, progress); } void test_unobstructed_area_service__change_no_will(void) { Unobstructe...
GRect(210, 220, 190, 180)
); } void test_unobstructed_area_service__layer_clip_nx_ny(void) { app_state_get_unobstructed_area_state()->area = GRect(0, 0, 400, 400); Layer root_layer = { .bounds = GRect(-110, -120, 300, 300), }; GRect unobstructed_bounds; layer_get_unobstructed_bounds(&root_layer, &unobstructed_bounds); cl_asser...
weight_x100_out = state->hr.metrics.previous_median_total_weight_x100; } } // -------------------------------------------------------------------------------------------- void activity_metrics_prv_reset_hr_stats(void) { ActivityState *state = activity_private_state(); mutex_lock_recursive(state->mutex); { ...
ROUND(full_day_resting_calories, ACTIVITY_CALORIES_PER_KCAL)
; } } } // Copy values from old history into correct slot in new history for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++) { int new_index = i + old_age; if (new_index >= 0 && new_index < ACTIVITY_HISTORY_DAYS) { new_history.values[new_index] = old_history.va...
normal/activity/activity_insights.h" #include "services/normal/activity/insights_settings.h" #include "services/normal/settings/settings_file.h" #include "shell/prefs.h" #include "shell/prefs_private.h" static PebbleMutex *s_mutex; #define PREF_KEY_CLOCK_24H "clock24h" static bool s_is_24h_style; #define PREF_KEY_DE...
app_install_get_id_for_uuid(&s_default_watchface)
ypical_value(ActivityMetricDistanceMeters, Monday, &val_out)); } void test_health_db__sleep_data(void) { const char *key = "monday_sleepData"; cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_sleep_data, sizeof(s_sleep_data)), S_S...
for (int i = 0; i < ARRAY_LENGTH(entries); ++i) { cl_assert_equal_i(health_db_insert((uint8_t *)entries[i].key, strlen(entries[i].key), (uint8_t *)entries[i].val, strlen(entries[i].val)), ...
} void test_health_db__monthly_averages(void) { int32_t val_out; const char *average_step_key = "average_dailySteps"; int32_t average_steps_val = 123456; cl_assert_equal_i(health_db_insert((uint8_t *)average_step_key, strlen(average_step_key), (uint8_t *)&average_steps_va...
_insert; layer_to_insert->next_sibling = old_next_sibling; } void layer_set_hidden(Layer *layer, bool hidden) { if (hidden == layer->hidden) { return; } layer->hidden = hidden; if (layer->parent) { layer_mark_dirty(layer->parent); } } bool layer_get_hidden(const Layer *layer) { return layer->hid...
recognizer_manager_register_recognizer(window_get_recognizer_manager(layer_get_window(layer)), recognizer)
; recognizer_add_to_list(recognizer, &layer->recognizer_list); #endif } void layer_detach_recognizer(Layer *layer, Recognizer *recognizer) { #if CAPABILITY_HAS_TOUCHSCREEN if (!layer || !recognizer) { return; } recognizer_remove_from_list(recognizer, &layer->recognizer_list); recognizer_manager_deregiste...
layer, &corners_all_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_corners_all.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("white_over_black", ctx....
(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r6_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 7, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r7_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_R...
and_ptr.h" #include "stubs_pfs.h" #include "stubs_blob_db_sync.h" #include "stubs_prompt.h" extern const char *iOS_NOTIF_PREF_DB_FILE_NAME; extern const int iOS_NOTIF_PREF_MAX_SIZE; //! Data from iOS notif pref INSERT //! 00 00 00 00 00 01 02 0d 03 01 05 00 52 65 70 6c ........ ....Repl //! 79 08 71 00 4f 6b 00 59...
attribute_find(&notif_prefs->attr_list, AttributeIdMuteDayOfWeek)
; cl_assert(mute); cl_assert_equal_i(mute->uint8, 0x1F); Attribute *name = attribute_find(&notif_prefs->attr_list, AttributeIdAppName); cl_assert(name); cl_assert_equal_s(name->cstring, "GMail"); // Update the current entry with a new attribute attribute_list_add_uint32(&attr_list, AttributeIdLastUpdate...
oid *data) { ClickRecognizer *recognizer = (ClickRecognizer *) data; // User has been holding the button down for more than the repetition delay. prv_auto_repeat_single_click(recognizer); } static uint8_t prv_multi_click_get_min(ClickRecognizer *recognizer) { if (false == prv_is_multi_click_enabled(recognizer...
if ((button < 0 || button > NUM_BUTTONS)) { return; }
switch(*click_type) { case 's': offset = ClickHandlerOffsetSingle; break; case 'm': offset = ClickHandlerOffsetMulti; break; case 'l': offset = ClickHandlerOffsetLong; break; case 'r': offset = ClickHandlerOffsetLongRelease; break; case 'u': ...
ime(time_t *tloc) { time_t t = sys_get_time(); if (tloc) { *tloc = t; } return (t); } // Manually construct double to avoid requiring soft-fp static double prv_time_to_double(time_t time) { // time_t is 32bit signed int, convert it manually #ifndef UNITTEST _Static_assert(sizeof(time_t) == 4, "Conversi...
strlen(format)
h> #include <stdio.h> #include <stdlib.h> #include <string.h> /////////////////////////////////////////////////////////// // Stubs #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_app_state.h" #include "stubs_fonts.h" #include "stubs_graphics_context.h" #include "st...
cl_assert(success)
{ if (!strcmp(font_key, s_font_helpers[i].key)) { return &s_font_helpers[i]; } }
return NULL; } static GFont prv_get_font(const char *font_key) { FontHelper *font_helper = prv_font_helper_from_font_key(font_key); cl_assert_(font_helper, font_key); FontInfo *result = &font_helper->font_info; if (!result->loaded) { bool init_result = text_resources_init_font(0, font_helper->handle, 0,...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_draw_line(ctx, GPoint(5, -30), GPoint(45, 30))
prv_do_blocking_spi_transfer(dev, &tx_footer_transfer); HOST_TRANSPORT_DEBUG_LOG("Sent %u bytes.", tx_len); } else { HOST_TRANSPORT_DEBUG_LOG("Nothing to send."); } // Single duplex read: const size_t rx_len = MIN(remote_status_in.bytes_sendable_count, rx_bytes_available); if (rx_len) { HOST_TR...
PBL_LOG(LOG_LEVEL_DEBUG, "Failed to enqueue %u bytes", length)
; return HostTransportEnqueueStatus_RetryLater; } size_t host_transport_rx_get_length(void) { prv_lock(); size_t rx_length = circular_buffer_get_read_space_remaining(&s_rx_buffer); prv_unlock(); return rx_length; } bool host_transport_rx_read(uint8_t **data_ptr_out, size_t length) { prv_lock(); bool cal...
/* * 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 (gpio_addr == (uint32_t)GPIOB) { gpio_init.GPIO_Pin = GPIO_Pin_All & ~(GPIO_Pin_3 | GPIO_Pin_4); } else { gpio_init.GPIO_Pin = GPIO_Pin_All; }
gpio_use((GPIO_TypeDef *)gpio_addr); GPIO_Init((GPIO_TypeDef *)gpio_addr, &gpio_init); gpio_release((GPIO_TypeDef *)gpio_addr); tot_gpios -= num_gpios_per_port; } }
ach field is either empty //! or written with a valid CRC. static bool prv_valid_struct(SharedPRFData *data) { if (data->magic == SprfMagic_UnpopulatedEntry && prv_buffer_empty((uint8_t *)data, sizeof(*data))) { return true; } if (data->magic == SprfMagic_ValidEntry && (prv_field_valid((uint...
SPRF_FIELD_DATA_SIZE(field_size)
; const uint32_t old_crc = FIELD_CRC_FROM_DATA(data, offset); const uint32_t new_crc = (calc_crc) ? crc32(CRC32_INIT, SPRF_FIELD_DATA(field), field_data_size) : SPRF_UNWRITTEN_CRC; const bool same_data = (0 == memcmp(SPRF_FIELD_DATA(field), SPRF_FIELD_DATA(((uint8_t *)d...
p), 0); strncat(data->dialog_text, " ", buf_space_remaining); buf_space_remaining = MAX(buf_space_remaining - 1, 0);; clock_get_time_number(tmp, date_time_len, data->timestamp); strncat(data->dialog_text, tmp, buf_space_remaining); buf_space_remaining = MAX(buf_space_remaining - strlen(tmp), 0); clock_get...
bt_persistent_storage_get_cached_system_capabilities(&capabilities)
; SerializedReminderAppPrefs *prefs = watch_app_prefs_get_reminder(); const bool is_visible_in_launcher = capabilities.reminders_app_support && (prefs ? (prefs->appState == ReminderAppState_Enabled) : false); task_free(prefs); static const PebbleProcessMdSystem s_reminder_app_info =...
\ "notification.", action_menu); ExpandableDialog *first_use_dialog = expandable_dialog_create_with_params( "Dismiss First Use", RESOURCE_ID_QUICK_DISMISS, tutorial_msg, gcolor_legible_over(GColorLightGray), GColorLightGray, NULL, RESOURCE_ID_ACTION_BAR_ICON_C...
(template_level, label, prv_action_menu_cb, action)
; } } return template_level; } static ActionMenuLevel *prv_create_emoji_level_from_action(ActionMenuLevel *parent_level, TimelineItemAction *action, void *i18n_owner) { static const char *sh...
/* * 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...
{ byte = *(ctx->sle_buffer++); if (byte == 0x00) { // end of stream ctx->sle_buffer = NULL; return false; } else if (byte == 0x01) { // literal escape byte *out = ctx->escape; } else { // a sequence of zeros if ((byte & 0x80) == 0) { // the count is 1 by...
return true; }
, 872, -16}, { 128, 848, -32}, { 176, 864, -24}, { 192, 952, -16}, { 416, 1184, -72}, { 472, 1144, -168}, { 512, 1080, -96}, // 5 seconds { 376, 744, -88}, { 368, 632, -96}, { 376, 616, -48}, { 448, 680, 24}, { 376, 720, -24}, { 312, 704, -96}, { 288, 768, -72}, ...
{ 768, 32, -176}, { 776, 16, -200}, { 832, 8, -168}, { 848, 8, -216}, { 984, 0, -232}, { 1632, 56, -120}, { 1384, 64, -168}, { 1144, 112, -216}, { 960, 112, -288}, { 1144, 176, -328}, { 1168, 104, -168}, { 1112, 96, -144}, { 992, 72, -136}, { 1016, 64, -128}, ...
{ 952, -32, 16}, { 904, 0, -56}, { 912, -40, -104}, { 1040, -112, -168}, { 1352, -224, -72}, { 1224, -208, -152}, { 1056, -192, -160}, { 1216, -64, -504}, { 1352, 104, -432}, { 1232, 56, -192}, { 1056, 48, -192}, { 1016, 56, -168}, { 1024, 72, -184}, { 968, 80, -...
is_ddr) { prv_indirect_read(dev, instruction, addr, dummy_cycles, buffer, length, is_ddr); } void qspi_indirect_read_dma(QSPIPort *dev, uint8_t instruction, uint32_t start_addr, uint8_t dummy_cycles, void *buffer, uint32_t length, bool is_ddr) { // DMA reads are most efficient when doin...
QSPI_ClearFlag(QSPI_FLAG_TC)
; prv_wait_for_not_busy(); } bool qspi_poll_bit(QSPIPort *dev, uint8_t instruction, uint8_t bit_mask, bool should_be_set, uint32_t timeout_us) { prv_set_num_data_bytes(1); // Set autopolling on the register QSPI_AutoPollingMode_SetInterval(dev->auto_polling_interval); QSPI_AutoPollingMode...
{ -600, 480, 456}, { -640, 520, 488}, { -680, 528, 512}, { -696, 544, 536}, { -688, 560, 536}, { -656, 576, 544}, { -648, 560, 520}, { -632, 528, 496}, { -632, 496, 528}, { -616, 480, 544}, { -608, 496, 528}, { -656, 528, 496}, { -672, 608, 448}, { -688, 640, 464}, ...
{ -744, 280, 248}, { -648, 328, 208}, { -568, 328, 328}, { -624, 368, 800}, { -752, 456, 1520}, { -816, 192, 712}, { -216, 432, 376}, { -584, 528, 736}, // 487 seconds { -728, 184, 848}, { -672, 168, 784}, { -576, 216, 672}, { -504, 184, 632}, { -512, 208, 672}, ...
hile (result) { if (!result->next) { // Found the last result, unlink and free it: prev->next = NULL; free(result); return; } prev = result; result = result->next; } } //! Finds ScanResult based on BTDevice. If found, unlink and return ScanResult. static ScanResult *list_unlin...
// Look for Heart Rate Monitor service: // See https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx Uuid hrm_uuid = bt_uuid_expand_16bit(0x180D); result->has_heart_rate_service = ble_ad_includes_service(ad_data, &hrm_uuid); } else { result->has_services = false; result->has_he...
void toggle_scan(void) { if (s_is_scanning) { ble_scan_stop(); s_is_scanning = false; } else { ble_scan_start(ble_scan_handler); s_is_scanning = true; } menu_layer_reload_data(s_menu_layer); } //------------------------------------------------------------------------------ // MenuLayer callba...
the License for the specific language governing permissions and * limitations under the License. */ #include "util/iterator.h" #include "applib/graphics/framebuffer.h" #include "applib/graphics/utf8.h" #include "applib/graphics/text_layout_private.h" #include "clar.h" #include <stdarg.h> #include <stdio.h> #includ...
cl_assert(*word_iter_state.current.start == 'I')
; cl_assert(*word_iter_state.current.end == '\n'); cl_assert(HORIZ_ADVANCE_PX * 2 == word_iter_state.current.width_px); cl_assert(iter_next(&word_iter)); cl_assert(*word_iter_state.current.start == '\n'); cl_assert(*word_iter_state.current.end == '\n'); cl_assert(0 == word_iter_state.current.width_px); ...
ng_by_id(id, NULL, NULL, device_name_out); cl_assert_equal_i(strcmp(device_name, device_name_out), 0); // Update: const char *new_device_name = "New iPhone"; bt_persistent_storage_update_ble_device_name(id, new_device_name); bt_persistent_storage_get_ble_pairing_by_id(id, NULL, NULL, device_name_out); cl...
cl_assert_equal_i(platform_bits_1, platform_bits_out)
; ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_2, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_2, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&link_key_2, &link_key_out, sizeof(link_key_ou...
cl_assert_equal_p(manager.active_layer, &layer_a); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered); cl_assert_equal_i(r2->state, RecognizerState_Started); cl_assert(!recognizer_get_manager(r1)); recognizer_set_manager(r1, &manager); recognizer_set_simultaneous_with(r2, prv_simul...
cl_assert_equal_p(manager.active_layer, NULL)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ char testbuf[8] = "He\0llo!"; char destbuf[8] = "AAAAAAAA"; char expectbuf[8] = "He\0AAAAA"; strcpy(destbuf, testbuf); cl_assert_equal_m(expectbuf, destbuf, 8); }
void test_strcpy__return(void) { char testbuf[8] = "Hello!"; char destbuf[8] = "AAAAAAAA"; cl_assert_equal_p(strcpy(destbuf, testbuf), destbuf); } void test_strcpy__n_basic(void) { char testbuf[8] = "Hello!"; char destbuf[8] = "AAAAAAAA"; char expectbuf[8] = "Hello!\0\0"; strncpy(destbuf, testbuf, 8); ...
= bus->scl_gpio.gpio_pin, .active_high = true }; gpio_output_init(&out_scl, GPIO_PuPd_NOPULL, GPIO_Speed_2MHz); gpio_output_set(&out_scl, false); OutputConfig out_sda = { .gpio = bus->sda_gpio.gpio, .gpio_pin = bus->sda_gpio.gpio_pin, .active_high = true }; gpio_output_init(&out_sda, GPIO_P...
mutex_unlock(slave->bus->state->bus_mutex)
; return; } slave->bus->state->user_count--; if (slave->bus->state->user_count == 0) { prv_bus_disable(slave->bus); } mutex_unlock(slave->bus->state->bus_mutex); } void i2c_reset(I2CSlavePort *slave) { PBL_ASSERTN(slave); // Take control of bus; only one task may use bus at a time mutex_lock...
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 CONDITIONS OF ANY KIND, either expres...
{ // Using one "global" lock for all app outboxes. // If needed, we could easily give each app outbox its own mutex, but it seems overkill right now. mutex_lock_recursive(s_app_outbox_mutex); }
e(s_mutex); } // ------------------------------------------------------------------------------------------- // NOTE: This is guaranteed to be only called from the KernelMain task by the event_service static void prv_tap_remove_subscriber_cb(PebbleTask task) { mutex_lock_recursive(s_mutex); { PBL_ASSERTN(s_ta...
{ s_mutex = mutex_create_recursive(); s_timer_id = new_timer_create(); event_service_init(PEBBLE_ACCEL_SHAKE_EVENT, &prv_tap_add_subscriber_cb, &prv_tap_remove_subscriber_cb); #ifdef TEST_KERNEL_SUBSCRIPTION accel_data_service_subscribe(5, prv_kernel_data_subscription_handler); accel_ta...
#ifdef RECOVERY_FW void command_accel_peek(void) { const bool temporarily_start = !accel_running(); if (temporarily_start) { accel_start(); } AccelData data; int result = sys_accel_manager_peek(&data); PBL_LOG(LOG_LEVEL_DEBUG, "result: %d", result); char buffer[20]; prompt_send_response_fmt(buff...
/* * 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...
(resource_id != UINT32_MAX)
; // Test Command_Image GDrawCommandImage *image = gdraw_command_image_create_with_resource(resource_id); cl_assert(image == NULL); // Test Command Sequence GDrawCommandSequence *sequence = gdraw_command_sequence_create_with_resource(resource_id); cl_assert(sequence == NULL); }
/* * 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...
(connection)
; } static void prv_handle_request_all_cb(Connection *connection, void *data) { prv_gap_le_device_name_request(connection); } void gap_le_device_name_handle_request_all(void) { connection_for_each(prv_handle_request_all_cb, NULL); }
start_ms + duration_a - 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_sto...
(&s_stopped_handler_calls, b)
, 0); // Complete spawn prv_advance_to_ms_with_timers(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 2); cl_assert_equal_i(prv_count_handler_ent...
ootloader isn't using // the vendor SystemInit, initialize the flash cache here static void prv_configure_system_flash(void) { // Enable flash instruction and data caches FLASH->ACR = FLASH_ACR_ICEN | FLASH_ACR_DCEN; } // RTC and bootbit assume access to the backup // registers has been enabled static void prv_ena...
prv_check_force_boot_recovery()
; if (force_boot_recovery_mode) { dbgserial_putstr("Force-booting recovery mode..."); } if (force_boot_recovery_mode || prv_check_for_fw_start_failure()) { if (!switch_to_recovery_fw()) { // We've failed to load recovery mode too many times. prv_sad_watch(ERROR_CANT_LOAD_FW); } } else {...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
for (unsigned int i = 0; i < num_remainder_bytes; ++i) { last_word = (last_word << 8) | data[i]; }
return crc_update(crc, (uint8_t*)&last_word, 4); } return crc & 0xffffffff; } /* * Data Logging Test App */ struct DataLoggingInfo { TextLayer text_layer; char text[32]; int counter; uint32_t crc; DataLoggingSessionRef logging_session; uint8_t item_size; }; static struct { Window window; ...
// shared PRF if (bt_persistent_storage_get_ble_pinned_address(&pinned_address)) { shared_prf_storage_set_ble_pinned_address(&pinned_address); } } static void prv_load_local_data_from_prf(void) { char name[BT_DEVICE_NAME_BUFFER_SIZE]; if (shared_prf_storage_get_local_device_name(name, BT_DEVICE_NAME_BUFFER...
bt_driver_supports_bt_classic()
) { prv_load_bt_classic_data_from_prf(); } prv_load_ble_pairing_from_prf(); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Common Helper Functions BtPersistBondingType prv_get_type_for_id(BTBondingID id) { BtPersistBondingData data; prv_file_get(&...
_ERROR, "Attempted access to disabled bus %s", bus->name); return false; } // If bus is busy (it shouldn't be as this function waits for the bus to report a non-idle state // before exiting) reset the bus and wait for it to become not-busy // Exit if bus remains busy. User module should reset the I2C modul...
prv_do_transfer(slave->bus, Read, slave->address, 0, read_size, result_buffer, NoRegisterAddress)
; if (!result) { PBL_LOG(LOG_LEVEL_ERROR, "Block read failed on bus %s", slave->bus->name); } return result; } bool i2c_write_register(I2CSlavePort *slave, uint8_t register_address, uint8_t value) { return i2c_write_register_block(slave, register_address, 1, &value); } bool i2c_write_register_block(I2CS...
/* * 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...
{ LauncherAppGlanceMusic *music_glance = launcher_app_glance_structured_get_data(structured_glance); return NULL_SAFE_FIELD_ACCESS(music_glance, icon, NULL); }
/* * 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_context, s_framebuffer, GContextInitializationMode_App)
; framebuffer_clear(s_framebuffer); if (s_pixels) { gbitmap_destroy(s_pixels); } s_pixels = gbitmap_create_blank(size, GBITMAP_NATIVE_FORMAT); memset(s_pixels->addr, 0xff, size.h * s_pixels->row_size_bytes); s_context.dest_bitmap = *s_pixels; s_context.draw_state.clip_box = (GRect){.size = size}; s_...
he License. */ #include "health_activity_summary_card.h" #include "health_activity_summary_card_segments.h" #include "health_activity_detail_card.h" #include "health_progress.h" #include "health_ui.h" #include "services/normal/activity/health_util.h" #include "applib/pbl_std/pbl_std.h" #include "applib/ui/kino/kino_...
{ snprintf(steps_buffer, sizeof(steps_buffer), "%"PRId32, data->typical_steps); }
/* * 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...
ARRAY_LENGTH(action3_attributes)
r *name, const char *number) { PebbleEvent e = fake_event_get_last(); cl_assert_equal_i(e.type, PEBBLE_PHONE_EVENT); cl_assert_equal_i(e.phone.source, PhoneCallSource_PP); cl_assert_equal_i(e.phone.type, subtype); if (check_cookie) { cl_assert_equal_i(e.phone.call_identifier, expected_cookie); } if (c...
{ fake_transport_set_sent_cb(s_transport, prv_assert_answer_call_sent_cb); pp_answer_call(expected_cookie); fake_comm_session_process_send_next(); }
static void prv_assert_decline_call_sent_cb(uint16_t endpoint_id, const uint8_t* data, unsigned int data_length) { uint8_t expected_decline_msg[] = {0x02, 0x1a, 0xd4, 0x77, 0x08}; cl_assert_equal_i(sizeof(expected_decline_msg), data_length); cl_assert_equal_i(memcmp(ex...
, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 40, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1008}, { 40, 24, -1008}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 40, 16, -1000}, ...
{ 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 32, -1000}, { 40, 8, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -1008}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16,...
{ 48, 16, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 40, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -992}, { 48, 24, -1000}, { 40, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24...
region.h" #include <stdio.h> #include <string.h> // Stubs //////////////////////////////////// #include "stubs_analytics.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "stubs_prompt.h" #i...
info->get_key(file, (uint8_t *)&key, sizeof(uint32_t))
le" ); EXECUTE_SCRIPT( "var d = new Date();\n" "d.toLocaleDateString(undefined);\n" ); EXECUTE_SCRIPT_EXPECT_ERROR( "d.toLocaleDateString('de');", "TypeError: Unsupported locale" ); EXECUTE_SCRIPT( "var d = new Date();\n" "d.toLocaleString(undefined);\n" ); EXECUTE_SCRIPT_EXPEC...
{ rocky_global_init(s_api); EXECUTE_SCRIPT("var d = new Date();"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'numeric'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "25"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: '2-digit'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "25"); EXECUTE_SCRIP...
void test_rocky_api_datetime__locale_date_string_time_options(void) { rocky_global_init(s_api); EXECUTE_SCRIPT("var d = new Date();"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {hour: 'numeric'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "07/25/05, 8 PM"); } void test_rocky_api_datetime__locale_string_o...
] = { TupletBytes(SOME_DATA_KEY, SOME_DATA, sizeof(SOME_DATA)), TupletCString(SOME_STRING_KEY, SOME_STRING), TupletInteger(SOME_UINT32_KEY, (uint32_t) 32), }; const uint32_t size = dict_calc_buffer_size_from_tuplets(tuplets, 3); cl_assert(size == sizeof(Dictionary) + (3 * sizeof(Tuple)) + sizeof(SOME_...
{ ++count; switch (tuple->key) { case SOME_DATA_KEY: cl_assert(tuple->length == sizeof(SOME_DATA)); cl_assert(memcmp(tuple->value->data, SOME_DATA, sizeof(SOME_DATA)) == 0); data_found = true; break; case SOME_STRING_KEY: cl_assert(tuple->length == strlen(SOME...
case SOME_NULL_KEY: cl_assert(tuple->length == 0); null_cstring_found = true; break; case SOME_EMPTY_STRING_KEY: cl_assert(tuple->length == strlen(SOME_EMPTY_STRING) + 1); cl_assert(strncmp(tuple->value->cstring, SOME_EMPTY_STRING, strlen(SOME_EMPTY_STRING) + 1) == 0...
ssage(void) { prv_init_api(false /* start_connected */); for (PostMessageKey key = PostMessageKeyResetRequest; key < PostMessageKey_Count; ++key) { uint8_t dummy_data[] = {0, 1, 2}; RCV_APP_MESSAGE(TupletBytes(key, dummy_data, sizeof(dummy_data))); } cl_assert_equal_i(0, s_app_message_outbox_send_call...
(PostMessageKeyResetComplete, malformed_payload, sizeof(malformed_payload))
); // Expect Error: const PostMessageUnsupportedErrorPayload expected_error = { .error_code = PostMessageErrorMalformedResetComplete, }; EXPECT_OUTBOX_MESSAGE_PENDING(TupletBytes(PostMessageKeyUnsupportedError, (const uint8_t *) &expected_error, ...
ATTService *service, BTErrno error) { // We experienced some kind of conversion error, pass it on if (error != BTErrnoOK) { prv_send_services_added_event(connection, error); return; } GATTServiceNode *node = kernel_zalloc_check(sizeof(GATTServiceNode)); node->service = service; // tag the service ...
{ if (connection->gatt_is_service_discovery_in_progress) { // Remove any partial jobs which may be pending // since we are going to rediscover everything gatt_client_cleanup_discovery_jobs(connection); bt_driver_gatt_stop_discovery(connection); } else { // Queue up CC...
} bt_unlock(); return ret_val; }
app_db_init(); // add all three cl_assert_equal_i(S_SUCCESS, app_db_insert((uint8_t*)&app1.uuid, sizeof(Uuid), (uint8_t*)&app1, sizeof(AppDBEntry))); cl_assert_equal_i(S_SUCCESS, app_db_insert((uint8_t*)&app2.uuid, sizeof(Uuid), (uint8_t*)&app2, sizeof(AppDBEntry))); cl_assert_equal_i(S_SUCCESS...
app_db_get_app_entry_for_uuid(&app3.uuid, &temp)
); cl_assert_equal_b(true, uuid_equal(&app3.uuid, &temp.uuid)); } void test_app_db__overwrite(void) { // add 3 of the same. Confirm that the entry was overwritten by checking next ID. cl_assert_equal_i(S_SUCCESS, app_db_insert((uint8_t*)&app1.uuid, sizeof(Uuid), (uint8_t*)&app1, sizeof(AppDBEntry))); cl_...
/* * 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...
(120, 102)
; check_atan2(0, 0); check_atan2(0, 10); check_atan2(10, 0); check_atan2(-32768, 1); // <- causes overflow for int16 check_atan2(1, -32768); // <- causes overflow for int16 check_atan2(20001, 20000); // <- causes overflow if numbers are added in an int16 check_atan2(32767, 1); check_atan2(1, 32767); c...
some new data but out stats shouldn't change (except HR) prv_inc_time(10); prv_inc_steps_and_put_event(10); prv_put_bpm_event(110, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_a...
workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)
); cl_assert_equal_i(bpm, 100); // Put an OffWrist reading. Verify we received it. prv_put_bpm_event(50, HRMQuality_OffWrist); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(bpm, 0);...
} void test_app_menu_data_source__floating_music_app(void) { // settings has to be at the beginning. The app_menu_data_source module enforces it // This test will move the music app to the second position AppInstallId written_order[] = {APP_ID_SETTINGS, APP_ID_NOTIFICATIONS, APP_ID_ALARMS, ...
ARRAY_LENGTH(storage_order)
; prv_write_order_to_file(storage_order, num_entries); app_menu_data_source_init(&data_source, &(AppMenuDataSourceCallbacks) { .changed = prv_menu_layer_reload_data, .filter = everything_filter_callback, }, &menu_layer); const uint16_t num_apps = app_menu_data_source_get_count(&data_source); for (ui...
r = lr, }, }; if (build_id) { memcpy(event_blob.app_crash_report.build_id_slice, build_id, sizeof(event_blob.app_crash_report.build_id_slice)); } #if LOG_DOMAIN_ANALYTICS char uuid_string[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(uuid, uuid_string); ANALYTICS_LOG_DEBUG("App Crash event...
memcpy(event_blob.bt_chip_boot.build_id, build_id, sizeof(BUILD_ID_EXPECTED_LEN))
receiver to nack the message static const AppMessagePush s_push = { .header = { .command = CMD_PUSH, .transaction_id = 0xa5, }, }; static const PebbleProtocolEndpoint s_app_message_endpoint = (const PebbleProtocolEndpoint) { .endpoint_id = APP_MESSAGE_ENDPOINT_ID, .handler = prv_protocol_msg_callback,...
app_message_receiver_open(sizeof(AppMessagePush))
); // Write an ACK, we should be able to fit one (N)ACK in addition to the Push message: AppMessageAck ack = {}; Receiver *r = s_rcv_imp->prepare(s_session, &s_app_message_endpoint, sizeof(ack)); cl_assert(r != NULL); s_rcv_imp->write(r, (const uint8_t *)&ack, sizeof(ack)); ...
Pick the next job: GAPLEAdvertisingJob *next = s_jobs; // s_is_dangling is checked here, in case the next job happens to have been allocated at the // same address as the old s_current: const bool is_same_job = (next == s_current && bt_driver_advert_client_has_cycled()); if (is_same_job && !force_refresh &...
{ // First term cannot be loop-around return NULL; }
continue; } // Silent term: const bool is_silent = (terms[i].min_interval_slots == GAPLE_ADVERTISING_SILENCE_INTERVAL_SLOTS && terms[i].max_interval_slots == GAPLE_ADVERTISING_SILENCE_INTERVAL_SLOTS); if (is_silent) { if (terms[i].duration_secs == GAPLE_ADVERTISING_DUR...
(); } PBL_ASSERTN(s_state.state != PostMessageStateSessionOpen); prv_emit_post_message_connection_event(false /* is_connected */); } static void prv_session_open__exit_and_initiate_reset(void) { prv_awaiting_reset_complete_local_initiated__enter(true /* should_send_reset_request */); prv_session_open__after...
{ // Don't send an error here! The initiating side is supposed have detected the version // incompatibility and not sent the ResetComplete (and send an Error message), but apparently // we did get the ResetComplete somehow? prv_awaiting_reset_request__enter(); return; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
((Layer *)&peek_layer->subtitle.text_layer, &(GRect) { { cursor.x, cursor.y + TEXT_OFFSET_Y }, { subtitle_size.w, subtitle_size.h + font_height_fuzz } })
; cursor.x = (layer_bounds.size.w - (title_size.w + number_size.w)) / 2; cursor.y += subtitle_size.h ? (subtitle_size.h + peek_layer->subtitle_margin) : 0; layer_set_frame((Layer *)&peek_layer->number.text_layer, &(GRect) { { cursor.x, cursor.y + NUMBER_OFFSET_Y }, number_size }); cursor.x += ...
ase ActivityMetricHeartRateZone2Minutes: case ActivityMetricHeartRateZone3Minutes: PBL_LOG(LOG_LEVEL_WARNING, "Health DB doesn't know about typical metric %d", metric); return false; } return true; } bool health_db_get_monthly_average_value(ActivityMetric metric, ...
if (rv != S_SUCCESS) { return 0; }
int length = settings_file_get_len(&file, key, key_len); prv_file_close_and_unlock(&file); return length; } status_t health_db_read(const uint8_t *key, int key_len, uint8_t *value_out, int value_out_len) { if (!prv_key_is_valid(key, key_len)) { return E_INVALID_ARGUMENT; } SettingsFile file; sta...
outside_nx_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(-5, 15)); } void outside_x_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoin...
(&ctx, fb)
; layer_init(&layer, &GRect(0, 0, 10, 10)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &white_layer_update_callback); layer_re...
node->id, &all_day_item.header.id)); cl_assert(!state.node->all_day); cl_assert_equal_i(state.node->timestamp, midnight_march_3_utc); cl_assert_equal_i(state.node->duration, 8 * MINUTES_PER_HOUR); cl_assert_equal_i(state.current_day, midnight_march_2_pst); // day 2 cl_assert(iter_next(&iterator)); cl_ass...
(&state.node->id, &multiday_item.header.id)
); cl_assert(state.node->all_day); cl_assert_equal_i(state.node->timestamp, midnight_march_2_pst + SECONDS_PER_DAY); cl_assert_equal_i(state.node->duration, MINUTES_PER_DAY); cl_assert_equal_i(state.current_day, midnight_march_2_pst + SECONDS_PER_DAY); // no more cl_assert(!iter_next(&iterator)); // 4 d...
/* * 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...
(&tim_config)
; tim_config.TIM_Period = TIMER_PERIOD_TICKS; // The timer is on ABP1 which is clocked by PCLK1 TimerConfig tc = { .peripheral = TIM4, .config_clock = RCC_APB1Periph_TIM4, }; tim_config.TIM_Prescaler = timer_find_prescaler(&tc, TIMER_FREQUENCY_HZ); t...
(fb); fb = NULL; gbitmap_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)); }
{ return MENU_CELL_LEGACY2_BASIC_SEPARATOR_HEIGHT; }
else { return MENU_CELL_BASIC_SEPARATOR_HEIGHT; } } static inline int16_t prv_menu_layer_get_header_height(MenuLayer *menu_layer, uint16_t section_index) { if (menu_layer->callbacks.get_header_height) { return menu_layer->callbacks.get_header_height(menu_layer, section_index, menu_layer->callback_cont...
/* * 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...
{ PluginServiceState *state = prv_get_state(PebbleTask_Unknown); uint16_t service_index = prv_get_service_index(uuid); ListNode *list = &state->subscribed_services; if (list_find(list, prv_service_filter, (void*)(uintptr_t)service_index)) { PBL_LOG(LOG_LEVEL_DEBUG, "Plug service handler already subscribed"...
// --------------------------------------------------------------------------------------------------------------- // Unsubscribe from a specific plug-in service by uuid. bool plugin_service_unsubscribe(Uuid *uuid) { PluginServiceState *state = prv_get_state(PebbleTask_Unknown); uint16_t service_index = prv_get_...
= (AnimationPrivate *)a; AnimationPrivate *animation_b = (AnimationPrivate *)b; return serial_distance32(animation_a->abs_start_time_ms, animation_b->abs_start_time_ms); } // ------------------------------------------------------------------------------------------- inline static uint32_t prv_get_ms_since_system_...
if (delta == 0) { return; }
AnimationPrivate *animation = (AnimationPrivate *) state->scheduled_head; while (animation) { // Since we are reducing the start times, each of the animations we operate on will be // moved earlier in the list. Get the next pointer now before we possibly move it. next = (AnimationPrivate*) list_get_ne...
}, { 160, 896, 392}, { 96, 1184, 384}, { 104, 1160, 264}, { -160, 1952, 704}, { -744, 1096, 416}, { -96, 792, 528}, { -128, 792, 408}, { -16, 656, 328}, { 32, 688, 232}, { 152, 528, 8}, { 120, 584, 240}, { 72, 928, 264}, { -168, 1104, 384}, { -144, 1032, 392}, ...
{ -440, 984, 96}, { -320, 512, 56}, { -88, 864, 64}, { 192, 568, 64}, { 264, 832, -192}, { 360, 560, 16}, { 248, 880, 40}, { 120, 840, -88}, { 0, 1072, 80}, { -336, 1112, 216}, { -360, 1576, 488}, { -600, 1568, 392}, { -192, 1352, 336}, { -136, 952, 368}, { -4...
{ -136, 1096, -112}, { -216, 1200, -56}, { -80, 1128, -128}, // 16 seconds { -8, 1088, -136}, { 0, 856, -104}, { 120, 568, -40}, { 280, 272, 24}, { 304, 224, 128}, { 360, 952, 120}, { 400, 1016, 280}, { 488, 1040, 392}, { 384, 1600, 216}, { 56, 768, 568}, { -...
/* * 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...
("off_screen_right_aa_clipping")
)); };
/* * 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_state, &rcv_bytes, &rcv_protocol)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
for (int i = 0; i < num_bytes; i++) { num_bits_set += __builtin_popcount(bitset_bytes[i]); }
return (num_bits_set); } void itoa(uint32_t num, char *buffer, int buffer_length) { if (buffer_length < 11) { PBL_LOG(LOG_LEVEL_WARNING, "ito buffer too small"); return; } *buffer++ = '0'; *buffer++ = 'x'; for (int i = 7; i >= 0; --i) { uint32_t digit = (num & (0xf << (i * 4))) >> (i * 4); ...
/* * 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 (dialog->callback_context) { dialog->callbacks.load(dialog->callback_context); } else { dialog->callbacks.load(dialog); } }
} // Unloads the core dialog. Should be called from each dialog window's unload callback. void dialog_unload(Dialog *dialog) { app_timer_cancel(dialog->timer); if (dialog->show_status_layer) { status_bar_layer_deinit(&dialog->status_layer); } dialog_set_icon(dialog, INVALID_RESOURCE); text_layer_deini...