prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
dler = up_handler; } void window_raw_click_subscribe(ButtonId button_id, ClickHandler down_handler, ClickHandler up_handler, void *context) { prv_check_is_in_click_config_provider(window_manager_get_top_window(), "subscribe"); if (button_id == BUTTON_ID_BACK) { PBL_LOG(LOG_LEVEL_DEBUG, "Cannot register BUTTON_...
(window, get_native_color(background_color))
; } void window_set_fullscreen(Window *window, bool enabled) { if (window->is_fullscreen == enabled) { return; } window->is_fullscreen = enabled; window->layer.frame = window_calc_frame(enabled); window->layer.bounds.size = window->layer.frame.size; layer_mark_dirty(&window->layer); } bool window_get...
n_info_valid = ble_data->is_local_encryption_info_valid; pairing_info_out->is_remote_encryption_info_valid = ble_data->is_remote_encryption_info_valid; pairing_info_out->is_remote_identity_info_valid = ble_data->is_remote_identity_info_valid; pairing_info_out->is_remote_signing_info_valid = ble_data->is_rem...
(LOG_LEVEL_WARNING, "Invalid pairing stored")
; goto done; } if (addr_out) { *addr_out = data.bt_classic_data.address; } if (link_key_out) { *link_key_out = data.bt_classic_data.link_key; } if (platform_bits) { *platform_bits = data.bt_classic_data.platform_bits; } if (device_name_out) { strcpy(device_name_out, data.bt_classic_...
gpio_output_init(&BOARD_CONFIG_BT_COMMON.reset, GPIO_OType_PP, GPIO_Speed_25MHz)
; periph_config_release_lock(); } static void prv_enter_reset(void) { gpio_output_set(&BOARD_CONFIG_BT_COMMON.reset, true); delay_us(100); } static void prv_exit_reset(void) { gpio_output_set(&BOARD_CONFIG_BT_COMMON.reset, false); } static void prv_send_char(uint8_t c) { uart_write_byte(BT_TX_BOOTROM_UART...
, -280, 408}, { 1176, -48, -128}, { 1112, 64, -136}, { 1008, 216, -88}, { 1096, 296, -224}, { 1152, 272, -288}, { 816, 144, -280}, { 888, 112, -136}, { 1072, -16, -96}, { 1464, -8, -280}, { 1912, 144, -216}, { 1568, 360, -320}, { 904, 520, -568}, { 776, 352, -448}, ...
{ 1144, 232, 40}, { 1128, 272, -72}, { 1056, 248, -200}, { 1232, 168, -48}, { 1120, 232, -160}, { 1048, 184, -280}, { 1312, 224, -320}, { 1248, 176, -320}, // 16 seconds { 816, 152, -232}, { 816, 208, -272}, { 960, 272, -128}, { 1168, 336, -192}, { 1120, 312, -184...
{ 1016, -272, -424}, { 1008, 24, -232}, { 992, 240, -152}, { 840, 152, -152}, { 824, 264, -48}, { 1304, 424, -112}, { 1280, 520, -168}, { 1520, 512, -72}, { 1376, 960, -448}, { 704, 408, -376}, { 864, 512, -560}, { 1264, 392, -560}, { 1504, 264, -144}, { 1232, -5...
akeupEntry)) { return true; // continue iterating } struct prv_check_app_and_wakeup_event_s *check = (struct prv_check_app_and_wakeup_event_s*)context; WakeupId wakeup_id; info->get_key(file, (uint8_t*)&wakeup_id, sizeof(WakeupId)); WakeupEntry entry; info->get_val(file, (uint8_t*)&entry, sizeof(Wake...
{ SettingsFile wakeup_settings; if (settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE) == S_SUCCESS) { // Check if the wakeup id is valid by seeing if it is in the wakeup settings_file status = settings_file_get(&wakeup_settings, (uint8_t*)&wakeup_id, sizeof(WakeupId), ...
mutex_unlock(s_mutex); if (status != S_SUCCESS) { return status; } // timer doesn't belong to this app if (!uuid_equal(&app_manager_get_current_app_md()->uuid, &entry.uuid)) { return E_DOES_NOT_EXIST; } time_t return_time = entry.timestamp; if (prv_compiled_without_utc_support()) { // Le...
} delay_ms(1); } return true; } void *reset_vector, *initial_sp; prv_get_fw_reset_vector(&reset_vector, &initial_sp); if ((uintptr_t)reset_vector == 0xffffffff || (uintptr_t)initial_sp == 0xffffffff) { dbgserial_putstr("Firmware is erased"); return true; } return false; } ...
(j << (i*4))
cl_assert(cmp_result); \ } while(0) static void setup_test(GContext* ctx, bool antialiased, uint8_t stroke_width, GColor stroke_color, GColor fill_color, bool lock) { graphics_context_set_antialiased(ctx, antialiased); graphics_context_set_stroke_width(ctx, stroke_width); graphics_c...
(context.draw_state.text_color.argb, GColorClear.argb)
; color.a = 0; graphics_context_set_text_color(&context, color); cl_assert_equal_i(context.draw_state.text_color.argb, GColorClear.argb); // Text Color - 2-bit graphics_context_set_text_color_2bit(&context, GColor2White); cl_assert(gcolor_equal(context.draw_state.text_color, GColorWhite)); #if PBL_COLOR ...
nclude/math.h" // easiest way to get M_PI #include <stdlib.h> #include <string.h> #define ROCKY_SINGLETON "_rocky" // [MT] including <math.h> causes the jerry-libm header to get included again :( extern double round(double d); uintptr_t rocky_util_uint_from_value(const jerry_value_t value) { uintptr_t rv = 0; i...
jerry_acquire_value(result)
; } static jerry_value_t prv_create_function(void *c_function_ptr) { return jerry_create_external_function(c_function_ptr); } bool rocky_add_function(jerry_value_t parent, char *name, jerry_external_handler_t handler) { bool result = false; JS_UNUSED_VAL = rocky_get_or_create_object(parent, name, prv_create_fun...
/* * 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_capture_frame_buffer_format(ctx, CANVAS_GBITMAP_FORMAT)
; } // Overrides same function in graphics.c; we need to do this so we can release the framebuffer we're // using even though its format doesn't match GBITMAP_NATIVE_FORMAT (see comment for mocked // graphics_capture_frame_buffer() above) bool graphics_release_frame_buffer(GContext *ctx, GBitmap *buffer) { PBL_ASSER...
/* * 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 < 7; i++) { steps = health_service_sum(HealthMetricStepCount, day_start, day_start + SECONDS_PER_DAY); APP_LOG(APP_LOG_LEVEL_INFO, "%d days ago steps: %d", i, (int)steps); day_start -= SECONDS_PER_DAY; }
// Test getting steps for part of a day day_start = time_start_of_today(); time_t seconds_today_so_far = time(NULL) - day_start; steps = health_service_sum(HealthMetricStepCount, day_start, day_start + (seconds_today_so_far / 2)); APP_LOG(APP_LOG_LEVEL_INFO, "steps 1...
.overrun_error = (errors & USART_ISR_ORE) != 0, .framing_error = (errors & USART_ISR_FE) != 0, .noise_detected = (errors & USART_ISR_NE) != 0, }; return flags; } bool uart_is_rx_ready(UARTDevice *dev) { return dev->periph->ISR & USART_ISR_RXNE; } bool uart_has_rx_overrun(UARTDevice *dev) { return dev...
if (dev->state->tx_irq_handler(dev)) { should_context_switch = true; }
} portEND_SWITCHING_ISR(should_context_switch); } void uart_clear_all_interrupt_flags(UARTDevice *dev) { dev->periph->RQR |= USART_RQR_RXFRQ; dev->periph->ICR |= USART_ICR_ORECF; } // DMA //////////////////////////////////////////////////////////////////////////////// void uart_start_rx_dma(UARTDevice *dev...
rmal); } uint8_t int0_status = bmi160_read_reg(BMI160_REG_INT_STATUS_0); uint8_t int2_status = bmi160_read_reg(BMI160_REG_INT_STATUS_2); prv_run_command(BMI160_CMD_INT_RESET); // debug bool anymotion = ((int0_status & BMI160_INT_STATUS_0_ANYM_MASK) != 0); if (anymotion) { int32_t direction; IMUC...
{ const int a_begin = 0; // index within the frame where accel data starts prv_convert_accel_raw_data_to_mgs(&frame_buf[a_begin], data); }
static void prv_drain_fifo(void) { // we can't drain the fifo if we are in low power mode so we have // to temporarily enter normal mode bool was_low_power = (s_accel_power_mode == BMI160_Accel_Mode_Low); if (was_low_power) { bmi160_set_accel_power_mode(BMI160_Accel_Mode_Normal); } // get the FIFO le...
h" #include "applib/ui/menu_layer.h" #include "applib/ui/content_indicator_private.h" // Stubs ///////////////////// #include "stubs_app_state.h" #include "stubs_graphics.h" #include "stubs_heap.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #inc...
menu_layer_set_center_focused(&l, true)
; menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks){ .draw_row = prv_draw_row, .get_num_rows = prv_get_num_rows, }); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(0, l.selection.y); const int16_t basic_cell_height = menu_cell_basic_cell_height(); const int...
/* * 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...
(runlevel < RunLevel_COUNT, "Unknown runlevel %d", runlevel)
) { return s_activity_state.enabled_run_level && s_activity_state.enabled_charging_state; } // ------------------------------------------------------------------------------------------------ // If necessary, change the sampling period of our heart rate subscription // @param[in] now_ts number of seconds the system...
rtc_get_time()
ter_next, NULL, &iter_state); while (iter_next(&iter)) { uint8_t status = iter_state.header.common.status; if (!(status & TimelineItemStatusDeleted)) { // Mark for deletion prv_set_header_status(&iter_state.header, TimelineItemStatusDeleted, fd); size_available += sizeof(SerializedTimelineIt...
if (size_needed > (NOTIFICATION_STORAGE_FILE_SIZE - s_write_offset)) { if (!prv_compress(size_needed, &fd)) { // Notification storage compression failed. Clear notifications storage goto reset_storage; } }
pfs_seek(fd, s_write_offset, FSeekSet); int result = prv_write_notification(notification, &header, fd); if (result < 0) { // [AS] TODO: Write failure: reset storage, compression or reset watch? goto reset_storage; } s_write_offset += result; prv_file_close(fd); return; reset_storage: mutex...
prv_send_response(false /* is_confirmed */); } prv_deinitialize_info_text(data); property_animation_destroy(data->info_text_in_animation); property_animation_destroy(data->info_text_out_animation); kernel_free(data); } s_data_ptr = NULL; } static void prv_show_failure_kernel_main_cb(void *unu...
{ PBL_LOG(LOG_LEVEL_WARNING, "Timeout cb executing while received successful completion event"); }
; syscall_failed(); } const size_t max_length = def->max_length; if (length > max_length) { PBL_LOG(LOG_LEVEL_ERROR, "AppOutbox max_length exceeded %"PRIu32" vs %"PRIu32, (uint32_t)length, (uint32_t)max_length); syscall_failed(); } app_outbox_service_send(data, length, sent_handler, c...
prv_unlock()
; } //! @note This executes on App Task //! Should only get called through the syscall, sys_app_outbox_send static void app_outbox_service_send(const uint8_t *data, size_t length, AppOutboxSentHandler sent_handler, void *cb_ctx) { AppOutboxStatus status = AppOutboxStatusSuccess; ...
///////////////////////////////// #include "stubs_analytics.h" #include "stubs_event_service_client.h" #include "stubs_logging.h" #include "stubs_new_timer.h" #include "stubs_pbl_malloc.h" #include "stubs_phone_call_util.h" #include "stubs_session.h" #include "stubs_system_task.h" bool alerts_should_notify_for_type(Al...
{ //fake_comm_session_init(); phone_call_service_init(); prv_call_end(); s_last_phone_ui_event = PhoneEventType_Invalid; // s_transport = fake_transport_create(TransportDestinationSystem, NULL, NULL); // s_session = fake_transport_set_connected(s_transport, true /* connected */); // pp_get_phone_state_set_en...
IFY "stringify" #define GLOBAL_JSON_PARSE "parse" #define CONTROL_MESSAGE_MAX_FAILURES (3) #define CHUNK_MESSAGE_MAX_FAILURES (3) #define RETRY_DELAY_MS (1000) #define SESSION_CLOSED_TIMEOUT_MS (3000) typedef struct { ListNode node; uint32_t key; size_t length; uint8_t data[0]; } MessageNode; typed...
prv_handle_disconnection()
; } } //////////////////////////////////////////////////////////////////////////////// // Outbound Object Queue //////////////////////////////////////////////////////////////////////////////// static void prv_object_queue_send_current_chunk(void); static void prv_object_queue_pop_head(bool should_free_data_buffer)...
handlers, seq); s_parent_for_sequence_unschedule_from_child = seq; prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(seq); // Complete A and start B. This should unschedule the parent prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS + 1);...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 1); // A should be at the end int32_t update_a_after = prv_last_update_distance(a); cl_assert_equal_i(update_a_after, ANIMATION_NORMALIZED_MAX); // B should be in the middle int32_t update_b_after = prv_last_update_distance(b); ...
t, title, subtitle_font, subtitle, icon); } static void prv_draw_notification_cell_round_unselected(GContext *ctx, const Layer *cell_layer, const char *title, const char *subtitle, ...
PBL_IF_RECT_ELSE(prv_draw_notification_cell_rect, prv_draw_notification_cell_round_selected)
/* * 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(list_get_prev(&b) == &a)
; cl_assert(list_get_next(&b) == &c); cl_assert(list_get_prev(&c) == &b); cl_assert(list_get_next(&c) == NULL); } void test_list__count(void) { ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LIST_NODE_NULL; ListNode *tail = list_append(list_append(&a, &b), &c); cl_assert(list_count(tail) == 3); cl_...
UEST; // UART DEVICES #if TARGET_QEMU static UARTDeviceState s_qemu_uart_state; static UARTDevice QEMU_UART_DEVICE = { .state = &s_qemu_uart_state, // GPIO? Where we're going, we don't need GPIO. (connected to QEMU) .periph = USART2, .irq_channel = USART2_IRQn, .irq_priority = 13, .rcc_apb_periph = RCC_A...
i2c_init(&I2C_2V5_BUS)
; voltage_monitor_device_init(VOLTAGE_MONITOR_ALS); voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY); }
d on steps void test_activity__step_derived_metrics(void) { int32_t value; // All tests start at 5pm, which is 1020 minutes into the day const int k_minute_start = 1020; // Set the user's dimensions const int k_height_mm = 1630; activity_prefs_set_height_mm(k_height_mm); activity_prefs_set_weight_dag(68...
prv_activity_init_and_set_enabled(true)
; // Start activity tracking. This method assumes it can be called from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); // All tests start at 5pm, which is 1020 minutes into a 1440 min...
mote_ltk_from_info(&info->remote_encryption_info); } // The LTK that's used when the local device is the master // (we call it "local", Dialog calls it "remote"... :-S ) if (info->is_local_encryption_info_valid) { dev->remote_ltk = prv_create_local_ltk_from_info(&info->local_encryption_info); } if (in...
(LOG_LEVEL_ERROR, "Pairing fail? conn=%p, dev=%p", connection, dev)
/* * 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 < (int) NUM_SYSTEM_FONTS; ++i) { if (0 == strcmp(font_key, s_font_resource_keys[i].key_name)) { FontInfo *fontinfo = &s_system_fonts_info_table[i]; uint32_t resource = s_font_resource_keys[i].resource_id; // if the font has not been initialized yet if (!fontinfo->loaded) { ...
// Didn't find the given font, invalid key. return (GFont)NULL; } void sys_font_reload_font(FontInfo *fontinfo) { text_resources_init_font(fontinfo->base.app_num, fontinfo->base.resource_id, fontinfo->extension.resource_id, fontinfo); } uint32_t sys_resource_get_and_cache(ResAppNum app_num, uint32_t res...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_state_get_window_stack()
, animated); } void app_window_stack_pop_all(const bool animated) { window_stack_pop_all(app_state_get_window_stack(), animated); } bool app_window_stack_remove(Window *window, bool animated) { return window_stack_remove(window, animated); } Window *app_window_stack_get_top_window(void) { return window_stack_g...
Y_GOTHIC_24); snprintf(data->text_buffer, sizeof(data->text_buffer), "%c: %"PRIi8, 'X' + i, data->axis_offsets[X_AdjustState + i]); graphics_draw_text(ctx, data->text_buffer, font, GRect(bounds->origin.x, bounds->origin.y + 35 + LINE_HEIGHT * i, ...
(layer, ctx)
; prv_display_offsets(layer, ctx); prv_display_serial_number(layer, ctx); if (data->is_saving) { prv_display_saving_message(layer, ctx); } } static void prv_select_click_handler(ClickRecognizerRef recognizer, void *data) { AppData *app_data = app_state_get_user_data(); app_data->app_state = (app_data...
e 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 express or implied. * See the License for the specific...
prv_global_init_and_set_ctx()
; // taken from http://fiddle.jshell.net/9298zub9/2/ EXECUTE_SCRIPT( "var t1 = 10;\n" "var b1 = 20.5;\n" "var t2 = 30.5;\n" "var b2 = 40;\n" " \n" "for (var i = 1; i <= 5; i++) {\n" " ctx.beginPath();\n" " var x1 = 20 * i;\n" " var x2 = x1 + 10.5; \n" " ctx.moveTo(x1...
.header = { // [3] .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4}, .parent_id = {0}, .timestamp = 1421183642, // Tue Jan 13 13:14:02 2015 PST .duration = 30, .type = TimelineItemTypePin, .flags = ...
cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id))
ictionaryResult dict_write_cstring(DictionaryIterator *iter, const uint32_t key, const char * const cstring) { return dict_write_data_internal(iter, key, (const uint8_t * const) cstring, cstring ? strlen(cstring) + 1 : 0, TUPLE_CSTRING); } DictionaryResult dict_write_uint8(DictionaryIterator *iter, const uint32_t ke...
{ uint32_t total_size = sizeof(Dictionary); if (tuplets_count == 0) { return total_size; } for (unsigned int i = 0; i < tuplets_count; ++i) { const Tuplet * const tuplet = &tuplets[i]; switch (tuplet->type) { case TUPLE_BYTE_ARRAY: total_size += tuplet->bytes.length; break; ...
// Legacy version to prevent previous app breakage, __deprecated preserves order uint32_t dict_calc_buffer_size_from_tuplets__deprecated(const uint8_t tuplets_count, const Tuplet * const tuplets) { return dict_calc_buffer_size_from_tuplets(tuplets, tuplets_count); } static DictionaryResult dict_write_tuple(Dict...
frame.origin.x += horizontal_inset; frame.size.w -= horizontal_inset * 2; frame.origin.y += top_inset; frame.size.h -= top_inset; // Using TextStyleFont_Header here is a little bit of a hack to achieve Gothic 18 Bold on // Spalding's default content size (medium) while still being a little robust for any f...
if (first_row) { // Draw "Clear all" box and exit #if PBL_ROUND draw_cell(ctx, cell_layer, i18n_get("Clear All", data), NULL, NULL); #else const GFont font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle); GRect box = cell_layer->bounds; box.origin.y += 6; graphics_draw_tex...
switch (*(msg++)) { case MusicEndpointCmdIDNowPlayingInfoResponse: prv_update_now_playing_info(session, msg, length); break; case MusicEndpointCmdIDPlayStateInfoResponse: prv_update_play_state_info(session, msg, length); break; case MusicEndpointCmdIDVolumeInfoResponse: prv_u...
{ return; // Expected to happen because this is called with `false` for any OS }
if (music_set_connected_server(&s_pp_music_implementation, connected)) { s_connected = connected; } else { s_connected = false; } if (s_connected) { // Request initial state: prv_send_music_command_to_handset(MusicEndpointCmdIDGetAllInfo); } } void music_endpoint_handle_mobile_app_info_event...
g(void) { new_timer_stop(s_call_watchdog); pp_get_phone_state_set_enabled(false); } static bool prv_can_answer(void) { // We can't answer calls with Android return prv_call_is_ancs(); } static bool prv_should_show_ongoing_call_ui(void) { // We only want to show the ongoing call UI on Android return (s_cal...
{ if (!disconnected) { analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_END_COUNT, AnalyticsClient_System); } if (s_call_in_progress) { prv_call_end_common(); phone_ui_handle_call_end(false /*call accepted*/, disconnected); } else if (!disconnected) { PBL_LOG(LOG_LEVEL_INFO, "Ignoring end call....
static void prv_handle_caller_id(PebblePhoneEvent *event) { if (s_call_in_progress) { phone_ui_handle_caller_id(event->caller); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Ignoring caller id. A call is not in progress"); } } T_STATIC void prv_handle_phone_event(PebbleEvent *e, void *context) { PebblePhoneEven...
e, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on...
(upng, frame_data_buffer, frame_bytes)
; upng_error upng_state = upng_decode_metadata(upng); if (upng_state != UPNG_EOK) { APP_LOG(APP_LOG_LEVEL_ERROR, (upng_state == UPNG_ENOMEM) ? APNG_MEMORY_ERROR : APNG_DECODE_ERROR); goto cleanup; } // Save metadata to bitmap_sequence uint32_t play_count = 0; // If png is APNG, get num ...
are // compiled to use the 3.0 animation API to work with 2.0 apps. return animation_legacy2_is_scheduled((AnimationLegacy2 *)animation_h); } AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, true /*quiet*/); if (!animation) { return false; } return prv_animation_is_...
(NULL, animation_h, false /*quiet*/)
; if (!animation) { return NULL; } return animation->context; } // ------------------------------------------------------------------------------------------- bool animation_set_delay(Animation *animation_h, uint32_t delay_ms) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); if (ani...
_frame_size(item_layer).h; if (max_scroll > 0) { int16_t first_scroll = prv_get_first_scroll_offset(item_layer); return MAX(first_scroll, max_scroll); } else { return MAX(max_scroll, 0); } } static void prv_scroll_offset_setter(TimelineItemLayer *item_layer, int16_t value) { item_layer->scroll_offs...
( num_actions, 0, TimelineItemActionSourceTimeline)
; for (int i = 0; i < num_actions; i++) { timeline_actions_add_action_to_root_level(&action_group->actions[i], root_level); } const LayoutColors *colors = layout_get_colors((LayoutLayer *)item_layer->timeline_layout); ActionMenuConfig config = { .root_level = root_level, .context = item_layer->item,...
VENT, .media = { .type = (change_type == Connected) ? PebbleMediaEventTypeServerConnected : PebbleMediaEventTypeServerDisconnected, }, }; event_put(&event); } mutex_unlock_recursive(s_music_ctx.mutex); return (change_type != None); } cons...
rtc_get_ticks()
- s_music_ctx.track_pos_updated_at; const uint32_t time_elapsed_ms = ticks_to_milliseconds(time_elapsed_ticks); mutex_unlock_recursive(s_music_ctx.mutex); return time_elapsed_ms; } void music_get_pos(uint32_t *track_pos_ms, uint32_t *track_length_ms) { mutex_lock_recursive(s_music_ctx.mutex); const int32_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 (region_name[i] == '_') { region_name[i] = ' '; } }
} //! Initialize the continent and region names for the timezone windows static void prv_init_continent_and_region_names(SettingsTimeData *data) { const uint16_t region_count = data->region_count = timezone_database_get_region_count(); char * const region_names_buffer = app_zalloc_check(region_count * TIMEZONE_NA...
* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoOK); // Device isn't connected. Verify no event was caused as a result of the // registration. prv_assert_no_event(); // Connect & verify...
prv_assert_client_event(&device, true /* connected */, (1 << PebbleTask_KernelMain), HCI_ERROR_CODE_SUCCESS)
; // Register connection intent for app: e = gap_le_connect_connect_by_bonding(bonding_id, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp); cl_assert_equal_i(e, BTEr...
/* * 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...
GPIO_Init(config->gpio, &GPIO_InitStructure)
; gpio_release(config->gpio); } bool button_is_pressed(ButtonId id) { const ButtonConfig* button_config = &BOARD_CONFIG_BUTTON.buttons[id]; gpio_use(button_config->gpio); uint8_t bit = GPIO_ReadInputDataBit(button_config->gpio, button_config->gpio_pin); gpio_release(button_config->gpio); return !bit; } u...
/* * 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(num.fraction == 0)
; test_num = (int16_t)((float)-0.875 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); cl_assert(num.fraction == 1); test_num = (int32_t)((float)-0.750 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num....
104}, // 93 seconds { -1096, 136, 48}, { -1048, 328, 72}, { -1128, 392, 40}, { -1240, 344, -56}, { -1272, 464, -32}, { -1288, 520, -80}, { -1232, 184, 72}, { -1648, 336, 48}, { -1264, 408, -152}, { -1040, 408, -256}, { -1344, 480, -48}, { -1552, 352, 136}, { -1416...
{ 192, 576, 80}, { 232, 744, 128}, { 360, 800, 80}, { 344, 1096, 216}, { 440, 1256, 344}, { 448, 1520, 184}, { 736, 1152, 264}, { 712, 1344, 24}, { 744, 992, 64}, { 536, 456, -248}, { 504, 16, -288}, { 480, 0, -320}, { 376, -40, -232}, { 360, 32, -248}, { 328,...
{ 680, -592, -520}, { 600, -688, -432}, { 424, -776, -416}, { 328, -632, -336}, { 360, -600, -216}, { 376, -472, -400}, { 384, -528, -560}, { 368, -616, -576}, { 568, -544, -520}, { 792, -576, -856}, { 552, -568, -920}, { 360, -368, -1024}, { 152, 40, -1016}, { 7...
get_count()); prv_assert_event(&device, BTErrnoOK); cl_assert_equal_i(3, fake_gatt_is_service_discovery_start_count()); fake_gatt_put_discovery_indication_blood_pressure_service(TEST_GATT_CONNECTION_ID); gatt_client_discovery_discover_range(connection, &range_alt); // BP service should have been discovered...
cl_assert_equal_i(characteristic_two->num_descriptors, expected_characteristic2->num_descriptors); cl_assert_equal_i(characteristic_two->descriptors[0].att_handle_offset, expected_characteristic2->descriptors[0].handle - service_handle); cl_assert_equal_i(characteristic_two->properties, expect...
void test_gatt_client_discovery__single_blood_pressure_service(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); prv_simulate_and_assert_discovery_of_one_service(&device); GAPLEConnection *connec...
/* * 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...
uart_set_baud_rate(BT_RX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE)
; uart_set_baud_rate(BT_TX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE); } else { uart_init(BT_RX_BOOTROM_UART); uart_set_baud_rate(BT_RX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE); } periph_config_release_lock(); } static void prv_deinit_dialog_bootrom_interface(void) { periph_config_acquire_lock...
e[PATH_STRING_LENGTH] = {0}; snprintf(test_image_filename, PATH_STRING_LENGTH, "test_graphics_draw_bitmap_%s_test_image", test_data->test_name); GBitmap *bitmap = test_data->bitmap_create_func(test_image_filename); cl_assert(bitmap); cl_assert(gbitmap_get_format(bitmap) == test_data->expec...
(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_graphics_draw_bitmap__offset_layer_across_ny(void) { prv_offset_layer_test(GPoint(0, -40)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__offset_bitmap_layer_inside(void) { prv_offset_bitmap_layer_test(GPointZero); cl_check(gbitmap_pbi_eq(&s_ctx.d...
rmalized]; config.end_quadrant.angle = angle_end_normalized; config.end_quadrant.quadrant = radius_quadrants[ending_quadrant_normalized]; if (angle_start % QUADRANT_ANGLE == 0) { starting_quadrant_normalized--; } // Full quadrants config.full_quadrants = prv_get_full_quadrants(starting_q...
prv_swap_precise_points(&end_top, &end_bottom)
; } else if (end_top.y.raw_value == end_bottom.y.raw_value && (config.end_quadrant.quadrant & GCornersBottom)) { // Special case to make bottom edge to be on left side and keep masking algorithm happy prv_swap_precise_points(&end_top, &end_bottom); } // Range for scanline, since scanlines ar...
t(session); return; } if (!comm_session_get_system_session()) { PBL_LOG(LOG_LEVEL_INFO, "Cancelling sync: No route to phone"); blob_db_sync_cancel(session); return; } // read item into a temporary buffer void *item_buf = kernel_malloc_check(item_size); status_t status = blob_db_read(sessio...
{ return E_INVALID_ARGUMENT; }
BlobDBSyncSession *session = blob_db_sync_get_session_for_id(db_id); if (session) { // This will get picked up by the current session when it is done with its dirty list return S_SUCCESS; } char buffer[key_len + 1]; strncpy(buffer, (const char *)key, key_len); buffer[key_len] = '\0'; PBL_LOG(LO...
first line should be layed out (not truncated) graphics_text_layout_get_max_used_size(&gcontext, "JR Whopper", font, box, GTextOverflowModeFill, GTextAlignmentLeft, (void*)&layout); cl_assert(layout.box.size.w == box.size.w); cl_assert_equal_i(layout.max_used_size.w, 5 * HORIZ_ADVANCE_PX); // "JR..." cl_asse...
(&gcontext, "\n\n", font, box, GTextOverflowModeFill, GTextAlignmentLeft, 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...
{ PBL_LOG(LOG_LEVEL_ERROR, "Could not create app menu order file"); goto cleanup; }
prv_log_time(session->start_utc)); if (!is_restful) { container_session = session; last_session_len_m = session->len_m; // Accumulate sleep container stats results->total.value += session->len_m; if (first_container || session->start_utc < enter_utc) { enter_utc = session->s...
{ bool success = prv_sample_discovery_init(&s_sleep_sample_discovery_state.common, SampleFileType_MinuteSamples, "activity/sleep_samples"); cl_assert(success); // Init algorithm state s_kalg_state = kernel_zalloc(kalg_state_s...
time_t test_start_utc = now; for (int i = 0; i < entry->num_samples; i++) { uint16_t vmc = entry->samples[i].v5_fields.vmc; if (entry->version == 1) { // Convert from the old compressed VMC to the new uncompressed one vmc = vmc * vmc * 1850 / 1250; } const bool shutting_...
EN_WIDTH, SCREEN_HEIGHT / 2); graphics_context_set_antialiased(&ctx, true); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_top_clipped_aa.${BIT_DEPTH_NAME}.pbi")); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; ctx.dr...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_infinite_70_aa.8bit.pbi"))
; // House path - two edge cases for tipping points of the path prv_reset(); s_current_path = s_house_path; gpath_move_to(s_house_path, GPoint(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)); s_path_angle = 20; test_graphics_context_init(&ctx, fb); graphics_context_set_antialiased(&ctx, true); prv_filled_update_...
GColor color) { PBL_ASSERTN(ctx); if (gcolor_is_invisible(color)) { return; } GDrawMask *mask = ctx->draw_state.draw_mask; PBL_ASSERTN(mask); const GBitmap *framebuffer = &ctx->dest_bitmap; const GBitmapDataRowInfo current_data_row_info = gbitmap_get_data_row_info(framebuffer, ...
(x, data_row_info.min_x, data_row_info.max_x)
) { continue; } prv_update_mask(ctx, i, x, x, color); } } T_STATIC void prv_mask_recording_assign_horizontal_line_delta_raw(GContext *ctx, int16_t y, Fixed_S16_3 x1, Fixed_S16_3 x2, ...
imes writes to the FIFO registers fail. I am suspicious that the bma255 enters // suspend mode instead of standby mode. (The datasheet states that FIFO_CONFIG registers // accesses fail in suspend mode). It seems like the issue can be worked around by attempting // to enter standby mode again. Hopefully, bo...
{ bma255_write_register(BMA255Register_INT_EN_0, BMA255_INT_EN_0_SLOPE_X_EN | BMA255_INT_EN_0_SLOPE_Y_EN | BMA255_INT_EN_0_SLOPE_Z_EN); bma255_write_register(BMA255Register_INT_MAP_0, BMA255_INT_MAP_0_INT1_SLOPE); ...
static void prv_disable_shake_detection(void) { // Don't worry about the configuration registers but disable interrupts from the accel bma255_write_register(BMA255Register_INT_EN_0, 0); prv_disable_operating_mode(AccelOperatingMode_ShakeDetection); } void accel_enable_shake_detection(bool enable) { if (s_sh...
et_callback_context(ScrollLayer *scroll_layer) { return scroll_layer->context ? scroll_layer->context : scroll_layer; } void scroll_layer_draw_shadow_sublayer(Layer *shadow_sublayer, GContext* ctx) { ScrollLayer *scroll_layer = (ScrollLayer *)(((uint8_t*)shadow_sublayer) - offsetof(ScrollLayer, shadow_sublayer)); ...
(&scroll_layer->layer)
read(&buffer, &client2, 4, &out_buffer, &out_length)); cl_assert(shared_circular_buffer_consume(&buffer, &client2, 4)); cl_assert(memcmp(out_buffer, "1234", 4) == 0); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 6); // Make client2 fall behind cl_assert(shared_circular_buffer...
(&buffer, storage, sizeof(storage))
er Erase sector"); PBL_ASSERTN(num_entries < PFS_PAGES_PER_ERASE_SECTOR); int fd = pfs_open_gc_file(space_needed, true); GCData gcdata = { .version = 0, // Version 0 for now, bump if we change .flags = 0xff, .gc_start_page = sector_start_page, .num_entries = num_entries, .page_mask = sectors_...
{ min_size += sizeof(FileHeader); min_size += sizeof(FileMetaData); min_size += namelen; int bytes_per_sector = PFS_PAGE_SIZE - sizeof(PageHeader); int num_pages = min_size / bytes_per_sector; if ((min_size % bytes_per_sector) > 0) { num_pages++; } int optimal_size = num_pages * bytes_per_sector; ...
uint32_t get_available_pfs_space(void) { uint32_t allocated_space = 0; for (uint16_t pg = 0; pg < s_pfs_page_count; pg++) { uint8_t page_flags = prv_get_page_flags(pg); if ((IS_PAGE_TYPE(page_flags, PAGE_FLAG_START_PAGE)) || (IS_PAGE_TYPE(page_flags, PAGE_FLAG_CONT_PAGE))) { allocated_spac...
isturb.h" #include "services/normal/settings/settings_file.h" #include "services/normal/vibes/vibe_intensity.h" #include "system/passert.h" #include "os/mutex.h" #include "util/bitset.h" #include <string.h> #define FILE_NAME "notifpref" #define FILE_LEN (1024) static PebbleMutex *s_mutex; //////////////////////////...
(s_dnd_schedule_keys[WeekendSchedule].schedule_pref_key, &s_dnd_schedule[WeekendSchedule].schedule)
; s_dnd_schedule[WeekendSchedule].enabled = s_legacy_dnd_schedule_enabled; SET_PREF_ALREADY_OPEN(s_dnd_schedule_keys[WeekendSchedule].enabled_pref_key, &s_dnd_schedule[WeekendSchedule].enabled); #undef SET_PREF_ALREADY_OPEN #define DELETE_PREF(key) \ do { \ if (settings_file...
----------------------------------------------- // The metrics minute handler void activity_metrics_prv_minute_handler(time_t utc_sec) { ActivityState *state = activity_private_state(); uint16_t cur_day_index = time_util_get_day(utc_sec); if (cur_day_index != state->cur_day_index) { // If we've just encounte...
activity_private_state()
; mutex_lock_recursive(state->mutex); { // Update stats used for computing the average if (hrm_event->bpm.bpm > 0) { // This should get reset about once a minute, so X minutes worth of samples means something // is terribly wrong. PBL_ASSERT(state->hr.num_samples <= ACTIVITY_MAX_HR_SAMPLES...
const char *title, const char *subtitle, GDrawCommandImage *icon) { // as measured from the design specs const int horizontal_inset = MENU_CELL_ROUND_UNFOCUSED_HORIZONTAL_INSET; const int top_inset = 2; GRe...
(&s_data->menu_layer, cell_index)
) { draw_cell = prv_draw_notification_cell_round_unselected; } #endif bool first_row = (cell_index->row == 0); // Test if there are any notifications in the list. if (first_row) { // Draw "Clear all" box and exit #if PBL_ROUND draw_cell(ctx, cell_layer, i18n_get("Clear All", data), NULL, NULL); #el...
{ PBL_ASSERTN(s_callback_list_semaphore); mutex_lock(s_callback_list_semaphore); bool rv = prv_regular_timer_is_scheduled(cb); mutex_unlock(s_callback_list_semaphore); return (rv); }
bool regular_timer_pending_deletion(RegularTimerInfo *cb) { return cb->pending_delete; } // ------------------------------------------------------------------------------------------ bool regular_timer_remove_callback(RegularTimerInfo* cb) { PBL_ASSERTN(s_callback_list_semaphore); bool timer_removed = false; ...
name_in, &platform_bits_in); prv_fire_writeback_timer(); cl_assert(id != BT_BONDING_ID_INVALID); // Delete the Pairing bt_persistent_storage_delete_bt_classic_pairing_by_id(id); // Try to read it back ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, ...
(id_out, id_1)
; cl_assert_equal_i(type_out, BtPersistBondingTypeBTClassic); ret = bt_persistent_storage_has_active_bt_classic_gateway_bonding(); cl_assert(ret); ret = bt_persistent_storage_has_active_ble_gateway_bonding(); cl_assert(!ret); // Store another BT Classic pairing BTDeviceAddress addr_2 = {.octets = {0x22,...
snprintf(dstbuf, 256, "There are %02d lights, %02d", 4, -4); cl_assert_equal_s(dstbuf, "There are 04 lights, -4"); // Space padded minimum character output snprintf(dstbuf, 256, "There are %2d lights, %2d", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, -4"); // Left-align, Space padded minimum cha...
(dstbuf, "zero1")
; // Minimum digits output (unspecified digits, acts as zero) snprintf(dstbuf, 256, "%.izero%.i", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.-3izero%.-3i", 0, 1); cl_assert_equal_s(dstbuf, "zero1"); // Minimum digits outp...
rt_equal_i(alarm_action->id, dummy_alarm_id); cl_assert_equal_i(alarm_action->type, TimelineItemActionTypeOpenWatchApp); const AttributeList *action_attr_list = &alarm_action->attr_list; const char *action_title = attribute_get_string(action_attr_list, AttributeIdTitle, NULL); cl_assert_equal_s(action_title, ...
cl_assert_equal_i(s_num_alarm_events_put, 2); cl_assert_equal_i(s_num_timeline_adds, 20); cl_assert_equal_i(s_num_timeline_removes, 12); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // First alarm goes off. Second one should be up s_current_hour = 10; s_current_minute ...
cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 6); cl_assert_equal_i(s_num_alarm_events_put, 6); cl_assert_equal_i(s_num_timeline_adds, 48); cl_assert_equal_i(s_num_timeline_removes, 36); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // First alarm goes o...
(scroll_layer, (GSize) { scroll_layer->layer.frame.size.w, new_height }); scroll_layer_set_content_offset(scroll_layer, offset, true /* animated */); animation_set_duration(property_animation_get_animation(scroll_layer->animation), SCROLL_ANIMATION_DURATION); } lay...
(POP_WINDOW_DELAY, prv_transcription_dialog_select_cb, transcription_dialog)
; } void transcription_dialog_update_text(TranscriptionDialog *transcription_dialog, char *buffer, uint16_t buffer_len) { Dialog *dialog = expandable_dialog_get_dialog((ExpandableDialog *)transcription_dialog); transcription_dialog->buffer_len = buffer_len; dialog_set_text_...
t * * 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 express or implied. * See the License for the specific language g...
(s_read_header_mbuf)
; s_read_header_mbuf = NULL; } mutex_unlock(s_read_lock); return result; } static void prv_send_service_discovery(void *context) { const uint16_t service_id = ReservedServiceManagement; const uint16_t attribute_id = ManagementServiceAttributeServiceDiscovery; if (s_reserved_read_mbuf) { // already ...
/* * 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...
spi_ll_slave_spi_disable(DIALOG_SPI)
; prv_disable_spi_clock(); stop_mode_enable(InhibitorBluetooth); } static bool prv_dma_handler(const SPISlavePort *slave, void *context) { bool should_context_switch = false; if (!s_dma_pending_transfer) { return should_context_switch; } s_dma_pending_transfer = false; // If the SPI frequency is set...
/* * 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(FrameBuffer))
; framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); } // Teardown void test_graphics_draw_stroke_precise_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } // Tests //////////////////////////////////// #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 30, 40...
TIN || PLATFORM_SILK [BatteryShutdownCharging] = { .enter = prv_shutdown } #else [BatteryShutdownCharging] = { .enter = prv_enter_shutdown_charging } #endif }; static BatteryUIStateID s_state = BatteryGood; static BatteryUIWarningLevel s_warning_points_index = -1; #if PLATFORM_SPALDING /* first warning for S4 is ...
{ const uint8_t count = ARRAY_LENGTH(ui_states[s_state].next_state); for (int i = 0; i < count; i++) { if (ui_states[s_state].next_state[i] == next_state) { return true; } } return false; }
static BatteryUIStateID prv_get_state(PreciseBatteryChargeState *state) { // TODO: Refactor? if (state->is_plugged) { // Don't use the PreciseBatteryChargeState definition of is_charging, as it maps to the // result of @see battery_charge_controller_thinks_we_are_charging instead of the actual // user...
em/logging.h" #include "util/units.h" #define REMINDER_DB_FILE_NAME "reminderdb" #define REMINDER_DB_MAX_SIZE KiBYTES(40) #define MAX_REMINDER_SIZE SETTINGS_VAL_MAX_LEN #define MAX_REMINDER_AGE (15 * SECONDS_PER_MINUTE) typedef struct { TimelineItemStorageFilterCallback filter_cb; time_t timestamp; const char *...
{ PBL_ASSERTN(reminder_out); ReminderInfo reminder_info = { .filter_cb = filter_cb, .timestamp = timestamp, .title = title, .reminder_out = reminder_out, .match = false }; timeline_item_storage_each(&s_storage, prv_timestamp_title_compare_func, &reminder_info); return reminder_info.matc...
static status_t prv_insert_reminder(const uint8_t *key, int key_len, const uint8_t *val, int val_len, bool mark_synced) { const SerializedTimelineItemHeader *hdr = (const SerializedTimelineItemHeader *)val; const bool has_reminded = hdr->common.reminded; status_t rv = timeli...
---------------------------------- bool alarm_can_schedule(void) { SettingsFile file; if (!prv_file_open_and_lock(&file)) { return false; } bool rv = false; for (int i = 0; i < MAX_CONFIGURED_ALARMS; ++i) { AlarmConfig config; if (!prv_alarm_get_config(&file, i, &config)) { rv = true; ...
/// A frequency option for alarms, i.e. the alarm would only go off one time ever. Respect /// capitalization! i18n_noop("Once"); break; case ALARM_KIND_CUSTOM: // TODO: Use selected days as the string alarm_day_text = all_caps ? /// A frequency option f...
return alarm_day_text; } void alarm_get_string_for_custom(bool scheduled_days[DAYS_PER_WEEK], char *alarm_day_text) { // 4 chars per day, 3 for letters and 1 for comma // max length = 7 days in a week * 4 chars per day = 28 static const char *day_strings[7] = { i18n_noop("Sun"), ...
rSuccess); // No crash etc, client still alive: cl_assert_equal_i(ppogatt_client_count(), 1); cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid), true); cl_assert_equal_i(fake_comm_session_close_call_count(), 0); } void test_ppogatt__ack_received_data(void) { test_ppogatt__open_session...
fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, sizeof(s_short_data_fragment))
, true); ppogatt_send_next(transport); prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment)); } // Ack the last one (sn == s_tx_window_size - 1), which will be interpreted as Ack'ing all // the packets befo...
ache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and ...
{ static const CompositorTransition s_impl = { .init = prv_transition_to_launcher_animation_init, .update = prv_transition_animation_update, }; return &s_impl; }
else { static const CompositorTransition s_impl = { .init = prv_transition_from_launcher_animation_init, .update = prv_transition_animation_update, }; return &s_impl; } }
n = MINUTES_PER_DAY, .type = TimelineItemTypePin, .layout = LayoutIdTest, .all_day = 1, }, }; cl_assert(timeline_add(&all_day_item)); Iterator iterator = {}; TimelineIterState state = {}; TimelineNode *head = NULL; cl_assert_equal_i(timeline_init(&head), S_SUCCESS); const time_t t...
(&iterator, &state, &head, TimelineIterDirectionFuture, time_21_00_march_1_pst)
, S_SUCCESS); // day 1 cl_assert(uuid_equal(&state.pin.header.id, &all_day_item.header.id)); cl_assert(uuid_equal(&state.node->id, &all_day_item.header.id)); cl_assert(state.node->all_day); cl_assert_equal_i(state.node->timestamp, midnight_march_2_pst); cl_assert_equal_i(state.node->duration, MINUTES_PER_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...
prompt_send_response( "name state pri fstk num stk_beg stk_ptr")
{ graphics_context_set_text_color(ctx, GColorWhite); } graphics_draw_text(ctx, text, font, bounds, GTextOverflowModeFill, GTextAlignmentCenter, NULL); } static void canvas_update_proc(Layer *layer, GContext* ctx) { AppData *data = window_get_user_data(s_window); GRect bounds = layer->...
{ init(); app_event_loop(); deinit(); }
const PebbleProcessMd* movable_line_get_app_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = s_main, .name = "Movable Line" }; return (const PebbleProcessMd*) &s_app_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...
{ free(fb); if (s_dest_bitmap) { gbitmap_destroy(s_dest_bitmap); } s_dest_bitmap = NULL; }
// Helpers ////////////////////// #define GRID_CELL_PADDING 5 typedef void (*RenderCallback)(GContext *ctx, SettingsContentSize content_size); static void prv_prepare_canvas_and_render_for_each_size(RenderCallback callback) { GContext *ctx = &s_ctx; const unsigned int num_columns = SettingsContentSizeCount; ...
/* * 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...
{ int diff = *p1 - *p2; if (diff) { return diff; } p1++; p2++; }
return 0; }
gap_le_connection_add(&event->peer_address, remote_irk, local_is_master)
; // Cache the BLE connection parameters connection->conn_params = *params; bool found_match = false; GAPLEConnectionIntent *intent = s_intents; while (intent) { GAPLEConnectionIntent *next = (GAPLEConnectionIntent *) intent->node.next; if (prv_intent_matches_connection(in...
/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 express or implied. * See the License for the specific language governing permissio...
(&s_aa_clipping_path_info)
; prv_reset(); } void test_graphics_gpath_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); gpath_destroy(s_house_path); gpath_destroy(s_bolt_path); gpath_destroy(s_duplicates_path); gpath_destroy(s_infinite_path); gpath_destroy(s_crossing_path); gpath_destroy(s_aa_clipping_path); } // tests void test_grap...
cognizersTriggered) { if (!manager->triggered) { // Look for triggered recognizers in remaining recognizer lists prv_set_triggered(manager, prv_any_recognizers_active_triggered(manager)); } if (manager->triggered) { if (!new_active_layer_is_ancestor) { p...
(recognizer)
; if (recognizer->manager != manager) { // Registered with a different manager return; } recognizer_cancel(recognizer); Recognizer *triggered = recognizer_has_triggered(recognizer) ? recognizer : NULL; prv_cleanup_state_change(manager, triggered); recognizer_reset(recognizer); recognizer_set_ma...
/* * 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...
{ // This function follows the steps listed in Erratum 2.1.4 "Wakeup sequence from Standby mode..." // to avoid a situation where the watch cannot wake up // or immediately wakes up after going into standby. // The erratum says all used wakeup sources need to be disabled before // reenabling the required one...
static void prv_enable_wake_on_usb(void) { // Use the RTC timestamp alternate function to trigger a wakeup from the VUSB interrupt // We don't clear all the wakeup flags here as said in // 4.3.6 "Safe RTC alternate function wakeup flag clearing sequence", because // prv_clear_wakeup_flags already cleared them...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_context_set_fill_color(&ctx, GColorFromHEX(0x55aaff))
; graphics_context_set_antialiased(&ctx, true); graphics_fill_rect(&ctx, &ctx.dest_bitmap.bounds); GDrawCommandImage *l = weather_app_resource_create_sun(); gdraw_command_image_draw(&ctx, l, GPoint(0, 0)); int32_t dt = ANIMATION_NORMALIZED_MAX / 5; int32_t t = 0; l = weather_app_resource_create_sun(); ...
/* * 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...
fake_GAPAPI_init()
n/analytics/analytics.h" #include "services/common/i18n/i18n.h" #include "services/normal/activity/activity_insights.h" #include "services/normal/blob_db/api.h" #include "services/normal/blob_db/pin_db.h" #include "services/normal/blob_db/reminder_db.h" #include "services/normal/notifications/notification_storage.h" #i...
{ break; }
if (!current->all_day && (current->timestamp >= today_midnight)) { show = !show; break; } current = (TimelineNode *)current->node.next; } return show; } static TimelineNode *prv_find_first_past(TimelineNode *head, time_t timestamp, time_t today_midnight, bool show_all_day_events) { Tim...
/* * 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(0b00011111, BITS(4))
; cl_assert_equal_i(0b00111111, BITS_BETWEEN(0, 5)); cl_assert_equal_i(0b00111000, BITS_BETWEEN(3, 5)); cl_assert_equal_i(0b00010000, BITS_BETWEEN(4, 4)); } // Flash memory is organized into twelve sectors of unequal sizes. // Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB. // The remaining sectors are 128 KiB. // ...
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 "shell/shell.h" #include "apps/system_app_ids.h" #include "kernel/pbl_malloc.h" #include "...
prv_get_health_compositor_animation(CompositorTransitionDirectionUp)
; goto done; } } else if ((current_app_id == APP_ID_HEALTH_APP) && app_install_get_entry_for_install_id(next_app_id, app_entry) && app_install_entry_is_watchface(app_entry)) { res = prv_get_health_compositor_animation(CompositorTransitionDirectionDown); goto d...
pairing_2.irk, sizeof(irk_out)); cl_assert_equal_m(&device_out, &pairing_2.identity, sizeof(device_out)); // Update first pairing (with the same data) BTBondingID id_X = bt_persistent_storage_store_ble_pairing(&pairing_1, true /* is_gateway */, NULL, ...
{ bool ret; // Output variables SMIdentityResolvingKey irk_out; // Store a pairing SMPairingInfo pairing = (SMPairingInfo) { .irk = (SMIdentityResolvingKey) { .data = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, }...
void test_bluetooth_persistent_storage__delete_ble_pairing_by_id(void) { bool ret; // Output variables SMIdentityResolvingKey irk_out; BTDeviceInternal device_out; // Store a pairing SMPairingInfo pairing = (SMPairingInfo) { .irk = (SMIdentityResolvingKey) { .data = { 0x01, 0x02, 0x03...
/* * 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...
registry_private_init(&s_factory_registry)
; registry_private_read_from_flash(&s_factory_registry); } int factory_registry_add(const char* key, const uint8_t key_length, const uint8_t* uuid, const uint8_t description, const uint8_t* value, uint8_t value_length) { return registry_private_add(key, key_length, uuid, description, value...
/window_private.h" #include "resource/resource.h" #include "resource/resource_ids.auto.h" #include "services/normal/timeline/timeline_resources.h" #include "shell/system_theme.h" #include "util/buffer.h" #include "util/graphics.h" #include "util/hash.h" #include "util/math.h" #include "util/size.h" #include "clar.h" ...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } static void prv_render_long_strings_test(bool is_current_location) { const WeatherLocationForecast forecast = { .location_name = "QWERTYUIO ASEDDFFGHHJ", .is_current_location = is_current_location, .current_temp = 68, .today_high = 68, .today_low = 58, .current_weather_type =...
ce QEMU_UART_DEVICE = { .state = &s_qemu_uart_state, // GPIO? Where we're going, we don't need GPIO. (connected to QEMU) .periph = USART2, .irq_channel = USART2_IRQn, .irq_priority = 13, .rcc_apb_periph = RCC_APB1Periph_USART2 }; UARTDevice * const QEMU_UART = &QEMU_UART_DEVICE; IRQ_MAP(USART2, uart_irq_han...
voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY)
; }
PBL_LOG(LOG_LEVEL_WARNING, "Adding attribute with type uint8 for non-uint8_t attribute"); } prv_add_attribute(list, id)->uint8 = uint8; } void attribute_list_add_string_list(AttributeList *list, AttributeId id, StringList *string_list) { PBL_ASSERTN(prv_attribute_type(id) == AttributeTypeStringList); prv_add_...
(prv_attribute_type(id) == AttributeTypeUint32List)
; Attribute *attribute = attribute_find(attr_list, id); return attribute ? attribute->uint32_list : NULL; }
#include "syscall/syscall_internal.h" #include "system/hexdump.h" #include "system/passert.h" #include "util/attributes.h" #include "util/math.h" #include "util/size.h" #include "FreeRTOS.h" #include "queue.h" #include <stddef.h> #define HRM_DEBUG 0 #if HRM_DEBUG #define HRM_LOG(fmt, ...) \ do { \ PBL_LOG(LOG...
analytics_inc(ANALYTICS_DEVICE_METRIC_HRM_ACCEL_DATA_MISSING, AnalyticsClient_System)
; num_new_samples = MAX_BUFFERED_SAMPLES - s_manager_state.accel_data.num_samples; } void *write_ptr = &s_manager_state.accel_data.data[s_manager_state.accel_data.num_samples]; memcpy(write_ptr, s_manager_state.accel_manager_buffer, num_new_samples * sizeof(AccelRawData)); s_manager_state.accel_data.num_s...
---------------------"); float avg_pct_err = pct_err_sum / ARRAY_LENGTH(tests); printf("\nAVERAGE PCT ERROR: %.2f", avg_pct_err); // Check the overall percent error cl_assert(avg_pct_err < 10); } // -------------------------------------------------------------------------------------------- // Advance throug...
(false /*test_mode*/)
const jerry_value_t this_val, const jerry_value_t args_p[], jerry_size_t args_count) { if (!jerry_value_is_function(func_obj_val)) { return TYPE_ERROR_ARG; } return (jerry_value_t)EM_ASM_INT({ var f...
({ __jerryRefs.setNativeHandle($0, $1, $2); }, obj_val, handle_p, freecb_p)
; } void emscripten_call_jerry_object_free_callback(jerry_object_free_callback_t freecb_p, uintptr_t handle_p) { if (freecb_p) { freecb_p(handle_p); } } //////////////////////////////////////////////////////////////////////////////// // Error flag manipulation f...
ODE_UNDIRECTED); if (rv != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_adv_start: status = 0x%x", rv); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Adverts (re)started"); } return rv; } static ble_error_t prv_advert_disable(void) { ble_error_t rv = ble_gap_adv_stop(); if (rv != BLE_STATUS_OK) { PB...
{ bool cb_executed = false; prv_lock(); { switch (s_adv_state) { // States where we can immediately transition to paused case AdvertState_Off: case AdvertState_Paused: s_adv_state = AdvertState_Paused; break; default: break; } if (s_adv_state != AdvertS...
void advert_init(void) { s_adv_state = AdvertState_Off; s_desired_host_adv_state = AdvertState_Off; s_desired_ad_data.needs_updating = false; s_desired_ad_data.ad_data.ad_data_length = 0; s_desired_ad_data.ad_data.scan_resp_data_length = 0; s_adv_mutex = mutex_create_recursive(); }
rsistBonding*Data structs can never shrink, only grow //! Stores data about a remote BT classic device typedef struct PACKED { BTDeviceAddress addr; SM128BitKey link_key; char name[BT_DEVICE_NAME_BUFFER_SIZE]; // These are the lowest bits of Remote.platform_bitfield_cache, which contain the OS type uint8_t p...
(ble_name)
== 0) ? NULL : &ble_name[0]; shared_prf_storage_store_ble_pairing_data( &pairing_info, ble_name_ptr, requires_address_pinning, flags); } } } //! Returns the size of the data read. If the buffer provided is too small then 0 is returned static int prv_file_get(const void *key, size_t key_len, void...
st_node, (Comparator) sorting_comparator, true); cl_assert(head == &bar2.list_node); head = list_sorted_add(head, &bar3.list_node, (Comparator) sorting_comparator, true); cl_assert(head == &bar2.list_node); cl_assert(list_get_tail(head) == &bar3.list_node); head = list_sorted_add(head, &bar1.list_node, (Com...
(list_concatenate(&f, NULL), &d)
; cl_assert_equal_p(list_concatenate(&d, NULL), &d); cl_assert_equal_p(list_concatenate(&a, &d), &a); cl_assert_equal_p(list_get_head(&e), &a); cl_assert_equal_p(list_get_tail(&b), &f); c.next = NULL; d.prev = NULL; cl_assert_equal_p(list_concatenate(&c, &f), &a); cl_assert_equal_p(list_get_head(&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...
{ return animation_h && animation_h == s_scheduled_animation; }