A modern, type-safe Swift 6.0 library for generating GNSS ranging codes across multiple constellations.
This project is a high-performance port of the Oriental AI C library.
- Swift-Native Architecture: Built from the ground up for Swift 6.0, leveraging enums for type safety and Swift Package Manager (SPM) for seamless integration.
- Multi-Constellation Support:
- GPS: L1 C/A, L1C (Pilot/Data/Overlay), L2C (CM/CL), L5 (I/Q)
- Galileo: E1B/C, E5a (I/Q), E5b (I/Q)
- GLONASS: G1 (C/A)
- BeiDou: B1I
- Memory Safe: Replaces manual C memory management with Swift's automatic memory management and safe array buffers.
- Bit-Perfect Parity: Verified against the original C library and reference Matlab data.
- Rich Documentation: Integrated DocC support for browsable API documentation.
Add the package to your Package.swift dependencies:
dependencies: [
.package(url: "https://github.com/shuwang1/libgnss-codes-swift.git", from: "1.0.0")
]import GNSSCodes
// Generate GPS L1 C/A chips for PRN 1
if let code = GNSSCodes.generate(prn: 1, type: .L1CA) {
print("Signal: GPS L1 C/A")
print("Length: \(code.length) chips")
print("Rate: \(code.chipRate / 1e6) MHz")
print("First 5 chips: \(code.chips.prefix(5))")
}
// Generate Galileo E1B chips for PRN 10
if let galileo = GNSSCodes.generate(prn: 10, type: .E1B) {
// Process Galileo chips...
}- Installation & Setup: See INSTALL.md for detailed setup and build instructions.
- Verification: Run
swift testto execute the comprehensive test suite. - API Reference: Generate documentation with
swift package generate-documentation. - CI/CD: Automated builds and tests are performed via GitHub Actions on every push to
main. Documentation is automatically deployed to GitHub Pages.
- SIMD Optimization: Currently, chips are represented as
[Int16]. Transitioning to bit-packed[UInt64]with SIMD-accelerated correlation is planned for a future release. - Extended Constellation Support: Porting of additional signals (e.g., L1 SBAS, NH10/20 integration) is ongoing.
- Resource Management: Galileo binary resources are currently bundled. Exploring dynamic downloading or more compact packing formats to reduce initial clone size.
2016 All Rights Reserved by Shu Wang shuwang1@outlook.com
This project is licensed under the same terms as the original libgnss-codes library. See the LICENSE file (if available) or contact Shu Wang shuwang1@outlook.com.
Original C implementation by Shu Wang. Swift port and optimization developed as part of Orientable AI internel C project.