- The
UartCommunicationWithObc
class is an abstract class to communicate withOnBoardComputer
. - Component classes can use this abstract class to emulate telemetry/command communication with an
OnBoardComputer
. - This class also supports communication with
C2A
in theObcWithC2a
class.
- on_board_computer.cpp, hpp
- example_serial_communication_with_obc.cpp, hpp
- Users can find an example of using this class.
- Inherit this class by component class.
- Users need to set
sils_port_id
and targetOnBoardComputer
for the communication.
- Users need to set
- This class has the following protected functions for telemetry/command communication. Users can call these functions in the
MainRoutine
of the component.int ReceiveCommand(const int offset, const int rec_size); int SendTelemetry(const int offset);
- In the protected functions, the following pure virtual functions are called. Users need to define the functions in the subclass.
virtual int ParseCommand(const int cmd_size)=0; virtual int GenerateTelemetry()=0;
- In the constructors, the communication port for the
OnBoardComputer
is connected. - If another component already connects the port, the connection function returns an error, and the constructors output a message.
- Both constructors require
sils_port_id
and targetOnBoardComputer
. - Users can set the communication data buffer size. When users do not put the size, the value is automatically set as the maximum value.
- The maximum value is 1024, and it is defined in
uart_port.hpp
- The maximum value is 1024, and it is defined in
- N/A
- N/A
- In the destructor, the communication port is closed.
- If another component has closed the port, the close function returns an error, and the constructors output a message.
- N/A
- N/A
- N/A
- Receive command data sent from the OBC.
- input
- offset: offset value of the rx_buffer [Byte]
- rec_size: receiving data size = length of the command [Byte]
- output
- return: Error code. (<=0: Error was happened)
- N/A
- N/A
- Send telemetry data to the OBC.
- input
- offset: offset value of the tx_buffer [Byte]
- output
- return: Error code. 0: fine, <0: Error.
- N/A
- N/A
- Users need to define this function to analyze the command.
- input
- cmd_size: command side [Byte]
- output
- return: Error code. (<=0: Error was happened)
- N/A
- N/A
- Users need to define this function to make telemetry.
- input: N/A
- output
- return: send data size [Byte]
- N/A
- N/A
- N/A
- N/A