public void onDiscoveryStateChanged(CalibreService.DiscoveryState discoveryState) {
   ConnectionFragment frag = (ConnectionFragment) tab_connection.getFragment();
   if (frag != null) {
     frag.setDiscoveryState(discoveryState);
     switch (discoveryState) {
       case NO_SERVER:
         if (frag.isResumed() && mFragmentManager.findFragmentByTag("dlg-connect") == null) {
           NoServerDialogFragment instNSDF = new NoServerDialogFragment();
           instNSDF.show(mFragmentManager, "dlg-no-server");
         }
         break;
     }
   }
 }
 @Override
 public void onErrorReported(CalibreService.ErrorType e) {
   ConnectionFragment frag = (ConnectionFragment) tab_connection.getFragment();
   if (frag != null) frag.setErrorMessage(e);
 }
 public void onConnectionStateChanged(CalibreService.ConnectionState connectionState) {
   ConnectionFragment frag = (ConnectionFragment) tab_connection.getFragment();
   if (frag != null) frag.setConnectionState(connectionState);
 }