[Change] 增加了对定位上报及Socket的日志输出控制
This commit is contained in:
@@ -36,9 +36,6 @@ dependencies {
|
||||
// socket-for-internal 长链 内部SDK版本
|
||||
implementation 'com.zhidao.socketsdk:socketsdk:2.1.4'
|
||||
|
||||
// 上报位置 http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48956200
|
||||
implementation 'com.zhidao.locupload:loc-upload-sdk:1.2.0'
|
||||
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation "com.mogo.cloud:passport:${MOGO_PASSPORT_VERSION}"
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.mogo.cloud.socket.third.core.CallbackManager;
|
||||
import com.mogo.cloud.socket.third.core.ConnectionLifecycleListener;
|
||||
import com.mogo.cloud.socket.third.core.SocketClient;
|
||||
import com.mogo.cloud.socket.third.core.SocketConfig;
|
||||
import com.zhidao.locupload.Platform;
|
||||
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
|
||||
|
||||
public class ThirdSocketManager implements Callback {
|
||||
@@ -47,7 +46,7 @@ public class ThirdSocketManager implements Callback {
|
||||
SocketConfig.instance()
|
||||
.setAppContext(context.getApplicationContext())
|
||||
.setEnvironment(getEnvironment())
|
||||
.setClient(Platform.getClient(Platform.car))
|
||||
.setClient(MogoCommon.Client.car)
|
||||
.setChannelId(SocketServicesConstants.SOCKET_CHANNEL_ID)
|
||||
.setOpenAnalytics(true)
|
||||
.setSn(cloudClientConfig.getSn())
|
||||
|
||||
@@ -166,8 +166,8 @@ public class ClientSocketManager {
|
||||
}
|
||||
onConnectSuccess(future1.channel());
|
||||
} else {
|
||||
Logger.i(SocketConstants.TAG, "Client---connecting server fails,失败重试");
|
||||
Logger.i(SocketConstants.TAG, future1.cause().getMessage());
|
||||
Logger.e(SocketConstants.TAG, "Client---connecting server fails,失败重试");
|
||||
Logger.e(SocketConstants.TAG, future1.cause().getMessage());
|
||||
onConnectFailure();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.text.TextUtils;
|
||||
|
||||
import com.elegant.log.simplelog.Logger;
|
||||
import com.mogo.cloud.passport.utils.DevicesUtils;
|
||||
import com.mogo.cloud.socket.SocketBuildConfig;
|
||||
import com.mogo.cloud.socket.third.core.SocketConfig;
|
||||
import com.mogo.cloud.socket.third.core.SocketConstants;
|
||||
import com.mogo.cloud.socket.third.core.client.ClientSocketManager;
|
||||
@@ -23,23 +24,31 @@ public final class RequestUtil {
|
||||
}
|
||||
|
||||
private static boolean checkNotNull(Channel channel) {
|
||||
Logger.i(SocketConstants.TAG, channel == null ? "checkNotNull(channel), channel is null." : "checkNotNull(channel), channel is not null.");
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.i(SocketConstants.TAG, channel == null ? "checkNotNull(channel), channel is null." : "checkNotNull(channel), channel is not null.");
|
||||
}
|
||||
boolean isLogin = LoginStatusUtil.isLogin() && ClientSocketManager.getInstance().isConnected();
|
||||
Logger.i(SocketConstants.TAG, "socket connected is :" + isLogin);
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.i(SocketConstants.TAG, "socket connected is :" + isLogin);
|
||||
}
|
||||
return channel != null;
|
||||
}
|
||||
|
||||
public static void login(Channel channel) {
|
||||
if (checkNotNull(channel)) {
|
||||
channel.writeAndFlush(RequestModelUtil.buildAuthRequest());
|
||||
Logger.i(SocketConstants.TAG, "requestAuth");
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.i(SocketConstants.TAG, "requestAuth");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ack(Channel channel, byte[] data) {
|
||||
if (checkNotNull(channel)) {
|
||||
channel.writeAndFlush(data);
|
||||
Logger.i(SocketConstants.TAG, "ack");
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.i(SocketConstants.TAG, "ack");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,21 +56,27 @@ public final class RequestUtil {
|
||||
Channel channel = ClientSocketManager.getInstance().getChannel();
|
||||
if (checkNotNull(channel)) {
|
||||
channel.writeAndFlush(RequestModelUtil.buildEncodeInfo(key));
|
||||
Logger.i(SocketConstants.TAG, "checkAuth");
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.i(SocketConstants.TAG, "checkAuth");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendHeartbeat(Channel channel) {
|
||||
if (checkNotNull(channel)) {
|
||||
channel.writeAndFlush(RequestModelUtil.buildHeartbeat());
|
||||
Logger.i(SocketConstants.TAG, "send heartbeat");
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.i(SocketConstants.TAG, "send heartbeat");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendUserInfo(Channel channel) {
|
||||
if (checkNotNull(channel)) {
|
||||
channel.writeAndFlush(RequestModelUtil.buildUserInfo());
|
||||
Logger.i(SocketConstants.TAG, "send user info");
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.i(SocketConstants.TAG, "send user info");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +87,9 @@ public final class RequestUtil {
|
||||
final Channel channel = ClientSocketManager.getInstance().getChannel();
|
||||
if (checkNotNull(channel)) {
|
||||
channel.writeAndFlush(RequestModelUtil.buildPayloadData(productLine, appId, payload, headerType, ack, msgId));
|
||||
Logger.i(SocketConstants.TAG, "send---> appId is: " + appId + "; headerType is: " + headerType+ "; msgId is: " + msgId);
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.i(SocketConstants.TAG, "send---> appId is: " + appId + "; headerType is: " + headerType + "; msgId is: " + msgId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +121,9 @@ public final class RequestUtil {
|
||||
if (TextUtils.isEmpty(appId)) {
|
||||
appId = "unknown";
|
||||
}
|
||||
Logger.i(SocketConstants.TAG, "socket app id is " + appId + ", msg type is " + msgType);
|
||||
if (SocketBuildConfig.isPrintLog) {
|
||||
Logger.i(SocketConstants.TAG, "socket app id is " + appId + ", msg type is " + msgType);
|
||||
}
|
||||
|
||||
return buildHeader(appId, 0, msgType, false, 0);
|
||||
}
|
||||
|
||||
@@ -36,22 +36,22 @@ PASSWORD=xintai2018
|
||||
RELEASE=true
|
||||
# AI CLOUD 云平台
|
||||
# 工具类
|
||||
MOGO_UTILS_VERSION=1.3.14
|
||||
MOGO_UTILS_VERSION=1.3.15
|
||||
# 网络请求
|
||||
MOGO_NETWORK_VERSION=1.3.14
|
||||
MOGO_NETWORK_VERSION=1.3.15
|
||||
# 网络DNS
|
||||
MOGO_HTTPDNS_VERSION=1.3.14
|
||||
MOGO_HTTPDNS_VERSION=1.3.15
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.3.14
|
||||
MOGO_PASSPORT_VERSION=1.3.15
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.3.14
|
||||
MOGO_SOCKET_VERSION=1.3.15
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.3.14
|
||||
MOGO_REALTIME_VERSION=1.3.15
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.3.14
|
||||
MOGO_TANLU_VERSION=1.3.15
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.3.14
|
||||
MOGO_LIVE_VERSION=1.3.15
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.3.14
|
||||
MOGO_TRAFFICLIVE_VERSION=1.3.15
|
||||
# 定位服务
|
||||
MOGO_LOCATION_VERSION=1.3.14
|
||||
MOGO_LOCATION_VERSION=1.3.15
|
||||
|
||||
Reference in New Issue
Block a user