/* szModuleName__ []  = "a:/nordrad/unix/api.h" */
/* szLastVersion []   = "Version 0.7" */
/* szLastSave []      = "1997-02-05*22:34" */
/***********************************************************************
Abstract
api.h - API interface definitions for users.

(C) Copyright AU-System Communication AB 1994.

Change activity	
1997-02-05      ARG  Define constants for BUFR_mode
1994-11-22      ARG  Define constants for product descriptor variables
1994-01-24 1.00 BBN  Initial version by Bjorn Brodin

Description

***********************************************************************/

#include "apitypes.h"
#include "nraderr.h"



#define MAX_PIX_VALUES    255
#define CLASS_TAB_MAX 20
  
#define MAX_FILE_NAME_SIZE  130
#define MAX_ACCESSCTRL_SIZE 46
#define MAX_AREANAME_SIZE   10
#define MAX_COMMENT_SIZE    36
#define MAX_NODENAME_SIZE   8
#define MAX_VSINAME_SIZE    12
#define MAX_RECEIVERID_SIZE 12
#define POS_SIZE            15

#define MAX_HOSTNAME_SIZE    80
 
/* static INT32 iTmpRc; Not always used */   /* used as temp err storage  */
                         
struct ApiProdDescrStruc
  {
  unsigned char bProd;
  char          cTimeStr[24];
  char          cArea[MAX_AREANAME_SIZE];
  INT32           iResolution;
  union ApiSpecDataUni
    {
    struct ApiForeignStruc
      {
      char cComment[MAX_COMMENT_SIZE];  
      }Foreign;    
    struct ApiGeoMapStruc
      {
      unsigned char bMapType;
      unsigned char bMapGraphic;  
      }GeoMap;
    struct ApiRrStatusStruc
      {
      char cStatusNode[MAX_NODENAME_SIZE];  
      }RrStatus;    
    struct ApiRrTypesStruc
      {
      unsigned char bRrMode;  
      union ApiuRr
        {
        struct ApiRrCappiStruc
          {    
          INT32 iHeight;
          }RrCappi;    
        struct ApiRrHMIStruc
          {    
          unsigned char bHmiWall;
          }RrHmi;
        struct ApiRrVSIStruc
          {    
          unsigned char bVsiWall;
          char  cStartLat[POS_SIZE];
          char  cStartLong[POS_SIZE];
          char  cEndLat[POS_SIZE];
          char  cEndLong[POS_SIZE];
          char  cVsiName[MAX_VSINAME_SIZE];  
          }RrVsi;    
        struct ApiDurationStruc
          {
          INT32  iDays;
          INT32  iSecs;    
          }Duration;  
         }uRr;
      }RrType; /*   struct RrTypesStruc  */
    }uData; 
  }; 

struct ApiAviStruc        
  {
  char cNodeName[MAX_NODENAME_SIZE];  
  struct ApiProdDescrStruc ApiProdDescr;  
  };


struct SearchCritStruc
  {
  unsigned char bName;
  unsigned char bTime;
  unsigned char bArea;
  unsigned char bResolution;   
  };  

/* typedef  enum  boolean={FALSE,TRUE}; */
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE  1
#endif

/* pack algoritms */
#define NONE 1
#define RLE  0

#define GET_INT_TYPE   0
#define GET_STR_TYPE   1
#define GET_FLOAT_TYPE 2

