Skip to content

Commit 6fc5b82

Browse files
author
Stefania
committed
rename serial monitor
1 parent e2a50ac commit 6fc5b82

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ ArduinoCloud.sendMessage(connectionId, topic, message).then(() => {
4545
// Message sent
4646
});
4747

48-
ArduinoCloud.openCloudSerialMonitor(connectionId, deviceId, cb).then(topic => {
49-
// Serial monitor messages fired to cb
48+
ArduinoCloud.openCloudMonitor(connectionId, deviceId, cb).then(topic => {
49+
// Cloud monitor messages fired to cb
5050
});
5151

52-
ArduinoCloud.writeCloudSerialMonitor(connectionId, deviceId, message).then(() => {
53-
// Message sent to serial monitor
52+
ArduinoCloud.writeCloudMonitor(connectionId, deviceId, message).then(() => {
53+
// Message sent to cloud monitor
5454
});
5555

56-
ArduinoCloud.closeCloudSerialMonitor(connectionId, deviceId).then(topic => {
57-
// Close serial monitor
56+
ArduinoCloud.closeCloudMonitor(connectionId, deviceId).then(topic => {
57+
// Close cloud monitor
5858
});
5959

6060
// Send a property value to a device

src/index.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -198,19 +198,19 @@ const sendMessage = (id, topic, message) => new Promise((resolve, reject) => {
198198
return resolve();
199199
});
200200

201-
const openCloudSerialMonitor = (id, deviceId, cb) => {
202-
const cloudSerialOutputTopic = `/a/d/${deviceId}/s/o`;
203-
return subscribe(id, cloudSerialOutputTopic, cb);
201+
const openCloudMonitor = (id, deviceId, cb) => {
202+
const cloudMonitorOutputTopic = `/a/d/${deviceId}/s/o`;
203+
return subscribe(id, cloudMonitorOutputTopic, cb);
204204
};
205205

206-
const writeCloudSerialMonitor = (id, deviceId, message) => {
207-
const cloudSerialInputTopic = `/a/d/${deviceId}/s/i`;
208-
return sendMessage(id, cloudSerialInputTopic, message);
206+
const writeCloudMonitor = (id, deviceId, message) => {
207+
const cloudMonitorInputTopic = `/a/d/${deviceId}/s/i`;
208+
return sendMessage(id, cloudMonitorInputTopic, message);
209209
};
210210

211-
const closeCloudSerialMonitor = (id, deviceId) => {
212-
const cloudSerialOutputTopic = `/a/d/${deviceId}/s/o`;
213-
return unsubscribe(id, cloudSerialOutputTopic);
211+
const closeCloudMonitor = (id, deviceId) => {
212+
const cloudMonitorOutputTopic = `/a/d/${deviceId}/s/o`;
213+
return unsubscribe(id, cloudMonitorOutputTopic);
214214
};
215215

216216
const sendProperty = (connectionId, deviceId, name, value, timestamp) => {
@@ -325,9 +325,9 @@ export default {
325325
subscribe,
326326
unsubscribe,
327327
sendMessage,
328-
openCloudSerialMonitor,
329-
writeCloudSerialMonitor,
330-
closeCloudSerialMonitor,
328+
openCloudMonitor,
329+
writeCloudMonitor,
330+
closeCloudMonitor,
331331
sendProperty,
332332
sendPropertyAsDevice,
333333
onPropertyValue,

test/arduino-cloud.test.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -65,36 +65,36 @@ it('Property name must be a string in sendProperty', (done) => {
6565
}
6666
});
6767

68-
it('Simulate client write to serial monitor', (done) => {
69-
ArduinoCloud.writeCloudSerialMonitor(connectionId, deviceId, `this is a test ${Math.random()}`).then(() => {
68+
it('Simulate client write to cloud monitor', (done) => {
69+
ArduinoCloud.writeCloudMonitor(connectionId, deviceId, `this is a test ${Math.random()}`).then(() => {
7070
done();
7171
}, (error) => {
7272
throw new Error(error);
7373
});
7474
});
7575

76-
it('Simulate device write to serial monitor', (done) => {
77-
const cloudSerialInputTopic = `/a/d/${deviceId}/s/o`;
78-
ArduinoCloud.sendMessage(connectionId, cloudSerialInputTopic, `this is a test ${Math.random()}`).then(() => {
76+
it('Simulate device write to cloud monitor', (done) => {
77+
const cloudMonitorInputTopic = `/a/d/${deviceId}/s/o`;
78+
ArduinoCloud.sendMessage(connectionId, cloudMonitorInputTopic, `this is a test ${Math.random()}`).then(() => {
7979
done();
8080
}, (error) => {
8181
throw new Error(error);
8282
});
8383
});
8484

85-
it('Simulate device write and client read his message from serial monitor', (done) => {
86-
const cloudSerialInputTopic = `/a/d/${deviceId}/s/o`;
85+
it('Simulate device write and client read his message from cloud monitor', (done) => {
86+
const cloudMonitorInputTopic = `/a/d/${deviceId}/s/o`;
8787

8888
const cb = () => {
89-
// console.log(`[${new Date()}] Message from serial: ${message}`);
89+
// console.log(`[${new Date()}] Message from monitor: ${message}`);
9090
done();
9191
};
9292

93-
ArduinoCloud.openCloudSerialMonitor(connectionId, deviceId, cb).then(() => {
93+
ArduinoCloud.openCloudMonitor(connectionId, deviceId, cb).then(() => {
9494
// console.log(`Subscribed to topic: ${topic}`);
9595
const message = `This is a test ${new Date()}`;
96-
ArduinoCloud.sendMessage(connectionId, cloudSerialInputTopic, message).then(() => {
97-
// console.log(`[${new Date()}] Message sent to serial: [${message}]`);
96+
ArduinoCloud.sendMessage(connectionId, cloudMonitorInputTopic, message).then(() => {
97+
// console.log(`[${new Date()}] Message sent to monitor: [${message}]`);
9898
}, (error) => {
9999
throw new Error(error);
100100
});

0 commit comments

Comments
 (0)