Monday, November 25, 2013

Learning Flash

The Flash engine inside the box is FlashLite 3.1, and makes use of ActionScript 2.0

While setting up the environment, I was reading the documentation in the Lexmark SDK and came across this part:
The SDK comes with several components (SWCs) that must be set up in the proper location in order for Creative Suite to make use of them. To install these components, do the following:
Determine the proper data directory.
For CS5, it will look like this: (Your Drive):\Documents and Settings\(Your user name)\Local Settings\Application Data\Adobe\Flash CS5\(Language and country, i.e. en_US)\Configuration\Components
 and while I do have this directory on the machine, there is one more child directory named "Flex" which does contain a SWC file in it.  So at this time I am not 100% sure whether I will need to copy over SWC files into the one specified by the documentation or the child directory named "Flex".  For the moment I am going to stay strictly with the documentation and if problems arise I can see if this is the problem.

The documentation has you set up the Test SWF app on the printer so that you can test SWF files.  I ran into a problem at first however with the app not showing anything.  However I luckily figured out that the publishing settings were set to run on flash player 10 instead of Flash Lite 3.1 like it needed to be, here is how I fixed it.

Inside of Flash Player under File>Publish Settings>Flash I changed the Player value to Flash Lite3.1 and under formats I unclicked HTML so that we don't get an HTML published format.

In order to see actionscript inside of eclipse I downloaded the plugin at http://aseclipseplugin.sf.net/updates/ in order to get syntax highlighting


Also found out that calling SWFPromptContext.cancel will take you back to the homescreen where as .dismiss() will just dismiss the prompt and contiue on with the go() function

Saturday, November 23, 2013

Customer Change Request

After showing the app to Lexmark, they have decided that they would like us to have a Flash interface instead of the current VLML interface.  Here is a list of all of the changes that were proposed by our customer (Jason):
  • Login and Password prompts should ask for your gmail account.
  • Hide password with asterisks.
  • When authorization fails give a message and let them retype their password.
  • Where the meetings are displayed either make the date bigger or get rid of it.
  • Make some of the Tips screens better by changing them from one long paragraph to multiple paragraphs. 
  • Fix descriptions on the settings screen. 
  • Fix the white bar on the meetings page.
  • The timing for late, on time, and running close seem to be a little off.
  • Make the status for each meeting bigger and more than just late. They wanted late to become You are Late.
  • Put the arrow buttons when there is a double booking at the middle of the screen. (They might have changed their minds on this one, they saw another place in an app that had the arrows at the bottom).
  • The back button for tips needs to be all the way to the bottom right corner. 

Thursday, November 7, 2013

Integration Testing

After a few days of trying to get JUnit up and running, I have decided that integration testing will be the best route to take.  The way we ended up doing integration testing is to have a separate program which can invoke different elements and modules that we have create for this program.

Unit testing ended up not working to well as our classes often are reliant on many different services which may or may not be present.  Other obstacles with unit testing were that we were forced to test with junit 3 and the framework needed to run on a special application on the printer in order to see test results.  All of this made it unnecessary and clearly the wrong approach for testing.

In our test program, we take out individual classes and test them similar to how we would do unit testing but with more emphasis on how it will interact with the overall system.  For example with the EmailPrompt.java class we test that it can show all messages which are passed into the constructor in the radio list on screen.  We also test that the prompt returns the correct message by allowing the user in the program to test edge cases and off by one errors.

Wednesday, November 6, 2013

Completed work on the EmailPrompt

The email prompt class is a class which aids in rendering a graphical user interface as well as handling primary events which happen as a result of user interaction.

It's important to remember the overall theme of what happens in an eSF application on a Lexmark computer.  A Profile is a series of Prompt's.  A prompt is an individual screen which can be rendered and handle events.  There are several standard prompts that the SDK provides such as a Message prompt, String prompt, and other base prompts that can be utilized in many settings.

As part of this project though, the requirements for the screens cause us to have to implement a custom prompt.  When implementing a custom prompt you must create a class that extends BasePrompt and implements VlmlPrompt.  One method which will need to be overridden is getVlml which returns the String representation of the custom vlml to be shown to the user.

