@gaidalou/control 1.0.12 → 1.0.13

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.
@@ -45762,7 +45762,7 @@ const cS = "MYESP32", dS = ["000000ff-0000-1000-8000-00805f9b34fb"], fS = {
45762
45762
  // 滑动按钮
45763
45763
  4: "rotateKey"
45764
45764
  // 旋钮
45765
- }, pS = ["ok", "horizontalSpeed", "verticalSpeed", "manualInvestigation", "algorithm", "openAiView", "remoteIntercom"], vS = ["leftYaoGanLR", "leftYaoGanTB", "rightYaoGanLR", "rightYaoGanTB", "centerYaoGanLR", "centerYaoGanTB", "leftYaoGanRoll", "rightYaoGanRoll"], ms = {
45765
+ }, pS = ["ok", "horizontalSpeed", "verticalSpeed", "manualInvestigation", "algorithm", "openAiView", "remoteIntercom", "flashingLighting", "realTimeShouting"], vS = ["leftYaoGanLR", "leftYaoGanTB", "rightYaoGanLR", "rightYaoGanTB", "centerYaoGanLR", "centerYaoGanTB", "leftYaoGanRoll", "rightYaoGanRoll"], ms = {
45766
45766
  0: "version1",
45767
45767
  // 第一代
45768
45768
  1: "version2"
@@ -86,7 +86,7 @@ Only state can be modified.`);s[0]="$state",_l=!1,r.set(l,s,r.state.value),_l=!0
86
86
  state: () => new MyClass()
87
87
  Found in store "${b.$id}".`),g&&l&&o.hydrate&&o.hydrate(b.$state,g),d=!0,u=!0,b}/*! #__NO_SIDE_EFFECTS__ */function AK(t,n,o){let r,a;const l=typeof n=="function";r=t,a=l?o:n;function s(i,c){const d=e.hasInjectionContext();if(i=(process.env.NODE_ENV==="test"&&Rs&&Rs._testing?null:i)||(d?e.inject(hk,null):null),i&&Ps(i),process.env.NODE_ENV!=="production"&&!Rs)throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
88
88
  See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
89
- This will fail in production.`);i=Rs,i._s.has(r)||(l?Yp(r,n,a,i):vk(r,a,i),process.env.NODE_ENV!=="production"&&(s._pinia=i));const u=i._s.get(r);if(process.env.NODE_ENV!=="production"&&c){const f="__hot:"+r,y=l?Yp(f,n,a,i,!0):vk(f,ho({},a),i,!0);c._hotUpdate(y),delete i.state.value[f],i._s.delete(f)}if(process.env.NODE_ENV!=="production"&&Lr){const f=e.getCurrentInstance();if(f&&f.proxy&&!c){const y=f.proxy,h="_pStores"in y?y._pStores:y._pStores={};h[r]=u}}return u}return s.$id=r,s}function Gp(t){{const n=e.toRaw(t),o={};for(const r in n){const a=n[r];a.effect?o[r]=e.computed({get:()=>t[r],set(l){t[r]=l}}):(e.isRef(a)||e.isReactive(a))&&(o[r]=e.toRef(t,r))}return o}}const Mk="MYESP32",Ok=["000000ff-0000-1000-8000-00805f9b34fb"],Ik={0:"sendToYaoKongQi",1:"key",2:"yaoGan",3:"scrollKey",4:"rotateKey"},Dk=["ok","horizontalSpeed","verticalSpeed","manualInvestigation","algorithm","openAiView","remoteIntercom"],Rk=["leftYaoGanLR","leftYaoGanTB","rightYaoGanLR","rightYaoGanTB","centerYaoGanLR","centerYaoGanTB","leftYaoGanRoll","rightYaoGanRoll"],Vl={0:"version1",1:"version2"},Pk={[Vl[0]]:{key:{0:{type:"action",value:"emergencyStop"},1:null,2:{type:"action",value:"oneClickTakeoff"},3:{type:"action",value:"oneClickReturn"},4:{type:"action",value:"cancelReturnFlight"},5:null,6:{type:"action",value:"seizureControl"},7:{type:"action",value:"guideFlight"},8:{type:"action",value:"suspendRoute"},9:{type:"action",value:"executeRoute"},10:{type:"action",value:"cancelRoute"},11:null,12:{type:"action",value:"airportRestart"},13:{type:"action",value:"airportSupplementaryLighting"},14:{type:"action",value:"airportHatchCover"},15:null,16:null,17:null,18:{type:"action",value:"airportSelection"},19:{type:"action",value:"routeSelection"},20:{type:"action",value:"ok"},21:null,22:{type:"action",value:"cameraSwitching"},23:{type:"action",value:"consoleToMiddle"},24:{type:"action",value:"followFuselage"},25:{type:"action",value:"lensRemoveFog"},26:null,27:{type:"action",value:"pictureQualitySwitching"},28:{type:"action",value:"panoramicShooting"},29:{type:"action",value:"watermark"},30:{type:"action",value:"fullScreen"},31:null,32:{type:"action",value:"pictureInPicture"},33:{type:"action",value:"algorithm"},34:{type:"page",value:"/monitoring/dataStatistics"},35:{type:"page",value:"/monitoring/WarningRecord"},36:null,37:{type:"action",value:"radarAlert"},38:{type:"action",value:"birdRepellentAlert"},39:{type:"action",value:"soundAndLightWarning"},40:{type:"action",value:"airportGuidelines"},41:null,42:{type:"page",value:"/monitoring/dailyData"},43:{type:"action",value:"photograph"},44:{type:"action",value:"videotape"},45:{type:"page",value:"/monitoring/dailyData"},46:{type:"page",value:"/monitoring/orthographShow"},47:{type:"page",value:"/monitoring/panoramaShow"},48:{type:"page",value:"/monitoring/threeModelShow"},49:{type:"page",value:"/monitoring/fightPlan?toStatus=0"},50:{type:"page",value:"/monitoring/comparison"},51:{type:"action",value:"layerChange"},53:{type:"action",value:"videotape"},54:{type:"action",value:"photograph"}},yaoGan:{66:{type:"action",value:"leftYaoGanLR"},67:{type:"action",value:"leftYaoGanTB"},68:{type:"action",value:"rightYaoGanLR"},69:{type:"action",value:"rightYaoGanTB"},70:{type:"action",value:"centerYaoGanLR"},71:{type:"action",value:"centerYaoGanTB"},72:{type:"action",value:"leftYaoGanRoll"},73:{type:"action",value:"rightYaoGanRoll"}},scrollKey:{56:{type:"action",value:"horizontalSpeed"},57:{type:"action",value:"verticalSpeed"}},rotateKey:{}},[Vl[1]]:{key:{0:{type:"action",value:"emergencyStop"},1:null,2:{type:"action",value:"oneClickTakeoff"},3:{type:"action",value:"oneClickReturn"},4:{type:"action",value:"pageBack"},5:null,6:{type:"action",value:"seizureControl"},7:null,8:{type:"action",value:"suspendRoute"},9:{type:"action",value:"executeRoute"},10:{type:"action",value:"cancelRoute"},11:null,12:{type:"action",value:"airportRestart"},13:{type:"action",value:"laserAlert"},14:{type:"action",value:"birdRepellentAlert"},15:{type:"action",value:"realTimeShouting"},16:{type:"action",value:"deviceSelection"},17:{type:"page",value:"/monitoring/systemSetting"},18:{type:"action",value:"airportSelection"},19:{type:"action",value:"routeSelection"},20:{type:"action",value:"ok"},21:{type:"action",value:"cancel"},22:{type:"action",value:"cameraSwitching"},23:{type:"action",value:"consoleToMiddle"},24:{type:"action",value:"followFuselage"},25:null,26:{type:"action",value:"remoteIntercom"},27:{type:"action",value:"pictureQualitySwitching"},28:null,29:{type:"action",value:"watermark"},30:{type:"action",value:"fullScreen"},31:{type:"action",value:"manualInvestigation"},32:{type:"action",value:"openAiView"},33:{type:"page",value:"/monitoring/WarningRecord"},34:{type:"page",value:"/monitoring/dataStatistics"},35:{type:"action",value:"layerChange"},36:{type:"action",value:"uavPort"},37:{type:"action",value:"radarAlert"},38:{type:"action",value:"airportHatchCover"},39:{type:"action",value:"soundAndLightWarning"},40:null,41:{type:"action",value:"toVirtualCabin"},42:{type:"page",value:"/monitoring/dailyData"},43:{type:"action",value:"photograph"},44:{type:"action",value:"videotape"},45:{type:"page",value:"/monitoring/dailyData"},46:{type:"page",value:"/monitoring/orthographShow"},47:{type:"page",value:"/monitoring/panoramaShow"},48:{type:"page",value:"/monitoring/threeModelShow"},49:{type:"page",value:"/monitoring/fightPlan?toStatus=0"},50:{type:"action",value:"flashingLighting"},51:{type:"action",value:"algorithm"},52:{type:"action",value:"airportSupplementaryLighting"},53:{type:"action",value:"videotape"},54:{type:"action",value:"photograph"}},yaoGan:{66:{type:"action",value:"leftYaoGanLR"},67:{type:"action",value:"leftYaoGanTB"},68:{type:"action",value:"rightYaoGanLR"},69:{type:"action",value:"rightYaoGanTB"},70:{type:"action",value:"centerYaoGanLR"},71:{type:"action",value:"centerYaoGanTB"},72:{type:"action",value:"leftYaoGanRoll"},73:{type:"action",value:"rightYaoGanRoll"}},scrollKey:{56:{type:"action",value:"horizontalSpeed"},57:{type:"action",value:"verticalSpeed"}},rotateKey:{}}};let ka=AK("blue",{state:()=>({blueMessage:null,blueScanBtnShow:!1,usbScanBtnShow:!1,horizontalSpeedValue:0,verticalSpeedValue:0,systemSetPage:0,systemShouShi:2,blueControl:!1,blueControlStatus:!0,blueControlKey:null,selectLinkText:"请选择"}),actions:{updateBlueMessage(t){this.blueMessage=t},getBlueNum(t){let{version:n,type:o,code:r}=t;return n?Pk[n][o][r]?Pk[n][o][r]:"":{}},updateBlueControlKey(t){this.blueControlKey=t}},getters:{},persist:{paths:[]}});function zK(t){return{all:t=t||new Map,on:function(n,o){var r=t.get(n);r?r.push(o):t.set(n,[o])},off:function(n,o){var r=t.get(n);r&&(o?r.splice(r.indexOf(o)>>>0,1):t.set(n,[]))},emit:function(n,o){var r=t.get(n);r&&r.slice().map(function(a){a(o)}),(r=t.get("*"))&&r.slice().map(function(a){a(n,o)})}}}const Gc=class Gc{static init(){return this.instance==null&&(this.instance=new Gc),this.instance}constructor(){this.bus=zK()}has(n){let o=!1;if(!n)return o;let{type:r,fnName:a}=n,l=this.bus.all.get(r),s=!1;if(l)for(let i=0;i<l.length;i++)l[i].name===a&&(s=!0);return s&&(o=s),o}};Il(Gc,"instance",null);let As=Gc;const Xc=class Xc{static init(n){return this.instance==null&&(this.instance=new Xc(n)),this.instance}constructor(n){let o="",r="",a=!1;n&&(o=n.namePreFix,r=n.serviceUUIDs,a=n.testModel),this.mitt=As.init(),this.name=o,this.services=r,this.testModel=a,this.device=null,this.deviceName="",this.server=null,this.allServices=null,this.webBleInfos=[],this.webBleInfosObj={},this.version=Vl[0]}async getDevice(){this.device=await navigator.bluetooth.requestDevice({filters:[{namePrefix:this.name},{services:this.services}]}),this.deviceName=this.device.gatt.device.name}async connect(){this.server=await this.device.gatt.connect()}async getAllServers(){this.allServices=await this.server.getPrimaryServices()}async getAllCharacters(n){let o=null;for await(const r of this.allServices){let a=await this.server.getPrimaryService(r.uuid);o={uuid:r.uuid,service:a,children:[]};let l=await a.getCharacteristics();for await(const s of l){let i=await a.getCharacteristic(s.uuid),c={uuid:s.uuid,characteristic:i,children:[]};o.children.push(c);let d=s.uuid.split("-")[0],u=i;this.webBleInfosObj[d]=u,i.properties.notify&&await this.listening(i)}}if(this.webBleInfos.push(o),n){let{back:r}=n;r&&r()}}listening(n){return new Promise(o=>{new TextDecoder,n.addEventListener("characteristicvaluechanged",r=>{let a=r.target.value;this.testModel&&console.log("blue 接受的数据receivedData",a);let l=ka(),s=new Uint8Array(a.buffer),i=new Int8Array(a.buffer),c=Ik[s[4]],d=s[5],u="";if(c==="sendToYaoKongQi")return;c==="key"&&d===255&&(this.version=Vl[s[6]]);let f=l.getBlueNum({version:this.version,type:c,code:d});f.type==="action"&&(Dk.some(y=>y===f.value)?f.value==="remoteIntercom"?u=s.slice(6):u=s[6]:Rk.some(y=>y===f.value)&&(u=i[6])),!(c==="key"&&d===255&&u==="")&&(this.testModel&&console.log("<===blue 接收的数据 类型 type==>",c,`\r
89
+ This will fail in production.`);i=Rs,i._s.has(r)||(l?Yp(r,n,a,i):vk(r,a,i),process.env.NODE_ENV!=="production"&&(s._pinia=i));const u=i._s.get(r);if(process.env.NODE_ENV!=="production"&&c){const f="__hot:"+r,y=l?Yp(f,n,a,i,!0):vk(f,ho({},a),i,!0);c._hotUpdate(y),delete i.state.value[f],i._s.delete(f)}if(process.env.NODE_ENV!=="production"&&Lr){const f=e.getCurrentInstance();if(f&&f.proxy&&!c){const y=f.proxy,h="_pStores"in y?y._pStores:y._pStores={};h[r]=u}}return u}return s.$id=r,s}function Gp(t){{const n=e.toRaw(t),o={};for(const r in n){const a=n[r];a.effect?o[r]=e.computed({get:()=>t[r],set(l){t[r]=l}}):(e.isRef(a)||e.isReactive(a))&&(o[r]=e.toRef(t,r))}return o}}const Mk="MYESP32",Ok=["000000ff-0000-1000-8000-00805f9b34fb"],Ik={0:"sendToYaoKongQi",1:"key",2:"yaoGan",3:"scrollKey",4:"rotateKey"},Dk=["ok","horizontalSpeed","verticalSpeed","manualInvestigation","algorithm","openAiView","remoteIntercom","flashingLighting","realTimeShouting"],Rk=["leftYaoGanLR","leftYaoGanTB","rightYaoGanLR","rightYaoGanTB","centerYaoGanLR","centerYaoGanTB","leftYaoGanRoll","rightYaoGanRoll"],Vl={0:"version1",1:"version2"},Pk={[Vl[0]]:{key:{0:{type:"action",value:"emergencyStop"},1:null,2:{type:"action",value:"oneClickTakeoff"},3:{type:"action",value:"oneClickReturn"},4:{type:"action",value:"cancelReturnFlight"},5:null,6:{type:"action",value:"seizureControl"},7:{type:"action",value:"guideFlight"},8:{type:"action",value:"suspendRoute"},9:{type:"action",value:"executeRoute"},10:{type:"action",value:"cancelRoute"},11:null,12:{type:"action",value:"airportRestart"},13:{type:"action",value:"airportSupplementaryLighting"},14:{type:"action",value:"airportHatchCover"},15:null,16:null,17:null,18:{type:"action",value:"airportSelection"},19:{type:"action",value:"routeSelection"},20:{type:"action",value:"ok"},21:null,22:{type:"action",value:"cameraSwitching"},23:{type:"action",value:"consoleToMiddle"},24:{type:"action",value:"followFuselage"},25:{type:"action",value:"lensRemoveFog"},26:null,27:{type:"action",value:"pictureQualitySwitching"},28:{type:"action",value:"panoramicShooting"},29:{type:"action",value:"watermark"},30:{type:"action",value:"fullScreen"},31:null,32:{type:"action",value:"pictureInPicture"},33:{type:"action",value:"algorithm"},34:{type:"page",value:"/monitoring/dataStatistics"},35:{type:"page",value:"/monitoring/WarningRecord"},36:null,37:{type:"action",value:"radarAlert"},38:{type:"action",value:"birdRepellentAlert"},39:{type:"action",value:"soundAndLightWarning"},40:{type:"action",value:"airportGuidelines"},41:null,42:{type:"page",value:"/monitoring/dailyData"},43:{type:"action",value:"photograph"},44:{type:"action",value:"videotape"},45:{type:"page",value:"/monitoring/dailyData"},46:{type:"page",value:"/monitoring/orthographShow"},47:{type:"page",value:"/monitoring/panoramaShow"},48:{type:"page",value:"/monitoring/threeModelShow"},49:{type:"page",value:"/monitoring/fightPlan?toStatus=0"},50:{type:"page",value:"/monitoring/comparison"},51:{type:"action",value:"layerChange"},53:{type:"action",value:"videotape"},54:{type:"action",value:"photograph"}},yaoGan:{66:{type:"action",value:"leftYaoGanLR"},67:{type:"action",value:"leftYaoGanTB"},68:{type:"action",value:"rightYaoGanLR"},69:{type:"action",value:"rightYaoGanTB"},70:{type:"action",value:"centerYaoGanLR"},71:{type:"action",value:"centerYaoGanTB"},72:{type:"action",value:"leftYaoGanRoll"},73:{type:"action",value:"rightYaoGanRoll"}},scrollKey:{56:{type:"action",value:"horizontalSpeed"},57:{type:"action",value:"verticalSpeed"}},rotateKey:{}},[Vl[1]]:{key:{0:{type:"action",value:"emergencyStop"},1:null,2:{type:"action",value:"oneClickTakeoff"},3:{type:"action",value:"oneClickReturn"},4:{type:"action",value:"pageBack"},5:null,6:{type:"action",value:"seizureControl"},7:null,8:{type:"action",value:"suspendRoute"},9:{type:"action",value:"executeRoute"},10:{type:"action",value:"cancelRoute"},11:null,12:{type:"action",value:"airportRestart"},13:{type:"action",value:"laserAlert"},14:{type:"action",value:"birdRepellentAlert"},15:{type:"action",value:"realTimeShouting"},16:{type:"action",value:"deviceSelection"},17:{type:"page",value:"/monitoring/systemSetting"},18:{type:"action",value:"airportSelection"},19:{type:"action",value:"routeSelection"},20:{type:"action",value:"ok"},21:{type:"action",value:"cancel"},22:{type:"action",value:"cameraSwitching"},23:{type:"action",value:"consoleToMiddle"},24:{type:"action",value:"followFuselage"},25:null,26:{type:"action",value:"remoteIntercom"},27:{type:"action",value:"pictureQualitySwitching"},28:null,29:{type:"action",value:"watermark"},30:{type:"action",value:"fullScreen"},31:{type:"action",value:"manualInvestigation"},32:{type:"action",value:"openAiView"},33:{type:"page",value:"/monitoring/WarningRecord"},34:{type:"page",value:"/monitoring/dataStatistics"},35:{type:"action",value:"layerChange"},36:{type:"action",value:"uavPort"},37:{type:"action",value:"radarAlert"},38:{type:"action",value:"airportHatchCover"},39:{type:"action",value:"soundAndLightWarning"},40:null,41:{type:"action",value:"toVirtualCabin"},42:{type:"page",value:"/monitoring/dailyData"},43:{type:"action",value:"photograph"},44:{type:"action",value:"videotape"},45:{type:"page",value:"/monitoring/dailyData"},46:{type:"page",value:"/monitoring/orthographShow"},47:{type:"page",value:"/monitoring/panoramaShow"},48:{type:"page",value:"/monitoring/threeModelShow"},49:{type:"page",value:"/monitoring/fightPlan?toStatus=0"},50:{type:"action",value:"flashingLighting"},51:{type:"action",value:"algorithm"},52:{type:"action",value:"airportSupplementaryLighting"},53:{type:"action",value:"videotape"},54:{type:"action",value:"photograph"}},yaoGan:{66:{type:"action",value:"leftYaoGanLR"},67:{type:"action",value:"leftYaoGanTB"},68:{type:"action",value:"rightYaoGanLR"},69:{type:"action",value:"rightYaoGanTB"},70:{type:"action",value:"centerYaoGanLR"},71:{type:"action",value:"centerYaoGanTB"},72:{type:"action",value:"leftYaoGanRoll"},73:{type:"action",value:"rightYaoGanRoll"}},scrollKey:{56:{type:"action",value:"horizontalSpeed"},57:{type:"action",value:"verticalSpeed"}},rotateKey:{}}};let ka=AK("blue",{state:()=>({blueMessage:null,blueScanBtnShow:!1,usbScanBtnShow:!1,horizontalSpeedValue:0,verticalSpeedValue:0,systemSetPage:0,systemShouShi:2,blueControl:!1,blueControlStatus:!0,blueControlKey:null,selectLinkText:"请选择"}),actions:{updateBlueMessage(t){this.blueMessage=t},getBlueNum(t){let{version:n,type:o,code:r}=t;return n?Pk[n][o][r]?Pk[n][o][r]:"":{}},updateBlueControlKey(t){this.blueControlKey=t}},getters:{},persist:{paths:[]}});function zK(t){return{all:t=t||new Map,on:function(n,o){var r=t.get(n);r?r.push(o):t.set(n,[o])},off:function(n,o){var r=t.get(n);r&&(o?r.splice(r.indexOf(o)>>>0,1):t.set(n,[]))},emit:function(n,o){var r=t.get(n);r&&r.slice().map(function(a){a(o)}),(r=t.get("*"))&&r.slice().map(function(a){a(n,o)})}}}const Gc=class Gc{static init(){return this.instance==null&&(this.instance=new Gc),this.instance}constructor(){this.bus=zK()}has(n){let o=!1;if(!n)return o;let{type:r,fnName:a}=n,l=this.bus.all.get(r),s=!1;if(l)for(let i=0;i<l.length;i++)l[i].name===a&&(s=!0);return s&&(o=s),o}};Il(Gc,"instance",null);let As=Gc;const Xc=class Xc{static init(n){return this.instance==null&&(this.instance=new Xc(n)),this.instance}constructor(n){let o="",r="",a=!1;n&&(o=n.namePreFix,r=n.serviceUUIDs,a=n.testModel),this.mitt=As.init(),this.name=o,this.services=r,this.testModel=a,this.device=null,this.deviceName="",this.server=null,this.allServices=null,this.webBleInfos=[],this.webBleInfosObj={},this.version=Vl[0]}async getDevice(){this.device=await navigator.bluetooth.requestDevice({filters:[{namePrefix:this.name},{services:this.services}]}),this.deviceName=this.device.gatt.device.name}async connect(){this.server=await this.device.gatt.connect()}async getAllServers(){this.allServices=await this.server.getPrimaryServices()}async getAllCharacters(n){let o=null;for await(const r of this.allServices){let a=await this.server.getPrimaryService(r.uuid);o={uuid:r.uuid,service:a,children:[]};let l=await a.getCharacteristics();for await(const s of l){let i=await a.getCharacteristic(s.uuid),c={uuid:s.uuid,characteristic:i,children:[]};o.children.push(c);let d=s.uuid.split("-")[0],u=i;this.webBleInfosObj[d]=u,i.properties.notify&&await this.listening(i)}}if(this.webBleInfos.push(o),n){let{back:r}=n;r&&r()}}listening(n){return new Promise(o=>{new TextDecoder,n.addEventListener("characteristicvaluechanged",r=>{let a=r.target.value;this.testModel&&console.log("blue 接受的数据receivedData",a);let l=ka(),s=new Uint8Array(a.buffer),i=new Int8Array(a.buffer),c=Ik[s[4]],d=s[5],u="";if(c==="sendToYaoKongQi")return;c==="key"&&d===255&&(this.version=Vl[s[6]]);let f=l.getBlueNum({version:this.version,type:c,code:d});f.type==="action"&&(Dk.some(y=>y===f.value)?f.value==="remoteIntercom"?u=s.slice(6):u=s[6]:Rk.some(y=>y===f.value)&&(u=i[6])),!(c==="key"&&d===255&&u==="")&&(this.testModel&&console.log("<===blue 接收的数据 类型 type==>",c,`\r
90
90
  <===命令code decodedString==>`,d,`\r
91
91
  <===命令value type==>`,u,`\r
92
92
  <===版本heart version==>`,this.version),this.mitt.bus.emit("blueSend",{version:this.version,type:c,code:d,value:u}))}),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:Mk,serviceUUIDs:Ok}),{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)}};Il(Xc,"instance",null);let Cr=Xc;const Zc=class Zc{static init(n){return this.instance==null&&(this.instance=new Zc(n)),this.instance}constructor(n){let o=!1;n&&(o=n.testModel),this.testModel=o,this.serialPort=null,this.reader=null,this.mitt=As.init(),this.version=Vl[0],this.timerLongData=null,this.timerLongDataFlag=null}async connect(n){try{if(this.serialPort=await navigator.serial.requestPort(),n){let{back:a}=n;a&&a()}let o=9600;await this.serialPort.open({baudRate:o}),await this.serialPort.close(),await this.serialPort.open({baudRate:o});let r=new Uint8Array;for(this.reader=this.serialPort.readable.getReader();;){let{value:a,done:l}=await this.reader.read();if(l)break;let s=new Uint8Array(r.length+a.length);s.set(r,0),s.set(a,r.length),r=s;let i=r[5];if(i===26){if(r.length>=262){let c=r.slice(0,262);this.dataReceived(c),r=r.slice(262)}this.timerLongDataFlag=!0,this.timerLongData&&clearTimeout(this.timerLongData),this.timerLongData=setTimeout(()=>{r=new Uint8Array,this.timerLongDataFlag=!1},500)}else if(i===15){if(r.length>=262){let c=r.slice(0,262);this.dataReceived(c),r=r.slice(262)}this.timerLongDataFlag=!0,this.timerLongData&&clearTimeout(this.timerLongData),this.timerLongData=setTimeout(()=>{r=new Uint8Array,this.timerLongDataFlag=!1},500)}else r.length%19===0&&(this.dataReceived(r),r=new Uint8Array),this.timerLongDataFlag&&(this.timerLongData&&clearTimeout(this.timerLongData),this.timerLongData=setTimeout(()=>{r=new Uint8Array,this.timerLongDataFlag=!1},500))}}catch(o){console.error("出现错误:",o)}}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=Ik[a[4]],i=a[5],c="";if(s==="sendToYaoKongQi"||(s==="key"&&i===255&&(this.version=Vl[a[6]]),!s))return;let d=r.getBlueNum({version:this.version,type:s,code:i});d.type==="action"&&(Dk.some(u=>u===d.value)?d.value==="remoteIntercom"?c=a.slice(6):c=a[6]:Rk.some(u=>u===d.value)&&(c=l[6])),!(s==="key"&&i===255&&c==="")&&(this.testModel&&console.log("<===usb 接收的数据 类型 type==>",s,`\r
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaidalou/control",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Vue3 control component",
5
5
  "type": "module",
6
6
  "author": "Dalou Gai",