### Install Application Executable Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Installs the main application executable to the specified runtime destination. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Define Installation Directories Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Sets variables for the installation directories of bundle data and libraries. ```cmake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ``` -------------------------------- ### Install Bundled Plugin Libraries Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Iterates through a list of bundled plugin libraries and installs each one to the lib directory within the installation bundle. This ensures all necessary plugin code is included. ```cmake foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) ``` -------------------------------- ### Install Flutter Library Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Installs the Flutter library file to the bundle library directory. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Configure Installation Prefix for Bundle Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Sets the installation prefix to a bundle directory within the build directory when the default prefix is used. This ensures the application is installed as a relocatable bundle. ```cmake set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() ``` -------------------------------- ### Install Bundled Plugin Libraries Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Installs any bundled plugin libraries to the bundle library directory if they exist. ```cmake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install Native Assets Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Installs native assets provided by build.dart from all packages to the bundle library directory. ```cmake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### CMake Project Setup Source: https://github.com/even-realities/evendemoapp/blob/main/android/app/src/main/cpp/CMakeLists.txt Sets the minimum required CMake version and defines the project name. ```cmake cmake_minimum_required(VERSION 3.22.1) project("lc3") ``` -------------------------------- ### Set Installation Prefix for Bundle Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Configures the installation prefix to be next to the executable for in-place running, especially for Visual Studio builds. ```cmake set(BUILD_BUNDLE_DIR "$") set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() ``` -------------------------------- ### Clean Build Bundle Directory on Install Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Removes the build bundle directory recursively before installation to ensure a clean state. This is part of the installation process. ```cmake install( CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ) ``` -------------------------------- ### Install ICU Data File Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Installs the ICU data file to the bundle data directory. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install Native Assets Directory Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Copies native assets from the build directory to the installation bundle's library directory. This ensures all necessary native components are included in the final application package. ```cmake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install Flutter Assets Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Installs the Flutter assets directory, ensuring it's re-copied on each build to avoid stale files. ```cmake set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install AOT Library Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library on non-Debug builds (Profile and Release configurations). ```cmake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Start Even AI Source: https://github.com/even-realities/evendemoapp/blob/main/README.md Commands to control the Even AI feature, including starting, stopping, and exiting the AI mode. ```APIDOC ## Start Even AI ### Command Information - **Command**: 0xF5 - **subcmd**: 0-255 - **param**: Specific parameters for each sub-command. ### Sub-command Descriptions - **subcmd: 0** - **Description**: Exits all advanced features and returns to the dashboard. - **subcmd: 1** - **Description**: Controls page up (left BLE) and page down (right BLE) in manual mode. - **subcmd: 23** - **Description**: Notifies the phone to activate Even AI. - **subcmd: 24** - **Description**: Signals the end of Even AI recording. ``` -------------------------------- ### Configuring Installation RPATH Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Sets the RPATH to load bundled libraries from the 'lib/' directory relative to the binary. This is important for ensuring dynamic libraries are found at runtime. ```cmake set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### Install AOT Library Conditionally Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library only on non-Debug builds. This optimizes performance for release versions while keeping debug builds smaller and faster to compile. ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Android BLE Scan Filter Example Source: https://github.com/even-realities/evendemoapp/blob/main/docs/G1_BLE_CONNECTION.en.md An example of an Android scan filter for G1 devices. It specifies criteria for matching device names, including format and segment count, to identify paired left and right peripherals. ```Java // Example names (from Android comments): `G1_45_L_92333`, `G1_45_R_xxxx` (left contains `_L_`, right `_R_`). // Android scan filter (summary): // - Non-empty advertised name; // - Name matches `G` + digit(s) (e.g. `G1`); // - Split by `_` yields **four** segments (matches the sample shape); // - Only after **both** left and right exist for the same `channel` does native code notify Flutter of a **paired** set. ``` -------------------------------- ### Define C++ Wrapper Sources Source: https://github.com/even-realities/evendemoapp/blob/main/windows/flutter/CMakeLists.txt Lists core, plugin, and application-specific C++ wrapper source files, prepending the wrapper root directory to each. ```cmake list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_PLUGIN "plugin_registrar.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_APP "flutter_engine.cc" "flutter_view_controller.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") ``` -------------------------------- ### Apply Standard Build Settings Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Applies standard C++14, warning, and optimization settings to a target. Use this to ensure consistent build configurations across targets. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_14) target_compile_options(${TARGET} PRIVATE -Wall -Werror) target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") endfunction() ``` -------------------------------- ### Configure Flutter Tool Backend Command Source: https://github.com/even-realities/evendemoapp/blob/main/windows/flutter/CMakeLists.txt Sets up a custom command to run the Flutter tool backend, ensuring it executes on every build by using a phony output file. ```cmake # === Flutter tool backend === # _phony_ is a non-existent file to force this command to run every time, # since currently there's no way to get a full input/output list from the # flutter tool. set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ${PHONY_OUTPUT} COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) ``` -------------------------------- ### Apply Standard Build Settings Source: https://github.com/even-realities/evendemoapp/blob/main/windows/runner/CMakeLists.txt Applies a predefined set of standard build settings to the specified target. This can be removed if custom build settings are required. ```cmake apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Create Flutter Wrapper Plugin Library Source: https://github.com/even-realities/evendemoapp/blob/main/windows/flutter/CMakeLists.txt Builds a static library for the Flutter wrapper plugin, applying standard settings and configuring visibility and include paths. ```cmake # Wrapper sources needed for a plugin. add_library(flutter_wrapper_plugin STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ) apply_standard_settings(flutter_wrapper_plugin) set_target_properties(flutter_wrapper_plugin PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(flutter_wrapper_plugin PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) target_include_directories(flutter_wrapper_plugin PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_plugin flutter_assemble) ``` -------------------------------- ### Configuring Flutter Library Dependencies Source: https://github.com/even-realities/evendemoapp/blob/main/linux/flutter/CMakeLists.txt This section finds necessary system libraries using PkgConfig and sets up variables for the Flutter library, ICU data file, and project build directories. It ensures all required components are available for the Flutter build. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) ``` -------------------------------- ### Create Flutter Wrapper App Library Source: https://github.com/even-realities/evendemoapp/blob/main/windows/flutter/CMakeLists.txt Builds a static library for the Flutter wrapper application, linking against the Flutter library and setting include paths. ```cmake # Wrapper sources needed for the runner. add_library(flutter_wrapper_app STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_APP} ) apply_standard_settings(flutter_wrapper_app) target_link_libraries(flutter_wrapper_app PUBLIC flutter) target_include_directories(flutter_wrapper_app PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_app flutter_assemble) ``` -------------------------------- ### Include Directories Source: https://github.com/even-realities/evendemoapp/blob/main/android/app/src/main/cpp/CMakeLists.txt Specifies directories to be searched for header files. ```cmake include_directories(include) ``` -------------------------------- ### Include Generated Plugins Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Includes the CMake file that manages building and adding generated plugins to the application. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Set Include Directories for liblc3 Source: https://github.com/even-realities/evendemoapp/blob/main/android/app/src/main/cpp/liblc3/CMakeLists.txt Specifies the public include directories for the liblc3 library. ```cmake target_include_directories(liblc3 PUBLIC ../include) ``` -------------------------------- ### Apply Standard Compilation Settings Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt A function to apply standard compilation features, options, and definitions to a target. Use with caution for plugins. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_17) target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") target_compile_options(${TARGET} PRIVATE /EHsc) target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") endfunction() ``` -------------------------------- ### Set Runtime Output Directory Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Configures the runtime output directory for the application binary to a specific subdirectory within the build directory. This is used to prevent accidental execution of unbundled copies. ```cmake set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### Cross-Building Root Filesystem Configuration Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Configures the sysroot and find paths for cross-building. This section is conditionally enabled when FLUTTER_TARGET_PLATFORM_SYSROOT is defined. ```cmake if(FLUTTER_TARGET_PLATFORM_SYSROOT) set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() ``` -------------------------------- ### Define Application Executable Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Defines the main executable target for the application, listing all source files. Ensure source files are correctly listed here for the application to build. ```cmake add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) ``` -------------------------------- ### Add liblc3 Static Library Source: https://github.com/even-realities/evendemoapp/blob/main/android/app/src/main/cpp/liblc3/CMakeLists.txt Defines the liblc3 static library and lists its source files. ```cmake add_library(liblc STATIC attdet.c bits.c bwdet.c energy.c lc3.c ltpf.c mdct.c plc.c sns.c spec.c tables.c tns.c ) ``` -------------------------------- ### Link Libraries and Include Directories Source: https://github.com/even-realities/evendemoapp/blob/main/windows/runner/CMakeLists.txt Links the necessary Flutter libraries and the wrapper application library to the target executable. It also adds the source directory to the include paths for the compiler. Application-specific dependencies should be added here. ```cmake target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") ``` -------------------------------- ### Link Application Dependencies Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Links the application executable against the Flutter library and GTK+ 3.0. Add any other application-specific libraries here. ```cmake target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) ``` -------------------------------- ### Enabling Modern CMake Behaviors Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Explicitly opts into modern CMake behaviors to prevent warnings with newer CMake versions. This ensures compatibility and adherence to current CMake practices. ```cmake cmake_policy(SET CMP0063 NEW) ``` -------------------------------- ### Configure Flutter Library Headers Source: https://github.com/even-realities/evendemoapp/blob/main/windows/flutter/CMakeLists.txt Appends Flutter library header files to a list and prepends the ephemeral directory path to each. ```cmake list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_export.h" "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") ``` -------------------------------- ### Modern CMake Policy Opt-in Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Explicitly opts into modern CMake behaviors to avoid warnings with recent CMake versions. ```cmake cmake_policy(VERSION 3.14...3.25) ``` -------------------------------- ### Set Flutter Build Directories Source: https://github.com/even-realities/evendemoapp/blob/main/windows/flutter/CMakeLists.txt Defines the ephemeral directory for generated build files and the wrapper root for C++ client wrapper sources. ```cmake set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") # Configuration provided via flutter tool. include(${EPHEMERAL_DIR}/generated_config.cmake) # TODO: Move the rest of this into files in ephemeral. See # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") ``` -------------------------------- ### Unicode Support Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Adds definitions to enable Unicode support for all projects. ```cmake add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### Create Flutter Interface Library Source: https://github.com/even-realities/evendemoapp/blob/main/windows/flutter/CMakeLists.txt Defines an interface library for Flutter, setting include directories and linking against the Flutter library. ```cmake add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Android Connect Argument Processing Source: https://github.com/even-realities/evendemoapp/blob/main/docs/G1_BLE_CONNECTION.en.md Illustrates how the 'Pair_' prefix is handled when connecting to G1 glasses on Android. The prefix is stripped before passing the channel string to the native BleManager. ```Text Connect argument: Flutter usually passes `deviceName` as `Pair_{channelNumber}`. On Android, `BleMethodChannel.connectToGlasses` **strips the `Pair_` prefix** and passes only the channel string into `BleManager.connectToGlass`. ``` -------------------------------- ### Creating an Interface Library for Flutter Source: https://github.com/even-realities/evendemoapp/blob/main/linux/flutter/CMakeLists.txt This snippet creates an interface library named 'flutter' and specifies its include directories and link libraries. This allows Flutter components to be easily integrated into the project. ```cmake add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") target_link_libraries(flutter INTERFACE PkgConfig::GTK PkgConfig::GLIB PkgConfig::GIO ) add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Build Configuration Types Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Configures the available build types (Debug, Profile, Release) based on whether the generator supports multi-configuration builds. ```cmake get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTICONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) else() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() endif() ``` -------------------------------- ### Add Shared Library Source: https://github.com/even-realities/evendemoapp/blob/main/android/app/src/main/cpp/CMakeLists.txt Defines a shared library and lists its source files. This includes C/C++ files for the main library and its dependencies. ```cmake add_library(${CMAKE_PROJECT_NAME} SHARED # List C/C++ source files with relative paths to this CMakeLists.txt. liblc3.cpp liblc3/attdet.c liblc3/bits.c liblc3/bwdet.c liblc3/energy.c liblc3/lc3.c liblc3/ltpf.c liblc3/mdct.c liblc3/plc.c liblc3/sns.c liblc3/spec.c liblc3/tables.c liblc3/tns.c rnnoise/celt_lpc.c rnnoise/denoise.c rnnoise/kiss_fft.c rnnoise/pitch.c rnnoise/rnn.c rnnoise/rnn_data.c rnnoise/rnn_reader.c ) ``` -------------------------------- ### Android GATT Service Discovery Source: https://github.com/even-realities/evendemoapp/blob/main/docs/G1_BLE_CONNECTION.en.md Enable notifications on the RX characteristic, write the CCCD, request MTU, create a bond, and send an initial command. Call glassesConnected only when both devices are connected. ```java onServicesDiscovered(): enable notify on RX, write the CCCD (00002902-...), then requestMtu(251), createBond(), send an initial 0xF4 0x01 to both ears at the end of that ear’s setup path; call glassesConnected only when both isConnect flags are true. ``` -------------------------------- ### Custom Command for Flutter Assembly Source: https://github.com/even-realities/evendemoapp/blob/main/linux/flutter/CMakeLists.txt This custom command is designed to run the Flutter tool backend script to assemble the Flutter library and its headers. It uses a phony target to ensure it runs on every build, as precise input/output tracking is not yet supported. ```cmake add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/_phony_ COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ) ``` -------------------------------- ### iOS GATT Service Discovery Source: https://github.com/even-realities/evendemoapp/blob/main/docs/G1_BLE_CONNECTION.en.md Bind Bluetooth peripherals, hold characteristic references, set notify value to true on RX, and send platform-specific initial commands. ```swift didDiscoverCharacteristicsFor: bind left/right CBPeripheral, hold leftWChar/rightWChar and leftRChar/rightRChar, setNotifyValue(true) on RX, then write 0x4d 0x01 per side (different first bytes from Android—platform implementation drift). ``` -------------------------------- ### Custom list_prepend function for CMake Source: https://github.com/even-realities/evendemoapp/blob/main/linux/flutter/CMakeLists.txt This function prepends a prefix to each element in a list. It is used as a workaround for older CMake versions (pre-3.10) that do not support `list(TRANSFORM ... PREPEND ...)`. It ensures compatibility and consistent list manipulation. ```cmake function(list_prepend LIST_NAME PREFIX) set(NEW_LIST "") foreach(element ${${LIST_NAME}}) list(APPEND NEW_LIST "${PREFIX}${element}") endforeach(element) set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) endfunction() ``` -------------------------------- ### BLE Manager Dart Entry Point Source: https://github.com/even-realities/evendemoapp/blob/main/docs/G1_BLE_CONNECTION.en.md The Dart entry point for managing Bluetooth operations is the BleManager class located in lib/ble_manager.dart. It utilizes MethodChannel for communication with native platforms. ```Dart lib/ble_manager.dart (Dart) └─ MethodChannel("method.bluetooth") ├─ Android: BleChannelHelper / BleMethodChannel → BleManager.kt └─ iOS: AppDelegate.swift → BluetoothManager.swift Downlink: Dart invokeMethod("send", { data, lr? }) → native GATT write Uplink: Android EventChannel("eventBleReceive") / iOS blueInfoSink → Dart Status: native methodChannel.invokeMethod → Dart setMethodCallHandler ``` -------------------------------- ### Link Target Libraries Source: https://github.com/even-realities/evendemoapp/blob/main/android/app/src/main/cpp/CMakeLists.txt Links the target library against necessary Android and logging libraries. ```cmake target_link_libraries(${CMAKE_PROJECT_NAME} # List libraries link to the target library android log) ``` -------------------------------- ### Defining Flutter Library Headers Source: https://github.com/even-realities/evendemoapp/blob/main/linux/flutter/CMakeLists.txt This code appends a list of Flutter library header file names to the `FLUTTER_LIBRARY_HEADERS` variable and then prepends the ephemeral directory path to each. This prepares the header files for inclusion in the build process. ```cmake list(APPEND FLUTTER_LIBRARY_HEADERS "fl_basic_message_channel.h" "fl_binary_codec.h" "fl_binary_messenger.h" "fl_dart_project.h" "fl_engine.h" "fl_json_message_codec.h" "fl_json_method_codec.h" "fl_message_codec.h" "fl_method_call.h" "fl_method_channel.h" "fl_method_codec.h" "fl_method_response.h" "fl_plugin_registrar.h" "fl_plugin_registry.h" "fl_standard_message_codec.h" "fl_standard_method_codec.h" "fl_string_codec.h" "fl_value.h" "fl_view.h" "flutter_linux.h" ) list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") ``` -------------------------------- ### Add Preprocessor Definitions for Build Version Source: https://github.com/even-realities/evendemoapp/blob/main/windows/runner/CMakeLists.txt Adds preprocessor definitions to the compile command for the application target, embedding Flutter version information directly into the build. This allows the application to access version details at runtime. ```cmake target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") ``` -------------------------------- ### Define Flutter Library Paths Source: https://github.com/even-realities/evendemoapp/blob/main/windows/flutter/CMakeLists.txt Sets variables for the Flutter library DLL, ICU data file, project build directory, and AOT library path, publishing them to the parent scope. ```cmake # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) ``` -------------------------------- ### Add Flutter Subdirectory Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Includes the Flutter managed directory as a subdirectory for building. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) ``` -------------------------------- ### Executable Binary Name Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Defines the name of the executable file for the application. This can be changed to alter the on-disk name. ```cmake set(BINARY_NAME "demo_ai_even") ``` -------------------------------- ### Add Runner Subdirectory Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Includes the runner directory as a subdirectory for application build rules. ```cmake add_subdirectory("runner") ``` -------------------------------- ### Profile Build Mode Linker Flags Source: https://github.com/even-realities/evendemoapp/blob/main/windows/CMakeLists.txt Sets linker flags for the Profile build mode to match those of the Release build mode. ```cmake set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") ``` -------------------------------- ### Define Executable Target Source: https://github.com/even-realities/evendemoapp/blob/main/windows/runner/CMakeLists.txt Defines the main executable for the Windows Flutter application. Source files and resources are listed here. The binary name is controlled by the top-level CMakeLists.txt to ensure `flutter run` compatibility. ```cmake add_executable(${BINARY_NAME} WIN32 "flutter_window.cpp" "main.cpp" "utils.cpp" "win32_window.cpp" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" "Runner.rc" "runner.exe.manifest" ) ``` -------------------------------- ### Create Flutter Assemble Custom Target Source: https://github.com/even-realities/evendemoapp/blob/main/windows/flutter/CMakeLists.txt Defines a custom target 'flutter_assemble' that depends on the Flutter library, headers, and wrapper source files. ```cmake add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ) ``` -------------------------------- ### Set Fallback Target Platform Source: https://github.com/even-realities/evendemoapp/blob/main/windows/flutter/CMakeLists.txt Sets a fallback FLUTTER_TARGET_PLATFORM if it's not already defined, ensuring a default configuration. ```cmake if (NOT DEFINED FLUTTER_TARGET_PLATFORM) set(FLUTTER_TARGET_PLATFORM "windows-x64") endif() ``` -------------------------------- ### Add Flutter Tool Build Dependency Source: https://github.com/even-realities/evendemoapp/blob/main/windows/runner/CMakeLists.txt Ensures that the Flutter tool's assembly steps are executed as part of the build process for the application target. This is a mandatory step for Flutter builds. ```cmake add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Setting GTK Application ID Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Configures the unique GTK application identifier. This is crucial for desktop integration and is referenced in GNOME documentation. ```cmake set(APPLICATION_ID "com.example.demo_ai_even") ``` -------------------------------- ### Defining Build Configuration Type Source: https://github.com/even-realities/evendemoapp/blob/main/linux/CMakeLists.txt Sets the default build type to 'Debug' if not already defined. This ensures a build mode is always set, influencing compilation flags and optimizations. ```cmake if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() ``` -------------------------------- ### TouchBar Events Source: https://github.com/even-realities/evendemoapp/blob/main/README.md Handles user interactions with the TouchBar, including single, double, and triple taps, to control various app features. ```APIDOC ## TouchBar Events ### Single Tap - **Command**: 0xf5 0x01 - **Description**: Used to navigate through QuickNotes, view notifications, or control page turning in teleprompting/Even AI features. ### Double Tap - **Command**: 0xf5 0x00 - **Description**: Closes features or hides detailed information. ### Triple Tap - **Command**: 0xf5 0x04/0x05 - **Description**: Toggles Silent Mode. ``` -------------------------------- ### Receive Glasses Mic data Source: https://github.com/even-realities/evendemoapp/blob/main/README.md Receives audio data streamed from the glasses' microphone. ```APIDOC ## Receive Glasses Mic data ### Command Information - **Command**: 0xF1 - **seq**: 0-255 (Sequence Number) - **data**: Audio Data ### Field Descriptions - **seq**: Sequence number for packet ordering. - **data**: Actual audio data chunks. ### Example - **Command**: 0xF1, seq = 10, data = [Audio Data] - **Description**: Transmits an audio data chunk with sequence number 10. ``` -------------------------------- ### Flutter BLE Connection Flow Source: https://github.com/even-realities/evendemoapp/blob/main/docs/G1_BLE_CONNECTION.en.md Manages the BLE connection lifecycle including scanning, handling paired devices, connecting, managing connection status, and receiving data. ```dart BleManager.startScan() → invokeMethod('startScan') // ... _onPairedGlassesFound: dedupe by channelNumber into pairedGlasses // ... connectToGlasses(deviceName) → invokeMethod('connectToGlasses', {'deviceName': deviceName}); set local connectionStatus to Connecting... // ... _onGlassesConnected: set isConnected, show left/right names, startSendBeatHeart() (periodic Proto.sendHeartBeat()) // ... _onGlassesDisconnected (when native invokes it) // ... EventChannel('eventBleReceive'); _handleReceivedData parses commands (e.g. 0xF5 touchpad / EvenAI events). ``` -------------------------------- ### G1 Device Pairing Logic Source: https://github.com/even-realities/evendemoapp/blob/main/docs/G1_BLE_CONNECTION.en.md Explains the logic for pairing G1 devices, where native code only notifies Flutter once both left and right peripherals for a specific channel are detected. ```Text Only after **both** left and right exist for the same `channel` does native code notify Flutter of a **paired** set. ``` -------------------------------- ### Open Glasses Mic Source: https://github.com/even-realities/evendemoapp/blob/main/README.md Enables or disables the microphone on the glasses, with status feedback. ```APIDOC ## Open Glasses Mic ### Command Information - **Command**: 0x0E - **enable**: 0 (Disable) / 1 (Enable) ### Description - **enable = 0**: Disables the microphone. - **enable = 1**: Enables the microphone. ### Response from Glasses - **Command**: 0x0E - **rsp_status**: 0xC9 (Success), 0xCA (Failure) - **enable**: 0 (MIC disabled), 1 (MIC enabled) ### Example - **Send**: 0x0E, enable = 1 - **Success Response**: 0x0E, rsp_status = 0xC9, enable = 1 - **Failure Response**: 0x0E, rsp_status = 0xCA, enable = 1 ``` -------------------------------- ### BLE Communication Channels Source: https://github.com/even-realities/evendemoapp/blob/main/docs/G1_BLE_CONNECTION.en.md Defines the communication channels used for BLE operations between Flutter and native platforms. The 'method.bluetooth' channel is bidirectional, while 'eventBleReceive' is for native-to-Dart notifications. ```Markdown | Channel | Direction | Purpose | |---|---|---| | `method.bluetooth` | Bidirectional | `startScan`, `stopScan`, `connectToGlasses`, `disconnectFromGlasses`, `send`, etc. | | `eventBleReceive` | Native → Dart | Binary notifications and app payloads (`lr`, `data`, `type`) | ``` -------------------------------- ### Disable Conflicting Windows Macros Source: https://github.com/even-realities/evendemoapp/blob/main/windows/runner/CMakeLists.txt Disables the `NOMINMAX` Windows macro to prevent conflicts with C++ standard library functions, ensuring cleaner compilation. ```cmake target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") ``` -------------------------------- ### G1 Device Map Sent to Flutter Source: https://github.com/even-realities/evendemoapp/blob/main/docs/G1_BLE_CONNECTION.en.md Details the structure of the map sent to Flutter containing information about paired G1 devices, including their names and channel number. ```Text The map sent to Flutter includes: `leftDeviceName`, `rightDeviceName`, `channelNumber`. ``` -------------------------------- ### G1 Device Naming Convention Source: https://github.com/even-realities/evendemoapp/blob/main/docs/G1_BLE_CONNECTION.en.md Describes the naming convention for G1 BLE peripherals, which involves left and right devices identified by a channel number. The names typically follow a pattern like 'G1_CHANNEL_SIDE_UNIQUEID'. ```Text G1_45_L_92333 G1_45_R_xxxx ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.