merge socket replace code and update aicloud sdk version

This commit is contained in:
zhongchao
2022-03-23 21:12:27 +08:00
parent b280481882
commit f5edb94684
7 changed files with 35 additions and 28 deletions

View File

@@ -133,13 +133,13 @@ public class MogoOCHTaxiModelNew {
mContext = context.getApplicationContext(); mContext = context.getApplicationContext();
initListeners(); initListeners();
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis(); // IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
apis.getSocketManagerApi(mContext).init(mContext, DebugConfig.getSocketAppId()); // apis.getSocketManagerApi(mContext).init(mContext, DebugConfig.getSocketAppId());
// TODO: 2021/8/27 因需要通过此回调的location进行坐标上传暂改为全程监听退出后再反注册 // TODO: 2021/8/27 因需要通过此回调的location进行坐标上传暂改为全程监听退出后再反注册
// 待后续整体调整location获取来源 // 待后续整体调整location获取来源
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) { // if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
apis.getLocationInfoApi().start(); // apis.getLocationInfoApi().start();
} // }
//2022.1.28 //2022.1.28
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃 // 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃

View File

@@ -15,12 +15,12 @@ if (!isAndroidTestBuild()) {
logLevel "DEBUG" logLevel "DEBUG"
} }
} }
//if (!isAndroidTestBuild()) { if (!isAndroidTestBuild()) {
// apply plugin: 'chain.log.hook' apply plugin: 'chain.log.hook'
// hooklog{ hooklog{
// enableLoggerToServer true enableLoggerToServer true
// } }
//} }
//if (!isAndroidTestBuild()) { //if (!isAndroidTestBuild()) {
// apply plugin: 'apm-plugin' // apply plugin: 'apm-plugin'

View File

@@ -187,6 +187,8 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
clientConfig.setThirdPartyDeviceId(Utils.getDevicesId()); clientConfig.setThirdPartyDeviceId(Utils.getDevicesId());
// 设置循环检测间隔时间每隔2小时loop一次httpDnsConfig // 设置循环检测间隔时间每隔2小时loop一次httpDnsConfig
clientConfig.setLoopCheckDelay(60 * 60 * 2 * 1000); clientConfig.setLoopCheckDelay(60 * 60 * 2 * 1000);
//设置长链接的secretKey //todo 通过SHA1和包名找中台服务生成后续包名分渠道,需要做对应操作
clientConfig.setSecretKey("YMj2VFDFxJ3Q4gNoZceJ");
//连接ami //连接ami
connectAmiIp(); connectAmiIp();
@@ -234,6 +236,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
@Override @Override
public void onTokenGot(String token, String sn) { public void onTokenGot(String token, String sn) {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "onTokenGot "); CallerLogger.INSTANCE.d(M_MAIN + TAG, "onTokenGot ");
clientConfig.setToken(token);
// 异步初始化NetConfig // 异步初始化NetConfig
asyncInit(); asyncInit();
// HttpDns ttl回调 --- socketTTL // HttpDns ttl回调 --- socketTTL
@@ -277,6 +280,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
private void startSocketService() { private void startSocketService() {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "startSocketService"); CallerLogger.INSTANCE.d(M_MAIN + TAG, "startSocketService");
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis(); IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
MogoLocation location = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getApp()).getLastKnowLocation();
// 关闭长链服务 // 关闭长链服务
apis.getSocketManagerApi(getApplicationContext()).destroy(); apis.getSocketManagerApi(getApplicationContext()).destroy();
apis.getSocketManagerApi(this).registerLifecycleListener(10020, new IMogoLifecycleListener() { apis.getSocketManagerApi(this).registerLifecycleListener(10020, new IMogoLifecycleListener() {
@@ -299,7 +303,10 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
} }
}); });
// 开启Socket长链服务 // 开启Socket长链服务
apis.getSocketManagerApi(getApplicationContext()).init(getApplicationContext(), DebugConfig.getSocketAppId()); double lat = location.getLatitude();
double lon = location.getLongitude();
CallerLogger.INSTANCE.d(M_MAIN + TAG,"emArrow lat : " + lat + " , lon : " + lon);
apis.getSocketManagerApi(getApplicationContext()).init(getApplicationContext(), DebugConfig.getSocketAppId(),lat,lon);
} }
@Override @Override

View File

