1
0

Implemented nickel_misc:rescan_books action, updated docs

This commit is contained in:
Patrick Gaskin
2020-04-23 06:32:51 -04:00
parent d2f307dd7b
commit b3d38dbdee
2 changed files with 17 additions and 4 deletions

View File

@@ -41,10 +41,10 @@
# solitaire # solitaire
# sudoku # sudoku
# word_scramble # word_scramble
# misc - one of: # nickel_misc - one of:
# force_usb_connection - forces a usb connection dialog to be shown # force_usb_connection - forces a usb connection dialog to be shown
# rescan_books - forces nickel to rescan books (TODO) # rescan_books - forces nickel to rescan books
# rescan_books_full - forcez a full usb connect/disconnect cycle (TODO) # rescan_books_full - forces a full usb connect/disconnect cycle
# cmd_spawn - the command line to pass to /bin/sh -c (started in /) # cmd_spawn - the command line to pass to /bin/sh -c (started in /)
# cmd_output - the timeout in milliseconds (0 < t < 10000), a colon, then the command line to pass to /bin/sh -c (started in /) # cmd_output - the timeout in milliseconds (0 < t < 10000), a colon, then the command line to pass to /bin/sh -c (started in /)
# #

View File

@@ -128,7 +128,20 @@ extern "C" int nm_action_nickelextras(const char *arg, char **err_out) {
extern "C" int nm_action_nickelmisc(const char *arg, char **err_out) { extern "C" int nm_action_nickelmisc(const char *arg, char **err_out) {
#define NM_ERR_RET 1 #define NM_ERR_RET 1
if (!strcmp(arg, "rescan_books_full")) { if (!strcmp(arg, "rescan_books")) {
PlugWorkflowManager *(*PlugWorkflowManager_sharedInstance)();
reinterpret_cast<void*&>(PlugWorkflowManager_sharedInstance) = dlsym(RTLD_DEFAULT, "_ZN19PlugWorkflowManager14sharedInstanceEv");
NM_ASSERT(PlugWorkflowManager_sharedInstance, "could not dlsym PlugWorkflowManager::sharedInstance");
void (*PlugWorkflowManager_sync)(PlugWorkflowManager*);
reinterpret_cast<void*&>(PlugWorkflowManager_sync) = dlsym(RTLD_DEFAULT, "_ZN19PlugWorkflowManager4syncEv");
NM_ASSERT(PlugWorkflowManager_sync, "could not dlsym PlugWorkflowManager::sync");
PlugWorkflowManager *wf = PlugWorkflowManager_sharedInstance();
NM_ASSERT(wf, "could not get shared PlugWorkflowManager pointer");
PlugWorkflowManager_sync(wf);
} else if (!strcmp(arg, "rescan_books_full")) {
PlugWorkflowManager *(*PlugWorkflowManager_sharedInstance)(); PlugWorkflowManager *(*PlugWorkflowManager_sharedInstance)();
reinterpret_cast<void*&>(PlugWorkflowManager_sharedInstance) = dlsym(RTLD_DEFAULT, "_ZN19PlugWorkflowManager14sharedInstanceEv"); reinterpret_cast<void*&>(PlugWorkflowManager_sharedInstance) = dlsym(RTLD_DEFAULT, "_ZN19PlugWorkflowManager14sharedInstanceEv");
NM_ASSERT(PlugWorkflowManager_sharedInstance, "could not dlsym PlugWorkflowManager::sharedInstance"); NM_ASSERT(PlugWorkflowManager_sharedInstance, "could not dlsym PlugWorkflowManager::sharedInstance");