![](/media/cache/profiles/68fc61f6fd79afe9607a3ec58f2e6ad1.jpg.50x50_q85.jpg)
IM920地温観測システム CQ 2017ARMセミナー用サンプルプログラム
Dependencies: C027_Support_ForIM920
Fork of C027_SupportTest by
main.cpp@34:1cbf923d4ca7, 2017-07-09 (annotated)
- Committer:
- ntaka206
- Date:
- Sun Jul 09 11:35:56 2017 +0000
- Revision:
- 34:1cbf923d4ca7
- Parent:
- 33:e27f40fada64
- Child:
- 35:7838543282c2
Initial IM920????M2X?PUT
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lawliet | 0:4e3cb26f6019 | 1 | #include "mbed.h" |
mazgch | 9:26f694bc31b4 | 2 | |
mazgch | 19:f022ff746eb8 | 3 | //------------------------------------------------------------------------------------ |
mazgch | 11:b8505cbbd55c | 4 | /* This example was tested on C027-U20 and C027-G35 with the on board modem. |
mazgch | 11:b8505cbbd55c | 5 | |
mazgch | 18:50e6c4ed8a4a | 6 | Additionally it was tested with a shield where the SARA-G350/U260/U270 RX/TX/PWRON |
mazgch | 11:b8505cbbd55c | 7 | is connected to D0/D1/D4 and the GPS SCL/SDA is connected D15/D15. In this |
mazgch | 11:b8505cbbd55c | 8 | configuration the following platforms were tested (it is likely that others |
mazgch | 11:b8505cbbd55c | 9 | will work as well) |
mazgch | 19:f022ff746eb8 | 10 | - U-BLOX: C027-G35, C027-U20, C027-C20 (for shield set define C027_FORCE_SHIELD) |
mazgch | 18:50e6c4ed8a4a | 11 | - NXP: LPC1549v2, LPC4088qsb |
mazgch | 18:50e6c4ed8a4a | 12 | - Freescale: FRDM-KL05Z, FRDM-KL25Z, FRDM-KL46Z, FRDM-K64F |
mazgch | 12:96c7b62c7aaf | 13 | - STM: NUCLEO-F401RE, NUCLEO-F030R8 |
mazgch | 18:50e6c4ed8a4a | 14 | mount resistors SB13/14 1k, SB62/63 0R |
mazgch | 11:b8505cbbd55c | 15 | */ |
mazgch | 19:f022ff746eb8 | 16 | #include "GPS.h" |
mazgch | 19:f022ff746eb8 | 17 | #include "MDM.h" |
ntaka206 | 34:1cbf923d4ca7 | 18 | #include "DebugPrint.h" |
ntaka206 | 34:1cbf923d4ca7 | 19 | |
mazgch | 19:f022ff746eb8 | 20 | //------------------------------------------------------------------------------------ |
mazgch | 19:f022ff746eb8 | 21 | // You need to configure these cellular modem / SIM parameters. |
mazgch | 19:f022ff746eb8 | 22 | // These parameters are ignored for LISA-C200 variants and can be left NULL. |
mazgch | 19:f022ff746eb8 | 23 | //------------------------------------------------------------------------------------ |
mazgch | 19:f022ff746eb8 | 24 | //! Set your secret SIM pin here (e.g. "1234"). Check your SIM manual. |
ntaka206 | 34:1cbf923d4ca7 | 25 | #define SIMPIN "0000" |
mazgch | 19:f022ff746eb8 | 26 | /*! The APN of your network operator SIM, sometimes it is "internet" check your |
mazgch | 19:f022ff746eb8 | 27 | contract with the network operator. You can also try to look-up your settings in |
mazgch | 19:f022ff746eb8 | 28 | google: https://www.google.de/search?q=APN+list */ |
ntaka206 | 34:1cbf923d4ca7 | 29 | #define APN "soracom.io" |
mazgch | 19:f022ff746eb8 | 30 | //! Set the user name for your APN, or NULL if not needed |
ntaka206 | 34:1cbf923d4ca7 | 31 | #define USERNAME "sora" |
mazgch | 19:f022ff746eb8 | 32 | //! Set the password for your APN, or NULL if not needed |
ntaka206 | 34:1cbf923d4ca7 | 33 | #define PASSWORD "sora" |
mazgch | 19:f022ff746eb8 | 34 | //------------------------------------------------------------------------------------ |
lawliet | 0:4e3cb26f6019 | 35 | |
msinig | 29:16f1037626e3 | 36 | //#define CELLOCATE |
msinig | 29:16f1037626e3 | 37 | |
ntaka206 | 34:1cbf923d4ca7 | 38 | #define IM920_TX P4_28 |
ntaka206 | 34:1cbf923d4ca7 | 39 | #define IM920_RX P4_29 |
ntaka206 | 34:1cbf923d4ca7 | 40 | Serial im920(IM920_TX, IM920_RX); |
ntaka206 | 34:1cbf923d4ca7 | 41 | |
ntaka206 | 34:1cbf923d4ca7 | 42 | #define AD_NUM 3 |
ntaka206 | 34:1cbf923d4ca7 | 43 | #define MV_LSB (1500/1024.) |
ntaka206 | 34:1cbf923d4ca7 | 44 | #define DEGC_MV (1/10.) |
ntaka206 | 34:1cbf923d4ca7 | 45 | #define PV_LSB (2*1.5/1024) |
ntaka206 | 34:1cbf923d4ca7 | 46 | |
ntaka206 | 34:1cbf923d4ca7 | 47 | #define M2X_SERVER "api-m2x.att.com" |
ntaka206 | 34:1cbf923d4ca7 | 48 | #define M2X_DEVICE_ID "964d05b1a6f4a8bb02c2a5aaf6e7e268" |
ntaka206 | 34:1cbf923d4ca7 | 49 | #define M2X_API_KEY "602d38e9e8dfcf62e7f87a59c80784ec" |
ntaka206 | 34:1cbf923d4ca7 | 50 | #define M2X_CHID_TEMP0 "temp0" |
ntaka206 | 34:1cbf923d4ca7 | 51 | |
ntaka206 | 34:1cbf923d4ca7 | 52 | |
ntaka206 | 34:1cbf923d4ca7 | 53 | /* |
ntaka206 | 34:1cbf923d4ca7 | 54 | IM920から受信したADデータをデコードする |
ntaka206 | 34:1cbf923d4ca7 | 55 | sn: IM920 SN |
ntaka206 | 34:1cbf923d4ca7 | 56 | *ad: ADデータ配列 LSB |
ntaka206 | 34:1cbf923d4ca7 | 57 | ret: 0=OK -1=ERR |
ntaka206 | 34:1cbf923d4ca7 | 58 | */ |
ntaka206 | 34:1cbf923d4ca7 | 59 | int im920_conv(char *in, int *sn, int *ad) |
ntaka206 | 34:1cbf923d4ca7 | 60 | { |
ntaka206 | 34:1cbf923d4ca7 | 61 | char *p; |
ntaka206 | 34:1cbf923d4ca7 | 62 | char *endptr; |
ntaka206 | 34:1cbf923d4ca7 | 63 | int l, h; |
ntaka206 | 34:1cbf923d4ca7 | 64 | int i; |
ntaka206 | 34:1cbf923d4ca7 | 65 | |
ntaka206 | 34:1cbf923d4ca7 | 66 | p = strtok(in, ","); |
ntaka206 | 34:1cbf923d4ca7 | 67 | // SN |
ntaka206 | 34:1cbf923d4ca7 | 68 | p = strtok(NULL, ","); |
ntaka206 | 34:1cbf923d4ca7 | 69 | *sn = strtol(p, &endptr, 16); |
ntaka206 | 34:1cbf923d4ca7 | 70 | // SUM |
ntaka206 | 34:1cbf923d4ca7 | 71 | p = strtok(NULL, ":"); |
ntaka206 | 34:1cbf923d4ca7 | 72 | // printf("%s ", p); |
ntaka206 | 34:1cbf923d4ca7 | 73 | // AD0-2 |
ntaka206 | 34:1cbf923d4ca7 | 74 | for(i = 0; i < AD_NUM; i++) { |
ntaka206 | 34:1cbf923d4ca7 | 75 | p = strtok(NULL, ","); |
ntaka206 | 34:1cbf923d4ca7 | 76 | // printf("%s ", p); |
ntaka206 | 34:1cbf923d4ca7 | 77 | l = strtol(p, &endptr, 16); |
ntaka206 | 34:1cbf923d4ca7 | 78 | p = strtok(NULL, ","); |
ntaka206 | 34:1cbf923d4ca7 | 79 | // printf("%s ", p); |
ntaka206 | 34:1cbf923d4ca7 | 80 | h = strtol(p, &endptr, 16); |
ntaka206 | 34:1cbf923d4ca7 | 81 | ad[i] = l + h*256; |
ntaka206 | 34:1cbf923d4ca7 | 82 | } |
ntaka206 | 34:1cbf923d4ca7 | 83 | |
ntaka206 | 34:1cbf923d4ca7 | 84 | return 0; |
ntaka206 | 34:1cbf923d4ca7 | 85 | } |
ntaka206 | 34:1cbf923d4ca7 | 86 | |
ntaka206 | 34:1cbf923d4ca7 | 87 | /** |
ntaka206 | 34:1cbf923d4ca7 | 88 | * M2X HTTP送信 |
ntaka206 | 34:1cbf923d4ca7 | 89 | * @param http HTTP送信する文字列 |
ntaka206 | 34:1cbf923d4ca7 | 90 | * @param hostname |
ntaka206 | 34:1cbf923d4ca7 | 91 | * @return 0=OK -1=ERR |
ntaka206 | 34:1cbf923d4ca7 | 92 | */ |
ntaka206 | 34:1cbf923d4ca7 | 93 | int cloud_http_socket_send(MDMSerial *mdm, char *http, const char *hostname) |
ntaka206 | 34:1cbf923d4ca7 | 94 | { |
ntaka206 | 34:1cbf923d4ca7 | 95 | int socket; |
ntaka206 | 34:1cbf923d4ca7 | 96 | char data[512]; // receive |
ntaka206 | 34:1cbf923d4ca7 | 97 | char *strtokptr; |
ntaka206 | 34:1cbf923d4ca7 | 98 | char *ptr; |
ntaka206 | 34:1cbf923d4ca7 | 99 | |
ntaka206 | 34:1cbf923d4ca7 | 100 | socket = mdm->socketSocket(MDMParser::IPPROTO_TCP); |
ntaka206 | 34:1cbf923d4ca7 | 101 | if (socket >= 0) { |
ntaka206 | 34:1cbf923d4ca7 | 102 | mdm->socketSetBlocking(socket, 60*1000); // timeout im msec |
ntaka206 | 34:1cbf923d4ca7 | 103 | // 指定されたhostにSocket Connect |
ntaka206 | 34:1cbf923d4ca7 | 104 | if (!mdm->socketConnect(socket, hostname, 80)) { |
ntaka206 | 34:1cbf923d4ca7 | 105 | ERROR("ERROR socket connect\r\n"); |
ntaka206 | 34:1cbf923d4ca7 | 106 | ERROR("hostname=%s\r\n", hostname); |
ntaka206 | 34:1cbf923d4ca7 | 107 | return -1; |
ntaka206 | 34:1cbf923d4ca7 | 108 | } |
ntaka206 | 34:1cbf923d4ca7 | 109 | TRACE("socketConnect() OK\r\n"); |
ntaka206 | 34:1cbf923d4ca7 | 110 | } else { |
ntaka206 | 34:1cbf923d4ca7 | 111 | ERROR("sockeSocket() < 0\r\n"); |
ntaka206 | 34:1cbf923d4ca7 | 112 | ERROR("hostname=%s\r\n", hostname); |
ntaka206 | 34:1cbf923d4ca7 | 113 | return -1; |
ntaka206 | 34:1cbf923d4ca7 | 114 | } |
ntaka206 | 34:1cbf923d4ca7 | 115 | int ret = mdm->socketSend(socket, http, strlen(http)); |
ntaka206 | 34:1cbf923d4ca7 | 116 | TRACE("socketSend()=%d\r\n", ret); |
ntaka206 | 34:1cbf923d4ca7 | 117 | // Recv responce 十分な大きさの変数を渡す必要あり |
ntaka206 | 34:1cbf923d4ca7 | 118 | ret = mdm->socketRecv(socket, data, sizeof(data)-1); |
ntaka206 | 34:1cbf923d4ca7 | 119 | TRACE("socketRecv()=%d\r\n", ret); |
ntaka206 | 34:1cbf923d4ca7 | 120 | // 毎回Socket Closeが必要みたい |
ntaka206 | 34:1cbf923d4ca7 | 121 | mdm->socketClose(socket); |
ntaka206 | 34:1cbf923d4ca7 | 122 | mdm->socketFree(socket); |
ntaka206 | 34:1cbf923d4ca7 | 123 | // HTTPレスポンス受信出来た |
ntaka206 | 34:1cbf923d4ca7 | 124 | if (ret > 0) { |
ntaka206 | 34:1cbf923d4ca7 | 125 | TRACE("Socket Recv \"%s\"\r\n", data); |
ntaka206 | 34:1cbf923d4ca7 | 126 | // HTTPレスポンスcheck |
ntaka206 | 34:1cbf923d4ca7 | 127 | // ERR retryは呼び出し元でしている |
ntaka206 | 34:1cbf923d4ca7 | 128 | // 1行目抽出 |
ntaka206 | 34:1cbf923d4ca7 | 129 | ptr = strtok_r(data, "\r\n", &strtokptr); |
ntaka206 | 34:1cbf923d4ca7 | 130 | // Status Code抽出 |
ntaka206 | 34:1cbf923d4ca7 | 131 | ptr = strtok_r(ptr, " ", &strtokptr); |
ntaka206 | 34:1cbf923d4ca7 | 132 | ptr = strtok_r(NULL, " ", &strtokptr); |
ntaka206 | 34:1cbf923d4ca7 | 133 | int code = atoi(ptr); |
ntaka206 | 34:1cbf923d4ca7 | 134 | // ログにレスポンスコードout |
ntaka206 | 34:1cbf923d4ca7 | 135 | INFO("HTTP Res=%d\r\n", code); |
ntaka206 | 34:1cbf923d4ca7 | 136 | // Code=200番台以外ならばエラー |
ntaka206 | 34:1cbf923d4ca7 | 137 | // m2x 202(Accepted) |
ntaka206 | 34:1cbf923d4ca7 | 138 | if (code < 200 || code >= 300) { |
ntaka206 | 34:1cbf923d4ca7 | 139 | ERROR("HTTP Response ERR code=%d\r\n", code); |
ntaka206 | 34:1cbf923d4ca7 | 140 | return -1; |
ntaka206 | 34:1cbf923d4ca7 | 141 | } |
ntaka206 | 34:1cbf923d4ca7 | 142 | } else { |
ntaka206 | 34:1cbf923d4ca7 | 143 | // レスポンス受信できず |
ntaka206 | 34:1cbf923d4ca7 | 144 | ERROR("HTTP Response rcv ERR ret=%d\r\n", ret); |
ntaka206 | 34:1cbf923d4ca7 | 145 | return -1; |
ntaka206 | 34:1cbf923d4ca7 | 146 | } |
ntaka206 | 34:1cbf923d4ca7 | 147 | return 0; |
ntaka206 | 34:1cbf923d4ca7 | 148 | } |
ntaka206 | 34:1cbf923d4ca7 | 149 | /** |
ntaka206 | 34:1cbf923d4ca7 | 150 | * M2X にHTTP PUT送信する |
ntaka206 | 34:1cbf923d4ca7 | 151 | * HTTPデータを作って送信する |
ntaka206 | 34:1cbf923d4ca7 | 152 | * API V2 POST |
ntaka206 | 34:1cbf923d4ca7 | 153 | * @param *data JSONデータ (mag+powerv data) |
ntaka206 | 34:1cbf923d4ca7 | 154 | * @return 0=OK -1=ERR |
ntaka206 | 34:1cbf923d4ca7 | 155 | */ |
ntaka206 | 34:1cbf923d4ca7 | 156 | static char m2x_http_send(MDMSerial *mdm, int sn, int *ad) |
ntaka206 | 34:1cbf923d4ca7 | 157 | { |
ntaka206 | 34:1cbf923d4ca7 | 158 | char http_data[512]; |
ntaka206 | 34:1cbf923d4ca7 | 159 | char data[128]; |
ntaka206 | 34:1cbf923d4ca7 | 160 | // char buf[128]; |
ntaka206 | 34:1cbf923d4ca7 | 161 | |
ntaka206 | 34:1cbf923d4ca7 | 162 | #if 0 |
ntaka206 | 34:1cbf923d4ca7 | 163 | data[0] = 0; |
ntaka206 | 34:1cbf923d4ca7 | 164 | strncat(data, "{\"values\": {\r\n", sizeof(data)); |
ntaka206 | 34:1cbf923d4ca7 | 165 | sprintf(buf, "\"%s\": [\r\n", M2X_CHID_TEMP0); |
ntaka206 | 34:1cbf923d4ca7 | 166 | strncat(data, buf, sizeof(data)); |
ntaka206 | 34:1cbf923d4ca7 | 167 | |
ntaka206 | 34:1cbf923d4ca7 | 168 | sprintf(buf, "{ \"value\":%6.1f}", (ad[0]*MV_LSB-500)*DEGC_MV); |
ntaka206 | 34:1cbf923d4ca7 | 169 | strncat(data, buf, sizeof(data)); |
ntaka206 | 34:1cbf923d4ca7 | 170 | strncat(data, "],\r\n", sizeof(data)); |
ntaka206 | 34:1cbf923d4ca7 | 171 | strncat(data, "}}", sizeof(data)); |
ntaka206 | 34:1cbf923d4ca7 | 172 | #endif |
ntaka206 | 34:1cbf923d4ca7 | 173 | sprintf(data, "{ \"value\": \"%6.1f\" }", (ad[0]*MV_LSB-500)*DEGC_MV); |
ntaka206 | 34:1cbf923d4ca7 | 174 | |
ntaka206 | 34:1cbf923d4ca7 | 175 | // HTTP PUTデータ作る |
ntaka206 | 34:1cbf923d4ca7 | 176 | snprintf(http_data, sizeof(http_data), "PUT /v2/devices/%s/streams/%04d-temp0/value HTTP/1.0\r\n" |
ntaka206 | 34:1cbf923d4ca7 | 177 | "X-M2X-KEY: %s\r\n" |
ntaka206 | 34:1cbf923d4ca7 | 178 | "Host: %s\r\n" |
ntaka206 | 34:1cbf923d4ca7 | 179 | "Content-Type: application/json\r\n" |
ntaka206 | 34:1cbf923d4ca7 | 180 | "Content-Length: %d\r\n\r\n%s\r\n", |
ntaka206 | 34:1cbf923d4ca7 | 181 | M2X_DEVICE_ID, sn, M2X_API_KEY, M2X_SERVER, |
ntaka206 | 34:1cbf923d4ca7 | 182 | strlen(data), data); |
ntaka206 | 34:1cbf923d4ca7 | 183 | TRACE(http_data); |
ntaka206 | 34:1cbf923d4ca7 | 184 | // HTTP PUTする |
ntaka206 | 34:1cbf923d4ca7 | 185 | return cloud_http_socket_send(mdm, http_data, M2X_SERVER); |
ntaka206 | 34:1cbf923d4ca7 | 186 | } |
ntaka206 | 34:1cbf923d4ca7 | 187 | |
lawliet | 0:4e3cb26f6019 | 188 | int main(void) |
lawliet | 0:4e3cb26f6019 | 189 | { |
mazgch | 2:b77151f111a9 | 190 | int ret; |
mazgch | 19:f022ff746eb8 | 191 | #ifdef LARGE_DATA |
mazgch | 16:43f6de7bc38b | 192 | char buf[2048] = ""; |
mazgch | 17:c293780a40ac | 193 | #else |
mazgch | 17:c293780a40ac | 194 | char buf[512] = ""; |
mazgch | 17:c293780a40ac | 195 | #endif |
ntaka206 | 34:1cbf923d4ca7 | 196 | const int wait = 100; |
ntaka206 | 34:1cbf923d4ca7 | 197 | int ad[AD_NUM]; |
ntaka206 | 34:1cbf923d4ca7 | 198 | int sn; |
ntaka206 | 34:1cbf923d4ca7 | 199 | |
ntaka206 | 34:1cbf923d4ca7 | 200 | im920.baud(19200); |
ntaka206 | 34:1cbf923d4ca7 | 201 | im920.format(8, Serial::None, 1); |
lawliet | 0:4e3cb26f6019 | 202 | |
mazgch | 19:f022ff746eb8 | 203 | // Create the GPS object |
mazgch | 19:f022ff746eb8 | 204 | #if 1 // use GPSI2C class |
ntaka206 | 34:1cbf923d4ca7 | 205 | // GPSI2C gps; |
mazgch | 19:f022ff746eb8 | 206 | #else // or GPSSerial class |
ntaka206 | 34:1cbf923d4ca7 | 207 | // GPSSerial gps; |
mazgch | 10:d2da2028a233 | 208 | #endif |
mazgch | 10:d2da2028a233 | 209 | // Create the modem object |
mazgch | 32:b838fcaba45e | 210 | MDMSerial mdm; // use mdm(D1,D0) if you connect the cellular shield to a C027 |
mazgch | 28:334263983fcd | 211 | //mdm.setDebug(4); // enable this for debugging issues |
mazgch | 2:b77151f111a9 | 212 | // initialize the modem |
mazgch | 19:f022ff746eb8 | 213 | MDMParser::DevStatus devStatus = {}; |
mazgch | 19:f022ff746eb8 | 214 | MDMParser::NetStatus netStatus = {}; |
mazgch | 10:d2da2028a233 | 215 | bool mdmOk = mdm.init(SIMPIN, &devStatus); |
mazgch | 19:f022ff746eb8 | 216 | mdm.dumpDevStatus(&devStatus); |
mazgch | 19:f022ff746eb8 | 217 | if (mdmOk) { |
mazgch | 20:52f0e5de8c3d | 218 | // wait until we are connected |
mazgch | 20:52f0e5de8c3d | 219 | mdmOk = mdm.registerNet(&netStatus); |
mazgch | 20:52f0e5de8c3d | 220 | mdm.dumpNetStatus(&netStatus); |
mazgch | 20:52f0e5de8c3d | 221 | } |
mazgch | 20:52f0e5de8c3d | 222 | if (mdmOk) |
mazgch | 20:52f0e5de8c3d | 223 | { |
mazgch | 4:90ab1ec64b0e | 224 | // join the internet connection |
mazgch | 19:f022ff746eb8 | 225 | MDMParser::IP ip = mdm.join(APN,USERNAME,PASSWORD); |
mazgch | 32:b838fcaba45e | 226 | if (ip == NOIP) |
mazgch | 32:b838fcaba45e | 227 | printf("Not able to join network"); |
mazgch | 32:b838fcaba45e | 228 | else |
mazgch | 2:b77151f111a9 | 229 | { |
mazgch | 19:f022ff746eb8 | 230 | mdm.dumpIp(ip); |
mazgch | 2:b77151f111a9 | 231 | } |
ntaka206 | 34:1cbf923d4ca7 | 232 | } else { |
ntaka206 | 34:1cbf923d4ca7 | 233 | goto ErrOut; |
mazgch | 10:d2da2028a233 | 234 | } |
ntaka206 | 34:1cbf923d4ca7 | 235 | /* |
ntaka206 | 34:1cbf923d4ca7 | 236 | MAIN LOOP |
ntaka206 | 34:1cbf923d4ca7 | 237 | */ |
ntaka206 | 34:1cbf923d4ca7 | 238 | printf("LOOP START\r\n"); |
ntaka206 | 34:1cbf923d4ca7 | 239 | while(true) { |
ntaka206 | 34:1cbf923d4ca7 | 240 | if (im920.gets(buf, 128) > 0) { |
ntaka206 | 34:1cbf923d4ca7 | 241 | printf("%s", buf); |
ntaka206 | 34:1cbf923d4ca7 | 242 | if (!im920_conv(buf, &sn, ad)) { |
ntaka206 | 34:1cbf923d4ca7 | 243 | printf ("IM920: %06d, %04d, %04d, %04d\r\n", sn, ad[0], ad[1], ad[2]); |
ntaka206 | 34:1cbf923d4ca7 | 244 | printf ("IM920: %06d, %f, %f, %f\r\n", sn, (ad[0]*MV_LSB-500)*DEGC_MV, (ad[1]*MV_LSB-500)*DEGC_MV, ad[2]*PV_LSB); |
ntaka206 | 34:1cbf923d4ca7 | 245 | m2x_http_send(&mdm, sn, ad); |
mazgch | 4:90ab1ec64b0e | 246 | } |
mazgch | 9:26f694bc31b4 | 247 | } |
mazgch | 31:a07d0f76dc81 | 248 | #ifdef RTOS_H |
mazgch | 31:a07d0f76dc81 | 249 | Thread::wait(wait); |
mazgch | 31:a07d0f76dc81 | 250 | #else |
mazgch | 31:a07d0f76dc81 | 251 | ::wait_ms(wait); |
mazgch | 31:a07d0f76dc81 | 252 | #endif |
lawliet | 0:4e3cb26f6019 | 253 | } |
ntaka206 | 34:1cbf923d4ca7 | 254 | ErrOut: |
ntaka206 | 34:1cbf923d4ca7 | 255 | // gps.powerOff(); |
mazgch | 10:d2da2028a233 | 256 | mdm.powerOff(); |
lawliet | 0:4e3cb26f6019 | 257 | return 0; |
lawliet | 0:4e3cb26f6019 | 258 | } |