prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
cal_actions = 0; num_local_actions += (has_snooze_action) ? 1 : 0; num_local_actions += (has_dismiss_all_action) ? 1 : 0; num_local_actions += (has_quiet_time_action) ? 1 : 0; num_local_actions += (has_ancs_mute_action) ? 1 : 0; uint8_t num_item_specific_actions = num_timeline_actions; num_item_specific_ac...
if (has_dismiss_all_action) { action_menu_level_add_action(root_level, i18n_get("Dismiss All", root_level), prv_dismiss_all_action_cb, window_data); }
if (has_quiet_time_action) { action_menu_level_add_action(root_level, do_not_disturb_is_active() ? i18n_get("End Quiet Time", root_level) : i18n_get("Start Quiet Time", root_level), ...
(0, s_prv_activity_cb__call_count)
; s_sys_activity_get_sessions_values.out.result = true; // result from mocked sys_activity_get_sessions_values is still 0 sessions health_service_activities_iterate(HealthActivityMaskAll, now - (100 * SECONDS_PER_MINUTE), now, HealthIterationDirectionPast, prv_activity_cb, NUL...
elineItem *item = timeline_item_create_with_attributes(now + delta_time_s, duration_m, TimelineItemTypePin, LayoutIdHealth, &list, NULL); pin_db_insert_item_without_event(item); timeline_item_des...
app_window_stack_pop(true)
; } static uint16_t prv_menu_get_num_rows(OptionMenu *option_menu, void *context) { return ARRAY_LENGTH(timeline_demo_strings); } static void prv_menu_draw_row(OptionMenu *option_menu, GContext *ctx, const Layer *cell_layer, const GRect *text_frame, uint32_t row, bool selected, void *c...
s a no-op snprintf(dstbuf, 256, "There are % u lights, the absolute value of % u", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, the absolute value of 4294967292"); // Plus for positive signed // No signed conversion occurs, so this is a no-op snprintf(dstbuf, 256, "There are %+u lights, the absolut...
(dstbuf, "There are 10 lights")
_permission_by_device(const BTDeviceInternal *device) { BLEHRMSharingPermission *p = prv_find_permission_by_device(device); if (!p) { return HrmSharingPermission_Unknown; } return p->permission; } void ble_hrm_handle_activity_prefs_heart_rate_is_enabled(bool is_enabled) { if (!prv_hw_and_sw_supports_hrm(...
PBL_LOG(LOG_LEVEL_INFO, "Requesting BLE HRM sharing permission")
; BLEHRMSharingRequest *const sharing_request = kernel_zalloc_check(sizeof(*sharing_request)); sharing_request->connection = connection; launcher_task_add_callback(prv_push_sharing_request_window_kernel_main_cb, sharing_request); } static void prv_put_sharing_state_updated_event(int subscription_count) { // 2 ...
/* * 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...
(codepoint, FORMATTING_CODEPOINTS, ARRAY_LENGTH(FORMATTING_CODEPOINTS))
; } bool codepoint_is_ideograph(const Codepoint codepoint) { if (codepoint > MIN_IDEOGRAPH_CODEPOINT) { // non ideographic characters. This is an approximation that is good enough until // we start supporting some exotic scripts (e.g. tibetan) return true; } else { return false; } } // see http:...
accel_data(120, 0, ActivitySleepStateRestfulSleep); prv_feed_cannned_accel_data(120, 0, ActivitySleepStateLightSleep); // Wait long enough for our recompute sleep logic to run. prv_feed_cannned_accel_data(SECONDS_PER_MINUTE * ACTIVITY_SESSION_UPDATE_MIN, 0, ActivitySleepStateAwake);...
{ s_captured_sleep_event = *event; s_num_captured_sleep_events++; }
} // ---------------------------------------------------------------------------- // fake_event callback used to look for history update events generated by the health_events test static PebbleEvent s_captured_history_event = { }; static int s_num_captured_history_events = 0; static void prv_fake_history_event_cb(Pe...
ething has reset the register, ignore return; } // sign bit is zero if positive, 1 if negative direction = (click_src & Sign) ? -1 : 1; } else { // when no-one has subscribed, we only listen to the x axis axis = AXIS_X; // no sign info direction = 0; } PebbleEvent e = { .typ...
(&s_buffer, client)
); lis3dh_unlock(); } //! Removes a consumer from the circular buffer //! @client which client to remove void accel_remove_consumer(SharedCircularBufferClient *client) { lis3dh_lock(); shared_circular_buffer_remove_client(&s_buffer, client); lis3dh_unlock(); } //! Returns number of samples actually read. //...
/* * 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...
ntohs(raw_ibeacon.major)
, .minor = ntohs(raw_ibeacon.minor), .distance_cm = calculate_distance_cm(tx_power, rssi), .rssi = rssi, .calibrated_tx_power = tx_power, }; return true; } return false; } // ----------------------------------------------------------------------------- //! iBeacon Advertisement Data...
if (WITHIN(x, data_row_info.min_x, data_row_info.max_x)) { graphics_private_raw_blend_color_factor(ctx, output, data_row_offset, color, x, (uint8_t)(FIXED_S16_3_ONE.raw_value - y1.fraction)); } y1.integer++; data_row_info = gbitmap_get_data_row_info(f...
PBL_ASSERTN(framebuffer->bounds.origin.x == 0 && framebuffer->bounds.origin.y == 0)
; // Clip the clip box to the bitmap data row's range const GBitmapDataRowInfo data_row_info = gbitmap_get_data_row_info(framebuffer, y); clip_box_min_x = MAX(clip_box_min_x, data_row_info.min_x); clip_box_max_x = MIN(clip_box_max_x, data_row_info.max_x); // If x1 is further outside the clip box than the lef...
36, -280}, { 1520, 392, -408}, { 1472, 376, -568}, { 1416, 320, -432}, { 1264, 176, -240}, { 1096, 280, -256}, { 968, 416, -216}, { 880, 536, -232}, { 832, 528, -272}, { 808, 472, -280}, { 824, 400, -352}, { 792, 400, -304}, { 840, 464, -392}, { 848, 432, -416}, {...
ARRAY_LENGTH(samples)
; return samples; }
((MBuf *)1) #define assert_result_ok(result) cl_assert(result == SmartstrapResultOk) #define assert_result_invalid(result) cl_assert(result == SmartstrapResultInvalidArgs) #define assert_result_busy(result) cl_assert(result == SmartstrapResultBusy) typedef void (*EventServiceEventHandler)(PebbleEvent *e, void *context...
app_smartstrap_attribute_begin_write(attr, NULL, NULL)
); assert_result_invalid(app_smartstrap_attribute_begin_write(attr, &buffer, NULL)); assert_result_invalid(app_smartstrap_attribute_begin_write(attr, NULL, &buffer_len)); // smartstrap_attribute_end_write() assert_result_invalid(app_smartstrap_attribute_end_write(NULL, 0, false)); assert_result_invalid(app_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...
uuid_equal(&app_uuid, uuid)
; } void app_message_inbox_receive(CommSession *session, AppMessagePush *push_message, size_t length, AppInboxConsumerInfo *consumer_info) { // Test if the data is long enough to contain a push message: if (length < sizeof(AppMessagePush)) { PBL_LOG(LOG_LEVEL_ERROR, "Too short");...
TH_NAME}__lock(void) { // Test all the setup test combinations as above setup_test(&context, false, 1, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphic...
cl_assert(memcmp(&draw_state, &context.draw_state, sizeof(GDrawState)) == 0)
; // Compositing Mode draw_state = graphics_context_get_drawing_state(&context); graphics_context_set_compositing_mode(&context, GCompOpOr); cl_assert(memcmp(&draw_state, &context.draw_state, sizeof(GDrawState)) == 0); // Text Color draw_state = graphics_context_get_drawing_state(&context); graphics_con...
pp_db.h" #include "services/normal/process_management/app_storage.h" #include "system/logging.h" #include "system/passert.h" #include "util/attributes.h" #include "util/math.h" #include "util/uuid.h" //! Used for keeping track of binaries that are loaded through put_bytes typedef struct { AppInstallId app_id; uint...
{ PBL_LOG(LOG_LEVEL_ERROR, "Put bytes failure"); error = AppFetchResultPutBytesFailure; }
prv_cleanup(error); goto finally; } if (pb_event->type == PebblePutBytesEventTypeInitTimeout) { PBL_LOG(LOG_LEVEL_WARNING, "Timed out waiting for putbytes request from phone"); prv_cleanup(AppFetchResultTimeoutError); } // If this is an object that doesn't have a cookie, then we won't care 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...
(&timeline_layer)
TANGLE) { graphics_draw_rect(ctx, &data->rect); } else if (shape == RECTANGLE_ROUND) { graphics_draw_round_rect(ctx, &data->rectr, data->rectr_radius); } else if (shape == CIRCLE) { graphics_context_set_fill_color(ctx, data->circle_color); graphics_context_set_stroke_color(ctx, data->cir...
data->circle_origin = GPoint(50, 50); data->circle_radius = 20; data->circle_velocity_x = 1; data->circle_velocity_y = 1; data->circle_color = s_display_colors[5]; // Triangle data->triangle = gpath_create(&s_triangle_path); data->triangle_offset = GPoint(10, 80); gpath_move_to(data->triangle, data->...
static void deinit(void) { AppData *data = app_state_get_user_data(); task_free(data); } static void s_main(void) { init(); app_event_loop(); deinit(); } const PebbleProcessMd* pebble_shapes_get_app_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = s_main, .nam...
ncelConnect); // Verify there are no more intents: cl_assert_equal_i(gap_le_connect_connection_intents_count(), 0); } // ----------------------------------------------------------------------------- // Cancel Connect by Bonding (as Slave) void test_gap_le_connect__slave_cancel_connect_by_bonding(void) { BTBondi...
(&device, true /* connected */, (1 << PebbleTask_App), HCI_ERROR_CODE_SUCCESS)
; } void test_gap_le_connect__add_intent_requiring_pairing_after_connected_and_encrypted(void) { BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk(); BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_device(); prv_fake_connect(&device, false /* is_master*/); fake_GAPAPI_set_en...
a); cl_assert(parent.first_child == &child_c); cl_assert(child_c.parent == &parent); cl_assert(child_a.parent == NULL); cl_assert(child_a.next_sibling == NULL); cl_assert(grand_child_a.parent == &child_a); // Return early when (parent->paren == NULL): layer_remove_from_parent(&parent); } void test_layer...
(aaa, stack[2])
; // go to child if possible actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_stack, true); cl_assert_equal_p(aaaa, actual); cl_assert_equal_i(3, current_stack); cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(aa, stack[1]); cl_assert_equal_p(aaa, stack[2]); 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...
if (FLASH_EraseSector( s_sectors[sector], VoltageRange_1) != FLASH_COMPLETE) { dbgserial_print("failed to erase sector "); dbgserial_print_hex(sector); dbgserial_newline(); FLASH_Lock(); return false; }
if (progress_callback) { progress_callback(sector - first_sector + 1, count, progress_context); } } FLASH_Lock(); return true; } bool system_flash_write( uint32_t address, const void *data, size_t length, SystemFlashProgressCb progress_callback, void *progress_context) { FLASH_Unlock(); ...
/* * 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_FROM_FAULT_HANDLER_FMT(buffer, 80, "R2 = 0x%x", stacked_r2)
= *r1; GRect s_r2 = *r2; grect_standardize(&s_r1); grect_standardize(&s_r2); const uint8_t min_x = MIN(s_r2.origin.x, s_r1.origin.x); const uint8_t min_y = MIN(s_r2.origin.y, s_r1.origin.y); const uint8_t max_x = MAX(s_r2.origin.x + s_r2.size.w, s_r1.origin.x + s_r1.size.w); co...
if (new_width < 0 || new_height < 0) { return GRectZero; }
return GRect(r.origin.x + insets.left, r.origin.y + insets.top, new_width, new_height); } GPoint gpoint_to_global_coordinates(const GPoint point, GContext *ctx) { return gpoint_add(point, ctx->draw_state.drawing_box.origin); } GPoint gpoint_to_local_coordinates(const GPoint point, GContext *ctx) { return gpoin...
/* * 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...
GRect(2, -10, 28, 20)
, 4); } void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__origin_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 32, 24)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi...
= PEBBLE_BATTERY_CONNECTION_EVENT) { battery_state_handle_connection_event(event->battery_connection.is_connected); periodic_timer_trigger(1); } } // Setup //////////////////////////////////// void test_battery_monitor__initialize(void) { //g_pbl_log_enabled = true; //g_pbl_log_level = 255; s_entered_...
battery_get_charge_state()
.charge_percent, percent); } void test_battery_monitor__curve_adjustment_when_charge_complete(void) { int charge_mv = battery_curve_lookup_voltage_by_percent(0, true); int full_mv = battery_curve_lookup_voltage_by_percent(100, false); int charge_terminate_mv = battery_curve_lookup_voltage_by_percent(95, false); ...
or writing status to notification header %d", result); } // Seek to the end of the header pfs_seek(fd, ((int)sizeof(*header) - (int)offsetof(CommonTimelineItemHeader, status) - sizeof(header->common.status)), FSeekCur); } bool notification_storage_get_status(const Uuid *id, uint8_t *status) { int fd = p...
if (prv_compare_ancs_notifications(notification, payload, payload_size, &iter_state.header, fd)) { *header_out = iter_state.header.common; rv = true; break; }
patch, b->payload_sender_version_patch); // Ensure they are the same type cl_assert_equal_i(a->type, b->type); // MeasurementSet Specific if (a->type == ProtobufLogType_Measurements) { cl_assert_equal_i(a->msrmt.time_utc, b->msrmt.time_utc); cl_assert_equal_i(a->msrmt.utc_to_local, b->msrmt.utc_to_loc...
parser(s_saved_encoded_msg)
; } return msg; } // --------------------------------------------------------------------------------------------- static ProtobufLogRef *prv_test_encode_measurements(TestPLParsedMsg *input, bool use_data_logging) { prv_common_payload_initialize(input); ProtobufLogRef session_ref = prv_log_create_measurement(i...
ount) || (bitmap_sequence->play_count == PLAY_COUNT_INFINITE)) { prv_gbitmap_sequence_restart(bitmap_sequence, false); } else { return false; // animation complete } } const int32_t metadata_bytes = png_seek_chunk_in_resource(bitmap_sequence->resource_id, ...
if (delay_ms != NULL) { *delay_ms = bitmap_sequence->current_frame_delay_ms; } uint32_t bpp = upng_get_bpp(upng); upng_format png_format = upng_get_format(upng); uint8_t *upng_buffer = (uint8_t*)upng_get_buffer(upng); // Byte aligned rows for image at bpp uint16_t row_stride_bytes = (fctl.width * b...
const uint16_t corrected_y = fctl.y_offset + y + bitmap->bounds.origin.y; const GBitmapDataRowInfo row_info = gbitmap_get_data_row_info(bitmap, corrected_y); // delta_x is the first bit of data in this frame relative to the bitmap's coordinate system const int16_t delta_x = fctl.x_offset + bit...
even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 32), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(4, 36), 10); // cross - odd vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(41, 33), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(37, 37), 10); // T facing u...
(&ctx, fb)
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); draw_lines_same_point(&ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_same_point"))); #if SCREEN_COLOR_DEPTH_BITS == 8 graphics_context_set_stroke_color(&ctx, GColorRed); draw_lines_same_point(&...
2) - 1, GCornerTopRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_topright.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCorne...
cl_assert_equal_i(prv_clamp_corner_radius(GSize(4, 0), GCornersAll, 8), 0)
------------------------------------- // Test to make sure that when we re-boot we correctly get the saved minute data void test_activity_algorithm_kraepelin__minute_data_after_boot(void) { const int num_minutes = 4 * MINUTES_PER_HOUR; time_t start_utc = rtc_get_time(); // The test data AlgMinuteDLSSample minu...
for (int i = 0; i < num_minutes; i++) { prv_assert_minute_data(&retrieve[i], &minute_data[i]); }
gth); s_num_sent_handler_called = 0; s_num_app_outbox_events_sent = 0; s_num_message_handler_calls = 0; s_last_message = NULL; stubs_syscall_init(); s_app_state_app_outbox_subscription_info = (EventServiceInfo) {}; // set to something that is not expected anywhere in the tests: s_last_sent_status = Ap...
cl_assert_equal_p(s_test_data, s_last_message->data)
; cl_assert_equal_i(s_test_data_length, s_last_message->length); cl_assert_equal_b(false, app_outbox_service_is_message_cancelled(s_last_message)); message[i] = s_last_message; } for (uint32_t i = 0; i < max_pending_messages; ++i) { app_outbox_service_consume_message(message[i], AppOutboxStatusSu...
andle_circular_buffer_write_complete(); if (should_give_semaphore) { prv_give_semamphore_from_isr(should_context_switch); } } static void prv_handle_receiving_complete_isr(bool *should_context_switch) { // Wait for the controller to signal that it's ready prv_watchdog_start(); s_spi_transport.state = SP...
dialog_spi_send_and_receive_dma(s_spi_transport.status_local, &s_spi_transport.status_remote, sizeof(SPITransportMsgStatus), prv_handle_status_exchange_complete_isr)
; } static bool prv_handle_rx_buffer_full(void) { prv_lock(); bool is_rx_buffer_full = (0 == circular_buffer_get_write_space_remaining(&s_spi_transport.rx)); if (is_rx_buffer_full) { s_spi_transport.should_transact_after_consuming_rx = true; } prv_unlock(); return is_rx_buffer_full; } static void prv_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_state_get_user_data()
; health_data_update_step_derived_metrics(health_app_data->health_data); health_card_view_mark_dirty(health_app_data->health_card_view); } // Activity change callback static void prv_health_service_event_handler(HealthEventType event, void *context) { HealthAppData *health_app_data = context; if (event == Heal...
n_by_idx(uint16_t conn_idx) { Connection *connection; prv_lock(); { connection = (Connection *)list_find( (ListNode *)s_connections, prv_connection_by_idx_list_filter_cb, (void *)(uintptr_t)conn_idx); } prv_unlock(); return connection; } Connection *connection_by_idx_check(uint16_t conn...
{ bool val; prv_lock(); { uint32_t bit = (1 << flag); val = ((connection->flags & bit) == bit); } prv_unlock(); return val; }
bool connection_is_subscribed_to_connection_status_notifications(const Connection *connection) { return prv_get_flag(connection, ConnectionFlag_IsSubscribedToConnectionStatusNotifications); } bool connection_should_pin_address(const Connection *connection) { return prv_get_flag(connection, ConnectionFlag_ShouldP...
lled more than once prv_create_timer_if_needed(); bool success = new_timer_start(s_pb_state.timer_id, timeout_ms, prv_expect_init_timeout_cb, NULL, 0 /*flags*/); PBL_ASSERTN(success); xSemaphoreGive(s_pb_semaphore); } void put_bytes_handle_comm_session_event(const PebbleCommSes...
if (!prv_is_message_pending_processing()) { // Could happen if put_bytes_cancel() was called after "prepare" PBL_LOG(LOG_LEVEL_WARNING, "No message pending, PutBytes cancelled? Will NACK."); s_pb_state.receiver.should_nack = true; goto finally; }
PBL_ASSERTN(s_pb_state.receiver.buffer && s_pb_state.receiver.pos + length <= PUT_BYTES_PP_BUFFER_SIZE); memcpy(s_pb_state.receiver.buffer + s_pb_state.receiver.pos, data, length); if (s_pb_state.receiver.pos == 0) { prv_validate_and_preack_request_if_needed(data, length); } s_pb_s...
teStateRequestInProgress) && (new_state == SmartstrapAttributeStateIdle)) { return pebble_task_get_current() == PebbleTask_KernelBackground; } else { return false; } } static void prv_set_attribute_state(SmartstrapAttributeInternal *attr, SmartstrapAttribute...
smartstrap_profiles_handle_request(&request)
; if (result == SmartstrapResultBusy) { // there was another request in progress so we'll try again later return false; } else if ((result == SmartstrapResultOk) && (smartstrap_fsm_state_get() != SmartstrapStateReadReady)) { prv_set_attribute_state(attr, SmartstrapAttributeStateRequestInPro...
= grect_inset(frame, GEdgeInsets(down_arrow_layer_frame_origin_y, 0, 0, 0)); Layer *down_arrow_layer = &launcher_menu_layer->down_arrow_layer; layer_init(down_arrow_layer, &down_arrow_layer_frame); layer_add_child(container_layer, down_arrow_layer); ContentIndicator *content_indicator = scroll_lay...
if (!launcher_menu_layer || !launcher_menu_layer->data_source || !state_out) { return; }
#define DISP_LINE_WORDS (((DISP_COLS - 1) / 32) + 1) // GPIO constants #define DISP_SPI (SPI2) #define DISP_GPIO (GPIOB) #define DISPLAY_SPI_CLOCK (RCC_APB1Periph_SPI2) #define DISP_PIN_SCS (GPIO_Pin_9) #define DISP_PINSOURCE_SCS (GPIO_PinSource9) #define DISP_PIN_SCLK (GPIO_Pin_10) #define DISP_PINSOURCE_SCKL (GPIO_...
prv_enable_display_access()
; prv_display_write_byte(DISP_MODE_CLEAR); prv_display_write_byte(0x00); prv_disable_display_access(); } //! Static mode is entered by sending 0x00 to the panel //! This stops any further updates being registered by //! the display, preventing corruption on shutdown / boot static void prv_display_enter_static(...
t need them. // This will init it and set the correct style to be used within the settings // app. static void prv_init_status_bar(StatusBarLayer *status_layer, Window *window, const char *text) { status_bar_layer_init(status_layer); status_bar_layer_set_title(status_layer, text, false, false); status_bar_layer_s...
window_single_click_subscribe(BUTTON_ID_UP, prv_coredump_confirm_cb)
; window_single_click_subscribe(BUTTON_ID_DOWN, prv_confirm_pop); window_single_click_subscribe(BUTTON_ID_BACK, prv_confirm_pop); } static void prv_coredump_reset_confirm_cb(ClickRecognizerRef recognizer, void *context) { ExpandableDialog *s_dialog = expandable_dialog_create("Core Dump Reset"); Dialog *dialog ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; bool success = comm_session_send_data(session, PB_APP_STATE_ENDPOINT_ID, (uint8_t*)app_run_state, sizeof(*app_run_state), COMM_SESSION_DEFAULT_TIMEOUT); uuid_to_strin...
else { PBL_LOG(LOG_LEVEL_DEBUG, "Using deprecated launcher_app_message"); const bool is_running = ((app_run_state->state == RUNNING) ? true : false); launcher_app_message_send_app_state_deprecated(&app_run_state->uuid, is_running); } } kernel_free(app_run_state); } void app_run_state_comman...
or; } } voice_window->state = StateStart; prv_voice_window_push(voice_window); return DictationSessionStatusSuccess; } void voice_window_pop(VoiceWindow *voice_window) { sys_light_reset_to_timed_mode(); prv_cancel_dictation(voice_window); // This relies on all dialogs having a dialog object as their...
(event_type, response_size, response_len_chars, response_len_ms, error_count, num_sessions, &uuid)
; }
ate->mutex); } // -------------------------------------------------------------------------------------------- // 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 (se...
prv_push_median_hr_event(state->hr.metrics.previous_median_bpm)
; } } // ------------------------------------------------------------------------------------------ static void prv_write_hr_zone_info_to_flash(HRZone zone) { ActivityMetric metric; if (zone == HRZone_Zone1) { metric = ActivityMetricHeartRateZone1Minutes; } else if (zone == HRZone_Zone2) { metric = Act...
/* * 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...
tolower(c)
; } else { return c; } } // "Define" libc functions we're testing #include "pblibc_private.h" #include "include/ctype.h" /////////////////////////////////////////////////////////////////////////////////////////////////// //! Tests #define ISCTYPE_TEST(CHK) \ for(int i = -128; i < 256; i++) { \ cl_asser...
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language govern...
worker_manager_get_task_context()
->to_process_event_queue; break; case PebbleTask_App: queue = app_manager_get_task_context()->to_process_event_queue; break; case PebbleTask_KernelBackground: queue = NULL; break; default: WTF; } return queue; } void pebble_task_create(PebbleTask pebble_task, TaskPar...
G_MEMORY_ERROR : APNG_DECODE_ERROR); goto cleanup; } // Save metadata to bitmap_sequence uint32_t play_count = 0; // If png is APNG, get num plays, otherwise play count is 0 if (upng_is_apng(upng)) { play_count = upng_apng_num_plays(upng); // At the API level 0 is no loops vs APNG specification us...
APP_LOG(APP_LOG_LEVEL_ERROR, "Invalid destination bitmap format for APNG")
; goto cleanup; } // Update current time elapsed using the previous frames current_frame_delay_ms bitmap_sequence->elapsed_ms += bitmap_sequence->current_frame_delay_ms; // Check if single animation loop is complete, and restart if there are more loops if (bitmap_sequence->current_frame >= bitmap_sequen...
app_name = app_attrs[FetchedAppAttributeIndexDisplayName]; ancs_app_name_storage_store(app_id, app_name); fail: prv_put_ancs_message(app_attrs); prv_reset_and_next(); } // ----------------------------------------------------------------------------- // Get Notification Attributes request static void prv_add_at...
{ prv_reset_and_flush(); }
else { prv_set_state(ANCSClientStateRetrying); evented_timer_register(ANCS_RETRY_TIME_MS, false, prv_reset_and_retry, NULL); } } } static void prv_handle_notification_attributes_response(const uint8_t *data, size_t length) { // Skip past the header, don't need it (for now): data += sizeof(GetNot...
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 == ActivitySessionT...
("Avg HR", headings)
, headings_buf_size); string_list_add_string(values, values_buf_size, hr_str, values_buf_size); } if (hr_zone_time_s) { const int zone_1_minutes = ROUND(hr_zone_time_s[HRZone_Zone1], SECONDS_PER_MINUTE); if (zone_1_minutes) { snprintf(hr_str, hr_buf_size, i18n_get("%d Min", headings), zone_1_minu...
smartstrap_state_assert_locked_by_current_task()
; // we expect the arguments to be valid const bool is_read = (read_mbuf != NULL); PBL_ASSERTN((profile > SmartstrapProfileInvalid) && (profile < NumSmartstrapProfiles)); PBL_ASSERTN(!is_read || (mbuf_get_chain_length(read_mbuf) > 0)); PBL_ASSERTN((!write_mbuf && !read_mbuf) || (write_mbuf != read_mbuf)); t...
d", accel_test_axis[i].axis_name, axis_delta, accel_test_axis[i].pass_threshold); pass = false; } } prv_run_command(BMI160_CMD_SOFTRESET); psleep(50); bmi160_enable_spi_mode(); return pass; } bool gyro_run_selftest(void) { prv_update_accel_interrupts(false); prv_run_command(BM...
if (BMI160SampleRate_200_HZ <= interval_us) { sample_rate = BMI160SampleRate_200_HZ; } else if (BMI160SampleRate_400_HZ <= interval_us) { sample_rate = BMI160SampleRate_400_HZ; } else if (BMI160SampleRate_800_HZ <= interval_us) { sample_rate = BMI160SampleRate_800_HZ; } else { // any interval < min su...
cl_assert_equal_i(track_position, 0xAA)
; cl_assert_equal_i(music_get_playback_rate_percent(), 0xAA); } else { cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT); } } static void prv_receive_and_assert_volume_info(bool expect_is_handled) { uint8_t msg[] = { 0x12, 0x33 }; prv_receive_pp_data(msg, sizeof(msg)); PebbleEvent e = fake_event_get_las...
status; } T_STATIC status_t settings_file_compact(SettingsFile *file) { return settings_file_rewrite_filtered(file, NULL, NULL); } static bool key_matches(SettingsRawIter *iter, const uint8_t *key, int key_len) { SettingsRecordHeader *hdr = &iter->hdr; if (key_len != hdr->key_len) { return false; } if (...
memset(val_out, 0, val_out_len)
; return E_DOES_NOT_EXIST; } if (deleted_and_expired(&file->iter.hdr)) { memset(val_out, 0, val_out_len); return E_DOES_NOT_EXIST; } size_t val_len = file->iter.hdr.val_len; if (val_out_len > val_len) { memset(val_out, 0, val_out_len); return E_RANGE; } settings_raw_iter_read_val(&file...
e.h" #endif #define DECLINE_DELAY_MS 2000 #define SMS_REPLY_DELAY_MS 1200 #define SMS_REPLY_IOS_DELAY_MS 600 #define ACCEPT_DELAY_MS 3000 #define CALL_END_DELAY_MS 5000 #define OUTGOING_CALL_DELAY_MS 5000 #define MISSED_CALL_DELAY_MS 180000 #define NAME_BUFFER_LENGTH 32 #define CALL_STATUS_BUFFER_LENGTH 32 #define D...
(138, 144)
, .status_height = 20, .large_caller_id = true, }; static const PhoneStyle *s_phone_styles[NumPreferredContentSizes] = { [PreferredContentSizeSmall] = &s_phone_style_default, [PreferredContentSizeMedium] = &s_phone_style_default, [PreferredContentSizeLarge] = &s_phone_style_large, [PreferredContentSizeExtr...
/* * 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_malloc_check(alloc_size)
line, utf8_bounds.start); cl_assert(line_add_words(&line, &word_iter, NULL)); cl_assert(line.height_px == 10); cl_assert(line.width_px == HORIZ_ADVANCE_PX * 0); cl_assert(line.origin.x == 0); cl_assert(line.suffix_codepoint == 0); cl_assert(*line.start == '\n'); // \n cl_assert(*word_iter_state.current...
{ bool is_text_remaining = line_add_words(&s_ctx.text_draw_state.line, &line_iter_state.word_iter, NULL); count++; if (!is_text_remaining) { // Exit after 2 lines cl_assert(count == 2); break; } if (!iter_next(&line_iter)) { // Should not get here cl_assert(false); ...
}
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(window_layer, text_layer_get_layer(data->title_text_layer))
; bounds.origin.y += 30; data->reading_text_layer = text_layer_create(bounds); prv_update_reading(data); text_layer_set_font(data->reading_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text(data->reading_text_layer, data->ambient_reading); text_layer_set_text_alignment(data-...
n, &header); int fd = prv_file_open(OP_FLAG_WRITE | OP_FLAG_READ); if (fd < 0) { return; } size_t size_needed = header.payload_length + sizeof(SerializedTimelineItemHeader); if (size_needed > (NOTIFICATION_STORAGE_FILE_SIZE - s_write_offset)) { if (!prv_compress(size_needed, &fd)) { // Notifica...
(item_out && (s_notif_storage_mutex != NULL))
; int fd = prv_file_open(OP_FLAG_READ); if (fd < 0) { return false; } bool rv = true; SerializedTimelineItemHeader header = { .common.id = UUID_INVALID }; char uuid_string[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(id, uuid_string); if (!prv_find_next_notification(&header, prv_uuid_equal_func, (v...
34567890123456789"; mfg_info_set_model(long_string); // We only expect to see the first 15 (MFG_INFO_MODEL_STRING_LENGTH - 1) characters mfg_info_get_model(buffer); cl_assert_equal_s(buffer, "012345678901234"); } } void test_spalding_mfg_info__1_to_2_conversion(void) { // Force in an old data ...
(mfg_info_get_disp_offsets().y, 0)
; // Set x and y offsets and make sure others don't change. mfg_info_set_disp_offsets((GPoint) {-2, 1}); cl_assert_equal_i(mfg_info_get_disp_offsets().x, -2); cl_assert_equal_i(mfg_info_get_disp_offsets().y, 1); cl_assert_equal_i(mfg_info_get_watch_color(), 3); cl_assert_equal_i(mfg_info_get_rtc_fr...
{ // copy key for event uint8_t *key_bytes = NULL; if (key_len > 0) { key_bytes = kernel_malloc(key_len); 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)...
void blob_db_init_dbs(void) { const BlobDB *db = s_blob_dbs; for (int i = 0; i < NumBlobDBs; ++i, ++db) { if (db->init) { db->init(); } } } void blob_db_get_dirty_dbs(uint8_t *ids, uint8_t *num_ids) { const BlobDB *db = s_blob_dbs; *num_ids = 0; for (uint8_t i = 0; i < NumBlobDBs; ++i, ++db...
t8_t *end = serialized_attribute_list_to_deserialize + serialized_attribute_list_to_deserialize_size; const uint8_t *buffer_size_cursor = serialized_attribute_list_to_deserialize; const int32_t buffer_size = attribute_get_buffer_size_for_serialized_attributes(num_attributes, &buffer...
strlen(app_glance_subtitle_attributes->cstring)
> ATTRIBUTE_APP_GLANCE_SUBTITLE_MAX_LEN); AttributeList app_glance_subtitle_attribute_list = { .num_attributes = ARRAY_LENGTH(app_glance_subtitle_attributes), .attributes = app_glance_subtitle_attributes, }; const uint8_t app_glance_subtitle_attribute_list_serialized[] = { 0x2F, ...
/* * 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...
{ TimeRangeSelectionWindowData *data = context; date_time_handle_time_change(&data->from, index, 1); }
static void prv_handle_from_dec(unsigned index, void *context) { TimeRangeSelectionWindowData *data = context; date_time_handle_time_change(&data->from, index, -1); } // TO selection layer callbacks static char* prv_handle_to_get_text(unsigned index, void *context) { TimeRangeSelectionWindowData *data = contex...
tatic int32_t prv_convert_to_graph_height(HealthGraphCard *graph_card, int32_t point) { // Round up in order to show the minimum stub bar once progress begins int bar_height = (point * GRAPH_HEIGHT + graph_card->data_max - 1) / graph_card->data_max; const int minimum_stub_height = 5; if (bar_height > 0 && bar_h...
(graph_card, day_point)
; const bool is_active = (graph_card->selection == i); if (graph_card->current_day == i) { // Draw last week's bar as a thin bar behind this bar const int32_t last_bar_height = prv_convert_to_graph_height(graph_card, graph_card->day_data[DAYS_PER_WEEK]); prv_setup_day_bar_box(i, &bo...
.info.version = GBITMAP_VERSION_CURRENT, .bounds = src_bitmap->bounds }; // All compositing modes except GCompOpSet should be the same as GCompAssign memset(dest_data, GColorGreen.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpAssign, GColorWhite); cl_as...
(&dest_bitmap, &expect_bmp, "test_bitblt__8bit_comptint_clear-expect.8bit.pbi")
); gbitmap_destroy(src_bitmap); } // Tests comptint, multiple tint colors and varying opacity of the source image. // Setup: // - Destination is two 128 by 64 blocks expressing the 64 colors; each row expresses // one of the colors stack vertically. // - Source is a set of 4 by 4 blocks each with a 1 pixel ...
1); prv_draw_hline_test_pattern(&ctx, prv_hline_pattern_assign_horizontal_line_raw); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_core_assign_horizontal_line_raw"))); }; void prv_blend_horizontal_line_raw(GBitmap *framebuffer, int16_t y, int16_t x1, int16_t x2, ...
TEST_NAMED_PBI_FILE("draw_core_assign_vertical_line_raw")
/* * 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 (bt_ctl_is_airplane_mode_on()) { new_connectivity_icon_id = RESOURCE_ID_CONNECTIVITY_BLUETOOTH_AIRPLANE_MODE; } else if (do_not_disturb_is_active()) { new_connectivity_icon_id = RESOURCE_ID_CONNECTIVITY_BLUETOOTH_DND; } else if (!prv_is_pebble_app_connected()) { new_connectivity_icon_id = RESOURCE_ID...
// replace the image if the connectivity ResourceId has changed if (data->connectivity_icon_id != new_connectivity_icon_id) { data->connectivity_icon_id = new_connectivity_icon_id; kino_layer_set_reel_with_resource(&data->connectivity_icon, data->connectivity_icon_id); } // Get the connectivity Resou...
KEY_BACKLIGHT_BEHAVIOUR_DEPRECATED, sizeof(PREF_KEY_BACKLIGHT_BEHAVIOUR_DEPRECATED)); } } // ------------------------------------------------------------------------------------ void shell_prefs_init(void) { s_backlight_intensity = prv_convert_backlight_percent_to_intensity(BOARD_CO...
{ const PrefsTableEntry *entry = prv_prefs_entry(key, key_len); if (!entry) { return false; } return prv_set_pref_backing(entry, value, value_len); }
04, -424, -984}, { -40, -384, -1104}, { -216, -304, -1344}, { -400, -216, -1256}, { -272, -144, -1280}, { -320, -248, -1040}, { -232, -320, -896}, { -136, -224, -888}, { -8, -264, -816}, { 0, -320, -736}, { 56, -312, -744}, { 56, -384, -712}, { -8, -432, -768}, { -16,...
{ -1352, 136, 0}, { -1456, -160, 24}, { -1152, -672, -120}, { -1088, -496, 320}, { -1200, -80, -504}, { -1600, 168, -528}, { -1576, 152, -216}, { -1544, -72, 8}, { -1480, -176, 24}, // 10 seconds { -1424, 248, 176}, { -1320, 456, -8}, { -1408, 432, 72}, { -1312, 3...
{ -1680, 472, -128}, { -1664, 464, -96}, { -1528, 352, -64}, { -1184, 784, -328}, { -976, 536, 0}, { -960, 680, -8}, { -1032, 872, 0}, { -888, 688, -176}, { -1360, 728, -232}, { -1728, 352, -104}, { -1704, 376, -240}, { -1904, 408, -72}, { -1944, 184, 96}, { -193...
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_assert(after_size == (before_size - to_free)); } struct file_description { const char *name; size_t size; }; static struct file_description descriptions[] = { // ...
prv_file_create(descriptions[i].name, descriptions[i].size)
; } // re-initialize the app-cache (which will attempt to purge resource files too) app_cache_init(); // make sure the 'standard' files are all there for (uint32_t i = 0; i < ARRAY_LENGTH(descriptions); ++i) { prv_check_file_exists(descriptions[i].name); } }
{ bool passed = true; activity_prefs_activity_insights_set_enabled(true); // Set to the trigger time struct tm time_tm = {}; const time_t now = rtc_get_time(); localtime_r(&now, &time_tm); time_tm.tm_hour = 20; time_tm.tm_min = 25; rtc_set_time(mktime(&time_tm)); // Set the step history activit...
(data->menu_layer)
); } // ------------------------------------------------------------------------------- static void prv_window_load(Window *window) { ActivityTestAppData *data = window_get_user_data(window); Layer *window_layer = window_get_root_layer(window); GRect bounds = window_layer->bounds; uint32_t num_tests = ARRAY_...
char time_str_buf[TIME_BUFFER_LENGTH]; strftime(time_str_buf, TIME_BUFFER_LENGTH, format, &time); safe_strcat(out_buf, string_strip_leading_whitespace(time_str_buf), buf_length); } // ----------------------------------------------------------------------------------------- // Generates the sleep enter/exit time an...
kernel_zalloc_check(TIME_STRING_TIME_LENGTH)
; char *end_time = kernel_zalloc_check(TIME_STRING_TIME_LENGTH); char *time_range = kernel_zalloc_check(max_attr_length); const char *time_range_fmt = i18n_get("%s - %s", &pin_attr_list); /// "10:00AM - 11:00PM" clock_copy_time_string_timestamp(start_time, TIME_STRING_TIME_LENGTH, session->start_utc); clock_c...
tm *gmtime_tm = NULL; if (pebble_task_get_current() == PebbleTask_App) { gmtime_tm = app_state_get_gmtime_tm(); } else { gmtime_tm = worker_state_get_gmtime_tm(); } sys_gmtime_r(timep, gmtime_tm); return gmtime_tm; } struct tm *pbl_override_localtime(const time_t *timep) { struct tm *localtime_t...
while (true) { // Skip to next '%' while (*fmt != 0 && *fmt != '%') fmt++; if (*fmt == 0) break; fmt++; // Skip flags, width, and precision until we find the format // specifier. If it's a floating point specifier, immediately bail. end_spec = false; while (!end_spec) { ...
ree(prefs); } iOSNotifPrefs* ios_notif_pref_db_get_prefs(const uint8_t *app_id, int key_len) { SettingsFile file; status_t rv = prv_file_open_and_lock(&file); if (rv != S_SUCCESS) { return 0; } if (!settings_file_exists(&file, app_id, key_len)) { char buffer[key_len + 1]; strncpy(buffer, (const ...
prv_file_close_and_unlock(&file)
; if (rv == S_SUCCESS) { char buffer[length + 1]; strncpy(buffer, (const char *)app_id, length); buffer[length] = '\0'; PBL_LOG(LOG_LEVEL_INFO, "Added <%s> to the notif pref db", buffer); blob_db_sync_record(BlobDBIdiOSNotifPref, app_id, length, rtc_get_time()); } return rv; } void ios_not...
d"); return false; } return true; } static bool prv_set_accel_sample_frequency(HRMDevice *dev, uint16_t freq) { const uint8_t msb = (freq >> 8) & 0xff; const uint8_t lsb = freq & 0xff; return prv_write_register(dev, ADDR_ACCEL_SAMPLE_FREQ_MSB, msb) && prv_write_register(dev, ADDR_ACCEL_SAMPLE_FREQ...
PBL_LOG(LOG_LEVEL_ERROR, "Timed-out waiting for the HRM app to be ready")
reate_test_animation(); Animation *b = prv_create_test_animation(); Animation *seq = animation_sequence_create(a, b, NULL); cl_assert(seq != NULL); // Try to create a spawn out of b and c Animation *c = prv_create_test_animation(); Animation *spawn = animation_spawn_create(c, b, NULL); cl_assert(spawn ==...
(elapsed_ms, 0)
; cl_must_pass(animation_get_progress(h, &progress)); cl_assert_equal_i(progress, 0); animation_set_elapsed(h, duration / 2); cl_must_pass(animation_get_elapsed(h, &elapsed_ms)); cl_assert_equal_i(elapsed_ms, duration / 2); cl_must_pass(animation_get_progress(h, &progress)); cl_assert_equal_i(progress, 32...
oid flash_init(void) { if (s_flash_lock) { return; // Already initialized } s_flash_lock = mutex_create(); s_erase_semphr = xSemaphoreCreateBinary(); xSemaphoreGive(s_erase_semphr); s_erase_poll_timer = new_timer_create(); s_erase_suspend_timer = new_timer_create(); flash_erase_init(); mutex_lock...
mutex_lock(s_flash_lock)
; stop_mode_disable(InhibitorFlash); // FIXME: PBL-18028 s_analytics_write_bytes_count += buffer_size; s_system_analytics_write_bytes_count += buffer_size; prv_erase_pause(); new_timer_start(s_erase_suspend_timer, 50, prv_erase_suspend_timer_cb, NULL, 0); while (buffer_size) { int written = flash_impl_...
/* * 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_handler(data, num_samples); }
if (s_raw_handler) { AccelRawData raw_data[num_samples]; for (int i = 0; i < num_samples; i++) { raw_data[i].x = data[i].x; raw_data[i].y = data[i].y; raw_data[i].z = data[i].z; } uint64_t timestamp = data[0].timestamp; s_raw_handler(raw_data, num_samples, timestamp); } } ...
ice_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(steps, 20); cl_assert_equal_i(duration_s, 20); cl_assert_equal_i(bpm, 80); prv_inc_time(10); prv_inc_steps_and_put_event(10); prv_put_bpm_event(117, HRMQua...
prv_inc_steps_and_put_event(1000)
; cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(steps, 1010); // Pretend we wrap around midnight. Midnight will reset the step count. s_total_step_count = 0; // Put some steps and ...
with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expres...
PBL_LOG(LOG_LEVEL_DEBUG, "===LE Stop Tx Test===")
; hci_rom_passthrough_send_cmd(0x8, 0x1f, NULL, 0); break; case 3: { PBL_LOG(LOG_LEVEL_DEBUG, "===LE Receiver Test==="); uint8_t params[] = { 0x00 }; hci_rom_passthrough_send_cmd(0x8, 0x1d, &params[0], sizeof(params)); break; } case 4: PBL_LOG(LOG_LEVEL_DEBUG, "===...
false /* scroll */); Animation *swap_up = prv_create_anim_frame((Layer *)&data->swap_layer, swap_frame_animation_dy, true /* scroll */); Animation *spawn = animation_spawn_create(peek_up, swap_up, NULL); AnimationHandlers anim_handlers...
layer_set_frame((Layer *)&data->swap_layer, &swap_frame)
; // play the peek layer after the delay, more delay for the first notification // because we're coming from the compositor modal transition const uint16_t peek_layer_play_delay = is_first_notification ? FIRST_PEEK_DELAY : 100; data->peek_layer_timer = evented_timer_register_or_reschedule(data->peek_layer_time...
into the middle of a page * (addr & 0xFFF > 0), overrunning the length of the page will cause * the write to "wrap around" and will modify (i.e. corrupt) data * stored before the starting address within the page. * */ static void flash_write_page(const uint8_t* buffer, uint32_t start_addr, uint16_t buffer_size) { ...
handle_sleep_when_idle_begin()
; uint32_t first_page_available_bytes = FLASH_PAGE_SIZE - (start_addr % FLASH_PAGE_SIZE); uint32_t bytes_to_write = MIN(buffer_size, first_page_available_bytes); if (first_page_available_bytes < FLASH_PAGE_SIZE) { PBL_LOG_VERBOSE("Address is not page-aligned; first write will be %"PRId32"B at address 0x%"PR...
/* * 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_CROAK("Out of memory")
; } app_state_set_user_data(data); push_window(data); } static void handle_deinit(void) { FSResourceAppData *data = app_state_get_user_data(); app_free(data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* fs_resources_app_get_info() { stat...
/* * 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_WARNING, "Data logging full at boot. Clearing...")
; // We reset all data logging here, including data logging for applications, // because an inability to allocate a new session means all 200+ session // IDs are exhausted, likely caused by a misbehaving app_hb. See discussion at: // https://github.com/pebble/tintin/pull/1967#discussion-diff-11746345 ...
g_style_font = TextStyleFont_Header, .paragraph_style_font = TextStyleFont_Body, }; const LayoutNodeConfig *reminder_timestamp_node_config = NULL; const LayoutNodeConfig *notification_timestamp_node_config = NULL; const LayoutNodeConfig *header_node_config = NULL; if (is_reminder) { reminder_timestam...
(ANALYTICS_DEVICE_METRIC_NOTIFICATION_JUMBOJI_COUNT, AnalyticsClient_System)
/* * 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 (bits_per_pixel == 1) return GBitmapFormat1BitPalette;
if (bits_per_pixel == 2) return GBitmapFormat2BitPalette; if (bits_per_pixel == 4) return GBitmapFormat4BitPalette; return GBitmapFormat8Bit; } bool gbitmap_png_data_is_png(const uint8_t *data, size_t data_size) { if (data_size >= sizeof(PNG_SIGNATURE)) { // PNG files start with [137, 'P', 'N', 'G'] ...
TimelineResourceSizeTiny, icon_from); } else { const bool use_pin = false; prv_setup_peek_animation(data, &first_timeline_layout->icon_info, use_pin); } } static void NOINLINE prv_setup_peek(TimelineAppData *data) { TimelineIterState *state = timeline_model_get_current_state(); Tim...
((Layer *)&timeline_layer->day_separator, true)
; layer_add_child(&window->layer, (Layer *)timeline_layer); // peek layer prv_init_peek_layer(s_app_data); prv_setup_peek(s_app_data); } static void prv_timeline_window_appear(Window *window) { TimelineAppData *data = window_get_user_data(window); // re-enable the inactivity timer back in timeline view ...
idate(draw_command_sequence, data_size)) { gdraw_command_sequence_destroy(draw_command_sequence); return NULL; } return draw_command_sequence; } GDrawCommandSequence *gdraw_command_sequence_clone(GDrawCommandSequence *sequence) { if (!sequence) { return NULL; } // potentially extracting into a ...
if (!sequence) { return; }
sequence->play_count = MIN(play_count, GDRAW_COMMAND_SEQUENCE_PLAY_COUNT_INFINITE_STORED); } uint32_t gdraw_command_sequence_get_total_duration(GDrawCommandSequence *sequence) { if (!sequence) { return 0; } if (sequence->play_count == GDRAW_COMMAND_SEQUENCE_PLAY_COUNT_INFINITE_STORED) { return PLAY_...
/* * 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...
htons(QEMU_HEADER_SIGNATURE)
/* * 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...
gbitmap_create_blank(GSize(size.w * steps_x, size.h * steps_y), GBITMAP_NATIVE_FORMAT)
abled_run_level && s_sends_enabled_pp); } // ---------------------------------------------------------------------------------------- //! Wrapper for data_logging_send_session that makes it usable in dls_list_for_each_session //! @param empty_all_data A bool that indicates if the session should be force emptied static...
{ return true; // nothing to flush yet }
bool success = false; uint8_t *buffer = kernel_malloc_check(DLS_ENDPOINT_MAX_PAYLOAD); unsigned int num_bytes = DLS_ENDPOINT_MAX_PAYLOAD; PBL_ASSERTN(logging_session->item_size <= num_bytes); num_bytes -= (num_bytes % logging_session->item_size); uint32_t new_read_offset; int32_t read_bytes = dls_stora...
rce/resource_ids.auto.h" #include "services/common/clock.h" #include "services/common/i18n/i18n.h" #include "services/normal/activity/activity_private.h" #include "services/normal/activity/health_util.h" #include "services/normal/activity/hr_util.h" #include "services/normal/activity/workout_service.h" #include "system...
(i18n_noop("AVG PACE (/MI)"), i18n_noop("AVG PACE (/KM)"))
; #endif case WorkoutMetricType_Pace: #if PBL_RECT /// Pace Label return i18n_noop("PACE"); #else /// Pace Label with units return active_window->workout_controller->get_distance_string(i18n_noop("PACE (/MI)"), i18n_noop("PA...
TIMEOUT_MS); uint8_t fake_data[max_length]; memset(fake_data, 0, max_length); comm_session_send_buffer_write(write_sb, fake_data, max_length); comm_session_send_buffer_end_write(write_sb); // Set a yield callback that gives the semph in time but closes the session: SemaphoreHandle_t write_semph = comm_...
htons(ENDPOINT_ID)
#include "applib/fonts/fonts.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/progress_window.h" #include "applib/ui/ui.h" #include "drivers/battery.h" #include "kernel/pbl_malloc.h" #include "process_management/app_install_manager.h" #include "process_management/app_manager.h" #include "process_managemen...
i18n_get("No internet\nconnection", data)
ied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "gtypes.h" #include "gtransform.h" #include "util/trig.h" #include <string.h> ////////////////////////////////////// /// Creating Transforms ////////////////////////////////////// // Note that i...
Fixed_S32_16_add(a_b, b_d)
; t_new->c = Fixed_S32_16_add(c_a, d_c); t_new->d = Fixed_S32_16_add(c_b, d_d); t_new->tx = Fixed_S32_16_add3(tx_a, ty_c, t2->tx); t_new->ty = Fixed_S32_16_add3(tx_b, ty_d, t2->ty); } void gtransform_scale(GTransform *t_new, GTransform *t, GTransformNumber sx, GTransformNumber sy) { if ((!t_new) || (!t)) { ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
for (int i = 0; i < NUM_BUTTONS; ++i) { window_long_click_subscribe(i, 0, prv_reboot_on_click, NULL); }
} static void prv_power_off_timer_expired(void *data) { enter_standby(RebootReasonCode_ShutdownMenuItem); } static void prv_battery_state_handler(BatteryChargeState charge) { struct AppData *data = app_state_get_user_data(); if (charge.is_plugged && !data->was_plugged) { app_timer_cancel(data->poweroff_tim...
es based on state changes // If this callback was called, there exists a modal ctx->properties |= ModalProperty_Exists; if (iter->current_idx > ModalPriorityDiscreet) { // There is a modal window that has a compositor transition ctx->properties |= ModalProperty_CompositorTransitions; } if (is_visibl...
(window, true /* animated */)
ay obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Li...
(&layer, &ctx)
SMC; const uint32_t apb1_periphs = RCC_APB1Periph_TIM2 | RCC_APB1Periph_TIM3 | RCC_APB1Periph_TIM4 | RCC_APB1Periph_TIM5 | RCC_APB1Periph_TIM6 | RCC_APB1Periph_TIM7 | RCC_APB1Periph_TIM12 | RCC_APB1Periph_TIM13 | RCC_APB1Periph_TIM14 | RCC_APB1Periph_WWDG | RCC_APB1Periph_SPI2 | RCC_APB1Periph_SPI3 ...
(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)
) { // We're good, we're just starting normally. PBL_LOG_VERBOSE("We're good, we're just starting normally."); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); return false; } // We failed to start our firmware successfully! if (watchdog_c...
nge(); } // ------------------------------------------------------------------------------------------------ bool activity_get_sessions(uint32_t *session_entries, ActivitySession *sessions) { if (sessions == NULL) { return false; } mutex_lock_recursive(s_activity_state.mutex); { uint32_t num_sessions_...
{ if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(averages, sizeof(*averages)); } return activity_get_step_averages(day_of_week, averages); }
// ------------------------------------------------------------------------------------------------ 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); } // ---------------------------------------...
youts it wants to. notifications_presented_list_set_current(second_id); swap_layer_attempt_layer_swap(&data->swap_layer, ScrollDirectionUp); return; } #else // On round displays, just set the new notification as the current one and show // the peek animation notifications_presented_lis...
vibes_short_pulse()
*state = context; if (state->shake_handler != NULL) { state->shake_handler(e->accel_tap.axis, e->accel_tap.direction); } } // ---------------------------------------------------------------------------------------------- // Event service handler for double tap events static void prv_session_do_double_tap_han...
{ return; }
if (sys_accel_manager_data_unsubscribe(state->manager_state)) { // There is a pending event posted. Only session tasks allocate memory for their state in the // first place so only free the memory if this is true state->deferred_free = prv_is_session_task(); } applib_free(state->raw_data); state->...
db_insert((uint8_t *)&menu_layer.uuid, sizeof(Uuid), (uint8_t *)&menu_layer, sizeof(AppDBEntry)); menu_layer_id = app_db_get_install_id_for_uuid(&menu_layer.uuid); app_cache_add_entry(menu_layer_id, menu_layer_size /* size */); cl_assert_equal_i(2, menu_layer_id); // load second app app_storage_get_file_name...
app_install_get_uuid_for_install_id(sports_id, &uuid)
); cl_assert_equal_uuid(uuid, sports_uuid); cl_assert_equal_b(false, app_install_get_uuid_for_install_id(CRAZY_ID, &uuid)); cl_assert_equal_uuid(uuid, UUID_INVALID); } void test_app_install_manager__has_worker(void) { cl_assert_equal_b(false, app_install_has_worker(tictoc_id)); cl_assert_equal_b(false, app_i...