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.


Monday, September 30, 2013

Emails with Client



Daniel Turkington (who is the POC for our development questions) addressed a few of the concerns we were having about the project. We were wondering if we needed a certificate in order to install onto the device but Daniel said that the fls file contains a developer certificate which contains all the MAC addresses of development machines. Therefore he believes that we shouldn't have any problems with building the application in that respect.




Daniel also showed us how to access the printer log by
1. Type "<printer ip address>/se" in your browser
2. Click "Embedded Solutions"
3. Click "Log File"


We still need to have the OAuth issue addressed about needing to log in with a browser on the device despite not having a browser. I did just now find this document https://developers.google.com/accounts/docs/OAuth2ForDevices. 

 The document states that for a printer device we will have to display a url for the user to navigate to on a device with a browser and they will have to put in the user code that we provide. Once they have done this, our application will have to poll the endpoint to see when the user has allowed the app access to their calendar. We will need to store the the access token as well as the refresh token.  The access token expires after a given amount of time so we will need to check the validity of the access token and use the refresh token if the access token has expired.

Sunday, September 29, 2013

Architecture Assignment Meeting

Today Gavin, Daniel, and I met to discuss and complete the architecture assignement.  Gavin address a huge concern that he was having about authentication.  Apparently OAuth authentication with google requires that a user login to Google through a browser after which an authentication token will be created and passed back to the application.  The problem is that as far as we know, the printer doesn't have a browser and thus OAuth may not be possible.  If it's not possible then we will either have to access public browsers or figure out a different means of authentication.

We started out the meeting discussing the user stories and we built up a high level overview from this.  From there we fleshed out a fairly comprehensive class diagram over the course of the next 2 hours.  Some major design points that we discussed was adding interfaces for the Google Calendar Service as well as the Google Authentication Manager which are CalendarService and AuthenticationManager respectively.  The reason we did this was to allow for other calendar services to be plugged into  the AppController without requiring modification to it's logic.

We also decided on implementing an MVC architecture so that we could keep the business logic separate from the view.

As of now we are also unsure of another major design decision which has to do with multi-threading.  We are not positive what facilities are available to us for multithreading but we feel it will be necessary as we are hoping to show a short dialog during printing and sending an email and having a callback being invoked when they complete, however we don't want to block as the user may still want to look through the different meetings for that day while the email is sending or while printing.

Authentication Problem
Spawning a new thread for printing.

Preparation for Group Architecture Meeting Tomorrow

Saturday September 28, 2013

Our team has a scheduled meeting tomorrow to discuss and finish the Architecture Assignment.  I have already begun exploring the SDK to get a feel of what our major components will be.  Daniel Turkington had explained in the initial meeting that our development would have to center around an OSGi based system for our code modules.  So today I learned about the basics of OSGi and the main concepts that would be useful.

OSGi as I understand it will involve bundling our package files into a jar file with some extra metadata which will contain such information as the modules interface, the modules dependencies, and what services the module provides.


Tuesday, September 17, 2013

Initial meeting with Lexmark

Yesterday, Gavin and I had our requirements workshop with Lexmark.  Jason explained the app in very good detail and provided us with a spec sheet that served as a foundation for a long conversation which went on to answer many of the questions and concerns we had.

Daniel (the developer) explained how the development workflow would be going as far as testing and running the app and also provided us with the sdk zip file so that we could start exploring it.  We will basically be VNCing into the the printer remotely and will be able to run our app that way after uploading it on to the printer via ftp.

We will be having weekly meetings with Shaun Love on Tuesdays at 6pm via Skype to discuss the project.

Jason explained some of the technologies that we would be needing to get familiar with including ActionScript for the Flash UI development and told us that we would be needing to get used to developing for a 1.3 JRE which doesn't include a lot of the things most developers expect out of Java like Generics, enums, etc...

Here is a list of topics that were discussed in the meeting which spanned about 90 minutes.

  • sdk zip file
  • vnc into machine remotely (one at a time)
  • ftp application files directly onto the printer
  • talked about double bookings
  • discussed what happens when you get out of a meeting early (what if a meeting gets cancelled), still concerned about what will happen if you get out of a meeting early, how will it know what to display.
  • Action Script (Flash) to program the UI and Java for nonUI components however only have a 1.3 jre to work with so no generics, enums, etc.
  • Shaun Love wants for us to take a tour of the facility and meet developers in the near future and take us out to dinner.
  • Skype
  • Schedule weekly skype meeting time with shaun
  • Still need better grasp of what the lexmark design guidelines are
  • OAuth authentication
  • OSGi bundles ???
  • Show Agenda 
  • Print out Agenda for rest of day
  • Print a map of meeting location
  • User is able to configure the number of minutes til meeting that shows yellow, green, and red.