Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for PACS autopts tests #1747

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
KKopyscinski marked this conversation as resolved.
Show resolved Hide resolved
- "@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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

define those right after opcode (so that opcode, cmd struct and rsp stuct are in one place)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

uint8_t data[0];
} __packed;

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

#define BTP_PACS_SET_LOCATION 0x03

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

#define BTP_PACS_SET_SUPPORTED_CONTEXTS 0x05
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmd struct seems to be missing for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

struct btp_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
Loading