prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
p_Max | StatsBasicOp_Count | StatsBasicOp_Consecutive | StatsBasicOp_ConsecutiveFirst | StatsBasicOp_Median); struct { int32_t sum; int32_t avg; int32_t min; int32_t max; int32_t count; int32_t max_streak; int32_t first_streak; int32_t median; } result; stats_calc...
for (size_t i = 0; i < ARRAY_LENGTH(test_cases); i++) { int32_t w_median = stats_calculate_weighted_median(test_cases[i].values, test_cases[i].weights, test_cases[i].num_values); printf("W_Median test c...
}
izontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_origin_even_clip"))); // Clipping on odd boundaries - no offset setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_ODD, ORIGIN_RECT_NO_CLIP, false, 1); for (int16_...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_EVEN, OFFSET_RECT_EVEN, false, 1)
; for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_even_offset_even_clip"))); // Clipping on odd boundaries - no offset setup_test_aa...
e; static bool s_is_transacting __RETAINED; static CircularBuffer s_tx_buffer __RETAINED; static CircularBuffer s_rx_buffer __RETAINED; static uint8_t s_tx_storage[HOST_TRANSPORT_CTLR_TX_BUFFER_SIZE] __RETAINED; static uint8_t s_rx_storage[HOST_TRANSPORT_CTLR_RX_BUFFER_SIZE] __RETAINED; static void prv_lock(void) { ...
(HOST_SPI->mcu_int.port, HOST_SPI->mcu_int.pin, HW_GPIO_MODE_OUTPUT, HOST_SPI->mcu_int.function, false /* is_high */)
; } static void prv_do_blocking_spi_transfer(spi_device dev, spi_transfer_data *transfer) { ad_spi_complex_transact(dev, transfer, 1, host_transport_set_mcu_int); } static bool prv_transact(spi_device dev) { const uint8_t *tx_bytes = NULL; prv_lock(); uint16_t tx_bytes_available = circular_buffer_get_read_sp...
tware * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <stdint.h> #include <string.h> #include "console/...
(*new_baud)
; }
/* * 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 (id < 1) { *entry = (ResourceStoreEntry){0}; return; } mutex_lock_recursive(s_resource_mutex); ListNode *node; if (app_num == SYSTEM_APP && (node = list_find((ListNode *)s_resource_list, prv_resource_filter, (void *)(uintptr_t)id))) { mutex_unlock_recursive(s_resource_mutex); *entr...
//! initialize components needed for one apps resources bool resource_init_app(ResAppNum app_num, const ResourceVersion *expected_version) { // resource_id is ignored in this case, so we set it to 0 mutex_lock_recursive(s_resource_mutex); bool rv = resource_storage_check(app_num, 0, expected_version); mutex_u...
time_t timestamp, const ANCSAttribute *title, uint32_t uid, const ANCSAttribute *attr_action_neg) { if (!pstring_equal_cstring(&app_id->pstr, IOS_REMINDERS_APP...
if (timestamp < (now - MAXIMUM_NOTIFY_TIME) && timestamp != INVALID_TIME) { PBL_LOG(LOG_LEVEL_INFO, "Not presenting stale notif (ts=%ld)", timestamp); return true; }
0x0}, { 0, 0x1e, 0, 0x0}, { 0, 0x1e, 0, 0x0}, { 0, 0x1e, 0, 0x0}, { 0, 0x1e, 0, 0x0}, { 0, 0x1e, 0, 0x0}, { 0, 0x1e, 0, 0x0}, // 255: Local time: 11:45:00 PM { 0, 0x1e, 0, 0x0}, { 0, 0x1e, 0, 0x0}, { 0, 0x1e, 0, 0x0}, { 0, 0x1e, 0, 0x0}, { 0, 0x1e, 0, 0x0}, ...
{ 0, 0x73, 0, 0x0}, { 0, 0x73, 0, 0x0}, { 0, 0x73, 0, 0x0}, { 0, 0x73, 0, 0x0}, { 0, 0x73, 0, 0x0}, { 0, 0x73, 0, 0x0}, { 0, 0x73, 0, 0x0}, // 375: Local time: 01:47:00 AM { 0, 0x73, 0, 0x0}, { 0, 0x73, 0, 0x0}, { 0, 0x73, 0, 0x0}, { 0, 0x73, 0, 0x0}, { 0,...
{ 0, 0x8d, 0, 0x0}, { 0, 0x8d, 10, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, // 435: Local time: 02:47:00 AM { 0, 0x8c, 0, 0x0}, { 0, 0x8c, 0, 0x0}, { ...
void prv_dls_endpoint_handle_nack(uint8_t session_id) { PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Received NACK for id: %"PRIu8, session_id); DataLoggingSession *logging_session = dls_list_find_by_session_id(session_id); if (!logging_session) { PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_WARNING...
((ListNode *)(*head_ptr), &entry->list_node)
; return true; } static void prv_handle_report_cmd(const uint8_t *session_ids, size_t num_sessions) { for (size_t i = 0; i < num_sessions; ++i) { const uint8_t session_id = session_ids[i]; DataLoggingSession *logging_session = dls_list_find_by_session_id(session_id); PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING...
/* * 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(out_error)
; *out_error = false; const uint8_t* iter = data; if (length < sizeof(ANCSAttribute)) { PBL_LOG(LOG_LEVEL_INFO, "ANCS data length is too small. Length: %d, sizeof(ANCSAttribute): %d", (int)length, (int)sizeof(ANCSAttribute)); *out_error = true; ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_m(array, sorted, sizeof(array))
i(BITS_BETWEEN(0, 4), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_full_flash(void) { cl_assert(system_flash_erase(FLASH_BASE, 1024 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 7), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_sector_0(void) { c...
{ cl_assert_(!flash_locked, "Attempted to write to a locked flash"); cl_assert_(address >= flash_data_start && address < flash_data_start + flash_data_length, "Address out of range"); cl_assert_(flash_written_flag[address - flash_data_start] == false, "Overwriting an already...
extern void dbgserial_print(char *str) { fprintf(stderr, "%s", str); } extern void dbgserial_print_hex(uint32_t num) { fprintf(stderr, "0x%.08x", num); } extern void dbgserial_putstr(char *str) { fprintf(stderr, "%s\n", str); }
------------------------------------------------------------------------------ bool activity_get_metric_typical(ActivityMetric metric, DayInWeek day, int32_t *value_out) { *value_out = 0; return health_db_get_typical_value(metric, day, value_out); } // --------------------------------------------------------------...
MIN(ACTIVITY_ALGORITHM_MAX_SAMPLES, num_samples)
; // Allocate space for the samples uint16_t req_size = sizeof(ActivityFeedSamples) + chunk_size * sizeof(AccelRawData); ActivityFeedSamples *context = kernel_malloc(req_size); if (!context) { PBL_LOG(LOG_LEVEL_ERROR, "Not enough memory"); return false; } context->num_samples = chu...
// Nothing to cancel return; } if (recognizer->impl->cancel(recognizer)) { recognizer->subscriber.event(recognizer, RecognizerEvent_Cancelled); } prv_set_state(recognizer, RecognizerState_Cancelled); } void recognizer_set_failed(Recognizer *recognizer) { PBL_ASSERTN(recognizer); PBL_ASSERTN(r...
list_remove(&recognizer->node, &list->node, NULL)
; } //////////////////////////////////////////////////////////////////////////////////////////////////// // Recognizer list void recognizer_list_init(RecognizerList *list) { if (!list) { return; } *list = (RecognizerList){}; } bool recognizer_list_iterate(RecognizerList *list, RecognizerListIteratorCb iter...
s_higher_task_woken = pdFALSE; xSemaphoreGiveFromISR(s_spi_transport.semph, &was_higher_task_woken); *should_context_switch = (was_higher_task_woken != pdFALSE); } static void prv_handle_sending_footer_complete_isr(bool *should_context_switch) { s_spi_transport.state = SPITransportState_Idle; prv_lock(); cir...
PBL_LOG(LOG_LEVEL_DEBUG, "->IN:")
; PBL_HEXDUMP(LOG_LEVEL_DEBUG, (uint8_t *)&s_spi_transport.status_remote, sizeof(s_spi_transport.status_remote)); prv_trigger_core_dump_from_isr(); return; } if (s_spi_transport.status_remote.msg_id != SPITransportMsgID_Status) { // Unexpected msg ID... prv_trigger_core_dump_fro...
_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_x_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebu...
GPoint(p.x + 1, p.y + 2)
); graphics_draw_pixel(ctx, GPoint(p.x + 2, p.y + 2)); graphics_draw_pixel(ctx, GPoint(p.x + 3, p.y + 2)); graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y + 2)); graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y + 2)); graphics_draw_pixel(ctx, GPoint(p.x + 6, p.y + 2)); graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y ...
{ 664, -24, 56}, { 680, -56, 64}, { 784, -64, 40}, { 1032, -16, 40}, { 1408, -152, 184}, { 1688, -80, 408}, { 1528, 440, 24}, { 1216, 544, -240}, { 864, 240, 48}, { 672, 192, 88}, { 768, 288, 80}, { 816, 176, 240}, { 792, 280, 120}, { 720, 256, 104}, { 824, 3...
{ 832, 208, 232}, { 848, 296, 88}, { 912, 272, 48}, { 1176, 384, -72}, { 1256, 392, -48}, { 1944, 512, 16}, { 1512, 584, 24}, { 984, 296, -24}, { 1072, 184, 128}, { 1352, 48, -344}, { 896, 32, 160}, { 784, 64, 120}, { 800, 88, 120}, { 832, 40, 72}, { 824, -8, ...
buf, "04", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"M\": %s", buf); } r = strftime(buf, buf_size, "%p", &good_data); if (r == 0 || strncmp(buf, "AM", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"p\": %s", buf); } r = strftime(buf, buf_size, "%r", &good_data); if...
(buf, buf_size, "%u", &bad_data)
; strftime(buf, buf_size, "%U", &bad_data); strftime(buf, buf_size, "%V", &bad_data); strftime(buf, buf_size, "%w", &bad_data); strftime(buf, buf_size, "%W", &bad_data); strftime(buf, buf_size, "%x", &bad_data); strftime(buf, buf_size, "%X", &bad_data); strftime(buf, buf_size, "%y", &bad_data); ...
id *)(uintptr_t)metric); } static void prv_add_analytic_node(DialogAnalyticsMetric metric) { AnalyticsNode *node = kernel_malloc_check(sizeof(AnalyticsNode)); *node = (AnalyticsNode) { .metric = metric, }; s_analytics_list = list_prepend(s_analytics_list, (ListNode *)node); } // Stopwatch Node Functions ...
prv_lock()
; ListNode *iter = s_analytics_list; while (iter) { AnalyticsNode *node = (AnalyticsNode *)iter; cb(node->metric, node->value, context); iter = iter->next; } prv_unlock(); } // Unit Test Helpers uint32_t analytics_get_value(DialogAnalyticsMetric metric) { AnalyticsNode *node = prv_find_analytic...
/* * 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_list_find_string("Music", (void *)0xdeadbeef)
->translated_string == third); i18n_free_all((void *)0xdeadbeef); cl_assert(prv_list_find_string("Music", __FILE__) == NULL); // this should be a no-op i18n_free("Music", __FILE__); } void test_i18n__locale(void) { cl_assert(strcmp(i18n_get_locale(), "fr_FR") == 0); cl_assert_equal_i(i18n_get_version(), 24...
BUFFER_SIZE, s_writer)); cl_assert_equal_b(false, app_inbox_service_is_being_written_for_tag(AppInboxServiceTagUnitTest)); } void test_app_inbox__app_inbox_service_begin_already_being_written(void) { prv_create_test_inbox(); cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUni...
app_inbox_service_num_success_for_tag(AppInboxServiceTagUnitTest)
); cl_assert_equal_i(0, app_inbox_service_num_failed_for_tag(AppInboxServiceTagUnitTest)); prv_process_callback_events(); assert_message(0, s_test_data, BUFFER_SIZE); assert_num_message_callbacks(1); assert_num_dropped_callbacks(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...
prv_app_is_render_scheduled()
&& !*app_state_get_framebuffer_render_pending()) { prv_render_app(); } } static void prv_app_will_focus_handler(PebbleEvent *e, void *context) { Window *window = app_window_stack_get_top_window(); if (e->app_focus.in_focus) { if (window) { // Do not call 'appear' handler on window displacing...
test_timer, 31, prv_sleep_timer_test_cb, (void *)(uintptr_t)count, 0); } } // Attempts to check that the Dialog chip sleep mode is working correctly by forcing wakeups at // different times. (See PBL-39777). The timeouts delays may seem a little random but I found with // this combo of values I was able to hit the i...
(fb->buffer, 0xff, FRAMEBUFFER_SIZE_BYTES)
rv = prv_lock_mutex_and_open_file(); if (rv != S_SUCCESS) { return rv; } AppInstallId app_id = prv_find_install_id_for_uuid(&s_app_db.settings_file, uuid); prv_close_file_and_unlock_mutex(); return app_id; } /////////////////////////// // App DB API /////////////////////////// //! Fills an AppDBEntr...
PBL_LOG(LOG_LEVEL_WARNING, "Got an insert for an app that is currently being fetched, %"PRId32, app_id)
; rv = prv_cancel_app_fetch(app_id); } if (rv == S_SUCCESS) { rv = settings_file_set(&s_app_db.settings_file, (uint8_t *)&app_id, sizeof(AppInstallId), val, val_len); } prv_close_file_and_unlock_mutex(); if (rv == S_SUCCESS) { // app install something app_install_...
------------------------------ void workout_service_activity_event_handler(PebbleActivityEvent *event) { if (!workout_service_is_workout_ongoing()) { return; } if (event->type == PebbleActivityEvent_TrackingStopped) { workout_service_pause_workout(true); } } // ----------------------------------------...
if (workout_service_is_workout_ongoing()) { PBL_LOG(LOG_LEVEL_WARNING, "Only 1 workout at a time is supported"); rv = false; goto unlock; }
// Before starting this new session we need to deal with any in progress sessions uint32_t num_sessions = 0; ActivitySession *sessions = kernel_zalloc_check(sizeof(ActivitySession) * ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT); activity_get_sessions(&num_s...
STATE_WRITE_ADDRESS_RX: // Write the I2C device address again, but this time in read mode. bus->i2c->DR = bus->transfer.device_address | I2C_READ_WRITE_BIT; if (bus->transfer.size == 1) { // Last byte, we want to NACK this one to tell the slave to stop sending us bytes. bus->i2c->CR1 &...
(irq_event_handler(&i2c_buses[0]))
start, Fixed_S16_3 end) { if (quadrant & desired) { graphics_private_draw_vertical_line(ctx, x, start, end); } } inline void prv_hline_quadrant(GCornerMask quadrant, GCornerMask desired, GContext *ctx, int16_t y, Fixed_S16_3 start, Fixed_S16_3 end) { if (quadrant & desired) { ...
(ctx, p, radius, stroke_width, quadrant)
; } else { // Non-Antialiased and Stroke Width == 1 graphics_circle_quadrant_draw_1px_non_aa(ctx, p, radius, quadrant); } } T_STATIC void graphics_circle_draw_1px_non_aa(GContext* ctx, GPoint p, uint16_t radius) { graphics_circle_quadrant_draw_1px_non_aa(ctx, p, radius, GCornersAll); p.x += ctx->draw_...
= activity_prefs_get_height_mm(); uint16_t weight_dag = activity_prefs_get_weight_dag(); uint8_t age_years = activity_prefs_get_age_years(); snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "activity tracking: %"PRIu8"\n" "activity_insights: %"PRIu8"\n" "sleep_insigh...
(data->debug_card.dialog_text)
; } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_push_rewards(int index, void *context) { activity_insights_test_push_rewards(); } // ----------------------------------------------------------------------------------------- static void prv_...
(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(5)); cl_assert(timeline_model_iter_prev(&new_idx, NULL)); cl_assert_equal_i(new_idx, 2); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_...
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(1))
; cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(2)); } void test_timeline_model__graceful_delete_all(void) { TimelineModel model = {0}; model.direction = TimelineIterDirectionFuture; time_t first_time = 1421178000; // Note: 1421178000 = Tue Jan 13 11:40:00 PST ...
bool owns_userdata; } lookup; } ScaleSegmentedData; typedef struct { GPoint target; } DistanceLookupData; static GPointIndexLookup *prv_create_lookup_by_distance(GDelayCreatorContext *ctx, void *userdata) { ctx->owns_lookup = true; DistanceLookupData *data = userdata; return gdraw_command_list_create_i...
(reel, true)
; } else { prv_destructor(data); } return reel; } void kino_reel_scale_segmented_set_delay_lookup_creator( KinoReel *reel, GPointIndexLookupCreator creator, void *userdata, bool take_ownership) { ScaleSegmentedData *data = kino_reel_transform_get_context(reel); if (!data) { return; } if (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...
(data[i] >> 2)
; *out++ = prv_encode_char(((data[i] & 0x03) << 4) | (data[i + 1] >> 4)); *out++ = prv_encode_char(((data[i + 1] & 0x0F) << 2) | (data[i + 2] >> 6)); *out++ = prv_encode_char(data[i + 2] & 0x3F); } if (i < data_len) { if (i == data_len - 2) { // if 2 leftover bytes *out++ = prv_encode_c...
, // Version NOW, // Timestamp 3, // Number of zones 60, // Minutes in zone 1 30, // Minutes in zone 2 15, // Minutes in zone 3 }; // Tests //////////////////////////////////////////////////////////////// void test_health_db__blob_db_api(void) { ...
cl_assert_equal_i(s_metric_updated_count, NUM_CURRENT_HR_ZONE_METRICS)
; // check typicals (not stored) int32_t val_out; cl_assert(!health_db_get_typical_value(ActivityMetricHeartRateZone1Minutes, Monday, &val_out)); cl_assert(!health_db_get_typical_value(ActivityMetricHeartRateZone2Minutes, Monday, &val_out)); cl_assert(!health_db_get_typical_value(ActivityMetricHeartRateZone...
/* * 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...
(void, sys_profiler_print_stats, void)
{ profiler_print_stats(); } DEFINE_SYSCALL(void, sys_profiler_node_start, ProfilerNode *node) { if (PRIVILEGE_WAS_ELEVATED) { if (!list_contains(g_profiler.nodes, (ListNode *)node)) { // Instead of calling syscall_failed(), simply return. If PROFILE_INIT has not been // executed yet, there won't b...
4, 176, -64}, { 1200, 192, -48}, { 1208, 272, -56}, { 1024, 280, -72}, { 792, 256, -136}, { 664, 240, -104}, { 648, 192, -120}, { 728, 232, -96}, // 56 seconds { 824, 272, -192}, { 1056, 296, -224}, { 1232, 352, -312}, { 1112, 344, -320}, { 1072, 344, -272}, { 127...
{ 832, 200, 32}, { 872, 120, 0}, { 944, 80, 16}, { 880, 48, 8}, { 1016, 80, -64}, { 1136, 128, -48}, { 1072, 200, -96}, { 1120, 192, -128}, { 1296, 224, -112}, { 1288, 296, -120}, { 1128, 304, -152}, { 880, 264, -160}, { 712, 248, -120}, { 680, 240, -96}, { 75...
/* * 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...
QSPI_ComConfig_Init(&qspi_com_config)
; prv_wait_for_qspi_transfer_complete(QSPIFlag_ClearTC); prv_wait_for_qspi_not_busy(); } static void prv_flash_reset(void) { QSPI_ComConfig_InitTypeDef qspi_com_config; QSPI_ComConfig_StructInit(&qspi_com_config); qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Write; qspi_com_config...
2cBus *bus = &i2c_buses[bus_idx]; // Take control of bus; only one task may use bus at a time bus_lock(bus); if (bus->user_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "Attempted access to disabled bus %d by device %d", bus_idx, device_id); bus_unlock(bus); return false; } // If bus is busy (it shoul...
(device_id, i2c_device_address, register_address, 1, &value)
; } bool i2c_write_register_block(I2cDevice device_id, uint8_t i2c_device_address, uint8_t register_address_start, uint8_t write_size, const uint8_t* buffer) { // Do transfer locks the bus bool result = do_transfer(device_id, false, i2c_device_address, register_address_start, write_si...
prv_app_install_entry_from_fw_registry_entry(reg_entry, entry); break; case AppInstallStorageResources: rv = prv_app_install_entry_from_resource_registry_entry(reg_entry, entry); break; case AppInstallStorageInvalid: case AppInstallStorageFlash: PBL_LOG(LOG_LEVEL_DEBUG...
if (!md) { return; }
switch (md->process_storage) { case ProcessStorageBuiltin: break; case ProcessStorageFlash: case ProcessStorageResource: kernel_free((PebbleProcessMd*) md); } } static void prv_enumerate_app_db_delete(AppInstallId install_id, AppDBEntry *db_entry, void *data) { PBL_ASSERTN(app_install_id_from...
.utc_time_delta = 0, .gmt_offset_delta = 0, .dst_changed = true, } }; event_put(&e); s_dst_checker.cb_data = (void*)is_dst; } } void clock_init(void) { if (clock_is_timezone_set()) { TimezoneInfo tz_info; rtc_get_timezone(&tz_info); time_util_update_timezone(&tz_in...
if (timestamp < now || difference < SECONDS_PER_MINUTE) { i18n_get_with_buffer("Now", word_buffer, word_buffer_size); strncpy(number_buffer, "", number_buffer_size); } else if (difference <= SECONDS_PER_HOUR) { snprintf(number_buffer, number_buffer_size, "%ld", difference / SECONDS_PER_MINUTE); ...
} else { // past time_t difference = now - timestamp; if (now < timestamp || difference < SECONDS_PER_MINUTE) { i18n_get_with_buffer("Now", word_buffer, word_buffer_size); strncpy(number_buffer, "", number_buffer_size); } else { prv_copy_time_string_timestamp(number_buffer, number_buffe...
the 1.x apps do. struct PACKED VersionsPhoneResponseV2 { uint32_t pebble_library_version; uint32_t session_capabilities_bitfield; uint32_t platform_bitfield; uint8_t response_version; // Set to 2 in this format of the response. uint8_t major_version; // major version number of the mobile app, i.e. 2 ...
capability_flags = response->protocol_capabilities; } } comm_session_set_capabilities(session, capability_flags); const uint32_t platform_bits = ntohl(response->platform_bitfield); bt_driver_reconnect_notify_platform_bitfield(platform_bits); const bool is_system = comm_session_is_system(session); ...
void session_remote_version_protocol_msg_callback(CommSession *session_ref, const uint8_t *data, size_t length) { switch (data[0]) { case CommSessionVersionCommandResponse: { prv_handle_phone_versions_response(session_ref, data + 1, length - 1); brea...
b, play_count_b); // Create a sequence Animation *seq = animation_sequence_create(a, b, NULL); cl_assert(seq != NULL); // Setup started/stopped handlers for the sequence const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; animation_set_handlers(...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 1); #endif } static Animation *s_parent_for_sequence_unschedule_from_child; static void prv_unschedule_parent(Animation *animation, bool finished, void *context) { DPRINTF("%"PRIu64" ms: Executing prv_unschedule_parent handler for %d\n"...
and peripheral config access before enabling it static void bus_enable(uint8_t bus_idx) { // Don't power up rail if the bus is already in use (enable can be called to reset bus) if (i2c_buses[bus_idx].user_count == 0) { bus_rail_power_up(bus_idx); } bus_pin_cfg_i2c(BOARD_CONFIG.i2c_bus_configs[bus_idx].i...
{ PBL_ASSERTN(s_initialized); PBL_ASSERTN(device_id < BOARD_CONFIG.i2c_device_count); uint8_t bus_idx = BOARD_CONFIG.i2c_device_map[device_id]; I2cBus *bus = &i2c_buses[bus_idx]; // Take control of bus; only one task may use bus at a time bus_lock(bus); if (bus->user_count == 0) { PBL_LOG(LOG_LEVEL...
/*--------------------DATA TRANSFER FUNCTIONS--------------------------*/ //! Wait a short amount of time for busy bit to clear static bool wait_for_busy_clear(uint8_t bus_idx) { unsigned int attempts = I2C_TIMEOUT_ATTEMPTS_MAX; while((i2c_buses[bus_idx].i2c->SR2 & I2C_SR2_BUSY) != 0) { --attempts; if (!...
LinkState_RequestSent); } else if (this->state->link_state == LinkState_Opened) { this->state->restart_count = 0; prv_start_timer(this); prv_transition_to(this, LinkState_Stopping); } prv_send_terminate_ack(this, packet->identifier); } static void prv_on_terminate_ack(PPPControlProtocol *this, ...
{ return; }
); SET_PREF_ALREADY_OPEN(PREF_KEY_VIBE_SCORE_INCOMING_CALLS, s_vibe_score_incoming_calls); SET_PREF_ALREADY_OPEN(PREF_KEY_VIBE_SCORE_ALARMS, s_vibe_score_alarms); #undef SET_PREF_ALREADY_OPEN } static VibeScoreId prv_return_default_if_invalid(VibeScoreId id, VibeScoreId default_id) { return vibe_score_info_is_va...
{ s_mutex = mutex_create(); SettingsFile file = {{0}}; if (settings_file_open(&file, FILE_NAME, FILE_LEN) != S_SUCCESS) { return; } #define RESTORE_PREF(key, var) \ do { \ __typeof__(var) _tmp; \ if (settings_file_get( \ &file, key, strlen(key), &_tmp, sizeof(_tmp)) == S_SUCCESS) { \ ...
*layer, GContext *ctx) { AppData *data = app_state_get_user_data(); if (data->rendered_frames == 0) { data->time_started = prv_time_64(); PROFILER_INIT; PROFILER_START; } data->rendered_frames++; } static void prv_window_disapper(Window *window) { } void prv_syncing_content_offset_changed(struct ...
layer_set_update_proc(&window->layer, prv_window_update_proc)
; window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, .unload = prv_window_unload, .disappear = prv_window_disapper, }); app_window_stack_push(window, true); PROFILER_INIT; PROFILER_START; app_event_loop(); } const PebbleProcessMd* fps_test_get_app_info(void) { s...
/* * 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...
(&pair->black_layer, GCompOpClear)
; } void rotbmp_pair_layer_init(RotBmpPairLayer *pair, GBitmap *white, GBitmap *black) { if (white->bounds.size.w != black->bounds.size.w && white->bounds.size.h != black->bounds.size.h) { PBL_LOG(LOG_LEVEL_ERROR, "rotbmp_pair inited with unmatching bitmaps"); return; } rot_bitmap_layer_init(&pair...
(subscription->event_type, NULL, NULL); service = s_event_services[subscription->event_type]; } if (service->subscribers[subscription->task]) { // already subscribed ? PBL_LOG(LOG_LEVEL_DEBUG, "already subscribed"); return; } if (service->add_subscriber_callback != NULL) { service->add_sub...
(service->subscribers[i], e)
) { PBL_LOG(LOG_LEVEL_INFO, "Queue full! %d not delivered to task %d!", (int)e->type, (int)i); #if !RELEASE // For 3rd party apps, just close them. For a 1st party app or other task, reboot // the watch if (i == PebbleTask_App && app_manager_get_current_app_md()...
/* * 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...
mfg_runin_app_get_info()
); } static void prv_select_vibe(int index, void *context) { launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_vibe_app_get_info()); } static void prv_select_als(int index, void *context) { launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_als_app_get_info()); } static void prv_select_bt_sig_rf(i...
AY) { time_tm.tm_hour %= HOURS_PER_DAY; } // Brazil delays DST end by one week every 3 years for elections if (tz_info->dst_id == DSTID_BRAZIL && (((TM_YEAR_ORIGIN + year) % 3) == 2) && is_end) { time_tm.tm_mday += DAYS_PER_WEEK; } time_t uxtime = mktime(&time_tm); gmtime_r(&uxtime, &time_tm); fo...
prv_clock_get_timezone_info_from_region_id(region_id, tz_data->utc_time, &tz_info)
View ///////////////////////////////////// static void prv_move_timeline_layer_stopped(Animation *animation, bool finished, void *context) { TimelineAppData *data = context; // reset the timeline layer data->timeline_layer.layer.bounds.origin.x = 0; window_set_background_color(&data->timeline_window, GColorW...
if (timeline_model_is_empty() && prv_set_state(data, TimelineAppStateNoEvents)) { // Hide layouts and animate to "No events" timeline_layer_set_layouts_hidden(&data->timeline_layer, true); prv_init_peek_layer(data); prv_setup_no_events_peek(data); peek_layer_play(&data->peek_layer); Anim...
{ // Make sure we can use all or part of this block for this allocation. if (heap_info_ptr == heap->end || heap_info_ptr->is_allocated || heap_info_ptr->Size < n_units) { return NULL; } /* Check to see if we need to split this into two */ /* entries. */...
// A very naive realloc implementation void* heap_realloc(Heap* const heap, void *ptr, unsigned long nbytes, uintptr_t client_pc) { #if !defined(MALLOC_INSTRUMENTATION) client_pc = 0; #endif // Get a pointer to the Heap Info. void *new_ptr = heap_malloc(heap, nbytes, client_pc); if (new_ptr && ptr) { // C...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
text_layer_set_text(text_heap_info, s_text_buf)
; } static void config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler); } static void init() { window = window_create(); window_set_click_config_provider(window, config_provider); window_stack_push(window, true /* Animated */); Layer *window_layer = window_get...
buffer[key_len] = '\0'; PBL_LOG(LOG_LEVEL_ERROR, "Could not deserialize data for <%s>", buffer); prv_free_serialzed_prefs(serialized_prefs); kernel_free(notif_prefs); return NULL; } prv_free_serialzed_prefs(serialized_prefs); return notif_prefs; } void ios_notif_pref_db_free_prefs(iOSNotifPr...
prv_file_close_and_unlock(&file)
; return rv; } BlobDBDirtyItem* ios_notif_pref_db_get_dirty_list(void) { SettingsFile file; if (S_SUCCESS != prv_file_open_and_lock(&file)) { return NULL; } BlobDBDirtyItem *dirty_list = NULL; settings_file_each(&file, sync_util_build_dirty_list_cb, &dirty_list); prv_file_close_and_unlock(&file); ...
static void prv_until_time_update(const LayoutLayer *layout_ref, const LayoutNodeTextDynamicConfig *config, char *buffer, bool render) { const TimelineLayout *layout = (TimelineLayout *)layout_ref; const int max_relative_hours = 24; // show up to...
(&timeline_layout->layout_layer, &s_vertical_config.container.extent.node)
; } ////////////////////////////////////////// // LayoutLayer API ////////////////////////////////////////// bool alarm_layout_verify(bool existing_attributes[]) { return (existing_attributes[AttributeIdTitle] && existing_attributes[AttributeIdSubtitle]); } LayoutLayer *alarm_layout_create(const LayoutLayerConfig ...
sk_App); cl_check(app_state_get_window_stack()); cl_check(!app_state_get_window_stack()->list_head); app_window_stack_push(window1, true); cl_assert_equal_i(app_window_stack_count(), 1); cl_assert_equal_i(window1->on_screen, true); app_window_stack_insert_next(window2); cl_assert_equal_i(app_window_s...
modal_manager_event_loop_upkeep()
; cl_assert_equal_i(modal_manager_get_properties(), ModalProperty_Transparent | ModalProperty_Unfocused); // Add priority 0 (discreet) opaque window 0 cl_assert(NumModalPriorities > 0); window_stack_push(window_stacks[0], windows[0][0], false); // A discreet window just went on-screen ...
prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(10, 10), 20, 5, true)
; touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420); touch_event = touch_event_queue_get_event(0, 1); prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(13, 13), 40, 6, true); touch_handle_update(0, TouchState_Finger...
/* * 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 (grect_is_empty(&rect)) { goto call_processor_post_function_and_return; }
// Calculate the offset of src_bitmap to use const GPoint src_offset = gpoint_sub(rect.origin, unclipped_origin); // Blit bitmap_to_draw (which might have been changed by the processor) into dest_bitmap bitblt_bitmap_into_bitmap_tiled(dest_bitmap, bitmap_to_draw, rect, src_offset, ...
esult: %d", (int)mask); } health_service_activities_iterate(HealthActivityMaskAll, now - (2 * SECONDS_PER_DAY), now, HealthIterationDirectionFuture, prv_activity_iterate_cb, &num_activities_found); APP_LOG(APP_LOG_LEVEL_DEBUG, "Found %"PRIu3...
( metric, day_start, day_start + SECONDS_PER_DAY, HealthServiceTimeScopeDailyWeekdayOrWeekend)
/* * 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...
bitblt_bitmap_into_bitmap(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite)
/* * 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_factory_reset_called = true; }
L_DEBUG, "Cache entry did not exist on launch attempt"); return true; } *md = app_install_get_md(id, is_worker); if (!is_worker && rocky_app_validate_resources(*md) == RockyResourceValidation_Invalid) { PBL_LOG(LOG_LEVEL_DEBUG, "App has incompatible JavaScript bytecode"); // TODO: do we need to pur...
if (task == PebbleTask_App) { if (context->app_md->is_rocky_app) { analytics_inc(ANALYTICS_APP_METRIC_ROCKY_CRASHED_COUNT, AnalyticsClient_App); } analytics_inc(ANALYTICS_APP_METRIC_CRASHED_COUNT, AnalyticsClient_App); } else if (task == PebbleTask_Worker) { analytics_inc(ANALYTICS_A...
if (context->app_md->is_rocky_app) { analytics_inc(ANALYTICS_DEVICE_METRIC_APP_ROCKY_CRASHED_COUNT, AnalyticsClient_System); } analytics_inc(ANALYTICS_DEVICE_METRIC_APP_CRASHED_COUNT, AnalyticsClient_System); } if (task == PebbleTask_App) { analytics_stopwatch_stop(ANALYTICS_APP_METRIC_FRONT_...
oGATT: GAPLEConnection *connection = gap_le_connection_by_device(gateway_device); // It's possible the connection is gone in the mean time; this runs on KernelMain. if (connection) { bonding_id = connection->bonding_id; } bt_unlock(); // don't hold bt_lock while calling bt_persistent_storage_... becaus...
PBL_LOG(LOG_LEVEL_DEBUG, "Found an instance of %s at 0x%"PRIx16"-0x%"PRIx16"!", client->debug_name, range.start, range.end); } #endif client->handle_service_discovered(characteristics); }
} } static void prv_handle_gatt_service_discovery_event(const PebbleBLEGATTClientServiceEvent *event) { PebbleBLEGATTClientServiceEventInfo *event_info = event->info; if (event_info->status == BTErrnoServiceDiscoveryDisconnected) { // TODO: In the past we'd disconnect when service discovery // failed (n...
_pinning */, false /* auto_accept_re_pairing */); prv_fire_writeback_timer(); cl_assert(id != BT_BONDING_ID_INVALID); // Read it back ret = bt_persistent_storage_get_ble_pairing_by_addr(&pairing.identity, &irk_out, NULL); cl_assert(ret); cl_assert_...
(&addr_2, &link_key_2, name_2, &platform_bits_2)
; prv_fire_writeback_timer(); cl_assert(id_2 != BT_BONDING_ID_INVALID); // Read it pairings back (purposefully using the wrong bonding ID cause it doesn't matter) ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_1, &addr_out, &link_key_out, name_ou...
state/app_state/app_state.h" #include "process_state/worker_state/worker_state.h" #include "system/passert.h" #include "util/heap.h" #include <string.h> Heap *task_heap_get_for_current_task(void) { if (pebble_task_get_current() == PebbleTask_App) { return app_state_get_heap(); } else if (pebble_task_get_curre...
(app_state_get_heap(), size, saved_lr)
; } void *app_zalloc_check(size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; Heap *heap = app_state_get_heap(); void *mem = heap_zalloc(heap, bytes, saved_lr); if (!mem && bytes != 0) { PBL_CROAK_OOM(bytes, saved_lr, heap); } return mem; } void *app_calloc(size_t count, s...
296}, { 1192, 448, -352}, { 1584, 504, -424}, { 1536, 608, -416}, { 1056, 472, -296}, { 1280, 704, -432}, { 1312, 352, -272}, { 1352, 464, -208}, { 1480, 336, -128}, { 1224, 248, -88}, { 1024, 144, 24}, { 1072, 232, -96}, { 1224, 280, -80}, { 1280, 264, -32}, { 10...
{ 1336, 32, 80}, { 976, 48, 24}, { 1064, 16, 168}, { 1104, 168, 136}, // 13 seconds { 1128, 168, -104}, { 1296, 112, -168}, { 1336, 168, -176}, { 1120, 72, -200}, { 920, 120, -184}, { 968, 168, -224}, { 1088, 256, -304}, { 1160, 312, -280}, { 1392, 464, -320}, ...
{ 1208, 400, -344}, { 1312, 408, -248}, { 1528, 360, -64}, { 1384, 200, -56}, { 1120, 184, 16}, { 1240, 216, -88}, { 1416, 280, -40}, { 1328, 240, -8}, { 1248, 112, 128}, { 1320, 0, 184}, { 880, 40, 80}, { 1136, -8, 216}, { 1008, 112, -16}, // 16 seconds { 11...
------------------- // Sample captured: 2015-10-09 10:32:49 local AccelRawData *activity_sample_walk_100_temp_95861_1(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_temp_95861_1 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 /...
{ -128, 528, -792}, { -24, 408, -672}, { 8, 384, -584}, // 5 seconds { -72, 304, -520}, { -192, 320, -616}, { -144, 416, -872}, { -16, 480, -944}, { -64, 592, -1208}, { 32, 552, -1208}, { -24, 536, -1056}, { -64, 768, -1184}, { 112, 768, -1096}, { 160, 640, -1072}...
{ 72, 152, -784}, { -16, 88, -704}, { -72, 32, -760}, { -72, -8, -872}, { -32, 56, -992}, { -160, 40, -1208}, { -32, 88, -1256}, { -88, 96, -1264}, { -200, 256, -1240}, { -72, 296, -1184}, { -32, 288, -1080}, { -40, 384, -960}, // 8 seconds { 32, 272, -840}, ...
S_PER_DAY; i++) { int value = 0; for (int j = i * k_avgs_per_hour; j < (i + 1) * k_avgs_per_hour; j++) { if (averages->average[j] == ACTIVITY_METRIC_AVERAGES_UNKNOWN) { averages->average[j] = 0; } value += averages->average[j]; } char temp[32]; snprintf(temp, sizeof(temp), ...
(CURRENT_STEP_AVG - 250, data)
; } // ----------------------------------------------------------------------------------------- static void prv_debug_cmd_set_steps_at_avg(int index, void *context) { ActivityDemoAppData *data = context; prv_set_steps(CURRENT_STEP_AVG, data); } // ---------------------------------------------------------------...
res_key = FONT_KEY_BITHAM_34_MEDIUM_NUMBERS}, {.js_name = "21px Roboto", .res_key = FONT_KEY_ROBOTO_CONDENSED_21}, {.js_name = "49px Roboto-subset", .res_key = FONT_KEY_ROBOTO_BOLD_SUBSET_49}, {.js_name = "28px bold Droid-serif", .res_key = FONT_KEY_DROID_SERIF_28_BOLD}, {.js_name = "20px bold Leco-numbers", .r...
(DEFAULT_FONT_DEFINITION.res_key)
; rocky_api_graphics_text_reset_state(); } void rocky_api_graphics_text_deinit(void) { prv_text_state_deinit(); }
oxNode; typedef struct AppInboxConsumerInfo { AppInboxServiceTag tag; AppInboxMessageHandler message_handler; AppInboxDroppedHandler dropped_handler; uint32_t num_failed; uint32_t num_success; uint8_t *it; uint8_t *end; } AppInboxConsumerInfo; _Static_assert(sizeof(AppInboxServiceTag) <= sizeof(void *)...
prv_get_consumer_info(tag, info_out)
616, -8}, { 1168, 496, -192}, { 1168, 272, -64}, { 1344, 376, 16}, { 1824, 568, 32}, { 1960, 392, 120}, // 84 seconds { 1840, 176, 328}, { 1704, 32, 144}, { 1472, 208, -128}, { 1160, 256, -120}, { 760, 160, -128}, { 512, -16, -264}, { 424, -88, -512}, { 288, -80,...
{ 88, 248, -1048}, { 16, 216, -928}, { -96, 152, -800}, { -216, 168, -760}, { -272, 104, -768}, { -280, 72, -808}, { -272, 72, -904}, { -264, 40, -1000}, { -328, -24, -1032}, { -312, 48, -1120}, { -368, -24, -1184}, { -496, 88, -1296}, { -280, 224, -1376}, { -328,...
{ 1360, 280, 40}, { 1296, 264, -120}, { 1464, 408, 24}, { 1000, 584, 216}, { 1080, 568, -40}, { 968, 504, -16}, // 92 seconds { 992, 528, -24}, { 1024, 424, 48}, { 1280, 392, 104}, { 1416, 336, 8}, { 1304, 200, 72}, { 1384, 96, 144}, { 1480, 24, 80}, { 1344, ...
ank 2 { .id = 18, .priority = 30, .size = 33202 }, // priority rank 22 { .id = 19, .priority = 25, .size = 151434 }, // priority rank 18 { .id = 20, .priority = 33, .size = 102321 }, // priority rank 24 { .id = 21, .priority = 19, .size = 223352 }, // priority rank 9 { .id = 22, .priority = 36, .size = 13322...
cl_assert_equal_i(after_size, (before_size - 207357))
; // test two lowest priority's size prv_cleanup(); to_free = (207357 + 22644); before_size = app_cache_get_size(); cl_assert(before_size >= to_free); cl_assert_equal_i(S_SUCCESS, app_cache_free_up_space(to_free)); fake_system_task_callbacks_invoke_pending(); after_size = app_cache_get_size(); cl_ass...
false); cl_assert_equal_i(2 * FOCUSED - NORMAL, l.selection.y); cl_assert_equal_i(NORMAL, l.selection.h); cl_assert_equal_b(false, s_content_available[ContentIndicatorDirectionUp]); cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]); } void test_menu_layer__center_focused_respects_row...
(0, menu_layer_get_selected_index(&l).section)
; cl_assert_equal_i(2, menu_layer_get_selected_index(&l).row); const int16_t basic_cell_height = menu_cell_basic_cell_height(); cl_assert_equal_i(2 * basic_cell_height, l.selection.y); menu_layer_set_selected_next(&l, false, MenuRowAlignNone, false); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).sec...
/* * 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...
USART_Init(USART3, &USART_InitStructure)
) { // Do nothing } // From action_menu_layer.c, needed to scroll the action menu layer to the point of interest void prv_set_selected_index(ActionMenuLayer *aml, int selected_index, bool animated); typedef enum { ActionMenuLayerLongLabelScrollingAnimationState_Top, ActionMenuLayerLongLabelScrollingAnimationSta...
{ gbitmap_destroy(s_dest_bitmap); const unsigned int num_columns = SettingsContentSizeCount; const int16_t bitmap_width = (DISP_COLS * num_columns) + (GRID_CELL_PADDING * (num_columns + 1)); const int16_t bitmap_height = (num_rows == 1) ? DISP_ROWS : ((DISP_ROWS * num_rows) + (GRID_CELL_PADDING * (num_r...
static void prv_render_action_menus_static( SettingsContentSize content_size, const ActionMenuLevel *root_level, unsigned int selected_index, unsigned int additional_crumbs) { const int16_t x_offset = GRID_CELL_PADDING + (content_size * (GRID_CELL_PADDING + DISP_COLS)); s_ctx.draw_state.drawing_box.or...
/* * 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 existing_attributes[AttributeIdTitle]; }
LayoutLayer *health_layout_create(const LayoutLayerConfig *config) { HealthLayout *layout = task_zalloc_check(sizeof(HealthLayout)); static const TimelineLayoutImpl s_timeline_layout_impl = { .attributes = { AttributeIdTitle, AttributeIdSubtitle }, .default_colors = { { .argb = GColorBlackARGB8 }, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
((Layer *) window, prv_test_update_proc)
; app_window_stack_push(window, false); } static uint16_t prv_get_num_rows(struct MenuLayer *menu_layer, uint16_t section, void *callback_context) { return (uint16_t) ARRAY_LENGTH(s_tests); } static void prv_draw_row(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, ...
nt8_t rssi, const BLEAdData *ad_data) { const BTDeviceAddress address = bt_device_get_address(device); APP_LOG(APP_LOG_LEVEL_INFO, "Got Advertisement from: " BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(address)); // Find existing ScanResult with BTDevice: ScanResult ...
if (strlen(result->local_name)) { snprintf(title, sizeof(title), "%s %s", result->local_name, hrm_str); } else { const BTDeviceAddress address = bt_device_get_address(result->device); snprintf(title, sizeof(title), BT_DEVICE_ADDRESS_FMT " %s", BT_DEVICE_ADDRESS_XPLODE(address), hrm_str); }
/* * 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_configure_transition_animation(animation, CompositorTransitionDirectionRight)
; } static void prv_transition_to_launcher_animation_init(Animation *animation) { prv_configure_transition_animation(animation, CompositorTransitionDirectionLeft); } const CompositorTransition *compositor_app_slide_transition_get(bool flip_to_the_right) { if (compositor_transition_app_to_app_should_be_skipped()) ...
in - less than next update time and next steps"); return; } s_activity_pin_state.next_update_time = now_utc + s_activity_summary_settings.summary.activity.update_max_interval_seconds; s_activity_pin_state.next_step_count = steps + s_activity_summary_settings.summary.activity.update_threshold_step...
health_util_format_hours_and_minutes(duration_str, duration_buffer_size, duration_s, headings)
; } const char *activity_label; if (session->type == ActivitySessionType_Run) { activity_label = i18n_get("Run", headings); } else if (session->type == ActivitySessionType_Walk) { activity_label = i18n_get("Walk", headings); } else { activity_label = i18n_get("Workout", headings); } string_li...
eturn layout_node_create_kino_layer_wrapper((void *)&layout->icon_layer); } static void prv_last_updated_update(const LayoutLayer *layout, const LayoutNodeTextDynamicConfig *config, char *buffer, bool render) { AttributeList *attributes = layout...
GPoint(bounds->size.w / 2, bounds->size.h - TIMELINE_CARD_ARROW_HEIGHT + arrow_offset)
; gpath_move_to(&s_page_break_arrow_path, origin); gpath_draw_filled(ctx, &s_page_break_arrow_path); } else { layout->page_break_height = height; layout->has_page_break = true; } if (size_out) { *size_out = (GSize) { bounds->size.w, height }; } } GTextNodeCustom *timeline_layout_create_page...
schedule_alarm) { data->show_limit_reached_text = true; layer_mark_dirty(menu_layer_get_layer(&data->menu_layer)); } else { prv_create_new_alarm(data); } return; } // Minus 1 because of the "add alarm" cell AlarmNode *node = (AlarmNode *)list_get_at((ListNode *)data->alarm_lis...
status_bar_layer_set_separator_mode(&data->status_layer, StatusBarLayerSeparatorModeNone)
; layer_add_child(&data->window.layer, status_bar_layer_get_layer(&data->status_layer)); #if CAPABILITY_HAS_HEALTH_TRACKING gbitmap_init_with_resource(&data->smart_alarm_icon, RESOURCE_ID_SMART_ALARM_ICON_BLACK); #endif gbitmap_init_with_resource(&data->plus_icon, RESOURCE_ID_PLUS_ICON_BLACK); data->current_pl...
S_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 1 MIN", time_buf); // June 10th 2015, 13:59:59 (T-00:00:01) rtc_set_time(event_time - 1); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS...
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("IN 12 H", time_buf); // June 12th 2015, 00:29:30 (T-11:30:30) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) + (29 * SECONDS_PER_MINUTE) + 30); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 12 H", time_buf); // Jun...
t)); cl_assert(!health_db_get_typical_value(ActivityMetricActiveKCalories, Monday, &val_out)); cl_assert(!health_db_get_typical_value(ActivityMetricDistanceMeters, Monday, &val_out)); } void test_health_db__sleep_data(void) { const char *key = "monday_sleepData"; cl_assert_equal_i(health_db_insert((uint8_t *...
strlen(entries[i].key)
, (uint8_t *)entries[i].val, strlen(entries[i].val)), S_SUCCESS); ActivityMetricAverages averages; health_db_get_typical_step_averages(i, &averages); int idx = i * 10; uint16_t val_expected = ((uint16_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...
ASSERT_JS_GLOBAL_EQUALS_I("num_times", d)
; cl_assert(fake_app_timer_is_scheduled(timer)); cl_assert(app_timer_trigger(timer)); ASSERT_JS_GLOBAL_EQUALS_I("extra_arg", 5.0); } script = "clearInterval(timer);"; EXECUTE_SCRIPT(script); cl_assert(fake_app_timer_is_scheduled(timer) == false); } void test_rocky_api_timers__setTimeout(void) { ...
/* * 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...
(model, "1002")
) { // SilkHR return true; } return false; #endif } #endif #if MFG_INFO_RECORDS_TEST_RESULTS void mfg_info_write_test_result(MfgTest test, bool pass) { MfgData data = prv_fetch_struct(); data.test_results[test] = pass; prv_update_struct(&data); } bool mfg_info_get_test_result(MfgTest test) { MfgData d...
{ // Do we have a default worker we should switch to that is different from the previous worker? AppInstallId default_id = worker_manager_get_default_install_id(); if (default_id != INSTALL_ID_INVALID && default_id != previous_worker_install_id) { worker_manager_put_launch_worker_event(default_id); ...
} // ------------------------------------------------------------------------------------------------ void worker_manager_handle_remove_current_worker(void) { s_worker_crash_relaunches_disabled = true; worker_manager_close_current_worker(true); } // ----------------------------------------------------------------...
(0, comm_session_send_queue_copy(s_valid_session, 0, sizeof(data_out), data_out)); } void test_session_send_queue__copy_less_than_head_job_zero_offset(void) { int num_jobs = 3; prv_add_jobs(num_jobs); uint8_t data_out[2]; memset(data_out, 0, sizeof(data_out)); cl_assert_equal_i(sizeof(da...
{ cl_assert_equal_i(s_free_count, 0); // Add a couple jobs: int num_jobs = 3; prv_add_jobs(num_jobs); // When the session is disconnected, comm_session_send_queue_cleanup() is called: comm_session_send_queue_cleanup(s_valid_session); cl_assert_equal_i(s_free_count, num_jobs); }
void test_session_send_queue__session_closed_when_add_is_called(void) { s_valid_session = NULL; SessionSendQueueJob *job = prv_create_test_job(TEST_DATA, sizeof(TEST_DATA)); comm_session_send_queue_add_job(s_valid_session, &job); cl_assert(!job); cl_assert_equal_i(s_free_count, 1); }
_MAX) << GPOINT_PRECISE_PRECISION); cl_assert(gpointprecise_equal(&pointP, &pointP_c)); GVectorPrecise vectorP = GVectorPreciseFromGVector(GVector(2, 5)); GVectorPrecise vectorP_c = GVectorPrecise((2 % GVECTOR_PRECISE_MAX) << GVECTOR_PRECISE_PRECISION, (5 % GVECTOR_...
(1, 2, 3, 4, 5, 6)
id(descriptor); uuid_to_string(&descriptor_uuid, uuid_buffer); APP_LOG(APP_LOG_LEVEL_INFO, "Write response for Descriptor %s (error=%u)", uuid_buffer, error); } static void descriptor_read_handler(BLEDescriptor descriptor, const uint8_t *value, ...
for (unsigned int c = 0; c < num_characteristics; ++c) { Uuid characteristic_uuid = ble_characteristic_get_uuid(characteristics[c]); uuid_to_string(&characteristic_uuid, uuid_buffer); APP_LOG(APP_LOG_LEVEL_INFO, "-- Characteristic: %s (0x%08x)", uuid_buffer, characteristics[c]); ...
// APP_LOG(APP_LOG_LEVEL_INFO, "---- Descriptor: %s (0x%08x)", uuid_buffer, descriptors[d]); // // // If the characteristic is the Heart Rate Measurement, // // attempt to subscribe to it by writing to the CCCD: // const Uuid hrm_uuid = bt_uuid_expand_16bit(0x2A37); // const Uuid ccc...
istream_t *stream, const pb_field_t *field, void **arg) { PLogMeasurementsDecoderArg *decoder_info = *(PLogMeasurementsDecoderArg **)arg; while (stream->bytes_left) { uint64_t value; if (!pb_decode_varint(stream, &value)) { return false; } if (*d...
pb_read(stream, (uint8_t *)ret_sender_type, str_len)
/* * 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...
kernel_zalloc_check(sizeof(Contact) + alloc_size)
; uint8_t *buffer = (uint8_t *)contact + sizeof(Contact); uint8_t *const buf_end = buffer + alloc_size; attributes_address_init(&contact->attr_list, &contact->addr_list, &buffer, serialized_contact->num_attributes, ...
/* * 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...
(new_font_key, bitham_prefix, bitham_prefix_len)
; strcpy(new_font_key+bitham_prefix_len, font_key+bitham_alias_len); // let's try again res = sys_font_get_system_font(new_font_key); } if (NULL == res) { PBL_LOG(LOG_LEVEL_DEBUG, "Getting fallback font instead"); res = fonts_get_fallback_font(); PBL_ASSERTN(res); } return res; } GFon...
/* * 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...
launcher_app_glance_structured_get_data(structured_glance)
/* * 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...
(false, prv_scroll_layer_is_paging_enabled(scroll_layer))
; // verify shadow layer is hidden on paging disabled cl_assert_equal_b(true, scroll_layer_get_shadow_hidden(scroll_layer)); } void test_scroll_layer__paging_vs_shadow_bits(void) { ScrollLayer *scroll_layer = scroll_layer_create(GRect(0,0,180,180)); // Validate that paging_disabled is same position as shadow ...
_abandoned_workout_notification_sent; void workout_utils_send_abandoned_workout_notification() { s_abandoned_workout_notification_sent = true; } // --------------------------------------------------------------------------------------- static void prv_inc_steps_and_put_event(int steps) { s_total_step_count += step...
(bpm, 180)
; cl_assert_equal_i(hr_zone, 3); cl_assert_equal_i(duration_s, 10 * SECONDS_PER_MINUTE + 10); cl_assert(workout_service_stop_workout()); cl_assert(!workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); } // ----------...
/* * 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...
swapIntersections(&values[i], &values[j])
; } } } } static inline bool prv_is_in_range(int16_t min_a, int16_t max_a, int16_t min_b, int16_t max_b) { return (max_a >= min_b) && (min_a <= max_b); } static void prv_gpath_draw_filled_cb(GContext *ctx, int16_t y, Fixed_S16_3 x_range_begin, Fixed_S16_3 x_range_end...
Font font = aml->layout_cache.font; const int16_t font_height = fonts_get_font_height(font); const GRect *layer_bounds = &cell_layer->bounds; GRect r = *layer_bounds; #if PBL_ROUND // more narrow on round r = grect_inset_internal(r, 25, 0); // center the columns horizontally if there's only one row const ...
(GTextAlignmentCenter, GTextAlignmentLeft)
); } // Item Scroll Animation /////////////////////////////////// static int16_t prv_get_cell_offset(void *subject) { ActionMenuLayer *aml = subject; return aml->item_animation.current_offset_y; } T_STATIC void prv_set_cell_offset(void *subject, int16_t value) { ActionMenuLayer *aml = subject; aml->item_anim...
; // 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_APB1P...
i2c_init(&I2C_2V5_BUS)
; voltage_monitor_device_init(VOLTAGE_MONITOR_ALS); voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY); }
params_t conn_params = evt->conn_params; PBL_LOG(LOG_LEVEL_DEBUG, "Master requesting conn param change, Conn Idx: %d - (%d %d %d %d)", evt->conn_idx, (int)conn_params.interval_min, (int)conn_params.interval_max, (int)conn_params.slave_latency, (int)conn_params.sup_timeout); // accept the change...
(conn, conn_idx)
) { PBL_LOG(LOG_LEVEL_DEBUG, "Auto-accepting pairing request"); extern void pair_reply(uint16_t conn_idx, bool is_confirmed); pair_reply(conn_idx, true); return; } hc_endpoint_pairing_send_pairing_request(&device); } static void prv_handle_address_resolved(const ble_evt_gap_address_resolved_t *evt...
nute = 30; s_current_day = s_saturday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); cl_assert_equal_i(s_num_alarm_events_put, 1); cl_assert_equal_i(s_num_timeline_adds, 6); cl_assert_equal_i(s_num_timeline_removes, 2); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc...
alarm_set_enabled(id2, true)
; s_current_hour = 12; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); } void test_alarm__delete_upcoming_alarm(void) { AlarmId id1, id2; id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id1, 10, 30, false, ALARM_KIND_EVERY...
if !TINTIN_FORCE_FIT typedef struct LoadedNotificationNode { ListNode node; TimelineItem notification; GDrawCommandImage *icon; bool icon_is_default; } LoadedNotificationNode; typedef struct NotificationNode { ListNode node; Uuid id; } NotificationNode; typedef struct NotificationsData { Window window; ...
((ListNode*) *loaded_list)
> MAX_ACTIVE_NOTIFICATIONS) { LoadedNotificationNode *old_node = (LoadedNotificationNode*) list_get_tail( (ListNode*) *loaded_list); list_remove((ListNode*) old_node, (ListNode**) loaded_list, NULL); prv_unload_loaded_notification(old_node); } // load the notification TimelineItem notificati...
/* * 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...
circular_cache_get(s_cache, &entry)
; if (found) { return found->app_name; } else { return NULL; } }