Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4LabVIEW)  1.26.2
mlpiTraceLib.h
Go to the documentation of this file.
1 #ifndef __MLPITRACELIB_H__
2 #define __MLPITRACELIB_H__
3 
4 // -----------------------------------------------------------------------
5 // MLPI - <mlpiTraceLib.h>
6 // -----------------------------------------------------------------------
7 // Copyright (c) 2013 Bosch Rexroth. All rights reserved.
8 // Redistribution and use in source and binary forms of this MLPI software
9 // (SW) provided to you, with or without modification, are permitted
10 // without prior approval provided that the following conditions are met:
11 //
12 // 1. Redistributions of source code of SW must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 //
15 // 2. Redistributions in binary form of SW must reproduce the above copyright
16 // notice, this list of conditions and the following disclaimer in the
17 // documentation and/or other materials provided with the distribution.
18 //
19 // 3. User recognizes and acknowledges that it acquires no right,
20 // title or interest in or to any of the names or trademarks used in
21 // connection with the SW ("names") by virtue of this License and waives
22 // any right to or interest in the names. User recognizes and acknowledges
23 // that names of companies or names or products of companies displayed
24 // in the documentation of SW to indicate the interoperability of products
25 // with the SW are the names of their respective owners. The use of such
26 // names in the documentation of SW does not imply any sponsorship,
27 // approval, or endorsement by such companies of this product.
28 //
29 // 4. Modified code versions, i.e. any addition to or deletion from
30 // the substance or structure of the original code of the SW running
31 // the MLPI must be plainly marked as such and must not be misrepresented
32 // as being original SW.
33 //
34 // 5. The SW may only be used in connection with a Bosch Rexroth product.
35 //
36 // THIS INFORMATION IS PROVIDED BY BOSCH REXROTH CORPORATION "AS IS"
37 // AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING
38 // (BUT NOTLIMITED TO) ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
39 // FITNESS FOR ANY PARTICULAR PURPOSE, OR NON-INFRINGEMENT. WHILE THE
40 // INFORMATION PROVIDED IS BELIEVED TO BE ACCURATE, IT MAY INCLUDE
41 // ERRORS OR INACCURACIES.
42 // SUBJECT TO COMPULSORY STATUTORY PROVISIONS OF THE GERMAN LAW AS
43 // THE APPLICABLE LAW FOR THIS LICENSE BOSCH REXROTH CORPORATION WILL
44 // NOT BE LIABLE FOR ANY DAMAGES OF ANY KIND ARISING FROM THE USE OF
45 // THE SOFTWARE DISTRIBUTED HEREUNDER, INCLUDING BUT NOT LIMITED TO
46 // DIRECT, INDIRECT, INCIDENTAL, PUNITIVE, AND CONSEQUENTIAL DAMAGES.
47 // -----------------------------------------------------------------------
48 //
58 //
59 // -----------------------------------------------------------------------
60 
61 
62 
82 
88 
94 
100 
204 
209 
210 
211 
212 
213 // -----------------------------------------------------------------------
214 // GLOBAL INCLUDES
215 // -----------------------------------------------------------------------
216 #include "mlpiGlobal.h"
217 
218 
219 // -----------------------------------------------------------------------
220 // GLOBAL CONSTANTS
221 // -----------------------------------------------------------------------
222 #define MLPI_TRACE_MODULE_NAME_SIZE (20)
223 #define MLPI_TRACE_BUFFER_NAME_SIZE (20)
224 #define MLPI_TRACE_FUNCTION_NAME_SIZE (30)
225 #define MLPI_TRACE_MESSAGE_SIZE (130)
226 
227 #define MLPI_TRACE_MAX_MODULES (2000)
228 #define MLPI_TRACE_MAX_BUFFERS (16)
229 
230 #define MLPI_TRACE_MAIN_BUFFER_NAME L"MAIN"
231 #define MLPI_TRACE_KIS_CMD_BUFFER_NAME L"KIS_CMD_LOGGER"
232 
233 #define MLPI_TRACE_MODULE_USER L"MLPI_TRACE_USER"
234 
235 
236 
237 // -----------------------------------------------------------------------
238 // GLOBAL TYPEDEFS
239 // -----------------------------------------------------------------------
240 
243 typedef enum MlpiTraceType
244 {
250 
251 // message packing follows 8 byte natural alignment
252 #if !defined(TARGET_OS_VXWORKS)
253 #pragma pack(push,8)
254 #endif
255 
268 typedef struct MlpiTraceModuleInformation
269 {
270  BOOL8 isActive;
271  BOOL8 toStdOut;
272  BOOL8 toMainBuffer;
273  BOOL8 toSeparateBuffer;
274  WCHAR16 moduleName[MLPI_TRACE_MODULE_NAME_SIZE];
275  WCHAR16 bufferName[MLPI_TRACE_BUFFER_NAME_SIZE];
277 
288 typedef struct MlpiTraceBufferInformation
289 {
290  WCHAR16 bufferName[MLPI_TRACE_BUFFER_NAME_SIZE];
291  LONG maximumBufferSize;
292  LONG actualBufferSize;
293  BOOL8 isLocked;
295 
310 typedef struct MlpiTraceMessage
311 {
312  ULLONG index;
313  MlpiTraceType type;
314  ULONG milliseconds;
315  ULONG lineNumber;
316  ULONG threadId;
317  WCHAR16 text[MLPI_TRACE_MESSAGE_SIZE];
318  WCHAR16 moduleName[MLPI_TRACE_MODULE_NAME_SIZE];
319  WCHAR16 functionName[MLPI_TRACE_FUNCTION_NAME_SIZE];
321 
322 #if !defined(TARGET_OS_VXWORKS)
323 #pragma pack(pop)
324 #endif
325 
327 
328 
329 
330 
331 // -----------------------------------------------------------------------
332 // GLOBAL EXPORTS
333 // -----------------------------------------------------------------------
334 #ifdef MLPI_API
335  #undef MLPI_API
336 #endif
337 
338 #if defined(TARGET_OS_WINNT)
339  #if defined(MLPI_EXPORTS)
340  #define MLPI_API __declspec(dllexport)
341  #elif defined(MLPI_IMPORTS)
342  #define MLPI_API __declspec(dllimport)
343  #else
344  #define MLPI_API
345  #endif
346 #else
347  #if defined(MLPI_EXPORTS)
348  #define MLPI_API __attribute__ ((visibility("default")))
349  #elif defined(MLPI_IMPORTS)
350  #define MLPI_API
351  #else
352  #define MLPI_API
353  #endif
354 #endif
355 
356 
357 #ifdef __cplusplus
358 extern "C" {
359 #endif
360 
382 MLPI_API MLPIRESULT mlpiTraceActivateModule(const MLPIHANDLE connection, const WCHAR16* moduleName);
383 
384 
403 MLPI_API MLPIRESULT mlpiTraceDeactivateModule(const MLPIHANDLE connection, const WCHAR16* moduleName);
404 
405 
425 MLPI_API MLPIRESULT mlpiTraceActivateAllModules(const MLPIHANDLE connection);
426 
427 
442 MLPI_API MLPIRESULT mlpiTraceDeactivateAllModules(const MLPIHANDLE connection);
443 
444 
462 MLPI_API MLPIRESULT mlpiTraceGetNumberOfModules(const MLPIHANDLE connection, ULONG* numberOfModules);
463 
464 
500 MLPI_API MLPIRESULT mlpiTraceGetModuleList(const MLPIHANDLE connection, MlpiTraceModuleInformation *moduleInfo, const ULONG numElements, ULONG *numElementsRet = 0);
501 
502 
521 MLPI_API MLPIRESULT mlpiTraceGetNumberOfBuffers(const MLPIHANDLE connection, ULONG* numberOfBuffers);
522 
523 
557 MLPI_API MLPIRESULT mlpiTraceGetBufferList(const MLPIHANDLE connection, MlpiTraceBufferInformation *bufferInfo, const ULONG numElements, ULONG *numElementsRet = 0);
558 
559 
630 MLPI_API MLPIRESULT mlpiTraceReadBuffer(const MLPIHANDLE connection, const WCHAR16 *bufferName, const ULLONG startIndex, MlpiTraceMessage *messages, const ULONG numElements, ULONG *numElementsRet = 0);
631 
632 
644 MLPI_API MLPIRESULT mlpiTraceGetNewestMessageIndex(const MLPIHANDLE connection, const WCHAR16 *bufferName, ULLONG *newestIndex);
645 
646 
658 MLPI_API MLPIRESULT mlpiTraceGetOldestMessageIndex(const MLPIHANDLE connection, const WCHAR16 *bufferName, ULLONG *oldestIndex);
659 
660 
676 MLPI_API MLPIRESULT mlpiTraceClearAllBuffers(const MLPIHANDLE connection);
677 
678 
702 MLPI_API MLPIRESULT mlpiTraceMessage(const MLPIHANDLE connection, const WCHAR16* text, const WCHAR16 *moduleName=0, const WCHAR16 *functionName=0, const LONG lineNumber=0);
703 
704 
728 MLPI_API MLPIRESULT mlpiTraceWarning(const MLPIHANDLE connection, const WCHAR16* text, const WCHAR16 *moduleName=0, const WCHAR16 *functionName=0, const LONG lineNumber=0);
729 
730 
754 MLPI_API MLPIRESULT mlpiTraceError(const MLPIHANDLE connection, const WCHAR16* text, const WCHAR16 *moduleName=0, const WCHAR16 *functionName=0, const LONG lineNumber=0);
755 
756 
780 MLPI_API MLPIRESULT mlpiTraceEvent(const MLPIHANDLE connection, const WCHAR16* text, const WCHAR16 *moduleName=0, const WCHAR16 *functionName=0, const LONG lineNumber=0);
781 
782 
783 
784 #ifdef __cplusplus
785 }
786 #endif
787 
788 
789 
790 #endif // endof: #ifndef __MLPITRACELIB_H__
long LONG
4 byte signed integer
Definition: mlpiGlobal.h:167
long MLPIRESULT
common MLPI-API return value
Definition: mlpiGlobal.h:200
MLPIRESULT mlpiTraceDeactivateAllModules(const MLPIHANDLE connection)
This function deactivates all available trace modules.
MLPIRESULT mlpiTraceGetModuleList(const MLPIHANDLE connection, MlpiTraceModuleInformation *moduleInfo, const ULONG numElements, ULONG *numElementsRet=0)
This function returns a list of all modules currently available in the tracing system. The module information also contains the name of each module. This name can be used with other calls to the tracing system.
MLPIRESULT mlpiTraceActivateAllModules(const MLPIHANDLE connection)
This function activates all available trace modules.
unsigned long long ULLONG
8 byte unsigned integer
Definition: mlpiGlobal.h:171
signed char BOOL8
1 byte boolean
Definition: mlpiGlobal.h:158
MLPIRESULT mlpiTraceGetNumberOfBuffers(const MLPIHANDLE connection, ULONG *numberOfBuffers)
This function returns the number of registered buffers.
MLPIRESULT mlpiTraceDeactivateModule(const MLPIHANDLE connection, const WCHAR16 *moduleName)
This function deactivates a trace module. Messages to a deactivated trace module are ignored by the t...
MLPIRESULT mlpiTraceClearAllBuffers(const MLPIHANDLE connection)
This function clears all buffers. This means that all trace messages currently available and stored i...
MLPIRESULT mlpiTraceError(const MLPIHANDLE connection, const WCHAR16 *text, const WCHAR16 *moduleName=0, const WCHAR16 *functionName=0, const LONG lineNumber=0)
This function traces an error.
struct MlpiTraceModuleInformation MlpiTraceModuleInformation
This structure defines the information about a trace module as used by mlpiTraceGetModuleList.
MLPIRESULT mlpiTraceGetBufferList(const MLPIHANDLE connection, MlpiTraceBufferInformation *bufferInfo, const ULONG numElements, ULONG *numElementsRet=0)
This function returns a list of all buffers currently available in the tracing system. The buffer information also contains the name of each buffer. This name can be used with other calls to the tracing system.
wchar_t WCHAR16
UTF16 string.
Definition: mlpiGlobal.h:193
MLPIRESULT mlpiTraceGetOldestMessageIndex(const MLPIHANDLE connection, const WCHAR16 *bufferName, ULLONG *oldestIndex)
This function returns the message index of the oldest message available in the given trace buffer...
MLPIRESULT mlpiTraceActivateModule(const MLPIHANDLE connection, const WCHAR16 *moduleName)
This function activates a trace module. Trace messages to modules which are not activated will not be...
MLPIRESULT mlpiTraceGetNewestMessageIndex(const MLPIHANDLE connection, const WCHAR16 *bufferName, ULLONG *newestIndex)
This function returns the message index of the newest message available in the given trace buffer...
MLPIRESULT mlpiTraceEvent(const MLPIHANDLE connection, const WCHAR16 *text, const WCHAR16 *moduleName=0, const WCHAR16 *functionName=0, const LONG lineNumber=0)
This function traces an event.
MLPIRESULT mlpiTraceWarning(const MLPIHANDLE connection, const WCHAR16 *text, const WCHAR16 *moduleName=0, const WCHAR16 *functionName=0, const LONG lineNumber=0)
This function traces a warning.
Entry is log message.
Definition: mlpiTraceLib.h:246
MLPIRESULT mlpiTraceGetNumberOfModules(const MLPIHANDLE connection, ULONG *numberOfModules)
This function returns the number of registered modules.
MlpiTraceType
This enumeration defines the different types of entries that can be found in a trace buffer...
Definition: mlpiTraceLib.h:243
struct MlpiTraceBufferInformation MlpiTraceBufferInformation
This structure defines the information about a trace buffer as used by mlpiTraceGetBufferList.
MLPIRESULT mlpiTraceReadBuffer(const MLPIHANDLE connection, const WCHAR16 *bufferName, const ULLONG startIndex, MlpiTraceMessage *messages, const ULONG numElements, ULONG *numElementsRet=0)
This functions returns the messages of a given buffer.
Entry is error.
Definition: mlpiTraceLib.h:248
unsigned long ULONG
4 byte unsigned integer
Definition: mlpiGlobal.h:168
Entry is warning.
Definition: mlpiTraceLib.h:247
MLPIRESULT mlpiTraceMessage(const MLPIHANDLE connection, const WCHAR16 *text, const WCHAR16 *moduleName=0, const WCHAR16 *functionName=0, const LONG lineNumber=0)
This function traces a message.
unsigned long MLPIHANDLE
common MLPI-API handle value
Definition: mlpiGlobal.h:206
struct MlpiTraceMessage MlpiTraceMessage
This structure defines the information about a trace buffer as used by mlpiTraceReadBuffer.
Unspecified message type.
Definition: mlpiTraceLib.h:245