当前位置: 首页 > news >正文

uniapp 小程序低功耗蓝牙配网 ble配网 物联网

 1.获取蓝牙列表  bleList.vue

<template><view><button @touchstart="startSearch">获取蓝牙列表</button><scroll-view :scroll-top="scrollTop" scroll-y class="content-pop"><viewclass="bluetoothItem"v-for="(item, index) in bluetoohList":key="index"@click="openControl(item)"><view class="textItem">蓝牙:{{ item.name }}</view><view>{{ item.deviceId }}</view></view></scroll-view></view>
</template><script>
export default {data() {return {bluetoohList: [],};},onLoad: function (options) {this.startSearch();},methods: {// 连接蓝牙startSearch() {let that = this;that.$ble.openBluetoothAdapter((res) => {that.$ble.getBluetoothAdapterState((res) => {if (res.available) {if (res.discovering) {that.$ble.stopBluetoothDevicesDiscovery();} else {that.getBluetoothDevices();}that.checkPemission();} else {that.$tip.toast("本机蓝牙不可用");}});},(err) => {that.openSetting();});},openSetting() {let params = {title: "检测到您没打开蓝牙权限,是否去设置打开?",showCancel: true,};this.$tip.showModal(params, (res) => {if (res.confirm) {this.$ble.openSetting();}});},checkPemission() {//android 6.0以上需授权地理位置权限var that = this;const sys = uni.getSystemInfoSync();if (sys.platform == "ios") {that.getBluetoothDevices();} else if (sys.platform == "android") {console.log(app.getSystem().substring(app.getSystem().length - (app.getSystem().length - 8),app.getSystem().length - (app.getSystem().length - 8) + 1));if (app.globalData.getSystem().substring(app.globalData.getSystem().length -(app.globalData.getSystem().length - 8),app.globalData.getSystem().length -(app.globalData.getSystem().length - 8) +1) > 5) {uni.getSetting({success: (res) => {console.log(res);if (!res.authSetting["scope.userLocation"]) {uni.authorize({scope: "scope.userLocation",complete: (res) => {that.getBluetoothDevices();},});} else {that.getBluetoothDevices();}},});}}},//获取蓝牙设备信息getBluetoothDevices() {that.$tip.loading("蓝牙搜索中");this.$ble.getBluetoothDevices((res) => {this.bluetoohList = res;this.$tip.loaded();});},// 连接蓝牙 跳转到连接页面openControl(item) {let params = {list: this.bluetoohList,info: item,};this.$tip.redirectTo("/pages/ble/ble", params);},},
};
</script><style scoped>
.content-pop {width: 100vw;max-height: 55vh;padding: 0 30rpx;
}
.bluetoothItem {padding: 20rpx 0;font-weight: 400;font-size: 28rpx;border-bottom: 1rpx solid #f4f4f4;text-align: left;
}
.textItem {display: block;margin-bottom: 10rpx;
}
</style>

2.选择蓝牙进行连接  ble.vue

<script>
export default {data() {return {bluInfo: {},services: [],bleServiceId: "",serviceId: 0,writeCharacter: false,readCharacter: false,notifyCharacter: false,BLEInformation: {serveiceId: "",config_write_char_id: "",cmd_write_char_id: "",config_read_char_id: "",cmd_read_char_id: "",},};},onLoad(option) {// 接收页面传递的数据this.bluInfo = JSON.parse(decodeURIComponent(option.info));this.bluetooh(this.bluInfo.info.deviceId);},methods: {bluetooh(deviceId) {var that = this;that.$ble.stopBluetoothDevicesDiscovery();that.$ble.createBLEConnection(deviceId,(res) => {that.getSeviceId(deviceId);},(err) => {console.log(err);that.bluetoothFail();});},// 连接成功后保存连接状态getSeviceId(deviceId) {var that = this;that.$ble.getBLEDeviceServices(deviceId,(res) => {that.services = res.services;that.bleServiceId = res.services[0].uuid;this.BLEInformation.serveiceId = res.services[0].uuid;that.getCharacteristics(deviceId);},(err) => {console.log(err);that.bluetoothFail();});},getCharacteristics(deviceId) {var that = this;var list = that.services;var num = that.serviceId;var write = that.writeCharacter;var read = that.readCharacter;var notify = that.notifyCharacter;that.$ble.getBLEDeviceCharacteristics(deviceId,that.bleServiceId,(res) => {for (var i = 0; i < res.characteristics.length; ++i) {var properties = res.characteristics[i].properties;if (!notify) {if (properties.notify) {notify = true;}}if (!write) {if (properties.write) {this.BLEInformation.config_write_char_id =res.characteristics[2].uuid;this.BLEInformation.cmd_write_char_id =res.characteristics[0].uuid;write = true;}}if (!read) {if (properties.read) {this.BLEInformation.config_read_char_id =res.characteristics[3].uuid;this.BLEInformation.cmd_read_char_id =res.characteristics[1].uuid;read = true;}}}if (!write || !notify || !read) {num++;(that.writeCharacter = write),(that.readCharacter = read),(that.notifyCharacter = notify),(that.serviceId = num);if (num == list.length) {// console.log("找不到该读写的特征值")that.bluetoothFail();} else {that.getCharacteristics(deviceId);}} else {that.bluetoothSuccess(res);}},(err) => {console.log(err);that.bluetoothFail();});},// 蓝牙连接打印机bluetoothSuccess(res) {uni.setStorageSync("blefiInfo", this.BLEInformation);let params = {title: "连接成功",confirmText: "继续",showCancel: false,};this.$tip.showModal(params, (res) => {if (res.confirm) {// 蓝牙连接成功this.$tip.redirectTo("/pages/ble/bleWifi");}});},bluetoothFail() {// 蓝牙连接失败this.$tip.redirectTo("/pages/ble/bleFail");},},
};
</script><style scoped>
.zai-box {padding: 0;margin: 0;height: 100%;background-color: #fff;
}.container {padding: 30rpx;margin: 0;font-size: 28rpx;color: #20212b;background-color: #fff;text-align: left;font-weight: 400;
}image {width: 362rpx;height: 362rpx;margin-top: 30rpx;
}.textTitle {display: block;font-size: 36rpx;font-weight: bold;color: #20212b;display: block;margin-bottom: 30rpx;
}.textItem {display: block;font-size: 24rpx;font-weight: 400;color: #999999;line-height: 36rpx;
}
</style>

3. 蓝牙连接WiFi  bleWifi.vue

<template><view><text>{{ SSID }}</text><input type="text" placeholder="请输入密码" v-model="password" /><button @click="settiing">连接</button></view></template><script>import APToast from "@/util/APToast.js";export default {data() {return {SSID: "your SSID",password: "",connected: true,wifiCountDown: 0,wifiCountInterval: null, // 定时器blefiInfo: {},};},// 二级页面清除onUnload() {this.$ble.offBLEConnectionStateChange();this.clearIntervalWifi();},onLoad(options) {this.blefiInfo = uni.getStorageSync("blefiInfo");let sys = uni.getStorageSync("phoneInfo");if (sys.platform == "android") {// this.$ble.onBLEMTUChange((res) => {//   console.log(res, "androidMTU");// });// this.$ble.getBLEMTU(this.blefiInfo.deviceId, (res) => {//   console.log(res, "mtu");// });// 安卓要手动更改MTU值const mtu = 512;this.$ble.setBLEMTU(this.blefiInfo.deviceId,mtu,(res) => {console.log(res);},(err) => {console.log(err);});}this.$ble.getBLEDeviceServices(this.blefiInfo.deviceId, (res) => {this.$ble.getBLEDeviceCharacteristics(this.blefiInfo.deviceId,this.blefiInfo.serveiceId,(res) => {this.$ble.notifyBLECharacteristicValueChange(true,this.blefiInfo.deviceId,this.blefiInfo.serveiceId,this.blefiInfo.readCharId,(res) => {console.log("启用notify成功");});});});this.$ble.onBLEConnectionStateChange((res) => {this.connected = res.connected;if (!res.connected) {this.$tip.loaded();// 蓝牙连接失败,跳转到失败页面this.$tip.redirectTo("/pages/ble/bleFail");}});// 接收配网打印机回传的数据this.$ble.onBLECharacteristicValueChange((res) => {if (!res || res.value.byteLength == 0) return;this.clearIntervalWifi();this.$tip.loaded();let num = new Int32Array(res.value)[0];console.log(num, "NUM");// 失败原因let tip = APToast.find((item) => item.id == num);if (num == 0) {// 连接wifi成功this.$tip.redirectTo("/pages/ble/WifiSuccess");} else {// 连接WiFi失败this.$tip.redirectTo("/pages/ble/WifiFile",tip);}});},methods: {settiing() {this.startSMSTimer("60");this.$tip.loading("连接中");if (this.connected) {this.sendWifi();} else {this.$tip.loaded();// 蓝牙连接失败,跳转到失败页面this.$tip.redirectTo("/pages/ble/bleFail");}},// 转UTF-8sendWifi() {let msg = {event: "network",data: { ssid: this.SSID, password: this.password, authmode: 4 },};let buffer = this.stringToUint8Array(JSON.stringify(msg));this.bleSendWifi(buffer);},// json字符串数据转Uint8ArraystringToUint8Array(str) {// 方法一// var arr = [];// for (var i = 0, j = str.length; i < j; ++i) {//   arr.push(str.charCodeAt(i));// }// var tmpUint8Array = new Uint8Array(arr);// return tmpUint8Array.buffer;// 方法二let buffer = new ArrayBuffer(str.length);let dataView = new DataView(buffer);for (var i = 0; i < str.length; i++) {dataView.setUint8(i, str.charCodeAt(i));}return buffer;},bleSendWifi(payload) {if (this.connected) {this.$ble.writeBLECharacteristicValueOnce(this.blefiInfo.deviceId,this.blefiInfo.serveiceId,this.blefiInfo.writecharId,payload);if (this.blefiInfo.readCharId) {this.$ble.readBLECharacteristicValue(this.blefiInfo.deviceId,this.blefiInfo.serveiceId,this.blefiInfo.readCharId);}}},startSMSTimer(val) {this.wifiCountDown = val;this.wifiCountInterval = setInterval(() => {this.wifiCountDown--;// console.log(this.wifiCountDown);if (this.wifiCountDown <= 0) {clearInterval(this.wifiCountInterval);this.wifiCountInterval = null;this.$tip.loaded();// 连接WiFi失败this.$tip.redirectTo("/pages/ble/WifiFile");}}, 1000);},clearIntervalWifi() {this.wifiCountDown = 0;if (this.wifiCountInterval) {clearInterval(this.wifiCountInterval);this.wifiCountInterval = null;}},},};</script>

4. 手机连接蓝牙失败、蓝牙连接WiFi成功/失败(关闭蓝牙连接)

<script>
export default {onLoad() {// 使用完成后在合适的时机断开连接和关闭蓝牙适配器this.$ble.closeBLEConnection(this.deviceId);this.$ble.closeBluetoothAdapter();},
};
</script>

5.ble.js

class ble {openBluetoothAdapter(success, failure) {uni.openBluetoothAdapter({success: (res) => {success(res);},fail: (err) => {failure(err);},});}getBluetoothAdapterState(success) {uni.getBluetoothAdapterState({success: (res) => {success(res);},});}//停止搜寻附近的蓝牙外围设备stopBluetoothDevicesDiscovery() {uni.stopBluetoothDevicesDiscovery();}//获取蓝牙设备信息getBluetoothDevices(success) {// 开始搜寻附近的蓝牙外围设备uni.startBluetoothDevicesDiscovery({success: (res) => {setTimeout(() => {// 获取搜索到的设备信息uni.getBluetoothDevices({success: (res) => {let bluetoohList = [];var num = 0;for (var i = 0; i < res.devices.length; ++i) {if (res.devices[i].name != "未知设备") {bluetoohList[num] = res.devices[i];num++;}}this.stopBluetoothDevicesDiscovery();success(bluetoohList);},});}, 5000);// that.onBluetoothDeviceFound();},});}openSetting() {uni.openSetting({//opensetting是调起设置页面的success: (res) => {if (res.authSetting == true) {//判断res.authsetting的值是true还是falseuni.openBluetoothAdapter();}},});}//断开与低功耗蓝牙设备的连接closeBLEConnection(deviceId) {uni.closeBLEConnection({deviceId: deviceId,});}offBLEConnectionStateChange() {wx.offBLEConnectionStateChange();}//连接低功耗蓝牙设备createBLEConnection(deviceId, success, failure) {uni.createBLEConnection({deviceId: deviceId,success: (res) => {success(res);},fail: (err) => {failure(err);},});}//获取蓝牙设备所有服务getBLEDeviceServices(deviceId, success, failure) {wx.getBLEDeviceServices({deviceId: deviceId,success: (res) => {success(res);},fail(err) {failure(err);},});}//获取蓝牙设备某个服务中所有特征值getBLEDeviceCharacteristics(deviceId, serviceId, success, failure) {wx.getBLEDeviceCharacteristics({deviceId: deviceId,serviceId: serviceId,success: (res) => {success(res);},fail(err) {failure(err);},});}notifyBLECharacteristicValueChange(state,deviceId,serviceId,characteristicId,success) {wx.notifyBLECharacteristicValueChange({state: state,deviceId: deviceId,serviceId: serviceId,characteristicId: characteristicId,success: function (res) {success(res);},});}onBLEConnectionStateChange(success) {wx.onBLEConnectionStateChange((res) => {success(res);});}// 接收配网打印机回传的数据onBLECharacteristicValueChange(success) {wx.onBLECharacteristicValueChange((res) => {success(res);});}//关闭蓝牙模块closeBluetoothAdapter() {wx.closeBluetoothAdapter();}// 不分包写入蓝牙writeBLECharacteristicValueOnce(deviceId,serviceId,characteristicId,value) {wx.writeBLECharacteristicValue({deviceId: deviceId,serviceId: serviceId,characteristicId: characteristicId,value: value,});}readBLECharacteristicValue(deviceId, serviceId, characteristicId) {wx.readBLECharacteristicValue({deviceId: deviceId,serviceId: serviceId,characteristicId: characteristicId,});}getBLEMTU(deviceId, success) {wx.getBLEMTU({deviceId: deviceId,writeType: "write",success(res) {success(res.mtu);},});}onBLEMTUChange(success) {wx.onBLEMTUChange(function (res) {success(res.mtu);});}setBLEMTU(deviceId, mtu, success, failure) {wx.setBLEMTU({deviceId: deviceId,mtu: mtu,success: (res) => {success(res);},fail: (res) => {failure(res);},});}
}
const bleDevice = new ble();
export default bleDevice;

6.APToast.js

const message = [{id:0,type:"WIFI_REASON_SUCCESS",message:"打印机连接成功"},{id:2,type:"WIFI_REASON_AUTH_EXPIRE",message:"身份验证超时"},{id:3,type:"WIFI_REASON_AUTH_LEAVE",message:"连接中断"},{id:8,type:"WIFI_REASON_ASSOC_LEAVE",message:"连接中断"},{id:15,type:"WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT",message:"密码错误"},{id:201,type:"WIFI_REASON_NO_AP_FOUND",message:"未找到可用的网络"},{id:202,type:"WIFI_REASON_AUTH_FAIL",message:"密码错误或身份验证超时"},{id:203,type:"WIFI_REASON_ASSOC_FAIL",message:"设备无法与WiFi成功关联"},{id:204,type:"WIFI_REASON_HANDSHAKE_TIMEOUT",message:"密码错误"},{id:205,type:"WIFI_REASON_CONNECTION_FAIL",message:"连接失败"}, 
]export default message;

7.tip.js

export default class Tips { /*** 弹出提示框*/static success(title, duration = 1000) {setTimeout(() => {uni.showToast({title: title,icon: "success",mask: true,duration: duration,});}, 300);if (duration > 0) {return new Promise((resolve, reject) => {setTimeout(() => {resolve();}, duration);});}}/*** 弹出加载提示*/static loading(title = "加载中") {if (Tips.isLoading) {return;}Tips.isLoading = true;uni.showLoading({title: title,mask: true,});}/*** 加载完毕*/static loaded() {if (Tips.isLoading) {Tips.isLoading = false;uni.hideLoading();}}/*** 关闭当前页面,跳转到新页面*/static redirectTo(urls, item) {uni.redirectTo({url: item? urls + "?info=" + encodeURIComponent(JSON.stringify(item)): urls, //  JSON.parse(decodeURIComponent(option.info));});}/*** 弹出确认窗口*/static showModal(val, success) {uni.showModal({title: val.title ? val.title : "",content: val.content ? val.content : "",showCancel: val.showCancel,confirmText: val.confirmText ? val.confirmText : "确定",cancelText: val.cancelText ? val.cancelText : "取消",cancelColor: "#999999", //取消按钮颜色confirmColor: "#00A0E9", //确定按钮颜色success: (res) => {success(res);},});}
}/*** 静态变量,是否加载中*/
Tips.isLoading = false;

8.main.js

import ble from "./common/util/ble.js";
import tip from "./common/util/tip.js";// ble
Vue.prototype.$ble = ble;
// tip
Vue.prototype.$tip = tip;

相关文章:

uniapp 小程序低功耗蓝牙配网 ble配网 物联网

1.获取蓝牙列表 bleList.vue <template><view><button touchstart"startSearch">获取蓝牙列表</button><scroll-view :scroll-top"scrollTop" scroll-y class"content-pop"><viewclass"bluetoothItem&q…...

服务器防火墙有什么用防护策略

随着互联网的飞速发展&#xff0c;服务器的安全问题日益凸显。为了保护服务器免受网络攻击和恶意入侵的威胁&#xff0c;人们引入了防火墙的概念。服务器防火墙作为保护服务器的第一道防线&#xff0c;具有重要的作用。那么服务器防火墙有什么用&#xff1f; 首先&#xff0c;服…...

27.哀家要长脑子了!

目录 1.316. 去除重复字母 - 力扣&#xff08;LeetCode&#xff09; 2. 1209. 删除字符串中的所有相邻重复项 II - 力扣&#xff08;LeetCode 哎哟 烦死了 刚刚不小心退出又没保存 又要写一遍 烦死了 最近刷题不得劲啊 感觉这脑子没长一点 1.316. 去除重复字母 - 力扣&am…...

Redis实战—验证码登录注册

目录 基于Session Controller层 Service层 ServiceImpl层 ​编辑校验登录状态 ThreadLocal 登录拦截器 添加拦截器到Config Controller层实现 基于Redis ServiceImpl 新增刷新拦截器 添加拦截器到Config 基于Session Controller层 /*** 发送手机验证码*/PostMappi…...

对话机器人技术解说

一、RAG介绍 如何不通过微调模型来提高LLM性能&#xff0c;检索增强生成&#xff08;RAG&#xff09;是未来的发展方向。 Embedding&#xff1a;将文档的句子或单词块转换为数字向量。就向量之间的距离而言&#xff0c;彼此相似的句子应该很近&#xff0c;而不同的句子应该离…...

红黑树底层封装map、set C++

目录 一、框架思考 三个问题 问题1的解决 问题2的解决&#xff1a; 问题3的解决&#xff1a; 二、泛型编程 1、仿函数的泛型编程 2、迭代器的泛型编程 3、typename&#xff1a; 4、/--重载 三、原码 红黑树 map set 一、框架思考 map和set都是使用红黑树底层&…...

压力给到 Google,OpenAI 发布 GPT-4o 来了

北京时间5月14日凌晨1点&#xff0c;OpenAI 开启了今年的第一次直播&#xff0c;根据官方消息&#xff0c;这次旨在演示 ChatGPT 和 GPT-4 的升级内容。在早些时候 Sam Altman 在 X 上已经明确&#xff0c;「我们一直在努力开发一些我们认为人们会喜欢的新东西&#xff0c;对我…...

【SpringSecurity源码】过滤器链加载流程

theme: smartblue highlight: a11y-dark 一、前言及准备 1.1 SpringSecurity过滤器链简单介绍 在Spring Security中&#xff0c;过滤器链&#xff08;Filter Chain&#xff09;是由多个过滤器&#xff08;Filter&#xff09;组成的&#xff0c;这些过滤器按照一定的顺序对进…...

第9章.Keil5-MDK软件简介

目录 0. 《STM32单片机自学教程》专栏 9.1 主界面 9.2 文本格式编辑 9.3 代码提示&语法检测&代码模版 9.4 其他小技巧 9.4.1 TAB 键的妙用 9.4.2 快速定位函数/变量被定义的地方 9.4.3 快速注释与快速消注释 9.4.4 快速打开头文件 9.4.5 查找替换…...

mysql中utf8字符集中文字节长度统计如何统计到2个字节一个汉字

在 MySQL 的 utf8 字符集中&#xff08;也被称为 utf8mb3&#xff09;&#xff0c;中文字符实际上并不是用2个字节来表示的&#xff0c;而是使用3个字节。这是 UTF-8 编码的一个特性&#xff0c;它使用1到4个字节来表示一个字符&#xff0c;具体取决于字符的 Unicode 码点。 对…...

如何实现Linux双网卡同时连接内网和外网的配置?

博主猫头虎的技术世界 &#x1f31f; 欢迎来到猫头虎的博客 — 探索技术的无限可能&#xff01; 专栏链接&#xff1a; &#x1f517; 精选专栏&#xff1a; 《面试题大全》 — 面试准备的宝典&#xff01;《IDEA开发秘籍》 — 提升你的IDEA技能&#xff01;《100天精通鸿蒙》 …...

ASCLL码表以及字符的相加减

ASCLL码表完整版及解释_acssll码-CSDN博客 #include <getopt.h> #include <stdio.h> #include <stdlib.h>#define MAX_PATH 256 char filename[MAX_PATH 5];int isdigit(int c) {if (c > 0 && c < 9)return 1;return 0; }int main(int argc…...

一键修复所有dll缺失,教大家解决丢失的dll文件

修复所有DLL&#xff08;动态链接库&#xff09;文件缺失的问题通常不可能通过单一的"一键修复"按钮来实现&#xff0c;因为DLL文件缺失可能由各种不同的原因导致&#xff0c;比如应用程序安装不正确、病毒感染、或系统文件损坏等。 使用内置的系统文件检查器&#x…...

wsl2安装rancher并导入和创建k8s集群

环境准备 安装wsl2点击此文]ubuntu20.04安装docker 点击此文,安装完成后docker镜像仓库改成阿里云镜像加速地址.如果不熟请点击此文 docker 安装rancher 启动wsl,根据官方文档以root身份执行 sudo docker run -d --restartunless-stopped -p 80:80 -p 443:443 --privileged …...

内网环境ubuntu设置静态ip、DNS、路由,不影响网络访问

内网环境通常是有线的&#xff0c;通过服务器的ip、mac、dns地址访问网络才生效的&#xff0c;如果ip地址变了&#xff0c;就不能访问网络了。 如果你的ip地址变了&#xff0c;或者要防止ip变更影响网络访问&#xff0c;就要设置 1、依次点击右上角的电源-设置&#xff0c;在打…...

学习前端第三十七天(静态属性静态方法、类检查、错误处理)

一、静态属性和静态方法 1、静态属性静态方法 在属性和方法前加上static&#xff0c;创建属于类自己的属性和方法 class Person {// 加static&#xff0c;属于类自己的static name "xc"; // 类的name属性static height 183; // 类的height属性static age 20;…...

全网最全的基于电机控制的38类simulink仿真全家桶----新手大礼包

整理了基于电机的38种simulink仿真全家桶&#xff0c;包含多种资料&#xff0c;类型齐全十分适合新手学习使用。包括但是不局限于以下&#xff1a; 1、基于多电平逆变器的无刷直流电机驱动simulink仿真 2、基于负载转矩的感应电机速度控制simulink仿真 3、基于滑膜观测器的永…...

Python使用asyncio包实现异步编程

1. 异步编程 异步编程是一种编程范式&#xff0c;用于处理程序中需要等待异步操作完成后才能继续执行的情况。异步编程允许程序在执行耗时的操作时不被阻塞&#xff0c;而是在等待操作完成时继续执行其他任务。这对于处理诸如文件 I/O、网络请求、定时器等需要等待的操作非常有…...

获取文件夹下的vue文件形成组件,require.context

前言&#xff1a;项目中现有一个文件里面包含所有需要用到的组件&#xff0c;如果一个个的去import&#xff0c;则会非常麻烦&#xff0c;现有require.context去实现&#xff0c; 1、require.context var request require.context(‘./module’, true, /.js$/) require.cont…...

2024软件测试必问的常见面试题1000问!

01、您所熟悉的测试用例设计方法都有哪些&#xff1f;请分别以具体的例子来说明这些方法在测试用例设计工作中的应用。 答&#xff1a;有黑盒和白盒两种测试种类&#xff0c;黑盒有等价类划分法&#xff0c;边界分析法&#xff0c;因果图法和错误猜测法。白盒有逻辑覆盖法&…...

利用最小二乘法找圆心和半径

#include <iostream> #include <vector> #include <cmath> #include <Eigen/Dense> // 需安装Eigen库用于矩阵运算 // 定义点结构 struct Point { double x, y; Point(double x_, double y_) : x(x_), y(y_) {} }; // 最小二乘法求圆心和半径 …...

【Axure高保真原型】引导弹窗

今天和大家中分享引导弹窗的原型模板&#xff0c;载入页面后&#xff0c;会显示引导弹窗&#xff0c;适用于引导用户使用页面&#xff0c;点击完成后&#xff0c;会显示下一个引导弹窗&#xff0c;直至最后一个引导弹窗完成后进入首页。具体效果可以点击下方视频观看或打开下方…...

阿里云ACP云计算备考笔记 (5)——弹性伸缩

目录 第一章 概述 第二章 弹性伸缩简介 1、弹性伸缩 2、垂直伸缩 3、优势 4、应用场景 ① 无规律的业务量波动 ② 有规律的业务量波动 ③ 无明显业务量波动 ④ 混合型业务 ⑤ 消息通知 ⑥ 生命周期挂钩 ⑦ 自定义方式 ⑧ 滚的升级 5、使用限制 第三章 主要定义 …...

论文浅尝 | 基于判别指令微调生成式大语言模型的知识图谱补全方法(ISWC2024)

笔记整理&#xff1a;刘治强&#xff0c;浙江大学硕士生&#xff0c;研究方向为知识图谱表示学习&#xff0c;大语言模型 论文链接&#xff1a;http://arxiv.org/abs/2407.16127 发表会议&#xff1a;ISWC 2024 1. 动机 传统的知识图谱补全&#xff08;KGC&#xff09;模型通过…...

OPENCV形态学基础之二腐蚀

一.腐蚀的原理 (图1) 数学表达式&#xff1a;dst(x,y) erode(src(x,y)) min(x,y)src(xx,yy) 腐蚀也是图像形态学的基本功能之一&#xff0c;腐蚀跟膨胀属于反向操作&#xff0c;膨胀是把图像图像变大&#xff0c;而腐蚀就是把图像变小。腐蚀后的图像变小变暗淡。 腐蚀…...

20个超级好用的 CSS 动画库

分享 20 个最佳 CSS 动画库。 它们中的大多数将生成纯 CSS 代码&#xff0c;而不需要任何外部库。 1.Animate.css 一个开箱即用型的跨浏览器动画库&#xff0c;可供你在项目中使用。 2.Magic Animations CSS3 一组简单的动画&#xff0c;可以包含在你的网页或应用项目中。 3.An…...

Cilium动手实验室: 精通之旅---13.Cilium LoadBalancer IPAM and L2 Service Announcement

Cilium动手实验室: 精通之旅---13.Cilium LoadBalancer IPAM and L2 Service Announcement 1. LAB环境2. L2公告策略2.1 部署Death Star2.2 访问服务2.3 部署L2公告策略2.4 服务宣告 3. 可视化 ARP 流量3.1 部署新服务3.2 准备可视化3.3 再次请求 4. 自动IPAM4.1 IPAM Pool4.2 …...

Python实现简单音频数据压缩与解压算法

Python实现简单音频数据压缩与解压算法 引言 在音频数据处理中&#xff0c;压缩算法是降低存储成本和传输效率的关键技术。Python作为一门灵活且功能强大的编程语言&#xff0c;提供了丰富的库和工具来实现音频数据的压缩与解压。本文将通过一个简单的音频数据压缩与解压算法…...

高抗扰度汽车光耦合器的特性

晶台光电推出的125℃光耦合器系列产品&#xff08;包括KL357NU、KL3H7U和KL817U&#xff09;&#xff0c;专为高温环境下的汽车应用设计&#xff0c;具备以下核心优势和技术特点&#xff1a; 一、技术特性分析 高温稳定性 采用先进的LED技术和优化的IC设计&#xff0c;确保在…...

Git 命令全流程总结

以下是从初始化到版本控制、查看记录、撤回操作的 Git 命令全流程总结&#xff0c;按操作场景分类整理&#xff1a; 一、初始化与基础操作 操作命令初始化仓库git init添加所有文件到暂存区git add .提交到本地仓库git commit -m "提交描述"首次提交需配置身份git c…...