56 #include "ble_srv_common.h" 57 #include "app_util_platform.h" 58 #include "drv_audio_config.h" 62 #define BLE_UUID_TSS_SERVICE 0x0500 63 #define BLE_TSS_MAX_DATA_LEN (BLE_GATT_ATT_MTU_DEFAULT - 3) 70 #define PACKED(TYPE) TYPE __attribute__ ((packed)) 73 #define BLE_TSS_SPKR_STAT_FINISHED 0x00 74 #define BLE_TSS_SPKR_STAT_BUFFER_WARNING 0x01 75 #define BLE_TSS_SPKR_STAT_BUFFER_READY 0x02 76 #define BLE_TSS_SPKR_STAT_PACKET_DISREGARDED 0x10 77 #define BLE_TSS_SPKR_STAT_INVALID_COMMAND 0x11 79 #define BLE_TSS_MIC_FRAME_SIZE CONFIG_AUDIO_FRAME_SIZE_BYTES 81 typedef uint8_t ble_tss_spkr_stat_t;
83 typedef uint8_t ble_tss_spkr_sample_t;
85 typedef PACKED(
struct 90 }) ble_tss_spkr_freq_t;
94 ble_tss_spkr_freq_t freq;
96 ble_tss_spkr_sample_t sample_id;
102 uint8_t raw[BLE_TSS_MIC_FRAME_SIZE];
107 BLE_TSS_SPKR_MODE_FIRST,
108 BLE_TSS_SPKR_MODE_FREQ,
109 BLE_TSS_SPKR_MODE_PCM,
110 BLE_TSS_SPKR_MODE_SAMPLE,
111 BLE_TSS_SPKR_MODE_LAST
112 } ble_tss_spkr_mode_t;
116 BLE_TSS_MIC_MODE_FIRST,
117 BLE_TSS_MIC_MODE_ADPCM,
118 BLE_TSS_MIC_MODE_SPL,
119 BLE_TSS_MIC_MODE_LAST
120 } ble_tss_mic_mode_t;
122 typedef PACKED(
struct 124 ble_tss_spkr_mode_t spkr_mode;
125 ble_tss_mic_mode_t mic_mode;
128 #define BLE_TSS_CONFIG_SPKR_MODE_MIN (BLE_TSS_SPKR_MODE_FIRST + 1) 129 #define BLE_TSS_CONFIG_SPKR_MODE_MAX (BLE_TSS_SPKR_MODE_LAST - 1) 130 #define BLE_TSS_CONFIG_MIC_MODE_MIN (BLE_TSS_MIC_MODE_FIRST + 1) 131 #define BLE_TSS_CONFIG_MIC_MODE_MAX (BLE_TSS_MIC_MODE_LAST - 1) 135 BLE_TSS_EVT_NOTIF_MIC,
136 BLE_TSS_EVT_CONFIG_RECEIVED,
137 BLE_TSS_EVT_SPKR_RECEIVED,
138 BLE_TSS_EVT_NOTIF_SPKR_STAT
146 ble_tss_evt_type_t evt_type,
157 ble_tss_config_t * p_init_config;
213 uint32_t
ble_tss_mic_set(ble_tss_t * p_tss, uint8_t * p_data, uint16_t size);
226 #endif // BLE_TSS_H__ ble_gatts_char_handles_t spkr_stat_handles
Definition: ble_tss.h:171
uint32_t ble_tss_mic_set(ble_tss_t *p_tss, uint8_t *p_data, uint16_t size)
Function for sending microphone data.
ble_tss_evt_handler_t evt_handler
Definition: ble_tss.h:158
bool is_spkr_stat_notif_enabled
Definition: ble_tss.h:175
ble_gatts_char_handles_t config_handles
Definition: ble_tss.h:172
uint16_t service_handle
Definition: ble_tss.h:168
ble_gatts_char_handles_t mic_handles
Definition: ble_tss.h:170
uint32_t ble_tss_spkr_stat_set(ble_tss_t *p_tss, ble_tss_spkr_stat_t status)
Function for sending speaker status.
Thingy Sound Service structure.
Definition: ble_tss.h:165
Thingy Sound Service initialization structure.
Definition: ble_tss.h:155
bool is_mic_notif_enabled
Definition: ble_tss.h:174
ble_tss_evt_handler_t evt_handler
Definition: ble_tss.h:176
uint16_t conn_handle
Definition: ble_tss.h:173
uint32_t ble_tss_init(ble_tss_t *p_tss, const ble_tss_init_t *p_tss_init)
Function for initializing the Thingy Sound Service.
ble_gatts_char_handles_t spkr_handles
Definition: ble_tss.h:169
void ble_tss_on_ble_evt(ble_tss_t *p_tss, ble_evt_t *p_ble_evt)
Function for handling the Thingy Sound Service's BLE events.
void(* ble_tss_evt_handler_t)(ble_tss_t *p_tss, ble_tss_evt_type_t evt_type, uint8_t *p_data, uint16_t length)
Thingy Sound Service event handler type.
Definition: ble_tss.h:145
uint8_t uuid_type
Definition: ble_tss.h:167