I'm trying to write an application that uses a GPRS (UMTS?) USB stick to communicate and UMTSStickNetIf seems to be the solution I need.
I've put together the simple test program that should just open a connection and then close it again however I can't get it to compile.
I get error 153 (<<quote>>"expression must have class type"<</quote>>) for each of the four lines that use myGPRS. (e.g. myGPRS.setup() etc.)
Changing the "."s to "->"s causes error 131 (<<quote>>"expression must have pointer-to-class type"<</quote>>) instead.
My C++ is somewhat limited and I'm sure I've made a very basic error somewhere but if someone could point me in the right direction it would be greatly appreciated.
Edit: Further googling suggested that I should remove the brackets from the end of my definition of myGPRS. Doing this allows the program to compile but I then get loads of undefined symbol errors from the linker so I suspect I may be missing an include somewhere.
#include "mbed.h"
#include "UMTSStickNetIf.h"
Serial pc(USBTX, USBRX);
UMTSStickNetIf myGPRS();
int main() {
pc.baud(115200);
pc.printf("Attempting to initialise GPRS Stick\n\r");
UMTSStickErr err_setup = myGPRS.setup();
pc.printf("Result code: %d (%s)\n\n\r", err_setup, err_setup==0?"Success":"Failure");
if(err_setup==0)
{
pc.printf("Attempting to establish a PPP connection\n\r");
PPPErr err_connect = myGPRS.connect(NULL, NULL, NULL); //Connect using SIM card defaults
pc.printf("Result code: %d (%s)\n\n\r", err_connect, err_connect==0?"Success":"Failure");
if(err_connect==0)
{
IpAddr addr = myGPRS.getIp();
pc.printf("Connection established, IP address = %d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);
pc.printf("Attempting to disconnect the PPP connection\n\r");
PPPErr err_disconnect = myGPRS.disconnect();
pc.printf("Result code: %d (%s)\n\n\r", err_disconnect, err_disconnect==0?"Success":"Failure");
}
}
}
I'm trying to write an application that uses a GPRS (UMTS?) USB stick to communicate and UMTSStickNetIf seems to be the solution I need.
I've put together the simple test program that should just open a connection and then close it again however I can't get it to compile.
I get error 153 (
<<quote>>"expression must have class type"<</quote>>) for each of the four lines that use myGPRS. (e.g. myGPRS.setup() etc.)Changing the "."s to "->"s causes error 131 (
<<quote>>"expression must have pointer-to-class type"<</quote>>) instead.My C++ is somewhat limited and I'm sure I've made a very basic error somewhere but if someone could point me in the right direction it would be greatly appreciated.
Edit: Further googling suggested that I should remove the brackets from the end of my definition of myGPRS. Doing this allows the program to compile but I then get loads of undefined symbol errors from the linker so I suspect I may be missing an include somewhere.
#include "mbed.h" #include "UMTSStickNetIf.h" Serial pc(USBTX, USBRX); UMTSStickNetIf myGPRS(); int main() { pc.baud(115200); pc.printf("Attempting to initialise GPRS Stick\n\r"); UMTSStickErr err_setup = myGPRS.setup(); pc.printf("Result code: %d (%s)\n\n\r", err_setup, err_setup==0?"Success":"Failure"); if(err_setup==0) { pc.printf("Attempting to establish a PPP connection\n\r"); PPPErr err_connect = myGPRS.connect(NULL, NULL, NULL); //Connect using SIM card defaults pc.printf("Result code: %d (%s)\n\n\r", err_connect, err_connect==0?"Success":"Failure"); if(err_connect==0) { IpAddr addr = myGPRS.getIp(); pc.printf("Connection established, IP address = %d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]); pc.printf("Attempting to disconnect the PPP connection\n\r"); PPPErr err_disconnect = myGPRS.disconnect(); pc.printf("Result code: %d (%s)\n\n\r", err_disconnect, err_disconnect==0?"Success":"Failure"); } } }