diff --git a/upnp/sample/common/common_data.h b/upnp/sample/common/common_data.h index 8fc230c..47c37f5 100644 --- a/upnp/sample/common/common_data.h +++ b/upnp/sample/common/common_data.h @@ -1,19 +1,83 @@ +/* + * Copyright (C) 2010 Marcelo Roberto Jimenez + */ #ifndef COMMON_DATA #define COMMON_DATA -#ifdef ALLOC_COMMON_DATA +/*! + * \file + */ +#ifdef ALLOC_CMD_LINE + /*! Tags for valid commands issued at the command prompt. */ + enum cmdloop_tvcmds { + PRTHELP = 0, + PRTFULLHELP, + POWON, + POWOFF, + SETCHAN, + SETVOL, + SETCOL, + SETTINT, + SETCONT, + SETBRT, + CTRLACTION, + PICTACTION, + CTRLGETVAR, + PICTGETVAR, + PRTDEV, + LSTDEV, + REFRESH, + EXITCMD + }; + + /*! Data structure for parsing commands from the command line. */ + struct cmdloop_commands { + /* the string */ + const char *str; + /* the command */ + int cmdnum; + /* the number of arguments */ + int numargs; + /* the args */ + const char *args; + } cmdloop_commands; + + /*! Mappings between command text names, command tag, + * and required command arguments for command line + * commands */ + static struct cmdloop_commands cmdloop_cmdlist[] = { + {"Help", PRTHELP, 1, ""}, + {"HelpFull", PRTFULLHELP, 1, ""}, + {"ListDev", LSTDEV, 1, ""}, + {"Refresh", REFRESH, 1, ""}, + {"PrintDev", PRTDEV, 2, ""}, + {"PowerOn", POWON, 2, ""}, + {"PowerOff", POWOFF, 2, ""}, + {"SetChannel", SETCHAN, 3, " "}, + {"SetVolume", SETVOL, 3, " "}, + {"SetColor", SETCOL, 3, " "}, + {"SetTint", SETTINT, 3, " "}, + {"SetContrast", SETCONT, 3, " "}, + {"SetBrightness", SETBRT, 3, " "}, + {"CtrlAction", CTRLACTION, 2, " "}, + {"PictAction", PICTACTION, 2, " "}, + {"CtrlGetVar", CTRLGETVAR, 2, " "}, + {"PictGetVar", PICTGETVAR, 2, " "}, + {"Exit", EXITCMD, 1, ""} + }; +#else /* ALLOC_CMD_LINE */ +#endif /* ALLOC_CMD_LINE */ + +#ifdef ALLOC_COMMON_DATA /*! Service types for tv services. */ const char *TvServiceType[] = { "urn:schemas-upnp-org:service:tvcontrol:1", "urn:schemas-upnp-org:service:tvpicture:1" }; - #else /* ALLOC_COMMON_DATA */ - extern const char *TvServiceType[]; - #endif /* ALLOC_COMMON_DATA */ #endif /* COMMON_DATA */ diff --git a/upnp/sample/tvcombo/linux/tv_combo_main.c b/upnp/sample/tvcombo/linux/tv_combo_main.c index eafc15a..32a617e 100644 --- a/upnp/sample/tvcombo/linux/tv_combo_main.c +++ b/upnp/sample/tvcombo/linux/tv_combo_main.c @@ -29,6 +29,7 @@ * ******************************************************************************/ +#define ALLOC_CMD_LINE #define ALLOC_COMMON_DATA #include "common_data.h" #include "sample_util.h" @@ -39,50 +40,6 @@ #include #include -/*! Tags for valid commands issued at the command prompt. */ -enum cmdloop_tvcmds { - PRTHELP = 0, PRTFULLHELP, POWON, POWOFF, - SETCHAN, SETVOL, SETCOL, SETTINT, SETCONT, SETBRT, - CTRLACTION, PICTACTION, CTRLGETVAR, PICTGETVAR, - PRTDEV, LSTDEV, REFRESH, EXITCMD -}; - -/*! Data structure for parsing commands from the command line. */ -struct cmdloop_commands { - /* the string */ - const char *str; - /* the command */ - int cmdnum; - /* the number of arguments */ - int numargs; - /* the args */ - const char *args; -} cmdloop_commands; - -/*! Mappings between command text names, command tag, - * and required command arguments for command line - * commands */ -static struct cmdloop_commands cmdloop_cmdlist[] = { - {"Help", PRTHELP, 1, ""}, - {"HelpFull", PRTFULLHELP, 1, ""}, - {"ListDev", LSTDEV, 1, ""}, - {"Refresh", REFRESH, 1, ""}, - {"PrintDev", PRTDEV, 2, ""}, - {"PowerOn", POWON, 2, ""}, - {"PowerOff", POWOFF, 2, ""}, - {"SetChannel", SETCHAN, 3, " "}, - {"SetVolume", SETVOL, 3, " "}, - {"SetColor", SETCOL, 3, " "}, - {"SetTint", SETTINT, 3, " "}, - {"SetContrast", SETCONT, 3, " "}, - {"SetBrightness", SETBRT, 3, " "}, - {"CtrlAction", CTRLACTION, 2, " "}, - {"PictAction", PICTACTION, 2, " "}, - {"CtrlGetVar", CTRLGETVAR, 2, " "}, - {"PictGetVar", PICTGETVAR, 2, " "}, - {"Exit", EXITCMD, 1, ""} -}; - /*! * \brief Prints a string to standard out. */ diff --git a/upnp/sample/tvctrlpt/linux/tv_ctrlpt_main.c b/upnp/sample/tvctrlpt/linux/tv_ctrlpt_main.c index 638e760..4ed58e6 100644 --- a/upnp/sample/tvctrlpt/linux/tv_ctrlpt_main.c +++ b/upnp/sample/tvctrlpt/linux/tv_ctrlpt_main.c @@ -29,6 +29,7 @@ * ******************************************************************************/ +#define ALLOC_CMD_LINE #define ALLOC_COMMON_DATA #include "common_data.h" #include "sample_util.h" @@ -38,50 +39,6 @@ #include #include -/*! Tags for valid commands issued at the command prompt. */ -enum cmdloop_tvcmds { - PRTHELP = 0, PRTFULLHELP, POWON, POWOFF, - SETCHAN, SETVOL, SETCOL, SETTINT, SETCONT, SETBRT, - CTRLACTION, PICTACTION, CTRLGETVAR, PICTGETVAR, - PRTDEV, LSTDEV, REFRESH, EXITCMD -}; - -/*! Data structure for parsing commands from the command line. */ -struct cmdloop_commands { - /* the string */ - const char *str; - /* the command */ - int cmdnum; - /* the number of arguments */ - int numargs; - /* the args */ - const char *args; -} cmdloop_commands; - -/*! Mappings between command text names, command tag, - * and required command arguments for command line - * commands */ -static struct cmdloop_commands cmdloop_cmdlist[] = { - {"Help", PRTHELP, 1, ""}, - {"HelpFull", PRTFULLHELP, 1, ""}, - {"ListDev", LSTDEV, 1, ""}, - {"Refresh", REFRESH, 1, ""}, - {"PrintDev", PRTDEV, 2, ""}, - {"PowerOn", POWON, 2, ""}, - {"PowerOff", POWOFF, 2, ""}, - {"SetChannel", SETCHAN, 3, " "}, - {"SetVolume", SETVOL, 3, " "}, - {"SetColor", SETCOL, 3, " "}, - {"SetTint", SETTINT, 3, " "}, - {"SetContrast", SETCONT, 3, " "}, - {"SetBrightness", SETBRT, 3, " "}, - {"CtrlAction", CTRLACTION, 2, " "}, - {"PictAction", PICTACTION, 2, " "}, - {"CtrlGetVar", CTRLGETVAR, 2, " "}, - {"PictGetVar", PICTGETVAR, 2, " "}, - {"Exit", EXITCMD, 1, ""} -}; - /*! * \brief Prints a string to standard out. */