订阅Topic修改为网关sn
parent
4db89e8dc5
commit
a5e7bb3bb2
|
|
@ -21,6 +21,7 @@ export const airPortStore = defineStore({
|
|||
rtmp: 'rtmp://box.wisestcity.com:1935/live/',
|
||||
url: 'http://box.wisestcity.com:8081/live/',
|
||||
},
|
||||
gateway: null,
|
||||
}),
|
||||
getters: {
|
||||
getAirport(state) {
|
||||
|
|
@ -32,6 +33,9 @@ export const airPortStore = defineStore({
|
|||
getLiveInfo(state) {
|
||||
return state.liveInfo;
|
||||
},
|
||||
getGateway(state) {
|
||||
return state.gateway;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
setAirPort(item: any, value: any) {
|
||||
|
|
@ -40,5 +44,8 @@ export const airPortStore = defineStore({
|
|||
setUAV(item: any, value: any) {
|
||||
this.uav[item] = value;
|
||||
},
|
||||
setGateway(value: any) {
|
||||
this.gateway = value;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { clientReizePublish, clientReizeSubscribe } from '@/utils/mqtt';
|
|||
import { airPortStore } from '@/store/modules/airport';
|
||||
|
||||
const airPortStoreVal = airPortStore();
|
||||
const airPort = airPortStoreVal.getAirport;
|
||||
const gateway = airPortStoreVal.getGateway;
|
||||
|
||||
export const return_home_status = {
|
||||
canceled: '取消或终止',
|
||||
|
|
@ -16,26 +16,26 @@ export const return_home_status = {
|
|||
};
|
||||
export const eventsTopicReize = (data) => {
|
||||
// 发送消息
|
||||
clientReizePublish('thing/product/' + airPort.sn + '/events', data);
|
||||
clientReizePublish('thing/product/' + gateway + '/events', data);
|
||||
};
|
||||
export const events_replyTopicReize = () => {
|
||||
// 订阅消息
|
||||
clientReizeSubscribe('thing/product/' + airPort.sn + '/events_reply');
|
||||
clientReizeSubscribe('thing/product/' + gateway + '/events_reply');
|
||||
};
|
||||
|
||||
export const servicesTopicReize = (data) => {
|
||||
// 发送消息
|
||||
clientReizePublish('thing/product/' + airPort.sn + '/services', data);
|
||||
clientReizePublish('thing/product/' + gateway + '/services', data);
|
||||
};
|
||||
export const services_replyTopicReize = () => {
|
||||
// 订阅消息
|
||||
clientReizeSubscribe('thing/product/' + airPort.sn + '/services_reply');
|
||||
clientReizeSubscribe('thing/product/' + gateway + '/services_reply');
|
||||
};
|
||||
export const drcDownTopicReize = (data) => {
|
||||
// 发送消息thing/product/{gateway_sn}/drc/down
|
||||
clientReizePublish('thing/product/' + airPort.sn + '/drc/down', data);
|
||||
clientReizePublish('thing/product/' + gateway + '/drc/down', data);
|
||||
};
|
||||
export const eventsTopicSubscribeReize = () => {
|
||||
// 发送消息
|
||||
clientReizeSubscribe('thing/product/' + airPort.sn + '/events');
|
||||
clientReizeSubscribe('thing/product/' + gateway + '/events');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ import { airPortStore } from '@/store/modules/airport';
|
|||
import errorCode from './error_code.json';
|
||||
|
||||
const airPortStoreVal = airPortStore();
|
||||
const airPort = airPortStoreVal.getAirport;
|
||||
const uav = airPortStoreVal.getUAV;
|
||||
const gateway = airPortStoreVal.getGateway;
|
||||
export const debug_mode_openOptions = {
|
||||
canceled: '取消或终止',
|
||||
failed: '失败',
|
||||
|
|
@ -37,47 +36,38 @@ export const errorName = (code) => {
|
|||
};
|
||||
export const servicesTopic = (data) => {
|
||||
// 发送消息
|
||||
clientPublish('thing/product/' + airPort.sn + '/services', data);
|
||||
clientPublish('thing/product/' + gateway + '/services', data);
|
||||
};
|
||||
export const services_replyTopic = () => {
|
||||
// 订阅消息
|
||||
clientSubscribe('thing/product/' + airPort.sn + '/services_reply');
|
||||
};
|
||||
// 无人机
|
||||
export const servicesUAVTopic = (data) => {
|
||||
// 发送消息
|
||||
clientPublish('thing/product/' + uav.sn + '/services', data);
|
||||
};
|
||||
export const services_replyUAVTopic = () => {
|
||||
// 订阅消息
|
||||
clientSubscribe('thing/product/' + uav.sn + '/services_reply');
|
||||
clientSubscribe('thing/product/' + gateway + '/services_reply');
|
||||
};
|
||||
export const eventsTopic = (data) => {
|
||||
// 发送消息
|
||||
clientPublish('thing/product/' + airPort.sn + '/events', data);
|
||||
clientPublish('thing/product/' + gateway + '/events', data);
|
||||
};
|
||||
export const events_replyTopic = () => {
|
||||
// 订阅消息
|
||||
clientSubscribe('thing/product/' + airPort.sn + '/events_reply');
|
||||
clientSubscribe('thing/product/' + gateway + '/events_reply');
|
||||
};
|
||||
export const drcDownTopic = (data) => {
|
||||
// 发送消息thing/product/{gateway_sn}/drc/down
|
||||
clientPublish('thing/product/' + airPort.sn + '/drc/down', data);
|
||||
clientPublish('thing/product/' + gateway + '/drc/down', data);
|
||||
};
|
||||
|
||||
export const eventsTopicSubscribe = () => {
|
||||
// 发送消息
|
||||
clientSubscribe('thing/product/' + airPort.sn + '/events');
|
||||
clientSubscribe('thing/product/' + gateway + '/events');
|
||||
};
|
||||
export const drcUpTopic = () => {
|
||||
clientSubscribe('thing/product/' + airPort.sn + '/drc/up');
|
||||
clientSubscribe('thing/product/' + gateway + '/drc/up');
|
||||
};
|
||||
|
||||
export const setTopic = (data) => {
|
||||
// 发送消息
|
||||
clientPublish('thing/product/' + airPort.sn + '/property/set', data);
|
||||
clientPublish('thing/product/' + gateway + '/property/set', data);
|
||||
};
|
||||
export const set_replyTopic = () => {
|
||||
// 订阅消息
|
||||
clientSubscribe('thing/product/' + airPort.sn + '/services_reply');
|
||||
clientSubscribe('thing/product/' + gateway + '/services_reply');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@
|
|||
});
|
||||
const locationVal: any = ref({});
|
||||
const flyToThere = (e) => {
|
||||
console.log(e);
|
||||
locationVal.value.lat = e._lat;
|
||||
locationVal.value.lng = e._lng;
|
||||
locationVal.value.alt = e._alt;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
project: null,
|
||||
equipment: null,
|
||||
airport: null,
|
||||
gateway: null,
|
||||
});
|
||||
const optionsArr = reactive({
|
||||
projectOptions: [],
|
||||
|
|
@ -55,6 +56,7 @@
|
|||
const handleChange = () => {
|
||||
airPortStoreVal.setAirPort('sn', selectVal.airport);
|
||||
airPortStoreVal.setUAV('sn', selectVal.equipment);
|
||||
airPortStoreVal.setGateway(selectVal.gateway);
|
||||
emits('selectChange', selectVal);
|
||||
};
|
||||
// 项目列表
|
||||
|
|
@ -67,9 +69,9 @@
|
|||
value: item.Id,
|
||||
};
|
||||
});
|
||||
if(sessionStorage.getItem('homeToFlightId')){
|
||||
if (sessionStorage.getItem('homeToFlightId')) {
|
||||
selectVal.project = sessionStorage.getItem('homeToFlightId');
|
||||
sessionStorage.removeItem('homeToFlightId')
|
||||
sessionStorage.removeItem('homeToFlightId');
|
||||
} else {
|
||||
selectVal.project = optionsArr.projectOptions[0].value;
|
||||
}
|
||||
|
|
@ -123,9 +125,11 @@
|
|||
return {
|
||||
label: item.name,
|
||||
value: item.sn,
|
||||
gateway: item.gateway,
|
||||
};
|
||||
});
|
||||
selectVal.equipment = optionsArr.equipmentOptions[0].value;
|
||||
selectVal.gateway = optionsArr.equipmentOptions[0].gateway;
|
||||
handleChange();
|
||||
} else {
|
||||
optionsArr.equipmentOptions = [];
|
||||
|
|
|
|||
Loading…
Reference in New Issue