context-provide man page

context-provide — A tool to provide ContextKit properties to debug and inspect applications


context-provide [--session | --system] [BUSNAME] [TYPE NAME INITVALUE]...


context-provide 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 TYPE NAME INITVALUE triplets.

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

If no BUSNAME 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 `add' the property, which stops forwarding the corresponding property.  You can undo this via the `del' command.

Values are input using JSon notation ( 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 strings ("soylent green"), numbers (2, 6.9), heterogeneous lists ([1, 1.5, 3, "foo"]) and dictionaries with string keys ({"foo": 1, "bar": 2}).



Use the system bus.


Use the session bus (the default).



Adds a key named KEY with the given TYPE to the list of provided properties.  The initial value will be INITVALUE if specified, otherwise unset (null).  This has to be called before an attempt is made to set a key value.  TYPE can be any type described in the type registry (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 Commander mode it also stops proxying the real property.


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

del KEY

Makes context-provide forget KEY.  In Commander mode, restores proxying of the real property.


Sets the given KEY value to the new VALUE, which has to be in JSon format (see above).  For backward compatibility, if the type of the property is string, the value is accepted without quotes.

Example: "Battery.Status=99".

unset KEY

Sets the given KEY to non specified (null).

info KEY

Prints the type, name and current value of KEY.  In Commander mode the real value (from the original provider) is printed as well.


Same as calling `info' for all known keys (both proxied and added ones).


Sleeps and blocks the main loop for the given amount of seconds.  Used mainly for internal testing purposes.  Example: "sleep 10".


Dumps the currently added properties to an XML .context file defined by the FILENAME (the default is 'context-provide.context' in the current directory).


Tries to republish the BUSNAME of the provider on D-Bus, exit if it fails.


Exits the program.

Example Sessions

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

 ./context-provide 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 33
   add string example.string
   example.string = value1
   example.string = value2

See Also

context-listen(1) context-ls(1) /usr/share/doc/contextkit-doc/html/*.html

Referenced By