add log
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package com.mogo.cloud.socket;
|
||||
|
||||
|
||||
import static com.mogo.cloud.socket.SocketServicesConstants.getTag;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.mogo.cloud.GsonUtil;
|
||||
@@ -22,10 +26,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static com.mogo.cloud.socket.SocketServicesConstants.TAG;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
|
||||
/**
|
||||
* Socket 长链核心服务
|
||||
@@ -84,7 +84,7 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
return;
|
||||
}
|
||||
if (mListeners.containsKey(msgType)) {
|
||||
Logger.w(TAG, "msgType %d is exist.", msgType);
|
||||
Logger.w(getTag(), "msgType %d is exist.", msgType);
|
||||
return;
|
||||
}
|
||||
if (!mListeners.containsKey(msgType)) {
|
||||
@@ -123,7 +123,7 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
|
||||
@Override
|
||||
public void sendMsg(String appId, int headerType, MsgBody body, IMogoCloudSocketMsgAckListener listener) {
|
||||
Logger.d(TAG, "sendMsg msgId : " + body.getMsgId());
|
||||
Logger.d(getTag(), "sendMsg msgId : " + body.getMsgId());
|
||||
final byte[] pb = convertToPBBytes(body.getMsgType(), body.getContent());
|
||||
if (cloudClientConfig.isThirdLogin()) {
|
||||
ThirdSocketManager.getInstance().sendMsg(appId, pb, headerType, true, body.getMsgId());
|
||||
@@ -137,7 +137,7 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
try {
|
||||
MogoConnsvr.Payload payload = MogoConnsvr.Payload.parseFrom(message);
|
||||
int msgType = payload.getMsgType();
|
||||
Logger.d(TAG, "received msg type = %d", msgType);
|
||||
Logger.d(getTag(), "received msg type = %d", msgType);
|
||||
List<IMogoCloudSocketOnMessageListener> listeners = mListeners.get(msgType);
|
||||
if (listeners != null && !listeners.isEmpty()) {
|
||||
Iterator<IMogoCloudSocketOnMessageListener> iterator = listeners.iterator();
|
||||
@@ -159,13 +159,13 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
}
|
||||
}
|
||||
if (listener != null) {
|
||||
Logger.d(TAG, "received msgId = %s, content = %s", msgId, payload.getPayload().toStringUtf8());
|
||||
Logger.d(getTag(), "received msgId = %s, content = %s", msgId, payload.getPayload().toStringUtf8());
|
||||
listener.onMsgReceived(msgType, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
Logger.e(TAG, e, "parse msg error.");
|
||||
Logger.e(getTag(), e, "parse msg error.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
if (listener != null) {
|
||||
listener.onAck(msgId);
|
||||
}
|
||||
Logger.d(TAG, "send message success: msgId = %d msgType = %d, appId = %s, productLine = %d", msgId, msgType, appId, productLine);
|
||||
Logger.d(getTag(), "send message success: msgId = %d msgType = %d, appId = %s, productLine = %d", msgId, msgType, appId, productLine);
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
package com.mogo.cloud.socket;
|
||||
|
||||
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.socket.third.core.Environment;
|
||||
|
||||
import static com.mogo.cloud.httpdns.MogoHttpDnsConfig.HTTP_DNS_ENV_DEV;
|
||||
import static com.mogo.cloud.httpdns.MogoHttpDnsConfig.HTTP_DNS_ENV_QA;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.socket.third.core.Environment;
|
||||
|
||||
public class SocketServicesConstants {
|
||||
|
||||
public static final String TAG = "MoGoAiCloud_Socket";
|
||||
public static String getTag() {
|
||||
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isUseOriginSocket()) {
|
||||
return "MoGoAiCloud_Origin_Socket";
|
||||
} else {
|
||||
return "MoGoAiCloud_New_Socket";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 建立长链的通道ID
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.mogo.cloud.socket.internal;
|
||||
|
||||
|
||||
import static com.mogo.cloud.socket.SocketServicesConstants.getTag;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -14,7 +16,6 @@ import com.zhidao.socketsdk.manager.OnSocketReceiveCallback;
|
||||
import com.zhidao.socketsdk.manager.SocketConnManager;
|
||||
import com.zhidao.socketsdk.manager.SocketConnManagerImpl;
|
||||
|
||||
import static com.mogo.cloud.socket.SocketServicesConstants.TAG;
|
||||
|
||||
public class InternalSocketManager implements OnSocketReceiveCallback, OnSocketAckCallback {
|
||||
|
||||
@@ -45,7 +46,7 @@ public class InternalSocketManager implements OnSocketReceiveCallback, OnSocketA
|
||||
mSocketConnManager.addSocketAckCallback(this);
|
||||
String appId = cloudClientConfig.getServiceAppId();
|
||||
if (TextUtils.isEmpty(appId)) {
|
||||
Logger.e(TAG, "需要初始化 Socket AppId");
|
||||
Logger.e(getTag(), "需要初始化 Socket AppId");
|
||||
return;
|
||||
}
|
||||
mSocketConnManager.init(appId);
|
||||
@@ -53,22 +54,22 @@ public class InternalSocketManager implements OnSocketReceiveCallback, OnSocketA
|
||||
|
||||
@Override
|
||||
public void onAck(byte[] headerBytes, byte[] payload) {
|
||||
Logger.d(TAG, "InternalSocketManager update ack");
|
||||
Logger.d(getTag(), "InternalSocketManager update ack");
|
||||
SocketManager.getInstance().onAck(headerBytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(byte[] message) {
|
||||
Logger.d(TAG, "InternalSocketManager update message");
|
||||
Logger.d(getTag(), "InternalSocketManager update message");
|
||||
SocketManager.getInstance().update(message, 0);
|
||||
}
|
||||
|
||||
public void sendMsg(byte[] pb, int headerType, boolean isAck, long msgId) {
|
||||
if (mSocketConnManager.isConnected()) {
|
||||
Logger.d(TAG, "isConnected.");
|
||||
Logger.d(getTag(), "isConnected.");
|
||||
mSocketConnManager.sendPayload(MSG_PRODUCT_LINE, pb, headerType, isAck, msgId);
|
||||
} else {
|
||||
Logger.e(TAG, "sendMsg error, connect is lost.");
|
||||
Logger.e(getTag(), "sendMsg error, connect is lost.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package com.mogo.cloud.socket.third;
|
||||
|
||||
import static com.mogo.cloud.socket.SocketServicesConstants.SOCKET_CHANNEL_ID;
|
||||
import static com.mogo.cloud.socket.SocketServicesConstants.getEnvironment;
|
||||
import static com.mogo.cloud.socket.SocketServicesConstants.getTag;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.socket.SocketManager;
|
||||
@@ -15,12 +21,6 @@ import com.mogo.cloud.utils.logger.Logger;
|
||||
import com.zhidao.locupload.Platform;
|
||||
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
|
||||
|
||||
import static com.mogo.cloud.socket.SocketServicesConstants.SOCKET_CHANNEL_ID;
|
||||
import static com.mogo.cloud.socket.SocketServicesConstants.TAG;
|
||||
import static com.mogo.cloud.socket.SocketServicesConstants.getEnvironment;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class ThirdSocketManager implements Callback {
|
||||
|
||||
private static volatile ThirdSocketManager mInstance;
|
||||
@@ -59,13 +59,13 @@ public class ThirdSocketManager implements Callback {
|
||||
|
||||
@Override
|
||||
public void update(@NonNull CallbackManager manager, @NonNull byte[] message, String appId, long msgId) {
|
||||
Logger.d(TAG,"ThirdSocketManager update message");
|
||||
Logger.d(getTag(), "ThirdSocketManager update message");
|
||||
SocketManager.getInstance().update(message, msgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAck(@NonNull CallbackManager manager, @NonNull byte[] header, byte[] content) {
|
||||
Logger.d(TAG,"ThirdSocketManager update ack");
|
||||
Logger.d(getTag(), "ThirdSocketManager update ack");
|
||||
SocketManager.getInstance().onAck(header);
|
||||
}
|
||||
|
||||
@@ -83,11 +83,11 @@ public class ThirdSocketManager implements Callback {
|
||||
mInstance = null;
|
||||
}
|
||||
|
||||
public void registerSocketConnCallback(ConnectionLifecycleListener listener){
|
||||
public void registerSocketConnCallback(ConnectionLifecycleListener listener) {
|
||||
SocketClient.getInstance().registerSocketConnCallback(listener);
|
||||
}
|
||||
|
||||
public void unregisterSocketConnCallback(ConnectionLifecycleListener listener){
|
||||
public void unregisterSocketConnCallback(ConnectionLifecycleListener listener) {
|
||||
SocketClient.getInstance().unregisterSocketConnCallback(listener);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,22 +36,22 @@ PASSWORD=xintai2018
|
||||
RELEASE=true
|
||||
# AI CLOUD 云平台
|
||||
# 工具类
|
||||
MOGO_UTILS_VERSION=1.2.8
|
||||
MOGO_UTILS_VERSION=1.2.9
|
||||
# 网络请求
|
||||
MOGO_NETWORK_VERSION=1.2.8
|
||||
MOGO_NETWORK_VERSION=1.2.9
|
||||
# 网络DNS
|
||||
MOGO_HTTPDNS_VERSION=1.2.8
|
||||
MOGO_HTTPDNS_VERSION=1.2.9
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.2.8
|
||||
MOGO_PASSPORT_VERSION=1.2.9
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.2.8
|
||||
MOGO_SOCKET_VERSION=1.2.9
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.2.8
|
||||
MOGO_REALTIME_VERSION=1.2.9
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.2.8
|
||||
MOGO_TANLU_VERSION=1.2.9
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.2.8
|
||||
MOGO_LIVE_VERSION=1.2.9
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.2.8
|
||||
MOGO_TRAFFICLIVE_VERSION=1.2.9
|
||||
# 定位服务
|
||||
MOGO_LOCATION_VERSION=1.2.8
|
||||
MOGO_LOCATION_VERSION=1.2.9
|
||||
|
||||
Reference in New Issue
Block a user