We saw in the SDK that many of the examples would literally write the VLML into string literals which would cause them to have to escape a lot of text and generally looked tedious.  The way that we tackled this problem was to have the VLML centralized into an xml file which we then import in program code and convert to a String representation that the framework expects.  Gavin used the StringSubstitutor class so that we could place tags within the xml file such as ${texttoreplace} and using the string substitutor class we could easily throw in dynamic elements into the VLML file.  This proved useful when I was implementing the EmailPrompt class as the Email Prompt needs to be able to display different messages depending on the messages that are passed into the constructor.  Therefore I was able to put a tag like ${radio1} in the VLML file and have that text replaced with one of the messages passed into the constructor.

Sunday, October 20, 2013

Finished the MeetingPrinter

I was able to glean a lot of information from the printexample project in the SDK and I would recommend anyone looking for printer information to look there first for a good look at implementation.  It still seems that you are able to pass the PrintService a text input stream or formatted html and it will work just fine.  I still don't see any thorough documentation on what different ways the InputStream can be formatted.

The PrintService must register as a component of the bundle and must be registered in the bundle.permissions file as well.  As I have implemented it thus far, the main Profile (GoudaProfile) has a callback function that sets the PrintService member variable when it becomes available and sets it to null if it is not available.  From there the GoudaProfile constructs a MeetingPrinter object by passing the PrintService member variable to the MeetingPrinter Constructor.

Gavin took care of the Google API's and he created the main data class which is Meeting.java.  He used the builder pattern but the way he implemented it, each builder can only build a single object so if you want multiple objects you must create multiple builders.

Meeting.Builder expects a certain date-time format for it's argument which is based off an ISO standard but a simple example of something I used to mock a Meeting object was 2013-10-30T14:00:00-05:00

Today Gavin and Daniel will be coming over here to work on the project further and we will soon be moving the printer back to Marksbury so that we can all VLC into it.

Here is the test code i usedc to mock meeting objects and send them to the MeetingPrinter
//Create a new meeting object
         Meeting.Builder builder = new Builder(DateTimeZone.UTC, false);
         builder.host("Batman", "b@tman.com");
         builder.name("Deep voice lessons");
         builder.startDatetime("2013-10-30T10:00:00-05:00");
         builder.endDatetime("2013-10-30T11:00:00-05:00");
         Meeting meeting = builder.build();
       
         Meeting.Builder builder2 = new Builder(DateTimeZone.UTC, false);
         builder2.host("Batman", "b@tman.com");
         builder2.name("Play COD with Robin");
         builder2.startDatetime("2013-10-30T13:00:00-05:00");
         builder2.endDatetime("2013-10-30T14:00:00-05:00");
         Meeting meeting2 = builder2.build();
       
         if(printService != null) {
            MeetingPrinter meetingPrinter = new MeetingPrinter(printService);
            meetingPrinter.print(new Meeting[]{meeting, meeting2});
         }


Thursday, October 17, 2013

Working with the printing APIs

So on the high level I have learned that all things are packaged into things called bundles, these bundles are managed by the OSGi framework.  Each bundle has an activator that is run when the bundle is being prepared for use.  When the bundles activator has completed the framework gives control to dependent bundles callback that is listening for the activation to be complete.  Bundles must declare their dependencies explicitly in their manifest and must also say the cardinality of the dependency.

The Print Service API is really simple though it is not well documented.  I gained most of my knowledge by looking at the example app in the sdk which showed that it was possible to print from a url by getting a handle to an inputStream object that contains the html of the webpage.  I took this concept further and constructed a string and from that a String into an InputStream via the following code:
// convert String into InputStream
  inputStream = new ByteArrayInputStream(str.getBytes());

Sunday, October 6, 2013

Setting up Development Environment

Setting up a new development environment is usually a tricky endeavour so I am going to go through the steps here to show how I got the environment up and running.

First off I set up a new user on my Ubuntu machine as the environment is calling for a few unique environment variables to be set and I don't want it to interfere with my main user on my machine.

The Lexmark SDK called for the  Java Development Kit version 1.4.2 so I downloaded that after setting up an account with Oracle.  And after 2 hours of trying to install the jdk on linux it's a no go. Something about the tail command not being recognized.  Whatever I'll develop on Windows.

So I downloaded the LES-SDK zip file that lexmark provided and extracted it's contents to a local directory within my home directory.  I downloaded the 1.4.2 JDK from the oracle website and set the java home environment variable. I downloaded the latest version of Eclipse from eclipse.org and extracted that zip file to my home directory.

Inside the SDK zip file you find a file called index.html which goes step by step on how to install eclipse, ant, the java jdk, and how to set up environment variables and get the eclipse plugin working.  I won't repeat the steps here as they are already well laid out in the document there.