prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
text's
// contains the appropriate size.
GContext *ctx = graphics_context_get_current_context();
const GSize current_framebuffer_size = graphics_context_get_framebuffer_size(ctx);
layer_init(&status_bar_layer->layer, &GRect(0, 0, current_framebuffer_size.w, prv_height()));
status_bar_layer->layer.update_proc... | (status_bar_layer) | ;
}
void status_bar_layer_set_info_text(StatusBarLayer *status_bar_layer, const char *text) {
PBL_ASSERTN(status_bar_layer);
strncpy(status_bar_layer->config.info_text_buffer, text, INFO_TEXT_BUFFER_SIZE);
layer_mark_dirty(&(status_bar_layer->layer));
}
// Sets info text either ot X/Y or percentage if total is ... |
/*
* 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(workout_glance->icon) | ;
workout_glance->icon_resource_id = new_icon_resource_id;
return true;
}
static uint32_t prv_get_workout_icon_resource_id_for_type(ActivitySessionType type) {
switch (type) {
case ActivitySessionType_Open:
return RESOURCE_ID_WORKOUT_APP_HEART;
case ActivitySessionType_Walk:
return RESOURCE_... |
/*
* 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_expected_bytes_received = true;
debug_print_str_and_int("Bytes TX/RXed: ", transferred);
} | |
}, {
.title = "Sleep Insights",
.callback = prv_debug_cmd_sleep_insights,
}, {
.title = "DLS sends",
.callback = prv_debug_cmd_dls_sends,
}, {
.title = "Step History",
.callback = prv_debug_cmd_step_history,
}, {
.title = "Distance(m) History",
.callback ... | (sizeof(ActivityDemoAppData)) | ;
s_data = data;
memset(data, 0, sizeof(ActivityDemoAppData));
app_state_set_user_data(data);
// Debug window
data->debug_window = window_create();
window_set_user_data(data->debug_window, data);
window_set_window_handlers(data->debug_window, &(WindowHandlers) {
.load = debug_window_load,
.unload... |
m_task_callbacks_cleanup();
fake_event_clear_last();
fake_pbl_malloc_check_net_allocs();
fake_pbl_malloc_clear_tracking();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Misc
static TickType_t prv_taking_too_long_yield_cb(QueueHandle_t queue) {
retu... | assert_ack_count(0) | |
ot_disturb_is_manually_enabled() == true);
cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == true);
active = do_not_disturb_is_active();
cl_assert(active == true); // Both OFF
do_not_disturb_set_manually_enabled(false); // turned Manual OFF, scheduled should be overriden
cl_assert(do_not_distu... | (active == false) | ;
s_event_ongoing = true;
active = do_not_disturb_is_active();
cl_assert(active == true);
// Testing the override capability
do_not_disturb_set_manually_enabled(false);
active = do_not_disturb_is_active();
cl_assert(active == false);
}
void test_do_not_disturb__weekday_weekend_schedule(void) {
bool ... |
rt_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2);
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 2);
cl_asse... | (distance, ANIMATION_NORMALIZED_MAX) | ;
// B should start high
distance = prv_last_update_distance(b);
cl_assert_equal_i(distance, ANIMATION_NORMALIZED_MIN);
#endif
}
// --------------------------------------------------------------------------------------
// Test cloning complex animation
void test_animation__complex_clone(void) {
#ifdef TEST_IN... |
must be typecast
GTransformSetter setter = (GTransformSetter)((PropertyAnimationImplementation*)
property_animation->animation.implementation)
->accessors.setter.int16;
setter(property_animation->subject, result);
}
#endif
// -------------------------... | if (property_animation->animation.implementation->update
== (AnimationUpdateImplementation) property_animation_update_int16) {
property_animation->values.to.int16 = to_value ? *((int16_t *)to_value)
: implementation->accessors.getter.int16(subject);
property... |
== (AnimationUpdateImplementation)property_animation_update_grect) {
property_animation->values.to.grect = to_value ? *((GRect*)to_value)
: implementation->accessors.getter.grect(subject);
property_animation->values.from.grect = from_value ? *((GRect... |
/*
* 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;
} | |
ount_b = 2;
int duration_total = duration_a + play_count_b * duration_b;
// Create 2 animations
Animation *a = prv_create_test_animation();
animation_set_duration(a, duration_a);
// Setup stopped handler for the first child that unschedules the parent
const AnimationHandlers special_handlers = {
.star... | cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0) | ;
cl_assert_equal_i(prv_count_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 e... |
p_transitions_flip_animation_update(ctx, ANIMATION_NORMALIZED_MAX * 3 / 4,
CompositorTransitionDirectionRight,
GColorWhite);
}
void test_graphics_window_stack_animation__right_flip_first_quarter_frame_cl... | gbitmap_pbi_eq(bitmap, TEST_NAMED_PBI_FILE("move_horizontal_right_too_far")) | );
graphics_private_move_pixels_horizontally(bitmap, -400, true);
cl_check(gbitmap_pbi_eq(bitmap, TEST_NAMED_PBI_FILE("move_horizontal_left_filled")));
free(ctx);
}
|
tart_ms + duration_a + duration_b + 5 * MIN_FRAME_INTERVAL_MS + 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 0);
cl_assert_eq... | cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, c), 1) | ;
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, c), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, d), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, d), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, d), 1)... |
-------
// Running Tests
//--------------------------------------------------------------------------------
// Running the actual test is an asynchronous operations which expects a
// callback to come from the bt test driver.
// We keep track of our current test progress with AppData.current_test_step,
// and use that ... | (BTLETestStep_BTStart, data) | ) {
failed = true;
goto cleanup;
}
switch (data->current_test) {
case BTLETestType_TX:
if (!prv_run_test_step(BTLETestStep_BTLETransmitStart, data)) {
failed = true;
goto cleanup;
}
break;
case BTLETestType_RX:
data->rx_test_received_packets = 0;
if (!p... |
o_dict),
(uint8_t *)s_fake_app_info_dict);
} else {
prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_message_app_info_dict),
(uint8_t *)s_message_app_info_dict);
}
return BTErrnoOK;
}
// else: notif request
uint3... | s_num_ds_notifications_received++;
} else if (uid == mms_with_caption_dict_uid) {
prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_mms_with_caption_dict), (uint8_t *)s_mms_with_caption_dict);
s_num_ds_notifications_received++;
} else if (uid == s_get_wrong_data_uid) {
// We wanted a notification at... |
// Tests
///////////////////////////////////////////////////////////
#define TEST_START FILESYSTEM_FILE_TEST_SPACE_BEGIN
#define TEST_SIZE (FILESYSTEM_FILE_TEST_SPACE_END - \
FILESYSTEM_FILE_TEST_SPACE_BEGIN)
void test_ancs__initialize(void) {
s_block_event_callback = false;
regular_timer_init();
s_num_req... |
-----------------------------------------------
// Test a simple sequence animation
void test_animation__simple_sequence(void) {
#ifdef TEST_INCLUDE_COMPLEX
const int duration_a = 300;
const int duration_b = 500;
const int play_count_b = 2;
int duration_total = duration_a + play_count_b * duration_b;
// Crea... | (&s_setup_handler_calls, a) | , 1);
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2);
cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MA... |
28, -112, -968},
{ 136, -104, -976},
{ 128, -104, -976},
{ 128, -120, -976},
{ 144, -104, -968},
{ 136, -96, -976},
{ 136, -104, -968},
{ 136, -112, -976},
{ 144, -120, -976},
{ 128, -104, -976},
{ 136, -120, -968},
{ 144, -104, -976},
{ 144, -112, -976},
{ 136, -112,... | { 136, -128, -976},
{ 144, -120, -976},
{ 136, -128, -968},
{ 136, -128, -976},
{ 136, -128, -976},
{ 144, -128, -976},
{ 136, -120, -976},
// 76 seconds
{ 136, -136, -976},
{ 136, -128, -984},
{ 136, -144, -968},
{ 144, -104, -976},
{ 144, -136, -968},
{ 144, -12... |
{ 136, -120, -976},
{ 152, -120, -976},
{ 136, -120, -984},
{ 144, -144, -960},
{ 136, -120, -968},
{ 152, -128, -976},
{ 136, -128, -960},
{ 144, -120, -976},
{ 144, -120, -976},
{ 144, -112, -976},
{ 144, -128, -968},
{ 136, -104, -984},
{ 144, -128, -984},
{ 1... |
http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing ... | evented_timer_register(100, false, stub_evented_timer_callback, 0) | ;
// We've started the timer, but it hasn't fired yet.
TimerID sys_timer_id = timer;
cl_assert(stub_new_timer_is_scheduled(sys_timer_id));
cl_assert_equal_i(s_last_event.type, PEBBLE_NULL_EVENT);
cl_assert(!s_times_callback_executed);
// Now cancel the timer, this should delete the system timer
stub_new... |
zero_flags = 0;
menu_callback_prefix(index, ctx);
// invalid timer id
new_timer_start(0x12345678, 100, timer_callback, cb_data, zero_flags);
}
// =================================================================================
void reg_timer_schedule_1sec_from_cb_menu_cb(int index, void *ctx) {
menu_callb... | {
simple_menu_layer_destroy(s_app_data->menu_layer);
} |
// =================================================================================
static void handle_init(void) {
TestTimersAppData *data = app_malloc_check(sizeof(TestTimersAppData));
memset(data, 0, sizeof(TestTimersAppData));
s_app_data = data;
data->window = window_create();
if (data->window == NUL... |
}
void test_gdraw_command__validate_image(void) {
size_t size = sizeof(GDrawCommandImage) + (3 * sizeof(GDrawCommand)) +
(sizeof(GPoint) * 6);
GDrawCommandImage *image = malloc(size);
GDrawCommandList *command_list = prv_create_command_list_3();
memcpy(&image->command_list, command_list, sizeof(GDrawCom... | (ctx, NULL, frame, GPoint(-1, 1)) | ;
cl_assert_equal_i(s_path_num_points, 2);
points[0] = GPoint(0, 2);
points[1] = GPoint(1, -1);
cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points));
cl_assert(prv_compare_points(points, s_fill_points, s_path_num_points));
free(frame);
}
static int s_iterations = 0;
static bool prv_it... |
%dH %dM which is %d%% below your typical. "
"We know you're busy, but try getting more tonight. We believe in you 😉"),
i18n_noop("You slept for %dH %dM which is %d%% below your typical. "
"We know stuff happens; take another crack at it tonight."),
},
},
};
co... | INSIGHTS_LOG_DEBUG("Not updating activity pin - less than next update time and next steps") | ;
return;
}
s_activity_pin_state.next_update_time =
now_utc + s_activity_summary_settings.summary.activity.update_max_interval_seconds;
s_activity_pin_state.next_step_count =
steps + s_activity_summary_settings.summary.activity.update_threshold_steps;
// Determine the average for today
Activ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | pbl_log(LOG_LEVEL_ERROR, __FILE_NAME__, __LINE__,
"System resources are missing or corrupt, time to sad watch") | ;
launcher_panic(ERROR_BAD_RESOURCES);
#else
PBL_LOG(LOG_LEVEL_ERROR, "System resources are missing or corrupt! Going to PRF");
fw_reset_into_prf();
#endif
}
}
bool system_resource_is_valid(void) {
return resource_init_app(SYSTEM_APP, &SYSTEM_RESOURCE_VERSION);
}
#define NUM_SYSTEM_FONTS ARRAY_LENGTH(... |
governing permissions and
* limitations under the License.
*/
#include "applib/graphics/framebuffer.h"
#include "applib/graphics/graphics.h"
#include "applib/graphics/gtypes.h"
#include "util/trig.h"
#include "applib/ui/layer.h"
#include "applib/ui/window_private.h"
#include "clar.h"
#include "util.h"
#include <... | DEG_TO_TRIGANGLE(45) | , GPointZero);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
"draw_rotated_bitmap_origin_bw_assign_corner_45.Xbit.pbi"));
// Top-left center rotation point, Angle 45
setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign);
graphics_draw_rotated_bitmap(&... |
ig *config,
bool is_selected) {
if (!cell_layer_bounds) {
return;
}
const GSize icon_size = config->icon ? config->icon->bounds.size : GSizeZero;
// Calculate the size used by the value or icon on the right
// NOTE: If a value and icon is provided we only draw the value so we can re-use this functio... | {
prv_draw_cell(ctx, cell_layer, config);
} | |
ASSERT_CALLED(graphics_line_draw_stroked_aa(&context, GPoint(5, 5), GPoint(45, 10), SW_EVEN));
#else
ASSERT_CALLED(graphics_line_draw_stroked_non_aa(&context, GPoint(5, 5), GPoint(45, 10), SW_EVEN));
#endif
setup_test(&context, true, SW_EVEN, GColorBlack, GColorBlack, false);
graphics_draw_rect(&context, &GRec... | graphics_fill_circle(&context, GPoint(50, 50), 10) | |
272, -144},
{ 872, 256, -120},
{ 880, 264, -120},
{ 888, 280, -128},
{ 880, 280, -136},
{ 880, 272, -136},
{ 864, 264, -144},
{ 888, 264, -144},
{ 904, 240, -136},
{ 920, 248, -120},
{ 896, 248, -120},
{ 904, 256, -136},
{ 928, 264, -136},
{ 928, 248, -152},
{ 912... | { 872, 256, -144},
{ 872, 264, -152},
{ 880, 264, -152},
{ 888, 272, -144},
{ 888, 264, -136},
{ 888, 256, -144},
// 67 seconds
{ 888, 264, -144},
{ 880, 256, -144},
{ 896, 264, -144},
{ 888, 264, -144},
{ 888, 248, -144},
{ 880, 248, -144},
{ 888, 256, -144},
... |
{ 888, 272, -144},
{ 888, 272, -144},
{ 888, 272, -144},
{ 888, 264, -136},
{ 888, 272, -144},
{ 888, 264, -144},
{ 896, 264, -144},
{ 896, 256, -144},
{ 888, 248, -152},
{ 896, 248, -144},
{ 896, 240, -152},
{ 920, 264, -152},
{ 904, 248, -144},
{ 888, 248, -152... |
/*
* 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... | {
event_service_client_unsubscribe(&music_glance->music_event_info);
kino_reel_destroy(music_glance->icon);
} |
app_free(music_glance);
}
static void prv_set_glance_icon(LauncherAppGlanceMusic *music_glance,
uint32_t new_icon_resource_id) {
if (music_glance->icon_resource_id == new_icon_resource_id) {
// Nothing to do, bail out
return;
}
// Destroy the existing icon
kino_reel_... |
ic_request_reduced_latency(false /* reduced_latency */);
cl_assert_equal_i(s_conn_mgr_states[BtConsumerMusicServiceIndefinite].state,
ResponseTimeMax);
}
void test_ams__music_request_low_latency_for_period(void) {
prv_connect_ams();
const uint32_t period_s = 1234;
music_request_low_latency... | cl_assert_equal_i(track_duration_ms, 0) | ;
cl_assert_equal_i(music_get_playback_rate_percent(), 0);
}
void test_ams__receive_non_numeric_player_playback_info_update(void) {
prv_connect_ams();
// Receive: 'A', 'B.0' playback rate, elapsed time 184.755s
// 0000 00 01 00 41 2c 42 2e 30 2c 31 38 34 2e 37 35 35 ...A,B.0 ,184.755
uint8_t nan_playba... |
ources[timeline_id & 0x7FFFFFFF][size];
}
return true;
}
bool timeline_resources_is_system(TimelineResourceId timeline_id) {
return false;
}
// Stubs
/////////////////////
#include "stubs_app_cache.h"
#include "stubs_alarm.h"
#include "stubs_alerts.h"
#include "stubs_analytics.h"
#include "stubs_app_manager.h"... | (&launcher_menu_layer, &data_source) | ;
const bool animated = false;
// If we used MenuRowAlignCenter on rect then the test images would show the top and bottom
// rows being clipped by the edge of the screen
const MenuRowAlign row_align = PBL_IF_RECT_ELSE(MenuRowAlignTop, MenuRowAlignCenter);
prv_launcher_menu_layer_set_selection_index(&launcher... |
) {
*out_token = *(BlobDBToken *)iter;
iter += sizeof(BlobDBToken);
*out_response = *(BlobDBResponse *)iter;
iter += sizeof(BlobDBResponse);
return iter;
}
T_STATIC void prv_send_response(CommSession *session, uint8_t *response,
uint8_t response_length) {
comm_session_send_... | if (length < SYNC_DONE_RESPONSE_LENGTH) {
PBL_LOG(LOG_LEVEL_ERROR, "Got a sync done response with an invalid length: %"PRIu32"", length);
return;
} |
// read token and response code
BlobDBToken token;
BlobDBResponse response_code;
prv_read_token_and_response(data, &token, &response_code);
if (response_code != BLOB_DB_SUCCESS) {
PBL_LOG(LOG_LEVEL_ERROR, "Sync Done response error: %d", response_code);
}
}
static void prv_send_error_response(CommSes... |
/*
* 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_LOG_LEVEL_DEBUG, "Error with \"h\": %s", buf) | ;
}
r = strftime(buf, buf_size, "%H", &good_data);
if (r == 0 || strncmp(buf, "11", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"H\": %s", buf);
}
r = strftime(buf, buf_size, "%I", &good_data);
if (r == 0 || strncmp(buf, "11", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error w... |
ezone_source_is_manual(bool *new_value) {
s_clock_timezone_source_is_manual = *new_value;
return true;
}
static bool prv_set_s_clock_phone_timezone_id(int16_t *new_value) {
s_clock_phone_timezone_id = *new_value;
return true;
}
static bool prv_set_s_units_distance(uint8_t *new_unit) {
if (*new_unit >= Units... | {
s_activity_activation_delay_insight = *insight_bitmask;
return true;
} |
static bool prv_set_s_activity_prefs_health_app_opened(uint8_t *version) {
s_activity_prefs_health_app_opened = *version;
return true;
}
static bool prv_set_s_activity_prefs_workout_app_opened(uint8_t *version) {
s_activity_prefs_workout_app_opened = *version;
return true;
}
static bool prv_set_s_alarms_app... |
/////////////////////////////////////////
// Transport mock
typedef struct {
ListNode node;
uint16_t endpoint_id;
size_t length;
uint8_t data[];
} DataNode;
typedef struct {
ListNode node;
TransportDestination destination;
FakeTransportSentCallback sent_cb;
Uuid app_uuid;
CommSession *session;
//... | (transport) | ;
FakeTransport *fake_transport = (FakeTransport *) transport;
fake_transport->sent_cb = sent_cb;
}
void fake_transport_assert_sent(Transport *transport, uint16_t index, uint16_t endpoint_id,
const uint8_t data[], size_t length) {
cl_assert(transport);
FakeTransport *fake_transp... |
nt_for_default_size(TextStyleFont_Header);
prv_draw_notification_cell_round(ctx, cell_layer, &frame, font, title, NULL, NULL, NULL);
}
static void prv_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index,
void *data) {
NotificationsData *notifications_data = data;
if ((no... | list_get_at(
(ListNode*) notifications_data->notification_list, notif_idx) | ;
if (!node) {
return;
}
LoadedNotificationNode *loaded_node = prv_loaded_notification_list_load_item(
¬ifications_data->loaded_notification_list, node);
if (!loaded_node) {
return;
}
TimelineItem *notification = &loaded_node->notification;
const char *title = attribute_get_string(¬i... |
info->config);
ble_error_t e = ble_enable();
if (e != BLE_STATUS_OK) {
PBL_LOG(LOG_LEVEL_ERROR, "ble_enable: %u", e);
}
PBL_LOG(LOG_LEVEL_DEBUG, "go go go");
ble_register_app();
advert_init();
local_addr_init();
// Do all the things that clear the ATT table before registering the local services:... | gatt_client_discovery_process_service((const ble_evt_gattc_browse_svc_t *)hdr) | ;
break;
case BLE_EVT_GATTC_BROWSE_COMPLETED:
gatt_client_discovery_handle_complete((const ble_evt_gattc_browse_completed_t *)hdr);
break;
case BLE_EVT_GATTC_READ_COMPLETED:
gatt_wrapper_handle_read_completed((const ble_evt_gattc_read_completed_t *)hdr);
... |
les[i].heart_rate_bpm);
if (done) {
// Already newer than we need, return false to stop the search
return false;
}
}
// Return true to continue searching
return true;
}
// ----------------------------------------------------------------------------------------------
// Fetch whatever record... | if (file) {
prv_minute_data_file_close(file);
} |
prv_unlock();
if (success) {
// Return number of records that were written, including missing records in the middle
*num_records = context.last_record_idx_written + 1;
*utc_start = context.utc_start;
} else {
*num_records = 0;
*utc_start = 0;
}
return success;
}
// --------------------... |
/*
* 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** fw_vector_table = (void**) FIRMWARE_BASE; // Defined in wscript
*initial_stack_pointer = fw_vector_table[0];
*reset_handler = fw_vector_table[1];
} |
static void __attribute__((noreturn)) jump_to_fw(void) {
void *initial_stack_pointer, *reset_handler;
prv_get_fw_reset_vector(&reset_handler, &initial_stack_pointer);
dbgserial_print("Booting firmware @ ");
dbgserial_print_hex((uintptr_t)reset_handler);
dbgserial_print("...\r\n\r\n");
// Disable all int... |
/*
* 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... | (buffer, buffer_size, metric_value,
false, i18n_owner) | ;
break;
}
case WorkoutMetricType_Speed:
// Not part of the workout service yet
case WorkoutMetricType_Custom:
// Sports app only
case WorkoutMetricType_None:
case WorkoutMetricTypeCount:
break;
}
}
int32_t workout_data_get_metric_value(WorkoutMetricType type, void *data) ... |
ogging.h"
#include "stubs_mutex.h"
#include "stubs_passert.h"
#include "stubs_pbl_malloc.h"
#include "stubs_pebble_tasks.h"
#include "stubs_print.h"
#include "stubs_prompt.h"
#include "stubs_rand_ptr.h"
#include "stubs_serial.h"
#include "stubs_sleep.h"
#include "stubs_system_reset.h"
#include "stubs_task_watchdog.h"
... | persist_get_size(key) | , sizeof(int));
cl_assert_equal_i(persist_read_int(key), value);
}
void test_persist__bool(void) {
const uint32_t key = 0;
cl_assert_equal_i(persist_read_bool(key), false);
cl_assert_equal_i(persist_write_bool(key, true), sizeof(bool));
cl_assert_equal_i(persist_get_size(key), sizeof(bool));
cl_assert_equa... |
greed 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 the License.
*/
#include "app_glance.h"
#include "... | {
AppGlanceSliceInternal *slice_dest = &glance->slices[glance->num_slices];
*slice_dest = (AppGlanceSliceInternal) {
.expiration_time = slice.expiration_time,
.type = AppGlanceSliceType_IconAndSubtitle,
.icon_and_subtitle.icon_resource_id = slice.layout.icon,
};
// We already checked t... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | graphics_fill_rect(ctx, &layer_bounds) | ;
// Draw the text
prv_draw_text(ctx, &layer_bounds);
// Create the mask and start recording
const bool transparent = false;
GDrawMask *mask = graphics_context_mask_create(ctx, transparent);
graphics_context_mask_record(ctx, mask);
// The number of milliseconds it should take each of the shapes to make... |
/*
* 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... | jerry_eval((jerry_char_t *)script, strlen(script),
false /* is_strict */) | ;
cl_assert_equal_b(jerry_value_has_error_flag(rv), false);
jerry_release_value(rv);
const jerry_value_t func = JS_GLOBAL_GET_VALUE(FUNC_NAME);
rocky_util_call_user_function_and_log_uncaught_error(func, jerry_create_undefined(), NULL, 0);
jerry_release_value(func);
}
static void prv_do_eval(const char *eval... |
/*
* 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_timer_register(0, prv_redraw_timer_cb, NULL) | ;
}
/*****************************************************************************************
Stop our timer and display results.
A frame update consists of the following operations:
op_1) App renders to its own frame buffer
op_2) System copies the app frame buffer to the system frame buffer
op_3) System s... |
_ms - start_ms,
layer.frame.origin.x, layer.frame.origin.y,
layer.frame.size.w, layer.frame.size.h);
cl_assert(max_loops > 0);
max_loops--;
}
// This should return a NULL context now if the animation got destroyed
cl_assert(animation_get_context(h) == NULL);
// Make sure no an... | cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, h), 1) | ;
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, h), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, h), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, h), 1);
// Make sure the frame reached the "to" state
cl_assert_equal_i(prv_last_u... |
hState;
//! Command type
enum {
APP_FETCH_INSTALL_COMMAND = 0x01,
} AppFetchCommand;
//! Possible results that come back from the INSTALL_COMMAND
enum {
APP_FETCH_INSTALL_RESPONSE = 0x01,
} AppFetchResponse;
//! Possible results that come back from the INSTALL_COMMAND
enum {
APP_FETCH_RESPONSE_STARTING = 0x01,... | (LOG_LEVEL_DEBUG, "Ignoring non cookie put_bytes event") | ;
goto finally;
}
// Check for the different types of PutBytes events.
if (pb_event->type == PebblePutBytesEventTypeProgress) {
// compute and save the new progress, then show it on the progress bar
uint8_t percent =
prv_compute_progress_percent(pb_event->object_type, pb_event->progress_perce... |
AnalyticsEventBlob event_blob = {
.event = event_enum,
.pin_open_create_update.time_utc = timestamp,
.pin_open_create_update.parent_id = *parent_id,
};
#if LOG_DOMAIN_ANALYTICS
char uuid_string[UUID_STRING_BUFFER_LENGTH];
uuid_to_string(&event_blob.pin_open_create_update.parent_id, uuid_string);
... | if (successfully_sent) {
ANALYTICS_LOG_DEBUG("canned response sent event: response_size_bytes:%d",
event_blob.canned_response.response_size_bytes);
} else {
ANALYTICS_LOG_DEBUG("canned response failed event: response_size_bytes:%d",
event_blob.canned_response.re... |
analytics_logging_log_event(&event_blob);
}
// ------------------------------------------------------------------------------------------
// Log a voice response event
void analytics_event_voice_response(AnalyticsEvent event_type, uint16_t response_size_bytes,
uint16_t response_... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | GRect(4, 2, 16, 8) | );
}
void across_x_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_antialiased(ctx, false);
graphics_context_set_fill_color(ctx, GColorBlack);
graphics_fill_round_rect(ctx, &GRect(10, 2, 18, 4), 4, GCornersAll);
}
void across_nx_layer_update_callback(Layer* me, GContext* ctx) {
graphics... |
id_key = (int32_t)newest_valid_key - max_records;
oldest_valid_key = MAX(0, oldest_valid_key);
AlgMinuteFileRewriteContext context = (AlgMinuteFileRewriteContext) {
.oldest_valid_key = oldest_valid_key,
.newest_valid_key = newest_valid_key,
.watchdog_kicks_left = max_records,
};
// Rewrite the sett... | (LOG_LEVEL_ERROR, "Error %"PRIi32" writing out minute data to minute file",
(int32_t)status) | ;
} else {
s_alg_state->num_minute_records++;
success = true;
}
exit:
if (minute_file) {
prv_minute_data_file_close(minute_file);
}
return success;
}
// -------------------------------------------------------------------------------------
static DataLoggingSession *prv_get_dls_minute_session(vo... |
key_len);
}
settings_file_close(&fd);
}
cleanup:
prv_unlock();
if (rv != S_SUCCESS) {
PBL_LOG(LOG_LEVEL_ERROR, "Failed to update gap bonding db, rv = %"PRId32, rv);
return GapBondingFileSetFail;
}
return (do_perform_update ? GapBondingFileSetUpdated : GapBondingFileSetNoUpdateNeeded);
}
//!... | bt_persistent_storage_get_root_key(SMRootKeyTypeIdentity, &keys[SMRootKeyTypeIdentity]) | |
/*
* 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... | {
ISCTYPE_TEST(iscntrl)
} |
void test_ctype__isascii(void) {
ISCTYPE_TEST(isascii)
}
#define TOCTYPE_TEST(CHK) \
for(int i = -128; i < 256; i++) { \
cl_assert_equal_i(CHK##_theirs(i), CHK(i)); \
} \
/* validate double-evaluation behavior */ \
for(int i = -128; i < 256;) { \
int them = CHK##_theirs(i); \
int us = CHK(i++); \
... |
plateStringState *state) {
prv_filter_time_until(state);
if (state->error->status != TemplateStringErrorStatus_Success) {
return;
}
state->filter_state = -state->filter_state;
state->time_was_until = false;
}
static void prv_filter_end(TemplateStringState *state) {
state->filters_complete = true;
}
T_... | prv_template_eval(&state) | |
/*
* 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 (((msg->body.msgid.str_index_1 != 0) && (arg_index + 1 == (msg->body.msgid.str_index_1))) ||
((msg->body.msgid.str_index_2 != 0) && (arg_index + 1 == (msg->body.msgid.str_index_2)))) {
// String. TODO: the string is null terminated for now.
BinLogMessage_StringParam *str_param = (BinLogMessage_St... |
arg_index++;
}
// Fixup the hash (add the #args, ignore the task id for now, leave the level 0) TODO.
uint32_t hash = ((msg->body.msgid.msg_id & MSGID_STR_AND_HASH_MASK) |
((arg_index & PACKED_NUM_FMT_MASK) << PACKED_NUM_FMT_OFFSET));
// The core must be in the correct position for pbl_... |
RAME_INTERVAL_MS));
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 3);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 2);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_ha... | prv_count_handler_entries(&s_started_handler_calls, b) | , 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1);
// B should end low
distance = prv_last_update_distance(b);
cl_assert(distance < TEST_ANIMATION_NORMALIZED_LOW);
// If we keep going, we should repeat the whole sequence
prv_advance_to_ms_with_timers(start_ms + 2 * (durat... |
R "Unsupported PNG format, only PNG8 is supported!"
#define PNG_LOAD_ERROR "Failed to load PNG"
static GBitmapFormat prv_get_format_for_bpp(uint8_t bits_per_pixel) {
if (bits_per_pixel == 1) return GBitmapFormat1BitPalette;
if (bits_per_pixel == 2) return GBitmapFormat2BitPalette;
if (bits_per_pixel == 4) ret... | (upng, &palette) | ;
if (palette_size == 0) {
goto cleanup;
}
// Get the GBitmap format based on the bit depth of the raw data
GBitmapFormat format = prv_get_format_for_bpp(bpp);
// Convert 8-bit palettized PNGs to raw ARGB color images in-place
// as we don't support palettized bitdepths above 4
if (format == GBitmap... |
/*
* 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... | ("21474836481") | , 1);
// ((2147483647 * 10) + 1) & 0xFFFFFFFF
cl_assert_equal_i(atoi("21474836471"), (int)4294967287);
// -1 * (((2147483647 * 10) + 1) & 0xFFFFFFFF)
cl_assert_equal_i(atoi("-21474836471"), -(int)4294967287);
}
// atol will actually behave _exactly_ the same as atoi, so these tests are just copy-pasted
// Woul... |
SYNC(LOG_LEVEL_INFO, "Test not supported for parallel flash");
return (false);
#endif
}
static void menu_select_callback(int index, void *data) {
struct Region region = s_flash_regions[index];
PBL_LOG(LOG_LEVEL_INFO, ">>>> Erase %s", region.name);
flash_region_erase_optimal_range(region.begin, region.begin, re... | populate_menu(&data->menu_section, data->menu_items) | ;
Layer *root_layer = window_get_root_layer(window);
const GRect *bounds = &root_layer->bounds;
simple_menu_layer_init(&data->menu_layer, bounds, window, &data->menu_section, 1, NULL);
layer_add_child(root_layer, simple_menu_layer_get_layer(&data->menu_layer));
}
static void push_window(FlashDiagAppData *data)... |
= id,
.status = 0,
.layout = LayoutIdGeneric,
.type = TimelineItemTypeNotification,
},
.attr_list = {
.num_attributes = ARRAY_LENGTH(attributes),
.attributes = attributes,
},
.action_group = {
.num_actions = ARRAY_LENGTH(actions),
.actions = actions,
}
};
... | {
Uuid i;
uuid_generate(&i);
TimelineItem e = {
.header = {
.id = i,
.type = TimelineItemTypeNotification,
.status = 0,
.ancs_uid = 0,
.layout = LayoutIdGeneric,
.timestamp = 0x53f0dda5,
},
.attr_list = {
.num_attributes = ARRAY_LENGTH(attributes),
.attr... |
void test_notification_storage__remove_multiple_first(void) {
Uuid i1;
uuid_generate(&i1);
TimelineItem e1 = {
.header = {
.id = i1,
.type = TimelineItemTypeNotification,
.status = 0,
.ancs_uid = 0,
.layout = LayoutIdGeneric,
.timestamp = 0x53f0dda5,
},
.attr_list =... |
"drivers/legacy/accel.h"
#include "drivers/periph_config.h"
#include "drivers/vibe.h"
#include "kernel/events.h"
#include "pebble_errors.h"
#include "registers.h"
#include "services/common/accel_manager.h"
#include "services/common/analytics/analytics.h"
#include "services/common/vibe_pattern.h"
#include "services/imu/... | (I2C_LIS3DH) | |
mand_set_stroke_color(command, color);
gdraw_command_draw(NULL, command);
cl_assert_equal_i(s_stroke_color.argb, GColorClearARGB8);
cl_assert_equal_i(s_fill_color.argb, GColorRedARGB8);
cl_assert_equal_i(s_stroke_width, 0);
cl_assert_equal_i(s_path_num_points, 1);
cl_assert_equal_b(s_path_open, false);
cl... | {
GDrawCommandList *command_list = malloc(sizeof(GDrawCommandList) + sizeof(GDrawCommand) +
(sizeof(GPoint) * 2));
*command_list = (GDrawCommandList) {
.num_commands = 1
};
command_list->commands[0] = (GDrawCommand) {
.type = GDrawCommandTypePath,
.hidden = false,
.stroke_color = GColorRed... |
cl_assert_equal_i(s_path_stroke_count, 0);
cl_assert_equal_i(s_path_fill_count, 0);
cl_assert_equal_i(s_circle_stroke_count, 1);
cl_assert_equal_i(s_circle_fill_count, 1);
prv_reset();
gdraw_command_list_get_command(command_list, 1)->hidden = true;
gdraw_command_list_draw(ctx, command_list);
cl_assert... |
r *s_pbi2png_path;
// Stubs
void passert_failed(const char* filename, int line_number, const char* message, ...) {
exit(EXIT_FAILURE);
}
void passert_failed_no_message(const char* filename, int line_number) {
exit(EXIT_FAILURE);
}
void wtf(void) {
exit(EXIT_FAILURE);
}
bool process_manager_compiled_with_legac... | ("File not found: %s\n", filename) | ;
return;
}
// Check that file is a PDC file
char magic[4];
if (fread(magic, sizeof(magic), 1, f) != 1) {
printf("Failed to read PDC magic word: %s\n", filename);
fclose(f);
return;
}
// Read size of data
size_t size;
if (fread(&size, sizeof(size), 1, f) != 1) {
printf("Failed to 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... | (result, false) | ;
result = transcription_validate(validate_test, sizeof(Transcription));
cl_assert_equal_p(result, false);
result = transcription_validate(validate_test, sizeof(Transcription) - 1);
cl_assert_equal_p(result, false);
s_test_transcription_example[0] = 0;
result = transcription_validate(validate_test, test_... |
/*
* 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... | forecast_out->location_name = task_zalloc_check(location_pstring->str_length + 1);
pstring_pstring16_to_string(location_pstring, forecast_out->location_name);
forecast_out->current_weather_phrase = task_zalloc_check(phrase_pstring->str_length + 1);
pstring_pstring16_to_string(phrase_pstring, forecast_out->curr... | |
const GTextOverflowMode overflow_mode = selected ? GTextOverflowModeWordWrap :
GTextOverflowModeTrailingEllipsis;
const GTextAlignment text_alignment = GTextAlignmentCenter;
const GSize text_size = graphics_text_layout_get_max_used_size(ctx, item->label, font,
... | {
ctx->draw_state.clip_box.size.h -= VERTICAL_PADDING + bottom_inset;
} |
// Prevent drawing outside of the context bitmap
grect_clip(&ctx->draw_state.clip_box, &ctx->dest_bitmap.bounds);
#endif
graphics_context_set_text_color(ctx, PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack));
graphics_context_set_fill_color(ctx, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
}
PBL_IF_RE... |
ax_used_size.overflow_mode = overflow_mode,
.max_used_size.alignment = alignment,
};
strncpy(s_graphics_text_layout_get_max_used_size.last_call.max_used_size.text,
text, sizeof(s_graphics_text_layout_get_max_used_size.last_call.max_used_size.text));
return s_graphics_text_layout_get_max_used_size__... | (5, 6, 7, 8) | ;
}
void test_rocky_api_graphics__canvas_offers_size(void) {
rocky_global_init(s_graphics_api);
Layer l = {.bounds = GRect(1, 2, 3, 4)};
const jerry_value_t ctx = prv_create_canvas_context_2d_for_layer(&l);
jerry_set_object_field(jerry_get_global_object(), "ctx", ctx);
EXECUTE_SCRIPT(
"var w = ctx.canv... |
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%4k %0l", &jan_2_10015__13_00_00);
cl_assert_equal_s(tmbuf, " 13 01");
#endif
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%3H %4I", &jan_2_10015__13_00_00);
cl_assert_equal_s(tmbuf, "013 0001");
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%... | localized_strftime(tmbuf, sizeof(tmbuf), "%c", &jan_2_2015__13_00_00, NULL) | |
a doesn't set the 'is_random_address' field in the encryption change event, so using
// gap_le_connection_by_device() will fail.
GAPLEConnection *connection = gap_le_connection_by_addr(&event->dev_address);
if (connection->is_encrypted) {
PBL_LOG(LOG_LEVEL_INFO, "Encryption refreshed!");
goto unlock;
}
... | PBL_LOG(LOG_LEVEL_ERROR,
"HCI_LE_..._Device_To_White_List (is_adding=%u, r=%d, status=0x%x)",
is_adding, r, status) | ;
}
#endif
}
// -------------------------------------------------------------------------------------------------
//! Helpers to manage the s_intents list.
//! bt_lock() is expected to be taken by the caller for each of these.
static bool prv_intent_matches_connection(const GAPLEConnectionIntent *intent,
... |
/*
* 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_dest_bitmap, src_bitmap, GPointZero, GCompOpAssign, GColorWhite) | |
or on top of the cell:
if (top_diff >= it->it.cursor.sep) {
prv_menu_layer_draw_separator(it->it.menu_layer, &it->cell_layer, &it->it.cursor, it->ctx);
}
}
}
static void prv_menu_layer_render_row_from_iterator(MenuIterator *iterator) {
MenuRenderIterator *it = (MenuRenderIterator*)iterator;
const i... | {
return;
} |
} // for() sections
}
static void prv_menu_layer_walk_upward_from_iterator(MenuIterator *it) {
it->should_continue = true;
for (;;) { // sections
for (;;) { // rows
// Previous row
if (it->cursor.index.row == 0) {
// Reached top-most row in current section
break;
}
-... |
data->complete_callback(EDITED, data->alarm_id, data->callback_context);
}
i18n_free_all(data);
task_free(data);
data = NULL;
}
static void prv_time_picker_window_appear(Window *window) {
AlarmEditorData *data = (AlarmEditorData *)window_get_user_data(window);
const bool is_smart = (data->alarm_type == Al... | ("Smart Alarm") | ,
};
const char *title = i18n_get("New Alarm", data);
OptionMenu *option_menu = settings_option_menu_create(
title, OptionMenuContentType_Default, 0, &callbacks, ARRAY_LENGTH(s_type_labels),
false /* icons_enabled */, s_type_labels, data);
PBL_ASSERTN(option_menu);
data->alarm_type_menu = option_m... |
oke_precise_${BIT_DEPTH_NAME}__cleanup(void) {
free(fb);
}
// Tests
////////////////////////////////////
#define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168)
#define ORIGIN_RECT_CLIP_XY GRect(0, 0, 30, 40)
#define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 30, 40)
#define START_ON_ORIGIN_RECT GPointPre... | (gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_inside_offset_layer_aa.${BIT_DEPTH_NAME}.pbi")) | ;
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 10);
graphics_line_draw_precise_stroked_aa(&ctx, START_ON_ORIGIN_RECT_XY, END_ON_ORIGIN_RECT_XY, 10);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_x_offset_layer_aa.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(... |
tx));
cl_assert_equal_i(r1->state, RecognizerState_Failed);
cl_assert(!ctx.recognizers_active);
// Make sure that we don't try to fail a recognizer twice (causing an assert)
cl_assert(prv_fail_recognizer(r1, &ctx));
cl_assert_equal_i(r1->state, RecognizerState_Failed);
r1->state = RecognizerState_Possible... | (recognizer, &s_recognizers_handled) | ;
if ((s_idx_to_change >= 0) && (*idx == s_idx_to_change)) {
recognizer_transition_state(recognizer, s_next_state);
s_idx_to_change = -1;
s_next_state = RecognizerStateCount;
}
}
static void prv_reset_test(Recognizer *recognizer) {
prv_store_recognizer_idx(recognizer, &s_recognizers_reset);
}
void t... |
actually still there
ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, &link_key_out,
name_out, &platform_bits_out);
cl_assert(ret);
// And delete is again
bt_persistent_storage_delete_bt_classic_pairing_by_id(id);
cl_assert_equal_i(fa... | bt_persistent_storage_has_active_bt_classic_gateway_bonding() | ;
cl_assert(ret);
ret = bt_persistent_storage_has_active_ble_gateway_bonding();
cl_assert(!ret);
// Store another BT Classic pairing
BTDeviceAddress addr_2 = {{0x22, 0x12, 0x13, 0x14, 0x15, 0x16}};
SM128BitKey link_key_2 = {{0x22, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10,... |
N_UPPER_PADDING + STATUS_BAR_LAYER_HEIGHT;
frame.size = NOTIFICATION_TINY_RESOURCE_SIZE;
const bool align_in_frame = true;
peek_layer_set_scale_to_image(peek_layer, &data->peek_icon_info, TimelineResourceSizeTiny, frame,
align_in_frame);
// set peek_layer clips to true so I can... | window_get_root_layer(window) | , (Layer *)data->peek_layer);
layer_insert_below_sibling((Layer *)data->peek_layer, (Layer *)&data->status_layer);
}
///////////////////////
// SwapLayer Callbacks
///////////////////////
static void prv_remove_notification(NotificationWindowData *data, Uuid *notif_id,
const bool... |
bool has_heart_rate_service;
Uuid first_service_uuid;
} ScanResult;
static bool s_is_scanning;
//------------------------------------------------------------------------------
// ScanResult List management
static ScanResult *s_head;
//! Gets the number of ScanResults in the list:
static uint8_t list_get_count(... | {
// Clear out the local name field:
result->local_name[0] = 0;
} | |
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(origin.x + radius + width_actual - 1,... | (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_... |
IGATION4
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[1].header.id));
cl_assert(iter_next(&iterator));
#endif
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[0].header.id));
cl_assert(!iter_next(&iterator));
}
// 11 am, all events passed
void test_timeline__extra_case_backwar... | timeline_init(&head) | |
nd elapsed to have clean division for
// ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number
test_reel_data->duration_ms = ANIMATION_DURATION_INFINITE;
Animation *animation = (Animation *)kino_player_create_play_animation(test_player);
cl_assert_equal_i(animation_is_scheduled(animation), false);
ani... | (animation, true) | |
y_glance_for_row(LauncherMenuLayer *launcher_menu_layer, uint16_t row) {
if (!launcher_menu_layer || !launcher_menu_layer->selection_animations_enabled) {
return;
}
// Get the app menu node for the glance that is about to be selected
AppMenuDataSource *data_source = launcher_menu_layer->data_source;
AppM... | grect_inset(frame, GEdgeInsets(down_arrow_layer_frame_origin_y, 0, 0, 0)) | ;
Layer *down_arrow_layer = &launcher_menu_layer->down_arrow_layer;
layer_init(down_arrow_layer, &down_arrow_layer_frame);
layer_add_child(container_layer, down_arrow_layer);
ContentIndicator *content_indicator =
scroll_layer_get_content_indicator(&menu_layer->scroll_layer);
ContentIndicatorConfig cont... |
//////////////////////////////////////////////////////////////////////
// //! Local Device Info
void test_bluetooth_persistent_storage_prf__test_active_gateway(void) {
bool ret;
BtPersistBondingType type_out;
BTBondingID id_out;
// Nothing is stored, so no active gateways yet
ret = bt_persistent_storage_ge... | bt_persistent_storage_has_active_ble_gateway_bonding() | ;
cl_assert(ret);
}
|
Fixed_S16_3 radius_inner, Fixed_S16_3 radius_outer,
int32_t angle_start, int32_t angle_end) {
record_mock_call(s_graphics_fill_radial_precise_internal) {
.ctx = ctx,
.fill_radial_precise.center = center,
.fill_radial_precise.radius_inne... | {
jerry_cleanup();
rocky_runtime_context_deinit();
} |
}
static const RockyGlobalAPI *s_graphics_api[] = {
&GRAPHIC_APIS,
NULL,
};
extern RockyAPITextState s_rocky_text_state;
void test_rocky_api_graphics__handles_text_state(void) {
cl_assert_equal_i(0, s_fonts_get_system_font.call_count);
cl_assert_equal_i(0, s_graphics_text_attributes_destroy.call_count);
r... |
rv_complex_animation_update(Animation * animation, uint32_t distance) {
}
static const AnimationImplementation s_complex_implementation = {
.update = (AnimationUpdateImplementation) prv_complex_animation_update,
};
// -------------------------------------------------------------------------------------------
static ... | if (from->type != AnimationTypePrimitive) {
// Count the children
int num_children;
for (num_children = 0; num_children < ANIMATION_MAX_CHILDREN; num_children++) {
AnimationPrivate *child = prv_find_animation_by_parent_child_idx(state, from, num_children);
if (!child) {
break;
}
... |
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->context;
clone->delay_ms = from->delay_ms;
clone->duration_ms = fro... |
/*
* 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... | {
rv = jerry_get_number_value(value);
} | else if (jerry_value_is_string(value)) {
uint32_t sz = jerry_get_utf8_string_size(value);
char buf[sz + 1];
memset(buf, 0, sz + 1);
jerry_string_to_utf8_char_buffer(value, (jerry_char_t *)buf, sz);
rv = strtoul(buf, NULL, 0);
}
return rv;
}
int32_t jerry_get_int32_value(jerry_value_t value) {... |
KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "applib/graphics/gbitmap_png.h"
#include "clar.h"
#include "util.h"
#include <string.h>
#include <stdio.h>
// Stubs
////////////////////////////////////
#include "st... | cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat4BitPalette) | ;
}
// Tests 8-bit transparent palettized PNG loading into gbitmap
// Result:
// - gbitmap matches platform loaded PNG
void test_png__color_8_bit_transparent(void) {
GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(8bit));
cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(8bit)));
cl_assert_equal_i(gbitmap_... |
ns);
cl_assert_equal_i(sessions[0].type, ActivitySessionType_Sleep);
}
{ // Create a 2 hour session that is still on-going - should register as normal sleep
time_t sleep_start_utc = now_utc - (2 * SECONDS_PER_HOUR);
ActivitySession sessions[] = {
{
.start_utc = sleep_start_utc,
.l... | activity_algorithm_get_steps(&steps_asleep_100m) | ;
prv_feed_minute_data(20, &minute_data[100], false /*simulate_bg_delays*/);
activity_algorithm_get_steps(&steps_asleep_120m);
// We should get steps counted while not sleeping
printf("\nWhile asleep in the first 100m: ");
printf("\n Counted %d steps first 60m", steps_asleep_60m);
printf("\n Counted %d ... |
cl_assert_equal_i(recognizers[2]->state, RecognizerState_Started);
cl_assert_equal_i(recognizers[3]->state, RecognizerState_Cancelled);
// Layer C's and layer A's recognizers get reset when layer B becomes the new active layer
prv_set_all_states(recognizers, k_rec_count, RecognizerState_Started);
prv_cancel_l... | (manager.state, RecognizerManagerState_RecognizersActive) | ;
cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[3]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible);
// All recognizers receive events w... |
prv_render_metric(ctx, metric_type, layer, bg_color, draw_hr_zones, prefer_larger_font);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//! End Workout
static void prv_end_workout_up_click_handler(ClickRecognizerRef recognizer, void *context) {
WorkoutActiv... | (active_window) | ;
}
static void prv_click_config_provider(void *context) {
window_set_click_context(BUTTON_ID_UP, context);
window_set_click_context(BUTTON_ID_SELECT, context);
window_set_click_context(BUTTON_ID_DOWN, context);
window_single_click_subscribe(BUTTON_ID_UP, prv_up_click_handler);
window_single_click_subscribe(... |
e, 0x0f, 0x20,
},
},
.identity = (BTDeviceInternal) {
.address = (BTDeviceAddress) {
.octets = {
0x21, 0x22, 0x13, 0x14, 0x15, 0x26,
},
},
.is_classic = false,
.is_random_address = false,
},
.is_remote_identity_info_valid = true,
};
BTBondingID... | (&irk_out, &pairing_2.irk, sizeof(irk_out)) | ;
cl_assert_equal_m(&device_out, &pairing_2.identity, sizeof(device_out));
ret = bt_persistent_storage_get_ble_pairing_by_id(id_3, &irk_out, &device_out, NULL /* name */);
cl_assert(ret);
cl_assert_equal_m(&irk_out, &pairing_3.irk, sizeof(irk_out));
cl_assert_equal_m(&device_out, &pairing_3.identity, sizeof(... |
, we can get "Excellent" quality readings the first few seconds, even
// though the BPM is 0. Let's fix the quality if the BPM is too low to be valid
HRMQuality quality = data->hrm_quality;
if ((data->hrm_bpm < HRM_SENSOR_MIN_VALID_BPM_READING)
&& (data->hrm_quality > HRMQuality_NoSignal)) {
quality = H... | sys_accel_manager_set_sample_buffer(
s_manager_state.accel_state, s_manager_state.accel_manager_buffer,
HRM_MANAGER_ACCEL_MANAGER_SAMPLES_PER_UPDATE) | ;
hrm_enable(HRM);
// Don't need the re-enable timer to fire
new_timer_stop(s_manager_state.update_enable_timer_id);
} else if (!turn_sensor_on && hrm_is_enabled(HRM)) {
// Turn off the sensor now
HRM_LOG("Turning off HR sensor");
hrm_disable(HRM);
sys_accel_manager_dat... |
F2_COMPATIBLE
#define STM32F4_COMPATIBLE
#define STM32F7_COMPATIBLE
#include <mcu.h>
#include "FreeRTOS.h"
#define DIALOG_INT_CONFIG_PTR (&BOARD_CONFIG_BT_COMMON.wakeup.int_gpio)
#define DIALOG_EXTI (BOARD_CONFIG_BT_COMMON.wakeup.int_exti)
static DialogSpiDmaTransferCompletedCallback s_dma_transfer_complet... | PBL_ASSERTN(tx_buffer || rx_buffer) | ;
// FIXME: PBL-32864: Ugh, can't do this from ISR
// periph_config_acquire_lock();
s_dma_transfer_complete_cb = done_isr_callback;
prv_enable_spi_clock();
// Client code is supposed to ensure no transfer gets set up,
// while the previous one is still on-going:
PBL_ASSERTN(!spi_ll_slave_dma_in_progress... |
},
{ 1240, 416, -296},
{ 1088, 360, -192},
{ 1192, 296, -72},
{ 1288, 272, 24},
{ 1200, 264, -8},
{ 1000, 200, -48},
{ 768, 168, -24},
{ 680, 160, 0},
{ 672, 160, 0},
{ 752, 152, -40},
{ 840, 136, -32},
{ 1032, 144, -88},
{ 1096, 136, -144},
{ 1048, 72, -152},
... | { 1112, 216, -104},
{ 832, 208, -96},
{ 608, 184, -136},
{ 520, 184, -112},
// 110 seconds
{ 528, 152, -80},
{ 688, 176, -80},
{ 824, 232, -176},
{ 984, 256, -224},
{ 1048, 312, -288},
{ 1120, 328, -264},
{ 1400, 368, -232},
{ 1112, 392, -224},
{ 968, 312, -152},
... | |
NULL, NULL, false, overflow_mode);
// Restore the cell layer's bounds
mutable_cell_layer->bounds = saved_bounds;
}
static void prv_cell_item_content_draw_round(GContext *ctx, const Layer *cell_layer,
const ActionMenuLayer *aml, const ActionMenuItem *item,... | (aml, &label_text_frame, &draw_top_shading, &draw_bottom_shading) | ;
#if !defined(RECOVERY_FW) && SCREEN_COLOR_DEPTH_BITS == 8
// Replace the clip box with a clip box that will render the item in the right place with the
// right size, without menu layer's selection clipping. Menu layer will responsible for cleaning
// up the changes made to this clip box.
ctx->draw_st... |
Data*) context;
if (!data) {
return;
}
StoredRemote* remote = (StoredRemote*) list_find_next(data->remote_list_head,
dual_remote_filter, true, device);
if (remote) {
// The remote is also a ble device, promote to a dual remote
const bool class... | {
SettingsBluetoothData* settings_data = (SettingsBluetoothData *) context;
PBL_LOG_COLOR(LOG_LEVEL_DEBUG, LOG_COLOR_BLUE, "BT EVENT");
switch (event->type) {
case PEBBLE_BT_CONNECTION_EVENT:
// If BT Settings is open, update BLE device name upon connecting device:
if (event->bluetooth.connection.... |
// UI Stuff
/////////////////////////////
// Menu Layer Callbacks
/////////////////////////////
//-- Address
// ...
//| Airplane Mode: Off
//-- Paired Devices
//| Device Name
// Connected
//| Device Name
//
static void prv_draw_stored_remote_item_rect(GContext *ctx, const Layer *cell_layer,
... |
= ROCKY_DATE_FORMAT_SHORT, .format = ToStringFormatMonthShort},
{.field = month, .value = ROCKY_DATE_FORMAT_LONG, .format = ToStringFormatMonthLong},
{.field = year, .value = ROCKY_DATE_FORMAT_NUMERIC, .format = ToStringFormatYearNumeric},
{.field = year, .value = ROCKY_DATE_FORMAT_2DIGIT, .format = ToStrin... | (options, default_format, mask,
&is_24h_style) | ;
if (format == ToStringFormatUnsupported) {
if (error) {
*error = rocky_error_argument_invalid("Unsupported options");
}
return 0;
}
struct tm tm;
prv_tm_from_js_date(this_val, &tm);
const char *strftime_format = prv_strftime_format(format, is_24h_style);
const size_t str_len = strftime... |
.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_pb_state.timer_id, PUT_TIMEOUT_MS, prv_timer_callback, &s_pb_state,
0 /*flags*/);
exit:
prv_mark_pb_jo... | prv_has_invalid_fw_update_state(cmd) | );
return has_error;
}
static bool prv_check_putrequest_for_errors(const PutRequest *request_hdr,
uint32_t tot_request_size) {
uint32_t req_size = tot_request_size - sizeof(PutRequest);
uint32_t data_length = ntohl(request_hdr->length);
if (data_length > req_size) {... |
er_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_nx_offset_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_y_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,... | setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 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... | (0 == strcmp(buf, "-365")) | ;
// max int32
itoa_int(2147483647, buf, 10);
cl_assert(0 == strcmp(buf, "2147483647"));
// min int32
itoa_int(-2147483647, buf, 10);
cl_assert(0 == strcmp(buf, "-2147483647"));
}
void test_string__test_byte_stream_to_hex_string(void) {
char result_buf[256]; // arbitraily large
const uint8_t byte_st... |
hour = 5,
.tm_mday = 1,
.tm_mon = 0,
.tm_year = 115
};
time_t utc_sec = mktime(&start_tm);
rtc_set_time(utc_sec);
// Add a Sleep session
const time_t time_elapsed = (120 * SECONDS_PER_MINUTE);
ActivitySession sleep_session = {
.start_utc = utc_sec - time_elapsed,
.length_min = time_elap... | activity_private_state() | |
/*
* 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... | JERRY_VALUE_HAS_TYPE(value, 'function') | ;
}
bool jerry_value_is_number(const jerry_value_t value) {
return JERRY_VALUE_HAS_TYPE(value, 'number');
}
bool jerry_value_is_null(const jerry_value_t value) {
return ((bool)EM_ASM_INT({
return __jerryRefs.get($0) === null;
}, value));
}
bool jerry_value_is_object(const jerry_value_t value) {
retur... |
_stopped_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0);
// Just before A completes
prv_advance_to_ms_with_timers(start_ms + duration_a - 1);
cl_assert_equal_i(prv_count_handler_e... | prv_count_handler_entries(&s_started_handler_calls, a) | , 2);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0);
// Complete spawn
prv_advance_to_ms_with_timers(start_ms + duration_t... |
--------------------
// Compute the aggregated value of the given metric using values from minute history
static HealthValue prv_compute_aggregate_using_minute_history(
HealthServiceState *state, HealthMetric metric, time_t time_start, time_t time_end,
HealthAggregation aggregation) {
// Currently only implemente... | {
return;
} |
bool went_above = ((value > info->threshold) && (info->prior_reading < info->threshold));
bool went_below = ((value < info->threshold) && (info->prior_reading > info->threshold));
if (went_above || went_below) {
state->event_handler(HealthEventMetricAlert, state->context);
info->prior_reading = value;
... |
/*
* 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... | delay_ms(200) | ;
display_error_code(0x89abcdef);
delay_ms(200);
display_error_code(0xcafebabe);
delay_ms(200);
display_error_code(0xfeedface);
delay_ms(200);
display_error_code(0x8badf00d);
delay_ms(200);
display_error_code(0xbad1ce40);
delay_ms(200);
display_error_code(0xbeefcace);
del... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.