@gaidalou/control 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/control.js +351 -343
- package/dist/es/control.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/es/control.umd.cjs
CHANGED
|
@@ -108,4 +108,4 @@ onmessage = (e) =>{
|
|
|
108
108
|
<===命令value type==>`,u,`\r
|
|
109
109
|
<===版本heart version==>`,this.version),this.mitt.bus.emit("blueSend",{version:this.version,scene:this.scene,type:c,code:d,value:p,source:"bluetooth"}),this.soundAddEndTime=null}}this.soundAddEndTime?(u=s.slice(6),this.worker.postMessage({soundValue:u,source:"bluetooth",isEnd:!1})):this.soundAddEndTime=new Date().getTime(),this.soundTimer&&clearTimeout(this.soundTimer),this.soundTimer=setTimeout(()=>{this.worker.postMessage({isEnd:!0}),this.soundTimer=null},this.soundDiffTime);return}else u=s[6];else zk.some(y=>y===f.value)&&(u=i[6]);c==="key"&&d===255&&u===""||(this.testModel&&console.log("<===usb 接收的数据",{version:this.version,scene:this.scene,type:c,code:d,value:u,source:"usb"}),this.mitt.bus.emit("blueSend",{version:this.version,scene:this.scene,type:c,code:d,value:u,source:"bluetooth"}))}),n.startNotifications().then(()=>{o()}).catch(r=>{r.message.indexOf("unknown reason"),o()}).finally(()=>{o()})})}send(n){let{characteristic:o,value:r}=n;if(!o)return;const a=new Uint8Array([90,168,0,6,0,3,20,248,192,0,0,0,0,0,0,0,0,0,0]);o.writeValue(a)}static async sendMsg(n){let o=this.init({namePreFix:Dk,serviceUUIDs:Rk}),{characteristic:r,value:a}=n,l=o.webBleInfosObj[r];if(!l)return;const s=new Uint8Array(a);await l.writeValue(s)}async getVal(n){let{characteristic:o}=n;if(!o)return;let r=await o.readValue();new TextDecoder().decode(r)}async disconnect(n){if(this.server&&this.server.connected&&(await this.server.disconnect(),this.webBleInfos=[],n)){let{back:o}=n;o&&o()}}static async destory(n){this.instance&&(await this.instance.disconnect(n),this.instance.webBleInfosObj={},this.instance.device=null,this.instance.deviceName="",this.instance.server=null,this.instance.allServices=null,this.instance.webBleInfos=[],this.instance=null)}};Ol(ed,"instance",null);let go=ed;const td=class td{static init(n){return this.instance==null&&(this.instance=new td(n)),this.instance}constructor(n){let o=!1,r="";n&&(o=n.testModel,r=n.scene),this.testModel=o,this.scene=r,this.serialPort=null,this.reader=null,this.mitt=zs.init(),this.firstAudio=!0,this.version=null,this.timerLongData=null,this.timerLongDataFlag=null,this.animationId=null,this.worker=null,this.soundAddEndTime=null,this.soundDiffTime=600,this.soundTimer=null,this.shortMax=19,this.longMax=262}async connect(n){try{if(this.serialPort=await navigator.serial.requestPort(),n){let{back:r}=n;r&&r()}let o=9600;for(await this.serialPort.open({baudRate:o}),await this.serialPort.close(),await this.serialPort.open({baudRate:o}),this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null),this.buffer=new Uint8Array,this.reader=this.serialPort.readable.getReader(),this.autoHandle();;){let{value:r}=await this.reader.read(),a=new Uint8Array(this.buffer.length+r.length);if(a.set(this.buffer,0),a.set(r,this.buffer.length),this.buffer=a,this.buffer.length>=this.shortMax){let l=this.buffer[5],s=[];if(this.scene?s=Xc[this.scene]:s=Xc[1],s.some(i=>i===l)){if(this.firstAudio){this.firstAudio=!1;let i=this.buffer.slice(0,this.shortMax);this.buffer=this.buffer.slice(this.shortMax),i[0]===90&&i[1]===165?this.dataReceived(i):this.buffer=new Uint8Array}else if(this.buffer.length>=this.longMax){let i=this.buffer.slice(0,this.longMax);this.buffer=this.buffer.slice(this.longMax),this.dataReceived(i)}}else{let i=this.buffer.slice(0,this.shortMax);this.buffer=this.buffer.slice(this.shortMax),i[0]===90&&i[1]===165?this.dataReceived(i):this.buffer=new Uint8Array}}}}catch(o){console.error("出现错误:",o)}}autoHandle(){if(this.buffer.length>=this.shortMax){let n=this.buffer[5],o=[];if(this.scene?o=Xc[this.scene]:o=Xc[1],o.some(r=>r===n)){if(this.firstAudio){this.firstAudio=!1;let r=this.buffer.slice(0,this.shortMax);this.buffer=this.buffer.slice(this.shortMax),r[0]===90&&r[1]===165?this.dataReceived(r):this.buffer=new Uint8Array}else if(this.buffer.length>=this.longMax){let r=this.buffer.slice(0,this.longMax);this.buffer=this.buffer.slice(this.longMax),this.dataReceived(r)}}else{let r=this.buffer.slice(0,this.shortMax);this.buffer=this.buffer.slice(this.shortMax),r[0]===90&&r[1]===165?this.dataReceived(r):this.buffer=new Uint8Array}}this.animationId=requestAnimationFrame(this.autoHandle.bind(this))}dataReceived(n){let o=n,r=ka(),a=new Uint8Array(o.buffer),l=new Int8Array(o.buffer);this.testModel&&(console.log("usb 接受的数据 uint8Array==>",a),console.log("usb 接受的数据 int8Array==>",l));let s=Pk[a[4]],i=a[5],c="";if(s==="sendToYaoKongQi"||(s==="key"&&i===255&&(this.version=As[a[6]]),!s))return;if(this.version==="version3"&&!this.scene){Is.error("请传入场景类型");return}let d={};if(this.version,this.version==="version1"||this.version==="version2"?d=r.getBlueNum({version:this.version,type:s,code:i}):this.version==="version3"&&this.scene&&(d=r.getBlueNumV3({version:this.version,scene:this.scene,type:s,code:i})),d.type==="action")if(Ak.some(u=>u===d.value))if(d.value==="remoteIntercom"||d.value==="realTimeShouting"){if(!this.worker){const u=new Blob([Lk],{type:"application/javascript"});let f=URL.createObjectURL(u);this.worker=new Worker(f,{type:"module"}),this.worker.onmessage=async y=>{this.worker&&(this.worker.terminate(),this.worker=null),this.firstAudio=!0,this.buffer=new Uint8Array;let h=y.data;this.testModel&&console.log("<===usb 接收的数据 类型 type==>",s,`\r
|
|
110
110
|
<===命令code decodedString==>`,i,`\r
|
|
111
|
-
<===命令value type==>`,c),this.mitt.bus.emit("blueSend",{version:this.version,scene:this.scene,type:s,code:i,value:h,source:"bluetooth"}),this.soundAddEndTime=null}}this.soundAddEndTime?(c=a.slice(6),this.worker.postMessage({soundValue:c,source:"bluetooth",isEnd:!1})):this.soundAddEndTime=new Date().getTime(),this.soundTimer&&clearTimeout(this.soundTimer),this.soundTimer=setTimeout(()=>{this.worker.postMessage({isEnd:!0})},this.soundDiffTime);return}else c=a[6];else zk.some(u=>u===d.value)&&(c=l[6]);s==="key"&&i===255&&c===""||(this.testModel&&console.log("<===usb 接收的数据",{version:this.version,scene:this.scene,type:s,code:i,value:c,source:"usb"}),this.mitt.bus.emit("blueSend",{version:this.version,scene:this.scene,type:s,code:i,value:c,source:"usb"}))}static async sendMsg(n){try{if(!this.instance||!this.instance.serialPort)return;let o=this.instance.serialPort.writable.getWriter(),{value:r}=n;await o.write(new Uint8Array(r)),o.releaseLock()}catch(o){console.error("发送数据时出现错误:",o)}}async disconnect(n){if(this.serialPort.readable&&this.serialPort.readable.locked&&await this.reader.cancel(),await this.serialPort.close(),this.serialPort=null,this.reader=null,n){let{back:o}=n;o&&o()}}static async destory(n){this.instance&&(await this.instance.disconnect(n),this.instance=null)}};Ol(td,"instance",null);let yo=td,Qp=(t,n=2)=>{let o=null;if(isNaN(t)){let r=parseFloat(t);isNaN(r)?o=t:(r*=Math.pow(10,n),r=Math.round(r),o=r/Math.pow(10,n))}else t*=Math.pow(10,n),t=Math.round(t),o=t/Math.pow(10,n);return o};const nd=class nd{static init(){return this.instance==null&&(this.instance=new nd),this.instance}constructor(){}async heart(){let o=new TextEncoder().encode(this.yunTaiName),a=Array.from(o).map(d=>d.toString(10).padStart(2,"0")).join(" ").split(" ");a=a.map(d=>Qp(d,0));let l=a.length+4;const s=Math.floor(l/256),i=l%256;let c=[90,165,s,i,0,2,...a,248,192];await go.sendMsg({characteristic:"0000ff04",value:c}),await yo.sendMsg({value:c}),this.heartTimerStatus&&(this.heartTimer=setTimeout(async()=>{await this.heart()},1e3*60*10))}startHeart(){this.heartTimer&&clearInterval(this.heartTimer),this.heartTimerStatus=!0}unHeart(){this.heartTimerStatus=!1,this.heartTimer&&clearInterval(this.heartTimer)}numberToBytes(n){const o=n&255,r=n>>8&255;return[o,r]}async sendBlueYunTaiName(n){this.yunTaiName=n;let r=new TextEncoder().encode(n),l=Array.from(r).map(u=>u.toString(10).padStart(2,"0")).join(" ").split(" ");l=l.map(u=>Qp(u,0));let s=l.length+4;const i=Math.floor(s/256),c=s%256;let d=[90,165,i,c,0,2,...l,248,192];await go.sendMsg({characteristic:"0000ff04",value:d}),await yo.sendMsg({value:d})}async sendBlueWenDu(n){let r=[90,165,0,6,0,3,...this.numberToBytes(n*10),248,192];await go.sendMsg({characteristic:"0000ff04",value:r}),await yo.sendMsg({value:r})}async sendBlueFengSu(n){let r=[90,165,0,6,0,5,...this.numberToBytes(n*10),248,192];await go.sendMsg({characteristic:"0000ff04",value:r}),await yo.sendMsg({value:r})}async sendBluePlatformType(n){let r=[90,165,0,5,0,10,...this.numberToBytes(n),248,192];await go.sendMsg({characteristic:"0000ff04",value:r}),await yo.sendMsg({value:r})}async sendBlueAirportName(n){let r=new TextEncoder().encode(n),l=Array.from(r).map(u=>u.toString(10).padStart(2,"0")).join(" ").split(" ");l=l.map(u=>Qp(u,0));let s=l.length+4;const i=Math.floor(s/256),c=s%256;let d=[90,165,i,c,0,11,...l,248,192];await go.sendMsg({characteristic:"0000ff04",value:d}),await yo.sendMsg({value:d})}async sendBlueDistance(n){let r=[90,165,0,6,0,12,...this.numberToBytes(n*10),248,192];await go.sendMsg({characteristic:"0000ff04",value:r}),await yo.sendMsg({value:r})}sendBlueUavHorizontalSpeed(n){}sendBlueUavVerticalSpeed(n){}sendToBlue(n){}sendBlueOneKeyTakeoffOk(n){}};Ol(nd,"instance",null);let Ls=nd;const Fk=(t,n)=>{const o=t.__vccOpts||t;for(const[r,a]of n)o[r]=a;return o},HK={class:"blue"},jK=["src"],KK=["src"],WK=Fk(Object.assign({name:"Bluetooth"},{__name:"index",props:["blueIcon","tipStatus","blueLinkText","blueDisconnectText","testModel","scene"],setup(t,{expose:n}){let o=t,r=jc.create(),a=ka(),{blueScanBtnShow:l,usbScanBtnShow:s,selectLinkText:i}=Gc(a),c=null,d=null;async function u(){let y=e.toRaw(i.value);try{c=go.init({namePreFix:Dk,serviceUUIDs:Rk,testModel:o.testModel,scene:o.scene}),await c.getDevice(),await c.connect(),await c.getAllServers(),await c.getAllCharacters({back:async()=>{await yo.destory({back:async()=>{s.value=!1}}),d=Ls.init(),d.unHeart(),l.value=!0,o.tipStatus&&r.customTip({message:!0,type:"success",content:o.blueLinkText?o.blueLinkText:"操作台设备已上线(蓝牙)"}),i.value="蓝牙连接",setTimeout(async()=>{d.startHeart(),await d.heart()},1e3*3)}})}catch{r.customTip({message:!0,type:"error",content:"操作台设备(蓝牙)连接失败,请重新连接"}),i.value=y}}function f(){Kp.confirm("确定断开操作台设备吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(async()=>{await go.destory({back:()=>{l.value=!1,c=null,o.tipStatus&&r.customTip({message:!0,type:"success",content:o.blueDisconnectText?o.blueDisconnectText:"操作台设备已下线"}),i.value="请选择",d&&d.unHeart()}})}).catch(()=>{r.customTip({message:!0,type:"info",content:"已取消"})})}return n({scan:u,disconnect:f}),e.onMounted(()=>{}),e.onUnmounted(()=>{d&&d.unHeart()}),(y,h)=>{const g=e.resolveComponent("el-tooltip");return e.openBlock(),e.createElementBlock("div",HK,[e.unref(l)?(e.openBlock(),e.createElementBlock("div",{key:1,class:"scanBlue",onClick:f},[e.renderSlot(y.$slots,"link",{},()=>[e.createVNode(g,{class:"box-item","popper-class":"custom-el-tooltip",effect:"dark",content:"断开蓝牙操作台"},{default:e.withCtx(()=>[e.createElementVNode("img",{class:"bluetoothWorking",src:t.blueIcon,alt:""},null,8,KK)]),_:1})],!0)])):(e.openBlock(),e.createElementBlock("div",{key:0,class:"scanBlue",onClick:u},[e.renderSlot(y.$slots,"unlink",{},()=>[e.createVNode(g,{class:"box-item","popper-class":"custom-el-tooltip",effect:"dark",content:"链接蓝牙操作台"},{default:e.withCtx(()=>[e.createElementVNode("img",{class:"bluetoothUnWorking",src:t.blueIcon,alt:""},null,8,jK)]),_:1})],!0)]))])}}}),[["__scopeId","data-v-156449bb"]]),UK={class:"blue"},qK=["src"],YK=["src"],GK=Fk(Object.assign({name:"Webusb"},{__name:"index",props:["usbIcon","tipStatus","usbLinkText","usbDisconnectText","testModel","scene"],setup(t,{expose:n}){let o=t,r=jc.create(),a=ka(),{blueScanBtnShow:l,usbScanBtnShow:s,selectLinkText:i}=Gc(a),c=null,d=null;async function u(){c=yo.init({testModel:o.testModel,scene:o.scene}),await c.connect({back:async()=>{await go.destory({back:async()=>{l.value=!1}}),d=Ls.init(),d.unHeart(),s.value=!0,o.tipStatus&&r.customTip({message:!0,type:"success",content:o.usbLinkText?o.usbLinkText:"操作台设备已上线(USB)"}),i.value="USB连接",setTimeout(async()=>{d.startHeart(),await d.heart()},1e3*3)}})}async function f(){Kp.confirm("确定断开操作台设备吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(async()=>{await yo.destory({back:()=>{s.value=!1,c=null,o.tipStatus&&r.customTip({message:!0,type:"success",content:o.usbDisconnectText?o.usbDisconnectText:"操作台设备已下线"}),i.value="请选择",d&&d.unHeart()}})}).catch(()=>{r.customTip({message:!0,type:"info",content:"已取消"})})}return e.onMounted(()=>{}),e.onUnmounted(()=>{d&&d.unHeart()}),n({scan:u,disconnect:f}),(y,h)=>{const g=e.resolveComponent("el-tooltip");return e.openBlock(),e.createElementBlock("div",UK,[e.unref(s)?(e.openBlock(),e.createElementBlock("div",{key:1,class:"scanBlue",onClick:f},[e.renderSlot(y.$slots,"link",{},()=>[e.createVNode(g,{class:"box-item","popper-class":"custom-el-tooltip",effect:"dark",content:"断开usb操作台"},{default:e.withCtx(()=>[e.createElementVNode("img",{class:"bluetoothWorking",src:t.usbIcon,alt:""},null,8,YK)]),_:1})],!0)])):(e.openBlock(),e.createElementBlock("div",{key:0,class:"scanBlue",onClick:u},[e.renderSlot(y.$slots,"unlink",{},()=>[e.createVNode(g,{class:"box-item","popper-class":"custom-el-tooltip",effect:"dark",content:"链接usb操作台"},{default:e.withCtx(()=>[e.createElementVNode("img",{class:"bluetoothUnWorking",src:t.usbIcon,alt:""},null,8,qK)]),_:1})],!0)]))])}}}),[["__scopeId","data-v-59728a5a"]]),XK={__name:"index",props:{write:{type:Object,default:()=>[{wind:0}]}},emits:["message"],setup(t,{expose:n,emit:o}){let r=t,a=o;ka();let l=Ls.init(),s=async u=>{a("message",u)},i=u=>{let f=!1;return u?(Object.keys(u).length==0?f=!0:f=!1,f):!0};e.watch(()=>r.write,()=>{i(r.write)||r.write&&r.write.value&&l.sendBlueFengSu(r.write.value)});let c=async u=>{i(u)||(u.deviceName&&u.deviceName.value&&await l.sendBlueYunTaiName(u.deviceName.value),u.wind&&u.wind.value!==null&&await l.sendBlueFengSu(u.wind.value),u.temperature&&u.temperature.value!==null&&await l.sendBlueWenDu(u.temperature.value),u.platformType&&u.platformType.value&&await l.sendBluePlatformType(u.platformType.value),u.airportName&&u.airportName.value&&await l.sendBlueAirportName(u.airportName.value),u.distance&&u.distance.value&&await l.sendBlueDistance(u.distance.value))},d=null;return e.onMounted(()=>{d=zs.init(),d.has({type:"blueSend",fnName:"blueSend_homePage_control"})||d.bus.on("blueSend",s)}),e.onUnmounted(()=>{d.bus.off("blueSend",s)}),n({sendMessage:c}),(u,f)=>(e.openBlock(),e.createElementBlock("div"))}},ZK="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAVCAYAAABCIB6VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cm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w/sff7S1O9pn6CiGP8rwAACKohjm09W/gAAAABJRU5ErkJggg==",QK="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAATCAYAAABPwleqAAABSklEQVQ4jcXTsU4VQRTG8d/O7I1AhwkdlRAqEiho0AZ8AWMMFVSE2BAKGxMKCITQGQutLHgCeAEa30IKG02wkQKMIQQhcM3gLJmg3AuVXzI5k5n9z3fOmdlqau2rEKqhGKudEMNI3QoXdR1cjVbQyjFezasY63ASY5iLsdqt/dEQxvEG3xD8rTYqvMUkruHzHDfx4x9gqWVcKBzaOQ52AZN6G7guFo/wEKsYxSesYxbP8/577DdAWdsZHuApZjCV18fwIh8wgOMGKJ3TxvcCavQ6j6TUsOGbzod5ftCl3nb+7mfpPIJLPMHnDnDIBzxq4Hls4RTbObVOOsGr1KMEL+ILFtB3ywMplRq2hJdN2nv42AUqNYHp5PIrO95H/anMbil21P+Fe3L776P0qHpTt9OlP873fZcy0vfPUkzwBj7gXf457pJtCyu/AVEyOYhfPAHKAAAAAElFTkSuQmCC",vl=Object.assign({name:"ControlIndex"},{__name:"controlIndex",props:["write","blueIcon","usbIcon","tipStatus","testModel","scene","blueLinkText","blueDisconnectText","usbLinkText","usbDisconnectText"],emits:["message"],setup(t,{expose:n,emit:o}){let r=ka(),{blueScanBtnShow:a,usbScanBtnShow:l,selectLinkText:s}=Gc(r),i=()=>ka,c=e.ref(null),d=e.ref(null),u=e.ref(null),f=t,y=o,h=e.computed(()=>f.tipStatus!==void 0||f.tipStatus!==null?f.tipStatus:!0),g=e.computed(()=>f.blueIcon?f.blueIcon:ZK),p=e.computed(()=>f.usbIcon?f.usbIcon:QK),w=e.computed(()=>f.testModel?f.testModel:!1),C=($,v)=>{f.testModel&&console.log("item",$),y("message",$,v)};return n({sendMessage:$=>{u.value.sendMessage($)},blueLink:()=>{c.value.scan()},blueDisconnect:()=>{c.value.disconnect()},usbLink:()=>{d.value.scan()},usbDisconnect:()=>{d.value.disconnect()},getLinkStatus:()=>({blueScanBtnShow:a.value,usbScanBtnShow:l.value,selectLinkText:s.value}),getBlueStore:i}),($,v)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(WK,{blueIcon:e.unref(g),tipStatus:e.unref(h),scene:t.scene,blueLinkText:t.blueLinkText,blueDisconnectText:t.blueDisconnectText,testModel:e.unref(w),ref_key:"bluetoothRef",ref:c},{unlink:e.withCtx(()=>[e.renderSlot($.$slots,"blueUnlink")]),link:e.withCtx(()=>[e.renderSlot($.$slots,"blueLink")]),_:3},8,["blueIcon","tipStatus","scene","blueLinkText","blueDisconnectText","testModel"]),e.createVNode(GK,{usbIcon:e.unref(p),tipStatus:e.unref(h),scene:t.scene,usbLinkText:t.usbLinkText,usbDisconnectText:t.usbDisconnectText,testModel:e.unref(w),ref_key:"usbRef",ref:d},{unlink:e.withCtx(()=>[e.renderSlot($.$slots,"usbUnlink")]),link:e.withCtx(()=>[e.renderSlot($.$slots,"usbLink")]),_:3},8,["usbIcon","tipStatus","scene","usbLinkText","usbDisconnectText","testModel"]),e.createVNode(XK,{onMessage:e.unref(C),write:t.write,ref_key:"controlRef",ref:u},null,8,["onMessage","write"])]))}});vl.install=t=>{t.component(vl.name,vl)};const JK={__name:"controlTest",setup(t){let n=e.ref(!1),o=e.ref({deviceName:{value:null},temperature:{value:null},wind:{value:null},platformType:{value:1},airportName:{value:null},distance:{value:null}}),r=c=>{console.log("version===>",c,n.value),n.value||(i(c),s&&clearInterval(s),s=setInterval(()=>{i(c)},1e3*20))},a=e.ref(null);const l=c=>{console.log("平台接收的message===>",c),r(c.version)};let s=null,i=c=>{n.value=!0;let d={},u=e.toRaw(o.value);c==="version3"?(d.deviceName=u.deviceName,d.temperature=u.temperature,d.wind=u.wind,d.platformType=u.platformType,d.airportName=u.airportName,d.distance=u.distance):(d.deviceName=u.deviceName,d.temperature=u.temperature,d.wind=u.wind),console.log("平台发送的数据message===>",d),a.value.sendMessage(d)};return e.onMounted(()=>{let d=a.value.getBlueStore()(),{blueScanBtnShow:u,usbScanBtnShow:f,selectLinkText:y}=Gc(d);e.watch([()=>u.value,()=>f.value,()=>y.value],([h,g,p],[w,C,T])=>{h||(n.value=!1),g||(n.value=!1),!h&&!g&&(n.value=!1,s&&clearInterval(s))})}),e.onUnmounted(async()=>{s&&clearInterval(s),s=null}),(c,d)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(vl,{onMessage:l,tipStatus:!0,testModel:!0,scene:1,blueLinkText:"blueLinkText",blueDisconnectText:"blueDisconnectText",usbLinkText:"usbLinkText",usbDisconnectText:"usbDisconnectText",ref_key:"controlRef",ref:a},{blueUnlink:e.withCtx(()=>d[0]||(d[0]=[e.createElementVNode("div",null," blueLink ",-1)])),blueLink:e.withCtx(()=>d[1]||(d[1]=[e.createElementVNode("div",null," blueUnlink ",-1)])),usbUnlink:e.withCtx(()=>d[2]||(d[2]=[e.createElementVNode("div",null," usbLink ",-1)])),usbLink:e.withCtx(()=>d[3]||(d[3]=[e.createElementVNode("div",null," usbUnlink ",-1)])),_:1},512)]))}},e7={__name:"App",setup(t){return(n,o)=>(e.openBlock(),e.createBlock(JK))}};/*! Element Plus v2.9.10 */var t7={name:"zh-cn",el:{breadcrumb:{label:"面包屑"},colorpicker:{confirm:"确定",clear:"清空",defaultLabel:"颜色选择器",description:"当前颜色 {color},按 Enter 键选择新颜色",alphaLabel:"选择透明度的值"},datepicker:{now:"此刻",today:"今天",cancel:"取消",clear:"清空",confirm:"确定",dateTablePrompt:"使用方向键与 Enter 键可选择日期",monthTablePrompt:"使用方向键与 Enter 键可选择月份",yearTablePrompt:"使用方向键与 Enter 键可选择年份",selectedDate:"已选日期",selectDate:"选择日期",selectTime:"选择时间",startDate:"开始日期",startTime:"开始时间",endDate:"结束日期",endTime:"结束时间",prevYear:"前一年",nextYear:"后一年",prevMonth:"上个月",nextMonth:"下个月",year:"年",month1:"1 月",month2:"2 月",month3:"3 月",month4:"4 月",month5:"5 月",month6:"6 月",month7:"7 月",month8:"8 月",month9:"9 月",month10:"10 月",month11:"11 月",month12:"12 月",weeks:{sun:"日",mon:"一",tue:"二",wed:"三",thu:"四",fri:"五",sat:"六"},weeksFull:{sun:"星期日",mon:"星期一",tue:"星期二",wed:"星期三",thu:"星期四",fri:"星期五",sat:"星期六"},months:{jan:"一月",feb:"二月",mar:"三月",apr:"四月",may:"五月",jun:"六月",jul:"七月",aug:"八月",sep:"九月",oct:"十月",nov:"十一月",dec:"十二月"}},inputNumber:{decrease:"减少数值",increase:"增加数值"},select:{loading:"加载中",noMatch:"无匹配数据",noData:"无数据",placeholder:"请选择"},dropdown:{toggleDropdown:"切换下拉选项"},mention:{loading:"加载中"},cascader:{noMatch:"无匹配数据",loading:"加载中",placeholder:"请选择",noData:"暂无数据"},pagination:{goto:"前往",pagesize:"条/页",total:"共 {total} 条",pageClassifier:"页",page:"页",prev:"上一页",next:"下一页",currentPage:"第 {pager} 页",prevPages:"向前 {pager} 页",nextPages:"向后 {pager} 页",deprecationWarning:"你使用了一些已被废弃的用法,请参考 el-pagination 的官方文档"},dialog:{close:"关闭此对话框"},drawer:{close:"关闭此对话框"},messagebox:{title:"提示",confirm:"确定",cancel:"取消",error:"输入的数据不合法!",close:"关闭此对话框"},upload:{deleteTip:"按 Delete 键可删除",delete:"删除",preview:"查看图片",continue:"继续上传"},slider:{defaultLabel:"滑块介于 {min} 至 {max}",defaultRangeStartLabel:"选择起始值",defaultRangeEndLabel:"选择结束值"},table:{emptyText:"暂无数据",confirmFilter:"筛选",resetFilter:"重置",clearFilter:"全部",sumText:"合计"},tour:{next:"下一步",previous:"上一步",finish:"结束导览"},tree:{emptyText:"暂无数据"},transfer:{noMatch:"无匹配数据",noData:"无数据",titles:["列表 1","列表 2"],filterPlaceholder:"请输入搜索内容",noCheckedFormat:"共 {total} 项",hasCheckedFormat:"已选 {checked}/{total} 项"},image:{error:"加载失败"},pageHeader:{title:"返回"},popconfirm:{confirmButtonText:"确定",cancelButtonText:"取消"},carousel:{leftArrow:"上一张幻灯片",rightArrow:"下一张幻灯片",indicator:"幻灯片切换至索引 {index}"}}};function n7(t){return typeof t=="object"&&t!==null}function Hk(t,n){return t=n7(t)?t:Object.create(null),new Proxy(t,{get(o,r,a){return r==="key"?Reflect.get(o,r,a):Reflect.get(o,r,a)||Reflect.get(n,r,a)}})}function o7(t,n){return n.reduce((o,r)=>o==null?void 0:o[r],t)}function r7(t,n,o){return n.slice(0,-1).reduce((r,a)=>/^(__proto__)$/.test(a)?{}:r[a]=r[a]||{},t)[n[n.length-1]]=o,t}function a7(t,n){return n.reduce((o,r)=>{const a=r.split(".");return r7(o,a,o7(t,a))},{})}function l7(t,n){return o=>{var r;try{const{storage:a=localStorage,beforeRestore:l=void 0,afterRestore:s=void 0,serializer:i={serialize:JSON.stringify,deserialize:JSON.parse},key:c=n.$id,paths:d=null,debug:u=!1}=o;return{storage:a,beforeRestore:l,afterRestore:s,serializer:i,key:((r=t.key)!=null?r:f=>f)(typeof c=="string"?c:c(n.$id)),paths:d,debug:u}}catch(a){return o.debug&&console.error("[pinia-plugin-persistedstate]",a),null}}}function jk(t,{storage:n,serializer:o,key:r,debug:a}){try{const l=n==null?void 0:n.getItem(r);l&&t.$patch(o==null?void 0:o.deserialize(l))}catch(l){a&&console.error("[pinia-plugin-persistedstate]",l)}}function Kk(t,{storage:n,serializer:o,key:r,paths:a,debug:l}){try{const s=Array.isArray(a)?a7(t,a):t;n.setItem(r,o.serialize(s))}catch(s){l&&console.error("[pinia-plugin-persistedstate]",s)}}function s7(t={}){return n=>{const{auto:o=!1}=t,{options:{persist:r=o},store:a,pinia:l}=n;if(!r)return;if(!(a.$id in l.state.value)){const i=l._s.get(a.$id.replace("__hot:",""));i&&Promise.resolve().then(()=>i.$persist());return}const s=(Array.isArray(r)?r.map(i=>Hk(i,t)):[Hk(r,t)]).map(l7(t,a)).filter(Boolean);a.$persist=()=>{s.forEach(i=>{Kk(a.$state,i)})},a.$hydrate=({runHooks:i=!0}={})=>{s.forEach(c=>{const{beforeRestore:d,afterRestore:u}=c;i&&(d==null||d(n)),jk(a,c),i&&(u==null||u(n))})},s.forEach(i=>{const{beforeRestore:c,afterRestore:d}=i;c==null||c(n),jk(a,i),d==null||d(n),a.$subscribe((u,f)=>{Kk(f,i)},{detached:!0})})}}var i7=s7();let Wk=RK();Wk.use(i7);const Qc=e.createApp(e7);Qc.use(Wk),Qc.use(uK,{locale:t7}),Qc.mount("#app");const c7=Object.freeze(Object.defineProperty({__proto__:null,app:Qc},Symbol.toStringTag,{value:"Module"}));let d7=[vl],Uk=t=>{d7.forEach(n=>{t.component(n.name,n)})};const u7={install:Uk,Main:c7};zt.BoweeControl=vl,zt.default=u7,zt.install=Uk,Object.defineProperties(zt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
111
|
+
<===命令value type==>`,c),this.mitt.bus.emit("blueSend",{version:this.version,scene:this.scene,type:s,code:i,value:h,source:"bluetooth"}),this.soundAddEndTime=null}}this.soundAddEndTime?(c=a.slice(6),this.worker.postMessage({soundValue:c,source:"bluetooth",isEnd:!1})):this.soundAddEndTime=new Date().getTime(),this.soundTimer&&clearTimeout(this.soundTimer),this.soundTimer=setTimeout(()=>{this.worker.postMessage({isEnd:!0})},this.soundDiffTime);return}else c=a[6];else zk.some(u=>u===d.value)&&(c=l[6]);s==="key"&&i===255&&c===""||(this.testModel&&console.log("<===usb 接收的数据",{version:this.version,scene:this.scene,type:s,code:i,value:c,source:"usb"}),this.mitt.bus.emit("blueSend",{version:this.version,scene:this.scene,type:s,code:i,value:c,source:"usb"}))}static async sendMsg(n){try{if(!this.instance||!this.instance.serialPort)return;let o=this.instance.serialPort.writable.getWriter(),{value:r}=n;await o.write(new Uint8Array(r)),o.releaseLock()}catch(o){console.error("发送数据时出现错误:",o)}}async disconnect(n){if(this.serialPort.readable&&this.serialPort.readable.locked&&await this.reader.cancel(),await this.serialPort.close(),this.serialPort=null,this.reader=null,n){let{back:o}=n;o&&o()}}static async destory(n){this.instance&&(await this.instance.disconnect(n),this.instance=null)}};Ol(td,"instance",null);let yo=td,Qp=(t,n=2)=>{let o=null;if(isNaN(t)){let r=parseFloat(t);isNaN(r)?o=t:(r*=Math.pow(10,n),r=Math.round(r),o=r/Math.pow(10,n))}else t*=Math.pow(10,n),t=Math.round(t),o=t/Math.pow(10,n);return o};const nd=class nd{static init(){return this.instance==null&&(this.instance=new nd),this.instance}constructor(){}async heart(){let o=new TextEncoder().encode(this.yunTaiName),a=Array.from(o).map(d=>d.toString(10).padStart(2,"0")).join(" ").split(" ");a=a.map(d=>Qp(d,0));let l=a.length+4;const s=Math.floor(l/256),i=l%256;let c=[90,165,s,i,0,2,...a,248,192];await go.sendMsg({characteristic:"0000ff04",value:c}),await yo.sendMsg({value:c}),this.heartTimerStatus&&(this.heartTimer=setTimeout(async()=>{await this.heart()},1e3*60*10))}startHeart(){this.heartTimer&&clearInterval(this.heartTimer),this.heartTimerStatus=!0}unHeart(){this.heartTimerStatus=!1,this.heartTimer&&clearInterval(this.heartTimer)}numberToBytes(n){const o=n&255,r=n>>8&255;return[o,r]}async sendBluePlatformType(n){let r=[90,165,0,5,0,10,...this.numberToBytes(n),248,192];await go.sendMsg({characteristic:"0000ff04",value:r}),await yo.sendMsg({value:r})}async sendBlueWenDu(n){let r=[90,165,0,6,0,3,...this.numberToBytes(n*10),248,192];await go.sendMsg({characteristic:"0000ff04",value:r}),await yo.sendMsg({value:r})}async sendBlueFengSu(n){let r=[90,165,0,6,0,5,...this.numberToBytes(n*10),248,192];await go.sendMsg({characteristic:"0000ff04",value:r}),await yo.sendMsg({value:r})}async sendBlueDistance(n){let r=[90,165,0,6,0,12,...this.numberToBytes(n*10),248,192];await go.sendMsg({characteristic:"0000ff04",value:r}),await yo.sendMsg({value:r})}async sendBlueYunTaiName(n){this.yunTaiName=n;let r=new TextEncoder().encode(n),l=Array.from(r).map(u=>u.toString(10).padStart(2,"0")).join(" ").split(" ");l=l.map(u=>Qp(u,0));let s=l.length+4;const i=Math.floor(s/256),c=s%256;let d=[90,165,i,c,0,2,...l,248,192];await go.sendMsg({characteristic:"0000ff04",value:d}),await yo.sendMsg({value:d})}async sendBlueAirportName(n){let r=new TextEncoder().encode(n),l=Array.from(r).map(u=>u.toString(10).padStart(2,"0")).join(" ").split(" ");l=l.map(u=>Qp(u,0));let s=l.length+4;const i=Math.floor(s/256),c=s%256;let d=[90,165,i,c,0,11,...l,248,192];await go.sendMsg({characteristic:"0000ff04",value:d}),await yo.sendMsg({value:d})}sendBlueUavHorizontalSpeed(n){}sendBlueUavVerticalSpeed(n){}sendToBlue(n){}sendBlueOneKeyTakeoffOk(n){}};Ol(nd,"instance",null);let Ls=nd;const Fk=(t,n)=>{const o=t.__vccOpts||t;for(const[r,a]of n)o[r]=a;return o},HK={class:"blue"},jK=["src"],KK=["src"],WK=Fk(Object.assign({name:"Bluetooth"},{__name:"index",props:["blueIcon","tipStatus","blueLinkText","blueDisconnectText","testModel","scene"],setup(t,{expose:n}){let o=t,r=jc.create(),a=ka(),{blueScanBtnShow:l,usbScanBtnShow:s,selectLinkText:i}=Gc(a),c=null,d=null;async function u(){let y=e.toRaw(i.value);try{c=go.init({namePreFix:Dk,serviceUUIDs:Rk,testModel:o.testModel,scene:o.scene}),await c.getDevice(),await c.connect(),await c.getAllServers(),await c.getAllCharacters({back:async()=>{await yo.destory({back:async()=>{s.value=!1}}),d=Ls.init(),d.unHeart(),l.value=!0,o.tipStatus&&r.customTip({message:!0,type:"success",content:o.blueLinkText?o.blueLinkText:"操作台设备已上线(蓝牙)"}),i.value="蓝牙连接",setTimeout(async()=>{d.startHeart(),await d.heart()},1e3*3)}})}catch{r.customTip({message:!0,type:"error",content:"操作台设备(蓝牙)连接失败,请重新连接"}),i.value=y}}function f(){Kp.confirm("确定断开操作台设备吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(async()=>{await go.destory({back:()=>{l.value=!1,c=null,o.tipStatus&&r.customTip({message:!0,type:"success",content:o.blueDisconnectText?o.blueDisconnectText:"操作台设备已下线"}),i.value="请选择",d&&d.unHeart()}})}).catch(()=>{r.customTip({message:!0,type:"info",content:"已取消"})})}return n({scan:u,disconnect:f}),e.onMounted(()=>{}),e.onUnmounted(()=>{d&&d.unHeart()}),(y,h)=>{const g=e.resolveComponent("el-tooltip");return e.openBlock(),e.createElementBlock("div",HK,[e.unref(l)?(e.openBlock(),e.createElementBlock("div",{key:1,class:"scanBlue",onClick:f},[e.renderSlot(y.$slots,"link",{},()=>[e.createVNode(g,{class:"box-item","popper-class":"custom-el-tooltip",effect:"dark",content:"断开蓝牙操作台"},{default:e.withCtx(()=>[e.createElementVNode("img",{class:"bluetoothWorking",src:t.blueIcon,alt:""},null,8,KK)]),_:1})],!0)])):(e.openBlock(),e.createElementBlock("div",{key:0,class:"scanBlue",onClick:u},[e.renderSlot(y.$slots,"unlink",{},()=>[e.createVNode(g,{class:"box-item","popper-class":"custom-el-tooltip",effect:"dark",content:"链接蓝牙操作台"},{default:e.withCtx(()=>[e.createElementVNode("img",{class:"bluetoothUnWorking",src:t.blueIcon,alt:""},null,8,jK)]),_:1})],!0)]))])}}}),[["__scopeId","data-v-156449bb"]]),UK={class:"blue"},qK=["src"],YK=["src"],GK=Fk(Object.assign({name:"Webusb"},{__name:"index",props:["usbIcon","tipStatus","usbLinkText","usbDisconnectText","testModel","scene"],setup(t,{expose:n}){let o=t,r=jc.create(),a=ka(),{blueScanBtnShow:l,usbScanBtnShow:s,selectLinkText:i}=Gc(a),c=null,d=null;async function u(){c=yo.init({testModel:o.testModel,scene:o.scene}),await c.connect({back:async()=>{await go.destory({back:async()=>{l.value=!1}}),d=Ls.init(),d.unHeart(),s.value=!0,o.tipStatus&&r.customTip({message:!0,type:"success",content:o.usbLinkText?o.usbLinkText:"操作台设备已上线(USB)"}),i.value="USB连接",setTimeout(async()=>{d.startHeart(),await d.heart()},1e3*3)}})}async function f(){Kp.confirm("确定断开操作台设备吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(async()=>{await yo.destory({back:()=>{s.value=!1,c=null,o.tipStatus&&r.customTip({message:!0,type:"success",content:o.usbDisconnectText?o.usbDisconnectText:"操作台设备已下线"}),i.value="请选择",d&&d.unHeart()}})}).catch(()=>{r.customTip({message:!0,type:"info",content:"已取消"})})}return e.onMounted(()=>{}),e.onUnmounted(()=>{d&&d.unHeart()}),n({scan:u,disconnect:f}),(y,h)=>{const g=e.resolveComponent("el-tooltip");return e.openBlock(),e.createElementBlock("div",UK,[e.unref(s)?(e.openBlock(),e.createElementBlock("div",{key:1,class:"scanBlue",onClick:f},[e.renderSlot(y.$slots,"link",{},()=>[e.createVNode(g,{class:"box-item","popper-class":"custom-el-tooltip",effect:"dark",content:"断开usb操作台"},{default:e.withCtx(()=>[e.createElementVNode("img",{class:"bluetoothWorking",src:t.usbIcon,alt:""},null,8,YK)]),_:1})],!0)])):(e.openBlock(),e.createElementBlock("div",{key:0,class:"scanBlue",onClick:u},[e.renderSlot(y.$slots,"unlink",{},()=>[e.createVNode(g,{class:"box-item","popper-class":"custom-el-tooltip",effect:"dark",content:"链接usb操作台"},{default:e.withCtx(()=>[e.createElementVNode("img",{class:"bluetoothUnWorking",src:t.usbIcon,alt:""},null,8,qK)]),_:1})],!0)]))])}}}),[["__scopeId","data-v-59728a5a"]]),XK={__name:"index",props:{write:{type:Object,default:()=>[{wind:0}]}},emits:["message"],setup(t,{expose:n,emit:o}){let r=t,a=o;ka();let l=Ls.init(),s=async u=>{a("message",u)},i=u=>{let f=!1;return u?(Object.keys(u).length==0?f=!0:f=!1,f):!0};e.watch(()=>r.write,()=>{i(r.write)||r.write&&r.write.value&&l.sendBlueFengSu(r.write.value)});let c=async u=>{i(u)||(u.platformType&&u.platformType.value&&await l.sendBluePlatformType(u.platformType.value),u.wind&&u.wind.value!==null&&await l.sendBlueFengSu(u.wind.value),u.temperature&&u.temperature.value!==null&&await l.sendBlueWenDu(u.temperature.value),u.distance&&u.distance.value&&await l.sendBlueDistance(u.distance.value),u.deviceName&&u.deviceName.value&&await l.sendBlueYunTaiName(u.deviceName.value),u.airportName&&u.airportName.value&&await l.sendBlueAirportName(u.airportName.value))},d=null;return e.onMounted(()=>{d=zs.init(),d.has({type:"blueSend",fnName:"blueSend_homePage_control"})||d.bus.on("blueSend",s)}),e.onUnmounted(()=>{d.bus.off("blueSend",s)}),n({sendMessage:c}),(u,f)=>(e.openBlock(),e.createElementBlock("div"))}},ZK="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAVCAYAAABCIB6VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjk1RTNEMkMyMzg1OTExRUZCMjVBRjhEMUNGNzBFMTYzIiB4bXBNTT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NYHp5PIrO95H/anMbil21P+Fe3L776P0qHpTt9OlP873fZcy0vfPUkzwBj7gXf457pJtCyu/AVEyOYhfPAHKAAAAAElFTkSuQmCC",vl=Object.assign({name:"ControlIndex"},{__name:"controlIndex",props:["write","blueIcon","usbIcon","tipStatus","testModel","scene","blueLinkText","blueDisconnectText","usbLinkText","usbDisconnectText"],emits:["message"],setup(t,{expose:n,emit:o}){let r=ka(),{blueScanBtnShow:a,usbScanBtnShow:l,selectLinkText:s}=Gc(r),i=()=>ka,c=e.ref(null),d=e.ref(null),u=e.ref(null),f=t,y=o,h=e.computed(()=>f.tipStatus!==void 0||f.tipStatus!==null?f.tipStatus:!0),g=e.computed(()=>f.blueIcon?f.blueIcon:ZK),p=e.computed(()=>f.usbIcon?f.usbIcon:QK),w=e.computed(()=>f.testModel?f.testModel:!1),C=($,v)=>{f.testModel&&console.log("item",$),y("message",$,v)};return n({sendMessage:$=>{u.value.sendMessage($)},blueLink:()=>{c.value.scan()},blueDisconnect:()=>{c.value.disconnect()},usbLink:()=>{d.value.scan()},usbDisconnect:()=>{d.value.disconnect()},getLinkStatus:()=>({blueScanBtnShow:a.value,usbScanBtnShow:l.value,selectLinkText:s.value}),getBlueStore:i}),($,v)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(WK,{blueIcon:e.unref(g),tipStatus:e.unref(h),scene:t.scene,blueLinkText:t.blueLinkText,blueDisconnectText:t.blueDisconnectText,testModel:e.unref(w),ref_key:"bluetoothRef",ref:c},{unlink:e.withCtx(()=>[e.renderSlot($.$slots,"blueUnlink")]),link:e.withCtx(()=>[e.renderSlot($.$slots,"blueLink")]),_:3},8,["blueIcon","tipStatus","scene","blueLinkText","blueDisconnectText","testModel"]),e.createVNode(GK,{usbIcon:e.unref(p),tipStatus:e.unref(h),scene:t.scene,usbLinkText:t.usbLinkText,usbDisconnectText:t.usbDisconnectText,testModel:e.unref(w),ref_key:"usbRef",ref:d},{unlink:e.withCtx(()=>[e.renderSlot($.$slots,"usbUnlink")]),link:e.withCtx(()=>[e.renderSlot($.$slots,"usbLink")]),_:3},8,["usbIcon","tipStatus","scene","usbLinkText","usbDisconnectText","testModel"]),e.createVNode(XK,{onMessage:e.unref(C),write:t.write,ref_key:"controlRef",ref:u},null,8,["onMessage","write"])]))}});vl.install=t=>{t.component(vl.name,vl)};const JK={__name:"controlTest",setup(t){let n=e.ref(1),o=e.ref(!1),r=e.ref({deviceName:{value:null},temperature:{value:null},wind:{value:null},platformType:{value:n.value},airportName:{value:null},distance:{value:null}}),a=f=>{o.value||(u(f),i&&clearInterval(i),i=setInterval(()=>{u(f)},300))},l=e.ref(null);const s=f=>{a(f.version)};let i=null,c=(f,y=2)=>{let h=null;if(isNaN(f)){let g=parseFloat(f);isNaN(g)?h=f:(g*=Math.pow(10,y),g=Math.round(g),h=g/Math.pow(10,y))}else f*=Math.pow(10,y),f=Math.round(f),h=f/Math.pow(10,y);return h},d=.01,u=f=>{o.value=!0;let y={},h=e.toRaw(r.value);f==="version3"?(y.deviceName=h.deviceName,y.temperature=h.temperature,y.wind=h.wind,y.platformType=h.platformType,y.airportName=h.airportName,y.distance=h.distance):(y.deviceName=h.deviceName,y.temperature=h.temperature,y.wind=h.wind),y.deviceName={value:"设备测试1"},y.temperature={value:36.5},y.wind={value:17.5},y.platformType={value:n.value},y.airportName={value:"机库测试2"},d+=10,y.distance={value:c(d/1e3,2)},console.log("平台发送的数据message===>",y),l.value.sendMessage(y)};return e.onMounted(()=>{let y=l.value.getBlueStore()(),{blueScanBtnShow:h,usbScanBtnShow:g,selectLinkText:p}=Gc(y);e.watch([()=>h.value,()=>g.value,()=>p.value],([w,C,T],[k,E,N])=>{w||(o.value=!1),C||(o.value=!1),!w&&!C&&(o.value=!1,i&&clearInterval(i))})}),e.onUnmounted(async()=>{i&&clearInterval(i),i=null}),(f,y)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(vl,{onMessage:s,tipStatus:!0,testModel:!0,scene:e.unref(n),blueLinkText:"blueLinkText",blueDisconnectText:"blueDisconnectText",usbLinkText:"usbLinkText",usbDisconnectText:"usbDisconnectText",ref_key:"controlRef",ref:l},{blueUnlink:e.withCtx(()=>y[0]||(y[0]=[e.createElementVNode("div",null," blueLink ",-1)])),blueLink:e.withCtx(()=>y[1]||(y[1]=[e.createElementVNode("div",null," blueUnlink ",-1)])),usbUnlink:e.withCtx(()=>y[2]||(y[2]=[e.createElementVNode("div",null," usbLink ",-1)])),usbLink:e.withCtx(()=>y[3]||(y[3]=[e.createElementVNode("div",null," usbUnlink ",-1)])),_:1},8,["scene"])]))}},e7={__name:"App",setup(t){return(n,o)=>(e.openBlock(),e.createBlock(JK))}};/*! Element Plus v2.9.10 */var t7={name:"zh-cn",el:{breadcrumb:{label:"面包屑"},colorpicker:{confirm:"确定",clear:"清空",defaultLabel:"颜色选择器",description:"当前颜色 {color},按 Enter 键选择新颜色",alphaLabel:"选择透明度的值"},datepicker:{now:"此刻",today:"今天",cancel:"取消",clear:"清空",confirm:"确定",dateTablePrompt:"使用方向键与 Enter 键可选择日期",monthTablePrompt:"使用方向键与 Enter 键可选择月份",yearTablePrompt:"使用方向键与 Enter 键可选择年份",selectedDate:"已选日期",selectDate:"选择日期",selectTime:"选择时间",startDate:"开始日期",startTime:"开始时间",endDate:"结束日期",endTime:"结束时间",prevYear:"前一年",nextYear:"后一年",prevMonth:"上个月",nextMonth:"下个月",year:"年",month1:"1 月",month2:"2 月",month3:"3 月",month4:"4 月",month5:"5 月",month6:"6 月",month7:"7 月",month8:"8 月",month9:"9 月",month10:"10 月",month11:"11 月",month12:"12 月",weeks:{sun:"日",mon:"一",tue:"二",wed:"三",thu:"四",fri:"五",sat:"六"},weeksFull:{sun:"星期日",mon:"星期一",tue:"星期二",wed:"星期三",thu:"星期四",fri:"星期五",sat:"星期六"},months:{jan:"一月",feb:"二月",mar:"三月",apr:"四月",may:"五月",jun:"六月",jul:"七月",aug:"八月",sep:"九月",oct:"十月",nov:"十一月",dec:"十二月"}},inputNumber:{decrease:"减少数值",increase:"增加数值"},select:{loading:"加载中",noMatch:"无匹配数据",noData:"无数据",placeholder:"请选择"},dropdown:{toggleDropdown:"切换下拉选项"},mention:{loading:"加载中"},cascader:{noMatch:"无匹配数据",loading:"加载中",placeholder:"请选择",noData:"暂无数据"},pagination:{goto:"前往",pagesize:"条/页",total:"共 {total} 条",pageClassifier:"页",page:"页",prev:"上一页",next:"下一页",currentPage:"第 {pager} 页",prevPages:"向前 {pager} 页",nextPages:"向后 {pager} 页",deprecationWarning:"你使用了一些已被废弃的用法,请参考 el-pagination 的官方文档"},dialog:{close:"关闭此对话框"},drawer:{close:"关闭此对话框"},messagebox:{title:"提示",confirm:"确定",cancel:"取消",error:"输入的数据不合法!",close:"关闭此对话框"},upload:{deleteTip:"按 Delete 键可删除",delete:"删除",preview:"查看图片",continue:"继续上传"},slider:{defaultLabel:"滑块介于 {min} 至 {max}",defaultRangeStartLabel:"选择起始值",defaultRangeEndLabel:"选择结束值"},table:{emptyText:"暂无数据",confirmFilter:"筛选",resetFilter:"重置",clearFilter:"全部",sumText:"合计"},tour:{next:"下一步",previous:"上一步",finish:"结束导览"},tree:{emptyText:"暂无数据"},transfer:{noMatch:"无匹配数据",noData:"无数据",titles:["列表 1","列表 2"],filterPlaceholder:"请输入搜索内容",noCheckedFormat:"共 {total} 项",hasCheckedFormat:"已选 {checked}/{total} 项"},image:{error:"加载失败"},pageHeader:{title:"返回"},popconfirm:{confirmButtonText:"确定",cancelButtonText:"取消"},carousel:{leftArrow:"上一张幻灯片",rightArrow:"下一张幻灯片",indicator:"幻灯片切换至索引 {index}"}}};function n7(t){return typeof t=="object"&&t!==null}function Hk(t,n){return t=n7(t)?t:Object.create(null),new Proxy(t,{get(o,r,a){return r==="key"?Reflect.get(o,r,a):Reflect.get(o,r,a)||Reflect.get(n,r,a)}})}function o7(t,n){return n.reduce((o,r)=>o==null?void 0:o[r],t)}function r7(t,n,o){return n.slice(0,-1).reduce((r,a)=>/^(__proto__)$/.test(a)?{}:r[a]=r[a]||{},t)[n[n.length-1]]=o,t}function a7(t,n){return n.reduce((o,r)=>{const a=r.split(".");return r7(o,a,o7(t,a))},{})}function l7(t,n){return o=>{var r;try{const{storage:a=localStorage,beforeRestore:l=void 0,afterRestore:s=void 0,serializer:i={serialize:JSON.stringify,deserialize:JSON.parse},key:c=n.$id,paths:d=null,debug:u=!1}=o;return{storage:a,beforeRestore:l,afterRestore:s,serializer:i,key:((r=t.key)!=null?r:f=>f)(typeof c=="string"?c:c(n.$id)),paths:d,debug:u}}catch(a){return o.debug&&console.error("[pinia-plugin-persistedstate]",a),null}}}function jk(t,{storage:n,serializer:o,key:r,debug:a}){try{const l=n==null?void 0:n.getItem(r);l&&t.$patch(o==null?void 0:o.deserialize(l))}catch(l){a&&console.error("[pinia-plugin-persistedstate]",l)}}function Kk(t,{storage:n,serializer:o,key:r,paths:a,debug:l}){try{const s=Array.isArray(a)?a7(t,a):t;n.setItem(r,o.serialize(s))}catch(s){l&&console.error("[pinia-plugin-persistedstate]",s)}}function s7(t={}){return n=>{const{auto:o=!1}=t,{options:{persist:r=o},store:a,pinia:l}=n;if(!r)return;if(!(a.$id in l.state.value)){const i=l._s.get(a.$id.replace("__hot:",""));i&&Promise.resolve().then(()=>i.$persist());return}const s=(Array.isArray(r)?r.map(i=>Hk(i,t)):[Hk(r,t)]).map(l7(t,a)).filter(Boolean);a.$persist=()=>{s.forEach(i=>{Kk(a.$state,i)})},a.$hydrate=({runHooks:i=!0}={})=>{s.forEach(c=>{const{beforeRestore:d,afterRestore:u}=c;i&&(d==null||d(n)),jk(a,c),i&&(u==null||u(n))})},s.forEach(i=>{const{beforeRestore:c,afterRestore:d}=i;c==null||c(n),jk(a,i),d==null||d(n),a.$subscribe((u,f)=>{Kk(f,i)},{detached:!0})})}}var i7=s7();let Wk=RK();Wk.use(i7);const Qc=e.createApp(e7);Qc.use(Wk),Qc.use(uK,{locale:t7}),Qc.mount("#app");const c7=Object.freeze(Object.defineProperty({__proto__:null,app:Qc},Symbol.toStringTag,{value:"Module"}));let d7=[vl],Uk=t=>{d7.forEach(n=>{t.component(n.name,n)})};const u7={install:Uk,Main:c7};zt.BoweeControl=vl,zt.default=u7,zt.install=Uk,Object.defineProperties(zt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|