diff --git a/CMakeLists.txt b/CMakeLists.txt index 01a9b0d..16994b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,10 +79,13 @@ set(API_HEADERS src/hal/inc/hal_time.h src/hal/inc/hal_thread.h src/hal/inc/hal_filesystem.h + src/hal/inc/platform_endian.h src/common/inc/libiec61850_common_api.h + src/common/inc/libiec61850_platform_includes.h src/common/inc/linked_list.h src/common/inc/byte_buffer.h src/common/inc/lib_memory.h + src/common/inc/string_utilities.h src/iec61850/inc/iec61850_client.h src/iec61850/inc/iec61850_common.h src/iec61850/inc/iec61850_server.h @@ -108,6 +111,7 @@ set(API_HEADERS src/sampled_values/sv_subscriber.h src/sampled_values/sv_publisher.h src/logging/logging_api.h + ${CMAKE_CURRENT_BINARY_DIR}/config/stack_config.h ) IF(MSVC) diff --git a/config/stack_config.h b/config/stack_config.h index 2159992..a305280 100644 --- a/config/stack_config.h +++ b/config/stack_config.h @@ -24,6 +24,7 @@ #define DEBUG_GOOSE_SUBSCRIBER 0 #define DEBUG_GOOSE_PUBLISHER 0 #define DEBUG_SV_SUBSCRIBER 0 +#define DEBUG_SV_PUBLISHER 0 #define DEBUG_HAL_ETHERNET 0 /* Maximum MMS PDU SIZE - default is 65000 */ diff --git a/pyiec61850/CMakeLists.txt b/pyiec61850/CMakeLists.txt index 4942995..f5f0f92 100644 --- a/pyiec61850/CMakeLists.txt +++ b/pyiec61850/CMakeLists.txt @@ -1,7 +1,7 @@ FIND_PACKAGE(SWIG REQUIRED) INCLUDE(${SWIG_USE_FILE}) FIND_PACKAGE(PythonLibs REQUIRED) -FIND_PACKAGE ( PythonInterp REQUIRED ) +FIND_PACKAGE ( PythonInterp ${PYTHONLIBS_VERSION_STRING} EXACT REQUIRED ) INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) SET(CMAKE_SWIG_FLAGS "") diff --git a/pyiec61850/test_pyiec61850.py b/pyiec61850/test_pyiec61850.py index a37fd6b..aceb3fd 100755 --- a/pyiec61850/test_pyiec61850.py +++ b/pyiec61850/test_pyiec61850.py @@ -55,20 +55,20 @@ def testClient(): theVal = "testmodelSENSORS/TTMP1.TmpSp.setMag.f" theValType = iec61850.IEC61850_FC_SP temperatureSetpoint = iec61850.IedConnection_readFloatValue(con, theVal, theValType) - print temperatureSetpoint + print(temperatureSetpoint) assert(temperatureValue[1]==0) newValue= temperatureValue[0]+10 err = iec61850.IedConnection_writeFloatValue(con, theVal, theValType, newValue) assert(err==0) temperatureSetpoint = iec61850.IedConnection_readFloatValue(con, theVal, theValType) - print temperatureSetpoint + print(temperatureSetpoint) assert(temperatureSetpoint[0]==newValue) iec61850.IedConnection_close(con) else: - print "Connection error" + print("Connection error") sys.exit(-1) iec61850.IedConnection_destroy(con) - print "client ok" + print("client ok") try: srv=myIECServer() srvThread = threading.Thread(target = srv.run) @@ -78,6 +78,6 @@ try: #signal.pause() except: running = 0 - print "Error :" + print("Error :") traceback.print_exc(file=sys.stdout) sys.exit(-1) diff --git a/src/mms/iso_mms/common/mms_value.c b/src/mms/iso_mms/common/mms_value.c index d5cbaf8..199e3ec 100644 --- a/src/mms/iso_mms/common/mms_value.c +++ b/src/mms/iso_mms/common/mms_value.c @@ -1999,6 +1999,7 @@ MmsValue_printToBuffer(const MmsValue* self, char* buffer, int bufferSize) case MMS_STRUCTURE: case MMS_ARRAY: { + if (bufferSize==0) break; buffer[0] = '{'; int bufPos = 1; diff --git a/src/sampled_values/sv_publisher.c b/src/sampled_values/sv_publisher.c index 5f812fb..d550b57 100644 --- a/src/sampled_values/sv_publisher.c +++ b/src/sampled_values/sv_publisher.c @@ -30,7 +30,9 @@ #include "hal_ethernet.h" #include "ber_encoder.h" +#ifndef DEBUG_SV_PUBLISHER #define DEBUG_SV_PUBLISHER 1 +#endif #define CONFIG_SV_DEFAULT_DST_ADDRESS CONFIG_GOOSE_DEFAULT_DST_ADDRESS @@ -567,6 +569,11 @@ SV_ASDU_setFLOAT64(SV_ASDU self, int index, double value) } } +uint16_t +SV_ASDU_getSmpCnt(SV_ASDU self) +{ + return self->smpCnt; +} void SV_ASDU_setSmpCnt(SV_ASDU self, uint16_t value) diff --git a/src/sampled_values/sv_publisher.h b/src/sampled_values/sv_publisher.h index 5612aa9..eeaf70e 100644 --- a/src/sampled_values/sv_publisher.h +++ b/src/sampled_values/sv_publisher.h @@ -89,6 +89,9 @@ SV_ASDU_setFLOAT64(SV_ASDU self, int index, double value); void SV_ASDU_setSmpCnt(SV_ASDU self, uint16_t value); +uint16_t +SV_ASDU_getSmpCnt(SV_ASDU self); + void SV_ASDU_increaseSmpCnt(SV_ASDU self);