Results 1 to 6 of 6

Thread: How to Access Radio on Infill G4

  1. #1
    Newbie
    Join Date
    Apr 2007
    Posts
    7

    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.

  2. #2
    Constant Bitrate
    Join Date
    Apr 2007
    Location
    Moscow, Russia
    Posts
    125
    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.

  3. #3
    Low Bitrate
    Join Date
    Apr 2007
    Location
    San Dimas, Cali
    Posts
    76
    Nice work! Please post any more G4 info you find. It is greatly appreciated.

  4. #4
    Newbie ojindia's Avatar
    Join Date
    May 2007
    Location
    Syria
    Posts
    21
    you are amazing!!! That's what I'm looking for.

  5. #5
    Newbie ojindia's Avatar
    Join Date
    May 2007
    Location
    Syria
    Posts
    21
    Change Long to Integer in the code to work in VB.NET

  6. #6
    Newbie ojindia's Avatar
    Join Date
    May 2007
    Location
    Syria
    Posts
    21
    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

Similar Threads

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •