diff --git a/.idea/compiler.xml b/.idea/compiler.xml index fb7f4a8..61a9130 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index c4d70da..b57f1e7 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,17 +1,11 @@ - + -<<<<<<< HEAD - -======= - ->>>>>>> yingyan_location + diff --git a/gradle.properties b/gradle.properties index 1bc4a56..e4187c6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -30,22 +30,22 @@ PASSWORD=xintai2018 RELEASE=true # AI CLOUD 云平台 # 工具类 -MOGO_UTILS_VERSION=1.1.34 +MOGO_UTILS_VERSION=1.1.35 # 网络请求 -MOGO_NETWORK_VERSION=1.1.34 +MOGO_NETWORK_VERSION=1.1.35 # 网络DNS -MOGO_HTTPDNS_VERSION=1.1.34 +MOGO_HTTPDNS_VERSION=1.1.35 # 鉴权 -MOGO_PASSPORT_VERSION=1.1.34 +MOGO_PASSPORT_VERSION=1.1.35 # 常链接 -MOGO_SOCKET_VERSION=1.1.34 +MOGO_SOCKET_VERSION=1.1.35 # 数据采集 -MOGO_REALTIME_VERSION=1.1.34 +MOGO_REALTIME_VERSION=1.1.35 # 探路,道路事件发布,获取 -MOGO_TANLU_VERSION=1.1.34 +MOGO_TANLU_VERSION=1.1.35 # 直播推流 -MOGO_LIVE_VERSION=1.1.34 +MOGO_LIVE_VERSION=1.1.35 # 直播拉流 -MOGO_TRAFFICLIVE_VERSION=1.1.34 +MOGO_TRAFFICLIVE_VERSION=1.1.35 # 定位服务 -MOGO_LOCATION_VERSION=1.1.34 +MOGO_LOCATION_VERSION=1.1.35 diff --git a/modules/mogo-realtime/src/main/java/com/mogo/realtime/constant/RealTimeConstant.java b/modules/mogo-realtime/src/main/java/com/mogo/realtime/constant/RealTimeConstant.java index d67be1a..5fb6fdf 100644 --- a/modules/mogo-realtime/src/main/java/com/mogo/realtime/constant/RealTimeConstant.java +++ b/modules/mogo-realtime/src/main/java/com/mogo/realtime/constant/RealTimeConstant.java @@ -5,4 +5,7 @@ public class RealTimeConstant { public static final String TAG = "MoGoAiCloud_RealTime"; public static final int HIGH_FREQUENCY_CHANNEL_ID = 0x040002; //高频数据 public static final int LOW_FREQUENCY_CHANNEL_ID = 0x040003; //低频数据 + public static final int DEMO_FREQUENCY_CHANNEL_ID = 0x040004; //演示环境通道 + + } diff --git a/modules/mogo-realtime/src/main/java/com/mogo/realtime/core/SnapshotUploadInTime.java b/modules/mogo-realtime/src/main/java/com/mogo/realtime/core/SnapshotUploadInTime.java index fbb862e..bb2dae1 100644 --- a/modules/mogo-realtime/src/main/java/com/mogo/realtime/core/SnapshotUploadInTime.java +++ b/modules/mogo-realtime/src/main/java/com/mogo/realtime/core/SnapshotUploadInTime.java @@ -1,7 +1,10 @@ package com.mogo.realtime.core; +import static com.mogo.cloud.httpdns.MogoHttpDnsConfig.HTTP_DNS_ENV_DEMO; + import android.content.Context; +import com.mogo.cloud.passport.MoGoAiCloudClient; import com.mogo.cloud.socket.entity.MsgBody; import com.mogo.realtime.constant.RealTimeConstant; import com.mogo.realtime.entity.SocketReceiveDataProto3; @@ -61,9 +64,17 @@ public class SnapshotUploadInTime implements UploadInTimeHandler.IUploadInTimeLi RealTimeProviderImp.getInstance().getLocationMsg();//SPI接口返回 if (socketReceiveDataProto != null) { MsgBody msgBody = new MsgBody(); - msgBody.msgType(RealTimeConstant.HIGH_FREQUENCY_CHANNEL_ID); + msgBody.msgType(getMsgType()); msgBody.content(socketReceiveDataProto.toByteArray()); SocketHandler.getInstance().sendMsg(msgBody); } } + + private int getMsgType() { + if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getNetMode() == HTTP_DNS_ENV_DEMO) { + return RealTimeConstant.DEMO_FREQUENCY_CHANNEL_ID; + } else { + return RealTimeConstant.HIGH_FREQUENCY_CHANNEL_ID; + } + } } diff --git a/modules/mogo-realtime/src/main/java/com/mogo/realtime/socket/SocketHandler.java b/modules/mogo-realtime/src/main/java/com/mogo/realtime/socket/SocketHandler.java index 9ad7a05..1b5c35d 100644 --- a/modules/mogo-realtime/src/main/java/com/mogo/realtime/socket/SocketHandler.java +++ b/modules/mogo-realtime/src/main/java/com/mogo/realtime/socket/SocketHandler.java @@ -1,7 +1,12 @@ package com.mogo.realtime.socket; +import static com.mogo.cloud.httpdns.MogoHttpDnsConfig.HTTP_DNS_ENV_DEMO; +import static com.mogo.cloud.socket.SocketMsgType.MSG_TYPE_DOWNLINK_CAR_DATA; +import static com.mogo.realtime.constant.RealTimeConstant.TAG; + import android.content.Context; +import com.mogo.cloud.passport.MoGoAiCloudClient; import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener; import com.mogo.cloud.socket.SocketManager; import com.mogo.cloud.socket.entity.MsgBody; @@ -13,9 +18,6 @@ import com.zhidao.ptech.connsvr.protocol.MogoConnsvr; import java.util.ArrayList; import java.util.List; -import static com.mogo.cloud.socket.SocketMsgType.MSG_TYPE_DOWNLINK_CAR_DATA; -import static com.mogo.realtime.constant.RealTimeConstant.TAG; - /** * Socket长链 业务服务处理类 */ @@ -48,8 +50,12 @@ public class SocketHandler { public void initSocket(Context context, String appId) { mAppId = appId; SocketManager.getInstance().init(context); - SocketManager.getInstance().registerOnMessageListener(RealTimeConstant.HIGH_FREQUENCY_CHANNEL_ID, onMessageListener); - SocketManager.getInstance().registerOnMessageListener(RealTimeConstant.LOW_FREQUENCY_CHANNEL_ID, onMessageListener); + if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getNetMode() == HTTP_DNS_ENV_DEMO) { + SocketManager.getInstance().registerOnMessageListener(RealTimeConstant.DEMO_FREQUENCY_CHANNEL_ID, onMessageListener); + } else { + SocketManager.getInstance().registerOnMessageListener(RealTimeConstant.HIGH_FREQUENCY_CHANNEL_ID, onMessageListener); + SocketManager.getInstance().registerOnMessageListener(RealTimeConstant.LOW_FREQUENCY_CHANNEL_ID, onMessageListener); + } } public void registerOnMsgListener(IMogoCloudOnMsgListener onMsgListener) { @@ -102,8 +108,12 @@ public class SocketHandler { } public void stop() { - SocketManager.getInstance().unregisterOnMessageListener(RealTimeConstant.HIGH_FREQUENCY_CHANNEL_ID, onMessageListener); - SocketManager.getInstance().unregisterOnMessageListener(RealTimeConstant.LOW_FREQUENCY_CHANNEL_ID, onMessageListener); + if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getNetMode() == HTTP_DNS_ENV_DEMO) { + SocketManager.getInstance().unregisterOnMessageListener(RealTimeConstant.DEMO_FREQUENCY_CHANNEL_ID, onMessageListener); + } else { + SocketManager.getInstance().unregisterOnMessageListener(RealTimeConstant.HIGH_FREQUENCY_CHANNEL_ID, onMessageListener); + SocketManager.getInstance().unregisterOnMessageListener(RealTimeConstant.LOW_FREQUENCY_CHANNEL_ID, onMessageListener); + } SocketManager.getInstance().release(); onMsgListenerList.clear(); mInstance = null;