StopLog

Stop recording the specified data in the logging shared memory.

Syntax

KsCommandStatus StopLog();

Return value

Returns the KsCommandStatus structure.

Remarks

StopLog stops the log if it was started by another application or if you don't have the log KsCommandStatus variable.

Usable EtherCAT states

ecatOP

Example

Copy
double* LogData = NULL;

KsLogChannel Channels[3] =
{
    {KsLogSource::logAxis, 0, KsLogVariable::logActualPosition, 0, KsLogDataType::logDouble},
    {KsLogSource::logAxis, 0, KsLogVariable::logActualVelocity, 0, KsLogDataType::logDouble},
    {KsLogSource::logAxis, 0, KsLogVariable::logFollowingError, 0, KsLogDataType::logDouble}
};

// Stop current log
KsCommandStatus cmdStopLog = WaitForCommand(1, TRUE, StopLog());
if (!cmdStopLog.Error)
{
    // Log for 10 seconds
    KsCommandStatus cmdLog = Log(3, Channels, 0, 0, KsLogTriggerType::logImmediately, 10);
    cmdLog = WaitForCommand(11, TRUE, cmdLog);
    if (cmdLog.Done)
    {
        // Open log space
        HANDLE hLogMem = RtOpenSharedMemory(SHM_MAP_READ, FALSE, L"KSLogSpace", (void**)&LogData);
        double* data = (double*)malloc(sizeof(double) * 3 * (cmdLog.ValueLength));
        memcpy((void*)data, (void*)LogData, sizeof(double) * 3 * (cmdLog.ValueLength));
        RtCloseHandle(hLogMem); // Close log space

        // Access to log data

        free(data);
    }
}

Requirements

  RT Win32
Minimum supported version 4.0 4.0
Header ksapi.h ksapi.h
Library KsApi_Rtss.lib KsApi.lib

See also

Log