@tuya-miniapp/ark-extension-virtual-device 0.0.6 → 0.0.8-beta-2
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.
- package/dist/worker/index.js +2 -112
- package/package.json +1 -1
package/dist/worker/index.js
CHANGED
|
@@ -21540,9 +21540,7 @@ async function getDeviceInfo2(params) {
|
|
|
21540
21540
|
const { result: devInfo } = response || {};
|
|
21541
21541
|
let product = {};
|
|
21542
21542
|
try {
|
|
21543
|
-
const presponse = await getProductInfo({
|
|
21544
|
-
productIds: [devInfo.productId]
|
|
21545
|
-
});
|
|
21543
|
+
const presponse = await getProductInfo({ productIds: [devInfo.productId] });
|
|
21546
21544
|
const { result: productInfo } = presponse || {};
|
|
21547
21545
|
product = productInfo[0] || {};
|
|
21548
21546
|
} catch (e) {
|
|
@@ -21613,9 +21611,7 @@ async function publishDps2(params) {
|
|
|
21613
21611
|
}
|
|
21614
21612
|
async function getProductInfo2(params) {
|
|
21615
21613
|
try {
|
|
21616
|
-
const productInfo = await getProductInfo({
|
|
21617
|
-
productIds: [params.productId]
|
|
21618
|
-
});
|
|
21614
|
+
const productInfo = await getProductInfo({ productIds: [params.productId] });
|
|
21619
21615
|
return {
|
|
21620
21616
|
data: productInfo.result[0],
|
|
21621
21617
|
errorCode: !!productInfo ? 0 : import_TYUniCode.TYUniPluginError.DEVICEKIT_PRODUCT_ID_INVALID.code,
|
|
@@ -21645,26 +21641,10 @@ async function queryDps2(params) {
|
|
|
21645
21641
|
};
|
|
21646
21642
|
}
|
|
21647
21643
|
}
|
|
21648
|
-
function registerDeviceListListener(params) {
|
|
21649
|
-
return {
|
|
21650
|
-
data: null,
|
|
21651
|
-
errorCode: 0,
|
|
21652
|
-
errorMsg: import_TYUniCode.TYUniPluginError.SUCCESS.des
|
|
21653
|
-
};
|
|
21654
|
-
}
|
|
21655
|
-
function unregisterDeviceListListener(params) {
|
|
21656
|
-
return {
|
|
21657
|
-
data: null,
|
|
21658
|
-
errorCode: 0,
|
|
21659
|
-
errorMsg: import_TYUniCode.TYUniPluginError.SUCCESS.des
|
|
21660
|
-
};
|
|
21661
|
-
}
|
|
21662
21644
|
ark.miniapp.addPluginMethod("TYUniDeviceControlManager", "getDeviceInfo", getDeviceInfo2);
|
|
21663
21645
|
ark.miniapp.addPluginMethod("TYUniDeviceControlManager", "getProductInfo", getProductInfo2);
|
|
21664
21646
|
ark.miniapp.addPluginMethod("TYUniDeviceControlManager", "publishDps", publishDps2);
|
|
21665
21647
|
ark.miniapp.addPluginMethod("TYUniDeviceControlManager", "queryDps", queryDps2);
|
|
21666
|
-
ark.miniapp.addPluginMethod("TYUniDeviceControlManager", "registerDeviceListListener", registerDeviceListListener);
|
|
21667
|
-
ark.miniapp.addPluginMethod("TYUniDeviceControlManager", "unregisterDeviceListListener", unregisterDeviceListListener);
|
|
21668
21648
|
|
|
21669
21649
|
// worker/api/services/publishDps.ts
|
|
21670
21650
|
var publishDps = async ({ deviceId, dps }) => {
|
|
@@ -22034,13 +22014,6 @@ function onBluetoothAdapterStateChange(listener) {
|
|
|
22034
22014
|
data: listener
|
|
22035
22015
|
};
|
|
22036
22016
|
}
|
|
22037
|
-
function offBluetoothAdapterStateChange(listener) {
|
|
22038
|
-
return {
|
|
22039
|
-
errorCode: 0,
|
|
22040
|
-
errorMsg: import_TYUniCode3.TYUniPluginError.SUCCESS.des,
|
|
22041
|
-
data: listener
|
|
22042
|
-
};
|
|
22043
|
-
}
|
|
22044
22017
|
function bluetoothIsPowerOn(params) {
|
|
22045
22018
|
return {
|
|
22046
22019
|
data: bluetoothIsOn,
|
|
@@ -22049,91 +22022,8 @@ function bluetoothIsPowerOn(params) {
|
|
|
22049
22022
|
};
|
|
22050
22023
|
}
|
|
22051
22024
|
ark.miniapp.addPluginMethod("TYUniPhoneBluetoothManager", "onBluetoothAdapterStateChange", onBluetoothAdapterStateChange);
|
|
22052
|
-
ark.miniapp.addPluginMethod("TYUniPhoneBluetoothManager", "offBluetoothAdapterStateChange", offBluetoothAdapterStateChange);
|
|
22053
22025
|
ark.miniapp.addPluginMethod("TYUniBluetoothManager", "bluetoothIsPowerOn", bluetoothIsPowerOn);
|
|
22054
22026
|
|
|
22055
|
-
// worker/api/TYUniOTAManager.ts
|
|
22056
|
-
var import_TYUniCode4 = __toESM(require_dist());
|
|
22057
|
-
async function connectTYBLEDevice(params) {
|
|
22058
|
-
return {
|
|
22059
|
-
data: { status: 0 },
|
|
22060
|
-
errorCode: 0,
|
|
22061
|
-
errorMsg: import_TYUniCode4.TYUniPluginError.SUCCESS.des
|
|
22062
|
-
};
|
|
22063
|
-
}
|
|
22064
|
-
ark.miniapp.addPluginMethod("TYUniBluetoothManager", "connectTYBLEDevice", connectTYBLEDevice);
|
|
22065
|
-
|
|
22066
|
-
// worker/api/TYUniBluetoothManager.ts
|
|
22067
|
-
var import_TYUniCode5 = __toESM(require_dist());
|
|
22068
|
-
async function onTYBLEConnectStatusChange(listener) {
|
|
22069
|
-
return {
|
|
22070
|
-
errorCode: 0,
|
|
22071
|
-
errorMsg: import_TYUniCode5.TYUniPluginError.SUCCESS.des,
|
|
22072
|
-
data: listener
|
|
22073
|
-
};
|
|
22074
|
-
}
|
|
22075
|
-
async function offTYBLEConnectStatusChange(listener) {
|
|
22076
|
-
return {
|
|
22077
|
-
errorCode: 0,
|
|
22078
|
-
errorMsg: import_TYUniCode5.TYUniPluginError.SUCCESS.des,
|
|
22079
|
-
data: listener
|
|
22080
|
-
};
|
|
22081
|
-
}
|
|
22082
|
-
function subscribeTYBLEConnectStatus(params) {
|
|
22083
|
-
return {
|
|
22084
|
-
errorCode: 0,
|
|
22085
|
-
errorMsg: import_TYUniCode5.TYUniPluginError.SUCCESS.des,
|
|
22086
|
-
data: null
|
|
22087
|
-
};
|
|
22088
|
-
}
|
|
22089
|
-
function unsubscribeTYBLEConnectStatus(params) {
|
|
22090
|
-
return {
|
|
22091
|
-
errorCode: 0,
|
|
22092
|
-
errorMsg: import_TYUniCode5.TYUniPluginError.SUCCESS.des,
|
|
22093
|
-
data: null
|
|
22094
|
-
};
|
|
22095
|
-
}
|
|
22096
|
-
ark.miniapp.addPluginMethod("TYUniOTAManager", "onTYBLEConnectStatusChange", onTYBLEConnectStatusChange);
|
|
22097
|
-
ark.miniapp.addPluginMethod("TYUniOTAManager", "offTYBLEConnectStatusChange", offTYBLEConnectStatusChange);
|
|
22098
|
-
ark.miniapp.addPluginMethod("TYUniOTAManager", "subscribeTYBLEConnectStatus", subscribeTYBLEConnectStatus);
|
|
22099
|
-
ark.miniapp.addPluginMethod("TYUniOTAManager", "unsubscribeTYBLEConnectStatus", unsubscribeTYBLEConnectStatus);
|
|
22100
|
-
|
|
22101
|
-
// worker/api/TYUniGroupControlManager.ts
|
|
22102
|
-
var import_TYUniCode6 = __toESM(require_dist());
|
|
22103
|
-
function registerGroupChange(params) {
|
|
22104
|
-
return {
|
|
22105
|
-
errorCode: 0,
|
|
22106
|
-
errorMsg: import_TYUniCode6.TYUniPluginError.SUCCESS.des,
|
|
22107
|
-
data: null
|
|
22108
|
-
};
|
|
22109
|
-
}
|
|
22110
|
-
function unRegisterGroupChange(params) {
|
|
22111
|
-
return {
|
|
22112
|
-
errorCode: 0,
|
|
22113
|
-
errorMsg: import_TYUniCode6.TYUniPluginError.SUCCESS.des,
|
|
22114
|
-
data: null
|
|
22115
|
-
};
|
|
22116
|
-
}
|
|
22117
|
-
async function getGroupInfo(params) {
|
|
22118
|
-
const { groupId } = params;
|
|
22119
|
-
const response = await apiRequestByAtop({
|
|
22120
|
-
api: "tuya.m.device.group.get",
|
|
22121
|
-
version: "2.0",
|
|
22122
|
-
params: {
|
|
22123
|
-
id: groupId
|
|
22124
|
-
}
|
|
22125
|
-
});
|
|
22126
|
-
console.log("getGroupInfo------", response);
|
|
22127
|
-
return {
|
|
22128
|
-
errorCode: 0,
|
|
22129
|
-
errorMsg: import_TYUniCode6.TYUniPluginError.SUCCESS.des,
|
|
22130
|
-
data: response?.result
|
|
22131
|
-
};
|
|
22132
|
-
}
|
|
22133
|
-
ark.miniapp.addPluginMethod("TYUniGroupControlManager", "registerGroupChange", registerGroupChange);
|
|
22134
|
-
ark.miniapp.addPluginMethod("TYUniGroupControlManager", "unRegisterGroupChange", unRegisterGroupChange);
|
|
22135
|
-
ark.miniapp.addPluginMethod("TYUniGroupControlManager", "getGroupInfo", getGroupInfo);
|
|
22136
|
-
|
|
22137
22027
|
// worker/index.ts
|
|
22138
22028
|
console.log("ServicesMap", services_default);
|
|
22139
22029
|
ark.runtime.onMessage(async (event) => {
|