prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
/*
* 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_execute_command, &s_prompt_context, &should_context_switch) | ;
} else if (UNLIKELY(c == 0x3)) { // CTRL-C
// FIXME: Clean this up so this logic doesn't need to be duplicated here
s_prompt_context.write_index = 0;
prv_display_prompt();
}
return should_context_switch;
#endif
}
|
.state, RecognizerManagerState_RecognizersActive);
cl_assert_equal_p(manager.triggered, NULL);
cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible);
// A touchdown occurs and the active layer goes from non-null to null. All layer... | (manager.state, RecognizerManagerState_WaitForTouchdown) | ;
cl_assert_equal_i(r2->state, RecognizerState_Possible);
cl_assert(!recognizer_get_manager(r1));
recognizer_set_manager(r1, &manager);
r1->state = RecognizerState_Possible;
r2->state = RecognizerState_Started;
manager.active_layer = &layer_a;
manager.triggered = r2;
manager.state = RecognizerManagerSt... |
/*
* 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... | setup_pbi_test(TEST_PBI_FILE) | |
e.integer, progress),
MAX_PLOT_OPACITY, stroke_color, quadrant);
}
}
// Behold for magic number 3!!!
// Note: magic numbers explained in main comment for this function
int special_case_pixels = 3;
// Acommpanied by magic number 7 (not 6, we increased radius at beginning of this function)... | {
graphics_circle_quadrant_fill_non_aa(ctx, p, outer_radius, quadrant);
} |
#else
graphics_circle_quadrant_fill_non_aa(ctx, p, outer_radius, quadrant);
#endif
// Restore original status
ctx->draw_state.fill_color = temp_color;
return;
}
// Since fill_oval will use fill color, we have to swap those:
const GColor fill_color = ctx->draw_state.fill_color;
ctx->draw_state... |
139, 0},
{ 0, 0x6a, 0, 139, 0},
{ 0, 0x6a, 0, 139, 0},
{ 0, 0x6a, 0, 140, 0},
{ 0, 0x79, 4162, 139, 0},
{ 0, 0x62, 2787, 139, 0},
{ 0, 0x62, 0, 132, 0},
{ 0, 0x62, 13, 140, 0},
{ 0, 0x62, 0, 140, 0},
{ 0, 0x61, 0, 140, 0},
{ 0, 0x61, 0, 141, 0},
{ 0, 0x6... | // 600: Local time: 2016-05-20 07:06:00 AM
{ 0, 0x1c, 0, 141, 0},
{ 0, 0x1b, 404, 224, 0},
{ 0, 0x1a, 893, 129, 0},
{ 0, 0x1b, 0, 129, 0},
{ 0, 0x1c, 0, 128, 0},
{ 0, 0x1b, 0, 129, 0},
{ 0, 0x1b, 115, 151, 0},
{ 0, 0x3b, 1074, 158, 0},
{ 0, 0x4b, 0, 160, 0},
... |
{ 0, 0xe, 0, 122, 0},
// 645: Local time: 2016-05-20 07:52:00 AM
{ 0, 0xe, 0, 123, 0},
{ 0, 0xe, 0, 122, 0},
{ 0, 0xe, 0, 122, 0},
{ 0, 0xe, 0, 122, 0},
{ 0, 0xe, 0, 122, 0},
{ 0, 0xe, 0, 121, 0},
{ 0, 0xe, 0, 122, 0},
{ 0, 0xe, 0, 122, 0},
{ 0, 0xe, 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... | RTC_GetDate(RTC_Format_BIN, &rtc_date) | ;
// Unlike mktime there's no error checking here since if something goes wrong
// it'll just give us the wrong time anyway
unsigned days = rtc_date.RTC_Year * 365; // RTC_Year is 0-99
days += (rtc_date.RTC_Year / 4); // Leap years
// Cumulative days from previous months
const unsigned month_days[] = {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... | (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 with \"I\": %s", buf);
}
r = strftime(buf, buf_siz... |
== PebbleTask_Worker) {
worker_manager_close_current_worker(gracefully);
} else {
WTF;
}
}
// ----------------------------------------------------------------------------------------------
bool process_manager_send_event_to_process(PebbleTask task, PebbleEvent* e) {
ProcessContext *context = prv_get_c... | {
return (uint32_t) process_manager_get_current_process_args();
} | |
one_call.c ignores it
prv_put_phone_event(PhoneEventType_Start, PhoneCallSource_PP, ANCS_CALL_UID);
}
static void prv_call_hide(uint32_t call_identifier) {
// Note: the source doesn't matter here, phone_call.c ignores it
prv_put_phone_event(PhoneEventType_Hide, PhoneCallSource_PP, call_identifier);
}
static voi... | (PhoneEventType_End) | ;
}
// ---------------------------------------------------------------------------------------
// Basic test for call start events
void test_phone_call__call_start(void) {
// A call start event with ANCS should act as a call end in order to hide the phone ui
prv_put_incoming_call_event(PhoneCallSource_ANCS_Legacy... |
layer_selection_will_change(MenuLayer *UNUSED menu_layer, MenuIndex *new_index,
MenuIndex UNUSED old_index, void *context) {
LauncherMenuLayer *launcher_menu_layer = context;
prv_play_glance_for_row(launcher_menu_layer, new_index->row);
}
T_STATIC void prv_launcher_... | content_indicator_configure_direction(content_indicator, ContentIndicatorDirectionUp,
&content_indicator_config) | ;
content_indicator_config.layer = down_arrow_layer;
content_indicator_configure_direction(content_indicator, ContentIndicatorDirectionDown,
&content_indicator_config);
#endif
// Wait to add the menu layer until after we might have added the content indicators because
//... |
oid test_do_not_disturb__weekday_weekend_schedule(void) {
bool active;
cl_assert(do_not_disturb_is_smart_dnd_enabled() == false);
cl_assert(do_not_disturb_is_manually_enabled() == false);
cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == false);
cl_assert(do_not_disturb_is_schedule_enabled(Wee... | (get_dnd_timer_id()) | , 169200 * MS_PER_SECOND);
do_not_disturb_set_schedule_enabled(WeekendSchedule, false);
do_not_disturb_set_schedule_enabled(WeekdaySchedule, true);
rtc_set_time(s_saturday_01_30);
do_not_disturb_handle_clock_change();
cl_assert(active == false);
// Timer will go off at 00:00 on Saturday. (46.5 hours)
cl_... |
r_handler_histories();
uint64_t start_ms = prv_now_ms();
animation_schedule(seq);
// Start A
prv_advance_to_ms_with_timers(start_ms + 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0);
cl_assert... | (prv_count_handler_entries(&s_started_handler_calls, b), 0) | |
te,
#if PBL_BW
.outline_color = GColorBlack,
#endif
},
.num_subtitles = 1,
.subtitles = &(HealthDetailSubtitle) {
.label = "30 DAY AVG",
.fill_color = PBL_IF_COLOR_ELSE(GColorYellow, GColorBlack),
},
.bg_color = BG_COLOR,
.daily_avg = 900,
.weekly_max = 1300,
.num_zones... | scroll_layer_get_content_offset(&card->scroll_layer) | ;
offset.y -= scroll_layer_get_content_size(&card->scroll_layer).h;
scroll_layer_set_content_offset(&card->scroll_layer, offset, false);
#endif
window_render(&card->window, &s_ctx);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
|
er 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 <inttypes.h>
#include <stdio.h>
#include <string.h>
#i... | app_file_get_app_id("@ffffffe9/asdf") | , -23);
}
|
t char *[]){
"Unhandled Error",
" "ERROR_STRING,
NULL
};
prv_do_eval("throw new Error('"ERROR_STRING"');");
cl_assert(*s_log_internal__expected == NULL);
}
void test_rocky_api_util__create_date_now(void) {
const time_t cur_time = 1458250851; // Thu Mar 17 21:40:51 2016 UTC
... | jerry_call_function(getDate, now, NULL, 0) | ;
jerry_value_t result_month = jerry_call_function(getMonth, now, NULL, 0);
jerry_value_t result_year = jerry_call_function(getYear, now, NULL, 0);
cl_assert_equal_d(jerry_get_number_value(result_seconds), 28.0);
cl_assert_equal_d(jerry_get_number_value(result_minutes), 38.0);
cl_assert_equal_d(jerry_get_num... |
ENT_CLOSED);
}
res = S_SUCCESS;
cleanup:
mutex_unlock_recursive(s_pfs_mutex);
return (res);
}
status_t pfs_close_and_remove(int fd) {
mutex_lock_recursive(s_pfs_mutex);
status_t res = E_UNKNOWN;
if (!FD_VALID(fd)) {
res = E_INVALID_ARGUMENT;
} else {
File *f = &PFS_FD(fd).file;
char file_... | ((uint8_t *)&file_hdr.file_namelen, sizeof(file_hdr.file_namelen),
prv_page_to_flash_offset(pg) + file_namelen_offset) | ;
char file_name[file_hdr.file_namelen + 1];
prv_flash_read((uint8_t *)file_name, file_hdr.file_namelen,
prv_page_to_flash_offset(pg) + FILE_NAME_OFFSET);
file_name[file_hdr.file_namelen] = 0;
if (callback && !callback(file_name)) {
// Don't include
continue;
}
... |
(event.event_type) {
case HRMEvent_BPM:
if (!(state->features & HRMFeature_BPM)) {
continue;
}
break;
case HRMEvent_LEDCurrent:
if (!(state->features & HRMFeature_LEDCurrent)) {
continue;
}
break;
case HRMEvent_HRV:
if (!(sta... | ("TIA samples: %d", data->ppg_data.num_samples) | ;
HRM_HEXDUMP(data->ppg_data.tia, data->ppg_data.num_samples * sizeof(uint16_t));
HRM_LOG("Accel samples: %"PRIu32, data->accel_data.num_samples);
HRM_LOG("LED %"PRIu16"uA, TIA: %"PRIu16, data->led_current_ua, data->tia);
time_t utc_now = rtc_get_time();
RtcTicks cur_ticks = rtc_get_ticks();
HRMFeature ker... |
bitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(2bitpalette)));
cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat2BitPalette);
}
// Tests 4-bit transparent palettized PNG loading into gbitmap
// Result:
// - gbitmap matches platform loaded PNG
void test_png__color_4_bit_transparent(void) {
GBitmap *bitmap = se... | TEST_PBI_FILE_FMT(raw) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
syscall_failed();
} | |
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 "kernel/pbl_malloc.h"
#include... | ("got header signature LSB") | |
<string.h>
//////////////////////////////////////
/// Creating Transforms
//////////////////////////////////////
// Note that int64_t casting is required since cos/sin values are already in a 32-bit fixed point
// representation and when passed to this function. They need to be scaled by the
// Fixed_S32_16 precision... | (tx_b, ty_d, t2->ty) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(notif_db_get_len((uint8_t *)&hdr2, UUID_SIZE), 0) | ;
cl_assert_equal_i(notif_db_get_len((uint8_t *)&hdr3, UUID_SIZE), 0);
}
|
;
kernel_free(notif_prefs);
return NULL;
}
prv_free_serialzed_prefs(serialized_prefs);
return notif_prefs;
}
void ios_notif_pref_db_free_prefs(iOSNotifPrefs *prefs) {
kernel_free(prefs);
}
status_t ios_notif_pref_db_store_prefs(const uint8_t *app_id, int length, AttributeList *attr_list,
... | if (S_SUCCESS != prv_file_open_and_lock(&file)) {
return NULL;
} |
BlobDBDirtyItem *dirty_list = NULL;
settings_file_each(&file, sync_util_build_dirty_list_cb, &dirty_list);
prv_file_close_and_unlock(&file);
return dirty_list;
}
status_t ios_notif_pref_db_mark_synced(const uint8_t *key, int key_len) {
if (key_len == 0) {
return E_INVALID_ARGUMENT;
}
SettingsFil... |
/*
* 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 INSTALL_ID_INVALID;
} |
#if !CAPABILITY_HAS_SDK_SHELL4
const char *app_custom_get_title(AppInstallId id) {
return NULL;
}
void customizable_app_protocol_msg_callback(void *session, const uint8_t* data,
size_t length) {
}
#endif
// Used by the alarm service to add alarm pins to the timeline
con... |
/*
* 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... | (&data->click_manager.recognizers[e->button.button_id]) | ;
break;
case PEBBLE_BUTTON_UP_EVENT:
click_recognizer_handle_button_up(&data->click_manager.recognizers[e->button.button_id]);
break;
default:
PBL_CROAK("Invalid event type: %u", e->type);
break;
}
}
#else
if ((e->button.button_id == BUTTON_ID_SELECT) && (e->type == PEBBLE... |
AMPLE_HZ;
return true;
}
static void prv_activity_update_states(time_t utc_sec, AlgMinuteRecord *record_out,
bool shutting_down);
// ------------------------------------------------------------------------------------
// This is called when the activity services is doing down.... | (&median, &heart_rate_total_weight_x100) | ;
m_rec->heart_rate_bpm = (uint8_t)median;
m_rec->heart_rate_total_weight_x100 = (uint16_t)heart_rate_total_weight_x100;
m_rec->heart_rate_zone = activity_metrics_prv_get_hr_zone();
return minute_distance_mm;
}
static void NOINLINE prv_reset_state_minute_handler(const AlgMinuteDLSSample *m_rec) {
s_alg_st... |
case RecognizerState_Completed:
case RecognizerState_Failed:
PBL_ASSERTN(new_state == RecognizerState_Possible);
break;
default:
WTF;
}
recognizer->state = new_state;
}
static bool prv_should_handle_touches(Recognizer *recognizer, const TouchEvent *touch_event) {
if (recognizer_get_sta... | PBL_ASSERTN(recognizer && recognizer->impl) | ;
if (!recognizer_is_active(recognizer)) {
return;
}
if (recognizer->state == RecognizerState_Possible) {
// Nothing to cancel
return;
}
if (recognizer->impl->cancel(recognizer)) {
recognizer->subscriber.event(recognizer, RecognizerEvent_Cancelled);
}
prv_set_state(recognizer, Recognizer... |
/*
* 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... | (sector - first_sector + 1, count, progress_context) | ;
}
}
FLASH_Lock();
return true;
}
bool system_flash_write(uint32_t address, const void *data, size_t length) {
// enable programming of flash
FLASH_Unlock();
// clear errors
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |
FLASH_FLAG_PGAERR | FLASH_FLAG_PGPER... |
/*
* 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... | get_bitmap_color(test_image_bw, 8, 24) | , GColorBlack));
cl_check(gcolor_equal(get_bitmap_color(test_image_color, 30, 2), GColorClear));
cl_check(gcolor_equal(get_bitmap_color(test_image_color, 30, 10), GColorRed));
cl_check(gcolor_equal(get_bitmap_color(test_image_color, 30, 30), GColorScreaminGreen));
#endif
}
void test_graphics_draw_rotated_bitmap... |
/*
* 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... | nexmo_is_reauth_sms(expected_app_id, bad_message) | );
cl_assert(!nexmo_is_reauth_sms(bad_app_id, bad_message));
}
void test_nexmo__handle_reuath_sms(void) {
// UID
const uint32_t uid = 42;
s_expected_uid = uid;
// App ID
uint8_t app_id_buf[128];
ANCSAttribute *app_id = (ANCSAttribute *)&app_id_buf;
app_id->length = strlen(IOS_SMS_APP_ID);
memcpy(app... |
/ x5| x4 \
*
* + center point
* - x coordiante mirror line
* | y coordinate mirror line
* / 45 degree mirror line
* \ 135 degree mirror line
* x given offset point
* xn mirrored points
*/
prv_plot4(fb, clip_box, center, offset, brightness, stroke_color, quadrant... | (progress, radius) | .raw_value};
if (edge.integer != 0) {
weighting = (edge.fraction >> 1);
if (edge.integer - 1 > radius - stop_progress) {
prv_plot4(framebuffer, &ctx->draw_state.clip_box, p, GPoint(edge.integer - 1, progress),
weighting, stroke_color, quadrant);
}
if (edge.intege... |
e->command_id = command_id;
if (request_payload_length) {
memcpy(message->payload, request_payload, request_payload_length);
}
return message;
}
bool hc_protocol_enqueue_with_payload(HcEndpointID endpoint_id, HcCommandID command_id,
const uint8_t *request_payload,
... | prv_cleanup_expectation(expectation) | |
(), 0);
#endif
}
// --------------------------------------------------------------------------------------
// Test that we can reschedule an animation from the stopped handler that has auto-destroy on
void test_animation__auto_destroy_reschedule(void) {
#ifdef TEST_INCLUDE_BASIC
PropertyAnimation *prop_h;
Layer l... | (prv_last_update_distance(h), ANIMATION_NORMALIZED_MAX) | ;
// This should return NULL now if the animation got destroyed
cl_assert(animation_private_animation_find(h) == NULL);
// Make sure no animations exist
cl_assert_equal_i(prv_count_animations(), 0);
}
// --------------------------------------------------------------------------------------
// Test that anim... |
(pin_config.gpio, pin_config.gpio_pin_source, pin_config.gpio_af) | ;
gpio_release(pin_config.gpio);
}
//! Configure bus pin as input
//! Lock bus and peripheral config access before use
static void bus_pin_cfg_input(AfConfig pin_config) {
gpio_use(pin_config.gpio);
// Configure pin as high impedance input
GPIO_InitTypeDef gpio_init_struct;
gpio_init_struct.GPIO_Pin = pin_... | |
RCC_AHB3PeriphResetCmd(ahb3_periphs, DISABLE);
RCC_APB1PeriphResetCmd(apb1_periphs, ENABLE);
RCC_APB1PeriphResetCmd(apb1_periphs, DISABLE);
RCC_APB2PeriphResetCmd(apb2_periphs, ENABLE);
RCC_APB2PeriphResetCmd(apb2_periphs, DISABLE);
// The Cortex-M user guide states that the reset values for the core regist... | dbgserial_putstr("Failed to start firmware, strike one.") | ;
boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE);
}
return false;
}
static bool prv_prf_button_combination_is_pressed(void) {
return (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK)
&& button_is_pressed(BUTTON_ID_SELECT) && !button_is_pressed(BUTTON_ID_DOWN));
}
static bool chec... |
/*
* 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... | mutex_create() | ;
// Find and delete any AppInstallId-indexed persist files. Due to PBL-16663
// (affecting FW 3.0-dp5 thru -dp7), the AppInstallId in the file name may not
// correspond to the app that the persist file originally belonged to. Since
// we can't be sure that the persist files correspond to the current
// App... |
/////////////////////////////////////////////////////////
//! BT Classic Pairing Data
bool shared_prf_storage_get_bt_classic_pairing_data(BTDeviceAddress *addr_out,
char *device_name_out,
SM128BitKey *link_key_out,
... | prv_cleanup_struct(&data) | |
sCommand command, uint32_t request_token) {
if (command == PutBytesInit ||
command == PutBytesInstall) {
return false;
}
if (s_pb_state.token != request_token) {
PBL_LOG(LOG_LEVEL_ERROR, "%d: Token does not match; got 0x%" PRIx32 ", expected 0x%" PRIx32,
command, request_token, s_pb_stat... | resource_storage_get_file_name(filename, sizeof(filename), index) | ;
storage_info = kernel_malloc_check(sizeof(PutBytesStorageInfo) + strlen(filename) + 1);
strcpy(storage_info->filename, filename);
break;
}
#else
case ObjectFile:
case ObjectWatchApp:
case ObjectWatchWorker:
case ObjectAppResources:
return false;
#endif
case ObjectFirmwa... |
this->stream->periph->FCR = fcr_value;
prv_release_controller(this->stream->controller);
// Configure and enable the IRQ if necessary (DMA interrupts enabled later)
if (this->irq_priority != IRQ_PRIORITY_INVALID) {
NVIC_SetPriority(this->stream->irq_channel, this->irq_priority);
NVIC_EnableIRQ(this->st... |
void dma_request_init(DMARequest *this) {
if (this->state->initialized) {
return;
}
// we only support 1 transfer per stream so assert that the stream isn't already initialized
PBL_ASSERTN(!this->stream->state->initialized);
// sanity check that the stream and controller are valid
switch ((uintptr_t)... | |
al_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture,
time_21_00_march_1_pst), S_SUCCESS);
const time_t midnight_march_2_pst = 1425283200;
// day 1
cl_assert(uuid_equal(&state.pin.header.id, &all_day_item.header.id));
cl_assert(uuid_equal(&state.n... | cl_assert_equal_i(state.node->timestamp, midnight_march_2_pst) | |
/*
* 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... | (!circular_buffer_read(&buffer, 1, &out_buffer, &out_length)) | ;
cl_assert(!circular_buffer_consume(&buffer, 1));
}
void test_circular_buffer__copy(void) {
CircularBuffer buffer;
uint8_t storage[8];
circular_buffer_init(&buffer, storage, sizeof(storage));
const uint16_t data_out_size = 8;
uint8_t data_out[data_out_size];
// Test copy when there is nothing in the b... |
ReceiveRouter *rtr) {
// Eat any bytes from an ignored, previous message:
if (rtr->bytes_to_ignore) {
const uint32_t num_ignored_bytes = MIN(*data_size_p, rtr->bytes_to_ignore);
rtr->bytes_to_ignore -= num_ignored_bytes;
*data_size_p -= num_ignored_bytes;
if (*data_size_p == 0) {
return tr... | {
rtr->receiver_imp->finish(rtr->receiver);
// Wipe it, to avoid confusing ourselves when looking at core dumps:
prv_cleanup_router(rtr);
} |
}
}
void comm_session_receive_router_cleanup(CommSession *session) {
ReceiveRouter *rtr = &session->recv_router;
if (rtr->receiver_imp) {
rtr->receiver_imp->cleanup(rtr->receiver);
}
// Wipe it, to avoid confusing ourselves when looking at core dumps:
prv_cleanup_router(rtr);
}
|
ile (QSPI_GetFlagStatus(QSPI_FLAG_BUSY) != RESET) { }
}
static void prv_quad_enable() {
QSPI_ComConfig_InitTypeDef qspi_com_config;
QSPI_ComConfig_StructInit(&qspi_com_config);
qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Write;
qspi_com_config.QSPI_ComConfig_IMode = QSPI_ComConfig_IMod... | (buffer_size) | ;
QSPI_ComConfig_InitTypeDef qspi_com_config;
QSPI_ComConfig_StructInit(&qspi_com_config);
qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Read;
qspi_com_config.QSPI_ComConfig_DMode = QSPI_ComConfig_DMode_4Line;
qspi_com_config.QSPI_ComConfig_DummyCycles = MT25Q_FASTREAD_DUMMYCYCLES;
q... |
/*
* 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... | dialog_set_text(dialog, "A Simple Dialog For Flow Testing!\nHello!") | ;
dialog_set_background_color(dialog, GColorLavenderIndigo);
dialog_set_icon(dialog, data->resource_id_80);
dialog_set_vibe(dialog, true);
dialog_show_status_bar_layer(dialog, true);
app_simple_dialog_push(simple_dialog);
}
//////////////////////
// Confirmation Dialog
static void prv_confirm_click_handler... |
ute *title = attribute_find(¬if_prefs->attr_list, AttributeIdShortTitle);
cl_assert(title);
cl_assert_equal_s(title->cstring, "Title");
Attribute *mute = attribute_find(¬if_prefs->attr_list, AttributeIdMuteDayOfWeek);
cl_assert(mute);
cl_assert_equal_i(mute->uint8, 0x1F);
Attribute *name = attribute_f... | cl_assert_equal_i(ios_notif_pref_db_is_dirty(&is_dirty), S_SUCCESS) | ;
cl_assert(!is_dirty);
dirty_list = ios_notif_pref_db_get_dirty_list();
cl_assert(!dirty_list);
}
|
-40, 920, 248},
{ -40, 912, 248},
{ -40, 920, 248},
{ -40, 920, 248},
{ -40, 912, 248},
{ -40, 920, 248},
{ -40, 920, 248},
{ -40, 920, 248},
{ -40, 920, 248},
{ -40, 920, 248},
{ -40, 920, 248},
{ -40, 920, 248},
{ -40, 912, 248},
// 111 seconds
{ -40, 920, 248},... | { -40, 920, 240},
{ -32, 920, 240},
{ -40, 920, 256},
{ -40, 920, 248},
{ -40, 912, 248},
{ -40, 920, 248},
{ -40, 920, 248},
{ -40, 912, 248},
{ -32, 920, 248},
{ -40, 920, 248},
{ -40, 920, 248},
{ -32, 920, 248},
{ -40, 920, 240},
{ -40, 920, 248},
{ -40, 9... |
{ -40, 920, 248},
{ -40, 920, 256},
{ -40, 920, 248},
{ -40, 920, 248},
{ -40, 920, 248},
{ -40, 920, 248},
{ -48, 920, 248},
{ -24, 920, 232},
{ -40, 912, 240},
{ -40, 912, 240},
{ -48, 920, 248},
{ -40, 920, 240},
{ -32, 920, 248},
{ -40, 920, 240},
{ -40, ... |
/*
* 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 rtc_get_time();
} | |
/*
* 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_destructor(data);
} | |
rcle_quadrant_draw_stroked_aa(GContext* ctx, GPoint p, uint16_t radius,
uint8_t stroke_width, GCornerMask quadrant) {
prv_stroke_circle_quadrant_full_override_aa(ctx, p, radius, stroke_width, quadrant, true);
}
#endif // PBL_COLOR
//! Draws aliased stroked quadr... | (ctx, p, radius, ctx->draw_state.stroke_width) | ;
return;
} else {
// Antialiased and Stroke Width == 1
graphics_circle_draw_1px_aa(ctx, p, radius);
return;
}
}
#endif
if (ctx->draw_state.stroke_width > 1) {
// Non-Antialiased and Stroke Width > 1
graphics_circle_draw_stroked_non_aa(ctx, p, radius, ctx->draw_state.stroke_w... |
d->num_regulatory_marks_in_current_cell,
});
}
}
static void prv_draw_regulatory_id_cell(
GContext *ctx, const Layer *cell_layer, SystemCertificationData *cd,
bool is_selected, const void *arg1, const void *arg2) {
const char *title = arg1;
const char *subtitle = arg2;
menu_cell_basic_draw(ctx, cel... | (cd, &(SystemCertificationMenuItem) {
.draw_cell_fn = prv_draw_korea_regulatory_cell,
.arg1 = "South Korea KCC",
.select_cb = prv_push_kcc_window,
}) | ;
}
if (flags->has_mexico_nom_nyce) {
prv_append_certification_menu(cd, &(SystemCertificationMenuItem) {
.draw_cell_fn = prv_draw_regulatory_id_cell,
.arg1 = "IFETEL",
.arg2 = prv_get_mexico_ifetel_id(),
});
}
if (flags->has_korea_kcc) {
prv_append_regulatory_compliance_mark... |
/*
* 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... | (l.bounds, GRect(1, 1, 200, 599)) | ;
// act as 2.x once bounds.size isn't same as frame.size
layer_set_bounds(&l, &GRect(0, 0, 150, 600));
layer_set_frame(&l, &GRect(10, 20, 100, 700));
cl_assert_equal_grect(l.bounds, GRect(0, 0, 150, 700));
}
|
/*
* 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... | {
reason->cookie = COOKIE;
s_reboot_reason = *reason;
} |
bool reboot_reason_get(RebootReason *reason) {
*reason = s_reboot_reason;
return (reason->cookie == COOKIE);
}
void reboot_reason_clear(void) {
s_reboot_reason = (RebootReason){};
}
uint32_t reboot_reason_get_crash_lr(void) {
RebootReason reason;
if (!reboot_reason_get(&reason)) {
return 0;
};
sw... |
// Don't send an error here! The initiating side is supposed have detected the version
// incompatibility and not sent the ResetComplete (and send an Error message), but apparently
// we did get the ResetComplete somehow?
prv_awaiting_reset_request__enter();
return;
}
prv_session_open_... | (it, context) | |
(state, prv_get_ms_since_system_start(), animation,
0 /*add_delay*/);
return success;
}
// -------------------------------------------------------------------------------------------
bool animation_unschedule(Animation *animation_h) {
AnimationState *state = prv_animation_s... | if (animation_private_using_legacy_2(NULL)) {
// We need to enable other applib modules like scroll_layer, menu_layer, etc. which are
// compiled to use the 3.0 animation API to work with 2.0 apps.
AnimationHandlers *handlers = (AnimationHandlers *)&((AnimationLegacy2 *)animation_h)->handlers;
return *h... |
AnimationPrivate *animation = prv_find_animation_by_handle(NULL, animation_h, false /*quiet*/);
if (!animation) {
return (AnimationHandlers) {0};
}
return animation->handlers;
}
// -------------------------------------------------------------------------------------------
bool animation_set_implementati... |
/*
* 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... | ("Enabling clock %s", prv_string_for_cmd(clock_cmd)) | ;
#endif
portENTER_CRITICAL();
clock_cmd(rcc_bit, ENABLE);
portEXIT_CRITICAL();
}
void periph_config_disable(void *periph, uint32_t rcc_bit) {
ClockCmd clock_cmd = prv_get_clock_cmd((uintptr_t)periph);
#if PERIPH_CONFIG_DEBUG
if (prv_string_for_cmd(clock_cmd))
PERIPH_CONFIG_LOG("Disabling clock %s", prv_... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_28386_1
//> TEST_EXPECTED 100
//> TEST_EXPECTED_MIN 80
//> TEST_EXPECTED_MAX 120
//> TEST_WEIGHT 1.0
static AccelRawData samples[] = {
// 0 seconds
// elapsed: 0 minutes
{ 344, -264, -880},
{ 3... |
{ 120, 1080, -288},
{ 24, 1080, -80},
{ -40, 1080, 120},
{ -128, 1152, 176},
{ -128, 1056, 216},
{ -112, 1000, 256},
{ -120, 1008, 264},
{ -104, 896, 280},
{ -120, 920, 248},
{ -120, 888, 248},
{ -96, 840, 304},
{ -48, 952, 296},
{ -8, 912, 336},
{ 24, 952, 528},... |
y+minute
// 2015 Nov 13, 00:45:00
{ -1,12,-1,45, WDAY_ANY, 1447375500},
// mday+hour
// 2015 Nov 13, 13:00:00
{ -1,12,13,-1, WDAY_ANY, 1447419600},
// mday+hour+minute
// 2015 Nov 13, 13:45:00
{ -1,12,13,45, WDAY_ANY, 1447422300},
// month
// 2015 Dec 1, 00:00:00
{ 11,-1,-1,-1, WDAY_ANY, 14489280... | {
// Nov 21st, 01:00:00 local
CronJob test_cron = {
.cb = prv_cron_callback,
.cb_data = (void*)0,
.minute = 0,
.hour = 1,
.mday = 20,
.month = 10,
.may_be_instant = true,
};
// 2015 Nov 21, 00:00:00 GMT
const time_t advance = 1448064000 - s_2015_nov12_123456_gmt;
prv_basic_test... |
void test_cron__dst_simple_from(void) {
// Dec 21st, 01:00:00 local
CronJob test_cron = {
.cb = prv_cron_callback,
.cb_data = (void*)0,
.minute = 0,
.hour = 1,
.mday = 20,
.month = 11,
.may_be_instant = true,
};
// 2015 Dec 21, 01:00:00 GMT
const time_t advance = 1450659600 - s... |
ered_frames);
if (time_rendered) {
int frame_period = time_rendered/(int64_t)data->rendered_frames;
int fps = (int64_t)data->rendered_frames*1000/time_rendered;
PBL_LOG(LOG_LEVEL_INFO, "## at %d FPS (%d ms/frame)", fps, frame_period);
}
app_window_stack_pop_all(false);
}
static const char *prv_row_t... | GRect(navbar_width, 0, full_rect->size.w - navbar_width, full_rect->size.h) | ;
menu_layer_init(&data->action_list1, &menu_layer_rect);
menu_layer_set_callbacks(&data->action_list1, NULL, &(MenuLayerCallbacks){
.get_num_rows = prv_get_num_rows,
.draw_row = prv_draw_row_1,
.get_separator_height = prv_get_separator_height,
});
layer_set_hidden(&data->action_list1.inverter... |
keupId first_wakeup_id = sys_wakeup_schedule(first_event, 0, false);
cl_assert_equal_i(sys_wakeup_query(first_wakeup_id), first_event);
TimerID first_timer = wakeup_get_current();
// Schedule another a minute away
time_t second_event = sys_get_time() + WAKEUP_EVENT_WINDOW * 2;
WakeupId second_wakeup_id = sy... | cl_assert_equal_b(s_popup_occurred, true) | ;
// Make sure the wakeup event is no longer scheduled
cl_assert_equal_i(sys_wakeup_query(first_timer), E_DOES_NOT_EXIST);
}
|
void gatt_client_subscriptions_handle_write_cccd_response(BLEDescriptor cccd,
BLEGATTError error);
// -------------------------------------------------------------------------------------------------
typedef struct {
ListNode node;
//! This is redu... | prv_ctx_in_client_event_ctxs(event->context) | ) {
goto unlock;
}
// Default values
uint16_t gatt_value_length = 0;
uint16_t gatt_err_code = BLEGATTErrorSuccess;
if (event->error_code != BLEGATTErrorSuccess) {
gatt_err_code = event->error_code;
} else {
switch (event->type) {
case GattClientOpResponseRead: {
... |
H_NAME}.pbi"));
prv_reset();
test_graphics_context_init(&ctx, fb);
s_current_path = s_house_path;
ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT / 2);
graphics_context_set_antialiased(&ctx, true);
prv_filled_update_proc(NULL, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
"gp... | (SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2) | );
s_path_angle = 20;
test_graphics_context_init(&ctx, fb);
graphics_context_set_antialiased(&ctx, true);
prv_filled_update_proc(NULL, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_house_20_aa.8bit.pbi"));
// This case demonstrates tipping point that is also the starting point of the path
... |
le_free_handler(ptr);
return;
}
UTIL_ASSERT(0); // heap_free on invalid pointer <ptr>
}
/* Mask out the allocation bit of the segment to be freed. */
/* This will make calculations in this block easier. */
heap_info_ptr->is_allocated = false;
#ifndef RELEASE
if (heap-... | (heap, block) | |
) {
return (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK)
&& button_is_pressed(BUTTON_ID_SELECT) && !button_is_pressed(BUTTON_ID_DOWN));
}
static bool prv_check_force_boot_recovery(void) {
if (boot_bit_test(BOOT_BIT_FORCE_PRF)) {
boot_bit_clear(BOOT_BIT_FORCE_PRF);
return true;... | {
prv_sad_watch(ERROR_BAD_SPI_FLASH);
} | |
G_SETF(DCDC, DCDC_TEST_0_REG, DCDC_OUTPUT_MONITOR, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_ANA_TEST, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_IDLE, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V18P, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_VDD, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC... | REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_WRAP_LEN, 0x0) | ;
REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_WRAP_MD, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_INST_MD, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_DMY_NUM, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_EXT_HF_DS, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_EXT_BYTE_EN, 0x0);
REG_SETF(Q... |
"services/normal/timeline/timeline.h"
#include "services/normal/timeline/timeline_resources.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/size.h"
#include "util/struct.h"
typedef struct {
void *action_data;
void *context;
ActionMenu *action_menu;
#if CAPABILITY_HAS_MICROPHONE
VoiceW... | applib_free(data) | ;
}
static void prv_show_result_window(ActionResultData *data, const TimelineResourceId timeline_res_id,
const char *msg, bool succeeded) {
const GSize simple_dialog_icon_size = timeline_resources_get_gsize(TimelineResourceSizeLarge);
const bool use_status_bar = true;
const boo... |
/*
* 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... | (size, client_pc) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | fake_spi_flash_cleanup() | ;
}
void test_shared_prf_storage_v2__wipe_all(void) {
SMPairingInfo sm_pairing_info;
memset(&sm_pairing_info, 0xaa, sizeof(sm_pairing_info));
sm_pairing_info.is_local_encryption_info_valid = true;
sm_pairing_info.is_remote_signing_info_valid = true;
sm_pairing_info.is_remote_identity_info_valid = true;
sha... |
ubsample_denominator != new_den) {
state->subsample_numerator = new_num;
state->subsample_denominator = new_den;
}
PBL_LOG(LOG_LEVEL_DEBUG, "set subsampling for session %d to %d/%d", (int)state->session_ref,
state->subsample_numerator, state->subsample_denominator);
state = (AccelS... | accel_get_latest_reading((AccelRawData *)accel_data) | ;
result = 0;
break;
}
vTaskDelay(milliseconds_to_ticks(10));
}
}
}
mutex_unlock_recursive(s_mutex);
return result;
}
static bool prv_call_data_callback(AccelSubscriberState *state) {
switch (state->task) {
case PebbleTask_App:
case PebbleTask_Worker:
c... |
sion_exit_utc > exit_utc) {
exit_utc = session_exit_utc;
}
first_container = false;
} else {
// Insure that restful sessions are inside the previous container
cl_assert(container_session != NULL);
cl_assert(session->start_utc >= container_session->start_utc);
cl_assert(s... | ("\n\n========================================================") | |
ransition
// With a few tweaks, this compositor animation can drive both
typedef struct {
int16_t offset_y;
bool slide_up;
bool timeline_is_destination;
bool timeline_is_empty;
GColor fill_color;
} CompositorSlideTransitionData;
static CompositorSlideTransitionData s_data;
static void prv_copy_framebuffer_... | (ctx, &GRect(content_width, fill_offset_y, TIMELINE_PEEK_ICON_BOX_WIDTH,
fill_height)) | ;
} else
#endif
{
graphics_context_set_fill_color(ctx, s_data.fill_color);
graphics_fill_rect(ctx, &GRect(0, fill_offset_y, DISP_COLS, fill_height));
}
} else {
GBitmap app_bitmap = compositor_get_app_framebuffer_as_bitmap();
bitblt_bitmap_into_bitmap(&dest_bitmap, &app_bitmap, GPoint(... |
hrm->debug->accel_data.num_samples);
led_current = bpm = bpm_quality = 0;
prv_send_msg();
} else if (hrm->event_type == HRMEvent_SubscriptionExpiring) {
PBL_LOG(LOG_LEVEL_INFO, "Got subscription expiring event");
// Subscribe again if our subscription is expiring
const uint32_t updat... | PBL_LOG(LOG_LEVEL_DEBUG, "Successfully opened app message") | ;
}
if (!sys_hrm_manager_is_hrm_present()) {
text_layer_set_text(quality_tl, "No HRM Present");
} else {
text_layer_set_text(quality_tl, "Loading...");
prv_enable_hrm();
}
app_message_register_inbox_received(prv_message_received_cb);
app_message_register_outbox_sent(prv_message_sent_cb);
app... |
equence_ptr = sequence;
*sequence = (GDrawCommandSequence){
.version = GDRAW_COMMAND_VERSION,
.num_frames = 2,
.play_count = 1,
};
GDrawCommandFrame *frame;
frame = &sequence->frames[0];
*frame = (GDrawCommandFrame) {
.duration = 15,
};
frame->command_list = (GDrawCommandList) {
.num... | (sequence, 0) | ;
frame->duration = 0;
frame = gdraw_command_sequence_get_frame_by_elapsed(sequence, 0);
cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_index(sequence, 1));
frame = gdraw_command_sequence_get_frame_by_index(sequence, 0);
frame->duration = 15;
// test that the sequence loops when the play coun... |
;
}
// Insert into the list:
list_link_sorted_by_rssi(result);
// Tell the menu to update:
menu_layer_reload_data(s_menu_layer);
}
void toggle_scan(void) {
if (s_is_scanning) {
ble_scan_stop();
s_is_scanning = false;
} else {
ble_scan_start(ble_scan_handler);
s_is_scanning = true;
}
... | {
APP_LOG(APP_LOG_LEVEL_INFO, "ble_central_cancel_connect: %d", e);
} |
}
//------------------------------------------------------------------------------
// Window callbacks:
static void window_load(Window *window) {
Layer *window_layer = window_get_root_layer(window);
GRect bounds = layer_get_frame(window_layer);
s_menu_layer = menu_layer_create(bounds);
window_set_user_data(... |
141, 0},
{ 0, 0x2b, 0, 141, 0},
{ 0, 0x2b, 0, 141, 0},
{ 0, 0x2b, 0, 141, 0},
{ 0, 0x2b, 0, 141, 0},
{ 0, 0x2b, 0, 141, 0},
{ 0, 0x2b, 0, 141, 0},
{ 0, 0x2b, 0, 141, 0},
{ 0, 0x2b, 0, 141, 0},
{ 0, 0x2b, 0, 141, 0},
{ 0, 0x2b, 0, 141, 0},
{ 0, 0x2b, 0, 141, 0},
// 535: L... | ARRAY_LENGTH(samples) | ;
return samples;
}
|
connect_ping)];
uint16_t tx_start_ticks;
bool rx_mode;
printf("Waiting for host:\n");
for (int count = 10; count > 0; --count) {
printf(".");
// Feed the watchdog
hw_watchdog_set_pos_val(0xFF);
// Configure for RX mode
rx_mode = true;
hw_spi_change_fifo_mode(s_spi->bus_id, HW_SPI_FIFO... | hw_watchdog_set_pos_val(0xFF) | |
ALARM_KIND_JUST_ONCE, just_once_schedule_friday);
// Only 1 pin should be added
cl_assert_equal_i(s_num_timeline_adds, 1);
}
void test_alarm__just_once_alarm(void) {
AlarmId id1, id2;
id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_JUST_ONCE });
// It's currently Thursday @ 00... | prv_assert_alarm_config(id1, 10, 30, false, ALARM_KIND_CUSTOM, schedule_1) | ;
// It's currently Thursday @ 00:00.
s_current_day = s_friday;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 1);
s_current_day = s_saturday;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 1);
s_current_day = s_sunday;
cron_service_wakeup();
cl_assert_equal_i(s_num_a... |
p the audio transfer session. We
// expect voice_handle_dictation_result to be called next with a dictation response
void voice_stop_dictation(VoiceSessionId session_id) {
mutex_lock(s_lock);
if ((s_state == SessionState_Idle) ||
(session_id != s_session_id) ||
(session_id == VOICE_SESSION_ID_INVALID)) ... | {
strcat(sentence, " ");
} | |
Event expiring_event = (PebbleHRMEvent) {
.event_type = HRMEvent_SubscriptionExpiring,
.expiring.session_ref = state->session_ref,
};
state->callback_handler(&expiring_event, state->callback_context);
state->sent_expiration_event = true;
}
// See if this subscriber wants these... | ("HRM Data:") | ;
HRM_LOG("Status %"PRIx8, data->hrm_status);
HRM_LOG("HRM: %"PRIu8"bpm, Quality: %d, Stable: %d", data->hrm_bpm, data->hrm_quality,
(int)stable_sensor);
HRM_LOG("PPG samples: %d", data->ppg_data.num_samples);
HRM_HEXDUMP(data->ppg_data.ppg, data->ppg_data.num_samples * sizeof(uint16_t));
HRM_LOG("T... |
e double click
int16_t offset = prv_get_current_notification_offset(swap_layer);
if (offset != 0) {
prv_announce_interaction(swap_layer);
prv_attempt_swap(swap_layer, ScrollDirectionDown, true /* to_top */);
}
}
static void prv_raw_click_handler(ClickRecognizerRef recognizer, void *context) {
SwapLayer... | swap_layer_reload_data(swap_layer) | ;
}
Layer* swap_layer_get_layer(const SwapLayer *swap_layer) {
return &((SwapLayer *)swap_layer)->layer;
}
LayoutLayer* swap_layer_get_current_layout(const SwapLayer *swap_layer) {
return swap_layer->current;
}
///////////////////////
// INIT FUNCTIONS
///////////////////////
void swap_layer_init(SwapLayer *swa... |
free(command);
}
void test_gdraw_command__draw_precise_path(void) {
GDrawCommand *command = malloc(sizeof(GDrawCommand) + (sizeof(GPoint) * 3 ));
*command = (GDrawCommand){
.type = GDrawCommandTypePrecisePath,
.hidden = false,
.stroke_color = GColorRed,
.stroke_width = 1,
.fill_color = GColo... | prv_compare_points(¢er, s_stroke_points, s_path_num_points) | );
cl_assert_equal_p(s_fill_points, NULL);
prv_reset();
// set stroke color to be transparent and restore fill - fill should be drawn, but no outline
// should be drawn
gdraw_command_set_fill_color(command, GColorRed);
color = gdraw_command_get_stroke_color(command);
color.a = 0;
gdraw_command_set_stro... |
dingID id_1 = bt_persistent_storage_store_bt_classic_pairing(&addr_1, &link_key_1,
name_1, &platform_bits_1);
prv_fire_writeback_timer();
cl_assert(id_1 != BT_BONDING_ID_INVALID);
// Read it back
ret = bt_persistent_storage_get_bt_classic_pairing_by_i... | cl_assert_equal_s(name_in, name_out) | ;
cl_assert_equal_i(platform_bits_in, platform_bits_out);
}
void test_bluetooth_persistent_storage_prf__delete_bt_classic_pairing_by_id(void) {
bool ret;
// Output variables
BTDeviceAddress addr_out;
SM128BitKey link_key_out;
char name_out[BT_DEVICE_NAME_BUFFER_SIZE];
uint8_t platform_bits_out;
// St... |
ched(0, size);
size = FLASH_SIZE - FLASH_REGION_DEBUG_DB_END;
fake_flash_assert_region_untouched(FLASH_REGION_DEBUG_DB_END, size);
fake_spi_flash_cleanup();
}
typedef struct {
char **msg_arr;
int curr_msg_idx;
int num_items;
int num_processed;
} ExpectedMessage;
static ExpectedMessage s_msg;
void test... | {
uint32_t uniq_msg_id = 0xDEADDEAD - i + (i << 16);
char buf[20];
snprintf(buf, sizeof(buf), "%x", uniq_msg_id);
for (int j = 0; j < log_len; j += strlen(buf)) {
memcpy(&msg[j], buf, MIN(strlen(buf), log_len - j));
}
msg[log_len] = '\0';
msg_arr[i] = task_strdup(msg);
} |
return (msg_arr);
}
static void free_logs(char **msg_arr, int num_logs) {
for (int i = 0; i < num_logs; i++) {
free(msg_arr[i]);
}
free(msg_arr);
}
//
// Actual Tests
//
//! Simple test to confirm that we can log and read back several messages
void test_flash_logging__basic(void) {
flash_logging_ini... |
e_size),
S_SUCCESS);
cl_assert_equal_i(app_glance_db_get_len((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE),
glance_size);
uint8_t *glance_out = kernel_malloc(glance_size);
cl_assert_equal_i(app_glance_db_read((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, glance_out,
... | cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE,
(uint8_t *)&app_glance_2, glance_2_size),
E_INVALID_ARGUMENT) | ;
}
void test_app_glance_db__glance_blob_with_too_many_slices_inserted_but_trimmed(void) {
const size_t original_glance_size = sizeof(s_app_glance_with_too_many_slices);
const size_t excess_slices_size = 11;
const size_t trimmed_glance_size = original_glance_size - excess_slices_size;
// Insert the glance blo... |
*window_layer = window_get_root_layer(window);
GRect root_bounds = layer_get_bounds(window_layer);
data->results_card.text_layer = text_layer_create(root_bounds);
text_layer_set_text_alignment(data->results_card.text_layer, GTextAlignmentCenter);
text_layer_set_background_color(data->results_card.text_layer, ... | {
HealthAPITestAppData *data = window_get_user_data(window);
Layer *window_layer = window_get_root_layer(window);
GRect root_bounds = layer_get_bounds(window_layer);
data->hr_card.text_layer = text_layer_create(root_bounds);
text_layer_set_text_alignment(data->hr_card.text_layer, GTextAlignmentCenter);
tex... |
// -------------------------------------------------------------------------------
static void prv_hr_window_unload(Window *window) {
HealthAPITestAppData *data = window_get_user_data(window);
text_layer_destroy(data->hr_card.text_layer);
data->hr_card.text_layer = NULL;
// Cancel our shorter sample period
... |
, seconds);
}
}
int health_util_format_minutes_and_seconds(char *buffer, size_t buffer_size, int duration_s,
void *i18n_owner) {
int minutes = duration_s / SECONDS_PER_MINUTE;
int seconds = duration_s % SECONDS_PER_MINUTE;
return snprintf(buffer, buffer_size, i18n_get... | (fmt_i18n, buffer) | ;
return rv;
}
int health_util_get_distance_factor(void) {
switch (shell_prefs_get_units_distance()) {
case UnitsDistance_Miles:
return METERS_PER_MILE;
case UnitsDistance_KM:
return METERS_PER_KM;
case UnitsDistanceCount:
break;
}
return 1;
}
const char *health_util_get_distance... |
er translated to the destination bitmap
// address - so do all calculations so everything is offset from 0
uint32_t * base_addr = 0;
#else
uint32_t * base_addr = ((uint32_t*)dest_bitmap->addr);
#endif
const uint32_t * const dest_block_x_begin = base_addr +
(left_cl... | {
const int left_clip_shift = left_clip % 32;
const int clipped_blocks = left_clip / 32;
dest_shift = (dest_shift + left_clip_shift) % 32;
glyph_block_bits_left -= left_clip_shift;
glyph_block += clipped_blocks;
if (glyph_block_bits_left <= 0) {
src = *(++glyph_block);
... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert(!s_pending_did_write.active) | ;
s_pending_did_write = (PendingInfo) {
.active = true,
.attribute = attribute
};
}
static void prv_did_write_handler(SmartstrapAttribute *attribute, SmartstrapResult result) {
cl_assert(result == SmartstrapResultOk);
cl_assert(s_pending_did_write.active);
cl_assert(s_pending_did_write.attribute == a... |
ams_t *dev_params = ble_mgr_dev_params_acquire();
memcpy(&dev_params->irk, &config->root_keys[SMRootKeyTypeIdentity], sizeof(dev_params->irk));
ble_mgr_dev_params_release();
}
static void prv_handle_get_peer_version_complete(const ble_evt_gap_get_peer_version_t *evt) {
Connection *conn = connection_by_idx_check(... | {
ble_evt_gap_pair_completed_t *evt = (ble_evt_gap_pair_completed_t *)hdr;
prv_handle_pairing_completed(evt);
break;
} |
case BLE_EVT_GAP_ADDRESS_RESOLVED: {
const ble_evt_gap_address_resolved_t *evt = (const ble_evt_gap_address_resolved_t *)hdr;
prv_handle_address_resolved(evt);
break;
}
case BLE_EVT_GAP_DEV_ADDR_UPDATED: {
const ble_evt_gap_dev_address_updated_t *evt =
... |
c(ANALYTICS_APP_METRIC_FLASH_SUBSECTOR_ERASE_COUNT,
AnalyticsClient_CurrentTask);
s_system_analytics_erase_count++;
status = is_subsector? flash_impl_erase_subsector_begin(addr)
: flash_impl_erase_sector_begin(addr);
if (PASSED(status)) {
flash_impl_set_nvram_erase_stat... | {
prv_erase_suspend_timer_cb(NULL);
} | |
ics with step:0, variance:17-22, with
// one minute of high variance (511) every 3-10 minutes.
for (uint32_t minute = 0; minute < minutes; minute++) {
if ((minute % 10) == 0) {
activity_test_feed_samples(s_walk_30_steps, 10 * SAMPLES_PER_SECOND);
prv_feed_idle_movement_sec(50);
} else {
p... | activity_get_metric(ActivityMetricSleepState, 1, &value) | ;
PBL_LOG(LOG_LEVEL_DEBUG, "sleep state: %d", (int)value);
// See how many steps we took during sleep. The light sleep simulator ends up providing about
// 12 steps every 10 minutes, so without the "no steps during sleep" logic in the activity
// service, we would end up with about 180/10 * 12 = 216 steps duri... |
bs_pbl_malloc.h"
#include "stubs_pebble_tasks.h"
#include "stubs_print.h"
#include "stubs_prompt.h"
#include "stubs_serial.h"
#include "stubs_shell_prefs.h"
#include "stubs_sleep.h"
#include "stubs_status_bar_layer.h"
#include "stubs_syscall_internal.h"
#include "stubs_syscalls.h"
#include "stubs_task_watchdog.h"
#incl... | {
SimpleDialog *simple_dialog = simple_dialog_create("Watchface crashed");
Dialog *dialog = simple_dialog_get_dialog(simple_dialog);
dialog_set_text(dialog, "Watchface is not responding");
dialog_set_icon(dialog, RESOURCE_ID_GENERIC_WARNING_LARGE);
dialog_set_timeout(dialog, DIALOG_TIMEOUT_INFINITE /* no time... |
void test_simple_dialog__battery_charged(void) {
SimpleDialog *simple_dialog = simple_dialog_create("Battery Status");
Dialog *dialog = simple_dialog_get_dialog(simple_dialog);
dialog_set_text(dialog, "Fully Charged");
dialog_set_background_color(dialog, GColorKellyGreen);
dialog_set_icon(dialog, RESOURCE_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... | delay_us(10) | |
/*
* 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_modal_transition_animation_teardown_rect(NULL);
s_data.animation_sequence = gdraw_command_sequence_create_with_resource(resource_id);
} |
static void prv_modal_transition_fill_update(GContext *ctx,
uint32_t distance_normalized,
bool inner) {
const GColor replace_color = GColorGreen;
const GColor stroke_color = TIMELINE_DOT_COLOR;
compositor_transition_pdcs_a... |
og_private.h"
#include "applib/app_timer.h"
#include "applib/applib_malloc.auto.h"
#include "applib/ui/dialogs/dialog.h"
#include "applib/ui/kino/kino_reel/transform.h"
#include "applib/ui/kino/kino_reel/scale_segmented.h"
#include "applib/ui/kino/kino_reel_pdci.h"
#include "applib/ui/vibes.h"
#include "applib/ui/wind... | (reel, 300) | |
/*
* 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... | (file, iOS_NOTIF_PREF_DB_FILE_NAME, iOS_NOTIF_PREF_MAX_SIZE) | ;
if (rv != S_SUCCESS) {
mutex_unlock(s_mutex);
}
return rv;
}
static void prv_file_close_and_unlock(SettingsFile *file) {
settings_file_close(file);
mutex_unlock(s_mutex);
}
//! Assumes the file is opened and locked
static status_t prv_save_serialized_prefs(SettingsFile *file, const void *key, size_t ... |
5171200,"46","07"},
{1195257600,"46","07"},{1195344000,"46","07"},{1195430400,"47","07"},{1195516800,"47","07"},{1195603200,"47","07"},{1195689600,"47","07"},{1195776000,"47","07"},
{1195862400,"47","07"},{1195948800,"47","07"},{1196035200,"48","07"},{1196121600,"48","07"},{1196208000,"48","07"},{1196294400,"48","0... | cl_assert_equal_s(tmbuf, "-1000") | ;
jan_2_2015__13_00_00.tm_gmtoff = -39600;
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%z", &jan_2_2015__13_00_00);
cl_assert_equal_s(tmbuf, "-1100");
}
#endif
void test_strftime__full_percent_U(void) {
char tmbuf[512];
struct tm dec_30_2014__13_00_00 = {
.tm_hour = 13, .tm_min = 0, .tm_sec = 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... | {
const ButtonConfig* button_config = &BOARD_CONFIG_BUTTON.buttons[id];
gpio_use(button_config->gpio);
uint8_t bit = GPIO_ReadInputDataBit(button_config->gpio, button_config->gpio_pin);
gpio_release(button_config->gpio);
return !bit;
} |
uint8_t button_get_state_bits(void) {
uint8_t button_state = 0x00;
for (int i = 0; i < NUM_BUTTONS; ++i) {
button_state |= (button_is_pressed(i) ? 0x01 : 0x00) << i;
}
return button_state;
}
void button_init(void) {
// Need to disable button wakeup functionality
// or the buttons don't register input... |
adrants = GCornerNone,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(10),GCornerTopRight}
}));
// # Section with quadrant filling
// Tests for full quadrants
cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(0), TO_TRIG(90)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){... | (TO_TRIG(30), TO_TRIG(60)) | |
gTypeInt32] = {-2147483648.0, 2147483647.0},
[RockyArgTypeInt64] = {-9223372036854775808.0, 9223372036854775807.0},
[RockyArgTypeDouble] = {-1.7976931348623157e+308, 1.7976931348623157e+308},
[RockyArgTypeFixedS16_3] = {-32768.0 / FIXED_S16_3_FACTOR, 32767.0 / FIXED_S16_3_FACTOR},
};
const bool is_withi... | {
prv_convert_to_string_and_apply(argv[0], prv_copy_string_applier, binding);
return true;
} |
static bool prv_convert_and_assign_angle(const RockyArgBinding *binding, const jerry_value_t argv[],
RockyArgValueCheckError *value_error_out) {
*((double *)binding->ptr) = jerry_get_angle_value(argv[0]);
return true;
}
static bool prv_assign_grect_precise(const RockyArgBin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.