- RCBs support for VMD scope datasets

- Client support for VMD scope datasets
pull/6/head
Michael Zillgith 10 years ago
parent b9c520240a
commit 91d122fd51

@ -1901,23 +1901,34 @@ IedConnection_createDataSet(IedConnection self, IedClientError* error, const cha
bool isAssociationSpecific = false;
if (dataSetReference[0] != '@') {
domainId = MmsMapping_getMmsDomainFromObjectReference(dataSetReference, domainIdBuffer);
if (domainId == NULL) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
if ((dataSetReference[0] == '/') || (strchr(dataSetReference, '/') == NULL)) {
domainId = NULL;
if (dataSetReference[0] == '/')
itemId = dataSetReference + 1;
else
itemId = dataSetReference;
}
else {
domainId = MmsMapping_getMmsDomainFromObjectReference(dataSetReference, domainIdBuffer);
if (domainId == NULL) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
}
int domainIdLength = strlen(domainId);
int domainIdLength = strlen(domainId);
if ((strlen(dataSetReference) - domainIdLength - 1) > 32) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
}
if ((strlen(dataSetReference) - domainIdLength - 1) > 32) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
}
char* itemIdRef = copyStringToBuffer(dataSetReference + domainIdLength + 1, itemIdBuffer);
StringUtils_replace(itemIdRef, '.', '$');
itemId = itemIdRef;
char* itemIdRef = copyStringToBuffer(dataSetReference + domainIdLength + 1, itemIdBuffer);
StringUtils_replace(itemIdRef, '.', '$');
itemId = itemIdRef;
}
}
else {
itemId = dataSetReference + 1;
@ -1965,28 +1976,40 @@ exit_function:
void
IedConnection_deleteDataSet(IedConnection self, IedClientError* error, const char* dataSetReference)
{
char domainId[65];
char domainIdBuf[65];
char* domainId = domainIdBuf;
char itemId[DATA_SET_MAX_NAME_LENGTH + 1];
bool isAssociationSpecific = false;
int dataSetReferenceLength = strlen(dataSetReference);
if (dataSetReference[0] != '@') {
if (MmsMapping_getMmsDomainFromObjectReference(dataSetReference, domainId) == NULL) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
if ((dataSetReference[0] == '/') || (strchr(dataSetReference, '/') == NULL)) {
domainId = NULL;
if (dataSetReference[0] == '/')
strcpy(itemId, dataSetReference + 1);
else
strcpy(itemId, dataSetReference);
}
else {
if (MmsMapping_getMmsDomainFromObjectReference(dataSetReference, domainId) == NULL) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
}
const char* itemIdString = dataSetReference + strlen(domainId) + 1;
const char* itemIdString = dataSetReference + strlen(domainId) + 1;
if (strlen(itemIdString) > DATA_SET_MAX_NAME_LENGTH) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
}
if (strlen(itemIdString) > DATA_SET_MAX_NAME_LENGTH) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
}
copyStringToBuffer(itemIdString, itemId);
copyStringToBuffer(itemIdString, itemId);
StringUtils_replace(itemId, '.', '$');
StringUtils_replace(itemId, '.', '$');
}
}
else {
if (dataSetReferenceLength > 33) {
@ -2028,23 +2051,33 @@ IedConnection_getDataSetDirectory(IedConnection self, IedClientError* error, con
bool isAssociationSpecific = false;
if (dataSetReference[0] != '@') {
domainId = MmsMapping_getMmsDomainFromObjectReference(dataSetReference, domainIdBuffer);
if ((dataSetReference[0] == '/') || (strchr(dataSetReference, '/') == NULL)) {
domainId = NULL;
if (domainId == NULL) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
if (dataSetReference[0] == '/')
itemId = dataSetReference + 1;
else
itemId = dataSetReference;
}
else {
domainId = MmsMapping_getMmsDomainFromObjectReference(dataSetReference, domainIdBuffer);
const char* itemIdRef = dataSetReference + strlen(domainId) + 1;
if (domainId == NULL) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
}
if (strlen(itemIdRef) > DATA_SET_MAX_NAME_LENGTH) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
}
const char* itemIdRef = dataSetReference + strlen(domainId) + 1;
if (strlen(itemIdRef) > DATA_SET_MAX_NAME_LENGTH) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
}
char* itemIdRefInBuffer = copyStringToBuffer(itemIdRef, itemIdBuffer);
StringUtils_replace(itemIdRefInBuffer, '.', '$');
itemId = itemIdRefInBuffer;
char* itemIdRefInBuffer = copyStringToBuffer(itemIdRef, itemIdBuffer);
StringUtils_replace(itemIdRefInBuffer, '.', '$');
itemId = itemIdRefInBuffer;
}
}
else {
itemId = dataSetReference + 1;
@ -2103,24 +2136,35 @@ IedConnection_readDataSetValues(IedConnection self, IedClientError* error, const
bool isAssociationSpecific = false;
if (dataSetReference[0] != '@') {
domainId = MmsMapping_getMmsDomainFromObjectReference(dataSetReference, domainIdBuffer);
if (domainId == NULL) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
if ((dataSetReference[0] == '/') || (strchr(dataSetReference, '/') == NULL)) {
domainId = NULL;
if (dataSetReference[0] == '/')
itemId = dataSetReference + 1;
else
itemId = dataSetReference;
}
else {
domainId = MmsMapping_getMmsDomainFromObjectReference(dataSetReference, domainIdBuffer);
const char* itemIdRefOrig = dataSetReference + strlen(domainId) + 1;
if (domainId == NULL) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
}
if (strlen(itemIdRefOrig) > DATA_SET_MAX_NAME_LENGTH) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
}
const char* itemIdRefOrig = dataSetReference + strlen(domainId) + 1;
char* itemIdRef = copyStringToBuffer(itemIdRefOrig, itemIdBuffer);
if (strlen(itemIdRefOrig) > DATA_SET_MAX_NAME_LENGTH) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto exit_function;
}
StringUtils_replace(itemIdRef, '.', '$');
itemId = itemIdRef;
char* itemIdRef = copyStringToBuffer(itemIdRefOrig, itemIdBuffer);
StringUtils_replace(itemIdRef, '.', '$');
itemId = itemIdRef;
}
}
else {
itemId = dataSetReference + 1;

@ -1310,7 +1310,9 @@ IedConnection_readDataSetValues(IedConnection self, IedClientError* error, const
* \brief create a new data set at the connected server device
*
* This function creates a new data set at the server. The parameter dataSetReference is the name of the new data set
* to create. It is either in the form LDName/LNodeName.dataSetName or @dataSetName for an association specific data set.
* to create. It is either in the form LDName/LNodeName.dataSetName for permanent domain or VMD scope data sets or
* @dataSetName for an association specific data set. If the LDName part of the reference is missing the resulting
* data set will be of VMD scope.
*
* The dataSetElements parameter contains a linked list containing the object references of FCDs or FCDAs. The format of
* this object references is LDName/LNodeName.item(arrayIndex)component[FC].

@ -513,6 +513,13 @@ updateReportDataset(MmsMapping* mapping, ReportControl* rc, MmsValue* newDatSet,
dataSet = MmsMapping_createDataSetByNamedVariableList(mapping, mmsVariableList);
}
}
/* check for VMD specific data set */
else if (dataSetName[0] == '/') {
MmsNamedVariableList mmsVariableList = MmsDevice_getNamedVariableListWithName(mapping->mmsDevice, dataSetName + 1);
if (mmsVariableList != NULL)
dataSet = MmsMapping_createDataSetByNamedVariableList(mapping, mmsVariableList);
}
}
if (dataSet == NULL)

