homebridge-cmd4 6.3.0-beta.1 → 7.0.0

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/cmd4Constants.js CHANGED
@@ -86,6 +86,10 @@ var cmd4Constants = {
86
86
  QUEUETYPE_STANDARD: "StandarD",
87
87
  // Used internally to mean entries go straight through the queue
88
88
  QUEUETYPE_PASSTHRU: "None",
89
+ DEFAULT_STANDARD_QUEUE_RETRY_COUNT: 0,
90
+ DEFAULT_WORM_QUEUE_RETRY_COUNT: 0,
91
+ QUEUE_RETRIES: "retries",
92
+
89
93
 
90
94
 
91
95
  // Platform/Accessory Config Constants
@@ -137,18 +141,68 @@ var cmd4Constants = {
137
141
  VALUE_lv: "value",
138
142
  CMD4_STORAGE_lv: "cmd4Storage",
139
143
 
144
+ ERROR_STRING_MIN: -151,
140
145
  ERROR_TIMER_EXPIRED: -151,
141
- //Exports.ERROR_CMD_FAILED_REPLY: -152,
146
+ // ERROR_CMD_FAILED_REPLY: -152,
142
147
  ERROR_NULL_REPLY: -153,
143
148
  ERROR_NULL_STRING_REPLY: -154,
144
149
  ERROR_EMPTY_STRING_REPLY: -155,
145
150
  ERROR_2ND_NULL_STRING_REPLY: -156,
146
151
  ERROR_NON_CONVERTABLE_REPLY: -157,
147
152
  ERROR_NO_DATA_REPLY: -158,
153
+ ERROR_STRING_MAX: -158,
154
+ ERROR_STRINGS:
155
+ [ // cmd4Constants.ERROR_TIMER_EXPIRED -151
156
+ "Timer expired contacting accessory",
157
+ // cmd4Constants.ERROR_CMD_FAILED_REPLY -152
158
+ "Command failed",
159
+ // cmd4Constants.ERROR_NULL_REPLY -153
160
+ "Reply is NULL",
161
+ // cmd4Constants.ERROR_NULL_STRING_REPLY -154
162
+ "Reply is NULL string",
163
+ // cmd4Constants.ERROR_EMPTY_STRING_REPLY -155
164
+ "Reply is an empty string",
165
+ // cmd4Constants.ERROR_2ND_NULL_STRING_REPLY -156
166
+ "Reply is still NULL",
167
+ // cmd4Constants.ERROR_NON_CONVERTABLE_REPLY -157
168
+ "Cannot convert characteristic string",
169
+ // cmd4Constants.ERROR_NO_DATA_REPLY -158
170
+ "No data returned from accessory"
171
+ ],
172
+
173
+ // Convert our known Error Codes to strings
174
+ errorString: function( index )
175
+ {
176
+ let offset = - index + cmd4Constants.ERROR_STRING_MIN ;
177
+ let max = cmd4Constants.ERROR_STRING_MIN - cmd4Constants.ERROR_STRING_MAX;
178
+
179
+ //console.log(" index is " + index );
180
+ //console.log(" offset is " + offset );
181
+ //console.log(" max is " + max );
182
+ // i.e 0-7
183
+ if ( index == 0 )
184
+ return "Device returned SUCCESS; " + index;
185
+
186
+ //if ( offset < 0 || offset > max )
187
+ if ( index > cmd4Constants.ERROR_STRING_MIN )
188
+ return "Device returned its own error; " + index;
189
+ if ( index < cmd4Constants.ERROR_STRING_MAX )
190
+ return "Device returned its own error; " + index;
191
+
192
+ // Should not happen because of the above checks
193
+ if ( offset < 0 )
194
+ return "Invalid Error min index: " + index;
195
+
196
+ // Should not happen because of the above checks
197
+ if ( offset > max )
198
+ return "Invalid Error max index: " + index;
199
+
200
+ return cmd4Constants.ERROR_STRINGS[ offset ];
201
+ },
148
202
 
149
203
 
150
204
 
151
205
  // Static Messages
152
- DBUSY: "Perhaps your device is busy?"
206
+ DBUSY: "Perhaps your device is busy or unavailable?"
153
207
  };
154
208
  module.exports = cmd4Constants;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-cmd4",
3
3
  "description": "Exec Plugin for Homebridge supporting all accessorys and characteristics",
4
- "version": "6.3.0-beta.1",
4
+ "version": "7.0.0",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "John Talbot"