/*
 * sfp_dsp_ris.h
 *
 */

#ifndef SFP_DSP_RIS_H_
#define SFP_DSP_RIS_H_

#include "DspHeaderResults.h"

#include "sfp/sfp_types.h"
#include "sfp/sfp_helper.h"

namespace SFP_RIS
{

enum ris_chunk_tags_t
{
	tag_sts_scenario='S',
	tag_targets_db='T',

	tag_header='H',
};

struct scenario_t
{
	uint32_t timetag;

	uint32_t flags;
	uint32_t mode;

	uint32_t spare_[8-(2+3)];

	uint32_t cc_cookie;

	uint32_t nav_timetag;
	uint32_t nav_invalidity; //real time mask of nav_validity_flags_t;
        enum nav_invalidity_flags_t
        {
            nav_geopos_invalid=(1<<0),
            nav_altitude_invalid=(1<<1),
            nav_attitude_invalid=(1<<2)
        };


	float platform_azimuth;
	float vx;
	float vy;
	float vz;
	float baro_altitude;

	float true_heading;
	float latitude;
	float longitude;

	float ant_nav_az;
	float ant_nav_el;

	uint32_t spare[16-9];
};

struct target_status_t
{
	uint32_t flags;

	float heading;

	float x;
	float y;
	float z;

//	float vx;
//	float vy;
//	float vz;

	uint32_t spare[8-5];

};

enum { k_max_tgt=32};

struct target_db_t
{
	uint32_t flags;
	target_status_t tgt[k_max_tgt];
};

struct status_payload_t
{
	SFP::data_tag_t scenario_tag;
	scenario_t scenario;

	SFP::data_tag_t target_tag;
	target_db_t tgt;
};

struct status_message_t
{
	SFP::frag_header_t header;
	status_payload_t payload;
};

struct cc_sync_payload_t
{
    uint32_t flags;  //=0; don't reply immediately
    uint32_t cc_cookie;
    uint32_t ris_timetag;
    int32_t tx_period_ms;
};

struct cc_ctrl_data_t
{
    uint32_t features;
    enum features_t
    {
        feat_disable=(1<<0),
        feat_tgt_inject_signal=(1<<1),
        feat_map_inject_signal=(1<<2)
    };
    uint32_t spare[32-(1+6)];
};

struct script_payload_t
{
    //uint32_t ctrl[32];
    SFP::data_tag_t sync_tag; //TAG="SY", 2w
    cc_sync_payload_t sync;

	SFP::data_tag_t ctrl_tag;
    cc_ctrl_data_t ctrl;

	SFP::data_tag_t script_tag;
	int8_t script[1024];
};

struct script_message_t
{
	SFP::frag_header_t header;
	script_payload_t payload;
};



}


#endif /* SFP_DSP_RIS_H_ */
