prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
(in hex) with ST being the address and RPQ being the value. PBL_ASSERTN(response.data[0] == address); PBL_ASSERTN((response.data[2] & 0x0F) == PACKET_FOOTER); *(uint16_t *)result = response.data[1] | ((uint16_t)(response.data[2] & 0xF0) << 4); } else if (type == StatusReadType_16bit) { // The 3 data ...
(i, TouchState_FingerDown, &point, 0, current_time_ms)
; } else { touch_handle_update(i, TouchState_FingerUp, NULL, 0, current_time_ms); } } } else if (message.packet_id == PACKET_ID_PALM_DETECTION) { touch_handle_driver_event(TouchDriverEvent_PalmDetect); } else if (message.packet_id == PACKET_ID_HELLO) { // TODO: PBL-29...
/* * 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...
gdraw_command_list_get_data_size(src)
; if (buffer_length < src_size) { return false; } memcpy(buffer, src, src_size); return true; } GDrawCommandList *gdraw_command_list_clone(GDrawCommandList *list) { if (!list) { return NULL; } size_t size = gdraw_command_list_get_data_size(list); GDrawCommandList *result = applib_malloc(size)...
_WaitingHdrSignatureMSB && cur_time > state->start_recv_packet_time + QEMU_RECV_PACKET_TIMEOUT_SEC) { state->recv_state = QemuRecvState_WaitingHdrSignatureMSB; PBL_LOG(LOG_LEVEL_WARNING, "Resetting receive state - max packet time expired"); } state->callback_pending = false; uint16_t bytes_avail =...
shared_circular_buffer_read_consume(&state->isr_buffer, &state->isr_buffer_client, sizeof(footer), (uint8_t *)&footer, &bytes_read); bytes_avail -= bytes_read; footer.signature = ntohs(footer.signature); if (footer.signature != QEMU_FOOTER_SIGNATURE) { ...
// while (!exit && bytes_avail) // Return pointer if we got a complete message if (got_msg) { *msg_bytes= state->msg_buffer_bytes; *protocol = state->hdr.protocol; return state->msg_buffer; } else { return 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...
{ res_id = RESOURCE_ID_GENERIC_CONFIRMATION_LARGE; end_screen_timeout = COMPLETE_SCREEN_VISIBLE_DURATION_MS; dialog_set_background_color(simple_dialog_get_dialog(&data->finished_dialog), GColorGreen); simple_dialog_set_buttons_enabled(&data->finished_dialog, false); }
else { res_id = RESOURCE_ID_GENERIC_WARNING_LARGE; end_screen_timeout = FAIL_SCREEN_VISIBLE_DURATION_MS; } dialog_set_icon(&data->finished_dialog.dialog, res_id); #if !PLATFORM_ROBERT && !PLATFORM_CALCULUS dialog_set_text(&data->finished_dialog.dialog, prv_get_dialog_text(data, success)); #endif // Sh...
e for the specific language governing permissions and * limitations under the License. */ #include "health_graph_card.h" #include "applib/graphics/graphics.h" #include "applib/graphics/text.h" #include "drivers/rtc.h" #include "kernel/pbl_malloc.h" #include "services/common/clock.h" #include "services/common/i18n/i...
(ctx, border_color)
; graphics_fill_rect(ctx, box); graphics_context_set_fill_color(ctx, bar_color); graphics_fill_rect(ctx, box_inset); } static void prv_draw_day_bar_thin(GContext *ctx, const GRect *box, int weekday, GColor bar_color) { GRect thin_box = *box; // Nudge the bars before Thursday...
put_bytes_get_semaphore()
, prv_taking_too_long_yield_cb); } void test_put_bytes__lock_contention_upon_write_message(void) { // When the PutBytes lock is taken for a long time when a PutBytes message is written, // expect to receive a Nack: s_do_before_write = prv_hold_lock_before_write; prv_receive_init(4, ObjectFirmware); // Rel...
ntext_mark_dirty_rect(ctx, clipped_rect); // bit-block fiddling: const int16_t max_y = clipped_rect.origin.y + clipped_rect.size.h; for (; clipped_rect.origin.y < max_y; ++clipped_rect.origin.y) { if ((clipped_rect.origin.y == (rect.origin.y + rect.size.h) - radius) && (corner_mask & GCornersBottom)) { ...
prv_fill_rect_legacy2(ctx, GRect(rect->origin.x, rect->origin.y + radius, rect->size.w, rect->size.h - 2 * radius), 0, GCornerNone, fill_color)
; // Bottom Rect prv_fill_rect_legacy2(ctx, GRect(bottom_rect_origin_x, rect->origin.y + rect->size.h - radius, bottom_rect_size_w, radius), 0, GCornerNone, fill_color); } } T_STATIC void prv_fill_rect_non_aa(GContext* ctx, const GRect *rect, ui...
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) { const int num_windows_per_stack = 2; Window *windows[NumModalPriorities][num_windows_per_stack]; WindowStack *window_stac...
(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 unfocusable top windows // Test: An opaque top window below a unfocusable top window removes Unfocusable // i.e. A unfocusable to...
NOT A CALENDAR PIN static TimelineItem item5 = { .header = { .id = {0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, .timestamp = 10*60, .duration = 10, .type = TimelineItemTypePin, .all_day = false, .layout = LayoutIdWeather, }, ....
prv_get_calendar_ongoing()
); cl_assert(!stub_new_timer_is_scheduled(timer_id)); } void test_calendar__init_with_past_event(void) { cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); rtc_set_time(30 * 60); timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing(...
*sb; if (packet_len == 0 || !(sb = comm_session_send_buffer_begin_write(state->session, GET_BYTES_ENDPOINT_ID, packet_len, COMM_SESSION_DEFAULT_TIMEOUT))) { // If timeout, try again // MT: What if the session got disconnected? system_task_add_callbac...
(LOG_LEVEL_DEBUG, "Fetching %d bytes starting at %d", (int)info.flash_len, (int)info.flash_start_addr)
/* * 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...
DEFINE_SYSCALL(void, memory_cache_flush, void *start, size_t size)
{ // We need to align the address and size properly for the cache functions. It needs to be done // before we do syscall_assert_userspace_buffer though, because otherwise the user could // potentially abuse this behavior to flush+invalidate kernel memory. Theoretically that // shouldn't actually have any reall...
/* * 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...
recognizer->subscriber.filter(recognizer, touch_event)
; } static void prv_send_subscriber_event(Recognizer *recognizer) { RecognizerEvent event; switch (recognizer->state) { case RecognizerState_Started: event = RecognizerEvent_Started; break; case RecognizerState_Updated: event = RecognizerEvent_Updated; break; case RecognizerSt...
et_iter_state(2)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(1)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_...
{ TimelineModel model = {0}; model.direction = TimelineIterDirectionFuture; time_t first_time = 1421178000; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 for (int i = 0; i < ARRAY_LENGTH(s_items); i++) { pin_db_delete((uint8_t *)&s_items[i].header.id, sizeof(TimelineItemId)); } timeline_model_in...
b, NULL); cl_assert(seq != NULL); // Try to create a spawn out of b and c Animation *c = prv_create_test_animation(); Animation *spawn = animation_spawn_create(c, b, NULL); cl_assert(spawn == NULL); // We should be able to create one out of c and d Animation *d = prv_create_test_animation(); spawn = a...
animation_set_elapsed(h, duration / 2)
t(fds[i] == E_OUT_OF_RESOURCES); for (int j = 0; j < i; j++) { cl_assert(pfs_close(fds[j]) == S_SUCCESS); } fd = pfs_open("newfile", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); pfs_close(fd); int fd2 = pfs_open("newfile", OP_FLAG_READ, 0, 0); cl_assert((fd2 >= 0) && (fd == fd2)); // sh...
strlen(overwrite_string)
); cl_assert(fd >= 0); pfs_init(false); // simulate a reboot uint8_t read_buf[strlen(string)]; fd = pfs_open(file, OP_FLAG_READ, 0, 0); cl_assert(fd >= 0); rv = pfs_read(fd, &read_buf[0], strlen(string)); cl_assert_equal_i(rv, strlen(string)); cl_assert(memcmp(string, read_buf, strlen(string)) == 0); ...
reset any timers based on our state. int32_t new_brightness = 0; switch (new_state) { case LIGHT_STATE_ON: new_brightness = prv_backlight_get_intensity(); new_timer_stop(s_timer_id); break; case LIGHT_STATE_ON_TIMED: new_brightness = prv_backlight_get_intensity(); // Schedule ...
mutex_unlock(s_mutex)
; } void light_enable_respect_settings(bool enable) { mutex_lock(s_mutex); s_user_controlled_state = enable; if (enable) { if (prv_light_allowed()) { prv_change_state(LIGHT_STATE_ON); } } else if (s_num_buttons_down == 0) { prv_change_state(LIGHT_STATE_OFF); } mutex_unlock(s_mutex); } ...
function call below. app_notification_window_add_new_notification_by_id(id); } static void prv_handle_notification(PebbleEvent *e, void *context) { if (e->type == PEBBLE_SYS_NOTIFICATION_EVENT) { Uuid *id = e->sys_notification.notification_id; switch(e->sys_notification.type) { case NotificationAdded...
app_zalloc_check(sizeof(NotificationsData))
record, telling the loader that the image has been // fully written. uint8_t eof_record[IHEX_RECORD_LENGTH(0)]; ihex_encode(eof_record, IHEX_TYPE_EOF, 0, NULL, 0); if (!prv_write_register_block(dev, ADDR_LOADER_STATUS, eof_record, IHEX_RECORD_LENGTH(0))) { PBL_LOG(LOG_LEVEL_E...
{ PBL_LOG(LOG_LEVEL_ERROR, "Timed-out waiting for the Idle app to end but we " "probably just missed it"); // TODO: The line only goes high for a few ms. If there is any kind of context switch while we // wait for the line to go high we will miss this. Let's fix this the right way in PBL-41812 ...
g app forcefully"); PebbleTask task = (PebbleTask)data; process_manager_put_kill_process_event(task, false /*gracefully*/); } // --------------------------------------------------------------------------------------------- static bool prv_force_stop_task_if_unprivileged(ProcessContext *context) { vTaskSuspend(...
{ return true; }
/* * 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...
(dialog, DIALOG_TIMEOUT_DEFAULT)
; app_simple_dialog_push(simple_dialog); } /////////////////////////////// // Simple Dialog with vibration static void prv_show_simple_dialog_vibe(DialogsData *data) { SimpleDialog *simple_dialog = simple_dialog_create("Simple Vibe Dialog"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); dialog_se...
Point(45, 10), SW_ODD)); setup_test(&context, false, SW_ODD, GColorBlack, GColorBlack, false); graphics_draw_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_draw_rect_stroked(&context, &GRect(10, 20, 40, 10), SW_ODD)); setup_test(&context, false, SW_ODD, GColorBlack, GColorBlack, false); graphics_...
(10, 20, 40, 10)
mode_with_just_titles(void) { ActionMenuLevel *root_level = action_menu_level_create(3); action_menu_level_add_action(root_level, "I will text back", prv_noop_action_callback, NULL); action_menu_level_add_action(root_leve...
action_menu_level_create(3)
ton_id = index + 1; const int vertical_icon_margin = prv_vertical_icon_margin(); switch (button_id) { case BUTTON_ID_UP: rect.origin.y = vertical_icon_margin; break; case BUTTON_ID_SELECT: rect.origin.y = (action_bar->layer.bounds.size.h / 2) - (rect.size.h / 2)...
(recognizer)
; const uint8_t index = button_id - 1; // is_highlighted will cause the icon in the action bar to render normal or inverted: action_bar_set_highlighted(action_bar, index, is_highlighted); } static void action_bar_raw_up_handler(ClickRecognizerRef recognizer, void *context) { ActionBarLayer *action_bar = (Acti...
led_completed, false); // Expect no advertisement timer cl_assert_equal_i(regular_timer_seconds_count(), 0); free(ad); } void test_gap_le_advert__single_job_multiple_terms_silence_and_loop_around(void) { BLEAdData *ad = create_ad("yo", NULL); GAPLEAdvertisingJobTerm advert_terms[] = { { .min_i...
cl_assert_equal_i(regular_timer_seconds_count(), 1); // Unschedule callback should not have been called: cl_assert_equal_i(s_unscheduled_cb_count, 0); // Make sure the all the terms in the job are run: for (int term = 0; term < ARRAY_LENGTH(advert_terms); ++term) { for (int second_tick = 0; second_tick ...
property_animation->values.from.int16, property_animation->values.to.int16); ((PropertyAnimationLegacy2Implementation*)property_animation->animation.implementation) ->accessors.setter.int16(property_animation->subject, result); } void property_animation_legacy2...
if (property_animation->animation.implementation->update == (AnimationLegacy2UpdateImplementation) property_animation_legacy2_update_gpoint || property_animation->animation.implementation->update == (AnimationLegacy2UpdateImplementation) property_animation_update_gpoint) { pr...
_2X_DISP_COLS, LEGACY_2X_DISP_ROWS); return; case PlatformTypeBasalt: case PlatformTypeChalk: // yes, this is misleading, e.g. on Spalding, these defines are always 180x180 // oh dear... *size = GSize(LEGACY_3X_DISP_COLS, LEGACY_3X_DISP_ROWS); return; case PlatformTypeDiorite: ...
DEFINE_SYSCALL(PlatformType, sys_get_current_app_sdk_platform, void)
{ return process_metadata_get_app_sdk_platform(app_manager_get_current_app_md()); } DEFINE_SYSCALL(bool, sys_app_is_watchface, void) { return app_manager_is_watchface_running(); } DEFINE_SYSCALL(ResAppNum, sys_get_current_resource_num, void) { if (pebble_task_get_current() == PebbleTask_KernelMain) { retu...
/* * 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 (ADC_GetFlagStatus(ADC1, ADC_FLAG_OVR) == SET) { ADC_ClearFlag(ADC1, ADC_FLAG_OVR); ADC_ClearFlag(ADC1, ADC_FLAG_EOC); return false; }
} return true; } void voltage_monitor_read(const VoltageMonitorDevice *device, VoltageReading *reading_out) { PBL_ASSERTN(device->adc == ADC1); mutex_lock(s_adc_mutex); periph_config_enable(ADC1, RCC_APB2Periph_ADC1); ADC_TempSensorVrefintCmd(ENABLE); ADC_CommonInitTypeDef ADC_CommonInitStruct; // S...
) { ++s_count_display_update; } static bool s_display_update_in_progress = false; bool compositor_display_update_in_progress(void) { return s_display_update_in_progress; } static PebbleEvent s_last_event; void event_put(PebbleEvent* event) { s_last_event = *event; } static bool s_render_pending; bool process_m...
cl_assert_equal_i(s_count_display_update, 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...
cl_assert_equal_i(1, interpolate_int16(2, 3, 4))
; cl_assert_equal_i(2, s_override_progress); cl_assert_equal_i(3, s_override_from); cl_assert_equal_i(4, s_override_to); } int64_t prv_override_times_two(AnimationProgress p, int64_t a, int64_t b) { return interpolate_int64_linear(p, a, b) * 2; } void test_animation_interpolate__override_gets_clipped(void) { ...
{ 1152, 360, -288}, { 1104, 360, -280}, { 1288, 384, -224}, { 1176, 384, -224}, { 1136, 312, -136}, { 1224, 304, -80}, { 1224, 280, -64}, // 56 seconds { 1072, 224, -16}, { 824, 176, 16}, { 648, 160, -32}, { 600, 160, 0}, { 680, 120, 40}, { 888, 80, 64}, { 1096,...
{ 872, 288, -192}, { 616, 200, -152}, { 520, 176, -136}, { 544, 184, -72}, { 696, 208, -88}, { 864, 216, -176}, { 1040, 288, -256}, { 1136, 328, -280}, { 1176, 328, -256}, { 1240, 336, -240}, { 1088, 344, -248}, { 1056, 344, -168}, { 1192, 344, -176}, { 1224, 280,...
// 64 seconds { 1328, 320, -304}, { 1056, 288, -232}, { 1104, 320, -208}, { 1184, 320, -208}, { 1264, 312, -144}, { 1184, 256, -64}, { 960, 216, -16}, { 792, 176, -24}, { 736, 184, -48}, { 784, 144, -8}, { 808, 104, 24}, { 904, 48, 24}, { 1008, 96, -48}, { 10...
, ContentIndicatorDirectionUp, fg_color, bg_color, GAlignTop); } if (num_rows - row >= SHORT_ITEM_MAX_ROWS_SPALDING) { grect_align(&arrow_rect, aml_bounds, GAlignBottom, true /* clip */); content_indicator_draw_arrow(ctx, &arrow_rect, ContentIndicatorDirectionDown,...
gbitmap_deinit(&aml->item_animation.fade_top)
l_height > it->cursor.y) { // If the total height is greater than the cursor y, don't // add in space to accodomate the separator as the downwards callback // will add it for us. it->cursor.y -= it->cursor.h; } else { it->cursor.y -= total_height; } ...
prv_menu_layer_walk_upward_from_iterator(&render_iter->it)
; render_iter->it.cursor = menu_layer->cache.cursor; prv_menu_layer_walk_downward_from_iterator(&render_iter->it); } layer_remove_from_parent(&render_iter->cell_layer); // Assign the new cache: menu_layer->cache.cursor = render_iter->new_cache; task_free(render_iter); } void menu_layer_init_scroll_...
graphics_draw_rotated_bitmap(&ctx, test_image_color, GPoint(30, 30), DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq( &ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_assign_center_45_transparent.Xbit.pbi")); } void test_graphics_draw_rotated_bitm...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_topedge_2.Xbit.pbi"))
; // left edge center rotation point, Angle 2 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_color, GPoint(1, 30), DEG_TO_TRIGANGLE(2), GPoint(72, 84)); cl_check(gbitmap_pbi_eq(&ctx.dest_b...
free(r.allocated_buffer)
; // Fill up storage again for (++i; i < count + erase_count; i++) { e.header.id = uuids[i % count]; e.header.timestamp = timestamp + i; notification_storage_store(&e); cl_assert(notification_storage_get(&uuids[i % count], &r)); compare_notifications(&e, &r); free(r.allocated_buffer); } ...
ute *)write_ptr; // shallow copy the attributes for (int i = 0; i < in->num_attributes; i++) { if (write_ptr + sizeof(Attribute) > buffer_end) { return false; } memcpy(&out->attributes[i], &in->attributes[i], sizeof(Attribute)); write_ptr += sizeof(Attribute); } for (int i = 0; i < in->nu...
{ return 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...
list_remove(&reg_timer->list_node, NULL, NULL)
; } } else { iter = list_get_next(iter); } } mutex_unlock(s_callback_list_semaphore); } // ------------------------------------------------------------------------------------------- static void timer_callback(void* data) { (void) data; do_callbacks(&s_seconds_callbacks); time_t t = r...
t_len); return E_RANGE; } settings_raw_iter_read_val(&file->iter, val_out, val_out_len); return S_SUCCESS; } status_t settings_file_set_byte(SettingsFile *file, const void *key, size_t key_len, size_t offset, uint8_t byte) { if (key_len > SETTINGS_KEY_MAX_LEN) { return E...
if (search_forward(&file->iter, key, key_len)) { set_flag(&file->iter.hdr, SETTINGS_FLAG_SYNCED); settings_raw_iter_write_header(&file->iter, &file->iter.hdr); return S_SUCCESS; }
/* * 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...
(BMA255Register_EXTENDED_MEMORY_MAP, BMA255_EXTENDED_MEMORY_MAP_OPEN)
; bma255_write_register(BMA255Register_EXTENDED_MEMORY_MAP, BMA255_EXTENDED_MEMORY_MAP_OPEN); bma255_write_register(BMA255Register_TEMPERATURE_SENSOR_CTRL, BMA255_TEMPERATURE_SENSOR_DISABLE); bma255_write_register(BMA255Register_EXTENDED_MEMORY_MAP, BMA255_EXTENDED_MEMORY_MAP_CLOSE); exti_configure_pin(BOARD_C...
.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_persist.h" #include "stubs_prompt.h" #include "stubs_queue.h" #include "stubs_resources.h" #include "stubs_serial.h" #include "stubs_syscall_internal.h" #include "stubs_worker_manager.h" #include "drivers/accel.h" #include "services/common/event_s...
cl_assert_equal_i(num, 1)
; cl_assert_equal_i(den, fastest_rate / sample_arr[i]); cl_assert_equal_i(samps_per_update, 1); } else { // the sample rate is not an even multiple of our fastest rate uint32_t gcd_of_rates = gcd(fastest_rate, sample_arr[i]); cl_assert_equal_i(num, sample_arr[i] / gcd_of_rates); ...
cl_assert_equal_i(s_command_list[0].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[1].addr, 64 * 1024); cl_assert_equal_i(s_command_list[1].type, SectorEraseCommand); cl_assert_equal_i(s_command_list[2].addr, 2 * 64 * 1024); cl_assert_equal_i(s_command_list[2].type, SubsectorEraseCommand); ...
cl_assert_equal_i(s_command_list[2].addr, 0x331000)
; cl_assert_equal_i(s_command_list[2].type, SubsectorEraseCommand); }
est", test_func_imp); cl_assert_equal_b(jerry_value_is_object(prototype), true); EXECUTE_SCRIPT("_rocky.test();"); cl_assert_equal_i(1, s_test_func_imp_call_count); rocky_add_function(prototype, "method", method_func_imp); EXECUTE_SCRIPT("var y = new _rocky.test(); y.method();"); cl_assert_equal_i(1, s_met...
jerry_release_value(result_seconds)
const AlarmInfo info = { .hour = data->alarm_hour, .minute = data->alarm_minute, .kind = data->alarm_kind, .is_smart = (data->alarm_type == AlarmType_Smart), }; data->alarm_id = alarm_create(&info); data->complete_callback(CREATED, data->alarm_id, data->callback_context); app_w...
menu_layer_set_highlight_colors(&data->day_picker_menu_layer, ALARMS_APP_HIGHLIGHT_COLOR, GColorWhite)
; menu_layer_set_click_config_onto_window(&data->day_picker_menu_layer, &data->day_picker_window); layer_add_child(&data->day_picker_window.layer, menu_layer_get_layer(&data->day_picker_menu_layer)); if (!alarm_get_kind(data->alarm_id, &data->alarm_kind)) { data->alarm_kind = ALARM_KIND_JUST...
l_main(void *unused) { PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sharing started"); s_ble_hrm_session.service_info = (EventServiceInfo) { .type = PEBBLE_HRM_EVENT, .handler = prv_ble_hrm_handle_hrm_data, }; event_service_client_subscribe(&s_ble_hrm_session.service_info); s_ble_hrm_session.manager_session = ...
(&connection->device)
== permission) { return; } const bool prev_is_sharing = prv_is_sharing(connection); prv_upsert_permission(&connection->device, permission); prv_update_is_sharing(connection, prev_is_sharing); } static void prv_disconnect_to_kill_subscription(GAPLEConnection *connection) { // Unfortunately, GATT does not...
find a sample, just give up on reading PPG for this handshake break; } data_out->num_samples++; } PPG_DBG("num_samples reg: %"PRIu8" read: %u", num_ppg_samples, data_out->num_samples); } static void prv_write_accel_sample(HRMDevice *dev, uint8_t sample_idx, AccelRawData *data) { struct ...
(&s_handshake_interval_timer, &average_handshake_interval_ms)
; // Try to write the register frequently early on, and then every half second to accommodate // changes over time. if (num_intervals == 2 || num_intervals == 10 || (num_intervals % 30) == 0) { prv_set_host_one_second_time_register(HRM, average_handshake_interval_ms); } // Read the SYNC byte ...
(font_cache, &font_res->md, mid_idx)
; if (codepoint_at_mid_idx < codepoint) { min_idx = mid_idx + 1; } else if (codepoint_at_mid_idx > codepoint) { max_idx = mid_idx - 1; } else { offset = prv_offset_table_get_offset(font_cache, &font_res->md, mid_idx); break; } } return offset; } static uint32_t prv_get_gly...
Full circle case: if (angle_end - angle_start >= TRIG_MAX_ANGLE) { config.full_quadrants = GCornersAll; return config; } int32_t angle_start_normalized = normalize_angle(angle_start); int32_t angle_end_normalized = normalize_angle(angle_end); int8_t starting_quadrant_normalized = (angle_start_normal...
prv_get_rotated_precise_point_for_ellipsis(center, radius_outer_x.raw_value, radius_outer_y.raw_value, config.end_quadrant.angle)
; GPointPrecise start_bottom = (no_innner_ellipsis) ? center : prv_get_rotated_precise_point_for_ellipsis(center, radius_inner_x.raw_value, radius_inner_y.raw_value, config.start_quadrant.angle); GPointPrecise e...
/* * 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...
(input_config->gpio, gpio_init)
; gpio_release(input_config->gpio); } static uint8_t s_gpio_clock_count[MAX_GPIO]; void gpio_use(GPIO_TypeDef* GPIOx) { uint8_t idx = ((((uint32_t)GPIOx) - AHB1PERIPH_BASE) / 0x0400); portENTER_CRITICAL(); if((idx < MAX_GPIO) && !(s_gpio_clock_count[idx]++)) { SET_BIT(RCC->AHB1ENR, (0x1 << idx)); powe...
RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR)
); } uint32_t boot_bits_get(void) { return RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR); } void command_boot_bits_get(void) { char buffer[32]; dbgserial_putstr_fmt(buffer, sizeof(buffer), "bootbits: 0x%"PRIu32, boot_bits_get()); } void boot_version_write(void) { if (boot_version_read() == TINTIN_METADATA.versi...
ds_utc(time_t now_utc, time_t *enter_utc, time_t *exit_utc) { // Get useful UTC times time_t start_of_today_utc = time_util_get_midnight_of(now_utc); int minute_of_day = time_util_get_minute_of_day(now_utc); int last_sleep_second_of_day = ACTIVITY_LAST_SLEEP_MINUT...
if (state->sleep_data.cur_state != ActivitySleepStateAwake) { continue; }
} // Log this event activity_sessions_prv_send_activity_session_to_data_logging(session); *params->exit_utc = session_exit_utc; params->modified = true; logged_event = true; } // Update settings file if any events were logged if (logged_event) { mutex_lock_recursive(state->mutex); ...
ring, sizeof(data->custom_value_string)) != 0) { strncpy(data->custom_value_string, new_tuple->value->cstring, sizeof(data->custom_value_string)); prv_update_scrollable_metrics(data); } break; } default: // Unknown key ret...
app_sync_init(&data->sync, data->sync_buffer, sizeof(data->sync_buffer), initial_values, ARRAY_LENGTH(initial_values), prv_sync_tuple_changed_callback, prv_sync_error_callback, data)
; data->workout_controller = (WorkoutController) { .is_paused = prv_is_paused, .pause = prv_pause, .stop = NULL, .update_data = prv_update_data, .metric_to_string = prv_metric_to_string, .get_metric_value = prv_get_metric_value, .get_distance_string = prv_get_distance_string, .get_cu...
_corr[2] = valz & CORRECTION_VAL_MASK; } return (is_valid); } static void prv_get_roll_and_pitch(AccelRawData *d, int32_t *rollp, int32_t *pitchp) { if ((d->x == 0) && (d->y == 0) && (d->z == 0)) { *rollp = *pitchp = 0; return; } int32_t roll = atan2_lookup(d->y, d->z); int32_t act_ang = (ro...
PBL_LOG(LOG_LEVEL_DEBUG, "subscribers %"PRIu8, s_compass_subscribers_count)
; } static void prv_compass_data_service_start(PebbleTask task) { prv_compass_data_service_stop(task); s_compass_subscribers[task] = true; if (++s_compass_subscribers_count == 1) { // If this is the first subscriber to the compass service, start sampling PBL_ASSERTN(s_accel_session == NULL); s_accel...
/* * 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...
malloc(length + 2)
; if (path == NULL) return NULL; memcpy(path, _path, length); path[length] = 0; path[length + 1] = 0; for (i = 0; i < length; ++i) { if (path[i] == '/') path[i] = '\\'; } return path; } static void fileops(int mode, const char *_source, const char *_dest) { SHFILEOPSTRUCT fops; char *source = file...
_1_UUID 0x0a, 0x04, 0x98, 0x00, 0x39, 0x18, 0x47, 0xaa, 0x9c, 0x16, 0x8e, 0xa0, 0xa8, 0x2a, 0x2e, 0xb8 #define ADDRESS_1_UUID 0xd3, 0x72, 0x2d, 0x75, 0x6b, 0x21, 0x49, 0x2a, 0x9c, 0xc7, 0x5f, 0xf8, 0x4d, 0xd2, 0x5a, 0x9c #define ADDRESS_2_UUID 0x43, 0x03, 0x91, 0x06, 0x80, 0x39, 0x48, 0xea, 0x92, 0x72, 0xf3, 0x4c, 0...
cl_assert_equal_i(serialized_contact->flags, 0)
; cl_assert_equal_i(serialized_contact->num_attributes, 1); cl_assert_equal_i(serialized_contact->num_addresses, 2); contacts_db_free_serialized_contact(serialized_contact); }
/* * 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...
((ExpandableDialog *)transcription_dialog)
; // Find the current index utf8_t *cursor = (utf8_t *)dialog->buffer; int16_t current_idx = 0; while (cursor < (utf8_t *)transcription_dialog->zero) { cursor = utf8_get_next(cursor); current_idx++; } PBL_ASSERTN(cursor == (utf8_t *)transcription_dialog->zero); PBL_ASSERTN(current_idx <= to_idx);...
(0x8fbc8f)}, {"darkslateblue", GColorARGB8FromHEX(0x483d8b)}, {"darkslategray", GColorARGB8FromHEX(0x2f4f4f)}, {"darkslategrey", GColorARGB8FromHEX(0x2f4f4f)}, {"darkturquoise", GColorARGB8FromHEX(0x00ced1)}, {"darkviolet", GColorARGB8FromHEX(0x9400d3)}, {"deeppink", GColorARGB8FromHEX(0xff1493)}, {"deeps...
(0xa0522d)
}, {"skyblue", GColorARGB8FromHEX(0x87ceeb)}, {"slateblue", GColorARGB8FromHEX(0x6a5acd)}, {"slategray", GColorARGB8FromHEX(0x708090)}, {"slategrey", GColorARGB8FromHEX(0x708090)}, {"snow", GColorARGB8FromHEX(0xfffafa)}, {"springgreen", GColorARGB8FromHEX(0x00ff7f)}, {"steelblue", GColorARGB8FromHEX(0x468...
C, 10); cl_assert(fd >= 0); cl_assert(pfs_close(fd) == S_SUCCESS); } cl_assert(pfs_active_in_region(0, pfs_get_size())); // delete every page and make sure pfs is active for (int i = 0; i < num_pages(); i++) { snprintf(file_name, sizeof(file_name), "file%d", i); cl_assert(pfs_remove(file_name)...
(buf, sizeof(buf), "This is small buf %d!", i)
; int len = strlen(buf); char rbuf[len]; int fd = pfs_open(file_small, OP_FLAG_READ, FILE_TYPE_STATIC, 0); cl_assert(fd >= 0); cl_assert_equal_i(pfs_read(fd, (uint8_t *)rbuf, len), len); cl_assert(memcmp(rbuf, buf, len) == 0); cl_assert(fd >= 0); cl_assert(pfs_close(fd) == S_SUCCESS); ...
le 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 under the License. */ #include "drivers/qspi.h...
(QSPI_FLAG_TC)
== RESET) { } } static void prv_wait_for_not_busy(void) { while (QSPI_GetFlagStatus(QSPI_FLAG_BUSY) != RESET) { } } #endif static void prv_read_bytes(uint8_t *buffer, size_t buffer_size) { for (size_t i = 0; i < buffer_size; ++i) { buffer[i] = QSPI_ReceiveData8(); } } static void prv_set_ddr_enabled(bool...
t; GFont s_fonts_get_system_font__result; GFont fonts_get_system_font(const char *font_key) { record_mock_call(s_fonts_get_system_font){ .font_key = font_key }; return s_fonts_get_system_font__result; } static MockCallRecordings s_graphics_draw_text; void graphics_draw_text(GContext *ctx, const char *text, G...
cl_assert_equal_i(1, s_graphics_text_attributes_destroy.call_count)
; } void test_rocky_api_graphics__request_draw(void) { rocky_global_init(s_graphics_api); cl_assert_equal_i(0, s_layer_mark_dirty.call_count); EXECUTE_SCRIPT("_rocky.requestDraw();"); cl_assert_equal_i(1, s_layer_mark_dirty.call_count); cl_assert_equal_p(&s_app_window_stack_get_top_window.layer, s_layer_mar...
/* * 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...
(PEBBLE_CALLBACK_EVENT, e->type)
{ *bounds_out = layer->bounds; }
static Window s_app_window_stack_get_top_window; Window *app_window_stack_get_top_window() { return &s_app_window_stack_get_top_window; } GContext s_context; // mocks static MockCallRecordings s_graphics_context_set_fill_color; void graphics_context_set_fill_color(GContext* ctx, GColor color) { record_mock_call...
_t data_len, uint8_t *data) { return i2c_read_register_block(I2C_MAG3110, reg_addr, data_len, data); } static bool mag3110_write(uint8_t reg_addr, uint8_t data) { return i2c_write_register_block(I2C_MAG3110, reg_addr, 1, &data); } static void mag3110_interrupt_handler(bool *should_context_switch) { if (s_use_re...
mag3110_read(DR_STATUS_REG, sizeof(raw_data), raw_data)
) { rv = MagReadCommunicationFail; goto done; } // TODO: shouldn't happen at low sample rate, but handle case where some data // is overwritten if ((raw_data[0] & 0xf0) != 0) { PBL_LOG(LOG_LEVEL_INFO, "Some Mag Sample Data was overwritten, " "dr_status=0x%x", raw_data[0]); rv = MagR...
{ -1056, 272, 160}, // 61 seconds { -1448, 480, 344}, { -1224, 856, 8}, { -1128, 8, -184}, { -1104, 448, -72}, { -1456, 568, 24}, { -1648, 368, 80}, { -1688, 176, 64}, { -1504, 48, 136}, { -1360, 0, 160}, { -1272, 0, 136}, { -1200, 8, 112}, { -1128, 40, 104}, ...
{ 112, 360, -40}, { 120, 320, -16}, { 80, 464, 104}, { 32, 712, 128}, { -72, 720, 224}, { -24, 1072, 152}, { -40, 1392, 344}, { 0, 1624, 240}, { 24, 1576, -96}, { -32, 1160, 56}, { 8, 736, 104}, // 67 seconds { 32, 584, 64}, { 40, 504, 48}, { 120, 328, 88}, ...
/* * 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(s_test_cases)
; i++) { const struct SelfTestCase* test = s_test_cases + i; bool test_passed = false; if (test->func != 0) { test_passed = test->func(); } bitset32_update(&result, i, test_passed); } return result; } void command_selftest(void) { char buffer[32]; uint32_t result = mfg_selftest(); f...
2"s", days, hours, minutes, seconds); } static void prv_information_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) { PBL_ASSERTN(cell_index->section == 0); PBL_ASSERTN(cell_index->row < SystemInformationItem_Count); S...
{ case 3: led_controller_rgb_set_color(LED_RED); break; case 4: led_controller_rgb_set_color(LED_GREEN); break; case 5: led_controller_rgb_set_color(LED_BLUE); break; case 6: led_controller_rgb_set_color(LED_BLACK); i = 2; break; default: break; }
i = (i + 1)%7; #endif } static void prv_information_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *context) { prv_color_led_easter_egg(); } static void prv_information_window_load(Window *window) { Set...
d test_gatt_client_subscriptions__cleanup(void) { for (GAPLEClient c = 0; c < GAPLEClientNum; ++c) { gatt_client_subscriptions_cleanup_by_client(c); } gap_le_connection_deinit(); gatt_client_subscription_cleanup(); fake_pbl_malloc_check_net_allocs(); fake_pbl_malloc_clear_tracking(); } // ------------...
fake_kernel_malloc_mark()
; // Un-subscribe, while subscribing process is still pending: e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionNone, GAPLEClientKernel); cl_assert_equal_i(e, BTErrnoInvalidState); fake_kernel_malloc_mark_assert_equal(); prv_assert_no_event(); } void test_gatt_client_subscriptions__subs...
/* * 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(prv_convert_1bit_addr_to_8bit_x(bitmap, block_addr, dest_y), prv_get_8bit_x_from_1bit_x(dest_x))
ize) { timeline_id &= ~SYSTEM_RESOURCE_FLAG; if (timeline_id >= NUM_TIMELINE_RESOURCES) { return RESOURCE_ID_INVALID; } return g_timeline_resources[timeline_id][size]; } static bool prv_get_sys_resource(TimelineResourceId timeline_id, TimelineResourceSize size, AppResourceI...
{ *res_info = (AppResourceInfo) {0}; }
return; } timeline_resources_get_id(timeline_res, size, res_info); }
/* * 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...
service_changed_send_indication_to_all(HRM_SERVICE_EXPECTED_ATT_STARTING_HANDLE, HRM_SERVICE_EXPECTED_ATT_ENDING_HANDLE)
; } else { // Unfortunately, there is no clean way to remove a service from RivieraWaves once it has been // added. The various ble_... APIs do nuke the GATT DB entirely, but can only be called when // there is no connection / on-going air operations. // The next time the BT stack is restarted (grante...
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 == 2 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); cl...
(&line, utf8_bounds.start)
; cl_assert(line_add_words(&line, &word_iter, NULL)); cl_assert(line.height_px == 10); cl_assert(line.width_px == HORIZ_ADVANCE_PX * 4); cl_assert(line.origin.x == 0); cl_assert(line.suffix_codepoint == '-'); cl_assert(*line.start == 'a'); // mal- cl_assert(*word_iter_state.current.start == 'm'); cl_...
TestCharacteristicInstanceUnsupported = 33, } TestCharacteristicInstance; Uuid gatt_client_service_get_uuid(BLEService service_ref) { switch (service_ref) { case TestServiceInstanceComplete: case TestServiceInstanceIncomplete: return s_test_service_uuid; case TestServiceInstanceUnsupported: de...
kernel_malloc(sizeof(PebbleBLEGATTClientServiceEventInfo) + (num_services_added * sizeof(BLEService)))
; *info = (PebbleBLEGATTClientServiceEventInfo) { .status = BTErrnoOK, .type = PebbleServicesAdded, .device = s_test_device, }; info->services_added_data.num_services_added = num_services_added; memcpy(info->services_added_data.services, s_service_handles, sizeof(s_service_handles)); PebbleEvent...
/* * 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...
(&attr_list, AttributeIdBgColor, GColorOrangeARGB8)
_name, const char *connected_string, const char *le_string, const char *is_sharing_heart_rate_string) { # if CAPABILITY_HAS_BUILTIN_HRM _Static_assert(false, "FIXME: Implement round drawing code to show heart rate sharing sta...
i18n_get("Airplane Mode", data)
; icon = &data->icon_heap_bitmap[AirplaneIconIdx]; } else { if (selected) { bt_local_id_copy_device_name(device_name_buffer, false); subtitle = device_name_buffer; } else { subtitle = i18n_get("Now Discoverable", data); } icon...
ect to, int16_t bounce) { GPoint bounce_offset = GPointZero; const int16_t delta_x = to.origin.x - from.origin.x; const int16_t delta_y = to.origin.y - from.origin.y; if (!delta_x && !delta_y) { return bounce_offset; } const int16_t magnitude = integer_sqrt(delta_x * delta_x + delta_y * delta_y); i...
kino_reel_transform_get_to_frame(reel)
state s_kalg_state = kernel_zalloc(kalg_state_size()); const uint32_t k_max_tests = 1000; uint32_t num_tests = 0; // Results ActivityTestResults test_results[k_max_tests]; memset(test_results, 0, sizeof(test_results)); // List of metrics we measure for each test // IMPORTANT: This order must match t...
for (int i = 0; i < ARRAY_LENGTH(metrics); i++) { printf("| ---------------------- "); }
def struct PACKED { uint8_t packet_id; uint8_t data[DATA_LEN_STATUS_RESPONSE]; uint32_t padding; } StatusRegisterResponse; #endif typedef struct PACKED { uint8_t packet_id; uint16_t address; uint16_t value; uint8_t footer; } MemoryPacket; static bool s_callback_scheduled = false; // Low-level helper f...
htons(value)
; MemoryPacket data = { .packet_id = PACKET_ID_RAM_WRITE, .address = address, .value = value, .footer = RAM_FLASH_FOOTER }; prv_write_data((uint8_t *)&data, sizeof(data)); } #if 0 // TODO: we will use this to verify firmware when upgrading static uint16_t prv_read_flash(uint16_t address) { addr...
draw_lines_same_point(&ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_same_point"))); #if SCREEN_COLOR_DEPTH_BITS == 8 graphics_context_set_stroke_color(&ctx, GColorRed); draw_lines_same_point(&ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_same_point_color"))); #endif } #...
nguage governing permissions and * limitations under the License. */ #include "clar.h" #include "services/normal/timezone_database.h" #include "services/common/clock.h" #include "../timezone_fixture.auto.h" #include "stubs_logging.h" #include "stubs_passert.h" #include <string.h> //! Find a region ID for the gi...
{ { const int almaty_region = FIND_REGION("Asia/Almaty"); TimezoneInfo tz_info; bool result = timezone_database_load_region_info(almaty_region, &tz_info); cl_assert(result); cl_assert_equal_i(tz_info.dst_id, 0); // No DST cl_assert_equal_i(tz_info.tm_gmtoff, 6 * 60 * 60); // +6 hours } }
{ phone_format_phone_number(caller_text, s_phone_ui_data->caller_id_text_buf, NAME_BUFFER_LENGTH); text_layer_set_overflow_mode(&s_phone_ui_data->caller_id_text_layer, GTextOverflowModeWordWrap); }
else { phone_format_caller_name(caller_text, s_phone_ui_data->caller_id_text_buf, NAME_BUFFER_LENGTH); } if (s_phone_ui_data->style->large_caller_id) { caller_id_font = s_phone_ui_data->name_font; lines++; } else if (prv_has_long_name(s_phone_ui_data->name_font)) { caller_id_font = s_phone_ui_da...
/* * 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 (slice.layout.icon != APP_GLANCE_SLICE_DEFAULT_ICON) { Uuid app_uuid; sys_get_app_uuid(&app_uuid); const TimelineResourceInfo timeline_resource_info = (TimelineResourceInfo) { .app_id = &app_uuid, .res_id = (TimelineResourceId)slice.layout.icon, }; AppResourceInfo app_resource_info = ...
// Check if the template string is too long (if it's not NULL) // Plus one for the null terminator, then plus one more to become too long const size_t template_string_too_long_size = ATTRIBUTE_APP_GLANCE_SUBTITLE_MAX_LEN + 1 + 1; if (slice.layout.subtitle_template_string && strnlen(slice.layout.subtitle...
)binding->ptr) = jerry_get_angle_value(argv[0]); return true; } static bool prv_assign_grect_precise(const RockyArgBinding *binding, const jerry_value_t argv[], RockyArgValueCheckError *value_error_out) { Fixed_S16_3 v[4]; for (int i = 0; i < 4; ++i) { const double d = jerry_get_...
(binding->type, &imp)
; // Check number of arguments: // TODO: PBL-40644: support optional bindings if (i + imp.expected_num_args > argc) { return rocky_error_arguments_missing(); } // Type check: RockyArgTypeCheckError type_error; if (!imp.check_type(&argv[i], &type_error)) { return rocky_error_une...
/* * 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...
(sizeof(s_palette) == (1 << BITS_PER_PIXEL))
; GBitmap s_bmp = (GBitmap) { .addr = s_data, .row_size_bytes = ROW_STRIDE, .info.format = GBitmapFormat1BitPalette, .info.version = GBITMAP_VERSION_CURRENT, .bounds = { .size = { WIDTH, HEIGHT } }, .palette = s_palette, }; memset(s_data, 0, sizeof(s_data)); for (int y = 0; y < HEIGHT; ...
bi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_across_x_origin_layer"))); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_acr...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 24), 10)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_origin_no_clip"))); // Even rows of different lengths setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_COLS); graphic...
(BOOT_BIT_RESET_LOOP_DETECT_ONE)
; if (counter == 7) { boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_THREE); return true; } switch (++counter) { case 1: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 2: boot_bi...
t 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 in writing, sof...
codepoint_is_end_of_word(codepoint)
) { new_state = WordStateEnd; } else { new_state = WordStateGrowing; } break; case WordStateJoining: if (codepoint == NEWLINE_CODEPOINT) { new_state = WordStateEnd; } else if (codepoint_is_ideograph(codepoint)) { new_state = WordStateIdeograph; } e...
limitations under the License. */ #include "os/mutex.h" #include "kernel/pbl_malloc.h" #include "process_management/app_manager.h" #include "process_management/worker_manager.h" #include "services/common/analytics/analytics.h" #include "services/common/analytics/analytics_metric.h" #include "services/common/analyti...
if (!uuid) { // There is a brief period of time where no app is running, which we // attribute to the system UUID. For now, this lets us track how // much time we are missing, although we probably want to try and // tighten this up as much as possible going forward. uuid = &uuid_...
} ListNode *node = list_find((ListNode*)s_app_heartbeat_list, prv_is_app_node_with_uuid, (void*)uuid); AnalyticsHeartbeatList *app_node = (AnalyticsHeartbeatList*)node; if (!app_node) { if (list_count((ListNode *)s_app_heartbeat_list) >= MAX_APP_HEARTBEATS) { ...
right 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 in writing,...
layer_set_frame((Layer *)&peek_layer->number.text_layer, &(GRect) { { cursor.x, cursor.y + NUMBER_OFFSET_Y }, number_size })
; cursor.x += number_size.w; layer_set_frame((Layer *)&peek_layer->title.text_layer, &(GRect) { { cursor.x, cursor.y + TEXT_OFFSET_Y }, { title_size.w, title_size.h + font_height_fuzz } }); } ////////////////////// // API ///////////////////// PeekLayer *peek_layer_c...
--------------------------------- void *animation_get_context(Animation *animation_h) { if (animation_private_using_legacy_2(NULL)) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. return ((AnimationLe...
(state, animation, include_delay, include_play_count)
v_exit_and_send_result_event(data, DictationSessionStatusFailureRecognizerError); } } } static void prv_handle_dictation_result(VoiceUiData *data, PebbleVoiceServiceEvent *event) { VOICE_LOG("Handling result event"); data->session_id = VOICE_SESSION_ID_INVALID; bool success = false; switch (event->status...
VOICE_LOG("Ignoring event")
; break; default: WTF; } } static void prv_start_dictation(VoiceUiData *data) { VOICE_LOG("Start dictation session"); PBL_ASSERTN(data->session_id == VOICE_SESSION_ID_INVALID); data->session_id = sys_voice_start_dictation(data->session_type); if (data->session_id == VOICE_SESSION_ID_INVALID) ...
now - 10 * SECONDS_PER_DAY, now - 9 * SECONDS_PER_DAY); cl_assert_equal_i(accessible, HealthServiceAccessibilityMaskNotAvailable); // range far into to past and future accessible = health_service_any_activity_accessible(HealthActivityMaskAll, ...
health_service_activities_iterate(HealthActivityRun | HealthActivityWalk | HealthActivityOpenWorkout, now - (100 * SECONDS_PER_MINUTE), now, HealthIterationDirectionPast, prv_activity_cb, 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...
list_get_next(iter)
; // Did the caller want to remove this one? // NOTE: We do not support callers that free the memory for the regular timer structure // from their callback procedure! if (reg_timer->pending_delete) { list_remove(&reg_timer->list_node, NULL, NULL); } } else { iter = list...
{ QuickLaunchData *data = (QuickLaunchData *)context; prv_update_app_names(data); }
static Window *prv_init(void) { QuickLaunchData *data = app_malloc_check(sizeof(*data)); *data = (QuickLaunchData){}; data->callbacks = (SettingsCallbacks) { .deinit = prv_deinit_cb, .draw_row = prv_draw_row_cb, .get_initial_selection = prv_get_initial_selection_cb, .select_click = prv_select_c...
/* * 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...
{ service_uuids[num_uuids++] = bt_uuid_expand_16bit(0x180D); // Heart Rate Service }
#endif // Pebble Pairing Service UUID: service_uuids[num_uuids++] = bt_uuid_expand_16bit(PEBBLE_BT_PAIRING_SERVICE_UUID_16BIT); ble_ad_set_service_uuids(ad, service_uuids, num_uuids); char device_name[BT_DEVICE_NAME_BUFFER_SIZE]; bt_local_id_copy_device_name(device_name, true); ble_ad_set_local_name(ad,...
d prv_set_flag(Connection *connection, bool enabled, ConnectionFlag flag) { prv_lock(); { if (connection_is_valid(connection)) { PBL_LOG(LOG_LEVEL_DEBUG, "Changing connection flag: %c=%u", prv_debug_char_for_flag(flag), enabled); if (enabled) { connection->flags |= (1 << flag);...
((ListNode *)connection->gatt_op_list)
; if (!tmp_tail) { PBL_LOG(LOG_LEVEL_WARNING, "Gatt: Attempted to pop recent op when list empty"); PBL_ASSERTN(0); } connection->gatt_op_list = (GattOperation *) list_get_head(list_pop_tail((ListNode *)connection->gatt_op_list)); kernel_free(tmp_tail); } prv_unlock(); return r...
GColorARGB8FromHEX(0xffd700)
}, {"goldenrod", GColorARGB8FromHEX(0xdaa520)}, {"greenyellow", GColorARGB8FromHEX(0xadff2f)}, {"grey", GColorARGB8FromHEX(0x808080)}, {"honeydew", GColorARGB8FromHEX(0xf0fff0)}, {"hotpink", GColorARGB8FromHEX(0xff69b4)}, {"indianred", GColorARGB8FromHEX(0xcd5c5c)}, // {"indigo", GColorARGBFromHEX(0x4b0082...
/* * 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...
workout_service_get_current_workout_info(&workout_data->steps, &workout_data->duration_s, &workout_data->distance_m, &workout_data->bpm, &workout_data->hr_zone)
; if (workout_data->duration_s && workout_data->distance_m) { workout_data->avg_pace = health_util_get_pace(workout_data->duration_s, workout_data->distance_m); } } void workout_data_fill_metric_value(WorkoutMetricType type, char *buffer, size_t buffer_size, ...
phics_fill_rect.last_call.rect); cl_assert_equal_i(GColorBlackARGB8, s_graphics_fill_rect__color.argb); cl_assert_equal_i(GColorJaegerGreenARGB8, s_context.draw_state.fill_color.argb); s_graphics_fill_rect = (MockCallRecordings){}; EXECUTE_SCRIPT( "ctx.fillRect(5, 6, 7, 8);\n" ); cl_assert_equal_i(1, ...
{ prv_global_init_and_set_ctx(); // inner radius = 0 EXECUTE_SCRIPT( "ctx.rockyFillRadial(30, 40, 0, 20, 0, Math.PI);\n" ); MockCallRecording *const lc = &s_graphics_fill_radial_precise_internal.last_call; cl_assert_equal_i(1, s_graphics_fill_radial_precise_internal.call_count); cl_assert_equal_point_...
void test_rocky_api_graphics__line_styles(void) { prv_global_init_and_set_ctx(); EXECUTE_SCRIPT( "ctx.lineWidth = 8;\n" "var w = ctx.lineWidth;\n" ); cl_assert_equal_i(1, s_graphics_context_set_stroke_width.call_count); cl_assert_equal_i(8, s_graphics_context_set_stroke_width.last_call.width); A...
} return false; } bool gtransform_is_only_translation(const GTransform * const t) { if (!t) { return false; } if ((t->a.raw_value == GTransformNumberOne.raw_value) && (t->b.raw_value == GTransformNumberZero.raw_value) && (t->c.raw_value == GTransformNumberZero.raw_value) && (t->d.raw_...
(pointP.x, t->a)
; Fixed_S16_3 y_c = Fixed_S16_3_S32_16_mul(pointP.y, t->c); Fixed_S16_3 one_tx = Fixed_S16_3_S32_16_mul(FIXED_S16_3_ONE, t->tx); Fixed_S16_3 x_b = Fixed_S16_3_S32_16_mul(pointP.x, t->b); Fixed_S16_3 y_d = Fixed_S16_3_S32_16_mul(pointP.y, t->d); Fixed_S16_3 one_ty = Fixed_S16_3_S32_16_mul(FIXED_S16_3_ONE, t->...
44, 112}, { -120, 904, 72}, { -120, 920, 80}, { -80, 872, 112}, { -96, 976, 104}, { -80, 912, 56}, { -120, 912, 80}, { -112, 960, 104}, { -112, 920, 104}, { -96, 904, 72}, { -64, 848, 32}, { -80, 912, 80}, { -112, 1008, 112}, { -128, 904, 80}, { -64, 872, 24}, ...
{ 1192, 192, -336}, { 1024, 304, -152}, { 712, 224, -216}, { 616, 288, -192}, { 768, 384, -104}, { 976, 504, -128}, // 135 seconds { 1344, 536, -144}, { 1096, 760, -56}, { 960, 480, -256}, { 880, 752, -104}, { 1272, 1192, 0}, { 1344, 288, 0}, { 1104, 696, -128}, ...
{ 1312, 336, -200}, { 1416, 272, -248}, { 1088, -96, -256}, { 800, -72, -336}, { 1192, -168, -104}, { 864, 136, -448}, { 1168, 176, -320}, { 1160, 352, -352}, { 872, 320, -296}, { 736, 384, -272}, { 864, 472, -224}, { 1072, 600, -288}, { 1368, 768, -248}, { 1232,...
ectionLayer *selection_layer) { // Config UP / DOWN button behavior: window_set_click_context(BUTTON_ID_UP, selection_layer); window_set_click_context(BUTTON_ID_DOWN, selection_layer); window_set_click_context(BUTTON_ID_SELECT, selection_layer); window_single_repeating_click_subscribe(BUTTON_ID_UP, ...
(window, (ClickConfigProvider) prv_click_config_provider, selection_layer)
; } } void selection_layer_set_callbacks(SelectionLayer *selection_layer, void *callback_context, SelectionLayerCallbacks callbacks) { selection_layer->callbacks = callbacks; selection_layer->callback_context = callback_context; }
circular_buffer_get_write_space_remaining(&buffer), 2); cl_assert(shared_circular_buffer_read(&buffer, &client, 4, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 4); cl_assert(memcmp(out_buffer, "1234", 4) == 0); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 2); cl_...
(shared_circular_buffer_read(&buffer, &client1, 2, &out_buffer, &out_length))
; cl_assert_equal_i(out_length, 2); cl_assert(memcmp(out_buffer, "bc", 2) == 0); cl_assert(shared_circular_buffer_consume(&buffer, &client1, 2)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 0); // Should fail, not enough room because client 2 is full cl_assert(!shared_cir...