View Single Post
Old 11-02-2009, 05:10 AM   #1
DairyKnight
Connoisseur
DairyKnight plays well with othersDairyKnight plays well with othersDairyKnight plays well with othersDairyKnight plays well with othersDairyKnight plays well with othersDairyKnight plays well with othersDairyKnight plays well with othersDairyKnight plays well with othersDairyKnight plays well with othersDairyKnight plays well with othersDairyKnight plays well with others
 
Posts: 63
Karma: 2600
Join Date: Oct 2008
Device: PRS-505
Kindle DX Homebrew - Booklet&AWT Event Hook works, a step forward

Today I finally got the time to try on the AWT Event Hook with Amazon's Booklet/KOS framework. To my surprise, it's so easy and just works like a charm.

The idea:
1. Replace the Amazon msp.jar booklet (the minesweep & go game) with user java code.
2. Hook into the AWT event queue in order to load user code upon request (e.g. hot key combination).

The implementation:
Code is attached. To write a booklet for Amazon KOS (codename for kindle os, i guess? ), one has to implement the following interface:

package com.amazon.ebook.framework.a
public abstract interface a
{
public abstract String C(); // Returns the booklet name

public abstract void c(); // Initialize the booklet

public abstract void B(); // ? Load the booklet ?

public abstract void b(); // Handles open file

public abstract void A(); // ?

/** @deprecated */
public abstract void a(y paramy, Graphics paramGraphics); // painting
/*
}

Upon initializing the KOS framework, kindle will look for all classes in /opt/amazon/ebook/booklets/*.jar and load all classes implementing the above interface.

So what I did was simply replacing the msp.jar with my code and let it get loaded.

Easiest way to use the code: (I suppose you know scp/mntroot stuffs)
1. Create a CDC project in Netbeans with name 'msp'
2. Import all amazon libraries from /opt/amazon/ebook/lib/, and the attached source code.
3. Build the code. Create /mnt/us/log directory for event logging.
4. Replace /opt/amazon/ebook/booklets/msp.jar (Don't forget to backup!)
5. /etc/init.d/framework restart You'll see all the AWT Events logged in /mnt/us/log


Thoughts on future development:

1. Develop a unified 'Application Launcher' (like what in iPhone and Palm ) to load user code from, e.g. /mnt/us/Applications/ with Java classloader. We will be able to start this launcher with key combinations. (Intercept key combination in dispatchEvent())

2. Replace default key behaviours on kindle. e.g. Use 5-way sticks for page turing.
Attached Files
File Type: zip src.zip (2.8 KB, 600 views)
DairyKnight is offline   Reply With Quote