nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
ams_client.h File Reference
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/conn.h>
#include <bluetooth/gatt_dm.h>

Go to the source code of this file.

Data Structures

struct  bt_ams_entity_attribute
 Structure for Entity Attribute pair. More...
 
struct  bt_ams_entity_attribute_list
 Structure for Entity Attribute pair list. More...
 
struct  bt_ams_entity_update_notif
 Structure for Entity Update notification. More...
 
struct  bt_ams_client
 AMS client structure, which contains various status information for the client. More...
 
struct  bt_ams_client::bt_ams_remote_command_characteristic
 
struct  bt_ams_client::bt_ams_entity_update_characteristic
 
struct  bt_ams_client::bt_ams_entity_attribute_characteristic
 

Macros

#define BT_UUID_AMS_VAL    BT_UUID_128_ENCODE(0x89d3502b, 0x0f36, 0x433a, 0x8ef4, 0xc502ad55f8dc)
 Apple Media Service UUID.
 
#define BT_UUID_AMS_REMOTE_COMMAND_VAL    BT_UUID_128_ENCODE(0x9b3c81d8, 0x57b1, 0x4a8a, 0xb8df, 0x0e56f7ca51c2)
 Remote Command Characteristic UUID.
 
#define BT_UUID_AMS_ENTITY_UPDATE_VAL    BT_UUID_128_ENCODE(0x2f7cabce, 0x808d, 0x411f, 0x9a0c, 0xbb92ba96c102)
 Entity Update Characteristic UUID.
 
#define BT_UUID_AMS_ENTITY_ATTRIBUTE_VAL    BT_UUID_128_ENCODE(0xc6b2f38c, 0x23ab, 0x46d8, 0xa6ab, 0xa3a870bbd5d7)
 Entity Attribute Characteristic UUID.
 
#define BT_UUID_AMS   BT_UUID_DECLARE_128(BT_UUID_AMS_VAL)
 
#define BT_UUID_AMS_REMOTE_COMMAND    BT_UUID_DECLARE_128(BT_UUID_AMS_REMOTE_COMMAND_VAL)
 
#define BT_UUID_AMS_ENTITY_UPDATE    BT_UUID_DECLARE_128(BT_UUID_AMS_ENTITY_UPDATE_VAL)
 
#define BT_UUID_AMS_ENTITY_ATTRIBUTE   BT_UUID_DECLARE_128(BT_UUID_AMS_ENTITY_ATTRIBUTE_VAL)
 
#define BT_AMS_EU_NOTIF_ENTITY_IDX   0
 Entity Update notification: Entity index.
 
#define BT_AMS_EU_NOTIF_ATTRIBUTE_IDX   1
 Entity Update notification: Attribute index.
 
#define BT_AMS_EU_NOTIF_FLAGS_IDX   2
 Entity Update notification: Flags index.
 
#define BT_AMS_EU_NOTIF_VALUE_IDX   3
 Entity Update notification: Value index.
 
#define BT_AMS_ENTITY_UPDATE_FLAG_TRUNCATED   0
 Entity Update flag: truncated.
 
#define BT_AMS_EU_CMD_ENTITY_IDX   0
 Entity Update command: Entity index.
 
#define BT_AMS_EU_CMD_ATTRIBUTE_IDX   1
 Entity Update command: Attribute index.
 
#define BT_AMS_EU_CMD_ATTRIBUTE_COUNT_MAX   4
 Entity Update command: Maximum value of Attribute ID count.
 
#define BT_AMS_EA_CMD_ENTITY_IDX   0
 Entity Attribute command: Entity index.
 
#define BT_AMS_EA_CMD_ATTRIBUTE_IDX   1
 Entity Attribute command: Attribute index.
 
#define BT_AMS_EA_CMD_LEN   2
 Entity Attribute command length.
 
#define BT_ATT_ERR_AMS_MS_INVALID_STATE   0xA0
 AMS error code: MS is not properly set up.
 
#define BT_ATT_ERR_AMS_MS_INVALID_COMMAND   0xA1
 AMS error code: The command format is invalid.
 
#define BT_ATT_ERR_AMS_MS_ABSENT_ATTRIBUTE   0xA2
 AMS error code: The entity attribute is empty.
 

Typedefs

typedef void(* bt_ams_remote_command_notify_cb) (struct bt_ams_client *ams_c, const uint8_t *data, size_t len)
 Remote Command notification callback function.
 
typedef void(* bt_ams_entity_update_notify_cb) (struct bt_ams_client *ams_c, const struct bt_ams_entity_update_notif *notif, int err)
 Entity Update notification callback function.
 
typedef void(* bt_ams_write_cb) (struct bt_ams_client *ams_c, uint8_t err)
 Write response callback function.
 
typedef void(* bt_ams_read_cb) (struct bt_ams_client *ams_c, uint8_t err, const uint8_t *data, size_t len)
 Read response callback function.
 

Enumerations

