Extended MaximInterface
Dependents: mbed_DS28EC20_GPIO
Links/SerialPort.hpp@10:de4b8812877d, 2020-01-06 (annotated)
- Committer:
- reARMnimator
- Date:
- Mon Jan 06 15:54:55 2020 +0000
- Revision:
- 10:de4b8812877d
- Parent:
- 7:471901a04573
Fixed inappropriate include path.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
IanBenzMaxim | 3:f818ea5172ed | 1 | /******************************************************************************* |
IanBenzMaxim | 3:f818ea5172ed | 2 | * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved. |
IanBenzMaxim | 3:f818ea5172ed | 3 | * |
IanBenzMaxim | 3:f818ea5172ed | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
IanBenzMaxim | 3:f818ea5172ed | 5 | * copy of this software and associated documentation files (the "Software"), |
IanBenzMaxim | 3:f818ea5172ed | 6 | * to deal in the Software without restriction, including without limitation |
IanBenzMaxim | 3:f818ea5172ed | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
IanBenzMaxim | 3:f818ea5172ed | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
IanBenzMaxim | 3:f818ea5172ed | 9 | * Software is furnished to do so, subject to the following conditions: |
IanBenzMaxim | 3:f818ea5172ed | 10 | * |
IanBenzMaxim | 3:f818ea5172ed | 11 | * The above copyright notice and this permission notice shall be included |
IanBenzMaxim | 3:f818ea5172ed | 12 | * in all copies or substantial portions of the Software. |
IanBenzMaxim | 3:f818ea5172ed | 13 | * |
IanBenzMaxim | 3:f818ea5172ed | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
IanBenzMaxim | 3:f818ea5172ed | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
IanBenzMaxim | 3:f818ea5172ed | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
IanBenzMaxim | 3:f818ea5172ed | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
IanBenzMaxim | 3:f818ea5172ed | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
IanBenzMaxim | 3:f818ea5172ed | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
IanBenzMaxim | 3:f818ea5172ed | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
IanBenzMaxim | 3:f818ea5172ed | 21 | * |
IanBenzMaxim | 3:f818ea5172ed | 22 | * Except as contained in this notice, the name of Maxim Integrated |
IanBenzMaxim | 3:f818ea5172ed | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
IanBenzMaxim | 3:f818ea5172ed | 24 | * Products, Inc. Branding Policy. |
IanBenzMaxim | 3:f818ea5172ed | 25 | * |
IanBenzMaxim | 3:f818ea5172ed | 26 | * The mere transfer of this software does not imply any licenses |
IanBenzMaxim | 3:f818ea5172ed | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
IanBenzMaxim | 3:f818ea5172ed | 28 | * trademarks, maskwork rights, or any other form of intellectual |
IanBenzMaxim | 3:f818ea5172ed | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
IanBenzMaxim | 3:f818ea5172ed | 30 | * ownership rights. |
IanBenzMaxim | 3:f818ea5172ed | 31 | *******************************************************************************/ |
IanBenzMaxim | 3:f818ea5172ed | 32 | |
IanBenzMaxim | 3:f818ea5172ed | 33 | #ifndef MaximInterface_SerialPort |
IanBenzMaxim | 3:f818ea5172ed | 34 | #define MaximInterface_SerialPort |
IanBenzMaxim | 3:f818ea5172ed | 35 | |
IanBenzMaxim | 3:f818ea5172ed | 36 | #include <string> |
IanBenzMaxim | 3:f818ea5172ed | 37 | #include "Uart.hpp" |
IanBenzMaxim | 3:f818ea5172ed | 38 | |
IanBenzMaxim | 3:f818ea5172ed | 39 | namespace MaximInterface { |
IanBenzMaxim | 3:f818ea5172ed | 40 | |
IanBenzMaxim | 3:f818ea5172ed | 41 | class SerialPort : public Uart { |
IanBenzMaxim | 3:f818ea5172ed | 42 | public: |
IanBenzMaxim | 3:f818ea5172ed | 43 | /// Connect a specified COM port. |
IanBenzMaxim | 3:f818ea5172ed | 44 | virtual error_code connect(const std::string & portName) = 0; |
IanBenzMaxim | 3:f818ea5172ed | 45 | |
IanBenzMaxim | 3:f818ea5172ed | 46 | /// Disconnect from the current port. |
IanBenzMaxim | 3:f818ea5172ed | 47 | virtual error_code disconnect() = 0; |
IanBenzMaxim | 3:f818ea5172ed | 48 | |
IanBenzMaxim | 7:471901a04573 | 49 | /// @brief Check if currently connected to a port. |
IanBenzMaxim | 3:f818ea5172ed | 50 | /// @returns True if connected. |
IanBenzMaxim | 3:f818ea5172ed | 51 | virtual bool connected() const = 0; |
IanBenzMaxim | 3:f818ea5172ed | 52 | |
IanBenzMaxim | 3:f818ea5172ed | 53 | /// Get the currently connected port name. |
IanBenzMaxim | 3:f818ea5172ed | 54 | virtual std::string portName() const = 0; |
IanBenzMaxim | 3:f818ea5172ed | 55 | }; |
IanBenzMaxim | 3:f818ea5172ed | 56 | |
IanBenzMaxim | 3:f818ea5172ed | 57 | } |
IanBenzMaxim | 3:f818ea5172ed | 58 | |
IanBenzMaxim | 6:a8c83a2e6fa4 | 59 | #endif |