处理分体机acc状态和诺维达accDelay的情况
This commit is contained in:
@@ -3,9 +3,11 @@ package com.mogo.module.service.intent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.receiver.AccStatusReceiver;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
@@ -19,6 +21,7 @@ class AccStatusIntentHandler implements IntentHandler {
|
||||
|
||||
public static final byte ACC_ON = 1;
|
||||
public static final byte ACC_OFF = 0;
|
||||
public static final byte ACC_OFF_DELAY = 3;
|
||||
|
||||
private static final String TAG = "AccStatusIntentHandler";
|
||||
|
||||
@@ -46,21 +49,26 @@ class AccStatusIntentHandler implements IntentHandler {
|
||||
public void handle( Context context, Intent intent ) {
|
||||
String action = intent.getAction();
|
||||
if ( Intent.ACTION_POWER_CONNECTED.equals( action ) ) {
|
||||
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, true );
|
||||
Logger.d( TAG, "acc status: %s", true );
|
||||
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
|
||||
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, true );
|
||||
Logger.d( TAG, "acc status: %s", true );
|
||||
}
|
||||
} else if ( Intent.ACTION_POWER_DISCONNECTED.equals( action ) ) {
|
||||
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false );
|
||||
Logger.d( TAG, "acc status: %s", false );
|
||||
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
|
||||
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false );
|
||||
Logger.d( TAG, "acc status: %s", false );
|
||||
}
|
||||
} else if ( AccStatusReceiver.ACTION_NWD_ACC.equals( action ) ) {
|
||||
int state = intent.getByteExtra( AccStatusReceiver.PARAM_ACC_STATUS, ACC_OFF );
|
||||
if ( state != ACC_OFF && state != ACC_ON ) {
|
||||
TipToast.shortTip( "收到acc状态变更:" + state );
|
||||
if ( state != ACC_OFF && state != ACC_ON && state != ACC_OFF_DELAY ) {
|
||||
return;
|
||||
}
|
||||
boolean accOn = state == ACC_ON;
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isAccOn() == accOn ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "acc status: %s", accOn );
|
||||
Logger.d( TAG, "acc status: %s", state );
|
||||
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, accOn );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user