@ -384,6 +384,9 @@ MmsConnection_getVariableAccessAttributes(MmsConnection self, MmsError* mmsError
/**
* \brief Read the values of a domain specific named variable list
*
* The resulting named variable list will either be of domain scope (when the domainId argument
* is present) or VMD scope when the domainId argument is NULL.
*
* \param self MmsConnection instance to operate on
* \param mmsError user provided variable to store error code
* \param domainId the domain name of the requested variables.
@ -416,7 +419,10 @@ MmsConnection_readNamedVariableListValuesAssociationSpecific(MmsConnection self,
const char* listName, bool specWithResult);
/**
* \brief Define a new named variable list at the server.
* \brief Define a new VMD or domain scoped named variable list at the server.
*
* The resulting named variable list will either be of domain scope (when the domainId argument
* is present) or VMD scope when the domainId argument is NULL.
*
* \param self MmsConnection instance to operate on
* \param mmsError user provided variable to store error code
@ -446,6 +452,9 @@ MmsConnection_defineNamedVariableListAssociationSpecific(MmsConnection self, Mms
/**
* \brief Read the entry list of a named variable list at the server.
*
* The resulting named variable list will either be of domain scope (when the domainId argument
* is present) or VMD scope when the domainId argument is NULL.
*
* \param self MmsConnection instance to operate on
* \param mmsError user provided variable to store error code
* \param domainId the domain name of the domain of the variable list
@ -477,6 +486,9 @@ MmsConnection_readNamedVariableListDirectoryAssociationSpecific(MmsConnection se
/**
* \brief Delete a named variable list at the server.
*
* The resulting named variable list will either be of domain scope (when the domainId argument
* is present) or VMD scope when the domainId argument is NULL.
*
* \param self MmsConnection instance to operate on
* \param mmsError user provided variable to store error code
* \param domainId the domain name of the domain of the variable list

@ -182,6 +182,9 @@ MmsDevice_getNamedVariable(MmsDevice* self, char* variableName);
LinkedList
MmsDevice_getNamedVariableLists(MmsDevice* self);
MmsNamedVariableList
MmsDevice_getNamedVariableListWithName(MmsDevice* self, const char* variableListName);
/**@}*/
#ifdef __cplusplus

@ -54,11 +54,18 @@ mmsClient_createDeleteNamedVariableListRequest(long invokeId, ByteBuffer* writeB
request->listOfVariableListName->list.array = (ObjectName_t**) GLOBAL_CALLOC(1, sizeof(ObjectName_t*));
request->listOfVariableListName->list.array[0] = (ObjectName_t*) GLOBAL_CALLOC(1, sizeof(ObjectName_t));
request->listOfVariableListName->list.array[0]->present = ObjectName_PR_domainspecific;
request->listOfVariableListName->list.array[0]->choice.domainspecific.domainId.size = strlen(domainId);
request->listOfVariableListName->list.array[0]->choice.domainspecific.domainId.buf = (uint8_t*) copyString(domainId);
request->listOfVariableListName->list.array[0]->choice.domainspecific.itemId.size = strlen(listNameId);
request->listOfVariableListName->list.array[0]->choice.domainspecific.itemId.buf = (uint8_t*) copyString(listNameId);
if (domainId != NULL) {
request->listOfVariableListName->list.array[0]->present = ObjectName_PR_domainspecific;
request->listOfVariableListName->list.array[0]->choice.domainspecific.domainId.size = strlen(domainId);
request->listOfVariableListName->list.array[0]->choice.domainspecific.domainId.buf = (uint8_t*) copyString(domainId);
request->listOfVariableListName->list.array[0]->choice.domainspecific.itemId.size = strlen(listNameId);
request->listOfVariableListName->list.array[0]->choice.domainspecific.itemId.buf = (uint8_t*) copyString(listNameId);
}
else {
request->listOfVariableListName->list.array[0]->present = ObjectName_PR_vmdspecific;
request->listOfVariableListName->list.array[0]->choice.vmdspecific.size = strlen(listNameId);
request->listOfVariableListName->list.array[0]->choice.vmdspecific.buf = (uint8_t*) copyString(listNameId);
}
request->scopeOfDelete = (INTEGER_t*) GLOBAL_CALLOC(1, sizeof(INTEGER_t));
asn_long2INTEGER(request->scopeOfDelete, DeleteNamedVariableListRequest__scopeOfDelete_specific);
@ -156,13 +163,21 @@ mmsClient_createGetNamedVariableListAttributesRequest(uint32_t invokeId, ByteBuf
GetNamedVariableListAttributesRequest_t* request =
&(mmsPdu->choice.confirmedRequestPdu.confirmedServiceRequest.choice.getNamedVariableListAttributes);
request->present = ObjectName_PR_domainspecific;
if (domainId != NULL) {
request->present = ObjectName_PR_domainspecific;
request->choice.domainspecific.domainId.size = strlen(domainId);
request->choice.domainspecific.domainId.buf = (uint8_t*) copyString(domainId);
request->choice.domainspecific.domainId.size = strlen(domainId);
request->choice.domainspecific.domainId.buf = (uint8_t*) copyString(domainId);
request->choice.domainspecific.itemId.size = strlen(listNameId);
request->choice.domainspecific.itemId.buf = (uint8_t*) copyString(listNameId);
}
else {
request->present = ObjectName_PR_vmdspecific;
request->choice.domainspecific.itemId.size = strlen(listNameId);
request->choice.domainspecific.itemId.buf = (uint8_t*) copyString(listNameId);
request->choice.vmdspecific.size = strlen(listNameId);
request->choice.vmdspecific.buf = (uint8_t*) copyString(listNameId);
}
der_encode(&asn_DEF_MmsPdu, mmsPdu,
(asn_app_consume_bytes_f*) mmsClient_write_out, (void*) writeBuffer);
@ -277,13 +292,21 @@ mmsClient_createDefineNamedVariableListRequest(
request->variableListName.choice.aaspecific.buf = (uint8_t*) copyString(listNameId);
}
else {
request->variableListName.present = ObjectName_PR_domainspecific;
if (domainId != NULL) { /* domain scope */
request->variableListName.present = ObjectName_PR_domainspecific;
request->variableListName.choice.domainspecific.domainId.size = strlen(domainId);
request->variableListName.choice.domainspecific.domainId.buf = (uint8_t*) copyString(domainId);
request->variableListName.choice.domainspecific.domainId.size = strlen(domainId);
request->variableListName.choice.domainspecific.domainId.buf = (uint8_t*) copyString(domainId);
request->variableListName.choice.domainspecific.itemId.size = strlen(listNameId);
request->variableListName.choice.domainspecific.itemId.buf = (uint8_t*) copyString(listNameId);
}
else { /* VMD scope */
request->variableListName.present = ObjectName_PR_vmdspecific;
request->variableListName.choice.domainspecific.itemId.size = strlen(listNameId);
request->variableListName.choice.domainspecific.itemId.buf = (uint8_t*) copyString(listNameId);
request->variableListName.choice.vmdspecific.size = strlen(listNameId);
request->variableListName.choice.vmdspecific.buf = (uint8_t*) copyString(listNameId);
}
}
int listSize = LinkedList_size(listOfVariables);

@ -307,13 +307,22 @@ mmsClient_createReadNamedVariableListRequest(uint32_t invokeId, const char* doma
ObjectName_t* objectName = &(readRequest->variableAccessSpecification.choice.variableListName);
objectName->present = ObjectName_PR_domainspecific;
objectName->choice.domainspecific.domainId.buf = (uint8_t*) copyString(domainId);
objectName->choice.domainspecific.domainId.size = strlen(domainId);
if (domainId != NULL) {
objectName->present = ObjectName_PR_domainspecific;
objectName->choice.domainspecific.domainId.buf = (uint8_t*) copyString(domainId);
objectName->choice.domainspecific.domainId.size = strlen(domainId);
objectName->choice.domainspecific.itemId.buf = (uint8_t*) copyString(itemId);
objectName->choice.domainspecific.itemId.size = strlen(itemId);
}
else {
objectName->present = ObjectName_PR_vmdspecific;
objectName->choice.domainspecific.itemId.buf = (uint8_t*) copyString(itemId);
objectName->choice.domainspecific.itemId.size = strlen(itemId);
objectName->choice.vmdspecific.buf = (uint8_t*) copyString(itemId);
objectName->choice.vmdspecific.size = strlen(itemId);
}
asn_enc_rval_t rval;

@ -127,3 +127,10 @@ MmsDevice_getNamedVariableLists(MmsDevice* self)
{
return self->namedVariableLists;
}
MmsNamedVariableList
MmsDevice_getNamedVariableListWithName(MmsDevice* self, const char* variableListName)
{
return mmsServer_getNamedVariableListWithName(self->namedVariableLists, variableListName);
}

Loading…
Cancel
Save