[master]expand the interface of socket, add sn
This commit is contained in:
@@ -46,7 +46,7 @@ public class SocketMsgUtils implements IMogoCloudSocketMsgAckListener {
|
||||
Log.i(TAG, "初始化长连接……");
|
||||
mSocketManager = SocketManager.getInstance();
|
||||
mMessageListener = listener;
|
||||
mSocketManager.init(mContext,0,0);
|
||||
mSocketManager.init(mContext,"",0,0);
|
||||
mSocketManager.registerOnMessageListener(401017, listener);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public interface IMogoCloudSocketManager {
|
||||
*
|
||||
* @param context 上下文
|
||||
*/
|
||||
void init(Context context, double lat, double lon);
|
||||
void init(Context context, String sn, double lat, double lon);
|
||||
|
||||
/**
|
||||
* 重新连接
|
||||
|
||||
@@ -75,9 +75,9 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
private int mCurrentIndex = 0;
|
||||
|
||||
@Override
|
||||
public void init(Context context, double lat, double lon) {
|
||||
public void init(Context context, String sn, double lat, double lon) {
|
||||
if (cloudClientConfig.isThirdLogin()) {
|
||||
ThirdSocketManager.getInstance().init(context, lat, lon);
|
||||
ThirdSocketManager.getInstance().init(context, sn, lat, lon);
|
||||
} else {
|
||||
InternalSocketManager.getInstance().init(context);
|
||||
}
|
||||
|
||||
@@ -45,18 +45,22 @@ public class ThirdSocketManager implements Callback, ErrorCallback {
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
public void init(Context context, double lat, double lon) {
|
||||
public void init(Context context, String sn, double lat, double lon) {
|
||||
MLocation mLocation = new MLocation();
|
||||
mLocation.setCoordinate(GCJ02);
|
||||
mLocation.setLatitude(lat);
|
||||
mLocation.setLongitude(lon);
|
||||
String tempSn = cloudClientConfig.getSn();
|
||||
if (tempSn == null || tempSn.isEmpty()) {
|
||||
tempSn = sn;
|
||||
}
|
||||
SocketConfig.instance()
|
||||
.setAppContext(context.getApplicationContext())
|
||||
.setEnvironment(getEnvironment())
|
||||
.setClient(MogoCommon.Client.car)
|
||||
.setChannelId(SocketServicesConstants.SOCKET_CHANNEL_ID)
|
||||
.setOpenAnalytics(true)
|
||||
.setSn(cloudClientConfig.getSn())
|
||||
.setSn(tempSn)
|
||||
.setToken(cloudClientConfig.getToken())
|
||||
.setSecretKey(cloudClientConfig.getSecretKey())
|
||||
.setAuthPubKey(cloudClientConfig.getAuthPubKey())
|
||||
@@ -69,7 +73,7 @@ public class ThirdSocketManager implements Callback, ErrorCallback {
|
||||
SocketClient.getInstance().start(context);
|
||||
}
|
||||
|
||||
public void reConnect(){
|
||||
public void reConnect() {
|
||||
SocketClient.getInstance().stopAndRestart();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.mogo.v2x
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import com.mogo.cloud.location.LocationManager
|
||||
//import com.mogo.cloud.location.LocationManager
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.cloud.socket.SocketManager
|
||||
import com.mogo.v2x.callback.IV2XCallback
|
||||
@@ -128,15 +128,15 @@ object V2XManager {
|
||||
}
|
||||
if (started.compareAndSet(false, true)) {
|
||||
Logger.d(TAG, "-- start real --")
|
||||
SocketManager.getInstance().init(config.context,0.0,0.0)
|
||||
SocketManager.getInstance().init(config.context,"",0.0,0.0)
|
||||
SocketManager.getInstance().registerOnMessageListener(401012, V2XMessageListener_401012(cbs))
|
||||
SocketManager.getInstance().registerOnMessageListener(401018, V2XMessageListener_401018(cbs))
|
||||
SocketManager.getInstance().registerOnMessageListener(402000, V2XMessageListener_402000(cbs))
|
||||
SocketManager.getInstance().registerOnMessageListener(404000, V2XMessageListener_404000(cbs))
|
||||
SocketManager.getInstance().registerOnMessageListener(503000, V2XMessageListener_503000(cbs))
|
||||
|
||||
LocationManager.getInstance().init(config.context)
|
||||
LocationManager.getInstance().start()
|
||||
// LocationManager.getInstance().init(config.context)
|
||||
// LocationManager.getInstance().start()
|
||||
handler.post(refreshTask)
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ object V2XManager {
|
||||
if (started.compareAndSet(true, false)) {
|
||||
Logger.d(TAG, "-- stop real --")
|
||||
SocketManager.getInstance().release()
|
||||
LocationManager.getInstance().stop()
|
||||
// LocationManager.getInstance().stop()
|
||||
handler.removeCallbacks(refreshTask)
|
||||
lastLatitude.set(0.0)
|
||||
lastLongitude.set(0.0)
|
||||
|
||||
@@ -36,24 +36,24 @@ PASSWORD=xintai2018
|
||||
RELEASE=true
|
||||
# AI CLOUD 云平台
|
||||
# 工具类
|
||||
MOGO_UTILS_VERSION=1.4.6.8
|
||||
MOGO_UTILS_VERSION=1.4.7.2
|
||||
# 网络请求
|
||||
MOGO_NETWORK_VERSION=1.4.6.8
|
||||
MOGO_NETWORK_VERSION=1.4.7.2
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.4.6.8
|
||||
MOGO_PASSPORT_VERSION=1.4.7.2
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.4.6.8
|
||||
MOGO_SOCKET_VERSION=1.4.7.2
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.4.6.8
|
||||
MOGO_REALTIME_VERSION=1.4.7.2
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.4.6.8
|
||||
MOGO_TANLU_VERSION=1.4.7.2
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.4.6.8
|
||||
MOGO_LIVE_VERSION=1.4.7.2
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.4.6.8
|
||||
MOGO_TRAFFICLIVE_VERSION=1.4.7.2
|
||||
# 定位服务
|
||||
MOGO_LOCATION_VERSION=1.4.6.8
|
||||
MOGO_LOCATION_VERSION=1.4.7.2
|
||||
# 远程通讯模块
|
||||
MOGO_TELEMATIC_VERSION=1.4.6.8
|
||||
MOGO_TELEMATIC_VERSION=1.4.7.2
|
||||
# v2x
|
||||
MOGO_V2X_VERSION=1.4.6.8
|
||||
MOGO_V2X_VERSION=1.4.7.2
|
||||
|
||||
@@ -49,7 +49,7 @@ public class SocketHandler {
|
||||
*/
|
||||
public void initSocket(Context context, String appId, double lat, double lon) {
|
||||
mAppId = appId;
|
||||
SocketManager.getInstance().init(context, lat, lon);
|
||||
SocketManager.getInstance().init(context, "", lat, lon);
|
||||
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getNetMode() == HTTP_DNS_ENV_DEMO) {
|
||||
SocketManager.getInstance().registerOnMessageListener(RealTimeConstant.DEMO_FREQUENCY_CHANNEL_ID, onMessageListener);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user