The SDK C++ API provides an object-based interface for controlling/configuring the radar and for processing incoming data.
Communication to the radar is asynchronous: * Outgoing messages are encapsulated within API calls. The parameters provided to the functions are used to populate Colossus messages, which are sent to the sensor. * Incoming messages from the sensor invoke callbacks. Each (supported) incoming message will have a callback function object associated with it. The callback is passed a (shared) pointer to the received data.
The API handles all endianness and encoding required by the Colossus protocol; removing the need from the client.
Connecting to the sensor
The steps involved in connecting and getting data are as follows:
Setup your radar client and hook up the message and connection events:
Code Block |
---|
#include "radar_client.h"
int main()
{
Navtech::Radar_client radar_client { "127.0.0.1"_ipv4 };
// See below for details on message handler callbacks
//
radar_client.set_configuration_data_callback(config_handler);
radar_client.set_fft_data_callback(fft_handler);
...
} |
Connect to the radar:
Code Block |
---|
int main()
{
Navtech::Radar_client radar_client { "127.0.0.1"_ipv4 };
radar_client.set_configuration_data_callback(config_handler);
radar_client.set_fft_data_callback(fft_handler);
// Connect to the radar
//
radar_client.start();
} |
On successful connection you will receive a Configuration message with details of the radar's current configuration. So you must have the handler setup before you connect.
Message handler callbacks
An incoming Colossus message will be unmarshalled and stored in a message-specific structure.
Each structure also defines a pointer type (usually a std::shared_ptr
). This pointer type is used to allocate, and then access, the structure object created from the incoming Colossus message.
The message handler callback must be a Callable Type - a function, a member-function, a function-object or a lambda expression.
The signature of the Callable Type for a data item of type Message_Ty
depends on the type of the Colossus message being received; for example:
Code Block |
---|
void (*callback_fn_ptr)( // Configuration data
const Configuration_data::Pointer&,
const Configuration_data::ProtobufPointer&
);
void (*callback_fn_ptr)(const Fft_data::Pointer&); // FFT data
void (*callback_fn_ptr)(const std::vector<std::uint8_t>&); // Raw FFT data |
WherePointer
is the message structure-specific pointer type.
For example:
Code Block |
---|
void config_handler(
const Configuration_data::Pointer& data,
const Configuration_data::ProtobufPointer& protobuf_config
)
{
// Process incoming configuration...
} |
Once connected and you have the config data, tell the radar to start sending FFT Data:
Code Block |
---|
radar_client.start_fft_data(); |
You must provide a incoming FFT Data:
Code Block |
---|
void fft_handler(const Fft_data::Pointer& data)
{
// Process incoming FFT data...
} |
When you need to disconnect, firstly stop the FFT Data:
Code Block |
---|
radar_client.stop(); |
Then unbind the data handlers:
Code Block |
---|
radar_client.set_fft_data_callback();
radar_client.set_configuration_data_callback(); |
Then disconnect:
Code Block |
---|
radar_client.stop(); |
The file testclient_main.cpp
contains an example of basic configuration and FFT data processing operations. It can be used as the basis for more complex applications.
...
C++ Source Code
This code is a series of classes developed using C++ 11. We have provided the The source code so for end users can to easily integrate the code into their application, regardless of the platform they are targeting. target platform, is available at https://bitbucket.org/navtechradar/iasdk-public/src/master/cpp/
The code targets the following compilers:
GCC 4.8 and above
Visual Studio 2015 (VC++ 2015 libraries)
The code and documentation is available through an online Git repository. Access will be made available once a customer has purchased an sensor.
...