Skip to content

Commit 53e2449

Browse files
committed
Address comments
1 parent 6b96e9c commit 53e2449

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

index.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,19 +186,11 @@ let rcl = {
186186

187187
/** {@link getActionNamesAndTypes} function */
188188
getActionNamesAndTypes: getActionNamesAndTypes,
189-
/**
190-
* Serialize a message to a buffer.
191-
* @param {Object} message - The message to serialize.
192-
* @return {Buffer} The serialized message as a Buffer.
193-
*/
189+
190+
/** {@link serializeMessage} function */
194191
serializeMessage: serializeMessage,
195192

196-
/**
197-
* Deserialize a message from a buffer.
198-
* @param {Buffer} buffer - The buffer containing the serialized message.
199-
* @param {Object} typeClass - The class of the message type to deserialize into.
200-
* @return {Object} The deserialized message object.
201-
*/
193+
/** {@link deserializeMessage} function */
202194
deserializeMessage: deserializeMessage,
203195

204196
/**

lib/serialization.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
const rclnodejs = require('bindings')('rclnodejs');
1818

1919
class Serialization {
20+
/**
21+
* Serialize a message to a buffer.
22+
* @param {object} message - The message to serialize.
23+
* @param {function} typeClass - The class of the message type to serialize.
24+
* @return {Buffer} The serialized message as a Buffer.
25+
*/
2026
static serializeMessage(message, typeClass) {
2127
if (!(message instanceof typeClass)) {
2228
throw new TypeError('Message must be a valid ros2 message type');
@@ -29,6 +35,12 @@ class Serialization {
2935
);
3036
}
3137

38+
/**
39+
* Deserialize a message from a buffer.
40+
* @param {Buffer} buffer - The buffer containing the serialized message.
41+
* @param {function} typeClass - The class of the message type to deserialize into.
42+
* @return {object} The deserialized message object.
43+
*/
3244
static deserializeMessage(buffer, typeClass) {
3345
if (!(buffer instanceof Buffer)) {
3446
throw new TypeError('Buffer is required for deserialization');

0 commit comments

Comments
 (0)