aboutsummaryrefslogtreecommitdiff
path: root/libcontextprovider/context-provide/context-provide.1
blob: e8a3b5ce88b57457de3e7577b986ea1d8acce688 (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
.TH context-provide 1 Nov-18-2009

.SH NAME
context-provide
- A tool to provide ContextKit properties to debug and inspect applications

.SH SYNOPSIS
.B context-provide [\fI--session\fR | \fI--system\fR] \fR[\fIBUSNAME\fR] [\fITYPE\fR \fINAME\fR \fIINITVALUE\fR]...

.SH DESCRIPTION
\fBcontext-provide\fR is an interactive tool to set (provide)
properties of the ContextKit.  It can be used to simulate an actual
provider to debug applications using the ContextKit.  When launched,
the tool presents a simple console where commands can be issued to
provide new keys and set their values.

Properties can also be provided on the command line with \fITYPE\fR
\fINAME\fR \fIINITVALUE\fR triplets.

When ran, the tool automatically claims the specified \fIBUSNAME\fR and if
there were properties specified on the command line, it will provide them
right away.  To add new properties, use the \fB`add'\fR command.

If no \fIBUSNAME\fR is given the tool acts as a Commander, taking control of
all subscribers in the system.  This mode by default proxies the real values
of all properties.  To control a property you have to \fB`add'\fR the
property, which stops forwarding the corresponding property.  You can undo
this via the \fB`del'\fR command.

Values are input using JSon notation (http://json.org/) relaxed to allow other
top-level elements than objects (ie. you can write `"some text"' or `23.1'
directly).  As an executive summary, the allowed data types are \fBstrings\fR
("soylent green"), \fBnumbers\fR (2, 6.9), heterogeneous \fBlists\fR ([1, 1.5,
3, "foo"]) and \fBdictionaries\fR with string keys ({"foo": 1, "bar": 2}).

.SH OPTIONS
.TP
\fB--system\fR
Use the system bus.
.TP
\fB--session\fR
Use the session bus (the default).

.SH COMMANDS
.TP
\fBadd\fR \fITYPE\FR \fIKEY\fR [\fIINITVALUE\fR]

Adds a key named \fIKEY\fR with the given \fITYPE\fR to the list of provided
properties.  The initial value will be \fIINITVALUE\fR if specified, otherwise
unset (null).  This has to be called before an attempt is made to set a key
value.  \fITYPE\fR can be any type described in the \fBtype registry\fR
(located in /usr/share/contextkit/core.types, overridden by the
CONTEXT_CORE_TYPES environment variable).  Some examples are: value, bool,
number, integer, string, list, map.  For backward compatibility, INT, BOOL,
and DOUBLE may also be used as type.

Example: "add integer Battery.Status 20".

In \fICommander mode\fR it also stops proxying the real property.
.TP
\fBsettype\fR \fIKEY\fR \fITYPE FRAGMENT\fR

Sets the type of \fIKEY\fR to the NanoXML fragment.  For convenience, "type"
is interpreted as "<type/>".  See
/usr/share/doc/contextkit/html/context-types.html for more information.
.TP
\fBdel\fR \fIKEY\fR

Makes context-provide forget \fIKEY\fR.  In \fICommander mode\fR, restores
proxying of the real property.
.TP
\fIKEY\fB=\fIVALUE\fR

Sets the given \fIKEY\fR value to the new \fIVALUE\fR, which has to be in JSon
format (see above).  For backward compatibility, if the type of the property
is \fBstring\fR, the value is accepted without quotes.

Example: "Battery.Status=99".

.TP
\fBunset\fR \fIKEY\fR

Sets the given \fIKEY\fR to non specified (null).
.TP
\fBinfo\fR \fIKEY\fR

Prints the type, name and current value of \fIKEY\fR.  In \fICommander mode\fR
the real value (from the original provider) is printed as well.
.TP
\fBlist\fR

Same as calling `info' for all known keys (both proxied and added ones).
.TP
\fBsleep\fR \fIINTERVAL\fR

Sleeps and blocks the main loop for the given amount of seconds.  Used mainly
for internal testing purposes.  Example: "sleep 10".
.TP
\fBdump\fR [\fIFILENAME\fR]

Dumps the currently added properties to an XML .context file defined by the
\fIFILENAME\fR (the default is 'context-provide.context' in the current
directory).
.TP
\fBrestart\fR

Tries to republish the \fIBUSNAME\fR of the provider on D-Bus, exit if it
fails.
.TP
\fBexit\fR

Exits the program.

.SH EXAMPLE SESSIONS
Starts up a provider, initially having a single integer property named
an.example with the default value of 42.

  ./context-provide dbus.service.name integer an.example 42

Starts up the provider on the system bus without any properties, then
add some through the command line interface.

  ./context-provide --system org.bottomdrawer.kit2000
    add integer example.int 33
    add string example.string
    example.string = value1
    example.string = value2
    unset example.int

.SH SEE ALSO
.BR context-listen (1)
.BR context-ls (1)
.BR /usr/share/doc/contextkit/html/*.html