From 2343b7d3c2d08f0b27713bf7aa9a0cc3a2869dac Mon Sep 17 00:00:00 2001
From: Matthias Ringwald <matthias@ringwald.ch>
Date: Mon, 22 Apr 2019 18:32:26 +0200
Subject: [PATCH] mesh: use mesh_lower_transport_send_pdu instead of send
 segmented/unsegmented

---
 src/ble/mesh/mesh_lower_transport.c | 11 -----------
 src/ble/mesh/mesh_lower_transport.h |  2 --
 test/mesh/mesh.c                    |  2 +-
 test/mesh/mesh_transport.c          |  8 ++++----
 4 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/src/ble/mesh/mesh_lower_transport.c b/src/ble/mesh/mesh_lower_transport.c
index 4af1138fe..fc8f2d3e8 100644
--- a/src/ble/mesh/mesh_lower_transport.c
+++ b/src/ble/mesh/mesh_lower_transport.c
@@ -598,17 +598,6 @@ static void mesh_lower_transport_send_segmented_pdu_once(mesh_transport_pdu_t *t
     mesh_lower_transport_send_next_segment();
 }
 
-void mesh_lower_transport_send_segmented_pdu(mesh_transport_pdu_t *transport_pdu){
-    // queue transport (= segmented pdu)
-    btstack_linked_list_add_tail(&lower_transport_outgoing, (btstack_linked_item_t*) transport_pdu);
-    mesh_lower_transport_run();
-}
-
-void mesh_lower_transport_send_unsegmented_pdu(mesh_network_pdu_t *network_pdu){
-    btstack_linked_list_add_tail(&lower_transport_outgoing, (btstack_linked_item_t*) network_pdu);
-    mesh_lower_transport_run();
-}
-
 void mesh_lower_transport_send_pdu(mesh_pdu_t *pdu){
     btstack_linked_list_add_tail(&lower_transport_outgoing, (btstack_linked_item_t*) pdu);
     mesh_lower_transport_run();
diff --git a/src/ble/mesh/mesh_lower_transport.h b/src/ble/mesh/mesh_lower_transport.h
index e8af596d7..ace09c626 100644
--- a/src/ble/mesh/mesh_lower_transport.h
+++ b/src/ble/mesh/mesh_lower_transport.h
@@ -103,8 +103,6 @@ uint32_t mesh_lower_transport_peek_seq(void);
 
 void mesh_lower_transport_message_processed_by_higher_layer(mesh_pdu_t * pdu);
 
-void mesh_lower_transport_send_unsegmented_pdu(mesh_network_pdu_t *network_pdu);
-void mesh_lower_transport_send_segmented_pdu(mesh_transport_pdu_t *transport_pdu);
 void mesh_lower_transport_send_pdu(mesh_pdu_t * pdu);
 
 // test
diff --git a/test/mesh/mesh.c b/test/mesh/mesh.c
index 71d6a8138..cfaccffd0 100644
--- a/test/mesh/mesh.c
+++ b/test/mesh/mesh.c
@@ -167,7 +167,7 @@ static uint8_t mesh_network_send(uint16_t netkey_index, uint8_t ctl, uint8_t ttl
     mesh_network_setup_pdu(network_pdu, netkey_index, network_key->nid, ctl, ttl, seq, src, dest, transport_pdu_data, transport_pdu_len);
 
     // send network_pdu
-    mesh_lower_transport_send_unsegmented_pdu(network_pdu);
+    mesh_lower_transport_send_pdu((mesh_pdu_t *) network_pdu);
     return 0;
 }
 
diff --git a/test/mesh/mesh_transport.c b/test/mesh/mesh_transport.c
index 1cfb1fcb3..227150b6c 100644
--- a/test/mesh/mesh_transport.c
+++ b/test/mesh/mesh_transport.c
@@ -513,7 +513,7 @@ static void mesh_upper_transport_send_unsegmented_access_pdu_ccm(void * arg){
     mesh_print_hex("TransMIC", &upper_transport_pdu[upper_transport_pdu_len], 4);
     network_pdu->len += 4;
     // send network pdu
-    mesh_lower_transport_send_unsegmented_pdu(network_pdu);
+    mesh_lower_transport_send_pdu((mesh_pdu_t*) network_pdu);
 }
 
 static void mesh_upper_transport_send_segmented_access_pdu_ccm(void * arg){
@@ -525,7 +525,7 @@ static void mesh_upper_transport_send_segmented_access_pdu_ccm(void * arg){
     btstack_crypto_ccm_get_authentication_value(&ccm, &transport_pdu->data[transport_pdu->len]);
     mesh_print_hex("TransMIC", &transport_pdu->data[transport_pdu->len], transport_pdu->transmic_len);
     transport_pdu->len += transport_pdu->transmic_len;
-    mesh_lower_transport_send_segmented_pdu(transport_pdu);
+    mesh_lower_transport_send_pdu((mesh_pdu_t*) transport_pdu);
 }
 
 uint8_t mesh_upper_transport_setup_unsegmented_control_pdu(mesh_network_pdu_t * network_pdu, uint16_t netkey_index, uint8_t ttl, uint16_t src, uint16_t dest, uint8_t opcode,
@@ -665,11 +665,11 @@ uint8_t mesh_upper_transport_setup_segmented_access_pdu(mesh_transport_pdu_t * t
 }
 
 void mesh_upper_transport_send_unsegmented_control_pdu(mesh_network_pdu_t * network_pdu){
-    mesh_lower_transport_send_unsegmented_pdu(network_pdu);
+    mesh_lower_transport_send_pdu((mesh_pdu_t*) network_pdu);
 }
 
 void mesh_upper_transport_send_segmented_control_pdu(mesh_transport_pdu_t * transport_pdu){
-    mesh_lower_transport_send_segmented_pdu(transport_pdu);
+    mesh_lower_transport_send_pdu((mesh_pdu_t*) transport_pdu);
 }
 
 void mesh_upper_transport_send_unsegmented_access_pdu_digest(void * arg){