'From etoys3.0 of 7 March 2008 [latest update: #1939] on 28 March 2008 at 4:44:27 pm'! "Change Set: DBus-Core-bf-39 Date: 28 March 2008 Author: Bert Freudenberg Name: DBus-Core-bf.39 Author: bf Time: 28 March 2008, 4:20:49 pm UUID: 57432302-3108-4e8c-8d92-82a20fe55ede Ancestors: DBus-Core-bf.38 - fix reading Bytes (prim returns signed ints) - optimize receiving ByteArrays"! !DBusConnection commentStamp: '' prior: 0! I represent a connection to the DBus (see http://dbus.freedesktop.org/). connectionIndex: 0 for session bus, 1 for system bus semaIndex: index of the read semaphore in the externalObjects array This class is known to the DBus plugin. The connectionIndex and semaIndex must be the first instance variables in the class. The plugin automatically connects to the DBus when a primitive of me is called.! !DBusArgument methodsFor: 'accessing' stamp: 'bf 3/28/2008 16:06'! fromDBusArgument "XXX refactor into subclasses" self isBasicType ifTrue: [^value]. ^type caseOf: { [DBusArgument struct] -> [value collect: [:ea | ea fromDBusArgument]]. [DBusArgument dictEntry] -> [value key fromDBusArgument -> value value fromDBusArgument]. [DBusArgument array] -> [| arr | signature = 'ay' ifTrue: [^value]. arr := value collect: [:ea | ea fromDBusArgument]. self containedSignature first =${ ifTrue: [arr as: Dictionary] ifFalse: [arr]]. [DBusArgument variant] -> [value fromDBusArgument] } ! ! !DBusConnection methodsFor: 'arguments-read' stamp: 'bf 3/28/2008 16:08'! argumentReadArray "returns an array" | arg sig array | sig := self primIteratorSignature. sig = 'ay' ifTrue: [ ^DBusArgument array: ( ByteArray streamContents: [:strm | self primPushIterator. [ arg := self primArgumentGetByte. "XXX earlier plugins answer signed bytes" arg ifNotNil: [strm nextPut: (arg bitAnd: 16rFF)]. self nextIterator ] whileTrue. self popIterator]) signature: sig]. array := Array streamContents: [:strm | self primPushIterator. [ arg := self getArgument. arg ifNotNil: [strm nextPut: arg]. self nextIterator ] whileTrue. self popIterator]. ^ DBusArgument array: array signature: sig ! ! !DBusConnection methodsFor: 'arguments-read' stamp: 'bf 3/27/2008 17:46'! argumentReadByte "XXX earlier plugins answer signed bytes" ^ DBusArgument byte: (self primArgumentGetByte bitAnd: 16rFF)! !