aboutsummaryrefslogtreecommitdiffstats
path: root/src/ahl-binding.h
diff options
context:
space:
mode:
authorTai Vuong <tvuong@audiokinetic.com>2017-10-16 10:09:38 -0400
committerTai Vuong <tvuong@audiokinetic.com>2017-10-16 10:09:38 -0400
commit9b7e1d0361d1a5eee415e453ae79925084552c68 (patch)
tree19ef4489e2fb2932b1ce8106489fd1ee9507303b /src/ahl-binding.h
parent539f65bb5ad87238422a5ca26c5b524c3be44bd1 (diff)
add policy and reference implementation
Diffstat (limited to 'src/ahl-binding.h')
-rw-r--r--src/ahl-binding.h42
1 files changed, 30 insertions, 12 deletions
diff --git a/src/ahl-binding.h b/src/ahl-binding.h
index 508ca0a..8f308d5 100644
--- a/src/ahl-binding.h
+++ b/src/ahl-binding.h
@@ -31,12 +31,22 @@
#define AHL_POLICY_ACCEPT 1
#define AHL_POLICY_REJECT 0
+#define AHL_ACCESS_CONTROL_GRANTED 1
+#define AHL_ACCESS_CONTROL_DENIED 0
#define AHL_UNDEFINED -1
typedef int endpointID_t;
typedef int streamID_t;
+// Define default behavior of audio role when interrupted by higher priority sources
+typedef enum InterruptedBehavior {
+ AHL_INTERRUPTEDBEHAVIOR_CONTINUE = 0, // Continue to play when interrupted (e.g. media may be ducked)
+ AHL_INTERRUPTEDBEHAVIOR_CANCEL, // Abort playback when interrupted (e.g. non-important HMI feedback that does not make sense later)
+ AHL_INTERRUPTEDBEHAVIOR_PAUSE, // Pause source when interrupted, to be resumed afterwards (e.g. non-temporal guidance)
+ AHL_INTERRUPTEDBEHAVIOR_MAXVALUE, // Enum count, keep at the end
+} InterruptedBehaviorT;
+
typedef enum EndpointSelectionMode {
AHL_ENDPOINTSELMODE_AUTO = 0, // Automatic endpoint selection based on config priority
AHL_ENDPOINTSELMODE_MANUAL, // Explicit endpoint selection
@@ -61,7 +71,8 @@ typedef struct EndpointInfo
{
endpointID_t endpointID; // Unique endpoint ID (per type)
EndpointTypeT type; // Source or sink device
- GString * gsDeviceName; // Device name for applications to display
+ GString * gsDeviceName; // Unique device card name
+ GString * gsDisplayName; // Application display name
GString * gsDeviceURI; // Associated URI
DeviceURITypeT deviceURIType; // Device URI type (includes audio domain information)
GString * gsAudioRole; // Audio role that registered this endpoint
@@ -75,7 +86,7 @@ typedef struct EndpointInfo
typedef struct StreamInfo {
streamID_t streamID; // Stream unique ID
EndpointInfoT * pEndpointInfo; // Associated endpoint information
- StreamStateT streamState; // Stream activity state
+ StreamStateT streamState; // Stream activity state
StreamMuteT streamMute; // Stream mute state
struct afb_event streamStateEvent; // Stream specific event for stream state changes
EndpointSelectionModeT endpointSelMode; // Automatic (priority based) or manual endpoint selection
@@ -103,8 +114,15 @@ typedef struct AHLCtx {
endpointID_t nextSinkEndpointID; // Counter to assign new ID
endpointID_t nextStreamID; // Counter to assign new ID
GArray * pHALList; // List of HAL dependencies
+ int iNumActiveClients; // Number of clients with active stream(s)
} AHLCtxT;
+// Client specific binding context
+typedef struct AHLClientCtx {
+ GArray * pEndpointAccessList; // List of endpoints that client has control over
+ GArray * pStreamAccessList; // List of streams that client has control over
+} AHLClientCtxT;
+
// ahl-binding.c
PUBLIC int AhlBindingInit();
PUBLIC void AhlOnEvent(const char *evtname, json_object *eventJ);
@@ -117,17 +135,17 @@ void TermEndpoints();
int ParseHLBConfig();
// ahl-policy.c
int Policy_Endpoint_Property_Init(EndpointInfoT * io_pEndpointInfo);
-int Policy_Init();
-void Policy_Term();
-int Policy_OpenStream(char *pAudioRole, EndpointTypeT endpointType, endpointID_t endpointID);
-int Policy_CloseStream(streamID_t streamID);
-int Policy_SetStreamState(streamID_t streamID, StreamStateT streamState );
-int Policy_SetStreamMute(streamID_t streamID, StreamMuteT streamMute);
-int Policy_SetVolume(EndpointTypeT endpointType, endpointID_t endpointID, char *volumeStr);
-int Policy_SetProperty(EndpointTypeT endpointType, endpointID_t endpointID, char *propertyName, char *propValueStr);
+int Policy_OpenStream(StreamInfoT * pStreamInfo);
+int Policy_CloseStream(StreamInfoT * pStreamInfo);
+int Policy_SetStreamState(StreamInfoT * pStreamInfo, int AudioRoleIndex, StreamStateT streamState);
+int Policy_SetStreamMute(StreamInfoT * pStreamInfo, StreamMuteT streamMute);
int Policy_PostEvent(char *eventName, char *audioRole, char *mediaName, void *audioContext);
int Policy_AudioDeviceChange();
-
-
+int Policy_SetVolume(EndpointInfoT * f_pEndpointInfo, char *volumeStr);
+//Todo
+int Policy_SetProperty(EndpointInfoT * f_pEndpointInfo, char *propertyName, json_object *propValue);
+int Policy_Init();
+void Policy_Term();
+void Policy_OnEvent(const char *evtname, json_object *eventJ);
#endif // AHL_BINDING_INCLUDE