Changes to support Vodafone K4606
Dependencies: Socket USBHostWANDongle lwip-sys lwip
Fork of VodafoneUSBModem by
Diff: ussd/USSDInterface.cpp
- Revision:
- 83:897a0de9d668
- Parent:
- 59:593fb493172f
- Child:
- 85:d74a2a9d2b01
--- a/ussd/USSDInterface.cpp Tue Jan 29 13:49:23 2013 +0000 +++ b/ussd/USSDInterface.cpp Tue Mar 05 14:54:15 2013 +0000 @@ -17,7 +17,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#define __DEBUG__ 0 +#define __DEBUG__ 4 #ifndef __MODULE__ #define __MODULE__ "USSDInterface.cpp" #endif @@ -34,6 +34,7 @@ USSDInterface::USSDInterface(ATCommandsInterface* pIf) : m_pIf(pIf), m_responseMtx(), m_responseSphre(1), m_result(NULL), m_maxResultLength(0) { m_responseSphre.wait(0); //Take ownership of the semaphore + DBG("events handler reg ussd"); m_pIf->registerEventsHandler(this); //Add us to the unsolicited result codes handlers } @@ -45,7 +46,7 @@ int USSDInterface::send(const char* command, char* result, size_t maxLength) { - if (strlen(command) > 20) //Prevent buffer overflow + if (strlen(command) > 20) //Prevent buffer overflow XXX shouldn't this be 19 as the AT+CUSD=1,"" is 12 { return NET_TOOSMALL; } @@ -188,6 +189,7 @@ return; } size_t cpyLen = MIN( pEnd - pStart, m_maxResultLength - 1 ); + DBG("cpyLen: %d",cpyLen); memcpy((void*)m_result, pStart, cpyLen); m_result[cpyLen] = '\0'; DBG("Got USSD response: %s", m_result);