// Path: pi-ezo/src/main/java/org/onebeartoe/media/piezo/ports/softtone/SoftTonePort.java
// public static final int PIEZO_PIN = 3;


import com.pi4j.wiringpi.Gpio;
import com.pi4j.wiringpi.SoftTone;
import java.util.List;
import static org.onebeartoe.media.piezo.ports.softtone.SoftTonePort.PIEZO_PIN;

package org.onebeartoe.media.piezo.ports.rtttl;


/**
 * This class uses the built in RTTTL songs to play ring tones on a piezo buzzer.
 * 
 * @author Roberto Marquez
 */
public class RtttlService
{
   BuiltInSongs builtInSongs = new BuiltInSongs();
   
   public RtttlService()
   {
       Gpio.wiringPiSetup();
   }
   
   public void playSong(int id) throws InterruptedException
   {
       List<RtttlSong> songs = builtInSongs.getSongs();
       
       RtttlSong song = songs.get(id);
       
       
       String data = song.getData();
  
       playSong(data);
   }
   
   public void playSong(String rtttl)
   {
// Path: pi-ezo/src/main/java/org/onebeartoe/media/piezo/ports/softtone/SoftTonePort.java
// public static final int PIEZO_PIN = 3;


// Path: pi-ezo/src/main/java/org/onebeartoe/media/piezo/ports/rtttl/RtttlService.java
import com.pi4j.wiringpi.Gpio;
import com.pi4j.wiringpi.SoftTone;
import java.util.List;
import static org.onebeartoe.media.piezo.ports.softtone.SoftTonePort.PIEZO_PIN;


package org.onebeartoe.media.piezo.ports.rtttl;


/**
 * This class uses the built in RTTTL songs to play ring tones on a piezo buzzer.
 * 
 * @author Roberto Marquez
 */
public class RtttlService
{
   BuiltInSongs builtInSongs = new BuiltInSongs();
   
   public RtttlService()
   {
       Gpio.wiringPiSetup();
   }
   
   public void playSong(int id) throws InterruptedException
   {
       List<RtttlSong> songs = builtInSongs.getSongs();
       
       RtttlSong song = songs.get(id);
       
       
       String data = song.getData();
  
       playSong(data);
   }
   
   public void playSong(String rtttl)
   {
       SoftTone.softToneCreate(PIEZO_PIN);