Tcl DBus Interface

Check-in [0b9fd275de]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add -id option to the signal subcommand to allow user specified SignalID's.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:0b9fd275ded5414d1373649c6b573de65234a83850dc955597514ecf19659216
User & Date: schelte 2014-10-30 11:41:56
Context
2014-11-11
10:28
- Bug fixes submitted by stwo check-in: 726254c7ec user: schelte tags: trunk, release-1-1
2014-10-30
11:41
Add -id option to the signal subcommand to allow user specified SignalID's. check-in: 0b9fd275de user: schelte tags: trunk
2013-08-17
19:47
- Unify naming format of the package with the dbus package check-in: fa37a0c13a user: schelte tags: trunk, dbif-1-0
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.

19
20
21
22
23
24
25
26




	- No more magic variables in a property script. The local variable has
	  the same name as the property.
	- Check if the value provided for a property matches the signature.
	- New "delete" subcommand to delete a node subtree.
	- Let dbif default return the current defaults.
	- If no defaults have been set up, set the default bus to the bus used
	  when connecting.
	- The introspect method now lists the the GetAll method for properties.











|
>
>
>
>
19
20
21
22
23
24
25
26
27
28
29
30
	- No more magic variables in a property script. The local variable has
	  the same name as the property.
	- Check if the value provided for a property matches the signature.
	- New "delete" subcommand to delete a node subtree.
	- Let dbif default return the current defaults.
	- If no defaults have been set up, set the default bus to the bus used
	  when connecting.
	- The introspect method now lists the GetAll method for properties.

Version 1.1 - Sep 6 2014
	- Add -id option to the signal subcommand to allow user specified
	  SignalID's.

Changes to Makefile.in.

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

dist-clean:
	rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.*

