Tcl DBus Interface

Check-in [ad58136c89]
Login

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

Overview
Comment:The generate command doesn't always correctly determine whether the result of the signal body should be interpreted as a single value or a list.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | master
Files: files | file ages | folders
SHA3-256:ad58136c89616e7ffa9f587431564e799e2df874279700a00a1460b9377a6482
User & Date: schelte 2016-05-22 09:27:12
Context
2016-07-03
20:41
Switch to a different separator that won't appear in a bus specification check-in: 3d85a506c8 user: schelte tags: trunk, master
2016-05-22
09:27
The generate command doesn't always correctly determine whether the result of the signal body should be interpreted as a single value or a list. check-in: ad58136c89 user: schelte tags: trunk, master
2015-12-12
20:11
Fix error when a method deletes its own path. check-in: 70d7950f3e user: schelte tags: trunk, master
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to dbif.tcl.

347
348
349
350
351
352
353







































354
355
356
357
358
359
360
...
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
    foreach n [array names dbif] {
	lassign [split $n ,] bus path intf
	foreach name [dict keys [dict get $dbif($n) properties]] {
	    vartrace $op $bus $path $intf $name
	}
    }
}








































########################################################################
# Ensemble subcommands
########################################################################

# Select which DBus to use (session or system)
#
................................................................................
	    if {[dict exists $opts -path]} {
		set path [pathcheck [dict get $opts -path]]
	    } else {
		error "No path specified for the signal"
	    }
	}
	# Don't expect the body to provide a list for single arg signals
	# Check for a length of 2 because args contains name/signature pairs
	if {[llength $args] == 2} {
	    dbus signal $bus -signature $signature \
	      $path $interface $name $argv
	    return
	}
    }
    dbus signal $bus -signature $signature \
      $path $interface $name {*}$argv
}

# Setup a signal handler for a specific signal
#







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
<
<
<
<
<







347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
...
606
607
608
609
610
611
612
613





614
615
616
617
618
619
620
    foreach n [array names dbif] {
	lassign [split $n ,] bus path intf
	foreach name [dict keys [dict get $dbif($n) properties]] {
	    vartrace $op $bus $path $intf $name
	}
    }
}

# Determine the number of arguments from signatures
proc dbus::dbif::argcount {argspec} {
    set cnt 0
    dict for {name sig} $argspec {
	if {![dbus validate signature $sig]} {return -1}
	while {$sig ne ""} {
	    switch [string index $sig 0] {
		s - b - y - n - q - i - u - x - t - d - g - o {
		    set sig [string range $sig 1 end]
		}
		a {
		    set sig [string range $sig 1 end]
		    continue
		}
		( {
		    set x 0
		    while {$x >= 0} {
			set x [string first ) $sig [incr x]]
			set str [string range $sig 0 $x]
			if {[dbus validate signature $str]} break
		    }
		    set sig [string range $sig [incr x] end]
		}
		\{ {
		    set x 0
		    while {$x >= 0} {
			set x [string first \} $sig [incr x]]
			set str [string range $sig 0 $x]
			if {[dbus validate signature a$str]} break
		    }
		    set sig [string range $sig [incr x] end]
		}
	    }
	    incr cnt
	}
    }
    return $cnt
}

########################################################################
# Ensemble subcommands
########################################################################

# Select which DBus to use (session or system)
#
................................................................................
	    if {[dict exists $opts -path]} {
		set path [pathcheck [dict get $opts -path]]
	    } else {
		error "No path specified for the signal"
	    }
	}
	# Don't expect the body to provide a list for single arg signals
	if {[argcount $args] == 1} {set argv [list $argv]}





    }
    dbus signal $bus -signature $signature \
      $path $interface $name {*}$argv
}

# Setup a signal handler for a specific signal
#