|
|
|
|
@ -25,21 +25,73 @@ import 'commonFun.dart';
|
|
|
|
|
// horizonSpeed 说明:横向位移速度
|
|
|
|
|
// verticalSpeed说明:垂直位移速度
|
|
|
|
|
// zoomSpeed说明:变焦速度
|
|
|
|
|
|
|
|
|
|
// 区县球机方向控制接口:
|
|
|
|
|
// 通过http协议向服务器发送POST数据,数据格式如下:
|
|
|
|
|
// http://125.64.218.67:9914/?type=publish&dwip=172.16.3.21&topic=camera&dataType=PTZ&cmdCode=23&to=456&speed=40
|
|
|
|
|
//
|
|
|
|
|
// -----------------------------------------------
|
|
|
|
|
// 云台控制代码:
|
|
|
|
|
// 1:停止动作
|
|
|
|
|
// 3:启动雨刷
|
|
|
|
|
// 11:焦距变大
|
|
|
|
|
// 12:焦距变小
|
|
|
|
|
// 21:上移
|
|
|
|
|
// 22:下移
|
|
|
|
|
// 23:左移
|
|
|
|
|
// 24:右移
|
|
|
|
|
// 25:左上移动
|
|
|
|
|
// 26:右上移动
|
|
|
|
|
// 27:左下移动
|
|
|
|
|
// 28:右下移动
|
|
|
|
|
Future setSphericalCameraDio(
|
|
|
|
|
{@required int id,
|
|
|
|
|
@required String dwip,
|
|
|
|
|
@required int cmdCode,
|
|
|
|
|
int horizonSpeed = 120,
|
|
|
|
|
int verticalSpeed = 120,
|
|
|
|
|
int zoomSpeed = 120}) async {
|
|
|
|
|
String move_type = "publish",
|
|
|
|
|
String topic_type = "camera",
|
|
|
|
|
String data_type = "PTZ",
|
|
|
|
|
// int horizonSpeed = 120,
|
|
|
|
|
// int verticalSpeed = 120,
|
|
|
|
|
// int zoomSpeed = 120}) async {
|
|
|
|
|
int speed = 120}) async {
|
|
|
|
|
// ---------------------------------------------------
|
|
|
|
|
// 参数说明:
|
|
|
|
|
// type:动作类型,publish表示向设备发送指令
|
|
|
|
|
// dwip:点位IP,向哪个点位的设备发送指令
|
|
|
|
|
// topic:设备主题类型,camera表示向球机设备发送
|
|
|
|
|
// dataType:控制类型,PTZ表示控制球机云台
|
|
|
|
|
// cmdCode:球机云台的控制代码,整数,如21表示上,22表示下,详情见下方
|
|
|
|
|
// to:客户端ID,暂不用,输入任意整数即可
|
|
|
|
|
// speed:暂不用,输入任意整数即可
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------
|
|
|
|
|
// http://125.64.218.67:9914/?
|
|
|
|
|
// type=publish&
|
|
|
|
|
// dwip=172.16.3.21&
|
|
|
|
|
// topic=camera&
|
|
|
|
|
// dataType=PTZ&
|
|
|
|
|
// cmdCode=23&
|
|
|
|
|
// to=456&
|
|
|
|
|
// speed=40
|
|
|
|
|
Map map = {
|
|
|
|
|
"type": move_type,
|
|
|
|
|
"dwip": dwip,
|
|
|
|
|
"topic": topic_type,
|
|
|
|
|
"dataType": data_type,
|
|
|
|
|
"cmdCode": cmdCode.toString(),
|
|
|
|
|
"horizonSpeed": horizonSpeed.toString(),
|
|
|
|
|
"verticalSpeed": verticalSpeed.toString(),
|
|
|
|
|
"zoomSpeed": zoomSpeed.toString(),
|
|
|
|
|
"to": id.toString(),
|
|
|
|
|
"speed": speed.toString(),
|
|
|
|
|
// "horizonSpeed": horizonSpeed.toString(),
|
|
|
|
|
// "verticalSpeed": verticalSpeed.toString(),
|
|
|
|
|
// "zoomSpeed": zoomSpeed.toString(),
|
|
|
|
|
};
|
|
|
|
|
var api = getSphericalCameraApi(id, map);
|
|
|
|
|
var api = getSphericalCameraApi(map);
|
|
|
|
|
print('api = ${api}');
|
|
|
|
|
//I/flutter (28351): api = http://125.64.218.67:9906/api/ptz/34020000001320001016/34020000001320001016?cmdCode=8&horizonSpeed=60&verticalSpeed=60&zoomSpeed=60
|
|
|
|
|
// api =
|
|
|
|
|
// OK: http://125.64.218.67:9914/?type=publish&dwip=172.16.3.21&topic=topic&dataType=dataType&cmdCode=21&to=1&speed=120
|
|
|
|
|
// bug01: http://125.64.218.67:9914/?type=publish&dwip=172.16.3.21&topic=camera&dataType=PTZ&cmdCode=23&to=456&speed=40
|
|
|
|
|
// api = http://125.64.218.67:9914/?type=publish&dwip=172.16.3.21&topic=camera&dataType=PTZ&cmdCode=21&to=1&speed=120
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
print('开始处理网络请求...');
|
|
|
|
|
@ -55,16 +107,16 @@ Future setSphericalCameraDio(
|
|
|
|
|
print('${api} 球机移动网络请求过程正常完成');
|
|
|
|
|
|
|
|
|
|
///处理球机停止移动
|
|
|
|
|
map["cmdCode"] = '0';
|
|
|
|
|
api = getSphericalCameraApi(id, map);
|
|
|
|
|
print('api = ${api}');
|
|
|
|
|
//I/flutter (28351): api = http://125.64.218.67:9906/api/ptz/34020000001320001016/34020000001320001016?cmdCode=0&horizonSpeed=60&verticalSpeed=60&zoomSpeed=60
|
|
|
|
|
|
|
|
|
|
response = await dio.post(api);
|
|
|
|
|
print('response = ${response.toString()}');
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
|
print('${api} 球机停止移动网络请求过程正常完成');
|
|
|
|
|
}
|
|
|
|
|
// map["cmdCode"] = '0';
|
|
|
|
|
// api = getSphericalCameraApi(map);
|
|
|
|
|
// print('api = ${api}');
|
|
|
|
|
// //I/flutter (28351): api = http://125.64.218.67:9906/api/ptz/34020000001320001016/34020000001320001016?cmdCode=0&horizonSpeed=60&verticalSpeed=60&zoomSpeed=60
|
|
|
|
|
//
|
|
|
|
|
// response = await dio.post(api);
|
|
|
|
|
// print('response = ${response.toString()}');
|
|
|
|
|
// if (response.statusCode == 200) {
|
|
|
|
|
// print('${api} 球机停止移动网络请求过程正常完成');
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
throw Exception('${api} 后端接口出现异常,请检测代码和服务器情况.........');
|
|
|
|
|
}
|
|
|
|
|
@ -84,16 +136,35 @@ Future setSphericalCameraDio(
|
|
|
|
|
// zoomSpeed:60
|
|
|
|
|
// 上述调用可以一次性书写为:
|
|
|
|
|
// http://125.64.218.67:9906/api/ptz/34020000001320002016/34020000001320002016?cmdCode=8&horizonSpeed=60&verticalSpeed=60&zoomSpeed=60
|
|
|
|
|
String getSphericalCameraApi(int id, Map map) {
|
|
|
|
|
var api = ServicePath.setSphericalCameraUrl +
|
|
|
|
|
getSphericalCameraID(id) +
|
|
|
|
|
'/' +
|
|
|
|
|
getSphericalCameraID(id) +
|
|
|
|
|
'?';
|
|
|
|
|
// String getSphericalCameraApi(int id, Map map) {
|
|
|
|
|
// // var api = ServicePath.setSphericalCameraUrl +
|
|
|
|
|
// var api = setSphericalCameraUrl + getSphericalCameraID(id) + '/' + getSphericalCameraID(id) + '?';
|
|
|
|
|
// map.forEach((key, value) {
|
|
|
|
|
// //print("$key : $value");
|
|
|
|
|
// api += (key + '=' + value + '&');
|
|
|
|
|
// });
|
|
|
|
|
// api = api.substring(0, api.length - 1); // 删除末尾字符
|
|
|
|
|
//
|
|
|
|
|
// return api;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 兴文县:
|
|
|
|
|
String getSphericalCameraApi(Map map) {
|
|
|
|
|
// Map map = {
|
|
|
|
|
// "type": move_type,
|
|
|
|
|
// "dwip": dwip,
|
|
|
|
|
// "topic": topic_type,
|
|
|
|
|
// "dataType": data_type,
|
|
|
|
|
// "cmdCode": cmdCode.toString(),
|
|
|
|
|
// "to": id.toString(),
|
|
|
|
|
// "speed": speed,
|
|
|
|
|
// };
|
|
|
|
|
// http://125.64.218.67:9914/?type=publish&dwip=172.16.3.21&topic=camera&dataType=PTZ&cmdCode=23&to=456&speed=40
|
|
|
|
|
var api = setSphericalCameraUrl + '?';
|
|
|
|
|
map.forEach((key, value) {
|
|
|
|
|
//print("$key : $value");
|
|
|
|
|
api += (key + '=' + value + '&');
|
|
|
|
|
// E/flutter (23744): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: type 'int' is not a subtype of type 'String' of 'other'
|
|
|
|
|
});
|
|
|
|
|
api = api.substring(0, api.length - 1); // 删除末尾字符
|
|
|
|
|
|
|
|
|
|
@ -1951,6 +2022,7 @@ Future playUrl({@required int index, String url, BuildContext context}) {
|
|
|
|
|
var ret = Navigator.of(context).push(MaterialPageRoute(
|
|
|
|
|
builder: (context) => SuperPlayerPage(
|
|
|
|
|
id: index + 1,
|
|
|
|
|
dwip: listDwinfoGetList2[index]['dwip'],
|
|
|
|
|
url: urlnew,
|
|
|
|
|
title: '点位视频\n${(index + 1)}、${listDwinfoGetList2[index]['dwmc']}',
|
|
|
|
|
)));
|
|
|
|
|
|