libexail 0.1.0

A rust library for communicating with Exail devices through their binary protocol
Documentation
# libexail

A Rust library for communicating with [Exail](https://www.exail.com/) (formerly iXblue) devices using their
standard binary protocol (StdBin). Supports INS/AHRS products such as Marins M9,
M7, and Atlans A7.

The protocol definition is based on the iXblue reference implementations:

- [`ixblue_stdbin_decoder`]https://github.com/ixblue/ixblue_stdbin_decoder — C++ parsing library
- [`ixblue_ins_stdbin_driver`]https://github.com/ixblue/ixblue_ins_stdbin_driver — ROS driver

## Supported Data Blocks

### Navigation Blocks (bits 0-30)

- **AttitudeHeading** — Heading, roll, pitch in vessel frame
- **AttitudeHeadingStdDev** — Attitude standard deviations
- **HeaveSurgeSway** — Real-time heave, surge, and sway
- **SmartHeave** — Delayed heave (100s from real time)
- **HeadingRollPitchRate** — Heading, roll, and pitch rates
- **RotationRateVesselFrame** — Compensated rotation rates
- **AccelerationVesselFrame** — Compensated acceleration
- **Position** — WGS84 position at selected lever arm
- **PositionStdDev** — Position standard deviations
- **SpeedGeographic** — Speed in geographic frame
- **SpeedStdDev** — Speed standard deviations
- **CurrentGeographic** — Current in geographic frame
- **CurrentStdDev** — Current standard deviations
- **SystemDate** — Internal or ZDA date
- **SensorStatus** — INS/AHRS sensor status words
- **InsAlgorithmStatus** — INS algorithm status (V5: 16 bytes, V6: 24 bytes)
- **InsSystemStatus** — INS system status words
- **InsUserStatus** — INS user status word
- **AhrsAlgorithmStatus** — AHRS algorithm status word
- **AhrsSystemStatus** — AHRS system status words
- **AhrsUserStatus** — AHRS user status word
- **HeaveSurgeSwaySpeed** — Heave, surge, sway speeds
- **SpeedVesselFrame** — Speed in vessel frame
- **AccelerationGeographic** — Acceleration in geographic frame
- **CourseSpeedOverGround** — Course and speed over ground
- **Temperatures** — FOG, accelerometer, and board temperatures
- **AttitudeQuaternion** — Attitude as quaternion
- **AttitudeQuaternionStdDev** — Quaternion error standard deviations
- **RawAccelerationVesselFrame** — Raw acceleration (not gravity-compensated)
- **AccelerationStdDev** — Acceleration standard deviations
- **RotationRateStdDev** — Rotation rate standard deviations

### Extended Navigation Blocks (bits 0-7)

- **RotationAccelerationVesselFrame** — Rotation acceleration
- **RotationAccelerationStdDev** — Rotation acceleration standard deviations
- **RawRotationRateVesselFrame** — Raw rotation rate (not Earth-compensated)
- **VehicleAttitudeHeading** — Vehicle attitude (turret feature)
- **VehicleAttitudeHeadingStdDev** — Vehicle attitude standard deviations
- **VehiclePosition** — Vehicle position (turret feature)
- **VehiclePositionStdDev** — Vehicle position standard deviations
- **SetAndDrift** — Water current set and drift

### External Sensor Blocks (bits 0-28)

- **UTC** — UTC time data
- **GNSS1/GNSS2/ManualGNSS** — GNSS position data
- **EMLOG1/EMLOG2** — Electromagnetic log speed
- **USBL1/USBL2/USBL3** — Ultra-short baseline position
- **Depth** — Depth sensor data
- **DVL1/DVL2 Ground/Water Speed** — Doppler velocity log
- **SoundVelocity** — External sound velocity
- **DMI** — Distance measurement instrument
- **LBL1-LBL4** — Long baseline beacon ranges
- **EventMarkerA/B/C** — Event markers
- **TurretAngles** — Turret heading, roll, pitch
- **VTG1/VTG2** — Track made good and ground speed
- **LogBook** — Log book entries
- **Date** — Date data

## Protocol Details

### Frame Structure

```text
[Sync1][Sync2][Version][Bitmask][Data Blocks][Checksum]
```

- **Sync bytes**: `IX` (navigation/input data), `CM` (command), `AN` (answer)
- **Big-endian**: All multi-byte values
- **Checksum**: XOR-based 32-bit checksum
- **Protocol versions**: 2-6

## Examples

### File Reader

Parse Exail frames from a binary file:

```bash
cargo run --example read_file -- recording.bin
cargo run --example read_file -- -v recording.bin  # verbose
```

### TCP Stream Reader

Read Exail frames from a TCP connection:

```bash
cargo run --example stream_reader 192.168.1.100 8080
cargo run --example stream_reader localhost 4001
```

### UDP Reader

Listen for Exail datagrams on a UDP port:

```bash
cargo run --example udp_reader 8080
cargo run --example udp_reader -- -v 8080  # verbose
```

## Testing

```bash
cargo test
```