Vodafone K3770/K3772-Z modems driver & networking library

Dependencies:   Socket

This library is deprecated. Please use the newest production branch of the library from https://mbed.org/users/mbed_official/code/VodafoneUSBModem/

Committer:
donatien
Date:
Thu Nov 01 09:57:11 2012 +0000
Revision:
2:50930edb6eb3
Parent:
0:bd5343539e38
Deprecated library, pointing out to new one

Who changed what in which revision?

UserRevisionLine numberNew contents of line
donatien 0:bd5343539e38 1 /* USSDInterface.h */
donatien 0:bd5343539e38 2 /* Copyright (C) 2012 mbed.org, MIT License
donatien 0:bd5343539e38 3 *
donatien 0:bd5343539e38 4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
donatien 0:bd5343539e38 5 * and associated documentation files (the "Software"), to deal in the Software without restriction,
donatien 0:bd5343539e38 6 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
donatien 0:bd5343539e38 7 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
donatien 0:bd5343539e38 8 * furnished to do so, subject to the following conditions:
donatien 0:bd5343539e38 9 *
donatien 0:bd5343539e38 10 * The above copyright notice and this permission notice shall be included in all copies or
donatien 0:bd5343539e38 11 * substantial portions of the Software.
donatien 0:bd5343539e38 12 *
donatien 0:bd5343539e38 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
donatien 0:bd5343539e38 14 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
donatien 0:bd5343539e38 15 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
donatien 0:bd5343539e38 16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
donatien 0:bd5343539e38 17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
donatien 0:bd5343539e38 18 */
donatien 0:bd5343539e38 19
donatien 0:bd5343539e38 20 #ifndef USSDINTERFACE_H_
donatien 0:bd5343539e38 21 #define USSDINTERFACE_H_
donatien 0:bd5343539e38 22
donatien 0:bd5343539e38 23 #include "core/fwk.h"
donatien 0:bd5343539e38 24
donatien 0:bd5343539e38 25 #include "rtos.h"
donatien 0:bd5343539e38 26
donatien 0:bd5343539e38 27 #include "at/ATCommandsInterface.h"
donatien 0:bd5343539e38 28
donatien 0:bd5343539e38 29 /** Component to send/receive Unstructured Supplementary Service Data (USSD)
donatien 0:bd5343539e38 30 *
donatien 0:bd5343539e38 31 */
donatien 0:bd5343539e38 32 class USSDInterface : protected IATEventsHandler
donatien 0:bd5343539e38 33 {
donatien 0:bd5343539e38 34 public:
donatien 0:bd5343539e38 35 /** Create USSDInterface instance
donatien 0:bd5343539e38 36 @param pIf Pointer to the ATCommandsInterface instance to use
donatien 0:bd5343539e38 37 */
donatien 0:bd5343539e38 38 USSDInterface(ATCommandsInterface* pIf);
donatien 0:bd5343539e38 39
donatien 0:bd5343539e38 40 /** Initialize interface
donatien 0:bd5343539e38 41 Configure USSD commands & register for USSD-related unsolicited result codes
donatien 0:bd5343539e38 42 */
donatien 0:bd5343539e38 43 int init();
donatien 0:bd5343539e38 44
donatien 0:bd5343539e38 45 /** Send a USSD command & wait for its result
donatien 0:bd5343539e38 46 @param command The command to send
donatien 0:bd5343539e38 47 @param result Buffer in which to store the result
donatien 0:bd5343539e38 48 @param maxLength Maximum result length that can be stored in buffer (including null-terminating character)
donatien 0:bd5343539e38 49 @return 0 on success, error code on failure
donatien 0:bd5343539e38 50 */
donatien 0:bd5343539e38 51 int send(const char* command, char* result, size_t maxLength);
donatien 0:bd5343539e38 52
donatien 0:bd5343539e38 53 protected:
donatien 0:bd5343539e38 54 //IATEventsHandler
donatien 0:bd5343539e38 55 virtual bool isATCodeHandled(const char* atCode); //Is this AT code handled
donatien 0:bd5343539e38 56 virtual void onDispatchStart();
donatien 0:bd5343539e38 57 virtual void onDispatchStop();
donatien 0:bd5343539e38 58 virtual void onEvent(const char* atCode, const char* evt);
donatien 0:bd5343539e38 59
donatien 0:bd5343539e38 60 private:
donatien 0:bd5343539e38 61 ATCommandsInterface* m_pIf;
donatien 0:bd5343539e38 62 Mutex m_responseMtx; //To protect concurrent accesses btw the user's thread and the AT thread
donatien 0:bd5343539e38 63 Semaphore m_responseSphre;
donatien 0:bd5343539e38 64
donatien 0:bd5343539e38 65 //Result
donatien 0:bd5343539e38 66 char* m_result;
donatien 0:bd5343539e38 67 size_t m_maxResultLength;
donatien 0:bd5343539e38 68
donatien 0:bd5343539e38 69 };
donatien 0:bd5343539e38 70
donatien 0:bd5343539e38 71
donatien 0:bd5343539e38 72 #endif /* USSDINTERFACE_H_ */