Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Socket USBHostWANDongle lwip-sys lwip
Fork of VodafoneUSBModem by
Revision 69:9b475f458fbc, committed 2013-02-06
- Comitter:
- nherriot
- Date:
- Wed Feb 06 16:51:39 2013 +0000
- Parent:
- 62:6f42a974eea6
- Child:
- 70:f6d75c4bb9d9
- Commit message:
- This removes a block in the VodafoneUSBModem lib. If there is no modem attached or a power problem the lib returns with a hardware error.; There is still a bug on power up though, as the application layer is not left stranded but it still happens!
Changed in this revision
--- a/USBHostWANDongleLib.lib Tue Nov 13 12:00:34 2012 +0000 +++ b/USBHostWANDongleLib.lib Wed Feb 06 16:51:39 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/donatien/code/USBHostWANDongle_bleedingedge/#4344ce758b88 +http://mbed.org/users/donatien/code/USBHostWANDongle_bleedingedge/#25c10b07bb17
--- a/VodafoneUSBModem.cpp Tue Nov 13 12:00:34 2012 +0000
+++ b/VodafoneUSBModem.cpp Wed Feb 06 16:51:39 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__ 3
+#define __DEBUG__ 4
#ifndef __MODULE__
#define __MODULE__ "VodafoneUSBModem.cpp"
#endif
@@ -442,6 +442,7 @@
int VodafoneUSBModem::getLinkState(int* pRssi, LinkMonitor::REGISTRATION_STATE* pRegistrationState, LinkMonitor::BEARER* pBearer)
{
+ DBG("Entering getLinkState.");
int ret = init();
if(ret)
{
@@ -504,8 +505,10 @@
int VodafoneUSBModem::init()
{
+ DBG("Entering init method for the VodafoneUSBModme");
if( !m_dongleConnected )
{
+ DBG("Dongle is not connected");
if(!power())
{
//Obviously cannot initialize the dongle if it is disconnected...
@@ -513,11 +516,38 @@
return NET_INVALID;
}
m_dongleConnected = true;
- while( !m_dongle.connected() )
+ bool detectConnectedModem = false; // local variable to use to create a while loop that we can break out of - this is used to detect if we can see a modem or not
+
+ while(!detectConnectedModem)
{
- m_dongle.tryConnect();
- Thread::wait(10);
+ for (int x=0; x<100;x++)
+ {
+ DBG("Trying to connect the dongle");
+ m_dongle.tryConnect();
+ if (m_dongle.connected())
+ {
+ DBG("Great the dongle is connected");
+ detectConnectedModem = true; // OK we can break out this while loop now - the dongle has been connected
+ break; // Break out of the for loop once the dongle is connected - otherwise try for a while more
+ }
+ Thread::wait(10);
+ }
+
+ // OK we got this far - so give up trying and let someone know you can't see the modem
+ m_dongleConnected = false; // set the member variable of this object to false - so if we get called again we know we have to try to detect again
+ ERR("There is no dongle pluged into the board, or the module does not respond. Is the module/modem switched on?");
+ return HARDWARE_NO_RESPONSE;
}
+
+
+ //while( !m_dongle.connected() )
+ //{
+ // DBG("Trying to connect the dongle");
+ // m_dongle.tryConnect();
+ // Thread::wait(10);
+ //}
+
+
}
if(m_atOpen)
--- a/VodafoneUSBModem.h Tue Nov 13 12:00:34 2012 +0000 +++ b/VodafoneUSBModem.h Wed Feb 06 16:51:39 2013 +0000 @@ -22,7 +22,7 @@ #include "core/fwk.h" -#include "WANDongle.h" +#include "USBHostWANDongleLib/USB3GModule/WANDongle.h" #include "at/ATCommandsInterface.h" #include "serial/usb/USBSerialStream.h" #include "ip/PPPIPInterface.h"
--- a/core/errors.h Tue Nov 13 12:00:34 2012 +0000 +++ b/core/errors.h Wed Feb 06 16:51:39 2013 +0000 @@ -43,5 +43,6 @@ #define NET_CONN 17 //>Connection error #define NET_CLOSED 18 //>Connection was closed by remote end #define NET_TOOSMALL 19 //>Buffer is too small +#define HARDWARE_NO_RESPONSE 20 //>No response from the hardware module. Could not be physically connected or maybe no power? #endif /* ERRORS_H_ */