enum  bt_ams_remote_command_id {
  BT_AMS_REMOTE_COMMAND_ID_PLAY , BT_AMS_REMOTE_COMMAND_ID_PAUSE , BT_AMS_REMOTE_COMMAND_ID_TOGGLE_PLAY_PAUSE , BT_AMS_REMOTE_COMMAND_ID_NEXT_TRACK ,
  BT_AMS_REMOTE_COMMAND_ID_PREVIOUS_TRACK , BT_AMS_REMOTE_COMMAND_ID_VOLUME_UP , BT_AMS_REMOTE_COMMAND_ID_VOLUME_DOWN , BT_AMS_REMOTE_COMMAND_ID_ADVANCE_REPEAT_MODE ,
  BT_AMS_REMOTE_COMMAND_ID_ADVANCE_SHUFFLE_MODE , BT_AMS_REMOTE_COMMAND_ID_SKIP_FORWARD , BT_AMS_REMOTE_COMMAND_ID_SKIP_BACKWARD , BT_AMS_REMOTE_COMMAND_ID_LIKE_TRACK ,
  BT_AMS_REMOTE_COMMAND_ID_DISLIKE_TRACK , BT_AMS_REMOTE_COMMAND_ID_BOOKMARK_TRACK
}
 Remote Command ID values. More...
 
enum  bt_ams_entity_id { BT_AMS_ENTITY_ID_PLAYER , BT_AMS_ENTITY_ID_QUEUE , BT_AMS_ENTITY_ID_TRACK }
 Entity ID values. More...
 
enum  bt_ams_player_attribute_id { BT_AMS_PLAYER_ATTRIBUTE_ID_NAME , BT_AMS_PLAYER_ATTRIBUTE_ID_PLAYBACK_INFO , BT_AMS_PLAYER_ATTRIBUTE_ID_VOLUME }
 Player Attribute ID values. More...
 
enum  bt_ams_queue_attribute_id { BT_AMS_QUEUE_ATTRIBUTE_ID_INDEX , BT_AMS_QUEUE_ATTRIBUTE_ID_COUNT , BT_AMS_QUEUE_ATTRIBUTE_ID_SHUFFLE_MODE , BT_AMS_QUEUE_ATTRIBUTE_ID_REPEAT_MODE }
 Queue Attribute ID values. More...
 
enum  bt_ams_shuffle_mode { BT_AMS_SHUFFLE_MODE_OFF , BT_AMS_SHUFFLE_MODE_ONE , BT_AMS_SHUFFLE_MODE_ALL }
 Shuffle Mode constants. More...
 
enum  bt_ams_repeat_mode { BT_AMS_REPEAT_MODE_OFF , BT_AMS_REPEAT_MODE_ONE , BT_AMS_REPEAT_MODE_ALL }
 Repeat Mode constants. More...
 
enum  bt_ams_track_attribute_id { BT_AMS_TRACK_ATTRIBUTE_ID_ARTIST , BT_AMS_TRACK_ATTRIBUTE_ID_ALBUM , BT_AMS_TRACK_ATTRIBUTE_ID_TITLE , BT_AMS_TRACK_ATTRIBUTE_ID_DURATION }
 Track Attribute ID values. More...
 

Functions

int bt_ams_client_init (struct bt_ams_client *ams_c)
 Initialize the AMS Client instance.
 
int bt_ams_handles_assign (struct bt_gatt_dm *dm, struct bt_ams_client *ams_c)
 Assign handles to the AMS Client instance.
 
int bt_ams_subscribe_remote_command (struct bt_ams_client *ams_c, bt_ams_remote_command_notify_cb func)
 Subscribe to the Remote Command notification.
 
int bt_ams_unsubscribe_remote_command (struct bt_ams_client *ams_c)
 Unsubscribe from the Remote Command notification.
 
int bt_ams_subscribe_entity_update (struct bt_ams_client *ams_c, bt_ams_entity_update_notify_cb func)
 Subscribe to the Entity Update notification.
 
int bt_ams_unsubscribe_entity_update (struct bt_ams_client *ams_c)
 Unsubscribe from the Entity Update notification.
 
int bt_ams_write_remote_command (struct bt_ams_client *ams_c, enum bt_ams_remote_command_id command, bt_ams_write_cb func)
 Write data to the Remote Command characteristic.
 
int bt_ams_write_entity_update (struct bt_ams_client *ams_c, const struct bt_ams_entity_attribute_list *ent_attr_list, bt_ams_write_cb func)
 Write data to the Entity Update characteristic.
 
int bt_ams_write_entity_attribute (struct bt_ams_client *ams_c, const struct bt_ams_entity_attribute *ent_attr, bt_ams_write_cb func)
 Write data to the Entity Attribute characteristic.
 
int bt_ams_read_entity_attribute (struct bt_ams_client *ams_c, bt_ams_read_cb func)
 Read data from the Entity Attribute characteristic.