[?+]: How to use MSRTEnumArchivData?

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
kukukk
Posts: 2
Joined: Mon Feb 09, 2009 6:50 am
Location: Europe

[?+]: How to use MSRTEnumArchivData?

Post by kukukk »

Hy,

Can somebody help how to export alarm logging values into a text file for a given day, or help me to find out what is the problem with the following code?
I'm trying to export the events from alarm logging into a text file. (To export tag logging values I have used TLGGetArchivDataEx, and it's working).

When I execute first time this code, it executes without an error message, but the callback function is not called for MSRTEnumArchivData. If I execute this code again, I get the following error message:

Error in MSRTEnumArchivData: E1= 0x00000001 ; E2= 0x00000000 ; Connection to the message system run time could not be set up!
File [F:\GEN_AKTUELL\HMI_WINCC_01_SRC\SC_RT_SERVER\ServerServices\Server\MsRtCli\src\app\CMsRt.cpp]
Line [4099]


Thanks in advance,
kukukk

Here is the code:

Code: Select all

    int year = 2010;
    int month = 12;
    int day = 20;

    CMN_ERROR Error;
    BOOL ret;
    TCHAR szText[255];
    DWORD dwServiceID = 0;
    MSG_FILTER_STRUCT MsgFilter;

    SYSTEMTIME localTimeStart, localTimeStop;
    localTimeStart.wYear = (WORD) year;
    localTimeStart.wMonth = (WORD) month;
    localTimeStart.wDay = (WORD) day;
    localTimeStart.wHour = 0;
    localTimeStart.wMinute = 0;
    localTimeStart.wSecond = 0;
    localTimeStart.wMilliseconds= 0;

    localTimeStop.wYear = (WORD) year;
    localTimeStop.wMonth = (WORD) month;
    localTimeStop.wDay = (WORD) day;
    localTimeStop.wHour = 23;
    localTimeStop.wMinute = 59;
    localTimeStop.wSecond = 59;
    localTimeStop.wMilliseconds= 999;

    memset(&Error, 0, sizeof(CMN_ERROR));
    memset(&MsgFilter, 0, sizeof(MSG_FILTER_STRUCT));

    strcpy(MsgFilter.szFilterName, "DAILY_BACKUP");
    MsgFilter.dwFilter = MSG_FILTER_DATE | MSG_FILTER_TIME;
    MsgFilter.st[0] = localTimeStart;
    MsgFilter.st[1] = localTimeStop;

/* Start */
    ret = MSRTStartMsgService(&dwServiceID, MyMSGServiceNotifyCallback, &MsgFilter, MSG_NOTIFY_MASK_ALL, NULL, &Error);
    if (FALSE == ret)
    {
        printf("Error in MSRTSetMsgFilter: E1= 0x%08lx ; E2= 0x%08lx ; %s\r\n", Error.dwError1, Error.dwError2, Error.szErrorText);
    }
    else
    {
        printf("MSRTStartMsgService:     dwServiceID = %d\r\n", dwServiceID);
    }


/* Enum */
    ret = MSRTEnumArchivData(dwServiceID, FALSE,  0xFFFFFFFF, MSG_ARCHIV_ENUM_DESC, &Error);
    if (FALSE == ret)
    {
        printf("Error in MSRTEnumArchivData: E1= 0x%08lx ; E2= 0x%08lx ; %s\r\n", Error.dwError1, Error.dwError2, Error.szErrorText);
    }
    else
    {
        printf("MSRTEnumArchivData\r\n");
    }


/* Stop */
    ret = MSRTStopMsgService(dwServiceID, &Error);
    if (FALSE == ret)
    {
        printf("Error in MSRTSetMsgFilter: E1= 0x%08lx ; E2= 0x%08lx ; %s\r\n", Error.dwError1, Error.dwError2, Error.szErrorText);
    }
    else
    {
        printf("MSRTStopMsgService\r\n");
    }
kukukk
Posts: 2
Joined: Mon Feb 09, 2009 6:50 am
Location: Europe

Re: [?]: How to use MSRTEnumArchivData?

Post by kukukk »

Solved...