#ifndef COMMON_DATA_BASIC_TYPE_H
#define COMMON_DATA_BASIC_TYPE_H

/************************** Include *******************************************/

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/************************** Macro *********************************************/
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef signed long long int64_lt;
typedef unsigned long long uint64_lt;
typedef char char_t;
typedef float float32_t;
typedef double float64_t;

#ifndef VOID
#define VOID void
#endif
#ifndef BOOL
#define BOOL bool
#endif
#ifndef CONST
#define CONST const
#endif
#ifndef TRUE
#define TRUE true
#endif
#ifndef FALSE
#define FALSE false
#endif

/*-------#endif------------------------ CONSTANTS ----------------------------------*/

/* min-max-constants for integer data types */
#ifndef UINT8_MAX
#define UINT8_MAX ((uint8_t)255)
#endif
#ifndef UINT8_MIN
#define UINT8_MIN ((uint8_t)0)
#endif
#ifndef SINT8_MAX
#define SINT8_MAX ((int8_t)127)
#endif
#ifndef SINT8_MIN
#define SINT8_MIN ((int8_t)-128)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX ((uint16_t)65535)
#endif
#ifndef UINT16_MIN
#define UINT16_MIN ((uint16_t)0)
#endif
#ifndef SINT16_MAX
#define SINT16_MAX (me_data_read_ptr_(int16_t) 32767)
#endif
#ifndef SINT16_MIN
#define SINT16_MIN ((int16_t)-32768)
#endif
#ifndef UINT32_MAX
#define UINT32_MAX (0xffffffffUL)
#endif
#ifndef UINT32_MIN
#define UINT32_MIN ((uint32_t)0)
#endif
#ifndef SINT32_MAX
#define SINT32_MAX ((int32_t)2147483647L)
#endif
#ifndef SINT32_MIN
#define SINT32_MIN ((int32_t)(-2147483647L - 1))
#endif
#ifndef FLOAT32_MAX
#define FLOAT32_MAX ((float32_t)3.402823466e+38)
#endif
#ifndef FLOAT32_MIN
#define FLOAT32_MIN ((float32_t)-3.402823466e+38)
#endif
#ifndef FLOAT32_EPSILON
#define FLOAT32_EPSILON ((float32_t)0.000001)
#endif
#ifndef FLOAT32_ZERO
#define FLOAT32_ZERO ((float32_t)0)
#endif
#ifndef FLOAT64_EPSILON
#define FLOAT64_EPSILON ((float64_t)0.000001)
#endif
#ifndef FLOAT64_ZERO
#define FLOAT64_ZERO ((float64_t)0)
#endif

#ifndef NULL
#define NULL (0)
#endif

#ifndef PTR_INVALID
#define PTR_INVALID NULL
#endif

#ifndef NULL_POINTER
#define NULL_POINTER(type) ((type *)PTR_INVALID)
#endif

#ifndef VOID
#define VOID void /* Data type specifier "void"   */
#endif

#define PI ((float32_t)3.1415926)

#define ZONE_MIN(x, y) (((x) > (y)) ? (y) : (x))
#define ZONE_MAX(x, y) (((x) < (y)) ? (y) : (x))

// add by zhang fang begin 20210317
// #define   a      (6378245.0)
// #define   ee     (0.00669342162296594323)
// #define   pi     (3.1415926535897932384626)
const static float32_t a = 6378245.0;
const static float64_t ee = 0.00669342162296594323;
const static float64_t pi = 3.1415926535897932384626;
// add by zhang fang end 20210317

/************************** Struct And Enum **********************************/

typedef enum { kZoneReturnOk = 0, kZoneReturnErr = -1, kZoneTimeout = -2, kZoneInvalidParam = -3, kZoneNotInitialized = -4 } ZoneRtrType;

/************************** Inline Function Definition ************************/

/************************** External Variable Decleration  ********************/

/************************** External Function Decleration *********************/

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* COMMON_DATA_BASIC_TYPE_H */