@@ -8,13 +8,13 @@ import com.mogo.cloud.socket.IMogoCloudSocketMsgAckListener;
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener; import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
import com.mogo.cloud.socket.SocketManager; import com.mogo.cloud.socket.SocketManager;
import com.mogo.cloud.socket.entity.MsgBody; import com.mogo.cloud.socket.entity.MsgBody;
import com.mogo.cloud.socket.third.core.ConnectionLifecycleListener;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.service.cloud.socket.IMogoLifecycleListener; import com.mogo.service.cloud.socket.IMogoLifecycleListener;
import com.mogo.service.cloud.socket.IMogoMsgAckListener; import com.mogo.service.cloud.socket.IMogoMsgAckListener;
import com.mogo.service.cloud.socket.IMogoOnMessageListener; import com.mogo.service.cloud.socket.IMogoOnMessageListener;
import com.mogo.service.cloud.socket.IMogoSocketManager; import com.mogo.service.cloud.socket.IMogoSocketManager;
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon; import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
import com.zhidao.socket.ConnectionLifecycleListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -70,9 +70,9 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem
private final Map<Long, IMogoMsgAckListener> mAckListeners = new ConcurrentHashMap<>(); private final Map<Long, IMogoMsgAckListener> mAckListeners = new ConcurrentHashMap<>();
@Override @Override
public void init(Context context, String appId) { public void init(Context context, String appId, double lat, double lon) {
this.mAppId = appId; this.mAppId = appId;
SocketManager.getInstance().init(context); SocketManager.getInstance().init(context, lat, lon);
SocketManager.getInstance().registerSocketConnCallback(this); SocketManager.getInstance().registerSocketConnCallback(this);
} }

View File

@@ -63,23 +63,23 @@ SERVICE_CHAIN_VERSION=1.0.53
LOGLIB_VERSION=1.2.20 LOGLIB_VERSION=1.2.20
######## MogoAiCloudSDK Version ######## ######## MogoAiCloudSDK Version ########
# 网络请求 # 网络请求
MOGO_NETWORK_VERSION=1.3.32 MOGO_NETWORK_VERSION=1.3.48
# 鉴权 # 鉴权
MOGO_PASSPORT_VERSION=1.3.32 MOGO_PASSPORT_VERSION=1.3.48
# 常链接 # 常链接
MOGO_SOCKET_VERSION=1.3.32 MOGO_SOCKET_VERSION=1.3.48
# 数据采集 # 数据采集
MOGO_REALTIME_VERSION=1.3.32 MOGO_REALTIME_VERSION=1.3.48
# 探路,道路事件发布,获取 # 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.3.32 MOGO_TANLU_VERSION=1.3.48
# 直播推流 # 直播推流
MOGO_LIVE_VERSION=1.3.32 MOGO_LIVE_VERSION=1.3.48
# 直播拉流 # 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.3.32 MOGO_TRAFFICLIVE_VERSION=1.3.48
# 定位服务 # 定位服务
MOGO_LOCATION_VERSION=1.3.32 MOGO_LOCATION_VERSION=1.3.48
# 远程通讯模块 # 远程通讯模块
MOGO_TELEMATIC_VERSION=1.3.32 MOGO_TELEMATIC_VERSION=1.3.48
######## MogoAiCloudSDK Version ######## ######## MogoAiCloudSDK Version ########
# 自研地图 # 自研地图
MAP_SDK_VERSION=2.0.9.4 MAP_SDK_VERSION=2.0.9.4
@@ -155,5 +155,5 @@ MOGO_OCH_TAXI_VERSION=2.0.66
# mogoAiCloud sdk services # mogoAiCloud sdk services
MOGO_AICLOUD_SERVICES_SDK_VERSION=2.1.16.10 MOGO_AICLOUD_SERVICES_SDK_VERSION=2.1.16.10
# v2x-sdk # v2x-sdk
MOGO_V2X_SDK_VERSION=1.3.32 MOGO_V2X_SDK_VERSION=1.3.48
################# 旧版本架构模块版本 ################# ################# 旧版本架构模块版本 #################

View File

@@ -19,7 +19,7 @@ public interface IMogoSocketManager extends IProvider {
* @param context 上下文 * @param context 上下文
* @param appId 一般为包名,不参与通道的建立,一般用于发消息 * @param appId 一般为包名,不参与通道的建立,一般用于发消息
*/ */
void init( Context context, String appId ); void init( Context context, String appId , double lat, double lon);
/** /**
* 注册消息监听 * 注册消息监听

View File

@@ -26,9 +26,9 @@ public class MogoSocketManager implements IMogoSocketManager {
private IMogoSocketManager mDelegate; private IMogoSocketManager mDelegate;
@Override @Override
public void init(Context context, String appId) { public void init(Context context, String appId, double lat, double lon) {
if (mDelegate != null) { if (mDelegate != null) {
mDelegate.init(context, appId); mDelegate.init(context, appId, lat, lon);
} }
} }