- windows file provider now supports unicode file names and converts them to UTF-8.

- fixed problem in IEC server GOOSE publisher integration: GoID(appID) was not set by the provided value in ICD file
pull/6/head
Michael Zillgith 10 years ago
parent 947b4a0cd5
commit c8e08597b3

@ -55,6 +55,13 @@ int main(int argc, char** argv) {
iedServer = IedServer_create(&iedModel); iedServer = IedServer_create(&iedModel);
if (argc > 1) {
char* ethernetIfcID = argv[1];
printf("Using GOOSE interface: %s\n", ethernetIfcID);
IedServer_setGooseInterfaceId(iedServer, ethernetIfcID);
}
/* MMS server will be instructed to start listening to client connections. */ /* MMS server will be instructed to start listening to client connections. */
IedServer_start(iedServer, 102); IedServer_start(iedServer, 102);

@ -1,7 +1,7 @@
/* /*
* file_provider_win32.c * file_provider_win32.c
* *
* Copyright 2014 Michael Zillgith * Copyright 2014, 2015 Michael Zillgith
* *
* This file is part of libIEC61850. * This file is part of libIEC61850.
* *
@ -45,7 +45,8 @@ static char* fileBasePath = CONFIG_VIRTUAL_FILESTORE_BASEPATH;
struct sDirectoryHandle { struct sDirectoryHandle {
HANDLE handle; HANDLE handle;
WIN32_FIND_DATA findData; WIN32_FIND_DATAW findData;
char utf8Filename[MAX_PATH * 3 + 1];
bool available; bool available;
}; };
@ -134,11 +135,19 @@ FileSystem_openDirectory(char* directoryName)
strcat(fullPath, "\\*"); strcat(fullPath, "\\*");
dirHandle->handle = FindFirstFile(fullPath, &(dirHandle->findData)); /* convert UTF-8 path name to WCHAR */
WCHAR unicodeFullPath[MAX_PATH + 1];
MultiByteToWideChar(CP_UTF8, 0, fullPath, -1, unicodeFullPath, MAX_PATH);
if (dirHandle->handle != NULL) dirHandle->handle = FindFirstFileW(unicodeFullPath, &(dirHandle->findData));
if (dirHandle->handle != NULL) {
dirHandle->available = true; dirHandle->available = true;
/* convert WCHAR to UTF-8 */
WideCharToMultiByte(CP_UTF8, 0, dirHandle->findData.cFileName, -1, dirHandle->utf8Filename, (MAX_PATH * 3) + 1, NULL, NULL);
}
if (dirHandle->handle == INVALID_HANDLE_VALUE) { if (dirHandle->handle == INVALID_HANDLE_VALUE) {
GLOBAL_FREEMEM(dirHandle); GLOBAL_FREEMEM(dirHandle);
return NULL; return NULL;
@ -158,18 +167,21 @@ getNextDirectoryEntry(DirectoryHandle directory, bool* isDirectory)
else else
*isDirectory = false; *isDirectory = false;
return directory->findData.cFileName; return directory->utf8Filename;
} }
else { else {
if (FindNextFile(directory->handle, &(directory->findData)) != 0) { if (FindNextFileW(directory->handle, &(directory->findData)) != 0) {
if (directory->findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (directory->findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
*isDirectory = true; *isDirectory = true;
else else
*isDirectory = false; *isDirectory = false;
return directory->findData.cFileName; /* convert WCHAR to UTF-8 */
WideCharToMultiByte(CP_UTF8, 0, directory->findData.cFileName, -1, directory->utf8Filename, (MAX_PATH * 3) + 1, NULL, NULL);
return directory->utf8Filename;
} }
else else
return NULL; return NULL;

@ -504,6 +504,8 @@ GOOSE_createGOOSEControlBlocks(MmsMapping* self, MmsDomain* domain,
MmsValue* goID = MmsValue_getElement(gseValues, 1); MmsValue* goID = MmsValue_getElement(gseValues, 1);
MmsValue_setVisibleString(goID, gooseControlBlock->appId); MmsValue_setVisibleString(goID, gooseControlBlock->appId);
mmsGCB->goId = copyString(gooseControlBlock->appId);
} }
if (gooseControlBlock->dataSetName != NULL) if (gooseControlBlock->dataSetName != NULL)

@ -1797,7 +1797,7 @@ mmsWriteHandler(void* parameter, MmsDomain* domain,
if (fc == IEC61850_FC_SE) { if (fc == IEC61850_FC_SE) {
SettingGroup* sg = getSettingGroupByMmsDomain(self, domain); SettingGroup* sg = getSettingGroupByMmsDomain(self, domain);
if (sg->editingClient != connection) if (sg->editingClient != (ClientConnection) connection)
return DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED; return DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED;
} }
#endif /* (CONFIG_IEC61850_SETTING_GROUPS == 1) */ #endif /* (CONFIG_IEC61850_SETTING_GROUPS == 1) */

Loading…
Cancel
Save