The beta version of the Vodafone K3770 dongle driver
This library is deprecated. Please use the newest production branch of the library from https://mbed.org/users/mbed_official/code/VodafoneUSBModem/
contrib/vodafone/if/VodafoneK3770.h@1:4b33ffe61bfa, 2012-11-01 (annotated)
- Committer:
- donatien
- Date:
- Thu Nov 01 10:03:50 2012 +0000
- Revision:
- 1:4b33ffe61bfa
- Parent:
- 0:0ac66acdfdc0
Deprecating library, pointing out at new one
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donatien | 0:0ac66acdfdc0 | 1 | /* VodafoneK3770.h */ |
donatien | 0:0ac66acdfdc0 | 2 | /* |
donatien | 0:0ac66acdfdc0 | 3 | Copyright (C) 2012 ARM Limited. |
donatien | 0:0ac66acdfdc0 | 4 | |
donatien | 0:0ac66acdfdc0 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
donatien | 0:0ac66acdfdc0 | 6 | this software and associated documentation files (the "Software"), to deal in |
donatien | 0:0ac66acdfdc0 | 7 | the Software without restriction, including without limitation the rights to |
donatien | 0:0ac66acdfdc0 | 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
donatien | 0:0ac66acdfdc0 | 9 | of the Software, and to permit persons to whom the Software is furnished to do |
donatien | 0:0ac66acdfdc0 | 10 | so, subject to the following conditions: |
donatien | 0:0ac66acdfdc0 | 11 | |
donatien | 0:0ac66acdfdc0 | 12 | The above copyright notice and this permission notice shall be included in all |
donatien | 0:0ac66acdfdc0 | 13 | copies or substantial portions of the Software. |
donatien | 0:0ac66acdfdc0 | 14 | |
donatien | 0:0ac66acdfdc0 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
donatien | 0:0ac66acdfdc0 | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
donatien | 0:0ac66acdfdc0 | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
donatien | 0:0ac66acdfdc0 | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
donatien | 0:0ac66acdfdc0 | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
donatien | 0:0ac66acdfdc0 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
donatien | 0:0ac66acdfdc0 | 21 | SOFTWARE. |
donatien | 0:0ac66acdfdc0 | 22 | */ |
donatien | 0:0ac66acdfdc0 | 23 | |
donatien | 0:0ac66acdfdc0 | 24 | #ifndef VODAFONEK3770_H_ |
donatien | 0:0ac66acdfdc0 | 25 | #define VODAFONEK3770_H_ |
donatien | 0:0ac66acdfdc0 | 26 | |
donatien | 1:4b33ffe61bfa | 27 | #error 'This library is deprecated. Please use the newest production branch of the library from https://mbed.org/users/mbed_official/code/VodafoneUSBModem/' |
donatien | 1:4b33ffe61bfa | 28 | |
donatien | 0:0ac66acdfdc0 | 29 | #include "core/fwk.h" |
donatien | 0:0ac66acdfdc0 | 30 | |
donatien | 0:0ac66acdfdc0 | 31 | #include "USB3GModule/WANDongle.h" |
donatien | 0:0ac66acdfdc0 | 32 | #include "drv/at/ATCommandsInterface.h" |
donatien | 0:0ac66acdfdc0 | 33 | #include "drv/serial/usb/USBSerialStream.h" |
donatien | 0:0ac66acdfdc0 | 34 | #include "if/ip/PPPIPInterface.h" |
donatien | 0:0ac66acdfdc0 | 35 | #include "if/sms/SMSInterface.h" |
donatien | 0:0ac66acdfdc0 | 36 | #include "if/ussd/USSDInterface.h" |
donatien | 0:0ac66acdfdc0 | 37 | |
donatien | 0:0ac66acdfdc0 | 38 | /** Vodafone K3770 dongle |
donatien | 0:0ac66acdfdc0 | 39 | */ |
donatien | 0:0ac66acdfdc0 | 40 | class VodafoneK3770 |
donatien | 0:0ac66acdfdc0 | 41 | { |
donatien | 0:0ac66acdfdc0 | 42 | public: |
donatien | 0:0ac66acdfdc0 | 43 | /** Create Vodafone K3770 dongle API instance |
donatien | 0:0ac66acdfdc0 | 44 | |
donatien | 0:0ac66acdfdc0 | 45 | */ |
donatien | 0:0ac66acdfdc0 | 46 | VodafoneK3770(); |
donatien | 0:0ac66acdfdc0 | 47 | |
donatien | 0:0ac66acdfdc0 | 48 | //Internet-related functions |
donatien | 0:0ac66acdfdc0 | 49 | |
donatien | 0:0ac66acdfdc0 | 50 | /** Open a 3G internet connection |
donatien | 0:0ac66acdfdc0 | 51 | @return 0 on success, error code on failure |
donatien | 0:0ac66acdfdc0 | 52 | */ |
donatien | 0:0ac66acdfdc0 | 53 | int connect(const char* apn = NULL, const char* user = NULL, const char* password = NULL); |
donatien | 0:0ac66acdfdc0 | 54 | |
donatien | 0:0ac66acdfdc0 | 55 | /** Close the internet connection |
donatien | 0:0ac66acdfdc0 | 56 | @return 0 on success, error code on failure |
donatien | 0:0ac66acdfdc0 | 57 | */ |
donatien | 0:0ac66acdfdc0 | 58 | int disconnect(); |
donatien | 0:0ac66acdfdc0 | 59 | |
donatien | 0:0ac66acdfdc0 | 60 | |
donatien | 0:0ac66acdfdc0 | 61 | /** Send a SM |
donatien | 0:0ac66acdfdc0 | 62 | @param number The receiver's phone number |
donatien | 0:0ac66acdfdc0 | 63 | @param message The message to send |
donatien | 0:0ac66acdfdc0 | 64 | @return 0 on success, error code on failure |
donatien | 0:0ac66acdfdc0 | 65 | */ |
donatien | 0:0ac66acdfdc0 | 66 | int sendSM(const char* number, const char* message); |
donatien | 0:0ac66acdfdc0 | 67 | |
donatien | 0:0ac66acdfdc0 | 68 | |
donatien | 0:0ac66acdfdc0 | 69 | /** Receive a SM |
donatien | 0:0ac66acdfdc0 | 70 | @param number Pointer to a buffer to store the sender's phone number (must be at least 17 characters-long, including the sapce for the null-terminating char) |
donatien | 0:0ac66acdfdc0 | 71 | @param message Pointer to a buffer to store the the incoming message |
donatien | 0:0ac66acdfdc0 | 72 | @param maxLength Maximum message length that can be stored in buffer (including null-terminating character) |
donatien | 0:0ac66acdfdc0 | 73 | @return 0 on success, error code on failure |
donatien | 0:0ac66acdfdc0 | 74 | */ |
donatien | 0:0ac66acdfdc0 | 75 | int getSM(char* number, char* message, size_t maxLength); |
donatien | 0:0ac66acdfdc0 | 76 | |
donatien | 0:0ac66acdfdc0 | 77 | /** Get the number of SMs in the incoming box |
donatien | 0:0ac66acdfdc0 | 78 | @param pCount pointer to store the number of unprocessed SMs on |
donatien | 0:0ac66acdfdc0 | 79 | @return 0 on success, error code on failure |
donatien | 0:0ac66acdfdc0 | 80 | */ |
donatien | 0:0ac66acdfdc0 | 81 | int getSMCount(size_t* pCount); |
donatien | 0:0ac66acdfdc0 | 82 | |
donatien | 0:0ac66acdfdc0 | 83 | /** Send a USSD command & wait for its result |
donatien | 0:0ac66acdfdc0 | 84 | @param command The command to send |
donatien | 0:0ac66acdfdc0 | 85 | @param result Buffer in which to store the result |
donatien | 0:0ac66acdfdc0 | 86 | @param maxLength Maximum result length that can be stored in buffer (including null-terminating character) |
donatien | 0:0ac66acdfdc0 | 87 | @return 0 on success, error code on failure |
donatien | 0:0ac66acdfdc0 | 88 | */ |
donatien | 0:0ac66acdfdc0 | 89 | int sendUSSD(const char* command, char* result, size_t maxLength); |
donatien | 0:0ac66acdfdc0 | 90 | |
donatien | 0:0ac66acdfdc0 | 91 | /** Get the ATCommandsInterface instance |
donatien | 0:0ac66acdfdc0 | 92 | @return Pointer to the ATCommandsInterface instance |
donatien | 0:0ac66acdfdc0 | 93 | */ |
donatien | 0:0ac66acdfdc0 | 94 | ATCommandsInterface* getATCommandsInterface(); |
donatien | 0:0ac66acdfdc0 | 95 | |
donatien | 0:0ac66acdfdc0 | 96 | protected: |
donatien | 0:0ac66acdfdc0 | 97 | int init(); |
donatien | 0:0ac66acdfdc0 | 98 | |
donatien | 0:0ac66acdfdc0 | 99 | private: |
donatien | 0:0ac66acdfdc0 | 100 | WANDongle m_dongle; |
donatien | 0:0ac66acdfdc0 | 101 | USBSerialStream m_stream; |
donatien | 0:0ac66acdfdc0 | 102 | ATCommandsInterface m_at; |
donatien | 0:0ac66acdfdc0 | 103 | PPPIPInterface m_ppp; |
donatien | 0:0ac66acdfdc0 | 104 | SMSInterface m_sms; |
donatien | 0:0ac66acdfdc0 | 105 | USSDInterface m_ussd; |
donatien | 0:0ac66acdfdc0 | 106 | |
donatien | 0:0ac66acdfdc0 | 107 | bool m_dongleConnected; |
donatien | 0:0ac66acdfdc0 | 108 | bool m_ipInit; |
donatien | 0:0ac66acdfdc0 | 109 | bool m_smsInit; |
donatien | 0:0ac66acdfdc0 | 110 | bool m_ussdInit; |
donatien | 0:0ac66acdfdc0 | 111 | bool m_atOpen; |
donatien | 0:0ac66acdfdc0 | 112 | }; |
donatien | 0:0ac66acdfdc0 | 113 | |
donatien | 0:0ac66acdfdc0 | 114 | |
donatien | 0:0ac66acdfdc0 | 115 | #endif /* VODAFONEK3770_H_ */ |