- fixed cmake file

- added function IedModel_getDeviceByIndex
pull/143/head
Michael Zillgith 8 years ago
parent d5900a9c52
commit 76cfa46378

@ -91,10 +91,10 @@ include_directories(
${CMAKE_CURRENT_LIST_DIR}/src/tls
)
set(API_HEADERS
src/hal/inc/hal_time.h
set(API_HEADERS
src/hal/inc/hal_time.h
src/hal/inc/hal_thread.h
src/hal/inc/hal_filesystem.h
src/hal/inc/hal_filesystem.h
src/hal/inc/hal_ethernet.h
src/hal/inc/platform_endian.h
src/common/inc/libiec61850_common_api.h
@ -162,7 +162,7 @@ configure_file(
)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/examples)
endif(BUILD_EXAMPLES)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/src)

@ -468,6 +468,17 @@ IedModel_getModelNodeByShortAddress(IedModel* self, uint32_t shortAddress);
LogicalDevice*
IedModel_getDeviceByInst(IedModel* self, const char* ldInst);
/**
* \brief Lookup logical device (LD) instance by index
*
* \param self IedModel instance
* \param index the index of the LD in the range (0 .. number of LDs - 1)
*
* \return the corresponding LogicalDevice* object or NULL if the index is out of range
*/
LogicalDevice*
IedModel_getDeviceByIndex(IedModel* self, int index);
/**
* \brief Lookup a logical node by name that is part of the given logical device

@ -75,12 +75,12 @@ IedModel_setAttributeValuesToNull(IedModel* iedModel)
int
IedModel_getLogicalDeviceCount(IedModel* iedModel)
IedModel_getLogicalDeviceCount(IedModel* self)
{
if (iedModel->firstChild == NULL)
if (self->firstChild == NULL)
return 0;
LogicalDevice* logicalDevice = iedModel->firstChild;
LogicalDevice* logicalDevice = self->firstChild;
int ldCount = 1;
@ -165,6 +165,27 @@ IedModel_getDeviceByInst(IedModel* self, const char* ldInst)
return NULL;
}
LogicalDevice*
IedModel_getDeviceByIndex(IedModel* self, int index)
{
LogicalDevice* logicalDevice = self->firstChild;
int currentIndex = 0;
while (logicalDevice) {
if (currentIndex == index)
return logicalDevice;
currentIndex++;
logicalDevice = (LogicalDevice*) logicalDevice->sibling;
}
return NULL;
}
static DataAttribute*
ModelNode_getDataAttributeByMmsValue(ModelNode* self, MmsValue* value)
{

@ -579,4 +579,5 @@ EXPORTS
ClientGooseControlBlock_setDstAddress
CDC_VSS_create
CDC_VSG_create
Timestamp_createFromByteArray
Timestamp_createFromByteArray
IedModel_getDeviceByIndex

@ -705,4 +705,5 @@ EXPORTS
SVSubscriber_ASDU_getQuality
SVPublisher_ASDU_addQuality
SVPublisher_ASDU_setQuality
Timestamp_createFromByteArray
Timestamp_createFromByteArray
IedModel_getDeviceByIndex
Loading…
Cancel
Save