dist: dist-clean
	mkdir -p $(DIST_DIR)
	cp -p $(srcdir)/ChangeLog $(srcdir)/INSTALL* $(srcdir)/README* \
		$(srcdir)/license* $(srcdir)/aclocal.m4 $(srcdir)/configure \
		$(srcdir)/*.in $(DIST_DIR)/
	chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4
	chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in

	for i in $(srcdir)/*.tcl; do \
	    if [ -f $$i ]; then \
		cp -p $$i $(DIST_DIR)/ ; \
	    fi; \







|
|







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

dist-clean:
	rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.*

dist: dist-clean
	mkdir -p $(DIST_DIR)
	cp -p $(srcdir)/ChangeLog $(srcdir)/INSTALL* $(srcdir)/README* \
		$(srcdir)/license* $(srcdir)/dbif.m4 $(srcdir)/aclocal.m4 \
		$(srcdir)/configure $(srcdir)/*.in $(DIST_DIR)/
	chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4
	chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in

	for i in $(srcdir)/*.tcl; do \
	    if [ -f $$i ]; then \
		cp -p $$i $(DIST_DIR)/ ; \
	    fi; \

Changes to configure.

1
2
3
4
5
6
7
8
9
10
...
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
....
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
....
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
....
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
....
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
....
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
....
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for dbif 1.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
................................................................................
subdirs=
MFLAGS=
MAKEFLAGS=

# Identity of this package.
PACKAGE_NAME='dbif'
PACKAGE_TARNAME='dbif'
PACKAGE_VERSION='1.0'
PACKAGE_STRING='dbif 1.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

ac_subst_vars='LTLIBOBJS
LIBOBJS
INSTALLDOC
DTPLITE_PROG
................................................................................
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
  # Omit some internal or obsolete options to make the list less imposing.
  # This message is too long to be a string in the A/UX 3.1 sh.
  cat <<_ACEOF
\`configure' configures dbif 1.0 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.
................................................................................

  cat <<\_ACEOF
_ACEOF
fi

if test -n "$ac_init_help"; then
  case $ac_init_help in
     short | recursive ) echo "Configuration of dbif 1.0:";;
   esac
  cat <<\_ACEOF

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-tcl              directory containing tcl configuration
................................................................................
    cd "$ac_pwd" || { ac_status=$?; break; }
  done
fi

test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
  cat <<\_ACEOF
dbif configure 1.0
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
  exit
................................................................................
  as_fn_set_status $ac_retval

} # ac_fn_c_try_compile
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by dbif $as_me 1.0, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ $0 $@

_ACEOF
exec 5>>config.log
{
................................................................................
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1

cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by dbif $as_me 1.0, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  CONFIG_FILES    = $CONFIG_FILES
  CONFIG_HEADERS  = $CONFIG_HEADERS
  CONFIG_LINKS    = $CONFIG_LINKS
  CONFIG_COMMANDS = $CONFIG_COMMANDS
  $ $0 $@
................................................................................

Report bugs to the package provider."

_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
dbif config.status 1.0
configured by $0, generated by GNU Autoconf 2.69,
  with options \\"\$ac_cs_config\\"

Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."



|







 







|
|







 







|







 







|







 







|







 







|







 







|







 







|







1
2
3
4
5
6
7
8
9
10
...
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
....
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
....
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
....
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
....
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
....
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
....
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for dbif 1.1.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
................................................................................
subdirs=
MFLAGS=
MAKEFLAGS=

# Identity of this package.
PACKAGE_NAME='dbif'
PACKAGE_TARNAME='dbif'
PACKAGE_VERSION='1.1'
PACKAGE_STRING='dbif 1.1'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

ac_subst_vars='LTLIBOBJS
LIBOBJS
INSTALLDOC
DTPLITE_PROG
................................................................................
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
  # Omit some internal or obsolete options to make the list less imposing.
  # This message is too long to be a string in the A/UX 3.1 sh.
  cat <<_ACEOF
\`configure' configures dbif 1.1 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.
................................................................................

  cat <<\_ACEOF
_ACEOF
fi

if test -n "$ac_init_help"; then
  case $ac_init_help in
     short | recursive ) echo "Configuration of dbif 1.1:";;
   esac
  cat <<\_ACEOF

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-tcl              directory containing tcl configuration
................................................................................
    cd "$ac_pwd" || { ac_status=$?; break; }
  done
fi

test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
  cat <<\_ACEOF
dbif configure 1.1
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
  exit
................................................................................
  as_fn_set_status $ac_retval

} # ac_fn_c_try_compile
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by dbif $as_me 1.1, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ $0 $@

_ACEOF
exec 5>>config.log
{
................................................................................
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1

cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by dbif $as_me 1.1, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  CONFIG_FILES    = $CONFIG_FILES
  CONFIG_HEADERS  = $CONFIG_HEADERS
  CONFIG_LINKS    = $CONFIG_LINKS
  CONFIG_COMMANDS = $CONFIG_COMMANDS
  $ $0 $@
................................................................................

Report bugs to the package provider."

_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
dbif config.status 1.1
configured by $0, generated by GNU Autoconf 2.69,
  with options \\"\$ac_cs_config\\"

Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."

Changes to configure.in.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Set your package name and version numbers here.
#
# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
# set as provided.  These will also be added as -D defs in your Makefile
# so you can encode the package version directly into the source files.
#-----------------------------------------------------------------------

AC_INIT([dbif], [1.0])

#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------








|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Set your package name and version numbers here.
#
# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
# set as provided.  These will also be added as -D defs in your Makefile
# so you can encode the package version directly into the source files.
#-----------------------------------------------------------------------

AC_INIT([dbif], [1.1])

#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------

Changes to dbif.tcl.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
325
326
327
328
329
330
331

332

333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
#
# The following interfaces are supported:
#	org.freedesktop.DBus.Peer
#	org.freedesktop.DBus.Introspectable
#	org.freedesktop.DBus.Properties

package require dbus 2.0
package provide dbif 1.0
package provide dbus-intf 1.0

namespace eval dbus::dbif {
    # Setup some defaults in case the user doesn't specify certain options
    variable defaults [dict create bus session intf com.tclcode.default]

    # Store a copy of the message info of the last received message so it
    # won't be necessary to pass it around all the time
................................................................................
}

# Define a signal that the application may send
#
proc dbus::dbif::signal {args} {
    variable defaults; variable dbif; variable signal; variable sigid
    dict with defaults {}

    cmdline opt arg {path name {in {}} {opt {}} {arglist {}} {body {}}} $args {

	-bus: {set bus [buscheck $arg]}
	-interface: {set intf [intfcheck $arg]}
    }
    if {$body eq ""} {
	set body $arglist
	set arglist $opt
	set interp ""
    } else {
	set interp $opt
    }
    namecheck $name
    create $bus $path $intf
    set id signal[incr sigid]
    set dict [dict create \
      bus $bus path $path interface $intf name $name command "" interp $interp]
    if {$body ne ""} {
	set ns [getns $interp]
	dict set dict command [list apply [list $arglist $body $ns]]
    }
    set signal($id) [dict merge $dict [args $in]]







|
|







 







>

>












|







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
#
# The following interfaces are supported:
#	org.freedesktop.DBus.Peer
#	org.freedesktop.DBus.Introspectable
#	org.freedesktop.DBus.Properties

package require dbus 2.0
package provide dbif 1.1
package provide dbus-intf 1.1

namespace eval dbus::dbif {
    # Setup some defaults in case the user doesn't specify certain options
    variable defaults [dict create bus session intf com.tclcode.default]

    # Store a copy of the message info of the last received message so it
    # won't be necessary to pass it around all the time
................................................................................
}

# Define a signal that the application may send
#
proc dbus::dbif::signal {args} {
    variable defaults; variable dbif; variable signal; variable sigid
    dict with defaults {}
    set id ""
    cmdline opt arg {path name {in {}} {opt {}} {arglist {}} {body {}}} $args {
	-id: {set id $arg}
	-bus: {set bus [buscheck $arg]}
	-interface: {set intf [intfcheck $arg]}
    }
    if {$body eq ""} {
	set body $arglist
	set arglist $opt
	set interp ""
    } else {
	set interp $opt
    }
    namecheck $name
    create $bus $path $intf
    if {$id eq ""} {set id signal[incr sigid]}
    set dict [dict create \
      bus $bus path $path interface $intf name $name command "" interp $interp]
    if {$body ne ""} {
	set ns [getns $interp]
	dict set dict command [list apply [list $arglist $body $ns]]
    }
    set signal($id) [dict merge $dict [args $in]]

Changes to doc/dbif.man.

1
2
3
4
5
6
7
8
9
10
11
...
217
218
219
220
221
222
223

224
225
226
227
228
229
230
231







232
233
234
235
236
237
238
[comment {-*- tcl -*- doctools manpage}]
[vset libname dbif]
[vset cmdname dbif]
[vset version 1.0]
[manpage_begin [vset libname] n [vset version]]
[copyright {2008-2013 Schelte Bron}]
[moddesc {Tcl D-Bus Interface}]
[titledesc {Application layer around the Tcl D-Bus library}]
[require Tcl 8.5]
[require dbus "2.0"]
[require [vset libname] [vset version]]
................................................................................

[call [cmd [vset cmdname]] [method return] [arg messageID] \
  [arg returnvalue]]

Send a D-Bus return message in response to a D-Bus method call.

[call [cmd [vset cmdname]] [method signal] \

  [opt "[option -bus] [arg bustype]"] \
  [opt "[option -interface] [arg interface]"] \
  [arg path] [arg name] \
  [opt "[arg arglist] [opt "[opt [arg interp]] [arg args] [arg body]"]"]]

Define a signal that the application may emit. This command returns
a signal identifier that may be used with the [cmd [vset cmdname]]
[method generate] subcommand to actually send the signal onto the D-Bus.







If the optional [arg args] and [arg body] arguments are specified, body
will be executed when the signal is transmitted on the D-Bus as a result
of the [cmd [vset cmdname]] [method generate] subcommand. It is the
responsibility of the body code to produce a return value that matches
the specified arglist.

[para]



|







 







>





|
<
|
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
...
217
218
219
220
221
222
223
224
225
226
227
228
229
230

231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
[comment {-*- tcl -*- doctools manpage}]
[vset libname dbif]
[vset cmdname dbif]
[vset version 1.1]
[manpage_begin [vset libname] n [vset version]]
[copyright {2008-2013 Schelte Bron}]
[moddesc {Tcl D-Bus Interface}]
[titledesc {Application layer around the Tcl D-Bus library}]
[require Tcl 8.5]
[require dbus "2.0"]
[require [vset libname] [vset version]]
................................................................................

[call [cmd [vset cmdname]] [method return] [arg messageID] \
  [arg returnvalue]]

Send a D-Bus return message in response to a D-Bus method call.

[call [cmd [vset cmdname]] [method signal] \
  [opt "[option -id] [arg signalID]"] \
  [opt "[option -bus] [arg bustype]"] \
  [opt "[option -interface] [arg interface]"] \
  [arg path] [arg name] \
  [opt "[arg arglist] [opt "[opt [arg interp]] [arg args] [arg body]"]"]]

Define a signal that the application may emit using the [cmd [vset cmdname]]

[method generate] subcommand. Signals are referred to by their SignalID.
If [option -id] is specified, it is used as the SignalID. Otherwise a new
unique identifier is generated. Specifying an existing SignalID replaces
the previously defined signal.

[cmd [vset cmdname]] [method signal] returns the SignalID of the newly
created signal.

If the optional [arg args] and [arg body] arguments are specified, body
will be executed when the signal is transmitted on the D-Bus as a result
of the [cmd [vset cmdname]] [method generate] subcommand. It is the
responsibility of the body code to produce a return value that matches
the specified arglist.

[para]