Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
qcloud-iotexplorer-appdev-plugin-sync-gateway-subdevice
Advanced tools
腾讯云物联网开发平台应用开发小程序Sdk同步网关子设备插件
腾讯云物联网开发平台应用开发小程序Sdk同步网关子设备插件
由于设备与家庭的绑定关系和网关及子设备的拓扑关系是两个不同的关联关系,所以可能会有两边不同步的情况出现。
例:
网关从家庭解绑,所有子设备都会从家庭解绑,但是网关-子设备的拓扑关系还存在,所以当网关重新绑定到家庭后,其下的子设备并不会自动重新绑定到家庭,此时需要调用插件方法来执行同步操作
网关直接向物联通通信侧申请解绑子设备,当时这时客户端并没有打开,就会出现子设备任然绑定在家庭中,但是其拓扑关系已解除,此时也需要调用插件方法来执行同步移除多余子设备的操作
npm install qcloud-iotexplorer-appdev-sdk
npm install qcloud-iotexplorer-appdev-plugin-sync-gateway-subdevice
step1.向 sdk 里面注册 airkiss 插件,sdk 的初始化方式参考文档qcloud-iotexplorer-appdev-sdk
import PluginSyncGatewaySubdevice from 'qcloud-iotexplorer-appdev-plugin-sync-gateway-subdevice';
sdk.usePlugin(PluginSyncGatewaySubdevice);
step2.执行同步网关子设备操作
用法1:同步单个网关
const deviceList = [....xxxx]; // 设备列表
const gatewayDeviceInfo = deviceList.find(item => item.DeviceType === 1)
const {
subDeviceList, // 真实子设备列表
diffResult: {
add, // 未绑定到家庭的子设备列表
remove, // 多余的子设备列表(已解除拓扑关系但仍绑定在家庭)
},
} = await sdk.plugins.syncGatewaySubDevicePlugin.sync(gatewayDeviceInfo.DeviceId); // 知道网关设备id,需要同步其下子设备
// 拿到diffResult后,可以同步到本地UI
add.forEach(({ deviceInfo, success, error }) => {
// 新添加到家庭的设备,只处理添加成功的
if (success) {
deviceList.push({
...item,
isShareDevice: gatewayDeviceInfo.isShareDevice,
});
} else {
console.warn('该子设备添加失败', error);
}
});
remove.forEach(({ deviceInfo, success, error }) => {
const index = deviceList.findIndex(deviceInfo => deviceInfo.DeviceId === item.DeviceId);
// 需要删除的,无论操作成功或失败,都从列表中删除
deviceList.splice(index, 1);
console.log('删除子设备', item, index, deviceList);
});
用法2:同步整个家庭的所有网关(注意:需要传入的deviceList需要为某个家庭的全量设备列表,否则无法正确比对子设备关联情况)
const deviceList = [....xxxx]; // 设备列表
const {
deviceList: newDeviceList, // 真实子设备列表
syncResults: [
{
gatewayDeviceInfo,
subDeviceList,
diffResult: {
add,
remove,
};
},
...others
],
} = await sdk.plugins.syncGatewaySubDevicePlugin.syncByList(deviceList); // 直接传入某个家庭的全量设备列表
// 执行结束后,已处理完整个家庭的网关-子设备同步操作,可以直接用返回的新的 deviceList 来渲染 UI,syncResults 中可以查看具体执行了同步操作的网关及其子设备同步情况
执行某个网关设备的同步子设备操作
批量执行某个家庭的所有网关同步子设备操作。
注意:需要传入该家庭的全量设备列表,否则无法正确比对设备绑定关系
FAQs
腾讯云物联网开发平台应用开发小程序Sdk同步网关子设备插件
The npm package qcloud-iotexplorer-appdev-plugin-sync-gateway-subdevice receives a total of 104 weekly downloads. As such, qcloud-iotexplorer-appdev-plugin-sync-gateway-subdevice popularity was classified as not popular.
We found that qcloud-iotexplorer-appdev-plugin-sync-gateway-subdevice demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.