6868#include "6LoWPAN/MAC/mac_data_poll.h"
6969#include "mlme.h"
7070
71- #ifdef HAVE_THREAD_ROUTER
71+ #ifdef HAVE_THREAD
7272
7373typedef struct scan_query {
7474 int8_t coap_service_id ;
@@ -1134,6 +1134,7 @@ int thread_management_server_init(int8_t interface_id)
11341134 this -> announce_ptr = NULL ;
11351135 this -> external_commissioner_port = THREAD_COMMISSIONING_PORT ;
11361136
1137+ #ifdef HAVE_THREAD_ROUTER
11371138 if (thread_border_router_init (this -> interface_id ) != 0 ) {
11381139 ns_dyn_mem_free (this );
11391140 return -5 ;
@@ -1143,19 +1144,20 @@ int thread_management_server_init(int8_t interface_id)
11431144 ns_dyn_mem_free (this );
11441145 return -5 ;
11451146 }
1146-
1147+ #endif
11471148 this -> coap_service_id = coap_service_initialize (this -> interface_id , THREAD_MANAGEMENT_PORT , COAP_SERVICE_OPTIONS_NONE , NULL , NULL );
11481149 if (this -> coap_service_id < 0 ) {
11491150 tr_warn ("Thread management init failed" );
11501151 ns_dyn_mem_free (this );
11511152 return -3 ;
11521153 }
1153-
1154+ #ifdef HAVE_THREAD_ROUTER
11541155 if (thread_leader_service_init (interface_id , this -> coap_service_id ) != 0 ) {
11551156 tr_warn ("Thread leader service init failed" );
11561157 ns_dyn_mem_free (this );
11571158 return -3 ;
11581159 }
1160+ #endif
11591161 thread_extension_init (interface_id , this -> coap_service_id );
11601162
11611163 // All thread devices
@@ -1556,7 +1558,7 @@ int thread_management_server_tmf_get_request_handler(int8_t interface_id, int8_t
15561558 return ret_val ;
15571559}
15581560
1559- #else // HAVE_THREAD_ROUTER
1561+ #else // HAVE_THREAD
15601562
15611563int thread_management_server_init (int8_t interface_id )
15621564{
@@ -1571,7 +1573,7 @@ void thread_management_server_delete(int8_t interface_id)
15711573
15721574int thread_management_server_joiner_router_init (int8_t interface_id )
15731575{
1574- (void )interface_id ;
1576+ (void )interface_id ;
15751577 return 0 ;
15761578}
15771579
@@ -1601,4 +1603,4 @@ int thread_management_server_tmf_get_request_handler(int8_t interface_id, int8_t
16011603 (void )request_ptr ;
16021604 return -1 ;
16031605}
1604- #endif //HAVE_THREAD_ROUTER
1606+ #endif //HAVE_THREAD
0 commit comments