prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
e_event_get_last();
if (expect_is_handled) {
cl_assert_equal_i(e.type, PEBBLE_MEDIA_EVENT);
cl_assert_equal_i(e.media.type, PebbleMediaEventTypeNowPlayingChanged);
char player_name[MUSIC_BUFFER_LENGTH];
music_get_player_name(player_name);
cl_assert_equal_s(player_name, "Spotify");
} else {
... | (false /* expect_is_handled*/) | ;
}
void test_music_endpoint__request_now_playing_upon_connect(void) {
fake_transport_set_sent_cb(s_transport, &prv_assert_now_playing_requested_cb);
// Android app connects:
prv_receive_app_info_event(true /* is_android */);
fake_comm_session_process_send_next();
cl_assert_equal_b(s_now_playing_requested,... |
&GPoint(10, 10), 20, 5, true);
touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420);
touch_event = touch_event_queue_get_event(0, 1);
prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0,
&GPoint(13, 13), 40, 6, true... | (&ctx.touch_events[1], 0, TouchEvent_PositionUpdate, &GPoint(13, 13), 3686420,
6, &GPoint(2, 2), 20, 0, true) | ;
touch_dispatch_touch_events(1, prv_touch_event_dispatch_cb, &ctx);
cl_assert_equal_i(ctx.idx, 4);
prv_test_touch_event(&ctx.touch_events[2], 1, TouchEvent_Touchdown, &GPoint(55, 55), 3686480, 2,
NULL, 0, 0, false);
prv_test_touch_event(&ctx.touch_events[3], 1, TouchEvent_PositionUpdate... |
/*
* 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... | memcpy(&hci_cmd->param, param_buf, param_length) | ;
}
PBL_LOG(LOG_LEVEL_DEBUG, "Sending HCI CMD to ROM stack:");
PBL_HEXDUMP(LOG_LEVEL_DEBUG, (uint8_t *)hci_cmd, msg_buf->msg_size);
bool result = (ad_ble_command_queue_send(&msg_buf, OS_QUEUE_FOREVER) == pdPASS);
return result;
}
void hci_rom_passthrough_handle_evt(hci_evt_msg_t *hci_evt) {
uint16_t payl... |
int s_thursday_01_00 = 1426122000;
// Thursday, March 12, 2015, 12:00 UTC
static const int s_thursday_12_00 = 1426161600;
// Thursday, March 12, 2015, 13:00 UTC
static const int s_thursday_13_00 = 1426165200;
// Friday, March 20, 2015, 12:00 UTC
static const int s_friday_08_30 = 1426840200;
// Friday, March 20, 2015, 2... | do_not_disturb_is_active() | == true);
cl_assert(enabled == true);
prv_assert_manually_dnd_setting_val(true);
cl_assert_equal_i(s_num_dnd_events_put, 3);
}
void test_do_not_disturb__manually_enable_active(void) {
bool active;
active = do_not_disturb_is_active();
cl_assert(active == false);
do_not_disturb_set_manually_enabled(true)... |
SE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under th... | (
connection, event->attr_handle, event->attr_val, event->attr_val_len) | ;
}
bt_unlock();
if (done) {
return;
}
gatt_client_subscriptions_handle_server_notification(
connection, event->attr_handle, event->attr_val, event->attr_val_len);
}
void bt_driver_cb_gatt_handle_buffer_empty(const GattDeviceBufferEmptyEvent *event) {
bt_lock();
{
const GAPLEConnection *c... |
tx, colors->primary_color);
}
graphics_fill_rect(ctx, &hr_box);
}
if (size_out) {
*size_out = hr_box.size;
}
}
static GTextNode *prv_horizontal_rule_constructor(const LayoutLayer *layout_ref,
const LayoutNodeConstructorConfig *config) {
GTextNodeC... | (s_horizontal_config_nodes) | ,
.container.nodes = (LayoutNodeConfig **)&s_horizontal_config_nodes,
};
#endif
static const LayoutNodeConfig * const s_vertical_config_nodes[] = {
#if PBL_RECT
&s_horizontal_config.container.extent.node,
&s_horizontal_rule_config.extent.node,
#else
&s_icon_config.node,
&s_time_config.text.exten... |
/*
* 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... | (0b11110000) | |
ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "weather_service.h"
#include "weather_service_private.h"
#include "applib/event_service_client.h"
#include "kernel/events.h"
#include "kernel/pbl_malloc.h"
#inclu... | (key, prefs, &location_index) | ) {
uuid_to_string(key, key_string_buffer);
PBL_LOG(LOG_LEVEL_WARNING, "Weather location %s has no known ordering! Skipping",
key_string_buffer);
return; // location not found in ordering list, skip over
}
WeatherDataListNode *node = task_zalloc_check(sizeof(WeatherDataListNode));
node->i... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
start_page = test_get_file_start_page(fd);
} |
if ((i % 2) != 0) {
pfs_close_and_remove(fd);
} else {
pfs_close(fd);
}
}
// force garbage collection
test_force_garbage_collection(start_page);
// now make sure the files are still there!
for (int i = 0; i < 16; i+=2) {
snprintf(file_small, sizeof(file_small), "file%d", i);
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prv_get_emoji_icon_by_string(s_emoji_table, "👍\xf0\x9f\x8f\xbe") | ==
RESOURCE_ID_EMOJI_THUMBS_UP_LARGE);
}
|
event_service,
[TimelineEventService_Peek] = timeline_peek_get_event_service,
};
// This mutex protects all state, but is only used for factory resetting synchronously, therefore
// it should not significantly increase blocking time.
static PebbleMutex *s_mutex;
static TimelineEventState s_states[TimelineEventServi... | for (unsigned int i = 0; i < TimelineEventServiceCount; i++) {
TimelineEventState *state = &s_states[i];
if (!state->impl) {
continue;
}
const bool has_item = !uuid_is_invalid(&state->filter_header->common.id);
if (has_item) {
timeline_item_deserialize_header(&item, state->filter_header)... |
// Did update
for (int i = 0; i < TimelineEventServiceCount; i++) {
TimelineEventState *state = &s_states[i];
if (state->impl && state->impl->did_update) {
state->impl->did_update(&state->context);
}
}
prv_set_timer(timeout_ms);
kernel_free(filter_headers);
mutex_unlock(s_mutex);
}
sta... |
_child(&window->layer, &data->info_text_mask_layer);
TextLayer *info_text_layer = &data->info_text_layer;
text_layer_init_with_parameters(info_text_layer,
&pair_text_area,
data->info_text_layer_buffer,
#if PLATFORM_ROBERT || PLATFORM_CALCULUS
... | if (s_data_ptr) {
window_stack_remove(&s_data_ptr->window, true /* animated */);
} |
}
static void prv_pop_window_kernel_main_cb(void* unused) {
prv_pop_window();
}
static void prv_pop_window_timer_callback(void *unused) {
launcher_task_add_callback(prv_pop_window_kernel_main_cb, NULL);
}
static void prv_push_pairing_window(void) {
BTPairingUIData *data = s_data_ptr;
Window *window = &data-... |
const int delay_spawn = 150;
int duration_total = MAX(duration_a + delay_a, duration_b + delay_b) + delay_spawn;
// Create 2 test animations
Animation *a = prv_create_test_animation();
animation_set_duration(a, duration_a);
animation_set_delay(a, delay_a);
Animation *b = prv_create_test_animation();
... | animation_set_duration(b, duration_b) | ;
animation_set_play_count(b, 0);
// Create a sequence
Animation *seq = animation_sequence_create(a, b, NULL);
cl_assert(seq != NULL);
animation_set_play_count(seq, play_count_seq);
// Check the duration
cl_assert_equal_i(animation_get_duration(seq, true, true), play_count_seq * duration_a);
prv_clea... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (app_data->window) | ;
GRect bounds = layer_get_bounds(window_layer);
app_data->result_text = text_layer_create((GRect) {
.origin = { .x = 10, .y = 10},
.size = { .w = bounds.size.w - 20, .h = bounds.size.h - 20 }
});
text_layer_set_text(app_data->result_text, "Press SELECT to start");
text_layer_set_overflow_mode(app_d... |
///////////////////////////////////////////////////////////
#define ANCS_CALL_UID 1
#define ANCS_UNUSED_UID 2
// Whenever we check the last phone ui event, we reset s_last_phone_ui_event so we don't end up
// checking the same event twice and assume everything went well
#define ASSERT_LAST_EVENT(event) \
cl_assert_... | ASSERT_LAST_EVENT(PhoneEventType_Invalid) | ;
prv_put_incoming_call_event(PhoneCallSource_ANCS_Legacy, true);
ASSERT_LAST_EVENT(PhoneEventType_Incoming);
// Make sure we don't process incoming calls while we're in a call
prv_put_incoming_call_event(PhoneCallSource_ANCS_Legacy, true);
ASSERT_LAST_EVENT(PhoneEventType_Invalid);
// Losing ANCS connec... |
es order
DictionaryResult dict_serialize_tuplets_to_buffer__deprecated(
const uint8_t tuplets_count, const Tuplet * const tuplets,
uint8_t *buffer, uint32_t *size_in_out) {
DictionaryIterator iter;
return dict_serialize_tuplets_to_buffer_with_iter(&iter,
tuplets, tuplets_count, buffer, size_in_out);... | dict_read_first(new_iter) | ; new; new = dict_read_next(new_iter)) {
if (dict_find(orig_iter, new->key) == NULL && update_existing_keys_only) continue;
total_size_required += sizeof(*new) + new->length;
}
// Then, add in the size of the keys which have not changed.
for (Tuple* orig = dict_read_first(orig_iter); orig; orig = dict_re... |
UARE) {
graphics_fill_rect(ctx, &data->square);
} else if (shape == RECTANGLE) {
graphics_fill_rect(ctx, &data->rect);
} else if (shape == RECTANGLE_ROUND) {
graphics_fill_round_rect(ctx, &data->rectr, data->rectr_radius, GCornersAll);
} else if (shape == CIRCLE) {
graphics_context_s... | GPoint(0, 0) | |
id prv_destroy_text_node_container(GTextNode *node) {
if (!node) {
return;
}
GTextNodeContainer *container_node = (GTextNodeContainer *)node;
prv_container_each(container_node, prv_destroy_container_iter, NULL);
prv_destroy_text_node_base(&container_node->node);
}
static bool prv_container_add_child(GTex... | (&ctx->box.origin) | [axis] += excess_length / 2;
} else if (align == GAxisAlign_Max) {
ToGValue(&ctx->box.origin)[axis] += excess_length;
}
}
static void prv_will_draw_container(GTextNodeDrawContext *ctx) {
GTextNodeContainer *container = (GTextNodeContainer *)ctx->node;
prv_set_size(&ctx->box.size, &container->size);
if (c... |
buted under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "clar.h"
#include "services/normal/notifications/alerts_preferen... | (!s_performed_store) | ;
}
void test_ancs_filtering__record_app_no_prefs_yet(void) {
// No existing prefs yet, we should instert all the defaults
iOSNotifPrefs *existing_prefs = NULL;
AttributeList attr_list = {
.num_attributes = 3,
.attributes = (Attribute[]) {
{ .id = AttributeIdAppName, .cstring = "Awesome" },
... |
send_configure_reject(PPPControlProtocol *this,
struct LCPPacket *bad_packet) {
if (ntoh16(bad_packet->length) > pulse_link_max_send_size()) {
// Too big to send and truncation will corrupt the packet.
// There isn't really anything we can do.
PBL_LOG(LOG_LEVEL_ERROR,... | prv_send_terminate_ack(this, -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... | prv_encode_char(((data[i] & 0x03) << 4) | (data[i + 1] >> 4)) | ;
*out++ = prv_encode_char((data[i + 1] & 0x0F) << 2);
*out++ = '=';
} else if (i == data_len - 1) {
// if 1 leftover byte
*out++ = prv_encode_char(data[i] >> 2);
*out++ = prv_encode_char((data[i] & 0x03) << 4);
*out++ = '=';
*out++ = '=';
}
}
if (result < out_len)... |
amples[idx_pln_b][i] - s_samples[idx_pln_a][i];
v_ac[i] = s_samples[idx_pln_c][i] - s_samples[idx_pln_a][i];
}
int64_t plane_eq[4];
plane_eq[0] = v_ab[1] * v_ac[2] - v_ab[2] * v_ac[1];
plane_eq[1] = -v_ab[0] * v_ac[2] + v_ab[2] * v_ac[0];
plane_eq[2] = v_ab[0] * v_ac[1] - v_ab[1] * v_ac[0];
// solve... | (0, 1, thresh) | ) {
return (MagCalStatusNoSolution);
}
} else if (s_sample_idx == 2) {
if (!pt_to_line_dist_under_thresh(0, 1, 2, thresh)) {
return (MagCalStatusNoSolution);
}
} else if (s_sample_idx == 3) {
if (!pt_to_plane_dist_under_thresh(0, 1, 2, 3, thresh)) {
return (MagCalStatusNoSolution);... |
clude "kernel/pbl_malloc.h"
#include "mfg/mfg_mode/mfg_factory_mode.h"
#include "mfg/results_ui.h"
#include "process_management/app_manager.h"
#include "process_management/pebble_process_md.h"
#include "process_state/app_state/app_state.h"
#include "resource/resource_ids.auto.h"
#include "resource/system_resource.h"
#i... | (radial_padding_size, layer->bounds.size.h / 2) | ,
GPoint(layer->bounds.size.w - radial_padding_size - 1, layer->bounds.size.h / 2));
prv_draw_border(layer, ctx, radial_padding_size);
}
static void prv_draw_bitmap(struct Layer *layer, GContext *ctx, uint32_t res) {
GBitmap *bitmap = gbitmap_create_with_resource(res);
graphics_draw_bitmap_in_rect(ctx, bi... |
&header);
cl_assert_equal_i(header.value_length, 0);
cl_assert_equal_i(header.characteristic, BLE_CHARACTERISTIC_INVALID);
cl_assert_equal_b(has_more, false);
BLECharacteristic characteristic_out = ~0;
uint8_t value = 0xff;
value_length = sizeof(value);
gatt_cli... | prv_pend_events_to_kernel_and_app() | ;
// should have no effect since service is not in this range
gatt_client_subscription_cleanup_by_att_handle_range(s_connection, &bogus_range);
prv_assert_no_event();
cl_assert(s_connection->gatt_subscriptions != NULL);
// should actually remove everything
gatt_client_subscription_cleanup_by_att_handle_... |
already at that position, don't bother scheduling an animation
if (item_layer->scroll_offset_pixels == new_offset) {
return;
}
if (item_layer->animation
&& animation_is_scheduled(property_animation_get_animation(item_layer->animation))) {
// Don't do anything if we're already animating to this posi... | ROUND_TO_MOD_CEIL(current_scroll, SCROLL_AMOUNT) | ;
#endif
if (current_scroll <= first_scroll) {
prv_update_scroll_offset(item_layer, min_scroll, true);
#if PBL_RECT // fudge breaks ROUND display paging
} else if (current_scroll - (SCROLL_AMOUNT + SCROLL_FUDGE_AMOUNT) < first_scroll) {
prv_update_scroll_offset(item_layer, first_scroll, false);
#endif
}... |
HRZone_Zone2], SECONDS_PER_MINUTE);
if (zone_2_minutes) {
snprintf(hr_str, hr_buf_size, i18n_get("%d Min", headings), zone_2_minutes);
string_list_add_string(headings, headings_buf_size,
i18n_get("Endurance", headings), headings_buf_size);
string_list_add_string(values... | analytics_event_health_insight_created(notif_time, type, 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... | PBL_ASSERTN(new_threshold <= AMBIENT_LIGHT_LEVEL_MAX) | ;
s_sensor_light_dark_threshold = new_threshold;
}
bool ambient_light_is_light(void) {
// if the sensor is not enabled, always return that it is dark
return s_initialized && ambient_light_get_light_level() > s_sensor_light_dark_threshold;
}
AmbientLightLevel ambient_light_level_to_enum(uint32_t light_level) {
... |
/*
* 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... | dict_write_data_internal(iter, key, (const uint8_t * const) &value, sizeof(value), TUPLE_UINT) | |
/*
* 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... | itoa_int(0, buf, 10) | ;
cl_assert(0 == strcmp(buf, "0"));
itoa_int(-0, buf, 10);
cl_assert(0 == strcmp(buf, "0"));
itoa_int(1, buf, 10);
cl_assert(0 == strcmp(buf, "1"));
itoa_int(-1, buf, 10);
cl_assert(0 == strcmp(buf, "-1"));
itoa_int(365, buf, 10);
cl_assert(0 == strcmp(buf, "365"));
itoa_int(-365, buf, 10);
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... | (&layer, &across_y_layer_update_callback) | ;
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_line_across_y_origin_layer")));
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(&ct... |
he settings are what we expected from prv_save_known_settings()
void prv_assert_known_settings(void) {
struct tm time_tm = s_init_time_tm;
time_t utc_sec = mktime(&time_tm);
rtc_set_time(utc_sec);
prv_activity_init_and_set_enabled(true);
ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricStepCount,
... | fopen(out_path, "wb") | ;
cl_assert(file != NULL);
cl_assert_equal_i(fwrite(buf, size, 1, file), 1);
fclose(file);
free(buf);
printf("\nSaved current settings file to %s", out_path);
}
// ---------------------------------------------------------------------------------------
// Create the settings file in PFS from a file saved in... |
e range_subtitle_text_layer
buffer = time_selection_window->range_subtitle_buf;
snprintf(buffer, sizeof(time_selection_window->range_subtitle_buf),
"%s", time_selection_window->range_text);
text_layer_set_text(range_subtitle_text_layer, buffer);
TextLayer *top_layer = PBL_IF_RECT_ELSE(range_subtitl... | ("Time Selection Window") | );
window_set_user_data(window, time_selection_window);
// Selection layer setup
const TimeSelectionSizeConfig * const size_config = prv_selection_config();
const int num_cells = clock_is_24h_style() ? 2 : 3;
const int padding = size_config->cell_padding;
SelectionLayer *selection_layer = &time_selection_w... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (s_buffer_mutex) | |
ed) {
if (nf->callbacks.incremented != NULL) {
nf->callbacks.incremented(nf, nf->callback_context);
}
update_output_value(nf);
}
}
static void down_click_handler(ClickRecognizerRef recognizer, NumberWindow *nf) {
bool is_decreased = false;
int32_t new_val = nf->value - nf->step_size;
if (new_... | if (nf->value > nf->max_val) {
nf->value = nf->max_val;
} |
if (nf->value < nf->min_val) {
nf->value = nf->min_val;
}
update_output_value(nf);
}
void number_window_set_step_size(NumberWindow *nf, int32_t step) {
nf->step_size = step;
}
int32_t number_window_get_value(const NumberWindow *nf) {
return nf->value;
}
static void number_window_load(NumberWindow *nw)... |
s = {
.type = PebblePutBytesEventTypeStart,
.object_type = s_pb_state.type,
.has_cookie = s_pb_state.has_cookie,
.progress_percent = 0,
.total_size = s_pb_state.total_size,
.failed = false
},
};
event_put(&event);
prv_create_timer_if_needed();
success = new_timer_start(s... | prv_has_invalid_request_length(cmd, req_length) | |
ius values to determine the eight points for each of the four lines
const GPoint top_l = GPoint(origin.x + radius, origin.y);
const GPoint top_r = GPoint(origin.x + radius + width_actual - 1, origin.y);
const GPoint bottom_l = GPoint(origin.x + radius, origin.y + height - 1);
const GPoint bottom_r = GPoint(ori... | {
// Non-Antialiased and Stroke Width == 1
prv_draw_round_rect(ctx, rect, radius);
} |
}
}
void graphics_draw_round_rect_by_value(GContext* ctx, GRect rect, uint16_t radius) {
graphics_draw_round_rect(ctx, &rect, radius);
}
void graphics_context_init(GContext *context, FrameBuffer *framebuffer,
GContextInitializationMode init_mode) {
PBL_ASSERTN(context);
PBL_ASSERTN... |
prv_pulse_pp_handle_data(&packet->data[0], length - sizeof(PulsePPPacket)) | ;
break;
case PULSE_PP_OPCODE_OPEN:
prv_pulse_pp_send(PULSE_PP_OPCODE_OPEN, NULL, 0);
prv_pulse_pp_transport_set_connected(true);
break;
case PULSE_PP_OPCODE_CLOSE:
prv_pulse_pp_transport_set_connected(false);
prv_pulse_pp_send(PULSE_PP_OPCODE_CLOSE, NULL, 0);
break;
... | |
PebbleTask_App);
cl_check(app_state_get_window_stack());
cl_check(!app_state_get_window_stack()->list_head);
app_window_stack_push(window1, true);
cl_assert_equal_i(app_window_stack_count(), 1);
cl_assert_equal_i(window1->on_screen, true);
app_window_stack_push(window2, true);
cl_assert_equal_i(app_w... | window_stack_count(stack) | , 0);
cl_assert_equal_i(prv_get_load_unload_count(), 0);
cl_assert_equal_i(prv_get_appear_disappear_count(), 0);
}
// Description:
// This test ensures that when we push windows onto modal window stacks, that
// only the appropriate window is visible at a given time.
void test_window_stack__modal_priority(void) {
... |
const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "Foo bar");
cl_assert(success);
const TextBoxParams text_box_params = (TextBoxParams) {
.utf8_bounds = &utf8_bounds,
.box = (GRect) { GPointZero, (GSize) { 7 * HORIZ_ADVANCE_PX + 1, 11 } }
};
line.max_width_px = text_box_params.box.size.w;
line... | cl_assert(success) | ;
const TextBoxParams text_box_params = (TextBoxParams) {
.utf8_bounds = &utf8_bounds,
// Width for first word only:
.box = (GRect) { (GPoint) { 0, 0 }, (GSize) { 3 * HORIZ_ADVANCE_PX, 10 } }
};
line.max_width_px = text_box_params.box.size.w;
line.height_px = text_box_params.box.size.h;
// Ini... |
PIC, QSPIC_CTRLMODE_REG, QSPIC_RXD_NEG, 0x0);
REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_HRDY_MD, 0x0);
REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_IO3_DAT, 0x0);
REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_IO2_DAT, 0x0);
REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, QSPIC_IO3_OEN, 0x0);
REG_SETF(QSPIC, QSPIC_CTRLMODE_REG, ... | REG_SETF(GPREG, PLL_SYS_TEST_REG, PLL_SEL_R_DIV_TEST, 0x0) | ;
REG_SETF(GPREG, PLL_SYS_TEST_REG, PLL_SEL_N_DIV_TEST, 0x0);
REG_SETF(GPREG, PLL_SYS_TEST_REG, PLL_CHANGE, 0x0);
REG_SETF(GPREG, PLL_SYS_TEST_REG, PLL_OPEN_LOOP, 0x0);
REG_SETF(GPREG, PLL_SYS_TEST_REG, PLL_TEST_VCTR, 0x0);
REG_SETF(GPREG, PLL_SYS_TEST_REG, PLL_MIN_CURRENT, 0x38);
REG_SETF(GPREG, PLL_SYS_TE... |
{ .x = cursor.origin.x + glyph_metrics.origin.x,
.y = cursor.origin.y + glyph_metrics.origin.y },
.size = { .w = glyph_metrics.size.w,
.h = glyph_metrics.size.h }
};
// The destination bitmap's x-coordinate and row advance. Used in the loop below.
GBitmap* dest_bitmap = graphi... | rotl32(src, (dest_shift_at_line_begin + ((0 - ((uint8_t)glyph_metrics.size.w)) % 32) * (clipped_glyph_target.origin.y - glyph_target.origin.y)) % 32) | ;
src_rotated = (dest_shift_at_line_begin + ((0 - ((uint8_t)glyph_metrics.size.w)) % 32) * (clipped_glyph_target.origin.y - glyph_target.origin.y)) % 32;
glyph_block_bits_left -= bits_to_skip % 32;
}
for (int dest_y = clipped_glyph_target.origin.y; dest_y != clipped_glyph_target.origin.y + clipped_glyph_ta... |
{
packed_pixel_set(s_data, x /* color_index */, x, y, BITS_PER_PIXEL, s_bmp.row_size_bytes);
} |
}
memset(dest_bitmap_data, GColorWhite.argb, sizeof(dest_bitmap_data));
#if SCREEN_COLOR_DEPTH_BITS == 8
char print_buf[20];
for (int y = 0; y < HEIGHT; ++y) {
for (int x = 0; x < WIDTH; ++x) {
snprintf(print_buf, sizeof(print_buf), "Failed index = %d, %d", x, y);
cl_check_(gcolor_equal(get_b... | |
uuid.h"
#include "services/normal/filesystem/pfs.h"
#include "services/normal/blob_db/pin_db.h"
#include "services/normal/timeline/attribute.h"
#include "services/normal/timeline/item.h"
#include "services/normal/timeline/timeline.h"
// Fixture
////////////////////////////////////////////////////////////////
// Fakes... | attribute_list_destroy_list(&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... | compositor_app_slide_transition_animation_update(ctx,
distance_normalized,
config.direction) | ;
}
//! The transition direction here is the direction of the visual elements, not the motion
static void prv_configure_transition_animation(Animation *animation,
CompositorTransitionDirection direction) {
AppSlideTransitionAnimationConfiguration config = {
.directi... |
d that's formed in msg_buffer.
uint32_t max_data_size = max_msg_size - payload_hdr_size - sizeof(PLogMessageHdr);
PROTOBUF_LOG_DEBUG("Max data buffer size: %"PRIu32, max_data_size);
uint8_t *data_buffer = kernel_zalloc(max_data_size);
if (!data_buffer) {
kernel_free(msg_buffer);
return NULL;
}
// E... | (session,
pebble_pipeline_MeasurementSet_measurements_tag,
pebble_pipeline_Measurement_fields,
&msg) | |
e all available RAM for the log buffer!
// That is, the difference between s_log_buffer_ram and RETENTION_BLE (__ble_vars_start__).
// This will always be at least sizeof(s_log_buffer_ram).
uint32_t start_addr = (uint32_t)s_log_buffer_ram;
uint32_t end_addr = (uint32_t)&__ble_vars_start__;
uint32_t available_... | {
str1_len = MIN(str1_len, MAX_MSG_STR_LEN_HALF);
str2_len = MIN(str2_len, MAX_MSG_STR_LEN_HALF);
} |
if (str1_len) {
// length + strlen(string) + padding (round up to nearest uint32_t).
msg_size += 1 + str1_len + (3 - (1 + str1_len + 3) % 4);
}
if (str2_len) {
// length + strlen(string) + padding (round up to nearest uint32_t).
msg_size += 1 + str2_len + (3 - (1 + str2_len + 3) % ... |
ROCKY_DATE_TOLOCALETIMESTRING "toLocaleTimeString"
#define ROCKY_DATE_TOLOCALEDATESTRING "toLocaleDateString"
#define ROCKY_DATE_TOLOCALESTRING "toLocaleString"
#define ROCKY_DATE_FORMAT_NUMERIC "numeric"
#define ROCKY_DATE_FORMAT_2DIGIT "2-digit"
#define ROCKY_DATE_FORMAT_SHORT "short"
#define ROCKY_DATE_FORMAT_LONG ... | jerry_get_object_field(options, "hour12") | ;
if (!jerry_value_is_undefined(hour12)) {
*is_24h_style = !jerry_get_boolean_value(hour12);
}
struct {
const jerry_value_t field;
const char *value;
ToStringFormat format;
} option_values[] = {
{.field = second, .value = ROCKY_DATE_FORMAT_NUMERIC, .format = ToStringFormatSecondNumeric},
... |
_init_with_resource(&data->checkmark_icon, data->current_checkmark_icon_resource_id);
}
box.origin = GPoint((((cell_layer->bounds.size.w)/2)-((data->checkmark_icon.bounds.size.w)/2)),
(((cell_layer->bounds.size.h)/2)-((data->checkmark_icon.bounds.size.h)/2)));
box.size = data->check... | {
window_init(&data->custom_day_picker_window, WINDOW_NAME("Alarm Custom Day Picker"));
window_set_user_data(&data->custom_day_picker_window, data);
data->custom_day_picker_window.window_handlers.unload = prv_custom_day_picker_window_unload;
GRect bounds = data->custom_day_picker_window.layer.bounds;
#if PBL_R... | |
opyright 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 in writi... | {
rail_control_reg = PmicRegisters_LDO2_CONFIG;
ref_count = &s_ldo2_ref_count;
} | else if (rail == PmicRail_LDO3) {
rail_control_reg = PmicRegisters_LDO3_CONFIG;
ref_count = &s_ldo3_ref_count;
} else {
WTF;
}
uint8_t register_value;
bool success = prv_read_register(rail_control_reg, ®ister_value);
if (!success) {
// Failed to read the current register value
return... |
blob_db_endpoint_send_writeback(session->db_id,
dirty_item->last_updated,
dirty_item->key,
dirty_item->key_len,
... | (session->dirty_list) | ;
list_remove((ListNode *)session, (ListNode **)&s_sync_sessions, NULL);
kernel_free(session);
}
void blob_db_sync_next(BlobDBSyncSession *session) {
PBL_LOG(LOG_LEVEL_DEBUG, "blob_db_sync_next");
BlobDBDirtyItem *dirty_item = session->dirty_list;
blob_db_mark_synced(session->db_id, dirty_item->key, dirty_it... |
_buffer);
switch (action->type) {
case TimelineItemActionTypeOpenWatchApp:
{
// find parent app
AppInstallId install_id = app_install_get_id_for_uuid(&item->header.parent_id);
if (install_id == INSTALL_ID_INVALID) {
// This should never happen... but we're not quite there yet
... | PBL_LOG(LOG_LEVEL_ERROR, "Action type not implemented: %d", action->type) | |
elineResourceId resource,
TimelineResourceId fallback_resource, const Uuid *app_id) {
KinoReel *icon_reel = prv_create_kino_reel_with_timeline_resource(
timeline_layout, icon_res_size, resource, fallback_resource, app_id);
if (!icon_reel) {
return;
}
GSize icon_size = kino_r... | (layout, graphics_context_get_current_context(), &layout->view_size) | ;
}
void timeline_layout_deinit_view(TimelineLayout *layout) {
if (layout->layout_layer.mode == LayoutLayerModeCard && layout->impl->card_view_deinitializer) {
layout->impl->card_view_deinitializer(layout);
}
graphics_text_node_destroy(layout->view_node);
layout->view_node = NULL;
}
static GTextNode *prv_... |
RecognizerManager *manager) {
PBL_ASSERTN(recognizer);
recognizer->manager = manager;
}
RecognizerManager *recognizer_get_manager(Recognizer *recognizer) {
PBL_ASSERTN(recognizer);
return recognizer->manager;
}
///////////////////////////////////////////////////////////////////////////////////////////////////... | {
ListNode *next = list_get_next(node);
if (!iter_cb((Recognizer *)node, context)) {
return false;
}
node = next;
} |
return true;
}
|
ow_stack, animated);
}
bool window_stack_remove(Window *window, bool animated) {
if (window == NULL) {
return false;
}
WindowStackItem *item = prv_find_window_stack_item_for_window(window->parent_window_stack,
window);
if (item == NULL) {
return false;
}
const WindowTransitionImplementation... | {
(*dump)[idx++] = (WindowStackDump) {
.addr = item->window,
.name = window_get_debug_name(item->window),
};
item = (WindowStackItem *)list_get_next(&item->list_node);
} |
PBL_ASSERTN(idx == count);
}
}
return count;
}
|
limitations under the License.
*/
#include "applib/graphics/graphics.h"
#include "applib/graphics/framebuffer.h"
#include "applib/ui/window_private.h"
#include "applib/ui/layer.h"
#include "util/math.h"
#include "util.h"
#include "clar.h"
#include <stdio.h>
// Helper Functions
///////////////////////////////////... | layer_set_update_proc(&layer, &inside_layer_update_callback) | ;
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_inside_offset_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_x_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.de... |
ling_memory_callback;
} RockyMemoryAPIContext;
static bool prv_is_headroom_allocated(const RockyMemoryAPIContext *ctx) {
return (ctx->headroom != NULL);
}
static void prv_allocate_headroom_or_die(RockyMemoryAPIContext *ctx) {
// It's highly likely that while executing a the handler for the 'memorypressure' event,... | (severity, requested_size_bytes, fatal_if_not_freed) | ;
if (!ctx->is_calling_memory_callback) {
// It's likely memory has just been free'd, try resizing now.
// See comment at the top of prv_allocate_headroom_or_die() why this is needed.
prv_resize_headroom_if_needed(ctx);
}
return;
}
// Trigger agressive garbage collection, force prope... |
/*
* 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_cleanup() | ;
s_storage_data.last_is_success = is_success;
}
const PutBytesStorageImplementation s_raw_implementation = {
.init = fake_pb_storage_mem_init,
.get_max_size = fake_pb_storage_mem_get_max_size,
.write = fake_pb_storage_mem_write,
.calculate_crc = fake_pb_storage_mem_calculate_crc,
.deinit = fake_pb_storage... |
0, 912, 264},
{ -40, 920, 264},
{ -40, 912, 264},
{ -32, 912, 264},
{ -40, 920, 264},
{ -40, 912, 264},
{ -32, 912, 264},
{ -40, 912, 272},
{ -40, 912, 264},
{ -40, 912, 264},
{ -40, 912, 264},
{ -40, 912, 264},
{ -40, 912, 272},
{ -40, 912, 264},
{ -32, 920, 256}... | { -40, 912, 264},
{ -32, 920, 248},
{ -40, 920, 264},
{ -40, 912, 264},
{ -32, 920, 256},
{ -32, 920, 256},
{ -32, 920, 264},
{ -32, 912, 256},
{ -40, 920, 248},
{ -32, 912, 264},
{ -32, 912, 256},
{ -32, 920, 240},
{ -40, 920, 264},
{ -32, 920, 256},
{ -32, 9... | |
y z "
"A B C D E F G H I J K L M N O P Q R S T U V W X Y Z "
"a b c d e f g h j k l m n o p q r s t u v w x y z";
char *texts[] = {
first_page_one_line,
second_page_one_line, second_page_two_lines, second_page_full,
third_page_one_line, third... | (&ctx, text, &s_font_info, GRect(0, 0, 180, 1000),
GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter,
(GTextAttributes *const) &layout) | |
/*
* 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... | (i < NUM_VALID_CODEPOINTS) | |
// Code: Terminate-Ack
packet[1] = 255; // Identifier
packet[2] = 0; // Length MSB
packet[3] = 4; // Length LSB
pulse_link_send(packet, 4);
}
void pulse_early_init(void) {
// Forge an LCP Terminate-Ack packet to synchronize the host's state
// in case we crashed without terminating the connection.
prv... | (s_tx_buffer_mutex) | ;
}
size_t pulse_link_max_send_size(void) {
return FRAME_MAX_SEND_SIZE - LINK_HEADER_LEN;
}
#endif
|
/*
* 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_walk_distance_m, easy_walk_distance_m) | ;
// Walk for a long time. People can walk at roughly 5km/h, so we should be close to 50km
const int long_walk_time = 10 * MINUTES_PER_HOUR;
steps = walking_cadence_spm * long_walk_time;
time_ms = long_walk_time * SECONDS_PER_MINUTE * MS_PER_SECOND;
int long_walk_distance_m = activity_private_compute_distanc... |
/*
* 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_rect(ctx, &GRect(-10, 2, 18, 4)) | ;
}
static void across_y_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_draw_rect(ctx, &GRect(4, 5, 18, 10));
}
static void across_ny_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics... |
AGING_CMD_QUERY_REGION (4)
#define IMAGING_CMD_FINALIZE_REGION (5)
#define IMAGING_RESP_ACK_ERASE (128)
#define IMAGING_RESP_ACK_WRITE (129)
#define IMAGING_RESP_CRC (130)
#define IMAGING_RESP_REGION_GEOMETRY (131)
#define IMAGING_RESP_FINALIZE_REGION (132)
#define IMAGING_RESP_MALFORMED_CMD (192)
#define IMAGING_RES... | {
EraseAndWriteAck *message = pulse_best_effort_send_begin(
PULSE_PROTOCOL_FLASH_IMAGING);
*message = (EraseAndWriteAck) {
.opcode = IMAGING_RESP_ACK_ERASE,
.address = s_erase_start_address,
.length = s_erase_length,
.complete = 1
};
if (FAILED(result)) {
message->opcode = IMAGING_RES... |
static void prv_handle_write(Command *cmd, size_t command_length) {
if (command_length <= sizeof(cmd->write)) {
prv_respond_malformed_command(cmd, command_length, NULL);
return;
}
size_t write_length = command_length - sizeof(cmd->write);
flash_write_bytes(&cmd->write.data[0], cmd->write.address, wri... |
/*
* 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 (text_layer == NULL) {
return GSizeZero;
}
return text_layer->layer.frame.size;
} | |
0x35, 0},
{ 0, 0x35, 0},
{ 0, 0x35, 0},
{ 0, 0x35, 17},
// 480: Local time: 01:36:00 AM
{ 0, 0x3b, 0},
{ 0, 0x3b, 0},
{ 0, 0x3b, 0},
{ 0, 0x21, 42},
{ 0, 0x42, 73},
{ 0, 0x63, 23},
{ 0, 0x63, 4},
{ 0, 0x34, 13},
{ 0, 0x34, 0},
{ 0, 0x34, 0}, ... | ARRAY_LENGTH(samples) | ;
return samples;
}
// ----------------------------------------------------------------
// Sample captured at: 2015-08-21 21:14:00 local, 2015-08-22 04:14:00 GMT
// According to Misfit:
// Total sleep from 9:53 pm to 6:00am (447 min))
// Deep sleep 272 min
// Light sleep 175 min)
// Breakdown (very approximate)... |
ion_delay_insight,
sizeof(s_activity_activation_delay_insight));
}
uint8_t activity_prefs_get_health_app_opened_version(void) {
return s_activity_prefs_health_app_opened;
}
void activity_prefs_set_health_app_opened_version(uint8_t version) {
if (s_activity_prefs_health_app_opened != version) {
... | mfg_info_get_disp_offsets() | );
}
void shell_prefs_display_offset_init(void) {
display_set_offset(shell_prefs_get_display_offset());
}
bool shell_prefs_should_prompt_display_calibration(void) {
return s_should_prompt_display_calibration;
}
void shell_prefs_set_should_prompt_display_calibration(bool should_prompt) {
s_should_prompt_display... |
/*
* 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_erase_subsector_blocking(FLASH_REGION_MFG_INFO_BEGIN) | ;
flash_write_bytes((const uint8_t*) data, FLASH_REGION_MFG_INFO_BEGIN, sizeof(*data));
}
static MfgData prv_fetch_struct(void) {
MfgData result;
flash_read_bytes((uint8_t*) &result, FLASH_REGION_MFG_INFO_BEGIN, sizeof(result));
switch (result.data_version) {
case CURRENT_DATA_VERSION:
// Our data ... |
tes = &title_attr,
},
};
// Setup
////////////////////////////////////////////////////////////////
void test_calendar__initialize(void) {
s_in_calendar_event = false;
rtc_set_time(0);
fake_event_init();
pin_db_init();
}
void test_calendar__cleanup(void) {
timeline_event_deinit();
stub_new_timer_cleanup... | cl_assert_equal_i(timer_id, TIMER_INVALID_ID) | ;
cl_assert(!stub_new_timer_is_scheduled(timer_id));
cl_assert(timeline_add(&item1));
timeline_event_handle_blobdb_event();
cl_assert_equal_i(fake_event_get_count(), 2);
cl_assert(!prv_get_calendar_ongoing());
cl_assert(!stub_new_timer_is_scheduled(timer_id));
cl_assert(timeline_remove(&item1.header.id)... |
/*
* 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... | syscall_assert_userspace_buffer(out_cb, sizeof(*out_cb)) | |
s = device->opaque.opaque_64,
.hci_reason = hci_reason,
.connected = connected,
.bonding_id = bonding_id,
},
},
},
};
event_put(&pebble_event);
}
// -------------------------------------------------------------------------------------------------
static void prv_bui... | prv_intent_remove_and_free(intent) | ;
return false;
}
return true;
}
void bt_driver_handle_le_connection_handle_update_address_and_irk(const BleAddressAndIRKChange *e) {
bt_lock();
{
GAPLEConnection *connection = gap_le_connection_by_device(&e->device);
if (!connection) {
PBL_LOG(LOG_LEVEL_ERROR,
"Got address & IR... |
TypeSnooze:
case TimelineItemActionTypeRemove:
case TimelineItemActionTypeInsightResponse:
case TimelineItemActionTypeComplete:
case TimelineItemActionTypePostpone:
case TimelineItemActionTypeRemoteRemove:
return prv_invoke_remote_action(action_menu, action, pin, (void *)label);
case Timel... | (voice_data->action_menu,
voice_data->action_data,
voice_data->context,
transcription) | ;
if (action_result) {
action_result->voice_data = voice_data;
} else {
prv_cleanup_voice_data(voice_data);
}
}
static ActionMenuLevel *prv_create_level(uint16_t num_items, ActionMenuLevel *parent_level) {
ActionMenuLevel *level = action_menu_level_create(num_items);
level->parent_level = parent_leve... |
it_and_send_result_event(data, DictationSessionStatusFailureRecognizerError);
}
}
}
static void prv_handle_dictation_result(VoiceUiData *data, PebbleVoiceServiceEvent *event) {
VOICE_LOG("Handling result event");
data->session_id = VOICE_SESSION_ID_INVALID;
bool success = false;
switch (event->status) {
... | ("Ignoring event") | ;
break;
default:
WTF;
}
}
static void prv_start_dictation(VoiceUiData *data) {
VOICE_LOG("Start dictation session");
PBL_ASSERTN(data->session_id == VOICE_SESSION_ID_INVALID);
data->session_id = sys_voice_start_dictation(data->session_type);
if (data->session_id == VOICE_SESSION_ID_INVALID) ... |
/*
* 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(&s_ctx.dest_bitmap, TEST_PBI_FILE) | );
}
void test_workout_selection__render_workout_selected(void) {
prv_create_window_and_render(2);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
|
deinit again
}
static void prv_put_and_assert_hrm_event(HRMEventType subtype, uint8_t bpm, HRMQuality quality,
bool expect_bt_driver_cb, bool expected_is_on_wrist) {
int call_count_before = s_bt_driver_hrm_service_handle_measurement_call_count;
PebbleEvent hrm_event = {
... | fake_regular_timer_trigger(timer) | ;
cl_assert_equal_i(1, s_ble_hrm_push_reminder_popup_call_count);
// Except timer to be rescheduled again:
cl_assert_equal_b(true, regular_timer_is_scheduled(timer));
bt_driver_cb_hrm_service_update_subscription(s_device_a, false);
cl_assert_equal_b(false, regular_timer_is_scheduled(timer));
}
|
uint32_t distance_normalized) {
}
static const CompositorTransition s_transition_a = {
.init = prv_compositor_init_func_a,
.update = prv_compositor_update_func_a
};
static const CompositorTransition s_transition_b = {
.init = prv_compositor_init_func_b,
.update = prv_compositor_update_... | compositor_app_render_ready() | ;
cl_assert_equal_i(s_count_display_update, 0);
cl_assert_equal_i(s_render_pending, true);
// Now transition to a modal. The app framebuffer should be released. No animation should be started.
s_modal_window_present = true;
compositor_transition(&s_transition_a);
cl_assert_equal_i(s_render_pending, false);... |
},
{ -376, 488, -112},
{ -456, 408, -16},
{ -536, 448, -56},
{ -544, 472, -16},
{ -552, 528, -24},
{ -624, 624, -184},
{ -888, 664, -80},
{ -880, 616, 0},
{ -1328, 776, -104},
{ -1008, 800, -112},
{ -848, 696, -48},
{ -1120, 616, -8},
{ -928, 368, 144},
{ -632, 22... | { -728, 792, 48},
{ -824, 784, 8},
{ -880, 872, 0},
{ -768, 648, -8},
{ -584, 744, -96},
{ -656, 712, -96},
{ -688, 744, -112},
{ -528, 528, 24},
{ -384, 456, -96},
{ -312, 520, -24},
{ -360, 520, -16},
{ -424, 736, -88},
{ -424, 656, 0},
{ -424, 656, -40},
{ ... |
{ -248, 336, -80},
{ -312, 504, -8},
{ -384, 680, -128},
{ -432, 504, 64},
{ -432, 728, -120},
{ -392, 632, -24},
// 45 seconds
{ -568, 904, -136},
{ -624, 872, -40},
{ -832, 944, -48},
{ -888, 1000, 8},
{ -832, 1040, -72},
{ -704, 832, 152},
{ -760, 736, 8},
... |
hash_entry_offset);
SYS_PROFILER_NODE_START(text_render_flash);
sys_resource_load_range(font_res->app_num, font_res->resource_id, hash_entry_offset,
(uint8_t*)&table_entry, sizeof(FontHashTableEntry));
SYS_PROFILER_NODE_STOP(text_render_flash);
offset = s_font_md_size[vers... | {
address = s_font_md_size[version] +
(sizeof(FontHashTableEntry) * font_res->md.hash_table_size) +
(prv_offset_table_entry_size(&font_res->md) * font_res->md.number_of_glyphs) +
offset;
} |
return address;
}
//! Decode RLE4 decoded glyph data in place.
//! @return g or NULL on error.
#define RLE4_SYMBOL_MASK 0x08
#define RLE4_LENGTH_MASK 0x07
static GlyphData *prv_decompress_glyph_data(GlyphData *g, uint8_t *src) {
// This RLE4 decompressor expects GlyphData to be formatted like this:
// [ <head... |
nd_page; pg++) {
prv_flash_read(&s_pfs_page_flags_cache[pg], sizeof(s_pfs_page_flags_cache[pg]),
prv_page_to_flash_offset(pg) + page_flags_offset);
}
}
static void prv_invalidate_page_flags_cache_all(void) {
prv_invalidate_page_flags_cache(0, s_pfs_page_count * PFS_PAGE_SIZE);
}
static void... | (hdr, offsetof(FileHeader, hdr_crc)) | ;
}
// the start page is written to, the end page is not written to.
static void prv_write_erased_header_on_page_range(uint16_t start, uint16_t end,
int erase_count) {
// create a header representing an erase header
PageHeader pg_hdr;
memset(&pg_hdr, 0xff, sizeof(pg_hdr));
pg_hdr.version = PFS_CUR_VERSION;... |
state == LinkState_Stopping) {
prv_transition_to(this, LinkState_Stopped);
} else if (this->state->link_state == LinkState_AckReceived) {
prv_transition_to(this, LinkState_RequestSent);
} else if (this->state->link_state == LinkState_Opened) {
PBL_LOG(LOG_LEVEL_WARNING, "Terminate-Ack received on an ope... | (packet->length) | < sizeof(*packet) ||
length < ntoh16(packet->length)) {
// Invalid packet; silently discard
goto done;
}
switch (packet->code) {
case ControlCode_ConfigureRequest:
prv_on_configure_request(this, packet);
break;
case ControlCode_ConfigureAck:
prv_on_configure_ack(this, packe... |
/ Register another connection intent using the bonding:
e = gap_le_connect_connect_by_bonding(bonding_id,
true /* auto_reconnect */,
false /* is_pairing_required */,
GAPLEClientApp);
cl_assert_equ... | (bonding_id,
true /* auto_reconnect */,
false /* is_pairing_required */,
GAPLEClientApp) | ;
cl_assert_equal_i(e, BTErrnoOK);
// Device isn't connected. Verify no event was caused as a result of the
// registration.
prv_assert_no_event();
// Connect & verify the client task gets the event:
prv_fake_connect(&device, false /* is_master*/);
prv_assert_client_event(&device, true /* connected */, ... |
xServiceTagUnitTest,
BUFFER_SIZE, s_writer));
cl_assert_equal_b(false, app_inbox_service_is_being_written_for_tag(AppInboxServiceTagUnitTest));
}
void test_app_inbox__app_inbox_service_begin_already_being_written(void) {
prv_create_test_inbox();
cl_assert_equal_... | {
prv_create_test_inbox_and_begin_write();
cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest,
s_test_data, BUFFER_SIZE));
// After ending the write, expect num_success to be incremented by one:
app_inbox_service_end(AppInboxServiceTagUni... |
////////////////////////////////////////////////////////////////////////////////////////////////////
// app_inbox_service_cancel
void test_app_inbox__app_inbox_service_cancel(void) {
prv_create_test_inbox_and_begin_write();
// Start writing a message that occupies the complete buffer, then cancel it:
cl_asser... |
_send_response("ERROR");
}
// Perform a button press from the serial console. Three responses are provided
// to users/tools using the interface to indicate status. They are: OK, BUSY, and ERROR.
void command_button_press(const char *button_index, const char *hold_down_time_ms) {
prv_button_press_multiple(button_i... | system_task_add_callback(spam_callback, (void *)(uintptr_t) i) | ;
}
}
#ifdef TEST_FLASH_LOCK_PROTECTION
#include "flash_region/flash_region.h"
#include "drivers/task_watchdog.h"
#include "drivers/watchdog.h"
// This test attempts to write over every region of the flash.
// If we can still boot PRF after running this, it means we have successfully
// protected those regions
void... |
ow_info(framebuffer, y);
x1.raw_value = MAX(x1.raw_value, data_row_info.min_x << FIXED_S16_3_PRECISION);
x2.raw_value = MIN(x2.raw_value, data_row_info.max_x << FIXED_S16_3_PRECISION);
if (x1.integer > x2.integer) {
return;
}
#if PBL_COLOR
GColor8 *output = (GColor8 *)(data_row_info.data + x1.integer);
... | PBL_ASSERTN(ctx) | ;
GBitmap *framebuffer = &ctx->dest_bitmap;
// Clip the line to the bitmap data row's range
const GBitmapDataRowInfo data_row_info = gbitmap_get_data_row_info(framebuffer, y);
x1 = MAX(x1, data_row_info.min_x);
x2 = MIN(x2, data_row_info.max_x);
#if PBL_COLOR
for (int i = x1; i <= x2; i++) {
GColor *ou... |
fake_new_timer.h"
static bool s_mfg_mode_entered;
void mfg_enter_mfg_mode(void) {
s_mfg_mode_entered = true;
}
void mfg_enter_mfg_mode_and_launch_app(void) {
mfg_enter_mfg_mode();
}
static bool s_factory_reset_called;
void factory_reset(bool shutdown) {
s_factory_reset_called = true;
}
Window* spinner_ui_wi... | stub_new_timer_timeout(timer->id) | |
in.y = LABEL_OFFSET_Y };
// The first day to draw is Monday, and draw a week's worth of bars
for (int i = Monday, draw_count = 0;
draw_count < DAYS_PER_WEEK;
draw_count++, i = (i + 1) % DAYS_PER_WEEK) {
// Setup the dimensions and color of the day bar
const int32_t day_point = prv_get_day_poin... | {
const int info_line_height = fonts_get_font_height(graph_card->legend_font);
const int avg_line_offset_y = -1;
const GRect avg_line_box = {
.origin.x = offset_x,
// Position vertically centered with the text
.origin.y = info_offset_y + (info_line_height + INFO_PADDING_BOTTOM) / 2 + avg_line_offset_y... | |
now = rtc_get_time();
const bool new_is_peeking = prv_is_in_peeking_time_window(new_header, now);
const bool old_is_peeking = prv_is_in_peeking_time_window(old_header, now);
const bool new_is_persistent = new_header->common.persistent;
const bool old_is_persistent = old_header->common.persistent;
if (new_is_... | {
s_peek_event_data.initialized = true;
s_peek_event_data.show_before_time_s =
(timeline_peek_prefs_get_before_time() * SECONDS_PER_MINUTE);
} |
return &s_event_impl;
}
void timeline_peek_set_show_before_time(unsigned int before_time_s) {
s_peek_event_data.show_before_time_s = before_time_s;
timeline_event_refresh();
}
|
ead let the compositor animate.
transition_insert = &g_window_transition_none_implementation;
transition_pop = &g_window_transition_none_implementation;
}
// This is a backwards compatibility hack for legacy2 applications. By default, watchface
// windows are not fullscreen until they're pushed onto the... | (window_from, window_to, transition) | ;
} else {
// We don't fire a transition in this case, but to ensure that all window-callbacks
// will still be called and the click handler is managed correctly, we call the
// appropriate helper functions manually with a fake transitioning context.
WindowTransitioningContext ctx = {
.window_fr... |
/*
* 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... | (list_append(&a, &b), &c) | |
AnimationPrivate *parent = animation_private_animation_find(parent_h);
parent->type = type;
// Keep track of which children we added so we can restore them in case of error
bool used_children[array_len];
memset(used_children, 0, sizeof(bool) * array_len);
// Set the parent on each of the components
uint... | if (prop) {
clone = &prop->animation;
clone->is_property_animation = true;
} |
} else {
clone = applib_type_malloc(AnimationPrivate);
}
if (!clone) {
return NULL;
}
clone_h = animation_private_animation_init(clone);
}
// Copy the values into the clone
clone->implementation = from->implementation;
clone->handlers = from->handlers;
clone->context = from->... |
/*
* 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... | (&test_uuid_1, buffer) | ;
cl_assert_equal_s(buffer, "{00010203-0405-0607-0809-000102030405}");
const Uuid system = UUID_SYSTEM;
uuid_to_string(&system, buffer);
cl_assert_equal_s(buffer, "{00000000-0000-0000-0000-000000000000}");
const Uuid invalid = UUID_INVALID;
uuid_to_string(&invalid, buffer);
cl_assert_equal_s(buffer, "{f... |
/*
* 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... | {
DebounceConnection conn_id = (DebounceConnection)data;
s_debounced_state_is_connected[conn_id] = false;
prv_put_debounced_connection_event(conn_id);
regular_timer_remove_callback(&s_debounce_timers[conn_id]);
} |
void debounced_connection_service_init(void) {
for (int i = 0; i < NumConnectionsToDebounce; i++) {
s_debounce_timers[i].cb = prv_handle_disconnection_debounced;
s_debounce_timers[i].cb_data = (void *)(uintptr_t)i;
}
// initial state of the connections
s_debounced_state_is_connected[MobileAppDebounce... |
/*
* 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... | {
*iter = (Iterator) {
.next = next,
.prev = prev,
.state = state
};
} |
bool iter_next(Iterator* iter) {
UTIL_ASSERT(iter->next);
return iter->next(iter->state);
}
bool iter_prev(Iterator* iter) {
UTIL_ASSERT(iter->prev);
return iter->prev(iter->state);
}
|
dbgserial_print("Display initialized after ") | ;
dbgserial_print_hex(retries);
dbgserial_putstr(" retries.");
#ifdef DISPLAY_DEMO_LOOP
prv_play_demo_loop();
#endif
return;
}
if (!prv_reset_fpga()) {
dbgserial_putstr("FPGA configuration failed.");
return;
}
}
// It's taken too many attempts and the FPGA still isn... | |
/*
* 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 true;
} | |
{ 1160, 288, -376},
{ 1224, 144, -248},
{ 1336, 48, -208},
{ 1248, 40, -64},
{ 1024, 192, -80},
{ 904, 192, -200},
// 5 seconds
{ 872, 112, -400},
{ 808, 160, -256},
{ 768, 104, -48},
{ 824, 224, -48},
{ 912, 216, -136},
{ 1040, 176, -176},
{ 1248, 384, -104},
{ ... | { 1208, 424, -64},
{ 1112, 304, 112},
{ 1272, 184, 72},
{ 1224, 168, 48},
{ 1048, 224, 0},
{ 896, 224, 0},
{ 872, 184, 8},
{ 904, 120, 56},
{ 936, 144, 112},
{ 928, 248, 16},
{ 912, 264, 96},
{ 952, 280, -32},
{ 968, 48, -32},
// 11 seconds
{ 1032, 40, -48},
... |
{ 888, 208, 40},
{ 896, 176, 56},
{ 840, 112, 80},
{ 800, 112, 8},
{ 832, 168, -24},
{ 920, 160, -16},
{ 1040, 168, -88},
{ 1256, 64, -56},
{ 1624, 176, -120},
{ 1456, 384, -320},
{ 1088, 368, -328},
{ 1208, 256, -160},
{ 1224, 64, -24},
{ 1120, 32, -8},
{ 92... |
/*
* 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_get_implementation(animation) | ->update(animation, 0);
} else {
animation_private_update(NULL, animation_private_animation_find(animation), 0);
}
}
static void prv_transition_teardown_destroy_animation(Animation *a) {
// needed for compatibility with 2.x apps: manually free animation + clear pointer
WindowTransitioningContext *ctx = ani... |
/*
* 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... | (c2->points, c2_points, sizeof(c2_points)) | ;
GDrawCommand *c3 = gdraw_command_list_get_command(list, 3);
*c3 = *c2;
memcpy(c3->points, c3_points, sizeof(c3_points));
GDrawCommand *c4 = gdraw_command_list_get_command(list, 4);
*c4 = *c2;
memcpy(c4->points, c4_points, sizeof(c4_points));
return image;
}
#define COPY_POINTS(target, source) \
fo... |
Test number muliplication
num1 = FIXED_S32_16_ONE;
num2 = FIXED_S32_16_ONE;
mul = Fixed_S32_16_mul(num1, num2);
mul_c = (Fixed_S32_16){ .raw_value = (int32_t)((float)1 * (1 << FIXED_S32_16_PRECISION)) };
cl_assert(mul.raw_value == mul_c.raw_value);
// 2*3 = 6
num1 = (Fixed_S32_16){ .raw_value = (int32_t)... | cl_assert(mul.raw_value == mul_c.raw_value) | ;
// check surrounding values
mul_c = (Fixed_S16_3){ .raw_value = (int32_t)((float)7.375 * (1 << FIXED_S16_3_PRECISION)) };
cl_assert(mul.raw_value == mul_c.raw_value);
mul_c = (Fixed_S16_3){ .raw_value = (int32_t)((float)7.5 * (1 << FIXED_S16_3_PRECISION)) };
cl_assert(mul.raw_value != mul_c.raw_value);
}
|
entire graph represents the current week
// Otherwise the selection is last week if either the selection is Sunday
// or if the selection is greater than the current day
return (((int)graph_card->current_day == graph_card->selection && graph_card->day_data[0] == 0) ||
((graph_card->current_day == Sunday... | (graph_card, ctx) | ;
prv_draw_day_bars(graph_card, ctx);
prv_draw_avg_lines(graph_card, ctx);
prv_draw_info(graph_card, ctx);
}
HealthGraphCard *health_graph_card_create(const HealthGraphCardConfig *config) {
HealthGraphCard *graph_card = app_zalloc_check(sizeof(HealthGraphCard));
if (graph_card) {
layer_init(&graph_card->... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.