PHS module SMA-01 library. see: https://developer.mbed.org/users/phsfan/notebook/abitusbmodem/

Dependencies:   Socket lwip-sys lwip

Dependents:   AbitUSBModem_HTTPTest AbitUSBModem_MQTTTest AbitUSBModem_WebsocketTest AbitUSBModem_SMSTest

Fork of VodafoneUSBModem by mbed official

/media/uploads/phsfan/sma01_003.png

Committer:
phsfan
Date:
Wed Feb 25 14:34:13 2015 +0000
Revision:
99:514e67a69ad6
Parent:
96:b50f5f795684
supported SMS

Who changed what in which revision?

UserRevisionLine numberNew contents of line
phsfan 96:b50f5f795684 1 /* IUSBHostSerial.h */
phsfan 96:b50f5f795684 2 /* Copyright (c) 2010-2012 mbed.org, MIT License
phsfan 96:b50f5f795684 3 *
phsfan 96:b50f5f795684 4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
phsfan 96:b50f5f795684 5 * and associated documentation files (the "Software"), to deal in the Software without
phsfan 96:b50f5f795684 6 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
phsfan 96:b50f5f795684 7 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
phsfan 96:b50f5f795684 8 * Software is furnished to do so, subject to the following conditions:
phsfan 96:b50f5f795684 9 *
phsfan 96:b50f5f795684 10 * The above copyright notice and this permission notice shall be included in all copies or
phsfan 96:b50f5f795684 11 * substantial portions of the Software.
phsfan 96:b50f5f795684 12 *
phsfan 96:b50f5f795684 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
phsfan 96:b50f5f795684 14 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
phsfan 96:b50f5f795684 15 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
phsfan 96:b50f5f795684 16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
phsfan 96:b50f5f795684 17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
phsfan 96:b50f5f795684 18 */
phsfan 96:b50f5f795684 19
phsfan 96:b50f5f795684 20 #ifndef IUSBHOSTSERIAL_H_
phsfan 96:b50f5f795684 21 #define IUSBHOSTSERIAL_H_
phsfan 96:b50f5f795684 22
phsfan 96:b50f5f795684 23 /**
phsfan 96:b50f5f795684 24 * Generic interface to abstract 3G dongles' impl
phsfan 96:b50f5f795684 25 */
phsfan 96:b50f5f795684 26
phsfan 96:b50f5f795684 27 #include "IUSBHostSerialListener.h"
phsfan 96:b50f5f795684 28
phsfan 96:b50f5f795684 29 class IUSBHostSerial {
phsfan 96:b50f5f795684 30 public:
phsfan 96:b50f5f795684 31
phsfan 96:b50f5f795684 32 enum IrqType {
phsfan 96:b50f5f795684 33 RxIrq,
phsfan 96:b50f5f795684 34 TxIrq
phsfan 96:b50f5f795684 35 };
phsfan 96:b50f5f795684 36
phsfan 96:b50f5f795684 37 /*
phsfan 96:b50f5f795684 38 * Get a char from the dongle's serial interface
phsfan 96:b50f5f795684 39 */
phsfan 96:b50f5f795684 40 virtual int getc() = 0;
phsfan 96:b50f5f795684 41
phsfan 96:b50f5f795684 42 /*
phsfan 96:b50f5f795684 43 * Put a char to the dongle's serial interface
phsfan 96:b50f5f795684 44 */
phsfan 96:b50f5f795684 45 virtual int putc(int c) = 0;
phsfan 96:b50f5f795684 46
phsfan 96:b50f5f795684 47 /*
phsfan 96:b50f5f795684 48 * Read a packet from the dongle's serial interface, to be called after multiple getc() calls
phsfan 96:b50f5f795684 49 */
phsfan 96:b50f5f795684 50 virtual int readPacket() = 0;
phsfan 96:b50f5f795684 51
phsfan 96:b50f5f795684 52 /*
phsfan 96:b50f5f795684 53 * Write a packet to the dongle's serial interface, to be called after multiple putc() calls
phsfan 96:b50f5f795684 54 */
phsfan 96:b50f5f795684 55 virtual int writePacket() = 0;
phsfan 96:b50f5f795684 56
phsfan 96:b50f5f795684 57 /**
phsfan 96:b50f5f795684 58 * Check the number of bytes available.
phsfan 96:b50f5f795684 59 *
phsfan 96:b50f5f795684 60 * @returns the number of bytes available
phsfan 96:b50f5f795684 61 */
phsfan 96:b50f5f795684 62 virtual int readable() = 0;
phsfan 96:b50f5f795684 63
phsfan 96:b50f5f795684 64 /**
phsfan 96:b50f5f795684 65 * Check the free space in output.
phsfan 96:b50f5f795684 66 *
phsfan 96:b50f5f795684 67 * @returns the number of bytes available
phsfan 96:b50f5f795684 68 */
phsfan 96:b50f5f795684 69 virtual int writeable() = 0;
phsfan 96:b50f5f795684 70
phsfan 96:b50f5f795684 71 /**
phsfan 96:b50f5f795684 72 * Attach a handler to call when a packet is received / when a packet has been transmitted.
phsfan 96:b50f5f795684 73 *
phsfan 96:b50f5f795684 74 * @param pListener instance of the listener deriving from the IUSBHostSerialListener
phsfan 96:b50f5f795684 75 */
phsfan 96:b50f5f795684 76 virtual void attach(IUSBHostSerialListener* pListener) = 0;
phsfan 96:b50f5f795684 77
phsfan 96:b50f5f795684 78 /**
phsfan 96:b50f5f795684 79 * Enable or disable readable/writeable callbacks
phsfan 96:b50f5f795684 80 */
phsfan 96:b50f5f795684 81 virtual void setupIrq(bool en, IrqType irq = RxIrq) = 0;
phsfan 96:b50f5f795684 82
phsfan 96:b50f5f795684 83 };
phsfan 96:b50f5f795684 84
phsfan 96:b50f5f795684 85 #endif /* IUSBHOSTSERIAL_H_ */