libnrsc5 5032de3
NRSC-5 digital radio via the RTL-SDR
|
#include <nrsc5.h>
Data Fields | ||
unsigned int | event | |
union { | ||
struct { | ||
const void * data | ||
size_t count | ||
} iq | ||
struct { | ||
float freq_offset | ||
int psmi | ||
} sync | ||
struct { | ||
float cber | ||
} ber | ||
struct { | ||
float lower | ||
float upper | ||
} mer | ||
struct { | ||
unsigned int program | ||
const uint8_t * data | ||
size_t count | ||
} hdc | ||
struct { | ||
unsigned int program | ||
const int16_t * data | ||
size_t count | ||
} audio | ||
struct { | ||
unsigned int program | ||
const char * title | ||
const char * artist | ||
const char * album | ||
const char * genre | ||
struct { | ||
const char * owner | ||
const char * id | ||
} ufid | ||
struct { | ||
uint32_t mime | ||
int param | ||
int lot | ||
} xhdr | ||
nrsc5_id3_comment_t * comments | ||
} id3 | ||
struct { | ||
uint16_t port | ||
uint16_t seq | ||
unsigned int size | ||
uint32_t mime | ||
const uint8_t * data | ||
nrsc5_sig_service_t * service | ||
nrsc5_sig_component_t * component | ||
} stream | ||
struct { | ||
uint16_t port | ||
uint16_t seq | ||
unsigned int size | ||
uint32_t mime | ||
const uint8_t * data | ||
nrsc5_sig_service_t * service | ||
nrsc5_sig_component_t * component | ||
} packet | ||
struct { | ||
uint16_t port | ||
unsigned int lot | ||
unsigned int size | ||
uint32_t mime | ||
const char * name | ||
const uint8_t * data | ||
struct tm * expiry_utc | ||
nrsc5_sig_service_t * service | ||
nrsc5_sig_component_t * component | ||
} lot | ||
struct { | ||
unsigned int lot | ||
unsigned int seq | ||
unsigned int repeat | ||
unsigned int size | ||
unsigned int bytes_so_far | ||
int is_duplicate | ||
const uint8_t * data | ||
nrsc5_sig_service_t * service | ||
nrsc5_sig_component_t * component | ||
} lot_fragment | ||
struct { | ||
unsigned int program | ||
unsigned int access | ||
unsigned int type | ||
unsigned int codec_mode | ||
unsigned int blend_control | ||
int digital_audio_gain | ||
unsigned int common_delay | ||
unsigned int latency | ||
} audio_service | ||
struct { | ||
nrsc5_sig_service_t * services | ||
} sig | ||
struct { | ||
const char * country_code | ||
int fcc_facility_id | ||
const char * name | ||
const char * slogan | ||
const char * message | ||
const char * alert | ||
float latitude | ||
float longitude | ||
int altitude | ||
nrsc5_sis_asd_t * audio_services | ||
nrsc5_sis_dsd_t * data_services | ||
const uint8_t * alert_cnt | ||
int alert_cnt_length | ||
int alert_category1 | ||
int alert_category2 | ||
int alert_location_format | ||
int alert_num_locations | ||
const int * alert_locations | ||
} sis | ||
struct { | ||
const char * country_code | ||
int fcc_facility_id | ||
} station_id | ||
struct { | ||
const char * name | ||
} station_name | ||
struct { | ||
const char * slogan | ||
} station_slogan | ||
struct { | ||
const char * message | ||
} station_message | ||
struct { | ||
float latitude | ||
float longitude | ||
int altitude | ||
} station_location | ||
struct { | ||
unsigned int program | ||
unsigned int access | ||
unsigned int type | ||
unsigned int sound_exp | ||
} asd | ||
struct { | ||
unsigned int access | ||
unsigned int type | ||
uint32_t mime_type | ||
} dsd | ||
struct { | ||
const char * message | ||
const uint8_t * control_data | ||
int control_data_length | ||
int category1 | ||
int category2 | ||
int location_format | ||
int num_locations | ||
const int * locations | ||
} emergency_alert | ||
struct { | ||
int image_type | ||
int seq | ||
int n1 | ||
int n2 | ||
struct tm * time_utc | ||
float latitude1 | ||
float longitude1 | ||
float latitude2 | ||
float longitude2 | ||
const char * name | ||
unsigned int size | ||
const uint8_t * data | ||
} here_image | ||
}; | ||
Incoming event from receiver.
This event structure is passed to your application supplied callback function–see nrsc5_set_callback(). It is a union of various structs, keyed by member event
.
unsigned int nrsc5_event_t::access |
NRSC5_ACCESS_PUBLIC or NRSC5_ACCESS_RESTRICTED
unsigned int nrsc5_event_t::blend_control |
blend control (NRSC5_BLEND_DISABLE, NRSC5_BLEND_SELECT, or NRSC5_BLEND_ENABLE). See SY_IDD_1017s section 5.2.1.2.
unsigned int nrsc5_event_t::bytes_so_far |
total number of bytes received for this LOT file, across all received fragments
unsigned int nrsc5_event_t::codec_mode |
audio codec mode. See SY_IDD_1017s Table 5-2.
unsigned int nrsc5_event_t::common_delay |
post-decoded common delay, in audio frame periods. See SY_IDD_1017s Table 5-1.
nrsc5_sig_component_t* nrsc5_event_t::component |
pointer to the associated SIG component
const uint8_t* nrsc5_event_t::data |
contents of the file (if the event type is NRSC5_EVENT_LOT), or NULL (if the event type is NRSC5_EVENT_LOT_HEADER)
pointer to the data bytes of this fragment
contents of image file
int nrsc5_event_t::digital_audio_gain |
TX digital audio gain, in dB. See SY_IDD_1017s section 5.2.1.3.
unsigned int nrsc5_event_t::event |
Type of event. The member event
determines which sort of event occurred:
NRSC5_EVENT_LOST_DEVICE
: RTL-SDR device was disconnectedNRSC5_EVENT_IQ
: IQ data, see the iq
union memberNRSC5_EVENT_SYNC
: indicates synchronization achieved, see the sync
union memberNRSC5_EVENT_LOST_SYNC
: indicates synchronization lostNRSC5_EVENT_MER
: modulation error ratio, see the mer
union member, and NRSC5 document SY_TN_2646sNRSC5_EVENT_BER
: Bit Error Ratio data, see the ber
union memberNRSC5_EVENT_HDC
: HDC audio packet, see the hdc
union memberNRSC5_EVENT_AUDIO
: audio buffer, see the audio
union memberNRSC5_EVENT_ID3
: ID3 information packet arrived, see id3
member and information in HD-Radio document SY_IDD_1028s.NRSC5_EVENT_SIG
: service information arrived, see sig
memberNRSC5_EVENT_LOT
: LOT file data available, see lot
memberNRSC5_EVENT_LOT_HEADER
: LOT file header metadata available, see lot
memberNRSC5_EVENT_LOT_FRAGMENT
: fragment of a LOT file received, see lot_fragment
memberNRSC5_EVENT_SIS
: DEPRECATED. Use NRSC5_EVENT_STATION_ID
, NRSC5_EVENT_STATION_NAME
, NRSC5_EVENT_STATION_SLOGAN
, NRSC5_EVENT_STATION_MESSAGE
, NRSC5_EVENT_STATION_LOCATION
, NRSC5_EVENT_AUDIO_SERVICE_DESCRIPTOR
, NRSC5_EVENT_DATA_SERVICE_DESCRIPTOR
, and NRSC5_EVENT_EMERGENCY_ALERT
instead.NRSC5_EVENT_STREAM
: stream data available, see stream
memberNRSC5_EVENT_PACKET
: packet data available, see packet
memberNRSC5_EVENT_AUDIO_SERVICE
: audio service available, see audio_service
memberNRSC5_EVENT_STATION_ID
: station ID number, see station_id
memberNRSC5_EVENT_STATION_NAME
: station name, see station_name
memberNRSC5_EVENT_STATION_SLOGAN
: station slogan, see station_slogan
memberNRSC5_EVENT_STATION_MESSAGE
: station message, see station_message
memberNRSC5_EVENT_STATION_LOCATION
: station location, see station_location
memberNRSC5_EVENT_AUDIO_SERVICE_DESCRIPTOR
: SIS audio service descriptor, see asd
memberNRSC5_EVENT_DATA_SERVICE_DESCRIPTOR
: SIS data service descriptor, see dsd
memberNRSC5_EVENT_EMERGENCY_ALERT
: emergency alert, see emergency_alert
memberNRSC5_EVENT_HERE_IMAGE
: HERE Images traffic/weather map, see here_image
member struct tm* nrsc5_event_t::expiry_utc |
time after which the file should be deleted
float nrsc5_event_t::freq_offset |
Frequency offset in Hz
int nrsc5_event_t::image_type |
NRSC5_HERE_IMAGE_TRAFFIC or NRSC5_HERE_IMAGE_WEATHER
int nrsc5_event_t::is_duplicate |
1 if this fragment was previously received, otherwise 0
unsigned int nrsc5_event_t::latency |
audio codec latency, in audio frame periods. See SY_IDD_1017s Table 5-1.
float nrsc5_event_t::latitude1 |
latitude of north map edge
float nrsc5_event_t::latitude2 |
latitude of south map edge
float nrsc5_event_t::longitude1 |
longitude of west map edge
float nrsc5_event_t::longitude2 |
longitude of east map edge
unsigned int nrsc5_event_t::lot |
LOT id of the file
LOT id of the file this fragment belongs to
uint32_t nrsc5_event_t::mime |
DEPRECATED: Use component->data.mime
instead
MIME type of the file, e.g. NRSC5_MIME_PNG
uint32_t nrsc5_event_t::mime_type |
MIME type, e.g. NRSC5_MIME_TEXT
int nrsc5_event_t::n1 |
part number (1-9) for traffic, or incrementing sequence number for weather
int nrsc5_event_t::n2 |
number of parts (9) for traffic, or incrementing sequence number for weather
const char* nrsc5_event_t::name |
filename
filename, e.g. "trafficMap_1_2_rdhs.png" or "WeatherImage_0_0_rdhs.png"
uint16_t nrsc5_event_t::port |
DEPRECATED: Use component->data.port
instead
unsigned int nrsc5_event_t::program |
program number 0, 1, ..., 7
int nrsc5_event_t::psmi |
Primary Service Mode Indicator (1, 2, 3, 5, 6, or 11 for FM; 1 or 2 for AM)
unsigned int nrsc5_event_t::repeat |
number of repetitions remaining
unsigned int nrsc5_event_t::seq |
sequence number of this fragment within the LOT file
int nrsc5_event_t::seq |
sequence number (1-15); increments when traffic/weather image changes
nrsc5_sig_service_t* nrsc5_event_t::service |
pointer to the associated SIG service
unsigned int nrsc5_event_t::size |
number of bytes in the file
number of bytes in this fragment
size of image file, in bytes
unsigned int nrsc5_event_t::sound_exp |
0 is none, 2 is Dolby Pro Logic II Surround
struct tm* nrsc5_event_t::time_utc |
UTC time of traffic or weather image
unsigned int nrsc5_event_t::type |
program type, e.g. NRSC5_PROGRAM_TYPE_JAZZ
data service type, e.g. NRSC5_SERVICE_DATA_TYPE_TEXT