Changeset 5836:81ccac5ddc61 in roaraudio
- Timestamp:
- 01/06/13 20:38:43 (10 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r5834 r5836 7 7 * Improved CSI: Make it easier to register and access services. 8 8 * Allow seperation of plugin's stdvios (See: #296) 9 * Added half of the support for AppSched Triggers 10 ABOUT, HELP and PREFERENCES. 9 11 10 12 v. 1.0beta8 - Mon Dec 10 2012 12:42 CET -
doc/man1/roarpluginrunner.1
r5801 r5836 79 79 Set plugin arguments. 80 80 81 .SH "RUNNER OPTIONS" 82 83 .TP 84 \fB--option-touch\fR 85 Do not keep the plugin running: Do a single UPDATE cycle. 86 87 .TP 88 \fB--option-no-touch\fR 89 Disable touch option. 90 91 .TP 92 \fB--option-about\fR 93 Show an about dialog after startup. 94 95 .TP 96 \fB--option-no-about\fR 97 Disable about option. 98 99 .TP 100 \fB--option-help\fR 101 Show onlion help after startup. 102 103 .TP 104 \fB--option-no-help\fR 105 Disable help option. 106 107 .TP 108 \fB--option-preferences\fR 109 Show preferences dialog after startup. 110 111 .TP 112 \fB--option-no-preferences\fR 113 Disable preferences option. 114 81 115 .SH "CPI OPTIONS" 82 116 -
include/libroar/roardl.h
r5823 r5836 274 274 ROAR_DL_APPSCHED_TICK, 275 275 #define ROAR_DL_APPSCHED_TICK ROAR_DL_APPSCHED_TICK 276 ROAR_DL_APPSCHED_WAIT 276 ROAR_DL_APPSCHED_WAIT, 277 277 #define ROAR_DL_APPSCHED_WAIT ROAR_DL_APPSCHED_WAIT 278 ROAR_DL_APPSCHED_ABOUT, 279 #define ROAR_DL_APPSCHED_ABOUT ROAR_DL_APPSCHED_ABOUT 280 ROAR_DL_APPSCHED_HELP, 281 #define ROAR_DL_APPSCHED_HELP ROAR_DL_APPSCHED_HELP 282 ROAR_DL_APPSCHED_PREFERENCES 283 #define ROAR_DL_APPSCHED_PREFERENCES ROAR_DL_APPSCHED_PREFERENCES 278 284 }; 279 285 -
include/libroar/services.h
r5823 r5836 64 64 65 65 // help: 66 #define ROAR_SERVICE_HELP_NAME "help" 67 #define ROAR_SERVICE_HELP_ABI "1.0beta9" 66 68 struct roar_service_help { 67 69 int (*show)(const struct roar_dl_libraryname * libname, const char * topic); -
libroar/roardl.c
r5835 r5836 820 820 } 821 821 822 int roar_dl_appsched_trigger__handle_about(struct roar_dl_lhandle * lhandle) { 823 libroar_dl_service_apitype(roar_service_about) api; 824 int ret, err; 825 826 if ( roar_dl_service_get_api(NULL, ROAR_SERVICE_ABOUT_NAME, ROAR_SERVICE_ABOUT_ABI, &api) == -1 ) 827 return -1; 828 829 ret = libroar_dl_service_run_func(api, show, int, roar_dl_getlibname(lhandle)); 830 err = roar_error; 831 832 libroar_dl_service_free_api(api); 833 834 roar_error = err; 835 return ret; 836 } 837 838 int roar_dl_appsched_trigger__handle_help(struct roar_dl_lhandle * lhandle) { 839 libroar_dl_service_apitype(roar_service_help) api; 840 int ret, err; 841 842 if ( roar_dl_service_get_api(NULL, ROAR_SERVICE_HELP_NAME, ROAR_SERVICE_HELP_ABI, &api) == -1 ) 843 return -1; 844 845 ret = libroar_dl_service_run_func(api, show, int, roar_dl_getlibname(lhandle), NULL); 846 err = roar_error; 847 848 libroar_dl_service_free_api(api); 849 850 roar_error = err; 851 return ret; 852 } 853 854 int roar_dl_appsched_trigger__handle_preferences(struct roar_dl_lhandle * lhandle) { 855 roar_err_set(ROAR_ERROR_NOSYS); 856 return -1; 857 } 858 822 859 int roar_dl_appsched_trigger(struct roar_dl_lhandle * lhandle, enum roar_dl_appsched_trigger trigger) { 823 860 int (*func) (struct roar_dl_librarypara * para) = NULL; … … 849 886 _trig(tick, TICK); 850 887 _trig(wait, WAIT); 888 889 // not yet supported by struct roar_dl_appsched. 890 case ROAR_DL_APPSCHED_ABOUT: 891 case ROAR_DL_APPSCHED_HELP: 892 case ROAR_DL_APPSCHED_PREFERENCES: 893 func = NULL; 894 break; 851 895 // use ifndef here so warnings of unhandled enum values will be shown in DEBUG mode. 852 896 #ifndef DEBUG … … 866 910 lhandle->runtime_flags -= RTF_APPSCHED_INITED; 867 911 } 868 roar_err_set(ROAR_ERROR_NOENT); 869 return -1; 912 switch (trigger) { 913 case ROAR_DL_APPSCHED_ABOUT: 914 return roar_dl_appsched_trigger__handle_about(lhandle); 915 break; 916 case ROAR_DL_APPSCHED_HELP: 917 return roar_dl_appsched_trigger__handle_help(lhandle); 918 break; 919 case ROAR_DL_APPSCHED_PREFERENCES: 920 return roar_dl_appsched_trigger__handle_preferences(lhandle); 921 break; 922 default: 923 roar_err_set(ROAR_ERROR_NOENT); 924 return -1; 925 break; 926 } 870 927 } 871 928 -
roarclients/roarpluginrunner.c
r5823 r5836 35 35 }; 36 36 37 #define OPTION_NONE 0x0000 38 #define OPTION_TOUCH 0x0001 39 #define OPTION_ABOUT 0x0100 40 #define OPTION_HELP 0x0200 41 #define OPTION_PREFERENCES 0x0400 42 37 43 static struct roar_dl_librarypara * g_para = NULL; 38 44 static struct roar_scheduler * g_sched = NULL; … … 56 62 ); 57 63 64 fprintf(stderr, "\nRunner Options:\n\n"); 65 fprintf(stderr, " --option-touch - Do not keep the plugin running:" 66 " Do a single UPDATE cycle.\n" 67 " --option-no-touch - Disable touch option.\n" 68 " --option-about - Show an about dialog after startup.\n" 69 " --option-no-about - Disable about option.\n" 70 " --option-help - Show onlion help after startup.\n" 71 " --option-no-help - Disable help option.\n" 72 " --option-preferences - Show preferences dialog after startup.\n" 73 " --option-no-preferences\n" 74 " - Disable preferences option.\n" 75 ); 76 58 77 fprintf(stderr, "\nCPI Options:\n\n"); 59 78 fprintf(stderr, " -t --tcp - Use TCP listen socket\n" … … 69 88 } 70 89 71 static int do_run(const char * name ) {90 static int do_run(const char * name, int options) { 72 91 struct roar_scheduler_source s_container; 73 92 struct roar_plugincontainer * cont = roar_plugincontainer_new(g_para); … … 92 111 roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_INIT); 93 112 94 roar_scheduler_run(g_sched); 113 if ( options & OPTION_ABOUT ) { 114 if ( roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_ABOUT) == -1 ) { 115 ROAR_WARN("Can not call ABOUT trigger: %s", roar_errorstring); 116 } 117 } 118 119 if ( options & OPTION_HELP ) { 120 if ( roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_HELP) == -1 ) { 121 ROAR_WARN("Can not call HELP trigger: %s", roar_errorstring); 122 } 123 } 124 125 if ( options & OPTION_PREFERENCES ) { 126 if ( roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_PREFERENCES) == -1 ) { 127 ROAR_WARN("Can not call PREFERENCES trigger: %s", roar_errorstring); 128 } 129 } 130 131 132 if ( !(options & OPTION_TOUCH) ) 133 roar_scheduler_run(g_sched); 95 134 96 135 roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_UPDATE); … … 303 342 } 304 343 305 static int do_plugin(enum action action, const char * name ) {344 static int do_plugin(enum action action, const char * name, int options) { 306 345 switch (action) { 307 346 case EXPLAIN: … … 310 349 case RUN: 311 350 case RUN_AS_APPLICATION: 312 return do_run(name );351 return do_run(name, options); 313 352 break; 314 353 default: … … 558 597 int cpi_touched = 0; 559 598 const char * cpi_host = NULL; 599 int options = OPTION_NONE; 560 600 561 601 g_sched = roar_scheduler_new(ROAR_SCHEDULER_FLAG_NONE, ROAR_SCHEDULER_STRATEGY_DEFAULT); … … 618 658 } 619 659 660 #define _option(name) \ 661 } else if ( !strcasecmp(k, "--option-" #name) ) { \ 662 options |= OPTION_ ## name; \ 663 } else if ( !strcasecmp(k, "--option-no-" #name) ) { \ 664 options |= OPTION_ ## name; \ 665 options -= OPTION_ ## name; 666 #define __fix_vim_syntax_highlight } 667 _option(TOUCH) 668 _option(ABOUT) 669 _option(HELP) 670 _option(PREFERENCES) 671 620 672 } else if ( !strcmp(k, "--appname") ) { 621 673 appname = argv[++i]; … … 640 692 } else { 641 693 roar_err_set(ROAR_ERROR_NONE); 642 if ( do_plugin(action, k ) == -1 ) {694 if ( do_plugin(action, k, options) == -1 ) { 643 695 fprintf(stderr, "Error loading plugin: %s\n", 644 696 roar_error != ROAR_ERROR_NONE ? roar_error2str(roar_error) : roar_dl_errstr(NULL));
Note: See TracChangeset
for help on using the changeset viewer.