eco-access-specifications 2.0.10 → 2.0.12

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.
@@ -71,6 +71,8 @@ var createCommandQueue = function createCommandQueue(specMethod, DeviceEvent, De
71
71
  var o = _step2.value;
72
72
  if (typeof o.siid === 'number' && typeof o.piid === 'number') {
73
73
  result["".concat(o.siid, "_").concat(o.piid)] = o.value;
74
+ } else if (typeof o.type === 'number' && typeof o.piid === 'number') {
75
+ result["".concat(o.type, "_").concat(o.piid)] = o.value;
74
76
  }
75
77
  }
76
78
  } catch (err) {
@@ -83,7 +85,7 @@ var createCommandQueue = function createCommandQueue(specMethod, DeviceEvent, De
83
85
  };
84
86
  var _checkAndExecute = /*#__PURE__*/function () {
85
87
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
86
- var command, rawResult, result, extracted;
88
+ var command, rawResult, result, _result$objects$, extracted;
87
89
  return _regeneratorRuntime().wrap(function _callee$(_context) {
88
90
  while (1) switch (_context.prev = _context.next) {
89
91
  case 0:
@@ -94,7 +96,31 @@ var createCommandQueue = function createCommandQueue(specMethod, DeviceEvent, De
94
96
  return _context.abrupt("return");
95
97
  case 2:
96
98
  isProcessing = true;
97
- command = commandArray.shift();
99
+ command = commandArray.shift(); // ✅ 类型映射逻辑
100
+ // if (
101
+ // command.specWay === 'setPropertiesValue' &&
102
+ // command.entity &&
103
+ // Array.isArray(command.entity.objects)
104
+ // ) {
105
+ // const typeMap = {
106
+ // bool: 0,
107
+ // uint8: 1,
108
+ // int8: 2,
109
+ // uint16: 3,
110
+ // int16: 4,
111
+ // uint32: 5,
112
+ // int32: 6,
113
+ // uint64: 7,
114
+ // int64: 8,
115
+ // float: 9,
116
+ // string: 10,
117
+ // };
118
+ // command.entity.objects.forEach(obj => {
119
+ // if (typeof obj.type === 'string' && typeMap.hasOwnProperty(obj.type)) {
120
+ // obj.type = typeMap[obj.type];
121
+ // }
122
+ // });
123
+ // }
98
124
  _context.prev = 4;
99
125
  addLog("spec\u6307\u4EE4\u4E0B\u53D1\u6210\u529F:".concat((Device.mac, JSON.stringify(command.entity))));
100
126
  _context.next = 8;
@@ -103,27 +129,52 @@ var createCommandQueue = function createCommandQueue(specMethod, DeviceEvent, De
103
129
  rawResult = _context.sent;
104
130
  result = parseToObject(rawResult);
105
131
  addLog("spec\u6307\u4EE4\u54CD\u5E94\u6210\u529F\u2705:".concat(JSON.stringify(result)));
106
- if (typeof command.onResult === 'function') {
107
- command.onResult({
108
- type: command.specWay,
109
- result: result
110
- });
111
- } else if (typeof command.onResultVal === 'function') {
112
- extracted = extractValues(result, command.targets);
113
- command.onResultVal(extracted);
114
- } else if (globalCallback) {
132
+ if (!(typeof command.onResult === 'function')) {
133
+ _context.next = 15;
134
+ break;
135
+ }
136
+ command.onResult({
137
+ type: command.specWay,
138
+ result: result
139
+ });
140
+ _context.next = 24;
141
+ break;
142
+ case 15:
143
+ if (!(typeof command.onResultVal === 'function')) {
144
+ _context.next = 23;
145
+ break;
146
+ }
147
+ extracted = extractValues(result, command.targets);
148
+ if (!((result === null || result === void 0 || (_result$objects$ = result.objects[0]) === null || _result$objects$ === void 0 ? void 0 : _result$objects$.code) !== 0)) {
149
+ _context.next = 20;
150
+ break;
151
+ }
152
+ addLog("spec\u6307\u4EE4\u54CD\u5E94\u5931\u8D25\u274C:".concat(JSON.stringify(extracted)));
153
+ throw new Error("spec\u6307\u4EE4\u54CD\u5E94\u5931\u8D25\u274C:".concat(JSON.stringify(extracted)));
154
+ case 20:
155
+ command.onResultVal(extracted);
156
+ _context.next = 24;
157
+ break;
158
+ case 23:
159
+ if (globalCallback) {
115
160
  globalCallback({
116
161
  type: command.specWay,
117
162
  result: result
118
163
  });
119
164
  }
120
- _context.next = 18;
165
+ case 24:
166
+ _context.next = 30;
121
167
  break;
122
- case 14:
123
- _context.prev = 14;
168
+ case 26:
169
+ _context.prev = 26;
124
170
  _context.t0 = _context["catch"](4);
125
171
  addLog("spec\u274C\u5931\u8D25:".concat(JSON.stringify(_context.t0)));
126
- if (typeof command.onResult === 'function') {
172
+ if (typeof command.error === 'function') {
173
+ command.error({
174
+ type: command.specWay,
175
+ error: _context.t0
176
+ });
177
+ } else if (typeof command.onResult === 'function') {
127
178
  command.onResult({
128
179
  type: command.specWay,
129
180
  error: _context.t0
@@ -134,14 +185,14 @@ var createCommandQueue = function createCommandQueue(specMethod, DeviceEvent, De
134
185
  error: _context.t0
135
186
  });
136
187
  }
137
- case 18:
188
+ case 30:
138
189
  isProcessing = false;
139
190
  _checkAndExecute();
140
- case 20:
191
+ case 32:
141
192
  case "end":
142
193
  return _context.stop();
143
194
  }
144
- }, _callee, null, [[4, 14]]);
195
+ }, _callee, null, [[4, 26]]);
145
196
  }));
146
197
  return function checkAndExecute() {
147
198
  return _ref.apply(this, arguments);
package/lib/index.min.js CHANGED
@@ -1 +1 @@
1
- import{bleSpec}from"./main/specMethod";var appName="",Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";appName="",Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";appName=appName="",Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";export{appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints};
1
+ import{bleSpec}from"./main/specMethod";var appName="",Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";appName="",Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";import{bleSpec}from"./main/specMethod";appName=appName="",Device={},DeviceEvent={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,DeviceEvent=e.DeviceEvent,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth,DeviceEvent,Device)};import{initSpecifications,bleSpecQueue}from"./global";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log";import{oneTrackReport,allTrackPoints}from"./eco-track-report";export{appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,DeviceEvent,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints};
@@ -133,4 +133,5 @@ _defineProperty(LogPage, "navigationOptions", function (_ref) {
133
133
  header: null
134
134
  };
135
135
  });
136
- export { LogPage as default };
136
+ export { LogPage as default };
137
+ LogPage.displayName = 'LogPage';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eco-access-specifications",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "description": "生态链公司插件接入规范,帮助生态链公司提高生产效率.",
5
5
  "main": "index.js",
6
6
  "scripts": {