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

小程序开发——获取设备信息 API(三)

ty.device.getShareDeviceInfo

获取共享设备信息

需引入DeviceKit,且在>=2.2.0版本才可使用

请求参数

Object object

属性类型默认值必填说明
deviceIdstringdeviceId 设备 id
completefunction接口调用结束的回调函数(调用成功、失败都会执行)
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数

返回结果

  • success
属性类型说明
namestring姓名
mobilestring手机号
emailstring邮件
  • fail
属性类型说明
errorMsgstring插件错误信息
errorCodestring错误码
innerErrorobject插件外部依赖错误信息 {errorMsg: string, errorCode: string }

请求示例

ty.device.getShareDeviceInfo({deviceId: 'vdevo165649418612782',
}).then((res) => {console.log(res);}).catch((error) => {console.log(error);});

返回示例

{"name": "设备详情小程序","email": "cn500**il.fr"
}

ty.device.getSupportedThirdPartyServices

获取设备支持的三方服务

需引入DeviceKit,且在>=2.2.0版本才可使用

请求参数

Object object

属性类型默认值必填说明
deviceIdstringdeviceId 设备 id
completefunction接口调用结束的回调函数(调用成功、失败都会执行)
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数

返回结果

  • success
属性类型说明
servicesArray<ThirdPartyService>服务列表
  • fail
属性类型说明
errorMsgstring插件错误信息
errorCodestring错误码
innerErrorobject插件外部依赖错误信息 {errorMsg: string, errorCode: string }

请求示例

ty.device.getSupportedThirdPartyServices({deviceId: '64710761ecfabcaaf553',
}).then((res) => {console.log(res);}).catch((error) => {console.log(error);});

返回示例

{"services": [{"attributeKey": "DUEROS_SUPPORT","attributeSign": 19,"serviceId": 9,"iconUrl": "https://images.tuyacn.com/app/thirdparty/du@3x.png","originJson": {"id": 9,"attributeSign": 19,"url": "https://app-third.tuyacn.com/thirdCode?platform=dueros","iconV2": "https://images.tuyacn.com/app/thirdparty/du@3x.png","iconMini": "https://images.tuyacn.comnull","remark": "小度","iconShow": "0","group": "1","icon": "https://images.tuyacn.com/app/thirdparty/du@3x.png","nameKey": "personal_speech_service_dueros","newRemark": "小度","attributeKey": "DUEROS_SUPPORT"},"name": "小度","url": "https://app-third.tuyacn.com/thirdCode?platform=dueros"}]
}

👉 立即开发。 

ty.device.isDeviceSupportOfflineReminder

设备是否支持离线提醒

需引入DeviceKit,且在>=2.2.0版本才可使用

请求参数

Object object

属性类型默认值必填说明
deviceIdstringdeviceId 设备 id
completefunction接口调用结束的回调函数(调用成功、失败都会执行)
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数

返回结果

  • success
属性类型说明
isSupportbooleansupport 是否支持设备离线提醒
  • fail
属性类型说明
errorMsgstring插件错误信息
errorCodestring错误码
innerErrorobject插件外部依赖错误信息 {errorMsg: string, errorCode: string }

请求示例

ty.device.isDeviceSupportOfflineReminder({deviceId: 'vdevo165649418612782',
}).then((res) => {console.log(res);}).catch((error) => {console.log(error);});

返回示例

  {isSupport: true}

ty.device.syncDeviceInfo

同步设备信息

需引入DeviceKit,且在>=2.1.6版本才可使用

请求参数

Object object

属性类型默认值必填说明
deviceIdstring设备 id
completefunction接口调用结束的回调函数(调用成功、失败都会执行)
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数

返回结果

  • success

  • fail
属性类型说明
errorMsgstring插件错误信息
errorCodestring错误码
innerErrorobject插件外部依赖错误信息 {errorMsg: string, errorCode: string }

请求示例

ty.device.syncDeviceInfo({deviceId: '64710761ecfabcaaf553'
}).then((res) => {console.log(res);}).catch((error) => {console.log(error);});

👉 立即开发。 

ty.device.renameDeviceName

修改设备名称

需引入DeviceKit,且在>=2.4.0版本才可使用

请求参数

Object object

属性类型默认值必填说明
deviceIdstringdeviceId 设备 id
namestringname 设备名称
completefunction接口调用结束的回调函数(调用成功、失败都会执行)
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数

返回结果

  • success

  • fail
属性类型说明
errorMsgstring插件错误信息
errorCodestring错误码
innerErrorobject插件外部依赖错误信息 {errorMsg: string, errorCode: string }

请求示例

ty.device.renameDeviceName({deviceId: '64710761ecfabcaaf553',name: 'device-f553',
}).then((res) => {console.log(res);}).catch((error) => {console.log(error);});

ty.device.toggleDeviceOfflineReminder

离线提醒开关

需引入DeviceKit,且在>=2.2.0版本才可使用

请求参数

Object object

属性类型默认值必填说明
deviceIdstringdeviceId 设备 id
statenumberstate 设备离线提醒的开关状态 0:关 1:开
completefunction接口调用结束的回调函数(调用成功、失败都会执行)
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数

返回结果

  • success

  • fail
属性类型说明
errorMsgstring插件错误信息
errorCodestring错误码
innerErrorobject插件外部依赖错误信息 {errorMsg: string, errorCode: string }

请求示例

ty.device.toggleDeviceOfflineReminder({deviceId: 'vdevo165649418612782',state: 1, 
}).then((res) => {console.log(res);}).catch((error) => {console.log(error);});

👉 立即开发。 

http://www.lryc.cn/news/317985.html

相关文章:

  • Vue2 + node.js项目
  • 如何使用IDE端通义灵码
  • 微服务分布式springcloud的体育场地预约系统演kdm1z
  • IDEA开启Run Dashboard
  • 小程序学习3 goods-card
  • 【投稿优惠-EI稳定检索】2024年图像处理与机械系统工程国际学术会议 (ICIPMSE 2024)
  • Linux系列
  • SQL笔记 -- 黑马程序员
  • C# MES通信从入门到精通(1)——串口传输文件
  • 论文阅读-federated unlearning via class-discriminative pruning
  • 研发效能DevOps: OpenEuler 部署 drone 持续集成平台
  • C#,图论与图算法,图着色问题(Graph Coloring)的威尔士-鲍威尔(Welch Powell Algorithm)算法与源代码
  • 用python写一个脚本,实现加速3X并压缩mp4视频以降低文件大小。
  • Flink广播流 BroadcastStream
  • IP数据报格式
  • GET https://registry.npm.taobao.org/xxxx error (CERT_HAS_EXPIRED)解决
  • SSM Java Web项目由于spring-mvc.xml配置不对带来的一系列问题
  • MySQL事务隔离
  • Java基础知识总结(1)
  • 脚手架原理之webpack处理html文件和模块打包
  • Winform编程详解一:Form窗口
  • Windows Server 2025 Install Preview
  • 四、MySQL
  • C#使用泛型自定义的方法设计队列CQueue<T>类
  • IDEA自定义Maven仓库
  • Codeql复现CVE-2018-11776学习笔记
  • CVE-2024-27199 JetBrains TeamCity 身份验证绕过漏洞2
  • ms office学习记录12:Excel学习记录㈥
  • 基于YOLOv8/YOLOv7/YOLOv6/YOLOv5的条形码二维码检测系统(深度学习+UI界面+训练数据集+Python代码)
  • npm yarn 一起使用报错