Project Description
USB FM library provides managed interfaces, developed with C# to USB FM receivers, supporting RDS. This includes consumer oriented and OEM devices.

Don't you ever want to be able to listen to your favorite radio station during your office hours? Do you developing automotive software and need an interfaces for FM receiver chip? Do you want to be notified about traffic jams before leaving office and turning on the radio with TMC in your vehicle? Maybe you want to use RDS to send and receive information over FM? Or you're just geek and love to deal with uber technical stuff? FM USB library is the answer to those question. This is fully managed and standard library in C#, which can be included into your software and provides support for FM radio chips on USB with full RDB (RDBS) and TMC support.



How to use this library? Simple it's like 1-2-3
Please see an example application with this library on Code Project

         using (var device = USBRadioDevice.FindDevice(0x818A, 0x10C4)) {
            Console.WriteLine("{0}ound {1}", device.IsInvalid ? "Not f" : "F", device);
            if(!device.IsInvalid) 
               Console.WriteLine("FM capabilities:\nDevice version: {0:x}\nFirmware version: {1:x}\nHardware version: {2:x}\nSoftware version: {3:x}\nManufacture ID version: {4:x}\nPart #{5:x}\n",
                  device.Capabilities.DeviceVersion,
                  device.Capabilities.FirmwareVersion,
                  device.Capabilities.HardwareVersion,
                  device.Capabilities.SoftwareVersion,
                  device.Capabilities.ManufacturerID,
                  device.Capabilities.PartNumber
                  );
            device.InitAudio();
            device.InitRDSReports();
            device.PropertyChanged += (s, e) => {
               if (e.PropertyName == "RDS" && device.RDS!=null) device.RDS.PropertyChanged += (s1, e1) => {
                  if (e1.PropertyName == "PS" && !string.IsNullOrEmpty(device.RDS.PS)) Console.WriteLine(device.RDS.PS);
                  if (e1.PropertyName == "AF" && device.RDS.AF != null && device.RDS.AF.Count > 0) Console.WriteLine(string.Join(",", device.RDS.AF.ConvertAll(f => f.ToString()).ToArray()));
                  if (e1.PropertyName == "PTYString" && !string.IsNullOrEmpty(device.RDS.PTYString)) Console.WriteLine("PTY:{0}", device.RDS.PTYString);
                  if (
                     (e1.PropertyName == "PIRegion" && !string.IsNullOrEmpty(device.RDS.PIRegion)) | 
                     (e1.PropertyName == "PICountry" && !string.IsNullOrEmpty(device.RDS.PICountry)))
                     Console.WriteLine("PI Region:{0}\nPI Country:{1}", device.RDS.PIRegion, device.RDS.PICountry);
                  if (e1.PropertyName == "TrafficPI") Console.WriteLine("Traffic: {0}", device.RDS.TrafficPI);
               };
            };
            ConsoleKey k;
            while ((k = Console.ReadKey(true).Key) != ConsoleKey.Q) {
               switch (k) {
                  case ConsoleKey.D1: Console.WriteLine("Tuning to {2} ({0}) - actual {1}", device.Tune(88), device.CurrentFrequency, 88); break;
                  case ConsoleKey.D2: Console.WriteLine("Tuning to {2} ({0}) - actual {1}", device.Tune(103), device.CurrentFrequency, 103); break;
                  case ConsoleKey.D3: Console.WriteLine("Tuning to {2} ({0}) - actual {1}", device.Tune(99), device.CurrentFrequency, 99); break;
                  case ConsoleKey.D4: Console.WriteLine("Tuning to {2} ({0}) - actual {1}", device.Tune(100), device.CurrentFrequency, 100); break;
                  case ConsoleKey.D5: Console.WriteLine("Tuning to {2} ({0}) - actual {1}", device.Tune(89.1), device.CurrentFrequency, 89.1); break;
                  case ConsoleKey.D6: Console.WriteLine("Tuning to {2} ({0}) - actual {1}", device.Tune(96.6), device.CurrentFrequency, 96.6); break;
                  case ConsoleKey.M: device.Mute(!device.IsMuted); Console.WriteLine("Mute: {0}", device.IsMuted); break;
                  case ConsoleKey.C: Console.WriteLine("Signal: {0}", device.RDS.SignalStrength); break;
                  case ConsoleKey.R: Console.WriteLine("RDS: {0}", device.RDS); break;
                  case ConsoleKey.S: Console.WriteLine("Seek: {0}, Freq: {1}", device.Seek(true), device.CurrentFrequency); break;
                  case ConsoleKey.Escape: Console.Clear(); break;
               }
            }
            device.StopRDSReports();
            device.StopAudio();
         }

Want to learn more? Visit my blog at http://khason.net

Currently this library was tested with Silicon Labs (PID = 0x818A, VID = 0x10C4), PCEar (PID = 0x819A, VID = 0x10C5) and ADSTech (PID = 0xA155, VID = 0x06E1) devices. You're welcome to test it on other devices and post PID/VID information in comments.

Last edited Jan 11, 2009 at 7:59 AM by tamirk, version 7