Skip to content

Commit

Permalink
apps/bttester: Add initial support for PACS autopts tests
Browse files Browse the repository at this point in the history
This commit adds support for Published
Audio Capabilities Service in bttester
application.
  • Loading branch information
szymon-czapracki committed May 8, 2024
1 parent 61021c1 commit 66040b3
Show file tree
Hide file tree
Showing 8 changed files with 414 additions and 1 deletion.
3 changes: 3 additions & 0 deletions apps/bttester/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ pkg.deps:
- "@apache-mynewt-core/sys/stats"
- "@apache-mynewt-core/sys/shell"
- "@apache-mynewt-nimble/nimble/host"
- "@apache-mynewt-nimble/nimble/host/audio"
- "@apache-mynewt-nimble/nimble/host/util"
- "@apache-mynewt-nimble/nimble/host/services/gap"
- "@apache-mynewt-nimble/nimble/host/services/gatt"
- "@apache-mynewt-nimble/nimble/host/services/dis"
- "@apache-mynewt-nimble/nimble/host/audio/services/pacs"
- "@apache-mynewt-nimble/nimble/host/audio/services/pacs/lc3"
- "@apache-mynewt-nimble/nimble/host/store/config"
- "@apache-mynewt-core/hw/drivers/uart"
- "@apache-mynewt-core/hw/drivers/rtt"
Expand Down
2 changes: 2 additions & 0 deletions apps/bttester/src/btp/btp.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "btp_gattc.h"
#include "btp_l2cap.h"
#include "btp_mesh.h"
#include "btp_pacs.h"
#include "btp_bap.h"

#define BTP_MTU MYNEWT_VAL(BTTESTER_BTP_DATA_SIZE_MAX)
Expand All @@ -47,6 +48,7 @@
#define BTP_SERVICE_ID_L2CAP 3
#define BTP_SERVICE_ID_MESH 4
#define BTP_SERVICE_ID_GATTC 6
#define BTP_SERVICE_ID_PACS 12
#define BTP_SERVICE_ID_BAP 14

#define BTP_SERVICE_ID_MAX BTP_SERVICE_ID_BAP
Expand Down
59 changes: 59 additions & 0 deletions apps/bttester/src/btp/btp_pacs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

#ifndef BTP_PACS_H
#define BTP_PACS_H

#include <stdint.h>

#ifndef __packed
#define __packed __attribute__((__packed__))
#endif

#define BTP_PACS_READ_SUPPORTED_COMMANDS 0x01
struct btp_pacs_read_supported_commands_rp {
uint8_t data[0];
} __packed;

#define BTP_PACS_UPDATE_CHARACTERISTIC 0x02
struct pacs_update_characteristic_cmd {
uint8_t char_id;
} __packed;

#define BTP_PACS_SET_LOCATION 0x03

#define BTP_PACS_SET_AVAILABLE_CONTEXTS 0x04
struct pacs_set_available_contexts_cmd {
uint16_t sink_contexts;
uint16_t source_contexts;
} __packed;

#define BTP_PACS_SET_SUPPORTED_CONTEXTS 0x05
struct pacs_set_supported_contexts_cmd {
uint16_t sink_contexts;
uint16_t source_contexts;
} __packed;

#define BTP_PACS_CHARACTERISTIC_SINK_PAC 0x01
#define BTP_PACS_CHARACTERISTIC_SOURCE_PAC 0x02
#define BTP_PACS_CHARACTERISTIC_SINK_AUDIO_LOCATIONS 0x03
#define BTP_PACS_CHARACTERISTIC_SOURCE_AUDIO_LOCATIONS 0x04
#define BTP_PACS_CHARACTERISTIC_AVAILABLE_AUDIO_CONTEXTS 0x05

#endif /* BTP_PACS_H*/
7 changes: 7 additions & 0 deletions apps/bttester/src/btp/bttester.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,12 @@ uint8_t
tester_unregister_bap(void);
#endif /* MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE) */

#if MYNEWT_VAL(BLE_AUDIO)
uint8_t
tester_init_pacs(void);
uint8_t
tester_unregister_pacs(void);
#endif /* MYNEWT_VAL(BLE_AUDIO) */

#endif /* __BTTESTER_H__ */

10 changes: 10 additions & 0 deletions apps/bttester/src/btp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ register_service(const void *cmd, uint16_t cmd_len,
status = tester_init_bap();
break;
#endif /* MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE) */
#if MYNEWT_VAL(BLE_AUDIO)
case BTP_SERVICE_ID_PACS:
status = tester_init_pacs();
break;
#endif /* MYNEWT(BLE_AUDIO) */
case BTP_SERVICE_ID_GATTC:
status = tester_init_gatt_cl();
break;
Expand Down Expand Up @@ -164,6 +169,11 @@ unregister_service(const void *cmd, uint16_t cmd_len,
status = tester_unregister_bap();
break;
#endif /* MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE) */
#if MYNEWT_VAL(BLE_AUDIO)
case BTP_SERVICE_ID_PACS:
status = tester_unregister_pacs();
break;
#endif /* MYNEWT_VAL (BLE_AUDIO) */
default:
status = BTP_STATUS_FAILED;
break;
Expand Down
Loading

0 comments on commit 66040b3

Please sign in to comment.