change the logic of socket service and stop the uploadService,but tanlu version can not upgrade
This commit is contained in:
@@ -2,6 +2,8 @@ package com.mogo.cloud.socket;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.socket.entity.MsgBody;
|
||||
|
||||
|
||||
/**
|
||||
* socket 长链
|
||||
|
||||
@@ -6,9 +6,10 @@ import android.support.annotation.NonNull;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.mogo.cloud.GsonUtil;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.socket.entity.MsgBody;
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.cloud.socket.internal.InternalSocketManager;
|
||||
import com.mogo.cloud.socket.third.ThirdSocketManager;
|
||||
import com.mogo.cloud.utils.logger.Logger;
|
||||
@@ -129,15 +130,15 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
}
|
||||
cacheLastReceivedMsgId(msgId);
|
||||
}
|
||||
Object object = null;
|
||||
SocketDownData.SocketDownDataProto proto3 = null;
|
||||
while (iterator.hasNext()) {
|
||||
IMogoCloudSocketOnMessageListener listener = iterator.next();
|
||||
if (object == null) {
|
||||
object = GsonUtil.objectFromJson(payload.getPayload().toStringUtf8(), listener.target(msgType));
|
||||
if (payload.getPayload() != null) {
|
||||
proto3 = SocketDownData.SocketDownDataProto.parseFrom(payload.getPayload());
|
||||
}
|
||||
if (listener != null) {
|
||||
Logger.d(TAG, "received msgId = %s, content = %s", msgId, payload.getPayload().toStringUtf8());
|
||||
listener.onMsgReceived(msgType, object);
|
||||
listener.onMsgReceived(msgType, proto3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mogo.cloud.socket;
|
||||
/**
|
||||
* 长链通道上传、下发业务消息类型
|
||||
*/
|
||||
public enum WebSocketMsgType {
|
||||
public enum SocketMsgType {
|
||||
|
||||
MSG_TYPE_UPLINK_CAR_DATA(0,"自车与ADAS数据"),
|
||||
MSG_TYPE_DOWNLINK_CAR_DATA(1,"服务端下发车辆信息"),
|
||||
@@ -12,7 +12,7 @@ public enum WebSocketMsgType {
|
||||
private int msgType;
|
||||
private String msg;
|
||||
|
||||
WebSocketMsgType(int msgType, String msg) {
|
||||
SocketMsgType(int msgType, String msg) {
|
||||
this.msgType = msgType;
|
||||
this.msg = msg;
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.mogo.cloud.socket;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* AI云平台 长链业务数据包装体对象
|
||||
*/
|
||||
public class WebSocketData implements Serializable {
|
||||
|
||||
private long seq;
|
||||
|
||||
private int msgType;
|
||||
|
||||
private String sn;
|
||||
|
||||
private String data;
|
||||
|
||||
private long utcTime;
|
||||
|
||||
private long upUtcTime;
|
||||
|
||||
private String cityCode;
|
||||
|
||||
public long getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
public void setSeq(long seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public int getMsgType() {
|
||||
return msgType;
|
||||
}
|
||||
|
||||
public void setMsgType(int msgType) {
|
||||
this.msgType = msgType;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public long getUtcTime() {
|
||||
return utcTime;
|
||||
}
|
||||
|
||||
public void setUtcTime(long utcTime) {
|
||||
this.utcTime = utcTime;
|
||||
}
|
||||
|
||||
public long getUpUtcTime() {
|
||||
return upUtcTime;
|
||||
}
|
||||
|
||||
public void setUpUtcTime(long upUtcTime) {
|
||||
this.upUtcTime = upUtcTime;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.socket;
|
||||
package com.mogo.cloud.socket.entity;
|
||||
|
||||
/**
|
||||
* AI云平台 长链消息数据包装体对象
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user