Own fork of MbedSmartRestMain
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
main.cpp
- Committer:
- vwochnik
- Date:
- 2014-05-22
- Revision:
- 27:bfd402593acc
- Parent:
- 24:8f9b678a7932
- Child:
- 28:2004400abeec
File content as of revision 27:bfd402593acc:
#include "common.h" #include "apndb.h" #include "io.h" //---------------------------------------------------------------------- // You may need to configure these parameters /** Set your secret SIM pin here "1234" */ #define SIMPIN NULL /** The APN of your network operator, sometimes it is "internet" check your contract with the network operator */ #define APN "public4.m2minternet.com" /** Set the user name for your APN, or NULL if not needed */ #define USERNAME NULL /** Set the password for your APN, or NULL if not needed */ #define PASSWORD NULL C027 c027; MDMSerial mdm; char cIMEI[21] = "ADASDF1312"; char cIMSI[16] = ""; char cCellId[9] = ""; char cICCID[24] = "12345"; sigq_t sigQ = {0, 0}; int main() { int ret; size_t c; puts("Started..."); io_init(); puts("IO initialized."); c027.mdmWakeup(); c027.mdmReset(); c027.mdmPower(true); /*puts("Searching for login..."); // get imsi number printf("IMSI: %s\n", imsi()); apndb_t *apn = apndb_get(imsi()); if (apn == NULL) puts("No APN found."); else printf("APN: %s\n", apn->apn); */ if (!mdm.connect(SIMPIN, APN,USERNAME,PASSWORD, true)) { puts("GPRS connection failure."); return 2; } /*printf("IMSI: %s\n", imsi()); apn = apndb_get(imsi()); if (apn == NULL) puts("No APN found."); else printf("APN: %s\n", apn->apn); */ // get before starting program as they're permanent if ((!strlen(imei())) || (!strlen(iccid()))) { puts("Couldn't read IMEI or ICCID."); return 2; } // Shown on display signalQuality(); puts("Starting program..."); // restart program upon failure do { ret = program(); if (ret) puts("Restarting program..."); } while (ret); c027.mdmPower(false); return 0; } const char * imei() { return cIMEI; } const char * imsi() { return cIMSI; } const char * cellId() { return cCellId; } const char * iccid() { return cICCID; } sigq_t * signalQuality() { sigQ.rssi = 0; sigQ.ber = 0; lcd_signal(0, 0); return &sigQ; }