12
12
13
13
static void default_msg_handler (void * client , message_data_t * msg )
14
14
{
15
- MQTT_LOG_I ("%s :%d %s()...\ntopic: %s, qos: %d, \nmessage:%s" , __FILE__ , __LINE__ , __FUNCTION__ ,
15
+ MQTT_LOG_I ("mqtt-client :%d %s()...\ntopic: %s, qos: %d, \nmessage:%s" , __LINE__ , __FUNCTION__ ,
16
16
msg -> topic_name , msg -> message -> qos , (char * )msg -> message -> payload );
17
17
}
18
18
@@ -352,7 +352,7 @@ static void mqtt_ack_handler_resend(mqtt_client_t* c, ack_handlers_t* ack_handle
352
352
353
353
mqtt_send_packet (c , ack_handler -> payload_len , & timer ); /* resend data */
354
354
platform_mutex_unlock (& c -> mqtt_write_lock );
355
- MQTT_LOG_W ("%s :%d %s()... resend %d package, packet_id is %d " , __FILE__ , __LINE__ , __FUNCTION__ , ack_handler -> type , ack_handler -> packet_id );
355
+ MQTT_LOG_W ("mqtt-client :%d %s()... resend %d package, packet_id is %d " , __LINE__ , __FUNCTION__ , ack_handler -> type , ack_handler -> packet_id );
356
356
}
357
357
358
358
static int mqtt_ack_list_node_is_exist (mqtt_client_t * c , int type , uint16_t packet_id )
@@ -460,8 +460,8 @@ static int mqtt_msg_handler_is_exist(mqtt_client_t* c, message_handlers_t *handl
460
460
461
461
/* determine whether a node already exists by mqtt topic, but wildcards are not supported */
462
462
if ((NULL != msg_handler -> topic_filter ) && (mqtt_is_topic_equals (msg_handler -> topic_filter , handler -> topic_filter ))) {
463
- MQTT_LOG_W ("%s :%d %s()...msg_handler->topic_filter: %s, handler->topic_filter: %s" ,
464
- __FILE__ , __LINE__ , __FUNCTION__ , msg_handler -> topic_filter , handler -> topic_filter );
463
+ MQTT_LOG_W ("mqtt-client :%d %s()...msg_handler->topic_filter: %s, handler->topic_filter: %s" ,
464
+ __LINE__ , __FUNCTION__ , msg_handler -> topic_filter , handler -> topic_filter );
465
465
return 1 ;
466
466
}
467
467
}
@@ -517,7 +517,7 @@ static void mqtt_clean_session(mqtt_client_t* c)
517
517
msg_handler -> topic_filter = NULL ;
518
518
platform_memory_free (msg_handler );
519
519
}
520
- // MQTT_LOG_D("%s :%d %s() mqtt_msg_handler_list delete", __FILE__ , __LINE__, __FUNCTION__);
520
+ // MQTT_LOG_D("mqtt-client :%d %s() mqtt_msg_handler_list delete", __LINE__, __FUNCTION__);
521
521
mqtt_list_del_init (& c -> mqtt_msg_handler_list );
522
522
}
523
523
@@ -569,10 +569,10 @@ static int mqtt_try_resubscribe(mqtt_client_t* c)
569
569
mqtt_list_t * curr , * next ;
570
570
message_handlers_t * msg_handler ;
571
571
572
- MQTT_LOG_W ("%s :%d %s()... mqtt try resubscribe ..." , __FILE__ , __LINE__ , __FUNCTION__ );
572
+ MQTT_LOG_W ("mqtt-client :%d %s()... mqtt try resubscribe ..." , __LINE__ , __FUNCTION__ );
573
573
574
574
if (mqtt_list_is_empty (& c -> mqtt_msg_handler_list )) {
575
- // MQTT_LOG_D("%s :%d %s() mqtt_msg_handler_list is empty", __FILE__ , __LINE__, __FUNCTION__);
575
+ // MQTT_LOG_D("mqtt-client :%d %s() mqtt_msg_handler_list is empty", __LINE__, __FUNCTION__);
576
576
RETURN_ERROR (MQTT_SUCCESS_ERROR );
577
577
}
578
578
@@ -581,7 +581,7 @@ static int mqtt_try_resubscribe(mqtt_client_t* c)
581
581
582
582
/* resubscribe topic */
583
583
if ((rc = mqtt_subscribe (c , msg_handler -> topic_filter , msg_handler -> qos , msg_handler -> handler )) == MQTT_ACK_HANDLER_NUM_TOO_MUCH_ERROR )
584
- MQTT_LOG_W ("%s :%d %s()... mqtt ack handler num too much ..." , __FILE__ , __LINE__ , __FUNCTION__ );
584
+ MQTT_LOG_W ("mqtt-client :%d %s()... mqtt ack handler num too much ..." , __LINE__ , __FUNCTION__ );
585
585
586
586
}
587
587
@@ -601,7 +601,7 @@ static int mqtt_try_do_reconnect(mqtt_client_t* c)
601
601
mqtt_ack_list_scan (c , 0 );
602
602
}
603
603
604
- MQTT_LOG_D ("%s :%d %s()... mqtt try connect result is -0x%04x" , __FILE__ , __LINE__ , __FUNCTION__ , - rc );
604
+ MQTT_LOG_D ("mqtt-client :%d %s()... mqtt try connect result is -0x%04x" , __LINE__ , __FUNCTION__ , - rc );
605
605
606
606
RETURN_ERROR (rc );
607
607
}
@@ -919,7 +919,7 @@ static int mqtt_yield(mqtt_client_t* c, int timeout_ms)
919
919
mqtt_ack_list_scan (c , 1 );
920
920
921
921
} else if (MQTT_NOT_CONNECT_ERROR == rc ) {
922
- MQTT_LOG_E ("%s :%d %s()... mqtt not connect" , __FILE__ , __LINE__ , __FUNCTION__ );
922
+ MQTT_LOG_E ("mqtt-client :%d %s()... mqtt not connect" , __LINE__ , __FUNCTION__ );
923
923
} else {
924
924
break ;
925
925
}
@@ -937,19 +937,19 @@ static void mqtt_yield_thread(void *arg)
937
937
938
938
state = mqtt_get_client_state (c );
939
939
if (CLIENT_STATE_CONNECTED != state ) {
940
- MQTT_LOG_W ("%s :%d %s()..., mqtt is not connected to the server..." , __FILE__ , __LINE__ , __FUNCTION__ );
940
+ MQTT_LOG_W ("mqtt-client :%d %s()..., mqtt is not connected to the server..." , __LINE__ , __FUNCTION__ );
941
941
platform_thread_stop (c -> mqtt_thread ); /* mqtt is not connected to the server, stop thread */
942
942
}
943
943
944
944
while (1 ) {
945
945
rc = mqtt_yield (c , c -> mqtt_cmd_timeout );
946
946
if (MQTT_CLEAN_SESSION_ERROR == rc ) {
947
- MQTT_LOG_W ("%s :%d %s()..., mqtt clean session...." , __FILE__ , __LINE__ , __FUNCTION__ );
947
+ MQTT_LOG_W ("mqtt-client :%d %s()..., mqtt clean session...." , __LINE__ , __FUNCTION__ );
948
948
network_disconnect (c -> mqtt_network );
949
949
mqtt_clean_session (c );
950
950
goto exit ;
951
951
} else if (MQTT_RECONNECT_TIMEOUT_ERROR == rc ) {
952
- MQTT_LOG_W ("%s :%d %s()..., mqtt reconnect timeout...." , __FILE__ , __LINE__ , __FUNCTION__ );
952
+ MQTT_LOG_W ("mqtt-client :%d %s()..., mqtt reconnect timeout...." , __LINE__ , __FUNCTION__ );
953
953
}
954
954
}
955
955
@@ -991,7 +991,7 @@ static int mqtt_connect_with_results(mqtt_client_t* c)
991
991
}
992
992
}
993
993
994
- MQTT_LOG_I ("%s :%d %s()... mqtt connect success..." , __FILE__ , __LINE__ , __FUNCTION__ );
994
+ MQTT_LOG_I ("mqtt-client :%d %s()... mqtt connect success..." , __LINE__ , __FUNCTION__ );
995
995
996
996
connect_data .keepAliveInterval = c -> mqtt_keep_alive_interval ;
997
997
connect_data .cleansession = c -> mqtt_clean_session ;
@@ -1045,7 +1045,7 @@ static int mqtt_connect_with_results(mqtt_client_t* c)
1045
1045
/*creat the thread fail and disconnect the mqtt socket connect*/
1046
1046
network_release (c -> mqtt_network );
1047
1047
rc = MQTT_CONNECT_FAILED_ERROR ;
1048
- MQTT_LOG_W ("%s :%d %s()... mqtt yield thread creat failed..." , __FILE__ , __LINE__ , __FUNCTION__ );
1048
+ MQTT_LOG_W ("mqtt-client :%d %s()... mqtt yield thread creat failed..." , __LINE__ , __FUNCTION__ );
1049
1049
}
1050
1050
} else {
1051
1051
mqtt_set_client_state (c , CLIENT_STATE_CONNECTED ); /* reconnect, mqtt thread is already exists */
@@ -1079,7 +1079,7 @@ static uint32_t mqtt_read_buf_malloc(mqtt_client_t* c, uint32_t size)
1079
1079
c -> mqtt_read_buf = (uint8_t * ) platform_memory_alloc (c -> mqtt_read_buf_size );
1080
1080
1081
1081
if (NULL == c -> mqtt_read_buf ) {
1082
- MQTT_LOG_E ("%s :%d %s()... malloc read buf failed..." , __FILE__ , __LINE__ , __FUNCTION__ );
1082
+ MQTT_LOG_E ("mqtt-client :%d %s()... malloc read buf failed..." , __LINE__ , __FUNCTION__ );
1083
1083
RETURN_ERROR (MQTT_MEM_NOT_ENOUGH_ERROR );
1084
1084
}
1085
1085
return c -> mqtt_read_buf_size ;
@@ -1101,7 +1101,7 @@ static uint32_t mqtt_write_buf_malloc(mqtt_client_t* c, uint32_t size)
1101
1101
c -> mqtt_write_buf = (uint8_t * ) platform_memory_alloc (c -> mqtt_write_buf_size );
1102
1102
1103
1103
if (NULL == c -> mqtt_write_buf ) {
1104
- MQTT_LOG_E ("%s :%d %s()... malloc write buf failed..." , __FILE__ , __LINE__ , __FUNCTION__ );
1104
+ MQTT_LOG_E ("mqtt-client :%d %s()... malloc write buf failed..." , __LINE__ , __FUNCTION__ );
1105
1105
RETURN_ERROR (MQTT_MEM_NOT_ENOUGH_ERROR );
1106
1106
}
1107
1107
return c -> mqtt_write_buf_size ;
@@ -1113,7 +1113,7 @@ static int mqtt_init(mqtt_client_t* c)
1113
1113
c -> mqtt_network = (network_t * ) platform_memory_alloc (sizeof (network_t ));
1114
1114
1115
1115
if (NULL == c -> mqtt_network ) {
1116
- MQTT_LOG_E ("%s :%d %s()... malloc memory failed..." , __FILE__ , __LINE__ , __FUNCTION__ );
1116
+ MQTT_LOG_E ("mqtt-client :%d %s()... malloc memory failed..." , __LINE__ , __FUNCTION__ );
1117
1117
RETURN_ERROR (MQTT_MEM_NOT_ENOUGH_ERROR );
1118
1118
}
1119
1119
memset (c -> mqtt_network , 0 , sizeof (network_t ));
@@ -1196,7 +1196,7 @@ int mqtt_keep_alive(mqtt_client_t* c)
1196
1196
1197
1197
if (platform_timer_is_expired (& c -> mqtt_last_sent ) || platform_timer_is_expired (& c -> mqtt_last_received )) {
1198
1198
if (c -> mqtt_ping_outstanding ) {
1199
- MQTT_LOG_W ("%s :%d %s()... ping outstanding" , __FILE__ , __LINE__ , __FUNCTION__ );
1199
+ MQTT_LOG_W ("mqtt-client :%d %s()... ping outstanding" , __LINE__ , __FUNCTION__ );
1200
1200
/*must realse the socket file descriptor zhaoshimin 20200629*/
1201
1201
network_release (c -> mqtt_network );
1202
1202
@@ -1246,7 +1246,7 @@ int mqtt_release(mqtt_client_t* c)
1246
1246
while ((CLIENT_STATE_INVALID != mqtt_get_client_state (c ))) {
1247
1247
// platform_timer_usleep(1000); // 1ms avoid compiler optimization.
1248
1248
if (platform_timer_is_expired (& timer )) {
1249
- MQTT_LOG_E ("%s :%d %s()... mqtt release failed..." , __FILE__ , __LINE__ , __FUNCTION__ );
1249
+ MQTT_LOG_E ("mqtt-client :%d %s()... mqtt release failed..." , __LINE__ , __FUNCTION__ );
1250
1250
RETURN_ERROR (MQTT_FAILED_ERROR )
1251
1251
}
1252
1252
}
@@ -1448,7 +1448,7 @@ int mqtt_publish(mqtt_client_t* c, const char* topic_filter, mqtt_message_t* msg
1448
1448
platform_mutex_unlock (& c -> mqtt_write_lock );
1449
1449
1450
1450
if ((MQTT_ACK_HANDLER_NUM_TOO_MUCH_ERROR == rc ) || (MQTT_MEM_NOT_ENOUGH_ERROR == rc )) {
1451
- MQTT_LOG_W ("%s :%d %s()... there is not enough memory space to record..." , __FILE__ , __LINE__ , __FUNCTION__ );
1451
+ MQTT_LOG_W ("mqtt-client :%d %s()... there is not enough memory space to record..." , __LINE__ , __FUNCTION__ );
1452
1452
1453
1453
/*must realse the socket file descriptor zhaoshimin 20200629*/
1454
1454
network_release (c -> mqtt_network );
@@ -1473,13 +1473,13 @@ int mqtt_list_subscribe_topic(mqtt_client_t* c)
1473
1473
RETURN_ERROR (MQTT_NULL_VALUE_ERROR );
1474
1474
1475
1475
if (mqtt_list_is_empty (& c -> mqtt_msg_handler_list ))
1476
- MQTT_LOG_I ("%s :%d %s()... there are no subscribed topics..." , __FILE__ , __LINE__ , __FUNCTION__ );
1476
+ MQTT_LOG_I ("mqtt-client :%d %s()... there are no subscribed topics..." , __LINE__ , __FUNCTION__ );
1477
1477
1478
1478
LIST_FOR_EACH_SAFE (curr , next , & c -> mqtt_msg_handler_list ) {
1479
1479
msg_handler = LIST_ENTRY (curr , message_handlers_t , list );
1480
1480
/* determine whether a node already exists by mqtt topic, but wildcards are not supported */
1481
1481
if (NULL != msg_handler -> topic_filter ) {
1482
- MQTT_LOG_I ("%s :%d %s()...[%d] subscribe topic: %s" , __FILE__ , __LINE__ , __FUNCTION__ , ++ i ,msg_handler -> topic_filter );
1482
+ MQTT_LOG_I ("mqtt-client :%d %s()...[%d] subscribe topic: %s" , __LINE__ , __FUNCTION__ , ++ i ,msg_handler -> topic_filter );
1483
1483
}
1484
1484
}
1485
1485
0 commit comments