Hack73.Use CENTRAFUSE as Your Car PC Frontend


Hack 73. Use CENTRAFUSE as Your Car PC Frontend

CENTRAFUSE integrates media playback, navigation, and hands-free mobile phone control in a clean, sharp-looking interface.

When I first installed a computer in my car, there wasn't any software available that did exactly what I needed it to do. That's when I decided to write CENTRAFUSE. What originally started out as a small project quickly grew into a large one. My main focus was to build a touchscreen-friendly music player, but it became much more than that. Just like any other car PC owner, I soon wanted navigation, video playback, and radio control capabilities, and I wanted it all integrated into one applicationand hence, CENTRAFUSE expanded into what it is today (see Figure 7-14). This hack will tell you a bit about how CETRAFUSE works and the features it offers.

7.6.1. Installing CENTRAFUSE

To get started, visit http://www.fluxmedia.net and download the latest version of CENTRAFUSE. While visiting the site, it is also a good idea to download the latest user manual. If you plan on using any third-party applications (such as PhoneControl.NET [Hack #63] for phone integration or Radiator [Hack #19] for hardware radio control), I recommend that you install and set up these applications before running CENTRAFUSE. This will simplify the configuration process, because you will already know the locations of your external applications. If you plan on using GPS, you should install your GPS software and verify that it is functional before attempting to embed it within CENTRAFUSE.

Figure 7-14. The CENTRAFUSE music manager


Once you've downloaded CENTRAFUSE and installed any helper applications you intend to use, simply run the setup and follow the onscreen instructions. When the installation is complete, click the CENTRAFUSE icon to launch the program, and the configuration will start automatically.

7.6.2. Integrating External Programs

You can integrate external programs into CENTRAFUSE by embedding them. One of the problems with Windows for car PC use is that you don't want or need Windows Explorer (the Windows GUI, not the web browser). And when you run other applications, you don't want to have to switch to them using the Alt-Tab or a mouseyou want them all to look and function like one integrated application.

To embed any external application into CENTRAFUSE, you'll need two important pieces of information:

  • The name or "title" of the external application, as listed within the application's title bar

  • The location of the executable file you wish to embed

Using GPS as an example, here is how you can embed a program in CENTRAFUSE. First, visit the CENTRAFUSE support forums at http://forums.fluxmedia.net, and navigate to the Installation subforum to view a list of commonly used GPS window titles. This list includes only verified and tested applications and is updated as new information and software become available. If your GPS program is not listed, don't worry; you can determine this information on your own. To do so, run your application and write down the exact title listed within the main title bar across the top of the program window. Once you have this information, open the CENTRAFUSE configuration utility and enable GPS support. Next, key in the correct location of the executable file for your GPS program, and enter its window title in the "GPS window name" field.

When you click the GPS button in CENTRAFUSE, it will now launch your selected GPS program and embed it within the main window (see Figure 7-15). Once the GPS window is loaded, you can toggle to a full-screen mode by clicking the song title display across the top of the window (which happens to be one of my favorite featuresbeing able to use your GPS software and still have easy access to your music controls is awesome!).

Figure 7-15. An embedded GPS application


For the curious programmers amongst you, I first get the GPS application's window handle by using FindWindow ( user32.dll), and then I used SetWindowLong ( user32.dll) to attach it to a .NET panel. I designed it this way so a user can plug in any GPS application. Also, through the use of Set- WindowLong, I am able to remove the border and client edge. When I first saw how good it looked, I couldn't believe it.


7.6.3. Changing CENTRAFUSE's Appearance

CENTRAFUSE is completely customizable and skinnable, which means anyone can customize its appearance. I added skin support because I love being able to easily change the look and feel of the application. Creating custom skins is not difficult. Open the installation folder where you installed CENTRAFUSE, and locate the skins folder. Here you will find a folder for each skin included with CENTRAFUSE. Each skin folder consists of many images that represent different states of the skin. All the buttons and icons are stored in JPEG files, and the action for each button is defined by a hot spot, a user-defined zone that is specified in the skin.xml file. Hot spots are rectangular areas defined by specifying the location of the top-left corner and then providing a width and a height. The ability to edit the skin files gives you control over almost all aspects of the application's look and feel, including text, fonts, and sizes. So if you decide you want to change a font size or don't like the way a font looks, don't worryyou can customize this in the skin file.

7.6.4. Setting Up the Radio

