sendsms.hpp

来自「一个在linux下连接Sybase数据库」· HPP 代码 · 共 112 行

HPP
112
字号
#include "Sidelight.hpp"
#include "Log.hpp"
#include <vector>
using namespace std;
using std::vector;

typedef struct SMS
{
	AlarmsTable STable;
	SendStrategy Strategy;
}SMS;
typedef struct _SAlarmsTable
{
	AlarmsTable 	ATable;
	SendStrategy	Strategy;
	unsigned long   Count;
}_SAlarmsTable;
typedef struct _OPERA
{
	int Type;
	void *lpvoid;
	unsigned long EndTime;//超时值
	_OPERA *Next;
}*LPOPERA,OPERA;
#define MAXTIME 60*60//一个小时60秒*60分
class Manage
{
public:
	Manage();
	~Manage();
	void *operator [](int Type);
	void * operator -(int Type);
	void * Add(int type,void *lpvoid,unsigned long Time=MAXTIME);
	void DetectIdleTime();
private:
	LPOPERA ASeekToEnd();
	LPOPERA pInfo;
};

class SendSms :public SendSmsBase
{
public:
	SendSms();
	virtual ~SendSms();
	virtual unsigned long OnTime(TimerEvent *Event);
	virtual int Run();
private:
	virtual int Init();
	int ReadAlarmsTable();
	int ReadSMSendStrategy();
	int ReadSMSendRecord();
	int ReadGSMRecvTable();


	void InitStrategy();
	void Explore();
	int Dispatch(AlarmsTable *pTable);
	int Apportion(_SAlarmsTable *pSAlarmsTable);
	void CarryOut();
	int SendGSMOntime(_SAlarmsTable * pSTable);
	void InitRecvTable();
	void InitAlarmsTable();
	int WriteSendRecord(unsigned long Sn);
	void StrategyUpdate();
	int WriteRealtimeStatus();


	
	int GetRecord();
	int WriteSendRecord();
	
	int DisposeAlarmsTable();
	int DisposeStrategyTable();
	int DisposeRecordTable();
	int Construe();

	int SendMessage(SMS *pSMS);
	int DistributeStrategy(SMS *pSMS);
	int CountDispose(SMS *pSMS);

	int GetUpdate();

	SendStrategy Strategy;//策略表
	SendStrategy MaxStrategy[16];
	char StrategyState[16];
	
	AlarmsTable  STable;//短信告警表
	AlarmsTable  MaxSTable[16];
	char STableState[16];//记录某一类型更新状态
	char TypeState[16];//记录同一类型的策略发送状态
	vector<SMS *> pListSMS;
	SMSendRecord SendRecord;//发送结果表	
	SMSendRecord MaxSendRecord[16];
	SMSendRecord *pEndSendRecord;
	char SendRecordState[16];
	char *GetCurrTime();
	unsigned long GetTime();
	void DetectIdleTime();
/************测试用****************/
	GSMOntime* ReadGSMOntime();
/************测试用***************/
	GSMRECV GsmRecv[2];
	int ret[5];//0告警表1告警策略表2发送结果表3读易新发送结果表4读易新发送表
	Manage AManage;
	_SAlarmsTable SAlarmsTable[16];
	unsigned long MaxTime;
	FILE *pLogFile;
	Config  Cfg;
};
unsigned long long StringTimeToInt();

⌨️ 快捷键说明

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