Показать сообщение отдельно
Старый 15.08.2007, 01:22   #15
Призрак
Пользователь
 
Регистрация: 09.03.2007
Возраст: 39
Город: Москва
Регион: 77, 97, 99, 177
Машина: VW passat 2000г, accord 2008
Сообщений: 25
Призрак is on a distinguished road
По умолчанию откопал статейку

вот пока рылся откопал статейку по радио командам...
пока есть время буду пробовать ее применить для раскорячивангия встроенного радио в CF..

Цитата:
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.
__________________
В5 2000г 1.8т низколетящий немецкий истребитель...продан...infill G4 продан...
honda accord 8.. продан...
Мазда3 2006 HB Touring+люк - black bird
будем строить новый проект.. pc
Призрак вне форума   Ответить с цитированием