hyzp_ybqx-Commit054:已经初步实现球机上下方向控制

master
WinUser01 4 years ago
parent 2ebb6f9136
commit 8026e81ee4

@ -54,6 +54,12 @@ import 'UserInfo.dart';
const serviceUrl_ybqx = 'http://125.64.218.67:9909';
// http://125.64.218.67:9912/
const serviceUrl_ybqx_media = 'http://125.64.218.67:9912/';
//5
// http://125.64.218.67:9906/api/ptz/{ID}/{ID}
// static const String setSphericalCameraUrl = 'http://125.64.218.67:9906/api/ptz/'; //
//
// http://125.64.218.67:9914/?type=publish&dwip=172.16.3.21&topic=camera&dataType=PTZ&cmdCode=23&to=456&speed=40
const String setSphericalCameraUrl = 'http://125.64.218.67:9914/'; //
// 511502
// int qxdm = 511502;

@ -25,21 +25,73 @@ import 'commonFun.dart';
// horizonSpeed
// verticalSpeed
// zoomSpeed
//
// httpPOST
// 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 {
// ---------------------------------------------------
//
// typepublish
// dwipIP
// topiccamera
// dataTypePTZ
// cmdCode2122
// toID
// 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']}',
)));

@ -127,7 +127,7 @@ class ServicePath {
//5
// http://125.64.218.67:9906/api/ptz/{ID}/{ID}
static const String setSphericalCameraUrl = 'http://125.64.218.67:9906/api/ptz/'; //
// static const String setSphericalCameraUrl = 'http://125.64.218.67:9906/api/ptz/'; //
//6 Apk
// api = http://sctastech.com/download/index.html

@ -22,10 +22,12 @@ class SuperPlayerPage extends StatefulWidget {
SuperPlayerPage(
{@required this.url,
this.id = -2, // -2
this.dwip = '', // IP
this.loop = 1,
this.title = 'Tencent Player',
Key key})
: super(key: key);
String dwip;
String url;
String title;
int loop; //1 0
@ -284,44 +286,62 @@ class _SuperPlayerPageState extends State<SuperPlayerPage> with SuperPlayerListe
/// status == -1
/// status == 0
case 0:
setSphericalCameraDio(id: widget.id, cmdCode: 1);
setSphericalCameraDio(
id: widget.id, dwip: widget.dwip, cmdCode: 1);
break;
/// status == 1
case 1:
setSphericalCameraDio(id: widget.id, cmdCode: 9);
setSphericalCameraDio(
id: widget.id, dwip: widget.dwip, cmdCode: 9);
break;
///
// 8 4 2 1 10 6 9 5
// 131112
// 21
// 22
// 23
// 24
// 25
// 26
// 27
// 28
/// status == 2
case 2:
setSphericalCameraDio(id: widget.id, cmdCode: 8);
setSphericalCameraDio(
id: widget.id, dwip: widget.dwip, cmdCode: 21);
break;
/// status == 3
case 3:
setSphericalCameraDio(id: widget.id, cmdCode: 10);
setSphericalCameraDio(
id: widget.id, dwip: widget.dwip, cmdCode: 10);
break;
/// status == 4
case 4:
setSphericalCameraDio(id: widget.id, cmdCode: 2);
setSphericalCameraDio(
id: widget.id, dwip: widget.dwip, cmdCode: 2);
break;
/// status == 5
case 5:
setSphericalCameraDio(id: widget.id, cmdCode: 6);
setSphericalCameraDio(
id: widget.id, dwip: widget.dwip, cmdCode: 6);
break;
/// status == 6
case 6:
setSphericalCameraDio(id: widget.id, cmdCode: 4);
setSphericalCameraDio(
id: widget.id, dwip: widget.dwip, cmdCode: 22);
break;
/// status == 7
case 7:
setSphericalCameraDio(id: widget.id, cmdCode: 5);
setSphericalCameraDio(
id: widget.id, dwip: widget.dwip, cmdCode: 5);
break;
/// status == 8

Loading…
Cancel
Save