@@ -53,7 +53,20 @@ namespace ProtoComm
5353 AsioSerialProtocol (const AsioSerialProtocol&) = delete ;
5454 AsioSerialProtocol& operator =(const AsioSerialProtocol&) = delete ;
5555
56+ /* *
57+ * @brief Gets the serial port of a specific channel.
58+ *
59+ * @param channelId The unique id of the channel.
60+ * @return The serial port.
61+ */
5662 const asio::serial_port& Port (ICommProtocol::ChannelId channelId) const ;
63+
64+ /* *
65+ * @brief Gets the serial port of a specific channel.
66+ *
67+ * @param name The name of the port.
68+ * @return The serial port if found, `std::nullopt` otherwise.
69+ */
5770 std::optional<std::reference_wrapper<const asio::serial_port>> Port (const std::string& name) const ;
5871
5972 size_t ChannelCount () const override ;
@@ -62,6 +75,17 @@ namespace ProtoComm
6275 bool IsRunning (ICommProtocol::ChannelId channelId) const override ;
6376 void SetChannelEventCallback (ICommProtocol::ChannelEventCallback callback) override ;
6477
78+ /* *
79+ * @brief Opens a new serial port as a managable channel.
80+ *
81+ * @param portName The name of the port to open.
82+ * @param baudRate The baud rate.
83+ * @param dataBits The number of data bits.
84+ * @param stopBits The number of stop bits.
85+ * @param parity The parity checking mode.
86+ * @param flowControl The flow control mode.
87+ * @return The unique id of the created channel on success, `std::nullopt` on fail.
88+ */
6589 std::optional<ICommProtocol::ChannelId> Start (
6690 const std::string& portName,
6791 asio::serial_port_base::baud_rate baudRate,
@@ -109,6 +133,11 @@ namespace ProtoComm
109133 AsioTcpClient (const AsioTcpClient&) = delete ;
110134 AsioTcpClient& operator =(const AsioTcpClient&) = delete ;
111135
136+ /* *
137+ * @brief Gets the tcp socket.
138+ *
139+ * @return The tcp socket.
140+ */
112141 const asio::ip::tcp::socket& Socket () const ;
113142
114143 size_t ChannelCount () const override ;
@@ -117,6 +146,13 @@ namespace ProtoComm
117146 bool IsRunning (ICommProtocol::ChannelId channelId) const override ;
118147 void SetChannelEventCallback (ICommProtocol::ChannelEventCallback callback) override ;
119148
149+ /* *
150+ * @brief Connects to a remote server.
151+ *
152+ * @param host The hostname or IP address of the server.
153+ * @param port The port number.
154+ * @return The unique id of the channel on success, `std::nullopt` on fail.
155+ */
120156 std::optional<ICommProtocol::ChannelId> Start (const std::string& host, const std::string& port);
121157
122158 void Stop () override ;
@@ -178,6 +214,16 @@ namespace ProtoComm
178214 bool IsRunning (ICommProtocol::ChannelId channelId) const override ;
179215 void SetChannelEventCallback (ICommProtocol::ChannelEventCallback callback) override ;
180216
217+ /* *
218+ * @brief Starts the server and begins listening.
219+ *
220+ * @note The channels represent clients in this protocol,
221+ * hence this method will always return `std::nullopt`.
222+ *
223+ * @param host The local IP address to bind to.
224+ * @param port The port number to listen on.
225+ * @return Always `std::nullopt`.
226+ */
181227 std::optional<ICommProtocol::ChannelId> Start (const std::string& host, const std::string& port);
182228
183229 void Stop () override ;
0 commit comments