/
profiled.txt
228 lines (156 loc) · 4.96 KB
/
profiled.txt
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
PROFILE DAEMON PLANNING
Contents:
1 Client Side View
1.1 Control / Query API
1.2 Indication Messages
2 Server Side View
2.1 Static Configuration
2.2 Dynamic State
2.3 INI File Contents
2.3.1 Sample Content
2.3.2 Sections
2.3.3 Key names
2.3.4 Datatypes
2.4 Value Lookup
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1 Client Side View
==================
1.1 Control / Query API
-----------------------
Implemented as dbus method calls.
- get_profiles() -> string[]
- has_profile(profile) -> bool
- get_proflie() -> string
- add_profile(profile, clone_from) -> bool
- get_keys() -> string[]
- get_value(profile, key) -> value
- set_value(profile, key, value) -> bool
- get_datatype(profile, key) -> string
- get_values(profile) -> key_val_datatype[]
1.2 Indication Messages
-----------------------
Implemented as dbus signals with:
- profile name
- is_current flag
- list of (key,val) tuples affected
Apart from some special cases (profile editor?) clients should
ignore signals with unset is_current.
Profile change creates signal with is_current flag set and
values for all keys.
Changes to individual keys should probably be pooled for a
while and send in one burst.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2 Server Side View
==================
2.1 Static Configuration
------------------------
Initial sane state for profile data is obtained by parsing ini
files in /etc/profiles directory. These files are not modified
by the daemon.
The files are parsed in ascending ascii order, allowing us
to impose priority convention similar to /etc/init?.d/ files.
Basically the priority levels needed are something like:
* Applications: Allows 3rd party apps to extend the set of keys
available and make them editable in profile editor too. Might
also be useful in develpment/debug phase of internally
developed applications.
* Product: Allows us to have one control point where values from
product speficications are enforced.
* Special cases: Might make some people happy if they can do
things like force alarms to be both audible and vibrating
regardless how the product specs evolve...
Example:
% ls /etc/profiles/
10.clock.ini
10.display.ini
:
30.app_from_net.ini
:
50.nokia-n810.ini
90.myhacks.ini
2.2 Dynamic State
-----------------
Any changes to profile data after the startup are kept separate
from the static configuration. The delta information is
mirrored to file: /var/profiles/values.ini.
When active profile is changed, the name of the profile
will be written to file: /var/profiles/current.
The daemon pid is written at startup to: /var/profiles/pid.
2.3 INI File Contents
---------------------
2.3.1 Sample Content
....................
Example:
[fallback]
system.callcoming.ringtone = /path/to/beepbeep.mp3
system.callcoming.ringlevel = 3
system.callcoming.vibrate = On
system.callcoming.flash = On
:
[datatype]
system.callcoming.ringtone = Sound
system.callcoming.ringlevel = Integer 0/5
system.callcoming.vibrate = Boolean
system.callcoming.flash = Boolean
:
[meeting]
system.callcoming.ringlevel = 1
:
[silent]
system.callcoming.ringlevel = 0
system.callcoming.vibrate = Off
:
2.3.2 Sections
..............
Required sections:
- fallback: sane values for all profile keys in use
- datatype: datatype specification for all keys
Optional sections:
- <profile>: values that differ from fallback data
- override: allows overriding keys in all sections
2.3.3 Key names
...............
The keys in ini files should be constructed in hierarchical
manner - this allows interactive editors to show tree like
views and keeps related items close to one another.
2.3.4 Datatypes
...............
Basic structure:
dataspec: <keyname> '=' <typename> [<rangespec> | <listspec>]
rangespec: <number>'/'<number>['/'<number>]
listspec: <value> [value] ...
Simple built in types:
- Integer
- String
- Double
- Boolean
These can be validated by the daemon if so decided.
Custom types:
- Sound
- Image
- Color
From storage & transfer & daemon point of view these are strings,
they just provide hints for profile editor. For example Sound or
Image might be name of a builtin value or path to a file.
Examples:
keytonevol = Integer 0/5
or
keytonevol = Integer 0 1 2 3 4 5
ringtonevol = Integer 0/100/25
or
ringtonevol = Integer 25 50 75 100
favfruit = String Apple Orange Banana
ringtone = Sound
background = Image
vibrating = Bool
2.4 Value Lookup
----------------
The key queries are resolved in the following order:
1. try lookup(dynamic, profile_name, key_name)
-> anything user has modified.
2. try lookup(static, 'override', key_name)
-> special optional rules
3. try lookup(static, profile_name, key_name)
-> actual profile
4. try lookup(static, 'fallback', key_name)
-> sane values from fallback section