Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Unknown ANT Error on Reboot

Avatar
Rank

Total Posts: 6

Joined 0

PM

I have written an App including a remote service. This service restarts every reboot. The service works also the App do. But every reboot the service logs an unknown ANT error:

09-25 18:04:24.002: E/ANTRadioService(1192): com.dsi.ant.exception.AntInterfaceException: Unknown ANT Interface error

My Question:

Is there a flag on reboot that I have to catch before I try to connect to the ANT Hardware?      
RankRankRankRank

Total Posts: 122

Joined 2010-10-25

PM

I don't think you have to be trying straight after a reboot just the first ANT usage after a reboot. I get something similar and would be interested if there is any way of stoping it.      
Avatar
RankRankRankRank

Total Posts: 129

Joined 2010-11-30

PM

Is this after an operation you perform, or simply from binding to the ANT Radio Service and starting it the first time? We will look in to it.      
Avatar
Rank

Total Posts: 6

Joined 0

PM

Seems to be first time binding after reboot.      
Avatar
Rank

Total Posts: 6

Joined 0

PM

Hardware:
Sony Ericsson Xperia Arc S
Sony Ericsson Xperia S


BootReceiver:
public class BootReceiver extends BroadcastReceiver {

    Context c
;

    
/*
     * (non-Javadoc)
     * 
     * @see android.content.BroadcastReceiver#onReceive(android.content.Context,
     * android.content.Intent)
     */
    
@Override
    
public void onReceive(final Context contextIntent intent{
        
        
final String TAG BootReceiver.class.getSimpleName();

        
Intent antService = new Intent();
        
antService.setAction("de.tum.lme.diamantum.ANTRadioService");
        
antService.putExtra("callerId""BootReceiver");

        if (
Intent.ACTION_SHUTDOWN.equals(intent.getAction())) {
            Log
.d("Bootreceiver""Shut down initiated");
            
context.stopService(antService);
            
Log.d(TAG"Stopped Service");
        
}

        
if (Intent.ACTION_BOOT_COMPLETED.equals(i[code] 
ntent.getAction())) {
Log.d(TAG, "boot completed");

context.startService(antService);
}

}
}


ANT ServiceListener to claim ANT interface
private AntInterface.ServiceListener listener = new AntInterface.ServiceListener() {
        
@Override
        
public void onServiceConnected() {
            
// Service ist verbunden
            
Log.d(TAG"ServiceListener onServiceConnected()");
            
// boolean mServiceConnected = true;

            
try {

                boolean mClaimedAntInterface 
mAntAdapter
                        
.hasClaimedInterface();
                if (
mClaimedAntInterface{
                    
// mAntMessageReceiver should be registered any time we have
                    // control of the ANT Interface
                    
receiveAntRxMessages(true);
                
else {
                    
// Need to claim the ANT Interface if it is available, now
                    // the service is connected
                    
mClaimedAntInterface mAntAdapter.claimInterface();
                
}
            } 
catch (Throwable e{
                
// irgendwas ist total schief gelaufen
                // wird aber auch angezeigt
                
error_message(e.toString());

            
}

            Log
.d(TAG"ANT Service connected");

            
Log.d(TAG"enabling ANT");

            
// try {
            // mAntAdapter.ANTResetSystem();
            // } catch (AntInterfaceException e) {
            // // TODO Auto-generated catch block
            // error_message(e.toString() + "RESET");
            // }
            // Aktiviere AntInterface

            
try {
                mAntAdapter
.enable();
            
catch (AntInterfaceException e{
                
// TODO Auto-generated catch block
                
error_message(e.toString() + "ENABLE");
            
}
        }

        
@Override
        
public void onServiceDisconnected() {
            
// Service ist nicht verbunden
            
Log.d(TAG"ServiceListener onServiceDisconnected()");
            try 
{
                receiveAntRxMessages
(false);
            
catch (IllegalArgumentException e{
                
// Receiver wasn't registered, ignore as that's what we wanted
                // anyway
            
}

        }
    }


The Interface is claimed and enabled, seen in Log file.      
Rank

Total Posts: 14

Joined 2012-09-04

PM

Need some help here since I can't reproduce the error even on our XPeria S phone.

What version of Android and AntRadioService are you developing the app on?