/* * Copyright © 2009, Koninklijke Philips Electronics N.V. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - Neither the name of the Koninklijke Philips Electronics N.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * */ #include #include #include #include #include /************************************** * Local macros/typedef **************************************/ #define LINE_LENGTH 256 #define FILENAME_LENGTH 128 // Local enumeration for Hotkeys #define HK_HOMESCREEN_START (0x1000+1) #define HK_HOMESCREEN_STOP (0x1000+2) #define HK_WATCHTV_START (0x1000+3) #define HK_WATCHTV_STOP (0x1000+4) #define HK_CB_USB_START (0x1000+5) #define HK_CB_USB_STOP (0x1000+6) #define HK_CB_DLNA_START (0x1000+7) #define HK_CB_DLNA_STOP (0x1000+8) #define HK_NETTV_START (0x1000+9) #define HK_NETTV_STOP (0x1000+10) #define HK_DFU_START (0x1000+11) #define HK_DFU_STOP (0x1000+12) #define HK_TELETEXT_START (0x1000+13) #define HK_TELETEXT_STOP (0x1000+14) #define HK_REMOTEAPP_START (0x1000+15) #define HK_REMOTEAPP_STOP (0x1000+16) /*************************************** * Local data ***************************************/ static void * rcButtonMatrix[]={ (void *)"Red",(void *)"Green",(void *)"Yellow",(void *)"Blue",(void *)"Standby", (void *)NULL, (void *)"Back", (void *)"Home", (void *)"Options",(void *)NULL, (void *)NULL, (void *)NULL, (void *)"Up", (void *)NULL, (void *)NULL, (void *)"Mute", (void *)"Left", (void *)"OK", (void *)"Right",(void *)NULL, (void *)"VolUp",(void *)NULL, (void *)"Down", (void *)NULL, (void *)"PgUp", (void *)"VolDn",(void *)"1", (void *)"2", (void *)"3", (void *)"PgDn", (void *)NULL, (void *)"4", (void *)"5", (void *)"6", (void *)NULL, (void *)NULL, (void *)"7", (void *)"8", (void *)"9", (void *)NULL, (void *)NULL, (void *)"Subt.",(void *)"0", (void *)"Source",(void *)NULL, (void *)NULL, (void *)"EPG", (void *)"Ambi", (void *)"Info",(void *)NULL, (void *)"HK_HOMESCREEN_START", (void *)"HK_WATCHTV_START", (void *)"HK_CB_USB_START", (void *)"HK_CB_DLNA_START", (void *)"HK_NETTV_START", (void *)"HK_DFU_START", (void *)"HK_TELETEXT_START", (void *)"HK_REMOTEAPP_START", (void *)NULL, (void *)NULL, (void *)"HK_HOMESCREEN_STOP", (void *)"HK_WATCHTV_STOP", (void *)"HK_CB_USB_STOP", (void *)"HK_CB_DLNA_STOP", (void *)"HK_NETTV_STOP", (void *)"HK_DFU_STOP", (void *)"HK_TELETEXT_STOP", (void *)"HK_REMOTEAPP_STOP", (void *)NULL, (void *)NULL }; static int rcButtonMapping[]={ rc6S0Red, rc6S0Green, rc6S0Yellow, rc6S0Cyan, rc6S0Standby, -1, rc6S0PreviousProgram, rc6S0MenuOn, rc6S0Options, -1, -1, -1, rc6S0StepUp, -1, -1, rc6S0MuteDemute, rc6S0StepLeft, rc6S0Acknowledge, rc6S0StepRight, -1, rc6S0VolumeUp, -1, rc6S0StepDown, -1, rc6S0Next, rc6S0VolumeDown, 1, 2, 3, rc6S0Previous, -1, 4, 5, 6, -1, -1, 7, 8, 9, -1, -1, rc6S0TvTextSubtitle, 0, rc6S0NextSource, -1, -1, rc6S0EpgGuide, rc6S0AmbLightOnOffDim, rc6S0Display, -1, HK_HOMESCREEN_START, HK_WATCHTV_START, HK_CB_USB_START, HK_CB_DLNA_START, HK_NETTV_START, HK_DFU_START, HK_TELETEXT_START, HK_REMOTEAPP_START, -1, -1, HK_HOMESCREEN_STOP, HK_WATCHTV_STOP, HK_CB_USB_STOP, HK_CB_DLNA_STOP, HK_NETTV_STOP, HK_DFU_STOP, HK_TELETEXT_STOP, HK_REMOTEAPP_STOP, -1, -1 }; /*************************************** * Local procedures ***************************************/ static int IsNumStr(const char * pStr) { if (*pStr == '-' || *pStr == '+') pStr++; return (*pStr >= '0' && *pStr <= '9'); } static int ReadDimsArg(const char * pArg, int * width, int * height) { int nWidth=1; int nHeight=1; if (IsNumStr(pArg)) nWidth = strtol(pArg, (char **) &pArg, 10); else return 0; if ('x' == *pArg++ && IsNumStr(pArg)) nHeight = strtol(pArg, (char **) &pArg, 10); else return 0; if (*pArg != '\0') return 0; if (nWidth <= 0 || nHeight <= 0) return 0; *width = nWidth; *height = nHeight; return 1; } static int ReadNumberArg(const char * pArg, int * value) { int val=0; if (IsNumStr(pArg)) val = strtol(pArg, (char **) &pArg, 10); else return 0; *value = val; return 1; } static int LookupCommand( const char *name ) { int i; for (i=0; i] keycommand keycommand ...\n\n"); printf("Supported key commands:\n"); k=0; for (i=0; i