monitor.h

来自「在ARM7和UC/OSII的平台上实现了GPS自动报站的功能,涉及GPS模块LE」· C头文件 代码 · 共 160 行

H
160
字号
/****************************************************************
**                                                              *
**  FILE         :  Monitor.H                                   *
**  COPYRIGHT    :  (c) 2001 .Xiamen Yaxon NetWork CO.LTD       *
**                                                              *
**                                                              *
**  By : CCH 2002.1.15                                          *
****************************************************************/
#ifndef DEF_MONITOR
#define DEF_MONITOR


/*
********************************************************************************
*                  DEFINE RETURN OF ADDMONITOR
********************************************************************************
*/
#define _ADD_SUCCESS                    1
#define _ADD_REJECT                     2
#define _ADD_FAILURE                    0x7f


/*
********************************************************************************
*                  DEFINE DELETE REASON
********************************************************************************
*/
#define _DEL_COMMON                     0
#define _DEL_OVERTIME                   1
#define _DEL_USER                       2
#define _DEL_QUERY                      3
#define _DEL_EXITALARM                  4
#define _DEL_CHANGEEGCODE               5


/*
********************************************************************************
*                  DEFINE MONITOR CHANNEL TYPE
********************************************************************************
*/
#define MT_EMPTY                        0x80
#define MT_POSITION                     0x01
#define MT_MONITOR                      0x02
#define MT_ALARM                        0x04
#define MT_AUTOMONITOR                  0x08


/*
********************************************************************************
*                  DEFINE GPS UPDATE MODE
********************************************************************************
*/
#define _TIMING                         0x00
#define _FIXEDSPACE                     0x08
#define _TIMING_OR_FIXEDSPACE           0x10


/*
********************************************************************************
*                  DEFINE GPS TYPE
********************************************************************************
*/
#define _COMGPS1                        0x00
#define _COMGPS2                        0x01
#define _STDGPS                         0x02
#define _DIFGPS                         0x03


/*
********************************************************************************
*                  DEFINE MONITOR ENTRY STRUCTURE
********************************************************************************
*/
typedef struct {
    INT8U           channeltype;
    BOOLEAN         gpscansleep;
    INT8U           delreason;
    INT8U           servicetype;
    INT16U          egcode;
    INT16U          monitortime;
    INT16U          periodtime;
    INT16U          fixedspace;
    INT8U           oldtellen;
    INT8U          *oldtel;
    INT8U           mttellen;
    INT8U          *mttel;
} MONITORENTRY_STRUCT;


void    AddAutoMonitor(void);
void    InitMonitor(void);
void    MonitorTskEntry(void);
void    ChangeMonitorEgcode(void);
INT8U   AddMonitor(MONITORENTRY_STRUCT *entry);
BOOLEAN DelMonitor(MONITORENTRY_STRUCT *entry);
BOOLEAN ModifyMonitor(MONITORENTRY_STRUCT *entry);
BOOLEAN QueryMonitor(MONITORENTRY_STRUCT *entry, INT16U querytime);
INT8U   QueryPosition(INT8U *ptr);

void    AllowMonitor(void);
void    RejectMonitor(void);
BOOLEAN CanMonitor(void);


__inline INT8U AddAlarmMonitor(MONITORENTRY_STRUCT *entry)
{
    entry->channeltype = MT_ALARM | MT_MONITOR;
    return AddMonitor(entry);
}

__inline BOOLEAN DelAlarmMonitor(MONITORENTRY_STRUCT *entry)
{
    entry->channeltype = MT_ALARM;
    entry->delreason   = _DEL_EXITALARM;
    return DelMonitor(entry);
}

__inline INT8U AddPositionMonitor(MONITORENTRY_STRUCT *entry)
{
    entry->channeltype = MT_POSITION;
    entry->gpscansleep = TRUE;
    return AddMonitor(entry);
}

__inline BOOLEAN DelPositionMonitor(MONITORENTRY_STRUCT *entry)
{
    entry->channeltype = MT_POSITION;
    entry->delreason   = _DEL_COMMON;
    return DelMonitor(entry);
}

__inline INT8U AddCommonMonitor(MONITORENTRY_STRUCT *entry)
{
    entry->channeltype = MT_MONITOR;
    entry->gpscansleep = TRUE;
    return AddMonitor(entry);
}

__inline BOOLEAN DelCommonMonitor(MONITORENTRY_STRUCT *entry)
{
    entry->channeltype = MT_MONITOR;
    entry->delreason   = _DEL_COMMON;
    return DelMonitor(entry);
}

__inline BOOLEAN ModifyCommonMonitor(MONITORENTRY_STRUCT *entry)
{
    entry->channeltype = MT_MONITOR;
    entry->gpscansleep = TRUE;
    return ModifyMonitor(entry);
}

__inline BOOLEAN QueryCommonMonitor(MONITORENTRY_STRUCT *entry, INT16U querytime)
{
    entry->channeltype = MT_MONITOR;
    return QueryMonitor(entry, querytime);
}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?