diff options
Diffstat (limited to 'Jslib')
-rwxr-xr-x | Jslib/jslibrc/jslibrc_client.c | 653 | ||||
-rwxr-xr-x | Jslib/jslibrc/jslibrc_client.h | 60 | ||||
-rwxr-xr-x | Jslib/jslibrc/jslibrc_types.h | 431 | ||||
-rwxr-xr-x | Jslib/tools/remco.c | 326 | ||||
-rwxr-xr-x | Jslib/tools/remco2k11.c | 323 |
5 files changed, 1793 insertions, 0 deletions
diff --git a/Jslib/jslibrc/jslibrc_client.c b/Jslib/jslibrc/jslibrc_client.c new file mode 100755 index 0000000..b942a38 --- /dev/null +++ b/Jslib/jslibrc/jslibrc_client.c @@ -0,0 +1,653 @@ +#include <jslibrc_client.h>
+#include <divine.h>
+
+
+
+#define DFBCHECK(x...) \
+do { \
+ DFBResult err; \
+ err = x; \
+ if (err != DFB_OK) { \
+ printf ("Fail!! err!=DFB_OK"); \
+ DirectFBError (#x, err); \
+ } \
+} while(0);
+
+
+#define HK_HOMESCREEN DIKS_CUSTOM36
+#define HK_MEDIA DIKS_CUSTOM20
+#define HK_TELETEXT DIKS_CUSTOM17
+#define HK_HTML DIKS_CUSTOM19
+#define HK_DFU DIKS_CUSTOM49
+#define HK_REMOTEAPP DIKS_CUSTOM97
+#define HK_EXPERIENCE DIKS_CUSTOM58
+
+#define DFB_RAW_KEY DIKS_CUSTOM31
+#define DFB_AMBILIGHT DIKS_CUSTOM33
+#define DFB_BATTERY_LOW DIKS_CUSTOM94
+#define DFB_3D DIKS_CUSTOM110
+
+/*added by Vivek to solve brg36mgr#235014 */
+
+#define DFB_NETTV DIKS_CUSTOM19
+#define DFB_MEDIA_CB DIKS_CUSTOM20
+#define DFB_MEDIA_DLNA DIKS_CUSTOM21
+#define DFB_LKB_TACT DIKS_CUSTOM32
+#define DFB_EXPERIENCE DIKS_CUSTOM58
+#define DFB_MUTE DIKS_CUSTOM93
+#define DFB_DEALERRC DIKS_CUSTOM111
+#define DFB_DEALERRC_DEMO DIKS_CUSTOM112
+
+
+
+#define NOTRCSOURCEMASK 0x20
+
+#define MAX_NR_OF_ELEMENTS( a, b ) ( sizeof( a ) / sizeof( b ) )
+
+
+typedef enum{
+ MEDIA_USB,
+ MEDIA_Network,
+ MEDIA_Scenea,
+ MEDIA_DRM
+} EnumMediaStart;
+
+
+static IDiVine *divine = NULL;
+
+static DFBInputDeviceKeySymbol Rc5Sys0TranslateTable[0x80] =
+{
+ /**********************/
+ /* SYSTEM CODE 0x00 */
+ /**********************/
+ /****************************************************************************************************************************************************************************/
+ /* * 0x00 / 0x08 0x01 / 0x09 0x02 / 0x0A 0x03 / 0x0B 0x04 / 0x0C 0x05 / 0x0D 0x06 / 0x0E 0x07 / 0x0F */
+ /****************************************************************************************************************************************************************************/
+ /* 0x00 */ DIKS_0, DIKS_1, DIKS_2, DIKS_3, DIKS_4, DIKS_5, DIKS_6, DIKS_7,
+ /* */ DIKS_8, DIKS_9, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_POWER, DIKS_MUTE, DFB_RAW_KEY, DIKS_INFO,
+ /* 0x10 */ DIKS_VOLUME_UP, DIKS_VOLUME_DOWN, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x20 */ DIKS_CHANNEL_UP, DIKS_CHANNEL_DOWN, DIKS_PREVIOUS, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x30 */ DFB_RAW_KEY, DFB_RAW_KEY, DIKS_REWIND, DFB_RAW_KEY, DIKS_FASTFORWARD, DIKS_PLAYPAUSE, DIKS_STOP, DIKS_RECORD,
+ /* */ DIKS_NEXT, DIKS_F2, DIKS_SUBTITLE, DFB_RAW_KEY, DIKS_TEXT, DIKS_POWER2, DFB_RAW_KEY, DIKS_TUNER,
+ /* 0x40 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_AMBILIGHT,
+ /* */ DFB_RAW_KEY, DFB_AMBILIGHT, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x50 */ DIKS_CURSOR_UP, DIKS_CURSOR_DOWN, DIKS_MENU, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_CURSOR_LEFT, DIKS_CURSOR_RIGHT, DIKS_OK,
+ /* */ DIKS_MODE, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x60 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_RED, DIKS_GREEN, DIKS_YELLOW, DIKS_BLUE, DFB_RAW_KEY,
+ /* 0x70 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_ZOOM, DFB_RAW_KEY
+ /****************************************************************************************************************************************************************************/
+};
+
+
+/* sync'ed the table of TV side to fix the issue brg36mgr#235014 , vivek*/
+static DFBInputDeviceKeySymbol Rc5Sys3TranslateTable[0x80] =
+{
+ /**********************/
+ /* SYSTEM CODE 0x03 */
+ /**********************/
+ /****************************************************************************************************************************************************************************/
+ /* * 0x00 / 0x08 0x01 / 0x09 0x02 / 0x0A 0x03 / 0x0B 0x04 / 0x0C 0x05 / 0x0D 0x06 / 0x0E 0x07 / 0x0F */
+ /****************************************************************************************************************************************************************************/
+ /* 0x00 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_F1, DIKS_F12, DIKS_F6, DIKS_F7,
+ /* */ DIKS_F8, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x10 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_MEDIA_CB, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x20 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_AMBILIGHT, DFB_AMBILIGHT, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_EPG, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x30 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DIKS_F3, DIKS_F4, DIKS_F12, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_ZOOM, DIKS_ZOOM, DFB_RAW_KEY,
+ /* 0x40 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DIKS_TUNER, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x50 */ DIKS_ZOOM, DIKS_ZOOM, DFB_RAW_KEY, DIKS_ZOOM, DFB_RAW_KEY, DIKS_ZOOM, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x60 */ DFB_MEDIA_DLNA, DFB_NETTV, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x70 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_ZOOM, DIKS_ZOOM, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_F5, DFB_RAW_KEY, DIKS_ZOOM, DIKS_ZOOM, DFB_RAW_KEY
+ /****************************************************************************************************************************************************************************/
+};
+
+static DFBInputDeviceKeySymbol Rc6TranslateTable[0x100] =
+{
+ /****************************************************************************************************************************************************************************/
+ /* * 0x00 / 0x08 0x01 / 0x09 0x02 / 0x0A 0x03 / 0x0B 0x04 / 0x0C 0x05 / 0x0D 0x06 / 0x0E 0x07 / 0x0F */
+ /****************************************************************************************************************************************************************************/
+ /* 0x00 */ DIKS_0, DIKS_1, DIKS_2, DIKS_3, DIKS_4, DIKS_5, DIKS_6, DIKS_7,
+ /* */ DIKS_8, DIKS_9, DIKS_PREVIOUS, DFB_RAW_KEY, DIKS_POWER, DIKS_MUTE, DFB_RAW_KEY, DIKS_INFO,
+ /* 0x10 */ DIKS_VOLUME_UP, DIKS_VOLUME_DOWN, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_CHANNEL_UP, DIKS_CHANNEL_DOWN,
+ /* 0x20 */ DIKS_CHANNEL_UP, DIKS_CHANNEL_DOWN, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DIKS_FASTFORWARD, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_REWIND, DIKS_PLAYPAUSE, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x30 */ DIKS_PLAYPAUSE, DIKS_STOP, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_STOP, DIKS_RECORD,
+ /* */ DIKS_NEXT, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_TEXT, DIKS_POWER2, DFB_RAW_KEY, DIKS_TUNER,
+ /* 0x40 */ DIKS_OPTION, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_SUBTITLE, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_PAGE_DOWN, DIKS_PAGE_UP, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x50 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_MENU, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DIKS_CURSOR_UP, DIKS_CURSOR_DOWN, DIKS_CURSOR_LEFT, DIKS_CURSOR_RIGHT, DIKS_OK, DIKS_MODE, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x60 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_RED, DIKS_GREEN, DIKS_YELLOW,
+ /* 0x70 */ DIKS_BLUE, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_SUBTITLE, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0x80 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_AMBILIGHT,
+ /* 0x90 */ HK_EXPERIENCE, DFB_AMBILIGHT, DFB_AMBILIGHT, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_TUNER,
+ /* 0xA0 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0xB0 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_3D, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, HK_HTML, DFB_RAW_KEY,
+ /* 0xC0 */ DFB_RAW_KEY, DIKS_PLAYPAUSE, DFB_RAW_KEY, DFB_BATTERY_LOW, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_EPG, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0xD0 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DIKS_PERIOD, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0xE0 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* 0xF0 */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DIKS_ZOOM, DFB_RAW_KEY, DFB_RAW_KEY,
+ /* */ DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY, DFB_RAW_KEY
+ /****************************************************************************************************************************************************************************/
+};
+
+
+
+static int TranslateKey( int *source, int *system, int *command, DFBInputDeviceKeySymbol *symbol )
+{
+ int translated = 0;
+
+ switch ( *source )
+ {
+ case keySourceRc5:
+ if (
+ ( *system == 0 ) &&
+ ( *command >= 0 ) &&
+ ( *command < ( MAX_NR_OF_ELEMENTS( Rc5Sys0TranslateTable, DFBInputDeviceKeySymbol ) ) )
+ )
+ {
+ *symbol = Rc5Sys0TranslateTable[*command];
+ translated = 1;
+ }
+ else if (
+ ( *system == 3 ) &&
+ ( *command >= 0 ) &&
+ ( *command < ( MAX_NR_OF_ELEMENTS( Rc5Sys3TranslateTable, DFBInputDeviceKeySymbol ) ) )
+ )
+ {
+ *symbol = Rc5Sys3TranslateTable[*command];
+ translated = 1;
+ }
+ break;
+
+ case keySourceRc6:
+ if (
+ ( *system < 2 ) &&
+ ( *command >= 0 ) &&
+ ( *command < ( MAX_NR_OF_ELEMENTS( Rc6TranslateTable, DFBInputDeviceKeySymbol ) ) )
+ )
+ {
+ *symbol = Rc6TranslateTable[*command];
+ translated = 1;
+ }
+ break;
+
+ default:
+ /* unrecognized source: no translation */
+ break;
+ }
+
+ if( !translated )
+ {
+ printf( ( "Key could not be translated, passing DFB_RAW_KEY instead!\n" ) );
+
+ *symbol = DFB_RAW_KEY;
+ translated = 1;
+ }
+
+ return( translated );
+}
+
+static int SendKeyDown(int keyname,int src,int sys,int cmd, int modifier )
+{
+ DFBInputEvent event;
+ unsigned long key_code;
+ if (divine)
+ {
+ key_code = (((unsigned int)src & 0xff) << 24) | (((unsigned int)sys & 0xff) << 16) | ((unsigned int)cmd & 0xffff);
+
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_KEYPRESS;
+ event.key_code = key_code;
+ event.key_symbol = keyname;
+ event.flags = DIEF_KEYCODE | DIEF_KEYSYMBOL;
+ if (modifier)
+ {
+ event.flags |= DIEF_MODIFIERS;
+ event.modifiers = modifier;
+ }
+ DFBCHECK(divine->SendEvent (divine, &event));
+ }
+
+ return 1;
+}
+
+static int SendKeyUp(int keyname,int src,int sys,int cmd, int modifier )
+{
+ DFBInputEvent event;
+ unsigned long key_code;
+ if (divine)
+ {
+ key_code = (((unsigned int)src & 0xff) << 24) | (((unsigned int)sys & 0xff) << 16) | ((unsigned int)cmd & 0xffff);
+
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_KEYRELEASE;
+ event.key_code = key_code;
+ event.key_symbol = keyname;
+ event.flags = DIEF_KEYCODE | DIEF_KEYSYMBOL;
+ if (modifier)
+ {
+ event.flags |= DIEF_MODIFIERS;
+ event.modifiers = modifier;
+ }
+ DFBCHECK(divine->SendEvent (divine, &event));
+ }
+
+ return 1;
+}
+
+static int SendKeyHK(int keyname,int src,int sys,int cmd, int modifier )
+{
+ unsigned long key_code;
+ DFBInputEvent event;
+ int dfb_ret;
+ int ret = 0;
+ if (divine)
+ {
+ src |= NOTRCSOURCEMASK;
+ key_code = (((unsigned int)src & 0xff) << 24) | (((unsigned int)sys & 0xff) << 16) | ((unsigned int)cmd & 0xffff);
+
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_KEYPRESS;
+ event.key_code = key_code;
+ event.key_symbol = keyname;
+ event.flags = DIEF_KEYCODE | DIEF_KEYSYMBOL;
+ if (modifier)
+ {
+ event.flags |= DIEF_MODIFIERS;
+ event.modifiers = modifier;
+ }
+ dfb_ret = divine->SendEvent (divine, &event);
+ printf("ReturnKey retval = %d\n", dfb_ret );
+ ret = 1;
+ }
+
+ return ret;
+}
+
+
+
+
+
+int
+jslibrc_Init( int *argc, char **argv[] )
+{
+ DFBResult ret;
+
+ ret = DiVineInit( argc, argv );
+ if (ret) {
+ return ret;
+ }
+
+ ret = DiVineCreate( &divine );
+ if (ret) {
+ return ret;
+ }
+
+ return 0;
+}
+
+void
+jslibrc_Exit( void )
+{
+ if (divine) {
+ divine->Release(divine);
+ divine = NULL;
+ }
+}
+
+void
+jslibrc_KeyDown( int src, int sys, int cmd )
+{
+ DFBInputDeviceKeySymbol symbol = 0;
+
+ if ( TranslateKey( &src, &sys, &cmd, &symbol ) )
+ {
+ SendKeyDown(symbol, src, sys, cmd, 0);
+ }
+}
+
+void
+jslibrc_KeyUp( int src, int sys, int cmd )
+{
+ DFBInputDeviceKeySymbol symbol = 0;
+
+ if ( TranslateKey( &src, &sys, &cmd, &symbol ) )
+ {
+ SendKeyUp(symbol, src, sys, cmd, 0);
+ }
+}
+
+
+
+int
+jslibrc_RequestActivity( amLib_EnumActivityId act, amLib_EnumActivation mode, int cookie )
+{
+ switch(act)
+ {
+ case amLib_ACT_HomeScreen:
+ SendKeyHK(HK_HOMESCREEN, 0, 0, mode, 0);
+ break;
+ case amLib_ACT_WatchTV:
+// key_KeyDown( source, system, command );
+ SendKeyHK(DIKS_TUNER, 3, 0, mode, 0);
+ break;
+ case amLib_ACT_BrowseUSB:
+ SendKeyHK(HK_MEDIA, MEDIA_USB,0,mode, 0);
+ break;
+ case amLib_ACT_BrowseDLNA:
+ SendKeyHK(HK_MEDIA, MEDIA_Network,0,mode, 0);
+ break;
+ case amLib_ACT_NetTV:
+ SendKeyHK(HK_HTML, 0, 0, mode, 0);
+ break;
+ case amLib_ACT_Dfu:
+ SendKeyHK(HK_DFU, 0, 0, mode, 0);
+ break;
+ case amLib_ACT_Teletext:
+ SendKeyHK(HK_TELETEXT, 0, 0, mode, 0);
+ break;
+ case amLib_ACT_RemoteApp:
+ SendKeyHK(HK_REMOTEAPP, 0, 0, mode, 0);
+ break;
+ default:
+ break;
+ }
+}
+
+
+
+void
+jslibrc_KeyDownEx( int src, int sys, int cmd )
+{
+ DFBInputDeviceKeySymbol symbol = 0;
+
+ if ( TranslateKey( &src, &sys, &cmd, &symbol ) )
+ {
+ SendKeyDown(symbol, src, sys, cmd, DIMM_HYPER);
+ }
+}
+
+void
+jslibrc_KeyUpEx( int src, int sys, int cmd )
+{
+ DFBInputDeviceKeySymbol symbol = 0;
+
+ if ( TranslateKey( &src, &sys, &cmd, &symbol ) )
+ {
+ SendKeyUp(symbol, src, sys, cmd, DIMM_HYPER);
+ }
+}
+
+int
+jslibrc_RequestActivityEx( amLib_EnumActivityId act, amLib_EnumActivation mode, int cookie )
+{
+ switch(act)
+ {
+ case amLib_ACT_HomeScreen:
+ SendKeyHK(HK_HOMESCREEN, 0, 0, mode, DIMM_HYPER);
+ break;
+ case amLib_ACT_WatchTV:
+// key_KeyDown( source, system, command );
+ SendKeyHK(DIKS_TUNER, 3, 0, mode, DIMM_HYPER);
+ break;
+ case amLib_ACT_BrowseUSB:
+ SendKeyHK(HK_MEDIA, MEDIA_USB,0,mode, DIMM_HYPER);
+ break;
+ case amLib_ACT_BrowseDLNA:
+ SendKeyHK(HK_MEDIA, MEDIA_Network,0,mode, DIMM_HYPER);
+ break;
+ case amLib_ACT_NetTV:
+ SendKeyHK(HK_HTML, 0, 0, mode, DIMM_HYPER);
+ break;
+ case amLib_ACT_Dfu:
+ SendKeyHK(HK_DFU, 0, 0, mode, DIMM_HYPER);
+ break;
+ case amLib_ACT_Teletext:
+ SendKeyHK(HK_TELETEXT, 0, 0, mode, DIMM_HYPER);
+ break;
+ case amLib_ACT_RemoteApp:
+ SendKeyHK(HK_REMOTEAPP, 0, 0, mode, DIMM_HYPER);
+ break;
+ default:
+ break;
+ }
+}
+
+void
+jslibrc_HIDKeyDown( int keycode )
+{
+ DFBInputEvent event;
+ int dfb_ret;
+
+ if (divine)
+ {
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_KEYPRESS;
+ event.flags = DIEF_KEYID;
+ event.key_id = keycode;
+ dfb_ret = divine->SendEvent (divine, &event);
+ }
+}
+
+void
+jslibrc_HIDKeyUp( int keycode )
+{
+ DFBInputEvent event;
+ int dfb_ret;
+
+ if (divine)
+ {
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_KEYRELEASE;
+ event.flags = DIEF_KEYID;
+ event.key_id = keycode;
+ dfb_ret = divine->SendEvent (divine, &event);
+ }
+}
+
+int
+jslibrc_HIDKeyDownEx( int keycode )
+{
+ DFBInputEvent event;
+ int dfb_ret = -1;
+
+ if (divine)
+ {
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_KEYPRESS;
+ event.flags = DIEF_KEYSYMBOL;
+ event.key_symbol = keycode;
+ dfb_ret = divine->SendEvent(divine, &event);
+ }
+ return dfb_ret;
+}
+
+int
+jslibrc_HIDKeyUpEx( int keycode )
+{
+ DFBInputEvent event;
+ int dfb_ret = -1;
+
+ if (divine)
+ {
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_KEYRELEASE;
+ event.flags = DIEF_KEYSYMBOL;
+ event.key_symbol = keycode;
+ dfb_ret = divine->SendEvent(divine, &event);
+ }
+ return dfb_ret;
+}
+
+void
+jslibrc_HidMouseMoveAbs ( int x, int y, int xmin, int xmax, int ymin, int ymax )
+{
+ DFBInputEvent event;
+ int dfb_ret;
+
+ if (divine)
+ {
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_AXISMOTION;
+ event.flags = DIEF_TIMESTAMP;
+ gettimeofday( &event.timestamp, NULL );
+ event.flags |= DIEF_AXISABS | DIEF_MIN | DIEF_MAX;
+ event.axis = DIAI_X;
+ event.min = xmin;
+ event.max = xmax;
+ event.axisabs = x;
+ dfb_ret = divine->SendEvent (divine, &event);
+ event.axis = DIAI_Y;
+ event.min = ymin;
+ event.max = ymax;
+ event.axisabs = y;
+ dfb_ret = divine->SendEvent (divine, &event);
+ }
+}
+
+void
+jslibrc_HidMouseMoveRel ( int dx, int dy, int sensitivity )
+{
+ DFBInputEvent event;
+ int dfb_ret;
+
+ if (divine)
+ {
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_AXISMOTION;
+ event.flags = DIEF_TIMESTAMP;
+ gettimeofday( &event.timestamp, NULL );
+ event.flags |= DIEF_AXISREL;
+ event.axis = DIAI_X;
+ event.axisrel = dx*sensitivity;
+ dfb_ret = divine->SendEvent (divine, &event);
+ event.axis = DIAI_Y;
+ event.axisrel = dy*sensitivity;
+ dfb_ret = divine->SendEvent (divine, &event);
+ }
+}
+
+void
+jslibrc_HidMouseMoveAbsEx ( int x, int y )
+{
+ DFBInputEvent event;
+ int dfb_ret;
+
+ if (divine)
+ {
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_AXISMOTION;
+ event.flags = DIEF_AXISABS;
+ event.axis = DIAI_X;
+ event.axisabs = x;
+ dfb_ret = divine->SendEvent (divine, &event);
+ event.axis = DIAI_Y;
+ event.axisabs = y;
+ dfb_ret = divine->SendEvent (divine, &event);
+ }
+}
+
+void
+jslibrc_HidMouseMoveRelEx ( int dx, int dy)
+{
+ DFBInputEvent event;
+ int dfb_ret;
+
+ if (divine)
+ {
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_AXISMOTION;
+ event.flags = DIEF_AXISREL;
+ event.axis = DIAI_X;
+ event.axisrel = dx;
+ dfb_ret = divine->SendEvent (divine, &event);
+ event.axis = DIAI_Y;
+ event.axisrel = dy;
+ dfb_ret = divine->SendEvent (divine, &event);
+ }
+}
+
+void
+jslibrc_HidMouseButtonDown ( int button )
+{
+ DFBInputEvent event;
+ int dfb_ret;
+
+ if (divine)
+ {
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_BUTTONPRESS;
+ event.flags = DIEF_NONE;
+ event.button = DIBI_FIRST;
+ dfb_ret = divine->SendEvent (divine, &event);
+ }
+}
+
+void
+jslibrc_HidMouseButtonUp( int button )
+{
+ DFBInputEvent event;
+ int dfb_ret;
+
+ if (divine)
+ {
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_BUTTONRELEASE;
+ event.flags = DIEF_NONE;;
+ event.button = DIBI_FIRST;
+ dfb_ret = divine->SendEvent (divine, &event);
+ }
+}
+
+void
+jslibrc_HidMouseButtonDownEx ( int button )
+{
+ DFBInputEvent event;
+ int dfb_ret;
+
+ if (divine)
+ {
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_BUTTONPRESS;
+ event.flags = 0;
+ event.button = DIBI_FIRST;
+ dfb_ret = divine->SendEvent (divine, &event);
+ }
+}
+
+void
+jslibrc_HidMouseButtonUpEx( int button )
+{
+ DFBInputEvent event;
+ int dfb_ret;
+
+ if (divine)
+ {
+ event.clazz = DFEC_INPUT;
+ event.type = DIET_BUTTONRELEASE;
+ event.flags = 0;
+ event.button = DIBI_FIRST;
+ dfb_ret = divine->SendEvent (divine, &event);
+ }
+}
\ No newline at end of file diff --git a/Jslib/jslibrc/jslibrc_client.h b/Jslib/jslibrc/jslibrc_client.h new file mode 100755 index 0000000..c1d9c15 --- /dev/null +++ b/Jslib/jslibrc/jslibrc_client.h @@ -0,0 +1,60 @@ + +/* + * 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. + * + */ + +#ifndef __JSLIBRC_CLIENT__ +#define __JSLIBRC_CLIENT__ + +#include <jslibrc_types.h> + + +int jslibrc_Init( int *argc, char **argv[] ); +void jslibrc_Exit( void ); + +void jslibrc_KeyDown( int src, int sys, int cmd ); +void jslibrc_KeyUp ( int src, int sys, int cmd ); +int jslibrc_RequestActivity( amLib_EnumActivityId act, amLib_EnumActivation mode, int cookie ); +/* To be used from 2k11 TV models onward */ +void jslibrc_KeyDownEx( int src, int sys, int cmd ); +void jslibrc_KeyUpEx ( int src, int sys, int cmd ); +int jslibrc_RequestActivityEx( amLib_EnumActivityId act, amLib_EnumActivation mode, int cookie ); +void jslibrc_HIDKeyDown( int keycode ); +void jslibrc_HIDKeyUp( int keycode ); +int jslibrc_HIDKeyDownEx( int keycode ); +int jslibrc_HIDKeyUpEx( int keycode ); +void jslibrc_HidMouseMoveAbs ( int x, int y, int xmin, int xmax, int ymin, int ymax ); +void jslibrc_HidMouseMoveRel ( int dx, int dy, int sensitivity ); +void jslibrc_HidMouseMoveAbsEx ( int x, int y ); +void jslibrc_HidMouseMoveRelEx ( int dx, int dy ); +void jslibrc_HidMouseButtonDown ( int button ); +void jslibrc_HidMouseButtonUp( int button ); +void jslibrc_HidMouseButtonDownEx ( int button ); +void jslibrc_HidMouseButtonUpEx( int button ); + +#endif + diff --git a/Jslib/jslibrc/jslibrc_types.h b/Jslib/jslibrc/jslibrc_types.h new file mode 100755 index 0000000..9757abe --- /dev/null +++ b/Jslib/jslibrc/jslibrc_types.h @@ -0,0 +1,431 @@ +#ifndef __JSLIBRC_TYPES__ +#define __JSLIBRC_TYPES__ + + +/* Rc5 System 0 raw key codes ----------------------*/ +#define rc5S0Digit0 0 +#define rc5S0Digit1 1 +#define rc5S0Digit2 2 +#define rc5S0Digit3 3 +#define rc5S0Digit4 4 +#define rc5S0Digit5 5 +#define rc5S0Digit6 6 +#define rc5S0Digit7 7 +#define rc5S0Digit8 8 +#define rc5S0Digit9 9 +#define rc5S0123Digits 10 +#define rc5S0ChannelProgramFrequency 11 +#define rc5S0Standby 12 +#define rc5S0MasterMuteDemute 13 +#define rc5S0PersonalPreference 14 +#define rc5S0Display 15 +#define rc5S0MasterVolumeUp 16 +#define rc5S0MasterVolumeDown 17 +#define rc5S0MasterBrightnessUp 18 +#define rc5S0MasterBrightnessDown 19 +#define rc5S0MasterSaturationUp 20 +#define rc5S0MasterSaturationDown 21 +#define rc5S0MasterBassUp 22 +#define rc5S0MasterBassDown 23 +#define rc5S0MasterTrebleUp 24 +#define rc5S0MasterTrebleDown 25 +#define rc5S0MasterBalanceRight 26 +#define rc5S0MasterBalanceLeft 27 +#define rc5S0ContrastUp 28 +#define rc5S0ContrastDown 29 +#define rc5S0SearchUp 30 +#define rc5S0TintHueDown 31 +#define rc5S0ChannelProgramUp 32 +#define rc5S0ChannelProgramDown 33 +#define rc5S0AlternateChannel 34 +#define rc5S0SoundSelect 35 +#define rc5S0SpatialStereo 36 +#define rc5S0StereoMono 37 +#define rc5S0Sleeptimer 38 +#define rc5S0TintHueUp 39 +#define rc5S0RfSwitch 40 +#define rc5S0StoreExecute 41 +#define rc5S0Time 42 +#define rc5S0ScanForward 43 +#define rc5S0Decrement 44 +#define rc5S0Cancel 45 +#define rc5S0SecondaryControlMenu 46 +#define rc5S0ShowClock 47 +#define rc5S0Pause 48 +#define rc5S0EraseCorrect 49 +#define rc5S0Rewind 50 +#define rc5S0GoTo 51 +#define rc5S0Wind 52 +#define rc5S0Play 53 +#define rc5S0Stop 54 +#define rc5S0Record 55 +#define rc5S0External1 56 +#define rc5S0External2 57 +#define rc5S0ClosedCaptioning 58 +#define rc5S0ViewDataAdvance 59 +#define rc5S0TxtSubmode 60 +#define rc5S0SystemStandby 61 +#define rc5S0Crispener 62 +#define rc5S0SystemSelect 63 +#define rc5S0SurroundSoundScroll 64 +/* define rc5S0... 65 */ +/* define rc5S0... 66 */ +#define rc5S0PipReplay 67 +#define rc5S0PipClear 68 +#define rc5S0PipSlowMotion 69 +#define rc5S0SpeechMusic 70 +#define rc5S0DimDown 71 +#define rc5S0RfLocator 72 +#define rc5S0Increment 73 +#define rc5S0Help 74 +#define rc5S0TunerAb 75 +#define rc5S0PcTv 76 +#define rc5S0LinearIncrement 77 +#define rc5S0LinearDecrement 78 +#define rc5S0SoundScroll 79 +#define rc5S0StepUp 80 +#define rc5S0StepDown 81 +#define rc5S0MenuOn 82 +#define rc5S0MenuOff 83 +#define rc5S0DisplayAvSystemStatus 84 +#define rc5S0StepLeft 85 +#define rc5S0StepRight 86 +#define rc5S0Acknowledge 87 +#define rc5S0PipPopOff 88 +#define rc5S0PipShift 89 +#define rc5S0PipMainSwap 90 +#define rc5S0StrobeOnOff 91 +#define rc5S0MultiStrobe 92 +#define rc5S0MainFreezed 93 +#define rc5S0MultiScanPip 94 +#define rc5S0PipSelect 95 +#define rc5S0MosaicMultiPip 96 +#define rc5S0PictureDigitalNoiseReduction 97 +#define rc5S0MainStored 98 +#define rc5S0PipStrobe 99 +#define rc5S0RecallMain 100 +#define rc5S0PipFreeze 101 +#define rc5S0PipStepUp 102 +#define rc5S0PipStepDown 103 +#define rc5S0PipSize 104 +#define rc5S0PictureScroll 105 +#define rc5S0ActuartorOnOff 106 +#define rc5S0Red 107 +#define rc5S0Green 108 +#define rc5S0Yellow 109 +#define rc5S0Cyan 110 +#define rc5S0IndexWhiteCancel 111 +#define rc5S0Next 112 +#define rc5S0Previous 113 +#define rc5S0LearningUp 114 +#define rc5S0LearningDown 115 +#define rc5S0ZoomPlus 116 +#define rc5S0SubtitleReposition 117 +#define rc5S0SubMode 118 +#define rc5S0OptionSubMode 119 +#define rc5S0ChannelGuide 120 +#define rc5S0SmartChannel 121 +#define rc5S0StoreOpenClose 122 +#define rc5S0Connect 123 +#define rc5S0Disconnect 124 +#define rc5S0ZoomMinus 125 +#define rc5S0MovieExpand 126 +#define rc5S0ParentalAccess 127 + + +/* Rc6 System 0 raw key codes ----------------------*/
+#define rc6S0Digit0 0
+#define rc6S0Digit1 1
+#define rc6S0Digit2 2
+#define rc6S0Digit3 3
+#define rc6S0Digit4 4
+#define rc6S0Digit5 5
+#define rc6S0Digit6 6
+#define rc6S0Digit7 7
+#define rc6S0Digit8 8
+#define rc6S0Digit9 9
+#define rc6S0PreviousProgram 10
+/* define rc6S0... 11 */
+#define rc6S0Standby 12
+#define rc6S0MuteDemute 13
+#define rc6S0PersonalPreference 14
+#define rc6S0Display 15
+#define rc6S0VolumeUp 16
+#define rc6S0VolumeDown 17
+#define rc6S0BrightnessUp 18
+#define rc6S0BrightnessDown 19
+#define rc6S0SaturationUp 20
+#define rc6S0SaturationDown 21
+#define rc6S0BassUp 22
+#define rc6S0BassDown 23
+#define rc6S0TrebleUp 24
+#define rc6S0TrebleDown 25
+#define rc6S0BalanceRight 26
+#define rc6S0BalanceLeft 27
+#define rc6S0CtrlLastPosition 28
+/* define rc6S0... 29 */
+#define rc6S0SearchUp 30
+#define rc6S0SearchDown 31
+#define rc6S0Next 32
+#define rc6S0Previous 33
+/* define rc6S0... 34 */
+/* define rc6S0... 35 */
+/* define rc6S0... 36 */
+/* define rc6S0... 37 */
+/* define rc6S0... 38 */
+/* define rc6S0... 39 */
+#define rc6S0FastForward 40
+/* define rc6S0... 41 */
+/* define rc6S0... 42 */
+#define rc6S0ScanReverse 43
+#define rc6S0Play 44
+/* define rc6S0... 45 */
+/* define rc6S0... 46 */
+/* define rc6S0... 47 */
+/* define rc6S0... 48 */
+#define rc6S0Stop 49
+/* define rc6S0... 50 */
+/* define rc6S0... 51 */
+/* define rc6S0... 52 */
+/* define rc6S0... 53 */
+/* define rc6S0... 54 */
+#define rc6S0Record 55
+#define rc6S0External1 56
+#define rc6S0External2 57
+/* define rc6S0... 58 */
+#define rc6S0AbProgram 59
+#define rc6S0TxtSubmode 60
+#define rc6S0SystemStandby 61
+/* define rc6S0... 62 */
+#define rc6S0SystemSelect 63
+#define rc6S0ContextualOptions 64
+/* define rc6S0... 65 */
+/* define rc6S0... 66 */
+/* define rc6S0... 67 */
+/* define rc6S0... 68 */
+#define rc6S0StoreOpenClose 69
+#define rc6S0ClosedCaptioning 70
+#define rc6S0Sleeptimer 71
+/* define rc6S0... 72 */
+/* define rc6S0... 73 */
+#define rc6S0PictureNumberTime 74
+#define rc6S0TvTextSubtitle 75
+/* define rc6S0... 76 */
+/* define rc6S0... 77 */
+#define rc6S0SoundSelect 78
+#define rc6S0SpatialStereo 79
+#define rc6S0StereoMono 80
+#define rc6S0SoundScroll 81
+#define rc6S0SurroundSound 82
+#define rc6S0SurroundSoundScroll 83
+#define rc6S0MenuOn 84
+#define rc6S0MenuOff 85
+/* define rc6S0... 86 */
+/* define rc6S0... 87 */
+#define rc6S0StepUp 88
+#define rc6S0StepDown 89
+#define rc6S0StepLeft 90
+#define rc6S0StepRight 91
+#define rc6S0Acknowledge 92
+#define rc6S0PipOnOff 93
+#define rc6S0PipSelect 94
+#define rc6S0PipShift 95
+#define rc6S0PipSize 96
+#define rc6S0PipStepDown 97
+#define rc6S0PipStepUp 98
+#define rc6S0PipMainSwap 99
+#define rc6S0PipFreeze 100
+#define rc6S0PipStrobe 101
+#define rc6S0MosaicMultiPip 102
+#define rc6S0MainFreezed 103
+#define rc6S0MainStored 104
+/* define rc6S0... 105 */
+/* define rc6S0... 106 */
+/* define rc6S0... 107 */
+/* define rc6S0... 108 */
+#define rc6S0Red 109
+#define rc6S0Green 110
+#define rc6S0Yellow 111
+#define rc6S0Cyan 112
+#define rc6S0IndexWhite 113
+/* define rc6S0... 114 */
+/* define rc6S0... 115 */
+/* define rc6S0... 116 */
+#define rc6S0TimerSet 117
+/* define rc6S0... 118 */
+/* define rc6S0... 119 */
+#define rc6S0Preset10 120
+#define rc6S0Preset11 121
+#define rc6S0Preset12 122
+#define rc6S0Preset13 123
+#define rc6S0Preset14 124
+#define rc6S0Preset15 125
+#define rc6S0Preset16 126
+#define rc6S0Time 127
+/* define rc6S0... 128 */
+#define rc6S0Help 129
+#define rc6S0DefaultMenuSelect 130
+/* define rc6S0... 131 */
+#define rc6S0FavouriteMode 132
+#define rc6S0SwivelMode 133
+#define rc6S0External3 134
+#define rc6S0External4 135
+#define rc6S0External5 136
+/* define rc6S0... 137 */
+#define rc6S0VideoVgaSelect 138
+#define rc6S0NextSource 139
+#define rc6S0BacklightUp 140
+#define rc6S0BacklightDown 141
+#define rc6S0HdAtHome 142
+#define rc6S0AmbLightOnOffDim 143
+#define rc6S0AmbLightMode 144
+#define rc6S0AmbilightBrightnessUp 145
+#define rc6S0AmbilightBrightnessDown 146
+/* define rc6S0... 147 */
+/* define rc6S0... 148 */
+/* define rc6S0... 149 */
+#define rc6S0Smart 150
+#define rc6S0SoftKey1A 151
+#define rc6S0SoftKey1B 152
+#define rc6S0SoftKey2A 153
+#define rc6S0SoftKey2B 154
+#define rc6S0SoftKey3A 155
+#define rc6S0SoftKey3B 156
+#define rc6S0Smiley 157
+#define rc6S0Frownie 158
+/* define rc6S0... 159 */
+/* define rc6S0... 160 */
+/* define rc6S0... 161 */
+/* define rc6S0... 162 */
+#define rc6S0AvMute 163
+/* define rc6S0... 164 */
+/* define rc6S0... 165 */
+/* define rc6S0... 166 */
+/* define rc6S0... 167 */
+/* define rc6S0... 168 */
+/* define rc6S0... 169 */
+/* define rc6S0... 170 */
+/* define rc6S0... 171 */
+/* define rc6S0... 172 */
+/* define rc6S0... 173 */
+/* define rc6S0... 174 */
+/* define rc6S0... 175 */
+#define rc6S0MainSubmode 176
+#define rc6S0Resume 177
+/* define rc6S0... 178 */
+/* define rc6S0... 179 */
+/* define rc6S0... 180 */
+/* define rc6S0... 181 */
+/* define rc6S0... 182 */
+/* define rc6S0... 183 */
+/* define rc6S0... 184 */
+/* define rc6S0... 185 */
+/* define rc6S0... 186 */
+/* define rc6S0... 187 */
+/* define rc6S0... 188 */
+/* define rc6S0... 189 */
+#define rc6S0DisplayBrowser 190
+/* define rc6S0... 191 */
+#define rc6S0AnalogueDigital 192
+#define rc6S0DigitalSetupMenu 193
+#define rc6S0OneTouchHomeCinema 194
+#define rc6S0BatteryLow 195
+#define rc6S0CursorUpRight 196
+#define rc6S0CursorUpLeft 197
+#define rc6S0CursorDownRight 198
+#define rc6S0CursorDownLeft 199
+#define rc6S0Digit100 200
+#define rc6S0RotCabClockwise 201
+#define rc6S0CenterCabinet 202
+#define rc6S0RotCabAntiClockwise 203
+#define rc6S0EpgGuide 204
+#define rc6S0ToggleStandby 205
+#define rc6S0PageUp 206
+#define rc6S0PageDown 207
+#define rc6S0DigitalPictureMenu 208
+#define rc6S0StartPage 209
+#define rc6S0FavouritesList 210
+#define rc6S0MarkListitem 211
+/* define rc6S0... 212 */
+#define rc6S0SubmodeSystemMenu 213
+#define rc6S0ZoomOnOff 214
+#define rc6S0CableMode 215
+#define rc6S0WideScreen 216
+#define rc6S0Dot 217
+#define rc6S0SpeechMusic 218
+#define rc6S0Options 219
+#define rc6S0RfSwitch 220
+#define rc6S0ActuatorOnOff 221
+#define rc6S0Learn1 222
+#define rc6S0Learn2 223
+#define rc6S0CancelPicture 224
+#define rc6S0Enter 225
+#define rc6S0Exchange 226
+#define rc6S0TxtTv 227
+#define rc6S0NewsFlash 228
+#define rc6S0RowZero 229
+#define rc6S0SequenceOut 230
+#define rc6S0LargeTopBottomNormal 231
+#define rc6S0StepPageDown 232
+#define rc6S0StepPageUp 233
+#define rc6S0RevealConceal 234
+#define rc6S0PageHold 235
+#define rc6S0Index 236
+#define rc6S0RadioChannelDown 237
+#define rc6S0RadioChannelUp 238
+#define rc6S0PayTvChannelDown 239
+#define rc6S0PayTvChannelUp 240
+#define rc6S0TiltForward 241
+#define rc6S0TiltBackward 242
+#define rc6S0VideoPp 243
+#define rc6S0AudioPp 244
+#define rc6S0MovieExpand 245
+#define rc6S0ZoomMinus 246
+#define rc6S0ZoomPlus 247
+#define rc6S0ShowClock 248
+#define rc6S0PictureDigitalNoiseReduction 249
+#define rc6S0Crispener 250
+#define rc6S0ContrastDown 251
+#define rc6S0ContrastUp 252
+#define rc6S0TintHueDown 253
+#define rc6S0TintHueUp 254
+#define rc6S0Wysiwyr 255
+
+
+
+#define keySourceLkb 1 +#define keySourceRc5 2 +#define keySourceRc6 3
+
+
+typedef enum{
+ amLib_ACT_Toggle,
+ amLib_ACT_Start,
+ amLib_ACT_Stop,
+ amLib_ACT_StartNoFocus
+} amLib_EnumActivation;
+
+typedef enum{
+ amLib_ACT_HomeScreen,
+ amLib_ACT_NetTV,
+ amLib_ACT_BrowseUSB,
+ amLib_ACT_BrowseDLNA,
+ amLib_ACT_WatchTV,
+ amLib_ACT_WatchSatellite,
+ amLib_ACT_WatchExt,
+ amLib_ACT_MultiApp,
+ amLib_ACT_VideoStore,
+ amLib_ACT_Dfu,
+ amLib_ACT_Teletext,
+ amLib_ACT_Epg,
+ amLib_ACT_Esticker,
+ amLib_ACT_Mhp,
+ amLib_ACT_Upgrade,
+ amLib_ACT_LoadingAnimation,
+ amLib_ACT_Widgets,
+ amLib_ACT_RemoteApp
+} amLib_EnumActivityId;
+
+ +#endif + diff --git a/Jslib/tools/remco.c b/Jslib/tools/remco.c new file mode 100755 index 0000000..9f3441f --- /dev/null +++ b/Jslib/tools/remco.c @@ -0,0 +1,326 @@ +/*
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <direct/util.h>
+#include <jslibrc_client.h>
+//#include <directfb_keyboard.h>
+
+
+/**************************************
+* 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<D_ARRAY_SIZE(rcButtonMatrix); i++) { + if (!rcButtonMatrix[i]) + continue; + + if (!strncasecmp( name, rcButtonMatrix[i], strlen(name) )) + return rcButtonMapping[i]; + } + + return 0; +} +
+
+static void
+CleanLine( char *line )
+{
+ while ( (*line != '\r') && (*line != '\n') && (*line != ';'))
+ {
+ line++;
+ }
+ *line = 0;
+}
+
+
+static void
+ExecuteCommand(int command)
+{
+ switch(command)
+ {
+ case HK_HOMESCREEN_START:
+ jslibrc_RequestActivity( amLib_ACT_HomeScreen, amLib_ACT_Start, 0 );
+ break;
+ case HK_HOMESCREEN_STOP:
+ jslibrc_RequestActivity( amLib_ACT_HomeScreen, amLib_ACT_Stop, 0 );
+ break;
+ case HK_WATCHTV_START:
+ jslibrc_RequestActivity( amLib_ACT_WatchTV, amLib_ACT_Start, 0 );
+ break;
+ case HK_WATCHTV_STOP:
+ jslibrc_RequestActivity( amLib_ACT_WatchTV, amLib_ACT_Stop, 0 );
+ break;
+ case HK_CB_USB_START:
+ jslibrc_RequestActivity( amLib_ACT_BrowseUSB, amLib_ACT_Start, 0 );
+ break;
+ case HK_CB_USB_STOP:
+ jslibrc_RequestActivity( amLib_ACT_BrowseUSB, amLib_ACT_Stop, 0 );
+ break;
+ case HK_CB_DLNA_START:
+ jslibrc_RequestActivity( amLib_ACT_BrowseDLNA, amLib_ACT_Start, 0 );
+ break;
+ case HK_CB_DLNA_STOP:
+ jslibrc_RequestActivity( amLib_ACT_BrowseDLNA, amLib_ACT_Stop, 0 );
+ break;
+ case HK_NETTV_START:
+ jslibrc_RequestActivity( amLib_ACT_NetTV, amLib_ACT_Start, 0 );
+ break;
+ case HK_NETTV_STOP:
+ jslibrc_RequestActivity( amLib_ACT_NetTV, amLib_ACT_Stop, 0 );
+ break;
+ case HK_DFU_START:
+ jslibrc_RequestActivity( amLib_ACT_Dfu, amLib_ACT_Start, 0 );
+ break;
+ case HK_DFU_STOP:
+ jslibrc_RequestActivity( amLib_ACT_Dfu, amLib_ACT_Stop, 0 );
+ break;
+ case HK_TELETEXT_START:
+ jslibrc_RequestActivity( amLib_ACT_Teletext, amLib_ACT_Start, 0 );
+ break;
+ case HK_TELETEXT_STOP:
+ jslibrc_RequestActivity( amLib_ACT_Teletext, amLib_ACT_Stop, 0 );
+ break;
+ case HK_REMOTEAPP_START:
+ jslibrc_RequestActivity( amLib_ACT_RemoteApp, amLib_ACT_Start, 0 );
+ break;
+ case HK_REMOTEAPP_STOP:
+ jslibrc_RequestActivity( amLib_ACT_RemoteApp, amLib_ACT_Stop, 0 );
+ break;
+ default:
+ jslibrc_KeyDown( keySourceRc6, 0, command );
+ jslibrc_KeyUp( keySourceRc6, 0, command );
+// jslibrc_HIDKeyDown( DIKI_O );
+// jslibrc_HIDKeyUp( DIKI_O );
+ break;
+ }
+}
+
+ +/***************************************
+* Main procedure
+***************************************/
+int +main (int argc, char *argv[]) +{ + int i,k; + int bParseOK = 1;
+ char filename[FILENAME_LENGTH]={'\0'};
+ char line[LINE_LENGTH+1];
+ int timeout;
+ FILE *f;
+
+ jslibrc_Init( &argc, &argv );
+
+ // Print ussage
+ printf("\n\n");
+ printf("Usage: remco [--keycommandfile <file>] keycommand keycommand ...\n\n");
+ printf("Supported key commands:\n");
+ k=0;
+ for (i=0; i<D_ARRAY_SIZE(rcButtonMatrix); i++) {
+ if (!rcButtonMatrix[i])
+ continue;
+ printf("'%s' ", rcButtonMatrix[i]);
+ k++;
+ if ( !(k%4) ) printf("\n");
+ }
+ printf("\n\n");
+
+
+ // Parse arguments
+ for (i = 1; i < argc && bParseOK; i++)
+ {
+ const char * pArg = argv[i];
+ if ('-' == *pArg++ && '-' == *pArg++)
+ {
+ if ((0 == strcmp(pArg, "keycommandfile")) && (i + 1 < argc))
+ {
+ strncpy (filename, argv[i+1], sizeof(filename) );
+ printf("Reading commands from %s\n\n", filename);
+ }
+ else
+ {
+ bParseOK = 0;
+ }
+ }
+ }
+ if (!bParseOK) exit;
+
+ + if (filename[0])
+ {
+ // Use file as input
+ if (f = fopen(filename,"r"))
+ {
+ while (fgets(line, LINE_LENGTH, f))
+ {
+ if ( (line[0] != 0) && (line[0] != ';') && (line[0] != '#') )
+ {
+ CleanLine(line);
+ printf("%s\n", line);
+ if (!strncmp(line, "sleep", 5))
+ {
+ sscanf(&line[5], "%d", &timeout);
+ sleep(timeout);
+ }
+ else
+ {
+ int command = LookupCommand(line);
+ if (command == -1)
+ {
+ printf( "Unknown key command '%s'\n", line );
+ continue;
+ }
+ ExecuteCommand(command);
+ }
+ }
+ }
+ fclose(f);
+ }
+ else
+ {
+ printf( "File not found!\n");
+ }
+ }
+ else
+ {
+ // Use ARGVs
+ for (i=1; i<argc; i++)
+ {
+ int command = LookupCommand( argv[i] );
+ if (command == -1)
+ {
+ printf( "Unknown key command '%s'!\n", argv[i] );
+ continue;
+ }
+ ExecuteCommand(command);
+ }
+ }
+
+ jslibrc_Exit(); + + return 0; +} + diff --git a/Jslib/tools/remco2k11.c b/Jslib/tools/remco2k11.c new file mode 100755 index 0000000..942ef2c --- /dev/null +++ b/Jslib/tools/remco2k11.c @@ -0,0 +1,323 @@ +/*
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <direct/util.h>
+#include <jslibrc_client.h>
+
+
+/**************************************
+* 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<D_ARRAY_SIZE(rcButtonMatrix); i++) { + if (!rcButtonMatrix[i]) + continue; + + if (!strncasecmp( name, rcButtonMatrix[i], strlen(name) )) + return rcButtonMapping[i]; + } + + return 0; +} +
+
+static void
+CleanLine( char *line )
+{
+ while ( (*line != '\r') && (*line != '\n') && (*line != ';'))
+ {
+ line++;
+ }
+ *line = 0;
+}
+
+
+static void
+ExecuteCommand(int command)
+{
+ switch(command)
+ {
+ case HK_HOMESCREEN_START:
+ jslibrc_RequestActivityEx( amLib_ACT_HomeScreen, amLib_ACT_Start, 0 );
+ break;
+ case HK_HOMESCREEN_STOP:
+ jslibrc_RequestActivityEx( amLib_ACT_HomeScreen, amLib_ACT_Stop, 0 );
+ break;
+ case HK_WATCHTV_START:
+ jslibrc_RequestActivityEx( amLib_ACT_WatchTV, amLib_ACT_Start, 0 );
+ break;
+ case HK_WATCHTV_STOP:
+ jslibrc_RequestActivityEx( amLib_ACT_WatchTV, amLib_ACT_Stop, 0 );
+ break;
+ case HK_CB_USB_START:
+ jslibrc_RequestActivityEx( amLib_ACT_BrowseUSB, amLib_ACT_Start, 0 );
+ break;
+ case HK_CB_USB_STOP:
+ jslibrc_RequestActivityEx( amLib_ACT_BrowseUSB, amLib_ACT_Stop, 0 );
+ break;
+ case HK_CB_DLNA_START:
+ jslibrc_RequestActivityEx( amLib_ACT_BrowseDLNA, amLib_ACT_Start, 0 );
+ break;
+ case HK_CB_DLNA_STOP:
+ jslibrc_RequestActivityEx( amLib_ACT_BrowseDLNA, amLib_ACT_Stop, 0 );
+ break;
+ case HK_NETTV_START:
+ jslibrc_RequestActivityEx( amLib_ACT_NetTV, amLib_ACT_Start, 0 );
+ break;
+ case HK_NETTV_STOP:
+ jslibrc_RequestActivityEx( amLib_ACT_NetTV, amLib_ACT_Stop, 0 );
+ break;
+ case HK_DFU_START:
+ jslibrc_RequestActivityEx( amLib_ACT_Dfu, amLib_ACT_Start, 0 );
+ break;
+ case HK_DFU_STOP:
+ jslibrc_RequestActivityEx( amLib_ACT_Dfu, amLib_ACT_Stop, 0 );
+ break;
+ case HK_TELETEXT_START:
+ jslibrc_RequestActivityEx( amLib_ACT_Teletext, amLib_ACT_Start, 0 );
+ break;
+ case HK_TELETEXT_STOP:
+ jslibrc_RequestActivityEx( amLib_ACT_Teletext, amLib_ACT_Stop, 0 );
+ break;
+ case HK_REMOTEAPP_START:
+ jslibrc_RequestActivityEx( amLib_ACT_RemoteApp, amLib_ACT_Start, 0 );
+ break;
+ case HK_REMOTEAPP_STOP:
+ jslibrc_RequestActivityEx( amLib_ACT_RemoteApp, amLib_ACT_Stop, 0 );
+ break;
+ default:
+ jslibrc_KeyDownEx( keySourceRc6, 0, command );
+ jslibrc_KeyUpEx( keySourceRc6, 0, command );
+ break;
+ }
+}
+
+ +/***************************************
+* Main procedure
+***************************************/
+int +main (int argc, char *argv[]) +{ + int i,k; + int bParseOK = 1;
+ char filename[FILENAME_LENGTH]={'\0'};
+ char line[LINE_LENGTH+1];
+ int timeout;
+ FILE *f;
+
+ jslibrc_Init( &argc, &argv );
+
+ // Print ussage
+ printf("\n\n");
+ printf("Usage: remco [--keycommandfile <file>] keycommand keycommand ...\n\n");
+ printf("Supported key commands:\n");
+ k=0;
+ for (i=0; i<D_ARRAY_SIZE(rcButtonMatrix); i++) {
+ if (!rcButtonMatrix[i])
+ continue;
+ printf("'%s' ", rcButtonMatrix[i]);
+ k++;
+ if ( !(k%4) ) printf("\n");
+ }
+ printf("\n\n");
+
+
+ // Parse arguments
+ for (i = 1; i < argc && bParseOK; i++)
+ {
+ const char * pArg = argv[i];
+ if ('-' == *pArg++ && '-' == *pArg++)
+ {
+ if ((0 == strcmp(pArg, "keycommandfile")) && (i + 1 < argc))
+ {
+ strncpy (filename, argv[i+1], sizeof(filename) );
+ printf("Reading commands from %s\n\n", filename);
+ }
+ else
+ {
+ bParseOK = 0;
+ }
+ }
+ }
+ if (!bParseOK) exit;
+
+ + if (filename[0])
+ {
+ // Use file as input
+ if (f = fopen(filename,"r"))
+ {
+ while (fgets(line, LINE_LENGTH, f))
+ {
+ if ( (line[0] != 0) && (line[0] != ';') && (line[0] != '#') )
+ {
+ CleanLine(line);
+ printf("%s\n", line);
+ if (!strncmp(line, "sleep", 5))
+ {
+ sscanf(&line[5], "%d", &timeout);
+ sleep(timeout);
+ }
+ else
+ {
+ int command = LookupCommand(line);
+ if (command == -1)
+ {
+ printf( "Unknown key command '%s'\n", line );
+ continue;
+ }
+ ExecuteCommand(command);
+ }
+ }
+ }
+ fclose(f);
+ }
+ else
+ {
+ printf( "File not found!\n");
+ }
+ }
+ else
+ {
+ // Use ARGVs
+ for (i=1; i<argc; i++)
+ {
+ int command = LookupCommand( argv[i] );
+ if (command == -1)
+ {
+ printf( "Unknown key command '%s'!\n", argv[i] );
+ continue;
+ }
+ ExecuteCommand(command);
+ }
+ }
+
+ jslibrc_Exit(); + + return 0; +} + |