Vodafone K3770/K3772-Z modems driver & networking library
Dependencies: Socket USBHostWANDongle lwip-sys lwip
Dependents: VodafoneUSBModemHTTPClientTest VodafoneUSBModemNTPClientTest VodafoneUSBModemSMSTest VodafoneUSBModemUSSDTest ... more
Fork of VodafoneUSBModem_bleedingedge by
USSDInterface.h
00001 /* USSDInterface.h */ 00002 /* Copyright (C) 2012 mbed.org, MIT License 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00005 * and associated documentation files (the "Software"), to deal in the Software without restriction, 00006 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 00007 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00008 * furnished to do so, subject to the following conditions: 00009 * 00010 * The above copyright notice and this permission notice shall be included in all copies or 00011 * substantial portions of the Software. 00012 * 00013 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00014 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00015 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00016 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00017 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00018 */ 00019 00020 #ifndef USSDINTERFACE_H_ 00021 #define USSDINTERFACE_H_ 00022 00023 #include "core/fwk.h" 00024 00025 #include "rtos.h" 00026 00027 #include "at/ATCommandsInterface.h" 00028 00029 /** Component to send/receive Unstructured Supplementary Service Data (USSD) 00030 * 00031 */ 00032 class USSDInterface : protected IATCommandsProcessor, IATEventsHandler 00033 { 00034 public: 00035 /** Create USSDInterface instance 00036 @param pIf Pointer to the ATCommandsInterface instance to use 00037 */ 00038 USSDInterface(ATCommandsInterface* pIf); 00039 00040 /** Initialize interface 00041 Configure USSD commands & register for USSD-related unsolicited result codes 00042 */ 00043 int init(); 00044 00045 /** Send a USSD command & wait for its result 00046 @param command The command to send 00047 @param result Buffer in which to store the result 00048 @param maxLength Maximum result length that can be stored in buffer (including null-terminating character) 00049 @return 0 on success, error code on failure 00050 */ 00051 int send(const char* command, char* result, size_t maxLength); 00052 00053 protected: 00054 //IATCommandsProcessor, needed for implementations of 3GGP standard < r06 00055 virtual int onNewATResponseLine(ATCommandsInterface* pInst, const char* line); 00056 virtual int onNewEntryPrompt(ATCommandsInterface* pInst); 00057 00058 //IATEventsHandler, needed for implementations of 3GGP standard >= r06 00059 virtual bool isATCodeHandled(const char* atCode); //Is this AT code handled 00060 virtual void onDispatchStart(); 00061 virtual void onDispatchStop(); 00062 virtual char* getEventsEnableCommand(); 00063 virtual char* getEventsDisableCommand(); 00064 virtual void onEvent(const char* atCode, const char* evt); 00065 00066 private: 00067 void processResult(const char* data); 00068 00069 ATCommandsInterface* m_pIf; 00070 Mutex m_responseMtx; //To protect concurrent accesses btw the user's thread and the AT thread 00071 Semaphore m_responseSphre; 00072 00073 //Result 00074 volatile char* m_result; 00075 volatile size_t m_maxResultLength; 00076 00077 }; 00078 00079 00080 #endif /* USSDINTERFACE_H_ */
Generated on Tue Jul 12 2022 12:11:28 by 1.7.2