Data Structures | |
| struct | HPI_RDS_GROUP |
| Raw RDS data. More... | |
Typedefs | |
| typedef HPI_RDS_DATA * | HPI_RDS_HANDLE |
| RDS data structure. Handle to an RDS data structure. | |
| typedef char * | HPI_RDS_STRING |
| Pointer to a string. | |
Enumerations | |
| enum | eHPI_RDS_errors { HPI_RDS_ERROR_NOERROR = 0, HPI_RDS_ERROR_UNKNOWN_GROUP = 1, HPI_RDS_ERROR_INVALID_DATASIZE = 2, HPI_RDS_ERROR_BLOCK_DATA = 3, HPI_RDS_ERROR_HANDLE = 4 } |
| Error codes returned from HPI_RDS_AnalyzeGroup(). More... | |
Functions | |
| HPI_RDS_HANDLE HPI_API | HPI_RDS_Create (enum eHPI_RDS_type eType) |
| Create an HPIRDS instance. | |
| void HPI_API | HPI_RDS_Delete (HPI_RDS_HANDLE h) |
| Delete an HPIRDS instance. | |
| void HPI_API | HPI_RDS_Clear (HPI_RDS_HANDLE h) |
| Clears internal HPIRDS data structures. | |
| enum eHPI_RDS_errors HPI_API | HPI_RDS_AnalyzeGroup (HPI_RDS_HANDLE h, const char *pData, const unsigned int nDataSize) |
| Analyze a block of RDS data. | |
| enum eHPI_RDS_errors HPI_API | HPI_RDS_Get_BlockErrorCounts (HPI_RDS_HANDLE h, unsigned int *uBlock0, unsigned int *uBlock1, unsigned int *uBlock2, unsigned int *uBlock3) |
| Get error counts per block. | |
| unsigned int HPI_API | HPI_RDS_Get_GroupType (HPI_RDS_HANDLE h) |
| Get the group type. | |
| char HPI_API | HPI_RDS_Get_GroupVersion (HPI_RDS_HANDLE h) |
| Get the group verion. | |
| unsigned int HPI_API | HPI_RDS_Get_PS_Ready (HPI_RDS_HANDLE h) |
| Get PS (program service) name ready flag. | |
| HPI_RDS_STRING HPI_API | HPI_RDS_Get_PS (HPI_RDS_HANDLE h) |
| Get PS (program service) name. | |
| void HPI_API | HPI_RDS_Set_RT_Threshold (HPI_RDS_HANDLE h, unsigned int nCount) |
| Sets the RT (Radio Test) good character threshold. | |
| unsigned int HPI_API | HPI_RDS_Get_RT_Ready (HPI_RDS_HANDLE h) |
| Get RT (Radio Text) ready flag. | |
| HPI_RDS_STRING HPI_API | HPI_RDS_Get_RT (HPI_RDS_HANDLE h) |
| Get RT (Radio Text). | |
| unsigned short HPI_API | HPI_RDS_Get_PI (HPI_RDS_HANDLE h) |
| Get PI (Program Identification). | |
| unsigned char HPI_API | HPI_RDS_Get_PTY (HPI_RDS_HANDLE h) |
| Get PTY (Program Type). | |
| HPI_RDS_STRING HPI_API | HPI_RDS_Get_PTY_Translate (enum eHPI_RDS_type eType, unsigned int uPTY) |
| Get PTY (Program Type) text given PTY number and data type. | |
| HPI_RDS_STRING HPI_API | HPI_RDS_Get_PTY_Text (HPI_RDS_HANDLE h) |
| Get PTY string. | |
| unsigned int HPI_API | HPI_RDS_Get_TP (HPI_RDS_HANDLE h) |
| Get TP (Traffic Program). | |
The user does not have to do anything at all with the raw RDS data except to pass it from the tuner to the analyzer. New RDS data is output at a rate of one data block every 87 ms. The AudioScience ASI8920 has on-board buffering that can hold up to 2 seconds of RDS data per tuner.
The recommended practice is for an application to poll each tuner every second and extract and analyze all the RDS data in the data buffer.
The following steps should be performed to analyze RDS data.
Below is a code snippet to create an HPIRDS object.
The following code shows how to call the analyze function and then shows how to query various RDS fields.
enum eHPI_RDS_errors eRDSerror; int nGroupType; char cGroupVersion; char *szPS; char *szRT; char *szPTY; unsigned short nPI,nPTY; char rds[12]; HW16 wHE=0; while(1) // run the following loop until all data has been read { // Use HPI Tuner call to fill in rds structure with valid bits from the tuner. wHE = HPI_Tuner_GetRDS(hSubSys, hTunerControl, rds); if(wHE) break; // break out of the loop if there is no data available // Call analyze function to analyze the RDS bits. eRDSerror = HPI_RDS_AnalyzeGroup(h, rds, sizeof(rds)); if(eRDSerror!=HPI_RDS_ERROR_NOERROR) printf("HPIRDS error #%d\n",(int)eRDSerror); // Retrieve current RDS settings. nGroupType = HPI_RDS_Get_GroupType(h); cGroupVersion = HPI_RDS_Get_GroupVersion(h); szPS = HPI_RDS_Get_PS(h); // use if(HPI_RDS_Get_PS_Ready()) first to only get the latest change. szRT = HPI_RDS_Get_RT(h); // use if(HPI_RDS_Get_RT_Ready()) first to only get the latest change. nPI = HPI_RDS_Get_PI(h); nPTY = HPI_RDS_Get_PTY(h); szPTY = HPI_RDS_Get_PTY_Text(h); }
The impact of RDS errors depends on the type of group in which the error occurs. An error in a group of type 0A will have no affect whatsoever. However an error in a 2A group containing 4 characters of a Radio Text array could result in 4 characters in the text showing up as spaces. ie blank text looking like " " could appear in the middle of a text string.
Note that we have concatinated the number (0-15) and the type (A or B) together in the list below.
Group | Description |
| 0A | Basic tuning and switching information |
| 0B | Basic tuning and switching information |
| 2A | Radio text |
|
|
RDS data structure. Handle to an RDS data structure.
|
|
|
Pointer to a string.
|
|
|
Error codes returned from HPI_RDS_AnalyzeGroup().
|
|
|
Create an HPIRDS instance. One of these should be created per tuner in the system.
|
|
|
Delete an HPIRDS instance.
|
|
|
Clears internal HPIRDS data structures. Applications should call this after changing the tuner frequency.
|
|
||||||||||||||||
|
Analyze a block of RDS data. This function should be called with a group of RDS data. Here a group refers to an array of 4 16-bit unsigned shorts that contain a complete Group of RDS bits. This function analyzes the passed in data and fills in various internal fields that can then be extracted with calls to HPI_RDS_Get_xxxx() functions.
|
|
||||||||||||||||||||||||
|
Get error counts per block. This function should be called if HPI_RDS_AnalyzeGroup() returns HPI_RDS_ERROR_BLOCK_DATA and the client wants to konw exactly which of the 4 RDS blocks contained un-correctable errors. It can also be called anytime after a call HPI_RDS_AnalyzeGroup() to monitor error counts.
|
|
|
Get the group type. The group type is a number between 0 and 15 and indicates the type of information that the last group processed contains.
|
|
|
Get the group verion.
|
|
|
Get PS (program service) name ready flag. This is set to 1 when new PS string data is available. Reading the PS string using HPI_RDS_Get_PS() resets this flag.
|
|
|
Get PS (program service) name. This is the name of the station and can be up to 8 characters long. Calling this function resets the PS_Ready flag.
|
|
||||||||||||
|
Sets the RT (Radio Test) good character threshold. Sometimes "bad" characters can end up in the RT string buffer. This variable defines how many times each each character in the buffer should be received before the RT buffer is considered good. An independant count is maintained for each character in the buffer. The count reset to one each time a change in character is detected.
|
|
|
Get RT (Radio Text) ready flag. This is set to 1 when new RT string data is available. Reading the RT string using HPI_RDS_Get_RT() resets this flag.
|
|
|
Get RT (Radio Text). This is typically the title of the playing song and can be up to 64 characters long. Calling this function resets the RT_Ready flag.
|
|
|
Get PI (Program Identification). PI is a two byte number which identifies the country, coverage area and service. It is not normally intended for display. A change in PI code causes the initialisation of all RDS data as it indicates that the radio has been retuned. This application also facilitates the display of the current PI code.
|
|
|
Get PTY (Program Type). PTY is a 5-bit number which indicates the current program type. Examples include "no programme type", "Current affairs" and "Pop music". See below table.
|
|
||||||||||||
|
Get PTY (Program Type) text given PTY number and data type.
|
|
|
Get PTY string. Tranlsates the Program Type code returned by HPI_RDS_Get_PTY() into a string.
|
|
|
Get TP (Traffic Program). The traffic program code indicates that the station will broadcast traffic announcements from time to time.
|
1.4.6-NO