Created
March 20, 2014 18:08
-
-
Save jadonk/9670158 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@beaglebone:~/bonescript# node test-dbus-native-wicd.js | |
onGetConnectionStatus: {"0":null,"1":[2,["192.168.2.130","XXXXX\" Nickname:\"MT7601STA","92","-1","65 Mb/s"]]} | |
onGetNumberOfNetworks: {"0":null,"1":11} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Installation: apt-get install -y socat && npm install dbus-native@0.0.13 | |
// Possible prerequisite: /etc/init.d/wicd start | |
// Alternate invocation: env `dbus-launch` node test-dbus-native.js | |
// Example usage of dbus-native: | |
// * https://github.com/sidorares/dbusfs | |
// * https://github.com/sidorares/node-gday | |
// Example usage of wicd dbus interfaces: | |
// * http://bazaar.launchpad.net/~wicd-devel/wicd/experimental/view/head:/curses/wicd-curses.py | |
var dbus = require('dbus-native'); | |
var bus = dbus.systemBus(); | |
//bus.listNames(function(err, names) { | |
// for (var i = 0; i < names.length; i++) { | |
// console.log(names[i]); | |
// } | |
//}); | |
bus.invoke({ | |
destination: 'org.wicd.daemon', | |
path: '/org/wicd/daemon', | |
interface: 'org.wicd.daemon', | |
member: 'GetConnectionStatus' | |
}, onGetConnectionStatus); | |
function onGetConnectionStatus() { | |
console.log('onGetConnectionStatus: ' + JSON.stringify(arguments)); | |
bus.invoke({ | |
destination: 'org.wicd.daemon', | |
path: '/org/wicd/daemon/wireless', | |
interface: 'org.wicd.daemon.wireless', | |
member: 'GetNumberOfNetworks' | |
}, onGetNumberOfNetworks); | |
}; | |
function onGetNumberOfNetworks() { | |
console.log('onGetNumberOfNetworks: ' + JSON.stringify(arguments)); | |
process.exit(0); | |
} | |
// Reference from 'gdbus introspect -y -r -d org.wicd.daemon -o /' | |
/* | |
node / { | |
node /org { | |
node /org/wicd { | |
node /org/wicd/daemon { | |
interface org.freedesktop.DBus.Introspectable { | |
methods: | |
Introspect(out s arg_0); | |
signals: | |
properties: | |
}; | |
interface org.wicd.daemon { | |
methods: | |
EmitStatusChanged(in u state, | |
in av info); | |
SetWPADriver(in v driver); | |
SetCurrentInterface(in v iface); | |
Disconnect(); | |
GetSignalDisplayType(); | |
SetGUIOpen(in v val); | |
GetBackendList(); | |
GetGUIOpen(); | |
SetConnectionStatus(in v state, | |
in v info); | |
GetUseGlobalDNS(); | |
GetShouldVerifyAp(); | |
SetBackend(in v backend); | |
GetAppAvailable(in v app); | |
SetNeedWiredProfileChooser(in v val); | |
SetAlwaysShowWiredInterface(in v value); | |
GetWirelessInterface(); | |
GetForcedDisconnect(); | |
CancelConnect(); | |
SendConnectResultsIfAvail(); | |
FormatSignalForPrinting(in v signal); | |
SetLinkDetectionTool(in v link_tool); | |
SetSudoApp(in v sudo_app); | |
GetFlushTool(); | |
SetGlobalDNS(in v dns1, | |
in v dns2, | |
in v dns3, | |
in v dns_dom, | |
in v search_dom); | |
GetWiredAutoConnectMethod(); | |
GetAlwaysShowWiredInterface(); | |
SetShowNeverConnect(in v value); | |
NeedsExternalCalls(); | |
GetGlobalDNSAddresses(); | |
GetAutoReconnect(); | |
SetSignalDisplayType(in v value); | |
GetBackendDescription(in v backend_name); | |
SetFlushTool(in v flush_tool); | |
GetLinkDetectionTool(); | |
GetCurrentBackend(); | |
SetAutoReconnect(in v value); | |
GetNeedWiredProfileChooser(); | |
CheckIfConnecting(); | |
SetWiredInterface(in v interface); | |
GetSudoApp(); | |
GetSuspend(); | |
ShouldAutoReconnect(); | |
SetWirelessInterface(in v interface); | |
GetDebugMode(); | |
SetWiredAutoConnectMethod(in v method); | |
SetSuspend(in v val); | |
AutoConnect(in v fresh); | |
GetSavedBackend(); | |
SetDebugMode(in v debug); | |
Hello(); | |
GetPreferWiredNetwork(); | |
GetCurrentInterface(); | |
SetShouldVerifyAp(in v value); | |
GetConnectionStatus(out (uas) arg_0); | |
GetDHCPClient(); | |
SetForcedDisconnect(in v value); | |
GetWiredInterface(); | |
UpdateState(); | |
GetBackendDescriptionDict(); | |
GetBackendUpdateInterval(); | |
SetUseGlobalDNS(in v use); | |
SendConnectResult(); | |
GetWPADriver(); | |
SetPreferWiredNetwork(in v value); | |
GetShowNeverConnect(); | |
ConnectResultsAvailable(); | |
SetDHCPClient(in v client); | |
signals: | |
ConnectResultsSent(s result); | |
LaunchChooser(); | |
DaemonStarting(); | |
StatusChanged(u state, | |
av info); | |
SignalBackendChanged(i interval); | |
DaemonClosing(); | |
properties: | |
}; | |
node /org/wicd/daemon/wired { | |
interface org.freedesktop.DBus.Introspectable { | |
methods: | |
Introspect(out s arg_0); | |
signals: | |
properties: | |
}; | |
interface org.wicd.daemon.wired { | |
methods: | |
CheckWiredConnectingMessage(); | |
DetectWiredInterface(); | |
GetWiredIP(in v ifconfig); | |
GetWiredProperty(in v property); | |
GetWiredInterfaces(); | |
GetDefaultWiredNetwork(); | |
UnsetWiredLastUsed(); | |
CreateWiredNetworkProfile(in v profilename, | |
in v default); | |
HasWiredDriver(); | |
DisableWiredInterface(); | |
IsWiredUp(); | |
EnableWiredInterface(); | |
DisconnectWired(); | |
UnsetWiredDefault(); | |
CheckWiredConnectingStatus(); | |
CheckPluggedIn(); | |
GetLastUsedWiredNetwork(); | |
SetWiredProperty(in v prop, | |
in v value); | |
ReloadConfig(); | |
ConnectWired(); | |
SaveWiredNetworkProfile(in v profilename); | |
ReadWiredNetworkProfile(in v profilename); | |
DeleteWiredNetworkProfile(in v profilename); | |
GetWiredProfileList(); | |
CheckIfWiredConnecting(); | |
signals: | |
properties: | |
}; | |
}; | |
node /org/wicd/daemon/wireless { | |
interface org.freedesktop.DBus.Introspectable { | |
methods: | |
Introspect(out s arg_0); | |
signals: | |
properties: | |
}; | |
interface org.wicd.daemon.wireless { | |
methods: | |
GetWirelessInterfaces(); | |
SetHiddenNetworkESSID(in v essid); | |
GetCurrentSignalStrength(in v iwconfig); | |
EnableWirelessInterface(); | |
ReadWirelessNetworkProfile(in v id); | |
CheckWirelessConnectingStatus(); | |
RemoveGlobalEssidEntry(in v networkid); | |
SaveWirelessNetworkProfile(in v id); | |
SetWirelessProperty(in v netid, | |
in v prop, | |
in v value); | |
CheckIfWirelessConnecting(); | |
GetApBssid(); | |
GetWirelessProperty(in v networkid, | |
in v property); | |
GetNumberOfNetworks(); | |
GetKillSwitchEnabled(); | |
GetCurrentNetworkID(in v iwconfig); | |
CreateAdHocNetwork(in v essid, | |
in v channel, | |
in v ip, | |
in v enctype, | |
in v key, | |
in v encused, | |
in v ics); | |
GetCurrentDBMStrength(in v iwconfig); | |
GetOperationalMode(in v iwconfig); | |
GetRfKillEnabled(); | |
SwitchRfKill(); | |
GetCurrentNetwork(in v iwconfig); | |
CheckWirelessConnectingMessage(); | |
GetAvailableAuthMethods(in v iwlistauth); | |
GetIwconfig(); | |
DisconnectWireless(); | |
GetWpaSupplicantDrivers(); | |
IsWirelessUp(); | |
ConnectWireless(in v id); | |
CreateAdHocNetwork(in v essid, | |
in v channel, | |
in v ip, | |
in v enctype, | |
in v key, | |
in v encused, | |
in v ics); | |
GetCurrentDBMStrength(in v iwconfig); | |
GetOperationalMode(in v iwconfig); | |
GetRfKillEnabled(); | |
SwitchRfKill(); | |
GetCurrentNetwork(in v iwconfig); | |
CheckWirelessConnectingMessage(); | |
GetAvailableAuthMethods(in v iwlistauth); | |
GetIwconfig(); | |
DisconnectWireless(); | |
GetWpaSupplicantDrivers(); | |
IsWirelessUp(); | |
ConnectWireless(in v id); | |
ReloadConfig(); | |
GetCurrentBitrate(in v iwconfig); | |
DisableWirelessInterface(); | |
Scan(in v sync); | |
DetectWirelessInterface(); | |
SaveWirelessNetworkProperty(in v id, | |
in v option); | |
GetWirelessIP(in v ifconfig); | |
signals: | |
SendStartScanSignal(); | |
SendEndScanSignal(); | |
properties: | |
}; | |
}; | |
}; | |
}; | |
}; | |
}; | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment