Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
IUSBHostSerial.h
00001 /* IUSBHostSerial.h */ 00002 /* 00003 Copyright (C) 2012 ARM Limited. 00004 00005 Permission is hereby granted, free of charge, to any person obtaining a copy of 00006 this software and associated documentation files (the "Software"), to deal in 00007 the Software without restriction, including without limitation the rights to 00008 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 00009 of the Software, and to permit persons to whom the Software is furnished to do 00010 so, subject to the following conditions: 00011 00012 The above copyright notice and this permission notice shall be included in all 00013 copies or substantial portions of the Software. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00018 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00020 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00021 SOFTWARE. 00022 */ 00023 00024 00025 #ifndef IUSBHOSTSERIAL_H_ 00026 #define IUSBHOSTSERIAL_H_ 00027 00028 /** 00029 * Generic interface to abstract 3G dongles' impl 00030 */ 00031 00032 #include "IUSBHostSerialListener.h" 00033 00034 class IUSBHostSerial { 00035 public: 00036 00037 enum IrqType { 00038 RxIrq, 00039 TxIrq 00040 }; 00041 00042 /* 00043 * Get a char from the dongle's serial interface 00044 */ 00045 virtual int getc() = 0; 00046 00047 /* 00048 * Put a char to the dongle's serial interface 00049 */ 00050 virtual int putc(int c) = 0; 00051 00052 /* 00053 * Read a packet from the dongle's serial interface, to be called after multiple getc() calls 00054 */ 00055 virtual int readPacket() = 0; 00056 00057 /* 00058 * Write a packet to the dongle's serial interface, to be called after multiple putc() calls 00059 */ 00060 virtual int writePacket() = 0; 00061 00062 /** 00063 * Check the number of bytes available. 00064 * 00065 * @returns the number of bytes available 00066 */ 00067 virtual int readable() = 0; 00068 00069 /** 00070 * Check the free space in output. 00071 * 00072 * @returns the number of bytes available 00073 */ 00074 virtual int writeable() = 0; 00075 00076 /** 00077 * Attach a handler to call when a packet is received / when a packet has been transmitted. 00078 * 00079 * @param pListener instance of the listener deriving from the IUSBHostSerialListener 00080 */ 00081 virtual void attach(IUSBHostSerialListener* pListener) = 0; 00082 00083 /** 00084 * Enable or disable readable/writeable callbacks 00085 */ 00086 virtual void setupIrq(bool en, IrqType irq = RxIrq) = 0; 00087 00088 }; 00089 00090 #endif /* IUSBHOSTSERIAL_H_ */
Generated on Tue Jul 12 2022 17:50:56 by
1.7.2