
IoT设备序列号又称设备编号、设备 SN 号;设备型号即设备的产品名称(可以参考 IoT 官网 了解);设备 ID即设备号,也是设备的全球唯一识别号。获取这些信息的主要方式有IoT 小程序接口获取和IoT 设备本身获取两种方式。
说明:建议开发者用设备 ID作为设备唯一标识,应用于设备-商户绑定等场景。
IoT 小程序接口获取 IoT 设备序列号、设备型号、设备 ID
IoT小程序只需要调用 myixgetSysProp 接口即可获取 IoT 设备序列号、设备型号、设备 ID等信息。
IoT 设备本身获取 IoT 设备序列号、设备型号、设备ID获取设备序列号
以蜻蜓设备为例:
方式一:长按电源键进入系统设置页,点击关于本机即可获取设备编号。
unionid与openid的不同之处在于:
openid是同一用户同一应用唯一;而unionid是同一用户不同应用唯一。
很显然,如果要拿到用户的唯一id,只能用unionid。
因为unionid是用户的私密信息,所以需要走登录入口。
uni-app框架对这块做了很好的封装,直接调用即可。不过api有点乱,手册介绍的实例是用云函数的方式获取,但云函数的相关配置比较繁琐,我们可以绕过不用。
你好,小程序的发布包含了安卓系统与苹果系统,小程序的启动需要扫描二维码,才能启动。您可以进入公众平台注册小程序账号来进行属于您自己的小程序的开发工作。
简单地讲就像注册公众号那样去注册一个小程序的账号,在小程序的账号中获取相应的开发接口与发布推广,谢谢。
//初始化蓝牙
initBlue() {
var that = this;
wxopenBluetoothAdapter({ //调用微信小程序api 打开蓝牙适配器接口
success: function (res) {
consolelog('1初始化蓝牙成功')
},
//监听手机蓝牙的开关
monitorTheBlue:function(){
var that =this;
wxonBluetoothAdapterStateChange(function(res){
})
},
//开始获取附近的蓝牙设备
// 获取到附近的蓝牙数组 通过蓝牙特定的名称获取自己想要连接的蓝牙设备
// 获取附近蓝牙设备的数组
findBlue() {
consolelog(new Date())
var that = this
wxstartBluetoothDevicesDiscovery({
allowDuplicatesKey: false,
interval: 0,
success: function (res) {
consolelog('2正在搜索设备')
if (thatdataisFirestShow) {
wxshowLoading({
title: '正在搜索设备'
})
}
},
//搜索获取附近的所有蓝牙设备 获取附近所有的蓝牙设备的相关信息 获取需要连接蓝牙设备的deviceID
// 通过bluetoothDeviceName 和 localName 来确定制定蓝牙
// 一般根据制定设备的名字去连接 设备的名字 是出产厂家设定
getBlue() {
var that = this
wxgetBluetoothDevices({
success: function (res) {
consolelog('3找到设备列表')
wxhideLoading()
// return false
var index = 10
for (var i = 0; i < resdeviceslength; i++) {
if (resdevices[i]name && resdevices[i]localName) {
var arr = resdevices[i]namesplit("-")
var secArr = resdevices[i]localNamesplit("-")
if (arr[0] == thatdatabluetoothDeviceName || secArr[0] == thatdatabluetoothDeviceName) {
},
//连接蓝牙设备
//通过deviceId 连接蓝牙
/
},
//6 连接上需要的蓝牙设备之后,获取这个蓝牙设备的服务uuid
//获取设备的uuid
getServiceId() {
var that = this
wxgetBLEDeviceServices({
// 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
deviceId: thatdatadeviceId,
success: function (res) {
var model = resservices[1]
thatsetData({
servicesUUID: modeluuid
})
consolelog('7获取设备 uuid 成功')
thatgetCharacteId() //60
}
})
},
//7 如果一个蓝牙设备需要进行数据的写入以及数据传输,就必须具有某些特征值,所以通过上面步骤获取的id可以查看当前蓝牙设备的特征值
//notify write read 当只有 notify为true的时候才能 接收蓝牙设备传来的数据,
//write 为true 才能传入数据
//read 为true 才能读取设备数据
getCharacteId() {
var that = this
wxgetBLEDeviceCharacteristics({
// 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
deviceId: thatdatadeviceId,
// 这里的 serviceId 需要在上面的 getBLEDeviceServices 接口中获取
serviceId: thatdataservicesUUID,
success: function (res) {
for (var i = 0; i < rescharacteristicslength; i++) { //2个值
var model = rescharacteristics[i]
if (modelpropertiesnotify == true) {
thatsetData({
characteristicId: modeluuid //监听的值
})
consolelog('8modelpropertiesnotify == true')
thatstartNotice(modeluuid) //70
}
// if (modelpropertiesread == true) {
// thatreadData(modeluuid)
// }
// if (modelpropertieswrite == true) {
// thatsetData({
// writeId: modeluuid//用来写入的值
// })
// }
}
}
})
},
fordateTime1(){
let now = new Date(),hour = nowgetHours()
consolelog(hour)
let str = ''
if(hour < 7){str = '早餐前'}
else if ((7< hour) && (hour<= 9)){str = '早餐后'}
else if ((9< hour) && (hour<= 11)){str = '午餐前'}
else if ((11< hour) && (hour<= 13)){str = '午餐后'}
else if ((13< hour) && (hour<= 17)){str = '晚餐前'}
else if ((17< hour) && (hour<= 19)){str = '晚餐后'}
else if ((19< hour) && (hour<= 24)){str = '睡觉前'}
return str
},
//8 如果一个蓝牙设备需要进行数据的写入以及数据传输,就必须具有某些特征值,所以通过上面步骤获取的id可以查看当前蓝牙设备的特征值
//开启设备数据监听 监听蓝牙设备返回来的数据
startNotice(uuid) {
var that = this;
wxnotifyBLECharacteristicValueChanged({
state: true, // 启用 notify 功能
deviceId: thatdatadeviceId,
serviceId: thatdataservicesUUID,
characteristicId: uuid, //第一步 开启监听 notityid 第二步发送指令 write
success: function (res) {
// thatcloseConnect(thatdatadeviceId)
// 设备返回的方法
let tip = 0
wxonBLECharacteristicValueChange(res1 => {
},
/
//监听蓝牙设备是否会异常断开
getTheBlueDisConnectWithAccident() {
},
// 断开设备连接
closeConnect: function(v) {
var that = this
if (v) {
wxcloseBLEConnection({
deviceId: v,
success: function(res) {
consolelog("蓝牙断开连接")
thatcloseBluetoothAdapter()
},
fail(res) {
}
})
} else {
thatcloseBluetoothAdapter()
}
},
// 关闭蓝牙模块
closeBluetoothAdapter:function () {
wxcloseBluetoothAdapter({
success: function(res) {
consolelog("关闭蓝牙模块")
},
fail: function(err) {
}
})
},
以上就是关于支付宝读取设备信息包括什么全部的内容,包括:支付宝读取设备信息包括什么、小程序如何获取用户的unionid、微信小程序怎么开发啊,ID在哪找,求指教等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)