Ejemplo n.º 1
0
  @Override
  public void onServiceConnected(ComponentName name, IBinder service) {
    mService = IPlayerService.Stub.asInterface(service);
    if (bound) {
      Log.d(TAG, "Service Connected");
    } else {
      Log.d(TAG, "Service Connected, but was unbound in the meantime");
      return;
    }

    try {
      mService.registerCallback(mCallback, 0);
    } catch (RemoteException e) {
      throw new RuntimeException(e);
    }

    for (Opt o : options) {
      setOption(o.opt, o.arg);
    }
    options.clear();

    if (modToPlay != null) {
      playMod(modToPlay);
      modToPlay = null;
    }
  }
Ejemplo n.º 2
0
 public boolean dumpWav(String modName, String destFile, int length, int flags) {
   try {
     return mService.dumpWav(modName, destFile, length, flags);
   } catch (RemoteException e) {
     e.printStackTrace();
   }
   return false;
 }
Ejemplo n.º 3
0
 public void stop() {
   try {
     mService.stop();
   } catch (RemoteException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Ejemplo n.º 4
0
 public byte[] getBinaryData(int what) {
   try {
     return mService.getBinaryData(what);
   } catch (RemoteException e) {
     e.printStackTrace();
   }
   return null;
 }
Ejemplo n.º 5
0
 public boolean seekTo(int msec) {
   try {
     return mService.seekTo(msec);
   } catch (RemoteException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return false;
 }
Ejemplo n.º 6
0
 public boolean playPause(boolean play) {
   try {
     return mService.playPause(play);
   } catch (RemoteException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return false;
 }
Ejemplo n.º 7
0
 public boolean setSubSong(int song) {
   try {
     return mService.setSubSong(song);
   } catch (RemoteException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return false;
 }
Ejemplo n.º 8
0
 public boolean playPlaylist(String path, int index) {
   try {
     return mService.playPlaylist(path, index);
   } catch (RemoteException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return false;
 }
Ejemplo n.º 9
0
 public boolean playList(java.lang.String[] names, int startIndex) {
   try {
     return mService.playList(names, startIndex);
   } catch (RemoteException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return false;
 }
Ejemplo n.º 10
0
 public Map<String, Object> getSongInfo() {
   try {
     String[] s = mService.getSongInfo();
     return arrayToMap(s);
   } catch (RemoteException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return null;
 }
Ejemplo n.º 11
0
  public boolean playMod(String name) {
    if (mService == null) {
      modToPlay = name;
      return true;
    }

    try {
      return mService.playMod(name);
    } catch (RemoteException e) {
      return false;
    }
  }
Ejemplo n.º 12
0
 public void unbindService(Context ctx) {
   Log.d(TAG, "Unbinding");
   handler = null;
   bound = false;
   if (mService != null) {
     try {
       mService.unRegisterCallback(mCallback);
     } catch (RemoteException e) {
       // throw new RuntimeException(e);
     }
   }
   ctx.unbindService(this);
 }
Ejemplo n.º 13
0
  public void setOption(int opt, String arg) {

    if (mService == null) {
      options.add(new Opt(opt, arg));
      return;
    }

    try {
      mService.setOption(opt, arg);
    } catch (RemoteException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }