Crate cottak

Expand description

TAK Logo

§CoT Library

CoT is a library for sending Cursor on Target (CoT) messages over various transport protocols.

TAK Brisbane Example TAK displaying GTFS Realtime data for Brisbane

§Cursor on Target (CoT) Messages

Cursor on Target (CoT) is a data format used for real-time data exchange between systems. It is primarily used in military and emergency response applications to share situational awareness information. CoT messages are XML-based and contain information about events, such as the location, type, and time of the event.

§Usage with TAK Servers and Clients

TAK (Tactical Assault Kit) servers and clients use CoT messages to communicate and share situational awareness data. TAK servers aggregate CoT messages from various sources and distribute them to connected clients. TAK clients, such as ATAK (Android Team Awareness Kit), display the received CoT messages on a map, providing users with real-time situational awareness.

This library provides the necessary tools to create, send, and receive CoT messages over different transport protocols, enabling seamless integration with TAK servers and clients.

§Example

To send a CoT message using this library, you can follow the example below:

§XML

use cot::config::Config;
use cot::cot::{CursorOnTarget, Point};
use cot::cot_types::{CoTType, CotClassification};
use cot::udp_sender::UdpSender;

// Brisbane City Hall
const LONGITUDE: f64 = 153.02351661489064;
const LATITUDE: f64 = -27.46891737509902;

// ...

// Read the configuration file
let config = Config::from_file(&Config::get_config_file_path()).expect("Failed to read config file");

// Setup classification of the CoT message
let cot_type = cot::cot_types::lookup_cot_type(CoTType::GndBuilding, CotClassification::Friend);

// Brisbane City Hall
let cot = CursorOnTarget::new(
    Some("No Remarks".to_string()),                    // remarks
    Some("CITY_#89436".to_string()),                   // uid
    Some("BRISBANE_CITY_HALL".to_string()),            // callsign
    Some(cot_type.to_string()),                        // type
    Point {
       longitude: LATITUDE,                            // latitude
       latitude: LONGITUDE,                            // longitude
       hae: cot::cot::HAE_NONE,                        // hae
       ce: cot::cot::CE_NONE,                          // ce
       le: cot::cot::LE_NONE,                          // le
    },
    false,                                             // military
    Some("".to_string()),                              // squawk
    Some(0.0),                                         // speed
    Some(0.0),                                         // battery
    None,                                              // link
    Some(0.0),                                         // heading
    Some(0.0),                                         // vertical_rate
    Some(0),                                           // last_seen
    None,                                              // video
);

// Create a UDP sender
let xml = UdpSender::new(&config.udp.address as &str, config.udp.port)
    .expect("Couldn't setup multicast");

// Send the CoT message
xml.send(&cot.get_xml_bytes()).expect("Failed to send CoT message");

UDP sender is shown above but it is also possible to use tcp_sender::TcpSender for TCL or ssl_sender::SslSender as the transport protocol. XML is compliant to version 1 of the CoT schema. You can use version 2 (protobuf) by requesting the protobuf method on the cot object and sending the bytes to the proto_sender.

§Protobuf

Example using protobuf sender is the same as for XML example above except we use the proto_sender::ProtoSender instead of the UDP sender.

// Create a Protobuf sender
let mut proto = ProtoSender::new(&config.udp.address as &str, config.udp.port)
    .expect("Couldn't setup multicast");

// Send the CoT message
proto.send(&cot).expect("Failed to send CoT message");

§More information

Modules§

chat
Create a chat message protobuf object.
config
Configuration module (read from TOML)
contact
Generated file from contact.proto
cot
Create a generic XML/protobuf object.
cot_base
The basic CoT message structure used by all CoT messages.
cot_bullseye
Create a bullseye XML/protobuf object.
cot_casevac
Create a casevac XML/protobuf object.
cot_circle
Create a circle XML/protobuf object.
cot_geofence
Create a geofence XML/protobuf object.
cot_measure
This module contains a TAK package creator.
cot_navigation
Create a navigation XML/protobuf object.
cot_sensor
Create a sensor XML/protobuf object.
cot_types
This module contains the types used in the Cursor on Target Data (CoT) messages.
cotevent
Generated file from cotevent.proto
data_package
This module contains a TAK package creator.
detail
Generated file from detail.proto
group
Generated file from group.proto
host
This module contains system information functions.
http_file_server
This module contains a simple HTTP file server.
nmea
This module contains system information functions.
precisionlocation
Generated file from precisionlocation.proto
proto_sender
Functions for sending CursorOnTarget messages via UDP protobuf CoT Version 1
ssl_sender
Send data using SSL secure connection
status
Generated file from status.proto
takcontrol
Generated file from takcontrol.proto
takmessage
Generated file from takmessage.proto
takv
Generated file from takv.proto
tcp_sender
Send data using TCP connection
time
Time utility and helper functions
track
Generated file from track.proto
udp_receiver
Receive data using UDP connection
udp_sender
Send data using UDP connection
version
This file is generated by build.rs Do not edit this file manually