Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development


Reply
 
Share Thread Tools Display Modes
Old 07-25-2007, 09:57 PM   #1
Newbie
 
Join Date: Apr 2007
Posts: 7
devers6 is an unknown quantity at this point
How to Access Radio on Infill G4

I have been working to figure out how to control the Radio and other functions of the Infill G4. I bought my G4 from MP3Car because I liked the idea of having a platform that was completely under my control. Although it came with Streetdeck, I found the software to be overkill for my needs. I think SD is a great frontend, I just wanted something else. I emailed Maxan/Infill for info on an SDK, but got no response (as have others I have noticed). Streetdeck declined to give me the information, so I was forced to find it on my own. With the help of a lucky find of an app called SampleApp.exe on the G4, I was able to hack it out.

The following is in VB6 as that is what I do fastest, but it should convert fairly readily to other languages.

The relevant dll on the G4 is InfillG4Cmd.dll. It is in the C:\Program Files\Streetdeck directory on a factory install, and likely findable on an InfillStation machine.

The VB declares work out as follows:

Private Declare Function OpenInfill Lib "InfillG4Cmd.dll" Alias "_mxn_OpenINFILL@0" () As Long
Private Declare Function CloseInfill Lib "InfillG4Cmd.dll" Alias "_mxn_CloseINFILL@0" () As Long
Private Declare Function OpenRadio Lib "InfillG4Cmd.dll" Alias "_mxn_OpenRadio@0" () As Long
Private Declare Function CloseRadio Lib "InfillG4Cmd.dll" Alias "_mxn_CloseRadio@0" () As Long
Private Declare Function IsOpenRadio Lib "InfillG4Cmd.dll" Alias "_mxn_IsOpenRadio@0" () As Long
Private Declare Function IsOpenInfill Lib "InfillG4Cmd.dll" Alias "_mxn_IsOpenINFILL@0" () As Long
Private Declare Function GetFMStereoState Lib "InfillG4Cmd.dll" Alias "_mxn_GetFMStereoState@0" () As Long
Private Declare Function GetChannelDetectState Lib "InfillG4Cmd.dll" Alias "_mxn_GetChannelDetectState@4" (ByVal Param As Long) As Long
Private Declare Function SetChannelRadio Lib "InfillG4Cmd.dll" Alias "_mxn_SetChannelRadio@8" (ByVal Param1 As Long, ByVal Param2 As Long) As Long
Private Declare Function SetMonitorBrightness Lib "InfillG4Cmd.dll" Alias "_mxn_SetMonitorBrightness@8" (ByVal Param1 As Long, ByVal Param2 As Long) As Long
Private Declare Function TiltDown Lib "InfillG4Cmd.dll" Alias "_mxn_TiltDown@4" (ByVal Param As Long) As Long
Private Declare Function TiltUp Lib "InfillG4Cmd.dll" Alias "_mxn_TiltUp@4" (ByVal Param As Long) As Long

These are functions that I have been able to call with success. There are a few more functions that are exported in the dll, but I have not been able to get them to work as of yet (in fact, they crash the app when called); but I didn't need them so I haven't pursued them. GetFWVersion retrieves the version number of the firmware, but it takes a parameter and crashes when the parameter is 0. I don't know why it should take a parameter to get the FW version. GetDeviceStatus appears to be a way to read status information from the Reverse wire, the Illumination wire, and the Fan. GetMonitorBrightness looks to return the current values of the Day and Night brightness settings.

Private Declare Function GetDeviceStatus Lib "InfillG4Cmd.dll" Alias "_mxn_GetDevStatus@4" (ByVal Param As Long) As Long
Private Declare Function GetFWVersion Lib "InfillG4Cmd.dll" Alias "_mxn_GetFwVersion@4" (ByVal Param As Long) As Long
Private Declare Function GetMonitorBrightness Lib "InfillG4Cmd.dll" Alias "_mxn_GetMonitorBrightness@4" (ByVal Param As Long) As Long

Anyway, the typical calling procedure would be:

OpenInfill()

which will initialize control. A return value of 0 represents success, any other value indicates a problem. CloseInfill() shuts things down and should be the last function called when terminating your app. You can call IsOpenInfill() to see the current state; I found that the following values were returned:

268439808 (10001100H) when NOT Open
268439809 (10001101H) when Open

After calling OpenInfill(), call OpenRadio(). A return value of 0 indicates success. IsOpenRadio() returns the following:

268440320 (10001300H) when Radio is NOT Open
268440321 (10001301H) when Radio is Open

The next function to call is SetChannelRadio(Band, Frequency). Both parameters are Longs. Band sets whether the channel is on AM or FM, and is represented as:

0 = FM
1 = AM

Frequency is sent as the KHz frequency (550 to 1600) for AM, and the MHz frequency (8800 to 10800) for FM. For example, 810 on AM would tune 810 KHz, and 9350 for FM would tune 93.5 MHz.

GetFMStereoState() returns 1 if the radio is currently tuned to a stereo station, and 0 if not. Use it to light up a Stereo indicator if you want.

GetChannelDetectState(Param) would be used to implement Seek and Scan functions. I don't know why it should take a parameter (maybe different for AM and FM; I tried it using 0 and it seemed to work for FM stations. Maybe you need a 1 to check for a valid AM station?). It returns 1 when a valid station is tuned, and 0 if not. Seek would be implemented by looping a tune command through the valid frequencies, checking GetChannelDetectState() after each and stopping when a good station was found. Scan would do the same, pausing for some period between detected station before continuing.

