[go: up one dir, main page]

Menu

[r101]: / trunk / VTS3 / ScriptPacket.h  Maximize  Restore  History

Download this file

105 lines (76 with data), 2.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
// ScriptPacket.h: interface for the ScriptPacket class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SCRIPTPACKET_H__AC59C5B1_BAFF_11D4_BEF7_00A0C95A9812__INCLUDED_)
#define AFX_SCRIPTPACKET_H__AC59C5B1_BAFF_11D4_BEF7_00A0C95A9812__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "BACnet.hpp"
#include "ScriptBase.h"
class ScriptPacket;
typedef ScriptPacket *ScriptPacketPtr;
class ScriptPacketExpr;
typedef ScriptPacketExpr *ScriptPacketExprPtr;
class ScriptPacketExprList;
typedef ScriptPacketExprList *ScriptPacketExprListPtr;
//
// ScriptPacketExpr
//
const int kMaxScriptExprLen = 8;
class ScriptPacketExpr {
public:
ScriptPacketExpr( void );
~ScriptPacketExpr( void );
int exprKeyword; // keyword
bool exprIsData; // true if data keyword
int exprOp; // operator
CString exprValue; // list of values
int exprLine; // line number in script
};
const int kScriptPacketExprSize = sizeof( ScriptPacketExpr );
//
// ScriptPacketExprList
//
class ScriptPacketExprList : public CList<ScriptPacketExprPtr,ScriptPacketExprPtr> {
public:
ScriptPacketExprList( ScriptPacketExprListPtr prev );
virtual ~ScriptPacketExprList();
ScriptPacketExprListPtr listPrevious; // inheritance chain
// list operations
void Append( ScriptPacketExprPtr sbp ); // add a child at the end
void Remove( int indx ); // remove a child
int Length( void ); // number of children
ScriptPacketExprPtr Child( int indx ); // child by index
ScriptPacketExprPtr Find( int keyword ); // specific child
int FirstData( void ); // index of first app layer elem
};
const int kScriptPacketExprListSize = sizeof( ScriptPacketExprList );
//
// ScriptPacket
//
const int kMaxPacketDelay = 1800; // in ms, 1 minute
class ScriptPacket : public ScriptBase {
public:
enum ScriptPacketType
{ sendPacket
, expectPacket
};
enum ScriptPacketSubtype
{ rootPacket
, andPacket
, orPacket
};
ScriptPacket( ScriptPacketType type, ScriptPacketSubtype subtype, ScriptPacketPtr prev );
~ScriptPacket( void );
ScriptPacketType packetType; // type
ScriptPacketSubtype packetSubtype; // could be root!
ScriptPacketExprList packetExprList; // list of expressions
int packetLevel; // case level
int packetDelay; // BEFORE/AFTER time value (in ms)
ScriptPacketPtr packetNext; // next packet in test sequence
ScriptPacketPtr packetPass; // next when execution passes
ScriptPacketPtr packetFail; // next when it fails
};
const int kScriptPacketSize = sizeof( ScriptPacket );
#endif // !defined(AFX_SCRIPTPACKET_H__AC59C5B1_BAFF_11D4_BEF7_00A0C95A9812__INCLUDED_)