- IEC 61850 server: functions IedModel_getModelNodeByShortObjectReference and IedModel_getModelNodeByObjectReference now also work with object references that have only LD part

pull/72/head
Michael Zillgith 7 years ago
parent 3f07176dc3
commit 6618093f7a

@ -3,7 +3,7 @@
* *
* Copyright 2013 Michael Zillgith * Copyright 2013 Michael Zillgith
* *
* This file is part of libIEC61850. * This file is part of libIEC61850.
* *
* libIEC61850 is free software: you can redistribute it and/or modify * libIEC61850 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -302,15 +302,16 @@ IedModel_getModelNodeByObjectReference(IedModel* model, const char* objectRefere
char* separator = strchr(objRef, '/'); char* separator = strchr(objRef, '/');
if (separator == NULL) if (separator != NULL)
return NULL; *separator = 0;
*separator = 0;
LogicalDevice* ld = IedModel_getDevice(model, objRef); LogicalDevice* ld = IedModel_getDevice(model, objRef);
if (ld == NULL) return NULL; if (ld == NULL) return NULL;
if ((separator == NULL) || (*(separator + 1) == 0))
return (ModelNode*) ld;
return ModelNode_getChild((ModelNode*) ld, separator + 1); return ModelNode_getChild((ModelNode*) ld, separator + 1);
} }
@ -350,10 +351,8 @@ IedModel_getModelNodeByShortObjectReference(IedModel* model, const char* objectR
char* separator = strchr(objRef, '/'); char* separator = strchr(objRef, '/');
if (separator == NULL) if (separator != NULL)
return NULL; *separator = 0;
*separator = 0;
char ldName[65]; char ldName[65];
strcpy(ldName, model->name); strcpy(ldName, model->name);
@ -363,6 +362,9 @@ IedModel_getModelNodeByShortObjectReference(IedModel* model, const char* objectR
if (ld == NULL) return NULL; if (ld == NULL) return NULL;
if ((separator == NULL) || (*(separator + 1) == 0))
return (ModelNode*) ld;
return ModelNode_getChild((ModelNode*) ld, separator + 1); return ModelNode_getChild((ModelNode*) ld, separator + 1);
} }

Loading…
Cancel
Save