@@ -222,6 +222,8 @@ static ssize_t supported_context_read(struct bt_conn *conn,
222222}
223223
224224#if defined(CONFIG_BT_PAC_SNK_LOC ) || defined(CONFIG_BT_PAC_SRC_LOC )
225+ static void pac_notify_loc (struct k_work * work );
226+
225227static int get_pac_loc (struct bt_conn * conn , enum bt_audio_dir dir ,
226228 enum bt_audio_location * location )
227229{
@@ -244,8 +246,10 @@ static int get_pac_loc(struct bt_conn *conn, enum bt_audio_dir dir,
244246}
245247#endif /* CONFIG_BT_PAC_SNK_LOC || CONFIG_BT_PAC_SRC_LOC */
246248
249+ static void pac_notify (struct k_work * work );
250+
247251#if defined(CONFIG_BT_PAC_SNK )
248- static struct k_work_delayable snks_work ;
252+ static K_WORK_DELAYABLE_DEFINE ( snks_work , pac_notify ) ;
249253
250254static ssize_t snk_read (struct bt_conn * conn , const struct bt_gatt_attr * attr ,
251255 void * buf , uint16_t len , uint16_t offset )
@@ -262,7 +266,7 @@ static void snk_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
262266}
263267
264268#if defined(CONFIG_BT_PAC_SNK_LOC )
265- static struct k_work_delayable snks_loc_work ;
269+ static K_WORK_DELAYABLE_DEFINE ( snks_loc_work , pac_notify_loc ) ;
266270
267271static ssize_t snk_loc_read (struct bt_conn * conn ,
268272 const struct bt_gatt_attr * attr , void * buf ,
@@ -341,7 +345,7 @@ static void snk_loc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
341345#endif /* CONFIG_BT_PAC_SNK */
342346
343347#if defined(CONFIG_BT_PAC_SRC )
344- static struct k_work_delayable srcs_work ;
348+ static K_WORK_DELAYABLE_DEFINE ( srcs_work , pac_notify ) ;
345349
346350static ssize_t src_read (struct bt_conn * conn , const struct bt_gatt_attr * attr ,
347351 void * buf , uint16_t len , uint16_t offset )
@@ -358,7 +362,7 @@ static void src_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
358362}
359363
360364#if defined(CONFIG_BT_PAC_SRC_LOC )
361- static struct k_work_delayable srcs_loc_work ;
365+ static K_WORK_DELAYABLE_DEFINE ( srcs_loc_work , pac_notify_loc ) ;
362366
363367static ssize_t src_loc_read (struct bt_conn * conn ,
364368 const struct bt_gatt_attr * attr , void * buf ,
@@ -588,24 +592,7 @@ static void pac_notify(struct k_work *work)
588592 }
589593}
590594
591- void bt_pacs_add_capability (enum bt_audio_dir dir )
592- {
593- struct k_work_delayable * work ;
594-
595- work = bt_pacs_get_work (dir );
596- if (!work ) {
597- return ;
598- }
599-
600- /* Initialize handler if it hasn't been initialized */
601- if (!work -> work .handler ) {
602- k_work_init_delayable (work , pac_notify );
603- }
604-
605- k_work_reschedule (work , PAC_NOTIFY_TIMEOUT );
606- }
607-
608- void bt_pacs_remove_capability (enum bt_audio_dir dir )
595+ void bt_pacs_capabilities_changed (enum bt_audio_dir dir )
609596{
610597 struct k_work_delayable * work ;
611598
@@ -628,11 +615,6 @@ int bt_audio_pacs_location_changed(enum bt_audio_dir dir)
628615 return - EINVAL ;
629616 }
630617
631- /* Initialize handler if it hasn't been initialized */
632- if (!work -> work .handler ) {
633- k_work_init_delayable (work , pac_notify_loc );
634- }
635-
636618 k_work_reschedule (work , PAC_NOTIFY_TIMEOUT );
637619
638620 return 0 ;
0 commit comments