The other functions that might be handy are the TiltUp() and TiltDown() commands which tilt the screen by some small increment. They also take a parameter for some reason; I used 0 and it worked OK.

SetMonitorBrightness(Night, Day) takes two parameters for Day and Night values. The values must be between 1 and 7 for each, with the higher numbers being brighter.

I hope this information proves to be of use to others who, like me, want to write their own front-end (or add support in other apps) for the G4.

Last edited by devers6; 07-28-2007 at 08:00 PM. Reason: change misprint in IsOpenRadio return val
devers6 is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 07-26-2007, 01:39 AM   #2
Constant Bitrate
 
Join Date: Apr 2007
Location: Moscow, Russia
Posts: 125
Marassa is an unknown quantity at this point
devers6, could you please check what exactly dlls (with versions and sizes) are loaded when you call those functions on your system?

We have already figured out what you have but the problem is that calling those functions seems to have no effect on a non-MP3Car-supplied G4. And the radio does not work in StreetDeck neither. Radio in InfillStation works ok, but InfillStation does not include nor use this dll.
Marassa is offline   Reply With Quote
Old 07-28-2007, 12:30 AM   #3
Low Bitrate
 
Join Date: Apr 2007
Location: San Dimas, Cali
Posts: 76
IandI is an unknown quantity at this point
Nice work! Please post any more G4 info you find. It is greatly appreciated.
IandI is offline   Reply With Quote
Old 09-28-2007, 11:38 PM   #4
Newbie
 
ojindia's Avatar
 
Join Date: May 2007
Location: Syria
Posts: 21
ojindia is an unknown quantity at this point
you are amazing!!! That's what I'm looking for.
ojindia is offline   Reply With Quote
Old 10-09-2007, 09:45 PM   #5
Newbie
 
ojindia's Avatar
 
Join Date: May 2007
Location: Syria
Posts: 21
ojindia is an unknown quantity at this point
Change Long to Integer in the code to work in VB.NET
ojindia is offline   Reply With Quote
Old 10-14-2007, 12:52 PM   #6
Newbie
 
ojindia's Avatar
 
Join Date: May 2007
Location: Syria
Posts: 21
ojindia is an unknown quantity at this point
Private Declare Function OpenInfill Lib "InfillG4Cmd.dll" Alias "_mxn_OpenINFILL@0" () As Integer
Private Declare Function CloseInfill Lib "InfillG4Cmd.dll" Alias "_mxn_CloseINFILL@0" () As Integer
Private Declare Function OpenRadio Lib "InfillG4Cmd.dll" Alias "_mxn_OpenRadio@0" () As Integer
Private Declare Function CloseRadio Lib "InfillG4Cmd.dll" Alias "_mxn_CloseRadio@0" () As Integer
Private Declare Function IsOpenRadio Lib "InfillG4Cmd.dll" Alias "_mxn_IsOpenRadio@0" () As Integer
Private Declare Function IsOpenInfill Lib "InfillG4Cmd.dll" Alias "_mxn_IsOpenINFILL@0" () As Integer
Private Declare Function GetFMStereoState Lib "InfillG4Cmd.dll" Alias "_mxn_GetFMStereoState@0" () As Integer
Private Declare Function GetChannelDetectState Lib "InfillG4Cmd.dll" Alias "_mxn_GetChannelDetectState@4" (ByVal Param As Integer) As Integer
Private Declare Function SetChannelRadio Lib "InfillG4Cmd.dll" Alias "_mxn_SetChannelRadio@8" (ByVal Param1 As Integer, ByVal Param2 As Integer) As Integer
Private Declare Function SetMonitorBrightness Lib "InfillG4Cmd.dll" Alias "_mxn_SetMonitorBrightness@8" (ByVal Param1 As Integer, ByVal Param2 As Integer) As Integer
Private Declare Function TiltDown Lib "InfillG4Cmd.dll" Alias "_mxn_TiltDown@4" (ByVal Param As Integer) As Integer
Private Declare Function TiltUp Lib "InfillG4Cmd.dll" Alias "_mxn_TiltUp@4" (ByVal Param As Integer) As Integer
Private Declare Function GetDeviceStatus Lib "InfillG4Cmd.dll" Alias "_mxn_GetDevStatus@4" (ByVal Param As Integer) As Integer
Private Declare Function GetFWVersion Lib "InfillG4Cmd.dll" Alias "_mxn_GetFwVersion@4" (ByVal Param As Integer) As Integer
Private Declare Function GetMonitorBrightness Lib "InfillG4Cmd.dll" Alias "_mxn_GetMonitorBrightness@4" (ByVal Param As Integer) As Integer
ojindia is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
INFILL G4 - Australian and New Zealand Questions Answered INFILLG4 General MP3Car Discussion 20 04-30-2008 12:21 AM
CF 1.2 on Infill G4 SUNAJ Centrafuse 10 08-21-2007 07:38 AM
Infill has AM/FM radio, why can't we? birdie Hardware Development 4 07-19-2007 09:15 AM
Indexing music in 1.0.9.8 Failed hovalistic StreetDeck 0 07-07-2007 12:19 PM
Infill G4 Price Cheekz185 Off Topic 0 03-24-2007 01:23 PM



All times are GMT -5. The time now is 07:44 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.2
Copyright © 1999 - 2008 Mp3Car.com Inc.Ad Management by RedTyger
Message Board Statistics