prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
alse, true, false}; bool verify_schedule_2[7] = {false, false, false, false, false, false, false}; id2 = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_EVERYDAY }); alarm_set_custom(id2, schedule_2); prv_assert_alarm_config(id2, 4, 14, false, ALARM_KIND_CUSTOM, schedule_2); alarm_get_...
assert_alarm_pins_absent(id1)
; alarm_delete(id2); prv_assert_alarm_config_absent(id2); assert_alarm_pins_absent(id2); id3 = alarm_create(&(AlarmInfo) { .hour = 13, .minute = 13, .kind = ALARM_KIND_WEEKDAYS }); id4 = alarm_create(&(AlarmInfo) { .hour = 14, .minute = 14, .kind = ALARM_KIND_WEEKDAYS }); id5 = alarm_create(&(AlarmInfo) { ....
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb3}, .parent_id = {0}, .timestamp = 1421183642, // Tue Jan 13 13:14:02 2015 PST .duration = 2, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, }, .attr_list = { .num_attributes = 0, ...
timeline_model_get_iter_state(1)
ection //! event only gets sent after pairing/encryption is established. bool connected; } GAPLEConnectionClient; //! Data structure to hold cached bonding info typedef struct { BTBondingID id; BTDeviceInternal device; // containing identity address, not connection address SMIdentityResolvingKey irk; } GAPL...
{ event.bluetooth.connection.state = PebbleBluetoothConnectionEventStateConnected; }
/* * 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_b(false, prv_scroll_layer_is_paging_enabled(scroll_layer))
; // verify shadow layer is hidden on paging disabled cl_assert_equal_b(true, scroll_layer_get_shadow_hidden(scroll_layer)); } void test_scroll_layer__paging_vs_shadow_bits(void) { ScrollLayer *scroll_layer = scroll_layer_create(GRect(0,0,180,180)); // Validate that paging_disabled is same position as shadow ...
l_radial(ctx, bounds, GOvalScaleModeFitCircle, 15, 0, TRIG_MAX_ANGLE * percent / 100); } // ------------------------------------------------------------------------------- static void handle_battery(BatteryChargeState charge_state) { layer_mark_dirty(window_get_root_layer(s_data->steps_window)); } // ------------...
// Subscribe to health update events health_service_events_subscribe(prv_health_event_handler, data); // Set a heart rate alert HealthMetricAlert *alert = health_service_register_metric_alert(HealthMetricHeartRateBPM, 80); APP_LOG(APP_LOG_LEVEL_INFO, "health metric alert: %p", alert); if (alert == NULL) { ...
// ------------------------------------------------------------------------------- static void steps_window_unload(Window *window) { HealthAPITestAppData *data = window_get_user_data(window); text_layer_destroy(data->steps_card.cur_step_layer); data->steps_card.cur_step_layer = NULL; text_layer_destroy(data-...
1936, 816, -88}, { 1312, 880, 88}, { 1056, 272, 264}, { 896, 240, 144}, { 712, 256, 88}, { 576, 304, 144}, { 544, 376, 152}, { 704, 400, 80}, { 864, 408, 96}, { 968, 424, 40}, { 1384, 488, -72}, { 1952, 744, -176}, { 2008, 672, -208}, { 1592, 472, -272}, { 1584, ...
{ 808, 200, -40}, { 704, 296, -80}, { 688, 288, -24}, // 8 seconds { 760, 336, -88}, { 888, 320, -48}, { 1168, 408, -8}, { 1488, 576, -128}, { 1752, 472, 96}, { 1696, 480, 24}, { 1256, 400, -48}, { 1232, 296, 24}, { 1264, 240, 104}, { 1256, 216, 128}, { 976, 2...
{ 1248, 272, 176}, { 952, 312, 80}, { 848, 296, 40}, { 824, 280, 48}, { 832, 280, 88}, { 840, 336, 96}, { 744, 88, 160}, { 752, 80, 112}, { 944, 160, 128}, // 11 seconds { 1104, 8, 192}, { 1528, 104, 200}, { 1392, 312, -176}, { 1320, 296, -392}, { 1416, 376, ...
unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert(job_a); assert_ad_data("A"); // Schedule job "B": BLEAdData *ad_b = create_ad("B", NULL); GAPLEAdvertisingJobRef job_b; job_b = gap_le_advert_schedule(ad_b, advert_terms_b, sizeof(ad...
cl_assert_equal_i(s_unscheduled_cb_count, 0)
; } // Unschedule job "B", air job "A" regular_timer_fire_seconds(1); assert_ad_data("A"); cl_assert_equal_i(s_unscheduled_cb_count, 1); cl_assert_equal_p(s_unscheduled_job, job_b); cl_assert_equal_b(s_unscheduled_completed, true); // Unschedule job "A" regular_timer_fire_seconds(1); cl_assert_equ...
_get_root_layer(&data->window)); } static GPointPrecise prv_gpoint_from_polar(const GPointPrecise *center, uint32_t distance, int32_t angle) { return gpoint_from_polar_precise(center, distance << GPOINT_PRECISE_PRECISION, angle); } static void prv_graphics_draw_center...
GSize(face->bob_center_radius * 2, face->bob_center_radius * 2)
}; grect_align(&bob_rect, bounds, GAlignCenter, false /* clips */); grect_align(&bob_center_rect, bounds, GAlignCenter, false /* clips */); graphics_context_set_fill_color(ctx, face->bob_color); graphics_fill_oval(ctx, bob_rect, GOvalScaleModeFitCircle); graphics_context_set_fill_color(ctx, face->bob_cente...
le_connection_any(); // Set the name text if (data->is_showing_version) { strncpy(data->name_text_buffer, GIT_TAG, sizeof(data->name_text_buffer)); } else if (bt_driver_classic_is_connected()) { // If BT Classic connected, show the name of the connected device bt_driver_classic_copy_connected_device_...
(url_font_key)
, GColorBlack, GColorClear, GTextAlignmentCenter, GTextOverflowModeTrailingEllipsis); layer_add_child(&window->layer, &url_text_layer->layer); TextLayer* name_text_layer = &data->name_text_layer; text_layer_init_with_parameters(name_text_layer, ...
/* * 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...
(id, 5, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule)
; id = alarm_create(&(AlarmInfo) { .hour = 6, .minute = 14, .kind = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id, 6, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule); } void test_alarm__alarm_create_recurring_weekends(void) { AlarmId id; id = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kin...
/* * 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_process_callback_events_alt(false /* should_execute_callback */); }
#define assert_num_callback_events(num) \ cl_assert_equal_i(list_count((ListNode *)s_event_head), num); //////////////////////////////////////////////////////////////////////////////////////////////////// // Inbox Service Stubs void app_message_receiver_message_handler(const uint8_t *data, size_t length, ...
reaming_decode_start(&frame_decode_ctx, s_current_rx_frame, RX_MAX_FRAME_SIZE); while (true) { uint8_t timer_sequence_number; TickType_t timeout = prv_poll_timer(&timer_sequence_number); if (timeout && uxQueueMessagesWaiting(s_pulse_task_queue) == 0) { s_pulse_task_id...
if (buf == s_tx_buffer + COBS_OVERHEAD(FRAME_MAX_SEND_SIZE) + LINK_HEADER_LEN) { buf_valid = true; }
PBL_ASSERT(buf_valid, "Buffer is not from the PULSE transmit buffer pool"); } void pulse_handle_character(char c, bool *should_context_switch) { portBASE_TYPE tmp; xQueueSendToBackFromISR(s_pulse_task_queue, &c, &tmp); xSemaphoreGiveFromISR(s_pulse_task_service_semaphore, &tmp); *should_context_switch = (tm...
_t response_len = sizeof(*resp); size_t command_len = MIN(length, PULSE_MAX_SEND_SIZE - response_len); response_len += command_len; memcpy(resp->bad_command, cmd, command_len); pulse_reliable_send(resp, response_len); } static int prv_get_fresh_fd(PulseBulkIODomainHandler *domain_handler, PulseTransferFD **fd...
(resp, sizeof(*resp))
; prv_free_fd(cmd->close.fd); } static void prv_handle_read(Command *cmd, size_t length) { if (cmd->read.length == 0) { prv_respond_internal_error(cmd, length, E_INVALID_ARGUMENT); return; } PulseTransferFD *pulse_fd = prv_get_fd(cmd, length); if (!pulse_fd) { // prv_get_fd has already sent an ...
RIBUTE_HUE: ++data->hue; if (data->hue >= HUE_COUNT) { data->hue = 0; } break; case ATTRIBUTE_PIXEL_BIT: ++data->pixel_bit; if (data->pixel_bit >= PIXEL_BIT_COUNT) { data->pixel_bit = 0; } break; case ATTRIBUTE_X: if (data->intersection.x < b...
if (data->hue == HUE_BLUE) { b = 1; } else if (data->hue == HUE_WHITE) { r = 1; g = 1; b = 1; }
GColor line_color = GColorFromRGB(r * saturation, g * saturation, b * saturation); graphics_context_set_stroke_color(ctx, line_color); graphics_draw_line(ctx, GPoint(0, data->intersection.y), GPoint(bounds.size.w, data->intersection.y)); graphics_draw_li...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_get_gpoint()
, prv_get_gpoint()); } // GSize ///////////////////////// #define EX_GSIZE GSize(5, 6) static GSize prv_get_gsize(void) { return EX_GSIZE; } void test_clar__equal_gsize(void) { // test with local variable GSize a = EX_GSIZE; GSize b = EX_GSIZE; cl_assert_equal_gsize(a, b); // test with reference cl_a...
health_card_view->slide_animation); health_card_view->current_card_index = next_card_index; } //////////////////////////////////////////////////////////////////////////////////////////////////// // Callback Functions // // Up/Down click handler static void prv_up_down_click_handler(ClickRecognizerRef recognizer, ...
(&health_card_view->up_arrow_layer, &up_arrow_layer_frame)
; layer_add_child(window_root, &health_card_view->up_arrow_layer); content_indicator_init(&health_card_view->up_indicator); prv_refresh_content_indicators(health_card_view); return health_card_view; } void health_card_view_destroy(HealthCardView *health_card_view) { // destroy cards health_activity_summa...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_encode_char(((data[i] & 0x03) << 4) | (data[i + 1] >> 4))
AS_GBITMAP_FORMAT PBL_IF_COLOR_ELSE(GBitmapFormat8Bit, GBITMAP_NATIVE_FORMAT) // Overrides same function in graphics.c; we need to do this so we can pass in the GBitmapFormat // we need to use for the unit test output canvas instead of relying on GBITMAP_NATIVE_FORMAT, which // wouldn't work for Spalding since it uses...
(dialog, GColorWhite)
; dialog_set_text(dialog, "Ping"); prv_push_and_render_simple_dialog(dialog); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_simple_dialog__alarm_snooze(void) { SimpleDialog *simple_dialog = simple_dialog_create("Alarm Snooze"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); ...
/* * 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...
click_number_of_clicks_counted(recognizer)
; sniprintf(data->text_buffer, TEXT_BUFFER_SIZE, "Single Click! (%u)", count); PBL_LOG(LOG_LEVEL_DEBUG, "Single Click! (%u)", click_number_of_clicks_counted(recognizer)); text_layer_set_text(&data->text, data->text_buffer); toggle_color(window); // Let's try shortening the repeat interval as we go: ClickCo...
}; memset(dest_data, GColorBlue.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_assign-expect.8bit.pbi")); memset(dest_data, GColorBlue.argb, sizeof(dest_data)); bitblt_bit...
(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorLightGray)
; cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_comptint_white_cross_lightgray_corners-expect.8bit.pbi")); // Destination Black memset(dest_data, GColorBlack.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorWhite); cl_check(gbitm...
may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIE...
layer_mark_dirty(simple_menu_layer_get_layer(s_app_data->menu_layer))
al_i(s_path_stroke_count, 0); cl_assert_equal_i(s_path_fill_count, 0); cl_assert_equal_i(s_circle_stroke_count, 0); cl_assert_equal_i(s_circle_fill_count, 0); free(command_list); } void test_gdraw_command__validate_list(void) { GDrawCommandList *command_list = prv_create_command_list_3(); size_t size = si...
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(image); } void test_gdraw_command__draw_frame(void) { GDrawCommandFrame *frame = malloc(sizeof(GDrawCommandFrame) + sizeof(GDrawCommand) + (sizeof(GPoint) * 2)); GDrawCommandList *command_list = &frame->command_list; *com...
expected"); _Static_assert(sizeof(ptrdiff_t) <= 4, "ptrdiff_t larger than expected"); #endif // ------------------------------------------------------------------------------------------- // If we should use a default log message (because stack space is too limited to use sprintf) // then copy it into 'msg' and retu...
pebble_task_get_current()
; if (task == PebbleTask_App || task == PebbleTask_Worker) { state->in_progress = false; } else { kernel_applib_release_log_state(state); } } static void prv_log_internal(bool async, uint8_t log_level, const char* src_filename, int src_line_number, const char* fmt, va_list args)...
/* * 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...
expandable_dialog_push(ex_dialog, modal_manager_get_window_stack(ModalPriorityGeneric))
GPointPreciseFromGPoint(point)
; } } collect->iter.current_index += num_copied; collect->iter.bytes_left -= bytes_copied; return true; } GPoint *gdraw_command_list_collect_points(GDrawCommandList *command_list, bool is_precise, uint16_t *num_points_out) { const uint16_t num_points = gdraw_command_list_get_num_points(command_lis...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_health_detail_card__render_one_heading(void) { HealthDetailCardConfig config = { .num_headings = 1, .headings = &(HealthDetailHeading) { .primary_label = "LABEL1", .primary_value = "value1", .fill_color = GColorWhite, #if PBL_BW .outline_color = GColorBlack, #endif ...
cl_assert_equal_m(expectbuf, destbuf, 8)
; } void test_strcpy__weird(void) { char testbuf[8] = "He\0llo!"; char destbuf[8] = "AAAAAAAA"; char expectbuf[8] = "He\0AAAAA"; strcpy(destbuf, testbuf); cl_assert_equal_m(expectbuf, destbuf, 8); } void test_strcpy__return(void) { char testbuf[8] = "Hello!"; char destbuf[8] = "AAAAAAAA"; cl_assert_eq...
, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 3); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 3); graphics_draw_rect(&ctx,...
(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 2)
; graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw2_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 2); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq...
n_string = "30:00", .distance_string = "5.0", .pace_string = "6:00", }; WorkoutMetricType top_metric = WorkoutMetricType_Duration; WorkoutMetricType middle_metric = WorkoutMetricType_Distance; WorkoutMetricType scrollable_metrics[] = {WorkoutMetricType_Pace, ...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); }
GAPLEClientKernel, false /* is_response_required */); } static void prv_assert_sent_reset_complete(BLECharacteristic characteristic) { struct PACKED { PPoGATTPacketType type:3; uint8_t sn:PPOGATT_SN_BITS; PPoGATTResetCompleteClientIDPayloadV1 payload; } expected_response = { .sn = 0, .typ...
(&s_meta_v0_system.app_uuid)
, true); ppogatt_handle_read_or_notification(s_characteristics[1][PPoGATTCharacteristicMeta], (const uint8_t *) &s_meta_v0_app, sizeof(s_meta_v0_app), BLEGATTErrorSuccess); cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_app.app_u...
g.h> #include <stdlib.h> #include "drivers/flash.h" #include "flash_region/flash_region.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/filesystem/flash_translation.h" #include "system/logging.h" #include "system/passert.h" #include "util/math.h" #include "util/size.h" #include "clar.h" #inc...
(pfs_close(fd), S_SUCCESS)
; } } void test_pfs__garbage_collection_when_full(void) { char file_name[10]; int num = 0; int fd; while (1) { snprintf(file_name, sizeof(file_name), "file%d", num++); fd = pfs_open(file_name, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(file_name)); cl_assert((fd >= 0) || (fd == E_OUT_OF_STORAGE)); ...
d) { return; } // Demands the underlying activity algorithms to clean up their act(ivity sessions) and save off // any new data they have (only to RAM...persisted to flash a few lines later). activity_algorithm_early_deinit(); // Update storage before we close down s_activity_state.update_settings_cou...
prv_start_tracking_cb(NULL)
; } } else { // We just got disabled. Turn off activity tracking if necessary and set should_be_started // so that it gets restarted again once we get re-enabled. if (s_activity_state.started) { prv_stop_tracking_cb(NULL); // We want to turn tracking on again once we get re-...
les. static uint32_t prv_get_total_file_system_bytes(void) { uint32_t size = 0; dls_list_for_each_session(prv_accumulate_size_cb, &size); PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Total used space: %d", (int)size); return size; } // ------------------------------------------------------------------...
(session->storage.fd)
; if (status != S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Error %d closing file for session %d", (int)status, session->comm.session_id); } session->storage.fd = DLS_INVALID_FILE; } // ----------------------------------------------------------------------------------------- // Open the session file,...
g_put_bytes_receiver_impl.write(r, data, length); g_put_bytes_receiver_impl.finish(r); } else { PBL_LOG(LOG_LEVEL_ERROR, "No receiver returned!"); } } static void prv_receive_init(uint32_t total_size, PutBytesObjectType object_type) { InitRequest init_msg = (InitRequest) { .cmd = CmdInit, .t...
prv_receive_commit(s_last_response_cookie, EXPECTED_CRC)
; prv_process_and_reset_test_counters(); } static void prv_receive_init_put_commit_and_install(PutBytesObjectType object_type) { prv_receive_init(VALID_OBJECT_SIZE, object_type); prv_process_and_reset_test_counters(); const uint8_t chunk[] = { 0xaa, 0xbb, 0xcc, 0xdd }; prv_receive_put(s_last_response_cookie...
ZRxzINDITxaThvFIpOrzYfgPVmqbbYoCZKkKkbgyvP1UaCEstr9WjptLszgMocgGSEsqmoipqqWdk7dq" \ "FXKAfWwOueL4jLJfZRxzINDITxaThvFIpOrzYfgPVmqbbYoCZKkKkbgyvP1UaCEstr9WjptLszgMocgGSEsqmoipqqWdk7dq", }, { .key = "friday_steps", .val = "uxFhoWTzJxDOmyBX2g3n7wdoPKxeleBR7iwKGn7utn8qTEj0tB7aw65EEFZ5QldgAkg6lct...
strlen(key)
, (uint8_t *)s_movement_data, sizeof(s_movement_data)), S_SUCCESS); cl_assert_equal_i(s_metric_updated_count, NUM_CURRENT_MOVEMENT_METRICS); s_metric_updated_count = 0; key = "monday_movementData"; cl_assert_equal_i(health_db_insert((uint8_t *)key, strl...
ion->values)); property_animation->animation.implementation = (AnimationLegacy2Implementation*) implementation; property_animation->subject = subject; // NOTE: we are also comparing against the 3.0 animation update handlers so that modules // like scroll_layer and menu_layer c...
{ property_animation_legacy2_init_layer_frame(property_animation, layer, from_frame, to_frame); }
return property_animation; }
/* * 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...
{ switch (type) { case ProtobufLogActivityType_UnknownType: return ActivitySessionType_None; case ProtobufLogActivityType_Sleep: return ActivitySessionType_Sleep; case ProtobufLogActivityType_DeepSleep: return ActivitySessionType_RestfulSleep; case ProtobufLogActivityType_Nap: ...
// ----------------------------------------------------------------------------------------- // Convert ActivitySessionType to the internal protobuf representation. static ProtobufLogActivityType prv_activity_type_to_proto_type(ActivitySessionType type) { switch (type) { case ActivitySessionType_None: ret...
/* * 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 uint16_t region_count = data->region_count = timezone_database_get_region_count(); char * const region_names_buffer = app_zalloc_check(region_count * TIMEZONE_NAME_LENGTH); char *cursor = region_names_buffer; char *last_cursor = cursor; const char **continent_names = app_zalloc_check(NUM_CONTINENTS * ...
// Set the starting region ID for the new continent. data->continent_start[++continent_index] = i; } // Save the last continent name continent_names[continent_index] = last_cursor; data->region_names_buffer = region_names_buffer; data->region_names = region_names; data->continent_names = continent...
animation_unschedule(Animation *animation_h) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); if (animation_private_using_legacy_2(state)) { // 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....
prv_find_animation_by_handle(NULL, animation_h, false /*quiet*/)
; if (!animation) { return (AnimationHandlers) {0}; } return animation->handlers; } // ------------------------------------------------------------------------------------------- bool animation_set_implementation(Animation *animation_h, const AnimationImplementation *imple...
orDisconnected, 1); app_free(outbox_data); } void test_app_message_sender__app_session_but_js_app(void) { s_process_md.allow_js = true; AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbox_message(s_app_session_ptr, ALLOWED_ENDPOINT_ID, TEST_PAYLOAD, si...
{ // Test the `length` implementation: cl_assert_equal_i(length - i, comm_session_send_queue_get_length(s_app_session_ptr)); // Test the `read_pointer` implementation: const uint8_t *read_pointer = NULL; size_t length_available = comm_session_send_queue_get_read_pointer(s_app_session_ptr, ...
assert_consumed(AppMessageSenderErrorSuccess, 1); cl_assert_equal_i(s_app_install_timestamp_update_count, 1); app_free(outbox_data); } void test_app_message_sender__byte_by_byte_copy_with_offset(void) { AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbox_message(NULL /* auto-select */, AL...
vel, uint64_t timestamp_ms, PebbleTask task, const char *src_filename, uint16_t src_line_number, const char *message) { prv_serialize_log_header(contents, log_level, timestamp_ms, task, src_filename, src_line_number); // Wr...
circular_buffer_write(&s_isr_log_buffer, &log_info, sizeof(log_info))
; circular_buffer_write(&s_isr_log_buffer, message, message_length); } if (buffer_was_empty) { PebbleEvent e = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_event_cb } }; event_put_isr(&e); } portEXIT_CRITICAL(); } void pulse_logging_init(void) { ...
---------- static AppInstallId prv_get_app_exit_reason_destination_install_id_override(void) { switch (s_app_task_context.exit_reason) { case APP_EXIT_NOT_SPECIFIED: return INSTALL_ID_INVALID; case APP_EXIT_ACTION_PERFORMED_SUCCESSFULLY: PBL_LOG(LOG_LEVEL_INFO, "Next app overridden w...
if (sdk_platform == PBL_PLATFORM_TYPE_CURRENT) { *size = GSize(DISP_COLS, DISP_ROWS); return; }
ds.origin.y = SINGLE_LINE_BOUND_OFFSET; } else { s_phone_ui_data->caller_id_text_layer.layer.bounds.origin.y = DOUBLE_LINE_BOUND_OFFSET; } s_phone_ui_data->caller_id_text_layer.layer.bounds.size.h = lines * fonts_get_font_height(caller_id_font); text_layer_set_text(&s_phone_ui_data->caller_id_text_lay...
animation_schedule(animation)
routine call return address", stacked_lr); PBL_LOG_FROM_FAULT_HANDLER_FMT( buffer, 80, "PC [R15] = 0x%x program counter", stacked_pc); PBL_LOG_FROM_FAULT_HANDLER_FMT(buffer, 80, "PSR = 0x%x", stacked_psr); //BREAKPOINT; // NOTE: If you want to get a stack trace at this point. Set a breakpoint here (you...
( buffer, 80, " Forced = %s", bool_to_str(SCB->HFSR & SCB_HFSR_FORCED_Msk))
; fault_handler_dump(buffer, hardfault_args); reset_due_to_software_failure(); } void HardFault_Handler(void) { // Grab the stack pointer, shove it into a register and call // the c function above. __asm("tst lr, #4\n" "ite eq\n" "mrseq r0, msp\n" "mrsne r0, psp\n" "b %0\n" ...
ful"); prv_file_set(&IS_UNFAITHFUL_KEY, sizeof(IS_UNFAITHFUL_KEY), &is_unfaithful, sizeof(is_unfaithful)); } bool bt_persistent_storage_get_root_key(SMRootKeyType key_type, SM128BitKey *key_out) { SM128BitKey keys[SMRootKeyTypeNum]; int read_size = prv_file_get(&ROOT_KEYS_KEY, sizeof(ROOT_KEYS_KEY...
(&s_cached_system_capabilities)
; } static void prv_delete_all_pairings_itr(SettingsFile *old_file, SettingsFile *new_file, SettingsRecordInfo *info, void *context) { if (info->key_len == sizeof(BTBondingID)) { // Skip pairing entries return; } // Re-write non-pairing entries void *key = kerne...
/* * 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...
{ // Show at most once per app launch AppInstallId app_id = app_manager_get_current_app_id(); if (app_id == s_last_app_id) { return; } s_last_app_id = app_id; /// Health disabled dialog static const char *msg = i18n_noop("This app requires Pebble Health to work. Enable Health in the Pebble" ...
// --------------------------------------------------------------------------- void health_tracking_ui_feature_show_disabled(void) { /// Feature requires health dialog static const char *msg = i18n_noop("This feature requires Pebble Health to work. Enable Health in the Pebble" " mobile app 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...
cl_assert(blob_db_get_dirty_list(BlobDBIdTest) == NULL)
; // insert one char *key = "key"; char *value = "value"; cl_assert_equal_i(S_SUCCESS, blob_db_insert(BlobDBIdTest, (uint8_t *)key, strlen(key), (uint8_t *)value, ...
y_value_t argv[], RockyArgValueCheckError *value_error_out) { if (rocky_api_graphics_color_from_value(argv[0], (GColor *)binding->ptr)) { return true; } *value_error_out = (RockyArgValueCheckError) { .error_msg = COLOR_ERROR_MSG, .arg_offset = 0, }; return...
jerry_create_undefined()
; }
ound_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerTopLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_topleft.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &...
GSize(0, 0)
, GCornerNone, 0), 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornerNone, 2), 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornersAll, 0), 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornersAll, 8), 0); cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 5), GCorne...
ent to handle GATT notification from characteristic %p", (void*) header.characteristic); } kernel_free(buffer); header.value_length = next_value_length; } } static void prv_handle_gatt_event(const PebbleBLEGATTClientEvent *event) { if (event->subtype == PebbleBLEGATTClientEventTypeBufferE...
{ switch (e->type) { case PEBBLE_BLE_SCAN_EVENT: PBL_LOG(LOG_LEVEL_DEBUG, "PEBBLE_BLE_SCAN_EVENT"); return; case PEBBLE_BLE_CONNECTION_EVENT: prv_handle_connection_event(&e->bluetooth.le.connection); return; case PEBBLE_BLE_GATT_CLIENT_EVENT: if (e->bluetooth.le.gatt_client...
// ------------------------------------------------------------------------------------------------- static void prv_connect_gateway_bonding(BTBondingID gateway_bonding) { gap_le_slave_reconnect_start(); gap_le_connect_connect_by_bonding(gateway_bonding, true /* auto_reconnect */, ...
andlers s_play_anim_handlers = { .stopped = prv_play_anim_stopped, }; ////////////////////////////////// // API ////////////////////////////////// void kino_player_set_callbacks(KinoPlayer *player, KinoPlayerCallbacks callbacks, void *context) { player->callbacks = callbacks; player->context = context; } void ...
(player, NULL, false)
_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); 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); cl_assert_equal_i(pr...
(start_ms + 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, NULL), 0); // Execute to the start of B and C prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_...
line_buf), state->common.file); if (!line) { // EOF break; } //printf("\nGot line: %s", line); // Find first token char *token = strtok(line, " \t\n"); if (!token) { continue; } // If this is a pre-processor directive, skip it if (token[0] == '#') { continue...
strlen(token)
+ 1, "%d", &state->test_entry.in_deep_sleep.max); } else if (strcmp(token, "TEST_FORCE_SHUT_DOWN_AT") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.force_shut_down_at); } else if (strcmp(token, "TEST_WEIGHT") == 0) { sscanf(token + strlen(token) + 1, "%f", &state->tes...
d, TimelineIterDirectionFuture, 1421178000), 0); cl_assert_equal_i(prv_num_items(iterator), 6); // Thursday Jan 16 00:00:00 PST 2015 // No items within window rtc_set_time(1421395200); head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirect...
(iter_next(&iterator))
; cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id)); // check fifth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); // check sixth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].header.id)); /...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ base = 8; nptr++; }
else if (base == 0) { base = 10; } // We break on '\0' anyways for (;;) { char ch = *nptr; if (ch >= '0' && ch <= '9') { ch = ch - '0'; } else if (ch >= 'A' && ch <= 'Z') { ch = ch - 'A' + 10; } else if (ch >= 'a' && ch <= 'z') { ch = ch - 'a' + 10; } else { // This will...
perty animations Animation *a = prv_create_test_animation(); const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler_check_finished }; animation_set_handlers(a, handlers, animation_get_context(a)); animation_set_duration(a, duration_a); prv_clear_handler...
(&s_started_handler_calls, b)
/* * 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...
(conn_idx, &conn_rssi)
/* * 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...
bt_unlock()
; return success; } // ----------------------------------------------------------------------------- bool gap_le_stop_scan(void) { bool success = false; bt_lock(); { if (s_is_scanning) { success = bt_driver_stop_le_scan(); kernel_free(s_reports_buffer); s_reports_buffer = NULL; s_i...
{ -1248, 208, -208}, { -1112, 240, -192}, { -1072, 184, -152}, { -1032, 120, -128}, { -968, 104, -104}, // 10 seconds { -1064, 152, -136}, { -1112, 64, -128}, { -944, -96, -152}, { -1088, 96, -336}, { -1512, 272, -456}, { -1208, 192, -592}, { -1032, -24, -400}, { ...
{ -1168, 136, -352}, { -1080, 256, -512}, { -920, 176, -480}, { -1064, -40, -344}, { -1216, -64, -224}, { -1168, 96, -176}, { -1016, 272, -96}, { -888, 384, -136}, { -896, 416, -136}, { -928, 464, -184}, { -904, 576, -320}, { -992, 1056, -424}, { -952, 816, -264}, ...
ries 2222, // Resting K Calories 3333, // Distance 4444, // Active Time }; typedef enum SleepDataFields { SD_Version, SD_Timestamp, SD_SleepDuration, SD_DeepSleepDuration, SD_FallAsleepTime, SD_WakeupTime, SD_TypicalSleepDuration, SD_TypicalDeepSleepDuration, SD_TypicalF...
(ActivityMetricStepCount, Monday, &val_out)
); cl_assert(!health_db_get_typical_value(ActivityMetricActiveSeconds, Monday, &val_out)); cl_assert(!health_db_get_typical_value(ActivityMetricRestingKCalories, Monday, &val_out)); cl_assert(!health_db_get_typical_value(ActivityMetricActiveKCalories, Monday, &val_out)); cl_assert(!health_db_get_typical_val...
weak pull-down to put it in a known state // when SCS is toggled gpio_cfg.GPIO_PuPd = GPIO_PuPd_DOWN; gpio_cfg.GPIO_Pin = FLASH_PIN_SCLK; GPIO_Init(FLASH_GPIO, &gpio_cfg); // Configure SCS to be controlled in software; pull up to high when inactive gpio_cfg.GPIO_Mode = GPIO_Mode_OUT; gpio_cfg.GPIO_Pin = ...
flash_end_cmd()
; disable_flash_spi_clock(); flash_unlock(); return ((manufacturer << 16) | (type << 8) | capacity); } bool check_whoami(uint32_t spi_flash_id) { return spi_flash_id == EXPECTED_SPI_FLASH_ID_32MBIT || spi_flash_id == EXPECTED_SPI_FLASH_ID_64MBIT; } bool flash_is_whoami_correct(void) { uint32_t spi_fla...
regular_timer_fire_seconds(1); assert_ad_data("D"); } // "D" should be done now, so expect only infinite jobs to get air-time again: for (int i = 0; i < 10; ++i) { regular_timer_fire_seconds(1); assert_ad_data("E"); regular_timer_fire_seconds(1); assert_ad_data("A"); regular_timer_fi...
create_ad("B", NULL)
; GAPLEAdvertisingJobRef job_b; job_b = gap_le_advert_schedule(ad_b, advert_terms_b, sizeof(advert_terms_b)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); // Even though B is newer, expect "A" to be scheduled sti...
olvingKey) { .data = { 0x33, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x08, 0x39, 0x02, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x20 }, }, .identity = (BTDeviceInternal) { .address = (BTDeviceAddress) { .octets = { 0x33, 0x22, 0x13, 0x14, 0x1...
(id != BT_BONDING_ID_INVALID)
e LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * dis...
is_remote_connected(other)
) { return is_remote_connected(remote) ? -1 : 1; } else { return strncmp(remote->name, other->name, sizeof(remote->name)); } } static void add_remote(SettingsBluetoothData* data, StoredRemote* remote) { const bool ascending = false; data->remote_list_head = list_sorted_add(data->remote_list_head, &remo...
* * 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 in...
cl_assert(gbitmap_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 = setup_png_test(TEST_PNG_FILE_FMT(4bitpalette)); cl_ass...
/* * 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 NULL; }
#endif void analytics_external_update(void) { } bool shell_prefs_get_stationary_enabled(void) { return false; } bool shell_prefs_get_language_english(void) { return true; } void shell_prefs_set_language_english(bool english) { } void shell_prefs_toggle_language_english(void) { } void language_ui_display_change...
hConnectionEventStateConnected; } else { event.bluetooth.connection.state = PebbleBluetoothConnectionEventStateDisconnected; } event_put(&event); } // ------------------------------------------------------------------------------------------------- static void prv_put_connection_event(PebbleTaskBitset task_...
if (client->is_pairing_required && event == GAPLEConnectionEventConnectedNotEncrypted) { // If is_pairing_required is true, "connected & not encrypted" is an // in-between state that should not be reported to the client. continue; }
// The new state needs to be communicated with this client. task_mask &= ~gap_le_pebble_task_bit_for_client(c); // Update the local state for the client. An event is sent shortly after. intent->client[c].connected = connected; } } if (task_mask != task_mask_none) { // Send event 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...
(&result->command_list, 2)
->points, c2_points) COPY_POINTS(gdraw_command_list_get_command(&result->command_list, 3)->points, c3_points) COPY_POINTS(gdraw_command_list_get_command(&result->command_list, 4)->points, c4_points) return result; } GDrawCommandImage *weather_app_resource_create_sun(void) { GPoint c0_points[] = {{47, 23}, {5, ...
} } #endif #endif static GAPLEConnection *prv_get_le_connection_and_print_info(void) { GAPLEConnection *conn = gap_le_connection_any(); if (!conn) { prompt_send_response("No device connected"); } else { char buf[80]; prompt_send_response_fmt(buf, sizeof(buf), "Connected to " BT_DEVICE_ADDRESS_FMT, ...
{ bt_driver_le_test_end(); }
//# if PLATFORM_ROBERT static const char *s_btle_pa_config_strings[3] = { "disable", "enable", "bypass" }; void command_btle_pa_set(char *command) { char buffer[64]; int index; for (index = 0; index < BtlePaConfigCount; ++index) { if (strcmp(command, s_btle_pa_config_strings[index]) == 0) { break; ...
/* * 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 (pebble_task_get_current() == PebbleTask_Worker) { // not allowed from workers syscall_failed(); }
if (!memory_layout_is_cstring_in_region(memory_layout_get_app_region(), string, 100) && !memory_layout_is_cstring_in_region(memory_layout_get_microflash_region(), string, 100)) { PBL_LOG(LOG_LEVEL_ERROR, "Pointer %p not in app or microflash region", string); syscall_failed(); } } retur...
layer->callback_context); } void prv_center_focus_animation_update_impl(Animation *animation, bool second_half, AnimationProgress adjusted_progress) { CenterFocusSelectionAnimationState state = prv_center_focus_animation_state(an...
(menu_layer, up, selection_animated, true /* change_ongoing_animation */)
; prv_menu_layer_update_selection_scroll_position(menu_layer, MenuRowAlignNone, selection_animated); static const PropertyAnimationImplementation s_center_focus_selection_animation_in_out_impl = { .base = { .setup = prv_center_focus_animation_setup, .update = prv_center_focus_animation_update_in_an...
/* * 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...
(confirmation_dialog)
; bool selection_confirmed = (click_recognizer_get_button_id(recognizer) == BUTTON_ID_UP); if (selection_confirmed) { if (!app_cache_entry_exists(args->new_worker_id)) { // If an app cache entry does not exist for the new worker, then we will have to // fetch the application. Since this will promp...
--------------------------------------------------------------------------------- // Test that we correctly calculate the statistics (# days of history, median, etc) void test_activity_insights__calculate_metric_history_stats(void) { // Construct history static const int32_t complete_history[ACTIVITY_HISTORY_DAYS] ...
s_data.metric_history[ActivityMetricSleepStateSeconds][0] = 2 * SECONDS_PER_HOUR; activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); // Advance the clock some and make sure we still don't get notifications for (int i = 0;...
// cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 2); // // // Fall back asleep, make sure we get the reward // s_data.metric_history[ActivityMetricSleepState][0] = ActivitySleepStateLightSleep; // activity_insights_process_sleep_data(rtc_get_time()); // s_data.metric_history[Act...
/* * 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...
(0x55aaff)
); graphics_fill_rect(&ctx, &ctx.dest_bitmap.bounds); GDrawCommandImage *img = weather_app_resource_create_sun(); gdraw_command_image_attract_to_square(img, t); gdraw_command_image_draw(&ctx, img, GPoint(48, 96)); char fn[20]; snprintf(fn, sizeof(fn), "tos_%06d.png", t); tests_write_gbitmap_...
, 448}, { -680, 528, 456}, // 174 seconds { -680, 528, 448}, { -688, 536, 456}, { -688, 512, 456}, { -680, 536, 456}, { -680, 536, 456}, { -672, 528, 432}, { -696, 520, 480}, { -672, 528, 464}, { -688, 528, 448}, { -680, 528, 464}, { -696, 528, 472}, { -688, 512, ...
{ -768, 360, 480}, { -776, 376, 480}, { -776, 376, 480}, { -768, 376, 488}, { -776, 376, 488}, { -776, 376, 480}, { -776, 376, 488}, { -768, 368, 488}, { -768, 384, 496}, { -768, 376, 488}, { -760, 368, 496}, { -760, 368, 504}, { -768, 376, 504}, // 180 seconds ...
{ -752, 392, 496}, { -752, 392, 504}, { -744, 392, 496}, { -752, 384, 512}, { -752, 384, 504}, { -752, 384, 504}, { -760, 392, 504}, { -744, 384, 504}, { -752, 392, 496}, { -752, 384, 496}, { -752, 392, 496}, { -752, 392, 504}, { -752, 392, 512}, { -752, 400, 488...
o_int16(anim, &to); animation_set_duration((Animation *) anim, duration); animation_set_curve((Animation *) anim, AnimationCurveEaseInOut); return anim; } static const PropertyAnimationImplementation s_animated_dot_impl = { .base = { .update = (AnimationUpdateImplementation) property_animation_upd...
kino_reel_transform_set_to_frame(reel, from)
; } kino_reel_unfold_set_start_as_dot(reel, data->mic_window.mic_dot_radius); kino_layer_play(&data->mic_window.icon_layer); } } static void prv_hide_unfold_animation(VoiceUiData *data) { kino_layer_pause(&data->mic_window.icon_layer); layer_set_hidden((Layer *) &data->mic_window.icon_layer, true); }...
ic void prv_analytics_track_i2c_error(void); /*----------------SEMAPHORE/LOCKING FUNCTIONS--------------------------*/ static bool prv_semaphore_take(I2CBusState *bus) { return (xSemaphoreTake(bus->event_semaphore, 0) == pdPASS); } static bool prv_semaphore_wait(I2CBusState *bus) { TickType_t timeout_ticks = mil...
(bus, true)
zalloc(str_size); if (!data_buffer) { return prv_create_oom_error(); } jerry_string_to_utf8_char_buffer(json_string, (jerry_char_t *)data_buffer, str_size); OutgoingObject * const obj = task_zalloc(sizeof(*obj)); if (!obj) { task_free(data_buffer); return prv_create_oom_error(); } *obj = (Out...
(ROCKY_EVENT_MESSAGE, event_name)
== 0 || strcmp(ROCKY_EVENT_ERROR, event_name) == 0) { return true; } return prv_handle_callback_registration(event_name, handler); } const RockyGlobalAPI APP_MESSAGE_APIS = { .init = prv_init_apis, .deinit = prv_deinit_apis, .add_handler = prv_add_handler, }; /////////////////////////////////////////...
limitations under the License. */ #include "progress_ui_app.h" #include "applib/app.h" #include "applib/app_timer.h" #include "applib/graphics/gpath_builder.h" #include "applib/graphics/graphics.h" #include "util/trig.h" #include "applib/ui/dialogs/dialog.h" #include "applib/ui/dialogs/simple_dialog.h" #include "app...
if (firmware_update_current_status() == FirmwareUpdateStopped) { prv_handle_finished(data, true /* success */); return; }
data->percent_complete = firmware_update_get_percent_progress(); break; } } prv_update_progress_text(data); progress_layer_set_progress(&data->progress_layer, PROG_LAYER_TRANSFORM(data->percent_complete)); if ((data->progress_source != PROGRESS_UI_SOURCE_FW_UPDA...
st_axis(BMA255Axis axis) { uint8_t axis_bits; switch (axis) { case BMA255Axis_X: axis_bits = 0x01; break; case BMA255Axis_Y: axis_bits = 0x02; break; case BMA255Axis_Z: axis_bits = 0x03; break; default: WTF; } // g-range should be 4g for self-test bm...
prompt_send_response_fmt(buf, 64, "(0x12) Low_Power: 0x%"PRIx8, lp)
; prompt_send_response_fmt(buf, 64, " lowpower_mode: 0x%"PRIx8, (lp & (1 << 6)) != 0); prompt_send_response_fmt(buf, 64, " sleeptimer_mode: 0x%"PRIx8, (lp & (1 << 5)) != 0); prompt_send_response_fmt(buf, 64, "(0x30) FIFO Config 0: 0x%"PRIx8, fifo_cfg0); prompt_send_response_fmt(buf, 64, " Watermark: 0x%"PRI...
.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "system/passert.h" #include <string.h> #include <stdio.h> typedef struct AnimatedDemoData { Window window; TextLayer text_layer; PropertyAnimation *prop_animation; bool toggle; } AnimatedDemoData; st...
(window, WINDOW_NAME("Animated Demo"))
ert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 3); cl_assert_equal_i(prv_count_handler_entries(&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_ass...
(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); // A should end up at max // A should end high distance = prv_last_update_distance(a); cl_assert_equal_i(distance, ANIMATION_NORMALIZED_MAX); // B ...
(num_pages()*128)); printf("%d\n", pfs_get_size() - 1024); cl_assert(fd >= 0); cl_assert(pfs_close(fd) == S_SUCCESS); cl_assert(pfs_remove(name) == S_SUCCESS); } void test_pfs__active_regions(void) { pfs_format(false); cl_assert(!pfs_active_in_region(0, pfs_get_size())); // erase every page and make s...
{ for (int i = 0; i < num_pages(); i++) { snprintf(file_small, sizeof(file_small), "file%d", i); snprintf(buf, sizeof(buf), "This is small buf %d!", i); int len = strlen(buf); int fd = pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, len); cl_assert(fd >= 0); cl_assert(pfs_w...
ter, -1, -5); cl_assert_fixedS16_3(radius, 0); // 2 pixel width means: center is 1px from side, 0.5 pixels to center of outer pixels r = GRect(-1, -5, 2, 2); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, -0.5, -4.5); cl_assert_fixedS16_3(radius, 0.5); } void test_gr...
(s_angle_end, TRIG_MAX_ANGLE)
/* * 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...
action_bar_layer_deinit(&data->action_bar)
; gbitmap_deinit(&data->check_icon); gbitmap_deinit(&data->x_icon); kernel_free(data); } static WindowStack *prv_get_window_stack(void) { return modal_manager_get_window_stack(ModalPriorityAlert); } static void prv_worker_crash_button_up_handler(ClickRecognizerRef recognizer, void *context) { WorkerCrashDia...
which // causes the processor to skip some instructions upon wake from STOP // in certain sitations. See the STM32F20x and STM32F21x Errata sheet // section 2.1.3 "Debugging Stop mode with WFE entry", or the erratum // of the same name in section 2.1.2 of the STM32F42x and STM32F43x // Errata sheet, for (mis...
portEXIT_CRITICAL()
; analytics_set(metric, ticks_to_milliseconds(ticks), AnalyticsClient_System); } void analytics_external_collect_stop_inhibitor_stats(RtcTicks now_ticks) { prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_MAIN_TIME, InhibitorMain, now_ticks); // We don't care about the serial console nostop time, it should always ...
s_precise_lines = NULL; } } // tests void test_gdraw_command__draw_command_stroke(void) { GDrawCommand *command = malloc(sizeof(GDrawCommand) + (sizeof(GPoint) * 2)); *command = (GDrawCommand){ .type = GDrawCommandTypePath, .hidden = false, .stroke_color = GColorRed, .stroke_width = 1, ...
(s_stroke_color.argb, GColorPurpleARGB8)
; cl_assert_equal_i(s_fill_color.argb, GColorGreenARGB8); cl_assert_equal_i(s_stroke_width, 2); cl_assert_equal_i(s_path_num_points, 2); cl_assert_equal_b(s_path_open, false); cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert(prv_compare_points(points2, s_stroke...
pb1_periphs, ENABLE); RCC_APB1PeriphResetCmd(apb1_periphs, DISABLE); RCC_APB2PeriphResetCmd(apb2_periphs, ENABLE); RCC_APB2PeriphResetCmd(apb2_periphs, DISABLE); } static void __attribute__((noreturn)) prv_jump_to_fw(void) { void *initial_stack_pointer, *reset_handler; prv_get_fw_reset_vector(&reset_handler,...
(BOOT_BIT_FW_START_FAIL_STRIKE_TWO)
; return true; } else if (boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_ONE)) { dbgserial_putstr("Failed to start firmware, strike two."); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); } else { dbgserial_putstr("Failed to start firmware, strike one."); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE...
{ 1040, -56, -48}, { 968, 16, -72}, { 904, 32, -104}, { 912, 24, -136}, { 1016, -8, -160}, { 1056, -40, -216}, // 77 seconds { 1048, -64, -240}, { 1080, -48, -304}, { 1144, -24, -360}, { 1160, -40, -336}, { 1320, -88, -272}, { 1648, -56, -312}, { 1256, -72, -152}, ...
{ 1464, -176, -200}, { 1464, -128, -200}, { 1072, -96, -312}, { 632, -96, -392}, { 672, -128, -256}, { 1056, -112, -136}, { 1072, -128, -120}, { 1040, -88, -152}, { 976, -72, -144}, { 872, -88, -152}, { 880, -80, -176}, { 944, -96, -192}, { 992, -112, -208}, { 100...
// 85 seconds { 1064, 152, 96}, { 1080, 88, 104}, { 1112, 24, 72}, { 1120, 8, 24}, { 1040, -32, 56}, { 1384, -80, 128}, { 1504, -16, 72}, { 1176, 8, -56}, { 856, -48, -128}, { 824, -208, 48}, { 1200, -200, 136}, { 1312, -136, 120}, { 1112, -112, 24}, { 1000, ...
RIC_ELEMENT_TYPE_INT32: return *(int32_t*)location; } WTF; // Should not get here! } ////////// // Set void analytics_heartbeat_set(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric, int64_t val) { uint8_t *location = prv_heartbeat_get_location(heartbeat, metric); prv_location_set_value(location, val, ...
(LOG_LEVEL_DEBUG, "%3" PRIu32 ": %s: %" PRIu32 " (0x%" PRIx32")", analytics_metric_offset(metric), name, (uint32_t)val, (uint32_t)val)
o app: cl_assert_equal_i(event.task_mask, (PebbleTaskBitset) ~(client_tasks)); const PebbleBLEConnectionEvent *conn_event = &event.bluetooth.le.connection; const BTDeviceInternal event_device = PebbleEventToBTDeviceInternal(conn_event); const bool is_same_device = bt_device_equal(&event_device.opaque, ...
(BT_BONDING_ID_INVALID, GAPLEClientApp)
; cl_assert_equal_i(e, BTErrnoInvalidParameter); } void test_gap_le_connect__unregister_non_existing_bonding(void) { BTErrno e = gap_le_connect_cancel_by_bonding(~0, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoInvalidParameter); } void test_gap_le_connect__register_is_already_registered_for_same_client(void) {...
/* * 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...
boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)
; } // Skip safe teardown if doing so the first time already caused a second reset attempt; or // if we're in a critical section, interrupt or if the scheduler has been suspended if (!already_failed && !mcu_state_is_isr() && !portIN_CRITICAL() && (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING)) { ...
value is incrementing or // decrementing over time. PredicateCondition cond_to_expire; PredicateCondition cond_to_valid; if (!state->time_was_until) { // Value increments over time, so a < will expire and a > will become valid. cond_to_expire = PredicateCondition_L; cond_to_valid = PredicateConditio...
while (*state->position != ')') { match = prv_format_predicate(state, previously_matched); if (state->error->status != TemplateStringErrorStatus_Success) { return; } // A force-default case if (prv_format_string_ending(*state->position)) { state->position++; continue; } /...
if (!did_output) { // If no output was generated, it's an error. state->error->status = TemplateStringErrorStatus_CantResolve; } // format() must be the last filter, and ends the sequence. state->filters_complete = true; } static void prv_filter_time_until(TemplateStringState *state) { char *endpt...
552, -296}, { -952, 624, -304}, { -1144, 528, -224}, { -1504, 664, -344}, // 18 seconds { -1184, 616, -240}, { -1000, 552, -128}, { -832, 576, -288}, { -744, 392, -32}, { -560, 320, -16}, { -536, 296, -16}, { -480, 288, 16}, { -456, 264, 24}, { -456, 280, 56}, { ...
{ -1136, 560, -408}, { -1136, 640, -392}, { -752, 552, -544}, { -432, 472, -496}, { -376, 424, -360}, { -368, 392, -312}, { -400, 416, -288}, { -496, 424, -232}, { -552, 472, -232}, { -672, 544, -312}, { -944, 600, -328}, { -904, 552, -216}, { -1400, 656, -336}, {...
{ -720, 376, -112}, { -688, 400, -144}, { -936, 504, -256}, { -1032, 424, -88}, // 26 seconds { -1552, 568, -240}, { -1320, 520, -320}, { -952, 360, -192}, { -1040, 384, -360}, { -960, 280, -48}, { -696, 344, -40}, { -480, 456, -168}, { -488, 312, -48}, { -472, 2...
, false, false, false, false, false, true}; char alarm_day_text_8[32] = {0}; alarm_get_string_for_custom(schedule_8, alarm_day_text_8); cl_assert_equal_s(alarm_day_text_8, "Saturdays"); bool schedule_9[7] = {true, false, false, false, false, false, false}; char alarm_day_text_9[32] = {0}; alarm_get_string_...
alarm_get_string_for_kind(ALARM_KIND_WEEKENDS, all_caps)
ame.size.w - UNFOLD_DOT_SIZE_PX) / 2, .origin.y = layer_frame.origin.y + (layer_frame.size.h - UNFOLD_DOT_SIZE_PX) / 2, .size = UNFOLD_DOT_SIZE, }; } GSize size = kino_reel_get_size(from_reel); GRect icon_to = { .origin.x = layer_frame.origin.x + (layer_frame.size.w - size.w) / 2, .origin...
(size.w / 2, size.h / 2)
); const bool take_ownership = true; KinoReel *kino_reel = kino_reel_scale_segmented_create(from_reel, take_ownership, layer_frame); kino_reel_transform_set_from_frame(kino_reel, icon_from); kino_reel_transform_set_to_frame(kino_reel, icon_to); kino_reel_transform_set_transform_duration(kino_reel, PEEK_LAYER...
ection_for_each_cb, &cb_data); } prv_unlock(); } // // Getters // // Note: Using a lock on the getters doesn't really accomplish anything since // the fields we read are either set on creation or atomic operations. We do // run the risk that the connection handle is no longer valid and could add // some extra chec...
prv_lock()
Color){.argb = 0b11000000 | rgb_half}; const int16_t y_upper = LEGEND_HEIGHT; const GRect upper_rect = GRect(x, y_upper, test_bmp.bounds.size.w, NUM_COLORS); const GRect upper_legend_rect = GRect(x, y_upper - LEGEND_HEIGHT, test_bmp.bounds.size.w, legend_height); GColor8 upper_legend[4] = { [0 ... 3] = ...
("test_bitblt__8bit_wrap_y.8bit.pbi")
; uint8_t dest_data[50*50]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = 50, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = { { 0, 0 }, { 50, 50 } } }; memset(dest_data, GColorGreen.argb, sizeof(dest_data)); GRect dest_rect = GRect(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...
{ enter_standby(RebootReasonCode_DialogBootFault); }
8, 344, -184}, { 952, 320, -176}, { 1376, 368, -120}, { 1576, 432, -136}, { 1000, 488, -80}, { 1296, 536, -160}, { 1184, 728, -336}, { 960, 496, -264}, { 1312, 392, 16}, { 1488, 184, 16}, { 1112, 24, -96}, { 960, 40, -112}, { 920, 128, -128}, { 952, 176, -136}, { ...
{ -160, -240, -1144}, { -40, -16, -1064}, { -80, -56, -800}, { -144, -176, -600}, // 37 seconds { -56, 104, -776}, { -32, 328, -968}, { -96, 248, -816}, { -128, 40, -560}, { 8, -72, -456}, { 224, -32, -384}, { 592, 56, -304}, { 1376, 144, -120}, { 2248, 416, 216},...
{ 960, 200, -264}, { 1176, 136, -160}, { 1312, 256, -96}, { 1328, 256, -200}, { 1368, 272, -96}, { 1288, 288, -168}, { 944, 280, -200}, { 856, 328, -200}, { 936, 368, -96}, { 1056, 344, -216}, { 1096, 376, -248}, { 1064, 416, -192}, // 40 seconds { 1432, 576, -96...