-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds Published Audio Capabilities Service/Prifile. In pair ble_audio_codec module is added, that supports registering supported codecs with their corresponding configurations.
- Loading branch information
1 parent
e5acfe0
commit 524ff53
Showing
16 changed files
with
851 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* 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 H_BLE_AUDIO_CODEC_ | ||
#define H_BLE_AUDIO_CODEC_ | ||
|
||
#include "stdint.h" | ||
#include "ble_audio_common.h" | ||
|
||
#define BLE_AUDIO_CODEC_FLAG_SOURCE 0x01 | ||
#define BLE_AUDIO_CODEC_FLAG_SINK 0x02 | ||
|
||
typedef int ble_audio_codec_parser(uint8_t codec_spec_caps_len, | ||
uint8_t *codec_spec_caps, | ||
void *cb_arg); | ||
|
||
struct ble_audio_codec_record { | ||
STAILQ_ENTRY(ble_audio_codec_record) next; | ||
struct ble_audio_codec_id codec_id; | ||
uint8_t codec_spec_caps_len; | ||
uint8_t *codec_spec_caps; | ||
uint8_t metadata_len; | ||
uint8_t *metadata; | ||
uint8_t flags; | ||
ble_audio_codec_parser *parser; | ||
void *parser_arg; | ||
}; | ||
|
||
/** Type definition for GATT service iteration callback function. */ | ||
typedef int ble_audio_codec_foreach_fn(struct ble_audio_codec_record * | ||
record, void *arg); | ||
|
||
int ble_audio_codec_register(struct ble_audio_codec_id codec_id, | ||
uint8_t codec_spec_caps_len, | ||
uint8_t *codec_spec_caps, | ||
uint8_t metadata_len, | ||
uint8_t *metadata, | ||
uint8_t flags, | ||
ble_audio_codec_parser *cb, | ||
void *cb_arg); | ||
|
||
int ble_audio_codec_unregister(struct ble_audio_codec_record *codec_record); | ||
|
||
int ble_audio_codec_foreach(ble_audio_codec_foreach_fn *cb, void *arg); | ||
|
||
#endif /* H_BLE_AUDIO_CODEC_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
nimble/host/services/audio/pacs/include/services/pacs/ble_audio_svc_pacs.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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 H_BLE_AUDIO_SVC_PACS_ | ||
#define H_BLE_AUDIO_SVC_PACS_ | ||
|
||
#define BLE_SVC_AUDIO_PACS_UUID16 0x1850 | ||
#define BLE_SVC_AUDIO_PACS_CHR_UUID16_SINK_PAC 0x2BC9 | ||
#define BLE_SVC_AUDIO_PACS_CHR_UUID16_SINK_AUDIO_LOCATIONS 0x2BCA | ||
#define BLE_SVC_AUDIO_PACS_CHR_UUID16_SOURCE_PAC 0x2BCB | ||
#define BLE_SVC_AUDIO_PACS_CHR_UUID16_SOURCE_AUDIO_LOCATIONS 0x2BCC | ||
#define BLE_SVC_AUDIO_PACS_CHR_UUID16_AVAILABLE_AUDIO_CONTEXTS 0x2BCD | ||
#define BLE_SVC_AUDIO_PACS_CHR_UUID16_SUPPORTED_AUDIO_CONTEXTS 0x2BCE | ||
|
||
int ble_svc_audio_pacs_set_sink_audio_loc(uint32_t audio_locations); | ||
int ble_svc_audio_pacs_set_source_audio_loc(uint32_t audio_locations); | ||
int ble_svc_audio_pacs_set_sup_contexts(uint16_t sink_contexts, | ||
uint16_t source_contexts); | ||
int ble_svc_audio_pacs_set_avail_contexts(uint16_t conn_handle, | ||
uint16_t sink_contexts, | ||
uint16_t source_contexts); | ||
|
||
#endif /* H_BLE_AUDIO_SVC_PACS_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# 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. | ||
|
||
pkg.name: nimble/host/services/audio/pacs | ||
pkg.description: Published Audio Capabilities Service | ||
pkg.author: "Apache Mynewt <[email protected]>" | ||
pkg.homepage: "http://mynewt.apache.org/" | ||
pkg.keywords: | ||
- ble | ||
- bluetooth | ||
- pacs | ||
- nimble | ||
|
||
pkg.deps: | ||
- nimble/host | ||
|
||
pkg.init: | ||
ble_svc_audio_pacs_init: 'MYNEWT_VAL(BLE_SVC_AUDIO_PACS_SYSINIT_STAGE)' |
Oops, something went wrong.