@@ -290,9 +290,14 @@ int at_obj_exec_cmd(at_client_t client, at_response_t resp, const char *cmd_expr
290290 rt_err_t result = RT_EOK ;
291291 const char * cmd = RT_NULL ;
292292
293- RT_ASSERT (client );
294293 RT_ASSERT (cmd_expr );
295294
295+ if (client == RT_NULL )
296+ {
297+ LOG_E ("input AT Client object is NULL, please create or get AT Client object!" );
298+ return - RT_ERROR ;
299+ }
300+
296301 rt_mutex_take (client -> lock , RT_WAITING_FOREVER );
297302
298303 client -> resp_status = AT_RESP_OK ;
@@ -348,8 +353,8 @@ int at_client_obj_wait_connect(at_client_t client, rt_uint32_t timeout)
348353
349354 if (client == RT_NULL )
350355 {
351- LOG_E ("Input AT Client is NULL, please create or get AT Client!" );
352- return RT_NULL ;
356+ LOG_E ("input AT Client object is NULL, please create or get AT Client object !" );
357+ return - RT_ERROR ;
353358 }
354359
355360 resp = at_create_resp (16 , 0 , rt_tick_from_millisecond (500 ));
@@ -400,13 +405,19 @@ int at_client_obj_wait_connect(at_client_t client, rt_uint32_t timeout)
400405 * @param buf send data buffer
401406 * @param size send fixed data size
402407 *
403- * @return send data size
408+ * @return >0: send data size
409+ * =0: send failed
404410 */
405411rt_size_t at_client_obj_send (at_client_t client , const char * buf , rt_size_t size )
406412{
407- RT_ASSERT (client );
408413 RT_ASSERT (buf );
409414
415+ if (client == RT_NULL )
416+ {
417+ LOG_E ("input AT Client object is NULL, please create or get AT Client object!" );
418+ return 0 ;
419+ }
420+
410421#ifdef AT_PRINT_RAW_CMD
411422 at_print_raw_cmd ("send" , buf , size );
412423#endif
@@ -436,16 +447,22 @@ static char at_client_getchar(at_client_t client)
436447 *
437448 * @note this function can only be used in execution function of URC data
438449 *
439- * @return success receive data size
450+ * @return >0: receive data size
451+ * =0: receive failed
440452 */
441453rt_size_t at_client_obj_recv (at_client_t client , char * buf , rt_size_t size )
442454{
443455 rt_size_t read_idx = 0 ;
444456 char ch ;
445457
446- RT_ASSERT (client );
447458 RT_ASSERT (buf );
448459
460+ if (client == RT_NULL )
461+ {
462+ LOG_E ("input AT Client object is NULL, please create or get AT Client object!" );
463+ return 0 ;
464+ }
465+
449466 while (1 )
450467 {
451468 if (read_idx < size )
@@ -475,7 +492,11 @@ rt_size_t at_client_obj_recv(at_client_t client, char *buf, rt_size_t size)
475492 */
476493void at_obj_set_end_sign (at_client_t client , char ch )
477494{
478- RT_ASSERT (client );
495+ if (client == RT_NULL )
496+ {
497+ LOG_E ("input AT Client object is NULL, please create or get AT Client object!" );
498+ return ;
499+ }
479500
480501 client -> end_sign = ch ;
481502}
@@ -491,6 +512,12 @@ void at_obj_set_urc_table(at_client_t client, const struct at_urc *urc_table, rt
491512{
492513 rt_size_t idx ;
493514
515+ if (client == RT_NULL )
516+ {
517+ LOG_E ("input AT Client object is NULL, please create or get AT Client object!" );
518+ return ;
519+ }
520+
494521 for (idx = 0 ; idx < table_sz ; idx ++ )
495522 {
496523 RT_ASSERT (urc_table [idx ].cmd_prefix );
0 commit comments