Developer_release_1.4.0
Class mint.dbus
MintLua specific D-Bus utility functions module.
Methods
mint.dbus:broadcast (event_name, ...) | Send event (to 'com.macnica.app '). |
mint.dbus:call ([options=nil], method_name, ...) | Send method call (to 'com.macnica.app '). |
mint.dbus:call_async (method_name, ..., callback) | Send asynchronous method call (to 'com.macnica.app '). |
mint.dbus:poll (self) | Do the D-Bus polling. |
Methods
- mint.dbus:broadcast (event_name, ...)
-
Send event (to '
com.macnica.app
').Parameters:
- event_name
string
Event name in short form without application ID (e.g.:
'TooHot'
). Application ID will be added as a prefix before broadcasting automatically. - ... varargs Event parameters
Returns:
-
none
Usage:
local dbus = require 'mint.dbus' local TOO_HOT_ALERT_EVENT_NAME = 'com.example.acme.TooHot' if temperature >= too_hot_threshold then dbus:broadcast(TOO_HOT_ALERT_EVENT_NAME, temperature, too_hot_threshold) end
dbus = require 'mint.dbus' event_name = 'com.example.acme.TooHot' temperature = 70 too_hot_threshold = 69 dbus:broadcast(TOO_HOT_ALERT_EVENT_NAME, temperature, too_hot_threshold)
- event_name
string
Event name in short form without application ID (e.g.:
- mint.dbus:call ([options=nil], method_name, ...)
-
Send method call (to '
com.macnica.app
').Parameters:
- options table Options table. (default nil)
- method_name string Qualified method name.
- ... varargs Method arguments.
Returns:
-
any
Method call result
Usage:
dbus = require 'mint.dbus' print(dbus:call('com.macnica.lua_sched.api.GetListeners'))
- mint.dbus:call_async (method_name, ..., callback)
-
Send asynchronous method call (to '
com.macnica.app
'). You should implement polling by yourself to obtain the results.Parameters:
- method_name string Qualified method name.
- ... varargs Method arguments.
- callback function A callback which will be invoked to pass the results.
Usage:
dbus = require 'mint.dbus' dbus:call_async( 'com.macnica.lua_sched.api.GetPID', 'com.macnica.lua_repl', function(pid) print('PID:', pid) end ) dbus:poll()
- mint.dbus:poll (self)
-
Do the D-Bus polling.
Parameters:
- self
Usage:
dbus = require 'mint.dbus' dbus:call_async( 'com.macnica.lua_sched.api.GetPID', 'com.macnica.lua_repl', function(pid) print('PID:', pid) end ) dbus:poll()