- extended server_example3.c to show Timestamp handling
- fixed server crash bug when whole LN is requested in a read request (bug #309)
This commit is contained in:
parent
b42aa358e9
commit
48b02ec1b0
3 changed files with 28 additions and 7 deletions
|
@ -129,14 +129,26 @@ main(int argc, char** argv)
|
|||
|
||||
IedServer_lockDataModel(iedServer);
|
||||
|
||||
Timestamp iecTimestamp;
|
||||
|
||||
Timestamp_clearFlags(&iecTimestamp);
|
||||
Timestamp_setTimeInMilliseconds(&iecTimestamp, timestamp);
|
||||
|
||||
/* toggle clock-not-synchronized flag in timestamp */
|
||||
if (((int) t % 2) == 0)
|
||||
Timestamp_setClockNotSynchronized(&iecTimestamp, true);
|
||||
|
||||
IedServer_updateFloatAttributeValue(iedServer, IEDMODEL_GenericIO_GGIO1_AnIn1_mag_f, an1);
|
||||
IedServer_updateUTCTimeAttributeValue(iedServer, IEDMODEL_GenericIO_GGIO1_AnIn1_t, timestamp);
|
||||
IedServer_updateTimestampAttributeValue(iedServer, IEDMODEL_GenericIO_GGIO1_AnIn1_t, &iecTimestamp);
|
||||
|
||||
IedServer_updateFloatAttributeValue(iedServer, IEDMODEL_GenericIO_GGIO1_AnIn2_mag_f, an2);
|
||||
IedServer_updateUTCTimeAttributeValue(iedServer, IEDMODEL_GenericIO_GGIO1_AnIn2_t, timestamp);
|
||||
IedServer_updateTimestampAttributeValue(iedServer, IEDMODEL_GenericIO_GGIO1_AnIn2_t, &iecTimestamp);
|
||||
|
||||
IedServer_updateFloatAttributeValue(iedServer, IEDMODEL_GenericIO_GGIO1_AnIn3_mag_f, an3);
|
||||
IedServer_updateUTCTimeAttributeValue(iedServer, IEDMODEL_GenericIO_GGIO1_AnIn3_t, timestamp);
|
||||
IedServer_updateTimestampAttributeValue(iedServer, IEDMODEL_GenericIO_GGIO1_AnIn3_t, &iecTimestamp);
|
||||
|
||||
IedServer_updateFloatAttributeValue(iedServer, IEDMODEL_GenericIO_GGIO1_AnIn4_mag_f, an4);
|
||||
IedServer_updateUTCTimeAttributeValue(iedServer, IEDMODEL_GenericIO_GGIO1_AnIn4_t, timestamp);
|
||||
IedServer_updateTimestampAttributeValue(iedServer, IEDMODEL_GenericIO_GGIO1_AnIn4_t, &iecTimestamp);
|
||||
|
||||
IedServer_unlockDataModel(iedServer);
|
||||
|
||||
|
|
|
@ -2156,10 +2156,13 @@ mmsReadAccessHandler (void* parameter, MmsDomain* domain, char* variableId, MmsS
|
|||
if (DEBUG_IED_SERVER)
|
||||
printf("IED_SERVER: mmsReadAccessHandler: Requested %s\n", variableId);
|
||||
|
||||
#if (CONFIG_IEC61850_SETTING_GROUPS == 1)
|
||||
|
||||
char* separator = strchr(variableId, '$');
|
||||
|
||||
if (separator == NULL)
|
||||
return DATA_ACCESS_ERROR_SUCCESS;
|
||||
|
||||
#if (CONFIG_IEC61850_SETTING_GROUPS == 1)
|
||||
|
||||
if (isFunctionalConstraintSE(separator)) {
|
||||
SettingGroup* sg = getSettingGroupByMmsDomain(self, domain);
|
||||
|
||||
|
|
|
@ -577,7 +577,13 @@ parseCotpMessage(CotpConnection* self)
|
|||
uint8_t tpduType;
|
||||
|
||||
len = buffer[0];
|
||||
assert(len <= tpduLength);
|
||||
|
||||
if (len > tpduLength) {
|
||||
if (DEBUG_COTP)
|
||||
printf("COTP: parseCotpMessage: len=%d tpduLength=%d\n", len, tpduLength);
|
||||
|
||||
return COTP_ERROR;
|
||||
}
|
||||
|
||||
tpduType = buffer[1];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue