@@ -29,7 +29,7 @@ struct BatteryService {
2929}
3030
3131/// Run the BLE stack.
32- pub async fn run < C , RNG , const L2CAP_MTU : usize > ( controller : C , random_generator : & mut RNG )
32+ pub async fn run < C , RNG > ( controller : C , random_generator : & mut RNG )
3333where
3434 C : Controller ,
3535 RNG : RngCore + CryptoRng ,
3939 let address: Address = Address :: random ( [ 0xff , 0x8f , 0x1a , 0x05 , 0xe4 , 0xff ] ) ;
4040 info ! ( "Our address = {}" , address) ;
4141
42- let mut resources: HostResources < CONNECTIONS_MAX , L2CAP_CHANNELS_MAX , L2CAP_MTU > = HostResources :: new ( ) ;
42+ let mut resources: HostResources < DefaultPacketPool , CONNECTIONS_MAX , L2CAP_CHANNELS_MAX > = HostResources :: new ( ) ;
4343 let stack = trouble_host:: new ( controller, & mut resources)
4444 . set_random_address ( address)
4545 . set_random_generator_seed ( random_generator) ;
9191///
9292/// spawner.must_spawn(ble_task(runner));
9393/// ```
94- async fn ble_task < C : Controller > ( mut runner : Runner < ' _ , C > ) {
94+ async fn ble_task < C : Controller , P : PacketPool > ( mut runner : Runner < ' _ , C , P > ) {
9595 loop {
9696 if let Err ( e) = runner. run ( ) . await {
9797 #[ cfg( feature = "defmt" ) ]
@@ -105,7 +105,7 @@ async fn ble_task<C: Controller>(mut runner: Runner<'_, C>) {
105105///
106106/// This function will handle the GATT events and process them.
107107/// This is how we interact with read and write requests.
108- async fn gatt_events_task ( server : & Server < ' _ > , conn : & GattConnection < ' _ , ' _ > ) -> Result < ( ) , Error > {
108+ async fn gatt_events_task ( server : & Server < ' _ > , conn : & GattConnection < ' _ , ' _ , DefaultPacketPool > ) -> Result < ( ) , Error > {
109109 let level = server. battery_service . level ;
110110 loop {
111111 match conn. next ( ) . await {
@@ -173,9 +173,9 @@ async fn gatt_events_task(server: &Server<'_>, conn: &GattConnection<'_, '_>) ->
173173/// Create an advertiser to use to connect to a BLE Central, and wait for it to connect.
174174async fn advertise < ' a , ' b , C : Controller > (
175175 name : & ' a str ,
176- peripheral : & mut Peripheral < ' a , C > ,
176+ peripheral : & mut Peripheral < ' a , C , DefaultPacketPool > ,
177177 server : & ' b Server < ' _ > ,
178- ) -> Result < GattConnection < ' a , ' b > , BleHostError < C :: Error > > {
178+ ) -> Result < GattConnection < ' a , ' b , DefaultPacketPool > , BleHostError < C :: Error > > {
179179 let mut advertiser_data = [ 0 ; 31 ] ;
180180 AdStructure :: encode_slice (
181181 & [
@@ -204,7 +204,11 @@ async fn advertise<'a, 'b, C: Controller>(
204204/// This task will notify the connected central of a counter value every 2 seconds.
205205/// It will also read the RSSI value every 2 seconds.
206206/// and will stop when the connection is closed by the central or an error occurs.
207- async fn custom_task < C : Controller > ( server : & Server < ' _ > , conn : & GattConnection < ' _ , ' _ > , stack : & Stack < ' _ , C > ) {
207+ async fn custom_task < C : Controller , P : PacketPool > (
208+ server : & Server < ' _ > ,
209+ conn : & GattConnection < ' _ , ' _ , P > ,
210+ stack : & Stack < ' _ , C , P > ,
211+ ) {
208212 let mut tick: u8 = 0 ;
209213 let level = server. battery_service . level ;
210214 loop {
0 commit comments