aboutsummaryrefslogtreecommitdiff
path: root/SrcShared/Palm/Platform/Incs/Core/UI/AttentionMgr.h
blob: c466a1f52d1e14f8e86b8b7db99c63ec1d424954 (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/******************************************************************************
 *
 * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
 * All rights reserved.
 *
 * File: AttentionMgr.h
 *
 * Release: 
 *
 * Description:
 *		Include file for Attention Manager
 *
 * History:
 *			Name	Date		Description
 *			----	----		-----------
 *			peter	06/12/00	Initial Revision
 *			gap	07/21/00	Change parameter list and data structures to support
 *								specification of card number as well as dbID.
 *
 *****************************************************************************/

#ifndef __ATTENTION_MGR_H__
#define __ATTENTION_MGR_H__

#include <PalmTypes.h>
#include <CoreTraps.h>
#include <Rect.h>
#include <SysEvent.h>
#include <Event.h>

/************************************************************
 * Attention Manager result codes
 * (attnErrorClass is defined in ErrorBase)
 *************************************************************/
#define	attnErrMemory			(attnErrorClass | 1)	// ran out of memory


/************************************************************
 * Attention Indicator bounds
 *************************************************************/
#define kAttnIndicatorLeft		0
#define kAttnIndicatorTop		0
#define kAttnIndicatorWidth	16
#define kAttnIndicatorHeight	15
	

/************************************************************
 * Constants used for list view drawing.
 *
 * Applications should use the following constants to format 
 * the display of information in attention manager list view.
 *
 * The application's small icon should be drawn centered within
 * the first kAttnListMaxIconWidth pixels of the drawing bounds.
 *
 * Two lines of text information describing the attention should 
 * then be drawn left justified starting at kAttnListTextOffset 
 * from the left edge of the drawing bounds.
 *************************************************************/
#define	kAttnListMaxIconWidth	15
#define	kAttnListTextOffset		17
			
			
/********************************************************************
 * Attention Manager Structures
 ********************************************************************/

typedef UInt32 AttnFlagsType;

#define kAttnFlagsSoundBit				((AttnFlagsType)0x0001)
#define kAttnFlagsLEDBit				((AttnFlagsType)0x0002)
#define kAttnFlagsVibrateBit			((AttnFlagsType)0x0004)
#define kAttnFlagsCustomEffectBit	((AttnFlagsType)0x0008)
	// Note: More bits can be defined if/when hardware capability increases

#define kAttnFlagsAllBits				((AttnFlagsType)0xFFFF)


// The following are passed to AttnGetAttention() and AttnUpdate to specify
// overrides from the user settings for an attention request.
#define kAttnFlagsUseUserSettings	((AttnFlagsType)0x00000000)

#define kAttnFlagsAlwaysSound			(kAttnFlagsSoundBit)
#define kAttnFlagsAlwaysLED			(kAttnFlagsLEDBit)
#define kAttnFlagsAlwaysVibrate		(kAttnFlagsVibrateBit)
#define kAttnFlagsAlwaysCustomEffect (kAttnFlagsCustomEffectBit)
#define kAttnFlagsEverything			(kAttnFlagsAllBits)

#define kAttnFlagsNoSound				(kAttnFlagsSoundBit<<16)
#define kAttnFlagsNoLED					(kAttnFlagsLEDBit<<16)
#define kAttnFlagsNoVibrate			(kAttnFlagsVibrateBit<<16)
#define kAttnFlagsNoCustomEffect		(kAttnFlagsCustomEffectBit<<16)
#define kAttnFlagsNothing				(kAttnFlagsAllBits<<16)


// The following are used to interpret the feature.
#define kAttnFtrCreator					'attn'
#define kAttnFtrCapabilities			0			// Read to determine device capabilities and user settings.

#define kAttnFlagsUserWantsSound		(kAttnFlagsSoundBit)
#define kAttnFlagsUserWantsLED		(kAttnFlagsLEDBit)
#define kAttnFlagsUserWantsVibrate	(kAttnFlagsVibrateBit)
#define kAttnFlagsUserWantsCustomEffect (kAttnFlagsCustomEffectBit)	// Always false
#define kAttnFlagsUserSettingsMask	(kAttnFlagsAllBits)

#define kAttnFlagsHasSound				(kAttnFlagsSoundBit<<16)
#define kAttnFlagsHasLED				(kAttnFlagsLEDBit<<16)
#define kAttnFlagsHasVibrate			(kAttnFlagsVibrateBit<<16)
#define kAttnFlagsHasCustomEffect	(kAttnFlagsCustomEffectBit<<16)	// Always true
#define kAttnFlagsCapabilitiesMask	(kAttnFlagsAllBits<<16)


typedef UInt16 AttnLevelType;
	#define kAttnLevelInsistent		((AttnLevelType)0)
	#define kAttnLevelSubtle			((AttnLevelType)1)

typedef UInt16 AttnCommandType;
	#define kAttnCommandDrawDetail	((AttnCommandType)1)
	#define kAttnCommandDrawList		((AttnCommandType)2)
	#define kAttnCommandPlaySound		((AttnCommandType)3)
	#define kAttnCommandCustomEffect	((AttnCommandType)4)
	#define kAttnCommandGoThere		((AttnCommandType)5)
	#define kAttnCommandGotIt			((AttnCommandType)6)
	#define kAttnCommandSnooze			((AttnCommandType)7)
	#define kAttnCommandIterate		((AttnCommandType)8)

typedef union AttnCommandArgsTag {
	struct AttnCommandArgsDrawDetailTag{
		RectangleType bounds;
		Boolean firstTime;
		AttnFlagsType flags;
	} drawDetail;
	
	struct AttnCommandArgsDrawListTag {
		RectangleType bounds;
		Boolean firstTime;
		AttnFlagsType flags;
		Boolean selected;
	} drawList;
	
	struct AttnCommandArgsGotItTag {
		Boolean dismissedByUser;
	} gotIt;
	
	struct AttnCommandArgsIterateTag {
		UInt32 iterationData;
	} iterate;
} AttnCommandArgsType;

typedef struct {
	AttnCommandType command;
	UInt32 userData;
	AttnCommandArgsType *commandArgsP;
} AttnLaunchCodeArgsType;

typedef Err AttnCallbackProc (AttnCommandType command, UInt32 userData, AttnCommandArgsType *commandArgsP);

// These details go with the sysNotifyGotUsersAttention notification.
typedef struct {
	AttnFlagsType flags;
} AttnNotifyDetailsType;


/********************************************************************
 * Public Attention Manager Routines
 ********************************************************************/
#ifdef REMOVE_FOR_EMULATOR
#ifdef __cplusplus
extern "C" {
#endif

Err AttnGetAttention (UInt16 cardNo, LocalID dbID, UInt32 userData,
	AttnCallbackProc *callbackFnP, AttnLevelType level, AttnFlagsType flags,
	UInt16 nagRateInSeconds, UInt16 nagRepeatLimit)
		SYS_TRAP(sysTrapAttnGetAttention);

Boolean AttnUpdate (UInt16 cardNo, LocalID dbID, UInt32 userData,
	AttnCallbackProc *callbackFnP, AttnFlagsType *flagsP,
	UInt16 *nagRateInSecondsP, UInt16 *nagRepeatLimitP)
		SYS_TRAP(sysTrapAttnUpdate);

Boolean AttnForgetIt (UInt16 cardNo, LocalID dbID, UInt32 userData)
		SYS_TRAP(sysTrapAttnForgetIt);

UInt16 AttnGetCounts (UInt16 cardNo, LocalID dbID, UInt16 *insistentCountP, UInt16 *subtleCountP)
		SYS_TRAP(sysTrapAttnGetCounts);

void AttnListOpen (void)
		SYS_TRAP(sysTrapAttnListOpen);

void AttnIterate (UInt16 cardNo, LocalID dbID, UInt32 iterationData)
		SYS_TRAP(sysTrapAttnIterate);

Err AttnDoSpecialEffects(AttnFlagsType flags)
		SYS_TRAP(sysTrapAttnDoSpecialEffects);

void AttnIndicatorEnable(Boolean enableIt)
		SYS_TRAP(sysTrapAttnIndicatorEnable);

Boolean AttnIndicatorEnabled(void)
		SYS_TRAP(sysTrapAttnIndicatorEnabled);


#ifdef __cplusplus 
}
#endif
#endif

#endif  // __ATTENTION_MGR_H__