7
res/doc
7
res/doc
@@ -31,6 +31,7 @@
|
|||||||
# nickel_extras - opens one of the beta features
|
# nickel_extras - opens one of the beta features
|
||||||
# nickel_misc - other stuff which isn't significant enough for its own category
|
# nickel_misc - other stuff which isn't significant enough for its own category
|
||||||
# nickel_open - opens a view
|
# nickel_open - opens a view
|
||||||
|
# nickel_wifi - controls wifi (note: it doesn't wait for it to connect or disconnect, neither does it check for success)
|
||||||
# power - gracefully controls the power state
|
# power - gracefully controls the power state
|
||||||
# skip - skips a number of actions after the current one (mainly useful for more complex conditional chains) (this action will not update the success/failure flag)
|
# skip - skips a number of actions after the current one (mainly useful for more complex conditional chains) (this action will not update the success/failure flag)
|
||||||
# <arg> the argument passed to the action:
|
# <arg> the argument passed to the action:
|
||||||
@@ -79,6 +80,12 @@
|
|||||||
# reading_life:words - My Words
|
# reading_life:words - My Words
|
||||||
# store:overdrive - OverDrive (4.10.11655+) (note: if you don't have an active OverDrive account, it will give you a "Network Error")
|
# store:overdrive - OverDrive (4.10.11655+) (note: if you don't have an active OverDrive account, it will give you a "Network Error")
|
||||||
# store:search - Search
|
# store:search - Search
|
||||||
|
# nickel_wifi - one of:
|
||||||
|
# autoconnect - attempts to enable and connect to wifi (similar to what happens when you open a link)
|
||||||
|
# autoconnect_silent - attempts to connect to wifi in the background (does nothing if wifi is disabled, the battery is low, is already connected, or there aren't any known networks in range) (no errors are shown) (similar to what happens when you turn on the Kobo)
|
||||||
|
# enable - enables WiFi (but doesn't necessarily connect to it)
|
||||||
|
# disable - disables WiFi (but doesn't necessarily connect to it)
|
||||||
|
# toggle - disables WiFi (but doesn't necessarily connect to it)
|
||||||
# power - one of:
|
# power - one of:
|
||||||
# shutdown (4.13.12638+)
|
# shutdown (4.13.12638+)
|
||||||
# reboot (4.13.12638+)
|
# reboot (4.13.12638+)
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ void nm_action_result_free(nm_action_result_t *res);
|
|||||||
X(nickel_extras) \
|
X(nickel_extras) \
|
||||||
X(nickel_misc) \
|
X(nickel_misc) \
|
||||||
X(nickel_open) \
|
X(nickel_open) \
|
||||||
|
X(nickel_wifi) \
|
||||||
X(power) \
|
X(power) \
|
||||||
X(skip)
|
X(skip)
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ typedef void PlugWorkflowManager;
|
|||||||
typedef void BrowserWorkflowManager;
|
typedef void BrowserWorkflowManager;
|
||||||
typedef void N3SettingsExtrasController;
|
typedef void N3SettingsExtrasController;
|
||||||
typedef void N3PowerWorkflowManager;
|
typedef void N3PowerWorkflowManager;
|
||||||
|
typedef void WirelessWorkflowManager;
|
||||||
|
|
||||||
NM_ACTION_(nickel_open) {
|
NM_ACTION_(nickel_open) {
|
||||||
#define NM_ERR_RET nullptr
|
#define NM_ERR_RET nullptr
|
||||||
@@ -451,6 +452,62 @@ NM_ACTION_(power) {
|
|||||||
#undef NM_ERR_RET
|
#undef NM_ERR_RET
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NM_ACTION_(nickel_wifi) {
|
||||||
|
#define NM_ERR_RET nullptr
|
||||||
|
|
||||||
|
//libnickel 4.6 * _ZN23WirelessWorkflowManager14sharedInstanceEv
|
||||||
|
WirelessWorkflowManager *(*WirelessWorkflowManager_sharedInstance)();
|
||||||
|
reinterpret_cast<void*&>(WirelessWorkflowManager_sharedInstance) = dlsym(RTLD_DEFAULT, "_ZN23WirelessWorkflowManager14sharedInstanceEv");
|
||||||
|
NM_ASSERT(WirelessWorkflowManager_sharedInstance, "could not dlsym WirelessWorkflowManager::sharedInstance");
|
||||||
|
|
||||||
|
WirelessWorkflowManager *wfm = WirelessWorkflowManager_sharedInstance();
|
||||||
|
NM_ASSERT(wfm, "could not get shared wireless manager pointer");
|
||||||
|
|
||||||
|
if (!strcmp(arg, "autoconnect")) {
|
||||||
|
//libnickel 4.6 * _ZN23WirelessWorkflowManager15connectWirelessEbb
|
||||||
|
void (*WirelessWorkflowManager_connectWireless)(WirelessWorkflowManager*, bool, bool); // I haven't looked into what the params are for, so I'm just using what the browser uses when opening it
|
||||||
|
reinterpret_cast<void*&>(WirelessWorkflowManager_connectWireless) = dlsym(RTLD_DEFAULT, "_ZN23WirelessWorkflowManager15connectWirelessEbb");
|
||||||
|
NM_ASSERT(WirelessWorkflowManager_connectWireless, "could not dlsym WirelessWorkflowManager::connectWireless");
|
||||||
|
|
||||||
|
WirelessWorkflowManager_connectWireless(wfm, true, false);
|
||||||
|
} else if (!strcmp(arg, "autoconnect_silent")) {
|
||||||
|
//libnickel 4.6 * _ZN23WirelessWorkflowManager23connectWirelessSilentlyEv
|
||||||
|
void (*WirelessWorkflowManager_connectWirelessSilently)(WirelessWorkflowManager*);
|
||||||
|
reinterpret_cast<void*&>(WirelessWorkflowManager_connectWirelessSilently) = dlsym(RTLD_DEFAULT, "_ZN23WirelessWorkflowManager23connectWirelessSilentlyEv");
|
||||||
|
NM_ASSERT(WirelessWorkflowManager_connectWirelessSilently, "could not dlsym WirelessWorkflowManager::connectWirelessSilently");
|
||||||
|
|
||||||
|
WirelessWorkflowManager_connectWirelessSilently(wfm);
|
||||||
|
} else if (!strcmp(arg, "enable") || !strcmp(arg, "disable") || !strcmp(arg, "toggle")) {
|
||||||
|
//libnickel 4.6 * _ZN23WirelessWorkflowManager14isAirplaneModeEv
|
||||||
|
bool (*WirelessWorkflowManager_isAirplaneMode)(WirelessWorkflowManager*);
|
||||||
|
reinterpret_cast<void*&>(WirelessWorkflowManager_isAirplaneMode) = dlsym(RTLD_DEFAULT, "_ZN23WirelessWorkflowManager14isAirplaneModeEv");
|
||||||
|
NM_ASSERT(WirelessWorkflowManager_isAirplaneMode, "could not dlsym WirelessWorkflowManager::isAirplaneMode");
|
||||||
|
|
||||||
|
bool e = WirelessWorkflowManager_isAirplaneMode(wfm);
|
||||||
|
NM_LOG("wifi disabled: %d", e);
|
||||||
|
|
||||||
|
//libnickel 4.6 * _ZN23WirelessWorkflowManager15setAirplaneModeEb
|
||||||
|
void (*WirelessWorkflowManager_setAirplaneMode)(WirelessWorkflowManager*, bool);
|
||||||
|
reinterpret_cast<void*&>(WirelessWorkflowManager_setAirplaneMode) = dlsym(RTLD_DEFAULT, "_ZN23WirelessWorkflowManager15setAirplaneModeEb");
|
||||||
|
NM_ASSERT(WirelessWorkflowManager_setAirplaneMode, "could not dlsym WirelessWorkflowManager::setAirplaneMode");
|
||||||
|
|
||||||
|
if (!strcmp(arg, "enable")) {
|
||||||
|
if (e)
|
||||||
|
WirelessWorkflowManager_setAirplaneMode(wfm, false);
|
||||||
|
} else if (!strcmp(arg, "disable")) {
|
||||||
|
if (!e)
|
||||||
|
WirelessWorkflowManager_setAirplaneMode(wfm, true);
|
||||||
|
} else if (!strcmp(arg, "toggle")) {
|
||||||
|
WirelessWorkflowManager_setAirplaneMode(wfm, !e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
NM_RETURN_ERR("unknown wifi action '%s'", arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
NM_RETURN_OK(nm_action_result_silent());
|
||||||
|
#undef NM_ERR_RET
|
||||||
|
}
|
||||||
|
|
||||||
NM_ACTION_(cmd_spawn) {
|
NM_ACTION_(cmd_spawn) {
|
||||||
#define NM_ERR_RET nullptr
|
#define NM_ERR_RET nullptr
|
||||||
char *tmp = strdup(arg); // strsep and strtrim will modify it
|
char *tmp = strdup(arg); // strsep and strtrim will modify it
|
||||||
|
|||||||
Reference in New Issue
Block a user