RITest
The RITest is a demo application that shows all functionalities the remote interface offers. It is shipped as a binary package and also in complete source code. It's primary feature is to show how to connect to a given PTV Navigator and how to send and receive messages to process certain tasks in the PTV Navigator.
Layout structure of the demo program
The RiTest is build up on so called fragments to get a clear layout on tablets and smartphones. A fragment is a sort of view which is shown differently on tablets and smartphones. On smartphones, a fragment behaves like a normal activity which comes in front then it is called. On a tablet, it is shown additionally to the calling activity. The layout on a smartphone is like this:
The main screen of the application is a listview showing the different categories of commands. Clicking on an entry will show the appropriate fragment. Each fragment has a set of functions which can be called, and an output window where status information or results from a message call will be posted:
This is the stations fragment, where you can do things like adding and deleting stations or start a navigation.
Code structure of the demo program
The BaseActivity is the place where the communication with the PTV Navigator will be set up. All binding relative code is in this activity, only the handlers for incoming messages and the resulting client messenger will be created outside in the appropriate fragment. The ItemListActivity inherits from BaseActivity and is the main activity in the app. When an entry in the listview was clicked, it will show the appropriate fragment. Showing a fragment is different on tablets and smartphones. On tablets, the fragment view is shown side by side to the listview, on smartphones, a new activity with the content of the fragment will be created and the app switches to this activity. Each of the fragments implement a handler to manage incoming messages, and has several test functionality for communicating with the PTV Navigator. Every fragment has also a text output window to show status messages, error codes and data received from the PTV Navigator.
The BaseActivity is a good point to start learning how a connection can be set up. The fragments itself gives code examples for implementing a handler that is needed for receiving messages from the PTV Navigator. Also, there are code samples for almost every message the PTV Navigator accepts.