├── .cargo └── config.toml ├── .github └── workflows │ ├── changelog.yml │ ├── deployment.yml │ └── rust.yml ├── .gitignore ├── CHANGELOG.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── build.rs ├── icons ├── icon.ico ├── icon.png ├── icon.xd └── install.png ├── ios-cargo ├── screenshot.png ├── src ├── color_picker.rs ├── custom_highlighter.rs ├── data.rs ├── gui.rs ├── io.rs ├── main.rs ├── serial.rs ├── settings_window.rs ├── toggle.rs └── update.rs └── wix ├── License.rtf └── main.wxs /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [target.x86_64-apple-darwin] 2 | rustflags = ["-C", "link-arg=-mmacosx-version-min=10.8"] 3 | [env] 4 | MACOSX_DEPLOYMENT_TARGET = "10.12" -------------------------------------------------------------------------------- /.github/workflows/changelog.yml: -------------------------------------------------------------------------------- 1 | name: Check Changelog 2 | on: 3 | pull_request: 4 | types: [ assigned, opened, synchronize, reopened, labeled, unlabeled ] 5 | branches: 6 | - main 7 | jobs: 8 | Check-Changelog: 9 | name: Check Changelog Action 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: tarides/changelog-check-action@v2 13 | with: 14 | changelog: CHANGELOG.md -------------------------------------------------------------------------------- /.github/workflows/deployment.yml: -------------------------------------------------------------------------------- 1 | name: Deployment 2 | 3 | on: 4 | release: 5 | types: 6 | - created 7 | 8 | env: 9 | CARGO_TERM_COLOR: always 10 | 11 | jobs: 12 | build: 13 | permissions: write-all 14 | strategy: 15 | matrix: 16 | include: 17 | - os: ubuntu-22.04 18 | target: x86_64-unknown-linux-gnu 19 | - os: ubuntu-22.04 20 | target: aarch64-unknown-linux-gnu 21 | - os: macos-13 22 | target: x86_64-apple-darwin 23 | - os: macos-14 24 | target: aarch64-apple-darwin 25 | - os: windows-2019 26 | target: x86_64-pc-windows-msvc 27 | - os: windows-2019 28 | target: aarch64-pc-windows-msvc 29 | runs-on: ${{ matrix.os }} 30 | steps: 31 | - uses: actions/checkout@v4 32 | 33 | - name: Install Dependencies (Linux) 34 | if: contains(matrix.os, 'ubuntu') 35 | run: sudo apt-get update && sudo apt-get install -y libclang-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libudev-dev && cargo install cargo-bundle 36 | 37 | - name: Install Dependencies (macOS) 38 | if: contains(matrix.os, 'macos') 39 | run: cargo install cargo-bundle 40 | 41 | - name: Install Dependencies (Windows) 42 | if: contains(matrix.os, 'windows') 43 | run: cargo install --force cargo-wix 44 | 45 | - name: Set CARGO_FEATURES environment variable (Windows) 46 | if: contains(matrix.os, 'windows') 47 | run: | 48 | echo "CARGO_FEATURES=self_update" >> $env:GITHUB_ENV 49 | 50 | - name: Build 51 | run: cargo build --features self_update --release 52 | 53 | - name: Build .deb Package (Linux) 54 | if: contains(matrix.os, 'ubuntu') 55 | run: cargo bundle --features self_update --release 56 | 57 | - name: Build .app Package (macOS) 58 | if: contains(matrix.os, 'macos') 59 | run: cargo bundle --features self_update --release 60 | 61 | - name: Build .msi Package (Windows) 62 | if: contains(matrix.os, 'windows') 63 | run: cargo wix 64 | 65 | # Compress for Linux Binary 66 | - name: Compress Output (Linux Binary) 67 | if: contains(matrix.os, 'ubuntu') 68 | run: | 69 | cd target/release 70 | zip -r serial-monitor-${{ matrix.target }}.zip serial-monitor-rust 71 | mv serial-monitor-${{ matrix.target }}.zip $GITHUB_WORKSPACE/ 72 | 73 | # Compress for Linux .deb Package 74 | - name: Compress Output (Linux .deb) 75 | if: contains(matrix.os, 'ubuntu') 76 | run: | 77 | cd target/release/bundle/deb 78 | zip serial-monitor-${{ matrix.target }}.deb.zip *.deb 79 | mv serial-monitor-${{ matrix.target }}.deb.zip $GITHUB_WORKSPACE/ 80 | 81 | # Compress for macOS (.app Bundle) 82 | - name: Compress Output (macOS) 83 | if: contains(matrix.os, 'macos') 84 | run: | 85 | cd target/release/bundle/osx 86 | zip -r serial-monitor-${{ matrix.target }}.app.zip Serial\ Monitor.app 87 | mv serial-monitor-${{ matrix.target }}.app.zip $GITHUB_WORKSPACE/ 88 | 89 | # Compress for Windows (.exe) 90 | - name: Compress Output (Windows .exe) 91 | if: contains(matrix.os, 'windows') 92 | run: | 93 | Compress-Archive -Path target/release/serial-monitor-rust.exe -DestinationPath serial-monitor-${{ matrix.target }}.exe.zip 94 | Move-Item -Path serial-monitor-${{ matrix.target }}.exe.zip -Destination $env:GITHUB_WORKSPACE 95 | 96 | # Compress for Windows (.msi) 97 | - name: Compress Output (Windows .msi) 98 | if: contains(matrix.os, 'windows') 99 | run: | 100 | cd target/wix 101 | Compress-Archive -Path *.msi -DestinationPath serial-monitor-${{ matrix.target }}.msi.zip 102 | Move-Item -Path serial-monitor-${{ matrix.target }}.msi.zip -Destination $env:GITHUB_WORKSPACE 103 | 104 | - name: Upload .deb and executable for Linux (Ubuntu) 105 | if: contains(matrix.os, 'ubuntu') 106 | uses: actions/upload-release-asset@v1.0.1 107 | env: 108 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 109 | with: 110 | upload_url: ${{ github.event.release.upload_url }} 111 | asset_path: serial-monitor-${{ matrix.target }}.deb.zip 112 | asset_name: serial-monitor-${{ matrix.target }}.deb.zip 113 | asset_content_type: application/zip 114 | 115 | - name: Upload .zip for Linux (Ubuntu executable) 116 | if: contains(matrix.os, 'ubuntu') 117 | uses: actions/upload-release-asset@v1.0.1 118 | env: 119 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 120 | with: 121 | upload_url: ${{ github.event.release.upload_url }} 122 | asset_path: serial-monitor-${{ matrix.target }}.zip 123 | asset_name: serial-monitor-${{ matrix.target }}.zip 124 | asset_content_type: application/zip 125 | 126 | - name: Upload .exe for Windows 127 | if: contains(matrix.os, 'windows') 128 | uses: actions/upload-release-asset@v1.0.1 129 | env: 130 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 131 | with: 132 | upload_url: ${{ github.event.release.upload_url }} 133 | asset_path: serial-monitor-${{ matrix.target }}.exe.zip 134 | asset_name: serial-monitor-${{ matrix.target }}.exe.zip 135 | asset_content_type: application/zip 136 | 137 | - name: Upload .msi for Windows 138 | if: contains(matrix.os, 'windows') 139 | uses: actions/upload-release-asset@v1.0.1 140 | env: 141 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 142 | with: 143 | upload_url: ${{ github.event.release.upload_url }} 144 | asset_path: serial-monitor-${{ matrix.target }}.msi.zip 145 | asset_name: serial-monitor-${{ matrix.target }}.msi.zip 146 | asset_content_type: application/zip 147 | 148 | - name: Upload .zip for macOS 149 | if: contains(matrix.os, 'macos') 150 | uses: actions/upload-release-asset@v1.0.1 151 | env: 152 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 153 | with: 154 | upload_url: ${{ github.event.release.upload_url }} 155 | asset_path: serial-monitor-${{ matrix.target }}.app.zip 156 | asset_name: serial-monitor-${{ matrix.target }}.app.zip 157 | asset_content_type: application/zip 158 | 159 | -------------------------------------------------------------------------------- /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | name: Rust 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | paths: 7 | - "**/*.rs" 8 | - "**/Cargo.toml" 9 | pull_request: 10 | branches: [ "main" ] 11 | paths: 12 | - "**/*.rs" 13 | - "**/Cargo.toml" 14 | 15 | env: 16 | CARGO_TERM_COLOR: always 17 | 18 | jobs: 19 | build: 20 | 21 | runs-on: ubuntu-latest 22 | steps: 23 | - uses: actions/checkout@v4 24 | 25 | - name: Install libraries 26 | run: sudo apt-get update && sudo apt-get install -y libclang-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev && sudo apt-get install libudev-dev && cargo install cargo-bundle 27 | 28 | - name: Build 29 | run: cargo build --all --all-features 30 | 31 | - name: Cargo check 32 | run: cargo check --all --all-features 33 | 34 | - name: Rustfmt 35 | run: cargo fmt --all -- --check 36 | 37 | - name: Clippy 38 | run: cargo clippy --all --all-targets --all-features 39 | 40 | - name: Test 41 | run: cargo test --all --all-features -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Serial Monitor changelog 2 | 3 | All notable changes to the `Serial Monitor` crate will be documented in this file. 4 | 5 | ## Unreleased 0.4.x 6 | 7 | * Switched to `crossbeam-channel` for more efficient channel routing 8 | * removed many `.clone()` calls to reduce CPU load 9 | * Fixed sample rate / disconnect issue 10 | * Releases are now linked to libssl 3.4.1 on linux (built on Ubuntu 22.04) 11 | 12 | ## 0.3.4 13 | 14 | * implement option to self-update the application 15 | 16 | ## 0.3.3 17 | 18 | ### Added: 19 | 20 | * implement `egui-file-dialog` and the feature to open `.csv` files. 21 | 22 | ## 0.3.2 23 | 24 | ### Added: 25 | 26 | * fixed display of only one dataset bug 27 | 28 | ## 0.3.1 - 8.12.2024 29 | 30 | ### Added: 31 | 32 | * removed the custom implementation of `Print` and `ScrollArea` and implemented the `log` crate and `egui_logger` 33 | * Up to 4 Sentences highlightings using regex (thanks [@simon0356](https://github.com/simon0356)) 34 | * Groups settings in the side bar by category into collapsing menu. (thanks [@simon0356](https://github.com/simon0356)) 35 | 36 | ## 0.3.0 - 14.10.2024 - Automatic Reconnection 37 | 38 | ### Added: 39 | 40 | * Color-picker for curves 41 | * Automatically reconnect when device becomes available again (only after unplugging) 42 | * minor bug fixes 43 | 44 | ## 0.2.0 - 09.03.2024 - New Design, Improved Performance 45 | 46 | ### Added: 47 | 48 | * [egui-phosphor](https://github.com/amPerl/egui-phosphor) icons for certain buttons 49 | * multiple plots support (thanks [@oeb25](https://github.com/oeb25)) 50 | * implemented keyboard shortcuts 51 | * improved serial transfer speed (thanks [@L-Trump](https://github.com/L-Trump)) 52 | * Bug fixes (thanks [@zimward](https://github.com/zimward)) 53 | 54 | ## Earlier: 55 | 56 | * code clean up (thanks [@lonesometraveler](https://github.com/lonesometraveler)) 57 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "serial-monitor-rust" 3 | version = "0.3.5" 4 | edition = "2021" 5 | authors = ["Linus Leo Stöckli"] 6 | description = "Serial Monitor and Plotter written in rust." 7 | license = "GPL-3.0" 8 | homepage = "https://github.com/hacknus/serial-monitor-rust" 9 | 10 | [dependencies] 11 | csv = "1.3" 12 | egui_plot = "0.31" 13 | egui_extras = { version = "0.31", features = ["all_loaders"] } 14 | egui-phosphor = { version = "0.9" } 15 | egui-theme-switch = { git = "https://github.com/hacknus/egui-theme-switch" } 16 | egui_logger = { git = "https://github.com/hacknus/egui_logger" } 17 | egui-file-dialog = { git = "https://github.com/hacknus/egui-file-dialog", branch = "sort_by_metadata", features = ["information_view"] } 18 | image = { version = "0.25", default-features = false, features = ["png"] } 19 | preferences = { version = "2.0.0" } 20 | regex = "1" 21 | serde = { version = "1.0", features = ["derive"] } 22 | serialport = { version = "4.7", features = ["serde"] } 23 | log = "0.4" 24 | self_update = { git = "https://github.com/hacknus/self_update", features = ["archive-zip", "compression-zip-deflate"], optional = true } 25 | tempfile = { version = "3.15", optional = true } 26 | reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "rustls-tls", "http2"], optional = true } 27 | semver = { version = "1.0.24", optional = true } 28 | crossbeam-channel = "0.5.14" 29 | 30 | [target.'cfg(not(target_os = "ios"))'.dependencies] 31 | eframe = { version = "0.31", features = ["persistence", "wayland", "x11"] } 32 | keepawake = { version = "0.5.1" } 33 | # ios: 34 | [target.'cfg(target_os = "ios")'.dependencies] 35 | eframe = { version = "0.31", default-features = false, features = [ 36 | "accesskit", 37 | "default_fonts", 38 | "wgpu", # Use the wgpu rendering backend on iOS. 39 | "persistence", 40 | ] } 41 | 42 | [features] 43 | self_update = ["dep:self_update", "tempfile", "reqwest", "semver"] 44 | 45 | [build-dependencies] 46 | regex = "1.11" 47 | 48 | [package.metadata.bundle] 49 | name = "Serial Monitor" 50 | identifier = "ch.hacknus.serial_monitor" 51 | icon = ["./icons/install.png"] 52 | copyright = "Copyright (c) hacknus 2025. All rights reserved." 53 | category = "Developer Tool" 54 | short_description = "Serial Monitor and Plotter written in rust." 55 | long_description = "Serial Monitor and Plotter written in rust. Interface with serial devices with the ability to log to a file and plot the data." 56 | osx_minimum_system_version = "10.12" 57 | osx_url_schemes = ["ch.hacknus.serial_monitor"] 58 | deb_depends = ["libclang-dev", "libgtk-3-dev", "libxcb-render0-dev", "libxcb-shape0-dev", "libxcb-xfixes0-dev", "libxkbcommon-dev", "libssl-dev"] 59 | 60 | [package.metadata.wix] 61 | dbg-build = false 62 | dbg-name = false 63 | name = "Serial Monitor" 64 | no-build = false 65 | output = "target/wix/SerialMonitorInstaller.msi" 66 | 67 | [profile.release] 68 | debug = true 69 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Serial Monitor 2 | 3 | “” 4 | 5 | A cross-platform serial monitor and plotter written entirely in rust, the GUI is written 6 | using [egui](https://github.com/emilk/egui). 7 | Inspired by the serial monitor/plotter from the Arduino IDE, but both plotting and reading the traffic can be done 8 | simultaneously. 9 | 10 | ## Installation: 11 | 12 | ### Download pre-built executables 13 | 14 | [Binary bundles](https://github.com/hacknus/serial-monitor-rust/releases) are available for Linux, macOS and Windows. 15 | 16 | Running the apple silicon binary (serial-monitor-aarch64-apple-darwin.app) may result to the message "Serial Monitor is 17 | damaged and cannot be opened.", to get 18 | around this you first need to run: 19 | `xattr -rd com.apple.quarantine Serial\ Monitor.app` 20 | 21 | On Linux first install the following: 22 | 23 | ```sh 24 | sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev 25 | ``` 26 | 27 | ### Compile from source 28 | 29 | The source code can be run using ```cargo run``` or bundled to a platform-executable using cargo bundle. 30 | Currently [cargo bundle](https://github.com/burtonageo/cargo-bundle) only supports linux and macOS 31 | bundles [see github issue](https://github.com/burtonageo/cargo-bundle/issues/77). 32 | As a work-around we can use [cargo wix](https://github.com/volks73/cargo-wix) to create a windows installer. 33 | 34 | #### Debian & Ubuntu 35 | 36 | ```sh 37 | sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libudev-dev 38 | cargo install cargo-bundle 39 | cargo bundle 40 | ``` 41 | 42 | ### Fedora Rawhide 43 | 44 | ```sh 45 | dnf install clang clang-devel clang-tools-extra libxkbcommon-devel pkg-config openssl-devel libxcb-devel gtk3-devel atk fontconfig-devel libusbx-devel 46 | ``` 47 | 48 | #### macOS 49 | 50 | ```sh 51 | cargo install cargo-bundle 52 | cargo bundle 53 | ``` 54 | 55 | #### iOS 56 | 57 | But this is probably not useful since iOS devices do not let you access serial devices because of sandboxing. 58 | 59 | ```sh 60 | sudo xcodebuild -license 61 | rustup target add aarch64-apple-ios 62 | cargo install cargo-bundle 63 | ./ios-cargo ipa --ipad --release 64 | ``` 65 | 66 | #### Windows 67 | 68 | ```sh 69 | cargo install cargo-wix 70 | cargo wix 71 | ``` 72 | 73 | ## Features: 74 | 75 | - [X] Plotting and printing of data simultaneously 76 | - [X] Smart data parser, works with ", " or "," or ":" or ": " 77 | - [X] History of the past sent commands 78 | - [X] Low CPU Usage, lightweight 79 | - [X] Clear history options 80 | - [X] Data Window width (number of displayed datapoints in plot) is adjustable 81 | - [X] Cross-platform, fully written in Rust 82 | - [X] Ability to save text to file 83 | - [X] Ability to save the plot 84 | - [X] Allow to put in labels for the different data columns (instead of column 1, 2, ...) 85 | - [X] Allow to choose Data-bits, Flow-Control, Parity and Stop-Bits for Serial Connection 86 | - [X] Saves the configuration for the serial port after closing and reloads them automatically upon selection 87 | - [X] Option to save raw data to file 88 | - [X] Use keyboard shortcuts (ctrl-S to save data, ctrl-shift-S to save plot, ctrl-X to clear plot) 89 | - [X] Automatic reconnect after device has been unplugged 90 | - [X] Color-picker for curves 91 | - [X] Open a CSV file and display data in plot 92 | - [ ] Allow to select (and copy) more than just the displayed raw traffic (also implement ctrl + A) 93 | - [ ] Smarter data parser 94 | - [ ] make serial print selectable and show corresponding datapoint in plot 95 | - [ ] COM-Port names on Windows (display manufacturer, name, pid or vid of device?) 96 | - [ ] current command entered is lost when navigating through the history 97 | - [ ] command history is currently unlimited (needs an upper limit to prevent huge memory usage) 98 | - [ ] data history is currently unlimited (needs an upper limit to prevent huge memory usage) 99 | - [ ] ... 100 | 101 | ![Screenshot of the application on macOS](screenshot.png) 102 | 103 | Tested on: 104 | 105 | - macOS 12 Monterey x86 106 | - macOS 13 Ventura x86 107 | - macOS 13 Ventura ARM 108 | - macOS 14 Sonoma ARM 109 | - Debian 12 (Testing) x86 110 | - Windows 10 x86 111 | - ... 112 | 113 | One might have to delete the ```Cargo.lock``` file before compiling. 114 | -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.12"); 3 | } 4 | -------------------------------------------------------------------------------- /icons/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hacknus/serial-monitor-rust/8f7970d900f08daa28dd2388532b553315923531/icons/icon.ico -------------------------------------------------------------------------------- /icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hacknus/serial-monitor-rust/8f7970d900f08daa28dd2388532b553315923531/icons/icon.png -------------------------------------------------------------------------------- /icons/icon.xd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hacknus/serial-monitor-rust/8f7970d900f08daa28dd2388532b553315923531/icons/icon.xd -------------------------------------------------------------------------------- /icons/install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hacknus/serial-monitor-rust/8f7970d900f08daa28dd2388532b553315923531/icons/install.png -------------------------------------------------------------------------------- /ios-cargo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import argparse 3 | import subprocess 4 | import tomllib 5 | import os 6 | import shutil 7 | import zipfile 8 | import tempfile 9 | import json 10 | 11 | def parse_cargo_toml(): 12 | with open('Cargo.toml', 'rb') as f: 13 | cargo_toml = tomllib.load(f) 14 | app_name = cargo_toml['package']['metadata']['bundle']['name'] 15 | app_id = cargo_toml['package']['metadata']['bundle']['identifier'] 16 | return app_name, app_id 17 | 18 | def ipa(args): 19 | print("Releasing the build...") 20 | args.release = True 21 | build(args) 22 | 23 | app_name, _ = parse_cargo_toml() 24 | build_type = 'release' 25 | target = get_target(args) 26 | cargo_target_dir = os.getenv('CARGO_TARGET_DIR') 27 | 28 | if cargo_target_dir: 29 | base_target_dir = cargo_target_dir 30 | else: 31 | base_target_dir = 'target' 32 | app_path = os.path.join(base_target_dir, target, build_type, 'bundle', 'ios', f'{app_name}.app') 33 | temp_dir = tempfile.mkdtemp() 34 | 35 | payload_dir = os.path.join(temp_dir, "Payload") 36 | os.makedirs(payload_dir) 37 | shutil.copytree(app_path, os.path.join(payload_dir, f'{app_name}.app')) 38 | 39 | ipa_path = f'{app_name}.ipa' 40 | with zipfile.ZipFile(ipa_path, 'w', zipfile.ZIP_DEFLATED) as ipa_file: 41 | for root, dirs, files in os.walk(payload_dir): 42 | for file in files: 43 | file_path = os.path.join(root, file) 44 | ipa_file.write(file_path, os.path.relpath(file_path, os.path.dirname(payload_dir))) 45 | 46 | shutil.rmtree(payload_dir) 47 | print(f"Created {ipa_path}") 48 | 49 | def post_process_info_plist(plist_path, ipad): 50 | try: 51 | with open('insert.plist', 'r') as insert_file: 52 | insert_content = insert_file.read() 53 | except: 54 | insert_content = "" 55 | with open(plist_path, 'r') as plist_file: 56 | plist_content = plist_file.read() 57 | 58 | if ipad: 59 | ipad_content = """ 60 | UIDeviceFamily 61 | 62 | 1 63 | 2 64 | 65 | UISupportedInterfaceOrientations 66 | 67 | UIInterfaceOrientationPortrait 68 | UIInterfaceOrientationLandscapeLeft 69 | UIInterfaceOrientationLandscapeRight 70 | 71 | UISupportedInterfaceOrientations~ipad 72 | 73 | UIInterfaceOrientationPortrait 74 | UIInterfaceOrientationPortraitUpsideDown 75 | UIInterfaceOrientationLandscapeLeft 76 | UIInterfaceOrientationLandscapeRight 77 | 78 | """ 79 | insert_content += ipad_content 80 | 81 | modified_content = plist_content.replace('', f'{insert_content}\n') 82 | 83 | with open(plist_path, 'w') as plist_file: 84 | plist_file.write(modified_content) 85 | 86 | def get_target(args): 87 | target = 'aarch64-apple-ios' 88 | if args.x86: 89 | target = 'x86_64-apple-ios' 90 | elif args.sim: 91 | target = 'aarch64-apple-ios-sim' 92 | if args.target: 93 | target = args.target 94 | return target 95 | 96 | def build(args): 97 | target = get_target(args) 98 | command = ['cargo', 'bundle', '--target', target] 99 | if args.release: 100 | command.append('--release') 101 | 102 | print(f"Running command: {' '.join(command)}") 103 | subprocess.run(command, check=True) 104 | app_name, _ = parse_cargo_toml() 105 | build_type = 'release' if args.release else 'debug' 106 | cargo_target_dir = os.getenv('CARGO_TARGET_DIR') 107 | if cargo_target_dir: 108 | base_target_dir = cargo_target_dir 109 | else: 110 | base_target_dir = 'target' 111 | plist_path = os.path.join(base_target_dir, target, build_type, 'bundle', 'ios', f'{app_name}.app', 'Info.plist') 112 | post_process_info_plist(plist_path, args.ipad) 113 | 114 | def get_booted_device(): 115 | result = subprocess.run(['xcrun', 'simctl', 'list', 'devices', '--json'], capture_output=True, text=True, check=True) 116 | devices = json.loads(result.stdout) 117 | for runtime in devices['devices']: 118 | for dev in devices['devices'][runtime]: 119 | if dev['state'] == 'Booted': 120 | return dev['udid'] 121 | return None 122 | 123 | def boot_device(device): 124 | print(f"Booting device {device}...") 125 | subprocess.run(['xcrun', 'simctl', 'boot', device], check=True) 126 | print(f"Device {device} booted.") 127 | 128 | def get_newest_iphone_udid(): 129 | result = subprocess.run(['xcrun', 'simctl', 'list', 'devices', '--json'], capture_output=True, text=True, check=True) 130 | devices = json.loads(result.stdout) 131 | 132 | for runtime in devices['devices']: 133 | for dev in devices['devices'][runtime]: 134 | if 'iPhone' in dev['name'] and dev['isAvailable'] and 'SE' not in dev['name']: 135 | return dev['udid'] 136 | 137 | raise Exception("No available iPhone simulators found") 138 | 139 | def run_build(args): 140 | app_name, app_id = parse_cargo_toml() 141 | build_type = 'release' if args.release else 'debug' 142 | target = get_target(args) 143 | 144 | cargo_target_dir = os.getenv('CARGO_TARGET_DIR') 145 | if cargo_target_dir: 146 | base_target_dir = cargo_target_dir 147 | else: 148 | base_target_dir = 'target' 149 | app_path = os.path.join(base_target_dir, target, build_type, 'bundle', 'ios', f'{app_name}.app') 150 | 151 | if args.device == "booted": 152 | if not get_booted_device(): 153 | specific_device_udid = get_newest_iphone_udid() 154 | boot_device(specific_device_udid) 155 | args.device = specific_device_udid 156 | 157 | install_command = [ 158 | 'xcrun', 'simctl', 'install', args.device, app_path 159 | ] 160 | 161 | launch_command = ['xcrun', 'simctl', 'launch', '--console', args.device, app_id] 162 | 163 | print(f"Running command: {' '.join(install_command)}") 164 | subprocess.run(install_command, check=True) 165 | 166 | print(f"Running command: {' '.join(launch_command)}") 167 | subprocess.run(launch_command, check=True) 168 | 169 | def run(args): 170 | print("Running the build process...") 171 | build(args) 172 | print("Running the build...") 173 | run_build(args) 174 | 175 | def main(): 176 | parser = argparse.ArgumentParser(description='A script with build, run, run-build, and release subcommands.') 177 | subparsers = parser.add_subparsers(dest='command', required=True) 178 | 179 | build_parser = subparsers.add_parser('build', help='Build the project') 180 | build_parser.add_argument('--x86', action='store_true', help='Use x86 target') 181 | build_parser.add_argument('--sim', action='store_true', help='Use simulator target') 182 | build_parser.add_argument('--target', type=str, help='Specify custom target') 183 | build_parser.add_argument('--release', '-r', action='store_true', help='Build for release') 184 | build_parser.add_argument('--ipad', action='store_true', help='Include iPad-specific Info.plist entries') 185 | build_parser.set_defaults(func=build) 186 | 187 | run_parser = subparsers.add_parser('run', help='Build and run the project') 188 | run_parser.add_argument('--x86', action='store_true', help='Use x86 target') 189 | run_parser.add_argument('--sim', action='store_true', help='Use simulator target') 190 | run_parser.add_argument('--target', type=str, help='Specify custom target') 191 | run_parser.add_argument('--release', '-r', action='store_true', help='Build for release') 192 | run_parser.add_argument('--ipad', action='store_true', help='Include iPad-specific Info.plist entries') 193 | run_parser.add_argument('--device', type=str, default='booted', help='Specify the target device') 194 | 195 | run_parser.set_defaults(func=run) 196 | 197 | run_build_parser = subparsers.add_parser('run-build', help='Runs already built project') 198 | run_build_parser.add_argument('--x86', action='store_true', help='Use x86 target') 199 | run_build_parser.add_argument('--sim', action='store_true', help='Use simulator target') 200 | run_build_parser.add_argument('--target', type=str, help='Specify custom target') 201 | run_build_parser.add_argument('--release', '-r', action='store_true', help='Build for release') 202 | run_build_parser.add_argument('--device', type=str, default='booted', help='Specify the target device') 203 | run_build_parser.add_argument('--ipad', action='store_true', help='Include iPad-specific Info.plist entries') 204 | 205 | run_build_parser.set_defaults(func=run_build) 206 | 207 | release_parser = subparsers.add_parser('ipa', help='Creates a ipa') 208 | release_parser.add_argument('--x86', action='store_true', help='Use x86 target') 209 | release_parser.add_argument('--sim', action='store_true', help='Use simulator target') 210 | release_parser.add_argument('--target', type=str, help='Specify custom target') 211 | release_parser.add_argument('--release', '-r', action='store_true', help='Build for release') 212 | release_parser.add_argument('--ipad', action='store_true', help='Include iPad-specific Info.plist entries') 213 | release_parser.set_defaults(func=ipa) 214 | 215 | args = parser.parse_args() 216 | args.func(args) 217 | 218 | if __name__ == '__main__': 219 | main() 220 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hacknus/serial-monitor-rust/8f7970d900f08daa28dd2388532b553315923531/screenshot.png -------------------------------------------------------------------------------- /src/color_picker.rs: -------------------------------------------------------------------------------- 1 | use eframe::egui::{ 2 | self, lerp, pos2, remap_clamp, vec2, Align2, Color32, Mesh, Response, Sense, Shape, Stroke, Ui, 3 | Vec2, 4 | }; 5 | use eframe::epaint::StrokeKind; 6 | 7 | // Ten colors that are distinguishable and suitable for colorblind people 8 | pub const COLORS: [Color32; 10] = [ 9 | Color32::WHITE, // White 10 | Color32::from_rgb(230, 159, 0), // Orange 11 | Color32::from_rgb(86, 180, 233), // Sky Blue 12 | Color32::from_rgb(0, 158, 115), // Bluish Green 13 | Color32::from_rgb(240, 228, 66), // Yellow 14 | Color32::from_rgb(0, 114, 178), // Blue 15 | Color32::from_rgb(213, 94, 0), // Vermilion (Red-Orange) 16 | Color32::from_rgb(204, 121, 167), // Reddish Purple 17 | Color32::from_rgb(121, 94, 56), // Brown 18 | Color32::from_rgb(0, 204, 204), // Cyan 19 | ]; 20 | 21 | fn contrast_color(color: Color32) -> Color32 { 22 | let intensity = (color.r() as f32 + color.g() as f32 + color.b() as f32) / 3.0 / 255.0; 23 | if intensity < 0.5 { 24 | Color32::WHITE 25 | } else { 26 | Color32::BLACK 27 | } 28 | } 29 | 30 | pub fn color_picker_widget( 31 | ui: &mut Ui, 32 | label: &str, 33 | color: &mut [Color32], 34 | index: usize, 35 | ) -> Response { 36 | // Draw the square 37 | ui.horizontal(|ui| { 38 | // Define the desired square size (same as checkbox size) 39 | let square_size = ui.spacing().interact_size.y * 0.8; 40 | 41 | // Allocate a square of the same size as the checkbox 42 | let (rect, response) = 43 | ui.allocate_exact_size(egui::vec2(square_size, square_size), Sense::click()); 44 | 45 | // Highlight stroke when hovered 46 | let stroke = if response.hovered() { 47 | Stroke::new(2.0, Color32::WHITE) // White stroke when hovered 48 | } else { 49 | Stroke::NONE // No stroke otherwise 50 | }; 51 | 52 | // Draw the color square with possible hover outline 53 | ui.painter() 54 | .rect(rect, 2.0, color[index], stroke, StrokeKind::Middle); 55 | ui.label(label); 56 | response 57 | }) 58 | .inner 59 | } 60 | pub fn color_picker_window(ctx: &egui::Context, color: &mut Color32, value: &mut f32) -> bool { 61 | let mut save_button = false; 62 | 63 | let _window_response = egui::Window::new("Color Menu") 64 | // .fixed_pos(Pos2 { x: 800.0, y: 450.0 }) 65 | .fixed_size(Vec2 { x: 100.0, y: 100.0 }) 66 | .anchor(Align2::CENTER_CENTER, Vec2 { x: 0.0, y: 0.0 }) 67 | .collapsible(false) 68 | .show(ctx, |ui| { 69 | // We will create two horizontal rows with five squares each 70 | let square_size = ui.spacing().interact_size.y * 0.8; 71 | 72 | ui.vertical(|ui| { 73 | // First row (5 squares) 74 | ui.horizontal(|ui| { 75 | for color_option in &COLORS[0..5] { 76 | let (rect, response) = ui.allocate_exact_size( 77 | egui::vec2(square_size, square_size), 78 | Sense::click(), 79 | ); 80 | 81 | // Handle click to set selected color 82 | if response.clicked() { 83 | *color = *color_option; 84 | } 85 | 86 | // Stroke highlighting for hover 87 | let stroke = if response.hovered() { 88 | Stroke::new(2.0, Color32::WHITE) 89 | } else { 90 | Stroke::NONE 91 | }; 92 | 93 | // Draw the color square 94 | ui.painter() 95 | .rect(rect, 2.0, *color_option, stroke, StrokeKind::Middle); 96 | } 97 | }); 98 | 99 | // Second row (5 squares) 100 | ui.horizontal(|ui| { 101 | for color_option in &COLORS[5..10] { 102 | let (rect, response) = ui.allocate_exact_size( 103 | egui::vec2(square_size, square_size), 104 | Sense::click(), 105 | ); 106 | 107 | // Handle click to set selected color 108 | if response.clicked() { 109 | *color = *color_option; 110 | } 111 | 112 | // Stroke highlighting for hover 113 | let stroke = if response.hovered() { 114 | Stroke::new(2.0, Color32::WHITE) 115 | } else { 116 | Stroke::NONE 117 | }; 118 | 119 | // Draw the color square 120 | ui.painter() 121 | .rect(rect, 2.0, *color_option, stroke, StrokeKind::Middle); 122 | } 123 | }); 124 | 125 | // Now, create the 1D color bar slider below the grid 126 | ui.separator(); // Optional visual separator between grid and color bar 127 | // Add a 1D color slider below the color grid 128 | let response = color_slider_1d(ui, value, |t| { 129 | // Generate hue-based colors 130 | let hue = t * 360.0; // Convert t from [0.0, 1.0] to [0.0, 360.0] 131 | hsv_to_rgb(hue, 1.0, 1.0) // Full saturation and value 132 | }); 133 | if response.clicked() || response.changed() || response.dragged() { 134 | // Update the selected color based on the slider position 135 | *color = hsv_to_rgb(*value * 360.0, 1.0, 1.0); // Update color 136 | } 137 | ui.add_space(5.0); 138 | ui.centered_and_justified(|ui| { 139 | if ui.button("Exit").clicked() { 140 | save_button = true; 141 | } 142 | }); 143 | }); 144 | }); 145 | 146 | save_button 147 | } 148 | 149 | // Function to create a 1D color slider 150 | fn color_slider_1d(ui: &mut Ui, value: &mut f32, color_at: impl Fn(f32) -> Color32) -> Response { 151 | const N: usize = 100; // Number of segments 152 | 153 | let desired_size = vec2(ui.spacing().slider_width, ui.spacing().interact_size.y); 154 | let (rect, response) = ui.allocate_at_least(desired_size, Sense::click_and_drag()); 155 | 156 | if let Some(mpos) = response.interact_pointer_pos() { 157 | *value = remap_clamp(mpos.x, rect.left()..=rect.right(), 0.0..=1.0); 158 | } 159 | 160 | if ui.is_rect_visible(rect) { 161 | let visuals = ui.style().interact(&response); 162 | 163 | // Fill the color gradient 164 | let mut mesh = Mesh::default(); 165 | for i in 0..=N { 166 | let t = i as f32 / (N as f32); 167 | let color = color_at(t); 168 | let x = lerp(rect.left()..=rect.right(), t); 169 | mesh.colored_vertex(pos2(x, rect.top()), color); 170 | mesh.colored_vertex(pos2(x, rect.bottom()), color); 171 | if i < N { 172 | mesh.add_triangle((2 * i) as u32, (2 * i + 1) as u32, (2 * i + 2) as u32); 173 | mesh.add_triangle((2 * i + 1) as u32, (2 * i + 2) as u32, (2 * i + 3) as u32); 174 | } 175 | } 176 | ui.painter().add(Shape::mesh(mesh)); 177 | 178 | ui.painter() 179 | .rect_stroke(rect, 0.0, visuals.bg_stroke, StrokeKind::Middle); // outline 180 | 181 | // Show where the slider is at: 182 | let x = lerp(rect.left()..=rect.right(), *value); 183 | let r = rect.height() / 4.0; 184 | let picked_color = color_at(*value); 185 | ui.painter().add(Shape::convex_polygon( 186 | vec![ 187 | pos2(x, rect.center().y), // tip 188 | pos2(x + r, rect.bottom()), // right bottom 189 | pos2(x - r, rect.bottom()), // left bottom 190 | ], 191 | picked_color, 192 | Stroke::new(visuals.fg_stroke.width, contrast_color(picked_color)), 193 | )); 194 | } 195 | 196 | response 197 | } 198 | 199 | // Convert HSV color to RGB 200 | fn hsv_to_rgb(hue: f32, saturation: f32, value: f32) -> Color32 { 201 | let c = value * saturation; 202 | let x = c * (1.0 - ((hue / 60.0) % 2.0 - 1.0).abs()); 203 | let m = value - c; 204 | 205 | let (r, g, b) = if hue < 60.0 { 206 | (c, x, 0.0) 207 | } else if hue < 120.0 { 208 | (x, c, 0.0) 209 | } else if hue < 180.0 { 210 | (0.0, c, x) 211 | } else if hue < 240.0 { 212 | (0.0, x, c) 213 | } else if hue < 300.0 { 214 | (x, 0.0, c) 215 | } else { 216 | (c, 0.0, x) 217 | }; 218 | 219 | Color32::from_rgb( 220 | ((r + m) * 255.0) as u8, 221 | ((g + m) * 255.0) as u8, 222 | ((b + m) * 255.0) as u8, 223 | ) 224 | } 225 | -------------------------------------------------------------------------------- /src/custom_highlighter.rs: -------------------------------------------------------------------------------- 1 | extern crate regex; 2 | use eframe::egui::{self, text::LayoutJob, Color32, TextFormat}; 3 | use eframe::egui::{FontFamily, FontId}; 4 | 5 | use regex::Regex; 6 | use regex::RegexSet; 7 | const DEFAULT_FONT_ID: FontId = FontId::new(14.0, FontFamily::Monospace); 8 | 9 | #[derive(Debug, Clone, Copy)] 10 | pub struct HighLightElement { 11 | pos_start: usize, 12 | pos_end: usize, 13 | token_idx: usize, 14 | } 15 | impl HighLightElement { 16 | pub fn new(pos_start: usize, pos_end: usize, token_idx: usize) -> Self { 17 | Self { 18 | pos_start, 19 | pos_end, 20 | token_idx, 21 | } 22 | } 23 | } 24 | pub fn highlight_impl( 25 | _ctx: &egui::Context, 26 | text: &str, 27 | tokens: Vec, 28 | default_color: Color32, 29 | ) -> Option { 30 | // Extremely simple syntax highlighter for when we compile without syntect 31 | 32 | let mut my_tokens = tokens.clone(); 33 | for token in my_tokens.clone() { 34 | if token.is_empty() { 35 | let index = my_tokens.iter().position(|x| *x == token).unwrap(); 36 | my_tokens.remove(index); 37 | } 38 | } 39 | 40 | let content_string = String::from(text); 41 | // let _ = file.read_to_string(&mut isi); 42 | let mut regexs: Vec = Vec::new(); 43 | for sentence in my_tokens.clone() { 44 | match Regex::new(&sentence) { 45 | Ok(re) => { 46 | regexs.push(re); 47 | } 48 | Err(_err) => {} 49 | }; 50 | } 51 | 52 | let mut highlight_list: Vec = Vec::::new(); 53 | match RegexSet::new(my_tokens.clone()) { 54 | Ok(set) => { 55 | for idx in set.matches(&content_string).into_iter() { 56 | for caps in regexs[idx].captures_iter(&content_string) { 57 | highlight_list.push(HighLightElement::new( 58 | caps.get(0).unwrap().start(), 59 | caps.get(0).unwrap().end(), 60 | idx, 61 | )); 62 | } 63 | } 64 | } 65 | Err(_err) => {} 66 | }; 67 | 68 | highlight_list.sort_by_key(|item| (item.pos_start, item.pos_end)); 69 | 70 | let mut job = LayoutJob::default(); 71 | let mut previous = HighLightElement::new(0, 0, 0); 72 | for matches in highlight_list { 73 | if previous.pos_end >= matches.pos_start { 74 | continue; 75 | } 76 | job.append( 77 | &text[previous.pos_end..(matches.pos_start)], 78 | 0.0, 79 | TextFormat::simple(DEFAULT_FONT_ID, default_color), 80 | ); 81 | if matches.token_idx == 0 { 82 | job.append( 83 | &text[matches.pos_start..matches.pos_end], 84 | 0.0, 85 | TextFormat::simple(DEFAULT_FONT_ID, Color32::from_rgb(255, 100, 100)), 86 | ); 87 | } else if matches.token_idx == 1 { 88 | job.append( 89 | &text[matches.pos_start..matches.pos_end], 90 | 0.0, 91 | TextFormat::simple(DEFAULT_FONT_ID, Color32::from_rgb(225, 159, 0)), 92 | ); 93 | } else if matches.token_idx == 2 { 94 | job.append( 95 | &text[matches.pos_start..matches.pos_end], 96 | 0.0, 97 | TextFormat::simple(DEFAULT_FONT_ID, Color32::from_rgb(87, 165, 171)), 98 | ); 99 | } else if matches.token_idx == 3 { 100 | job.append( 101 | &text[matches.pos_start..matches.pos_end], 102 | 0.0, 103 | TextFormat::simple(DEFAULT_FONT_ID, Color32::from_rgb(109, 147, 226)), 104 | ); 105 | } 106 | previous = matches; 107 | } 108 | job.append( 109 | &text[previous.pos_end..], 110 | 0.0, 111 | TextFormat::simple(DEFAULT_FONT_ID, default_color), 112 | ); 113 | 114 | Some(job) 115 | } 116 | -------------------------------------------------------------------------------- /src/data.rs: -------------------------------------------------------------------------------- 1 | use egui_plot::PlotPoint; 2 | use std::fmt; 3 | use std::time::{SystemTime, UNIX_EPOCH}; 4 | 5 | #[derive(Clone, Debug, PartialEq)] 6 | pub enum SerialDirection { 7 | Send, 8 | Receive, 9 | } 10 | 11 | impl fmt::Display for SerialDirection { 12 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 13 | match *self { 14 | SerialDirection::Send => write!(f, "SEND"), 15 | SerialDirection::Receive => write!(f, "RECV"), 16 | } 17 | } 18 | } 19 | 20 | pub fn get_epoch_ms() -> u128 { 21 | SystemTime::now() 22 | .duration_since(UNIX_EPOCH) 23 | .unwrap() 24 | .as_millis() 25 | } 26 | 27 | #[derive(Clone, Debug)] 28 | pub struct Packet { 29 | pub relative_time: f64, 30 | pub absolute_time: f64, 31 | pub direction: SerialDirection, 32 | pub payload: String, 33 | } 34 | 35 | impl Default for Packet { 36 | fn default() -> Packet { 37 | Packet { 38 | relative_time: 0.0, 39 | absolute_time: get_epoch_ms() as f64, 40 | direction: SerialDirection::Send, 41 | payload: "".to_string(), 42 | } 43 | } 44 | } 45 | 46 | #[derive(Clone, Debug)] 47 | pub struct DataContainer { 48 | pub time: Vec, 49 | pub absolute_time: Vec, 50 | pub dataset: Vec>, 51 | pub raw_traffic: Vec, 52 | pub loaded_from_file: bool, 53 | } 54 | 55 | impl Default for DataContainer { 56 | fn default() -> DataContainer { 57 | DataContainer { 58 | time: vec![], 59 | absolute_time: vec![], 60 | dataset: vec![vec![]], 61 | raw_traffic: vec![], 62 | loaded_from_file: false, 63 | } 64 | } 65 | } 66 | 67 | #[derive(Clone, Debug, Default)] 68 | pub struct GuiOutputDataContainer { 69 | pub prints: Vec, 70 | pub plots: Vec<(String, Vec)>, 71 | } 72 | -------------------------------------------------------------------------------- /src/io.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | use std::path::PathBuf; 3 | 4 | use csv::{ReaderBuilder, WriterBuilder}; 5 | 6 | use crate::DataContainer; 7 | 8 | /// A set of options for saving data to a CSV file. 9 | #[derive(Debug)] 10 | pub struct FileOptions { 11 | pub file_path: PathBuf, 12 | pub save_absolute_time: bool, 13 | pub save_raw_traffic: bool, 14 | pub names: Vec, 15 | } 16 | 17 | pub fn open_from_csv( 18 | data: &mut DataContainer, 19 | csv_options: &mut FileOptions, 20 | ) -> Result, Box> { 21 | let mut rdr = ReaderBuilder::new() 22 | .has_headers(true) 23 | .from_path(&csv_options.file_path)?; 24 | 25 | csv_options.names = rdr 26 | .headers() 27 | .unwrap() 28 | .into_iter() 29 | .skip(1) 30 | .map(|s| s.to_string()) 31 | .collect::>(); 32 | 33 | // Clear any existing data in the DataContainer 34 | data.absolute_time.clear(); 35 | data.time.clear(); 36 | data.dataset = vec![vec![]; csv_options.names.len()]; 37 | 38 | let mut raw_data = vec![]; 39 | 40 | // Read and parse each record in the CSV 41 | for result in rdr.records() { 42 | let record = result?; 43 | 44 | // Ensure the record has the correct number of fields 45 | if record.len() != csv_options.names.len() + 1 { 46 | return Err("CSV record does not match the expected number of columns".into()); 47 | } 48 | 49 | // Parse the time field (first column) 50 | let time_value = record.get(0).unwrap(); 51 | if csv_options.save_absolute_time { 52 | data.absolute_time.push(time_value.parse()?); 53 | } else { 54 | data.time.push(time_value.parse()?); 55 | } 56 | 57 | // Parse the remaining columns and populate the dataset 58 | for (i, value) in record.iter().skip(1).enumerate() { 59 | if let Some(dataset_column) = data.dataset.get_mut(i) { 60 | dataset_column.push(value.parse()?); 61 | } else { 62 | return Err("Unexpected number of data columns in the CSV".into()); 63 | } 64 | } 65 | // Join the row into a single string with ", " as delimiter and push to raw_data 66 | let row = record.iter().collect::>().join(", "); 67 | raw_data.push(row + "\n"); 68 | } 69 | 70 | data.loaded_from_file = true; 71 | 72 | Ok(raw_data) 73 | } 74 | 75 | pub fn save_to_csv(data: &DataContainer, csv_options: &FileOptions) -> Result<(), Box> { 76 | let mut wtr = WriterBuilder::new() 77 | .has_headers(false) 78 | .from_path(&csv_options.file_path)?; 79 | // serialize does not work, so we do it with a loop.. 80 | let mut header = vec!["Time [ms]".to_string()]; 81 | header.extend_from_slice(&csv_options.names); 82 | wtr.write_record(header)?; 83 | for j in 0..data.dataset[0].len() { 84 | let time = if csv_options.save_absolute_time { 85 | data.absolute_time[j].to_string() 86 | } else { 87 | data.time[j].to_string() 88 | }; 89 | let mut data_to_write = vec![time]; 90 | for value in data.dataset.iter() { 91 | data_to_write.push(value[j].to_string()); 92 | } 93 | wtr.write_record(&data_to_write)?; 94 | } 95 | wtr.flush()?; 96 | if csv_options.save_raw_traffic { 97 | let mut path = csv_options.file_path.clone(); 98 | let mut file_name = path 99 | .file_name() 100 | .unwrap() 101 | .to_str() 102 | .unwrap() 103 | .to_string() 104 | .replace(".csv", ""); 105 | file_name += "raw.csv"; 106 | path.set_file_name(file_name); 107 | save_raw(data, &path)? 108 | } 109 | Ok(()) 110 | } 111 | 112 | pub fn save_raw(data: &DataContainer, path: &PathBuf) -> Result<(), Box> { 113 | let mut wtr = WriterBuilder::new().has_headers(false).from_path(path)?; 114 | let header = vec![ 115 | "Time [ms]".to_string(), 116 | "Abs Time [ms]".to_string(), 117 | "Raw Traffic".to_string(), 118 | ]; 119 | wtr.write_record(header)?; 120 | 121 | for j in 0..data.dataset[0].len() { 122 | let mut data_to_write = vec![data.time[j].to_string(), data.absolute_time[j].to_string()]; 123 | data_to_write.push(data.raw_traffic[j].payload.clone()); 124 | wtr.write_record(&data_to_write)?; 125 | } 126 | wtr.flush()?; 127 | Ok(()) 128 | } 129 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] 2 | // hide console window on Windows in release 3 | extern crate core; 4 | extern crate csv; 5 | extern crate preferences; 6 | extern crate serde; 7 | 8 | use crate::data::{DataContainer, GuiOutputDataContainer, Packet, SerialDirection}; 9 | use crate::gui::{load_gui_settings, GuiCommand, MyApp, RIGHT_PANEL_WIDTH}; 10 | use crate::io::{open_from_csv, save_to_csv, FileOptions}; 11 | use crate::serial::{load_serial_settings, serial_thread, Device}; 12 | use crossbeam_channel::{select, Receiver, Sender}; 13 | use eframe::egui::{vec2, ViewportBuilder, Visuals}; 14 | use eframe::{egui, icon_data}; 15 | use egui_plot::PlotPoint; 16 | use preferences::AppInfo; 17 | use std::cmp::max; 18 | use std::path::PathBuf; 19 | use std::sync::{Arc, RwLock}; 20 | use std::time::Duration; 21 | use std::{env, thread}; 22 | 23 | mod color_picker; 24 | mod custom_highlighter; 25 | mod data; 26 | mod gui; 27 | mod io; 28 | mod serial; 29 | mod settings_window; 30 | mod toggle; 31 | mod update; 32 | 33 | const APP_INFO: AppInfo = AppInfo { 34 | name: "Serial Monitor", 35 | author: "Linus Leo Stöckli", 36 | }; 37 | const PREFERENCES_KEY: &str = "config/gui"; 38 | const PREFERENCES_KEY_SERIAL: &str = "config/serial_devices"; 39 | 40 | fn split(payload: &str) -> Vec { 41 | let mut split_data: Vec<&str> = vec![]; 42 | for s in payload.split(':') { 43 | split_data.extend(s.split(',')); 44 | } 45 | split_data 46 | .iter() 47 | .map(|x| x.trim()) 48 | .flat_map(|x| x.parse::()) 49 | .collect() 50 | } 51 | 52 | fn console_text(show_timestamps: bool, show_sent_cmds: bool, packet: &Packet) -> Option { 53 | match (show_sent_cmds, show_timestamps, &packet.direction) { 54 | (true, true, _) => Some(format!( 55 | "[{}] t + {:.3}s: {}\n", 56 | packet.direction, 57 | packet.relative_time as f32 / 1000.0, 58 | packet.payload 59 | )), 60 | (true, false, _) => Some(format!("[{}]: {}\n", packet.direction, packet.payload)), 61 | (false, true, SerialDirection::Receive) => Some(format!( 62 | "t + {:.3}s: {}\n", 63 | packet.relative_time as f32 / 1000.0, 64 | packet.payload 65 | )), 66 | (false, false, SerialDirection::Receive) => Some(packet.payload.clone() + "\n"), 67 | (_, _, _) => None, 68 | } 69 | } 70 | 71 | fn main_thread( 72 | sync_tx: Sender, 73 | data_lock: Arc>, 74 | raw_data_rx: Receiver, 75 | save_rx: Receiver, 76 | load_rx: Receiver, 77 | load_names_tx: Sender>, 78 | gui_cmd_rx: Receiver, 79 | ) { 80 | // reads data from mutex, samples and saves if needed 81 | let mut data = DataContainer::default(); 82 | let mut failed_format_counter = 0; 83 | 84 | let mut show_timestamps = true; 85 | let mut show_sent_cmds = true; 86 | 87 | let mut file_opened = false; 88 | 89 | loop { 90 | select! { 91 | recv(raw_data_rx) -> packet => { 92 | if let Ok(packet) = packet { 93 | if !file_opened { 94 | data.loaded_from_file = false; 95 | if !packet.payload.is_empty() { 96 | sync_tx.send(true).expect("unable to send sync tx"); 97 | data.raw_traffic.push(packet.clone()); 98 | 99 | if let Ok(mut gui_data) = data_lock.write() { 100 | if let Some(text) = console_text(show_timestamps, show_sent_cmds, &packet) { 101 | // append prints 102 | gui_data.prints.push(text); 103 | } 104 | } 105 | 106 | let split_data = split(&packet.payload); 107 | if data.dataset.is_empty() || failed_format_counter > 10 { 108 | // resetting dataset 109 | data.time = vec![]; 110 | data.dataset = vec![vec![]; max(split_data.len(), 1)]; 111 | if let Ok(mut gui_data) = data_lock.write() { 112 | gui_data.plots = (0..max(split_data.len(), 1)) 113 | .map(|i| (format!("Column {i}"), vec![])) 114 | .collect(); 115 | } 116 | failed_format_counter = 0; 117 | // log::error!("resetting dataset. split length = {}, length data.dataset = {}", split_data.len(), data.dataset.len()); 118 | } else if split_data.len() == data.dataset.len() { 119 | // appending data 120 | for (i, set) in data.dataset.iter_mut().enumerate() { 121 | set.push(split_data[i]); 122 | failed_format_counter = 0; 123 | } 124 | 125 | data.time.push(packet.relative_time); 126 | data.absolute_time.push(packet.absolute_time); 127 | 128 | // appending data for GUI thread 129 | if let Ok(mut gui_data) = data_lock.write() { 130 | // append plot-points 131 | for ((_label, graph), data_i) in 132 | gui_data.plots.iter_mut().zip(&data.dataset) 133 | { 134 | if data.time.len() == data_i.len() { 135 | if let Some(y) = data_i.last() { 136 | graph.push(PlotPoint { 137 | x: packet.relative_time / 1000.0, 138 | y: *y as f64, 139 | }); 140 | } 141 | } 142 | } 143 | } 144 | if data.time.len() != data.dataset[0].len() { 145 | // resetting dataset 146 | data.time = vec![]; 147 | data.dataset = vec![vec![]; max(split_data.len(), 1)]; 148 | if let Ok(mut gui_data) = data_lock.write() { 149 | gui_data.prints = vec!["".to_string(); max(split_data.len(), 1)]; 150 | gui_data.plots = (0..max(split_data.len(), 1)) 151 | .map(|i| (format!("Column {i}"), vec![])) 152 | .collect(); 153 | } 154 | } 155 | } else { 156 | // not same length 157 | failed_format_counter += 1; 158 | // log::error!("not same length in main! length split_data = {}, length data.dataset = {}", split_data.len(), data.dataset.len()) 159 | } 160 | } 161 | } 162 | } 163 | } 164 | recv(gui_cmd_rx) -> msg => { 165 | if let Ok(cmd) = msg { 166 | match cmd { 167 | GuiCommand::Clear => { 168 | data = DataContainer::default(); 169 | failed_format_counter = 0; 170 | if let Ok(mut gui_data) = data_lock.write() { 171 | *gui_data = GuiOutputDataContainer::default(); 172 | } 173 | } 174 | GuiCommand::ShowTimestamps(val) => { 175 | show_timestamps = val; 176 | } 177 | GuiCommand::ShowSentTraffic(val) => { 178 | show_sent_cmds = val; 179 | } 180 | } 181 | } 182 | } 183 | recv(load_rx) -> msg => { 184 | if let Ok(fp) = msg { 185 | // load logic 186 | if let Some(file_ending) = fp.extension() { 187 | match file_ending.to_str().unwrap() { 188 | "csv" => { 189 | file_opened = true; 190 | let mut file_options = FileOptions { 191 | file_path: fp.clone(), 192 | save_absolute_time: false, 193 | save_raw_traffic: false, 194 | names: vec![], 195 | }; 196 | match open_from_csv(&mut data, &mut file_options) { 197 | Ok(raw_data) => { 198 | log::info!("opened {:?}", fp); 199 | if let Ok(mut gui_data) = data_lock.write() { 200 | 201 | gui_data.prints = raw_data; 202 | 203 | dbg!(&gui_data.prints); 204 | 205 | gui_data.plots = (0..data.dataset.len()) 206 | .map(|i| (file_options.names[i].to_string(), vec![])) 207 | .collect(); 208 | // append plot-points 209 | for ((_label, graph), data_i) in 210 | gui_data.plots.iter_mut().zip(&data.dataset) 211 | { 212 | for (y,t) in data_i.iter().zip(data.time.iter()) { 213 | graph.push(PlotPoint { 214 | x: *t / 1000.0, 215 | y: *y as f64 , 216 | }); 217 | } 218 | } 219 | 220 | } 221 | load_names_tx 222 | .send(file_options.names) 223 | .expect("unable to send names on channel after loading"); 224 | } 225 | Err(err) => { 226 | file_opened = false; 227 | log::error!("failed opening {:?}: {:?}", fp, err); 228 | } 229 | }; 230 | } 231 | _ => { 232 | file_opened = false; 233 | log::error!("file not supported: {:?} \n Close the file to connect to a spectrometer or open another file.", fp); 234 | continue; 235 | } 236 | } 237 | } else { 238 | file_opened = false; 239 | } 240 | } else { 241 | file_opened = false; 242 | } 243 | } 244 | recv(save_rx) -> msg => { 245 | if let Ok(csv_options) = msg { 246 | match save_to_csv(&data, &csv_options) { 247 | Ok(_) => { 248 | log::info!("saved data file to {:?} ", csv_options.file_path); 249 | } 250 | Err(e) => { 251 | log::error!( 252 | "failed to save file to {:?}: {:?}", 253 | csv_options.file_path, 254 | e 255 | ); 256 | } 257 | } 258 | } 259 | } 260 | default(Duration::from_millis(10)) => { 261 | // occasionally push data to GUI 262 | } 263 | } 264 | } 265 | } 266 | 267 | fn main() { 268 | egui_logger::builder().init().unwrap(); 269 | 270 | let gui_settings = load_gui_settings(); 271 | let saved_serial_device_configs = load_serial_settings(); 272 | 273 | let device_lock = Arc::new(RwLock::new(Device::default())); 274 | let devices_lock = Arc::new(RwLock::new(vec![gui_settings.device.clone()])); 275 | let data_lock = Arc::new(RwLock::new(GuiOutputDataContainer::default())); 276 | let connected_lock = Arc::new(RwLock::new(false)); 277 | 278 | let (save_tx, save_rx): (Sender, Receiver) = 279 | crossbeam_channel::unbounded(); 280 | let (load_tx, load_rx): (Sender, Receiver) = crossbeam_channel::unbounded(); 281 | let (loaded_names_tx, loaded_names_rx): (Sender>, Receiver>) = 282 | crossbeam_channel::unbounded(); 283 | let (send_tx, send_rx): (Sender, Receiver) = crossbeam_channel::unbounded(); 284 | let (gui_cmd_tx, gui_cmd_rx): (Sender, Receiver) = 285 | crossbeam_channel::unbounded(); 286 | let (raw_data_tx, raw_data_rx): (Sender, Receiver) = 287 | crossbeam_channel::unbounded(); 288 | let (sync_tx, sync_rx): (Sender, Receiver) = crossbeam_channel::unbounded(); 289 | 290 | let serial_device_lock = device_lock.clone(); 291 | let serial_devices_lock = devices_lock.clone(); 292 | let serial_connected_lock = connected_lock.clone(); 293 | 294 | let _serial_thread_handler = thread::spawn(|| { 295 | serial_thread( 296 | send_rx, 297 | raw_data_tx, 298 | serial_device_lock, 299 | serial_devices_lock, 300 | serial_connected_lock, 301 | ); 302 | }); 303 | 304 | let main_data_lock = data_lock.clone(); 305 | 306 | let _main_thread_handler = thread::spawn(|| { 307 | main_thread( 308 | sync_tx, 309 | main_data_lock, 310 | raw_data_rx, 311 | save_rx, 312 | load_rx, 313 | loaded_names_tx, 314 | gui_cmd_rx, 315 | ); 316 | }); 317 | 318 | let args: Vec = env::args().collect(); 319 | if args.len() > 1 { 320 | load_tx 321 | .send(PathBuf::from(&args[1])) 322 | .expect("failed to send file"); 323 | } 324 | 325 | let options = eframe::NativeOptions { 326 | viewport: ViewportBuilder::default() 327 | .with_drag_and_drop(true) 328 | .with_inner_size(vec2(gui_settings.x, gui_settings.y)) 329 | .with_min_inner_size(vec2(2.0 * RIGHT_PANEL_WIDTH, 2.0 * RIGHT_PANEL_WIDTH)) 330 | .with_icon( 331 | icon_data::from_png_bytes(&include_bytes!("../icons/icon.png")[..]).unwrap(), 332 | ), 333 | ..Default::default() 334 | }; 335 | 336 | let gui_data_lock = data_lock; 337 | let gui_device_lock = device_lock; 338 | let gui_devices_lock = devices_lock; 339 | let gui_connected_lock = connected_lock; 340 | 341 | if let Err(e) = eframe::run_native( 342 | "Serial Monitor", 343 | options, 344 | Box::new(|ctx| { 345 | let mut fonts = egui::FontDefinitions::default(); 346 | egui_phosphor::add_to_fonts(&mut fonts, egui_phosphor::Variant::Regular); 347 | ctx.egui_ctx.set_fonts(fonts); 348 | ctx.egui_ctx.set_visuals(Visuals::dark()); 349 | egui_extras::install_image_loaders(&ctx.egui_ctx); 350 | 351 | let repaint_signal = ctx.egui_ctx.clone(); 352 | thread::spawn(move || loop { 353 | if sync_rx.recv().is_ok() { 354 | repaint_signal.request_repaint(); 355 | } 356 | }); 357 | 358 | Ok(Box::new(MyApp::new( 359 | ctx, 360 | gui_data_lock, 361 | gui_device_lock, 362 | gui_devices_lock, 363 | saved_serial_device_configs, 364 | gui_connected_lock, 365 | gui_settings, 366 | save_tx, 367 | load_tx, 368 | loaded_names_rx, 369 | send_tx, 370 | gui_cmd_tx, 371 | ))) 372 | }), 373 | ) { 374 | log::error!("{e:?}"); 375 | } 376 | } 377 | -------------------------------------------------------------------------------- /src/serial.rs: -------------------------------------------------------------------------------- 1 | use crossbeam_channel::{Receiver, Sender}; 2 | use eframe::egui::Color32; 3 | use preferences::Preferences; 4 | use serde::{Deserialize, Serialize}; 5 | use serialport::{DataBits, FlowControl, Parity, SerialPort, StopBits}; 6 | use std::io::{BufRead, BufReader}; 7 | use std::sync::{Arc, RwLock}; 8 | use std::time::{Duration, Instant}; 9 | 10 | use crate::color_picker::COLORS; 11 | use crate::data::{get_epoch_ms, SerialDirection}; 12 | use crate::{Packet, APP_INFO, PREFERENCES_KEY_SERIAL}; 13 | 14 | #[derive(Debug, Clone, Serialize, Deserialize)] 15 | pub struct SerialDevices { 16 | pub devices: Vec, 17 | pub labels: Vec>, 18 | pub highlight_labels: Vec>, 19 | pub colors: Vec>, 20 | pub color_vals: Vec>, 21 | pub number_of_plots: Vec, 22 | pub number_of_highlights: Vec, 23 | } 24 | 25 | impl Default for SerialDevices { 26 | fn default() -> Self { 27 | SerialDevices { 28 | devices: vec![Device::default()], 29 | labels: vec![vec!["Column 0".to_string()]], 30 | highlight_labels: vec![vec!["".to_string()]], 31 | colors: vec![vec![COLORS[0]]], 32 | color_vals: vec![vec![0.0]], 33 | number_of_plots: vec![1], 34 | number_of_highlights: vec![1], 35 | } 36 | } 37 | } 38 | 39 | pub fn load_serial_settings() -> SerialDevices { 40 | SerialDevices::load(&APP_INFO, PREFERENCES_KEY_SERIAL).unwrap_or_else(|_| { 41 | let serial_configs = SerialDevices::default(); 42 | // save default settings 43 | save_serial_settings(&serial_configs); 44 | serial_configs 45 | }) 46 | } 47 | 48 | pub fn save_serial_settings(serial_configs: &SerialDevices) { 49 | if serial_configs 50 | .save(&APP_INFO, PREFERENCES_KEY_SERIAL) 51 | .is_err() 52 | { 53 | log::error!("failed to save gui_settings"); 54 | } 55 | } 56 | 57 | pub fn clear_serial_settings() { 58 | let serial_configs = SerialDevices::default(); 59 | if serial_configs 60 | .save(&APP_INFO, PREFERENCES_KEY_SERIAL) 61 | .is_err() 62 | { 63 | log::error!("failed to clear gui_settings"); 64 | } 65 | } 66 | 67 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] 68 | pub struct Device { 69 | pub name: String, 70 | pub baud_rate: u32, 71 | pub data_bits: DataBits, 72 | pub flow_control: FlowControl, 73 | pub parity: Parity, 74 | pub stop_bits: StopBits, 75 | pub timeout: Duration, 76 | } 77 | 78 | impl Default for Device { 79 | fn default() -> Self { 80 | Device { 81 | name: "".to_string(), 82 | baud_rate: 9600, 83 | data_bits: DataBits::Eight, 84 | flow_control: FlowControl::None, 85 | parity: Parity::None, 86 | stop_bits: StopBits::One, 87 | timeout: Duration::from_millis(0), 88 | } 89 | } 90 | } 91 | 92 | fn serial_write( 93 | port: &mut BufReader>, 94 | cmd: &[u8], 95 | ) -> Result { 96 | let write_port = port.get_mut(); 97 | write_port.write(cmd) 98 | } 99 | 100 | fn serial_read( 101 | port: &mut BufReader>, 102 | serial_buf: &mut String, 103 | ) -> Result { 104 | port.read_line(serial_buf) 105 | } 106 | 107 | pub fn serial_thread( 108 | send_rx: Receiver, 109 | raw_data_tx: Sender, 110 | device_lock: Arc>, 111 | devices_lock: Arc>>, 112 | connected_lock: Arc>, 113 | ) { 114 | let mut last_connected_device = Device::default(); 115 | 116 | loop { 117 | #[cfg(not(target_os = "ios"))] 118 | let _not_awake = keepawake::Builder::default() 119 | .display(false) 120 | .reason("Serial Connection") 121 | .app_name("Serial Monitor") 122 | //.app_reverse_domain("io.github.myprog") 123 | .create(); 124 | 125 | if let Ok(mut connected) = connected_lock.write() { 126 | *connected = false; 127 | } 128 | 129 | let device = get_device(&devices_lock, &device_lock, &last_connected_device); 130 | 131 | let mut port = match serialport::new(&device.name, device.baud_rate) 132 | .timeout(Duration::from_millis(100)) 133 | .open() 134 | { 135 | Ok(p) => { 136 | if let Ok(mut connected) = connected_lock.write() { 137 | *connected = true; 138 | } 139 | 140 | log::info!( 141 | "Connected to serial port: {} @ baud = {}", 142 | device.name, 143 | device.baud_rate 144 | ); 145 | 146 | BufReader::new(p) 147 | } 148 | Err(err) => { 149 | if let Ok(mut write_guard) = device_lock.write() { 150 | write_guard.name.clear(); 151 | } 152 | log::error!("Error connecting: {}", err); 153 | continue; 154 | } 155 | }; 156 | 157 | let t_zero = Instant::now(); 158 | 159 | #[cfg(not(target_os = "ios"))] 160 | let _awake = keepawake::Builder::default() 161 | .display(true) 162 | .reason("Serial Connection") 163 | .app_name("Serial Monitor") 164 | //.app_reverse_domain("io.github.myprog") 165 | .create(); 166 | 167 | 'connected_loop: loop { 168 | let devices = available_devices(); 169 | if let Ok(mut write_guard) = devices_lock.write() { 170 | *write_guard = devices.clone(); 171 | } 172 | 173 | if disconnected(&device, &devices, &device_lock, &mut last_connected_device) { 174 | break 'connected_loop; 175 | } 176 | 177 | perform_writes(&mut port, &send_rx, &raw_data_tx, t_zero); 178 | perform_reads(&mut port, &raw_data_tx, t_zero); 179 | 180 | //std::thread::sleep(Duration::from_millis(10)); 181 | } 182 | std::mem::drop(port); 183 | } 184 | } 185 | 186 | fn available_devices() -> Vec { 187 | serialport::available_ports() 188 | .unwrap() 189 | .iter() 190 | .map(|p| p.port_name.clone()) 191 | .collect() 192 | } 193 | 194 | fn get_device( 195 | devices_lock: &Arc>>, 196 | device_lock: &Arc>, 197 | last_connected_device: &Device, 198 | ) -> Device { 199 | loop { 200 | let devices = available_devices(); 201 | if let Ok(mut write_guard) = devices_lock.write() { 202 | *write_guard = devices.clone(); 203 | } 204 | 205 | // do reconnect 206 | if devices.contains(&last_connected_device.name) { 207 | if let Ok(mut device) = device_lock.write() { 208 | device.name = last_connected_device.name.clone(); 209 | device.baud_rate = last_connected_device.baud_rate; 210 | } 211 | return last_connected_device.clone(); 212 | } 213 | 214 | if let Ok(device) = device_lock.read() { 215 | if devices.contains(&device.name) { 216 | return device.clone(); 217 | } 218 | } 219 | std::thread::sleep(Duration::from_millis(100)); 220 | } 221 | } 222 | 223 | fn disconnected( 224 | device: &Device, 225 | devices: &[String], 226 | device_lock: &Arc>, 227 | last_connected_device: &mut Device, 228 | ) -> bool { 229 | // disconnection by button press 230 | if let Ok(read_guard) = device_lock.read() { 231 | if device.name != read_guard.name { 232 | *last_connected_device = Device::default(); 233 | log::info!("Disconnected from serial port: {}", device.name); 234 | return true; 235 | } 236 | } 237 | 238 | // other types of disconnection (e.g. unplugging, power down) 239 | if !devices.contains(&device.name) { 240 | if let Ok(mut write_guard) = device_lock.write() { 241 | write_guard.name.clear(); 242 | } 243 | *last_connected_device = device.clone(); 244 | log::error!("Device has disconnected from serial port: {}", device.name); 245 | return true; 246 | }; 247 | false 248 | } 249 | 250 | fn perform_writes( 251 | port: &mut BufReader>, 252 | send_rx: &Receiver, 253 | raw_data_tx: &Sender, 254 | t_zero: Instant, 255 | ) { 256 | if let Ok(cmd) = send_rx.try_recv() { 257 | if let Err(e) = serial_write(port, cmd.as_bytes()) { 258 | log::error!("Error sending command: {e}"); 259 | return; 260 | } 261 | 262 | let packet = Packet { 263 | relative_time: Instant::now().duration_since(t_zero).as_millis() as f64, 264 | absolute_time: get_epoch_ms() as f64, 265 | direction: SerialDirection::Send, 266 | payload: cmd, 267 | }; 268 | raw_data_tx 269 | .send(packet) 270 | .expect("failed to send raw data (cmd)"); 271 | } 272 | } 273 | 274 | fn perform_reads( 275 | port: &mut BufReader>, 276 | raw_data_tx: &Sender, 277 | t_zero: Instant, 278 | ) { 279 | let mut buf = "".to_string(); 280 | match serial_read(port, &mut buf) { 281 | Ok(_) => { 282 | let delimiter = if buf.contains("\r\n") { "\r\n" } else { "\0\0" }; 283 | buf.split_terminator(delimiter).for_each(|s| { 284 | let packet = Packet { 285 | relative_time: Instant::now().duration_since(t_zero).as_millis() as f64, 286 | absolute_time: get_epoch_ms() as f64, 287 | direction: SerialDirection::Receive, 288 | payload: s.to_owned(), 289 | }; 290 | raw_data_tx.send(packet).expect("failed to send raw data"); 291 | }); 292 | } 293 | // Timeout is ok, just means there is no data to read 294 | Err(ref e) if e.kind() == std::io::ErrorKind::TimedOut => {} 295 | Err(e) => { 296 | log::error!("Error reading: {:?}", e); 297 | } 298 | } 299 | } 300 | -------------------------------------------------------------------------------- /src/settings_window.rs: -------------------------------------------------------------------------------- 1 | use crate::gui::GuiSettingsContainer; 2 | #[cfg(feature = "self_update")] 3 | use crate::update::{check_update, update}; 4 | use eframe::egui; 5 | use eframe::egui::{Align2, InnerResponse, Vec2, Visuals}; 6 | use egui_theme_switch::ThemeSwitch; 7 | #[cfg(feature = "self_update")] 8 | use self_update::restart::restart; 9 | #[cfg(feature = "self_update")] 10 | use self_update::update::Release; 11 | #[cfg(feature = "self_update")] 12 | use semver::Version; 13 | 14 | pub fn settings_window( 15 | ctx: &egui::Context, 16 | gui_conf: &mut GuiSettingsContainer, 17 | #[cfg(feature = "self_update")] new_release: &mut Option, 18 | settings_window_open: &mut bool, 19 | update_text: &mut String, 20 | ) -> Option>> { 21 | egui::Window::new("Settings") 22 | .fixed_size(Vec2 { x: 600.0, y: 200.0 }) 23 | .anchor(Align2::CENTER_CENTER, Vec2 { x: 0.0, y: 0.0 }) 24 | .collapsible(false) 25 | .show(ctx, |ui| { 26 | egui::Grid::new("theme settings") 27 | .striped(true) 28 | .show(ui, |ui| { 29 | if ui 30 | .add(ThemeSwitch::new(&mut gui_conf.theme_preference)) 31 | .changed() 32 | { 33 | ui.ctx().set_theme(gui_conf.theme_preference); 34 | }; 35 | gui_conf.dark_mode = ui.visuals() == &Visuals::dark(); 36 | 37 | ui.end_row(); 38 | ui.end_row(); 39 | }); 40 | #[cfg(feature = "self_update")] 41 | egui::Grid::new("update settings") 42 | .striped(true) 43 | .show(ui, |ui| { 44 | if ui.button("Check for Updates").clicked() { 45 | *new_release = check_update(); 46 | } 47 | 48 | let current_version = Version::parse(env!("CARGO_PKG_VERSION")).unwrap(); 49 | ui.label(format!("Current version: {}", current_version)); 50 | 51 | ui.end_row(); 52 | 53 | if let Some(r) = &new_release { 54 | ui.label(format!("New release: {}", r.version)); 55 | ui.end_row(); 56 | if ui.button("Update").clicked() { 57 | match update(r.clone()) { 58 | Ok(_) => { 59 | log::info!("Update done. {} >> {}", current_version, r.version); 60 | *new_release = None; 61 | *update_text = 62 | "Update done. Please Restart Application.".to_string(); 63 | } 64 | Err(err) => { 65 | log::error!("{}", err); 66 | } 67 | } 68 | } 69 | } else { 70 | ui.label(""); 71 | ui.end_row(); 72 | ui.horizontal(|ui| { 73 | ui.disable(); 74 | let _ = ui.button("Update"); 75 | }); 76 | ui.label("You have the latest version"); 77 | } 78 | }); 79 | ui.label(update_text.clone()); 80 | 81 | ui.horizontal(|ui| { 82 | ui.horizontal(|ui| { 83 | if !update_text.is_empty() { 84 | ui.disable(); 85 | }; 86 | if ui.button("Exit Settings").clicked() { 87 | *settings_window_open = false; 88 | *update_text = "".to_string(); 89 | } 90 | }); 91 | 92 | #[cfg(feature = "self_update")] 93 | if !update_text.is_empty() && ui.button("Restart").clicked() { 94 | restart(); 95 | ctx.request_repaint(); // Optional: Request repaint for immediate feedback 96 | ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); 97 | } 98 | }); 99 | }) 100 | } 101 | -------------------------------------------------------------------------------- /src/toggle.rs: -------------------------------------------------------------------------------- 1 | //! Source code example of how to create your own widget. 2 | //! This is meant to be read as a tutorial, hence the plethora of comments. 3 | 4 | use eframe::egui; 5 | use eframe::egui::StrokeKind; 6 | 7 | /// iOS-style toggle switch: 8 | /// 9 | /// ``` text 10 | /// _____________ 11 | /// / /.....\ 12 | /// | |.......| 13 | /// \_______\_____/ 14 | /// ``` 15 | /// 16 | /// ## Example: 17 | /// ``` ignore 18 | /// toggle_ui(ui, &mut my_bool); 19 | /// ``` 20 | pub fn toggle_ui(ui: &mut egui::Ui, on: &mut bool) -> egui::Response { 21 | // Widget code can be broken up in four steps: 22 | // 1. Decide a size for the widget 23 | // 2. Allocate space for it 24 | // 3. Handle interactions with the widget (if any) 25 | // 4. Paint the widget 26 | 27 | // 1. Deciding widget size: 28 | // You can query the `ui` how much space is available, 29 | // but in this example we have a fixed size widget based on the height of a standard button: 30 | let desired_size = ui.spacing().interact_size.y * egui::vec2(2.0, 1.0); 31 | 32 | // 2. Allocating space: 33 | // This is where we get a region of the screen assigned. 34 | // We also tell the Ui to sense clicks in the allocated region. 35 | let (rect, mut response) = ui.allocate_exact_size(desired_size, egui::Sense::click()); 36 | 37 | // 3. Interact: Time to check for clicks! 38 | if response.clicked() { 39 | *on = !*on; 40 | response.mark_changed(); // report back that the value changed 41 | } 42 | 43 | // Attach some meta-data to the response which can be used by screen readers: 44 | response.widget_info(|| { 45 | egui::WidgetInfo::selected(egui::WidgetType::Checkbox, ui.is_enabled(), *on, "") 46 | }); 47 | 48 | // 4. Paint! 49 | // Make sure we need to paint: 50 | if ui.is_rect_visible(rect) { 51 | // Let's ask for a simple animation from egui. 52 | // egui keeps track of changes in the boolean associated with the id and 53 | // returns an animated value in the 0-1 range for how much "on" we are. 54 | let how_on = ui.ctx().animate_bool(response.id, *on); 55 | // We will follow the current style by asking 56 | // "how should something that is being interacted with be painted?". 57 | // This will, for instance, give us different colors when the widget is hovered or clicked. 58 | let visuals = ui.style().interact_selectable(&response, *on); 59 | // All coordinates are in absolute screen coordinates so we use `rect` to place the elements. 60 | let rect = rect.expand(visuals.expansion); 61 | let radius = 0.5 * rect.height(); 62 | ui.painter().rect( 63 | rect, 64 | radius, 65 | visuals.bg_fill, 66 | visuals.bg_stroke, 67 | StrokeKind::Middle, 68 | ); 69 | // Paint the circle, animating it from left to right with `how_on`: 70 | let circle_x = egui::lerp((rect.left() + radius)..=(rect.right() - radius), how_on); 71 | let center = egui::pos2(circle_x, rect.center().y); 72 | ui.painter() 73 | .circle(center, 0.75 * radius, visuals.bg_fill, visuals.fg_stroke); 74 | } 75 | 76 | // All done! Return the interaction response so the user can check what happened 77 | // (hovered, clicked, ...) and maybe show a tooltip: 78 | response 79 | } 80 | 81 | /// Here is the same code again, but a bit more compact: 82 | #[allow(dead_code)] 83 | fn toggle_ui_compact(ui: &mut egui::Ui, on: &mut bool) -> egui::Response { 84 | let desired_size = ui.spacing().interact_size.y * egui::vec2(2.0, 1.0); 85 | let (rect, mut response) = ui.allocate_exact_size(desired_size, egui::Sense::click()); 86 | if response.clicked() { 87 | *on = !*on; 88 | response.mark_changed(); 89 | } 90 | response.widget_info(|| { 91 | egui::WidgetInfo::selected(egui::WidgetType::Checkbox, ui.is_enabled(), *on, "") 92 | }); 93 | 94 | if ui.is_rect_visible(rect) { 95 | let how_on = ui.ctx().animate_bool(response.id, *on); 96 | let visuals = ui.style().interact_selectable(&response, *on); 97 | let rect = rect.expand(visuals.expansion); 98 | let radius = 0.5 * rect.height(); 99 | ui.painter().rect( 100 | rect, 101 | radius, 102 | visuals.bg_fill, 103 | visuals.bg_stroke, 104 | StrokeKind::Middle, 105 | ); 106 | let circle_x = egui::lerp((rect.left() + radius)..=(rect.right() - radius), how_on); 107 | let center = egui::pos2(circle_x, rect.center().y); 108 | ui.painter() 109 | .circle(center, 0.75 * radius, visuals.bg_fill, visuals.fg_stroke); 110 | } 111 | 112 | response 113 | } 114 | 115 | // A wrapper that allows the more idiomatic usage pattern: `ui.add(toggle(&mut my_bool))` 116 | /// iOS-style toggle switch. 117 | /// 118 | /// ## Example: 119 | /// ``` ignore 120 | /// ui.add(toggle(&mut my_bool)); 121 | /// ``` 122 | pub fn toggle(on: &mut bool) -> impl egui::Widget + '_ { 123 | move |ui: &mut egui::Ui| toggle_ui(ui, on) 124 | } 125 | -------------------------------------------------------------------------------- /src/update.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "self_update")] 2 | 3 | use self_update::self_replace; 4 | use self_update::update::Release; 5 | use semver::Version; 6 | use std::path::Path; 7 | use std::{env, fs, io}; 8 | 9 | const REPO_OWNER: &str = "hacknus"; 10 | const REPO_NAME: &str = "serial-monitor-rust"; 11 | const MACOS_APP_NAME: &str = "Serial Monitor.app"; 12 | 13 | /// method to copy the complete directory `src` to `dest` but skipping the binary `binary_name` 14 | /// since we have to use `self-replace` for that. 15 | fn copy_dir(src: &Path, dest: &Path, binary_name: &str) -> io::Result<()> { 16 | // Ensure the destination directory exists 17 | if !dest.exists() { 18 | fs::create_dir_all(dest)?; 19 | } 20 | 21 | // Iterate through entries in the source directory 22 | for entry in fs::read_dir(src)? { 23 | let entry = entry?; 24 | let path = entry.path(); 25 | let dest_path = dest.join(entry.file_name()); 26 | 27 | if path.is_dir() { 28 | // Recursively copy subdirectories 29 | copy_dir(&path, &dest_path, binary_name)?; 30 | } else if let Some(file_name) = path.file_name() { 31 | if file_name != binary_name { 32 | // Copy files except for the binary 33 | fs::copy(&path, &dest_path)?; 34 | } 35 | } 36 | } 37 | 38 | Ok(()) 39 | } 40 | 41 | /// Function to check for updates and return the latest one, if it is more recent than the current version 42 | pub fn check_update() -> Option { 43 | if let Ok(builder) = self_update::backends::github::ReleaseList::configure() 44 | .repo_owner(REPO_OWNER) 45 | .repo_name(REPO_NAME) 46 | .build() 47 | { 48 | if let Ok(releases) = builder.fetch() { 49 | let current_version = Version::parse(env!("CARGO_PKG_VERSION")).unwrap(); 50 | return releases 51 | .iter() 52 | .filter_map(|release| { 53 | let release_version_str = release 54 | .version 55 | .strip_prefix("v") 56 | .unwrap_or(&release.version); 57 | Version::parse(release_version_str) 58 | .ok() 59 | .map(|parsed_version| (parsed_version, release)) 60 | }) 61 | .filter(|(parsed_version, _)| parsed_version > ¤t_version) // Compare versions 62 | .max_by(|(a, _), (b, _)| a.cmp(b)) // Find the max version 63 | .map(|(_, release)| release.clone()); // Return the release 64 | } 65 | } 66 | None 67 | } 68 | 69 | /// custom update function for use with bundles 70 | pub fn update(release: Release) -> Result<(), Box> { 71 | let target_asset = if cfg!(target_os = "windows") { 72 | release.asset_for(self_update::get_target(), Some("exe")) 73 | } else if cfg!(target_os = "linux") { 74 | release.asset_for(self_update::get_target(), Some("bin")) 75 | } else { 76 | release.asset_for(self_update::get_target(), None) 77 | } 78 | .ok_or("No asset found")?; 79 | let tmp_archive_dir = tempfile::TempDir::new()?; 80 | let tmp_archive_path = tmp_archive_dir.path().join(&target_asset.name); 81 | let tmp_archive = fs::File::create(&tmp_archive_path)?; 82 | 83 | self_update::Download::from_url(&target_asset.download_url) 84 | .set_header(reqwest::header::ACCEPT, "application/octet-stream".parse()?) 85 | .download_to(&tmp_archive)?; 86 | 87 | self_update::Extract::from_source(&tmp_archive_path).extract_into(tmp_archive_dir.path())?; 88 | let new_exe = if cfg!(target_os = "windows") { 89 | let binary = env::current_exe()? 90 | .file_name() 91 | .unwrap() 92 | .to_str() 93 | .unwrap() 94 | .to_string(); 95 | tmp_archive_dir.path().join(binary) 96 | } else if cfg!(target_os = "macos") { 97 | let binary = env::current_exe()? 98 | .file_name() 99 | .unwrap() 100 | .to_str() 101 | .unwrap() 102 | .to_string(); 103 | let app_dir = env::current_exe()? 104 | .parent() 105 | .unwrap() 106 | .parent() 107 | .unwrap() 108 | .parent() 109 | .unwrap() 110 | .to_path_buf(); 111 | 112 | let app_name = app_dir 113 | .clone() 114 | .file_name() 115 | .unwrap() 116 | .to_str() 117 | .unwrap() 118 | .to_string(); 119 | 120 | let _ = copy_dir(&tmp_archive_dir.path().join(&app_name), &app_dir, &binary); 121 | 122 | // MACOS_APP_NAME either needs to be hardcoded or extracted from the downloaded and 123 | // extracted archive, but we cannot just assume that the parent directory of the 124 | // currently running executable is equal to the app name - this is especially not 125 | // the case if we run the code with `cargo run`. 126 | tmp_archive_dir 127 | .path() 128 | .join(format!("{}/Contents/MacOS/{}", MACOS_APP_NAME, binary)) 129 | } else if cfg!(target_os = "linux") { 130 | let binary = env::current_exe()? 131 | .file_name() 132 | .unwrap() 133 | .to_str() 134 | .unwrap() 135 | .to_string(); 136 | tmp_archive_dir.path().join(binary) 137 | } else { 138 | return Err("Running on unsupported OS".into()); 139 | }; 140 | 141 | self_replace::self_replace(new_exe)?; 142 | Ok(()) 143 | } 144 | -------------------------------------------------------------------------------- /wix/License.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\deff0\nouicompat{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset0 Courier New;}} 2 | {\colortbl ;\red0\green0\blue255;} 3 | {\*\generator Riched20 10.0.15063}\viewkind4\uc1 4 | \pard\sa180\qc\fs24\lang9 GNU GENERAL PUBLIC LICENSE\line Version 3, 29 June 2007\par 5 | 6 | \pard\sa180 Copyright (C) 2007 Free Software Foundation, Inc. {{\field{\*\fldinst{HYPERLINK http://fsf.org/ }}{\fldrslt{http://fsf.org/\ul0\cf0}}}}\f0\fs24 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.\par 7 | 8 | \pard\sa180\qc Preamble\par 9 | 10 | \pard\sa180 The GNU General Public License is a free, copyleft license for software and other kinds of works.\par 11 | The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.\par 12 | When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.\par 13 | To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.\par 14 | For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.\par 15 | Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.\par 16 | For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.\par 17 | Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.\par 18 | Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.\par 19 | The precise terms and conditions for copying, distribution and modification follow.\par 20 | 21 | \pard\sa180\qc TERMS AND CONDITIONS\par 22 | 23 | \pard\fi-360\li360\sa180\tx360 0.\tab Definitions.\par 24 | 25 | \pard\sa180 "This License" refers to version 3 of the GNU General Public License.\par 26 | "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.\par 27 | "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.\par 28 | To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.\par 29 | A "covered work" means either the unmodified Program or a work based on the Program.\par 30 | To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.\par 31 | To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.\par 32 | An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.\par 33 | 34 | \pard\fi-360\li360\sa180\tx360 1.\tab Source Code.\par 35 | 36 | \pard\sa180 The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.\par 37 | A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.\par 38 | The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.\par 39 | The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.\par 40 | The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.\par 41 | The Corresponding Source for a work in source code form is that same work.\par 42 | 43 | \pard\fi-360\li360\sa180\tx360 2.\tab Basic Permissions.\par 44 | 45 | \pard\sa180 All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.\par 46 | You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.\par 47 | Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.\par 48 | 49 | \pard\fi-360\li360\sa180\tx360 3.\tab Protecting Users' Legal Rights From Anti-Circumvention Law.\par 50 | 51 | \pard\sa180 No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.\par 52 | When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.\par 53 | 54 | \pard\fi-360\li360\sa180\tx360 4.\tab Conveying Verbatim Copies.\par 55 | 56 | \pard\sa180 You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.\par 57 | You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.\par 58 | 59 | \pard\fi-360\li360\sa180\tx360 5.\tab Conveying Modified Source Versions.\par 60 | 61 | \pard\sa180 You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:\par 62 | 63 | \pard 64 | {\pntext\f0 a.\tab}{\*\pn\pnlvlbody\pnf0\pnindent0\pnstart1\pnlcltr{\pntxta.}} 65 | \fi-360\li720\sa180 The work must carry prominent notices stating that you modified\lang1033 \lang9 it, and giving a relevant date.\par 66 | {\pntext\f0 b.\tab}The work must carry prominent notices stating that it is released under this License and any conditions added under section\lang1033 \lang9 7.\lang1033 \lang9 This requirement modifies the requirement in section 4 to\lang1033 \lang9 "keep intact all notices".\par 67 | {\pntext\f0 c.\tab}You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7\lang1033 \lang9 additional terms, to the whole of the work, and all its parts,\lang1033 \lang9 regardless of how they are packaged. This License gives no\lang1033 \lang9 permission to license the work in any other way, but it does not\lang1033 \lang9 invalidate such permission if you have separately received it. \par 68 | {\pntext\f0 d.\tab}If the work has interactive user interfaces, each must display\lang1033 \lang9 Appropriate Legal Notices; however, if the Program has interactive\lang1033 \lang9 interfaces that do not display Appropriate Legal Notices, your\lang1033 \lang9 work need not make them do so.\par 69 | 70 | \pard\sa180 A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.\par 71 | 72 | \pard\fi-360\li360\sa180\tx360 6.\tab Conveying Non-Source Forms.\par 73 | 74 | \pard\sa180 You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:\par 75 | 76 | \pard 77 | {\pntext\f0 a.\tab}{\*\pn\pnlvlbody\pnf0\pnindent0\pnstart1\pnlcltr{\pntxta.}} 78 | \fi-360\li720\sa180 Convey the object code in, or embodied in, a physical product\line (including a physical distribution medium), accompanied by the\line Corresponding Source fixed on a durable physical medium\line customarily used for software interchange.\par 79 | {\pntext\f0 b.\tab}Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no\line more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.\par 80 | {\pntext\f0 c.\tab}Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.\par 81 | {\pntext\f0 d.\tab}Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.\par 82 | {\pntext\f0 e.\tab}Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.\par 83 | 84 | \pard\sa180 A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.\par 85 | A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.\par 86 | "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.\par 87 | If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).\par 88 | The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.\par 89 | Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.\par 90 | 91 | \pard\fi-360\li360\sa180\tx360 7.\tab Additional Terms.\par 92 | 93 | \pard\sa180 "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.\par 94 | When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.\par 95 | Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:\par 96 | 97 | \pard 98 | {\pntext\f0 a.\tab}{\*\pn\pnlvlbody\pnf0\pnindent0\pnstart1\pnlcltr{\pntxta.}} 99 | \fi-360\li720\sa180 Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or\par 100 | {\pntext\f0 b.\tab}Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or\par 101 | {\pntext\f0 c.\tab}Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or\par 102 | {\pntext\f0 d.\tab}Limiting the use for publicity purposes of names of licensors or authors of the material; or\par 103 | {\pntext\f0 e.\tab}Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or\par 104 | {\pntext\f0 f.\tab}Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.\par 105 | 106 | \pard\sa180 All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.\par 107 | If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.\par 108 | Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.\par 109 | 110 | \pard\fi-360\li360\sa180\tx360 8.\tab Termination.\par 111 | 112 | \pard\sa180 You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).\par 113 | However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.\par 114 | Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.\par 115 | Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.\par 116 | 117 | \pard\fi-360\li360\sa180\tx360 9.\tab Acceptance Not Required for Having Copies.\par 118 | 119 | \pard\sa180 You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.\par 120 | 121 | \pard\fi-360\li360\sa180\tx360 10.\tab Automatic Licensing of Downstream Recipients.\par 122 | 123 | \pard\sa180 Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.\par 124 | An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.\par 125 | You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.\par 126 | 127 | \pard\fi-360\li360\sa180\tx360 11.\tab Patents.\par 128 | 129 | \pard\sa180 A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".\par 130 | A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.\par 131 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.\par 132 | In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.\par 133 | If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.\par 134 | If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.\par 135 | A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.\par 136 | Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.\par 137 | 138 | \pard\fi-360\li360\sa180\tx360 12.\tab No Surrender of Others' Freedom.\par 139 | 140 | \pard\sa180 If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.\par 141 | 142 | \pard\fi-360\li360\sa180\tx360 13.\tab Use with the GNU Affero General Public License.\par 143 | 144 | \pard\sa180 Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.\par 145 | 146 | \pard\fi-360\li360\sa180\tx360 14.\tab Revised Versions of this License.\par 147 | 148 | \pard\sa180 The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.\par 149 | Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.\par 150 | If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.\par 151 | Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.\par 152 | 153 | \pard\fi-360\li360\sa180\tx360 15.\tab Disclaimer of Warranty.\par 154 | 155 | \pard\sa180 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\par 156 | 157 | \pard\fi-360\li360\sa180\tx360 16.\tab Limitation of Liability.\par 158 | 159 | \pard\sa180 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\par 160 | 161 | \pard\fi-360\li360\sa180\tx360 17.\tab Interpretation of Sections 15 and 16.\par 162 | 163 | \pard\sa180 If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.\par 164 | 165 | \pard\sa180\qc END OF TERMS AND CONDITIONS\par 166 | \line How to Apply These Terms to Your New Programs\par 167 | 168 | \pard\sa180 If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.\par 169 | To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.\par 170 | \f1 \line Copyright (C) [copyright-year] [copyright-holder]\par 171 | \line This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\line\line This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\line\line You should have received a copy of the GNU General Public License along with this program. If not, see <{{\field{\*\fldinst{HYPERLINK "http://www.gnu.org/licenses/"}}{\fldrslt{http://www.gnu.org/licenses/\ul0\cf0}}}}\f1\fs24 >.\par 172 | \f0 Also add information on how to contact you by electronic and paper mail.\par 173 | If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:\par 174 | \f1 [product-name] Copyright (C) [copyright-year] [copyright-holder]\par 175 | This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details.\f0\par 176 | The hypothetical commands {\f1 'show w'} and {\f1 'show c'} should show the appropriate arts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box".\par 177 | You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see {{\field{\*\fldinst{HYPERLINK http://www.gnu.org/licenses/ }}{\fldrslt{http://www.gnu.org/licenses/\ul0\cf0}}}}\f0\fs24 .\par 178 | The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read {{\field{\*\fldinst{HYPERLINK http://www.gnu.org/philosophy/why-not-lgpl.html }}{\fldrslt{http://www.gnu.org/philosophy/why-not-lgpl.html\ul0\cf0}}}}\f0\fs24 .\par 179 | } 180 | 181 | -------------------------------------------------------------------------------- /wix/main.wxs: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 70 | 71 | 81 | 82 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 101 | 102 | 107 | 108 | 109 | 110 | 111 | 119 | 120 | 121 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 157 | 158 | 159 | 160 | 161 | 170 | 174 | 175 | 176 | 177 | 178 | 184 | 185 | 186 | 187 | 188 | 196 | 197 | 198 | 199 | 200 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 234 | 235 | 236 | 237 | 238 | 239 | 243 | 244 | 245 | 246 | 254 | 255 | 256 | 257 | 265 | 266 | 267 | 268 | 269 | 270 | --------------------------------------------------------------------------------