Skip to content

Commit fca6f8c

Browse files
committed
Release of version 1.0.14
1 parent 97b0b46 commit fca6f8c

File tree

8 files changed

+241
-139
lines changed

8 files changed

+241
-139
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [1.0.14](https://github.com/aws/aws-iot-device-sdk-js/releases/tag/v1.0.14) (Dec 7, 2016)
2+
3+
Bugfixes/Improvements
4+
- Fixes for GitHub issues [#67]( https://github.com/aws/aws-iot-device-sdk-js/issues/67), [#95](https://github.com/aws/aws-iot-device-sdk-js/issues/95), [#96](https://github.com/aws/aws-iot-device-sdk-js/issues/96).
5+
16
## [1.0.13](https://github.com/aws/aws-iot-device-sdk-js/releases/tag/v1.0.13) (July 11, 2016)
27

38
Bugfixes/Improvements

device/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ function DeviceClient(options) {
741741
callback: callback
742742
});
743743
} else {
744-
that.emit('error', 'Maximum queued offline subscription operations reached.');
744+
that.emit('error', new Error('Maximum queued offline subscription reached'));
745745
}
746746
}
747747
};

examples/thing-example.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ function processTest(args) {
116116

117117
function mobileAppConnect() {
118118
thingShadows.register(thingName, {
119-
ignoreDeltas: false,
120-
operationTimeout: operationTimeout
119+
ignoreDeltas: false
121120
},
122121
function(err, failedTopics) {
123122
if (isUndefined(err) && isUndefined(failedTopics)) {
@@ -128,8 +127,7 @@ function processTest(args) {
128127

129128
function deviceConnect() {
130129
thingShadows.register(thingName, {
131-
ignoreDeltas: true,
132-
operationTimeout: operationTimeout
130+
ignoreDeltas: true
133131
},
134132
function(err, failedTopics) {
135133
if (isUndefined(err) && isUndefined(failedTopics)) {

examples/thing-passthrough-example.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
//app deps
2121
const thingShadow = require('..').thingShadow;
2222
const cmdLineProcess = require('./lib/cmdline');
23+
const isUndefined = require('../common/lib/is-undefined');
2324

2425
//begin module
2526

@@ -73,7 +74,6 @@ function processTest(args) {
7374

7475
function genericOperation(operation, state) {
7576
var clientToken = thingShadows[operation](thingName, state);
76-
7777
if (clientToken === null) {
7878
//
7979
// The thing shadow operation can't be performed because another one
@@ -112,8 +112,7 @@ function processTest(args) {
112112
// data to the non-thing topic.
113113
//
114114
thingShadows.register(thingName, {
115-
ignoreDeltas: false,
116-
operationTimeout: operationTimeout
115+
ignoreDeltas: false
117116
});
118117
}
119118

@@ -123,11 +122,13 @@ function processTest(args) {
123122
// topic.
124123
//
125124
thingShadows.register(thingName, {
126-
ignoreDeltas: true,
127-
operationTimeout: operationTimeout
128-
});
129-
genericOperation('update', generateState());
130-
thingShadows.subscribe(nonThingName);
125+
ignoreDeltas: true
126+
}, function(err, failedTopics){
127+
if (isUndefined(err) && isUndefined(failedTopics)) {
128+
genericOperation('update', generateState());
129+
thingShadows.subscribe(nonThingName);
130+
}
131+
});
131132
}
132133

133134
if (args.testMode === 1) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "aws-iot-device-sdk",
33
"description": "AWS IoT Node.js SDK for Embedded Devices",
4-
"version": "1.0.13",
4+
"version": "1.0.14",
55
"author": {
66
"name": "Amazon Web Services",
77
"email": "",

test/mock/mockMQTTClient.js

Lines changed: 125 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -4,123 +4,133 @@ const isUndefined = require('../../common/lib/is-undefined.js');
44

55
function mockMQTTClient( wrapper, options ) {
66

7-
var that = this;
8-
this.options = { 'reconnectPeriod':0 };
9-
10-
// Record list indicating whether the corresponding method is called
11-
this.commandCalled = {'publish':0, 'subscribe':0, 'unsubscribe':0, 'end':0, 'handleMessage':0};
12-
this.lastPublishedMessage = 'Empty'; // Keep track of the last published message
13-
this.subscriptions = new Array;
14-
this.subscriptions.length = 0;
15-
this.publishes = new Array; // for all topics
16-
this.publishes.length = 0;
17-
this.subscribeQosValues = new Array;
18-
this.subscribeQosValues.length = 0;
19-
this.publishQosValues = new Array;
20-
this.publishQosValues.length = 0;
21-
22-
// Reinit the record list
23-
this.reInitCommandCalled = function() {
24-
this.commandCalled['publish'] = 0;
25-
this.commandCalled['subscribe'] = 0;
26-
this.commandCalled['unsubscribe'] = 0;
27-
this.commandCalled['end'] = 0;
28-
this.commandCalled['handleMessage'] = 0;
29-
30-
var topic = this.subscriptions.shift();
31-
while (!isUndefined( topic )) {
32-
topic = this.subscriptions.shift();
33-
}
34-
var message = this.publishes.shift();
35-
while (!isUndefined( message )) {
36-
message = this.publishes.shift();
37-
}
38-
var qos = this.subscribeQosValues.shift();
39-
while (!isUndefined( qos )) {
40-
qos = this.subscribeQosValues.shift();
41-
}
42-
var qos = this.publishQosValues.shift();
43-
while (!isUndefined( qos )) {
44-
qos = this.publishQosValues.shift();
45-
}
46-
};
47-
48-
// Reset publishedMessage
49-
this.resetPublishedMessage = function() {
50-
this.lastPublishedMessage = 'Empty';
51-
}
7+
var that = this;
8+
this.options = { 'reconnectPeriod':0 };
9+
10+
// Record list indicating whether the corresponding method is called
11+
this.commandCalled = {'publish':0, 'subscribe':0, 'unsubscribe':0, 'end':0, 'handleMessage':0};
12+
this.lastPublishedMessage = 'Empty'; // Keep track of the last published message
13+
this.subscriptions = new Array;
14+
this.subscriptions.length = 0;
15+
this.unsubscriptions = new Array;
16+
this.unsubscriptions.length = 0;
17+
this.publishes = new Array; // for all topics
18+
this.publishes.length = 0;
19+
this.subscribeQosValues = new Array;
20+
this.subscribeQosValues.length = 0;
21+
this.publishQosValues = new Array;
22+
this.publishQosValues.length = 0;
23+
24+
// Reinit the record list
25+
this.reInitCommandCalled = function() {
26+
this.commandCalled['publish'] = 0;
27+
this.commandCalled['subscribe'] = 0;
28+
this.commandCalled['unsubscribe'] = 0;
29+
this.commandCalled['end'] = 0;
30+
this.commandCalled['handleMessage'] = 0;
31+
32+
var topic = this.subscriptions.shift();
33+
while (!isUndefined( topic )) {
34+
topic = this.subscriptions.shift();
35+
}
36+
var message = this.publishes.shift();
37+
while (!isUndefined( message )) {
38+
message = this.publishes.shift();
39+
}
40+
var qos = this.subscribeQosValues.shift();
41+
while (!isUndefined( qos )) {
42+
qos = this.subscribeQosValues.shift();
43+
}
44+
var qos = this.publishQosValues.shift();
45+
while (!isUndefined( qos )) {
46+
qos = this.publishQosValues.shift();
47+
}
48+
};
49+
50+
// Reset publishedMessage
51+
this.resetPublishedMessage = function() {
52+
this.lastPublishedMessage = 'Empty';
53+
}
5254

5355
// This is the module mocking the client returned by mqtt.connect, APIs are:
54-
this.publish = function(topic, message, options, callback) {
55-
options = options || '';
56-
callback = callback || '';
57-
this.lastPublishedMessage = message;
58-
this.commandCalled['publish'] += 1;
59-
this.publishes.push( message );
60-
61-
if (!isUndefined( options.qos )) {
62-
this.publishQosValues.push( options.qos );
63-
}
64-
};
65-
66-
this.subscribe = function(topic, options, callback) {
67-
options = options || '';
68-
callback = callback || '';
69-
this.commandCalled['subscribe'] += 1;
70-
71-
var granted = [];
72-
if ( Object.prototype.toString.call(topic) === '[object Array]' ) {
73-
topic.forEach( function( item, index, array ) {
74-
var grantedTopic = {topic: item, qos: 0}
75-
that.subscriptions.push( item );
76-
if (!isUndefined( options.qos )) {
77-
that.subscribeQosValues.push( options.qos );
78-
grantedTopic.qos = options.qos;
79-
}
80-
81-
if (mockMQTTClient.triggerError()) {
82-
grantedTopic.qos = 128;
83-
}
84-
85-
granted.push(grantedTopic);
86-
});
87-
}
88-
else {
89-
var grantedTopic = {topic: topic, qos: 0}
90-
this.subscriptions.push( topic );
91-
if (!isUndefined( options.qos )) {
92-
that.subscribeQosValues.push( options.qos );
93-
grantedTopic.qos = options.qos;
94-
}
95-
if (mockMQTTClient.triggerError()) {
96-
grantedTopic.qos = 128;
97-
}
98-
granted.push(grantedTopic);
99-
}
100-
if(callback !== '') {
101-
callback(null, granted); // call callback
102-
}
103-
};
104-
105-
this.unsubscribe = function(topic, callback) {
106-
callback = callback || '';
107-
this.commandCalled['unsubscribe'] += 1;
108-
if (callback !== '') {
109-
callback(null); // call callback
110-
}
111-
};
112-
113-
this.end = function(force, cb) {
114-
force = force || false;
115-
cb = cb || '';
116-
this.commandCalled['end'] += 1;
117-
};
118-
119-
this.handleMessage = function(packet, callback) {
120-
this.commandCalled['handleMessage'] += 1;
121-
};
122-
123-
EventEmitter.call(this);
56+
this.publish = function(topic, message, options, callback) {
57+
options = options || '';
58+
callback = callback || '';
59+
this.lastPublishedMessage = message;
60+
this.commandCalled['publish'] += 1;
61+
this.publishes.push( message );
62+
63+
if (!isUndefined( options.qos )) {
64+
this.publishQosValues.push( options.qos );
65+
}
66+
};
67+
68+
this.subscribe = function(topic, options, callback) {
69+
options = options || '';
70+
callback = callback || '';
71+
this.commandCalled['subscribe'] += 1;
72+
73+
var granted = [];
74+
if ( Object.prototype.toString.call(topic) === '[object Array]' ) {
75+
topic.forEach( function( item, index, array ) {
76+
var grantedTopic = {topic: item, qos: 0}
77+
that.subscriptions.push( item );
78+
if (!isUndefined( options.qos )) {
79+
that.subscribeQosValues.push( options.qos );
80+
grantedTopic.qos = options.qos;
81+
}
82+
83+
if (mockMQTTClient.triggerError()) {
84+
grantedTopic.qos = 128;
85+
}
86+
87+
granted.push(grantedTopic);
88+
});
89+
}
90+
else {
91+
var grantedTopic = {topic: topic, qos: 0}
92+
this.subscriptions.push( topic );
93+
if (!isUndefined( options.qos )) {
94+
that.subscribeQosValues.push( options.qos );
95+
grantedTopic.qos = options.qos;
96+
}
97+
if (mockMQTTClient.triggerError()) {
98+
grantedTopic.qos = 128;
99+
}
100+
granted.push(grantedTopic);
101+
}
102+
if(callback !== '') {
103+
callback(null, granted); // call callback
104+
}
105+
};
106+
107+
this.unsubscribe = function(topic, callback) {
108+
callback = callback || '';
109+
this.commandCalled['unsubscribe'] += 1;
110+
if ( Object.prototype.toString.call(topic) === '[object Array]' ) {
111+
topic.forEach( function( item, index, array ) {
112+
that.unsubscriptions.push( item );
113+
});
114+
}
115+
else {
116+
this.unsubscriptions.push( topic );
117+
}
118+
if (callback !== '') {
119+
callback(null); // call callback
120+
}
121+
};
122+
123+
this.end = function(force, cb) {
124+
force = force || false;
125+
cb = cb || '';
126+
this.commandCalled['end'] += 1;
127+
};
128+
129+
this.handleMessage = function(packet, callback) {
130+
this.commandCalled['handleMessage'] += 1;
131+
};
132+
133+
EventEmitter.call(this);
124134
}
125135

126136
util.inherits(mockMQTTClient, EventEmitter);

0 commit comments

Comments
 (0)