prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * 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...
rtc_get_time()
; struct tm local_tm; localtime_r(&now, &local_tm); //! Step / activity related data // Get the step totals for today and the past 6 days health_service_private_get_metric_history(HealthMetricStepCount, DAYS_PER_WEEK, health_data->step_data); // Update distance ...
ic inline bool prv_should_animate_casssette(void) { return music_get_playback_state() != MusicPlayStatePaused; } static Animation *prv_create_cassette_animation(MusicAppData *data) { const MusicAppSizeConfig *config = prv_config(); const GRect cassette_rect = prv_cassette_rect(); GPoint left_target = GPoint(-c...
(&s_frame_layer_implementation, &data->cassette_layer.layer, &origin, &cassette_rect)
/* * 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...
(timestamp, cookie, notify_if_missed)
; } void app_wakeup_cancel(WakeupId wakeup_id) { sys_wakeup_delete(wakeup_id); } void app_wakeup_cancel_all(void) { sys_wakeup_cancel_all_for_app(); } bool app_wakeup_get_launch_event(WakeupId *wakeup_id, int32_t *cookie) { WakeupInfo wakeup_info; sys_process_get_wakeup_info(&wakeup_info); //If the id is i...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gatt_client_op_cleanup(GAPLEClientApp)
; }
--------------------------------------------------------------- // Tests typedef struct { const char *title; AppTimerCallback callback; } TestEntry; static TestEntry s_test_entries[] = { { .title = "steps", .callback = prv_test_steps, }, { .title = "30m walk", .callback = prv_test_30_min_walk, ...
window_set_click_config_provider_with_context(data->window, click_config_provider, data)
/* * 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(sizeof(FrameBuffer))
; framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); } // Teardown void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } // Tests //////////////////////////////////// void inside_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); ...
r know. process_manager_put_kill_process_event(task, true); // Better to die in our sleep ... vTaskSuspend(NULL /* self */); // We don't expect someone to resume us. PBL_CROAK(""); } // --------------------------------------------------------------------------------------------- // Get the args for the cu...
if (!xQueueSend(context->to_process_event_queue, e, milliseconds_to_ticks(1000))) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to send event %u to app! Closing it!", e->type); // We could be called from a timer task callback, so post a kill event rather than call // process_manager_close_process directly. proces...
return true; } // ---------------------------------------------------------------------------------------------- uint32_t process_manager_process_events_waiting(PebbleTask task) { ProcessContext *context = prv_get_context_for_task(task); if (context->to_process_event_queue == 0) { PBL_LOG(LOG_LEVEL_WARNI...
pp_install_manager.h" #include "process_management/app_manager.h" #include "services/normal/accessory/smartstrap_attribute.h" #include "services/normal/accessory/smartstrap_comms.h" #include "services/normal/accessory/smartstrap_link_control.h" #include "services/normal/accessory/smartstrap_state.h" #include "syscall/s...
(GenericServiceTypeRead, service_id, attribute_id, NULL, s_reserved_read_mbuf, TIMEOUT_MS)
; if (result != SmartstrapResultOk) { mbuf_free(s_reserved_read_mbuf); s_reserved_read_mbuf = NULL; } PBL_LOG(LOG_LEVEL_DEBUG, "Sent service discovery message (result=%d)", result); } static void prv_set_connected(bool connected) { s_has_done_service_discovery = false; } static bool prv_handle_managem...
0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the Lic...
(s_flush_addr, 0x20)
; cl_assert_equal_i(s_flush_size, 0x08); cl_assert_equal_i(s_invalidate_addr, 0x20); cl_assert_equal_i(s_invalidate_size, 0x08); cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Invalid); } void test_cpu_cache__userspace_ignore(void) { cl_will_return(icache_is_enabled, true); cl_will_return(dcache_is_enab...
uint32_t copy_address; uint32_t length; } send_data_cmd_payload = { .copy_address = address, .length = data_len }; dialog_spi_transmit_data((uint8_t *)&send_data_cmd_payload, sizeof(send_data_cmd_payload)); dialog_spi_wait_for_int(); dialog_spi_start_cmd(); uint32_t expected_crc = CRC32_I...
(data_buf)
; return success; } static bool prv_transfer_main_image(void) { // TODO: Would be nice to just leverage memory mapping to avoid the double // copy in the future // Get the basic info about the image we are going to transfer uint32_t image_size = resource_size(SYSTEM_APP, RESOURCE_ID_BT_FW_IMAGE); ObjectBi...
onst AttributeList *attr_list, size_t num_down_clicks) { PBL_ASSERTN(attr_list); TimelineItem item = (TimelineItem) { .header = (CommonTimelineItemHeader) { .layout = layout_id, .type = TimelineItemTypePin, }, .attr_list = *attr_list, }; TimelinePinWindow ...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE_X(details2)))
; #endif }
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 "clar.h" #include "test_jerry_port_common.h" #include "test_rocky_common.h" #include "applib/rockyjs/api/rocky_api_g...
cl_assert_equal_b(false, rocky_global_has_event_handlers("bar"))
; cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_global__can_unsubsribe_event_handlers(void) { static const RockyGlobalAPI api = { .add_handler = prv_api_add, .remove_handler = prv_api_remove, }; static const RockyGlobalAPI *apis[] = { &api, NULL, }; rocky_global_init(a...
48, 1128, 112}, { -24, 1184, 264}, { -216, 1192, 224}, { -16, 1200, 24}, { 16, 880, 16}, { -64, 984, 128}, { 32, 856, 72}, { 128, 696, 32}, { 136, 704, 32}, { 152, 712, 48}, { 216, 992, 72}, { 184, 968, 80}, { 256, 1008, 160}, { 160, 1256, 128}, { 80, 1184, 296},...
{ 176, 536, -112}, { 216, 792, -8}, { 152, 1040, 64}, { 128, 984, 176}, { -48, 1064, 152}, { 72, 1456, 272}, { -368, 1544, 328}, { -80, 1232, 280}, { -40, 952, 288}, { -8, 744, 240}, { 24, 632, 208}, { 104, 632, 128}, { 80, 680, 240}, { 32, 816, 232}, { 136, 9...
{ -112, 1248, 352}, { -216, 1208, 312}, { -104, 1080, 24}, { -96, 808, 144}, // 86 seconds { -80, 968, 96}, { 48, 760, 72}, { 128, 736, 0}, { 160, 704, 16}, { 184, 792, 24}, { 216, 840, 160}, { 256, 1320, -40}, { 184, 1192, 160}, { -64, 1056, 312}, { 48, 1448...
/* * 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...
fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)
); // Get the size of the heap from the beginning of the first thing allocated unsigned long heap_size = 0x20020000 - (unsigned long)start; unsigned long alloc_size = 0.75*heap_size; char *buf = app_malloc_check(alloc_size); snprintf(buf, 80, "%luB/%luB\n\nJust allocated %lu%% of the app heap.", alloc_size,...
a(void) { #if SCREEN_COLOR_DEPTH_BITS == 8 GContext ctx; test_graphics_context_init(&ctx, fb); // Big circles setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, STROKE_BIG); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "s...
(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerBottomRight)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_bottom_right.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL); graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCorner...
/* * 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_zalloc_check(sizeof(*watchfaces_glance))
; // Copy the name of the Watchfaces app as the title const size_t title_size = sizeof(watchfaces_glance->title); strncpy(watchfaces_glance->title, node->name, title_size); watchfaces_glance->title[title_size - 1] = '\0'; // Create the icon for the Watchfaces app watchfaces_glance->icon = kino_reel_create...
/ancs_util.h" #include "util/buffer.h" #include "clar.h" #include <string.h> // Stubs /////////////////////////////////////////////////////////// #include "stubs_analytics.h" #include "stubs_ble.h" #include "stubs_bt_stack.h" #include "stubs_logging.h" #include "stubs_serial.h" #include "stubs_passert.h" #include...
cl_assert(!error)
; ANCSAttribute *attr_ptrs[NUM_FETCHED_NOTIF_ATTRIBUTES]; const GetNotificationAttributesMsg *msg = (const GetNotificationAttributesMsg*) b->data; const size_t attributes_length = b->bytes_written - sizeof(*msg); cl_assert(ancs_util_get_attr_ptrs(msg->attributes_data, attributes_length, s_fetched_notif_attr...
= flash_dump_log_file(log_gen, prv_flash_log_line_dump, prv_flash_log_dump_completed_cb); cl_assert(success); while (!s_completed) { fake_system_task_callbacks_invoke_pending(); } cl_assert(s_completed_success); cl_assert_equal_i(s_msg.num_processed, s_msg.num_items)...
snprintf(log, 100, "Generation 0x%x", i - gen)
drivers/spi.h" #include "kernel/util/delay.h" #include "kernel/util/sleep.h" #include "system/logging.h" #include "system/passert.h" #include "util/math.h" #include "util/units.h" #define STM32F2_COMPATIBLE #define STM32F4_COMPATIBLE #include <mcu.h> #define BMA255_DEBUG 0 #if BMA255_DEBUG #define BMA255_DBG(msg, .....
(&time_s, &time_ms)
; return (((uint64_t)time_s) * 1000 + time_ms); } void bma255_set_scale(BMA255Scale scale) { uint8_t value = 0; switch (scale) { case BMA255Scale_2G: value = 0x3; break; case BMA255Scale_4G: value = 0x5; break; case BMA255Scale_8G: value = 0x8; break; case BMA2...
, .tomorrow_weather_type = WeatherType_CloudyDay, .tomorrow_high_temp = 70, .tomorrow_low_temp = 60, }, { .version = WEATHER_DB_CURRENT_VERSION, .is_current_location = false, .current_temp = -10, .current_weather_type = WeatherType_PartlyCloudy, .today_high_temp = 0, .today_low_t...
{ rtc_set_time(1461765790); // 2016-04-27T14:03:10+00:00 prv_initialize_entries(); }
void weather_shared_data_cleanup(void) { for (int i = 0; i < WEATHER_DATA_SHARED_WEATHER_DB_NUM_DB_ENTRIES; i++) { if (s_entries[i]) { task_free(s_entries[i]); s_entries[i] = NULL; } } // Flush DB cl_assert_equal_i(S_SUCCESS, weather_db_flush()); } const WeatherDBKey *weather_shared_dat...
0; } void test_rocky_api_util_args__boolean(void) { // No API to create NaN :( char *nan_script = "Number.NaN"; jerry_value_t nan = jerry_eval((jerry_char_t *)nan_script, strlen(nan_script), false /* is_strict */); struct { jerry_value_t inp...
cl_assert_equal_s(output, "")
; ASSERT_JS_ERROR(error_value, NULL /* Never errors out! */); } jerry_release_value(input); cases[i].input = 0; } } #define PP(_x, _y, _w, _h) { \ .origin.x.raw_value = (_x), \ .origin.y.raw_value = (_y), \ .size.w.raw_value = (_w), \ .size.h.raw_value = (_h), \ } void test_rocky_api_ut...
, so the setter and getter // must be typecast static const PropertyAnimationImplementation implementation = { .base = { .update = (AnimationUpdateImplementation) property_animation_update_fixed_s32_16, }, .accessors = { .setter = { .int16 = (const Int16Setter) prv_fixed_s32_16_setter }, ...
abs((int32_t)value - (int32_t)mid_value)
< 10); // End prv_advance_to_ms_with_timers(start_ms + duration + MIN_FRAME_INTERVAL_MS*2); cl_assert_equal_i(value, end_value); #endif } // -------------------------------------------------------------------------------------- // Test a basic gcolor8 property animation void test_animation__property_gcolor8(...
push.dictionary, s_expected_buffer, dict_length); PBL_LOG(LOG_LEVEL_DEBUG, "message->transaction_id = %"PRIu32, message->transaction_id); CommSession *session = s_fake_app_comm_session; app_message_app_protocol_msg_callback(session, buffer, message_length, NULL); } static void prv_receive_ack_nack_callback(uint...
(s_sent_data)
; s_sent_data = NULL; } void sys_get_app_uuid(Uuid *uuid) { cl_assert(uuid); *uuid = s_app_uuid; } static void (*s_process_manager_callback)(void *data); static void *s_process_manager_callback_data; void sys_current_process_schedule_callback(CallbackEventCallback async_cb, void *ctx) { // Expecting the stub ...
/* * 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...
(kino_reel_get_data_size(kino_reel), 192)
; } void test_kino_reel__resource_pdcs(void) { // Test loading PDCS Kino Reel uint32_t resource_id = sys_resource_load_file_as_resource( TEST_IMAGES_PATH, "test_kino_reel__resource_pdcs.pdc"); cl_assert(resource_id != UINT32_MAX); KinoReel *kino_reel = kino_reel_create_with_resource(resource_id); cl_a...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(transcription, transcription_attr->length)
; if (!valid) { PBL_LOG(LOG_LEVEL_WARNING, "Unrecognized transcription format received"); voice_handle_dictation_result(VoiceEndpointResultFailInvalidRecognizerResponse, msg->session_id, NULL, app_initiated, app_uuid); } voice_handle_dictation_result(msg->result, msg->se...
ing -= 2, buffer += 2) { uint16_t buffer_word; memcpy(&buffer_word, buffer, sizeof buffer_word); *flash_write_dest++ = buffer_word; } // Handle trailing byte if present. This will be present if we started out // aligned and we wrote an odd number of bytes or if we started out unaligned // and wrote...
{ break; }
expire_s, HRMFeature_BPM, prv_fake_hrm_1_cb, NULL); fake_system_task_callbacks_invoke_pending(); HRMSessionRef session_ref_2 = hrm_manager_subscribe_with_callback(INSTALL_ID_INVALID, 1, ...
{ // Make sure there will be unaligned data const uint16_t buf_size = sizeof(PebbleHRMEvent) * 2 + sizeof(PebbleHRMEvent) / 2; uint8_t buffer[buf_size]; CircularBuffer cb; circular_buffer_init(&cb, buffer, buf_size); PebbleHRMEvent event[NUM_TEST_EVENTS] = { { .event_type = HRMEvent_BPM, .bpm = { .bpm...
#undef NUM_TEST_EVENTS // Test the enable and disable functionality across subscriptions void test_hrm_manager__enable_disable(void) { // 1. Disabling and then enabling with no subscriber should leave the HRM off hrm_manager_enable(false); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_b(hrm_is_...
const bool take_ownership = true; KinoReel *kino_reel = kino_reel_unfold_create( from_reel, take_ownership, layer_frame, 0, UNFOLD_DEFAULT_NUM_DELAY_GROUPS, UNFOLD_DEFAULT_GROUP_DELAY); kino_reel_transform_set_from_frame(kino_reel, icon_from); kino_reel_transform_set_to_frame(kino_reel, icon_to); ki...
(kino_reel, target)
; const int16_t expand = 10; kino_reel_scale_segmented_set_deflate_effect(kino_reel, expand); const int16_t bounce = 20; kino_reel_scale_segmented_set_bounce_effect(kino_reel, bounce); if (to_reel) { kino_reel_transform_set_to_reel(kino_reel, to_reel, take_ownership); } if (prv_is_dot_size(icon_to.si...
{ printf("\nTesting if compute stats is equal to live stats...\n"); SettingsFile file; const uint32_t max_used_space = 4096; cl_must_pass(settings_file_open(&file, "test_file_max_storage", max_used_space)); uint8_t key[5]; int key_len = 4; uint8_t val[5]; int val_len = 4; for (int i = 0; i < 100; i++)...
snprintf((char *)key, sizeof(key), "k%03d", i)
; snprintf((char *)val, sizeof(val), "v%03d", i); printf("Iteration %d val %s\n", i, val); set_and_verify(&file, key, key_len, val, val_len); } // Then, write to the same key many many times. This should only use up 16 // more bytes of the file if our used/free space tracking is working // correctl...
/* * 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 (needs_reset) { prv_click_reset(recognizer); }
return true; } else { return false; } } inline static bool prv_is_hold_to_repeat_enabled(ClickRecognizer *recognizer) { return (recognizer->config.click.repeat_interval_ms >= 30); } inline static bool prv_is_multi_click_enabled(ClickRecognizer *recognizer) { return (recognizer->config.multi_click.ha...
->mutex); { state->hr.num_samples = 0; state->hr.num_quality_samples = 0; memset(state->hr.samples, 0, sizeof(state->hr.samples)); memset(state->hr.weights, 0, sizeof(state->hr.weights)); state->hr.metrics.previous_median_bpm = 0; state->hr.metrics.previous_median_total_weight_x100 = 0; } ...
if (new_index >= 0 && new_index < ACTIVITY_HISTORY_DAYS) { new_history.values[new_index] = old_history.values[i]; }
} // init the time stamp if not initialized yet if (new_history.utc_sec == 0) { new_history.utc_sec = utc_now; } // Init current value *m_info.value_p = new_history.values[0]; // Only write to flash if the values change or this is a new day (to update the timestamp) ...
ications; } // Mask out the unsupported type bits: *subscription_type &= supported; return (*subscription_type != BLESubscriptionNone); } // ------------------------------------------------------------------------------------------------- static void prv_remove_subscription(GAPLEConnection *connection, ...
if (ret_val != BTErrnoOK) { // Write failed, bail out! if (did_create_new_subscription) { // Clean up... prv_remove_subscription(connection, subscription); } else { // ... or restore previous state: subscription->subscriptions[client] = previous_type; } retu...
}}; char name_2[BT_DEVICE_NAME_BUFFER_SIZE] = "Device 2"; uint8_t platform_bits_2 = 0x22; BTBondingID id_2 = bt_persistent_storage_store_bt_classic_pairing(&addr_2, &link_key_2, name_2, &platform_bits_2); cl_assert(id_2 != BT_BONDING_ID_INVALID); cl_...
(id_3, &addr_out, &link_key_out, name_out, &platform_bits_out)
; cl_assert(ret); cl_assert_equal_m(&addr_3, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&link_key_3, &link_key_out, sizeof(link_key_out)); cl_assert_equal_s(name_3, name_out); cl_assert_equal_i(platform_bits_3, platform_bits_out); // Add a fourth pairing BTDeviceAddress addr_4 = {{0x41, 0x42, 0x43, ...
void *i18n_owner, void *unused) { SportsAppData *data = app_state_get_user_data(); switch (type) { case WorkoutMetricType_Hr: { snprintf(buffer, buffer_size, "%d", data->current_bpm); break; } case WorkoutMetricType_Speed: case WorkoutMetricType_Pace: { ...
(1 /* interval_s */)
----------------------------------------------------------------------------- // Generates the sleep enter/exit time and total time strings static void prv_generate_sleep_pin_strings(int32_t sleep_enter_seconds, int32_t sleep_exit_seconds, ...
("%s - %s", &pin_attr_list)
; /// "10:00AM - 11:00PM" clock_copy_time_string_timestamp(start_time, TIME_STRING_TIME_LENGTH, session->start_utc); clock_copy_time_string_timestamp(end_time, TIME_STRING_TIME_LENGTH, session->start_utc + duration_s); snprintf(time_range, max_attr_length, time_range_fmt, start_...
ecma_free_unused_memory(JMEM_FREE_UNUSED_MEMORY_SEVERITY_HIGH, 0, true); jmem_pools_collect_empty(); } static void prv_memorypressure_app_log(const char *level, const jmem_heap_stats_t *stats) { APP_LOG(LOG_LEVEL_WARNING, "Memory pressure level: %s", level); APP_LOG(LOG_LEVEL_WARNING, "heap size: %zu, ...
if (!prv_is_headroom_allocated(ctx)) { prv_allocate_headroom_or_die(ctx); }
return true; } return false; } const RockyGlobalAPI MEMORY_APIS = { .init = prv_init, .deinit = prv_deinit, .add_handler = prv_add_handler, };
/* * 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(num_ids, 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...
{ return RTC_ReadBackupRegister(BOOTLOADER_VERSION_REGISTER); }
{ // Take and hold for a long time: xSemaphoreTake(put_bytes_get_semaphore(), portMAX_DELAY); fake_queue_set_yield_callback(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 PutBy...
assert_nack_count(0)
; cl_assert_equal_i(EXPECTED_COOKIE, put_bytes_get_index()); } void test_put_bytes__init_watch_app_okay_while_not_in_fw_update_mode(void) { s_firmware_update_is_in_progress = false; prv_receive_init_cookie(VALID_OBJECT_SIZE, ObjectWatchApp, EXPECTED_COOKIE); assert_ack_count(1); assert_nack_count(0); cl_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
periph_config_enable(VREF_ADC, VREF_ADC_CLOCK)
; if (!same_adc) { periph_config_enable(device->adc, device->clock_ctrl); } ADC_TempSensorVrefintCmd(ENABLE); // Common configuration (applicable for all ADCs) ADC_CommonInitTypeDef ADC_CommonInitStruct; ADC_CommonStructInit(&ADC_CommonInitStruct); // Single ADC mode ADC_CommonInitStruct.ADC_Mode =...
dstbuf, "There are 4 lights, the absolute value of 4294967292"); // Minimum digits output snprintf(dstbuf, 256, "There are %.2u lights, %.2u", 4, -4); cl_assert_equal_s(dstbuf, "There are 04 lights, 4294967292"); // Minimum digits output (zero digits) snprintf(dstbuf, 256, "%.0uzero%.0u", 0, 1); cl_assert...
snprintf(dstbuf, 256, "%#.ozero", 0)
call(argc, argv, prv_draw_rect_impl); } JERRY_FUNCTION(prv_clear_rect) { GContext *const ctx = rocky_api_graphics_get_gcontext(); const GColor prev_color = ctx->draw_state.fill_color; ctx->draw_state.fill_color = GColorBlack; JS_VAR result = prv_rect_call(argc, argv, graphics_fill_rect); ctx->draw_state.fill...
list_remove(&head->node, (ListNode **)&s_canvas_context_2d_stored_states, NULL)
; task_free(head); } return jerry_create_undefined(); } JERRY_FUNCTION(prv_canvas_rendering_context_2d_constructor) { JS_VAR canvas = rocky_create_with_constructor(ROCKY_CANVAS_CONSTRUCTOR, /* no args: */ NULL, 0); jerry_set_object_field(this_val, ROC...
// metric HealthMetricHeartRateRawBPM if the user wants the most recent reading. HealthValue value; sys_activity_get_metric(ActivityMetricHeartRateFilteredUpdatedTimeUTC, 1, &value); const time_t hr_median_age = now_utc - value; if (hr_median_age >= HS_MAX_AGE_HR_SAMPLE) { return ...
prv_compute_aggregate_averaged_using_daily_totals(state, metric, time_start, time_end, aggregation, scope)
; } #endif } // ---------------------------------------------------------------------------------------------- bool health_service_events_subscribe(HealthEventHandler handler, void *context) { #if !CAPABILITY_HAS_HEALTH_TRACKING return false; #else HealthServiceState *state = prv_get_state(true); if (!state) ...
ops--; } // This should return a NULL context now if the animation got destroyed cl_assert(animation_get_context(h) == NULL); // Make sure no animations exist cl_assert_equal_i(prv_count_animations(), 0); #endif } // -------------------------------------------------------------------------------------- //...
prv_count_handler_entries(&s_setup_handler_calls, h)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, h), 1); // Make sure the frame reached the "to" state cl_assert_equal_i(prv_last_update_distance(h), ANIMATION_NORMALIZED_MAX); // This should return NULL now if the animation got destroyed cl_assert(animation_private_animation_fin...
n"); bool have_hit_old_value = false; bool have_hit_new_value = false; bool have_hit_end = false; for (int i = 1; i < 50; i++) { printf("Iteration %3d... ", i); RecordResult result = write_and_change_record_aborting_after_bytes(i); switch (result) { case RecordResultOld: have_hit_old_v...
{ printf("\nTesting if we can use each and stop early at %d iterations...\n", STOPPING_NUM); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_each", 4096)); uint8_t key[5]; int key_len = 4; uint8_t val[5]; int val_len = 4; for (int i = 0; i < 255; i++) { snprintf((char *)key, s...
void test_settings_file__in_place(void) { printf("Testing that we can update a setting file in place\n"); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_in_place", 4096)); uint8_t key[4]; int key_len = sizeof(key) - 1; memcpy(key, "key", sizeof(key)); uint8_t val[4] = {0x11, 0x22...
se { if (transfer->direction == I2CTransferDirection_Read) { transfer->state = I2CTransferState_ReadData; } else { transfer->state = I2CTransferState_WriteData; } } } static void prv_enable_interrupts(I2CBus *bus) { bus->hal->i2c->CR1 |= I2C_CR1_ERRIE | // Enable error interrupt ...
{ i2c->TXDR = transfer->data[transfer->idx++]; }
if ((i2c->ISR & I2C_ISR_NACKF) != 0) { i2c->ICR |= I2C_ICR_NACKCF; return i2c_handle_transfer_event(bus, I2CTransferEvent_NackReceived); } if ((i2c->ISR & I2C_ISR_TCR) != 0) { prv_resume_transfer(bus, false /* !generate_start */); } if ((i2c->ISR & I2C_ISR_TC) != 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...
(buf, address, length)
, { -1392, 512, -176}, { -1344, 608, -240}, { -1192, 544, -192}, { -1088, 488, -168}, { -832, 416, -136}, { -536, 440, -168}, { -432, 376, -88}, { -464, 352, -8}, // 34 seconds { -496, 272, 72}, { -520, 240, 112}, { -568, 264, 104}, { -672, 312, 64}, { -976, 328, ...
{ -504, 384, -136}, { -768, 376, -80}, { -776, 440, -128}, { -824, 440, -56}, { -1080, 624, -224}, { -1000, 472, 24}, { -1400, 560, -184}, { -1384, 672, -200}, { -1464, 416, 0}, { -1272, 400, 40}, { -944, 408, 56}, { -584, 440, -32}, { -528, 384, 16}, { -552, 272,...
{ -1016, 520, -240}, { -1016, 1064, -296}, { -616, -8, 272}, { -528, 376, -104}, { -576, 480, 8}, // 42 seconds { -488, 216, 112}, { -472, 232, 104}, { -496, 232, 96}, { -544, 280, 80}, { -888, 320, 72}, { -1048, 376, 0}, { -1328, 320, 48}, { -1512, 376, -128}, ...
(slave->slave_state->dma_state == SPISlavePortDMAState_Idle); slave->slave_state->dma_state = SPISlavePortDMAState_Write; slave->slave_state->dma_complete_handler = handler; slave->slave_state->dma_complete_context = context; prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqTx, true); dma_request_start_direct(sla...
gpio_output_init(&clk_as_gpio, GPIO_OType_PP, GPIO_Speed_50MHz)
compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eit...
(&completed_attr_list)
; attribute_list_destroy_list(&postpone_attr_list); attribute_list_destroy_list(&remove_attr_list); timeline_item_destroy(item); } static void prv_push_success_dialog(void) { SimpleDialog *simple_dialog = simple_dialog_create("Reminder Added"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); dial...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (s_app_logging_mode == AppLoggingDisabled) { return; }
// Then log to the app logging endpoint (if we have enough stack space) uint32_t stack_space = stack_free_bytes(); if (stack_space > MIN_STACK_FOR_SEND_DATA) { CommSession *session = comm_session_get_system_session(); if (session) { comm_session_send_data(session, APP_LOGGING_ENDPOINT, (uint8_t*)l...
xecute_command(char* cmd, size_t cmd_len, PromptContext *context) { if (!cmd_len) { // Empty command. s_executing_command = ExecutingCommandNone; return; } s_current_context = context; bool command_found = false; for (unsigned int i = 0; i < NUM_PROMPT_COMMANDS; ++i) { const Command *cmd_ite...
(s_current_context)
e = BTPairingUIStateAwaitingUserConfirmation; s_data_ptr = data; } static void prv_handle_confirmation_request(const PairingUserConfirmationCtx *ctx, PebbleBluetoothPairingConfirmationInfo *info) { prv_create_new_pairing_data(); s_data_ptr->ctx = ctx; strncpy(s_dat...
{ // events.c clean-up (see event_deinit) can only clean up one associated heap allocation, // so put everything in a single buffer: size_t device_name_len = device_name ? (strlen(device_name) + 1) : 0; size_t token_len = confirmation_token ? (strlen(confirmation_token) + 1) : 0; size_t info_len = (sizeof(Peb...
void bt_driver_cb_pairing_confirm_handle_completed(const PairingUserConfirmationCtx *ctx, bool success) { PebbleBluetoothPairEvent pair_event = { .type = PebbleBluetoothPairEventTypePairingComplete, .ctx = ctx, .success = success, }; prv_put_pairin...
r_id); LOG("payload_sender_version: major: %"PRIu32", minor: %"PRIu32", patch: %s", s_parsed_msg.payload_sender_v_major, s_parsed_msg.payload_sender_v_minor, s_parsed_msg.payload_sender_version_patch); LOG("payload_send_time: %"PRIu32"", s_parsed_msg.payload_send_time); LOG("MeasurementSet:"); c...
{ const pebble_pipeline_ActivitySession *session = &event->activity_session; LOG(" Activity Type: %d, Start Reason: %d", session->type.type.internal_type, session->start_reason); // TODO: Add more detailed logging }
} } return &s_parsed_msg; } // --------------------------------------------------------------------------------------------- static void prv_assert_msg_equal(TestPLParsedMsg *a, TestPLParsedMsg *b) { // Payload Specific cl_assert_equal_s(a->payload_sender_type, b->payload_sender_type); cl_assert_equal_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_current_reconnect_type()
; if (cur_type == prev_type) { return; } if (cur_type != ReconnectType_None) { prv_unschedule_adv_if_needed(); #if CAPABILITY_HAS_BUILTIN_HRM const bool use_hrm_payload = (cur_type == ReconnectType_BleHrm); #else const bool use_hrm_payload = false; #endif BLEAdData *ad; if (use_hrm_payl...
break; } PBL_ASSERTN(last != ANALYTICS_METRIC_INVALID); return analytics_metric_offset(last) + analytics_metric_size(last); } ///////////////////// // Private static bool prv_verify_kinds_match(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric) { AnalyticsMetricKind metric_kind = analytics_metric_kind(metr...
{ uint8_t *location = prv_heartbeat_get_array_location(heartbeat, metric, 0); uint32_t size = analytics_metric_size(metric); memcpy(location, data, size); }
/* * 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...
(LOG_LEVEL_DEBUG, "ERROR: Unknown Test Case Selected")
; break; } text_layer_set_text(&data->status_text_layer, data->status_text); } static void test_window_load(Window *window) { struct FlashTestData *data = app_state_get_user_data(); window_set_background_color(window, GColorBlack); TextLayer *msg_text_layer = &data->msg_text_layer[0]; text_layer_i...
{ -48, 1024, -32}, { -48, 1056, -48}, { -88, 1016, 0}, { -104, 1008, 40}, { -120, 1008, 48}, { -96, 912, -72}, { -72, 800, -120}, { -48, 976, -144}, { -88, 1000, -72}, { -112, 1024, 24}, { -64, 912, 16}, { -96, 1112, -56}, { -64, 1048, -176}, { -80, 912, -184}, ...
{ 440, 440, -456}, { 440, 520, -544}, { 432, 552, -616}, { 376, 608, -520}, { 392, 696, -640}, { 400, 880, -568}, // 8 seconds { 488, 1000, -552}, { 552, 1056, -488}, { 752, 912, -488}, { 744, 832, -344}, { 568, 1072, -376}, { 352, 1064, -224}, { 144, 984, -136}, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_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); s_command_list_index = 0; // Offer a more than a full sector range, needs subsectors on both sides flash_region_erase_optimal_range(60 * 1024, 60 * 1024, ((2 * 64) + 4) * 1024, ((2 * 64) + ...
DISP_COLS * 0.5, DISP_ROWS }, { DISP_COLS * 0.8, DISP_ROWS }, }, PATH_INTERP_DEF_BL_CORNER, }, .quad_verts = { // TR: M,0 -> M,52 (0.31) { { DISP_COLS, 0 }, { DISP_COLS, DISP_ROWS * 0.31 }, }, // TL: 0,0 -> 0,30 (0.18) { { 0, ...
GPoint(0, -current_offset_px)
: GPoint(-current_offset_px, 0); // Make sure the undrawn areas are the shutter color graphics_context_set_fill_color(ctx, s_data.sampled_color); graphics_fill_rect(ctx, &DISP_FRAME); bitblt_bitmap_into_bitmap(&sys_bitmap, &app_bitmap, point, GCompOpAssign, GColorWhite); ...
verride(void) { AnimationPrivate *animation = prv_animation_get_current(); if (animation && animation->curve == AnimationCurveCustomInterpolationFunction) { return animation->custom_interpolation_function; } return NULL; } // ---------------------------------------------------------------------------------...
{ AnimationPrivate *animation_a = (AnimationPrivate *)a; AnimationPrivate *animation_b = (AnimationPrivate *)b; return serial_distance32(animation_a->abs_start_time_ms, animation_b->abs_start_time_ms); }
// ------------------------------------------------------------------------------------------- inline static uint32_t prv_get_ms_since_system_start(void) { return ((sys_get_ticks() * 1000 + RTC_TICKS_HZ / 2) / RTC_TICKS_HZ); } // -----------------------------------------------------------------------------------...
ense for the specific language governing permissions and * limitations under the License. */ #include "syscall/syscall_internal.h" #include "applib/bluetooth/ble_client.h" #include "comm/ble/gap_le.h" #include "comm/ble/gap_le_advert.h" #include "comm/ble/gap_le_connection.h" #include "comm/ble/gap_le_connect.h" #...
{ syscall_assert_userspace_buffer(value_length_in_out, sizeof(*value_length_in_out)); syscall_assert_userspace_buffer(value_out, *value_length_in_out); }
gatt_client_consume_read_response(object_ref, value_out, *value_length_in_out, GAPLEClientApp); } DEFINE_SYSCALL(bool, sys_ble_client_consume_notification, uintptr_t *object_ref_out, ui...
/* * 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...
(timep, result)
; } // i18n dummies //////////////////////////////////// static bool s_i18n_translate = false; static bool s_i18n_locale_other = false; char *i18n_get_locale(void) { if (s_i18n_locale_other) { return "es_ES"; } else { return "en_US"; } } char *app_get_system_locale(void) { return "es_ES"; } const cha...
.addr_type = PRIVATE_STATIC_ADDRESS }; memcpy(&own_addr.addr, addr, sizeof(own_addr.addr)); e = ble_gap_address_set(&own_addr, 0); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_address_set: %u", e); } #endif e = ble_gap_mtu_size_set(ATT_MAX_SUPPORTED_MTU); if (e != BLE_STATUS_OK) {...
ble_service_handle_event(hdr)
> *m_info.value_p) { *m_info.value_p = value; current_value_updated = true; } else if (m_info.value_u32p && (uint32_t)value > *m_info.value_u32p) { *m_info.value_u32p = value; current_value_updated = true; } } else if (m_info.has_history) { // This update is for a day in the past. ...
{ ActivityState *state = activity_private_state(); mutex_lock_recursive(state->mutex); { state->step_data.distance_meters = ROUND(state->distance_mm, MM_PER_METER); ACTIVITY_LOG_DEBUG("new distance: %"PRIu16"", state->step_data.distance_meters); ...
// -------------------------------------------------------------------------------------------- // Called periodically from the minute handler to update step derived metrics that do not have to // be updated in real time. // We use NOINLINE to reduce the stack requirements during the minute handler (see PBL-38130) s...
le_each(prv_any_pinned_ble_pairings_itr, &has_pinned_ble_pairings); return has_pinned_ble_pairings; } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Shared PRF Storage static void prv_load_pinned_address_from_prf(void) { BTDeviceAddress pinned_address; ...
shared_prf_storage_get_ble_pairing_data(&prf_pairing_info, device_name, &requires_address_pinning, &flags)
) { // No pairing available, check to see if we have a pairing in the gapDB prv_push_bt_persist_to_shared_prf(BtPersistBondingTypeBLE); return; } // PRF pairing storage has only one pairing slot. Assume is_gateway: bt_persistent_storage_store_ble_pairing(&prf_pairing_info, true /* is_gateway */, devi...
prv_handle_notification_removed(id); break; case NotificationActedUpon: prv_handle_notification_acted_upon(id); break; default: break; // Not implemented } menu_layer_reload_data(&s_data->menu_layer); prv_update_text_layer_visibility(s_data); } /...
app_state_get_user_data()
; #if PBL_ROUND status_bar_layer_deinit(&data->status_bar_layer); #endif menu_layer_deinit(&data->menu_layer); event_service_client_unsubscribe(&data->notification_event_info); prv_loaded_notification_list_deinit(data->loaded_notification_list); prv_notification_list_deinit(data->notification_list); i18n_f...
erating_states); i++) { if (s_operating_states[i].enabled) { // use MIN because sample rate enum value is actually the sampling interval in us sample_rate_max = MIN(sample_rate_max, s_operating_states[i].sample_interval); } } return (uint32_t)sample_rate_max; } // Determine the bit that flips w...
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; IMUCoordinateAxis axis = prv_get_axis_direction(int0_status, int2_status, ...
0}, { -792, 56, 112}, { -696, -152, 120}, { -768, -184, 112}, { -808, -80, 64}, { -1256, 136, 40}, { -1592, 256, 96}, { -1504, 616, -352}, { -1528, 384, -184}, { -1448, -72, 8}, { -1376, 104, -136}, { -1216, 312, -32}, { -1136, 328, 40}, // 65 seconds { -1032, 368...
{ -1968, 448, 176}, // 70 seconds { -1800, 200, 304}, { -1672, 424, 1072}, { -1432, 88, 176}, { -1160, 128, 136}, { -984, 128, 88}, { -904, -96, 80}, { -824, -608, 24}, { -848, -288, 0}, { -1176, -336, 88}, { -1656, 288, -288}, { -1832, 648, -376}, { -1784, 40, 24...
NVIC->ICPR[i] = 0xFFFFFFFF; } // Set the peripheral clock enable registers to their reset values as // specified in the reference manual. RCC->AHB1ENR = 0; RCC->AHB2ENR = 0; RCC->AHB3ENR = 0; RCC->APB1ENR = 0; RCC->APB2ENR = 0; // Reset most peripherals used by the bootloader. We want to minimi...
(BOOT_BIT_RESET_LOOP_DETECT_THREE)
<< 2) | (boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_TWO) << 1) | boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_ONE); switch (++counter) { case 1: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 2: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_...
he last event count regardless of whether we are paused wrkt_data->last_event_step_count = new_event_steps; wrkt_data->last_movement_event_time_ts = now_ts; } static void prv_handle_heart_rate_update(HealthEventHeartRateUpdateData *event) { CurrentWorkoutData *wrkt_data = s_workout_data.current_workout; if (e...
{ if (!workout_service_is_workout_ongoing()) { return; } // Handling this with an event because the timer needs to be called from KernelMain if (event->type == PebbleWorkoutEvent_FrontendOpened) { evented_timer_cancel(s_workout_data.current_workout->workout_abandoned_timer); } else if (event->type ==...
// --------------------------------------------------------------------------------------- void workout_service_init(void) { s_workout_data.s_workout_mutex = mutex_create_recursive(); } // --------------------------------------------------------------------------------------- // FIXME: We should probably handle th...
const AppMenuDataSource * const source) { AppMenuNode *node = source->list; while (node != NULL) { if (node->install_id == install_id) { return node; } else { node = (AppMenuNode*)list_get_next((ListNode*)node); } } return NULL; } //! @return True if there was app with i...
if (!node->icon && source->show_icons) { // If the icon is currently NULL and we should be showing icons, load the icon prv_load_list_item_icon(source, node); }
// Will return the icon if it exists, or NULL if one doesn't. return node->icon; } void app_menu_data_source_draw_row(AppMenuDataSource *source, GContext *ctx, Layer *cell_layer, MenuIndex *cell_index) { AppMenuNode *node = app_menu_data_source_get_node_at_index(source, cell_i...
.major = 1, .minor = 0, }, .sdk_version = { .major = 5, .minor = 13, }, .app_face_bg_color = {0}, .template_id = 0, .icon_resource_id = 0, }; // menu layer static const uint32_t menu_layer_size = (1140 + 7852); static const AppDBEntry menu_layer = { .name = MENU_LAYER_APP_NAME, .uuid = {0x...
cl_assert_equal_i(INSTALL_ID_INVALID, app_install_get_id_for_uuid(&(const Uuid)UUID_SYSTEM))
te_history_stats(const ActivityInsightMetricHistoryStats *stats, const ActivityInsightSettings *insight_settings) { // Make sure we have enough history if ((stats->total_days < insight_settings->reward.min_days_data) || (stats->consecutive_days < insight_settings->reward...
("You like sleep, don't you? " "Get fun stats on your sleep and start waking " "up less groggy with Pebble Health.", &notif_attr_list)
; prv_build_notification_attr_list(&notif_attr_list, body, TIMELINE_RESOURCE_ACTIVITY, ActivityInsightType_Day4, ActivitySessionType_None); AttributeList dismiss_action_attr_list = {0}; attribute_list_add_cstring(&dismiss_action_attr_list, AttributeIdTitle, ...
2, 1702, 168, 0}, { 0, 0x42, 7069, 224, 0}, { 0, 0x43, 7012, 149, 0}, { 0, 0x42, 5072, 157, 0}, // 660: Local time: 2016-05-20 08:07:00 AM { 13, 0x42, 5721, 159, 0}, { 0, 0x33, 5436, 155, 0}, { 0, 0x52, 2228, 191, 0}, { 0, 0x42, 5251, 187, 0}, { 0, 0x44, 4134, 188, 0}, { 0, 0x31,...
ARRAY_LENGTH(samples)
; return samples; }
PBL_LOG(LOG_LEVEL_ERROR, "Error fetching metric data"); return false; } // Store in cache if we have space for it. if (state->cache && (metric == HealthMetricStepCount)) { memcpy(&state->cache->steps_daily, daily, sizeof(*daily)); state->cache->step_daily_valid = true; } return true; } // ---...
memcpy(averages, &state->cache->step_averages, sizeof(*averages))
; return true; } // Fetch the intraday averages, if available if (state->cache && (metric == HealthMetricStepCount)) { // Fill the cache if this is step count sys_activity_get_step_averages(day_in_week, &state->cache->step_averages); state->cache->step_averages_day = day_in_week; state->cache...
orClearARGB8, gcolor_get_grayscale(GColorClear).argb); cl_assert_equal_i(GColorWhiteARGB8, gcolor_get_grayscale(GColorWhite).argb); cl_assert_equal_i(GColorBlackARGB8, gcolor_get_grayscale(GColorBlack).argb); cl_assert_equal_i(GColorLightGrayARGB8, gcolor_get_grayscale(GColorLightGray).argb); cl_assert_equal_i(...
gcolor_perform_lookup_using_color_luminance_and_multiply_alpha(src_color, lookup_table)
, expected_result_color)); cl_assert(gcolor_equal(gcolor_tint_using_luminance_and_multiply_alpha(src_color, tint_color), expected_result_color)); } void test_graphics_colors__tint_using_luminance_and_perform_lookup_using_color_luminance(void) { // Passing in NULL for lookup_table sho...
AM__[]; extern char __WORKER_RAM_end__[]; bool process_manager_is_address_in_region(PebbleTask task, const void *address, const void *lower_bound) { void *ram_start = NULL, *ram_end = NULL; if (task == PebbleTask_App) { ram_start = __APP_RAM__; ram_end = __APP_RAM_...
pebble_task_get_current()
; if (task != PebbleTask_App && task != PebbleTask_Worker) { return false; } const ProcessAppSDKType sdk_type = process_metadata_get_app_sdk_type(sys_process_manager_get_current_process_md()); return sdk_type == ProcessAppSDKType_Legacy3x; } DEFINE_SYSCALL(Version, sys_get_current_process_sdk_versi...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_get_action_compositor_animation(CompositorTransitionDirectionLeft)
; goto done; } } if (next_app_id == APP_ID_LAUNCHER_MENU) { res = prv_app_launcher_transition_animation(CompositorTransitionDirectionLeft); goto done; } // If we get here, we don't use a compositor animation for the transition done: kernel_free(app_entry); return res; } const Composito...
andler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // Just before A completes prv_advance_to_ms_with_timers(start_ms + duration_a - 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(pr...
prv_last_update_distance(b)
, ANIMATION_NORMALIZED_MIN); #endif } // -------------------------------------------------------------------------------------- // Test a sequence within a sequence where the imbedded one has a play count of 0 void test_animation__nested_sequence_with_0_play_count(void) { #ifdef TEST_INCLUDE_COMPLEX const int dura...
ted_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_st...
prv_count_handler_entries(&s_update_handler_calls, b)
, 0); // A should start out low distance = prv_last_update_distance(a); cl_assert(distance < TEST_ANIMATION_NORMALIZED_LOW); // Execute to the start of B prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls,...
scall.h" #include "services/normal/wakeup.h" #include "services/common/event_service.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/settings/settings_file.h" #include "process_management/app_install_manager.h" #include "util/attributes.h" #include "clar.h" // Fakes //////////////////////////...
wakeup_init()
; WakeupEntryV2 wakeup_entry_v2; open_settings_file(&file); cl_must_pass(settings_file_exists(&file, (uint8_t*)&wakeup_id, sizeof(wakeup_id))); cl_assert_equal_i(settings_file_get_len(&file, (uint8_t*)&wakeup_id, sizeof(wakeup_id)), sizeof(WakeupEntryV2)); cl_must_pass(settings_file_get(&file, (uint8...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(timer != TIMER_INVALID_ID)
; new_timer_start(timer, timeout, prv_ui_update_reset_delay_timer_callback, NULL, 0); } //! Note: For now we just call into storage directly for the status of FW installs. Someday, //! it would be nice for this exchange to take place as part of PutBytes extern bool pb_storage_get_status(PutBytesObjectType obj_type, ...
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, }, }, .identity = (BTDeviceInternal) { .address = (BTDeviceAddress) { .octets = { 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, }, }, .is_classic = false, .is_random_address = false, }, .is_...
(s_ble_bonding_change_delete_count, 1)
edule_enabled(WeekdaySchedule) == true); cl_assert(do_not_disturb_is_smart_dnd_enabled() == false); active = do_not_disturb_is_active(); cl_assert(active == true); // !Manual && Scheduled && !Smart do_not_disturb_set_manually_enabled(false); cl_assert(do_not_disturb_is_active() == false); do_not_disturb...
cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == true)
; active = do_not_disturb_is_active(); cl_assert(active == true); // ON due to manual only do_not_disturb_set_manually_enabled(false); cl_assert(do_not_disturb_is_manually_enabled() == false); active = do_not_disturb_is_active(); cl_assert(active == false); // Both OFF do_not_disturb_set_manually_enable...
/* * 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...
(ctx, data->spinner_color)
; graphics_context_set_stroke_color(ctx, GColorBlack); graphics_fill_circle(ctx, circle1_location, radius_of_spinner_circles); graphics_draw_circle(ctx, circle1_location, radius_of_spinner_circles); graphics_fill_circle(ctx, circle2_location, radius_of_spinner_circles); graphics_draw_circle(ctx, circle2_locat...
ck_pop(window_stack, true); cl_assert_equal_i(window_stack_count(window_stack), 0); window_destroy(window); } void test_window_stack__basic_window_pop(void) { Window *window1 = window_create(); Window *window2 = window_create(); // Switch to app state to push windows to the Application window stack stub...
app_window_stack_pop(true)
; cl_assert_equal_i(app_window_stack_count(), 0); cl_assert_equal_i(window2->on_screen, false); window_destroy(window1); window_destroy(window2); } // Description: // During the push of a window, we push another window in the load handler of // the window being pushed. This causes the loading window to disa...
d prv_compositor_flush(void) { PBL_ASSERT_TASK(PebbleTask_KernelMain); // Stop the framebuffer_prepare performance timer. This timer was started when the client // first posted the render event to the system. compositor_display_update(prv_handle_display_update_complete); } static void prv_send_did_focus_event...
compositor_render_modal()
; } prv_compositor_flush(); } static void prv_animation_update(Animation *animation, const AnimationProgress distance_normalized) { PBL_ASSERT_TASK(PebbleTask_KernelMain); // Since we might be running this animation update as part of a deferred render, we must // update the ...
CKMARK_ICON_BLACK); data->current_checkmark_icon_resource_id = RESOURCE_ID_CHECKMARK_ICON_BLACK; app_window_stack_push(&data->custom_day_picker_window, true); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Time Picker static void prv_time_picker_window_un...
if (selection == AlarmType_Smart && !activity_prefs_tracking_is_enabled()) { // Notify about Health and keep the menu open health_tracking_ui_feature_show_disabled(); return; }
#endif if (data->creating_alarm) { app_window_stack_push(&data->time_picker_window.window, true); } else { alarm_set_smart(data->alarm_id, (data->alarm_type == AlarmType_Smart)); app_window_stack_remove(&option_menu->window, true); } } static void prv_setup_type_menu_window(AlarmEditorData *data) {...
/* * 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...
(LOG_LEVEL_INFO, "Notification modified: %s", uuid_string)
ate->test_entry = (ActivityFileTestEntry) { .samples = state->samples, .version = 1, .activity_type = {-1, -1, -1}, .len = {-1, -1, -1}, .start_at = {-1, -1, -1}, .weight = 1.0, .force_shut_down_at = -1, }; char line_buf[256]; while (true) { char *line = fgets(line_buf, sizeof(lin...
PBL_ASSERTN(state->test_entry.num_samples < SLEEP_SAMPLES_DISCOVERY_MAX_SAMPLES)
; state->samples[state->test_entry.num_samples++] = (AlgMinuteFileSample) { .v5_fields = { .steps = steps, .orientation = orientation, .vmc = vmc, .light = light, .plugged_in = plugged_in, }, }; continue; } // End of a sample ...
/* * 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, "Debug seek failed: %d", status); kernel_free(contents); return NULL; }
int actual_read_size = pfs_read(iter->fd, contents, read_size); PBL_LOG(LOG_LEVEL_INFO, "Read %d (expected %d) bytes of file %s (size %d), around offset %d.", actual_read_size, read_size, iter->file_name, file_size, pos); return contents; } static NORETURN fatal_logic_error(SettingsRawIter *...
/* * 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...
(button_id)
; dbgserial_putstr("is stuck!"); result = true; } } if (button_counter_register != 0) { dbgserial_print("Button was pushed on boot. Button counter: "); dbgserial_print_hex(button_counter_register); dbgserial_newline(); } RTC_WriteBackupRegister(STUCK_BUTTON_REGISTER, button_counter...
ver items[4] cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id)); cl_assert(iter_prev(&iterator)); cl_assert(!iter_prev(&iterator)); cl_assert(state.node); timeline_iter_deinit(&iterator, &state, &head); } void test_timeline__delete_last_items(void) { Iter...
(&head, &multiday_item.header.id)
); } void test_timeline__all_day_single_day(void) { const time_t midnight_march_3_utc = 1425340800; TimelineItem all_day_item = { .header = { .id = { 0x29, 0xac, 0xd8, 0xb5, 0x09, 0xc7, 0x4c, 0x31, 0xbf, 0x6f, 0x03, 0x64, 0xd0, 0x5b, 0x9b, 0xc2 }, .timestamp = midnight_march_3_utc, ...
sk_callbacks_invoke_pending(); cl_assert(prv_get_subscriber_state_from_ref(session_ref) == NULL); cl_assert_equal_b(hrm_is_enabled(HRM), false); } // When we cleanup after an app process, its subscription, if any, should get an expriration time // placed on it void test_hrm_manager__app_cleanup(void) { stub_pebb...
(s_num_cb_events_1, 3)
; cl_assert_equal_i(s_cb_events_1[1].event_type, HRMEvent_SubscriptionExpiring); cl_assert_equal_i(s_cb_events_1[2].event_type, HRMEvent_BPM); // Now advance time to past expiration time rtc_set_time(rtc_get_time() + expire_s + 1); // Send more data, the subscription should go away now prv_fake_send_new_...
text app_message_close(); // Make fake remote send the ack if something has been sent (not expected) prv_process_sent_data(); // Test that timer has been invalidated cl_assert_equal_b(!fake_app_timer_is_scheduled(app_message_ack_timer_id()), true); cl_assert_equal_b(s_ack_sent_is_called, false); cl_ass...
(app_message_open(0, MAX_SIZE_OUTBOUND), APP_MSG_OK)
; cl_assert_equal_b(app_message_is_closed_inbound(), true); cl_assert_equal_b(app_message_is_closed_outbound(), false); } void test_app_message__zero_outbox(void) { app_message_close(); cl_assert_equal_i(app_message_open(MAX_SIZE_INBOUND, 0), APP_MSG_OK); cl_assert_equal_b(app_message_is_closed_inbound(), fa...
"prefs_db.h" #include "reminder_db.h" #include "watch_app_prefs_db.h" #include "weather_db.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "system/logging.h" typedef struct { BlobDBInitImpl init; BlobDBInsertImpl insert; BlobDBGetLenImpl get_len; BlobDBReadImpl read; BlobDBDeleteImpl ...
memcpy(key_bytes, key, key_len)
; } PebbleEvent e = { .type = PEBBLE_BLOBDB_EVENT, .blob_db = { .db_id = db_id, .type = type, .key = key_bytes, .key_len = (uint8_t)key_len, } }; event_put(&e); } void blob_db_init_dbs(void) { const BlobDB *db = s_blob_dbs; for (int i = 0; i < NumBlobDBs; ++i, ++db) { ...
er, void *context) { DisplayCalibrationData *data = context; if (data->state == DisplayCalibrationState_Confirm) { // set a new user offset shell_prefs_set_display_offset(data->offset); analytics_inc(ANALYTICS_DEVICE_METRIC_DISPLAY_OFFSET_MODIFIED_COUNT, AnalyticsClient_System); window_stack_remove(...
(&data->arrow_right, RESOURCE_ID_ARROW_RIGHT)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_log_state_mutex, 1000)
; if (!success) { dbgserial_putstr("kernel_applib_get_log_state timeout error"); goto exit_fail; } } // Return if re-entered (logging while logging). This can happen for example if one task // grabbed the context from an ISR or critical section and another grabbed it using the mutex if (sys...
s->missed_apps_count++] = app_install_get_id_for_uuid(&entry.uuid); } // Deletes the entry automatically if not written } } void wakeup_init(void) { struct prv_missed_events_s missed_events = { 0, NULL }; s_mutex = mutex_create(); event_service_init(PEBBLE_WAKEUP_EVENT, NULL, NULL); // C...
settings_file_close(&wakeup_settings)
; } } mutex_unlock(s_mutex); return entry; } DEFINE_SYSCALL(void, sys_wakeup_delete, WakeupId wakeup_id) { WakeupEntry entry = prv_wakeup_settings_get_entry(wakeup_id); // Only allow owner to delete its own wakeup events if (uuid_equal(&app_manager_get_current_app_md()->uuid, &entry.uuid)) { if (...