prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
#endif
// SW = 5
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 5);
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP);
cl_... | graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 3);
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw3_cli... |
/*
* 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... | { // Fast mode
if (bus->hal->duty_cycle == I2CDutyCycle_16_9) {
duty_cycle_low = 16;
duty_cycle_high = 9;
} else if (bus->hal->duty_cycle == I2CDutyCycle_2) {
duty_cycle_low = 2;
duty_cycle_high = 1;
} else {
WTF; // It might be possible to encode a duty cycle differently from... |
RCC_ClocksTypeDef rcc_clocks;
RCC_GetClocksFreq(&rcc_clocks);
uint32_t prescaler = rcc_clocks.PCLK1_Frequency /
(bus->hal->clock_speed * (duty_cycle_low + duty_cycle_high));
if ((rcc_clocks.PCLK1_Frequency %
(bus->hal->clock_speed * (duty_cycle_low + duty_cycle_high))) == 0) {
// Prescaler is... |
app id");
return;
}
const ANCSAttribute *title = notif_attributes[FetchedNotifAttributeIndexTitle];
const ANCSAttribute *subtitle = notif_attributes[FetchedNotifAttributeIndexSubtitle];
const ANCSAttribute *display_name = app_attributes[FetchedAppAttributeIndexDisplayName];
const ANCSAttribute *date = n... | (app_notif_prefs) | ;
}
void ancs_notifications_handle_notification_removed(uint32_t ancs_uid, ANCSProperty properties) {
// Dismissal from phone is only properly supported on iOS 9 and up
// The presence of the DIS service tells us we have at least iOS 9
const bool ios_9 = (properties & ANCSProperty_iOS9);
if (!ios_9) {
retu... |
/*
* 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... | progress_layer_set_progress(&data->progress_layer, data->progress) | ;
}
static void prv_click_config_provider(void *context) {
window_single_click_subscribe(BUTTON_ID_SELECT, prv_select_click_handler);
window_single_repeating_click_subscribe(BUTTON_ID_UP, 200, prv_up_click_handler);
window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 200, prv_down_click_handler);
}
static v... |
rv_spi_dma_tx_cb(void *user_data, uint16_t transferred) {
s_spi_dma_complete = true;
}
// Wait for DMA to complete. Note that since we don't have interrupts enabled, we're polling for
// the interrupt and then calling the DMA Interrupt Handler directly. This will cause the
// callback above to be called.
static void... | printf("CD: re-entered\n") | ;
// Update the reboot reason. Preserve the LR.
RebootReason reason;
reboot_reason_get(&reason);
reason.code = RebootReasonCode_CoreDumpReentered;
reboot_reason_set(&reason);
// Go into low-power mode. Hard reset isn't useful.
prv_low_power_mode();
}
s_core_dump_initiated = true;
i... |
diately follows.
// Length: 1, Endpoint ID: NON_EXISTENT_ENDPOINT_ID, Payload: 0x55
RECEIVE(0x00, 0x01, NON_EXISTENT_ENDPOINT_ID >> 8, NON_EXISTENT_ENDPOINT_ID & 0xff, 0x55,
0x00, 0x01, PRIVATE_TEST_ENDPOINT_ID >> 8, PRIVATE_TEST_ENDPOINT_ID & 0xff, 0xaa);
assert_meta_response_sent(MetaResponseCodeUnha... | RECEIVE(0xbb, 0xcc, 0xdd) | |
Node *)current->node.next;
}
return current;
}
static TimelineNode *prv_find_first(TimelineNode *head, TimelineIterDirection direction,
time_t timestamp, time_t today_midnight, bool show_all_day_events) {
if (direction == TimelineIterDirectionPast) {
return prv_find_first_past(head, timestamp, today_midnig... | {
prv_set_nodes_all_day(nodes, header, num_nodes);
} | else {
prv_set_nodes(nodes, header, num_nodes);
}
for (int i = 0; i < num_nodes; i++) {
*list_head = (TimelineNode *)list_sorted_add((ListNode *)*list_head, (ListNode *)nodes[i],
prv_time_comparator, true);
}
}
static bool prv_each(SettingsFile *file, SettingsRecordInfo *info, void *context) {
... |
};
cl_assert(S_SUCCESS == reminder_db_read((uint8_t*)&item1.header.id, sizeof(Uuid), (uint8_t*)&temp,
sizeof(CommonTimelineItemHeader)));
// Note: we set things to null because it makes it easier to compare two
// TimelineItems with memcmp
// check item 1
memset(&temp, 0, sizeof(TimelineItem));
cl_as... | (parent_id) | , S_SUCCESS);
// confirm the two are gone
cl_assert(reminder_db_get_len((uint8_t *)&item1.header.id, sizeof(Uuid)) == 0);
cl_assert(reminder_db_get_len((uint8_t *)&item2.header.id, sizeof(Uuid)) == 0);
// confirm the others are still here
cl_assert(reminder_db_get_len((uint8_t*)&item3.header.id, sizeof(Uuid))... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (void, sys_event_service_client_subscribe, EventServiceInfo *handler) | {
if (PRIVILEGE_WAS_ELEVATED) {
syscall_assert_userspace_buffer(handler, sizeof(*handler));
}
PebbleTask task = pebble_task_get_current();
// Get info
QueueHandle_t *event_queue;
if (task == PebbleTask_App) {
event_queue = app_manager_get_task_context()->to_process_event_queue;
} else if (task ... |
chunk) {
if (rocky_global_has_event_handlers(ROCKY_EVENT_MESSAGE)) {
// Last chunk MUST be zero terminated:
if (s_state.in.reassembly_buffer[s_state.in.total_size_bytes - 1] != '\0') {
PBL_LOG(LOG_LEVEL_ERROR, "Last Chunk MUST be zero-terminated! Dropping msg.");
} else {
// Try to... | {
// Retry happens below by calling prv_control_message_queue_send_head()
} |
}
break;
}
case OutboxMsgTypeChunk: {
if (is_sent_successfully) {
prv_object_queue_handle_chunk_sent();
} else {
if (s_state.out.failure_count >= CHUNK_MESSAGE_MAX_FAILURES) {
APP_LOG(APP_LOG_LEVEL_WARNING, "Dropping Message.");
prv_object_queue_pop_... |
(LOG_LEVEL_DEBUG, "Vibe status <%s>", on ? "on" : "off") | ;
prv_vibe_raw_ctl(on);
}
void vibe_force_off(void) {
if (!s_initialized) {
return;
}
prv_vibe_raw_ctl(false);
}
int8_t vibe_get_braking_strength(void) {
if (BOARD_CONFIG_VIBE.options & ActuatorOptions_HBridge) {
// We support the full -100..100 range, send it all the way backwards
return VIBE... | |
_convert_pps_request_params(const PebblePairingServiceConnParamSet *pps_params_in,
GAPLEConnectRequestParams *params_out) {
const uint16_t min_1_25ms = pps_params_in->interval_min_1_25ms;
params_out->connection_interval_min_1_25ms = min_1_25ms;
params_out->connection_int... | prv_handle_set_remote_desired_state(connection, &conn_params->remote_desired_state) | ;
break;
case PebblePairingServiceConnParamsWriteCmd_EnablePacketLengthExtension:
PBL_LOG(LOG_LEVEL_INFO, "Enabling BLE Packet Length Extension");
break;
case PebblePairingServiceConnParamsWriteCmd_InhibitBLESleep:
PBL_LOG(LOG_LEVEL_INFO, "BLE Sleep Mode inhibited!");
... |
/*
* 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 (!list) {
return NULL;
}
size_t size = gdraw_command_list_get_data_size(list);
GDrawCommandList *result = applib_malloc(size);
if (result) {
memcpy(result, list, size);
}
return result;
} |
void gdraw_command_list_destroy(GDrawCommandList *list) {
if (list) {
applib_free(list);
}
}
static GDrawCommand *prv_next_command(GDrawCommand *command) {
return (GDrawCommand *) (command->points + command->num_points);
}
bool gdraw_command_list_validate(GDrawCommandList *command_list, size_t size) {
i... |
2},
{ 696, 656, 448},
{ 200, 128, -96},
{ -192, -120, -152},
{ -552, -232, -344},
{ -1368, 376, 104},
{ -560, 448, -720},
{ -792, 112, -544},
{ -784, -72, -280},
{ -928, 160, -440},
{ -952, 48, -880},
{ -888, -248, -680},
// 351 seconds
{ -1008, -264, -576},
{ -63... | // 356 seconds
{ -312, -424, -1160},
{ -128, -320, -1216},
{ -216, -336, -1040},
{ -192, -184, -992},
{ -48, -200, -944},
{ -16, -360, -872},
{ 32, -288, -880},
{ 32, -320, -848},
{ 184, -352, -848},
{ 432, -456, -792},
{ 104, -656, -1016},
{ 248, -328, -1136},
{ ... | |
/*
* 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... | (" w offset %"PRIu32, logging_session->storage.write_offset) | |
prompt_send_response_fmt(buffer, 128, "Erasing sectors from 0x%"PRIx32" for %ub",
address, length) | ;
const uint32_t end_address = address + length;
const uint32_t aligned_end_address =
(end_address + (SUBSECTOR_SIZE_BYTES - 1)) & SUBSECTOR_ADDR_MASK;
flash_region_erase_optimal_range_no_watchdog(address, address, end_address, aligned_end_address);
prompt_send_response("OK");
}
void command_dump_flas... | |
(this, packet) | ;
break;
case ControlCode_ConfigureAck:
prv_on_configure_ack(this, packet);
break;
case ControlCode_ConfigureNak:
case ControlCode_ConfigureReject:
prv_on_configure_nak_or_reject(this, packet);
break;
case ControlCode_TerminateRequest:
prv_on_terminate_request(this, p... | |
-72, -768, -648},
{ -120, -728, -616},
{ -120, -728, -648},
// 2 seconds
{ -88, -704, -704},
{ -64, -720, -720},
{ -64, -744, -728},
{ -32, -744, -752},
{ -48, -752, -760},
{ -32, -720, -752},
{ -48, -728, -720},
{ -48, -712, -736},
{ -56, -696, -728},
{ -48, -672, -... | { -472, -400, -520},
{ -256, -408, -520},
{ -40, -80, -776},
{ 368, 200, -896},
{ 240, -184, -952},
{ 184, -472, -1056},
{ 208, -504, -1008},
{ 120, -592, -1088},
{ 168, -584, -1264},
{ 168, -680, -1120},
{ -72, -696, -888},
{ -64, -704, -952},
{ -120, -768, -752},
... | |
/*
* 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 (RCC_GetFlagStatus(RCC_FLAG_LSERDY) != RESET) {
PBL_LOG(LOG_LEVEL_INFO, "LSE oscillator started after %d ms", i);
break;
}
delay_us(1000);
watchdog_feed();
} |
if (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET) {
PBL_LOG(LOG_LEVEL_ERROR, "LSE oscillator did not start");
}
}
}
bool clocksource_is_lse_started(void) {
return (RCC_GetFlagStatus(RCC_FLAG_LSERDY) != RESET);
}
void clocksource_MCO1_enable(bool on) {
static int8_t s_refcount = 0;
portENTER_CRI... |
/*
* 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(atol("573888"), 573888) | ;
cl_assert_equal_i(atol("713713"), 713713);
}
void test_atol__whitespace_pfx(void) {
cl_assert_equal_i(atol(" 500"), 500);
cl_assert_equal_i(atol(" 765"), 765);
cl_assert_equal_i(atol(" 573888"), 573888);
cl_assert_equal_i(atol(" 713713"), 713713);
}
void test_atol__suffix(void) ... |
success = prv_schedule_animation(state, now, child, delay);
}
}
}
// Set the duration now, after we've possibly adjusted the children delays to compensate
// for already scheduled children.
animation->duration_ms = prv_get_total_duration(state, animation, false /*delay*/,
... | prv_get_time_normalized_raw(animation, now) | ;
return prv_get_distance_normalized(animation, time_normalized_raw);
}
bool animation_get_progress(Animation *animation_h, AnimationProgress *progress_out) {
AnimationState *state = prv_animation_state_get(PebbleTask_Current);
PBL_ASSERTN(!animation_private_using_legacy_2(state));
AnimationPrivate *animation... |
s
fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */);
pfs_init(false /* run filesystem check */);
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME,
false /* is_next */);
resource_init();
... | {
prv_render_timeline_peek(&(TimelinePeekItemConfig) {
.title = "NY 3\nSF 12",
.icon = TIMELINE_RESOURCE_TIMELINE_BASEBALL,
.num_concurrent = 1,
});
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE));
} |
void test_timeline_peek__peek_concurrent_1(void) {
prv_render_timeline_peek(&(TimelinePeekItemConfig) {
.title = "NY 3 - SF 12",
.subtitle = "Bottom of the 9th",
.icon = TIMELINE_RESOURCE_TIMELINE_BASEBALL,
.num_concurrent = 1,
});
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE));
}
void ... |
bounds->size.w, bounds->size.h),
GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL);
}
static void prv_display_saving_message(Layer *layer, GContext *ctx) {
AppData *data = app_state_get_user_data();
const GRect *bounds = &data->window.layer.bounds;
graphics_context_set_text_... | layer_mark_dirty(&app_data->window.layer) | ;
}
static void prv_save_offsets_callback(void *data) {
AppData *app_data = app_state_get_user_data();
mfg_info_set_disp_offsets((GPoint) {
.x = app_data->axis_offsets[X_AdjustState],
.y = app_data->axis_offsets[Y_AdjustState]
});
app_window_stack_pop_all(false);
}
static void prv_back_click_handler... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | strcat(destbuf, "larity") | ;
cl_assert_equal_m(expectbuf, destbuf, 9);
}
void test_strcat__weird(void) {
char destbuf[9] = "hi\0five";
char expectbuf[9] = "hilarity";
strcat(destbuf, "larity");
cl_assert_equal_m(expectbuf, destbuf, 9);
}
void test_strcat__return(void) {
char destbuf[9] = "hi";
char expectbuf[9] = "hilarity";
cl... |
orientation, &vmc, &light);
} else if (state->test_entry.version == 3) {
sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d, %d", &steps, &orientation, &vmc,
&light, &plugged_in);
} else {
cl_assert(false);
}
fflush(stdout);
PBL_ASSERTN(state->test_entry.nu... | {
// Read next entry if necessary
if (!state->common.file) {
if (!prv_sample_discovery_next_file(&state->common)) {
return false;
}
}
// Parse next set of samples in the current file
bool success = prv_parse_sleep_samples_file(state);
if (success) {
*entry = state->tes... |
}
// ---------------------------------------------------------------------------------------
// Return info on the next set of samples
static bool prv_activity_sample_discovery_next(ActivityFileTestEntry *entry) {
ActivitySampleDiscoveryState *state = &s_activity_sample_discovery_state;
while (true) {
// Re... |
raw_command_image_draw(&ctx, img, GPoint(48, 96));
char fn[20];
snprintf(fn, sizeof(fn), "tos_%06d.png", t);
tests_write_gbitmap_to_pbi(&ctx.dest_bitmap, fn);
free(img);
t += dt;
}
}
int16_t prv_int_scale_and_translate_to(
int16_t value, int16_t size, int16_t from_range, int16_t to_range,
... | (s / 2, s, 2 * s, 2 * s) | ;
GDrawCommandImage *img = weather_app_resource_create_cloud();
GPointIndexLookup *index_lookup = gdraw_command_list_create_index_lookup_by_distance(
gdraw_command_image_get_command_list(img), GPoint(s / 2, s));
free(img);
Fixed_S32_16 f = Fixed_S32_16(FIXED_S32_16_ONE.raw_value / 8);
while (t <= ANIM... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
PBL_ASSERTN(s_num_subscribers > 0);
--s_num_subscribers;
if (s_num_subscribers == 0) {
PBL_LOG(LOG_LEVEL_DEBUG, "stopping tick timer");
regular_timer_remove_callback(&s_tick_timer_info);
}
} | |
ncrement /
// decrment animation.
int y_offset =
prv_get_y_offset_which_vertically_centers_font(selection_layer->font, height);
// We might not be drawing from the top of the frame, compensate if needed
if (selection_layer->selected_cell_idx == i && selection_layer->bump_is_... | animation_get_context(animation) | |
ta);
return true;
}
void event_put(PebbleEvent* event) {
s_num_dnd_events_put++;
}
// Thursday, March 12, 2015, 00:00 UTC
static const int s_thursday_00_00 = 1426118400;
// Thursday, March 12, 2015, 01:00 UTC
static const int s_thursday_01_00 = 1426122000;
// Thursday, March 12, 2015, 12:00 UTC
static const int s... | cl_assert(enabled == false) | ;
prv_assert_manually_dnd_setting_val(false);
cl_assert_equal_i(s_num_dnd_events_put, 2);
do_not_disturb_set_manually_enabled(true);
enabled = do_not_disturb_is_manually_enabled();
cl_assert(do_not_disturb_is_active() == true);
cl_assert(enabled == true);
prv_assert_manually_dnd_setting_val(true);
cl_a... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | simple_dialog_create("Ping") | ;
Dialog *dialog = simple_dialog_get_dialog(s_dialog);
dialog_set_background_color(dialog, GColorCobaltBlue);
dialog_set_text_color(dialog, GColorWhite);
dialog_set_text(dialog, "Ping");
WindowStack *stack = modal_manager_get_window_stack(ModalPriorityGeneric);
simple_dialog_push(s_dialog, stack);
}
void... |
althServiceAccessibilityMaskNoPermission;
}
if (!prv_metric_aggregation_implemented(metric, time_start, time_end, aggregation, scope)) {
return HealthServiceAccessibilityMaskNotSupported;
}
// Get our state
HealthServiceState *state = prv_get_state(false);
HealthServiceTimeRange time_range = {};
He... | {
// If this is scope-once, the metric is BPM, and the time range is less than
// HS_MAX_MINUTE_DATA_SEC, we can use minute history since the amount of data is manageable.
return prv_compute_aggregate_using_minute_history(state, metric, time_start, time_end,
... |
} else if (metric == HealthMetricHeartRateRawBPM) {
// We don't allow the user to gather data from raw HR samples. Only return the current and
// return. If time_start and time_end were not for the current time, they are filtered out
// by the function above `prv_metric_aggregation_implemented`.
int3... |
/*
* 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... | {
const bool take_ownership = true;
kino_reel_scale_segmented_set_delay_lookup_creator(reel, prv_create_lookup_by_angle, ctx,
take_ownership);
kino_reel_scale_segmented_set_point_duration(reel, UNFOLD_DEFAULT_POINT_DURATION);
kino_reel_scale_segment... |
return reel;
}
void kino_reel_unfold_set_start_as_dot(KinoReel *reel, int16_t radius) {
GRect frame = kino_reel_transform_get_from_frame(reel);
kino_reel_transform_set_from_frame(
reel, (GRect) { grect_center_point(&frame), UNFOLD_DOT_SIZE });
const Fixed_S16_3 from = Fixed_S16_3((2 * radius) << FIXED_... |
#elif defined(BOARD_V2_0)
.hw_platform = FirmwareMetadataPlatformPebbleTwoPointZero,
#elif defined(BOARD_V1_5)
.hw_platform = FirmwareMetadataPlatformPebbleOnePointFive,
#elif defined(BOARD_EV2_4)
.hw_platform = FirmwareMetadataPlatformPebbleOneEV2_4,
#else
.hw_platform = FirmwareMetadataPlatformUnknown,
#endif... | version_copy_running_fw_metadata(&running_meta_data) | ;
version_copy_update_fw_metadata(&update_meta_data);
int rv = prv_version_compare_fw_version_tags(update_meta_data.version_tag,
running_meta_data.version_tag);
// return true is the new firmware to be updated to is a version less than the old one.
return (rv < 0);
}
|
{ 1824, 352, -80},
{ 1776, 352, -104},
{ 1544, 256, -128},
{ 1320, 160, -48},
{ 1152, 144, -96},
{ 1016, 160, -88},
{ 984, 200, -184},
{ 976, 152, -168},
{ 936, 80, -192},
{ 784, 72, -240},
{ 800, -64, -200},
{ 1096, -16, -296},
{ 1200, 320, -408},
{ 1232, 688, -53... | { 960, 128, -200},
{ 880, 120, -128},
{ 968, 112, -192},
{ 920, 112, -168},
{ 728, 96, -240},
{ 1024, 56, -160},
// 58 seconds
{ 1272, 168, -256},
{ 1296, 144, -544},
{ 1296, 168, -416},
{ 1264, 96, -400},
{ 1000, 144, -304},
{ 920, 120, -272},
{ 856, 256, -304},
... |
// ----------------------------------------------------------------
// Sample captured: 2015-10-01 09:33:36 local
AccelRawData *activity_sample_walk_100_pbl_25471_7(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_25471_7
//> TEST_EXPECTED 100
//> T... |
turn;
}
cl_assert(s_remote_receive_handler);
s_remote_receive_handler(s_sent_endpoint_id, s_sent_data, s_sent_data_length);
kernel_free(s_sent_data);
s_sent_data = NULL;
}
void sys_get_app_uuid(Uuid *uuid) {
cl_assert(uuid);
*uuid = s_app_uuid;
}
static void (*s_process_manager_callback)(void *data);
st... | (prv_ack_sent_callback) | ;
prv_send_test_data();
prv_process_sent_data();
// With certain PP transports (i.e. PPoGATT), the 'consuming' of the outbound data / outbox sent
// callback can fire after the AppMessage (N)ACK has been received.
cl_assert_equal_b(app_message_is_accepting_outbound(), false);
prv_call_outbox_sent(AppOutbox... |
/*
* 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... | {
// "" * 3
assert_float_parse("", 3, false, 0);
} |
void test_ams_util__float_string_parse_not_a_number(void) {
// "hello" * 3
assert_float_parse("hello", 3, false, 0);
// " " * 3
assert_float_parse(" ", 3, false, 0);
}
void test_ams_util__float_string_parse_no_fraction(void) {
// "42" * 3
assert_float_parse("42", 3, true, 42 * 3);
}
void test_ams_util__... |
you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARR... | {
break;
} |
}
PBL_ASSERT(i < QSPI_WAIT_TIME, "Waited too long for the QSPI to become not busy");
}
#else
static void prv_wait_for_transfer_complete(void) {
while (QSPI_GetFlagStatus(QSPI_FLAG_TC) == RESET) { }
}
static void prv_wait_for_not_busy(void) {
while (QSPI_GetFlagStatus(QSPI_FLAG_BUSY) != RESET) { }
}
#endif
... |
ession metadata to make sure the session pointer corresponds to
// the same session that was added to the reopen list. This guards
// against the session being destroyed and another getting allocated
// to the same address.
Uuid app_uuid;
time_t timestamp;
uint32_t tag;
} DataLoggingReopenEntry;
static str... | {
// No one is waiting for ack, just stop the timer
new_timer_stop(s_endpoint_data.ack_timer);
return;
} |
RtcTicks current_ticks = rtc_get_ticks();
if (soonest_ack_timeout < current_ticks) {
// Handle the timeout immediately. This will result the in the timer being rescheduled if we're still
// waiting for an ack.
check_ack_timeout();
return;
}
// Convert from ticks to ms for the timer
RtcTicks... |
ll_layer->animation);
if (scroll_layer_get_paging(scroll_layer)) {
animation_set_custom_interpolation(animation, interpolate_moook);
animation_set_duration(animation, interpolate_moook_duration());
}
animation_set_auto_destroy(animation, false);
}
animation_schedule(animation);... | ((Layer*)scroll_layer) | ;
layer_set_hidden(&scroll_layer->shadow_sublayer, hidden);
}
bool scroll_layer_get_shadow_hidden(const ScrollLayer *scroll_layer) {
return layer_get_hidden(&scroll_layer->shadow_sublayer);
}
void scroll_layer_set_paging(ScrollLayer *scroll_layer, bool paging_enabled) {
PBL_ASSERTN(scroll_layer);
if (paging_e... |
lities for 8-bit color) to draw a vertical line (using the test's specified raw
// drawing function) for each `num_pixels_per_mask_value`-tall row.
void prv_assign_vertical_line_raw(GContext *ctx, int16_t x, Fixed_S16_3 y1, Fixed_S16_3 y2,
GColor color);
static void prv_vline_pattern... | cl_assert_equal_p(ctx->draw_state.draw_implementation, &g_mask_recording_draw_implementation) | ;
// Should now have mask2 attached to GContext
cl_assert_equal_p(ctx->draw_state.draw_mask, mask2);
// Calling record with NULL should reset draw impl to default and mask in GContext to NULL
cl_assert(graphics_context_mask_record(ctx, NULL));
cl_assert_equal_p(ctx->draw_state.draw_implementation, &g_default... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | fake_spi_flash_init(0, 0x1000000) | |
// 217 seconds
{ -16, -56, -960},
{ -16, -56, -952},
{ -16, -40, -960},
{ -16, -64, -960},
{ -16, -32, -952},
{ -16, -48, -960},
{ -16, -64, -952},
{ -24, -48, -960},
{ -24, -64, -952},
{ -8, -56, -952},
{ -16, -48, -952},
{ -16, -56, -960},
{ -16, -80, -952},
... | { -16, -48, -952},
{ -16, -48, -952},
{ -16, -48, -960},
{ -16, -56, -960},
{ -16, -40, -952},
{ -16, -48, -960},
{ -16, -48, -952},
{ -16, -40, -952},
{ -16, -48, -952},
{ -16, -48, -960},
{ -16, -48, -960},
{ -16, -48, -952},
{ -16, -40, -960},
{ -16, -48, -952}... |
{ 0, -48, -944},
{ -16, -48, -960},
{ -16, -56, -952},
{ -16, -40, -952},
{ -24, -32, -960},
{ -32, -40, -952},
{ -40, -56, -960},
{ -32, -40, -960},
{ -8, -24, -952},
{ -16, -24, -968},
{ -8, -24, -960},
{ -8, -24, -952},
{ 0, -8, -952},
{ -8, -24, -968},
{ ... |
0);
}
void test_ams_util__float_string_parse_not_zero_terminated(void) {
uint8_t buffer[] = {'1'};
assert_float_parse(buffer, 3, true, 3);
}
void test_ams_util__float_string_parse_null_in_the_middle(void) {
uint8_t buffer[] = {'1', 0, '2'};
assert_float_parse(buffer, 3, true, 3);
}
void test_ams_util__float... | (multi_values, sizeof(multi_values), NULL,
prv_result_callback) | ;
cl_assert_equal_i(s_results_count, 3);
cl_assert_equal_i(count, 3);
assert_result(0, "A", 1);
assert_result(1, "B", 1);
assert_result(2, "C", 1);
}
void test_ams_util__csv_stop_after_one_value(void) {
const char multi_values[] = "A,B,C";
s_max_results_count = 1;
const uint8_t count = ams_util_csv_par... |
>
//! <uint8_t key_size M> <uint8_t[M]> key_bytes>
//! \endcode
//!
//! <b>CLEAR:</b> This command will clear all entries in the database specified.
//!
//! \code{.c}
//! 0x05 <uint16_t token> <uint8_t DatabaseId>
//! \endcode
//! BlobDB Endpoint ID
static const uint16_t BLOB_DB_ENDPOINT_ID = 0xb1db;
static const uin... | if (!iter || (iter != (data + length))) {
prv_send_response(session, token, BLOB_DB_INVALID_DATA);
return;
} |
// perform action on database and return result
status_t ret = blob_db_insert(db_id, key_bytes, key_size, value_bytes, value_size);
prv_send_response(session, token, prv_interpret_db_ret_val(ret));
}
static void prv_handle_database_delete(CommSession *session, const uint8_t *data, uint32_t length) {
if (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... | (CANCELLED, data->alarm_id, data->callback_context) | ;
}
}
static DayPickerMenuItems prv_alarm_kind_to_index(AlarmKind alarm_kind) {
switch (alarm_kind) {
case ALARM_KIND_EVERYDAY:
return DayPickerMenuItemsEveryday;
case ALARM_KIND_WEEKENDS:
return DayPickerMenuItemsWeekends;
case ALARM_KIND_WEEKDAYS:
return DayPickerMenuItemsWeekdays;
... |
fo on this activity
uint32_t session_len_sec = session->length_min * SECONDS_PER_MINUTE;
time_t session_exit_utc = session->start_utc + session_len_sec;
ActivityClassParams *params = NULL;
switch (session->type) {
case ActivitySessionType_Sleep:
case ActivitySessionType_Nap:
params ... | (LOG_LEVEL_ERROR, "Invalid activity session detected - could be flash corrruption") | ;
// Zero out flash so that we don't get into a reboot loop
memset(state->activity_sessions, 0, sizeof(state->activity_sessions));
settings_file_set(file, &key, sizeof(key), state->activity_sessions,
sizeof(state->activity_sessions));
WTF;
}
sta... |
er, text_layer_get_layer(data->hr_card.text_layer));
// Update UI
prv_hr_update_text(data);
// Sample the Heart rate at a higher rate while in this view
health_service_set_heart_rate_sample_period(1 /*interval_s*/);
}
// -------------------------------------------------------------------------------
static ... | APP_LOG(APP_LOG_LEVEL_ERROR, "Unexpected accessibility result: %d", (int)mask) | ;
}
health_service_activities_iterate(HealthActivityMaskAll, now - (2 * SECONDS_PER_DAY), now,
HealthIterationDirectionFuture, prv_activity_iterate_cb,
&num_activities_found);
APP_LOG(APP_LOG_LEVEL_DEBUG, "Found %"PRIu32" activities", num_ac... |
/*
* 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... | (SimpleMenuLayer) | |
(AnimationStartedHandler) animation_started,
.stopped = (AnimationStoppedHandler) animation_stopped,
}, NULL /* callback data */);
animation_set_delay((Animation*)a_rev, 400);
animation_set_duration((Animation*)a_rev, DURATION);
animation_set_reverse((Animation *)a_rev, true);
GRect test_rect;
propert... | app_event_loop() | ;
deinit();
}
|
);
cl_assert_equal_i(1, s_graphics_draw_text.call_count);
cl_assert_equal_s("some text", s_graphics_draw_text.last_call.draw_text.text);
cl_assert_equal_i(GColorRedARGB8, s_graphics_draw_text.last_call.draw_text.color.argb);
cl_assert_equal_rect((GRect(10, 10, large_int, large_int)),
s... | ASSERT_JS_GLOBAL_EQUALS_S("a", "right") | ;
}
void test_rocky_api_graphics__text_font(void) {
cl_assert_equal_i(0, s_fonts_get_system_font.call_count);
s_fonts_get_system_font__result = (GFont)123;
rocky_global_init(s_graphics_api);
cl_assert_equal_i(1, s_fonts_get_system_font.call_count);
cl_assert_equal_p((GFont)123, s_rocky_text_state.font);
/... |
;
GBitmap arrow_left;
GBitmap arrow_up;
GBitmap arrow_right;
} DisplayCalibrationData;
static void prv_draw_text(Layer *layer, GContext *ctx) {
DisplayCalibrationData *data = window_get_user_data(layer_get_window(layer));
graphics_context_set_text_color(ctx, GColorWhite);
const char *titles[] = {
[Dis... | window_get_user_data(layer_get_window(layer)) | ;
if ((data->state == DisplayCalibrationState_X_Adjust) ||
(data->state == DisplayCalibrationState_Confirm)) {
prv_draw_border_stripe(layer, ctx, GAlignLeft);
prv_draw_border_stripe(layer, ctx, GAlignRight);
}
if ((data->state == DisplayCalibrationState_Y_Adjust) ||
(data->state == DisplayCal... |
/*
* 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(" != { ") | ;
for (uint32_t i = 0; i < count; i++) {
printf("%d, ", ((RecognizerHandled *)node)->idx);
node = list_get_next(node);
}
printf("}");
}
printf("\n");
cl_assert(!failed);
prv_clear_recognizers_processed(list);
}
static void prv_sub_event_handler(const Recognizer *recognizer, RecognizerE... |
istributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "text_flow.h"
#include "applib/app.h"
#include "applib/fonts/fonts.h"
#include "applib/ui/ui... | (&data->scroll_layer, true) | |
-1088},
{ -256, 176, -784},
{ -224, 384, -1064},
{ -200, 424, -896},
{ -240, 320, -872},
{ -288, 464, -976},
{ -200, 336, -848},
{ -248, 552, -864},
// 208 seconds
{ -232, 424, -872},
{ -240, 488, -840},
{ -232, 344, -928},
{ -192, 448, -1024},
{ -224, 528, -904},
... | { -208, 336, -960},
{ -184, 464, -1008},
{ -232, 456, -984},
{ -208, 392, -920},
{ -176, 424, -992},
{ -208, 328, -800},
{ -136, 488, -928},
{ -232, 344, -912},
{ -208, 496, -824},
{ -168, 488, -960},
{ -216, 536, -936},
{ -232, 504, -904},
{ -224, 512, -1000},
{ ... |
{ -272, 336, -736},
{ -160, 456, -856},
{ -312, 336, -784},
{ -240, 224, -448},
{ -136, 400, -784},
{ -296, 32, -968},
{ -104, 608, -936},
{ -144, 160, -1152},
{ -224, 368, -1088},
{ -168, 368, -1240},
{ -304, 504, -904},
// 216 seconds
{ -88, 440, -1256},
{ -328... |
if (!memory_segment_split(destination, NULL, loaded_size)) {
return NULL;
} |
// Set the THUMB bit on the function pointer.
return (void *)((uintptr_t)main_func | 1);
} else {
// No loaded size; must be builtin. The entry point address is
// already a physical address.
return app_md->main_func;
}
}
| |
dialog_create("Confirm Dialog");
Dialog *dialog = actionable_dialog_get_dialog(actionable_dialog);
dialog_set_text(dialog, "Confirmation");
dialog_set_background_color(dialog, GColorGreen);
dialog_set_icon(dialog, data->resource_id_80);
dialog_show_status_bar_layer(dialog, true);
actionable_dialog_set_acti... | expandable_dialog_create("Expandable Dialog") | ;
Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog);
dialog_set_text(dialog, data->lorem_ipsum);
dialog_set_background_color(dialog, GColorLightGray);
dialog_set_icon(dialog, data->resource_id_25);
dialog_show_status_bar_layer(dialog, true);
expandable_dialog_set_header(expandable_dialog, "H... |
//////////
/////////////////////////////////
/// Generic matrix tests
/////////////////////////////////
void test_graphics_gtransform_${BIT_DEPTH_NAME}__types_gtransformnumber(void) {
GTransform t_c; // matrix to compare against
GTransformNumber tn;
int32_t test_num;
tn = GTransformNumberFromNumber(1);
test... | (gtransform_is_only_translation(&t_c)) | ;
t_c = GTransformTranslationFromNumber(2, 5);
cl_assert(gtransform_is_equal(&t, &t_c));
// Test Rotation Matrix
int32_t angle = DEG_TO_TRIGANGLE(45);
t = GTransformRotation(angle);
int32_t cosine = cos_lookup(angle);
int32_t sine = sin_lookup(angle);
t_c = GTransform(GTransformNumberFromNumber((flo... |
unt_handler_entries(&s_started_handler_calls, c), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 0);
// -------------------------------------------------------------------------------------
// Seek to about the middle of B
// Save the current update elapsed
animation_set_elaps... | animation_set_duration(a, duration_a) | ;
Animation *b = prv_create_test_animation();
animation_set_duration(b, duration_b);
Animation *c = prv_create_test_animation();
animation_set_duration(c, duration_c);
// Create a spawn out of b and c
Animation *spawn = animation_spawn_create(b, c, NULL);
cl_assert(spawn != NULL);
// Create a sequen... |
// fake_event callback used to look for sleep events generated by the health_events test
static PebbleEvent s_captured_sleep_event = { };
static int s_num_captured_sleep_events = 0;
static void prv_fake_sleep_event_cb(PebbleEvent *event) {
if ((event->type == PEBBLE_HEALTH_SERVICE_EVENT)
&& (event->health_event... | (s_num_captured_history_events, 1) | |
/*
* 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... | ("daychange") | );
EXECUTE_SCRIPT("_rocky.on('daychange', function() {});");
cl_assert_equal_b(false, rocky_global_has_event_handlers("secondchange"));
cl_assert_equal_b(false, rocky_global_has_event_handlers("minutechange"));
cl_assert_equal_b(false, rocky_global_has_event_handlers("hourchange"));
cl_assert_equal_b(true, r... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | mfg_info_get_rtc_freq() | , 4);
mfg_info_get_model(buffer);
cl_assert_equal_s(buffer, "");
// Make sure we have space for the model.
mfg_info_set_model("test_model");
cl_assert_equal_i(mfg_info_get_watch_color(), 5);
cl_assert_equal_i(mfg_info_get_rtc_freq(), 4);
mfg_info_get_model(buffer);
cl_assert_equal_s(buffer, ... |
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 in writing, software
* distributed under the L... | (current_app_id, app_entry) | |
cl_assert_equal_s(tmbuf, "01/02/15 0002");
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%05n %03r", &jan_2_10015__13_00_00);
cl_assert_equal_s(tmbuf, "\n 01:00:00 PM");
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%02R %06t %04T", &jan_2_10015__13_00_00);
cl_assert_equal_s(tmbuf, "13:00 \t 13:00:... | cl_assert_equal_s(tmbuf, "Fri Jan 2 13:00:00 2015") | ;
s_i18n_translate = false;
s_i18n_locale_other = true;
tmbuf[0] = '\0';
localized_strftime(tmbuf, sizeof(tmbuf), "%a %A %b %B", &jan_2_2015__13_00_00, NULL);
cl_assert_equal_s(tmbuf, "Fri Friday Jan January");
tmbuf[0] = '\0';
localized_strftime(tmbuf, sizeof(tmbuf), "%c", &jan_2_2015__13_00_00, NULL);
... |
if CAPABILITY_HAS_BUILTIN_HRM
if (!s_hrm_present) {
return;
}
ACTIVITY_LOG_DEBUG("Got HR event: %d", (int) hrm_event->event_type);
if (hrm_event->event_type == HRMEvent_BPM) {
ACTIVITY_LOG_DEBUG("HR bpm: %"PRIu8", qual: %"PRId8" ", hrm_event->bpm.bpm,
(int8_t) hrm_event->bpm.qual... | PBL_LOG(LOG_LEVEL_ERROR, "No settings file") | ;
return NULL;
}
return file;
}
// ------------------------------------------------------------------------------------------------
// Close the settings file and free the file struct
void activity_private_settings_close(SettingsFile *file) {
settings_file_close(file);
kernel_free(file);
}
// ----------... |
_color_to_char_buffer(GColor8 color, char *buf_out) {
if (color.a <= 1) {
strncpy(buf_out, "transparent", COLOR_BUFFER_LENGTH);
} else {
snprintf(buf_out, COLOR_BUFFER_LENGTH, "#%02X%02X%02X",
color.r * 85, color.g * 85, color.b * 85);
}
}
static jerry_value_t prv_graphics_get_color_string(G... | (ctx_prototype, ROCKY_CONTEXT2D_STROKERECT, prv_stroke_rect) | ;
rocky_add_function(ctx_prototype, ROCKY_CONTEXT2D_SAVE, prv_save);
rocky_add_function(ctx_prototype, ROCKY_CONTEXT2D_RESTORE, prv_restore);
rocky_define_property(ctx_prototype, ROCKY_CONTEXT2D_LINEWIDTH,
prv_get_stroke_width, prv_set_stroke_width);
rocky_define_property(ctx_prototype, ... |
sources_get_glyph(&s_font_cache, PHONE_CODEPOINT, &s_font_info);
cl_assert(glyph != NULL);
glyph_size_bytes = glyph_get_size_bytes(glyph);
cl_assert_equal_m(phone_bytes, glyph->data, glyph_size_bytes);
}
void DISABLED_test_text_resources__test_emoji_fallback(void) {
const uint8_t phone_bytes[] = {0xfe, 0x81, 0... | cl_assert_equal_m(glyph->data, glyph_buffer, glyph_size) | |
test(BOOT_BIT_RECOVERY_START_IN_PROGRESS);
}
static bool check_for_fw_start_failure() {
// Add more failure conditions here.
if (!watchdog_check_reset_flag() && !boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) {
// We're good, we're just starting normally.
PBL_LOG_VERBOSE("We're good, we're just startin... | dbgserial_putstr(" \\ `\\____\\ \\_\\ \\_\\ \\____/\\ \\___x___/'\\/`____ \\") | |
_cache[closest_match];
pages_to_seek -= f->pg_cache[closest_match].virtual_pg;
next_page = f->pg_cache[closest_match].physical_pg;
// if we still are not on the page we are looking for, see how
// many contiguous pages we can skip ahead.
if (pages_to_seek > 0) {
uint16_t contig_p... | (LOG_LEVEL_WARNING, "R:Couldn't find next page for %d",
file->curr_page) | ;
res = E_INTERNAL;
goto cleanup;
}
}
res = bytes_read;
cleanup:
mutex_unlock_recursive(s_pfs_mutex);
return (res);
}
int pfs_seek(int fd, int offset, FSeekType seek_type) {
mutex_lock_recursive(s_pfs_mutex);
int res = E_UNKNOWN;
if (!FD_VALID(fd)) {
res = E_INVALID_ARGUMENT;
got... |
uint16_t section_index,
void *callback_context) {
return MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT;
}
static void prv_draw_header(GContext *ctx,
const Layer *cell_layer,
uint16_t section_index,
... | (&data->status_layer, StatusBarLayerSeparatorModeDotted) | ;
layer_add_child(&data->window.layer, status_bar_layer_get_layer(&data->status_layer));
#endif
}
void action_chaining_window_push(WindowStack *window_stack, const char *title,
TimelineItemActionGroup *action_group,
ActionChainingMenuSelectCb select_... |
e governing permissions and
* limitations under the License.
*/
#define FILE_LOG_COLOR LOG_COLOR_BLUE
#include "settings_bluetooth.h"
#include "settings_menu.h"
#include "settings_remote.h"
#include "settings_window.h"
#include "applib/app.h"
#include "applib/app_focus_service.h"
#include "applib/event_service_cli... | (sizeof(*remote)) | ;
*remote = (StoredRemote){};
return remote;
}
static void prv_copy_device_name_with_fallback(StoredRemote *remote, const char *name) {
if (!name || strlen(name) == 0) {
i18n_get_with_buffer("<Untitled>", remote->name, sizeof(remote->name));
} else {
strncpy(remote->name, name, sizeof(remote->name));
... |
/*
* 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 = window_create();
menu_layer = menu_layer_create(window_get_root_layer(window)->bounds);
menu_layer_set_callbacks(menu_layer, NULL, &(MenuLayerCallbacks) {
.get_num_sections = prv_menu_get_num_sections_callback,
.get_num_rows = prv_menu_get_num_rows_callback,
.get_header_height = prv_menu_g... |
static void deinit(void) {
menu_layer_destroy(menu_layer);
window_destroy(window);
}
static void s_main(void) {
init();
app_event_loop();
deinit();
}
const PebbleProcessMd* menu_overflow_app_get_info() {
static const PebbleProcessMdSystem s_app_info = {
.common.main_func = &s_main,
.name = "Me... |
BTDeviceInternal *device_out,
char *name_out) {
BtPersistBondingData data;
if (!prv_file_get(&bonding, sizeof(bonding), &data, sizeof(data))) {
return false;
}
if (data.type != BtPersistBondingTypeBLE) {
PBL_LOG(LOG_LEVEL_ERROR, "N... | (file, (uint8_t*) first_ancs_supported_bonding_found, info->key_len) | ;
return false; // stop iterating
}
return true;
}
BTBondingID bt_persistent_storage_get_ble_ancs_bonding(void) {
BTBondingID first_ancs_supported_bonding_found = BT_BONDING_ID_INVALID;
prv_file_each(prv_get_first_ancs_bonding_itr, &first_ancs_supported_bonding_found);
return first_ancs_supported_bondi... |
ont(translation->font_key));
}
static void prv_update_prf_info_text_layers_text(BTPairingUIData *data) {
#if PLATFORM_ROBERT || PLATFORM_CALCULUS
const char *font_key_default = FONT_KEY_GOTHIC_28_BOLD;
const char *font_key_japanese = FONT_KEY_MINCHO_24_PAIR;
#else
const char *font_key_default = FONT_KEY_GOTHIC_2... | (&data->info_text_layer.layer,
&pair_text_area, &below_pair_text) | ;
PBL_ASSERTN(data->info_text_out_animation);
animation = property_animation_get_animation(data->info_text_out_animation);
animation_set_auto_destroy(animation, false);
animation_set_duration(animation, animation_duration_ms);
animation_set_delay(animation, animation_delay_ms);
// We only need a stop handl... |
= {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast,
1421183640), 0);
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.... | timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast,
s_feb_5_midnight + 11 * 60 * 60) | , 0);
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[2].header.id));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[1].header.id));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[0].header.id));... |
_width = window_bounds.size.w - PBL_IF_RECT_ELSE(ACTION_BAR_WIDTH, 0);
data->background = layer_create(window_bounds);
Layer *background = data->background;
layer_set_update_proc(background, &background_update_proc);
layer_add_child(window_layer, background);
// Set up the action bar.
data->action_bar = ... | (0, stroke_box_width) | ;
const int16_t par_label_y_offset = hole_label_y_offset + PBL_IF_ROUND_ELSE(stroke_box_height, 0);
const int16_t par_value_y_offset = hole_value_y_offset + PBL_IF_ROUND_ELSE(stroke_box_height, 0);
// Hole label.
text[TextHoleLabel] = text_layer_create(GRect(hole_box_x_offset, hole_label_y_offset,
... |
n-antialiased rounded rect
#if SCREEN_COLOR_DEPTH_BITS == 8
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 9, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r9_aa_no_clip.${BIT_DEPTH_NAME}.pbi"));
... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r1_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi")) | ;
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , 2, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP... |
if (evt->offset == 0) {
uint16_t value;
memcpy(&value, evt->value, sizeof(value));
bool subscribed = (GATT_CCC_NOTIFICATIONS == value);
prv_handle_cccd_write(conn, subscribed);
PBL_LOG(LOG_LEVEL_DEBUG, "Wrote reversed PPoGATT CCCD: %"PRIu16, subscribed);
} else {
PBL_LOG(LOG... | (conn_idx, msg) | ;
case EMULATED_DATA_CCCD_OFFSET: {
PPoGATTWorkAroundState *state = prv_get_state(conn);
return prv_handle_emulated_cccd_write(msg, state);
}
default:
goto unhandled;
}
unhandled:
return false;
}
void ppogatt_inject_emulated_ppogatt_service_if_needed(uint16_t conn_idx) {
if (!ppoga... |
,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "kernel/system_message.h"
#include "flash_region/filesystem_regions.h"
#include "kernel/events.h"
#include "kernel/util/sl... | ("About to receive new firmware!") | ;
uint32_t bytes_transferred = 0;
uint32_t total_size = 0;
bool smooth_progress_supported =
comm_session_has_capability(session, CommSessionSmoothFwInstallProgressSupport) &&
(length >= sizeof(SysMsgSmoothFirmwareStartPayload));
if (smooth_progress_supported) {
SysMsgSmoothFirmw... |
PEEK_LAYER_SCALE_DURATION);
kino_reel_scale_segmented_set_delay_by_distance(kino_reel, target);
const int16_t expand = 10;
kino_reel_scale_segmented_set_deflate_effect(kino_reel, expand);
const int16_t bounce = 20;
kino_reel_scale_segmented_set_bounce_effect(kino_reel, bounce);
if (to_reel) {
kino_ree... | prv_layout_text(peek_layer) | ;
}
void peek_layer_set_subtitle_font(PeekLayer *peek_layer, GFont font, int16_t margin) {
text_layer_set_font(&peek_layer->subtitle.text_layer, font);
peek_layer->subtitle_margin = margin;
prv_layout_text(peek_layer);
}
void peek_layer_set_dot_diameter(PeekLayer *peek_layer, uint8_t dot_diameter) {
peek_laye... |
e "mbuf.h"
#include "kernel/pbl_malloc.h"
#include "system/logging.h"
#include "os/mutex.h"
#include "system/passert.h"
#include "util/size.h"
//! Flags used for internal purposes (bits 24-31 are allocated for this purpose)
#define MBUF_FLAG_IS_MANAGED ((uint32_t)(1 << 24))
#define MBUF_FLAG_IS_FREE ((uint32_t)(1 << ... | while (m->next) {
m = m->next;
} |
m->next = new_mbuf;
}
void mbuf_clear_next(MBuf *m) {
PBL_ASSERTN(m);
m->next = NULL;
}
// Debug
////////////////////////////////////////////////////////////////////////////////
void mbuf_debug_dump(MBuf *m) {
char buffer[80];
while (m) {
dbgserial_putstr_fmt(buffer, sizeof(buffer), "MBuf <%p>: lengt... |
t_total_duration(true);
if (memcmp(buffer_dma, buffer_pol, size) != 0) {
prompt_send_response("FAILURE: buffer_dma != buffer_pol");
success = false;
}
if (memcmp(buffer_dma, buffer_mmap, size) != 0) {
prompt_send_response("FAILURE: buffer_dma != buffer_mmap");
success = false;
}
const int bu... | qspi_use(QSPI) | ;
bool is_blank = qspi_flash_blank_check(QSPI_FLASH, FLASH_REGION_FIRMWARE_SCRATCH_BEGIN,
SUBSECTOR_SIZE_BYTES);
qspi_release(QSPI);
profiler_stop();
uint32_t blank = profiler_get_total_duration(true);
prompt_send_response_fmt(buf, buf_size, "Sector blank check via read... |
when (parent->paren == NULL):
layer_remove_from_parent(&parent);
}
void test_layer__remove_child_layers(void) {
Layer parent, child_a, child_b;
Layer *layers[] = {&parent, &child_a, &child_b};
for (int i = 0; i < ARRAY_LENGTH(layers); ++i) {
layer_init(layers[i], &GRectZero);
}
// Create this hierarch... | cl_assert_equal_p(a, stack[0]) | ;
cl_assert_equal_p(aa, stack[1]);
cl_assert_equal_p(aaa, stack[2]);
cl_assert_equal_p(aaaa, stack[3]);
// go back two levels and then to sibling
actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), ¤t_stack, true);
cl_assert_equal_p(ab, actual);
cl_assert_equal_i(1, curre... |
/*
* 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... | (system_flash_erase(FLASH_BASE, 1024 KiB, NULL, NULL)) | ;
cl_assert_equal_i(BITS_BETWEEN(0, 7), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_sector_0(void) {
cl_assert(system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_16KB... |
ze(180, 180);
GBitmap *bmp = NULL;
cl_assert((void*)&bmp->palette == (void*)&bmp->data_row_infos); // union with .palette
cl_assert(NULL != g_gbitmap_spalding_data_row_infos); // make sure unit-test fixture is ok
#ifdef PLATFORM_TINTIN
cl_assert(!process_manager_compiled_with_legacy2_sdk());
bmp = gbitmap_... | cl_assert(NULL == bmp) | ;
cl_assert(NULL == gbitmap_create_blank_with_palette(s10, GBitmapFormat8BitCircular, p, true));
cl_assert(NULL == gbitmap_create_blank_with_palette(s180, GBitmapFormat8BitCircular, p, true));
#endif
#ifdef PLATFORM_SNOWY
cl_assert(NULL == gbitmap_create_blank_with_palette(s10, GBitmapFormat1Bit, p, true));
cl... |
{ -208, -64, -1000},
{ -200, -64, -992},
{ -200, -64, -976},
{ -192, -56, -976},
{ -200, -72, -1032},
// 10 seconds
{ -200, -72, -1000},
{ -192, -64, -968},
{ -192, -40, -976},
{ -200, -72, -992},
{ -192, -72, -992},
{ -192, -64, -992},
{ -200, -72, -976},
{ -200,... |
{ -192, -80, -1000},
{ -200, -64, -992},
{ -200, -64, -992},
{ -192, -64, -992},
{ -192, -72, -992},
{ -192, -72, -992},
{ -200, -72, -992},
{ -200, -64, -984},
{ -200, -64, -992},
{ -200, -72, -1000},
{ -200, -80, -984},
{ -192, -88, -976},
{ -192, -56, -992},
{... | |
nimation;
Layer *subject;
if (property_animation_get_subject(prop_anim, (void**)&subject) && subject) {
layer_mark_dirty(subject);
}
}
static const PropertyAnimationImplementation s_dirty_layer_implementation = {
.base = {
.update = property_animation_update_mark_dirty,
},
};
PropertyAnimati... | {
memcpy(&legacy->values.to, value, size);
} | |
368, 144, -848},
{ -336, -24, -784},
{ -216, 200, -944},
{ -248, 160, -792},
{ -200, 272, -936},
{ -240, -16, -896},
{ -200, -8, -904},
{ -232, 40, -880},
{ -264, 64, -896},
{ -256, -112, -888},
{ -192, -264, -960},
{ -224, -344, -968},
{ -184, -272, -880},
{ -184, -3... | { -360, 296, -760},
{ -344, 296, -776},
{ -368, 280, -768},
{ -352, 296, -768},
{ -352, 296, -784},
{ -352, 288, -792},
{ -336, 280, -792},
{ -344, 280, -776},
{ -360, 296, -760},
{ -360, 320, -752},
{ -344, 312, -760},
{ -352, 288, -768},
{ -336, 304, -760},
{ -3... |
{ -392, 856, 232},
{ -392, 824, 256},
{ -392, 760, 296},
{ -376, 760, 288},
{ -360, 728, 304},
{ -376, 728, 304},
{ -368, 784, 280},
{ -368, 776, 240},
{ -368, 800, 224},
{ -376, 800, 176},
{ -384, 776, 192},
{ -424, 760, 200},
{ -392, 816, 296},
{ -408, 752, 336... |
window);
action_bar_layer_set_icon(action_bar, BUTTON_ID_SELECT, actionable_dialog->select_icon);
} else if (actionable_dialog->action_bar_type == DialogActionBarDecline) {
#if !defined(RECOVERY_FW)
actionable_dialog->select_icon = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_X);
#endif
actio... | if (actionable_dialog) {
actionable_dialog_init(actionable_dialog, dialog_name);
} |
return actionable_dialog;
}
void actionable_dialog_set_action_bar_type(ActionableDialog *actionable_dialog,
DialogActionBarType action_bar_type,
ActionBarLayer *action_bar) {
if (action_bar_type == DialogActionBarCustom) {
P... |
{
.layer = up_arrow_layer,
.colors.background = GColorWhite,
.colors.foreground = GColorDarkGray,
};
content_indicator_configure_direction(content_indicator, ContentIndicatorDirectionUp,
&content_indicator_config);
content_indicator_config.layer = down_arrow_la... | ((ScrollLayer *)scroll_layer) | .y,
};
}
void launcher_menu_layer_set_selection_animations_enabled(LauncherMenuLayer *launcher_menu_layer,
bool enabled) {
if (!launcher_menu_layer) {
return;
}
launcher_menu_layer->selection_animations_enabled = enabled;
if (enabled) {
const ... |
,
LAUNCHER_MENU_LAYER_GENERIC_APP_ICON);
const LauncherAppGlanceServiceHandlers glance_handlers = (LauncherAppGlanceServiceHandlers) {
.glance_changed = prv_glance_changed,
};
launcher_app_glance_service_set_handlers(&launcher_menu_layer->glance_service,
... | menu_layer_deinit(&launcher_menu_layer->menu_layer) | |
, 0x00, // Attribute Length
// Slice subtitle:
'T', 'e', 's', 't', ' ', 's', 'u', 'b', 't', 'i', 't', 'l', 'e',
};
const size_t app_glance_with_slice_missing_expiration_time_size =
sizeof(app_glance_with_slice_missing_expiration_time);
cl_assert_equal_i(app_glance_db_insert((uint8... | app_glance_db_read_creation_time(&APP_GLANCE_TEST_UUID, &time_out) | ,
E_DOES_NOT_EXIST);
// Insert a glance and check that the creation time we read back matches
test_app_glance_db__basic_glance_blob_insert_and_read();
cl_assert_equal_i(app_glance_db_read_creation_time(&APP_GLANCE_TEST_UUID, &time_out),
S_SUCCESS);
cl_assert_equal_i(time... |
DAY_EVENT,
};
// Calling the function with an invalid size, no TimelineResourceInfo, or no AppResourceInfo
// should assert
cl_assert_passert(timeline_resources_get_id(&timeline_res_info, TimelineResourceSizeCount,
&res_info));
cl_assert_passert(timeline_resource... | (res_info.res_app_num, SYSTEM_APP) | |
ManagementServiceAttributeNotificationInfo = 0x0002
} ManagementServiceAttribute;
typedef enum {
ControlServiceAttributeLaunchApp = 0x0001,
ControlServiceAttributeButtonEvent = 0x0002
} ControlServiceAttribute;
static MBuf *s_reserved_read_mbuf;
static MBuf *s_read_header_mbuf;
static uint8_t s_read_header[sizeof... | {
PBL_LOG(LOG_LEVEL_WARNING, "Notification info response is invalid length: %"PRIu32, length);
return false;
} |
const NotificationInfoData *notification_info = data;
if (notification_info->service_id <= ReservedServiceMax) {
// Currently we only support the control service and its launch app attribute
if (notification_info->service_id == ReservedServiceControl &&
notification_info->attribute_id == ... |
.h"
#include "process_state/app_state/app_state.h"
#include "resource/resource_ids.auto.h"
#include "services/common/i18n/i18n.h"
#include "services/normal/timeline/notification_layout.h"
#include "services/normal/timeline/swap_layer.h"
#include "services/normal/timeline/timeline_resources.h"
#include "shell/normal/wat... | launcher_task_add_callback(prv_show_incoming_call, NULL) | ;
}
static void prv_select_long_click_handler(ClickRecognizerRef recognizer, void *context) {
SwapLayerDemoData *data = context;
data->idx = 0;
swap_layer_reload_data(&data->swap_layer);
}
static void prv_click_config_provider(void *context) {
SwapLayerDemoData *data = context;
window_single_click_subscribe... |
eiver_write(Receiver *receiver,
const uint8_t *data, size_t length) {
cl_assert(s_write_length + length < sizeof(s_write_buffer));
memcpy(s_write_buffer + s_write_length, data, length);
s_write_length += length;
PBL_LOG(LOG_LEVEL_DEBUG, "Wrote %zu bytes", length);
}
... | (s_prepare_count, 0) | |
_layer_set_font(text_layer, font);
if (highlight) {
text_layer_set_background_color(text_layer, GColorWhite);
text_layer_set_text_color(text_layer, GColorBlack);
} else {
text_layer_set_background_color(text_layer, GColorClear);
text_layer_set_text_color(text_layer, GColorWhite);
}
text_layer_se... | GPoint(point.x + 1, point.y) | );
graphics_draw_pixel(ctx, GPoint(point.x, point.y + 1));
graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1));
}
}
static void draw_color_rect(GContext* ctx, AppData *data, GRect rect) {
uint16_t width = rect.size.w;
uint16_t height = rect.size.h;
for (uint16_t row = 0; row < height; row += 2)... |
48},
{ -352, -72, -1200},
{ -520, 24, -1072},
{ -752, 168, -968},
{ -800, 264, -904},
{ -896, 360, -752},
{ -912, 216, -472},
{ -920, 168, -464},
{ -784, 72, -456},
{ -792, -232, -368},
{ -752, -32, -520},
{ -592, 56, -480},
{ -432, 72, -680},
{ -240, 8, -520},
{ ... | { -416, -104, -368},
{ -320, 264, -160},
{ -504, 896, -456},
{ -864, 720, -208},
{ -1288, 1272, -336},
{ -1376, -104, -704},
{ -704, 632, -216},
{ -568, 768, -472},
{ -280, -192, -712},
{ -832, 312, -744},
{ -504, -24, -752},
{ -464, -248, -744},
{ -304, -416, -720},
... | |
isteners, num_entries, listener);
}
static bool prv_remove_listener(jerry_value_t event_listeners, uint32_t idx,
jerry_value_t listener, void *data) {
ListenerQueryData *query_data = data;
if (query_data->listener == listener) {
// calling `event_listeners.splice(idx, 1)` to rem... | {
API_REFS_FOREACH(api_ref) {
if ((*api_ref)->remove_handler) {
(*api_ref)->remove_handler(event_name, func);
}
}
} | else {
APP_LOG(LOG_LEVEL_WARNING, "Unknown handler for event '%s'", event_name);
}
return jerry_create_undefined();
}
JERRY_FUNCTION(prv_event_constructor) {
if (argc < 1) {
return rocky_error_arguments_missing();
}
if (!jerry_value_is_string(argv[0])) {
return rocky_error_unexpected_type(0, "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... | (LOG_LEVEL_WARNING, "BlobDB: read invalid length") | ;
return NULL;
}
// grab pointer to start of buf
*out_buf = (uint8_t*)iter;
iter += buf_len;
return iter;
}
static const uint8_t *prv_read_key_size(const uint8_t *iter, const uint8_t *iter_end,
uint8_t *out_int) {
// copy length from iter to out_len, then save... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | text_layer_init(&text_layer, &GRect(10, 20, 30, 40)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.