@tuya-miniapp/ark-extension-virtual-device 0.0.4 → 0.0.6

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.
@@ -21540,7 +21540,9 @@ async function getDeviceInfo2(params) {
21540
21540
  const { result: devInfo } = response || {};
21541
21541
  let product = {};
21542
21542
  try {
21543
- const presponse = await getProductInfo({ productIds: [devInfo.productId] });
21543
+ const presponse = await getProductInfo({
21544
+ productIds: [devInfo.productId]
21545
+ });
21544
21546
  const { result: productInfo } = presponse || {};
21545
21547
  product = productInfo[0] || {};
21546
21548
  } catch (e) {
@@ -21611,7 +21613,9 @@ async function publishDps2(params) {
21611
21613
  }
21612
21614
  async function getProductInfo2(params) {
21613
21615
  try {
21614
- const productInfo = await getProductInfo({ productIds: [params.productId] });
21616
+ const productInfo = await getProductInfo({
21617
+ productIds: [params.productId]
21618
+ });
21615
21619
  return {
21616
21620
  data: productInfo.result[0],
21617
21621
  errorCode: !!productInfo ? 0 : import_TYUniCode.TYUniPluginError.DEVICEKIT_PRODUCT_ID_INVALID.code,
@@ -21641,10 +21645,26 @@ async function queryDps2(params) {
21641
21645
  };
21642
21646
  }
21643
21647
  }
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
+ }
21644
21662
  ark.miniapp.addPluginMethod("TYUniDeviceControlManager", "getDeviceInfo", getDeviceInfo2);
21645
21663
  ark.miniapp.addPluginMethod("TYUniDeviceControlManager", "getProductInfo", getProductInfo2);
21646
21664
  ark.miniapp.addPluginMethod("TYUniDeviceControlManager", "publishDps", publishDps2);
21647
21665
  ark.miniapp.addPluginMethod("TYUniDeviceControlManager", "queryDps", queryDps2);
21666
+ ark.miniapp.addPluginMethod("TYUniDeviceControlManager", "registerDeviceListListener", registerDeviceListListener);
21667
+ ark.miniapp.addPluginMethod("TYUniDeviceControlManager", "unregisterDeviceListListener", unregisterDeviceListListener);
21648
21668
 
21649
21669
  // worker/api/services/publishDps.ts
21650
21670
  var publishDps = async ({ deviceId, dps }) => {
@@ -22014,6 +22034,13 @@ function onBluetoothAdapterStateChange(listener) {
22014
22034
  data: listener
22015
22035
  };
22016
22036
  }
22037
+ function offBluetoothAdapterStateChange(listener) {
22038
+ return {
22039
+ errorCode: 0,
22040
+ errorMsg: import_TYUniCode3.TYUniPluginError.SUCCESS.des,
22041
+ data: listener
22042
+ };
22043
+ }
22017
22044
  function bluetoothIsPowerOn(params) {
22018
22045
  return {
22019
22046
  data: bluetoothIsOn,
@@ -22022,8 +22049,91 @@ function bluetoothIsPowerOn(params) {
22022
22049
  };
22023
22050
  }
22024
22051
  ark.miniapp.addPluginMethod("TYUniPhoneBluetoothManager", "onBluetoothAdapterStateChange", onBluetoothAdapterStateChange);
22052
+ ark.miniapp.addPluginMethod("TYUniPhoneBluetoothManager", "offBluetoothAdapterStateChange", offBluetoothAdapterStateChange);
22025
22053
  ark.miniapp.addPluginMethod("TYUniBluetoothManager", "bluetoothIsPowerOn", bluetoothIsPowerOn);
22026
22054
 
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
+
22027
22137
  // worker/index.ts
22028
22138
  console.log("ServicesMap", services_default);
22029
22139
  ark.runtime.onMessage(async (event) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/ark-extension-virtual-device",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "files": [
5
5
  "manifest.json",
6
6
  "dist/"