![](/media/cache/profiles/1225293648e26d9c5e54e22e92197cb4.jpg.50x50_q85.jpg)
Test
Fork of C027_SupportTest by
main.cpp@11:b8505cbbd55c, 2014-05-07 (annotated)
- Committer:
- mazgch
- Date:
- Wed May 07 15:36:38 2014 +0000
- Revision:
- 11:b8505cbbd55c
- Parent:
- 10:d2da2028a233
- Child:
- 12:96c7b62c7aaf
support for other platforms (using a shield)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lawliet | 0:4e3cb26f6019 | 1 | #include "mbed.h" |
mazgch | 2:b77151f111a9 | 2 | #include "GPS.h" |
mazgch | 2:b77151f111a9 | 3 | #include "MDM.h" |
lawliet | 0:4e3cb26f6019 | 4 | |
mazgch | 9:26f694bc31b4 | 5 | //---------------------------------------------------------------------- |
mazgch | 9:26f694bc31b4 | 6 | // You may need to configure these parameters |
mazgch | 9:26f694bc31b4 | 7 | |
mazgch | 9:26f694bc31b4 | 8 | /** Set your secret SIM pin here "1234" |
mazgch | 9:26f694bc31b4 | 9 | */ |
mazgch | 9:26f694bc31b4 | 10 | #define SIMPIN NULL |
mazgch | 9:26f694bc31b4 | 11 | |
mazgch | 9:26f694bc31b4 | 12 | /** The APN of your network operator, sometimes it is "internet" |
mazgch | 9:26f694bc31b4 | 13 | check your contract with the network operator |
mazgch | 9:26f694bc31b4 | 14 | */ |
mazgch | 9:26f694bc31b4 | 15 | #define APN "gprs.swisscom.ch" |
mazgch | 9:26f694bc31b4 | 16 | |
mazgch | 9:26f694bc31b4 | 17 | /** Set the user name for your APN, or NULL if not needed |
mazgch | 9:26f694bc31b4 | 18 | */ |
mazgch | 9:26f694bc31b4 | 19 | #define USERNAME NULL |
mazgch | 9:26f694bc31b4 | 20 | |
mazgch | 9:26f694bc31b4 | 21 | /** Set the password for your APN, or NULL if not needed |
mazgch | 9:26f694bc31b4 | 22 | */ |
mazgch | 9:26f694bc31b4 | 23 | #define PASSWORD NULL |
mazgch | 9:26f694bc31b4 | 24 | |
mazgch | 10:d2da2028a233 | 25 | //---------------------------------------------------------------------- |
mazgch | 11:b8505cbbd55c | 26 | /* This example was tested on C027-U20 and C027-G35 with the on board modem. |
mazgch | 11:b8505cbbd55c | 27 | |
mazgch | 11:b8505cbbd55c | 28 | Additionally it was tested with a shield where the SARA-G350 RX/TX/PWRON |
mazgch | 11:b8505cbbd55c | 29 | is connected to D0/D1/D4 and the GPS SCL/SDA is connected D15/D15. In this |
mazgch | 11:b8505cbbd55c | 30 | configuration the following platforms were tested (it is likely that others |
mazgch | 11:b8505cbbd55c | 31 | will work as well) |
mazgch | 11:b8505cbbd55c | 32 | - C027-XX. |
mazgch | 11:b8505cbbd55c | 33 | - LPC1549v2 |
mazgch | 11:b8505cbbd55c | 34 | - FRDM-KL25Z |
mazgch | 11:b8505cbbd55c | 35 | - FRDM-KL46Z |
mazgch | 11:b8505cbbd55c | 36 | - NUCLEO-F401RE |
mazgch | 11:b8505cbbd55c | 37 | */ |
mazgch | 10:d2da2028a233 | 38 | #if defined(TARGET_UBLOX_C027) || defined(TARGET_LPC1768) |
mazgch | 11:b8505cbbd55c | 39 | #define C027_USEONBOARD // remove this if you have a GSM/GPS shield |
mazgch | 10:d2da2028a233 | 40 | #ifdef C027_USEONBOARD |
mazgch | 10:d2da2028a233 | 41 | #include "C027.h" |
mazgch | 10:d2da2028a233 | 42 | C027 c027; |
mazgch | 10:d2da2028a233 | 43 | #elif defined(TARGET_LPC1768) |
mazgch | 10:d2da2028a233 | 44 | // We assume we have a C027 (not an Arch Pro) |
mazgch | 10:d2da2028a233 | 45 | #define D15 P0_1 |
mazgch | 10:d2da2028a233 | 46 | #define D14 P0_0 |
mazgch | 10:d2da2028a233 | 47 | #define D4 P2_12 |
mazgch | 10:d2da2028a233 | 48 | #define D1 P4_28 |
mazgch | 10:d2da2028a233 | 49 | #define D0 P4_29 |
mazgch | 10:d2da2028a233 | 50 | #define LED1 P3_25 |
mazgch | 10:d2da2028a233 | 51 | #endif |
mazgch | 10:d2da2028a233 | 52 | #endif |
mazgch | 10:d2da2028a233 | 53 | |
mazgch | 10:d2da2028a233 | 54 | #ifndef C027_USEONBOARD |
mazgch | 10:d2da2028a233 | 55 | #define GPSSCL D15 |
mazgch | 10:d2da2028a233 | 56 | #define GPSSDA D14 |
mazgch | 10:d2da2028a233 | 57 | #define GPSADR (66<<1) // GPS I2C Address |
mazgch | 10:d2da2028a233 | 58 | #define MDMPWRON D4 |
mazgch | 10:d2da2028a233 | 59 | #define MDMTXD D1 |
mazgch | 10:d2da2028a233 | 60 | #define MDMRXD D0 |
mazgch | 10:d2da2028a233 | 61 | #define MDMCTS NC |
mazgch | 10:d2da2028a233 | 62 | #define MDMRTS NC |
mazgch | 10:d2da2028a233 | 63 | #define MDMBAUD 115200 |
mazgch | 10:d2da2028a233 | 64 | #endif |
mazgch | 10:d2da2028a233 | 65 | |
mazgch | 10:d2da2028a233 | 66 | // no tracing if serial is shared with the VCP |
mazgch | 10:d2da2028a233 | 67 | #define TRACE ((USBRX==MDMRXD)||(USBTX==MDMTXD))?:printf |
lawliet | 0:4e3cb26f6019 | 68 | |
mazgch | 5:5366d39d3719 | 69 | void printDeviceStatus(MDMParser::DevStatus* status) { |
mazgch | 10:d2da2028a233 | 70 | TRACE("Device Status:\r\n"); |
mazgch | 6:71f6214d595e | 71 | const char* txtDev[] = { "Unknown", "SARA-G350", "LISA-U200", "LISA-C200" }; |
mazgch | 6:71f6214d595e | 72 | if (status->dev < sizeof(txtDev)/sizeof(*txtDev) && (status->dev != MDMParser::DEV_UNKNOWN)) |
mazgch | 10:d2da2028a233 | 73 | TRACE(" Device: %s\r\n", txtDev[status->dev]); |
mazgch | 7:e000317ddef6 | 74 | const char* txtLpm[] = { "Disabled", "Enabled", "Active" }; |
mazgch | 7:e000317ddef6 | 75 | if (status->lpm < sizeof(txtLpm)/sizeof(*txtLpm)) |
mazgch | 10:d2da2028a233 | 76 | TRACE(" Power Save: %s\r\n", txtLpm[status->lpm]); |
mazgch | 5:5366d39d3719 | 77 | const char* txtSim[] = { "Unknown", "Pin", "Ready" }; |
mazgch | 5:5366d39d3719 | 78 | if (status->sim < sizeof(txtSim)/sizeof(*txtSim) && (status->sim != MDMParser::SIM_UNKNOWN)) |
mazgch | 10:d2da2028a233 | 79 | TRACE(" SIM: %s\r\n", txtSim[status->sim]); |
mazgch | 6:71f6214d595e | 80 | if (*status->ccid) |
mazgch | 10:d2da2028a233 | 81 | TRACE(" CCID: %s\r\n", status->ccid); |
mazgch | 6:71f6214d595e | 82 | if (*status->imei) |
mazgch | 10:d2da2028a233 | 83 | TRACE(" IMEI: %s\r\n", status->imei); |
mazgch | 6:71f6214d595e | 84 | if (*status->imsi) |
mazgch | 10:d2da2028a233 | 85 | TRACE(" IMSI: %s\r\n", status->imsi); |
mazgch | 7:e000317ddef6 | 86 | if (*status->meid) |
mazgch | 10:d2da2028a233 | 87 | TRACE(" MEID: %s\r\n", status->meid); |
mazgch | 6:71f6214d595e | 88 | if (*status->manu) |
mazgch | 10:d2da2028a233 | 89 | TRACE(" Manufacturer: %s\r\n", status->manu); |
mazgch | 6:71f6214d595e | 90 | if (*status->model) |
mazgch | 10:d2da2028a233 | 91 | TRACE(" Model: %s\r\n", status->model); |
mazgch | 6:71f6214d595e | 92 | if (*status->ver) |
mazgch | 10:d2da2028a233 | 93 | TRACE(" Version: %s\r\n", status->ver); |
mazgch | 5:5366d39d3719 | 94 | } |
mazgch | 5:5366d39d3719 | 95 | |
mazgch | 5:5366d39d3719 | 96 | void printNetStatus(MDMParser::NetStatus *status) |
mazgch | 5:5366d39d3719 | 97 | { |
mazgch | 10:d2da2028a233 | 98 | TRACE("Network Status:\r\n"); |
mazgch | 5:5366d39d3719 | 99 | const char* txtReg[] = { "Unknown", "Denied", "None", "Home", "Roaming" }; |
mazgch | 5:5366d39d3719 | 100 | if (status->reg < sizeof(txtReg)/sizeof(*txtReg) && (status->reg != MDMParser::REG_UNKNOWN)) |
mazgch | 10:d2da2028a233 | 101 | TRACE(" Registration: %s\r\n", txtReg[status->reg]); |
mazgch | 5:5366d39d3719 | 102 | const char* txtAct[] = { "Unknown", "GSM", "Edge", "3G", "CDMA" }; |
mazgch | 5:5366d39d3719 | 103 | if (status->act < sizeof(txtAct)/sizeof(*txtAct) && (status->act != MDMParser::ACT_UNKNOWN)) |
mazgch | 10:d2da2028a233 | 104 | TRACE(" Access Technology: %s\r\n", txtAct[status->act]); |
mazgch | 5:5366d39d3719 | 105 | if (status->rssi) |
mazgch | 10:d2da2028a233 | 106 | TRACE(" Signal Strength: %d dBm\r\n", status->rssi); |
mazgch | 6:71f6214d595e | 107 | if (*status->opr) |
mazgch | 10:d2da2028a233 | 108 | TRACE(" Operator: %s\r\n", status->opr); |
mazgch | 6:71f6214d595e | 109 | if (*status->num) |
mazgch | 10:d2da2028a233 | 110 | TRACE(" Phone Number: %s\r\n", status->num); |
mazgch | 5:5366d39d3719 | 111 | } |
lawliet | 0:4e3cb26f6019 | 112 | |
lawliet | 0:4e3cb26f6019 | 113 | int main(void) |
lawliet | 0:4e3cb26f6019 | 114 | { |
mazgch | 2:b77151f111a9 | 115 | int ret; |
mazgch | 2:b77151f111a9 | 116 | char buf[512] = ""; |
lawliet | 0:4e3cb26f6019 | 117 | |
mazgch | 11:b8505cbbd55c | 118 | // only trace if |
mazgch | 11:b8505cbbd55c | 119 | if ((USBRX!=MDMRXD)&&(USBTX!=MDMTXD)) { |
mazgch | 11:b8505cbbd55c | 120 | Serial pc(USBTX,USBRX); |
mazgch | 11:b8505cbbd55c | 121 | pc.baud(115200); |
mazgch | 11:b8505cbbd55c | 122 | } |
mazgch | 11:b8505cbbd55c | 123 | |
mazgch | 11:b8505cbbd55c | 124 | wait_ms(1000); |
mazgch | 2:b77151f111a9 | 125 | |
mazgch | 10:d2da2028a233 | 126 | TRACE("GSM/GPS Support Example\r\n"); |
mazgch | 11:b8505cbbd55c | 127 | |
mazgch | 10:d2da2028a233 | 128 | #ifdef C027_USEONBOARD |
mazgch | 10:d2da2028a233 | 129 | // turn on the supplies of the Modem and the GPS |
mazgch | 2:b77151f111a9 | 130 | c027.mdmPower(true); |
mazgch | 4:90ab1ec64b0e | 131 | c027.gpsPower(true); |
mazgch | 10:d2da2028a233 | 132 | #else |
mazgch | 10:d2da2028a233 | 133 | // turn on the Modem |
mazgch | 10:d2da2028a233 | 134 | DigitalOut mdmPwrOn(MDMPWRON, 0); |
mazgch | 10:d2da2028a233 | 135 | wait_ms(150); |
mazgch | 10:d2da2028a233 | 136 | mdmPwrOn = 1; |
mazgch | 10:d2da2028a233 | 137 | #endif |
mazgch | 2:b77151f111a9 | 138 | wait(2); |
mazgch | 11:b8505cbbd55c | 139 | |
mazgch | 10:d2da2028a233 | 140 | // Create the GPS object |
mazgch | 10:d2da2028a233 | 141 | #if defined(GPSSCL) && defined(GPSSDA) && defined(GPSADR) |
mazgch | 4:90ab1ec64b0e | 142 | GPSI2C gps(GPSSDA,GPSSCL,GPSADR); // use GPSI2C class |
mazgch | 10:d2da2028a233 | 143 | #elif defined(GPSTXD) && defined(GPSRXD) && defined(GPSBAUD) |
mazgch | 10:d2da2028a233 | 144 | GPSSerial gps(GPSTXD,GPSRXD,GPSBAUD); // or GPSSerial class |
mazgch | 10:d2da2028a233 | 145 | #else |
mazgch | 10:d2da2028a233 | 146 | #warning "please define the pins for the GPS" |
mazgch | 10:d2da2028a233 | 147 | #endif |
mazgch | 11:b8505cbbd55c | 148 | |
mazgch | 10:d2da2028a233 | 149 | // Create the modem object |
mazgch | 7:e000317ddef6 | 150 | MDMSerial mdm(MDMTXD,MDMRXD,MDMBAUD |
mazgch | 10:d2da2028a233 | 151 | #if DEVICE_SERIAL_FC |
mazgch | 7:e000317ddef6 | 152 | ,MDMRTS,MDMCTS |
mazgch | 10:d2da2028a233 | 153 | #endif |
mazgch | 2:b77151f111a9 | 154 | ); |
mazgch | 11:b8505cbbd55c | 155 | |
mazgch | 2:b77151f111a9 | 156 | // initialize the modem |
mazgch | 10:d2da2028a233 | 157 | TRACE("Device Init\r\n"); |
mazgch | 5:5366d39d3719 | 158 | MDMParser::DevStatus devStatus; |
mazgch | 5:5366d39d3719 | 159 | MDMParser::NetStatus netStatus; |
mazgch | 10:d2da2028a233 | 160 | bool mdmOk = mdm.init(SIMPIN, &devStatus); |
mazgch | 10:d2da2028a233 | 161 | if (mdmOk) |
mazgch | 4:90ab1ec64b0e | 162 | { |
mazgch | 5:5366d39d3719 | 163 | printDeviceStatus(&devStatus); |
mazgch | 5:5366d39d3719 | 164 | |
mazgch | 4:90ab1ec64b0e | 165 | // wait until we are connected |
mazgch | 10:d2da2028a233 | 166 | TRACE("Network Check\r\n"); |
mazgch | 5:5366d39d3719 | 167 | while (!mdm.checkNetStatus(&netStatus)) |
mazgch | 4:90ab1ec64b0e | 168 | wait_ms(1000); |
mazgch | 2:b77151f111a9 | 169 | |
mazgch | 5:5366d39d3719 | 170 | printNetStatus(&netStatus); |
mazgch | 10:d2da2028a233 | 171 | TRACE("Network Join\r\n"); |
mazgch | 4:90ab1ec64b0e | 172 | // join the internet connection |
mazgch | 5:5366d39d3719 | 173 | MDMParser::IP ip = |
mazgch | 9:26f694bc31b4 | 174 | mdm.join(APN,USERNAME,PASSWORD); |
mazgch | 5:5366d39d3719 | 175 | if (ip != NOIP) |
mazgch | 2:b77151f111a9 | 176 | { |
mazgch | 10:d2da2028a233 | 177 | TRACE(" IP Address: " IPSTR "\r\n", IPNUM(ip)); |
mazgch | 10:d2da2028a233 | 178 | TRACE("Socket Create\r\n"); |
mazgch | 4:90ab1ec64b0e | 179 | int socket = mdm.socketSocket(MDMParser::IPPROTO_TCP); |
mazgch | 4:90ab1ec64b0e | 180 | if (socket >= 0) |
mazgch | 2:b77151f111a9 | 181 | { |
mazgch | 10:d2da2028a233 | 182 | TRACE("Socket Connect\r\n"); |
mazgch | 4:90ab1ec64b0e | 183 | if (mdm.socketConnect(socket, "mbed.org", 80)) |
mazgch | 4:90ab1ec64b0e | 184 | { |
mazgch | 10:d2da2028a233 | 185 | TRACE("Make a Http Post Request\r\n"); |
mazgch | 4:90ab1ec64b0e | 186 | const char http[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\r\n\r\n"; |
mazgch | 10:d2da2028a233 | 187 | TRACE("Socket Send\r\n"); |
mazgch | 4:90ab1ec64b0e | 188 | mdm.socketSend(socket, http, sizeof(http)-1); |
mazgch | 4:90ab1ec64b0e | 189 | |
mazgch | 10:d2da2028a233 | 190 | TRACE("Socket Recving\r\n"); |
mazgch | 4:90ab1ec64b0e | 191 | while (true) { |
mazgch | 4:90ab1ec64b0e | 192 | ret = mdm.socketReadable(socket); |
mazgch | 4:90ab1ec64b0e | 193 | if (ret > 0) |
mazgch | 4:90ab1ec64b0e | 194 | ret = mdm.socketRecv(socket, buf, sizeof(buf)-1); |
mazgch | 4:90ab1ec64b0e | 195 | if (ret < 0) |
mazgch | 4:90ab1ec64b0e | 196 | break; |
mazgch | 4:90ab1ec64b0e | 197 | else if (ret > 0) |
mazgch | 10:d2da2028a233 | 198 | TRACE("Socket Recv \"%*s\"\r\n", ret, buf); |
mazgch | 4:90ab1ec64b0e | 199 | } |
mazgch | 10:d2da2028a233 | 200 | TRACE("Socket Close\r\n"); |
mazgch | 4:90ab1ec64b0e | 201 | mdm.socketClose(socket); |
mazgch | 4:90ab1ec64b0e | 202 | } |
mazgch | 10:d2da2028a233 | 203 | TRACE("Socket Free\r\n"); |
mazgch | 4:90ab1ec64b0e | 204 | mdm.socketFree(socket); |
mazgch | 4:90ab1ec64b0e | 205 | } |
mazgch | 2:b77151f111a9 | 206 | |
mazgch | 4:90ab1ec64b0e | 207 | // disconnect |
mazgch | 10:d2da2028a233 | 208 | TRACE("Network Disconnect\r\n"); |
mazgch | 4:90ab1ec64b0e | 209 | mdm.disconnect(); |
mazgch | 2:b77151f111a9 | 210 | } |
mazgch | 2:b77151f111a9 | 211 | |
mazgch | 5:5366d39d3719 | 212 | const char* ussd = "*#134#"; // You may get answer "UNKNOWN APPLICATION" |
mazgch | 10:d2da2028a233 | 213 | TRACE("Send Ussd Command %s\r\n", ussd); |
mazgch | 5:5366d39d3719 | 214 | ret = mdm.ussdCommand(ussd, buf); |
mazgch | 4:90ab1ec64b0e | 215 | if (ret > 0) |
mazgch | 10:d2da2028a233 | 216 | TRACE("Got Ussd Answer: \"%*s\"\r\n", ret, buf); |
mazgch | 10:d2da2028a233 | 217 | } |
mazgch | 10:d2da2028a233 | 218 | TRACE("Checking SMS and GPS\r\n"); |
mazgch | 10:d2da2028a233 | 219 | char link[128] = ""; |
mazgch | 10:d2da2028a233 | 220 | unsigned int i = 0xFFFFFFFF; |
mazgch | 10:d2da2028a233 | 221 | const int wait = 100; |
mazgch | 10:d2da2028a233 | 222 | bool abort = false; |
mazgch | 11:b8505cbbd55c | 223 | //DigitalOut led(LED1); |
mazgch | 10:d2da2028a233 | 224 | while (!abort) { |
mazgch | 11:b8505cbbd55c | 225 | // led = !led; |
mazgch | 10:d2da2028a233 | 226 | while ((ret = gps.getMessage(buf, sizeof(buf))) > 0) |
mazgch | 10:d2da2028a233 | 227 | { |
mazgch | 10:d2da2028a233 | 228 | int len = LENGTH(ret); |
mazgch | 10:d2da2028a233 | 229 | //TRACE("NMEA: %.*s\r\n", len-2, msg); |
mazgch | 10:d2da2028a233 | 230 | if ((PROTOCOL(ret) == NMEA) && (len > 6) && !strncmp("$GPGLL", buf, 6)) |
mazgch | 4:90ab1ec64b0e | 231 | { |
mazgch | 10:d2da2028a233 | 232 | double la = 0, lo = 0; |
mazgch | 10:d2da2028a233 | 233 | char ch; |
mazgch | 10:d2da2028a233 | 234 | if (gps.getNmeaAngle(1,buf,len,la) && |
mazgch | 10:d2da2028a233 | 235 | gps.getNmeaAngle(3,buf,len,lo) && |
mazgch | 10:d2da2028a233 | 236 | gps.getNmeaItem(6,buf,len,ch) && ch == 'A') |
mazgch | 4:90ab1ec64b0e | 237 | { |
mazgch | 10:d2da2028a233 | 238 | TRACE("GPS Location: %.5f %.5f\r\n", la, lo); |
mazgch | 10:d2da2028a233 | 239 | sprintf(link, "I am here!\n" |
mazgch | 10:d2da2028a233 | 240 | "https://maps.google.com/?q=%.5f,%.5f", la, lo); |
mazgch | 4:90ab1ec64b0e | 241 | } |
mazgch | 4:90ab1ec64b0e | 242 | } |
mazgch | 10:d2da2028a233 | 243 | } |
mazgch | 10:d2da2028a233 | 244 | if (mdmOk && (i++ == 10000/wait)) { |
mazgch | 10:d2da2028a233 | 245 | i = 0; |
mazgch | 10:d2da2028a233 | 246 | // check the network status |
mazgch | 10:d2da2028a233 | 247 | if (mdm.checkNetStatus(&netStatus)) |
mazgch | 10:d2da2028a233 | 248 | printNetStatus(&netStatus); |
mazgch | 10:d2da2028a233 | 249 | |
mazgch | 10:d2da2028a233 | 250 | // checking unread sms |
mazgch | 10:d2da2028a233 | 251 | int ix[8]; |
mazgch | 10:d2da2028a233 | 252 | int n = mdm.smsList("REC UNREAD", ix, 8); |
mazgch | 10:d2da2028a233 | 253 | if (8 < n) n = 8; |
mazgch | 10:d2da2028a233 | 254 | while (0 < n--) |
mazgch | 10:d2da2028a233 | 255 | { |
mazgch | 10:d2da2028a233 | 256 | char num[32]; |
mazgch | 10:d2da2028a233 | 257 | TRACE("Unread SMS at index %d\r\n", ix[n]); |
mazgch | 10:d2da2028a233 | 258 | if (mdm.smsRead(ix[n], num, buf, sizeof(buf))) { |
mazgch | 10:d2da2028a233 | 259 | TRACE("Got SMS from \"%s\" with text \"%s\"\r\n", num, buf); |
mazgch | 10:d2da2028a233 | 260 | TRACE("Delete SMS at index %d\r\n", ix[n]); |
mazgch | 10:d2da2028a233 | 261 | mdm.smsDelete(ix[n]); |
mazgch | 10:d2da2028a233 | 262 | // provide a reply |
mazgch | 10:d2da2028a233 | 263 | const char* reply = "Hello my friend"; |
mazgch | 10:d2da2028a233 | 264 | if (strstr(buf, /*w*/"here are you")) |
mazgch | 10:d2da2028a233 | 265 | reply = *link ? link : "I don't know"; // reply wil location link |
mazgch | 10:d2da2028a233 | 266 | TRACE("Send SMS reply \"%s\" to \"%s\"\r\n", reply, num); |
mazgch | 10:d2da2028a233 | 267 | mdm.smsSend(num, reply); |
mazgch | 4:90ab1ec64b0e | 268 | } |
mazgch | 4:90ab1ec64b0e | 269 | } |
mazgch | 9:26f694bc31b4 | 270 | } |
mazgch | 10:d2da2028a233 | 271 | wait_ms(wait); |
lawliet | 0:4e3cb26f6019 | 272 | } |
mazgch | 10:d2da2028a233 | 273 | mdm.powerOff(); |
mazgch | 10:d2da2028a233 | 274 | gps.powerOff(); |
mazgch | 10:d2da2028a233 | 275 | TRACE("Shutdown\r\n"); |
mazgch | 10:d2da2028a233 | 276 | #ifdef C027_USEONBOARD |
mazgch | 10:d2da2028a233 | 277 | // now it is safe to switch LDOs off |
mazgch | 2:b77151f111a9 | 278 | c027.mdmPower(false); |
mazgch | 4:90ab1ec64b0e | 279 | c027.gpsPower(false); |
mazgch | 10:d2da2028a233 | 280 | #endif |
lawliet | 0:4e3cb26f6019 | 281 | return 0; |
lawliet | 0:4e3cb26f6019 | 282 | } |
mazgch | 2:b77151f111a9 | 283 |