- IED server: added new function IedServer_udpateDbposValue; added new return code for control check callback function

This commit is contained in:
Michael Zillgith 2017-10-26 09:32:16 +02:00
parent 02689d1410
commit cd8f5f483d
5 changed files with 42 additions and 24 deletions

View file

@ -560,6 +560,21 @@ IedServer_updateFloatAttributeValue(IedServer self, DataAttribute* dataAttribute
void
IedServer_updateInt32AttributeValue(IedServer self, DataAttribute* dataAttribute, int32_t value);
/**
* \brief Update the value of an IEC 61850 Dbpos (double point/position) data attribute.
*
* Update the value of a integer data attribute without handling with MmsValue instances.
*
* This function will also check if a trigger condition is satisfied in the case when a report or GOOSE
* control block is enabled.
*
* \param self the instance of IedServer to operate on.
* \param dataAttribute the data attribute handle
* \param value the new Dbpos value of the data attribute.
*/
void
IedServer_udpateDbposValue(IedServer self, DataAttribute* dataAttribute, Dbpos value);
/**
* \brief Update the value of an IEC 61850 integer64 data attribute (like BCR actVal)
*
@ -820,7 +835,8 @@ typedef enum {
CONTROL_HARDWARE_FAULT = 1, /** check failed due to hardware fault */
CONTROL_TEMPORARILY_UNAVAILABLE = 2, /** control is already selected or operated */
CONTROL_OBJECT_ACCESS_DENIED = 3, /** check failed due to access control reason - access denied for this client or state */
CONTROL_OBJECT_UNDEFINED = 4 /** object not visible in this security context ??? */
CONTROL_OBJECT_UNDEFINED = 4, /** object not visible in this security context ??? */
CONTROL_VALUE_INVALID = 11 /** ctlVal out of range */
} CheckHandlerResult;
/**

View file

@ -985,6 +985,27 @@ IedServer_updateInt32AttributeValue(IedServer self, DataAttribute* dataAttribute
}
}
void
IedServer_udpateDbposValue(IedServer self, DataAttribute* dataAttribute, Dbpos value)
{
Dbpos currentValue = Dbpos_fromMmsValue(dataAttribute->mmsValue);
if (currentValue == value) {
checkForUpdateTrigger(self, dataAttribute);
}
else {
#if (CONFIG_MMS_THREADLESS_STACK != 1)
Semaphore_wait(self->dataModelLock);
#endif
Dbpos_toMmsValue(dataAttribute->mmsValue, value);
#if (CONFIG_MMS_THREADLESS_STACK != 1)
Semaphore_post(self->dataModelLock);
#endif
checkForChangedTriggers(self, dataAttribute);
}
}
void
IedServer_updateInt64AttributeValue(IedServer self, DataAttribute* dataAttribute, int64_t value)
{

View file

@ -1211,27 +1211,6 @@ checkValidityOfOriginParameter(MmsValue* origin)
return true;
}
static MmsDataAccessError
getDataAccessErrorFromCheckHandlerResult(CheckHandlerResult checkResult)
{
MmsDataAccessError indication;
if (checkResult == CONTROL_HARDWARE_FAULT)
indication = DATA_ACCESS_ERROR_HARDWARE_FAULT;
else
if (checkResult == CONTROL_TEMPORARILY_UNAVAILABLE)
indication = DATA_ACCESS_ERROR_TEMPORARILY_UNAVAILABLE;
else
if (checkResult == CONTROL_OBJECT_UNDEFINED)
indication = DATA_ACCESS_ERROR_OBJECT_UNDEFINED;
else if (checkResult == CONTROL_OBJECT_ACCESS_DENIED)
indication = DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED;
else
indication = DATA_ACCESS_ERROR_SUCCESS;
return indication;
}
MmsDataAccessError
Control_writeAccessControlObject(MmsMapping* self, MmsDomain* domain, char* variableIdOrig,
MmsValue* value, MmsServerConnection connection)
@ -1378,7 +1357,7 @@ Control_writeAccessControlObject(MmsMapping* self, MmsDomain* domain, char* vari
printf("SBOw: selected successful\n");
}
else {
indication = getDataAccessErrorFromCheckHandlerResult(checkResult);
indication = (MmsDataAccessError) checkResult;
ControlObject_sendLastApplError(controlObject, connection, "SBOw", 0,
ADD_CAUSE_SELECT_FAILED, ctlNum, origin, true);
@ -1523,7 +1502,7 @@ Control_writeAccessControlObject(MmsMapping* self, MmsDomain* domain, char* vari
}
else {
indication = getDataAccessErrorFromCheckHandlerResult(checkResult);
indication = (MmsDataAccessError) checkResult;
abortControlOperation(controlObject);
}

View file

@ -572,3 +572,4 @@ EXPORTS
MmsConnection_writeNamedVariableList
IedConnection_writeDataSetValues
MmsVariableSpecification_isValueOfType
IedServer_udpateDbposValue

View file

@ -653,3 +653,4 @@ EXPORTS
SVClientASDU_getRefrTmAsMs
IedConnection_writeDataSetValues
MmsVariableSpecification_isValueOfType
IedServer_udpateDbposValue