Skip to content

Commit

Permalink
Added cyclic data event group
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Arndt committed Jun 14, 2016
1 parent efc89ec commit 2d737e1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion examples/cpp/snap7.h
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ const longword evcDirectory = 0x01000000;
const longword evcSecurity = 0x02000000;
const longword evcControl = 0x04000000;
const longword evcGroupProgrammer = 0x08000000;
const longword evcCyclicData = 0x10000000;
const longword evcGroupCyclicData = 0x10000000;
const longword evcReserved_20000000 = 0x20000000; // actually unused
const longword evcReserved_40000000 = 0x40000000; // actually unused
const longword evcReserved_80000000 = 0x80000000; // actually unused
Expand All @@ -620,6 +620,7 @@ const word evsGPBlink = 0x0002;
const word evsGPRequestDiag = 0x0003;
const word evsGPReadDiag = 0x0004;
const word evsGPRemoveDiag = 0x0005;
const word evsGCRequestData = 0x0001;
// Event Params : functions group
const word grProgrammer = 0x0041;
const word grCyclicData = 0x0042;
Expand Down
7 changes: 3 additions & 4 deletions src/core/s7_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ bool TS7Worker::PerformGroupCyclicData()
// Check request and send appropriate answer

if (RequestParams->SubFun == SFun_Profinet) {

evs = evsGCRequestData;
AnswerData->ReturnCode = ReturnCode_Success;
// Set transport size of Data to OCTET:
AnswerData->TransportSize = TS_ResOctet;
Expand All @@ -1693,8 +1693,7 @@ bool TS7Worker::PerformGroupCyclicData()
0xb6, 0x00, 0x00, 0x00, 0x00 };

// Fill Answer with Response Data
int i;
for (i = 0; i < sizeof(ResponseData); i++) {
for (size_t i = 0; i < sizeof(ResponseData); i++) {
AnswerData->Data[i] = ResponseData[i];
}

Expand All @@ -1716,7 +1715,7 @@ bool TS7Worker::PerformGroupCyclicData()
}

// TODO sent correct events
DoEvent(evcCyclicData,evrNotImplemented,grCyclicData,0,0,0);
DoEvent(evcGroupCyclicData,evrNoError,0,0,0,0);
return true;
}
//==============================================================================
Expand Down
10 changes: 10 additions & 0 deletions src/core/s7_text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,15 @@ static BaseString GroupProgrammerText(TSrvEvent &Event)
};
}
//---------------------------------------------------------------------------
static BaseString GroupCyclicDataText(TSrvEvent &Event)
{
switch (Event.EvtParam1)
{
case evsGCRequestData : return "Group Cyclic Data: Request Cyclic Data";
default : return "Group Cyclic Data: Unknown Subfunction";
};
}
//---------------------------------------------------------------------------
BaseString EvtSrvText(TSrvEvent &Event)
{
BaseString S;
Expand All @@ -543,6 +552,7 @@ BaseString EvtSrvText(TSrvEvent &Event)
case evcDirectory : S=BlockInfoText(Event);break;
case evcSecurity : S=SecurityText(Event);break;
case evcGroupProgrammer: S=GroupProgrammerText(Event);break;
case evcGroupCyclicData: S=GroupCyclicDataText(Event);break;
default: S="Unknown event ("+IntToString(Event.EvtCode)+")";break;
}
return SenderText(Event)+S;
Expand Down
3 changes: 2 additions & 1 deletion src/core/s7_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const longword evcDirectory = 0x01000000;
const longword evcSecurity = 0x02000000;
const longword evcControl = 0x04000000;
const longword evcGroupProgrammer = 0x08000000;
const longword evcCyclicData = 0x10000000;
const longword evcGroupCyclicData = 0x10000000;
const longword evcReserved_20000000 = 0x20000000;
const longword evcReserved_40000000 = 0x40000000;
const longword evcReserved_80000000 = 0x80000000;
Expand All @@ -127,6 +127,7 @@ const word evsGPBlink = 0x0002;
const word evsGPRequestDiag = 0x0003;
const word evsGPReadDiag = 0x0004;
const word evsGPRemoveDiag = 0x0005;
const word evsGCRequestData = 0x0001;
// Event Result
const word evrNoError = 0;
const word evrFragmentRejected = 0x0001;
Expand Down

0 comments on commit 2d737e1

Please sign in to comment.