aboutsummaryrefslogtreecommitdiff
path: root/SrcShared/TracerCommon.h
blob: f8ace3e60220459d551d98fb7786a40e117cc352 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* -*- mode: C++; tab-width: 4 -*- */
/* ===================================================================== *\
	Copyright (c) 2000-2001 Palm, Inc. or its subsidiaries.
	All rights reserved.

	This file is part of the Palm OS Emulator.

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.
\* ===================================================================== */

#ifndef _TRACER_COMMON_H_
#define _TRACER_COMMON_H_

#include <stdarg.h>				// va_list
#include <stdlib.h>				// size_t
#include "SessionFile.h"		// SessionFile


// Structures kept in memory
struct TracerTypeInfo
{
	char type			[8];
	char friendlyName	[32];
	char paramDescr		[32];
	char paramDefVal	[16];
	char paramCurVal	[256];
	char paramTmpVal	[256];
	bool autoConnectSupport;
	bool autoConnectCurState;
	bool autoConnectTmpState;
};

class TracerBase
{
public:
							TracerBase	(void);
	virtual					~TracerBase	(void);
	
	// Tracing subsystem lifecycle
	virtual void			Initialize	(void) = 0;
	virtual void 			Dispose		(void) = 0;
	
	// Tracer Type control
	virtual void			SetCurrentTracerTypeIndex	(unsigned short tracerType, Bool paramChange = false) = 0;
	virtual TracerTypeInfo*	GetCurrentTracerTypeInfo	(void);
	virtual TracerTypeInfo*	GetTracerTypeInfo			(unsigned short index);
	virtual unsigned short	GetTracerTypeCount			(void);
	virtual unsigned short	GetCurrentTracerTypeIndex	(void);

	// HostTrace* counterparts
	virtual void			InitOutputPort	(void) = 0;		
	virtual void			CloseOutputPort	(void) = 0;		
	virtual void			OutputVT		(unsigned short errModule, const char* formatString, va_list args) = 0;
	virtual void			OutputVTL		(unsigned short errModule, const char* formatString, va_list args) = 0;
	virtual void			OutputB			(unsigned short errModule, const void* buffer, size_t bufferLen) = 0;

	// User feedback
	virtual bool			IsLibraryLoaded			(void) = 0;
	virtual void			GetLibraryVersionString	(char* buffer, size_t bufferLen) = 0;
	virtual unsigned long	GetLibraryVersionNumber	(void) { return 0; };
	virtual long			GetConnectionStatus		(void) = 0;
	
	virtual void			LoadTracerTypeList		(void);
	virtual void			DisposeTracerTypeList	(void);

	virtual void			StopTracer				(void) = 0;

	virtual void			SaveTracerPrefs			(void);
	virtual unsigned short	LoadTracerPrefs			(void);

	virtual void 			GetTracerCapabilities	(char* buffer, size_t* bufferLen) = 0;
	virtual void			GetCapsToken			(char* src, char* tag, char* dst, size_t dstSize);

protected:
	unsigned long	tracerRefCounter;		// Number of referenced subsystem users
	unsigned short	supportedTypesCount;
	unsigned short	runningTracerType;
	unsigned short	previousTracerType;
	TracerTypeInfo*	supportedTypesTable;
};

#endif // _TRACER_COMMON_H_