|
Byggern
|
A socket which defines the communication in a CAN channel. More...
#include <socket.h>
Public Member Functions | |
| Socket (const Socket &)=delete | |
| Socket (uint8_t id) | |
| void | Initialize (CAN *can) |
| void | Write (uint8_t *string, uint16_t size) |
| void | WriteByte (uint8_t byte) |
Public Member Functions inherited from Stream | |
| Stream (uint16_t input_stream_size, uint16_t output_stream_size) | |
| virtual uint16_t | Read (uint8_t *string, uint16_t size) |
| virtual bool | ReadByte (uint8_t &byte) |
| virtual uint8_t | GetAvailableWriteBytes () |
| virtual uint8_t | GetAvailableReadBytes () |
| virtual bool | CheckInputOverflowFlag () |
| virtual bool | CheckOutputOverflowFlag () |
| virtual uint16_t | GetInputBufferLength () |
| virtual uint16_t | GetOutputBufferLength () |
| virtual void | FlushInputBuffer () |
| virtual void | FlushOutputBuffer () |
Static Public Member Functions | |
| static Socket & | GetInstance (uint8_t id=0) |
| static void | HandleDataFromLowerLevel (CanMessage &message) |
Public Attributes | |
| CAN * | can |
Private Attributes | |
| uint8_t | id |
Additional Inherited Members | |
Protected Member Functions inherited from Stream | |
| virtual uint16_t | ReadFromBuffer (uint8_t *buffer, uint16_t &start_index, uint16_t &stop_index, uint16_t &buffer_size, bool &empty, uint8_t *string, uint16_t &string_size) |
| virtual void | WriteToBuffer (uint8_t *buffer, uint16_t &start_index, uint16_t &stop_index, uint16_t &buffer_size, bool &empty, bool &overflow_flag, uint8_t *string, uint16_t &string_size, void(*cb)(Stream *stream)) |
| virtual bool | ReadByteFromBuffer (uint8_t &byte, uint8_t *buffer, uint16_t &start_index, uint16_t &stop_index, uint16_t &buffer_size, bool &empty) |
| virtual void | WriteByteToBuffer (uint8_t *buffer, uint16_t &start_index, uint16_t &stop_index, uint16_t &buffer_size, bool &empty, bool &overflow_flag, uint8_t &byte, void(*cb)(Stream *stream)) |
| virtual void | WriteByteToInputStream (uint8_t &byte) |
| virtual bool | ReadByteFromOutputStream (uint8_t &byte) |
| virtual void | WriteToInputStream (uint8_t *string, uint16_t size) |
| virtual uint16_t | ReadFromOutputStream (uint8_t *string, uint16_t size) |
| virtual uint16_t | CalculateLength (uint16_t &start_index, uint16_t &stop_index, uint16_t &buffer_size, bool &empty) |
| virtual void | FlushStream (uint16_t &start_index, uint16_t &stop_index, uint16_t &buffer_size, bool &empty) |
Protected Attributes inherited from Stream | |
| uint8_t * | input_buffer |
| uint8_t * | output_buffer |
| uint16_t | input_buffer_start_index = 0 |
| uint16_t | output_buffer_start_index = 0 |
| uint16_t | input_buffer_stop_index |
| uint16_t | output_buffer_stop_index |
| uint16_t | input_buffer_size |
| uint16_t | output_buffer_size |
| void(* | event_input_buffer_not_empty )(Stream *stream) = nullptr |
| void(* | event_output_buffer_not_empty )(Stream *stream) = nullptr |
| bool | input_buffer_empty = true |
| bool | output_buffer_empty = true |
| bool | input_buffer_overflowed = false |
| bool | output_buffer_overflowed = false |
A socket which defines the communication in a CAN channel.
It uses an ID to identify which channel it is listening and sending on. This interface consists of two sockets , although it is flexible to increase the amount of sockets. See GetInstance() for more information regarding extending the number of sockets. The lower the socket identifier, the higher the priority.
|
delete |
Because of singleton, make sure it is not deleted
|
inline |
The initializer. Not used by end user due to singleton
| id | The socket ID |
|
inlinestatic |
A Singleton implementation of this class. In order to have support for more than two sockets, this if else statement has to bee extended to the amount of sockets you wish to support.
| id | The socket ID |
|
inlinestatic |
Called when a new CAN_MESSAGE from the can controller has arrived. Puts the message into the stream
| message | The received CAN_MESSAGE |
|
inline |
Initializes the socket.
| can | A can controller which implements the interface defined in the can class in this project |
| target_id | The target node id |
|
virtual |
Creates the required number of can messages and sends the data to the targeted id
| string | Data to be sent |
| size | Size of the data |
Reimplemented from Stream.
|
virtual |
Creates a can message and sends the byte to the targeted id
| byte |
Reimplemented from Stream.
|
private |
This sockets identifier