|
|
@@ -365,49 +365,50 @@ void CGpioEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,cons
|
|
|
Dbg("unkown event(%d)...",dwUserCode);
|
|
|
return;
|
|
|
}
|
|
|
- Dbg("devseq[%d],mode[%d]close[%d]",Req.devseq,Req.mode,Req.close);
|
|
|
+ Dbg("devseq[%d],mode[%d]close[%d]",Req.devseq, Req.mode, Req.close);
|
|
|
Set(Req);
|
|
|
}
|
|
|
|
|
|
-void CGpioEntity::WritePin(DWORD dwPinSeq,bool bHighLow)
|
|
|
-{
|
|
|
- if (dwPinSeq > 16)//oiltest need to change?
|
|
|
- {
|
|
|
- if(!m_bNewVersion && dwPinSeq < 24) {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (bHighLow)
|
|
|
- SETBIT(m_btOutputStatus[3],dwPinSeq-24);
|
|
|
- else
|
|
|
- CLEARBIT(m_btOutputStatus[3],dwPinSeq-24);
|
|
|
- m_hDevHelper->WritePort(3, m_btOutputStatus[3]);
|
|
|
- Dbg("after write port3, %d", m_btOutputStatus[3]);
|
|
|
- return;
|
|
|
- }
|
|
|
+ void CGpioEntity::WritePin(DWORD dwPinSeq, bool bHighLevel)
|
|
|
+ {
|
|
|
+ ErrorCodeEnum result(Error_Succeed);
|
|
|
+
|
|
|
+ if (dwPinSeq > 16) {
|
|
|
+ if (!m_bNewVersion && dwPinSeq < 24) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (bHighLevel)
|
|
|
+ SETBIT(m_btOutputStatus[3], dwPinSeq - 24);
|
|
|
+ else
|
|
|
+ CLEARBIT(m_btOutputStatus[3], dwPinSeq - 24);
|
|
|
+ result = m_hDevHelper->WritePort(3, m_btOutputStatus[3]);
|
|
|
+ Dbg("after write port3, %d returned %s", m_btOutputStatus[3], SpStrError(result));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dwPinSeq < 8) {
|
|
|
+ if (bHighLevel)
|
|
|
+ SETBIT(m_btOutputStatus[0], dwPinSeq);
|
|
|
+ else
|
|
|
+ CLEARBIT(m_btOutputStatus[0], dwPinSeq);
|
|
|
+ result = m_hDevHelper->WritePort(0, m_btOutputStatus[0]);
|
|
|
+ Dbg("after write port0,%d returned %s", m_btOutputStatus[0], SpStrError(result));
|
|
|
+ } else {
|
|
|
+ if (bHighLevel)
|
|
|
+ SETBIT(m_btOutputStatus[1], dwPinSeq - 8);
|
|
|
+ else
|
|
|
+ CLEARBIT(m_btOutputStatus[1], dwPinSeq - 8);
|
|
|
+ DWORD dwStart, dwEnd;
|
|
|
+ dwStart = GetTickCount();
|
|
|
+ result = m_hDevHelper->WritePort(1, m_btOutputStatus[1]);
|
|
|
+ dwEnd = GetTickCount();
|
|
|
+ if ((dwEnd - dwStart) > 3000)
|
|
|
+ Dbg("writepin so long.than 3s(%d)", (dwEnd - dwStart));
|
|
|
+ else
|
|
|
+ Dbg("after write port1,%d returned %s", m_btOutputStatus[1], SpStrError(result));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (dwPinSeq < 8)
|
|
|
- {
|
|
|
- if (bHighLow)
|
|
|
- SETBIT(m_btOutputStatus[0],dwPinSeq);
|
|
|
- else
|
|
|
- CLEARBIT(m_btOutputStatus[0],dwPinSeq);
|
|
|
- m_hDevHelper->WritePort(0,m_btOutputStatus[0]);
|
|
|
- Dbg("after write port,%d",m_btOutputStatus[0]);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (bHighLow)
|
|
|
- SETBIT(m_btOutputStatus[1],dwPinSeq-8);
|
|
|
- else
|
|
|
- CLEARBIT(m_btOutputStatus[1],dwPinSeq-8);
|
|
|
- DWORD dwStart,dwEnd;
|
|
|
- dwStart = GetTickCount();
|
|
|
- m_hDevHelper->WritePort(1,m_btOutputStatus[1]);
|
|
|
- dwEnd = GetTickCount();
|
|
|
- if ((dwEnd-dwStart) > 3000)
|
|
|
- Dbg("writepin so long.than 3s(%d)",(dwEnd-dwStart));
|
|
|
- }
|
|
|
-}
|
|
|
void CGpioEntity::Set(GpioService_Set_Info req)
|
|
|
{
|
|
|
CSimpleStringA initDriver = "";
|
|
|
@@ -1356,6 +1357,7 @@ void CGpioEntity::GetOutDrivingModInfo(CSimpleStringA modName, OutDrivingInfo& o
|
|
|
spConfig->ReadConfigValueInt(modName,"Timeout",odi.TimeOut);
|
|
|
LOG_TRACE("outputmode.stopmode:[%d].[%d]",odi.OutputMode,odi.StopMode);
|
|
|
}
|
|
|
+
|
|
|
void CGpioEntity::GetReceivingModInfo(CSimpleStringA modName, ReceivingInfo& ri)
|
|
|
{
|
|
|
ErrorCodeEnum Error;
|