- IEC 61850 server: fixed reservation timeout when reporting enabled

pull/147/head
Michael Zillgith 7 years ago
parent 1e1d649aae
commit 719c174f81

@ -143,6 +143,10 @@ include_directories(
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/hal")
if(DEBUG)
set(CMAKE_BUILD_TYPE Debug)
endif(DEBUG)
if(BUILD_EXAMPLES)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/examples)
endif(BUILD_EXAMPLES)

@ -99,7 +99,7 @@ main(int argc, char** argv)
/* disable MMS file service */
IedServerConfig_enableFileService(config, false);
/* disable dynamic data set service */
/* enable dynamic data set service */
IedServerConfig_enableDynamicDataSetService(config, true);
/* disable log service */

@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--This file is generated using Kalkitech SCL Manager IEC61850 Configuration Tool (www.kalkitech.com)-->
<SCL xmlns="http://www.iec.ch/61850/2003/SCL">
<Header id="" version="4.0.2" revision="" toolID="" nameStructure="IEDName">
<Header id="" version="1.0.0" revision="" toolID="" nameStructure="IEDName">
</Header>
<Communication>
<SubNetwork name="subnetwork1" type="8-MMS">
<Text>Station bus</Text>
<BitRate unit="b/s">10</BitRate>
<ConnectedAP iedName="simpleIO" apName="accessPoint1">
<Address>
<P type="IP">10.0.0.2</P>
<P type="IP">192.168.2.223</P>
<P type="IP-SUBNET">255.255.255.0</P>
<P type="IP-GATEWAY">10.0.0.1</P>
<P type="OSI-TSEL">0001</P>
@ -29,10 +27,7 @@
<ReadWrite />
<GetCBValues />
<ConfLNs fixPrefix="true" fixLnInst="true" />
<GOOSE max="5" />
<GSSE max="5" />
<FileHandling />
<GSEDir />
<TimerActivatedControl />
</Services>
<AccessPoint name="accessPoint1">

@ -348,6 +348,9 @@ getDataSetEntryWithIndex(DataSetEntry* dataSet, int index)
static bool
sendReportSegment(ReportControl* self, bool isIntegrity, bool isGI)
{
if (self->clientConnection == NULL)
return false;
int maxMmsPduSize = MmsServerConnection_getMaxMmsPduSize(self->clientConnection);
int estimatedSegmentSize = 19; /* maximum size of header information (header can have 13-19 byte) */
estimatedSegmentSize += 8; /* reserve space for more-segments-follow (3 byte) and sub-seq-num (3-5 byte) */
@ -1593,17 +1596,19 @@ increaseConfRev(ReportControl* self)
static void
checkReservationTimeout(ReportControl* rc)
{
if (rc->resvTms > 0) {
if (Hal_getTimeInMs() > rc->reservationTimeout) {
rc->resvTms = 0;
if (rc->enabled == false) {
if (rc->resvTms > 0) {
if (Hal_getTimeInMs() > rc->reservationTimeout) {
rc->resvTms = 0;
#if (CONFIG_IEC61850_BRCB_WITH_RESVTMS == 1)
MmsValue* resvTmsVal = ReportControl_getRCBValue(rc, "ResvTms");
MmsValue_setInt16(resvTmsVal, rc->resvTms);
MmsValue* resvTmsVal = ReportControl_getRCBValue(rc, "ResvTms");
MmsValue_setInt16(resvTmsVal, rc->resvTms);
#endif
rc->reservationTimeout = 0;
updateOwner(rc, NULL);
rc->reservationTimeout = 0;
updateOwner(rc, NULL);
}
}
}
}
@ -2511,6 +2516,11 @@ exit_function:
static bool
sendNextReportEntrySegment(ReportControl* self)
{
if (self->clientConnection == NULL)
return false;
int maxMmsPduSize = MmsServerConnection_getMaxMmsPduSize(self->clientConnection);
Semaphore_wait(self->reportBuffer->lock);
if (self->reportBuffer->nextToTransmit == NULL) {
@ -2518,7 +2528,6 @@ sendNextReportEntrySegment(ReportControl* self)
return false;
}
int maxMmsPduSize = MmsServerConnection_getMaxMmsPduSize(self->clientConnection);
int estimatedSegmentSize = 19; /* maximum size of header information (header can have 13-19 byte) */
estimatedSegmentSize += 8; /* reserve space for more-segments-follow (3 byte) and sub-seq-num (3-5 byte) */

@ -25,7 +25,7 @@
#include "logging_api.h"
#include "libiec61850_platform_includes.h"
#include <sqlite3.h>
#include "sqlite3.h"
#ifndef DEBUG_LOG_STORAGE_DRIVER
#define DEBUG_LOG_STORAGE_DRIVER 0

@ -510,6 +510,9 @@ mmsServer_fileUploadTask(MmsServer self, MmsObtainFileTask task)
IsoConnection_sendMessage(task->connection->isoConnection, response, false);
FileSystem_closeFile(task->fileHandle);
deleteFile(MmsServerConnection_getFilesystemBasepath(task->connection), task->destinationFilename);
MmsServer_releaseTransmitBuffer(self);
if (DEBUG_MMS_SERVER)
@ -529,6 +532,9 @@ mmsServer_fileUploadTask(MmsServer self, MmsObtainFileTask task)
IsoConnection_sendMessage(task->connection->isoConnection, response, false);
FileSystem_closeFile(task->fileHandle);
deleteFile(MmsServerConnection_getFilesystemBasepath(task->connection), task->destinationFilename);
MmsServer_releaseTransmitBuffer(self);
if (DEBUG_MMS_SERVER)

Loading…
Cancel
Save