* Send data to AT server, send data don't have end sign(eg: \r\n). * * @param client current AT client object * @param buf send data buffer * @param size send fixed data size * * @return >0: send data size * =0: send failed */
| 509 | * =0: send failed |
| 510 | */ |
| 511 | rt_size_t at_client_obj_send(at_client_t client, const char *buf, rt_size_t size) |
| 512 | { |
| 513 | rt_size_t len; |
| 514 | |
| 515 | RT_ASSERT(buf); |
| 516 | |
| 517 | if (client == RT_NULL) |
| 518 | { |
| 519 | LOG_E("input AT Client object is NULL, please create or get AT Client object!"); |
| 520 | return 0; |
| 521 | } |
| 522 | |
| 523 | #ifdef AT_PRINT_RAW_CMD |
| 524 | at_print_raw_cmd("sendline", buf, size); |
| 525 | #endif |
| 526 | |
| 527 | rt_mutex_take(&client->lock, RT_WAITING_FOREVER); |
| 528 | |
| 529 | len = at_utils_send(client->device, 0, buf, size); |
| 530 | |
| 531 | rt_mutex_release(&client->lock); |
| 532 | |
| 533 | return len; |
| 534 | } |
| 535 | |
| 536 | /** |
| 537 | * AT client receive fixed-length data. |
nothing calls this directly
no test coverage detected