/* Product type (bProd) */
#define PROD_NONE            0
#define PROD_FOREIGN         1
#define PROD_GEOMAP          2
#define PROD_RRSTATUS        3
#define PROD_RRPPI_Z         4
#define PROD_RRPPI_W         5
#define PROD_RRPPI_T         6
#define PROD_RRCAPPI_Z       7
#define PROD_RRCAPPI_W       8
#define PROD_RRCAPPI_T       9
#define PROD_RRPSC_Z         10
#define PROD_RRPSC_W         11
#define PROD_RRPSC_T         12
#define PROD_RRETM_Z         13
#define PROD_RRVMI_Z         14
#define PROD_RRVMI_W         15
#define PROD_RRVMI_T         16
#define PROD_RRHMI_Z         17
#define PROD_RRHMI_W         18
#define PROD_RRHMI_T         19
#define PROD_RRHMAX_Z        20
#define PROD_RRHMAX_W        21
#define PROD_RRHMAX_T        22
#define PROD_RRVSI_Z         23
#define PROD_RRVSI_W         24
#define PROD_RRVSI_T         25
#define PROD_RRSRT_Z         26
#define PROD_RRSRI_Z         27
#define PROD_MAXVALUE        27
#define PROD_DEFAULT         0

/* bRrMode */
#define DOPPLER		1
#define NODOPPLER	2

/* bMapType */
#define DONTCARE	0
#define ROAD		1
#define LAKE		2
#define CONTOUR		3
#define FLIGHT		4
#define SITE		5

/* bMapGraphic */
#define RASTER	    0
#define VECTOR	    1

/* AreaWall (bHmiWall, bVsiWall) */
#define SOUTH		0
#define NORTH		1
#define EAST		2
#define WEST		4

/*search criteria values (bName, bTime, bArea, bResolution) */
#define CRIT_NONE		0
#define CRIT_WEAK		1
#define CRIT_MEDIUM		2
#define CRIT_STRONG		3
#define CRIT_EXACT		4

/* BUFR mode */
#define BUFR_4			0
#define BUFR_8			1

extern void    GetProduct(char                     *pAccessCtrl,
                          char                     *pHostName,
                          struct ApiAviStruc       *pApiAvi, 
                          char                     *pDestFile,
                          INT32                    iWaitTime,                          INT32                    *piStatus);
extern void   StoreProduct(char                   *pAccessCtrl,
                          char                     *pHostName,
                          struct ApiProdDescrStruc *pProdDescr,
                          char                     *pFileName,
                          INT32                    iWaitTime,
                          INT32                    *piStatus);
extern void   SearchProduct(char                  *pAccessCtrl,
                             char                  *pHostname,
                             struct ApiProdDescrStruc *pProdDescr,
                             struct SearchCritStruc *pSearchCrit,
                             char                   *pSearchLimFile,
                             char                   *pDestFileName,
                             INT32                  iWaitTime,
                             INT32                  *piStatus);
extern void  SubscribeAvi(char *pAccessCtrl,
                          char *pHostName,
                          char *pReceiverId,
                          INT32  iWaitTime,
                          INT32  *pSubscrSock,
                          INT32  *piStatus);    
extern void  ReceiveAvi(INT32 SubscrSockh,
                        struct ApiAviStruc  *pAvi,
                        INT32 iWaitTime,
                        INT32 *piStatus);
extern void  CancelAvi(INT32 SubscrSockh);
extern void Import_BUFR(char *pBufferFileStr,
			char *pDestFileStr,
                        char *pInParamFileStr,
			char *pOutParamFileStr,
                        unsigned char PackAlg,
                        struct ApiProdDescrStruc *pApiProdDescr,
                        INT32 *piStatus);
extern void Export_BUFR(char *pBufferFileStr,
			char *pDestFileStr,
                        char *pParamFileStr,
                        unsigned char BufrMode,
			INT32 *piStatus);
extern void Convert_Dbz_To_SRI(char *pSourceFileNameStr,
			       char *pDestFileNameStr,
			       char *pParamFileStr,
			       unsigned char bPackAlg,
			       struct ApiProdDescrStruc *pApiProdDescr,
			       INT32 *piStatus);

extern void Pack(char *pSourceFile,
		 char *pDestFile,
		 unsigned char bPackAlg,
		 INT32 *piStatus);

extern void UnPack(char *pSourceFile,
		   char *pDestFile,
		   unsigned char bPackAlg,
		   INT32 *piStatus);

