Skip to content

Commit 2fc95a5

Browse files
Read '@' char first then send data
1 parent c520449 commit 2fc95a5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
#include "UBLOX_AT_CellularStack.h"
19-
#include "mbed_poll.h"
19+
#include "rtos/ThisThread.h"
2020

2121
using namespace mbed;
2222
using namespace mbed_cellular_util;
@@ -168,17 +168,16 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_sendto_impl(CellularSocket
168168
MBED_ASSERT(socket->id != -1);
169169

170170
int sent_len = 0;
171-
pollfh fhs;
172-
fhs.fh = _at.get_file_handle();
173-
fhs.events = POLLIN;
171+
uint8_t ch = 0;
174172

175173
if (socket->proto == NSAPI_UDP) {
176174
if (size > UBLOX_MAX_PACKET_SIZE) {
177175
return NSAPI_ERROR_PARAMETER;
178176
}
179177
_at.cmd_start_stop("+USOST", "=", "%d%s%d%d", socket->id, address.get_ip_address(), address.get_port(), size);
178+
_at.resp_start("@", true);
179+
rtos::ThisThread::sleep_for(50); //wait for 50ms before sending data
180180

181-
(void)poll(&fhs, 1, 50);
182181
_at.write_bytes((uint8_t *)data, size);
183182

184183
_at.resp_start("+USOST:");
@@ -200,8 +199,9 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_sendto_impl(CellularSocket
200199
blk = count;
201200
}
202201
_at.cmd_start_stop("+USOWR", "=", "%d%d", socket->id, blk);
202+
_at.resp_start("@", true);
203+
rtos::ThisThread::sleep_for(50); //wait for 50ms before sending data
203204

204-
(void)poll(&fhs, 1, 50);
205205
_at.write_bytes((uint8_t *)buf, blk);
206206

207207
_at.resp_start("+USOWR:");

0 commit comments

Comments
 (0)