1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//
// Copyright (c) 2025, Astute Systems PTY LTD
//
// This file is part of the VivoeX SDK project developed by Astute Systems.
//
// See the commercial LICENSE file in the project root for full license details.
//
//! 
//!
//! # CoT Library
//!
//! CoT is a library for sending Cursor on Target (CoT) messages over various transport protocols.
//!
//! 
//! **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
//!
//! ``` rust
//! 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.
//!
//! ``` compile_fail ignore
//! // 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
//!
//! * WinTAK [download](https://www.civtak.org/download-atak) for civilian applications (Windows)
//! * ATAK-CIV for [Android devices](https://play.google.com/store/apps/details?id=com.atakmap.app.civ)
//! * iTAK for [iOS devices](https://apps.apple.com/us/app/itak/id1561656396)
//!
// pub mod push_cot;
include!;