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'; const serviceUrl_ybqx = 'http://125.64.218.67:9909';
// http://125.64.218.67:9912/ // http://125.64.218.67:9912/
const serviceUrl_ybqx_media = '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 // 511502
// int qxdm = 511502; // int qxdm = 511502;

@ -25,21 +25,73 @@ import 'commonFun.dart';
// horizonSpeed // horizonSpeed
// verticalSpeed // verticalSpeed
// zoomSpeed // 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( Future setSphericalCameraDio(
{@required int id, {@required int id,
@required String dwip,
@required int cmdCode, @required int cmdCode,
int horizonSpeed = 120, String move_type = "publish",
int verticalSpeed = 120, String topic_type = "camera",
int zoomSpeed = 120}) async { 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 = { Map map = {
"type": move_type,
"dwip": dwip,
"topic": topic_type,
"dataType": data_type,
"cmdCode": cmdCode.toString(), "cmdCode": cmdCode.toString(),
"horizonSpeed": horizonSpeed.toString(), "to": id.toString(),
"verticalSpeed": verticalSpeed.toString(), "speed": speed.toString(),
"zoomSpeed": zoomSpeed.toString(), // "horizonSpeed": horizonSpeed.toString(),
// "verticalSpeed": verticalSpeed.toString(),
// "zoomSpeed": zoomSpeed.toString(),
}; };
var api = getSphericalCameraApi(id, map); var api = getSphericalCameraApi(map);
print('api = ${api}'); 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 { try {
print('开始处理网络请求...'); print('开始处理网络请求...');
@ -55,16 +107,16 @@ Future setSphericalCameraDio(
print('${api} 球机移动网络请求过程正常完成'); print('${api} 球机移动网络请求过程正常完成');
/// ///
map["cmdCode"] = '0'; // map["cmdCode"] = '0';
api = getSphericalCameraApi(id, map); // api = getSphericalCameraApi(map);
print('api = ${api}'); // 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 // //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); // response = await dio.post(api);
print('response = ${response.toString()}'); // print('response = ${response.toString()}');
if (response.statusCode == 200) { // if (response.statusCode == 200) {
print('${api} 球机停止移动网络请求过程正常完成'); // print('${api} 球机停止移动网络请求过程正常完成');
} // }
} else { } else {
throw Exception('${api} 后端接口出现异常,请检测代码和服务器情况.........'); throw Exception('${api} 后端接口出现异常,请检测代码和服务器情况.........');
} }
@ -84,16 +136,35 @@ Future setSphericalCameraDio(
// zoomSpeed:60 // zoomSpeed:60
// //
// http://125.64.218.67:9906/api/ptz/34020000001320002016/34020000001320002016?cmdCode=8&horizonSpeed=60&verticalSpeed=60&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) { // String getSphericalCameraApi(int id, Map map) {
var api = ServicePath.setSphericalCameraUrl + // // var api = ServicePath.setSphericalCameraUrl +
getSphericalCameraID(id) + // var api = setSphericalCameraUrl + getSphericalCameraID(id) + '/' + getSphericalCameraID(id) + '?';
'/' + // map.forEach((key, value) {
getSphericalCameraID(id) + // //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) { map.forEach((key, value) {
//print("$key : $value"); //print("$key : $value");
api += (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); // 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( var ret = Navigator.of(context).push(MaterialPageRoute(
builder: (context) => SuperPlayerPage( builder: (context) => SuperPlayerPage(
id: index + 1, id: index + 1,
dwip: listDwinfoGetList2[index]['dwip'],
url: urlnew, url: urlnew,
title: '点位视频\n${(index + 1)}${listDwinfoGetList2[index]['dwmc']}', title: '点位视频\n${(index + 1)}${listDwinfoGetList2[index]['dwmc']}',
))); )));

@ -127,7 +127,7 @@ class ServicePath {
//5 //5
// http://125.64.218.67:9906/api/ptz/{ID}/{ID} // 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 //6 Apk
// api = http://sctastech.com/download/index.html // api = http://sctastech.com/download/index.html

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

Loading…
Cancel
Save