📄 datatype.h
字号:
// ---------------------------------------------
// Definitions derived from IEEE 1451.2 Standard
// ---------------------------------------------
// Section 3.3 - Data Types
// ------------------------
// 3.3.1 Unsigned byte (8-bit) integer.
//
typedef unsigned char U8C; // ... counting (3.3.1.1)
typedef unsigned char U8E; // ... enumeration (3.3.1.2)
typedef unsigned char U8L; // ... field length (3.3.1.3)
// 3.3.2 Unsigned 16-bit integer.
//
typedef unsigned int U16C; // ... counting (3.3.2.1)
typedef unsigned int U16E; // ... enumeration (3.3.2.2)
typedef unsigned int U16L; // ... field length (3.3.2.3)
// 3.3.3 Unsigned 32-bit integer.
//
typedef unsigned long U32C; // ... counting (3.3.3.1)
typedef unsigned long U32L; // ... field length (3.3.3.2)
// 3.3.4 Single Precision Real (32-bit).
//
typedef float F32;
// 3.3.5 Double Precision Real (64-bit).
//
typedef double F64;
// 3.3.6 String Type
// (NOTE: The number of bytes per character in each STRING type
// is defined in the LANG structure [see 3.3.7].
// The base type for STRING must be 'unsigned char' as
// each character will be represented by at least one byte.)
//
typedef unsigned char STRING;
// 3.3.7 String Language Specification (3 bytes)
//
typedef struct {
U8E StringCharacterSet;
U8E CharacterCodeFormat;
U8E StringLangageCode;
} LANG ;
// 3.3.8 Physical Units (10 bytes)
//
// ...the number of exponents that may be held in the UnitExponents array.
//
#define UNITS_NUM_OF_EXPONENTS 9
// ...the unit types, contained within the UnitExponents array:
//
#define UNITS_RADIANS 0
#define UNITS_STERADIANS 1
#define UNITS_METERS 2
#define UNITS_KILOGRAMS 3
#define UNITS_SECONDS 4
#define UNITS_AMPERES 5
#define UNITS_KELVINS 6
#define UNITS_MOLES 7
#define UNITS_CANDELAS 8
// ...the types of enumeration that may be held in the Enumeration Field:
//
#define UNITS_PRODUCT 0
#define UNITS_U_OVER_U 1
#define UNITS_LOG10_U 2
#define UNITS_LOG10_U_OVER_U 3
#define UNITS_DIGITAL_DATA 4
#define UNITS_ARBITRARY 5
typedef struct {
U8E EnumerationField;
U8C UnitExponents[UNITS_NUM_OF_EXPONENTS];
} UNITS ;
// 3.3.9 Universal Unique Identification (10 bytes)
//
#define UUID_NUM_OF_BYTES 10
typedef struct {
unsigned char ucUniversalUniqueId[UUID_NUM_OF_BYTES];
} UUID ;
// ---------------------------------------------
// byte number: 1 2 3 4 5 6 7 8 9 10
// ---------------------------------------------
// the LOCATION field, bitmask definition:
//
#define UUID_LOCATION 0xff ff ff ff ff c0 00 00 00 00
// ...sub-bitmask-definitions within the LOCATION field:
//
#define UUID_NORTHSOUTH 0x80 00 00 00 00 00 00 00 00 00
#define UUID_LATITUDE 0x7f ff f8 00 00 00 00 00 00 00
#define UUID_EASTWEST 0x00 00 04 00 00 00 00 00 00 00
#define UUID_LONGITUDE 0x00 00 03 ff ff c0 00 00 00 00
#define UUID_NORTH TRUE
#define UUID_SOUTH FALSE
#define UUID_EAST TRUE
#define UUID_WEST FALSE
// the MANUFACTURER field, bitmask definition:
//
#define UUID_MANUFACT 0x00 00 00 00 00 3C 00 00 00 00
// the YEAR field, bitmask definition:
//
#define UUID_YEAR 0x00 00 00 00 00 03 FF C0 00 00
// the TIME field, bitmask defintion:
//
#define UUID_TIME 0x00 00 00 00 00 00 00 3f ff ff
// ----------------------------------------------------
// Definitions derived from necessary descriptive types
// ----------------------------------------------------
//
// There is no standard Boolean Type: so define one here.
//
typedef unsigned char boolean;
//
// Some TEDS data blocks may have their length-field set to
// zero. A TEDS length field of 0xFFFFFFFF is interpreted as zero.
//
#define ZERO_LENGTH_FIELD 0xFFFFFFFF
//
// True and False need to be defined for use everywhere - define them
// here if they have not already been defined.
//
#ifndef FALSE
#define FALSE 0
#define TRUE !FALSE
#endif
//
// define the NULL value - used with invalid pointers
// define the NUL value - used with invalid data values
//
#ifndef NULL
#define NULL 0x0000
#endif
#ifndef NUL
#define NUL 0
#endif
// Floating Point Definitions:
// --------------------------
// 32 bit floating point takes: S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF
// 0 1 8 9 31
// If E==255 and F is non-zero => NaN
#define NaN32 0x7F800001
// 64 bit floating point takes: S EEEEEEEEEEE FFFFFFFF ... FFFFFFFFF
// 0 1 11 12 63
// If E==2047 and F is non-zero => NaN
#define NaN64 0x7FF0000000000001
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -