You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "EncryptionMgr.h"
|
|
|
|
|
#include "PlcIOMgr.h"
|
|
|
|
|
#include "LogMgr.h"
|
|
|
|
|
#include "MsgBox.h"
|
|
|
|
|
|
|
|
|
|
#define ENCRYPT_PORT "5" //<2F><><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD>PLC <20>˿<EFBFBD>
|
|
|
|
|
|
|
|
|
|
CEncryptionMgr *gEncryptionMgr = new CEncryptionMgr;
|
|
|
|
|
CEncryptionMgr::CEncryptionMgr(void)
|
|
|
|
|
{
|
|
|
|
|
m_bEncrypt = false;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>
|
|
|
|
|
m_bLocked = false;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
}
|
|
|
|
|
CEncryptionMgr::~CEncryptionMgr(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
void CEncryptionMgr::Ini()
|
|
|
|
|
{
|
|
|
|
|
if(!m_bEncrypt)
|
|
|
|
|
return ;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
|
|
|
|
//CheckLockState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
|
|
|
|
void CEncryptionMgr::CheckLockState()
|
|
|
|
|
{
|
|
|
|
|
if(m_bEncrypt)
|
|
|
|
|
{
|
|
|
|
|
if(!gPlcIOMgr->CheckPortState(ENCRYPT_PORT,5))
|
|
|
|
|
{
|
|
|
|
|
m_bLocked = true;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
gLogMgr->WriteDebugLog("Err---->EncryptionMgr Check Lock State");
|
|
|
|
|
gLogMgr->WriteDebugLog("Device Locked");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_bLocked = false;
|
|
|
|
|
gLogMgr->WriteDebugLog("Fun---->EncryptionMgr Check Lock State");
|
|
|
|
|
gLogMgr->WriteDebugLog("Device UnLocked");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
|
|
|
|
bool CEncryptionMgr::IsbLocked()
|
|
|
|
|
{
|
|
|
|
|
if(!m_bEncrypt)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if(m_bLocked)
|
|
|
|
|
{
|
|
|
|
|
CMsgBox MsgBox;
|
|
|
|
|
MsgBox.Show("<EFBFBD>豸<EFBFBD><EFBFBD>Ȩ֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD>0x000045");
|
|
|
|
|
}
|
|
|
|
|
return m_bLocked;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
void CEncryptionMgr::UnLock()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
gLogMgr->WriteDebugLog("Fun---->EncryptionMgr Unlock Succeed");
|
|
|
|
|
}
|
|
|
|
|
|