About
D-Bus in the Mys programming language.
Project: https://github.com/mys-lang/package-dbus
D-Bus specification: https://dbus.freedesktop.org/doc/dbus-specification.html
Examples
See https://github.com/mys-lang/package-dbus/tree/main/examples/basic.
API
dbus
trait SignalHandler:
trait Bus:
class CallError(Error):
A call failed with an error.
error_name: string
message: string
class SessionBus(Bus):
func __init__(self):
func start(self):
Connect to the bus.
func stop(self):
Disconnect from the bus once all ongoing calls have completed.
func join(self):
Wait for the bus to be stopped.
func add_object_client(self, object: ClientObject):
Add given client object.
func add_object_server(self, object: ServerObject):
Add given server object.
func add_signal_handler(self, handler: SignalHandler):
func call(self,
destination: string,
object_path: string,
interface: string,
method: string,
signature: string,
arguments: [Type]) -> [Type]:
Call given method on given object.
func emit(self,
object_path: string,
interface: string,
signal: string,
signature: string,
arguments: [Type]):
Emit given signal from given object.
dbus.types
trait Type:
func to_byte(self) -> u8:
func to_boolean(self) -> bool:
func to_int16(self) -> i16:
func to_uint16(self) -> u16:
func to_int32(self) -> i32:
func to_uint32(self) -> u32:
func to_int64(self) -> i64:
func to_uint64(self) -> u64:
func to_double(self) -> f64:
func to_string(self) -> string:
func to_object_path(self) -> string:
func to_signature(self) -> string:
func to_array(self) -> [Type]:
func to_struct(self) -> [Type]:
func to_dict(self) -> {Type: Type}:
func to_variant(self) -> (string, Type):
class WrongTypeError(Error):
class Byte(Type):
A BYTE. Type code 'y'.
value: u8
func to_byte(self) -> u8:
class Boolean(Type):
A BOOLEAN. Type code 'b'.
value: bool
func to_boolean(self) -> bool:
class Int16(Type):
An INT16. Type code 'n'.
value: i16
func to_int16(self) -> i16:
class Uint16(Type):
An UINT16. Type code 'q'.
value: u16
func to_uint16(self) -> u16:
class Int32(Type):
An INT32. Type code 'i'.
value: i32
func to_int32(self) -> i32:
class Uint32(Type):
An UINT32. Type code 'u'.
value: u32
func to_uint32(self) -> u32:
class Int64(Type):
An INT64. Type code 'x'.
value: i64
func to_int64(self) -> i64:
class Uint64(Type):
An UINT64. Type code 't'.
value: u64
func to_uint64(self) -> u64:
class Double(Type):
A DOUBLE. Type code 'd'.
value: f64
func to_double(self) -> f64:
class String(Type):
A STRING. Type code 's'.
value: string
func to_string(self) -> string:
class UnixFd(Type):
A UNIX_FD. Type code 'h'.
class ObjectPath(Type):
An OBJECT_PATH. Type code 'o'.
value: string
func to_object_path(self) -> string:
class Signature(Type):
A SIGNATURE. Type code 'g'.
value: string
func to_signature(self) -> string:
class Array(Type):
An ARRAY. Type code 'a'.
value: [Type]
func to_array(self) -> [Type]:
class Struct(Type):
A STRUCT. Type code 'r', '(' and ')'.
value: [Type]
func to_struct(self) -> [Type]:
class Dict(Type):
Zero or more DICT_ENTRY. Type code 'e', '{' and '}'.
value: {Type: Type}
func to_dict(self) -> {Type: Type}:
class Variant(Type):
A VARIANT.
signature: string
value: Type
func to_variant(self) -> (string, Type):