add acc status static broadcast

This commit is contained in:
wangcongtao
2020-06-19 11:16:23 +08:00
parent 89d20022bd
commit 879a01d11b
7 changed files with 59 additions and 18 deletions

View File

@@ -65,7 +65,12 @@ public class MarkerServiceHandler {
private static MapMarkerManager sMapMarkerManager;
public static void init( final Context context ) {
public static synchronized void init( final Context context ) {
if ( sGpsSimulatorManager != null ) {
return;
}
sApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( context );
sMapService = sApis.getMapServiceApi();
sImageloader = sApis.getImageLoaderApi();
@@ -85,7 +90,7 @@ public class MarkerServiceHandler {
sLauncher = sApis.getLauncherApi();
sFragmentManager = sApis.getFragmentManagerApi();
sCarChatting = (ICarsChattingProvider)ARouter.getInstance().build( CallChattingProviderConstant.CAR_CALL_PROVIDER ).navigation( context );
sCarChatting = ( ICarsChattingProvider ) ARouter.getInstance().build( CallChattingProviderConstant.CAR_CALL_PROVIDER ).navigation( context );
sMapMarkerManager = MapMarkerManager.getInstance();
sMapMarkerManager.init( context );
@@ -93,7 +98,7 @@ public class MarkerServiceHandler {
sGpsSimulatorManager = ARouter.getInstance().navigation( IMogoGpsSimulatorManager.class );
}
public static IMogoServiceApis getApis(){
public static IMogoServiceApis getApis() {
return sApis;
}

View File

@@ -403,10 +403,6 @@ public class MogoServices implements IMogoMapListener,
}
filter.addAction( MogoReceiver.VOICE_ACTION );
filter.addAction( MogoReceiver.ACTIION_ADAS );
filter.addAction( MogoReceiver.ACTION_NWD_ACC );
// acc On
filter.addAction( Intent.ACTION_POWER_CONNECTED );
filter.addAction( Intent.ACTION_POWER_DISCONNECTED );
// 小智语音
filter.addAction( MogoReceiver.ACTION_VOICE_UI );
filter.addAction( MogoReceiver.ACTION_ADAS_STATUS );

View File

@@ -5,6 +5,7 @@ import android.content.Intent;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.receiver.AccStatusReceiver;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.utils.logger.Logger;
@@ -47,8 +48,8 @@ class AccStatusIntentHandler implements IntentHandler {
} else if ( Intent.ACTION_POWER_DISCONNECTED.equals( action ) ) {
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false );
Logger.d( TAG, "acc status: %s", false );
} else if ( MogoReceiver.ACTION_NWD_ACC.equals( action ) ) {
int state = intent.getByteExtra( MogoReceiver.PARAM_ACC_STATUS, ( byte ) 0 );
} else if ( AccStatusReceiver.ACTION_NWD_ACC.equals( action ) ) {
int state = intent.getByteExtra( AccStatusReceiver.PARAM_ACC_STATUS, ( byte ) 0 );
Logger.d( TAG, "acc status: %s", state == 1 );
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, state == 1 );
}

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.receiver.AccStatusReceiver;
import com.mogo.module.service.receiver.MogoReceiver;
import java.util.HashMap;
@@ -31,7 +32,7 @@ public class IntentHandlerFactory {
mHandlers.put( MogoReceiver.ACTION_VOICE_UI, new VoiceUiIntentHandler() );
mHandlers.put( Intent.ACTION_POWER_CONNECTED, AccStatusIntentHandler.getInstance() );
mHandlers.put( Intent.ACTION_POWER_DISCONNECTED, AccStatusIntentHandler.getInstance() );
mHandlers.put( MogoReceiver.ACTION_NWD_ACC, AccStatusIntentHandler.getInstance() );
mHandlers.put( AccStatusReceiver.ACTION_NWD_ACC, AccStatusIntentHandler.getInstance() );
mHandlers.put( MogoReceiver.ACTION_ADAS_STATUS, ADASStatusIntentHandler.getInstance() );
mHandlers.put( MogoReceiver.ACTIION_ADAS, ADASStatusIntentHandler.getInstance() );
mHandlers.put( MogoReceiver.ACTION_VOICE_READY, new AIAssistIntentHandler() );

View File

@@ -0,0 +1,30 @@
package com.mogo.module.service.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.intent.IntentHandlerFactory;
public
/**
* @author congtaowang
* @since 2020/6/19
*
* 描述
*/
class AccStatusReceiver extends BroadcastReceiver {
// 诺威达 acc 状态
public static final String PARAM_ACC_STATUS = "extra_mcu_state";
// 诺威达 acc 状态
public static final String ACTION_NWD_ACC = "com.nwd.action.ACTION_MCU_STATE_CHANGE";
@Override
public void onReceive( Context context, Intent intent ) {
MarkerServiceHandler.init( context );
IntentHandlerFactory.getInstance().handle( context, intent.getAction(), intent );
}
}

View File

@@ -7,6 +7,7 @@ import android.text.TextUtils;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.voice.VoiceIntentTrack;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.intent.IMogoIntentManager;
import com.mogo.utils.logger.Logger;
@@ -34,12 +35,6 @@ public class MogoReceiver extends BroadcastReceiver {
// ADAS 状态 0 - 关闭 1 - 打开
public static final String PARAM_ADAS_STATUS = "adas_drawer_status";
// 诺威达 acc 状态
public static final String ACTION_NWD_ACC = "com.nwd.action.ACTION_MCU_STATE_CHANGE";
// 诺威达 acc 状态
public static final String PARAM_ACC_STATUS = "extra_mcu_state";
// 小智语音唤醒UI
public static final String ACTION_VOICE_UI = "com.zhidao.xiaozhi.wake.status";
public static final String PARRAM_WAKE_STATUS = "WAKE_STATUS";
@@ -61,7 +56,7 @@ public class MogoReceiver extends BroadcastReceiver {
private IMogoIntentManager mMogoIntentManager;
public MogoReceiver(Context context) {
mMogoIntentManager = (IMogoIntentManager) ARouter.getInstance().build(MogoServicePaths.PATH_INTENT_MANAGER).navigation(context);
mMogoIntentManager = MarkerServiceHandler.getIntentManager();
}
@Override