eRPC API Reference  Rev. 1.12.0
NXP Semiconductors
erpc_serial_transport.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, Freescale Semiconductor, Inc.
3  * Copyright 2016 NXP
4  * All rights reserved.
5  *
6  *
7  * SPDX-License-Identifier: BSD-3-Clause
8  */
9 
10 #ifndef _EMBEDDED_RPC__SERIAL_TRANSPORT_H_
11 #define _EMBEDDED_RPC__SERIAL_TRANSPORT_H_
12 
14 
15 #include <string>
16 
17 extern "C" {
18 #ifdef _WIN32
19 typedef long speed_t;
20 #else
21 #include <termios.h>
22 #endif
23 }
24 
31 // Classes
34 
35 namespace erpc {
42 {
43 public:
50  SerialTransport(const char *portName, speed_t baudRate);
51 
55  virtual ~SerialTransport(void);
56 
65  erpc_status_t init(uint8_t vtime, uint8_t vmin);
66 
67 private:
70 
80  virtual erpc_status_t underlyingReceive(uint8_t *data, uint32_t size) override;
81 
91  virtual erpc_status_t underlyingSend(const uint8_t *data, uint32_t size) override;
92 
93 private:
94  int m_serialHandle;
95  const char *m_portName;
96  speed_t m_baudRate;
97 };
98 
99 } // namespace erpc
100 
103 #endif // _EMBEDDED_RPC__SERIAL_TRANSPORT_H_
Base class for framed transport layers.
Definition: erpc_framed_transport.hpp:56
enum _erpc_status erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:85
erpc_status_t init(uint8_t vtime, uint8_t vmin)
Initialize Serial peripheral.
Definition: erpc_serial_transport.cpp:45
virtual erpc_status_t underlyingReceive(MessageBuffer *message, uint32_t size, uint32_t offset)
Adds ability to framed transport to overwrite MessageBuffer when receiving data.
Definition: erpc_framed_transport.cpp:177
Definition: erpc_arbitrated_client_manager.hpp:25
Serial transport layer for host PC.
Definition: erpc_serial_transport.hpp:41
SerialTransport(const char *portName, speed_t baudRate)
Constructor.
Definition: erpc_serial_transport.cpp:35
virtual erpc_status_t underlyingSend(MessageBuffer *message, uint32_t size, uint32_t offset)
Adds ability to framed transport to overwrite MessageBuffer when sending data.
Definition: erpc_framed_transport.cpp:170
virtual ~SerialTransport(void)
Destructor.
Definition: erpc_serial_transport.cpp:40