add func of test live

This commit is contained in:
zhongchao
2021-04-02 14:21:34 +08:00
parent 83252f79f5
commit 1ebe232114
7 changed files with 88 additions and 20 deletions

View File

@@ -30,7 +30,7 @@
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="date" />
<option name="myAdditionalJavadocTags" value="date,brief" />
</inspection_tool>
</profile>
</component>

View File

@@ -10,9 +10,14 @@ import android.widget.TextView;
import com.mogo.cloud.network.NetworkActivity;
import com.mogo.cloud.passport.IMoGoTokenCallback;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.cloud.trafficlive.api.ITrafficIntersectionLiveCallBack;
import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive;
import com.mogo.cloud.utils.logger.Logger;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private Button btnJumpPassPort;
private Button btnJumpConfigInfo;
private Button btnJumpNetWorkPort;
@@ -21,6 +26,7 @@ public class MainActivity extends AppCompatActivity {
private Button btnJumpLivePlayAndPush;
private Button btnJumpLivePush;
private Button btnJumpLivePlay;
private Button btnRequestXINGLive;
private TextView tvSn;
private TextView tvToken;
@@ -84,6 +90,21 @@ public class MainActivity extends AppCompatActivity {
startActivity(intent);
});
btnRequestXINGLive = findViewById(R.id.btnRequestXINGLive);
btnRequestXINGLive.setOnClickListener(v -> {
MoGoAiCloudTrafficLive.viewFrontIntersectionLive(40.11547, 116.22544, 60, new ITrafficIntersectionLiveCallBack() {
@Override
public void liveUrlResult(String liveUrl) {
Logger.d(TAG, "liveUrl : " + liveUrl);
}
@Override
public void onError(String errorMsg) {
Logger.e(TAG, "errorMsg : " + errorMsg);
}
});
});
MoGoAiCloudClient.getInstance().addTokenCallbacks(new IMoGoTokenCallback() {
@Override
public void onTokenGot(String token, String sn) {

View File

@@ -91,6 +91,13 @@
android:layout_height="match_parent"
android:text="直播SDK观看测试"
android:visibility="visible" />
<Button
android:id="@+id/btnRequestXINGLive"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="查看路口直播Url请求"
android:visibility="visible" />
</LinearLayout>
</ScrollView>

View File

@@ -4,6 +4,7 @@ import com.google.gson.Gson;
import com.mogo.cloud.live.constant.LiveConstant;
import com.mogo.cloud.live.listener.IRequestLiveListener;
import com.mogo.cloud.live.model.BaseData;
import com.mogo.cloud.live.model.LiveCameraPush;
import com.mogo.cloud.live.model.LivePush;
import com.mogo.cloud.live.model.LiveReceive;
import com.mogo.cloud.live.network.LiveApiServer;
@@ -196,10 +197,18 @@ public class RequestLiveManager {
});
}
/**
* 请求服务器查看特定设备路口直播
*
* @param cameraId 设备id
* @param lat 纬度
* @param lon 经度
* @param requestLiveListener {@link IRequestLiveListener}
*/
public void requestDesignativeIntersectionLive(int cameraId, double lat, double lon, IRequestLiveListener requestLiveListener) {
Gson gson = new Gson();
String sn = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
LivePush livePush = new LivePush(cameraId, lat, lon);
LiveCameraPush livePush = new LiveCameraPush(cameraId, lat, lon);
Map<String, String> map = new HashMap<>();
map.put("sn", sn);
map.put("data", gson.toJson(livePush));

View File

@@ -0,0 +1,47 @@
package com.mogo.cloud.live.model;
public class LiveCameraPush {
private int id; //摄像头id
private double lat; //纬度
private double lon; //经度
public LiveCameraPush(int id, double lat, double lon) {
this.id = id;
this.lat = lat;
this.lon = lon;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
@Override
public String toString() {
return "LiveCameraPush{" +
"id=" + id +
", lat=" + lat +
", lon=" + lon +
'}';
}
}

View File

@@ -5,7 +5,6 @@ package com.mogo.cloud.live.model;
*/
public class LivePush {
private int id; //路口摄像头id
private String sn; //直播车机sn
private String type; //直播类型 0开启直播 1关闭直播
private String videoChannel; //C_1 前摄
@@ -13,12 +12,6 @@ public class LivePush {
private double lon; //本机经度
private int bearing; //本机方向角
public LivePush(int id, double lat, double lon) {
this.id = id;
this.lat = lat;
this.lon = lon;
}
public LivePush(String sn, String type, String videoChannel) {
this.sn = sn;
this.type = type;
@@ -40,14 +33,6 @@ public class LivePush {
this.bearing = bearing;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSn() {
return sn;
}
@@ -99,8 +84,7 @@ public class LivePush {
@Override
public String toString() {
return "LivePush{" +
"id=" + id +
", sn='" + sn + '\'' +
"sn='" + sn + '\'' +
", type='" + type + '\'' +
", videoChannel='" + videoChannel + '\'' +
", lat=" + lat +

View File

@@ -27,7 +27,7 @@ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/
USERNAME=xintai
PASSWORD=xintai2018
# 编译模式: false - 依赖本地版本, true - 依赖 maven 版本
RELEASE=true
RELEASE=false
# AI CLOUD 云平台
# 工具类
MOGO_UTILS_VERSION=1.0.61