To use the radio mode within CENTRAFUSE, you need to install an application called Radiator (http://www.flesko.cz). (I also have links to the latest version of Radiator on the CENTRAFUSE support forums.) After installing Radiator, you should verify that it works with your current hardware setup. Then you need to enter the CENTRAFUSE setup utility, enable radio support, and provide the location to the Radiator executable file ( rc.exe). Now, through the use of the Radiator external application, CENTRAUFSE will have full control over your radio hardware.

7.6.5. Adding Support for New Audio and Video Formats

CENTRAFUSE supports any audio or video format your system supports. The audio and video file formats are determined by a list of file extensions within the config.xml file, which is located in your CENTRAFUSE system directory. By default, CENTRAFUSE supports all the most common audio and video extensions. However, if you install any extra codecs, you will need to edit the config.xml file to instruct CENTRAFUSE to support these new file types. The following code is a segment from the config.xml file, which shows the default list of supported audio and video file types:

<APPCONFIG>
<MUSICEXT>wav|mpa|mp2|mp3|au|aif|aiff|snd|wma</MUSICEXT>
<VIDEOEXT>avi|qt|mov|mpg|mpeg|m1v|wmv|bin</VIDEOEXT>

If your system supports any other audio or video extensions, you can add support for these file types by adding the new extensions to the end of the MUSICEXT or VIDEOEXT nodes. Just be sure to use the same format shown in this configuration segment.

7.6.6. Adding Phone Support

Phone support is enabled through PhoneControl.NET (http://www.phonecontrol.net). CENTRAFUSE is designed to communicate directly with the PhoneControl.NET application, but before starting down this path, I recommend that you first visit http://www.phoco.net and see if your phone is supported. If it is (or after you've purchased a supported phone), download and install PhoneControl.NET. Once PhoneControl.NET is up and running [Hack #63], start CENTRAFUSE, enter the setup, enable support for the application, and specify the correct location to its executable file. The next time you start CENTRAFUSE, if your phone support is working properly, you will see a battery and signal meter in the top-right corner (visible in Figure 7-15). This icon indicates that CENTRAFUSE recognizes your phone, and you can now use the phone modes and screens to make calls and send SMS messages. If you place or receive a call while music is playing, CENTRAFUSE will automatically pause the music until your call is finished.

7.6.7. Getting Online in Your Car

CENTRAFUSE can be configured to access the Internet via your mobile phone [Hack #62], so you can surf the Web, look up weather data, and check traffic updates from your car PC. Once you are able to establish an Internet connection with your phone, you can configure your computer to use this connection as the default Internet connection under Tools Internet Options Connections. Enabling this feature gives CENTRAFUSE control over your Internet connectivity. Touching the Internet status bar in the top-right corner of the CENTRAFUSE display will cause it to dial and connect via the default Windows Internet connection; touch it again to disconnect.

I implemented these features using wininet.dll and its methods. Your Internet connectivity status can be accessed using InternetGetconnectedState. InternetAutodial and InternetAutodialHangup provide easy methods for connecting and disconnecting via the default Internet connection. If the Internet status bar is clicked while disconnected, CENTRAFUSE will use InternetAutodial to dial the default Internet connection. If clicked while connected, it will use InternetAutodialHangup to disconnect.


Once an Internet connection is established, you can use the embedded web browser to access weather and traffic reports and surf the Web (seeFigure 7-16). However, before you begin surfing via your cell phone, make sure you contact your wireless phone provider about a data (i.e., flat-fee) plan so that you can avoid costly chargesby default, most providers charge for data by the byte.

Figure 7-16. The embedded CENTRAFUSE web browser


7.6.8. Changing the Voice Commands

CENTRAFUSE comes with voice-activated control. To enable this feature you must install Microsoft's SAPI SDK [Hack #60], which can be found under "Downloads" at http://www.fluxmedia.net. Once you've downloaded and installed SAPI, you will need to enter the CENTRAFUSE setup utility and enable the voice control option. The voice commands used for CENTRAFUSE are fully customizable via the grammar.xml file located in the CENTRAFUSE system folder. The voice keyword used to tell CENTRAFUSE you are going to give it a voice command is located under the CID_Navigation nodethe default value is computer. All voice commands are located under the CID_MAIN node. When performing edits to the grammar.xml file, do not make any changes to the XML tags, other than altering the voice commands. Editing any values other than the actual voice commands might disable voice support. Here's a sample grammar.xml file:

 <GRAMMAR LANG> <DEFINE> <ID NAME="CID_MAIN" VAL="1" /> <ID NAME="CID_MUSIC" VAL="2" /> <ID NAME="CID_RADIO" VAL="3" /> <ID NAME="CID_GPS" VAL="4" /> <ID NAME="CID_VIDEO" VAL="5" /> <ID NAME="CID_DVD" VAL="6" /> <ID NAME="CID_TOOLS" VAL="7" /> <ID NAME="CID_PHONE" VAL="8" /> <ID NAME="CID_TRAFFIC" VAL="9" /> <ID NAME="CID_Navigation" VAL="254" />  </DEFINE> <RULE  TOPLEVEL="ACTIVE"> <P>  <L>  <P>computer</P>   </L> </P> <RULEREF REF />   </RULE>  <RULE > <L PROP> <P VAL="CID_MUSIC">music</P> <P VAL="CID_RADIO">radio</P> <P VAL="CID_GPS">gps</P> <P VAL="CID_VIDEO">video</P> <P VAL="CID_DVD">dvd</P> <P VAL="CID_TOOLS">tools</P> <P VAL="CID_PHONE">phone</P> <P VAL="CID_TRAFFIC">traffic</P>   </L>  </RULE>  </GRAMMAR> 

7.6.9. Video Poster Images

Video poster images, which allow you to associate images with your video files, are supported in the Video Manager. This seems like a small thing, but it really improves the appearance of the video selection screen. CENTRAFUSE will read poster images for individual video files and for entire folders. For video files, you simply make a .jpg with the same name as the video file, and place it in the same directory as the video file. For example, if your movie is called Incredibles2.avi, your poster should be called Incredibles2.jpg. To make a generic graphic for everything in a folder, just create an image called folder.jpg inside that folder. These poster images are shown as you browse through your videos in the Video Manager.

7.6.10. Future Improvements

There are still a lot of things left for me to finish. Currently, I am working with some OBD-II readers [Hack #69] trying to implement cool analog gauges and sensors for the speedometer, tachometer, and so on. I also plan on diving into some XM and Sirius integration, which I have really been looking forward to. The plug-in system I am working on will allow other programmers to use my CENTRAFUSE SDK to easily integrate their own applications with mine, which will hopefully help add lots of support. I have had a great time writing this program, and I hope you enjoy using it.

David McGowan



    Car PC Hacks
    Car PC Hacks
    ISBN: 0596008716
    EAN: 2147483647
    Year: 2005
    Pages: 131

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net