prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
->context);
}
if (animation->implementation->teardown != NULL) {
animation->implementation->teardown(animation);
}
}
void animation_legacy2_private_unschedule_all(AppTaskCtxIdx idx) {
AnimationLegacy2Scheduler *animation_legacy2_scheduler =
animation_legacy2_scheduler_data... | // (render) events caused by this last update have been processed:
animation->is_completed = 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... | (strrchr(testbuf, 'Z'), NULL) | ;
}
void test_strchr__r_big_value(void) {
char testbuf[8] = "Hello!B";
cl_assert_equal_p(strrchr(testbuf, 0xF00 + 'B'), testbuf+6);
}
void test_strchr__r_end_of_string(void) {
char testbuf[8] = "Hello!B";
cl_assert_equal_p(strrchr(testbuf, '\0'), testbuf+7);
}
|
te.h"
#include "animation_interpolate.h"
#include "animation_private.h"
#include "animation_timing.h"
#include "applib/legacy2/ui/property_animation_legacy2.h"
#include "applib/app_logging.h"
#include "applib/applib_malloc.auto.h"
#include "system/passert.h"
#include "system/logging.h"
#include "util/size.h"
#include ... | if (!property_animation) {
return;
} |
GPoint result;
result.x = interpolate_int16(distance_normalized,
property_animation->values.from.gpoint.x,
property_animation->values.to.gpoint.x);
result.y = interpolate_int16(distance_normalized,
property_animation->v... |
/*
* 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_pbi_eq(&dest_bitmap, "test_bitblt__8bit_assign-expect.8bit.pbi")) | ;
memset(dest_data, GColorGreen.argb, sizeof(dest_data));
bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpAnd, GColorWhite);
cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_assign-expect.8bit.pbi"));
memset(dest_data, GColorGreen.argb, sizeof(dest_data));
bitblt_bitmap_into_... |
_abort)
{
int match = (s1 == NULL || s2 == NULL) ? (s1 == s2) : (strcmp(s1, s2) == 0);
if (!match) {
char buf[4096];
snprint_eq(buf, 4096, "'%s' != '%s'", s1, s2);
clar__assert(0, file, line, err, buf, should_abort);
}
}
void clar__assert_equal_i(
int i1,
int i2,
const char *file,
int line,
... | (0, file, line, err, buf, should_abort) | ;
}
}
void cl_set_cleanup(void (*cleanup)(void *), void *opaque)
{
_clar.local_cleanup = cleanup;
_clar.local_cleanup_payload = opaque;
}
${clar_modules}
int _MAIN_CC main(int argc, char *argv[])
{
return clar_test(argc, argv);
}
|
OG_LEVEL_ERROR, "No connection for idx=%d", conn_idx);
return;
}
BTDeviceInternal device = {};
connection_get_address(conn, &device);
if (prv_is_auto_accept_repairing_mode(conn, conn_idx)) {
PBL_LOG(LOG_LEVEL_DEBUG, "Auto-accepting pairing request");
extern void pair_reply(uint16_t conn_idx, bool ... | ble_gap_mtu_size_set(ATT_MAX_SUPPORTED_MTU) | ;
if (e != BLE_STATUS_OK) {
PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_mtu_size_set: %u", e);
}
e = ble_gap_role_set(GAP_PERIPHERAL_ROLE);
if (e != BLE_STATUS_OK) {
PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_role_set: %u", e);
}
// FIXME: PBL-23399: Single-source this.
const gap_conn_params_t preferred_params = {... |
/*
* 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... | printf("TAP version 13\n") | ;
}
static void clar_print_shutdown(int test_count, int suite_count, int error_count)
{
(void)test_count;
(void)suite_count;
(void)error_count;
if (!error_count)
printf("# passed all %d test(s)\n", test_count);
else
printf("# failed %d among %d test(s)\n", error_count,
test_count);
printf("1..%d\n", test... |
onding bonding[];
} GAPLEConnectionIntent;
_Static_assert(offsetof(GAPLEConnectionIntent, node) == 0,
"ListNode must be the first field in GAPLEConnectionIntent");
typedef enum {
GAPLEConnectionEventDisconnected,
GAPLEConnectionEventConnectedNotEncrypted,
GAPLEConnectionEventConnectedAndEncrypted... | event_put(&pebble_event) | ;
}
// -------------------------------------------------------------------------------------------------
static void prv_build_task_mask_cb(GAPLEConnectionIntent *intent, void *data) {
PebbleTaskBitset *task_mask = (PebbleTaskBitset *) data;
for (GAPLEClient c = 0; c < GAPLEClientNum; ++c) {
GAPLEConnectionCl... |
/*
* 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 GBITMAP_VERSION_0;
} |
return bitmap->info.version;
}
// indirection to allow conditional mocking in unit-tests
T_STATIC
#if !UNITTEST
// apparently, GCC doesn't inline this otherwise
// scary, I wonder how many more places like these aren't inlined
ALWAYS_INLINE
#endif
GBitmapDataRowInfo prv_gbitmap_get_data_row_info(const GBitmap *bitm... |
pi_bus);
prv_spi_send_data(slave->spi_bus, out);
}
void spi_ll_slave_burst_read(const SPISlavePort *slave, void *in, size_t len) {
PBL_ASSERTN(slave->slave_state->initialized);
PBL_ASSERTN(slave->slave_state->acquired);
PBL_ASSERTN(slave->slave_state->scs_selected);
uint8_t *cptr = in;
while (len--) {
... | PBL_ASSERTN(slave->slave_state->dma_state == SPISlavePortDMAState_Idle) | ;
slave->slave_state->dma_state = SPISlavePortDMAState_Write;
slave->slave_state->dma_complete_handler = handler;
slave->slave_state->dma_complete_context = context;
prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqTx, true);
dma_request_start_direct(slave->tx_dma, (void *)&slave->spi_bus->spi->DR, out, 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... | va_end(fmt_args) | |
yInsightType_ActivitySessionNap);
attribute_list_add_uint8(&pin_attr_list, AttributeIdHealthActivityType,
ActivitySessionType_Nap);
attribute_list_add_uint32(&pin_attr_list, AttributeIdTimestamp, session->start_utc);
attribute_list_add_cstring(&pin_attr_list, AttributeIdShortTitle,
... | ("Aren't naps great? You knocked out for %dH %dM!", body) | ,
hours, minutes);
i18n_free_all(body);
const NotificationConfig config = {
.notif_time = notif_time,
.session = session,
.insight_type = ActivityInsightType_ActivitySessionNap,
.icon_id = TIMELINE_RESOURCE_SLEEP,
.body = body,
.open_pin = {
.enabled = true,
.uuid = pi... |
FO, "Ignoring incoming call. A call is already in progress");
return;
}
// If we're not on iOS9+, we need to be connected to the mobile app since it tells us when
// the phone has stopped ringing
if ((event->source != PhoneCallSource_ANCS) && !s_mobile_app_is_connected) {
PBL_LOG(LOG_LEVEL_INFO, "Ignor... | {
// Be careful not to spam the logs with the new iOS polling implementation
PBL_LOG(LOG_LEVEL_INFO, "PebblePhoneEvent: %d, Call in progress: %s, Connected: %s",
event.type, s_call_in_progress ? "T": "F", s_mobile_app_is_connected ? "T": "F");
} | |
ning permissions and
* limitations under the License.
*/
#include "ecompass.h"
#include "applib/accel_service.h"
#include "applib/compass_service.h"
#include "util/trig.h"
#include "console/prompt.h"
#include "drivers/mag.h"
#include "kernel/event_loop.h"
#include "kernel/pbl_malloc.h"
#include "services/common/bat... | {
pitch -= (TRIG_MAX_ANGLE / 2);
} | else {
pitch -= TRIG_MAX_ANGLE;
}
}
*rollp = roll;
*pitchp = pitch;
}
static int32_t prv_correct_for_roll_and_pitch(AccelRawData *accel_data,
MagData *mag_data, int32_t roll, int32_t pitch) {
int32_t mx = mag_data->x - s_active_corr[0];
int32_t my = mag_data->y - s_active_corr[1];
int32_t m... |
/*
* 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... | {
compass_service_unsubscribe();
} |
int compass_service_peek(CompassHeadingData *data) {
CompassServiceConfig *config = *prv_get_config(PebbleTask_Unknown);
if ((config->peek_timer == NULL) && !sys_ecompass_service_subscribed()) {
// If we haven't initialized the compass yet by subscribing, do that now.
compass_service_subscribe(NULL);
}
... |
*config = prv_config();
return GRect(config->horizontal_margin, config->title_field.origin_y,
prv_text_layer_width(), config->title_field.size_h);
}
static GRect prv_time_rect(void) {
const MusicAppSizeConfig *config = prv_config();
return GRect(config->horizontal_margin, config->time_field.origi... | if (!music_is_command_supported(MusicCommandVolumeUp) ||
!music_is_command_supported(MusicCommandVolumeDown)) {
return;
} |
MusicAppData *data = app_state_get_user_data();
prv_show_volume_image(volume_is_up ? &data->image_volume_up : &data->image_volume_down);
music_command_send(volume_is_up ? MusicCommandVolumeUp : MusicCommandVolumeDown);
}
static Animation* prv_create_layer_upwards_animation(Layer *layer, int16_t offset) {
GPo... |
me - (59 * SECONDS_PER_MINUTE));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("IN 59 MIN", time_buf);
// June 10th 2015, 13:01:59 (T-00:58:01)
rtc_set_time(event_time - (58 * SECONDS_PER_MINUTE) - 1);
clock_get_until_time_capitalized(time_buf, ... | (time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS) | ;
cl_assert_equal_s("Fri, 12:00 PM", time_buf);
// June 11th 2015, 23:59:29 (T-12:00:31)
rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) - 31);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("Fri, 12:00 PM", time_buf);
// June 11th 2015, 23:... |
le);
cl_assert_equal_s(title->cstring, "Title");
Attribute *mute = attribute_find(¬if_prefs->attr_list, AttributeIdMuteDayOfWeek);
cl_assert(mute);
cl_assert_equal_i(mute->uint8, 0x1F);
Attribute *name = attribute_find(¬if_prefs->attr_list, AttributeIdAppName);
cl_assert(name);
cl_assert_equal_s(nam... | ios_notif_pref_db_get_dirty_list() | |
/*
* 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... | while (s1[len]) {
p = s2;
while (*p) {
if (s1[len] == *p++) {
return len;
}
}
len++;
} |
return len;
}
size_t strspn(const char *s1, const char *s2) {
size_t len = 0;
const char *p;
while (s1[len]) {
p = s2;
while (*p) {
if (s1[len] == *p) {
break;
}
p++;
}
if (!*p) {
return len;
}
len++;
}
return 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... | {
uint8_t nibble = data[i / 2];
if (i % 2 == 0) {
nibble >>= 4;
}
uint8_t index = nibble ^ (crc >> 4);
crc = lookup_table[index & 0xf] ^ ((crc << 4) & 0xf0);
} | |
const GDrawCommand *command) {
CompositorColorReplacementProcessor *p = (CompositorColorReplacementProcessor *)processor;
// fill with app framebuffer (only if a app_fb_key_color != clear was passed)
if (!gcolor_is_invisible(p->app_fb_key_color) &&
gcolor_e... | gbitmap_get_data_row_info(&app_framebuffer, y) | ;
GColor8 *input = (GColor8 *)(source_data_row_info.data + x1.integer);
GColor8 *output = (GColor8 *)(destination_data_row_info.data + x1.integer);
// First pixel with blending if fraction is different than 0
const uint16_t data_row_offset =
(uint16_t)(destination_data_row_info.data - (uint8_t *)framebuffe... |
<bluetooth/sm_types.h>
#include <btutil/bt_device.h>
// Fakes
///////////////////////////////////////////////////////////
#include "fake_events.h"
#include "fake_GAPAPI.h"
#include "fake_bluetooth_persistent_storage.h"
#include "fake_HCIAPI.h"
#include "fake_new_timer.h"
#include "fake_pbl_malloc.h"
#include "fake_s... | (HCI_ERROR_CODE_SUCCESS,
is_master, device) | ;
cl_assert_equal_b(gap_le_connection_is_connected(device), true);
}
static void prv_fake_disconnect(const BTDeviceInternal *device, bool is_master) {
fake_gap_put_disconnection_event(HCI_ERROR_CODE_SUCCESS,
HCI_ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST,
... |
t malformatted_album[] = {
0x10, 3, 'o', 'n', 'e', 10, 't', 'w', 'o', 5, 't', 'h', 'r', 'e', 'e'
};
const uint8_t malformatted_title[] = {
0x10, 3, 'o', 'n', 'e', 3, 't', 'w', 'o', 6, 't', 'h', 'r', 'e', 'e'
};
const uint8_t malformatted_player[] = {
0x13, 17, 'c', 'o', 'm', '.', 's', 'p', 'o', 't',... | fake_transport_set_sent_cb(s_transport, prv_assert_playback_command_sent_cb) | ;
for (int i = 0; i < ARRAY_LENGTH(cmds); ++i) {
music_command_send(cmds[i]);
fake_comm_session_process_send_next();
cl_assert_equal_i(s_is_playback_cmd_sent, true);
cl_assert_equal_i(s_playback_cmd_sent, opcodes[i]);
s_is_playback_cmd_sent = false;
}
}
void test_music_endpoint__player_name_not... |
_compare || (YEAR_IS_LEAP(year) && wday == leap_compare)) {
return 53;
} else {
return 52;
}
}
static int prv_iso8601_adjust(const struct tm *t, int year) {
const int week = prv_iso8601_base_week(t);
if (week == 0) {
return -1;
} else if (week > prv_year_week_count(year, t, 4, 3)) {
// 53 wee... | (i18nstr, dest_str, length + 1) | ;
} else {
memcpy(dest_str, cpystr, length);
}
dest_str += length;
left -= length;
break;
case 'A':
FMT_STRCOPY_I18N(time_locale->weekday[t->tm_wday % DAYS_PER_WEEK]);
break;
case 'h': // SU
case 'b':
FMT_STRCOPY_I18N(time_local... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&ctx.dest_bitmap, "draw_rect_across_y_origin_layer.${BIT_DEPTH_NAME}.pbi") | );
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_ny_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_ny_origin_layer.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_draw_rect_${BIT_DEPTH_NAME}__offset_layer(void)... |
pInstallId new_app_id = app_install_get_id_for_uuid(&default_process->uuid);
s_next_app = (NextApp) {
.md = default_process,
};
s_next_app.common.transition = shell_get_close_compositor_animation(current_app_id, new_app_id);
prv_app_switch(true /*gracefully*/);
}
const PebbleProcessMd* app_manager_get_cur... | analytics_set(ANALYTICS_APP_METRIC_APP_MAJOR_VERSION, app_version.major, AnalyticsClient_App) | ;
analytics_set(ANALYTICS_APP_METRIC_APP_MINOR_VERSION, app_version.minor, AnalyticsClient_App);
ResourceVersion resource_version = process_metadata_get_res_version(app_md);
analytics_set(ANALYTICS_APP_METRIC_RESOURCE_TIMESTAMP, resource_version.timestamp, AnalyticsClient_App);
if (app_md->is_rocky_app) {
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(calculated, 0) | ;
ANCSAttribute *zero_length_date = prv_create_ancs_attr("");
calculated = ancs_notifications_util_parse_timestamp(zero_length_date);
prv_destroy_ancs_attr(zero_length_date);
cl_assert_equal_i(calculated, 0);
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
cl_assert(s_msg.msg_arr != NULL);
cl_assert(s_msg.curr_msg_idx < s_msg.num_items);
char *expected_msg = NULL;
if (s_msg.num_processed != 0) {
expected_msg = s_msg.msg_arr[s_msg.curr_msg_idx - 1];
}
s_msg.curr_msg_idx++;
s_msg.num_processed++;
return (expected_msg);
} | |
rigin_center = GPointZero;
// 90 degrees should be (5, 0)
result = gpoint_from_polar_internal(&origin_center, radius, (TRIG_MAX_ANGLE / 4));
cl_assert_equal_gpoint(result, GPoint(5, 0));
// 270 (90 * 3) degrees should be (-5, 0)
result = gpoint_from_polar_internal(&origin_center, radius, (TRIG_MAX_ANGLE * 3 /... | (5, 4, 1, 2) | , grect_centered_internal(&p2, GSize(-1, -2)));
// handles fixed point
cl_assert_equal_grect(GRect(4, 4, 2, 2), grect_centered_internal(&p2, GSize(2, 2)));
p2.x.raw_value += FIXED_S16_3_HALF.raw_value;
cl_assert_equal_grect(GRect(5, 4, 2, 2), grect_centered_internal(&p2, GSize(2, 2)));
// Repeat for a posit... |
"stubs_sleep.h"
#include "stubs_task_watchdog.h"
#include "stubs_vibe_score_info.h"
#include "stubs_vibes.h"
#include "stubs_window_manager.h"
#include "fake_new_timer.h"
#include "fake_pbl_malloc.h"
#include "fake_rtc.h"
#include "fake_spi_flash.h"
#define PREF_KEY_DND_MANUALLY_ENABLED "dndManuallyEnabled"
static i... | cl_assert(do_not_disturb_is_active() == false) | ;
bool enabled = do_not_disturb_is_manually_enabled();
cl_assert(enabled == false);
do_not_disturb_set_manually_enabled(true);
enabled = do_not_disturb_is_manually_enabled();
cl_assert(enabled == true);
cl_assert(do_not_disturb_is_active() == true);
prv_assert_manually_dnd_setting_val(true);
cl_assert_... |
ather,
&list, NULL);
pin_db_insert_item_without_event(item);
timeline_item_destroy(item);
attribute_list_destroy_list(&list);
}
static void prv_add_weather_pin(int32_t delta_time_s) {
prv_add_weather_pin_with_params(delta_time_s, true, false, false);... | attribute_list_destroy_list(&list) | ;
}
static void prv_add_generic_pin(int32_t delta_time_s, bool has_subtitle) {
const time_t now = rtc_get_time();
AttributeList list = {};
prv_set_timeline_icon(&list, TIMELINE_RESOURCE_NOTIFICATION_FLAG, 0);
attribute_list_add_cstring(&list, AttributeIdTitle, "Delfina Pizza");
if (has_subtitle) {
attri... |
st BLECharacteristic characteristic_ref = (BLECharacteristic) data;
return (subscription->characteristic == characteristic_ref);
}
static GATTClientSubscriptionNode * prv_find_subscription_for_characteristic(
BLECharacteristic characteristic_ref,
... | {
if (subscription->subscriptions[client] == subscription_type) {
// Already subscribed
return BTErrnoInvalidState;
}
if (subscription->pending_confirmation[client] && !is_cleaning_up) {
// Already a pending subscription in flight...
return BTErrnoInvalidState;
}
previous_pre... | |
/*
* 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... | CLIP(normalized - delay, 0, ANIMATION_NORMALIZED_MAX) | ;
normalized = animation_timing_curve(normalized, AnimationCurveEaseInOut);
GPoint result;
result.x = interpolate_int16(normalized, from.x, to.x);
result.y = interpolate_int16(normalized, from.y, to.y);
return result;
}
//! Returns a new point halfway between two provided points
static GPoint prv_gpoint_mid(... |
cl_assert_equal_i(s_command_list[1].type, SectorEraseCommand) | ;
}
void test_flash_region__erase_optimal_range_subsectors(void) {
// Offer a less than full sector range but erase the full range
flash_region_erase_optimal_range(0, 4 * 1024, 64 * 1024, 64 * 1024);
cl_assert_equal_i(s_command_list_index, 1);
cl_assert_equal_i(s_command_list[0].addr, 0);
cl_assert_equal_i(... | |
case ToStringFormatMonthNumeric:
return true;
case ToStringFormatUnsupported:
case ToStringFormatEmpty:
case ToStringFormatSecond2Digit:
case ToStringFormatMinute2Digit:
case ToStringFormatHour2Digit:
case ToStringFormatLocaleDate:
case ToStringFormatDay2Digit:
case ToStringForma... | (result_buffer, ", ", remaining_buffer_size) | ;
remaining_buffer_size -= 2; // 2 = strlen(", ")
}
strncat(result_buffer, time_buffer, remaining_buffer_size);
return jerry_create_string_utf8((jerry_char_t *)result_buffer);
}
JERRY_FUNCTION(prv_to_locale_time_string) {
return prv_to_locale_time_or_date_string(this_val, argc, argv,
... |
// A touchdown occurs and the parent of the previous active recognizer becomes the active layer.
// No recognizers are reset and all recognizers remain in the possible state. The child is failed.
s_active_layer = &layer_a;
e.type = TouchEvent_Touchdown;
recognizer_manager_handle_touch_event(&e, &manager);
prv... | layer_init(&layer_a, &GRectZero) | ;
layer_add_child(root, &layer_a);
manager.window = &window;
manager.active_layer = &layer_a;
manager.state = RecognizerManagerState_RecognizersActive;
recognizer_add_to_list(r[0], &layer_a.recognizer_list);
recognizer_add_to_list(r[1], &layer_a.recognizer_list);
recognizer_set_manager(r[0], &manager);... |
cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 2);
// Consume it
prv_read_and_consume(&buffer, &client, storage, 2);
cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 0);
}
void test_shared_circular_buffer__subsampling_2of5(void) {
Sha... | (
&buffer, &client, item_size, out_buffer, 3) | , 3);
cl_assert_equal_m(out_buffer, "0a2c4e", 6);
subsampled_shared_circular_buffer_client_set_ratio(&client, 2, 3);
// Consume "5f6g7h8i"
cl_assert_equal_i(shared_circular_buffer_read_subsampled(
&buffer, &client, item_size, out_buffer, 3), 3);
// Normally the next read would skip 5f, but changing the... |
gister(LIS3DH_CTRL_REG1, ctrl_reg1)) {
// Write successful, low power mode disabled
return;
}
}
}
PBL_LOG(LOG_LEVEL_ERROR, "Failed to exit low power mode");
}
void lis3dh_power_down(void) {
if (accel_start()) {
uint8_t ctrl_reg1;
if (prv_read_register(LIS3DH_CTRL_REG1, &ctrl... | {
// Only buffer the data if we have clients that are subscribed.
if (!shared_circular_buffer_write(&s_buffer, (uint8_t *)accel_raw_data, num_samples * sizeof(AccelRawData),
false /*advance_slackers*/)) {
// Buffer is full, one or more clients will get dropped data
// ... | |
move the unfocused property
ctx->properties &= ~ModalProperty_Unfocused;
}
return true;
}
static bool prv_render_modal_stack_callback(ModalContext *modal, IterContext *iter, void *data) {
if (iter->current_idx < iter->first_opaque_idx) {
return true;
}
GContext *ctx = data;
WindowStack *stack = &... | modal_manager_get_window_stack(priority) | , window, animated);
}
// Commands
////////////////////////////
typedef struct WindowStackInfoContext {
SemaphoreHandle_t interlock;
WindowStackDump *dumps[NumModalPriorities];
size_t counts[NumModalPriorities];
bool disabled;
} WindowStackInfoContext;
static void prv_modal_window_stack_info_cb(void *ctx) {
... |
//////////////////////////////////////////////////////////
// Test Inbox Service Handlers
#define TEST_ARRAY_SIZE (4)
static int s_message_idx;
static struct {
uint8_t data[BUFFER_SIZE];
size_t length;
} s_messages[TEST_ARRAY_SIZE];
static int s_num_messages_to_consume_from_handler;
void test_message_handler(co... | {
// The syscall_failed() fake will trigger passert:
cl_assert_passert(app_inbox_create_and_register(BUFFER_SIZE, 1,
test_message_handler,
NOT_PERMITTED_DROP_HANDLER));
} |
void test_app_inbox__app_inbox_create_and_register_happy_case(void) {
void *result = app_inbox_create_and_register(BUFFER_SIZE, 1,
test_message_handler, test_dropped_handler);
cl_assert(result != NULL);
cl_assert_equal_b(true, app_inbox_service_has_inbox_for_tag(Ap... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (ctx, bg_color) | ;
graphics_fill_rect(ctx, &text_layer->layer.bounds);
}
if (text_layer->text && strlen(text_layer->text) > 0) {
graphics_context_set_text_color(ctx, get_native_color(text_layer->text_color));
graphics_draw_text(ctx, text_layer->text, text_layer->font, text_layer->layer.bounds,
tex... |
ext(Transport *transport);
static void prv_reset(Transport *transport);
static void prv_set_connection_responsiveness(Transport *transport,
BtConsumer consumer,
ResponseTimeState state,
... | (s_session, CommSessionCloseReason_UnderlyingDisconnection) | ;
s_session = NULL;
}
}
void test_session_receive_router__header_byte_by_byte(void) {
// Expect callback to "prepare" only after complete Pebble Protocol header has been received.
// Length high byte (big endian!)
RECEIVE(0x00);
cl_assert_equal_i(s_prepare_count, 0);
// Length low byte (big endian!)
... |
inset_y * 2) << FIXED_S16_3_PRECISION) / 2)};
prv_fill_oval_precise(ctx, center, radius_outer_x, radius_outer_y,
radius_inner_x, radius_inner_y, angle_start, angle_end);
}
void prv_fill_oval(GContext *ctx, GPoint center, uint16_t outer_radius_x, uint16_t outer_radius_y,
ui... | prv_fill_oval_quadrant_precise(ctx, center_precise, outer_x_precise, outer_y_precise,
inner_x_precise, inner_y_precise, quadrant) | ;
}
MOCKABLE void graphics_draw_arc_precise_internal(GContext *ctx, GPointPrecise center,
Fixed_S16_3 radius,
int32_t angle_start, int32_t angle_end) {
uint16_t stroke_width = ctx->draw_state.stroke_width;
// We acce... |
{
GAxis_X = 0,
GAxis_Y,
GAxis_W = GAxis_X,
GAxis_H = GAxis_Y,
} GAxis;
typedef enum {
GAxisAlign_Min = 0,
GAxisAlign_Center,
GAxisAlign_Max,
} GAxisAlign;
_Static_assert((((int)GAxisAlign_Min == GTextAlignmentLeft) &&
((int)GAxisAlign_Center == GTextAlignmentCenter) &&
... | if (text_node) {
*text_node = (GTextNodeText) {
.node.type = GTextNodeType_Text,
.node.free_on_destroy = true,
.text = buffer_size ? (char *)(text_node + 1) : NULL,
};
} |
return text_node;
}
GTextNodeTextDynamic *graphics_text_node_create_text_dynamic(
size_t buffer_size, GTextNodeTextDynamicUpdate update, void *user_data) {
GTextNodeTextDynamic *text_node = task_zalloc(sizeof(GTextNodeTextDynamic) + buffer_size);
if (text_node) {
*text_node = (GTextNodeTextDynamic) {
... |
|
context->closing_state == ProcessRunState_GracefullyClosing) {
// Right before a syscall drops privilege, it calls
// process_manager_force_close_syscall_exit_trap to check whether
// it is about to return control to a misbehaving app. This
// function checks the process context's clos... | persist_service_client_close(&context->app_md->uuid) | ;
event_reset_from_process_queue(task);
evented_timer_clear_process_timers(task);
event_service_clear_process_subscriptions(task);
#if CAPABILITY_HAS_BUILTIN_HRM
hrm_manager_process_cleanup(task, context->install_id);
#endif
#ifndef RECOVERY_FW
#if CAPABILITY_HAS_MICROPHONE
voice_kill_app_session(task);
#en... |
pp.h"
#include "applib/ui/ui.h"
#include "applib/ui/option_menu_window.h"
#include "bluetooth/bt_test.h"
#include "board/board.h"
#if CAPABILITY_HAS_MICROPHONE
#include "drivers/mic.h"
#endif
#include "services/common/bluetooth/bt_compliance_tests.h"
#if CAPABILITY_HAS_BUILTIN_HRM
#include "services/common/hrm/hrm_mana... | {
AppData *data = app_state_get_user_data();
const bool success = (status == HciStatusCode_Success);
PBL_LOG(LOG_LEVEL_DEBUG, "Step %d complete", data->current_test_step);
if (data->current_test_step == BTLETestStep_BTLEStop && data->current_test == BTLETestType_RX) {
// RX Test, need to keep track of rece... |
#if CAPABILITY_HAS_MICROPHONE
static void prv_mic_cb(int16_t *samples, size_t sample_count, void *context) {
// Just throw away the recorded samples.
}
#endif
static bool prv_run_test_step(BTLETestStep step, AppData *data) {
data->current_test_step = step;
PBL_LOG(LOG_LEVEL_DEBUG, "Run test step: %d", step);
... |
sh_check_whoami(QSPI_FLASH);
}
FlashAddress flash_impl_get_sector_base_address(FlashAddress addr) {
return (addr & SECTOR_ADDR_MASK);
}
FlashAddress flash_impl_get_subsector_base_address(FlashAddress addr) {
return (addr & SUBSECTOR_ADDR_MASK);
}
static bool prv_prf_supports_flash_protection(void) {
#if IS_BIGBO... | {
return 400;
} |
uint32_t flash_impl_get_typical_subsector_erase_duration_ms(void) {
return 40;
}
|
ry_monitor.h"
#include "board/board.h"
#include "kernel/low_power.h"
#include "kernel/util/standby.h"
#include "services/common/firmware_update.h"
#include "services/common/new_timer/new_timer.h"
#include "services/common/system_task.h"
#include "system/logging.h"
#include "util/ratio.h"
#include <stdint.h>
#define ... | (state.charge_percent) | |
ewind_scroll_duration_ms;
vars_out->duration_ms = scroll_duration_ms;
// Technically mod isn't necessary right now, but it's needed for looping eventually (PBL-40544)
int64_t elapsed_ms = cumulative_elapsed_ms % scroll_duration_ms;
const uint32_t end_of_normal_scroll_duration_ms = pause_at_start_ms + normal_sc... | prv_adjust_subtitle_node_for_scrolling_animation(structured_glance, ctx, node_text, buffer,
box) | ;
}
}
GTextNode *launcher_app_glance_structured_create_subtitle_text_node(
LauncherAppGlanceStructured *structured_glance, GTextNodeTextDynamicUpdate update) {
const size_t subtitle_buffer_size = ATTRIBUTE_APP_GLANCE_SUBTITLE_MAX_LEN + 1;
structured_glance->subtitle_update = update;
GTextNode *node = prv_s... |
ne TIME_RECT GRect(0, STEPS_TOP + STEPS_HEIGHT, DISP_COLS, STEPS_HEIGHT)
#define DELTA_STEP_RECT GRect(0, STEPS_TOP + 2 * STEPS_HEIGHT, 144, STEPS_HEIGHT)
#define TEXT_RECT GRect(0, STEPS_TOP + 3 * STEPS_HEIGHT - 3, \
DISP_COLS, DISP_ROWS - STEPS_HEIGHT * 3 + 3)
#define CURRENT_STEP_AVG 500
#de... | (data->debug_card.dialog_text) | ;
}
// -----------------------------------------------------------------------------------------
static void prv_display_seconds_history_alert(HealthAPITestAppData *data, const char *title,
HealthMetric metric) {
strcpy(data->debug_card.dialog_text, title);
// Get Hi... |
heap->begin;
do {
/* Check to see if the current fragment is marked as free. */
if(heap_info_ptr->is_allocated) {
alloc_segments++;
*used += heap_info_ptr->Size * ALIGNMENT_SIZE;
} else {
free_segments++;
/* Accumulate the total number of free Bytes. */
*... | {
return &allocated_block->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... | {
Animation *scroll_layer_animation =
property_animation_get_animation(menu_layer->scroll_layer.animation);
animation_set_elapsed(scroll_layer_animation,
animation_get_duration(scroll_layer_animation, true, true));
} |
// Actually handle the click
if (menu_layer->callbacks.select_click) {
menu_layer->callbacks.select_click(menu_layer, &menu_layer->selection.index,
menu_layer->callback_context);
}
}
static void prv_menu_select_long_click_handler(ClickRecognizerRef recognizer,
Men... |
layer_bounds->size.w - circle_center.x,
0, TRIG_MAX_ANGLE);
}
}
static void prv_update_proc(struct Layer *layer, GContext* ctx) {
TimelineLayer *timeline_layer = (TimelineLayer *)layer;
const GRect *bounds = &layer->bounds;
graphics_context_set_fill_color(ctx, GColorWh... | {
// we moved back to an item from the previous day, display the day separator
// by first hiding the pin of the "last" day that is about to come in and placing it there
if (layer->layouts[0]) {
prv_set_layout_hidden(layer->layouts[0], true);
}
prv_place_day_separator(layer);
} | else {
// continue to hide the day separator
layer_set_hidden((Layer *)&layer->day_separator, true);
}
}
bool timeline_layer_should_animate_day_separator(TimelineLayer *layer) {
return !layer_get_hidden((Layer *)&layer->day_separator);
}
void timeline_layer_move_data(TimelineLayer *layer, int delta) {
... |
ude "clar.h"
#include "pebble_asserts.h"
#include "applib/unobstructed_area_service.h"
// Stubs
/////////////////////
#include "stubs_app.h"
#include "stubs_app_manager.h"
#include "stubs_app_state.h"
#include "stubs_events.h"
#include "stubs_framebuffer.h"
#include "stubs_graphics.h"
#include "stubs_logging.h"
#incl... | {
UnobstructedAreaHandlers handlers = {
.will_change = prv_will_change,
};
app_unobstructed_area_service_subscribe(handlers, s_data.context);
cl_assert(fake_event_service_get_info(PEBBLE_UNOBSTRUCTED_AREA_EVENT)->handler);
cl_assert_equal_p(app_state_get_unobstructed_area_state()->handlers.will_change, 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... | applib_zalloc(frame_bytes) | ;
if (frame_data_buffer == NULL) {
goto cleanup;
}
const size_t bytes_read = sys_resource_load_range(app_num, resource_id,
0, frame_data_buffer, frame_bytes);
if (bytes_read != (size_t)frame_bytes) {
goto cleanup;
}
upng_t *upng = upng_create();
... |
ot still sleeping
int32_t sleep_state;
activity_get_metric(ActivityMetricSleepState, 1, &sleep_state);
if (sleep_state != ActivitySleepStateAwake) {
INSIGHTS_LOG_DEBUG("Not adding sleep pin - still asleep");
return;
}
// Get the sleep bounds for today and see if we actually have sleep data. The sleep... | prv_push_reward(now_utc, &ACTIVITY_REWARD_NOTIF_CONFIG) | |
ap, "draw_rect_origin_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 3);
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// TODO: Fi... | (&ctx, &OFFSET_DRAW_RECT_NO_CLIP) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw2_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 2);
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw2_clip_xy.$... |
// messages for the same range in quick succession and have multiple jobs
// scheduled as a result. This shouldn't be a frequent occurrence but see
// PBL-24741 as an example
DiscoveryJobQueue *new_job = connection->discovery_jobs;
if (!new_job) {
return; // nothing to do
}
if ((new_job->hdl.start ==... | {
BTErrno ret_val = BTErrnoOK;
bt_lock();
{
GAPLEConnection *connection = gap_le_connection_by_device(device);
if (!connection) {
ret_val = BTErrnoInvalidParameter;
goto unlock;
}
if (connection->gatt_is_service_discovery_in_progress) {
ret_val = BTErrnoInvalidState;
goto u... |
//! extern for gap_le_connnection.c
//! Cleans up any state and frees the associated memory of all the things this module might have
//! created for a given connection.
//! bt_lock() is assumed to be taken by the caller
void gatt_client_discovery_cleanup_by_connection(GAPLEConnection *connection, BTErrno reason) {
... |
id prv_log_failed_message(RebootReason *reboot_reason) {
PBL_LOG_SYNC(LOG_LEVEL_WARNING,
"Watchdog feed failed, last feed %dms ago, current status 0x%"PRIx16" mask 0x%"PRIx16,
(s_ticks_since_successful_feed * 1000) / TIMER_INTERRUPT_HZ,
s_watchdog_bits, s_watchdog_mask);
// Log about the tasks in... | (LOG_LEVEL_DEBUG, "WD: low priority ISR") | |
// Expect permissions UI to be presented:
prv_assert_permissions_ui_and_respond(true /* is_granted */);
// Device A unsubscribes:
bt_driver_cb_hrm_service_update_subscription(s_device_a, false);
prv_assert_event_service_subscribed(false);
// Device A re-subscribes, permission should still be valid:
b... | ble_hrm_handle_disconnection(&s_conn_a) | ;
prv_assert_event_service_subscribed(false);
cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 0);
ble_hrm_init(); // reinit, __cleanup() will deinit again
}
static void prv_put_and_assert_hrm_event(HRMEventType subtype, uint8_t bpm, HRMQuality quality,
... |
7", },
{ 2147483646LL, 11, "A02220280", },
{ 2147483646LL, 11, "a02220280", },
{ -2147483647LL, 11, "-A02220281", },
{ -2147483647LL, 11, "-a02220281", },
{ 2147483646LL, 12, "4BB2308A6", },
{ 2147483646LL, 12, "4bb2308a6", },
{ -2147483647LL, 12, "-4BB2308A7", },
{ -2147483647LL, 12, "-4bb2308a7", },
... | (strtol(s_base_test_data[i].str, NULL, s_base_test_data[i].base),
s_base_test_data[i].value) | ;
}
}
void test_strtol__zerobase(void) {
cl_assert_equal_i(strtol("573bb", NULL, 0), 573);
cl_assert_equal_i(strtol("0x573", NULL, 0), 0x573);
cl_assert_equal_i(strtol("0573", NULL, 0), 0573);
cl_assert_equal_i(strtol(" +573bb", NULL, 0), 573);
cl_assert_equal_i(strtol(" +0x573ghghghgh", NULL, 0), 0x573)... |
// reversed in the future)
if (s_data.expanding) {
prv_modal_transition_animation_init_sequence(MODAL_CONTRACT_FROM_MODAL_ANIMATION);
s_data.expanding = false;
}
distance_normalized = animation_timing_scaled(distance_normalized,
0,
... | (animation, duration) | ;
animation_set_curve(animation, AnimationCurveLinear);
}
}
static void prv_modal_push_transition_animation_init_round(Animation *animation) {
const uint32_t duration_ms = 8 * ANIMATION_TARGET_FRAME_INTERVAL_MS;
animation_set_duration(animation, duration_ms);
animation_set_curve(animation, AnimationCurveLi... |
/*
* 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_ERROR, "HcTest: unhandled message id: %d", msg->command_id) | |
_services, num_services);
for (uint8_t s = 0; s < num_found_services; ++s) {
BLEService service_ref = service_refs[s];
const Service *expected_service = services[s];
// Test gatt_client_service_get_uuid():
const Uuid uuid = gatt_client_service_get_uuid(service_ref);
cl_assert(uuid_equal(&uuid, &... | prv_mock_put_service_discovery_events() | ;
const uint8_t num_services = 1;
// Test gatt_client_copy_service_refs():
BLEService service_refs[num_services];
const Service *bp_service = fake_gatt_get_blood_pressure_service();
uint8_t num_found_services = gatt_client_copy_service_refs_matching_uuid(&device, service_refs,
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | graphics_draw_text(ctx, items[i].label, font, r, GTextOverflowModeTrailingEllipsis,
GTextAlignmentCenter, NULL) | ;
r.origin.x += r.size.w;
}
}
static const ActionMenuItem *prv_get_item_for_index(ActionMenuLayer *aml, int idx) {
if (!aml->num_items && !aml->num_short_items) {
return NULL;
}
PBL_ASSERTN(idx >= 0);
if (idx < aml->num_items) {
return &aml->items[idx];
} else {
const int short_items_idx... |
/*
* 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... | (flash_address) | ;
if (check_crc &&
!firmware_storage_check_valid_firmware_description(flash_address,
&firmware_description)) {
*out_metadata = (FirmwareMetadata){};
return false;
}
// The FirmwareMetadata is stored at the end of the binary
const uint32_t ... |
, GColorWhite));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &outside_x_y_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(framebuffer_is_empty("outside_x_y_origin_layer", ctx.parent_framebuffer, GColorWhite));
}
void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__offset... | (p.x + 3, p.y) | );
graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y));
graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y));
graphics_draw_pixel(ctx, GPoint(p.x + 6, p.y));
graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y));
graphics_draw_pixel(ctx, GPoint(p.x + 0, p.y + 1));
graphics_draw_pixel(ctx, GPoint(p.x + 1, p.y + 1));
graphi... |
/*
* 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... | (21845, f(two_third, half, ANIMATION_NORMALIZED_MAX)) | ;
cl_assert_equal_i(109224, f(four_third, half, ANIMATION_NORMALIZED_MAX));
}
|
ig_provider = prv_click_config_provider,
});
swap_layer_set_click_config_onto_window(swap_layer, window);
layer_add_child(root_layer, swap_layer_get_layer(swap_layer));
StatusBarLayer *status_layer = &data->status_layer;
status_bar_layer_init(status_layer);
status_bar_layer_set_colors(status_layer, PBL_IF_... | {
return;
} |
// the notification has been acted on. Remove it.
NotificationWindowData *data = &s_notification_window_data;
notification_storage_set_status(&action_result->id, TimelineItemStatusActioned);
data->notifications_modified = true;
if (data->is_modal) {
// Don't remove the action menu here. The timeline ac... |
_offset_y;
GTextNode *vertically_centered_charging_icon_node =
prv_wrap_text_node_in_vertically_centered_container(&charging_icon_node->node);
graphics_text_node_container_add_child(&horizontal_container_node->container,
vertically_centered_charging_icon_node);... | {
settings_glance->glance_state.is_pebble_app_connected =
event->bluetooth.comm_session_event.is_open;
} | |
/*
* 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_handle_erase(command, length) | ;
return;
case IMAGING_CMD_WRITE:
prv_handle_write(command, length);
return;
case IMAGING_CMD_CRC:
prv_handle_crc(command, length);
return;
case IMAGING_CMD_QUERY_REGION:
prv_handle_query_region(command, length);
return;
case IMAGING_CMD_FI... |
/*
* 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... | {
exit(EXIT_FAILURE);
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (ctx, NULL) | );
cl_assert_equal_p(ctx->draw_state.draw_mask, NULL);
cl_check(gbitmap_pbi_eq(&ctx->dest_bitmap, TEST_NAMED_PBI_FILE(expected_image)));
graphics_context_mask_destroy(ctx, mask);
free(ctx);
}
// Tests
////////////////////////////////////
// NOTE: All of the following tests first fill the framebuffer with g... |
_state(bool expect_is_handled) {
uint8_t msg[] = { 0x11, 0x01, 0xAA, 0x00, 0x00, 0x00, 0xAA, 0x00, 0x00, 0x00, 0x01, 0x01 };
prv_receive_pp_data(msg, sizeof(msg));
PebbleEvent e = fake_event_get_last();
if (expect_is_handled) {
cl_assert_equal_i(e.type, PEBBLE_MEDIA_EVENT);
cl_assert_equal_i(e.media.ty... | fake_rtc_init(0, 0) | ;
fake_comm_session_init();
music_init();
s_transport = fake_transport_create(TransportDestinationSystem, NULL, NULL);
fake_transport_set_connected(s_transport, true /* connected */);
// Simulate connecting Pebble mobile app:
prv_receive_app_event(true /* is_open */);
}
void test_music_endpoint__cleanup(... |
e(AlertInvalid));
cl_assert(!alerts_should_notify_for_type(AlertMobile));
cl_assert(!alerts_should_notify_for_type(AlertReminder));
cl_assert(!alerts_should_notify_for_type(AlertPhoneCall));
}
void test_alerts__do_not_disturb(void) {
cl_assert(alerts_get_mask() == AlertMaskAllOn);
// We now allow notificati... | cl_assert(!alerts_should_enable_backlight_for_type(AlertReminder)) | ;
cl_assert(alerts_should_notify_for_type(AlertOther));
cl_assert(!alerts_should_vibrate_for_type(AlertOther));
alerts_set_notification_vibe_timestamp();
fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS);
cl_assert(!alerts_should_enable_backlight_for_type(AlertOther));
s_dnd_active = t... |
tedValue in_deep_sleep;
float weight; // Weight percent error by this factor
int test_idx;
int force_shut_down_at;
} SleepFileTestEntry;
typedef struct {
ActualValue total;
ActualValue deep;
ActualValue start_at;
ActualValue end_at;
ActualValue cur_state_elapsed;
ActualValue in_sleep;
... | for (int i = 0; i < s_stats_num_columns; i++) {
free(s_stats_column_names[i]);
s_stats_column_names[i] = NULL;
} |
// Free the rows
StatsRow *next = s_stat_rows;
while (next) {
StatsRow *to_free = next;
next = (StatsRow *)next->node.next;
free(to_free);
}
s_stat_rows = NULL;
s_stats_num_columns = 0;
}
// ---------------------------------------------------------------------------------------
// Callback 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... | (af_config->gpio, &init) | ;
gpio_release(af_config->gpio);
}
void gpio_af_configure_fixed_output(const AfConfig *af_config, bool asserted) {
GPIO_InitTypeDef init = {
.GPIO_Pin = af_config->gpio_pin,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_NOPULL
}... |
structed area is derived from the origin of the obstruction.
//! This is equivalent to the height of the unobstructed area.
static void prv_origin_y_to_area(int16_t origin_y, GRect *area_out) {
PBL_ASSERTN(area_out);
*area_out = (GRect) {
.size = { DISP_COLS, origin_y },
};
prv_clip_area(area_out);
}
void ... | unobstructed_area_service_unsubscribe(app_state_get_unobstructed_area_state()) | ;
}
|
saturday_10_30);
do_not_disturb_handle_clock_change();
active = do_not_disturb_is_active();
cl_assert(active == false);
// Timer will go off at 01:00 on Sunday. (14.5 hours)
cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 52200 * MS_PER_SECOND);
do_not_disturb_set_schedule_enabled(WeekendSche... | (s_sunday_10_00) | ;
do_not_disturb_handle_clock_change();
active = do_not_disturb_is_active();
cl_assert(active == false);
// Timer will go off at 01:00 on Sunday. (14 hours)
cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 50400 * MS_PER_SECOND);
rtc_set_time(s_sunday_23_30);
do_not_disturb_handle_clock_chan... |
_ctx, foreground_color);
Layer cell_layer;
layer_init(&cell_layer, &cell_frame);
cell_layer.is_highlighted = is_selected;
s_cell_is_highlighted = is_selected;
const MenuCellLayerConfig config = {
.title_font = column_data->title_font ? fonts_get_system_font(column_data->title_font) : NULL,
.subtitle... | ARRAY_LENGTH(s_menu_system_basic_cell_test_column_data) | ,
/* is_legacy2 */ true);
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE));
#endif
}
void test_menu_layer_system_cells__basic_cell_width_144(void) {
const int16_t cell_width = 144;
prv_prepare_canvas_and_render_cells(
MenuCellType_Basic, cell_width,
s_menu_system_basic_cell_test_column_da... |
dler)(const void *value, size_t val_len);
typedef struct {
const char *key;
void *value;
uint16_t value_len;
PrefSetHandler handler;
} PrefsTableEntry;
// The PREFS_DECLARE_HANDLER creates a springboard function with a generic signature
// (of type PrefSetHandler) which simply calls into the specialized functi... | strncmp((const char *)key, entry->key, key_len) | ) {
return entry;
}
}
PBL_LOG(LOG_LEVEL_WARNING, "Unrecognized key: %s", (const char *)key);
return NULL;
}
// ------------------------------------------------------------------------------------
// Set the backing store for a pref
static bool prv_set_pref_backing(const PrefsTableEntry *entry, const v... |
/*
* 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, 2, 28, 20) | , 4);
}
void clear_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorClear);
graphics_context_set_antialiased(ctx, false);
graphics_draw_round_rect(ctx, &GRect(2, 2, 28, 20), 4);
}
void across_x_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set... |
ick_config_provider(actionable_dialog,
prv_decline_config_provider);
app_actionable_dialog_push(actionable_dialog);
}
//////////////////////////////////////////
// ActionableDialog with custom action bar
static void prv_custom_action_bar_click_up(ClickRecognizerRef recognizer, void *context) {
Dialog *dialo... | expandable_dialog_get_dialog(expandable_dialog) | ;
dialog_set_text(dialog, data->lorem_ipsum);
dialog_set_background_color(dialog, GColorLightGray);
dialog_show_status_bar_layer(dialog, true);
expandable_dialog_set_header(expandable_dialog, "Header");
app_expandable_dialog_push(expandable_dialog);
}
////////////////////////////////
// Expandable Dialog wi... |
KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "app_run_state.h"
#include "launcher_app_message.h"
#include "kernel/event_loop.h"
#include "kernel/pbl_malloc.h"
#include "process_management/app_install_manager.h"
#... | (LOG_LEVEL_ERROR, "length mismatch, expected %"PRIu32" byte(s), got %"PRIu32" bytes",
(uint32_t) sizeof(AppStateMessage), (uint32_t) length) | |
ze.w;
PropertyAnimation *prop_anim =
property_animation_create_layer_frame((Layer *)&data->action_menu_layer, start, &stop);
Animation *content_out = property_animation_get_animation(prop_anim);
animation_set_duration(content_out, IN_OUT_ANIMATION_DURATION);
AnimationHandlers anim_handlers = {
.starte... | action_menu_layer_deinit(&data->action_menu_layer) | |
48, 440, 88},
{ 232, 448, -104},
{ 592, 496, -248},
{ 1248, 656, -168},
{ 1120, -136, 248},
{ 1552, -496, 312},
{ 1824, -192, 104},
{ 2416, 224, -24},
{ 1992, 312, 296},
{ 1240, 208, 288},
{ 888, 168, 48},
{ 848, 248, 112},
// 13 seconds
{ 968, 256, 128},
{ 1176,... | { 1280, 320, -40},
{ 1872, -176, 272},
{ 2048, -304, 344},
{ 1824, -296, 224},
{ 1640, -216, 200},
{ 1368, -96, 192},
{ 1224, -56, 96},
{ 1184, -152, 160},
{ 1184, -232, 144},
{ 1104, -376, 200},
{ 856, -456, -16},
{ 1080, -568, -24},
{ 736, -504, 64},
{ 1584, 40,... |
{ 1376, 0, 168},
{ 1736, -16, 272},
{ 1840, 208, 216},
{ 2248, 1056, 408},
// 21 seconds
{ 976, 776, -72},
{ 1120, 600, 112},
{ 1288, 648, 168},
{ 1736, 232, 344},
{ 2048, -248, 520},
{ 2024, -360, 272},
{ 1704, -192, 176},
{ 1544, -112, 208},
{ 1488, -160, 216},... |
m_session_event_put;
void event_put(PebbleEvent* event) {
if (event->type == PEBBLE_COMM_SESSION_EVENT &&
event->bluetooth.comm_session_event.is_system) {
s_comm_session_event_put = true;
};
}
void app_launch_trigger(void) {
}
void session_remote_version_start_requests(CommSession *session) {
}
static ... | (transport, &s_transport_imp,
TransportDestinationSystem) | |
graphics_draw_vertical_line_dotted(&ctx, GPoint(12, 6), 10);
graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 6), 10);
graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 7), 10);
graphics_draw_vertical_line_dotted(&ctx, GPoint(24, 7), 10);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_F... | graphics_draw_vertical_line_dotted(&ctx, GPoint(24, 7), 10) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_vert_dotted_line_even_offset_no_clip")));
// Even cols of different lengths
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_ROWS);
graphics_dr... |
hange_type != None) {
// Upon connect and disconnect, reset the cached data:
music_update_player_volume_percent(0);
// Taking short-cut here, music_update_now_playing already puts NowPlayingChanged event, no
// need to put it again by calling music_update_player_name:
s_music_ctx.player_name[0] = 0... | mutex_lock_recursive(s_music_ctx.mutex) | ;
const bool has_player_name = (s_music_ctx.player_name[0] != 0);
if (player_name_out) {
strcpy(player_name_out, s_music_ctx.player_name);
}
mutex_unlock_recursive(s_music_ctx.mutex);
return has_player_name;
}
bool music_has_now_playing(void) {
bool has_now_playing = false;
mutex_lock_recursive(s... |
irst_part_size);
second_block->PrevSize = first_part_size;
second_block->is_allocated = false;
second_block->Size = block->Size - first_part_size;
block->Size = first_part_size;
/* Calculate the pointer to the next segment. */
HeapInfo_t* next_next_block = get_next_block(heap, second_block);
/... | while (heap_iter < heap->end) {
unsigned long block_size = (long)(heap_iter->Size) * ALIGNMENT_SIZE;
if (heap_iter->is_allocated) {
pc = (void *)heap_iter->pc;
type = "";
num_alloc_blocks++;
num_alloc_bytes += block_size;
} else {
pc = NULL;
type = "FREE";
num_free... |
snprintf(buffer, sizeof(buffer), "Heap start %p", heap->begin);
util_dbgserial_str(buffer);
snprintf(buffer, sizeof(buffer), "Heap end %p", heap->end);
util_dbgserial_str(buffer);
snprintf(buffer, sizeof(buffer), "Heap total size %zu", heap_size(heap));
util_dbgserial_str(buffer);
snprintf(buffer, si... |
ic act_metric = prv_get_activity_metric(metric);
return sys_activity_get_metric(act_metric, history_len, history);
#endif
}
// ----------------------------------------------------------------------------------------------
HealthServiceAccessibilityMask health_service_metric_accessible(
HealthMetric metric, time_t ... | health_service_aggregate_averaged(metric, now_utc, now_utc, HealthAggregationAvg,
HealthServiceTimeScopeOnce) | |
include "workout_active.h"
#include "workout_controller.h"
#include "workout_metrics.h"
#include <limits.h>
#include <stdio.h>
enum {
SPORTS_TIME_KEY = 0x0, // TUPLE_CSTRING
SPORTS_DISTANCE_KEY = 0x1, // TUPLE_CSTRING
SPORTS_DATA_KEY = 0x2, // TUPLE_CSTRING
SPORTS_UNITS_KEY ... | (0 /* interval_s */) | ;
prv_update_scrollable_metrics(data);
}
data->current_bpm = new_tuple->value->uint8;
break;
}
case SPORTS_CUSTOM_LABEL_KEY:
{
if (strncmp(new_tuple->value->cstring,
data->custom_label_string,
sizeof(data->custom_label_string)) != 0) {
... |
(window, data) | ;
window_set_window_handlers(window, &(WindowHandlers) {
.load = prv_window_load,
});
const bool animated = true;
app_window_stack_push(window, animated);
}
////////////////////
// App boilerplate
static void handle_init(void) {
AppData *data = app_malloc_check(sizeof(AppData));
app_state_set_user_da... | |
er *layer) = {
[Card_ActivitySummary] = health_activity_summary_show_select_indicator,
#if CAPABILITY_HAS_BUILTIN_HRM
[Card_HrSummary] = health_hr_summary_show_select_indicator,
#endif
[Card_SleepSummary] = health_sleep_summary_show_select_indicator,
};
///////////////////////////////////////////////////////////... | content_indicator_set_content_available(&health_card_view->down_indicator,
ContentIndicatorDirectionDown,
false) | ;
}
static void prv_set_window_background_color(HealthCardView *health_card_view) {
Layer *card_layer = health_card_view->card_layers[health_card_view->current_card_index];
window_set_background_color(&health_card_view->window,
s_card_view_get_bg_color[health_card_view->current_card_index](card_layer));
}
#... |
, -760},
// 107 seconds
{ 456, 424, -768},
{ 456, 384, -752},
{ 480, 416, -760},
{ 464, 384, -768},
{ 472, 384, -760},
{ 464, 416, -760},
{ 472, 376, -768},
{ 488, 392, -760},
{ 472, 408, -760},
{ 464, 376, -752},
{ 480, 392, -768},
{ 480, 392, -760},
{ 472, 400, ... | { 488, 408, -752},
{ 480, 408, -736},
{ 480, 368, -768},
{ 464, 392, -768},
{ 480, 400, -752},
{ 496, 408, -752},
{ 464, 400, -760},
{ 472, 376, -768},
{ 472, 400, -752},
{ 472, 384, -760},
{ 472, 392, -752},
{ 464, 416, -768},
// 113 seconds
{ 472, 336, -776},
... |
{ 480, 400, -760},
{ 472, 400, -752},
{ 496, 392, -752},
{ 464, 408, -760},
{ 488, 416, -752},
{ 480, 392, -752},
{ 472, 392, -760},
{ 472, 408, -752},
{ 464, 392, -744},
{ 480, 440, -760},
{ 464, 352, -776},
{ 464, 392, -768},
{ 472, 384, -776},
{ 480, 424, -720... |
/*
* 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_PLATFORM_SWITCH(platform,
/*aplite*/ 5,
/*basalt*/ 5,
/*chalk*/ 4,
/*diorite*/ 5,
/*emery*/ 5) | ;
}
// TODO: Once PBL-16032 is implemented, use that instead.
static int64_t prv_get_precise_time(void) {
time_t seconds;
uint16_t milliseconds;
time_ms(&seconds, &milliseconds);
return (seconds * 1000) + milliseconds;
}
inline static bool action_bar_is_highlighted(ActionBarLayer *action_bar, uint8_t index) {... |
, void *ctx) {
size_t *size = ctx;
const size_t command_size = gdraw_command_get_data_size(command);
if (command_size > *size) {
*size = command_size;
}
return true;
}
T_STATIC size_t prv_get_list_max_command_size(GDrawCommandList *command_list) {
if (!command_list) {
return 0;
}
size_t size =... | gdraw_command_list_get_num_points(command_list) | ;
const size_t max_bytes = num_points * sizeof(GPoint);
GPoint *points = applib_malloc(num_points * sizeof(GPoint));
if (!points) {
return NULL;
}
CollectPointsCBContext ctx = {
.values = {
.points = points,
.is_precise = is_precise,
},
.iter.bytes_left = max_bytes,
};
gdraw_c... |
8, 920, 224},
{ -48, 920, 224},
{ -48, 928, 232},
{ -40, 936, 224},
{ -40, 920, 208},
{ -40, 928, 208},
{ -48, 928, 232},
{ -40, 920, 216},
{ -48, 920, 216},
{ -56, 912, 224},
{ -40, 912, 224},
{ -32, 928, 232},
{ -48, 920, 240},
{ -40, 920, 240},
{ -40, 920, 256}... | { -40, 912, 256},
{ -40, 920, 256},
{ -40, 912, 256},
{ -40, 912, 256},
{ -40, 912, 264},
{ -40, 920, 256},
{ -40, 920, 256},
{ -40, 912, 256},
{ -40, 920, 256},
{ -40, 912, 248},
{ -40, 920, 256},
{ -40, 912, 264},
{ -40, 912, 256},
{ -40, 912, 256},
{ -40, 9... |
{ -40, 920, 264},
{ -48, 912, 240},
{ -40, 920, 256},
{ -40, 920, 248},
{ -40, 936, 256},
{ -40, 920, 248},
{ -40, 920, 240},
{ -48, 912, 248},
{ -40, 920, 248},
{ -40, 920, 256},
{ -40, 912, 248},
{ -40, 920, 248},
{ -40, 912, 256},
{ -40, 920, 256},
{ -40, ... |
enable the HR sensor in case we turned it off for a while
static void prv_update_enable_timer_cb(void *context) {
system_task_add_callback(prv_update_hrm_enable_system_cb, NULL);
}
//! The system task needs its own handler for HRM data since we can't queue up generic events.
static void prv_system_task_hrm_handler(v... | {
bool success;
if (state->queue) {
PebbleEvent e = {
.type = PEBBLE_HRM_EVENT,
.hrm = *event,
};
success = xQueueSendToBack(state->queue, &e, 0);
} else {
prv_queue_system_task_event(event);
success = system_task_add_callback(prv_system_task_hrm_handler, NULL);... |
T_STATIC void prv_charger_event_cb(PebbleEvent *e, void *context) {
const PebbleBatteryStateChangeEvent *evt = &e->battery_state;
mutex_lock_recursive(s_manager_state.lock);
{
s_manager_state.enabled_charging_state = !evt->new_state.is_plugged;
}
mutex_unlock_recursive(s_manager_state.lock);
system_t... |
;
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 2), MAX_NUM_COLS + 4);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 4), 0);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 6), 1);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 8), 2);
graphics_draw_horizontal_line_dotted(&ctx, GPoint... | graphics_draw_vertical_line_dotted(&ctx, GPoint(6, 0), 1) | ;
graphics_draw_vertical_line_dotted(&ctx, GPoint(8, 0), 2);
graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 0), 3);
graphics_draw_vertical_line_dotted(&ctx, GPoint(12, 0), 4);
graphics_draw_vertical_line_dotted(&ctx, GPoint(14, 0), 20);
graphics_draw_vertical_line_dotted(&ctx, GPoint(16, 0), 21);
graph... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.