Examples
Decoding of Asterix Messages
0 char msg[1000]; // Replace the 1000 with whatever the maximum expected size is
1 // it is assumed the socked is set up properly
2 socket.receive( msg, 1000 );
3 // In reality this needs some sanity checks and error handlig
4 int cat = static_cast<unsigned char>( msg[0] );
0 #include <deque>
1 #include <map>
2 #include <memory>
3 #include <iostream>
4 #include "AsterixCategory021.h"
5
6 int main( int argc, char* argv[] ){
7 std::deque<char> message( msg[2], msg[msg.size()-1] );
8 AsterixCategory021 astx = AsterixCategory021( message.size(), message );
9
10 // No access some items of the message
11 if( astx.isItemPresent( Cat021ItemNames::I021_010 ) ){
12 std::cout<<"Item 010 SAC/SIC is present SAC: " << astx.getValue( Cat021ItemNames::I021_010_SAC )
13 << " SIC: " << getValue( Cat021ItemNames::I021_010_SIC ) <<std::endl;
14 }
15 return 0;
16 }
Encoding of Asterix Messages
0 #include <memory>
1 #include <map>
2 #include "AsterixCategory062.h"
3 #include "TrackTypesIf.h"
4 #include "AsterixItemMaxAges.h"
5 #include "DetectionEntry.h"
6
7 int main( int argc, char* argv[] ){
8 AsterixCategory062 message = AsterixCategory062();
9
10 // Define the input items and add them to the message
11 std::shared_ptr<TrackTypesIf> track = std::make_shared<TrackTypesIf>();
12 std::map<std::string, unsigned char> additional_items;
13 additional_items[Cat062ItemNames::I062_010_SAC] = (unsigned char) 1;
14 additional_items[Cat062ItemNames::I062_010_SIC] = (unsigned char) 2;
15 message.setNonTrackRelatedValues( additional_items );
16
17 // Determine which items shall be contained in the message
18 std::map<std::string, bool> items_to_be_served;
19 items_to_be_served[Cat062ItemNames::I062_010] = true;
20
21 std::shared_ptr<AsterixItemMaxAges> max_ages;
22 max_ages = std::make_shared<AsterixItemMaxAges>();
23 max_ages->setMaxAgePerType( DetectionEntry::DET_TYPE::ADS_B, 10.0 );
24 max_ages->setMaxAgePerType( DetectionEntry::DET_TYPE::PSR, 10.0 );
25
26 // Encode the message
27 std::vector<unsigned char> msg = message.getEncodedMessage( track, items_to_be_served, max_ages );
28
29 return 0;
30 }
Further Reading
Asterix Lib availabe
The initial version of the Asterix Library is now available in the download section. In addition to that the git [...]
Two Projects Under One Roof
During the initial development of the FixMPTS software component, it became more and more clear, that the entire package should [...]
Launch of site
Although the project existed already for quite some time it is only presented to the public as of this moment. [...]