Skip to content

Commit 1e3369d

Browse files
committed
插件接口更新,ITrafficMonitor接口中增加获取版本的函数
1 parent 72572ae commit 1e3369d

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

TrafficMonitor/TrafficMonitor.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,16 @@ int CTrafficMonitorApp::ExitInstance()
13871387
return CWinApp::ExitInstance();
13881388
}
13891389

1390+
int CTrafficMonitorApp::GetAPIVersion()
1391+
{
1392+
return 0;
1393+
}
1394+
1395+
const wchar_t* CTrafficMonitorApp::GetTrafficMonitorVersion()
1396+
{
1397+
return VERSION;
1398+
}
1399+
13901400
double CTrafficMonitorApp::GetMonitorData(MonitorItem item)
13911401
{
13921402
switch (item)

TrafficMonitor/TrafficMonitor.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ class CTrafficMonitorApp : public CWinApp, public ITrafficMonitor
200200
virtual int ExitInstance();
201201

202202
// 通过 ITrafficMonitor 继承
203+
private:
204+
virtual int GetAPIVersion() override;
205+
virtual const wchar_t* GetTrafficMonitorVersion() override;
206+
public:
203207
double GetMonitorData(MonitorItem item) override;
204208
void ShowNotifyMessage(const wchar_t* strMsg) override;
205209
unsigned short GetLanguageId() const override;

include/PluginInterface.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,19 @@ class ITMPlugin
329329
class ITrafficMonitor
330330
{
331331
public:
332+
/**
333+
* @brief 获取此接口的版本。
334+
* @attention 插件在调用ITrafficMonitor中的函数时需要先判断接口的版本
335+
* @return int
336+
*/
337+
virtual int GetAPIVersion() = 0;
338+
339+
/**
340+
* @brief 获取TrafficMonitor的版本。
341+
* @return const wchar_t*
342+
*/
343+
virtual const wchar_t* GetTrafficMonitorVersion() = 0;
344+
332345
/** 主程序的所有监控信息 */
333346
enum MonitorItem
334347
{
@@ -404,6 +417,7 @@ class ITrafficMonitor
404417

405418
/*
406419
* 更新记录:
420+
* ITMPlugin
407421
* -------------------------------------------------------------------------
408422
* API version | 更新内容
409423
* -------------------------------------------------------------------------

0 commit comments

Comments
 (0)