1
1
/*
2
2
* Copyright 2019 ARDUINO SA (http://www.arduino.cc/)
3
- * This file is part of node-red-contrib-arduino-cloud.
3
+ * This file is part of node-red-contrib-arduino-iot- cloud.
4
4
* Copyright (c) 2019
5
5
*
6
6
* This software is released under:
7
7
* The GNU General Public License, which covers the main part of
8
- * node-red-contrib-arduino-cloud
8
+ * node-red-contrib-arduino-iot- cloud
9
9
* The terms of this license can be found at:
10
10
* https://www.gnu.org/licenses/gpl-3.0.en.html
11
11
*
@@ -50,7 +50,7 @@ module.exports = function (RED) {
50
50
this . status ( { } ) ;
51
51
} , config . id ) ;
52
52
} else {
53
- this . status ( { fill : "red" , shape : "ring" , text : "arduino-cloud.status.connection-error" } ) ;
53
+ this . status ( { fill : "red" , shape : "ring" , text : "arduino-iot- cloud.status.connection-error" } ) ;
54
54
}
55
55
this . on ( 'close' , function ( done ) {
56
56
connectionManager . deleteClientMqtt ( connectionConfig . credentials . clientid , this . thing , this . propertyVariableName , config . id ) . then ( ( ) => { done ( ) ; } ) ;
@@ -88,7 +88,7 @@ module.exports = function (RED) {
88
88
if ( typeof msg . payload !== "object" ) {
89
89
s = getStatus ( msg . payload ) ;
90
90
} else {
91
- s = "arduino-cloud.status.object-sent" ;
91
+ s = "arduino-iot- cloud.status.object-sent" ;
92
92
}
93
93
if ( s != undefined )
94
94
this . status ( { fill : "grey" , shape : "dot" , text : s } ) ;
@@ -106,14 +106,14 @@ module.exports = function (RED) {
106
106
console . log ( err ) ;
107
107
}
108
108
109
- this . status ( { fill : "red" , shape : "dot" , text : "arduino-cloud.status.error-setting-value" } ) ;
109
+ this . status ( { fill : "red" , shape : "dot" , text : "arduino-iot- cloud.status.error-setting-value" } ) ;
110
110
}
111
111
} ) ;
112
112
this . on ( 'close' , function ( done ) {
113
113
connectionManager . deleteClientHttp ( connectionConfig . credentials . clientid ) . then ( ( ) => { done ( ) ; } ) ;
114
114
} ) ;
115
115
} else {
116
- this . status ( { fill : "red" , shape : "ring" , text : "arduino-cloud.status.connection-error" } ) ;
116
+ this . status ( { fill : "red" , shape : "ring" , text : "arduino-iot- cloud.status.connection-error" } ) ;
117
117
}
118
118
}
119
119
} catch ( err ) {
@@ -181,9 +181,9 @@ module.exports = function (RED) {
181
181
} ]
182
182
}
183
183
) ;
184
- var str = RED . _ ( "arduino-cloud.status.sent" ) ;
184
+ var str = RED . _ ( "arduino-iot- cloud.status.sent" ) ;
185
185
str += data . length ;
186
- str += RED . _ ( "arduino-cloud.status.elements" ) ;
186
+ str += RED . _ ( "arduino-iot- cloud.status.elements" ) ;
187
187
this . status ( { fill : "grey" , shape : "dot" , text : str } ) ;
188
188
}
189
189
} catch ( err ) {
@@ -198,7 +198,7 @@ module.exports = function (RED) {
198
198
console . log ( err ) ;
199
199
}
200
200
201
- this . status ( { fill : "red" , shape : "dot" , text : "arduino-cloud.status.error-getting-value" } ) ;
201
+ this . status ( { fill : "red" , shape : "dot" , text : "arduino-iot- cloud.status.error-getting-value" } ) ;
202
202
}
203
203
} ) ;
204
204
@@ -207,7 +207,7 @@ module.exports = function (RED) {
207
207
} ) ;
208
208
}
209
209
} else {
210
- this . status ( { fill : "red" , shape : "ring" , text : "arduino-cloud.status.connection-error" } ) ;
210
+ this . status ( { fill : "red" , shape : "ring" , text : "arduino-iot- cloud.status.connection-error" } ) ;
211
211
}
212
212
} catch ( err ) {
213
213
if ( err . response && err . response . res && err . response . request ) {
@@ -221,7 +221,7 @@ module.exports = function (RED) {
221
221
console . log ( err ) ;
222
222
}
223
223
224
- this . status ( { fill : "red" , shape : "dot" , text : "arduino-cloud.status.error-getting-value" } ) ;
224
+ this . status ( { fill : "red" , shape : "dot" , text : "arduino-iot- cloud.status.error-getting-value" } ) ;
225
225
}
226
226
}
227
227
}
@@ -257,7 +257,7 @@ module.exports = function (RED) {
257
257
}
258
258
}
259
259
} else {
260
- this . status ( { fill : "red" , shape : "ring" , text : "arduino-cloud.status.connection-error" } ) ;
260
+ this . status ( { fill : "red" , shape : "ring" , text : "arduino-iot- cloud.status.connection-error" } ) ;
261
261
}
262
262
} catch ( err ) {
263
263
if ( err . response && err . response . res && err . response . request ) {
@@ -306,7 +306,7 @@ module.exports = function (RED) {
306
306
}
307
307
308
308
this . pollTimeoutPoll = setTimeout ( ( ) => { this . poll ( connectionConfig , pollTime ) } , pollTime * 1000 ) ;
309
- this . status ( { fill : "red" , shape : "dot" , text : "arduino-cloud.status.error-getting-value" } ) ;
309
+ this . status ( { fill : "red" , shape : "dot" , text : "arduino-iot- cloud.status.error-getting-value" } ) ;
310
310
}
311
311
}
312
312
}
@@ -356,14 +356,14 @@ module.exports = function (RED) {
356
356
console . log ( err ) ;
357
357
}
358
358
359
- this . status ( { fill : "red" , shape : "dot" , text : "arduino-cloud.status.error-getting-value" } ) ;
359
+ this . status ( { fill : "red" , shape : "dot" , text : "arduino-iot- cloud.status.error-getting-value" } ) ;
360
360
}
361
361
} ) ;
362
362
this . on ( 'close' , function ( done ) {
363
363
connectionManager . deleteClientHttp ( connectionConfig . credentials . clientid ) . then ( ( ) => { done ( ) ; } ) ;
364
364
} ) ;
365
365
} else {
366
- this . status ( { fill : "red" , shape : "ring" , text : "arduino-cloud.status.connection-error" } ) ;
366
+ this . status ( { fill : "red" , shape : "ring" , text : "arduino-iot- cloud.status.connection-error" } ) ;
367
367
}
368
368
}
369
369
} catch ( err ) {
@@ -378,7 +378,7 @@ module.exports = function (RED) {
378
378
console . log ( err ) ;
379
379
}
380
380
381
- this . status ( { fill : "red" , shape : "dot" , text : "arduino-cloud.status.error-getting-value" } ) ;
381
+ this . status ( { fill : "red" , shape : "dot" , text : "arduino-iot- cloud.status.error-getting-value" } ) ;
382
382
}
383
383
}
384
384
}
@@ -414,13 +414,13 @@ module.exports = function (RED) {
414
414
} else if ( req . query . connectionid ) {
415
415
const connectionConfig = RED . nodes . getNode ( req . query . connectionid ) ;
416
416
if ( ! connectionConfig ) {
417
- str = RED . _ ( "arduino-cloud.connection-error.no-cred-available" ) ;
417
+ str = RED . _ ( "arduino-iot- cloud.connection-error.no-cred-available" ) ;
418
418
console . log ( str ) ;
419
419
return res . send ( JSON . stringify ( { error : str } ) ) ;
420
420
}
421
421
arduinoRestClient = await connectionManager . getClientHttp ( connectionConfig ) ;
422
422
} else {
423
- str = RED . _ ( "arduino-cloud.connection-error.no-cred-available" ) ;
423
+ str = RED . _ ( "arduino-iot- cloud.connection-error.no-cred-available" ) ;
424
424
console . log ( str ) ;
425
425
return res . send ( JSON . stringify ( { error : str } ) ) ;
426
426
}
@@ -430,12 +430,12 @@ module.exports = function (RED) {
430
430
const thing_id = req . query . thing_id ;
431
431
return res . send ( JSON . stringify ( await arduinoRestClient . getProperties ( thing_id ) ) ) ;
432
432
} else {
433
- str = RED . _ ( "arduino-cloud.connection-error.wrong-param" ) ;
433
+ str = RED . _ ( "arduino-iot- cloud.connection-error.wrong-param" ) ;
434
434
console . log ( str ) ;
435
435
return res . send ( JSON . stringify ( { error : str } ) ) ;
436
436
}
437
437
} catch ( err ) {
438
- str = RED . _ ( "arduino-cloud.connection-error.wrong-cred-sys-unvail" ) ;
438
+ str = RED . _ ( "arduino-iot- cloud.connection-error.wrong-cred-sys-unvail" ) ;
439
439
console . log ( `Status: ${ err . status } , message: ${ err . error } ` ) ;
440
440
return res . send ( JSON . stringify ( { error : str } ) ) ;
441
441
}
@@ -456,5 +456,5 @@ function getStatus(value) {
456
456
else
457
457
return value ;
458
458
}
459
- return RED . _ ( "arduino-cloud.status.object-injected" ) ;
459
+ return RED . _ ( "arduino-iot- cloud.status.object-injected" ) ;
460
460
}
0 commit comments