PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
Audio endpoint

Streams encoded audio frames from the watch to the phone. More...

Data Structures

struct  DataTransferMsg
 Audio data message. More...
 
struct  StopTransferMsg
 Stop transfer message. More...
 

Macros

#define AUDIO_ENDPOINT_SESSION_INVALID_ID   (0)
 Invalid session identifier.
 

Typedefs

typedef uint16_t AudioEndpointSessionId
 Identifies a transfer session.
 
typedef void(* AudioEndpointStopTransferCallback) (AudioEndpointSessionId session_id)
 Called when the phone asks to stop a transfer.
 

Enumerations

enum  MsgId { MsgIdDataTransfer = 0x02 , MsgIdStopTransfer = 0x03 }
 Audio endpoint message types. More...
 

Functions

AudioEndpointSessionId audio_endpoint_setup_transfer (AudioEndpointStopTransferCallback stop_transfer)
 Create a session for transferring audio from the watch to the phone.
 
void audio_endpoint_add_frame (AudioEndpointSessionId session_id, uint8_t *frame, uint8_t frame_size)
 Send a frame of encoded audio.
 
void audio_endpoint_stop_transfer (AudioEndpointSessionId session_id)
 End a transfer and send a stop transfer message to the phone.
 
void audio_endpoint_cancel_transfer (AudioEndpointSessionId session_id)
 End a transfer without notifying the phone.
 

Detailed Description

Streams encoded audio frames from the watch to the phone.

Only one transfer session can be active at a time. While a session is active, the Bluetooth connection is kept in its low latency mode. Frames that do not fit in the send buffer are dropped.

audio_endpoint_add_frame(id, frame, frame_size);
}
AudioEndpointSessionId audio_endpoint_setup_transfer(AudioEndpointStopTransferCallback stop_transfer)
Create a session for transferring audio from the watch to the phone.
uint16_t AudioEndpointSessionId
Identifies a transfer session.
Definition audio_endpoint.h:29
void audio_endpoint_add_frame(AudioEndpointSessionId session_id, uint8_t *frame, uint8_t frame_size)
Send a frame of encoded audio.
#define AUDIO_ENDPOINT_SESSION_INVALID_ID
Invalid session identifier.
Definition audio_endpoint.h:31
void audio_endpoint_stop_transfer(AudioEndpointSessionId session_id)
End a transfer and send a stop transfer message to the phone.

Data Structure Documentation

◆ DataTransferMsg

struct DataTransferMsg

Audio data message.

Data Fields
uint8_t frame_count Number of frames that follow.
uint8_t frames[] Frames, each a length byte followed by that many bytes of encoded audio.
MsgId msg_id MsgIdDataTransfer.
AudioEndpointSessionId session_id Transfer session.

◆ StopTransferMsg

struct StopTransferMsg

Stop transfer message.

Data Fields
MsgId msg_id MsgIdStopTransfer.
AudioEndpointSessionId session_id Transfer session.

Macro Definition Documentation

◆ AUDIO_ENDPOINT_SESSION_INVALID_ID

#define AUDIO_ENDPOINT_SESSION_INVALID_ID   (0)

Invalid session identifier.

Typedef Documentation

◆ AudioEndpointSessionId

typedef uint16_t AudioEndpointSessionId

Identifies a transfer session.

◆ AudioEndpointStopTransferCallback

typedef void(* AudioEndpointStopTransferCallback) (AudioEndpointSessionId session_id)

Called when the phone asks to stop a transfer.

Parameters
session_idSession being stopped.

Enumeration Type Documentation

◆ MsgId

enum MsgId

Audio endpoint message types.

Enumerator
MsgIdDataTransfer 

Audio frames, watch to phone.

MsgIdStopTransfer 

End of transfer, in either direction.

Function Documentation

◆ audio_endpoint_add_frame()

void audio_endpoint_add_frame ( AudioEndpointSessionId  session_id,
uint8_t *  frame,
uint8_t  frame_size 
)

Send a frame of encoded audio.

Ignored if session_id is not the active session. Never blocks; the frame is dropped if the send buffer is full.

Parameters
session_idSession returned by audio_endpoint_setup_transfer().
frameEncoded audio data.
frame_sizeSize of frame in bytes.

◆ audio_endpoint_cancel_transfer()

void audio_endpoint_cancel_transfer ( AudioEndpointSessionId  session_id)

End a transfer without notifying the phone.

The stop callback is not called.

Parameters
session_idSession returned by audio_endpoint_setup_transfer().

◆ audio_endpoint_setup_transfer()

AudioEndpointSessionId audio_endpoint_setup_transfer ( AudioEndpointStopTransferCallback  stop_transfer)

Create a session for transferring audio from the watch to the phone.

Parameters
stop_transferCalled when the phone sends a stop transfer message.
Returns
Session identifier, or AUDIO_ENDPOINT_SESSION_INVALID_ID if a session is already active.

◆ audio_endpoint_stop_transfer()

void audio_endpoint_stop_transfer ( AudioEndpointSessionId  session_id)

End a transfer and send a stop transfer message to the phone.

The stop callback is not called.

Parameters
session_idSession returned by audio_endpoint_setup_transfer().