diff --git a/CMakeLists.txt b/CMakeLists.txt index cbc2f360..528be7a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,7 @@ set(API_HEADERS src/mms/inc/asn1_ber_primitive_value.h src/goose/goose_subscriber.h src/goose/goose_receiver.h + src/goose/goose_publisher.h src/sampled_values/sv_subscriber.h src/sampled_values/sv_publisher.h ) diff --git a/Makefile b/Makefile index aa8f5bad..6bb5ca4a 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,9 @@ LIB_API_HEADER_FILES += src/mms/inc/ber_integer.h LIB_API_HEADER_FILES += src/mms/inc/asn1_ber_primitive_value.h LIB_API_HEADER_FILES += src/goose/goose_subscriber.h LIB_API_HEADER_FILES += src/goose/goose_receiver.h +LIB_API_HEADER_FILES += src/goose/goose_publisher.h LIB_API_HEADER_FILES += src/sampled_values/sv_subscriber.h +LIB_API_HEADER_FILES += src/sampled_values/sv_publisher.h get_sources_from_directory = $(wildcard $1/*.c) get_sources = $(foreach dir, $1, $(call get_sources_from_directory,$(dir))) diff --git a/src/goose/goose_subscriber.h b/src/goose/goose_subscriber.h index 7e67b9cb..113be98c 100644 --- a/src/goose/goose_subscriber.h +++ b/src/goose/goose_subscriber.h @@ -94,15 +94,6 @@ GooseSubscriber_setAppId(GooseSubscriber self, uint16_t appId); bool GooseSubscriber_isValid(GooseSubscriber self); -//uint16_t -//GooseSubscriber_getAppId(GooseSubscriber self); - -void -GooseSubscriber_setGoId(GooseSubscriber self, const char* goId); - -//char* -//GooseSubscriber_getGoId(GooseSubscriber self); - void GooseSubscriber_destroy(GooseSubscriber self); diff --git a/src/hal/filesystem/linux/file_provider_linux.c b/src/hal/filesystem/linux/file_provider_linux.c index c973dd2a..df20c5c5 100644 --- a/src/hal/filesystem/linux/file_provider_linux.c +++ b/src/hal/filesystem/linux/file_provider_linux.c @@ -38,7 +38,8 @@ #define CONFIG_VIRTUAL_FILESTORE_BASEPATH "./vmd-filestore/" #endif -static char* fileBasePath = CONFIG_VIRTUAL_FILESTORE_BASEPATH; +static char fileBasePath[256]; +static bool fileBasePathInitialized = false; struct sDirectoryHandle { DIR* handle; @@ -47,6 +48,11 @@ struct sDirectoryHandle { static void createFullPathFromFileName(char* fullPath, char* filename) { + if (!fileBasePathInitialized) { + strcpy(fileBasePath, CONFIG_VIRTUAL_FILESTORE_BASEPATH); + fileBasePathInitialized = true; + } + strcpy(fullPath, fileBasePath); if (filename != NULL) @@ -57,7 +63,8 @@ createFullPathFromFileName(char* fullPath, char* filename) void FileSystem_setBasePath(char* basePath) { - fileBasePath = basePath; + strcpy(fileBasePath, basePath); + fileBasePathInitialized = true; } FileHandle @@ -191,24 +198,3 @@ FileSystem_closeDirectory(DirectoryHandle directory) GLOBAL_FREEMEM(directory); } -#if 0 -int -main(int argc, char** argv) -{ - DirectoryHandle directory = FileSystem_openDirectory("/"); - - if (directory != NULL) { - char* fileName = FileSystem_readDirectory(directory); - - - while (fileName != NULL) { - printf("FILE: (%s)\n", fileName); - fileName = FileSystem_readDirectory(directory); - } - - FileSystem_closeDirectory(directory); - } - else - printf("Error opening directory!\n"); -} -#endif diff --git a/src/hal/filesystem/win32/file_provider_win32.c b/src/hal/filesystem/win32/file_provider_win32.c index 9f25d233..95c42600 100644 --- a/src/hal/filesystem/win32/file_provider_win32.c +++ b/src/hal/filesystem/win32/file_provider_win32.c @@ -41,7 +41,10 @@ #define CONFIG_VIRTUAL_FILESTORE_BASEPATH ".\\vmd-filestore\\" #endif -static char* fileBasePath = CONFIG_VIRTUAL_FILESTORE_BASEPATH; +//static char* fileBasePath = CONFIG_VIRTUAL_FILESTORE_BASEPATH; + +static char fileBasePath[256]; +static bool fileBasePathInitialized = false; struct sDirectoryHandle { HANDLE handle; @@ -53,6 +56,11 @@ struct sDirectoryHandle { static void createFullPathFromFileName(char* fullPath, char* filename) { + if (!fileBasePathInitialized) { + strcpy(fileBasePath, CONFIG_VIRTUAL_FILESTORE_BASEPATH); + fileBasePathInitialized = true; + } + strcpy(fullPath, fileBasePath); if (filename != NULL) @@ -62,7 +70,8 @@ createFullPathFromFileName(char* fullPath, char* filename) void FileSystem_setBasePath(char* basePath) { - fileBasePath = basePath; + strcpy(fileBasePath, basePath); + fileBasePathInitialized = true; } FileHandle diff --git a/src/vs/libiec61850-wo-goose.def b/src/vs/libiec61850-wo-goose.def index 1a87ef6e..1fd83257 100644 --- a/src/vs/libiec61850-wo-goose.def +++ b/src/vs/libiec61850-wo-goose.def @@ -515,4 +515,5 @@ EXPORTS ClientSVControlBlock_getSmpMod ClientSVControlBlock_getNoASDU IedServer_setSVCBHandler - IedModel_getSVControlBlock \ No newline at end of file + IedModel_getSVControlBlock + MmsValue_printToBuffer diff --git a/src/vs/libiec61850.def b/src/vs/libiec61850.def index 7d9842de..4e89fd93 100644 --- a/src/vs/libiec61850.def +++ b/src/vs/libiec61850.def @@ -522,7 +522,6 @@ EXPORTS SVControlBlock_create SVControlBlock_addPhyComAddress GSEControlBlock_addPhyComAddress - GooseSubscriber_getConfRev SVReceiver_create SVReceiver_setInterfaceId SVReceiver_addSubscriber @@ -566,4 +565,32 @@ EXPORTS ClientSVControlBlock_getNoASDU IedServer_setSVCBHandler IedModel_getSVControlBlock - \ No newline at end of file + GooseSubscriber_getConfRev + GooseSubscriber_isValid + GooseReceiver_create + GooseReceiver_setInterfaceId + GooseReceiver_addSubscriber + GooseReceiver_removeSubscriber + GooseReceiver_start + GooseReceiver_stop + GooseReceiver_destroy + GooseReceiver_startThreadless + GooseReceiver_stopThreadless + GooseReceiver_tick + SampledValuesPublisher_create + SampledValuesPublisher_addASDU + SampledValuesPublisher_setupComplete + SampledValuesPublisher_publish + SampledValuesPublisher_destroy + SV_ASDU_resetBuffer + SV_ASDU_addINT8 + SV_ASDU_setINT8 + SV_ASDU_addINT32 + SV_ASDU_setINT32 + SV_ASDU_addFLOAT + SV_ASDU_setFLOAT + SV_ASDU_setSmpCnt + SV_ASDU_increaseSmpCnt + SV_ASDU_setRefrTm + SV_ASDU_setSmpMod + MmsValue_printToBuffer